I am sorry if I sound stupid or vague, but I have a question regarding a code about Bessel functions. I was tasked with the homework of representing a simple function, (f(x)=1-x to be exact) using the first five 0th order Bessel functions whos zeros are scaled to one. Plus I have to find their coefficients.
First off, I know I have to show that I've worked on this problem before asking for help, but I really don't know where to begin. I know about first-order Bessel functions and I know about second-order Bessel functions, but I have no idea what a 0th order Bessel function is. Plus, I didn't even know you could represent functions with Bessel functions. I know that you can use Taylor's expansion or Fourier representation to approximate a function, but I have no idea how to do that with the Bessel function. I searched this website and it seems a classmate of mine, rather rudely, just copy and pasted our assignment and thus that thread was closed.
So if some saintly person could at least point me in the right direction here, that would be wonderful. Seeing as this is a simple function and I know that Matlab has a Bessel function thing so coding it wouldn't be too hard. I just don't know how to use a method of solving a differential equation to represent another function. Oh, and the coefficients? What coefficients? Forgive my ignorance and help please!
Alright! Through much investigation and work, I have determined the answer to this problem. Now, this is actually the first time that I'm answering a question on this site, so once more, please forgive any faux pax that I might commit.
First off, it appears that I was right about the Bessel-Fourier series. It is impossible to use just the Bessel series to get a function approximation. Through a lengthy process starting with the Bessel function and scaling the x and doing a whole host of tricks that include a Fourier transform, we get can determine that the Bessel-Fourier representation of a function is given in the form of
f(x) = A1*J_0(z1x) + A2*J_0(z2x) + ....
where z1 are the zeros of a First-Order Bessel Function, J_0 is the 0th First-Order Bessel Function and A1 are the coefficients of the Fourier-Bessel series. The zeros are easily acquired by just plotting the Bessel Function, but the coefficients are the tricky parts. They are given by the equation
An = (2/(J_1(zn)^2))*integral(x*f(x)*J_0(zn*x), 0, 1)
Needless to say, the difficult part of this is getting the integral of the Bessel functions. But by using this lovely list, the process can be made simple. Messy....but simple. I should also note that the the integral is from 0 to 1 because that was the nature of my assignment. If the question was to scale it from 0 to 2, then the equation would be
An = (2/(2^2)*(J_1(zn)^2))*integral(x*f(x)*J_0(zn*x), 0, 2)
But I digress. So, since my assignment also had me graph the first five values individually, and then add them together and compare the results with the actual function, that's what I did. And thus here is the code.
And there we go. The struve function code was from this place
I hope this helped, and if I made any egregious errors, please tell me, but to be honest, I can't explain the equations up there any further as I just got them from a textbook.
Best wishes!