updatesR4/numeric - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : updatesR4/numeric

New Numerical Features That Have Been Added to Maple V for Release 4

 

Special functions:

Differential Equations:

Linear Algebra:

Numerical Approximation of Functions

Statistics:

Financial Calculations

Miscellaneous:

Special functions:

• 

Arbitrary precision evaluation, over the complex plane, of a wider range of special functions, including Elliptic and Inverse Elliptic, family of Bessel functions.

• 

Bessel family: AiryAi, AiryBi, BesselI, BesselJ, BesselK, BesselY, HankelH1, HankelH2, KelvinBer, KelvinBei, KelvinKer, KelvinKei, KelvinHer, KelvinHei, StruveH, StruveL, AngerJ, WeberE:

z:=evalf(1+2/3*I):

AiryAi(z), AiryBi(z);

0.10375714960.1044950325I,0.9630190393+0.5220371079I

(1)

 .1037571496 - .1044950325 I, .9630190393 + .5220371079 I

nu:=evalf(2/3+4/5*I):

BesselI(nu,z), BesselJ(nu,z), BesselK(nu,z), BesselY(nu,z);

0.72449351460.06234310868I,0.51099645530.1847149940I,0.35980770530.2438873156I,−0.57095159600.0002188584214I

(2)

 .7244935146 - .06234310868 I, .5109964553 - .1847149940 I,

     .3598077053 - .2438873156 I,

     -.5709515960 - .0002188584214 I

HankelH1(nu,z), HankelH2(nu,z);

0.51121531380.7556665900I,0.5107775969+0.3862366020I

(3)

 .5112153138 - .7556665900 I, .5107775969 + .3862366020 I

KelvinBer(nu,z), KelvinBei(nu,z), KelvinKer(nu,z), KelvinKei(nu,z),
KelvinHer(nu,z), KelvinHei(nu,z);

−0.80891663072.183698556I,2.2678537940.8137995614I,−1.7769711410.9961751070I,−1.078568331+1.766448520I,−0.6866379254+1.124556055I,1.131254963+0.6341847698I

(4)

 -.8089166307 - 2.183698556 I, 2.267853794 - .8137995614 I,

     -1.776971141 - .9961751070 I,

     -1.078568331 + 1.766448520 I,

     -.6866379254 + 1.124556055 I,

     1.131254963 + .6341847698 I

StruveH(nu,z), StruveL(nu,z);

0.3106257308+0.01505583261I,0.3511670099+0.07163120875I

(5)

 .3106257308 + .01505583261 I, .3511670099 + .07163120875 I

AngerJ(nu,z), WeberE(nu,z);

0.85314694800.9735866595I,0.9933652429+0.3464383081I

(6)

 .8531469480 - .9735866595 I, .9933652429 + .3464383081 I

• 

FresnelC, FresnelS:

FresnelC(z),FresnelS(z);

1.682212498+0.4016272750I,0.07110045108+1.175585852I

(7)

 1.682212498 + .4016272750 I, .07110045109 + 1.175585852 I

• 

dawson:

dawson(z);

0.74947490460.1808917014I

(8)

 .7494749046 - .1808917014 I

• 

Elliptic and Inverse Elliptic: EllipticK, EllipticE, EllipticPi, EllipticF, EllipticE, EllipticPi, EllipticCK, EllipticCE, EllipticCPi, EllipticNome

k:=-0.1+2.3*I:

  

Complete elliptic integrals of the first, second and third kind:

EllipticK(k),EllipticE(k),EllipticPi(nu,k);

0.94139429170.02100700736I,2.883535667+0.08445357415I,0.9032179896+0.4174342314I

(9)

 .9413942917 - .02100700736 I, 2.883535667 + .08445357415 I,

     .9032179896 + .4174342314 I

  

Incomplete elliptic integrals of the first, second and third kind:

EllipticF(z,k),EllipticE(z,k),EllipticPi(z,nu,k);

0.7242068410+0.3592870858I,0.4926925228+1.780640518I,0.5430830974+0.4039826151I

(10)

 .7242068410 + .3592870858 I, .4926925228 + 1.780640518 I,

     .5430830974 + .4039826151 I

  

Complementary complete elliptic integrals of the first, second and third kind:

EllipticCK(k),EllipticCE(k),EllipticCPi(nu,k);

0.6737225716+0.9153170422I,0.42481296061.954337561I,0.1660202658+0.9486420664I

(11)

 .6317085569 - .9674715411 I, .2138917976 + 1.929945189 I,

     EllipticCPi(.6666666667 + .8000000000 I, -.1 + 2.3 I)

  

Elliptic Nome:

q:=EllipticNome(k);

q−0.11306222300.004343557919I

(12)

 q := -.1130622230 - .004343557919 I

• 

Jacobi Amplitude and  Elliptic functions: JacobiAM, JacobiSN, JacobiCN, JacobiDN, JacobiNS, JacobiNC, JacobiND, JacobiSC, JacobiCS, JacobiSD, JacobiDS, JacobiCD, JacobiDC

JacobiAM(z,k);

4.005054544+2.900860234I

(13)

 -.1157677377 + .03628288589 I

JacobiSN(z,k), JacobiCN(z,k), JacobiDN(z,k);

−6.9338915595.892090470I,−5.927814364+6.892104554I,−15.3762501814.22897650I

(14)

 -.1155853604 + .03604793064 I,

     .9939602854 + .004191931060 I,

     -.9896343559 + .001229140163 I

JacobiNS(z,k), JacobiNC(z,k), JacobiND(z,k);

−0.08374711996+0.07116430985I,−0.071730494060.08339904633I,−0.03503417853+0.03242016078I

(15)

 -7.884711038 - 2.459026953 I, 1.006058520 - .004242954191 I,

     -1.010472657 - .001255021634 I

JacobiSC(z,k), JacobiCS(z,k);

0.005976741231+1.000922504I,0.0059655166340.9990427250I

(16)

 -.1161326869 + .03675675114 I, -7.826781562 - 2.477227297 I

JacobiSD(z,k), JacobiDS(z,k);

0.43394571520.01837332974I,2.300311961+0.09739556973I

(17)

 .1168410872 - .03628038614 I, 7.806003418 + 2.423846140 I

JacobiCD(z,k), JacobiDC(z,k);

−0.015767031030.4336399162I,−0.08373704817+2.303016116I

(18)

 -1.004364430 - .005483273379 I,

     -.9956248604 + .005435560172 I

• 

Jacobi Theta Functions: JacobiTheta1, JacobiTheta2, JacobiTheta3, JacobiTheta4

JacobiTheta1(z,q), JacobiTheta2(z,q),
JacobiTheta3(z,q), JacobiTheta4(z,q);

1.2004358060.4743634443I,0.013154362571.009987991I,1.175151117+0.3717688091I,0.82124343550.3687317775I

(19)

 1.200435806 - .4743634442 I, .01315436282 - 1.009987991 I,

     1.175151117 + .3717688097 I,

     .8212434354 - .3687317774 I

• 

Weierstrass P, P', zeta and sigma functions: WeierstrassP, WeierstrassPPrime, WeierstrassZeta, WeierstrassSigma

g2:=-0.11-0.7*I: g3:=0.22-0.4*I:

WeierstrassP(z,g2,g3), WeierstrassPPrime(z,g2,g3),
WeierstrassZeta(z,g2,g3), WeierstrassSigma(z,g2,g3);

0.32042878960.6325222283I,0.3493485146+1.127304155I,0.67415455300.4702886987I,0.9993746770+0.6595322141I

(20)

 .4087407191 + .1175456787 I, .3493485143 + 1.127304153 I,

     .6741545534 - .4702886991 I,

     .9993746759 + .6595322132 I

• 

General Pochhammer function over the complex plane: pochhammer

pochhammer(1.0+0.2*I,-0.3+0.7*I);

0.52160477230.3157393579I

(21)

 .5216047723 - .3157393579 I

Differential Equations:

  

Many extensions to dsolve/numeric extending Maple's power in developing numerical solutions to differential equations.

• 

Classical: dsolve[classical]

restart;

deq1 := diff(y(t),t$3)=y(t)+diff(x(t),t),diff(x(t),t$2)=
x(t)*y(t)-diff(y(t), t$2):

init1 := y(0)=1,D(y)(0)=2,(D@@2)(y)(0)=-1,x(0)=4,D(x)(0)=4.3:

ans1 := dsolve({deq1,init1},{x(t),y(t)},numeric,method=classical[abmoulton],
corrections=2):

ans1(1.0);

t=1.0,xt=13.1246093792716,ⅆⅆtxt=18.7876915350014,yt=3.76283413230601,ⅆⅆtyt=5.31760397608216,ⅆ2ⅆt2yt=10.2504683623596

(22)

 [t = 1.0, x(t) = 13.1246093794391730,

     d

     -- x(t) = 18.7876915356564993,

     dt

     y(t) = 3.76283413231971675,

     d

     -- y(t) = 5.31760397612483793,

     dt

      2

     d

     --- y(t) = 10.2504683625320059]

       2

     dt

• 

Gear: dsolve[gear] - a C.W.Gear single-step extrapolation method.

Digits := 10:

deq1 := {diff(y(x), x$3) = y(x)*diff(y(x), x)-x}:

init1 := {(D@@2)(y)(1) = 4, D(y)(1) = 3, y(1) = 2.4 }:

ans1 := dsolve(deq1 union init1, y(x), type=numeric,
method=gear[polyextr], stepsize=0.015, minstep=Float(1,-11),
errorper=Float(1,-5)):

ans1(1.01);

x=1.01,yx=2.43020104070930,ⅆⅆxyx=3.04031295467142,ⅆ2ⅆx2yx=4.06288854913227

(23)

 [x = 1.01, y(x) = 2.43020104070929621,

     d

     -- y(x) = 3.04031295467141982,

     dx

      2

     d

     --- y(x) = 4.06288854913227304]

       2

     dx

• 

Mgear: dsolve[mgear] -  a C.W.Gear multiple-step extrapolation method.

Digits := 12:

deq3 := diff(y(t), t$2) = 100*(exp(-10*t)+exp(10*t)):

ans3 := dsolve({deq3}, y(t), numeric, method=mgear[msteppart],
initial=array([2,0]), start=0):

Error, (in dsolve/numeric) the 'mgear' method has been removed, please use 'rosenbrock' or 'lsode' instead

ans3(0.7653);

ans30.7653

(24)

 [t = .7653, y(t) = 2106.95826948761987,

     d

     -- y(t) = 21069.5691650687149]

     dt

• 

Lsode: dsolve[lsode] - the "Livermore Stiff ODE Solver"

Digits := 10:

deq1 := {diff(y(x), x$3) = y(x)*diff(y(x), x) - x }:

init1 := { (D@@2)(y)(1) = 4, D(y)(1) = 3, y(1) = 2.4 }:

ans1 := dsolve(deq1 union init1, y(x), type=numeric,
method=lsode[adamsfull]):

ans1(1.5);

x=1.5,yx=4.59316878380163,ⅆⅆxyx=6.33685490613476,ⅆ2ⅆx2yx=11.0436021501495

(25)

 [x = 1.5, y(x) = 4.59316878380162308,

     d

     -- y(x) = 6.33685490613474300,

     dx

      2

     d

     --- y(x) = 11.0436021501494359]

       2

     dx

Linear Algebra:

• 

Numerical computations for matrix-decomposition routines: linalg[cholesky], linalg[QRdecomp], linalg[LUdecomp]

with(linalg):

A := matrix([[1.,2.,3.],[4.,5.,6.]]):

R := QRdecomp(A,Q='q',rank='r');

R4.123105625617665.335783750799336.548461875980990.0.7276068751089991.45521375021800

(26)

eval(q);

0.2425356250363330.9701425001453320.970142500145332−0.242535625036333

(27)

r;

2

(28)
• 

linalg[eigenvals], linalg[inverse]: use hardware floating-point when possible.

Numerical Approximation of Functions

• 

numapprox[chebmult]: Tools to manipulate Chebyshev series:

with(numapprox):  Digits:=3:

a:=chebyshev(sin(x),x):

b:=chebyshev(exp(x),x):

chebmult(a,b);

0.496T0,x+1.22T1,x+0.494T2,x+0.0718T3,x0.00212T4,x0.00227T5,x0.000344T6,x0.0000390T7,x+5.×10−7T8,x+1.37×10−6T9,x+1.36×10−7T10,x

(29)

 .496 T(0, x) + 1.22 T(1, x) + .494 T(2, x) + .0728 T(3, x)

      - .00212 T(4, x) - .00227 T(5, x) - .000344 T(6, x)

                                -6

      - .0000390 T(7, x) + .5 10   T(8, x)

               -5                  -6

      + .137 10   T(9, x) + .136 10   T(10, x)

Statistics:

• 

ANOVA (oneway): stats[anova]

with(stats[anova],oneway):

  

example with variance ratio of 0.1 with 1 and 4 degrees of freedom. Level of significance is 0.23 < 0.95 (non-signif)

oneway( [ [1.0,2.0,3.0],[1.0,2.0,4.0] ] );

1&comma;0.16&comma;0.16&comma;4&comma;6.67&comma;1.668&comma;5&comma;6.83,1&comma;4&comma;0.09592&comma;0.2278

(30)
• 

least median of squares regression: fit[leastmediansquare]

with(stats[fit]):

leastmediansquare[[x,y]]( [[1,2,3,4],[2,3,5,5]] );

y=x+1

(31)

Financial Calculations

  

The package finance provides functions for calculations related to finance. Some of the functions are: annuity, cashflows, perpetuity.

  

Amortization table of a loan of 100 at 10% interest, with payments of 50 per period

A:=finance[ amortization ] ( 100, 50, .10 ):

amortization_table[N, Payment, Interest, Principal, Balance]=matrix(A[1]);

Error, (in linalg:-matrix) invalid argument Vector[row](5, {(1) = n, (2) = Payment, (3) = Interest, (4) = Principal, (5) = Balance})

 amortization_table[N, Payment, Interest, Principal, Balance

         [0     0       0      -100    100 ]

     ] = [1     50     10.0    40.0    60.0]

         [2     50     6.00    44.0    16.0]

         [3    17.6    1.60    16.0     0  ]

cost_of_loan:=A[2];

000100100

(32)

Miscellaneous:

• 

The routines factor, convert/parfrac, resultant and content have been extended to handle floating points (for content, it just works for simple cases).

f := (2.3*x)/(5.4*x^3-2.3*x+1):

convert(f,parfrac,x);

0.224x+0.0636x20.810x+0.2290.224x+0.809

(33)

     .224            .344 + 1.21 x

 - -------- + .185 ------------------

   x + .809         2

                   x  - .810 x + .229

factor(x^3+5.0);

x+1.71x21.71x+2.92

(34)

              2

 (x + 1.71) (x  - 1.71 x + 2.92)

resultant( 1.1*x+1.2, 1.3*x+1.4, x);

−0.02

(35)

content( 5.4*x*y, x);

5.4y

(36)
• 

The routine Maple_floats computes the values of various parameters and constants associated with the arbitrary precision floating point computation environment.

readlib(Maple_floats):

Maple_floats(MAX_FLOAT);

1.×109223372036854775806

(37)

      2147483647

 .9 10

Maple_floats(sqrt(MAX_FLOAT)/LN_MAX_FLOAT);

4.708630210×104611686018427387883

(38)

 

               1073741814

 .6067023828 10