1679054344

The physical symbolic regression ( Φ-SO ) package `physo`

is a symbolic regression package that fully leverages physical units constraints. For more details see: [Tenachi et al 2023].

Installation

The package has been tested on Unix and OSX. To install the package it is recommend to first create a conda virtual environment:

```
conda create -n PhySO python=3.8
```

And activate it:

```
conda activate PhySO
```

From the repository root:

Installing essential dependencies :

```
conda install --file requirements.txt
```

Installing optional dependencies (for advanced debugging in tree representation) :

```
conda install --file requirements_display1.txt
```

```
pip install -r requirements_display2.txt
```

Side note regarding CUDA acceleration:

$\Phi$-SO supports CUDA but it should be noted that since the bottleneck of the code is free constant optimization, using CUDA (even on a very high-end GPU) does not improve performances over a CPU and can actually hinder performances.

Installing `physo`

(from the repository root):

```
pip install -e .
```

Import test:

```
python3
>>> import physo
```

This should result in `physo`

being successfully imported.

Unit tests:

From the repository root:

```
python -m unittest discover -p "*UnitTest.py"
```

This should result in all tests being successfully passed (except for program_display_UnitTest tests if optional dependencies were not installed).

Getting started

[Coming soon] In the meantime you can have a look at our demo folder ! :)

[Coming soon]

[Coming soon]

[Coming soon]

[Coming soon]

About performances

The main performance bottleneck of `physo`

is free constant optimization, therefore, performances are almost linearly dependent on the number of free constant optimization steps and on the number of trial expressions per epoch (ie. the batch size).

In addition, it should be noted that generating monitoring plots takes ~3s, therefore we suggest making monitoring plots every >10 epochs for low time / epoch cases.

Summary of expected performances with `physo`

:

Time / epoch | Batch size | # free const | free const opti steps | Example | Device |
---|---|---|---|---|---|

~20s | 10k | 2 | 15 | eg: demo_damped_harmonic_oscillator | CPU: Mac M1 RAM: 16 Go |

~30s | 10k | 2 | 15 | eg: demo_damped_harmonic_oscillator | CPU: Intel W-2155 10c/20t RAM: 128 Go |

~250s | 10k | 2 | 15 | eg: demo_damped_harmonic_oscillator | GPU: Nvidia GV100 VRAM : 32 Go |

~3s | 1k | 2 | 15 | eg: demo_mechanical_energy | CPU: Mac M1 RAM: 16 Go |

~3s | 1k | 2 | 15 | eg: demo_mechanical_energy | CPU: Intel W-2155 10c/20t RAM: 128 Go |

~4s | 1k | 2 | 15 | eg: demo_mechanical_energy | GPU: Nvidia GV100 VRAM : 32 Go |

Please note that using a CPU typically results in higher performances than when using a GPU.

Uninstalling

Uninstalling the package.

```
conda deactivate
conda env remove -n PhySO
```

Citing this work

```
@ARTICLE{2023arXiv230303192T,
author = {{Tenachi}, Wassim and {Ibata}, Rodrigo and {Diakogiannis}, Foivos I.},
title = "{Deep symbolic regression for physics guided by units constraints: toward the automated discovery of physical laws}",
journal = {arXiv e-prints},
keywords = {Astrophysics - Instrumentation and Methods for Astrophysics, Computer Science - Machine Learning, Physics - Computational Physics},
year = 2023,
month = mar,
eid = {arXiv:2303.03192},
pages = {arXiv:2303.03192},
doi = {10.48550/arXiv.2303.03192},
archivePrefix = {arXiv},
eprint = {2303.03192},
primaryClass = {astro-ph.IM},
adsurl = {https://ui.adsabs.harvard.edu/abs/2023arXiv230303192T},
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}
```

Author: WassimTenachi

Source Code: https://github.com/WassimTenachi/PhySO

License: MIT license

1666142220

*Symbolic mathematics language*

Static snapshots of Symata tutorial notebooks at `nbviewer.jupyter.org`

. These are the same notebooks found in the TutorialNotebooks directory in this repositoy. But the rendering at `nbviewer`

is better.

Symata-language test directory (note this is `symata_test`

, not `test`

)

Symata functions written in Symata.

When running Symata

`TAB`

completion`? Topic`

(with completion)`h"word"`

regular expression search`Help()`

and`Help(topic)`

NumericalMethodsforEngineers.jl uses Symata. Example code is found in

- examples/ch04/
- Ex.7.13.function.jl
- Several files in the test directory

If you have a question or a request, or want to contribute, please open an issue here on github.

a language for symbolic computations and mathematics, where, for the most part, "mathematics" means what it typically does for a scientist or engineer.

a language based mostly on expressions, on "evaluating" and rewriting them, like Wolfram, Maple, or Maxima. It is neither a language, nor an extension of a language, that is mostly procedural, or designed around data types and functions, or a hierarchy of classes, etc., like C or Python or Java. Nor is it language like Sage; that is, one meant to provide a unifying interface to a number of mathematics languages with various programming models.

meant to be useful to people who do not like to program computers, as well as those who do. The former includes people who prefer not to think about classes, methods, objects, dispatch, stack traces, etc.

Symata is largely modeled on the pattern matching and evaluation sequence of Mathematica. Evaluation, pattern matching, flow control, etc. are written in Julia. Much of the mathematics and symbolic manipulation is achieved by wrapping SymPy. There are more than 600 functions implemented, including integration, transformation of special functions, expression manipulation, writing and reading expressions to and from a file etc.

Symata is a registered module. It can be installed like this

```
(v0.7) pkg> add Symata
julia> using Symata
symata> Help() # type '=' alone on a line to enter symata mode
```

`Symata`

can be installed on Linux, OSX, and Windows.

`Symata`

depends on the `PyCall`

package and the python SymPy module. You can install SymPy via `pip install sympy`

. Symata is compatible with SymPy v1.0 and v1.2 (and probably v1.1).

Alternatively, you may install SymPy via `Conda.jl`

. When you load `Symata`

with `using Symata`

, `sympy`

is installed automatically via `PyCall`

, which uses `Conda`

. However, to do this, `PyCall`

must be configured to not use you system version of `python`

. If you do not have `PyCall`

installed, do this

```
julia> ENV["PYTHON"]=""
julia> Pkg.add("PyCall")
```

If you *do* have `PyCall`

installed, but it is configured to use your system `python`

, reconfigure it like this.

```
julia> ENV["PYTHON"]=""
julia> Pkg.build("PyCall")
```

If you use linux, you may have your distribution's `sympy`

package installed and it may be out of date. In this case, try the procedure above, and/or try removing your distribution's `sympy`

package.

`SymPy`

, or `sympy`

, here refers to the python SymPy distribution (sometimes called sympy), *not* the Julia package `SymPy`

. `Symata`

does not require the Julia package SymPy.jl, which has a different goal.

Symata requires `mpmath`

package for python. This should be automatically installed when installing `sympy`

via `PyCall`

as described above. This also works on OSX. However, if you use `pip`

, you should just be able to run `pip install mpmath`

.

See below for instructions on precompiling Symata to get more-or-less instant start up and many precompiled function calls.

Three environments for running `Symata`

are supported: the `Julia`

REPL, `Jupyter`

, and a dumb terminal.

A `Symata`

mode is added to the `Julia`

REPL. Enter the mode by typing `=`

as the first character. Exit the mode by typing `backspace`

as the first character.

```
julia> using Symata
symata 1> # after entering `=`
```

Under some circumstances, e.g. when using `PackageCompiler`

, the `Symata`

repl is not initialized after the module is loaded. You can initialize it with the exported Julia command `run_repl`

. After this, the repl is entered with the `=`

key. An executable `./scripts/symata`

is included. It is a (UNIX sh) shell script that just starts julia, loads the module, and enters `Symata`

mode. There is also a script `./scripts/symatap`

for starting from an image with Symata precompiled. (See below.) Switch between `Julia`

and `Symata`

modes by typing `=`

, or backspace, as the first character on a line. You can do tab completion to see a list of functions and symbols.

```
In [1]: using Symata
In [2]: Expand((a+b)^2)
Out[2]: a^2 + 2a*b + b^2
In [3]: Julia() # return to Julia mode
```

In `Jupyter`

, the `Symata`

expressions `In(n)`

and `Out(n)`

reevaluate the input and output cells. TAB completion works in `Jupyter`

. To see a list of all possible completions, type `*[TAB]`

.

If you do `using Symata`

in a dumb terminal, the `Symata`

prompt should appear automatically.

From the julia prompt, type `isympy()`

to enter the sympy shell.

You can precompile Symata. It will load very quickly and be generally much more responsive. The script `./scripts/gen_compile_symata.sh`

writes a Julia image. The shell script `./scripts/symatap`

runs Julia with this image and immediately enters the Symata repl. See the contents of these files if you can't run shell scripts on your platform.

You can install a Jupyter kernel using the precompiled image. You must *not* insert any whitespace between `-J`

and the path to the image.

```
julia> using IJulia
julia> installkernel("Symata", "-J/home/username/path/to/symataimage.so")
```

Run the test suite from the `symata`

prompt with `Tests()`

. This runs tests in the symata_test directory `Pkg.test("Symata")`

runs the same test suite from `Julia`

and some Julia-level unit tests, as well.

Author: jlapeyre

Source Code: https://github.com/jlapeyre/Symata.jl

License: View license

1666044720

Convenience functions for dictionaries with `Symbol`

keys.

Create a `Dict{Symbol,}`

:

```
@SymDict(a=1, b=2)
Dict{Symbol,Any}(:a=>1,:b=>2)
```

Capture local variables in a dictionary:

```
a = 1
b = 2
@SymDict(a,b)
Dict{Symbol,Any}(:a=>1,:b=>2)
```

```
a = 1
b = 2
@SymDict(a,b,c=3)
Dict{Symbol,Any}(:a=>1,:b=>2,:c=3)
```

Capture varags key,value arguments in a dictionary:

```
function f(x; option="Option", args...)
@SymDict(x, option, args...)
end
f("X", foo="Foo", bar="Bar")
Dict{Symbol,Any}(:x=>"X",:option=>"Option",:foo=>"Foo",:bar=>"Bar")
```

Merge new entries into a dictionary:

```
d = @SymDict(a=1, b=2)
merge!(d, c=3, d=4)
Dict{Symbol,Any}(:a=>1,:b=>2,:c=3,:d=>4)
```

Convert to/from `Dict{AbstractString,}:

```
d = @SymDict(a=1, b=2)
d = stringdict(d)
Dict{String,Any}("a"=>1,"b"=>2)
d = symboldict(d)
Dict{Symbol,Any}(:a=>1,:b=>2)
```

Author: JuliaCloud

Source Code: https://github.com/JuliaCloud/SymDict.jl

License: View license

1665269700

*OSC.jl* provides an implementation of the OSC binary format commonly used in networked control of musical applications. The code is based on a relatively straightforward translation of librtosc(https://github.com/fundamental/rtosc)

```
i = Int32( 42 ); #integer
f = Float32( 0.25; ); #float
s = "string" #string
b = s; #blob
h = Int64( -125; ); #long integer
t = UInt64( 22412; ); #timetag
d = Float64( 0.125; ); #double
S = "Symbol" #symbol
c = Char( 'J' ); #character
r = Int32( 0x12345678 ); #RGBA
m = Array{UInt8,1}( [0x12,0x23, #midi
0x34,0x45]);
#true
#false
#nil
#inf
msg = OscMsg("/dest", "[ifsbhtdScrmTFNI]", i,f,s,b,h,t,d,S,c,r,m);
show(msg)
```

This produces:

```
OSC Message to /dest
Arguments:
# 1 i:Int32 - 42
# 2 f:Float32 - 0.25
# 3 s:String - string
# 4 b:Blob - Uint8[115 116 114 105 110 103]
# 5 h:Int32 - -125
# 6 t:Uint64 - 22412
# 7 d:Float64 - 0.125
# 8 S:Symbol - Symbol
# 9 c:Char - J
#10 r:RBG - 305419896
#11 m:Midi - Uint8[18 35 52 69]
#12 T: - true
#13 F: - false
#14 N:Nothing - nothing
#15 I:Inf - nothing
```

Accessing the fields is done via the [] operator.

Most of the usage is going to involve sending the OSC messages over UDP to another program. To do this, first start two julia instances. In the first one run

```
using Sockets
using OpenSoundControl
sock2 = UDPSocket()
bind(sock2, ip"127.0.0.1", 7777)
msg2 = OscMsg(recv(sock2))
show(msg2)
```

The first instance will now wait for the second to send an OSC message. To send the an OSC message, in the second window type.

```
using Sockets
using OpenSoundControl
sock1 = UDPSocket()
msg1 = OpenSoundControl.message("/hello world", "sSif", "strings", "symbols", Int32(234), Float32(2.3))
send(sock1, ip"127.0.0.1", 7777, msg1.data)
```

- Port bundle message support from librtosc

Author: fundamental

Source Code: https://github.com/fundamental/OpenSoundControl.jl

License: LGPL-3.0 license

1661416800

SymbolicUtils.jl provides various utilities for symbolic computing. SymbolicUtils.jl is what one would use to build a Computer Algebra System (CAS). If you're looking for a complete CAS, similar to SymPy or Mathematica, see Symbolics.jl. If you want to build a crazy CAS for your weird Octonian algebras, you've come to the right place.

Symbols in SymbolicUtils carry type information. Operations on them propagate this information. A rule-based rewriting language can be used to find subexpressions that satisfy arbitrary conditions and apply arbitrary transformations on the matches. The library also contains a set of useful simplification rules for expressions of numeric symbols and numbers. These can be remixed and extended for special purposes.

If you are a Julia package develper in need of a rule rewriting system for your own types, have a look at the interfacing guide.

SymbolicUtils.jl is on the general registry and can be added the usual way:

```
pkg> add SymbolicUtils
```

or

```
julia> using Pkg; Pkg.add("SymbolicUtils")
```

```
julia> using SymbolicUtils
julia> SymbolicUtils.show_simplified[] = true
julia> @syms x::Real y::Real z::Complex f(::Number)::Real
(x, y, z, f(::Number)::Real)
julia> 2x^2 - y + x^2
(3 * (x ^ 2)) + (-1 * y)
julia> f(sin(x)^2 + cos(x)^2) + z
f(1) + z
julia> r = @rule sinh(im * ~x) => sin(~x)
sinh(im * ~x) => sin(~x)
julia> r(sinh(im * y))
sin(y)
julia> simplify(cos(y)^2 + sinh(im*y)^2, RuleSet([r]))
1
```

Citations

- The pattern matcher is an adaption of the one by Gerald Jay Sussman (as seen in 6.945 at MIT), his use of symbolic programming in the book SICM inspired this package.
- Rewrite.jl and Simplify.jl by Harrison Grodin also inspired this package.

Author: JuliaSymbolics

Source Code: https://github.com/JuliaSymbolics/SymbolicUtils.jl

License: View license

1661408700

Symbolics.jl is a fast and modern Computer Algebra System (CAS) for a fast and modern programming language (Julia). The goal is to have a high-performance and parallelized symbolic algebra system that is directly extendable in the same language as the users.

To install Symbolics.jl, use the Julia package manager:

```
julia> using Pkg
julia> Pkg.add("Symbolics")
```

For information on using the package, see the stable documentation. Use the in-development documentation for the version of the documentation which contains the unreleased features.

- SymbolicUtils.jl: This is a rule-rewriting system that is the core of Symbolics.jl. Symbolics.jl builds off of SymbolicUtils.jl to extend it to a whole symbolic algebra system, complete with support for differentiation, solving symbolic systems of equations, etc. If you're looking for the barebones to build a new CAS for specific algebras, SymbolicUtils.jl is that foundation. Otherwise, Symbolics.jl is for you.
- ModelingToolkit.jl: This is a symbolic-numeric modeling system for the SciML ecosystem. It heavily uses Symbolics.jl for its representation of symbolic equations along with tools like differentiation, and adds the representation of common modeling systems like ODEs, SDEs, and more.

```
julia> using Symbolics
julia> @variables t x y
julia> D = Differential(t)
julia> z = t + t^2
julia> D(z) # symbolic representation of derivative(t + t^2, t)
Differential(t)(t + t^2)
julia> expand_derivatives(D(z))
1 + 2t
julia> Symbolics.jacobian([x + x*y, x^2 + y],[x, y])
2×2 Matrix{Num}:
1 + y x
2x 1
julia> B = simplify.([t^2 + t + t^2 2t + 4t
x + y + y + 2t x^2 - x^2 + y^2])
2×2 Matrix{Num}:
t + 2(t^2) 6t
x + 2t + 2y y^2
julia> simplify.(substitute.(B, (Dict(x => y^2),)))
2×2 Matrix{Num}:
t + 2(t^2) 6t
2t + y^2 + 2y y^2
julia> substitute.(B, (Dict(x => 2.0, y => 3.0, t => 4.0),))
2×2 Matrix{Num}:
36.0 24.0
16.0 9.0
```

If you use Symbolics.jl, please cite this paper (or see the free arxiv version)

```
@article{10.1145/3511528.3511535,
author = {Gowda, Shashi and Ma, Yingbo and Cheli, Alessandro and Gw\'{o}\'{z}zd\'{z}, Maja and Shah, Viral B. and Edelman, Alan and Rackauckas, Christopher},
title = {High-Performance Symbolic-Numerics via Multiple Dispatch},
year = {2022},
issue_date = {September 2021},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
volume = {55},
number = {3},
issn = {1932-2240},
url = {https://doi.org/10.1145/3511528.3511535},
doi = {10.1145/3511528.3511535},
abstract = {As mathematical computing becomes more democratized in high-level languages, high-performance symbolic-numeric systems are necessary for domain scientists and engineers to get the best performance out of their machine without deep knowledge of code optimization. Naturally, users need different term types either to have different algebraic properties for them, or to use efficient data structures. To this end, we developed Symbolics.jl, an extendable symbolic system which uses dynamic multiple dispatch to change behavior depending on the domain needs. In this work we detail an underlying abstract term interface which allows for speed without sacrificing generality. We show that by formalizing a generic API on actions independent of implementation, we can retroactively add optimized data structures to our system without changing the pre-existing term rewriters. We showcase how this can be used to optimize term construction and give a 113x acceleration on general symbolic transformations. Further, we show that such a generic API allows for complementary term-rewriting implementations. Exploiting this feature, we demonstrate the ability to swap between classical term-rewriting simplifiers and e-graph-based term-rewriting simplifiers. We illustrate how this symbolic system improves numerical computing tasks by showcasing an e-graph ruleset which minimizes the number of CPU cycles during expression evaluation, and demonstrate how it simplifies a real-world reaction-network simulation to halve the runtime. Additionally, we show a reaction-diffusion partial differential equation solver which is able to be automatically converted into symbolic expressions via multiple dispatch tracing, which is subsequently accelerated and parallelized to give a 157x simulation speedup. Together, this presents Symbolics.jl as a next-generation symbolic-numeric computing environment geared towards modeling and simulation.},
journal = {ACM Commun. Comput. Algebra},
month = {jan},
pages = {92–96},
numpages = {5}
}
```

Author: JuliaSymbolics

Source Code: https://github.com/JuliaSymbolics/Symbolics.jl

License: View license

1661112420

**Linear symbolic expressions for the Julia language**

```
julia> using LinearExpressions
julia> a, b, c, d, w, x, y, z = map(RealVariable, [:a, :b, :c, :d, :w, :x, :y, :z])
8-element Array{TypedVariable{Real},1}:
a
b
c
d
w
x
y
z
julia> 2x
2x
julia> 2x + 1
1 + 2x
julia> 4 * (3 + 2x)
12 + 8x
julia> x - x == 0
true
julia> le = x + y + 2.3 * (w + z) - 3.4 * (a + b) - c - d + 1.23
1.23 - d - 3.4b - 3.4a + y + 2.3w + 2.3z - c + x
julia> le + 3*le
4.92 - 4.0d - 13.6b - 13.6a + 4.0y + 9.2w + 9.2z - 4.0c + 4.0x
julia> [x y; y 1] + [1.5 2; 3 4] * [x 0; z 0]
2x2 Array{LinExpr{Float64,TypedVariable{Real}},2}:
2.0z+2.5x y
y+4.0z+3.0x 1.0
julia> [1 2; 2 1] + [0.0 1.2; 1.2 0.0]*x + 4*eye(2)*y
1 2
2 1
+
4 0
0 4
y
+
0 1.2
1.2 0
x
```

Within Julia:

```
Pkg.clone("git://github.com/cdsousa/LinearExpressions.jl.git")
```

Author: cdsousa

Source Code: https://github.com/cdsousa/LinearExpressions.jl

License: View license

1603787160

The NEM blockchain has come a long way since its launch back in 2015. As one of the earliest and most prominent blockchain platforms, it has built a solid community globally, with XEM.

Later this year, NEM is launching the highly anticipated Symbol public blockchain, and with it XYM, the native currency of the platform. Read this Hackernoon piece to find out more about Symbol’s features and network architecture.

What does this launch mean for those who want to participate in the launch of Symbol, and more specifically what is the migration process from NEM NIS1 to Symbol?

The technology stacks between NEM NIS1 and Symbol are not compatible, meaning the Symbol chain will be introduced in parallel with NIS1. In order to give XEM holders agency throughout the migration, the token allocation of the XYM tokens will be determined by an opt-in process.

By opting-in, XEM holders will obtain an XYM balance equal to that of their XEM balance at the time of the Snapshot.

This article will break down everything you need to know about the opt-in process, snapshot, and how to be an early participant in XYM and Symbol.

#nem #cryptocurrency #symbol #developer #github #react native

1591594380

Detailed Overview of Well-known Symbols

These special symbols are important because they are system properties of objects that allow to define custom behavior. Sounds great, use them to hook into JavaScript!

#javascript #symbol #es2015 #js #development