[SciPy-User] y limit and Bessel function plot to file

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[SciPy-User] y limit and Bessel function plot to file

Jarvis Wyatt
I am new to SciPy, and with only a basic knowledge about Python. Using
Python 3, I am considering the code in this page


It has been written for the Bessel function of the first kind. I am trying
to adapt it for the Bessel function of the second kind. Being interested
only in generating an output file, the useful lines in my case are just:


import numpy as np
import scipy.special as sp

x = np.linspace(0, 15, 500)

np.savetxt('example-04.txt',list(   zip(x,sp.yn(0,x),sp.yn(1,x),sp.yn(2,x),
                                    fmt="% .10e")

I have used the special function yn instead of jv.

This is the `example-04.txt' output file:

(first line is `0.0000000000e+00 -inf -inf -inf -inf -inf -inf'!)

And this is the image generated using example-04.txt in LaTeX:

How to limit the output y range? I am interested in particular in y values
between -2 and 1. With mathplotlib, it would be for example
`plt.ylim((-2, 1))'. But what about scipy?
Thank you anyway!

SciPy-User mailing list
[hidden email]