I’m having issues translating my functions from Desmos 3D graphing calculator into rhino. I was able to get the graph I was having issue with from the previous post inro Rhino, see the attached 3dm and gh files. But, when I moved on to more complex functions to graph, it does not look like what Desmos had plotted.

For the green surface, it seems to me that one side of the surface is upside-down, but any attempts to split it and correct it fails because the surface is open at that region. And as for the function below that, line 58 in Desmos, I get a “Division by zero” error in Grasshopper, even after triple-checking the parenthesis.

I’ve been stuck on this problem for days and I don’t know what I missed. Any help figuring this out would be greatly appreciated. Thank you very much!

Hello
this is working as expected if you follow the good equation.
From what you asked you look at this equation

Phi has a range form [0 PI] but for Grasshopper coordinate and most of the sytem I know it is [-pi/2 to Pi/2] => so I remap the angle from [0 pi] to [-pi/2 pi/2] not in the equation just for the viewing. This angle is Elevation, Z angle in GH

It is logical that there is a division by 0 because of the Sinus. You can begin at say 0.001 but 1/sin(0.001) will be very big !!!
Second not logical thing you have this equation

But you feed it with Phi [0 PI] but it is writte, [2/3PI] !!!

Phi has a range form [0 PI] but for Grasshopper coordinate and most of the sytem I know it is [-pi/2 to Pi/2]

Man I wish I knew how to code so I can understand how these 3D graphing calculators work.

so I remap the angle from [0 pi] to [-pi/2 pi/2] not in the equation just for the viewing. This angle is Elevation, Z angle in GH

What I’ve notice right away is that upon fixing this in my script, the geometry is upside-down compared to what Desmos produced. The fix is a simple Negative component but another thing is that the blue geometry is not closed. In fact, neither of the geometries in the script are closed. Not much of a big deal to me but the real issue is this:

It is logical that there is a division by 0 because of the Sinus. You can begin at say 0.001 but 1/sin(0.001) will be very big !!!

Somehow, while fixing my script, the divide by zero error cleared itself! Thanks to you, Laurent, I was able to make a little progress, but the updated Grasshopper Script is now not matching the blue surface plotted by Desmos. See below:

If you were to play around with this in Desmos (Here is the link), you’ll quickly see that this particular function goes to infinity. Perhaps this has something to do with why Grasshopper is plotting it incorrectly? I’m not sure how you can restrict the Z-value of a function that goes to infinity in spherical coordinates beside splitting it with a plane. Again, thanks for providing your insight!

Hello
still errors, you must be more careful.
I just look at Desmos and it is clear that angles are not exactly what I thouht. It was hard to guess without documentation. See there