From: endah on
Dear All,

I work with fsolve to solve my nonlinear equation-->

x^q1*(rg+p-rg*q2+dg*q2)/q2/(rg+p)/(dg+p)+...
x*dg*(1-q2)/p^q1/q2/(dg+p)+rg/p^(1+q1)/(rg+p)

with tha default of fsolve. my initial guess is x=1, but the message is try again with a new starting guess. but i can't find another that obtains better result. and when I try another parameter (p,q1,q2,..etc) there are some complex numbers.

Would you help me to deal with this fsolve?

Kind regards
Endah


From: Walter Roberson on
endah wrote:
> Dear All,
>
> I work with fsolve to solve my nonlinear equation-->
>
> x^q1*(rg+p-rg*q2+dg*q2)/q2/(rg+p)/(dg+p)+...
> x*dg*(1-q2)/p^q1/q2/(dg+p)+rg/p^(1+q1)/(rg+p)
>
> with tha default of fsolve. my initial guess is x=1, but the message is
> try again with a new starting guess. but i can't find another that
> obtains better result. and when I try another parameter (p,q1,q2,..etc)
> there are some complex numbers.

What kind of values can q1 and p have?

Your solutions are the solutions to

x^q1 * (p^(2*q1+1) * (rg + 1 + q2*(dg-rg))) +
x^1 * p^(q1+1) * dg * (rg * (1 - q2*(p+1)) + p) +
x^0 * p^q1 * rg * q2 * (dg + p)

which can be rewritten as A * x^q1 + B * x + C

but your A and B and C *will* contain complex quantities if p < 0
(unless p > -1 and q1 is +infinity).

In the general algebraic case, the coefficients could potentially
contain complex quantities if p > 0 but q1 is not an integer (depends
how you write the fraction...) or if p > 0 but q1 is a multiple of 4 or
1 less than a multiple of 4 (because I^4 = 1). These are "avoidable"
complex quantities (that is, you could choose to ignore those complex
values... though doing so might result in discarding an optimum solution.)

If your A, B, and C are all real-valued, then unless q1 = 0 or 1 you run
into the possibility of complex values again -- even a simple quadratic
can encounter complex values.