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 

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

Floating-point evaluation 

Вычисления с плавающей точкой

 Using  evalhf

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

> restart;
> ProblemB1 := proc(a, h, ya, n, y)
local j,k,c,y1,y2;
y[1,0] := ya[1];
y[2,0] := ya[2];
for k from 1 to n do
c := 0;
for j from 0 to k-1 do
c := c + y[1,j]*y[2,k-j-1];
end do;
y[1,k] := 2*(y[1,k-1] - c)/k;
y[2,k] := (y[2,k-1] - c)/k;
end do;
end proc:
> ya := array(1..2, [1., 3.]):
> n := 200:

> y := array(1..2, 0..n):

> yf := array(1..2, 0..n):
> st := time(): evalhf(ProblemB1(0., 0.1, ya, n, var(y))): etime := time() -st;

etime := .50e-1

> Digits := trunc(evalhf(Digits))+1;

Digits := 15

> st := time(): evalf(ProblemB1(0., 0.1, ya, n, yf)): etimef := time() -st;

etimef := .932

> etimef/etime;

18.6400000000000

> y[1,n];

.816462639698141420e61

> yf[1,n];

.816462639698128e61

> restart;
> currentdir("C:/local/mpl/adics");
> read "polyflake.mpl";
> bm := evalhf( polyflake(3) );

bm := _rtable[5049532]

> bmp := PLOT3D( POINTS(bm) ):
> b := n -> plots[display]( bmp, scaling=CONSTRAINED, orientation=[n,60] ):
> plots[display]( [seq(b(10*n),n=0..35)], insequence=true );

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

 
Hosted by uCoz