The Maxima on-line user's manual

Algebra Calculator

Grind

Function: grind (<expr>) -- Option variable: grind The function `grind` prints <expr> to the console in a form suitable for input to Maxima. `grind` always returns `done`.

When <expr> is the name of a function or macro, `grind` prints the function or macro definition instead of just the name.

See also `string`, which returns a string instead of printing its output. `grind` attempts to print the expression in a manner which makes it slightly easier to read than the output of `string`.

When the variable `grind` is `true`, the output of `string` and `stringout` has the same format as that of `grind`; otherwise no attempt is made to specially format the output of those functions. The default value of the variable `grind` is `false`.

`grind` can also be specified as an argument of `playback`. When `grind` is present, `playback` prints input expressions in the same format as the `grind` function. Otherwise, no attempt is made to specially format input expressions.

`grind` evaluates its argument.

Examples:

```          (%i1) aa + 1729;
(%o1)                       aa + 1729
(%i2) grind (%);
aa+1729\$
(%o2)                         done
(%i3) [aa, 1729, aa + 1729];
(%o3)                 [aa, 1729, aa + 1729]
(%i4) grind (%);
[aa,1729,aa+1729]\$
(%o4)                         done
(%i5) matrix ([aa, 17], [29, bb]);
[ aa  17 ]
(%o5)                      [        ]
[ 29  bb ]
(%i6) grind (%);
matrix([aa,17],[29,bb])\$
(%o6)                         done
(%i7) set (aa, 17, 29, bb);
(%o7)                   {17, 29, aa, bb}
(%i8) grind (%);
{17,29,aa,bb}\$
(%o8)                         done
(%i9) exp (aa / (bb + 17)^29);
aa
-----------
29
(bb + 17)
(%o9)                     %e
(%i10) grind (%);
%e^(aa/(bb+17)^29)\$
(%o10)                        done
(%i11) expr: expand ((aa + bb)^10);
10           9        2   8         3   7         4   6
(%o11) bb   + 10 aa bb  + 45 aa  bb  + 120 aa  bb  + 210 aa  bb
5   5         6   4         7   3        8   2
+ 252 aa  bb  + 210 aa  bb  + 120 aa  bb  + 45 aa  bb
9        10
+ 10 aa  bb + aa
(%i12) grind (expr);
bb^10+10*aa*bb^9+45*aa^2*bb^8+120*aa^3*bb^7+210*aa^4*bb^6
+252*aa^5*bb^5+210*aa^6*bb^4+120*aa^7*bb^3+45*aa^8*bb^2
+10*aa^9*bb+aa^10\$
(%o12)                        done
(%i13) string (expr);
(%o13) bb^10+10*aa*bb^9+45*aa^2*bb^8+120*aa^3*bb^7+210*aa^4*bb^6\
+252*aa^5*bb^5+210*aa^6*bb^4+120*aa^7*bb^3+45*aa^8*bb^2+10*aa^9*\
bb+aa^10
(%i14) cholesky (A):= block ([n : length (A), L : copymatrix (A),
p : makelist (0, i, 1, length (A))], for i thru n do
for j : i thru n do
(x : L[i, j], x : x - sum (L[j, k] * L[i, k], k, 1, i - 1),
if i = j then p[i] : 1 / sqrt(x) else L[j, i] : x * p[i]),
for i thru n do L[i, i] : 1 / p[i],
for i thru n do for j : i + 1 thru n do L[i, j] : 0, L)\$
(%i15) grind (cholesky);
cholesky(A):=block(
[n:length(A),L:copymatrix(A),
p:makelist(0,i,1,length(A))],
for i thru n do
(for j from i thru n do
(x:L[i,j],x:x-sum(L[j,k]*L[i,k],k,1,i-1),
if i = j then p[i]:1/sqrt(x)
else L[j,i]:x*p[i])),
for i thru n do L[i,i]:1/p[i],
for i thru n do (for j from i+1 thru n do L[i,j]:0),L)\$
(%o15)                        done
(%i16) string (fundef (cholesky));
(%o16) cholesky(A):=block([n:length(A),L:copymatrix(A),p:makelis\
t(0,i,1,length(A))],for i thru n do (for j from i thru n do (x:L\
[i,j],x:x-sum(L[j,k]*L[i,k],k,1,i-1),if i = j then p[i]:1/sqrt(x\
) else L[j,i]:x*p[i])),for i thru n do L[i,i]:1/p[i],for i thru \
n do (for j from i+1 thru n do L[i,j]:0),L)```

```(%o1)                                true
(%i2) ```

Related Examples

grind-integrate-subst

tau:T/(A+T);

a_T:A/(A+T);

eq:B+(C-B)*tau^2*(1-a...

Calculate

grind-plot2d-sqrt-taylor

grind(''taylor(x^(1/2...

f(x):=1+(x-1)/2-(x-1)...

plot2d([sqrt(x),f(x)]...

Calculate

grind-linsolve-tex

eq1:I + ri*(ta*Ba+tp*...

eq2:O + ro*((1-ta)*Ba...

eq3:Ba = (1-ta)*O+ta*I;

Calculate

grind-integrate-subst

tau:T/(A+T);

a_T:A/(A+T);

eq:B+(C-B)*tau^2*(1-a...

Calculate

grind-plot2d-sqrt-taylor

grind(''taylor(x^(1/2...

f(x):=2+(x-4)/4-(x-4)...

plot2d([sqrt(x),f(x)]...

Calculate

grind-random

a2: random(10);

Aufgabe: a2*x^3 ;

grind(Aufgabe) ;

Calculate

grind-plot2d-sqrt-taylor

grind(''taylor(x^(1/2...

f(x):=2+(x-4)/4-(x-4)...

plot2d([sqrt(x),f(x)]...

Calculate

grind-solve

e01: 25*x^2+30*x*y+9*...

e02: 1*x^2+2*x*y+1*y^...

e03: -1*x^2+2*x*y-1*y...

Calculate

N(x) := x/2+1/x;

x: 1;

a: N(x);

Calculate

grind-linsolve-ratsimp

eq1: b1 + b3*w + 2*b4...

eq2: b2 + b3*d + 2*b5...

grind(linsolve([eq1,e...

Calculate