navigation / documentation overview / design choices / Computer Algebra System (CAS) comparison
Recommendation: Read the user documentation and FAQ first. This page assumes familiarity with the jargon used in the Physics Derivation Graph.
Constraints: Use a CAS which is free and open source. (See Design Principles.)
Sage, Mathematica, and SymPy are candidates capable of checking the correctness of derivations.
The following Sage code checks that the claimed step as stated by the inference rule is carried out correctly:
T=var('T')
f=var('f')
# latex input: T = 1/f
input_expr = (1)/(f) == (T)
# latex output: T f = 1
expected_output_expr = T * f == 1
# latex feed: f
feed = f
input_expr * feed == expected_output_expr
The output is
True
which means that the claimed step in the derivation was implemented consistent with the inference rule applied.
Sage code can be run in https://sagecell.sagemath.org/.
In this analysis of Sage the support for standard operations wasn't sufficient.
A computer algebra system like Mathematica can validate the steps of a derivation.
Input:
multiplyBothSidesOfExpression[LHS_, relation_, RHS_, feed_] := {LHSout = LHS*feed, relationOut = relation, RHSout = RHS*feed}
divideBothSidesOfExpression[LHS_, relation_, RHS_, feed_] := {LHSout = LHS/feed, relationOut = relation, RHSout = RHS/feed}
LHS = T;
RHS = 1/f;
relation = "=";
{LHS, relation, RHS}
result = multiplyBothSidesOfExpression[LHS, relation, RHS, f]; (* should yield T*f=1 *)
result = divideBothSidesOfExpression[result[[1]], result[[2]], result[[3]], T]; (* should yield f=1/T *)
{result[[1]], result[[2]], result[[3]]}
Output:
{T,=,1/f}
{f,=,1/T}
Quadratic equation derivation
First, set up the inference rules:
dividebothsidesby[expr_, x_] := Apart[First[expr]/x] == Apart[Last[expr]/x]; subtractXfromBothSides [expr_, x_] := First[expr]-x == Last[expr]-x; addXtoBothSides[expr_, x_] := First[expr]+x == Last[expr]+x; subXforY[expr_, x_, y_] := expr /. x -> y raiseBothSidesToPower[expr_, pwr_] = First[expr]^pwr == Last[expr]^pwr simplifyLHS [expr_, condition_] := FullSimplify [First[expr], condition] == Last[expr]
Next, use the inference rules
func = a*x^2+b*x+c == 0 func = dividebothsidesby[func, a] func = subtractXfromBothSides [func, c/a] func = addXtoBothSides[func, (b/(2 a))^2] func = subXforY[func, First[func], (x+b/(2 a))^2] func = subXforY[func, Last[func], (b^2-4 ac)/(4 a^2)] func = raiseBothSidesToPower[func, (1/2)] func = simplifyLHS [func, (x+b/(2 a)) > 0] func = subXforY[func, Last[func], ±Last[func]] func = subtractXfromBothSides [func, b/(2 a)]
The motives for using Sympy are the cost (free), the code (open source), the integration (Python), support for Physics, and the support for parsing Latex.
https://docs.sympy.org/latest/tutorials/intro-tutorial/intro.html
The snippets of SymPy can be run in http://live.sympy.org/
TODO: add more examples here.
http://savannah.nongnu.org/projects/axiom/
http://maxima.sourceforge.net/documentation.html
SnuggleTeX converts Latex to Maxima via MathML; see http://www2.ph.ed.ac.uk/snuggletex/documentation/generating-maxima-input.html
https://xcas.univ-grenoble-alpes.fr/backup/giac.html
latexcalc is a "LaTeX Calculator" that calculates values inside your LaTeX files before typesetting them.
LINCAS: LaTeXCalc is not a Computer Algebra System