Mathematica, Plot Implicit function contain Sum (sigma)

In summary, the person is trying to plot a function but is having trouble. They have provided a simplified version of the code and suggest that the poster try to hack it to death until it resembles the original code.
  • #1
8s0nc1
1
0
Dear friends,
Over the past week, I tried to plot implicit function by mathematica but failed. I am very disappointed. Hopefully someone help me at this time.
My equation is given by (see below figure):
getImageAttachment?filename=My_equation.gif

Where
z0 := 6
d := 12
k := 11800
w0 := 0.025
w[z_] := sqrt[w0^2*(1 + (z/z0)^2)]
deltaphi0[z_] := 0.6/(1 + (z^2/z0^2))
R[z_] := z*(1 + (z0/z)^2)
wm0[z_] := sqrt[w^2/(2*m + 1)]
dm[z_] := (k/2)*((wm0)^2)
g[z_] := 1 + (d/R)
wm[z_] := wm0*sqrt[[g^2 + (d)^2/dm^2]]
Rm[z_] := d*(1 - g/(g^2 + (d/dm)^2))^(-1)
thetam[z_] := ArcTan[d/(dm*g)]
I want to plot a graph to represent the dependence of r (z). I have tried the following code-mathematica file
getImageAttachment?filename=Trial_code.gif

But mathamatica plot 2 coordinate axes without data (no points).
getImageAttachment?filename=Output.gif

Please help me!
This is the mathematica file
https://docs.google.com/a/hcmus.edu.vn/file/d/0B6ue0CPI1AOFcWpjd19zMEU0a2s/edit
and my function
https://docs.google.com/a/hcmus.edu.vn/file/d/0B6ue0CPI1AOFTXMxRFZDaXd6NjQ/edit
Thanks very much.
 
Physics news on Phys.org
  • #2
Quick look suggest you got that little s in there: First rule of Mathematica: all built-in functions names start with capital letters like Sqrt
 
  • #3
I don't know how many more errors remain, but this fixes the first couple of waves and does plot something.

In[1]:= z0 = 6;
d = 12;
k = 11800;
w0 = 0.025;
w[z_] := Sqrt[w0^2*(1 + (z/z0)^2)];
deltaphi0[z_] := 0.6/(1 + (z/z0)^2);
R[z_] := z*(1 + (z0/z)^2);
wm0[z_] := Sqrt[w[z]^2/(2*m + 1)];
dm[z_] := k/2*wm0[z]^2;
g[z_] := 1 + d/R[z];
wm[z_] := wm0[z]*Sqrt[g[z]^2 + (d/dm[z])^2];
Rm[z_] := d/(1 - g[z]/(g[z]^2 + (d/dm[z])^2));
thetam[z_] := ArcTan[d/(dm[z]*g[z])];
ContourPlot[ Abs[ Sum[ (I*deltaphi0[z])^m/m!*wm0[z]/wm[z]* Exp[-r^2/wm[z]^2 - I*k*r^2/2*Rm[z] + I*thetam[z]], {m, 0, 1}]]^2 - 0.153*Abs[ Sum[ (I*deltaphi0[z])^m/m!*wm0[z]/wm[z]*Exp[I*thetam[z]], {m, 0, 1}]]^2 == 0, {r, -100, 100}, {z, -100, 100}]

Out[14]= ...PlotSnipped...

There are fairly clearly other things wrong. For example, when I change your plot range {r, -100, 100} to {r, -5, 5} to try to zoom in on the horizontal axis, instead of getting a substantially wider and more detailed version of your plot I get a narrower and narrower plot. So I think at least a couple of other things are seriously broken in the code.
 
Last edited:
  • #4
Bill Simpson said:
So I think at least a couple of other things are seriously broken in the code.

Great. That's a good start.

Now, to the poster:

How do we proceed from here? Well, I can tell you how to fix it without even looking at it: Start cutting things out, make it simpler while trying to keep the qualitative content of the code you're trying to run. Keep doing that even if you have to mercilessly hack it to death until it only vaguely resembles the original code. Get that simplified version running. Then piece by piece and not 2 or three at time, add one thing to the code, get it running, add another, get it running, then another until you build it back up to what you're trying to do.
 
  • #5


Dear friend,

I understand your frustration with trying to plot the implicit function using Mathematica. It can be a complex process and requires a good understanding of the software and the mathematical equations involved. I would suggest reaching out to a colleague or a tutor who has experience with Mathematica to help you with your plot. You can also try looking for online tutorials or forums where others have successfully plotted implicit functions using Mathematica.

In terms of your specific equation, it is important to ensure that all the variables and functions are properly defined and inputted into the code. Double check the syntax and make sure there are no typos or errors. Also, consider breaking down the equation into smaller parts and plotting them individually to troubleshoot any issues that may arise.

Additionally, it may be helpful to provide more information on the specific error or issue you are encountering, as well as any error messages that Mathematica may be giving you. This will allow others to better understand the problem and provide more targeted solutions.

I hope you are able to successfully plot your implicit function and achieve your desired results. Don't give up and keep exploring different methods and resources to help you with your plot. Best of luck.
 

1. What is Mathematica and how is it related to plotting implicit functions?

Mathematica is a computational software program that is widely used in various fields of science and engineering. It has a built-in function for plotting implicit functions, which allows for the visualization of mathematical relationships that cannot be expressed explicitly.

2. Can Mathematica plot implicit functions containing summation (sigma) notation?

Yes, Mathematica has the ability to plot implicit functions that contain summation (sigma) notation. This can be done by using the "Sum" function within the implicit function expression.

3. How do I plot an implicit function containing multiple variables in Mathematica?

To plot an implicit function with multiple variables in Mathematica, you can use the "ContourPlot" function. This function allows you to specify the variables and the implicit function expression, and it will generate a contour plot.

4. Is it possible to customize the appearance of the plot of an implicit function in Mathematica?

Yes, Mathematica offers various options for customizing the appearance of the plot of an implicit function. These include changing the color, style, and thickness of the contour lines, as well as adding labels, titles, and legends to the plot.

5. Can Mathematica solve and plot implicit functions simultaneously?

Yes, Mathematica has a built-in function called "Solve" that can be used to find the solutions of an implicit function. These solutions can then be plotted using the "ContourPlot" function, allowing for the simultaneous solving and plotting of the implicit function.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
269
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
6
Views
865
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
903
  • Advanced Physics Homework Help
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
942
Back
Top