Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Haw to find symbolick roots

Subject: Haw to find symbolick roots

From: Kiril

Date: 23 Mar, 2009 10:49:01

Message: 1 of 10

I have to find root of big equating. It's not a problem, but when i use sym arithmetic my comp block out. This is the program:

syms b B a C miu D alfa k f
a1=2*b/(1-b);
a2=(b/(b-1))^2+ ( (2*B*(b-a)-C*miu^2*(b-1)^2)/(D*alfa^k*(b-a)^2));
a3=(2*C*miu^2*b)/(D*alfa^k*(b-1));
a4=-(C*miu^2*b)/(D*alfa^k*(b-a));
P=0*f^8 + 0*f^7 + a1*f^6 + 0*f^5 + a2*f^4 + 0*f^3 + a3*f^2+ 0*f^1 + a4;
pretty(p);
% k=solve(P, 'f'); my comp. block here

Then I calculate P=0 with real value I find 8 roots: 6 of them complex, one real negative and one real positive root. The problem is that i need symbolic answer....... Can someone help me... Thank in advance !

Subject: Haw to find symbolick roots

From: John D'Errico

Date: 23 Mar, 2009 11:14:01

Message: 2 of 10

"Kiril " <kkirqkov@gmail.com> wrote in message <gq7pes$jm3$1@fred.mathworks.com>...
> I have to find root of big equating. It's not a problem, but when i use sym arithmetic my comp block out. This is the program:
>
> syms b B a C miu D alfa k f
> a1=2*b/(1-b);
> a2=(b/(b-1))^2+ ( (2*B*(b-a)-C*miu^2*(b-1)^2)/(D*alfa^k*(b-a)^2));
> a3=(2*C*miu^2*b)/(D*alfa^k*(b-1));
> a4=-(C*miu^2*b)/(D*alfa^k*(b-a));
> P=0*f^8 + 0*f^7 + a1*f^6 + 0*f^5 + a2*f^4 + 0*f^3 + a3*f^2+ 0*f^1 + a4;
> pretty(p);
> % k=solve(P, 'f'); my comp. block here
>
> Then I calculate P=0 with real value I find 8 roots: 6 of them complex, one real negative and one real positive root.

How do you find 8 roots, when the coefficients of
f^7 and f^8 are identically zero? This would be
quite a trick.


> The problem is that i need symbolic answer....... Can someone help me... Thank in advance !

It cannot be solved, for a general 8th order polynomial.
Luckily, you don't have one. See that the odd powers
of f all have zero coefficients, as well, even the highest
even power has a zero coefficient.

Substitute x = f^2 into your polynomial. Then it
becomes a simple cubic polynomial, easily solvable.

John

Subject: Haw to find symbolick roots

From: Kiril

Date: 23 Mar, 2009 12:02:02

Message: 3 of 10

> Substitute x = f^2 into your polynomial. Then it
> becomes a simple cubic polynomial, easily solvable.
Thanks for help ... may be u understand that I'm new here ( i asking stupid questions) but i want to as u only one thing : If I sub: x=f^2 so that
 P= x^4 +a1*x^3 + a2*x^2 + a3*x + a4;
 Is this equal to
P=0*f^8 + 0*f^7 + a1*f^6 + 0*f^5 + a2*f^4 + 0*f^3 + a3*f^2+ 0*f^1 + a4;
And if it is, is there are way to plot my roots ?

Subject: Haw to find symbolick roots

From: Roger Stafford

Date: 23 Mar, 2009 18:20:18

Message: 4 of 10

"Kiril " <kkirqkov@gmail.com> wrote in message <gq7tnq$3lo$1@fred.mathworks.com>...
> Thanks for help ... may be u understand that I'm new here ( i asking stupid questions) but i want to as u only one thing : If I sub: x=f^2 so that
> P= x^4 +a1*x^3 + a2*x^2 + a3*x + a4;
> Is this equal to
> P=0*f^8 + 0*f^7 + a1*f^6 + 0*f^5 + a2*f^4 + 0*f^3 + a3*f^2+ 0*f^1 + a4;
> And if it is, is there are way to plot my roots ?

  Kiril, you appear to have a typing error in

"P=0*f^8+0*f^7+a1*f^6+0*f^5+a2*f^4+0*f^3+a3*f^2+0*f^1+a4"

Based on your later remarks, it should be:

 P=1*f^8+0*f^7+a1*f^6+0*f^5+a2*f^4+0*f^3+a3*f^2+0*f^1+a4

with a '1' coefficient in the 'f^8' term.

  If so, you have an eighth degree polynomial equation for which in the general case there would be no symbolic solution. However, as John has pointed out, in your particular case it can be reduced to finding the roots of a quartic (fourth degree) polynomial equation using the substitution x = f^2. Quartics do have symbolic solutions. My own version of the Symbolic Toolbox is not smart enough to give it. Perhaps yours is. If not, many elementary algebra text books will have it.

  When you convert back to roots of f there will be eight roots, because each root for x has two possible square roots for f, and therefore these can also be expressed symbolically.

  As to your question about plotting the roots, what is it you are varying to produce a plot?

  Also note that to do a plot, it is not necessary to have symbolic expressions for your roots. They can be obtained numerically using the matlab 'roots' function. Requiring explicit symbolic formulas for complicated functional relationships is sometimes a difficult or impossible task.

  And finally, some of your eight roots may be complex-valued. Plotting these would be rather awkward to do.

Roger Stafford

Subject: Haw to find symbolick roots

From: Kiril

Date: 23 Mar, 2009 21:57:01

Message: 5 of 10


> Then I calculate P=0 with real value I find 8 roots: 6 of them complex, one real negative and one real positive root. The problem is that i need symbolic answer....... Can someone help me... Thank in advance !

Yes I understand my mistake.... and understand that is impossible to solve this poly with sym math. I will use only the number answer, and about plot I used
plot(real(P), imag(P)) ;
and everything is fine. Thank for attention !

Subject: Haw to find symbolick roots

From: kamuran turksoy

Date: 22 Sep, 2011 20:25:28

Message: 6 of 10

"John D'Errico" <woodchips@rochester.rr.com> wrote in message <gq7qtp$qlp$1@fred.mathworks.com>...
> "Kiril " <kkirqkov@gmail.com> wrote in message <gq7pes$jm3$1@fred.mathworks.com>...
> > I have to find root of big equating. It's not a problem, but when i use sym arithmetic my comp block out. This is the program:
> >
> > syms b B a C miu D alfa k f
> > a1=2*b/(1-b);
> > a2=(b/(b-1))^2+ ( (2*B*(b-a)-C*miu^2*(b-1)^2)/(D*alfa^k*(b-a)^2));
> > a3=(2*C*miu^2*b)/(D*alfa^k*(b-1));
> > a4=-(C*miu^2*b)/(D*alfa^k*(b-a));
> > P=0*f^8 + 0*f^7 + a1*f^6 + 0*f^5 + a2*f^4 + 0*f^3 + a3*f^2+ 0*f^1 + a4;
> > pretty(p);
> > % k=solve(P, 'f'); my comp. block here
> >
> > Then I calculate P=0 with real value I find 8 roots: 6 of them complex, one real negative and one real positive root.
>
> How do you find 8 roots, when the coefficients of
> f^7 and f^8 are identically zero? This would be
> quite a trick.
>
>
> > The problem is that i need symbolic answer....... Can someone help me... Thank in advance !
>
> It cannot be solved, for a general 8th order polynomial.
> Luckily, you don't have one. See that the odd powers
> of f all have zero coefficients, as well, even the highest
> even power has a zero coefficient.
>
> Substitute x = f^2 into your polynomial. Then it
> becomes a simple cubic polynomial, easily solvable.
>
> John

Hi everybody

Seems i have roughly same problem, in my case, i use

X=solve('a*x^4+b*x^3+c*x^2+d*x+1=0', 'x'), but it gives result as:

X =
 
RootOf(X4^4*a + X4^3*b + X4^2*c + X4*d + 1, X4), then i found in matlab help that i have to add an option 'MaxDegree',4

http://www.mathworks.com/help/toolbox/symbolic/solve.html

even i added that term still it does not work and this time gives error.


X = solve('a*x^4+b*x^3+c*x^2+d*x+1=0','x','MaxDegree',4)
Warning: The argument for the %s format specifier must be of type char (a string).
> In solve>getEqns at 178
  In solve at 67
??? Error using ==> solve>getEqns at 178
'  ' is not a valid expression or equation.

Error in ==> solve at 67
[eqns,vars] = getEqns(varargin{:});
 
Thanks

Subject: Haw to find symbolick roots

From: Steven_Lord

Date: 23 Sep, 2011 13:42:27

Message: 7 of 10



"kamuran turksoy" <kamuranturksoy@gmail.com> wrote in message
news:j5g5jo$mr8$1@newscl01ah.mathworks.com...

*snip*

> Seems i have roughly same problem, in my case, i use
>
> X=solve('a*x^4+b*x^3+c*x^2+d*x+1=0', 'x'), but it gives result as:

Do not call SOLVE with strings as input; SOLVE can't substitute values that
you may have defined for the variables into the expression-to-be-solved if
you do, and so in your example treated a, b, c, and d as symbolic variables
rather than the specific values you'd already defined. Call SOLVE with
symbolic expressions as input instead.

syms x
X=solve(a*x^4+b*x^3+c*x^2+d*x+1, x) % the = 0 is implied

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Haw to find symbolick roots

From: kamuran turksoy

Date: 23 Sep, 2011 19:50:30

Message: 8 of 10

"Steven_Lord" <slord@mathworks.com> wrote in message <j5i2c3$pe6$1@newscl01ah.mathworks.com>...
>
>
> "kamuran turksoy" <kamuranturksoy@gmail.com> wrote in message
> news:j5g5jo$mr8$1@newscl01ah.mathworks.com...
>
> *snip*
>
> > Seems i have roughly same problem, in my case, i use
> >
> > X=solve('a*x^4+b*x^3+c*x^2+d*x+1=0', 'x'), but it gives result as:
>
> Do not call SOLVE with strings as input; SOLVE can't substitute values that
> you may have defined for the variables into the expression-to-be-solved if
> you do, and so in your example treated a, b, c, and d as symbolic variables
> rather than the specific values you'd already defined. Call SOLVE with
> symbolic expressions as input instead.
>
> syms x
> X=solve(a*x^4+b*x^3+c*x^2+d*x+1, x) % the = 0 is implied
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

But i want to solve it as symbolic, i mean a b c d x are all symbols and then my aim is to define some constraints on a b c d such that roots of polynomial lie outside unit circle (abs (roots)> 1)

Regards

Subject: Haw to find symbolick roots

From: Steven_Lord

Date: 23 Sep, 2011 20:41:36

Message: 9 of 10



"kamuran turksoy" <kamuranturksoy@gmail.com> wrote in message
news:j5inu6$nni$1@newscl01ah.mathworks.com...
> "Steven_Lord" <slord@mathworks.com> wrote in message
> <j5i2c3$pe6$1@newscl01ah.mathworks.com>...
>>
>>
>> "kamuran turksoy" <kamuranturksoy@gmail.com> wrote in message
>> news:j5g5jo$mr8$1@newscl01ah.mathworks.com...
>>
>> *snip*
>>
>> > Seems i have roughly same problem, in my case, i use
>> >
>> > X=solve('a*x^4+b*x^3+c*x^2+d*x+1=0', 'x'), but it gives result as:
>>
>> Do not call SOLVE with strings as input; SOLVE can't substitute values
>> that you may have defined for the variables into the
>> expression-to-be-solved if you do, and so in your example treated a, b,
>> c, and d as symbolic variables rather than the specific values you'd
>> already defined. Call SOLVE with symbolic expressions as input instead.
>>
>> syms x
>> X=solve(a*x^4+b*x^3+c*x^2+d*x+1, x) % the = 0 is implied
>>
>> --
>> Steve Lord
>> slord@mathworks.com
>> To contact Technical Support use the Contact Us link on
>> http://www.mathworks.com
>
> But i want to solve it as symbolic, i mean a b c d x are all symbols and
> then my aim is to define some constraints on a b c d such that roots of
> polynomial lie outside unit circle (abs (roots)> 1)

While there is a formula for the roots of a quartic equation in radicals,
it's VERY messy.

http://en.wikipedia.org/wiki/Quartic_function#The_general_case.2C_along_Ferrari.27s_lines

I'm not all that surprised SOLVE doesn't try to expand it.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Haw to find symbolick roots

From: Christopher Creutzig

Date: 27 Sep, 2011 08:55:45

Message: 10 of 10

On 22.09.11 22:25, kamuran turksoy wrote:

> X = solve('a*x^4+b*x^3+c*x^2+d*x+1=0','x','MaxDegree',4)
> Warning: The argument for the %s format specifier must be of type char (a string).
>> In solve>getEqns at 178
> In solve at 67
> ??? Error using ==> solve>getEqns at 178
> '  ' is not a valid expression or equation.
>
> Error in ==> solve at 67
> [eqns,vars] = getEqns(varargin{:});

Strange, that works fine for me. I'm assuming you are using 2011b, since
that is the first version with the 'MaxDegree' option. Do you get this
error in a fresh MATLAB, or do you need to have something computed
beforehand? If you can reproduce this error message, could you please
file a report with customer service?

Notice that you do not want to use any kind of symbolic solution to this
input for numerical computations. The solution is correct, but there is
no single expression for it that is numerically stable for all inputs.

You said you want to bound the polynomial roots away from zero. That is
the same thing as getting an upper bound for the zeroes of the reversal
of the polynomial, i.e. finding a, b, c, d, such that
x^4+d*x^3+c*x^2+b*x+a has no zeroes outside the unit circle (and
whatever other conditions you have for these parameters). By the Rouché
theorem, having abs(a) < 1, abs(b) < 1, abs(c) < 1, abs(d) < 1 suffices.
(I believe you can also use the Rouché theorem directly to get a lower
bound for the roots of the original polynomial.)



Christopher

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us