# How to express Polynomial in a certain format with Mathematica?

Equations

A = {{-0.03333, 0, 0}, {0.0667, -0.6799, 0.6667}, {0,     0.3399, -0.3467}};
B = {0.0333, 0, 0};
CC = {1, 1, 1};
myInverse = Inverse[s*IdentityMatrix[3] - A];
P = CC*myInverse*B;
P = P[[1,1]];


Goal

Express the polynomial $P$ in the format $\frac{1}{1+\text{something}}$.

Trials

1. Trial: tried to play with denominator and numerator, FAIL, here.

2. Trial: tried Solve command but errs, the code here fires the error with a transfer function $G(s)$ and the picture here. I try to express the line 146 i.e. the equation $G(s)$ in the form $\frac{1}{1+C}$. How can I simplify this? Why do I get the error? How can I get the equation for the $G(s)$ in the requested form? Err report "Solve::ivar: ... is not a valid variable".

3. Trial: fixing the preserved-variable problem revealed by Artes's answer, I get very peculiar answer -- I get empty set!? Why? I should get some non-empty equation. Notice the line 336 in the picture here.

-
It helps to rewrite your question in the form: I have these equations, and I'd like to solve them for these unknowns. Instead of asking someone to look at code and try to figure what is it you are actually trying to solve. i.e. start with: This is the input and I'd like to obtain such output. Then someone will show you how to go from the input to the output (it is also better to post the code here instead of asking someone to look at outside link, which can go away in the future) – Nasser Dec 5 '12 at 14:49
@NasserM.Abbasi thank you for the notice, done. – hhh Dec 5 '12 at 15:19

You can't use Solve[ mySeries == 1/(1 + A), A] because A had been defined in your code. Moreover you can't use capital C because

it is the default form for the i-th parameter or constant generated in representing
the results of various symbolic computations.


mySeries has been defined with mySeries = Series[ P[[1, 1]], {s, 0, 1}]; thus it has the value in terms of SeriesData :

Head @ mySeries

SeriesData


therefore you should use Normal. Because of inexact coefficients Solve produces this message :

Solve::ratnz: Solve was unable to solve the system with inexact coefficients.
The answer was obtained by solving a corresponding exact system and numericizing
the result. >>


If you want to suppress the message use Quiet. Then you'll get the result :

Solve[ Normal[mySeries] == 1/(1 + x), x] // Quiet

{{x -> (0.333333 (-3.19716*10^7 - 1.06476*10^12 s))/(-1.18295*10^10 + 3.5492*10^11 s)}}


A bit more involved algebraic expression was P and you wanted to find P[[1,1]] in the form 1/(1 + x). You can use the MaxExtraConditions option in Solve to get all conditions for a general solution.

Solve[ 1/(1 + x) == P[[1, 1]], x, MaxExtraConditions -> All] // Quiet


or if you know that conditions are satisfied you may simply write

1/(1 + x) /. Solve[ 1/(1 + x) == P[[1, 1]], x] // Quiet


to get the result in the expected form.

-
@hhh You wanted mySeries == 1/(1+x) so write simply 1/(1 + x) /. Solve[ Normal[mySeries] == 1/(1 + x), x] // Quiet – Artes Dec 5 '12 at 15:27
@hhh You are welcome. I recommend to edit your question once more and put your equations in a good order. Next you neednt use P = P[[1]][[1]] because you set another value to P which was originally a matrix , moreover you can simply use P[[1,1]] instead of P[[1]][[1]]. – Artes Dec 5 '12 at 15:59

If you are only after "something" you could simply employ

something = Denominator[P]/Numerator[P] - 1 // Together


Note that system commands generally start with a capital letter. You can also apply this to Normal[ mySeries] (instead of P) if you wish/require. For target expressions more general than 1/(1+something)` Artes answer can always be generalized.

-