Line labels (Re: [Maxima] solving a sytem of symbolic equations)
- Subject: Line labels (Re: [Maxima] solving a sytem of symbolic equations)
- From: Stavros Macrakis
- Date: Wed, 12 Mar 2003 15:27:31 -0500
> what's an e-label?
E Labels are used whenever a command produces intermediate results.
Examples are Pickapart, Isolate, Solve/RealRoots/AllRoots/LinSolve with
Programmode:False (but not when Solve calls Algsys :-( ), Solve of a
cubic/quartic with Breakup:True, etc.
For user code, you can explicitly output something with an E-label using
LDisplay or LDisp.
Examples:
/* Programmode:True is the default */
(C1) programmode;
(D1) TRUE
(C2) solve(x^2-4,x);
(D2) [x = - 2, x = 2]
(C3) programmode:false;
(D3) FALSE
/* Programmode:false can be handier in interactive use. */
(C4) solve(x^2-4,x);
Solution:
(E4) x = - 2
(E5) x = 2
(D5) [E4, E5]
/* Cubics and Quartics have large solutions with common subexpressions.
The solutions are often easier to understand if the subexpressions
are broken out. */
(C5) breakup:true;
(D5) TRUE
(C6) solve(x^3-x^2+a,x);
SQRT(a (27 a - 4))
(E6) ------------------
6 SQRT(3)
27 a - 2 1/3
(E7) (E6 - --------)
54
Solution:
SQRT(3) %I 1
---------- - -
SQRT(3) %I 1 2 2 1
(E8) x = (- ---------- - -) E7 + -------------- + -
2 2 9 E7 3
SQRT(3) %I 1
- ---------- - -
SQRT(3) %I 1 2 2 1
(E9) x = (---------- - -) E7 + ---------------- + -
2 2 9 E7 3
1 1
(E10) x = E7 + ---- + -
9 E7 3
(D10) [E8, E9, E10]
...
/* Generate a largish expression */
(C13) rectform(exp(sin(a+%i)));
COSH(1) SIN(a)
(D13) %I %E SIN(SINH(1) COS(a))
COSH(1) SIN(a)
+ %E
COS(SINH(1) COS(a))
/* Split it up for easier manipulation */
(C14) pickapart(%,2);
COSH(1) SIN(a)
(E14) %E
(E15) SIN(SINH(1) COS(a))
(E16) COS(SINH(1) COS(a))
(D16) E14 E16 + %I E14 E15
/* Put it back together */
(C17) ev(d16);
COSH(1) SIN(a)
(D17) %I %E SIN(SINH(1) COS(a))
COSH(1) SIN(a)
+ %E
COS(SINH(1) COS(a))
/* Unfortunately, there is a bug in pickapart's handling of D-labels:
https://sourceforge.net/tracker/index.php?func=detail&aid=658762&group_i
d=4933&atid=104933 and the patch has not been applied to 5.9.0 */
...
/* Show use of ldisplay in user programs */
(C18) for i: 1 thru 4 do ldisplay(factor(x^(2^i)-1));
2
(E19) FACTOR(x - 1) = (x - 1) (x + 1)
4 2
(E20) FACTOR(x - 1) = (x - 1) (x + 1) (x + 1)
8 2 4
(E21) FACTOR(x - 1) = (x - 1) (x + 1) (x + 1) (x + 1)
16 2 4 8
(E22) FACTOR(x - 1) = (x - 1) (x + 1) (x + 1) (x + 1) (x + 1)
(D23) DONE