Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

enter image description here

enter image description here

I'd like to calculate x value in this equation.

Basically, I tried to 2 types of method which are FindRoot and NSolve.

But, I have failed the calculation caused by these errors up to now.

If there is anyone who knows this problems, plz let me know what I should do first!

Thank you for your cooperation.

share|improve this question
3  
Please post code, not images. Or include images, but as a complement. –  belisarius Jul 7 at 14:57

1 Answer 1

There are a few problems with your code. Allow me to highlight them and guide you to a solution.

First of all, the proper way to define a function in Mathematica is using :=. So your code should read

F[x_] := NSum[Exp[-x BesselJZero[0, a]^2]/BesselJZero[0, a]^2, {a, 1, Infinity}]

Furthermore, you should note that the zeroes of the Bessel function are increasing as a gets larger. Since you squaring and then taking a negative exponential, the terms in your series will rapidly decay and calculating only a finite number of terms will suffice. Therefore, you could also use the function

F2[x_, maxOrder_] := NSum[Exp[-x BesselJZero[0, a]^2]/BesselJZero[0, a]^2, {a, 1, maxOrder}]

and play with the maxOrder parameter. (In fact, for x equal to one the third term in the series equals 4.00479*10^-35, which is smaller than machine precision, so a very low number of terms suffices). This will save you a lot of computing time.

Now, the error messages (at least the ones that say ... is not numerical ...) that you receive have another origin, which can be found here: What are the most common pitfalls awaiting new users?. In short, the problem is that the first step in the FindRoot algorithm is to evaluate the function symbolically, i.e. for an arbitrary x. You can turn this off by explicitly demanding the argument of your function to be numeric, like this:

F3[x_?NumericQ, maxOrder_] := NSum[Exp[-x BesselJZero[0,a]^2]/BesselJZero[0, a]^2, {a, 1, maxOrder}]

The last point is that, as long as x is real, you are summing positive quantities and trying to equate them to something negative. When using a positive number:

FindRoot[F3[x, 5] == 0.014, {x, 0}]

Mathematica quickly finds the solution as

{x -> 0.434665}

When you want the right-hand side of your equation to be negative, you should solve for x in the complex domain. In that case, I would suggest to split it into its real and imaginary parts, write z=x+I y and use for instance

FindRoot[{Re[F3[x + I y, 5]] + 0.014,Im[F3[x + I y, 5]]}, {{x, 0.1}, {y, 0.1}}]

which gives

{x -> 0.434665, y -> 0.543228}

share|improve this answer
    
0.014 ? -0.014? –  Chenminqi Jul 8 at 6:42
1  
In the second line of the question, a solution of F[x]=-0.014 is sought. However, since F[x] is positive for real x, such a solution does not exist in the Reals. In the last coding example, I tried to explain how to look for such a solution in the complex plane. Re[F[z]]==-0.014 is equivalent to Re[F[x]]+0.014==0, hence the +0.014 in the last example. –  Koen Jul 8 at 7:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.