Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Integration: Functions not passing into function' topicStudent Support Forum > General > Archives > "Integration: Functions not passing into function"

Next Comment >Help | Reply To Topic
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: ,

Subject (listing for 'Integration: Functions not passing into function')
Author Date Posted
Integration: Functions not passing into function Dave 01/15/11 7:28pm
Re: Integration: Functions not passing into fun... jason biggs 01/28/11 6:41pm
Re: Re: Integration: Functions not passing into... Dave 01/30/11 3:34pm
Next Comment >Help | Reply To Topic