using MTH229
using Plots
f(x)=xcos((xn*π)/π)
a=-π
b=π
T=π
f(x) = x
integrate(f(x), x,a,b)
a_0=(1/T)*integrate(f(x), x,a,b)
using MTH229
using Plots
f(x)=xcos((xn*π)/π)
a=-π
b=π
T=π
f(x) = x
integrate(f(x), x,a,b)
a_0=(1/T)*integrate(f(x), x,a,b)
Welcome to the Julia discourse!
Please read Please read: make it easier to help you, the current title and formatting make it a bit difficult to tell what it is you want to know.
Complicated
It seems that you follow a course from the College of Staten Island (as suggested by ‘using MTH229’). Consequently, be aware that we are not here to help you in doing your homeworks (I don’t want to be harsh in saying that).
If your are a beginner in Julia and in programming languages in general, the Julia documentation is a good starting point. Googling is also a good way to obtain answers to basic questions. I generally use discourse in the last resort.
In conclusion, only use discourse when it is necessary.
Regarding your problem, it seems that you want to compute the coefficients of a Fourier series.
You can look at this thread Fourier series in Julia. That being said, I doubt that it is what you are looking for.
Thanks for helping. I’m not sure this is a question from our course, so I’ll answer it. The MTH229
bit is a red herring, that package just reexports SymPy
. The issue is, to get the syntax correct the poster needs:
f
@syms x n
will dointegrate
properly: They need (x,a,b)
to specify the variable of integration and limits of integration.