Post Reply 
Plotting f(x,y,z)=0?
01-19-2023, 07:02 PM
Post: #1
Plotting f(x,y,z)=0?
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?

- Bruce
Find all posts by this user
Quote this message in a reply
01-19-2023, 11:31 PM
Post: #2
RE: Plotting f(x,y,z)=0?
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)

-road
Find all posts by this user
Quote this message in a reply
01-20-2023, 12:30 AM (This post was last modified: 01-20-2023 01:25 AM by Albert Chan.)
Post: #3
RE: Plotting f(x,y,z)=0?
(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))
Find all posts by this user
Quote this message in a reply
01-20-2023, 02:58 PM
Post: #4
RE: Plotting f(x,y,z)=0?
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.

- Bruce
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)