stefnotch / quantum-sheet

QuantumSheet - A user friendly mathematics worksheet and solver
https://stefnotch.github.io/quantum-sheet/
GNU General Public License v3.0
55 stars 5 forks source link

Mathematical Functions, Constants, Evaluations (with Sympy) #30

Open phcreery opened 3 years ago

phcreery commented 3 years ago

This is an attempt to document and create a running list all the desired mathematical Functions, Constants, and Evaluations. This issue is aimed at Sympy but the list should be compatible with or easily inclusive to competitive CASs.

https://en.wikipedia.org/wiki/Template:Areas_of_mathematics https://en.wikipedia.org/wiki/Glossary_of_mathematical_symbols

Operations

https://cortexjs.io/compute-engine/guides/dictionaries/

MathJSON MathJSON -> Sympy Sympy -> MathJSON
MathJSON name Sympy function name Sympy printer function/name
(checked if fully tested) (checked if implemented) (checked if implemented)
Arithmatic
☒ Parentheses ☒   ☒  
☒ Add ☒ Sympy.Add ☒ _print_Add
☒ Subtract ☒ Sympy.Add(x,sympy.mul(y,-1)) ☒  
☐ Negate (*-1) ☒  
☒ Multiply ☒ Sympy.Mul ☒  
☒ (Divide) ☒  
☒ Power ☒ Sympy.Pow ☒  
☐ Root ☒ sympy.root  ☐  
☐ Sqrt * ☒ Sympy.sqrt ☒ Sqrt (capital s?)
☐ Square ☐   ☐  
☐ Exp * ☐   ☐ exp
☐   ☐   ☐  
Algebra
☐ Log * ☐   ☒ ln
☐ Log2 * ☐   ☒ log2
☐ Log10 * ☐   ☒ log10
☐ LogOnePlus ☐   ☒ log1p
☐ Abs * ☒ Sympy.Abs ☐  
☐ Ceil * ☐   ☒ ceiling
☐ Chop ☐   ☐  
☐ Floor * ☐   ☒ floor
☐ Round ☐   ☐  
☐ Factorial ☒ sympy.factorial ☒ factorial
☐   ☐  
Trigonometry
☒ Sin ☒ sympy.sin ☒ sin
☒ Cos ☒ sympy.cos ☒ cos
☒ Tan (defaults to tg?) ☒ sympy.tan ☒ tan
☐ Sec ☒ sympy.sec ☒ sec
☐ Csc ☒ sympy.csc ☒ csc 
☐ Cot ☒ sympy.cot ☒ cot 
☒ Arcsin** ☒ Sympy.asin ☒ asin
☒ Arccos** ☒ Sympy.acos ☒ acos
☒ Arctan** ☒ Sympy.atan ☒ atan
☒ Arctan2** ☒ sympy.atan2 ☒ atan2
☐ Asec** ☒ Sympy.asec ☒ asec
☐ Acsc** ☒ Sympy.acsc ☒ acsc
☐ Acot** ☒ Sympy.acot ☒ acot
☒ Sinh ☒ Sympy.sinh ☒ sinh
☒ Cosh ☒ Sympy.cosh ☒ cosh
☒ Tanh ☒ Sympy.tanh ☒ tanh
☐ Sech** ☒ Sympy.sech ☒ sech 
☐ Csch** ☒ Sympy.csch ☒ csch 
☐ Coth** ☒ Sympy.coth ☒ coth 
☒ Arsinh** ☒ Sympy.asinh ☒ asinh
☒ Arcosh** ☒ Sympy.acosh ☒ acosh
☒ Artanh** ☒ Sympy.atanh ☒ atanh
☐ Asech** ☒ Sympy.asech ☒ asech 
☐ Acsch** ☒ Sympy.acsch ☒ acsch 
☐ Arcoth** ☒ Sympy.acoth ☒ acoth 
☐ Degrees ☐   ☐  
☐ FromPolarCoordinates ☐   ☐  
☐ ToPolarCoordinates ☐   ☐  
☐ Hypot ** ☐  
☐ Haversine ☐   ☐  
☐ InverseHaversine ☐   ☐  
☐   ☐   ☐  
Calculus
☐ Integrate * ☐   ☐ _print_Integral
☐ Derivative/Prime (D, ') * ☐   ☐ _print_Derivative 
☐ (Partial Derivative) ☐  
☐ (Limit - lim(f,x,a)?) ☐   ☐ _print_Limit
☐ (SumSeries) ☐   ☐ _print_Sum 
☐ (Product of Sequence- CapitalPi) ☐   ☐  
☐   ☐   ☐  
Linear Algebra
☐ (System of Equations)  ☐   ☐  
☐ (EigenValues)  ☐   ☐  
☐ (EigenVectors)  ☐   ☐  
☐ (Matricies)  ☐   ☐  
☐ (Vectors)  ☐   ☐  
Matrix Operations
☐ (Matrix Define)  ☐   ☐  
☐ (Addition)  ☐   ☐  
☐ (Multiplication)  ☐   ☐ _print_MatMul ? 
☐ (Transpose)  ☐   ☐ _print_Transpose 
☐ (Multiplication)  ☐   ☐  
☐ (Power)  ☐   ☐ _print_MatPow ? 
☐ (Normal)  ☐   ☐  
Logic/Relational
☐ True**  ☐  ☐ _print_BooleanTrue 
☐ False** ☐  ☐  _print_BooleanFalse
☐ Maybe** ☐  ☐   
☐ And ☐  ☐  _print_And
☐ Or ☐  ☐ _print_Or
☐ (Xor) ☐  ☐ _print_Xor
☐ Not ☐  ☐  _print_Not
☐ Equivalent (\equiv) ☐  ☐   
☐ Implies ☐  ☐   
☐ Equal (taken) ☐  ☐   
☐ NotEqual ☐  ☐   
☐ GreaterEqual ☐ sympy.GreaterThan ☐   
☐ LessEqual ☐ sympy.LessThan ☐   
☐ Greater ☐ sympy.GreaterThanStrict ☐   
☐ Less  ☐ sympy.LessThanStrict ☐   
☐   ☐  ☐   
Special
☐ Gamma ☒ sympy.gamma ☒ gamma
☐ LogGamma ☒ sympy.loggamma ☒ loggamma
☐ Erf ☒ sympy.erf ☒ erf
☐ Erfc ☒ sympy.erfc ☒ erfc
☐ EulerGamma ☒ Sympy.EulerGamma ☒ _print_EulerGamma
☐   ☐  ☐   
Misc
☐ List   ☐  ☐ _print_list  
☐ Set ☐  ☐  _print_set
☐ Lambda  ☐ sympy.Lambda ☐ _print_Lambda
☐ InverseFunction  ☐  ☐  _print_Inverse ?
☐ Parse (Latex)  ☐  ☐ 
☐ String  ☐  ☐ 
☐  ☐  ☐ 
☐  ☐  ☐ 

* MathLive broken at the moment? Usually happens when the expression is converted to latex then parsed back. ** MathLive Unsupported

Constants

http://www.ebyte.it/library/educards/constants/ConstantsOfPhysicsAndMath.html https://cortexjs.io/mathlive/reference/commands/

MathJSON MathJSON -> Sympy Sympy -> MathJSON
Mathematical
☒ Pi ☒ Sympy.pi ☒ _print_Pi
☒ ImaginaryUnit (\imaginaryI) ☒ Sympy.I ☒ _print_ImaginaryUnit
☒ ExponentialE (\exponentialE) ☒ Sympy.E  ☒ _print_Exp1
☐ GoldenRatio ☒ Sympy.GoldenRatio ☒ _print_GoldenRatio
☐ (Infinity)   ☐  ☐  _print_Infinity
☐ (-Infinity)   ☐  ☐  _print_NegativeInfinity
☐   ☐  ☐  _print_TribonacciConstant
☐ (NaN)   ☐  ☐  _print_NaN
☐   ☐  ☐   

Evaluations

Some examples: https://docs.sympy.org/latest/tutorial/simplification.html#simplification

This list is nowhere near complete. Please comment with more expressions you wish to see supported

stefnotch commented 3 years ago

One place which has quite a few interesting functions are the default compute-engine dictionaries. I suppose we can take some from there as well. e.g. https://cortexjs.io/compute-engine/reference/trigonometry/

stefnotch commented 3 years ago

rewrite ?

Lets leave rewriting for a future issue/pull request. I got some ideas that go well above and beyond the scope of this.

stefnotch commented 3 years ago

Regarding Root, Sympy has a root function. I updated the code on the math-expansion branch

stefnotch commented 3 years ago

Infinity would be another constant that we'll have to support at some point