Solution: Plotting Mathematica Homework w/ Recursion Limit Error

AI Thread Summary
The discussion revolves around resolving a recursion limit error encountered while plotting a Mathematica homework problem involving electric field equations. The user initially presented their equations for x, y, and z based on the electric field formula but faced a recursion limit issue. A suggestion was made to rename the variables to avoid conflicts, as the same variable names were used for both the function and the input. After implementing the changes, the user successfully obtained a plot, although they noted that the output appeared unusual. The conversation highlights the importance of variable naming in programming to prevent errors.
Ashley1nOnly
Messages
132
Reaction score
3

Homework Statement


upload_2018-9-12_15-48-13.png


Homework Equations


E= kq/r^2 * r-hat

where q= +/-(1.6*10^-19)

The Attempt at a Solution


x=

(1.6*10^-19)*x/(x^2+y^2+(z+1)^2)^(3/2) - (1.6*10^-19)*x/(x^2+y^2+(z-1)^2)^(3/2)y=

(1.6*10^-19)*y/(x^2+y^2+(z+1)^2)^(3/2) - (1.6*10^-19)*y/(x^2+y^2+(z-1)^2)^(3/2)

z=

(1.6*10^-19)*(z+1)/(x^2+y^2+(z+1)^2)^(3/2) - (1.6*10^-19)*(z-1)/(x^2+y^2+(z-1)^2)^(3/2)ContourPlot3D[{x,y,z},{x,-5,5},{y,-5,5},{z,-5,5}]

This should work but it is giving me a recursion limit error. I know that the math (well at least I think) is correct.

Any suggestions on how to fix the error?
 

Attachments

  • upload_2018-9-12_15-48-13.png
    upload_2018-9-12_15-48-13.png
    1.5 KB · Views: 686
  • upload_2018-9-12_15-48-59.png
    upload_2018-9-12_15-48-59.png
    5.1 KB · Views: 364
Physics news on Phys.org
Ashley1nOnly said:

Homework Statement


View attachment 230602

Homework Equations


E= kq/r^2 * r-hat

where q= +/-(1.6*10^-19)

The Attempt at a Solution


x=

(1.6*10^-19)*x/(x^2+y^2+(z+1)^2)^(3/2) - (1.6*10^-19)*x/(x^2+y^2+(z-1)^2)^(3/2)y=

(1.6*10^-19)*y/(x^2+y^2+(z+1)^2)^(3/2) - (1.6*10^-19)*y/(x^2+y^2+(z-1)^2)^(3/2)

z=

(1.6*10^-19)*(z+1)/(x^2+y^2+(z+1)^2)^(3/2) - (1.6*10^-19)*(z-1)/(x^2+y^2+(z-1)^2)^(3/2)ContourPlot3D[{x,y,z},{x,-5,5},{y,-5,5},{z,-5,5}]

This should work but it is giving me a recursion limit error. I know that the math (well at least I think) is correct.

Any suggestions on how to fix the error?

I haven't checked your physics; the rest of this reply is solely involving the recursion limit error.

You are using your x, y, and z variables for different things in different places. Try changing the names of your variables appropriately.

For example, right now you have
x = a function of x (and also y and z).

Try changing that to

x1 = a function of x (and also y and z)

or some other variable name that makes more sense.
 
Thanks, that worked. It gave me an answer with the expected lines but it does look funny.

upload_2018-9-12_18-15-33.png
 

Attachments

  • upload_2018-9-12_18-15-33.png
    upload_2018-9-12_18-15-33.png
    31.8 KB · Views: 454
I multiplied the values first without the error limit. Got 19.38. rounded it off to 2 significant figures since the given data has 2 significant figures. So = 19. For error I used the above formula. It comes out about 1.48. Now my question is. Should I write the answer as 19±1.5 (rounding 1.48 to 2 significant figures) OR should I write it as 19±1. So in short, should the error have same number of significant figures as the mean value or should it have the same number of decimal places as...
Thread 'Collision of a bullet on a rod-string system: query'
In this question, I have a question. I am NOT trying to solve it, but it is just a conceptual question. Consider the point on the rod, which connects the string and the rod. My question: just before and after the collision, is ANGULAR momentum CONSERVED about this point? Lets call the point which connects the string and rod as P. Why am I asking this? : it is clear from the scenario that the point of concern, which connects the string and the rod, moves in a circular path due to the string...
Thread 'A cylinder connected to a hanging mass'
Let's declare that for the cylinder, mass = M = 10 kg Radius = R = 4 m For the wall and the floor, Friction coeff = ##\mu## = 0.5 For the hanging mass, mass = m = 11 kg First, we divide the force according to their respective plane (x and y thing, correct me if I'm wrong) and according to which, cylinder or the hanging mass, they're working on. Force on the hanging mass $$mg - T = ma$$ Force(Cylinder) on y $$N_f + f_w - Mg = 0$$ Force(Cylinder) on x $$T + f_f - N_w = Ma$$ There's also...
Back
Top