0
$\begingroup$

I try to plot an interactive plot where one can select the levels of N (noted nf) for a Bessel function:

nf = 8;
u[r_, ϕ_] := Nsum[(BesselJ[n, r]*E^(I n ϕ)) I^n, {n, -nf, nf}];

(*Changing to single variable representation*)
u1[z_] := u[Abs[z], Arg[z]];
Manipulate[Plot[u1[z], {z, 0, 1}], {n, 1, 2, 3, 5}]

But I get nothing... Any suggestion on how to use Manipulate to show levels of N (nf) from 1 to 8 for instance?

Thank you

$\endgroup$
1
  • 2
    $\begingroup$ Use NSum and make sure nf is defined. $\endgroup$
    – flinty
    Commented Apr 15, 2021 at 16:17

1 Answer 1

1
$\begingroup$

I present here a contiution to the solution for this question. This is the solution:

nf = 8;
u[r_, \[Phi]_, nf_] := 
  Sum[(BesselJ[n, r]*E^(I n \[Phi]))/I^n, {n, -nf, nf}];

(*Changing to single variable representation*)
u1[z_, n_] := u[Abs[z], Arg[z], n];

a = Manipulate[
  ComplexPlot3D[u1[z, n], {z, -1 - I, 1 + I}], {n, 1, nf, 1}]
CloudDeploy[a]

Note that you should use here ComplexPlot3D, and when you use Manipulate you must give it access to a variable that you change dynamically - n.

$\endgroup$
5
  • $\begingroup$ Thank you Ymir. I noticed the increase of levels of N gives a very long computation time, and the plots are very different. Would not the highest value of n give the most accurate results? $\endgroup$
    – user287546
    Commented Apr 15, 2021 at 18:01
  • 1
    $\begingroup$ @user287546 I'm not familiar with this specific sum. It depends on whether the sum converges or diverges. Even if it does converge, it can go crazy for small n, and strat to converge at some large n. So for you question: long computation time is excepted, and more accurate results depend on the mathematics. $\endgroup$
    – Ymir
    Commented Apr 15, 2021 at 18:05
  • $\begingroup$ Ok, thanks a lot for this. Do you have other scripts at the cloud which you recommend for analysing such complex sums? $\endgroup$
    – user287546
    Commented Apr 15, 2021 at 18:06
  • $\begingroup$ @user287546 Maybe you should read the Complex Vizualiztion guide on the Mathematica reference website. Hope that you will find something useful over there. $\endgroup$
    – Ymir
    Commented Apr 15, 2021 at 18:12
  • $\begingroup$ Thanks, will do! $\endgroup$
    – user287546
    Commented Apr 15, 2021 at 18:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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