Items tagged with fsolve fsolve Tagged Items Feed

Could anyone assist in rectifying this error ''Error, (in fsolve) {f[1], f[2], f[3], f[4], f[5], f[6], f[7], f[8], f[9], f[10], f[11], theta[11]} are in the equation, and are not solved for''. Here is the worksheet FDM_Revisit_1.mw

I am trying to find the root of an equation that involves a procedure and a definite integral (solved numerically). Of course, I don't need the root to be found symbolically, but numerically would be fine. The problem is, I keep getting the error

"Error, (in fsolve) Can't handle expressions with typed procedures"

whenever I try to solve it. Anyone have any ideas? My worksheet is here: Table-1-duplication-mapleprimes.mw 

 

What are the stopping criteria for fsolve?
I cannot find anything in the help page and there seems to be no way of adding an optional argument to fsolve about errors.

I was initially surprised by the results of the first two fsolve commands below:

restart;
infolevel[fsolve]:=2:
fsolve([x->1,x->3],[0.4,8]);
fsolve([x->1,x->3],[0..7,8..9]);
fsolve(x->1,0.4); #OK, returns unevaluated
fsolve([1,1],{x,y}); #OK, returns NULL

I assume that in the first two examples the criterion used is that at some point in the process the iterates [x(n+1),y(n+1)] and [x(n),y(n)] are close enough together and the difference between results from the two is small enough (clearly 0).

hello, i went solve these equation ,with a & b take any value

b*x*ln(x)-x*ln(a)+a=0

thank you

I have a nonlinear system with 4 equations and 4 unknowns. I am using fsolve. I know that there are multiple solutions for each variable but am only getting one. I need the others. what do I do??

This is my code:

R__1 := Matrix([[1, 0] , [0, 1] ]);

R__2 := Matrix([[1/2, sqrt(3)/2] , [-sqrt(3)/2, 1/2] ]);

R__3 := Matrix([[-1/2, sqrt(3)/2] , [-sqrt(3)/2, -1/2] ]);

R__4 := Matrix([[-1, 0] , [0, -1] ]);

R__5 := Matrix([[-1/2, -sqrt(3)/2] , [sqrt(3)/2, -1/2] ]);

 

d__1 := Vector( [ 0, 5.4] );

d__2 := Vector( [ 6.4, 4.539] );

d__3 := Vector( [ 11, 4.078] );

d__4 := Vector( [ 15.5, 2.079] );

d__5 := Vector( [ 19, 1.039] );

 

a := Vector( [ a__x, a__y] );

 

A__1:=R__1.a+d__1;

A__2:=R__2.a+d__2;

A__3:=R__3.a+d__3;

A__4:=R__4.a+d__4;

A__5:=R__5.a+d__5;

 

OO:=Vector([O__x,O__y]);

 

DA1:=A__2.A__2-A__1.A__1-2*(A__2-A__1).OO;

DA2:=A__3.A__3-A__1.A__1-2*(A__3-A__1).OO;

DA3:=A__4.A__4-A__1.A__1-2*(A__4-A__1).OO;

DA4:=A__5.A__5-A__1.A__1-2*(A__5-A__1).OO;

 

fsolve({DA1,DA2,DA3,DA4},{a__x,a__y,O__x,O__y});

Thanks for any tips you may be able to offer

 

Is it possible in Maple 15 to solve an equation with a parameter for a given set of parameters? How can this be passed to the solve function, should I use some kind of list?  After obtaining the solution how can I assign the solutions to variables such as x1 for the first value of the parameter, x2 for the second value of the parameters and so on. Furthermore, is this possible with the fsolve command?

 

Thanks

Hello I am a Maple 15 user and I am using the command fsolve to solve for the intersection of two curves over a specified interval in x, namely from 0 to the lim defined in the Maple document. The specified interval contains asymptotes and when I specify the full interval only one of the three solutions is returned even if I can see that there are three distinct solutions by looking at the plot of RHS and LHS. Should I use another technique to find the solution or is my implementation of fsolve command wrong?

Thanks in advance


restart

with(ListTools):

n1 := 1:

n2 := 1.50:

n3 := 1.40:

lambda := 1.3:

k0 := 2*Pi/lambda:

d := 3:

x0 := k0*d:

arg1 := sqrt(x0^2*(n2^2-n1^2)):

arg2 := sqrt(x0^2*(n2^2-n3^2)):

lim := FindMinimalElement([arg1, arg2]):

sqr1 := sqrt(x0^2*(n2^2-n1^2)-x^2):

sqr2 := sqrt(x0^2*(n2^2-n3^2)-x^2):

LHS := tan(x):

RHS := (sqr1+sqr2)/(x*(1-sqr1*sqr2/x^2)):

plot([LHS, RHS], x = 0 .. lim, y = -6 .. 6)

 

fsolve(RHS = LHS, x = (1/2)*Pi .. 3*Pi*(1/2))

2.634254816

(1)

fsolve(RHS = LHS, x = 3*Pi*(1/2) .. 9*Pi*(1/4))

5.222527128

(2)

fsolve(RHS = LHS, x = 9*Pi*(1/4) .. lim)

7.598486053

(3)

``


Download HW4Q2.mw

Hi

I have to numerically solve this equation many (tens of thousands) of times for theta_n (as I vary different parameters, especially n):

tan(theta_n) - C_a*Z_0*(-v^2*(Pi*n-theta_n)^2/x_l^2+omega_a^2)*x_l/(v*(Pi*n-theta_n)) = 0

theta_n should be in [-pi/2, pi/2). It seems like solving this is the slowest single component of the chain of calculations (that follow this).

Currently I do it with this function:

get_theta_n_array:=proc(max_n::integer, omega_a::float, v::float, x_l::float, C_a::float, Z_0::float)
    local theta_n_array:=Array(
        select(x->Re(x)<evalf(Pi/2) and Re(x)>=-evalf(Pi/2), [seq(
        #NOTE: careful with fsolve - in some cases returns unevaluated equation
        fsolve(tan(theta_n) - C_a*Z_0*(-v^2*(Pi*n-theta_n)^2/x_l^2+omega_a^2)*x_l/(v*(Pi*n-theta_n)) = 0, theta_n) , n=1..max_n)]
        , real)
        ,datatype=float[8]);
    if ArrayNumElems(theta_n_array) <> max_n then
        printf("Bad Array Dimensions! Got too many or not enough solutions.");
        theta_n_array:="CHECK: get_theta_n_array()": #dirrrrty hack that will ring an alarm bell if array is not the right size
    end;
    theta_n_array;
end;

And call it like so (for say n=1000)

st:=time();
result:=get_theta_n_array(1000, 100e9, 1e8, 0.3, 20e-14, 50.0);
time()-st;

This will take say 3.5s on my PC.

Does anyone have any ideas how to speed this up? I would hope this to take at least an order of magnitude less time. I played with DirectSearch lib but that was not faster.

Also, I should note that this is the only portion of my code that is not thread safe (because of the fsolve call), which leads to "extra" slowdowns because I have to use Grid:-Map, instead of Thread:-Map when parallelizing, and more importantly because I can't compile the rest of the code (Grid:-Map is not compatible with compiled functions).

Let me know if you have any ideas...

thanks!

i want to solve an equation by fsolve but i cant assign a value as an input for next step!

please help me

s := fsolve(G), x = -1 .. 1     

s := .1449607418, x = -1 .. 1  

 a:=s+1  

Error, invalid input: subs received .1449607418, which is not valid for its 1st argument                  

 

I want to solve system of equation but it has unknow parameter.

Then I test system of equation. It hasn't unknowparameter.

eq1 := x^2+y^2 = 4

eq2 := y-x^2 = 0

fsolve({eq1, eq2}, {x, y})

{x = -1.249621068, y = 1.561552813}

So I get answer by using fsolve.

 

Then I try to put unknow parameter in system of equation.

eq3 := x^2+ky^2 = 4

eq4 := ay-hx^2 = 0

fsolve({eq3, eq4}, {x, y})

Error, (in fsolve) {ay, hx, ky} are in the equation, and are not solved for

I don't get answer and open link. The link hasn't similar this problem.

To motivate some ideas in my research, I've been looking at the expected number of real roots of random polynomials (and their derivatives).  In doing so I have noticed an issue/bug with fsolve and RootFinding[Isolate].  One of the polynomials I came upon was

f(x) = -32829/50000-(9277/50000)*x-(37251/20000)*x^2-(6101/6250)*x^3-(47777/20000)*x^4+(291213/50000)*x^5.

We know that f(x) has at least 1 real root and, in fact, graphing shows that f(x) has exactly 1 real root (~1.018).  However, fsolve(f) and Isolate(f) both return no real roots.  On the other hand, Isolate(f,method=RC) correctly returns the root near 1.018.  I know that fsolve's details page says "It may not return all roots for exceptionally ill-conditioned polynomials", though this system does not seem especially ill-conditioned.  Moreover, Isolate's help page says confidently "All significant digits returned by the program are correct, and unlike purely numerical methods no roots are ever lost, although repeated roots are discarded" which is clearly not the case here.  It also seems interesting that the RealSolving package used by Isolate(f,method=RS) (default method) misses the root while the RegularChains package used by Isolate(f,method=RC) correctly finds the root.

 All-in-all, I am not sure what to make of this.  Is this an issue which has been fixed in more recent incarnations of fsolve or Isolate?  Is this a persistent problem?  Is there a theoretical reason why the root is being missed, particularly for Isolate?

Any help or insight would be greatly appreciated.

Hi! I'm trying to solve a system of four non-linear equations in Maple 17 but it doesn't work.

Equations are: F, Fw, Ft, Fk and varibles are T,w,k,ki.

Parametars are Mn=10, Ms=2, alfa=0.2 and Tf=(k*T^(alfa)/Mn)^(1/alfa).

Solutions must be positive. 

This is maple script:

restart;
> assume (w>0):
> assume (T>0):
> assume (k>0):
> assume (ki>0):
> assume (Mn>0):
> assume (Ms>0):
> assume (Tf>0):
> assume (alfa>0):


> Gp:=1/exp(sqrt(w*I));

> Cf:=((T*w*I+1)/(Tf*w*I+1));

> Cpi:=(k*w*I+ki)/(w*I);

> L:=Cf*Cpi*Gp;
> L:=evalc(L):
> F:=subs(Ms=2,Tf=(k*T^(alfa)/Mn)^(1/alfa),evalc(abs(1+L)^2-1/Ms^2));
> F:=subs(Mn=10,alfa=0.2,evalc(F));

> Fw:=diff(F,w):
> Fk:=diff(F,k):
> Ft:=diff(F,T):
> fsolve({F,Fw,Fk,Ft},{w,k,ki,T});

Thanks in advance for any help. Dragoslav

i := I;

assume(a>0);

assume(b>0);

assume(r>0);

assume(k>0);

assume(w>0);

Hz := k*(z^2-2*r*a+r^2)/((z-1)*(z^2-2*b*z+1));

Hzw := eval(Hz, z = exp(i*w)); assume(a > 0);

Habs := simplify(abs(Hzw)^2);

p1 := eval(Habs, w = Pi) = (10^((-3.3018)*(1/20)))^2;

p2 := eval(Habs, w = (1/2)*Pi) = (10^((-.1758)*(1/20)))^2;

p3 := eval(Habs, w = (1/4)*Pi) = (10^(6.425*(1/20)))^2;

p4 := eval(Habs, w = (1/8)*Pi) = (10^(54.5699*(1/20)))^2;

solve({p1, p2, p3, p4})

 

Hello everybody,

I want to find all of roots of the complex variables functions in two ways.

(1) find the value which can make the function equals 0

(2) find the real value and imaginary value which make real part and imaginary part of function equal 0

(I know answers of these two case is not equal completely.)

 

The function is a non-linear function, including sin, cos and Bessel function, such as:

 


And, I used Analytic and fsolve to do case (1) and (2), but failure. The follow result is how I tried to find the real value answer:

 

It seems that both of two commands can only find some of roots. 

How to find all of roots of these cases? The related .mw file is attached.

Cannot_find_all_of_roots.mw

 

Thanks a lot.

 

1 2 3 4 5 6 7 Page 1 of 8