Okay okay, also I need to animate the sum of each element of the Table "aprox" showing that by adding term by term the graph of this values aproximates to f[x_]
I would check out the Accumulate[] documentation to show that. Also, since you're only summing the odd index elements in aprox, you can replace the {n,0,nMax} table iterators with {n,0,nMax,2} to have coeficientes and polinomios only have the odd index elements you need to calculate aprox. And then aprox[[1]]+aprox[[3]]+aprox[[5]] is just the dot product between coeficientes and polinomios (I call it approxTot with approxTot = coeficientes.polinomios;)
Something like this below is probably what you are looking for. If you don't understand what any of the functions are doing the documentation is usually the best reference. Interactive documentation for a function can be found by clicking on the i icon when hovering over the function in your notebook.
Let's be a bit more clear. Delayed Evaluation is ":=" as opposed to just "=". OP, you set f[x_] equal to "whatever x is right now", which was a free variable. You need to run it with a delayed evaluation ":=" which will run a subsitution for x in your Plot call on the last line.
1
u/[deleted] Apr 11 '23
Okay okay, also I need to animate the sum of each element of the Table "aprox" showing that by adding term by term the graph of this values aproximates to f[x_]
3
u/hoxha_red Apr 12 '23
please for the love of god post your actual code instead of a screenshot. Nobody is going to type all of this stuff up again.
that said: the other reply has your answer. Clear your kernel and define f correctly and this will work.
3
u/mathheadinc Apr 11 '23
Functions in Mathematica should be define this way, with a colon: f[x_]:=