Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
3 tasks
phcreery opened this issue Aug 8, 2021 · 4 comments
Open
3 tasks

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

phcreery opened this issue Aug 8, 2021 · 4 comments

Comments

@phcreery
Copy link
Collaborator

phcreery commented Aug 8, 2021

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

  • Solve (for variable)
  • Expand
  • Factor

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

@phcreery phcreery mentioned this issue Aug 8, 2021
2 tasks
@stefnotch
Copy link
Owner

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
Copy link
Owner

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
Copy link
Owner

stefnotch commented Aug 9, 2021

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

@stefnotch
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants