Re: Assigning a list to coefficients
- To: mathgroup at smc.vnet.net
- Subject: [mg13925] Re: [mg13883] Assigning a list to coefficients
- From: Hugh Walker <hwalker at gvtc.com>
- Date: Mon, 7 Sep 1998 01:22:50 -0400
- Sender: owner-wri-mathgroup at wolfram.com
"Toshiyuki Meshii" <tm60 at cornell.edu> writes
--------Begin message------
How can I assign a list to a coefficient with an index? That is, I have
a list A which has data A={a1, a2, a3, ....., an} all the components of
A is numerical value. And I want to assign the coefficients ci used in
f[x_]=Sum[ ci * x ,{i=1,n}] at the later stage to the list A. How can
I do it?
I want to do some work such as differentiating f[x] symbolically, so I
do not want to use A[[i]] in the Sum.
-------End Message-------
Toshiyuki,
Here is an example of how to do what you want.
coefList = Table[Random[],{k,0,10}]
xList = Table[x^k,{k,0,10}]
f = Apply[Plus,coefList xList]
der1 = D[f,x]
der2 = D[f,{x,2}]
I arbitrarily have chosen the coefficients as a list of random numbers.
I hope this example helps. Best wishes!
Hugh Walker
University of Houston
Retired
Gnarly Oaks