Hello!
I'm working on some visualizations. In fact, I'd like to vizualize lines and curves on projective plane. I started with something very easy. I'd like to draw a line on sphere. I figured out something like this:
x,y,z=var('x y z')
sol = solve([x+y+z==0.0, x^2+y^2+z^2 == 1.0], y, z);
print(sol)
p = implicit_plot3d(x+y+z, (x,-5,5), (y,-5,5), (z,-5,5), color="blue", opacity=0.2)
p += implicit_plot3d(x^2+y^2+z^2 - 1,(x,-5,5), (y,-5,5), (z,-5,5), color="red", opacity=0.4)
for s in sol:
p += parametric_plot3d([x,y.subs(s[0]), z.subs(s[1])], (x,-5.0,5.0), color="green")
show(p)
The output of this program is:
[
[y == -1/2*x - 1/2*sqrt(-3*x^2 + 2), z == -1/2*x + 1/2*sqrt(-3*x^2 + 2)],
[y == -1/2*x + 1/2*sqrt(-3*x^2 + 2), z == -1/2*x - 1/2*sqrt(-3*x^2 + 2)]
]
I believe it's correct.
However I'm not satsified about the resulting plot. Unfortunately I don't have enough karma points to show you the result. Instead of smooth line (like equator) I have strange "triangles" on the poles of the sphere.
What can I do about it?