Further on plotting functions

20 views
Skip to first unread message

Fjordforsk A/S

unread,
Jun 26, 2017, 7:05:27 AM6/26/17
to sage-support
Hello, I tried a different variant of the previous plot:

def f(x,y):
return math.sqrt(2**3))*exp(-(x**2 + y**2)
P = plot3d(f,(-3,3),(-3,3), adaptive=True, color=rainbow(60, 'rgbtuple'), max_bend=.1, max_depth=15)
P.show()

however, this also does not show.


Eric Gourgoulhon

unread,
Jun 26, 2017, 7:25:58 AM6/26/17
to sage-support

Works for me, provided the parentheses in the definition of f are well placed:
def f(x,y):
    return math.sqrt(2**3)*exp(-(x**2 + y**2))

Best wishes,

Eric.

Fjordforsk A/S

unread,
Jun 26, 2017, 8:18:16 AM6/26/17
to sage-support

Thanks, that fixed it.


Trying this variant with colors:

var('x y');
cmsel = [colormaps['gnuplot2'](i) for i in sxrange(0,1,0.02)]
plot3d(lambda x,y:(1/(math.sqrt(2**2)*pi))*(x+I*y)*exp(-(0.25)((x+I*y)**2)),(x,-2*pi,2*pi),(y,-2*pi,2*pi),adaptive=True,color=cmsel)



But something stops here.

Is this a wrong type of way of plotting that function?
Reply all
Reply to author
Forward
0 new messages