1 | initial version |
I tinkered with this code below (far from being optimized!) Does it looks ok ? on SageCell
from sage.plot.plot3d.parametric_surface import ParametricSurface
var('x,y',domain='real')
var('k',domain='integer')
N=10 # approximation precision
xyBound=1.1
def condition(x,y,z):
return (x*x + y*y <=1)
cm = colormaps.jet
#cm = colormaps.autumn
def c(x,y):
if abs(x) >0 or abs(y)>0 :
argf=acos(x/sqrt((x**2 + y**2)))/3.15
else :
argf=0.5
return argf
def fr0(x,y):
z = CDF(x, y)
#return x, y, real_part((sum((factorial(2*k) * z^(2*k))/(4^k *(2*k - 1) *factorial(k)^2) ,k,0,N))^(1/2))
return x, y, real_part(sqrt(1-z^2))
def fr1(x,y):
z = CDF(x, y)
return x, y, -real_part(sqrt(1-z^2))
def fi0(x,y):
z = CDF(x, y)
return x, y, imag_part(sqrt(1-z^2))
def fi1(x,y):
z = CDF(x, y)
return x, y, -imag_part(sqrt(1-z^2))
pltr0=ParametricSurface(fr0, (srange(-1,1,0.1), srange(-1,1,0.1)), color=(c,cm), mesh=True)
pltr0.add_condition(condition)
pltr1=ParametricSurface(fr1, (srange(-1,1,0.1), srange(-1,1,0.1)), color=(c,cm), mesh=True)
pltr1.add_condition(condition)
pltr=pltr0+pltr1
pltr += arrow3d((0, 0, 0), (xyBound, 0, 0), color='green')
pltr += text3d("X", (xyBound, 0, 0), color='green')
pltr += arrow3d((0, 0, 0), (0, xyBound, 0), color='blue')
pltr += text3d("Y", (0, xyBound, 0), color='blue')
pltr += arrow3d((0, 0, 0), (0, 0, xyBound), color='red')
pltr += text3d("Z", (0,0, xyBound), color='red')
pltr.show(viewer='threejs')
plti0=ParametricSurface(fi0, (srange(-xyBound,xyBound,0.1), srange(-xyBound,xyBound,0.1)), color=(c,cm), mesh=True)
plti0.add_condition(condition)
plti1=ParametricSurface(fi1, (srange(-xyBound,xyBound,0.1), srange(-xyBound,xyBound,0.1)), color=(c,cm), mesh=True)
plti1.add_condition(condition)
plti=plti0+plti1
plti += arrow3d((0, 0, 0), (xyBound, 0, 0), color='green')
plti += text3d("X", (xyBound, 0, 0), color='green')
plti += arrow3d((0, 0, 0), (0, xyBound, 0), color='blue')
plti += text3d("Y", (0, xyBound, 0), color='blue')
plti += arrow3d((0, 0, 0), (0, 0, xyBound), color='red')
plti += text3d("Z", (0,0, xyBound), color='red')
plti.show(viewer='threejs')
2 | No.2 Revision |
I tinkered with this code below (far from being optimized!)
Does it looks ok ?
edited the 2022/03/14 new version
on SageCell
var('x,y,K,t',domain='real')
var('k',domain='integer')
3 | No.3 Revision |
I tinkered with this code below (far from being optimized!) Does it looks ok ? edited the 2022/03/14 new version on SageCell
from sage.plot.plot3d.parametric_surface import