Error plotting 3D

30 views
Skip to first unread message

Fjordforsk A/S

unread,
Jul 3, 2017, 8:51:17 AM7/3/17
to sage-support
Hi, I get this error:

/home/sem/SageMath/src/sage/symbolic/expression.pyx in sage.symbolic.expression.Expression.__call__ (/home/sem/SageMath/src/build/cythonized/sage/symbolic/expression.cpp:30500)()
   5058             z^2 + x^y
   5059         """
-> 5060         return self._parent._call_element_(self, *args, **kwds)
   5061
   5062     def variables(self):

/home/sem/SageMath/src/sage/symbolic/ring.pyx in sage.symbolic.ring.SymbolicRing._call_element_ (/home/sem/SageMath/src/build/cythonized/sage/symbolic/ring.cpp:10778)()
    894                     d[ vars[i] ] = arg
    895                 except IndexError:
--> 896                     raise ValueError("the number of arguments must be less than or equal to %s"%len(vars))
    897
    898         return _the_element.subs(d, **kwds)

ValueError: the number of arguments must be less than or equal to 0




when plotting:

sage: plot3d(lambda x,y:(exp(I*2000*(1.60217662*10**(-19))/((299792458*6.6260700
....: *10**(-34)))-sqrt(I*(1.60217662*10**(-19))/(4*6.62607004*10**(-34)*2997924
....: 58*2000-((1.60217662*10**(-19))^2*2000**2)/((6.62607004*10**(-34))**2)**29
....: 9792458**2)))(x**2+y**2)).real_part(),(x,-3*pi,3*pi),(y,0,2),adaptive=True
....: , color=cmsel)


It appears that the brackets are right. Can any one comment?

Thanks

Fjordforsk A/S

unread,
Jul 3, 2017, 9:14:16 AM7/3/17
to sage-support
Changed to:


sage: plot3d(lambda x,y:(exp(I*2000*(1.60217662*10**(-19))/((299792458*6.6260700
....: *10**(-34)))-sqrt(I*(1.60217662*10**(-19))/(4*6.62607004*10**(-34)*2997924
....: 58*2000-(((1.60217662*10**(-19))^2*2000**2)/(((6.62607004*10**(-34))**2)**
....: 299792458**2)))(x**2+y**2)).real_part(),(x,-3*pi,3*pi),(y,0,2),adaptive=Tr
....: ue, color=cmsel)))


Still get an error

William Stein

unread,
Jul 3, 2017, 3:02:47 PM7/3/17
to sage-s...@googlegroups.com
Hi,

If you want useful help, give the complete log of a minimal session reproducing the problem, from start to finish.

– William
--
You received this message because you are subscribed to the Google Groups "sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
To post to this group, send email to sage-s...@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Ralf Stephan

unread,
Jul 4, 2017, 1:48:24 AM7/4/17
to sage-support
Well you are dealing with numerically exctreme values here.
Let's look at the factor of (x**2+y**2) inside the lambda:

sage: (exp(I*2000*(1.60217662*10**(-19))/(299792458*6.6260700*10**(-34)))-(sqrt(
....: I*(1.60217662*10**(-19))/(4*6.62607004*10**(-34)*299792458*2000))-((((1.60
....: 217662*10**(-19))**2)*2000**2)/(((6.62607004*10**(-34))**2)**299792458**2)
....: )))
+infinity + NaN*I

Using inexact numerics will not work if you exceed machine limits.
It is even impossible for Sage to compute the value using exact numerics:

sage: (exp(I*2000*(160217662/100000000*10**(-19))/(299792458*66260700/10000000*1
....: 0**(-34)))-(sqrt(I*(160217662/100000000*10**(-19))/(4*662607004/100000000*
....: 10**(-34)*299792458*2000))-((((160217662/100000000*10**(-19))**2)*2000**2)
....: /(((662607004/100000000*10**(-34))**2)**299792458**2))))
sage/src/sage/rings/rational.pyx in sage.rings.rational.Rational.__pow__ (build/cythonized/sage/rings/rational.c:24103)()
   2575             return x
   2576         elif nn > 0:
-> 2577             sig_on()
   2578             mpz_pow_ui(mpq_numref(x.value), mpq_numref(_self.value), nn)
   2579             mpz_pow_ui(mpq_denref(x.value), mpq_denref(_self.value), nn)

MemoryError: failed to allocate 617894185381562160 bytes
 

Ralf Stephan

unread,
Jul 4, 2017, 2:03:45 AM7/4/17
to sage-support
The reason is the typo **299792458

You really want such a big power?

Reply all
Reply to author
Forward
0 new messages