#compsci #software 

Mathics is an FOSS interactive computer algebra system, akin to [[Wolfram Mathematica]]

Mostly compatible with the Wolfram Language

## History
First alpha versions were done in 2011 by Jan Pöschko. After that, Angus Griffith took over primary leadership together with Ben Jones. Now maintained by a large group of devs.

Consists of several module, such as mathics-core, mathics-django (a [[Django]] webserver with GUI)
## Syntax
### Basic language
Multiplication can be omitted
```mathics
>> 2 4
8
```

To convert a result to a floating point numbers, use the function N[].

Functions are written like Sin[] instead of sin().

Complex numbers are obviously supported.

You can use precision in Mathics with the raw backquote symbol ('):
```mathics
>> 3.1416'3
3.14
```

You can use variables in Mathics.

!  - logical not, && - logical and, || - logical or

Strings can be entered with "":
```mathics
"Hello World"
```

![[Pasted image 20241116182038.png]]

### Lists
![[Pasted image 20241116182153.png]]
![[Pasted image 20241116182207.png]]
![[Pasted image 20241116182219.png]]
![[Pasted image 20241116182226.png]]

### Objects
Every expression in Mathics = **head** + arbitrary number of **children**, unless it is an **atom**
![[Pasted image 20241116182347.png]]
![[Pasted image 20241116182624.png]]
![[Pasted image 20241116182658.png]]

### Declaring functions
![[Pasted image 20241116182840.png]]

### [[iteration]] loops
![[Pasted image 20241116183004.png]]

### Graphics
For use with Graphics[]:
![[Pasted image 20241116183657.png]]
![[Pasted image 20241116183748.png]]
Graphics[{Red, Disk[]}]
![[Pasted image 20241116183819.png]]

For use with Graphics3D[]
![[Pasted image 20241116183943.png]]

### Plotting
![[Pasted image 20241116184109.png]]
Plot3D[] also exists
DensityPlot[]
BarChart[]
Histogram[]
ParametricPlot[]
DiscretePlot[]
![[Pasted image 20241118153559.png]]
### Other functions
TeXForm[] converts an expression into its [[LaTeX]] form.
TableForm[] - in table form
MatrixForm[] - in matrix form

Compress[expr] and Uncompress[expr] - encoding and decoding expressions

ElementData[] - display information about chemicals
ElementData["Properties"] - all known properties
UnitConvert[] - converts the specifided quantity to the specified target unit.
#### Linear algerba
[[Eigenvalues and eigenvectors of a matrix]]:
Eigenvalues[], Eigenvectors[]

[[Transpose of a matrix]]:
Transpose[]

[[Inverse matrix]]:

Inverse[]

It can also matrix equations A=B with LinearSolve[A, B]

Det[]:
[[Determinant of a matrix]]

RowReduce[matrix] :
outputs the matrix in row-echelon form

Tr[]:
[[Trace of a matrix]]
#### Solving
Solve[] - solve an equation
LinearSolve[] - solve a matrix equation
DSolve[] - solve a simple [[Дифференциальное уравнение|differential equation]]
RSolve[] - solve a recurrent equation

#### Numerical functions
![[Pasted image 20241118145311.png]]

![[Pasted image 20241118153943.png]]
![[Pasted image 20241118154014.png]]

Divisible[]
GCD[]
LCM[]
Mod[]
Fibonacci[n]

![[Pasted image 20241118154258.png]]
![[Pasted image 20241118154552.png]]
![[Pasted image 20241118154310.png]]
![[Pasted image 20241118154348.png]]
Denominator[]
Numerator[]
![[Pasted image 20241118154421.png]]
![[Pasted image 20241118154500.png]]
![[Pasted image 20241118154531.png]]
![[Pasted image 20241118154626.png]]
![[Pasted image 20241118154718.png]]
![[Pasted image 20241118154732.png]]
![[Pasted image 20241118154811.png]]
Exp[]
Log[]
And other

Prime[]
PrimePi[]
RandomPrime[]

![[Pasted image 20241201181928.png]]

Table[] - generates a list, including a 2- and more- dimensional list

Append[] - appends to a list
Supports other list operations
Intersection[] - gives athe intersection of the sets

Maximize[] and Minimize[] - extremums of functions

Cross[] and Curl[] - [[Векторное произведение векторов|cross product]] and [[Завихренность векторного поля|curl]]
###  String manipulation
![[Pasted image 20241118150854.png]]

Transliteration:
![[Pasted image 20241118151330.png]]

WorldClouds: (install python package wordcloud)
![[Pasted image 20241201181620.png]]
### Colors
![[Pasted image 20241118151652.png]]

### Time
AbsoluteTime[]
![[Pasted image 20241118152029.png]]

DateDifference[]
![[Pasted image 20241118152054.png]]

Other timing functions:
EasterSunday[time]
Now[]
SessionTime[]

### Statistics
![[Pasted image 20241118152419.png]]

![[Pasted image 20241118152427.png]]

![[Pasted image 20241118152516.png]]

Quantiles:
![[Pasted image 20241118152640.png]]
![[Pasted image 20241118152652.png]]
![[Pasted image 20241118152710.png]]

### Directories
Mathics can also work with directories, as well as display general system information

### Quantum mechanics functions
PauliMatrix[]
ClebschGordan[]

### Images
Mathics can work with images:
Blur[]
Sharpen[]
ImageResize[]
ImageRotate[]
and much more


### Graphs
LoadModule["pymathics.graph"]

lots of operations with graphs and trees

### Natlang
Mathics has a library for natural language processing and can do lots of shit with it
pymathics.natlang and wordnet