Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #1288 > unrolled thread
| Started by | Chelly <chelly85086@gmail.com> |
|---|---|
| First post | 2011-03-30 09:16 +0000 |
| Last post | 2011-03-31 08:58 +0000 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
Sum of powers of multiplied terms Chelly <chelly85086@gmail.com> - 2011-03-30 09:16 +0000
Re: Sum of powers of multiplied terms Peter Pein <petsie@dordos.net> - 2011-03-31 08:58 +0000
| From | Chelly <chelly85086@gmail.com> |
|---|---|
| Date | 2011-03-30 09:16 +0000 |
| Subject | Sum of powers of multiplied terms |
| Message-ID | <imuse8$i9k$1@smc.vnet.net> |
I am new to Mathematica and need some help on the following:
I have a variable which has a sum of many sine terms as shown below:
x = k1^2 k2^2 e^2 Sin(phi) + k3^2 e k4^2 Sin(theta) +....
I'd like to create a table where the first element is the index of the list and the second element is the sum of the powers of the amplitude terms. In this case, I'd like it to be
{1,6},{2,5}
where the sum of powers of the first amplitude term is 2+2+2=6, and similarly for the second term it is 2+1+2=5
Thanks
Chelly
[toc] | [next] | [standalone]
| From | Peter Pein <petsie@dordos.net> |
|---|---|
| Date | 2011-03-31 08:58 +0000 |
| Message-ID | <in1fn3$4bh$1@smc.vnet.net> |
| In reply to | #1288 |
Am 30.03.2011 11:16, schrieb Chelly:
> I am new to Mathematica and need some help on the following:
>
> I have a variable which has a sum of many sine terms as shown below:
>
> x = k1^2 k2^2 e^2 Sin(phi) + k3^2 e k4^2 Sin(theta) +....
>
> I'd like to create a table where the first element is the index of the list and the second element is the sum of the powers of the amplitude terms. In this case, I'd like it to be
>
> {1,6},{2,5}
>
> where the sum of powers of the first amplitude term is 2+2+2=6, and similarly for the second term it is 2+1+2=5
>
> Thanks
> Chelly
>
something like
Block[{k=0},
Cases[x, a_. Sin[_] :> {++k, Total[Exponent[a, Variables[a]]]}] ]
?
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web