Ask Your Question

Plotting Bessel function

asked 2012-09-30 04:07:31 -0500

R C gravatar image

gives me a plot of the Bessel function. However:


gives me an error:

TypeError: plot() got an unexpected keyword argument 'rgbcolor'

even though:



I am using the developmental version of sage. Any help to resolve this is appreciated.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2012-09-30 06:50:53 -0500

achrzesz gravatar image

updated 2012-09-30 08:09:40 -0500

plot(lambda x:bessel_J(0,x),(x,0,10),color='red')
plot(lambda x:Bessel(0,'J')(x),(x,0,10),color='red')
edit flag offensive delete link more


Thanks, this works well. By defining the lambda function outside the plot command, I can use it also in find_local_maximum and find_root. I will check the documentation to better understand why a lambda function is needed for the Bessel functions.

R C gravatar imageR C ( 2012-09-30 09:51:32 -0500 )edit

I think this is because the in the current implementation the Bessel functions define their own `plot` method and the options supported aren't the same as the top-level plot function. hopefully this can be improved sometime soon. It looks like it would be very easy to pass along a dictionary of options through the Bessel class's plot method:

benjaminfjones gravatar imagebenjaminfjones ( 2012-09-30 11:22:40 -0500 )edit

Thanks for clarifying this. So using a lambda function in the plot call allows for the standard options to be passed to the plot method.

R C gravatar imageR C ( 2012-09-30 23:18:49 -0500 )edit

@benjaminfjones - as you are certainly aware, making Bessel functions symbolic would also fix this - e.g. for Bessel J.

kcrisman gravatar imagekcrisman ( 2012-10-01 02:18:52 -0500 )edit

Your Answer

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

Add Answer

Question Tools


Asked: 2012-09-30 04:07:31 -0500

Seen: 387 times

Last updated: Sep 30 '12