Items tagged with fsolve

I solve a set of equations in this way and I have three set of answers ,but I don`t know wich one is true.

and I have another question ,how can I assume v[0] like a constant?

 

alpha[2]:= 2.727272728*10^5: alpha[4]:= 3738.685337: alpha[6]:= -30.18675539: alpha[7] := -4.116375735*10^6: alpha[8] := 1.859504132*10^10: alpha[9]:= 2.489142857*10^(-12):

l10:=(alpha[7]*v[0]^2+1)*gamma[i*n]^4+(-alpha[4]*beta[n]^2+alpha[8]*v[0]^2-alpha[9])*gamma[i*n]^2+(2*I)*gamma[i*n]*alpha[2]*beta[n]*v[0]+(2*I)*gamma[i*n]^3*alpha[6]*beta[n]*v[0]-beta[n]^2 = 0:

l11 := subs(i = 1, l10);

l12 := subs(i = 2, l10);

l13 := subs(i = 3, l10);

l14 := subs(i = 4, l10);

l15 := (exp(I*(gamma[n]+gamma[2*n]))+exp(I*(gamma[3*n]+gamma[4*n])))*(gamma[3*n]^2-gamma[4*n]^2)*(gamma[n]^2-gamma[2*n]^2)+(exp(I*(gamma[n]+gamma[4*n]))+exp(I*(gamma[2*n]+gamma[3*n])))*(gamma[2*n]^2-gamma[3*n]^2)*(gamma[n]^2-gamma[4*n]^2)+(exp(I*(gamma[2*n]+gamma[4*n]))+exp(I*(gamma[n]+gamma[3*n])))*(gamma[2*n]^2-gamma[4*n]^2)*(-gamma[n]^2+gamma[3*n]^2) = 0;

l1 := combine(expand(evalc(l15)), trig):

l2 := combine(expand(evalc(Re(l15))), trig):

l3 := combine(expand(evalc(Im(l15))), trig): v[0] := 1; 1

fsolve({l1, l11, l12, l13, l14}, {beta[n], gamma[n], gamma[2*n], gamma[3*n], gamma[4*n]}):

fsolve({l11, l12, l13, l14, l2}):

solve({l11, l12, l13, l14, l3}):

thanks

Reyhaneh

Here is one that the students generated which caused confusion. 

a := 0.76;
eq1 := 2*cot(a*sqrt(2*E)) = (2*E-5.4)/(sqrt(E*(5.4-E));
solve(eq1, E)

And the results are: 0., 4.411954070, 2.423743792

The problem is with the second answer because it does not exist. If we plot the LHS and the RHS of eq1 vs E where E=0..5.4

plot([2*cot(0.76*sqrt(2*E)), (2*E-5.4)/sqrt(E*(5.4-E))], E=0..5.4, -3..3)

And it gets more interesting, if we calculate:

solve(evalf(eq1), E)

The answers are: 0., 2.423743793, 14.33807304+27.39159712*I

where the 3rd answer is again incorrect.

Finally, if a = 0.8 or larger, the incorrect answers disappear. 

Note - fsolve does handle this problem correctly. And despite my attempts to remind them to use fsolve, they see the solve command as the universal truth. Apparently this will be another teaching moment for next year.

So any thoughts about why this happens and why there is a difference in the outcomes between 0.76 and 0.8 for the value of a?

 

hi .how i can fsolve 8 equations, in which obtained from

for k from 2 to m do eq1[k_] end do

AND

for k from 2 to m do eq2[k_] end do  and so on........

And gain unknown functions as f3[2], f4[4],....

thanks?

fdm-maple.mw
 

 

 ############################Define some parameters

 

 
restart; Digits := 15; n := 1; m := 3; len := 1; h := len/m; nn := m+1
 ############################Define some equation

eq1[k_] := -3.0*h*(-f2[k]*f1[k-1]+f2[k]*f1[k+1]+f1[k]*(-f2[k+1]+f2[k-1]))*f4[k]^2+((-8.0*f1[k]+4.0*f1[k-1]+4.0*f1[k+1])*f3[k]+(-f1[k+1]+f1[k-1])*(-f3[k+1]+f3[k-1]))*f4[k]-f3[k]*(-f1[k+1]+f1[k-1])*(-f4[k+1]+f4[k-1]):

 

 

 

 

                                     ######################################  APPLY BOUNDARY CONDITIONS


f2[0] := f2[2];

1.0

(1)


``for k from 2 to m do eq1[k_] end do

-1.00000000000000*(-f1[2]*f2[3]+f1[3]*(-f2[4]+f2[2]))*f4[3]^2+((-8.0*f1[3]+4.0*f1[2])*f3[3]+f1[2]*(-f3[4]+f3[2]))*f4[3]-f3[3]*f1[2]*(-f4[4]+f4[2])

(2)

for k from 2 to m do eq2[k_] end do

(-4.16666666666667*f2[2]^2+(50.0000000000000*f2[3]+8.33333333333333*f2[4])*f2[2]-100.000000000000*f2[3]^2+50.0000000000000*f2[3]*f2[4]-4.16666666666667*f2[4]^2+1/27)*f4[3]^2+((f2[2]-1.*f2[4]-.5*f2[3])*f3[3]+(-50.*f3[2]+50.*f3[4])*f2[2]+(-50.*f3[2]+50.*f3[4])*f2[4]+(100.*f3[2]-100.*f3[4])*f2[3])*f4[3]+((50.*f4[2]-50.*f4[4])*f2[2]+(50.*f4[2]-50.0*f4[4])*f2[4]+(-100.0*f4[2]+100.*f4[4])*f2[3])*f3[3]

(3)

for k from 2 to m do eq3[k_] end do

-0.123456790123457e-1*f4[3]^3*f3[3]+((1/27)*(.5*f2[2]-.5*f2[4])*f3[3]-0.277777777777778e-1*f2[3]*f3[2]+0.277777777777778e-1*f2[3]*f3[4])*f4[3]^2+(-.222222222222222*f3[3]^2+((1/9)*f3[2]+(1/9)*f3[4]+4.*f2[3]^2+(-4.*f2[2]-4.*f2[4])*f2[3]+f2[2]^2+2.*f2[4]*f2[2]+f2[4]^2)*f3[3]+0.277777777777778e-1*f3[2]^2-0.555555555555556e-1*f3[2]*f3[4]+0.277777777777778e-1*f3[4]^2)*f4[3]+(1/9)*((-.25*f4[2]+.25*f4[4])*f3[2]+(.25*f4[2]-.25*f4[4])*f3[4])*f3[3]

(4)

for k from 2 to m do eq4[k_] end do

-0.493827160493827e-1*f4[3]^4-(1/27)*(-f2[4]+f2[2])*f4[3]^3+(.111111111111111*f2[3]*(f4[4]-f4[2])-.888888888888889*f3[3]+16.0*(f2[3]-.500000000000000*f2[2]-.500000000000000*f2[4])^2)*f4[3]^2+.444444444444444*((f3[3]+.250000000000000*f3[2]-.250000000000000*f3[4])*f4[2]+f4[4]*(f3[3]-.250000000000000*f3[2]+.250000000000000*f3[4]))*f4[3]-(1/9)*f3[3]*(f4[4]-f4[2])^2

(5)

``


 

Download fdm-maple.mw

 

hi.how i can solve or fsolve this equations?

i can not with fsolve?

thanks alot

SOLVE.mw


Maple Worksheet - Error

Failed to load the worksheet /maplenet/convert/SOLVE.mw .
 

Download SOLVE.mw

 

Hello, 

I have just started using Maple, and it seems very powerful. I am trying to solve trigonometric equations and get all the solutions in a range, but when I use fsolve I only get one solution. 

Is this by design of the function or is there another way to do this? 

 

Tom

i need to find the graph of exp(v(r)) from 0 to 2e6.

i obtained the graph of v(r) by taking log but how to obtained in exp form

graph_of_exp_form_of_u(r).mw 

I can't make maple solve this equation, any help please

hi

please help me for fsolve algebric equations...

thanks

AGM.mw
 

restart:

F(eta):=sum(a[i]*eta^i,i=0..5):

theta(eta):=sum(b[i]*eta^i,i=0..5):K(eta):=sum(c[i]*eta^i,i=0..5):Omega(eta):=sum(d[i]*eta^i,i=0..5):

``

U1:=diff(theta(eta), eta, eta)-3*Omega(eta)*(F(eta)*(diff(theta(eta), eta))-theta(eta)*(diff(F(eta), eta)))/(2*K(eta))+((diff(K(eta), eta))/K(eta)-(diff(Omega(eta), eta))/Omega(eta))*(diff(theta(eta), eta)) = 0:U2:= diff(F(eta), eta, eta, eta)+Omega(eta)*(3*F(eta)*(diff(F(eta), eta, eta))-(diff(F(eta), eta))^2)/(2*K(eta))+((diff(K(eta), eta))/K(eta)-(diff(Omega(eta), eta))/Omega(eta))*(diff(F(eta), eta, eta))+Omega(eta)/K(eta) = 0:U3:= diff(K(eta), eta, eta)+Omega(eta)*(1.5*F(eta)*(diff(K(eta), eta))-K(eta)*(diff(F(eta), eta)))/K(eta)+((diff(K(eta), eta))/K(eta)-(diff(Omega(eta), eta))/Omega(eta))*(diff(K(eta), eta))+(diff(F(eta), eta, eta))^2-Omega(eta)^2 = 0:U4:= diff(Omega(eta), eta, eta)+Omega(eta)*(3*F(eta)*(diff(Omega(eta), eta))+Omega(eta)*(diff(F(eta), eta)))/(2*K(eta))+((diff(K(eta), eta))/K(eta)-(diff(Omega(eta), eta))/Omega(eta))*(diff(Omega(eta), eta))+Omega(eta)*(diff(F(eta), eta, eta))^2/K(eta)-Omega(eta)^3/K(eta) = 0:

F(eta):=unapply(F(eta),eta):

theta(eta):=unapply(theta(eta),eta):K(eta):=unapply(K(eta),eta):Omega(eta):=unapply(Omega(eta),eta):

U1:=unapply(U1,eta):U2:=unapply(U2,eta):U3:=unapply(U3,eta):U4:=unapply(U4,eta):

 

s1:=F(eta)(0) = 0:

s2:=K(eta)(0) = 0:s3:=Omega(eta)(0) = 0:s4:=theta(eta)(0) = 1:s5:=theta(eta)(1) = 0:s6:=(D(F(eta)))(0) = 0:s7:=(D(K(eta)))(1) = 0:s8:=(D(Omega(eta)))(1) = 0:s9:=((D@@2)(F(eta)))(1) = 0

20*a[5]+12*a[4]+6*a[3]+2*a[2] = 0

(1)

s10:=U1(0):s11:=U2(0):s12:=U3(0):s13:=U4(0):        s14:=U1(1):s15:=U2(1):s16:=U3(1):s17:=U4(1):    s18:=D(U1)(0):s19:=D(U2)(0):s20:=D(U3)(0):s21:=D(U4)(0):     s22:=D(U1)(1):s23:=D(U2)(1):s24:=D(U3)(1):

 

 

Q:=fsolve([s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17,s18,s19,s20,s21,s22,s23,s24],{a[0],a[1],a[2],a[3],a[4],a[5],b[0],b[1],b[2],b[3],b[4],b[5],c[0],c[1],c[2],c[3],c[4],c[5],d[0],d[1],d[2],d[3],d[4],d[5]}):

F(eta):=eval(sum(a[i]*eta^i,i=0..5),Q):

Error, invalid input: eval received S, which is not valid for its 2nd argument, eqns

 

theta(eta):=eval(sum(b[i]*eta^i,i=0..5),Q):K(eta):=eval(sum(c[i]*eta^i,i=0..5),Q):Omega(eta):=eval(sum(d[i]*eta^i,i=0..5),Q):

Error, invalid input: eval received S, which is not valid for its 2nd argument, eqns

 

plot(g(x),x=0..1,axes=boxed,color=green,thickness=2,labels=[x,g]):

Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct

 

plot(f(x),x=0..1,axes=boxed,color=blue,thickness=2,labels=[x,f]):

Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct

 

 


 

Download AGM.mw

 


 

T := proc (t) options operator, arrow; 80+(-1)*1.4375*53*(1-exp((-1)*0.13775e-1*2.875*k*h__1*h__2*t/(1.4375^2*4190*(k*(h__1+h__2)+0.1e-2*h__1*h__2))))/2.875 end proc

proc (t) options operator, arrow; 80+(-1)*1.4375*53*(1-exp((-1)*0.13775e-1*2.875*k*h__1*h__2*t/((1.4375^2*4190*(k*(h__1+h__2)+0.1e-2*h__1*h__2)))))/2.875 end proc

(1)

T(204.39)

53.50000000+26.50000000*exp(-8.094482719*k*h__1*h__2/(8658.242188*k*(h__1+h__2)+8.658242188*h__1*h__2))

(2)

T(429.63)

53.50000000+26.50000000*exp(-17.01469059*k*h__1*h__2/(8658.242188*k*(h__1+h__2)+8.658242188*h__1*h__2))

(3)

T(872.5)

53.50000000+26.50000000*exp(-34.55372656*k*h__1*h__2/(8658.242188*k*(h__1+h__2)+8.658242188*h__1*h__2))

(4)

fsolve({53.50000000+26.50000000*exp(-34.55372656*k*h__1*h__2/(8658.242188*k*(h__1+h__2)+8.658242188*h__1*h__2)) = 56.15, 53.50000000+26.50000000*exp(-17.01469059*k*h__1*h__2/(8658.242188*k*(h__1+h__2)+8.658242188*h__1*h__2)) = 64.1, 53.50000000+26.50000000*exp(-8.094482719*k*h__1*h__2/(8658.242188*k*(h__1+h__2)+8.658242188*h__1*h__2)) = 72.05}, {h__1 = 0 .. 1000, h__2 = 0 .. 1000, k = 0 .. 1000})

fsolve({53.50000000+26.50000000*exp(-34.55372656*k*h__1*h__2/(8658.242188*k*(h__1+h__2)+8.658242188*h__1*h__2)) = 56.15, 53.50000000+26.50000000*exp(-17.01469059*k*h__1*h__2/(8658.242188*k*(h__1+h__2)+8.658242188*h__1*h__2)) = 64.1, 53.50000000+26.50000000*exp(-8.094482719*k*h__1*h__2/(8658.242188*k*(h__1+h__2)+8.658242188*h__1*h__2)) = 72.05}, {h__1, h__2, k}, {h__1 = 0 .. 1000, h__2 = 0 .. 1000, k = 0 .. 1000})

(5)

``

it would be great if you could explain me why maple cant numerically solve this set of 3 ecuatios for h1, h2, k being my unknows terms, it works with an exponential function. there is a way to solve it?

thanks..
 

Download heat_ecuation.mw

So I am trying to find the structure of a material from x-ray diffraction data. To accomplish this I have to solve a system of nonlinear equations. Since there is some unaccuracy in the measurements I wanted to use a numerical tool, so I am trying to solve using fsolve. To check that I am doing this correctly I am trying to solve a set of similar equations where I know the solution. My code is shown below.

eqs := {(2^2/a^2+2^2/c^2-2*(2*2)*cos(x)/(a*c))/sin(x)^2 = 1/2.2393^2, (2^2/a^2+4^2/c^2+4*(2*2)*cos(x)/(a*c))/sin(x)^2 = 1/1.5968^2, (1^2/a^2+sin(x)^2/b^2+2^2/c^2+(2*2)*cos(x)/(a*c))/sin(x)^2 = 1/2.7896^2, 1/sin(x)^2*(2^2*sin(x)^2/b^2) = 1/2.8650^2}

fsolve(eqs)

For this system I know that a = 5.44 b = 5.73 c = 7.89 x=pi/2, but fsolve only returns the input.

Am I doing something wrong or should I use a different function? I am quite new to Maple, so have some patience with me.

Thanks in advance.

Hello,

 

I have a function:

v0(t) = -g*t-vs*ln(r*t-m0)+vs*ln(-m0)

This function should be equal to 300, but when using fsolve we get a negative real part, and a very small imaginary part:

We have already made a plot of the function, and from that we see that the t should be about 65 when v0(t)= 300.

 

What are we doing wrong?

Is there a way to extract the data from the graph?

Very new to using Maple or coding in general. Ran into a problem that I couldn't figure it out.

Any help would be greatly appreciated.

I have a problem integrating a solution from fsolve.   I read in another post on this forum that the solution was to use unapply.   This works if I then set up the integration as suggested (i.e., without giving the argument to the function), but not if you do it in a way that seems logical to me (i.e.,the first version of the int command marked ‘fails’ below.   if you can plot a function why can’t you integrate it ?).  

Anyway the real problem I have is if I want to use the solution found using fsolve as the argument of another function (h below) and then integrate that.  I assume the final line fails because of the same reason the initial attempt to integrate g(x) fails. However, I can’t figure out what the equivalent notation would be if I wanted to omit the ‘x’ variable.   I tried using unapply again, and also putting in quotes, but nothing works.

> restart;

> g:=unapply('fsolve(a*y^2-sin(y),y=2)',a);

> plot('g(x)',x=1..2);

> evalf(Int('g(x)',x=1..2));#this fails

> evalf(Int(g,1..2));#this works fine

> h:=x->x*sin(x);

> h(g(1.0));

> h(g(2.0));

> evalf(Int(h(g(x)),x=1..2));# this fails

I mean the root of the equation

GAMMA(n-1/n)*GAMMA(1/n)/(n*GAMMA(n)) = 1

belonging to RealRange(Open(1),4). It should be noticed there are solutions outside this interval. Here is my try.

 

``

solve({n > 1, GAMMA(n-1/n)*GAMMA(1/n)/(n*GAMMA(n)) = 1, n < 4}, [n])``

[]

(1)

`in`(which*is*wrong, view*of)

simplify(eval(GAMMA(n-1/n)*GAMMA(1/n)/(n*GAMMA(n)), n = (1/2)*sqrt(5)+1/2))

1

(2)

Also

Student[Calculus1]:-Roots(A = 1, n = 1 .. 4)

[1.618033989]

(3)

There is a substitute

fsolve(GAMMA(n-1/n)*GAMMA(1/n)/(n*GAMMA(n)) = 1, n = 1 .. 4)

1.618033989

(4)

NULL

identify(%)

(1/2)*5^(1/2)+1/2

(5)

``

There is a shade of hope that GAMMA(n-1/n)*GAMMA(1/n)/(n*GAMMA(n))  can be simplified.

Download solution.mw

 PS. An SCR was submitted by me.

1 2 3 4 5 6 7 Last Page 1 of 13