Items tagged with rootfinding rootfinding Tagged Items Feed

Hey, 

I am trying to write a single procedure to find the root of any function using the Newton-Raphson method, given the initial approximation and the tolerance. If this fails to converge, the program must then use the Bisection method to find the root. Need some help please. The current procedure i have done is only coming out with the first Iteration 

Thanks for the help!

Hi, 

 

I wish to be able to calculate the roots of the function f(p) by using the roots of the function h(p) and applying the bisection method due to the fact that the roots of h(p) bracket the roots of f(p) as can be seen in the graph below. I have done this before for another example when h:=J0(p); and hence i could use The commands BesselJZeros(0,n)/BesselJZzeros(0,n+1) to find the roots. So my problem arises with the finding the roots of h(p) and how to insert them into my bisection loop(underlined below).

Any advice would amazing. Many thanks


restart;

Digits := 30:
with (plots):
with(RootFinding):

#Define given parameters

R:=1: #external radius of particles, cm

d:=10^(-3): #diffusivity cm^2 per second

alpha:= 1: #fractional void volume

c0:=10^(-6): #concentartion of soltion in void volume of solid initially, moles per liter

C0:=0: #concentration of main body of solution initially, moles per liter

k1:=0.5: #constant in adsorption isotherm (ka)

k2:=0.75: #constant in adsorption isotherm (kd)

k:=2.5: #equilbrium constant for adsorption kinetics

n0:=(k1/k2)*c0:#initial amount absrobed on solid, moles per liter

V:=0.1: #volume of external solution, liters

W:=0.1: #weight of absorbant, grams

rho:=2.0: #solid aparrant density, g/cc

delta:=(1/d)*((p+alpha*k2+k1)/(p+alpha*k2));

beta:=W*alpha*d/(rho*V);

   

1000*(p+1.25)/(p+.75)

 

0.500000000000000000000000000000e-3

 

 

 

 

 


f:=p->(BesselJ(0,R*sqrt(-delta*p))*k*p-(R*sqrt(-delta*p))*BesselJ(1,R*sqrt(-delta*p))*(d*p/R + 2*beta*k/(R^2)));

proc (p) options operator, arrow; BesselJ(0, R*sqrt(-delta*p))*k*p-R*sqrt(-delta*p)*BesselJ(1, R*sqrt(-delta*p))*(d*p/R+2*beta*k/R^2) end proc

(2)

h:=p->(BesselJ(0,R*sqrt(-delta*p)));
plot([f(p),h(p)],p=-0.3..0,axis=-5..5,legend=["f(p)","h(p)"]);


 




proc (p) options operator, arrow; BesselJ(0, R*sqrt(-delta*p)) end proc

 

 

 

(3)



points:=5:
rts:= Array(1..points):
for n from 1 by +1 to points do
pl:=evalf(#**first root of h**);
pu:=evalf(#**second root of h, i.e n+1 root**);
pe:= (pl+pu)/2;
while abs(f(pe))>10^(-6) do
pe:=(pu+pl)/2;
if f(pu)*f(pe) <0 then
pl:=pe;
elif f(pl)*f(pe)<0 then
pu:=pe;
end if;
od;
rts[n]:=pe;

od;
rts[n]:=p[n];

 

 

Download spherical_continue.mw


 

Download spherical_continue.mw

hi everybody

I want to solve this system of equations


t*((p-.764*z-2.194768)^2-1.170308549+.529948*(z-.382)^2)-(1-t)*p
t*((p+.382*z+.661624*y-1.907568)^2-1.018097144+.529984*(-.866*y-.5*z-.382)^2)+(1-t)*y
t*((p+.382*z-.661624*y-2.470348)^2-1.31636154+.529984*(.866*y-.5*z-.382)^2)+(1-t)*z


while t varies from 0 to 1 by 0.0001 interval. Using newton raphson method, the inital value for each step is the result of the previous step for y,z,p. the very initial values are y=1,z=1,p=1


please help me. Thanks

eq1 := y=−26.21231979∗z+15.42332896+13.22411533∗e−.6786000000∗x

eq2 := y=−25.98077423∗z+14.81943362+13.53858145∗e−.6569000000∗x

# Comparing both equations, eliminating y

# Putting z= 0.5044

fsolve(eval(rhs(eq1) = rhs(eq2), z = .5044))

I even done manually as well

-26.21231979*(0.5044)+15.42332896+13.22411533*e^(-.6786000000*x) =
 -25.98077423*(0.5044)+14.81943362+13.53858145*e^(-.6569000000*x)

I cannot find x value?  

But it doesn't evaluate the value of x. Any other solution.

Edit : My main task is to calculate value of x by putting any value of z This is just an example

Help with "fsolve"...

November 10 2013 giugi04 15

Hello,

I am trying to find all the roots of this equation and to solve it:

exp(x)*cos(x)+1=0

but doing fsolve(exp(x)*cos(x)+1,x=0..10) it gives me only one solution, while I know that there is more than one solution. How can I do in order to solve this equation and have all the roots in the range 0..10?

I really can't figure it out!

Thank you

 

Giulia

Hi,

I need help for the following,

Good morning sir,

 

I request you to help me out to solve the equations by using Muller Method & Horner's method using Maple.

 

With thanks & regards

 

M.Anand

Hi, I'm trying to find the first ten roots of the equation:

sin(a*Pi)*sqrt(4*a^2+3)*cos(sqrt(4*a^2+3)*Pi)+sin(sqrt(4*a^2+3)*Pi)*a*cos(a*Pi) = 0

But fsolve only finds one root, and not necessarily the first one. So I'm having a difficult time getting the first 10 roots without preknowledge of the intervals to search in. (I can obviously plot it, but there are some other parameters which affect this equation and I can't manually find the intervals every time I change them).

Hi,

This is for a code that analyzes composite laminates with many plys of varying orientation stacked on top of each other, and this is the first semester I've used Maple.

I'm solving for the roots of an equation which will always have a positive and a negative root, and I do this for each ply (could be 100 plies in a laminate).  I want to collect the positive root for each ply, put them in a list or array, and then pick out the smallest value of all the plies ...

In my complex root finding problem it is essential to obtain complex roots in each period of the function. to do this i have write the following code with functional periods but it doesnt work. would you please tell me why? and how can i correct the code?

I am trying to find the complex roots of a nonlinear function within a region using Rootfinding:- Analytic. The problem is that with exactly the same function, the same parameters, etc. it sometimes finds all the roots and sometimes does not! Does anyone know why?

hi all,

m := 1+(-21+.7*I)*sqrt((2.3*6.494)*10^13-x^2)/(2.3*sqrt(((-21+.7*I)*6.494)*10^13-x^2))

fsolve(m = 0, x, {x = 10^7+26500*I .. 2*10^7+26600*I}, complex)

 

the above characteristic equation m=0 will give complex roots if we solve it. but fsolve is not able to solve this equation evenif i provided the range.through some light for my problem.

thanks

Hi everyone.

Does anyone know what engine is behind the fsolve command? As we know fsolve can solve the sets of equations even without any initial guesses. Is it working based on GA or another global optimization techniques?

Appreciate any help.

MJ

Hi,

     I'm trying to find the zero's of a 'nearly parabolic' trajectory, so narurally there are two zeros' of course I don't care about the first zero only the second one. Is there a way to have fsolve find both, or just skip the first?

     Restricting the range of fsolve won't work because I don't know where my first of second zero will be.  
Thanks!

Hello, I have this question:

I have to plot the roots of a polynomial of the 6th degree, a*t6 + b*t5 + c*t4 + d*t3 + e*t2 + f*t = 0, where

a,b,c,d,e,f = g(sigma), then I use implicitplot function to plot t as function of sigma, I want to generate an array, vector or list of pairs as (sigma,t).

Thanks,

Benjamin.

1 2 Page 1 of 2