Robert M. Corless
Department of Applied Mathematics
University of Western Ontario
London, Canada

Copyright 2001 by Robert M. Corless
All rights reserved

Useful one-word commands 

Использование монокоманд

Simplification 

Упрощение

collect

Команда collect

> p := 1+x+3+5*x+6*y+17*y^2+35*x+52*x^2+99*x*y+(x+y)^3;

p := 4+41*x+6*y+17*y^2+52*x^2+99*x*y+(x+y)^3

> collect( p, x );

x^3+(52+3*y)*x^2+(41+99*y+3*y^2)*x+4+6*y+17*y^2+y^3...

> collect( p, y );

y^3+(17+3*x)*y^2+(3*x^2+99*x+6)*y+4+41*x+x^3+52*x^2...

> collect( p, [x,y] );

x^3+(52+3*y)*x^2+(41+99*y+3*y^2)*x+4+6*y+17*y^2+y^3...

> collect( p, [x,y], distributed );

x^3+52*x^2+3*y*x^2+41*x+99*x*y+3*y^2*x+4+6*y+17*y^2...

> restart;
> Logistic := x -> diff(x,t) - x*(1-x);

Logistic := proc (x) options operator, arrow; diff(...

Think of $v$ as $x_n$.

Считать $v$ как $x_n$.

> alias(w = v + h*v*(1-v));

w

The following is the cubic Hermite interpolant between v and w, which is the value of the Euler step from v.
Следующее - кубический интерполянт Эрмита между v и w, являющийся значением шага Эйлера от v.
> interpolant := v+t*v*(1-v)+(v*(1-v)-w*(1-w))/h^2*t^2*(h-t);

interpolant := v+t*v*(1-v)+(v*(1-v)-w*(1-v-h*v*(1-v...

> eval( interpolant, t=0 );

v

> eval( interpolant, t=h );

w

> eval( diff(interpolant, t), t=0);

v*(1-v)

> eval( diff(interpolant, t), t=h );

w*(1-v-h*v*(1-v))

> defect := Logistic( interpolant );

> simpler := collect( eval(defect,t=theta*h), h, factor );

> series( simpler, h, 3 );

> restart;
> currentdir("C:/books/ess/programs");
> read "veil.mpl";
> K := table();

K := TABLE([])

> VK := LEM( K ):
Warning, label K is assigned a value already.
Save its contents and issue the command unassign( K );
There is no need to repeat the call to LEM.

Внимание: символу K уже присвоено значение. Сохраните его содержание, и примените команду unassign (K); Нет необходимости в повторном вызове LEM.

> unassign( K ):
> VC := LEM( C ):
> p1 := sort( randpoly( [x,y,z], dense, degree=7 ) );

> compact1 := collect( p1, [x,y], distributed, VK:-veil );

> K[1] = VK:-unveil( K[1] );

K[1] = 81+40*z^7+11*z^4+88*z^3+62*z^5-78*z^6+z^2+30...

> K[2] = VK:-unveil( K[2] );

K[2] = 76*z^3-88*z^4+34*z^6-25*z+42*z^5+65*z^2-28

> zero := VK:-unveil( compact1, infinity ) - p1:
> normal( zero );

0

> p2 := sort( randpoly( [r,ln(r),Y], dense, degree=6 ) );

> compact2 := collect( p2, [r,ln(r)], distributed, VC:-veil );

> zero := VC:-unveil( compact2 ) - p2:
> expand( zero );

0

> p3 := sort( randpoly( [x,y,z,r,ln(r)], dense, degree=3 ) );

> compact3 := collect( p3, [x,y], distributed, VK:-veil );

> compact4 := collect( compact3, [y], VC:-veil );

compact4 := -67*y^3+C[22]*y^2-C[23]*y+C[24]

> VC:-unveil( C[22] );

K[32]+92*x

> VK:-unveil( K[32] );

8*z+93*ln(r)+20*r+45

> L := [seq( K[i]=VK:-unveil(K[i]), i=29..34 )];

> codegen[fortran](L,optimized);
      t2 = log(r)
      t3 = r*t2
      t5 = z**2
      t9 = r*z
      t11 = r**2
      t14 = t2**2
      t20 = z*t2
      K(29) = 63+31*r+52*t3-24*t5*z+95*z+19*t9-18*t11*t2+65*t14*t2+95*t1
     #1*r+85*t5+60*t20-24*t2+46*t14-67*t9*t2-20*r*t14-36*t5*t2+46*t11+35
     #*t11*z-63*r*t5
      K(30) = -68*t3+65*r-39-66*t5+62*t9-68*z-43*t14+67*t11-40*t20-6*t2
      t48 = 95*t2
      K(31) = -63-8*t9+44*t20-81*t5-34*r+t48+80*z-23*t3+81*t14+5*t11
      t53 = 8*z
      K(32) = t53+93*t2+20*r+45
      K(33) = -44+18*t2+95*r-t53
      K(34) = 36*r-8+t48-98*z
> codegen[C](L,optimized);
      t2 = log(r);
      t3 = r*t2;
      t5 = z*z;
      t9 = r*z;
      t11 = r*r;
      t14 = t2*t2;
      t20 = z*t2;
      K[28] = 63.0+31.0*r+52.0*t3-24.0*t5*z+95.0*z+19.0*t9-18.0*t11*t2+65.0*t14
*t2+95.0*t11*r+85.0*t5+60.0*t20-24.0*t2+46.0*t14-67.0*t9*t2-20.0*r*t14-36.0*t5*
t2+46.0*t11+35.0*t11*z-63.0*r*t5;
      K[29] = -68.0*t3+65.0*r-39.0-66.0*t5+62.0*t9-68.0*z-43.0*t14+67.0*t11
-40.0*t20-6.0*t2;
      t48 = 95.0*t2;
      K[30] = -63.0-8.0*t9+44.0*t20-81.0*t5-34.0*r+t48+80.0*z-23.0*t3+81.0*t14+
5.0*t11;
      t53 = 8.0*z;
      K[31] = t53+93.0*t2+20.0*r+45.0;
      K[32] = -44.0+18.0*t2+95.0*r-t53;
      K[33] = 36.0*r-8.0+t48-98.0*z;

С официального разрешения                    © 2002 Waterloo Maple, Inc

 
Hosted by uCoz