Items tagged with newton


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



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]})



k := 0:

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

maxval := 10^4:


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)})












Warning,  computation interrupted




I wonder what the built-in algorithm is used in "fsolve". From some references, it seems to be Newton iteration. 
But fsolve succeeds to quickly find a root of multiplicity more than 1, which can't be achieved by Newton iteration. So I wonder whether there are other techniques involved? Thank you!



i have a problem working with a list of equations. The background for the whole thing is simulating the movement of 4 astronomical bodies with Newtons equation. Currently i have a list which looks like this (read x(1,1) as x-coordinate body 1 time =1):

[ x(1,1)=1,12312,y(1,1)=2,3123,z(1,1)=4,141,...,x(1,n)=5,0102,y(1,n)=0,912,z(1,n)=8,1232,...,x(4,n)=5,92y(4,n)=1,656,z(4,n)=3,141]

so i basically have all the information about where the bodies are.

I want to use this information to create a 3D-pointplot. I know that the point plot requires a special input form ( {[x(1,1),y(1,1),z(1,1],[x(1,2),y(1,2),z(1,2)].....} ), but i alread have managed to convert my original list accordingly. However, i cannot use this new list for pointplot because it contains equations and not simple values.

So how do i get from a list as shown above to a list which contains merely the numeric values?

Basically what I'm trying to do is use Newton's method to find the root of f(x)=sqrt(x)+ln(0.1x) starting at x0=5 within a tolerance of 0.001.


f := proc (x) options operator, arrow; sqrt(x)+ln(.1*x) end proc

> xk := 1.0;
print(`output redirected...`); # input placeholder
> for k to 6 do xk1 := xk-f(xk)/(D(f))(xk); xk := xk1 end do;


When I do that, Maple barfs out pages of nonsense when I'm looking for it to give numerical values. It seemed to work fine with a different function, so maybe that's part of the problem? But I need to do it with the function I asked about.

how i can find order of convergence of newton method by expanding taylor series?? plz send me code???


Dear All,

I am going to solve the following systems of ODEs but get the error: Newton iteration is not converging.
Could you please share your idea with me. In the case of AA=-0.2,0,0.2,0.4,...; I could get the solution.
Thank you in advance.

Pr := 2; Le := 2; nn := 2; Nb := .1; Nt := .1; QQ := .1; SS := .1; BB := .1; CC := .1; Ec := .1; MM := .2;AA:=-0.4;

Eq1 := diff(f(eta), `$`(eta, 3))+f(eta).(diff(f(eta), `$`(eta, 2)))-2.*nn/(nn+1).((diff(f(eta), eta))^2)-MM.(diff(f(eta), eta)) = 0; Eq2 := 1/Pr.(diff(theta(eta), `$`(eta, 2)))+f(eta).(diff(theta(eta), eta))-4.*nn/(nn+1).(diff(f(eta), eta)).theta(eta)+Nb.(diff(theta(eta), eta)).(diff(h(eta), eta))+Nt.((diff(theta(eta), eta))^2)+Ec.((diff(f(eta), `$`(eta, 2)))^2)-QQ.theta(eta) = 0;
Eq3 := diff(h(eta), `$`(eta, 2))+Le.f(eta).(diff(h(eta), eta))+Nt/Nb.(diff(theta(eta), `$`(eta, 2))) = 0;

bcs := f(0) = SS, (D(f))(0) = 1+AA.((D@@2)(f))(0), theta(0) = 1+BB.(D(theta))(0), phi(0) = 1+CC.(D(phi))(0), (D(f))(etainf) = 0, theta(etainf) = 0, phi(etainf) = 0

Error, (in dsolve/numeric/ComputeSolution) Newton iteration is not converging

let γ be the root 

i have to apply taylor series on f(x) and then do some substitution like (helped by a member of Mapleprime)

taylor(f(x), x = gamma, 8);
f(x[n]) := subs([x-gamma = e[n], f(gamma) = 0, seq(((D@@k)(f))(gamma) = factorial(k)*c[k]*(D(f))(gamma), k = 1 .. 1000)], %)

then find the derivative of result from above output

i do

b := diff((x[n]), e[n])

basically i have to find the value of newton method which is


here we substitute xn=γ and D(f)(xn)=b

and then want to apply f on yn

there are to problem which i face 

1  f(xn)/D(f)(xn) is not in simplified form i-e O(e[n]^8) and O(e[n]^7) is appeared in numerator and denominator respectively. how we get the simplified result.

2 wht step should i do to find f(yn)

plx help me to do this 

thanx in advance

Hi all!


I do a small calculation and get a system of 6
nonlinear equations.
And "n" is the degree of the equation is float.

Here are the calculations that lead to the system.


 M_1:=piecewise((z<l), l-z, 0):
 M_2:=piecewise((z<2*l), 2*l-z, 0):
 M_3:=piecewise((z<3*l), 3*l-z, 0):
 M_4:=piecewise((z<4*l), 4*l-z, 0):
 M_5:=piecewise((z<5*l), 5*l-z, 0):
 for i from 2 to N do
 end do:
 So,my system:



I want to ask advice on how to solve the system.
I wanted to use Newton's method, but I don't know the initial values X_1..X_6.

Tried to set the values X_1..X_6 and to minimize the functional

with the help with(DirectSearch):
But I don't know what to do next

Please, advise me how to solve the system! I would be grateful for examples!


Hi, I am using Maple 18 and struggling with plotting Newton's Method.

I am wanting use the function f(x)=x^3 +cx + 1 where c is a parameter and uses 100 parameter values between -2 and 0, with 100 iterations of each parameter.

Any help would be brilliant.

Thanks in advance,


Hello, I'd like to use Maple to use Newton's Method in an interval to find multiple roots of 4xcos(3x)+(x-2)^2-2=0. What I have so far is:

f := 4*x*cos(3*x)+(x-2)^2-2:


Other than trying out different initial guesses is there a way to do this?



Can anyone help me with this error in Maple while using prcNewton to find local extrema: 


> prcNewton := proc () 
local ftn, strpt, epsilon, maxlps, i, xn, dftn; 
if 4 < nargs then 
elif nargs < 2 then end if; 
if nargs = 2 then 
epsilon := 1/10000000; 
maxlps := 1000 
elif nargs = 3 then 

Use Newton's Method to find a local extrema for f(x)=sin(x^2)+x

with start point x=(1,0)

take derivative of f(x) then apply Newton's Method


My teacher started us off with this but I can't seem to get it to work the way she did, any help would be appreciated!


prcNewton:=proc( ) 

  local ftn,strpt,epsilon,maxlps,i,xn,dftn; 

  if nargs>4 then     

Use Newton’s Method to approximate the indicated root of the equation to correct six decimal places.


The root of 2.2x5 – 4.4x3 + 1.3x2-0.9x-4.0=0 in the interval [-2, -1].


The rest of the assignment states : "

Start by plotting the function in
Maple to get a reasonably good initial approximation. You may use a
“while” loop, but do not use existing Maple commands for Newton’s
Page 1 of 1