home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Press 1997 July
/
Sezamfile97_1.iso
/
msdos
/
misc
/
sm30a.a03
/
SYMBMATH.H32
< prev
next >
Wrap
Text File
|
1993-11-07
|
2KB
|
66 lines
4.2 Simplification
SymbMath automatically simplifies the output expression.
You can further simplify it by using the built-in variable last
in a single line again and again until you are happy with the answer.
Expressions can be expanded by
expand(x)
expand := on
expandexp := on
Remember that the operation by assignment is global while operation by
function is local. So expand(x) only expands the expression x, but the
switch expand := on expands all expressions between the switch expand :=
on and the switch expand := off. Second difference betwen them is that
the switch expand := on only expands a*(b+c) and (b+c)/p, but does not
expands the power (a+b)^2. The expandexp is exp expand.
Example:
IN: expand((a+b)^2+(b+c)*p)
OUT: a^2 + 2 a b + b^2 + b p + c p
IN: expand := on
IN: (a+b)^2 + (b+c)*p
OUT: (a+b)^2 + b p + c p
---------------------------------------------------------------------
............... expand(x) ..........................................
(a+b)^2 to a^2+2*a*b+b^2
(a+b)^n to a^n+ ...... +b^n n is positive integer
............... expand(x) and expand := on ..........................
a*(b+c) to a*b + a*c
(b+c)/p to b/p + c/p
............... expandexp := on .....................................
e^(a+b) to e^a * e^b
---------------------------------------------------------------------
where a+b can be many terms or a-b.
Expressions can be factorized by
factor(x)
e.g.
IN: factor(a^2 + 2*a*b + b^2)
OUT: (a + b)^2
Polynomials of order less than 5 can be factorized by
factor(y, x)
Example.
IN: factor(x^2+5*x+6, x)
OUT: (2 + x) (3 + x)
Note that Shareware version of SymbMath cannot do this factor as
it lacks solve().
Example 4.2.1.
Reduce sqrt(x^2).
IN: sqrt(x^2)
OUT: x*sign(x)
This output can be further simplified if you know proporties of x.
A first way is to evaluate x*sign(x) when sign(x) = 1 if x is
positive.
IN: sqrt(x^2)
OUT: x*sign(x)
IN: subs(last, sign(x) = 1)
OUT: x
where a special keyword last stands for the last output, e.g. here last
is x*sign(x).