| Author |
Comment/Response |
Dave
|
01/15/11 7:28pm
I'm attempting to integrate basis functions that I'm working with and am practicing with simple Sin[x]. Yet the answers do not agree. I suspect that I do not know what's needed to do it correctly.
If I plug Sin[x] into mfeval then the answers agree.
Thanks
mfeval[function_, a_, b_, n_] :=
Module[{x, m, xo = a, x1 = b, fnct = function},
Table[NIntegrate[(fnct) (x^m), {x, xo, x1}], {m, 1, n}]];
fx := Sin[x];
mfeval[fx, 0, 1, 5]
Table[NIntegrate[fx x^n, {x, 0, 1}], {n, 1, 5}]
{0.454649, 0.303099, 0.227324, 0.181859, 0.15155}
{0.301169, 0.223244, 0.177099, 0.14665, 0.125081}
URL: , |
|