Re: M.U.C.

• To: mathgroup at smc.vnet.net
• Subject: [mg20623] Re: [mg20595] M.U.C.
• From: Daniel Lichtblau <danl at wolfram.com>
• Date: Thu, 4 Nov 1999 02:13:35 -0500
• References: <199911020735.CAA26960@smc.vnet.net.>
• Sender: owner-wri-mathgroup at wolfram.com

```Roscoe wrote:
>
> How can Mathematica solve the following Linear Operator for a and b?
> (E^(-2 x)((-3) + 10 b - x + 6 a(1 + 5 x)) == 0
>
> By hand it would be :
> (-3+10b+6a)=0
> (-1+30a)=0
>
> a=1/30
> b=whatever
>
> I need mathematica to group the coeeficients of x^0 and x^1, set them equal
> to 0 and solve.
> I am trying to avoid doing the gruoping by hand.  Thanks.

You can use SolveAlways for this task. For your particular example (you
have one parenthesis too many, I assume it is the left-most.):

In[9]:= SolveAlways[E^(-2 x)((-3) + 10 b - x + 6 a(1 + 5 x)) == 0, x]
1        7
Out[9]= {{a -> --, b -> --}}
30       25

Note that SolveAlways really works with polynomials, hence if your input
contains nontrivial nonpolynomial dependencies for the variable(s) in
question, you might need to extract an initial polynomial from a power
series. It is a good idea in this situation to take more terms than the
bare minimum needed, in case some inconsistency is lurking.

Here is an example where a series is needed.

In[13]:= SolveAlways[Exp[I*x]-a*Sin[x]-b*Cos[x] == 0, x]
SolveAlways::tdep:
The equations appear to involve the variables to be solved for in an
essentially non-algebraic way.
I x
Out[13]= SolveAlways[E    - b Cos[x] - a Sin[x] == 0, x]

To get a useful result we can instead work with a series expansion,
converted to polynomial form via Normal.

In[14]:= SolveAlways[Normal[Series[Exp[I*x]-a*Sin[x]-b*Cos[x],{x,0,10}]]
== 0, x]
Out[14]= {{a -> I, b -> 1}}

Daniel Lichtblau
Wolfram Research

```

• Prev by Date: hexagon tiled torus
• Next by Date: Re: dictionaries?
• Previous by thread: Re: M.U.C.
• Next by thread: Re: M.U.C.