       Re: Re: Using Coefficient on an equation

• To: mathgroup at smc.vnet.net
• Subject: [mg95548] Re: [mg95515] Re: Using Coefficient on an equation
• From: DrMajorBob <btreat1 at austin.rr.com>
• Date: Wed, 21 Jan 2009 06:46:46 -0500 (EST)
• References: <200901181033.FAA13999@smc.vnet.net> <gl1bjo\$93s\$1@smc.vnet.net>

```In my Init file, I have the following code:

Unprotect[Equal];
listableQ[f_]:=MemberQ[Attributes[f],Listable]
Equal /: lhs : (f_Symbol)?listableQ[___, _Equal, ___] :=

It causes Listable functions (like Coefficient) to thread over Equal.

(I think that's useful.)

Bobby

On Tue, 20 Jan 2009 04:49:30 -0600, dh <dh at metrohm.com> wrote:

>
>
> 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?
>
>>>
>
>>
>
>>
>
>>
>
>
>

--
DrMajorBob at longhorns.com

```

• Prev by Date: Re: Map onto one column of a matrix
• Next by Date: Re: Extract Integrate values
• Previous by thread: Re: Using Coefficient on an equation
• Next by thread: Re: Using Coefficient on an equation