HP Forums

Full Version: Plotting f(x,y,z)=0?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?
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)

(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))
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.
Reference URL's