Problem showing graphics in Mathematica

  • Context: Mathematica 
  • Thread starter Thread starter jorgext
  • Start date Start date
  • Tags Tags
    Graphics Mathematica
Click For Summary

Discussion Overview

The discussion revolves around a problem related to visualizing a cylinder in Mathematica, specifically in the context of electrostatics. Participants are sharing code snippets and outputs to troubleshoot issues with graphical representation.

Discussion Character

  • Technical explanation, Debate/contested, Experimental/applied

Main Points Raised

  • One participant describes their code for plotting the electrostatic potential of a cylinder and asks if others experience similar issues with the output.
  • Another participant reports successfully obtaining the expected cylinder image, suggesting the original poster may have lingering definitions from previous commands.
  • The original poster inquires about where to check for these definitions.
  • There is a request for the image output from the original poster to further investigate the issue.
  • The original poster mentions adding a constant that was initially omitted, indicating a potential source of error.
  • A later reply confirms that the cylinder appears correctly in the image shared by the original poster.

Areas of Agreement / Disagreement

Participants generally do not agree on the source of the original poster's issue, as one participant sees the expected output while the original poster continues to experience problems. The discussion remains unresolved regarding the specific cause of the graphical issue.

Contextual Notes

There are references to potential old definitions affecting the output, but no specific resolutions or corrections are provided. The discussion includes links to external files that may contain additional context or code.

jorgext
Messages
8
Reaction score
0
Hi all,

I solved a problem of electrostatics potencial of a cylinder with special condicions. When I plotted the obtained solution, I used this code:

\[Epsilon] = 8.8541878176 10^-12;
R=1;
maxx=10;
Vin[\[Rho]_, \[Phi]_] := (2 \[Sigma] R)/(\[Pi] \[Epsilon])
Sum[If[OddQ[k], 1/k^2 Sin[k \[Phi]] (\[Rho]/R)^k, 0], {k, 0, maxx}]
Vout[\[Rho]_, \[Phi]_] := (2 \[Sigma] R)/(\[Pi] \[Epsilon])
Sum[If[OddQ[k], 1/k^2 Sin[k \[Phi]] (\[Rho]/R)^-k, 0], {k, 0,
maxx}]
V[\[Rho]_, \[Phi]_] :=
If[R < \[Rho], Vin[\[Rho], \[Phi]], Vout[\[Rho], \[Phi]]]
Show[
RevolutionPlot3D[
V[\[Rho], \[Phi]], {\[Rho], 0, 2}, {\[Phi], 0, 2 \[Pi]}],
Graphics3D[{Blue, Opacity[0.5], Cylinder[]}]
]I got this output:

http://www.alumnos.usm.cl/~jorge.lopezl/problem001.jpg

Do you get the same problem with the image?

I want to see a cylinder of radius R=1, centered in the origin with Z as vertical axis.

Greatings.

PS: Here is the NB file: http://www.alumnos.usm.cl/~jorge.lopezl/Griffiths%203.39.nb
 
Last edited by a moderator:
Physics news on Phys.org
I get a very nice cylinder of radius 1, as you said one should.
Are you sure you don't have some old definitions from earlier commands hanging around?

(Using Mathematica 6.0 btw)
 
That all code I used.

Where can I look for definitions?
 
Can you post the obtained image please?
 
I'll attach the notebook with the image in an output cell. If you evaluate the cell with "img = ..." you can do with it what you like (e.g. Export["filename", img, "format"]).
 

Attachments

Same problem, I added one constant that wasn't included.

Please check the file I attached here:

http://www.alumnos.usm.cl/~jorge.lopezl/cylinder.nb
 
Last edited by a moderator:
The cylinder is there in the image you posted.
 

Similar threads

  • · Replies 11 ·
Replies
11
Views
4K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 8 ·
Replies
8
Views
12K