RE: Is it possible to impose a condition on an iterator
- To: mathgroup at smc.vnet.net
- Subject: [mg101552] RE: [mg101499] Is it possible to impose a condition on an iterator
- From: Tomas Garza <tgarza10 at msn.com>
- Date: Fri, 10 Jul 2009 06:42:55 -0400 (EDT)
- References: <200907090552.BAA16854@smc.vnet.net>
Quite possible. The straightforward approach would be to take
b = Table[{a=2Ca^2-3 a/(4 a^2)}=2C{a=2C1=2C20}]
and then
Plus@@ (#[[2]]&/@Select[b=2C[Not[6<#[[1]]<12]&])//N
(btw=2C if you wish to sum the elements of a table I suggest you use Plus t=
ogether with Apply - it is much nicer to take advantage of the beauties of =
functional programming) . The above expression has //N at the end in order =
to convert the resulting fraction to a more readable form.
Alternatively=2C
c = Table[a^2-3 a/(4 a^2)=2C{a=2C1=2C20}]
d = Flatten[Position[Range[20]=2C x_/=3Bx<=6||x>=12]]
Plus@@c[[d]]//N
The result in both cases is
2452.73
Tomas
>
> I would like to perform a summation of this type=2C
>
> Sum[a^2 - 3 a/(4 a^2)=2C {a=2C 1=2C 20}]
>
> excluding however some values of the iteratore=2C I would for instance
> like to exclude the values than to greater of 6 and inferior to 12. Is
> it possible?
>
> Thanks
>
- References:
- Is it possible to impose a condition on an iterator of the summation ?
- From: Mauro <mauro@NONOyahoo.com>
- Is it possible to impose a condition on an iterator of the summation ?