[SciPy-User] y limit and Bessel function plot to file
Jarvis Wyatt
jarvis.wyatt at gmx.com
Thu Oct 25 12:35:45 EDT 2018
Hello!
I am new to SciPy, and with only a basic knowledge about Python. Using
Python 3, I am considering the code in this page
http://ctan.math.washington.edu/tex-archive/macros/latex/contrib/hybrid-latex/examples/example-04.pdf
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:
#!/usr/bin/python3
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),
sp.yn(3,x),sp.yn(4,x),sp.yn(5,x))),
fmt="% .10e")
I have used the special function yn instead of jv.
This is the `example-04.txt' output file:
https://pastebin.com/xfCMQ4cH
(first line is `0.0000000000e+00 -inf -inf -inf -inf -inf -inf'!)
And this is the image generated using example-04.txt in LaTeX:
https://imagebin.ca/v/4KKebbscyqSr
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!
Jarvis
More information about the SciPy-User
mailing list