Re:
- To: mathgroup at smc.vnet.net
- Subject: [mg8923] Re: [mg8882]
- From: Hugh Walker <hwalker at hypercon.com>
- Date: Sat, 4 Oct 1997 22:08:02 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Scott Morrison <scott at morrison.fl.net.au> asks <I'm trying to do something along the lines of NIntegrate[c[1] f[1][x] + c[2] f[2][x] + ..., {x, 0, a}], where c[n_] is unknown, but the f[n_] are defined so that NIntegrate[f[n][x], {x, 0, a}] would work. I'd like to be able to do the numerical integration, and keep the coefficients, so I'd get as an answer c[1] NIntegrate[f[1][x], {x, 0, a}] + c[2] NIntegrate[f[2][x], {x, 0, a}] + ... with all the NIntegrate's evaluated.> Suitable modification of this example might be what you are looking for. Consider the list of functions fList = Table[x^(k-1) Exp[-x],{k,1,4}]. Construct the array of constants cList = Array[c, 4], evaluating to {c[1],c[2],c[3],c[4]}. Then the scalar product cList . NIntegrate[fList//Evaluate,{x,0,Infinity}] gives the linear combination you seek. Hugh Walker Gnarly Oaks Phone: (713) 729-3093