Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #10146 > unrolled thread
| Started by | J Jesus Rico-Melgoza <ricomelgozajjesus@gmail.com> |
|---|---|
| First post | 2012-05-19 09:43 +0000 |
| Last post | 2012-05-19 09:43 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Coefficient J Jesus Rico-Melgoza <ricomelgozajjesus@gmail.com> - 2012-05-19 09:43 +0000
| From | J Jesus Rico-Melgoza <ricomelgozajjesus@gmail.com> |
|---|---|
| Date | 2012-05-19 09:43 +0000 |
| Subject | Re: Coefficient |
| Message-ID | <jp7pv4$qcc$1@smc.vnet.net> |
Thanks for you answers
Alexei, your last suggestion works fine for want I want to do. Though, I am
still trying to understand the syntaxis of the function CoeffCos!
Jesus
-------------------------------------
If you need that the coefficient contains no functional dependence at all,
the above function should be slightly modified:
coeffCos[expr_] :=
Plus @@ Select[List @@ Coefficient[expr, Cos[t]], FreeQ[#, x_[t]] &];
Then let us check it with a more complicated expression:
series = a + b Cos[t] + c x[t] Cos[t] + d*y*Cos[t] + x[t]^2*Cos[t] +
z[t]*Cos[t] + A[t]*x[t]*Cos[t];
coeffCos[series]
b + d y
---------------------------------
2012/5/18 Alexei Boulbitch <Alexei.Boulbitch@iee.lu>
> Dear members,
>
> I am using the function Coefficient[expr, form] in series such as
>
> x(t)=a+b Cos[t]+c x[t]Cos[t]
>
> I wonder if it is possible to force mathematica to find only the
> coefficient b when using
>
> series = a + b Cos[t] + c x[t] Cos[t]
>
> Coefficient[series, Cos[t]]
>
>
> Sol
>
> b + c x[t]
>
>
> Regards
>
>
> Jesus Rico-Melgoza
>
>
> Hi, Jesus,
>
> It is not quite clear, what in general do you want to avoid. Is it that
> your final expression for the coefficient should not contain x[t]? If yes,
> I see a simple walk around.
> Assume we have the the series expression slightly more general, than in
> your case:
>
> series = a + b Cos[t] + c x[t] Cos[t] + d*y*Cos[t] + x[t]^2*Cos[t];
>
> The idea is that after the complete coefficient in front of Cos[t] is
> obtained:
>
> expr1 = Coefficient[series, Cos[t]]
>
> b + d y + c x[t] + x[t]^2
>
> one may transform it into list:
>
> expr2 = List @@ expr1
>
> {b, d y, c x[t], x[t]^2}
>
> And further select only terms free of x[t]:
>
> expr3 = Select[expr2, FreeQ[#, x[t]] &]
>
> {b, d y}
>
> Now one may transform it back into the sum:
>
> Plus @@ expr3
>
> b + d y
>
> Now all this may be collected into a function:
>
> coeffCos[expr_] :=
> Plus @@ Select[List @@ Coefficient[expr, Cos[t]], FreeQ[#, x[t]] &];
>
> and check:
>
> coeffCos[series]
>
> b + d y
>
> If you need that the coefficient contains no functional dependence at all,
> the above function should be slightly modified:
>
> coeffCos[expr_] :=
> Plus @@ Select[List @@ Coefficient[expr, Cos[t]], FreeQ[#, x_[t]] &];
>
> Then let us check it with a more complicated expression:
>
> series = a + b Cos[t] + c x[t] Cos[t] + d*y*Cos[t] + x[t]^2*Cos[t] +
> z[t]*Cos[t] + A[t]*x[t]*Cos[t];
>
> coeffCos[series]
>
> b + d y
>
> Have fun, Alexei
>
> Alexei BOULBITCH, Dr., habil.
> IEE S.A.
> ZAE Weiergewan,
> 11, rue Edmond Reuter,
> L-5326 Contern, LUXEMBOURG
>
> Office phone : +352-2454-2566
> Office fax: +352-2454-3566
> mobile phone: +49 151 52 40 66 44
>
> e-mail: alexei.boulbitch@iee.lu
>
>
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web