Fourier approximation with polynomial

In summary, the conversation discusses approximating the function f(x)=sin(\pi x) on the interval [0,1] using the polynomial ax^{2}+bx+c. The homework equations involve using Fourier series and integrals, but the student is struggling to understand how to use them and how to incorporate the interval [0,1]. The expert suggests looking at the function g(z) = f(z + 1/2) for z in [-1/2,1/2] and using the formulas for Fourier series with L=1/2. The student also clarifies that the assignment is to approximate with a polynomial using the method of least sum of squares.
  • #1
kottur
56
0

Homework Statement



Approximate the function [itex]f(x)=sin(\pi x)[/itex] on the interval [itex][0,1][/itex] with the polynomial [itex]ax^{2}+bx+c[/itex] with finding a, b and c.

Homework Equations



[itex]f(x)=a_{0}+\sum^{\infty}_{n=1}(a_{n}cos(nx)+b_{n}sin(nx))[/itex]

[itex]a_0=\frac{1}{2\pi}\int^{\pi}_{-\pi}f(x)dx[/itex]

[itex]a_n=\frac{1}{\pi}\int^{\pi}_{-\pi}f(x)cos(nx)dx , (n\geq1)[/itex]

[itex]b_n=\frac{1}{\pi}\int^{\pi}_{-\pi}f(x)sin(nx)dx , (n\geq1) [/itex]

The Attempt at a Solution



I understand that this is just a matter of filling in the equations but I just don't seem to get it right. I get:

[itex]a_{0}=0[/itex]

[itex]a_{n}=-cos(\pi\pi)cos(\pi n)-\frac{n}{\pi}sin(\pi\pi)sin(\pi n)[/itex]

[itex]b_{n}=-cos(\pi\pi)sin(\pi n)-\frac{n}{\pi}sin(\pi\pi)cos(\pi n)[/itex]

I think I need to simplify this and I don't know how to, plus then I'm not sure how to use it.
Thank you in advance.
 
Last edited:
Physics news on Phys.org
  • #2
If n is in the natural numbers, what is sin(n*pi) equal to?

Equally, what is cos(n*pi) equal to?

Although I'm not entirely sure why you want to use a Fourier series here.
 
Last edited:
  • #3
Okay so now I get:

[itex]a_{n}=\pm cos(\pi^{2})[/itex]
[itex]b_{n}=\pm \frac{n}{\pi}sin(\pi^{2})[/itex]

And this will give me:

[itex]f(x)=0+\sum^{\infty}_{n=1}(\pm cos(\pi^{2})cos(nx)+(\pm \frac{n}{\pi}sin(\pi^{2})sin(nx)))[/itex]

And when do I use the interval [itex][0,1][/itex] and how?

Thank you for the help!

Ps. The assignment was to Fourier approximate. I forgot to mention that in the original post.
 
  • #4
kottur said:

Homework Statement



Approximate the function [itex]f(x)=sin(\pi x)[/itex] on the interval [itex][0,1][/itex] with the polynomial [itex]ax^{2}+bx+c[/itex] with finding a, b and c.

Homework Equations



[itex]f(x)=a_{0}+\sum^{\infty}_{n=1}(a_{n}cos(nx)+b_{n}sin(nx))[/itex]

[itex]a_0=\frac{1}{2\pi}\int^{\pi}_{-\pi}f(x)dx[/itex]

[itex]a_n=\frac{1}{\pi}\int^{\pi}_{-\pi}f(x)cos(nx)dx , (n\geq1)[/itex]

[itex]b_n=\frac{1}{\pi}\int^{\pi}_{-\pi}f(x)sin(nx)dx , (n\geq1) [/itex]

The Attempt at a Solution



I understand that this is just a matter of filling in the equations but I just don't seem to get it right. I get:

[itex]a_{0}=0[/itex]

[itex]a_{n}=-cos(\pi\pi)cos(\pi n)-\frac{n}{\pi}sin(\pi\pi)sin(\pi n)[/itex]

[itex]b_{n}=-cos(\pi\pi)sin(\pi n)-\frac{n}{\pi}sin(\pi\pi)cos(\pi n)[/itex]

I think I need to simplify this and I don't know how to, plus then I'm not sure how to use it.
Thank you in advance.

Your formulas are incorrect. If you want a Fourier series on [0,1] all your integrals must go from x = 0 to x = 1 and the series will involve sin(2nπx), cos(2nπx), not sin(nx) and cos(nx). That said: why do you want to use Fourier series? But, a more fundamental question is: how do you measure the quality of an approximation? When can you say that one approximation is better than another? How can you define a "best" approximation?

RGV
 
  • #5
And, to add to that, you aren't asked to approximate your ##\sin(\pi x)## with sines and cosines. You want ##\sin(\pi x)\doteq ax^2+bx+c##.
 
  • #6
The assignment is to Fourier approximate.

I've got these formulas in my notes:

For a function with period T and T=2L we have:

[itex]f(x)=a_{0}+\sum^{\infty}_{n=1}(a_{n}cos(\frac{n\pi x}{L})+b_{n}sin(\frac{n\pi x}{L}))[/itex]

[itex]a_{0}=\frac{1}{2L}\int^{L}_{-L}f(x)dx[/itex]

[itex]a_{n}=\frac{1}{L}\int^{L}_{-L}f(x)cos(\frac{n\pi x}{L})dx , (n\geq1)[/itex]

[itex]b_{n}=\frac{1}{L}\int^{L}_{-L}f(x)sin(\frac{n\pi x}{L})dx , (n\geq1)[/itex]

So I just plugged in [itex]L=\pi[/itex] because [itex]T=2L=2\pi[/itex].

Is that incorrect? To be fair I don't understand how to use the interval [itex][1,0][/itex] so am I supposed to integrate with it? Then why do I have the formulas from above if they are incorrect?
Thank you!
 
  • #7
kottur said:
The assignment is to Fourier approximate.

I've got these formulas in my notes:

For a function with period T and T=2L we have:

[itex]f(x)=a_{0}+\sum^{\infty}_{n=1}(a_{n}cos(\frac{n\pi x}{L})+b_{n}sin(\frac{n\pi x}{L}))[/itex]

[itex]a_{0}=\frac{1}{2L}\int^{L}_{-L}f(x)dx[/itex]

[itex]a_{n}=\frac{1}{L}\int^{L}_{-L}f(x)cos(\frac{n\pi x}{L})dx , (n\geq1)[/itex]

[itex]b_{n}=\frac{1}{L}\int^{L}_{-L}f(x)sin(\frac{n\pi x}{L})dx , (n\geq1)[/itex]

So I just plugged in [itex]L=\pi[/itex] because [itex]T=2L=2\pi[/itex].

Is that incorrect? To be fair I don't understand how to use the interval [itex][1,0][/itex] so am I supposed to integrate with it? Then why do I have the formulas from above if they are incorrect?
Thank you!

Your general formulas are correct, but you are using them incorrectly in your example. If you have f(x) for x in the interval [0,1] you can look instead at g(z) = f(z + 1/2) for z in [-1/2,1/2]. Now take L = 1/2 in your Fourier formulas, applied to g(z). You will have a series containing sin(nπz/L) = sin(2nπx - πn) = +-sin(2πnx) and cos(nπz/L) = +-cos(2πnx).

Anyway: you still have not explained why, in your first posting, you said you want to approximate f(x) "with the polynomial ax^2+bx+c with finding a, b and c" (you did use the word "Fourier" but I really don't understand why). The expression ax^2+bx+c is not a Fourier series; it is a polynomial.

RGV
 
  • #8
Hmm okay, well I'm supposed to approximate f(x) with the polynomial with a method called least sum of squares or something like that. It's hard to translate it.

Okay I will try to do it with g(z) now. :smile:
 
  • #9
kottur said:
Hmm okay, well I'm supposed to approximate f(x) with the polynomial with a method called least sum of squares or something like that. It's hard to translate it.


Okay I will try to do it with g(z) now. :smile:

Why? Do you have a lot of extra time on your hands and just want to practice getting Fourier Coefficients even though it has nothing to do with your problem? Do you understand that you are working on a "solution" that has nothing to do with your stated problem?
 
  • #10
Okay I thought about what you said with g(z) but I just used f(x) and L=1/2. I hope that was okay.

So this is what I got:

[itex]a_{0}=0[/itex]

[itex]a_{n}=\frac{-cos(\pi-2\pi n)}{(\pi-2\pi n)}-\frac{cos(\pi+2\pi n}{(\pi+2\pi n)}=\frac{cos(2\pi n)}{(\pi-2\pi n)}+\frac{cos(2\pi n}{(\pi+2\pi n)}[/itex]

[itex]b_{n}=\frac{sin(2\pi n)}{(\pi-2\pi n)}+\frac{sin(2\pi n)}{(\pi+2\pi n)}[/itex]

Which gives me:

[itex]f(x)=\sum^{\infty}_{n=1}((\frac{1}{\pi(1-2n)}+\frac{1}{\pi(1+2n)})(cos(2\pi nx)(cos(2\pi n)+sin(2\pi nx)sin(2\pi n))=\sum^{\infty}_{n=1}(\frac{1}{\pi(1-2n)}+\frac{1}{\pi(1+2n)})(cos(2\pi nx-2\pi n))[/itex]

Does this make any sense?
 
  • #11
IF your problem was to express ##\sin(\pi x)## as a Fourier Series on [0,1] you would try to find ##a_n## and ##b_n## to get$$
\sin(\pi x) = a_{0}+\sum^{\infty}_{n=1}(a_{n}cos(n\pi x)+b_{n}sin(n\pi x))$$and if you worked it correctly you would get ##a_n=0## and ##b_n=0## except for ##b_1=1##, which would give an identity for ##\sin(\pi x)##. It is its own finite Fourier Series.

But that has nothing to do with your problem. You have never stated it fully, but I'm guessing you are supposed to minimize$$
\int_0^1(\sin(\pi x) - ax^2-bx-c)^2\, dx$$by choosing the appropriate values for ##a,b,c##.
 
  • #12
LCKurtz thank you for your help.

I used a totally different method after all this, finding a, b and c with linear algebra.
 

Related to Fourier approximation with polynomial

1. What is Fourier approximation with polynomial?

Fourier approximation with polynomial is a mathematical method used to approximate a given function using a combination of trigonometric polynomials. It is based on the Fourier series, which represents a periodic function as a sum of sine and cosine functions with different frequencies and amplitudes. The polynomial approximation uses a finite number of terms from the Fourier series to represent the function.

2. How does Fourier approximation with polynomial work?

The Fourier approximation with polynomial works by finding the coefficients of the trigonometric polynomials that best fit the given function. It starts by representing the function as a sum of sine and cosine functions using the Fourier series. Then, it calculates the coefficients using mathematical techniques such as least squares approximation or the discrete Fourier transform. The resulting polynomial is a close approximation of the original function.

3. What are the advantages of using Fourier approximation with polynomial?

One advantage of using Fourier approximation with polynomial is that it can approximate a wide range of functions, including non-periodic ones. It also provides a simple and efficient way to represent functions, making it useful for various applications in science and engineering. Additionally, the coefficients obtained from the approximation can provide insights into the behavior of the function, such as the dominant frequencies and amplitudes.

4. What are the limitations of Fourier approximation with polynomial?

One limitation of Fourier approximation with polynomial is that it only provides an approximation of the function, not the exact values. The accuracy of the approximation depends on the number of terms used from the Fourier series, so it may not be precise enough for certain applications. Additionally, the method may not work well for functions with sharp discontinuities or singularities.

5. How is Fourier approximation with polynomial used in practice?

Fourier approximation with polynomial has various applications in science and engineering, such as signal processing, image compression, and data analysis. It is also used in physics to solve differential equations and study the behavior of physical systems. In practice, the method is often implemented using computers and software packages, making it more efficient and accurate compared to manual calculations.

Similar threads

  • Calculus and Beyond Homework Help
Replies
1
Views
321
  • Calculus and Beyond Homework Help
Replies
1
Views
412
  • Calculus and Beyond Homework Help
Replies
1
Views
308
  • Calculus and Beyond Homework Help
Replies
11
Views
474
  • Calculus and Beyond Homework Help
Replies
16
Views
647
  • Calculus and Beyond Homework Help
Replies
3
Views
403
  • Calculus and Beyond Homework Help
Replies
1
Views
597
  • Calculus and Beyond Homework Help
Replies
3
Views
510
  • Calculus and Beyond Homework Help
Replies
2
Views
986
  • Calculus and Beyond Homework Help
Replies
4
Views
349
Back
Top