# Question about error using plot

Hello all,

I'd like to view the plot of the real portion of (1+x*I)^(1+5*I). I've tried the following in sage:

plot(((.5+x*I)^(1+5*I)).real(),(x,0,5)) but I keep getting cannot convert symbolic expression to numeric value.

Honestly, I'd actually like to integrate the expression with respect to x on some arbitrary real interval. That kept giving errors as well when I tried to use integral_numerical.

Can anyone help me? I am running the newest edition of sage, as I updated two days ago.

Thanks,

Rick

edit retag close merge delete

Sort by » oldest newest most voted

It's possible that Trac 13355 may end up solving this problem as well.

more

You can define your function first, and then plot it:

sage: f(x) = ((1+x*I)^(1+5*I)).real()
sage: plot(f,x,0,5)


sage: integral_numerical(f,0,1)


leads to an error. A workaround is to define your function f not as a symbolic expression, but as a lambda function:

sage: f = lambda x: ((1+x*I)^(1+5*I)).real()
sage: plot(f,x,0,5)
sage: integral_numerical(f,0,1)
(0.1786803251930374, 2.0932402003702034e-15)

more