       Re: Handling expressions. Could any one find a more direct way?

• To: mathgroup at smc.vnet.net
• Subject: [mg39928] Re: [mg39911] Handling expressions. Could any one find a more direct way?
• From: Daniel Lichtblau <danl at wolfram.com>
• Date: Wed, 12 Mar 2003 02:28:30 -0500 (EST)
• References: <200303110738.CAA08690@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Guillermo Sanchez wrote:
>
> (*A need to obtain   {k10, k21, k12, k13, k31}  knowing that A = b
> where*)
>
> A = 0.1/(0.1 + s) + 0.2/(1 + s) + 0.7/(5 + s);
>
> b = (k21*k31 + k21*s + k31*s + s^2)/(k10*k21*k31 + k10*k21*s +
> k13*k21*s +
>      k10*k31*s + k12*k31*s + k21*k31*s + k10*s^2 + k12*s^2 + k13*s^2 +
>      k21*s^2 + k31*s^2 + s^3);
>
> (*Here is my procedure*)
>
> A1 = Together[ExpandAll[Factor[A]]]
>
> n1 = Numerator[A1]
>
> d1 = Denominator[A1]
>
> n2 = Collect[Numerator[b], s]
>
> d2 = Collect[Denominator[b], s]
>
> (*Now, handing the solution for previous output -they are been
> eliminated in this mail- I can obtain  {k10, k21, k12, k13, k31}*)
>
> Solve[{k21*k31== 0.67, 2.39 == k21 + k31, k10*k21*k31 == 0.5,
>    k10*k21 + k13*k21 + k10*k31 + k12*k31 + k21*k31 == 5.6,
>    k10 + k12 + k13 + k21 + k31 == 6.1}, {k10, k21, k12, k13, k31}]
>
>   (* Could any one find a more direct way?*)
>
>   Guillermo Sanchez

SolveAlways can be used to advantage here.

aa = 0.1/(0.1 + s) + 0.2/(1 + s) + 0.7/(5 + s);
bb = (k21*k31 + k21*s + k31*s + s^2)/(k10*k21*k31 + k10*k21*s +
k13*k21*s + k10*k31*s + k12*k31*s + k21*k31*s + k10*s^2 +
k12*s^2 + k13*s^2 + k21*s^2 + k31*s^2 + s^3);

In:= InputForm[SolveAlways[aa==bb, s]]
Out//InputForm=
{{k10 -> 0.746268656716418, k12 -> 1.2548842674339165,
k13 -> 1.7088470758496648, k21 -> 0.32435368834411277,
k31 -> 2.065646311655888}, {k10 -> 0.746268656716418,
k12 -> 1.7088470758496648, k13 -> 1.2548842674339165,
k21 -> 2.065646311655888, k31 -> 0.32435368834411277}}

Note that with inexact arithmetic you rely on the vagaries of
approximate polynomial manipulation. Hence this would probably be more