Prev: how to solve for all integer solutions, linear programming
Next: Function construction and also symmetric matrices
From: davef on 2 May 2010 05:35 I want to evaluate a sum from a series I created using the Array function. For example; I specify Array[((-1)^(# + 1) (x)^#)/# ! &, 3, 1 ] which gives me the following 3 terms of output: {x, -(x^2/2), x^3/6} Can anyone tell if and how I can turn these 3 terms into a sum to be evaluated?
From: Bill Rowe on 3 May 2010 06:10 On 5/2/10 at 5:35 AM, davidfrick2003(a)yahoo.com (davef) wrote: >I want to evaluate a sum from a series I created using the Array >function. >For example; I specify >Array[((-1)^(# + 1) (x)^#)/# ! &, 3, 1 ] >which gives me the following 3 terms of output: >{x, -(x^2/2), x^3/6} >Can anyone tell if and how I can turn these 3 terms into a sum to be >evaluated? In[2]:= Plus @@ Array[((-1)^(# + 1) (x)^#)/#! &, 3, 1] Out[2]= x^3/6 - x^2/2 + x or In[3]:= Total(a)Array[((-1)^(# + 1) (x)^#)/#! &, 3, 1] Out[3]= x^3/6 - x^2/2 + x
From: Nasser M. Abbasi on 3 May 2010 06:10 "davef" <davidfrick2003(a)yahoo.com> wrote in message news:hrjh0l$bg8$1(a)smc.vnet.net... >I want to evaluate a sum from a series I created using the Array > function. > > For example; I specify > > Array[((-1)^(# + 1) (x)^#)/# ! &, 3, 1 ] > > which gives me the following 3 terms of output: > > {x, -(x^2/2), x^3/6} > > Can anyone tell if and how I can turn these 3 terms into a sum to be > evaluated? > may be use Total[]? v = Array[((-1)^(#1 + 1)*x^#1)/#1! & , 3, 1]; Total[v] /. x -> 3.14 3.370057333333333 --Nasser
From: M.Roellig on 3 May 2010 06:10
On 2 Mai, 11:35, davef <davidfrick2...(a)yahoo.com> wrote: > I want to evaluate a sum from a series I created using the Array > function. > > For example; I specify > > Array[((-1)^(# + 1) (x)^#)/# ! &, 3, 1 ] > > which gives me the following 3 terms of output: > > {x, -(x^2/2), x^3/6} > > Can anyone tell if and how I can turn these 3 terms into a sum to be > evaluated? maybe Total ? Total(a)Array[((-1)^(# + 1) (x)^#)/#! &, 3, 1] x - x^2/2 + x^3/6 Markus |