ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 20 Sep 2016 14:22:36 -0500Plot periodic minimal surface from Weierstrass representationhttps://ask.sagemath.org/question/34848/plot-periodic-minimal-surface-from-weierstrass-representation/ I want to plot the Schwarz P-(rimary) surface using its Weierstrass representation. Here is the code:
var('rho,a,w')
R=(w*(w^6+7/4*sqrt(2)*w^3-1))^(1/2)
# R=-I*w^2
theta=0
Phi_1=((1-w^2)/R).integrate(w)
Phi_2=(I*(1+w^2)/R).integrate(w)
Phi_3=(2*w/R).integrate(w)
def FF1(rho,a):
return real_part(exp(I*theta)*Phi_1(w=rho*exp(I*a)))
def FF2(rho,a):
return real_part(exp(I*theta)*Phi_2(w=rho*exp(I*a)))
def FF3(rho,a):
return real_part(exp(I*theta)*Phi_3(w=rho*exp(I*a)))
parametric_plot3d([FF1,FF2,FF3],(rho,0.001,1),(a,0.001,pi/3-0.001))
The range of plot is chosen to avoid any singular points, otherwise there will be a division-by-zero error. The commented line is a test for helicoid, which works very well. However, for P-surface, it returns the following warning:
.../sage/local/lib/python2.7/site-packages/sage/repl/rich_\
output/display_manager.py:590: RichReprWarning: Exception in _rich_repr_
while displaying object:
'sage.rings.complex_double.ComplexDoubleElement' object has no attribute
'variables'
RichReprWarning,
Graphics3d Object
And no graphics displayed.Sun, 18 Sep 2016 03:04:22 -0500https://ask.sagemath.org/question/34848/plot-periodic-minimal-surface-from-weierstrass-representation/Answer by eric_g for <p>I want to plot the Schwarz P-(rimary) surface using its Weierstrass representation. Here is the code:</p>
<pre><code>var('rho,a,w')
R=(w*(w^6+7/4*sqrt(2)*w^3-1))^(1/2)
# R=-I*w^2
theta=0
Phi_1=((1-w^2)/R).integrate(w)
Phi_2=(I*(1+w^2)/R).integrate(w)
Phi_3=(2*w/R).integrate(w)
def FF1(rho,a):
return real_part(exp(I*theta)*Phi_1(w=rho*exp(I*a)))
def FF2(rho,a):
return real_part(exp(I*theta)*Phi_2(w=rho*exp(I*a)))
def FF3(rho,a):
return real_part(exp(I*theta)*Phi_3(w=rho*exp(I*a)))
parametric_plot3d([FF1,FF2,FF3],(rho,0.001,1),(a,0.001,pi/3-0.001))
</code></pre>
<p>The range of plot is chosen to avoid any singular points, otherwise there will be a division-by-zero error. The commented line is a test for helicoid, which works very well. However, for P-surface, it returns the following warning:</p>
<pre><code>.../sage/local/lib/python2.7/site-packages/sage/repl/rich_\
output/display_manager.py:590: RichReprWarning: Exception in _rich_repr_
while displaying object:
'sage.rings.complex_double.ComplexDoubleElement' object has no attribute
'variables'
RichReprWarning,
Graphics3d Object
</code></pre>
<p>And no graphics displayed.</p>
https://ask.sagemath.org/question/34848/plot-periodic-minimal-surface-from-weierstrass-representation/?answer=34871#post-id-34871The problem does not come from the plotting function but from the fact that your functions `FF1`, `FF2`, `FF3` cannot return numerical values because `Phi_1`, `Phi_2` and `Phi_3` contain unevaluated integrals:
Phi_1
-2*integrate((w^2 - 1)/sqrt((4*w^6 + 7*sqrt(2)*w^3 - 4)*w), w)
You should probably use `numerical_integral` instead of integrate and specify some integration bounds.
The case of the commented line worked because SageMath was capable to find an explicit primitive:
R=-I*w^2
Phi_1=((1-w^2)/R).integrate(w)
Phi_1
-I*w - I/w
Tue, 20 Sep 2016 14:22:36 -0500https://ask.sagemath.org/question/34848/plot-periodic-minimal-surface-from-weierstrass-representation/?answer=34871#post-id-34871