Message Boards Message Boards

GROUPS:

Solve the following equation with NSolve?

Posted 4 years ago
5717 Views
|
10 Replies
|
3 Total Likes
|

This is the first question that i am posting here. So kindly excuse me for 2 things: One, as the question is bit longer and for second , if i am violating any rules in this community.

I have a equation which goes like this:

$$ \frac{\omega_p^2I_0(\lambda_p)e^{-\lambda_p}}{k^2} (1+\frac{\omega}{\sqrt{2}cos{\theta}}Z(\frac{\omega}{\sqrt{2}cos{\theta}}))=0 $$, where $\lambda_p= k^2 sin^2{\theta}$ and $Z(x) = i\sqrt{\pi}e^{-x^2} (1+erf(ix))$ [erf(ix) bein the error function]. I want to find the values of $\omega$ for various values of $k$. For this I am using Nsolve and the Mathematica code which i have written has been attached with this query. I am getting an error message "ReplaceAll::reps: ". I tried my level best to get rid of this. Any help in this aspect will be highly appreciated...

Thanks in advance...

Attachments:
10 Replies

NSolve deals primarily with linear and polynomial equations. Use FindRoot.

Attachments:

Thanks very much for understanding where and when i have to use the NSolve command. The Chop@ that you are using in the program means that you are finding the roots that are close to zero, right? What if some roots are far removed from zero?

Also, I would like to ask you one more question, if you can help me with. Actually, I am trying to find solution of an equation which goes like this: $$1+\sum_{L=-10}^{+10}\frac{\omega_p^2I_L(\lambda_p)e^{-\lambda_p}}{k^2} (1+\frac{\omega}{\sqrt{2}cos{\theta}}Z(\xi p)) +\sum_{L=-10}^{+10}\frac{z^2*nip*mpi*\omega_p^2 I_L(\lambda_i)e^{-\lambda_i}}{k^2 Tip*mpi} (1+\frac{\omega-k*ui*cos\theta }{\sqrt{2}*k*cos{\theta}}Z(\xi i))$$ $$+\frac{2*nep\omega_p^2}{k^2\frac{2\kappa-3}{2\kappa}Tep}(\frac{2\kappa-1}{2\kappa}+\frac{\omega}{k\sqrt{\frac{2\kappa-3 }{\kappa}Tep*mpe}}Z(\xi e))=0$$ where $\omega_p,nip,mpi,Tip,Tep,mpi,mpe,ui,\theta,nep,\kappa$ are predefined values and $\lambda _p,\lambda _i,\xi _p,\xi _i,\xi _e$ are as defined in the program, which i am attaching with this reply. And also some of $\lambda _p,\lambda _i,\xi _p,\xi _i,\xi _e$ are functions of $k$ and/or $\omega $. What i want is a plot of $Re{\omega}$ vs k and $Im{\omega}$ vs k. And many thanks for the first reply...

Attachments:

I use Chop to remove zeros from imaginary part of omega. I do not know if it my solution will be the right.

Thanks a lot again for that timely help. Once mistake which i wrote was that in et[ $\omega$,$k$ ], it should have been $nep$, instead of $Nep$. Anyway that doesn't matter, as it's working fine. One question is that I am expecting more than one values of $\omega$ for particular value of $k$. This will be quite evident as I simplify the expression. How can that be done?

Also, you are using the command {\[Omega], 1/10, 1}in Table. Does it stand for initial guess? If it's the initial guess, then is it like 1/10 stands for real part and 1 stands for complex?

What are those comments which we are getting, if we are not using // Quiet command?

Thank you...

How simplify Yours equation expression?.I don't no.

Reals or Complex starting points do not change to finiding roots.

Method "Secant" in FindRoot needs 2 starting points.

I' m increase WorkingPrecision to 30,no longer be a Warnings Messages.Quiet function evaluates expr "quietly", without actually outputting any messages is generated.

If You want more about FindRoot read this

Attachments:

What i mean by simplifying means that I can do it mathematically. That's okay in the sense that i can do it.

Now just one more question: I have a simple equation which goes like this $x^2+3x+2=0$. I know that root of this equation is -2 and -1. When i am using Solve[x^2 + 3 x + 2 == 0, x], I am getting the roots as expected: -2 and -1. Now if i am writing the code like this: FindRoot[x^2 + 3 x + 2 == 0, {x, 20}], no matter whatever the guess values that i use , i am not getting the second solution. So in this case, is it good to use the Solve command? . That what happening in the FindRoot command that we have used in the program....

Solve and NSolve can't solve Yours transcendental equation only FindRoot can.

You must put another starting points.

FindRoot[x^2 + 3 x + 2 == 0, {x, -20}]
FindRoot[x^2 + 3 x + 2 == 0, {x, -2}]
FindRoot[x^2 + 3 x + 2 == 0, {x, -1}]
FindRoot[x^2 + 3 x + 2 == 0, {x, 1}]
FindRoot[x^2 + 3 x + 2 == 0, {x, 20}]
FindRoot[x^2 + 3 x + 2 == 0, {x, 1 + I}]
FindRoot[x^2 + 3 x + 2 == 0, {x, -1 + I}]
FindRoot[x^2 + 3 x + 2 == 0, {x, -2 + I}]
FindRoot[x^2 + 3 x + 2 == 0, {x, -20 + I}]

and You find all roots.

Maybe this HELPS

Thanks for the reply.. And sorry for the delay..

Posted 4 years ago

You have one Nep in your notebook which has not been assigned a value. Assigning a numeric value to that enables FindRoot to find your solutions.

Sometimes in numerically solving equations a value of the form 2.610^-17I or 3.2*10^-16 will appear. Chop will map those values to 0. This should not stop it from finding solutions which are farther from zero.

Thanks for looking up the program... Actually, it was a typo error. I should have been $nep$, insteda of $Nep$. And, as i mentioned earlier in the post, I want to have some roots which are far removed from zero...

Thanks ...

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract