After attempting to solve a symbolic math problem, I got an expression with about 17000 characters. I am using the symbolic toolbox for Matlab, but I am open to any suggestion (Mathematica, whatever).
For obvious reasons, I won't copy-paste the expression straight into the question. Here is a link instead.
Running the Matlab
commands simplify
and simple
, and even attempts to collect
didn't improve the situation (Some got it worse).
But I am wondering, I don't care if the expression is evaluated in steps, with temporal parameters. Something like:
z1 = a^2*y1;
%Now the expression can be simplified by using z1 as alias!
z1+z1^2 ....
Is there an automatic method to get such a step-by-step simplification with temporal variables? Also, any other method that you can think of is plausible.
S = simplify( expr ) performs algebraic simplification of expr . If expr is a symbolic vector or matrix, this function simplifies each element of expr . S = simplify( expr , Name,Value ) performs algebraic simplification of expr using additional options specified by one or more Name,Value pair arguments.
Symbolic expressions. The symbolic language consists of symbolic expressions written in the way mathematicians traditionally write them. A symbolic expression consists of symbols arranged according to specific rules. Every symbolic expression is one of two types: symbolic assertion and symbolic term.
To simplify a mathematical expression is to represent it in the least complicated form possible. In general the simplest form is one that has used the fundamental properties of numbers, exponents, algebraic rules, etc. to remove any duplication or redundancy from the expression.
Might try common subexpression elimination (CSE). Here is an example cribbed from
Get mathematica to simplify expression with another equation
InputForm[Experimental`OptimizeExpression[(3 + 3*a^2 + Sqrt[5 + 6*a + 5*a^2] +
a*(4 + Sqrt[5 + 6*a + 5*a^2]))/6]]
==>
Out[206]//InputForm=
Experimental`OptimizedExpression[Block[{Compile`$1, Compile`$3, Compile`$4,
Compile`$5, Compile`$6}, Compile`$1 = a^2; Compile`$3 = 6*a;
Compile`$4 = 5*Compile`$1; Compile`$5 = 5 + Compile`$3 + Compile`$4;
Compile`$6 = Sqrt[Compile`$5]; (3 + 3*Compile`$1 + Compile`$6 +
a*(4 + Compile`$6))/6]]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With