Ask Your Question

Plotting Bessel function

asked 2012-09-30 11:07:31 +0200

R C gravatar image

updated 2024-04-14 16:06:44 +0200

FrédéricC 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 13:50:53 +0200

achrzesz gravatar image

updated 2012-09-30 15:09:40 +0200

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 16:51:32 +0200 )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 18:22:40 +0200 )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-10-01 06:18:49 +0200 )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 09:18:52 +0200 )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 11:07:31 +0200

Seen: 922 times

Last updated: Sep 30 '12