Ask Your Question
0

Question about error using plot

asked 2013-08-14 21:02:51 +0100

updated 2013-08-14 22:34:09 +0100

tmonteil gravatar image

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 flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2013-08-14 23:39:11 +0100

kcrisman gravatar image

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

edit flag offensive delete link more
0

answered 2013-08-14 22:35:36 +0100

tmonteil gravatar image

updated 2013-08-14 22:44:10 +0100

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)

But concerning your second question,

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)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-08-14 21:02:51 +0100

Seen: 525 times

Last updated: Aug 14 '13