HP Forums
Plotting f(x,y,z)=0? - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Plotting f(x,y,z)=0? (/thread-19450.html)

Plotting f(x,y,z)=0? - byoung - 01-19-2023 07:02 PM

Is there any way to make the Prime create a 3D plot when the equation cannot be explicitly solved for z? Specifically, the following equation has been used in 3D printing to recreate the porous internal structure of human bone:

cos(x)*sin(y) + cos(y)*sin(z) + cos(z)*sin(x) = 0

Is it possible to plot this on the Prime?

RE: Plotting f(x,y,z)=0? - roadrunner - 01-19-2023 11:31 PM

Maybe you can use fsolve to solve for z like this:

p:=(x,y,n)->(fsolve((cos(x)*sin(y)+cos(y)*sin(z)+cos(z)*sin(x)) = 0,z,0 .. (2*π)))(n)

That give 2 solutions between 0 and 2*pi so you can plot each one separately:

FZ1(X,Y)=p(X,Y,1) and FZ2((X,Y)=p(X,Y,2)


RE: Plotting f(x,y,z)=0? - Albert Chan - 01-20-2023 12:30 AM

(01-19-2023 07:02 PM)byoung Wrote:  cos(x)*sin(y) + cos(y)*sin(z) + cos(z)*sin(x) = 0

I think you can solve for z

Let K = sqrt(cos(y)^2 + sin(x)^2)
Let θ = asin(sin(x)/K)

cos(x)*sin(y) + K*(sin(z)*cos(θ) + cos(z)*sin(θ)) = 0
sin(z + θ) = -cos(x)*sin(y) / K

z = asin(-cos(x)*sin(y) / K) - θ

Comment: I assumed y within ±pi/2, otherwise θ = atan2(sin(x), cos(y))

RE: Plotting f(x,y,z)=0? - byoung - 01-20-2023 02:58 PM

Roadrunner and Albert, thanks for those solutions; both look like they should work. I'll probably need a few tries to get the fsolve syntax correct (syntax errors have become my nemesis as I get used to the Prime after 40 years of other HPs).

Albert, it's been too long since I've studied trig - I would never have thought of those substitutions!

Thanks again to both of you.