Of course you realize that there are either two or zero values of z for every value of x and y.
That said, (((x^2)%(a^2)) + ((y^2)%(b^2)) + ((z^2)%(c^2))) = 1 (((c^2)*((x^2)%(a^2)) + ((y^2)%(b^2)))+ ((z^2)) = c^2 (z^2) = (c^2)*(1 - ((x^2)%(a^2)) + ((y^2)%(b^2))) a=:3 b=:4 c=:5 z=:13 :'c * ((1 - ((x^2)%(a^2)) + ((y^2)%(b^2))))^0.5' z 5 * 0.5 ^~ 1 - (9 %~ 2 ^~ [) + 16 %~ 2 ^~ ] Or: z=:1 _1 */ c * 0.5 ^~ 1 - ((a^2) %~ 2 ^~ [) + (b^2) %~ 2 ^~ ] Does that help? Thanks, -- Raul On Sat, Mar 7, 2015 at 12:10 AM, Skip Cave <s...@caveconsulting.com> wrote: > Raul, > > Yes. What I need is a function f (x,y) using the Cartesian coordinates x & > y that will produce the z dimension in the ellipse when I step x & y over > the plane. > > Skip > > Skip Cave > Cave Consulting LLC > > On Fri, Mar 6, 2015 at 11:03 PM, Raul Miller <rauldmil...@gmail.com> wrote: > >> I imagine they'd go something like this: >> >> X=. a*((sin P) */ cos T) >> Y=. b*(((sin P) */ sin T) >> Z=. c*((cos P) +/ T*0)%2 >> >> The assumption would be that when they are omitted they are 1. >> >> The trick is recognizing how these parametric equations correspond to >> your original expression. >> >> Thanks, >> >> -- >> Raul >> >> On Sat, Mar 7, 2015 at 12:00 AM, Skip Cave <s...@caveconsulting.com> >> wrote: >> > Ok now I'm confused. Nowhere do I see where we set the length of the >> three >> > axes a, b, and c. Also the step verb has lots of variables in it, like a, >> > w, n, and z that I don't see defined anywhere. >> > steps=: 3 : 'a+(w)*(i.n+1)%n[w=.z-a[''a z n''=.y' >> > >> > How do I change the lengths of the axes a, b,and c? >> > >> > Skip Cave >> > Cave Consulting LLC >> > >> > On Fri, Mar 6, 2015 at 10:25 PM, Joe Bogner <joebog...@gmail.com> wrote: >> > >> >> I don't know what I'm doing other than copy/pasting, but the example >> from >> >> the plot demo looks pretty close: >> >> >> >> load 'plot' >> >> pd 'clear' >> >> steps=: 3 : 'a+(w)*(i.n+1)%n[w=.z-a[''a z n''=.y' >> >> P=. steps 0 1p1 30 >> >> T=. steps 0 2p1 40 >> >> X=. ((sin P) */ cos T) >> >> Y=. ((sin P) */ sin T) >> >> Z=. ((cos P) +/ T*0)%2 >> >> >> >> pd 'backcolor blue' >> >> pd 'new 0 0 1000 1000' >> >> >> >> pd 'type surface' >> >> pd 'viewpoint 2 2 2;color grayscale' >> >> pd X;Y;Z >> >> pd 'show' >> >> >> >> >> >> >> >> On Fri, Mar 6, 2015 at 11:18 PM, Raul Miller <rauldmil...@gmail.com> >> >> wrote: >> >> >> >> > This is something of an aside - I don't know what I'm doing yet, well >> >> > enough to implement this via jhs, but here's an ellipsoid: >> >> > >> >> > https://www.shadertoy.com/view/XtlGDX >> >> > >> >> > You can tweak the a, b, and c radius values near the top of the script >> >> > (which should display on the right side of the screen) and hit the >> >> > play button to see the change. >> >> > >> >> > Thanks, >> >> > >> >> > -- >> >> > Raul >> >> > >> >> > On Fri, Mar 6, 2015 at 10:38 PM, Skip Cave <s...@caveconsulting.com> >> >> > wrote: >> >> > > Looking a bit better, but no cigar: >> >> > > >> >> > > a=:3[b=:3[c=:3 >> >> > > >> >> > > X=:4 :0 >> >> > > >> >> > > a*(cos x)*cos y >> >> > > >> >> > > ) >> >> > > >> >> > > Y=:4 :0 >> >> > > >> >> > > b*(cos x)*sin y >> >> > > >> >> > > ) >> >> > > >> >> > > Z=:3 :0 >> >> > > >> >> > > c*(sin y) >> >> > > >> >> > > ) >> >> > > >> >> > > steps=: 3 : 'a+(w)*(i.n+1)%n[w=.z-a[''a z n''=.y' >> >> > > >> >> > > draw=:3 :0 >> >> > > >> >> > > angles=: steps _1p1 1p1 100 >> >> > > >> >> > > uangles =: steps _1.5708 1.5708 100 >> >> > > >> >> > > x=. uangles X"0 _ angles >> >> > > >> >> > > y=. uangles Y"0 _ angles >> >> > > >> >> > > z=. Z uangles >> >> > > >> >> > > 'surface' plot x;y;z >> >> > > >> >> > > ) >> >> > > >> >> > > draw'' >> >> > > >> >> > > >> >> > > output at: http://bit.ly/1wNlQe3 >> >> > > >> >> > > >> >> > > Skip Cave >> >> > > Cave Consulting LLC >> >> > > >> >> > > On Fri, Mar 6, 2015 at 9:18 PM, Raul Miller <rauldmil...@gmail.com> >> >> > wrote: >> >> > > >> >> > >> steps=: 3 : 'a+(w)*(i.n+1)%n[w=.z-a[''a z n''=.y' >> >> > >> >> >> > >> Thanks, >> >> > >> >> >> > >> -- >> >> > >> Raul >> >> > >> >> >> > >> On Fri, Mar 6, 2015 at 10:08 PM, Skip Cave < >> s...@caveconsulting.com> >> >> > >> wrote: >> >> > >> > Here's what I got whaen I ran Jon's code: >> >> > >> > >> >> > >> > a=:3[b=:3[c=:3 >> >> > >> > >> >> > >> > X=:4 :0 >> >> > >> > >> >> > >> > a*(cos x)*cos y >> >> > >> > >> >> > >> > ) >> >> > >> > >> >> > >> > Y=:4 :0 >> >> > >> > >> >> > >> > b*(cos x)*sin y >> >> > >> > >> >> > >> > ) >> >> > >> > >> >> > >> > Z=:3 :0 >> >> > >> > >> >> > >> > c*(sin y) >> >> > >> > >> >> > >> > ) >> >> > >> > >> >> > >> > draw=:3 :0 >> >> > >> > >> >> > >> > angles=: steps _1p1 1p1 100 >> >> > >> > >> >> > >> > uangles =: steps _1.5708 1.5708 100 >> >> > >> > >> >> > >> > x=. uangles X"0 _ angles >> >> > >> > >> >> > >> > y=. uangles Y"0 _ angles >> >> > >> > >> >> > >> > z=. Z uangles >> >> > >> > >> >> > >> > 'surface' plot x;y;z >> >> > >> > >> >> > >> > ) >> >> > >> > >> >> > >> > draw'' >> >> > >> > >> >> > >> > |value error: steps >> >> > >> > >> >> > >> > | angles=: steps _3.14159 3.14159 100 >> >> > >> > >> >> > >> > >> >> > >> > Skip Cave >> >> > >> > Cave Consulting LLC >> >> > >> > >> >> > >> > On Fri, Mar 6, 2015 at 8:56 PM, Jon Hough <jgho...@outlook.com> >> >> > wrote: >> >> > >> > >> >> > >> >> >> >> > >> >> I butchered Raul's script slightly. But the resulting graph is >> >> still >> >> > >> >> weird. Not sure if it's an improvement. >> >> > >> >> >> >> > >> >> >> >> > >> >> a=:3[b=:3[c=:3 >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> X=:4 :0 >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> a*(cos x)*cos y >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> ) >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> Y=:4 :0 >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> b*(cos x)*sin y >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> ) >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> Z=:3 :0 >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> c*(sin y) >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> ) >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> draw=:3 :0 >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> angles=: steps _1p1 1p1 100 >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> uangles =: steps _1.5708 1.5708 100 >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> x=. uangles X"0 _ angles >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> y=. uangles Y"0 _ angles >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> z=. Z uangles >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> 'surface' plot x;y;z >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> ) >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> draw'' >> >> > >> >> >> >> > >> >> > From: jgho...@outlook.com >> >> > >> >> > To: programm...@jsoftware.com >> >> > >> >> > Date: Sat, 7 Mar 2015 02:46:35 +0000 >> >> > >> >> > Subject: Re: [Jprogramming] Plotting a 3D Ellipse >> >> > >> >> > >> >> > >> >> > It seems you are using [-pi,pi] as the range of all your >> angles.I >> >> > >> think >> >> > >> >> you need to use [-pi/2,pi/2] as the range for the u argument (in >> >> the >> >> > >> >> wikipedia page). >> >> > >> >> > >> >> > >> >> > > From: rauldmil...@gmail.com >> >> > >> >> > > Date: Fri, 6 Mar 2015 21:35:37 -0500 >> >> > >> >> > > To: programm...@jsoftware.com >> >> > >> >> > > Subject: Re: [Jprogramming] Plotting a 3D Ellipse >> >> > >> >> > > >> >> > >> >> > > Hmm... >> >> > >> >> > > >> >> > >> >> > > I notice that load'graph' no longer provides the steps verb >> >> > >> mentioned >> >> > >> >> > > in http://www.jsoftware.com/books/pdf/expmath.pdf >> >> > >> >> > > >> >> > >> >> > > So here's a workalike: >> >> > >> >> > > steps=: 3 : 'a+(w)*(i.n+1)%n[w=.z-a[''a z n''=.y' >> >> > >> >> > > >> >> > >> >> > > and that gives us an example of a surface plot. >> >> > >> >> > > >> >> > >> >> > > Next, we need a parametric representation of the ellipse, >> and >> >> > >> >> > > http://en.wikipedia.org/wiki/Ellipsoid#Parameterization >> looks >> >> > like >> >> > >> a >> >> > >> >> > > plausible approach there. >> >> > >> >> > > >> >> > >> >> > > Using that, and >> >> http://www.jsoftware.com/help/jforc/graphics.htm >> >> > >> as a >> >> > >> >> > > starting point, it seems to me that I ought to be able to >> draw >> >> an >> >> > >> >> > > ellipse like this: >> >> > >> >> > > >> >> > >> >> > > a=:3[b=:4[c=:5 >> >> > >> >> > > >> >> > >> >> > > X=:4 :0~ >> >> > >> >> > > a*(cos x)*/cos y >> >> > >> >> > > ) >> >> > >> >> > > >> >> > >> >> > > Y=:4 :0~ >> >> > >> >> > > b*(cos x)*/sin y >> >> > >> >> > > ) >> >> > >> >> > > >> >> > >> >> > > Z=:4 :0~ >> >> > >> >> > > c*(sin x)*/1: y >> >> > >> >> > > ) >> >> > >> >> > > >> >> > >> >> > > draw=:3 :0 >> >> > >> >> > > angles=: steps _1p1 1p1 100 >> >> > >> >> > > x=. X angles >> >> > >> >> > > y=. Y angles >> >> > >> >> > > z=. Z angles >> >> > >> >> > > 'surface' plot x;y;z >> >> > >> >> > > ) >> >> > >> >> > > >> >> > >> >> > > draw'' >> >> > >> >> > > >> >> > >> >> > > Sadly, that's not an ellipse. >> >> > >> >> > > >> >> > >> >> > > But I do not have enough familiarity with plot to know >> whether >> >> > I've >> >> > >> >> > > screwed up my math or if there's a defect in plot -- I don't >> >> know >> >> > >> how >> >> > >> >> > > to isolate the problem. >> >> > >> >> > > >> >> > >> >> > > That said, a quick test with a 3d model of a cube: >> >> > >> >> > > >> >> > >> >> > > 'surface' plot ;/|:#:i.8 >> >> > >> >> > > |NaN error: ncile >> >> > >> >> > > >> >> > >> >> > > ...suggests that plot isn't really designed to represent 3d >> >> > solids. >> >> > >> >> > > >> >> > >> >> > > Still, that does not eliminate any potential errors on my >> part. >> >> > >> >> > > >> >> > >> >> > > On the other hand, maybe the right approach would be to use >> jhs >> >> > and >> >> > >> >> > > generate a distance field renderer along the lines of what >> you >> >> > see >> >> > >> at >> >> > >> >> > > shadertoy.com. >> >> > >> >> > > >> >> > >> >> > > I'll have to think a bit to see if I can pull off something >> >> like >> >> > >> that. >> >> > >> >> > > (I think that that would only work for people who have >> adequate >> >> > >> >> > > graphics hardware support. But I think you have a suitable >> >> > graphics >> >> > >> >> > > card?) >> >> > >> >> > > >> >> > >> >> > > Thanks, >> >> > >> >> > > >> >> > >> >> > > -- >> >> > >> >> > > Raul >> >> > >> >> > > >> >> > >> >> > > >> >> > >> >> > > On Fri, Mar 6, 2015 at 7:10 PM, Skip Cave < >> >> > s...@caveconsulting.com> >> >> > >> >> wrote: >> >> > >> >> > > > I want to plot a 3D ellipse (ellipsoid) and then be able >> to >> >> > change >> >> > >> >> the >> >> > >> >> > > > lengths of the three axes. The equation of an ellipse with >> >> axis >> >> > >> >> lengths of >> >> > >> >> > > > a, b, & c is: >> >> > >> >> > > > >> >> > >> >> > > > ((x^2)%(a^2)) + ((y^2)%(b^2)) + ((z^2)%(c^2)) = 1 >> >> > >> >> > > > >> >> > >> >> > > > How can I arrange this so it can be plotted in a 3-D plot >> in >> >> J, >> >> > >> and >> >> > >> >> then be >> >> > >> >> > > > able to experiment with the lengths of the axes? >> >> > >> >> > > > >> >> > >> >> > > > Skip >> >> > >> >> > > > >> >> > >> >> > > > Skip Cave >> >> > >> >> > > > Cave Consulting LLC >> >> > >> >> > > > >> >> > >> >> >> >> > ---------------------------------------------------------------------- >> >> > >> >> > > > For information about J forums see >> >> > >> >> http://www.jsoftware.com/forums.htm >> >> > >> >> > > >> >> > >> >> ---------------------------------------------------------------------- >> >> > >> >> > > For information about J forums see >> >> > >> http://www.jsoftware.com/forums.htm >> >> > >> >> > >> >> > >> >> > >> >> > ---------------------------------------------------------------------- >> >> > >> >> > For information about J forums see >> >> > >> http://www.jsoftware.com/forums.htm >> >> > >> >> >> >> > >> >> >> >> > ---------------------------------------------------------------------- >> >> > >> >> For information about J forums see >> >> > http://www.jsoftware.com/forums.htm >> >> > >> >> >> >> > >> > >> >> ---------------------------------------------------------------------- >> >> > >> > For information about J forums see >> >> > http://www.jsoftware.com/forums.htm >> >> > >> >> ---------------------------------------------------------------------- >> >> > >> For information about J forums see >> >> http://www.jsoftware.com/forums.htm >> >> > >> >> >> > > >> ---------------------------------------------------------------------- >> >> > > For information about J forums see >> http://www.jsoftware.com/forums.htm >> >> > ---------------------------------------------------------------------- >> >> > For information about J forums see >> http://www.jsoftware.com/forums.htm >> >> > >> >> ---------------------------------------------------------------------- >> >> For information about J forums see http://www.jsoftware.com/forums.htm >> >> >> > ---------------------------------------------------------------------- >> > For information about J forums see http://www.jsoftware.com/forums.htm >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm >> > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm