Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Need to split function into terms and then plot
Replies: 2   Last Post: Oct 30, 2013 12:10 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
W. Craig Carter

Posts: 266
Registered: 9/10/05
Re: Need to split function into terms and then plot
Posted: Oct 29, 2013 1:46 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hello Honza,
Here are five methods.

originalList = {u1 (1 + 2 x^2/le^2 - 3 x/le) + u3 (2 x^2/le^2 - x/le) +
u2 (-4 x^2/le^2 + 4 x/le)}

Map[Coefficient[originalList[[1]], #] &, {u1, u2, u3}]

Table[Coefficient[originalList[[1]], val], {val, {u1, u2, u3}}]

Through[{Coefficient[#, u1] &, Coefficient[#, u2] &,
Coefficient[#, u1] &}[originalList[[1]]]]

extractCoeffs[list_, factorsList_] :=
Map[Coefficient[list, #] &, factorsList]

extractCoeffs[originalList, {u1, u2, u3}]

extractCoeffs[originalList[[1]], {u1, u2, u3}]

Kind Regards, WCC




On Oct 28, 13, at 20:22 PM, Honza Vorel wrote:

> #I'll get {u1(1+2x^2/le^2-3x/le)+u3(2x^2/le^2-x/le)+u2(-4x^2/le^2+4x/le)}
>
> #Now I need to separate the above like this (le=1.5):
>
> # n1=(1+2x^2/le^2-3x/le)
> # n2=(-4x^2/le^2+4x/le)
> # n3=(2x^2/le^2-x/le)
>
> # And I don't know how.






Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.