MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Using Coefficient on an equation



Hi,

the first example is wrong. "Coefficient" only works on polynomial or 

list of polynomials. It does not work on expressions with head "Equal".

Daniel



DrMajorBob wrote:

> f = a*x^2 + b*x + c == 0;

> First@Coefficient[f, x^2]

> 

> a

> 

> or

> 

> Coefficient[First@f, x^2]

> 

> a

> 

> Bobby

> 

> On Sun, 18 Jan 2009 04:33:11 -0600, <carlos at colorado.edu> wrote:

> 

>> If f=a*x^2+b*x+c, Coefficient[f,x^2] obviously returns a.

>> But if f=a*x^2+b*x+c==0, it returns 0.

>>

>> The problem arose using the Calculus`VariationalMethods` package.

>> It (unfortunately) returns the Euler-Lagrange equations as

>> such, so I have to remove the useless ==0 appendage for

>> Coefficient to work properly. Is there a simple direct way out?

>>

> 

> 

> 




  • Prev by Date: Re: Mathematica Calls Home
  • Next by Date: Re: Debugging Mathematica Code (Mathematica 7)
  • Previous by thread: Re: Using Coefficient on an equation
  • Next by thread: Re: Re: Using Coefficient on an equation