Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Problem showing graphics in Mathematica

  1. Jun 21, 2009 #1
    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 [Broken]

    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 [Broken]
     
    Last edited by a moderator: May 4, 2017
  2. jcsd
  3. Jun 21, 2009 #2

    CompuChip

    User Avatar
    Science Advisor
    Homework Helper

    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)
     
  4. Jun 21, 2009 #3
    That all code I used.

    Where can I look for definitions?
     
  5. Jun 21, 2009 #4
    Can you post the obtained image please?
     
  6. Jun 21, 2009 #5

    CompuChip

    User Avatar
    Science Advisor
    Homework Helper

    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"]).
     

    Attached Files:

  7. Jun 21, 2009 #6
    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 [Broken]
     
    Last edited by a moderator: May 4, 2017
  8. Jun 21, 2009 #7

    Dale

    Staff: Mentor

    The cylinder is there in the image you posted.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Problem showing graphics in Mathematica
Loading...