Items tagged with numerical-analysis

Feed


iam trying to apply newton method on non liner system but i have a problem for apply while loop inside other while loop 
any help please

with(VectorCalculus):

NULL

f[1] := VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(x^2, VectorCalculus:-`-`(VectorCalculus:-`*`(z, exp(y)))), VectorCalculus:-`-`(VectorCalculus:-`*`(y, exp(z)))), 61):

f[2] := VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`*`(VectorCalculus:-`*`(x, y), z), VectorCalculus:-`-`(exp(x))), -3):

f[3] := VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(x^2, y^2), z^2), -14):

F := Matrix([[f[1]], [f[2]], [f[3]]]):

FF := eval(F, [x = x[k], y = y[k], z = z[k]]):

X := Matrix([[x], [y], [z]]):

XX := eval(X, [x = x[k], y = y[k], z = z[k]]):

J := Jacobian([f[1], f[2], f[3]], [x, y, z]):

JJ := eval(J, [x = x[k], y = y[k], z = z[k]])

JJ := Matrix(3, 3, {(1, 1) = 2*x[k], (1, 2) = -z[k]*exp(y[k])-exp(z[k]), (1, 3) = -exp(y[k])-y[k]*exp(z[k]), (2, 1) = y[k]*z[k]-exp(x[k]), (2, 2) = x[k]*z[k], (2, 3) = x[k]*y[k], (3, 1) = 2*x[k], (3, 2) = 2*y[k], (3, 3) = 2*z[k]})

(1)

``

k := 0:

xi := convert(exp(-10), float):

maxval := 10^4:

NULL

while convert(Norm(FF, 2), float) > xi do alpha[k] := min(1, alpha[k]/lambda); L := 1/JJ.FF; K := -L*alpha[k]+XX; x[k+1] := evalf(Determinant(K[1])); y[k+1] := evalf(Determinant(K[2])); z[k+1] := evalf(Determinant(K[3])); A := convert(Norm(FFF, 2), float)^2; B := convert(Norm(FF, 2), float)^2; while A > B do L := 1/JJ.FF; alpha[k+1] := lambda*alpha[k]; K := -L*alpha[k+1]+XX; x[k+1] := evalf(Determinant(K[1])); y[k+1] := evalf(Determinant(K[2])); z[k+1] := evalf(Determinant(K[3])) end do; k := k+1 end do

alpha[0] := 1

 

L := Matrix(3, 1, {(1, 1) = -(12900-300*exp(8)-1200*exp(2))/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500)-(2*exp(8)+31*exp(2))*(77-exp(5))/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500)-(395/2)*(7*exp(8)-4*exp(2))/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500), (2, 1) = (84+exp(5))*(86-2*exp(8)-8*exp(2))/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500)+(5/2)*(4+exp(8)+8*exp(2))*(77-exp(5))/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500)+(79/4)*(exp(8)*exp(5)+8*exp(2)*exp(5)-16*exp(8)-128*exp(2)-400)/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500), (3, 1) = -(-39+4*exp(5))*(86-2*exp(8)-8*exp(2))/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500)-(5/2)*(16+2*exp(8)+exp(2))*(77-exp(5))/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500)-(79/4)*(2*exp(8)*exp(5)+exp(2)*exp(5)-32*exp(8)-16*exp(2)-100)/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500)})

 

K := Matrix(3, 1, {(1, 1) = 5+(12900-300*exp(8)-1200*exp(2))/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500)+(2*exp(8)+31*exp(2))*(77-exp(5))/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500)+(395/2)*(7*exp(8)-4*exp(2))/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500), (2, 1) = 8-(84+exp(5))*(86-2*exp(8)-8*exp(2))/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500)-(5/2)*(4+exp(8)+8*exp(2))*(77-exp(5))/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500)-(79/4)*(exp(8)*exp(5)+8*exp(2)*exp(5)-16*exp(8)-128*exp(2)-400)/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500), (3, 1) = 2+(-39+4*exp(5))*(86-2*exp(8)-8*exp(2))/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500)+(5/2)*(16+2*exp(8)+exp(2))*(77-exp(5))/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500)+(79/4)*(2*exp(8)*exp(5)+exp(2)*exp(5)-32*exp(8)-16*exp(2)-100)/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500)})

 

14.35960152

 

-12.24471811

 

39.82986865

 

HFloat(5.911285325999999e36)

 

35235903.22

 

Warning,  computation interrupted

 

 

 

Numeric.mw

Is there an iterative solver for numeric equations. I'm trying to solve for Iarc & Rarc knowing C and Z1, Z1 can be complex.

Hello everyone.

Please can I meet with Computational or/and Numerical anlysts that have worked or working on the algorihms particularly (Runge Kutta Nystrom, Block multistep methods including hybrid and Block Boundaru Value methods) for the solution of both IVP and BVP.

I will appreciante if I can learn from them and possibly collaborate with them. Thank you in anticipation of your positive response.

Please I need Correction on this code particularly if I can make do without the declaration of vector in the third subroutine . The idea is to get maximum error. The code has 3 subroutine. The problem I think is in the third subroutine (Display of results).

Thank you in anticipation of positive response.

# First Declaration of the problem

restart:
Digits:=30:
interface(rtablesize=infinity):

f1:=proc(n)
    y2[n]:
end proc:
f2:=proc(n)
    -y1[n]+0.001*cos(t[n]):
end proc:
f3:=proc(n)
    y4[n]:
end proc:
f4:=proc(n)
    -y3[n]+0.001*sin(t[n]):
end proc:
F1:=proc(n)
    f2(n):
end proc:
F2:=proc(n)
    -(f1(n))-0.001*sin(t[n]):
end proc:
F3:=proc(n)
    f4(n):
end proc:
F4:=proc(n)
    -f3(n)+0.001*cos(t[n]):
end proc:


# Declaration of the Numerical methods

e1:=y1[n+2] = (7/23)*y1[n]+(16/23)*y1[n+1]+(12/23)*f1(n+2)*h+(16/23)*f1(n+1)*h-(2/23)*F1(n+2)*h^2+(2/23)*h*f1(n)+((24/3703)*y1[n]-(24/3703)*y1[n+1]+(48/18515)*f1(n+2)*h+(8/55545)*f1(n+1)*h-(116/55545)*F1(n+2)*h^2+(208/55545)*h*f1(n))*u^2+((901/2980915)*y1[n]-(901/2980915)*y1[n+1]+(7109/89427450)*f1(n+2)*h+(923/14904575)*f1(n+1)*h-(6241/89427450)*F1(n+2)*h^2+(14383/89427450)*h*f1(n))*u^4+((1979723/158376013950)*y1[n]-(1979723/158376013950)*y1[n+1]+(6364571/2375640209250)*f1(n+2)*h+(728327/215967291750)*f1(n+1)*h-(11785633/4751280418500)*F1(n+2)*h^2+(5106559/791880069750)*h*f1(n))*u^6+((6488435581/13259239887894000)*y1[n]-(6488435581/13259239887894000)*y1[n+1]+(8693517709/91794737685420000)*f1(n+2)*h+(260601208141/1789997384865690000)*f1(n+1)*h-(323357994149/3579994769731380000)*F1(n+2)*h^2+(891627999937/3579994769731380000)*h*f1(n))*u^8+((25090513463/1343541160668420000)*y1[n]-(25090513463/1343541160668420000)*y1[n+1]+(190450718149/55421072877572325000)*f1(n+2)*h+(47563947061/8210529315195900000)*f1(n+1)*h-(1475729910283/443368583020578600000)*F1(n+2)*h^2+(261738159769/27710536438786162500)*h*f1(n))*u^10+((244426606265778733/347060946154014557665200000)*y1[n]-(244426606265778733/347060946154014557665200000)*y1[n+1]+(1316372988977975777/10411828384620436729956000000)*f1(n+2)*h+(105391490263288387/473264926573656214998000000)*f1(n+1)*h-(1284959669761615073/10411828384620436729956000000)*F1(n+2)*h^2+(72506125749079249/204153497737655622156000000)*h*f1(n))*u^12:

e2:=h^2*F1(n+1) = (60/23)*y1[n]-(60/23)*y1[n+1]+(25/46)*f1(n+2)*h+(32/23)*f1(n+1)*h-(4/23)*F1(n+2)*h^2+(31/46)*h*f1(n)+((209/3703)*y1[n]-(209/3703)*y1[n+1]+(1313/222180)*f1(n+2)*h+(1304/55545)*f1(n+1)*h-(131/18515)*F1(n+2)*h^2+(6011/222180)*h*f1(n))*u^2+((77491/35770980)*y1[n]-(77491/35770980)*y1[n+1]+(574843/2146258800)*f1(n+2)*h+(113536/134141175)*f1(n+1)*h-(53461/178854900)*F1(n+2)*h^2+(2258041/2146258800)*h*f1(n))*u^4+((151508243/1900512167400)*y1[n]-(151508243/1900512167400)*y1[n+1]+(1290306599/114030730044000)*f1(n+2)*h+(18919693/647901875250)*f1(n+1)*h-(113769323/9502560837000)*F1(n+2)*h^2+(4470322013/114030730044000)*h*f1(n))*u^6+((42120775181/14464625332248000)*y1[n]-(42120775181/14464625332248000)*y1[n+1]+(332746636891/734357901483360000)*f1(n+2)*h+(302396120633/298332897477615000)*f1(n+1)*h-(369019384141/795554393273640000)*F1(n+2)*h^2+(13797329479621/9546652719283680000)*h*f1(n))*u^8+((18953368786273/177347433208231440000)*y1[n]-(18953368786273/177347433208231440000)*y1[n+1]+(2430202319484337/138330997902420523200000)*f1(n+2)*h+(310803544671199/8645687368901282700000)*f1(n+1)*h-(203453960588449/11527583158535043600000)*F1(n+2)*h^2+(7380568619069419/138330997902420523200000)*h*f1(n))*u^10+((16436168060905785763/4164731353848174691982400000)*y1[n]-(16436168060905785763/4164731353848174691982400000)*y1[n+1]+(167160345356705269819/249883881230890481518944000000)*f1(n+2)*h+(461636091223370027/354948694930242161248500000)*f1(n+1)*h-(13852288092290788813/20823656769240873459912000000)*F1(n+2)*h^2+(29059878239787610409/14699051837111204795232000000)*h*f1(n))*u^12:


e3:=y2[n+2] = (7/23)*y2[n]+(16/23)*y2[n+1]+(12/23)*f2(n+2)*h+(16/23)*f2(n+1)*h-(2/23)*F2(n+2)*h^2+(2/23)*h*f2(n)+((24/3703)*y2[n]-(24/3703)*y2[n+1]+(48/18515)*f2(n+2)*h+(8/55545)*f2(n+1)*h-(116/55545)*F2(n+2)*h^2+(208/55545)*h*f2(n))*u^2+((901/2980915)*y2[n]-(901/2980915)*y2[n+1]+(7109/89427450)*f2(n+2)*h+(923/14904575)*f2(n+1)*h-(6241/89427450)*F2(n+2)*h^2+(14383/89427450)*h*f2(n))*u^4+((1979723/158376013950)*y2[n]-(1979723/158376013950)*y2[n+1]+(6364571/2375640209250)*f2(n+2)*h+(728327/215967291750)*f2(n+1)*h-(11785633/4751280418500)*F2(n+2)*h^2+(5106559/791880069750)*h*f2(n))*u^6+((6488435581/13259239887894000)*y2[n]-(6488435581/13259239887894000)*y2[n+1]+(8693517709/91794737685420000)*f2(n+2)*h+(260601208141/1789997384865690000)*f2(n+1)*h-(323357994149/3579994769731380000)*F2(n+2)*h^2+(891627999937/3579994769731380000)*h*f2(n))*u^8+((25090513463/1343541160668420000)*y2[n]-(25090513463/1343541160668420000)*y2[n+1]+(190450718149/55421072877572325000)*f2(n+2)*h+(47563947061/8210529315195900000)*f2(n+1)*h-(1475729910283/443368583020578600000)*F2(n+2)*h^2+(261738159769/27710536438786162500)*h*f2(n))*u^10+((244426606265778733/347060946154014557665200000)*y2[n]-(244426606265778733/347060946154014557665200000)*y2[n+1]+(1316372988977975777/10411828384620436729956000000)*f2(n+2)*h+(105391490263288387/473264926573656214998000000)*f2(n+1)*h-(1284959669761615073/10411828384620436729956000000)*F2(n+2)*h^2+(72506125749079249/204153497737655622156000000)*h*f2(n))*u^12:

e4:=h^2*F2(n+1) = (60/23)*y2[n]-(60/23)*y2[n+1]+(25/46)*f2(n+2)*h+(32/23)*f2(n+1)*h-(4/23)*F2(n+2)*h^2+(31/46)*h*f2(n)+((209/3703)*y2[n]-(209/3703)*y2[n+1]+(1313/222180)*f2(n+2)*h+(1304/55545)*f2(n+1)*h-(131/18515)*F2(n+2)*h^2+(6011/222180)*h*f2(n))*u^2+((77491/35770980)*y2[n]-(77491/35770980)*y2[n+1]+(574843/2146258800)*f2(n+2)*h+(113536/134141175)*f2(n+1)*h-(53461/178854900)*F2(n+2)*h^2+(2258041/2146258800)*h*f2(n))*u^4+((151508243/1900512167400)*y2[n]-(151508243/1900512167400)*y2[n+1]+(1290306599/114030730044000)*f2(n+2)*h+(18919693/647901875250)*f2(n+1)*h-(113769323/9502560837000)*F2(n+2)*h^2+(4470322013/114030730044000)*h*f2(n))*u^6+((42120775181/14464625332248000)*y2[n]-(42120775181/14464625332248000)*y2[n+1]+(332746636891/734357901483360000)*f2(n+2)*h+(302396120633/298332897477615000)*f2(n+1)*h-(369019384141/795554393273640000)*F2(n+2)*h^2+(13797329479621/9546652719283680000)*h*f2(n))*u^8+((18953368786273/177347433208231440000)*y2[n]-(18953368786273/177347433208231440000)*y2[n+1]+(2430202319484337/138330997902420523200000)*f2(n+2)*h+(310803544671199/8645687368901282700000)*f2(n+1)*h-(203453960588449/11527583158535043600000)*F2(n+2)*h^2+(7380568619069419/138330997902420523200000)*h*f2(n))*u^10+((16436168060905785763/4164731353848174691982400000)*y2[n]-(16436168060905785763/4164731353848174691982400000)*y2[n+1]+(167160345356705269819/249883881230890481518944000000)*f2(n+2)*h+(461636091223370027/354948694930242161248500000)*f2(n+1)*h-(13852288092290788813/20823656769240873459912000000)*F2(n+2)*h^2+(29059878239787610409/14699051837111204795232000000)*h*f2(n))*u^12:

e5:=y3[n+2] = (7/23)*y3[n]+(16/23)*y3[n+1]+(12/23)*f3(n+2)*h+(16/23)*f3(n+1)*h-(2/23)*F3(n+2)*h^2+(2/23)*h*f3(n)+((24/3703)*y3[n]-(24/3703)*y3[n+1]+(48/18515)*f3(n+2)*h+(8/55545)*f3(n+1)*h-(116/55545)*F3(n+2)*h^2+(208/55545)*h*f3(n))*u^2+((901/2980915)*y3[n]-(901/2980915)*y3[n+1]+(7109/89427450)*f3(n+2)*h+(923/14904575)*f3(n+1)*h-(6241/89427450)*F3(n+2)*h^2+(14383/89427450)*h*f3(n))*u^4+((1979723/158376013950)*y3[n]-(1979723/158376013950)*y3[n+1]+(6364571/2375640209250)*f3(n+2)*h+(728327/215967291750)*f3(n+1)*h-(11785633/4751280418500)*F3(n+2)*h^2+(5106559/791880069750)*h*f3(n))*u^6+((6488435581/13259239887894000)*y3[n]-(6488435581/13259239887894000)*y3[n+1]+(8693517709/91794737685420000)*f3(n+2)*h+(260601208141/1789997384865690000)*f3(n+1)*h-(323357994149/3579994769731380000)*F3(n+2)*h^2+(891627999937/3579994769731380000)*h*f3(n))*u^8+((25090513463/1343541160668420000)*y3[n]-(25090513463/1343541160668420000)*y3[n+1]+(190450718149/55421072877572325000)*f3(n+2)*h+(47563947061/8210529315195900000)*f3(n+1)*h-(1475729910283/443368583020578600000)*F3(n+2)*h^2+(261738159769/27710536438786162500)*h*f3(n))*u^10+((244426606265778733/347060946154014557665200000)*y3[n]-(244426606265778733/347060946154014557665200000)*y3[n+1]+(1316372988977975777/10411828384620436729956000000)*f3(n+2)*h+(105391490263288387/473264926573656214998000000)*f3(n+1)*h-(1284959669761615073/10411828384620436729956000000)*F3(n+2)*h^2+(72506125749079249/204153497737655622156000000)*h*f3(n))*u^12:
e6:=h^2*F3(n+1) = (60/23)*y3[n]-(60/23)*y3[n+1]+(25/46)*f3(n+2)*h+(32/23)*f3(n+1)*h-(4/23)*F3(n+2)*h^2+(31/46)*h*f3(n)+((209/3703)*y3[n]-(209/3703)*y3[n+1]+(1313/222180)*f3(n+2)*h+(1304/55545)*f3(n+1)*h-(131/18515)*F3(n+2)*h^2+(6011/222180)*h*f3(n))*u^2+((77491/35770980)*y3[n]-(77491/35770980)*y3[n+1]+(574843/2146258800)*f3(n+2)*h+(113536/134141175)*f3(n+1)*h-(53461/178854900)*F3(n+2)*h^2+(2258041/2146258800)*h*f3(n))*u^4+((151508243/1900512167400)*y3[n]-(151508243/1900512167400)*y3[n+1]+(1290306599/114030730044000)*f3(n+2)*h+(18919693/647901875250)*f3(n+1)*h-(113769323/9502560837000)*F3(n+2)*h^2+(4470322013/114030730044000)*h*f3(n))*u^6+((42120775181/14464625332248000)*y3[n]-(42120775181/14464625332248000)*y3[n+1]+(332746636891/734357901483360000)*f3(n+2)*h+(302396120633/298332897477615000)*f3(n+1)*h-(369019384141/795554393273640000)*F3(n+2)*h^2+(13797329479621/9546652719283680000)*h*f3(n))*u^8+((18953368786273/177347433208231440000)*y3[n]-(18953368786273/177347433208231440000)*y3[n+1]+(2430202319484337/138330997902420523200000)*f3(n+2)*h+(310803544671199/8645687368901282700000)*f3(n+1)*h-(203453960588449/11527583158535043600000)*F3(n+2)*h^2+(7380568619069419/138330997902420523200000)*h*f3(n))*u^10+((16436168060905785763/4164731353848174691982400000)*y3[n]-(16436168060905785763/4164731353848174691982400000)*y3[n+1]+(167160345356705269819/249883881230890481518944000000)*f3(n+2)*h+(461636091223370027/354948694930242161248500000)*f3(n+1)*h-(13852288092290788813/20823656769240873459912000000)*F3(n+2)*h^2+(29059878239787610409/14699051837111204795232000000)*h*f3(n))*u^12:

e7:=y4[n+2] = (7/23)*y4[n]+(16/23)*y4[n+1]+(12/23)*f4(n+2)*h+(16/23)*f4(n+1)*h-(2/23)*F4(n+2)*h^2+(2/23)*h*f4(n)+((24/3703)*y4[n]-(24/3703)*y4[n+1]+(48/18515)*f4(n+2)*h+(8/55545)*f4(n+1)*h-(116/55545)*F4(n+2)*h^2+(208/55545)*h*f4(n))*u^2+((901/2980915)*y4[n]-(901/2980915)*y4[n+1]+(7109/89427450)*f4(n+2)*h+(923/14904575)*f4(n+1)*h-(6241/89427450)*F4(n+2)*h^2+(14383/89427450)*h*f4(n))*u^4+((1979723/158376013950)*y4[n]-(1979723/158376013950)*y4[n+1]+(6364571/2375640209250)*f4(n+2)*h+(728327/215967291750)*f4(n+1)*h-(11785633/4751280418500)*F4(n+2)*h^2+(5106559/791880069750)*h*f4(n))*u^6+((6488435581/13259239887894000)*y4[n]-(6488435581/13259239887894000)*y4[n+1]+(8693517709/91794737685420000)*f4(n+2)*h+(260601208141/1789997384865690000)*f4(n+1)*h-(323357994149/3579994769731380000)*F4(n+2)*h^2+(891627999937/3579994769731380000)*h*f4(n))*u^8+((25090513463/1343541160668420000)*y4[n]-(25090513463/1343541160668420000)*y4[n+1]+(190450718149/55421072877572325000)*f4(n+2)*h+(47563947061/8210529315195900000)*f4(n+1)*h-(1475729910283/443368583020578600000)*F4(n+2)*h^2+(261738159769/27710536438786162500)*h*f4(n))*u^10+((244426606265778733/347060946154014557665200000)*y4[n]-(244426606265778733/347060946154014557665200000)*y4[n+1]+(1316372988977975777/10411828384620436729956000000)*f4(n+2)*h+(105391490263288387/473264926573656214998000000)*f4(n+1)*h-(1284959669761615073/10411828384620436729956000000)*F4(n+2)*h^2+(72506125749079249/204153497737655622156000000)*h*f4(n))*u^12:

e8:=h^2*F4(n+1) = (60/23)*y4[n]-(60/23)*y4[n+1]+(25/46)*f4(n+2)*h+(32/23)*f4(n+1)*h-(4/23)*F4(n+2)*h^2+(31/46)*h*f4(n)+((209/3703)*y4[n]-(209/3703)*y4[n+1]+(1313/222180)*f4(n+2)*h+(1304/55545)*f4(n+1)*h-(131/18515)*F4(n+2)*h^2+(6011/222180)*h*f4(n))*u^2+((77491/35770980)*y4[n]-(77491/35770980)*y4[n+1]+(574843/2146258800)*f4(n+2)*h+(113536/134141175)*f4(n+1)*h-(53461/178854900)*F4(n+2)*h^2+(2258041/2146258800)*h*f4(n))*u^4+((151508243/1900512167400)*y4[n]-(151508243/1900512167400)*y4[n+1]+(1290306599/114030730044000)*f4(n+2)*h+(18919693/647901875250)*f4(n+1)*h-(113769323/9502560837000)*F4(n+2)*h^2+(4470322013/114030730044000)*h*f4(n))*u^6+((42120775181/14464625332248000)*y4[n]-(42120775181/14464625332248000)*y4[n+1]+(332746636891/734357901483360000)*f4(n+2)*h+(302396120633/298332897477615000)*f4(n+1)*h-(369019384141/795554393273640000)*F4(n+2)*h^2+(13797329479621/9546652719283680000)*h*f4(n))*u^8+((18953368786273/177347433208231440000)*y4[n]-(18953368786273/177347433208231440000)*y4[n+1]+(2430202319484337/138330997902420523200000)*f4(n+2)*h+(310803544671199/8645687368901282700000)*f4(n+1)*h-(203453960588449/11527583158535043600000)*F4(n+2)*h^2+(7380568619069419/138330997902420523200000)*h*f4(n))*u^10+((16436168060905785763/4164731353848174691982400000)*y4[n]-(16436168060905785763/4164731353848174691982400000)*y4[n+1]+(167160345356705269819/249883881230890481518944000000)*f4(n+2)*h+(461636091223370027/354948694930242161248500000)*f4(n+1)*h-(13852288092290788813/20823656769240873459912000000)*F4(n+2)*h^2+(29059878239787610409/14699051837111204795232000000)*h*f4(n))*u^12:

# Display of the solutions


h:=evalf(Pi/6):

omega:=1.0:
u:=omega*h:
N:=solve(h*p = 12*Pi/6, p):
n:=0:

exy1:= [seq](eval(cos(i)+0.0005*i*sin(i)), i=h..N,h):
exy2:= [seq](eval(-0.9995*sin(i)+0.0005), i=h..N,h):
exy3:= [seq](eval(sin(i)-0.0005*i*cos(i)), i=h..N,h):
exy4:= [seq](eval(0.9995*sin(i)+0.0005*i*sin(i)), i=h..N,h):

iny1:=1:
iny2:=0:
iny3:=0:
iny4:=0.9995:

err1 := Vector(N):
err2 := Vector(N):
c:=1:
inx:=0:
vars := y1[n+1],y1[n+2],y2[n+1],y2[n+2],y3[n+1],y3[n+2],y4[n+1],y4[n+2]:
for j from 0 to 2 do
    x[j]:=inx+j*h:
end do:
printf("%4s%9s%9s%9s%9s%9s%9s%10s%10s%9s%9s%9s%10s\n",
    "h","numy1","numy2","numy3","numy4",
    "exy1","exy2","exy3","exy4",
    "erry1","erry2","erry3","erry4");
    
st := time():
for k from 1 to N/2 do
    param1:=y1[n]=iny1,y2[n]=iny2,y3[n]=iny3,y4[n]=iny4:
    param2:=t[n]=x[0],t[n+1]=x[1],t[n+2]=x[2]:
    
    res:=eval(<vars>, fsolve(eval({e||(1..8)},[param1,param2]),{vars})):
    
    for i from 1 to 2 do
        printf("%5.2f%9.3f%9.3f%9.3f%9.3f %8.5f%10.5f%10.5f%10.5f %8.2g%9.3g%9.3g%8.3g\n",
        h*c,res[i],res[i+2],res[i+4],res[i+6],
        exy1[c],exy2[c],exy3[c],exy4[c],
        abs(res[i]-exy1[c]),abs(res[i+2]-exy2[c]),abs(res[i+4]-exy3[c]),abs(res[i+6]-exy4[c])):

        err1[c] := abs(evalf(res[i]-exy1)):
        err2[c] := abs(evalf(res[i+4]-exy3)):
        c:=c+1:
    end do:
    iny1:=res[2]:
    iny2:=res[4]:
    iny3:=res[6]:
    iny4:=res[8]:
    inx:=x[2]:
    for j from 0 to 2 do
        x[j]:=inx+j*h:
    end do:
end do:
v:=time() - st;
printf("Maximum error is %.13g", max(err1));
printf("Maximum error is %.13g", max(err2));

 

Hello i need a tutor to help me with  Numerical analysis on Maple and the programming part. Im In UAE but we can do this online as well

I want to write a procedure ThirdDer := proc(f,x0,h) which, given the funcion f, the point x0 and the step size h returns the value of f'''(x0). where f'''(x0) = (f(x0 +2h)−2f(x0 +h)+2f(x0 −h)−f(x0 −2h))/2h^3 

help

I tried splitting f''' up and assigning the 4 different parts as a letter then putting it all together but that didnt work..

Hello!

I was creating this code for the "Müller Method" for Numerical Analysis. Everything works fine till the if (for getting the x3) goes on. The problem is, the Maple doesn't detects the if.
I tried checking every variable and every variable is calculated except "x3"; even "disc".

I would like to know what happened. Anyways, here's the code:
http://imgur.com/a/DGlgl
 

                     
x0 := 0; x1 := 8.4; x2 := 10; iter := 1000; tol := 10^(-8); f := proc (x) options operator, arrow; 3*x^3+7*x^2+x+2 end proc; f(x); plot(f(x), color = green); printf(" n          x0               x1               x2              x3                Error \n"); for i to iter do d0 := evalf((f(x1)-f(x0))/(x1-x0)); d1 := evalf((f(x2)-f(x1))/(x2-x1)); h1 := evalf(x2-x1); h0 := evalf(x1-x0); a := evalf((d1-d0)/(h1-h0)); b := evalf(a*h1+d1); c := evalf(f(x2)); disc := sqrt(-4*a*c+b^2); if abs(b+disc) > abs(b-disc) then x3 := x2+(-2*c)*(1/(b+sqrt(-4*a*c+b^2))); erry := abs((x3-x2)/x3) else x3 := x2+(-2*c)*(1/(b-sqrt(-4*a*c+b^2))); erry := abs((x3-x2)/x3) end if; if erry > tol then x0 := x1; x1 := x2; x2 := x3; printf("%2d     %2.8f      %2.8f       %2.8f         %2.5 f     %2.8 f \n", i, a, b, c, x3, erry) else printf("una raiz es: %2.8f ", x3); break end if end do;

I put the image (as it looks on my maple) and the "code" so you can copy-paste it in Maple.

hi,

how we can use maple to find solution of singuler integral equation by using product nystrom method or toeplitz method in maple?

Dear All

In student numerical package, for in case of Secant method, how can we force Maple to print procedure and result of every iteration like we do in calculations by hand??

It gives direct output like:

 

with(Student[NumericalAnalysis]):

f := x^3-7*x^2+14*x-6

x^3-7*x^2+14*x-6

(1)

Secant(f, x = [2.7, 3.2], tolerance = 10^(-2))

3.005775850

(2)

Secant(f, x = [2.7, 3.2], tolerance = 10^(-2), output = sequence)

2.7, 3.2, 3.100884956, 2.858406793, 3.026267866, 3.005775850

(3)

What is we want print actual procedure that carry out calculations in step (3) ?

*What if, **want to

Download Secant_Method.mw

Regards

I have a system of equations in several variables and I just need one numerical solution of it, I tryed to use fsolve of Maple but it always show me some errors or gives back the command as the output.

aaghulu := {-6-4*y-x-(1+y)*x+sqrt((4*(1+y))*(2+x)*(4+2*y+x)+(-(1+y)*x+2+x)^2), (2*(4+2*y+x))*(1+y)-(1+y)*x+2+x+sqrt((4*(1+y))*(2+x)*(4+2*y+x)+(-(1+y)*x+2+x)^2)-(2+y)*(-(1+y)*x+2+x+sqrt((4*(1+y))*(2+x)*(4+2*y+x)+(-(1+y)*x+2+x)^2))};

fsolve(aaghulu, {x, y}, maxsols = 1);

 

I will be happy if someone guide me how to do these kinds of things using Maple.

f:=proc(x)
return 2^x
n:=5
M:=-2,-1,0,1,2
P:=1
for k to n+1 do
L:=1
for i to n+1 do
if i<>k then
L:=L*(x-M[i])/(M[k]-M[i]); end if; end do;
P:=P+f(M[k])*L;
end do;
I write Lagran algorithm. sorry, my english is not very good


 \int_{a}^{b} f(x) \, dx \approx \tfrac{3h}{8}\left[f(x_0) + 3f(x_1) + 3f(x_2) 
+ 2f(x_3) + 3f(x_4) + 3f(x_5) + 2f(x_6) + ... + f(x_n)\right] .


A Fantastic Good morning Ladies and Gentelmen,

You have the mission to find the problem in that code/ give a better code?
I want to write a procedure for the simpson 3/8 rule using the above formula I took from wikipedia :
(I don't want to use any super maple command that estimate the simpson 3/8, but just using this formula and starting from scratch, I am a beginner so feel free to laugh at my code hehehe)
here is the code I managed to write after 365 hours :D

restart:
simp38:=proc(f,x0,xn,n)                 
     local h,summ,i,x,Integral:                                              
     h=evalf((xn-x0)/n);               #h is the distance between 2 points
     summ:=f(x0)+f(xn);              #initialise the summ
    
      for i from 1 to n-1 by 3 do             
          x[i]:=x0+i*h:
          summ:=evalf(summ+3*f(x[i])):
      od:
      for i from 2 to n-1 by 3 do              
          x[i]:=x0+i*h:
          summ:=evalf(summ+3*f(x[i])):
      od:
      for i from 3 to n-1 by 3 do                  
          x[i]:=x0+i*h:
          summ:=evalf(summ+2*f(x[i])):  
      od:
    
      Integral:=3*h/8*summ;                  
 end:

simp38(x->(x^5-5.15*x^2+8.55*x-4.05045),1,5,6);   #testing it      --->2481.087090
evalf(int(x^5-5.15*x^2+8.55*x-4.05045,x=1..5));      #comparing it --->2477.531533


Your help will be apreciated.


to compute a maple program using the paper posted in the reply 

I am trying to numerically double integrate x^2+sqrt(y), with the bounds y=0..x and x=1..1.5.

Then I tried the following code:

 

int(int(x^2+sqrt(y),method=trapezoid,y=0..x),method=trapezoid,x=1..1.5);

 

I know how to write the code if instead of a 'x' in my upper limit for my integral, I had a real number, but I'm not sure how to remedy to code in order make it work. Any help would be appreciated. Thanks!

 

I need to show what happens to the zero r=20 of f(x)= (x-1)(x-2)..(x-20)-(1/10^8)*(x^19) and the hint given is that the secant method in double precision gives an approximate in [20,21].

At present, I'm calling the secant method on f with a tolerance of 1/(10^12) with an initial x=20, but I'm stuck as to what the second initial value would be. What is the right approach to this question?

 

1 2 Page 1 of 2