For Programmers: Free Programming Magazines  


Home > Archive > Mathematica > December 2006 > Help !! plot roots of an expression









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Help !! plot roots of an expression
mintoo

2006-12-21, 8:12 am

I have a polynomial. A simple example is like this

(w-w1) (w + 2 q +en^2 + s w^3) + r
The actual example is more complicated. It is a function of several
variables e.g. q, en, s, r etc..
I also need to Collect & FullSimplify this expression.
Finally, from that result, I want to plot the roots of this polynomial
(imaginary & real part) vs. q (say) or vs en etc.. other variables can
be given fixed values.

I'll the thankful if you give me hints how to do this!!

dimitris

2006-12-22, 8:11 am

No proper help can be given without seeing your polynomial!

Dimitris

mintoo wrote:
> I have a polynomial. A simple example is like this
>
> (w-w1) (w + 2 q +en^2 + s w^3) + r
> The actual example is more complicated. It is a function of several
> variables e.g. q, en, s, r etc..
> I also need to Collect & FullSimplify this expression.
> Finally, from that result, I want to plot the roots of this polynomial
> (imaginary & real part) vs. q (say) or vs en etc.. other variables can
> be given fixed values.
>
> I'll the thankful if you give me hints how to do this!!


Bob Hanlon

2006-12-27, 8:18 am

poly=(w-w1) (w + 2 q +en^2 + s w^3) + r;

Collect[poly,w]

s*w^4 - s*w1*w^3 + w^2 + (en^2 + 2*q - w1)*w + r - en^2*w1 - 2*q*w1

soln=Transpose[{Re[w],Im[w]}/.
{Reduce[poly==0/.{s->2,w1->1,en->5,r->3/2},w]//ToRules}];

Plot[#,{q,-22.5,0},
PlotStyle->{
{AbsoluteThickness[2],AbsoluteDashing[{3
,10}],Red},
{AbsoluteDashing[{10,10}],Blue},
{AbsoluteThickness[2],AbsoluteDashing[{3
,10}],Green},
{AbsoluteDashing[{10,10}],Orange}},
Frame->True,Axes->False,
PlotRange->{{-22.6,0.1},Automatic},
ImageSize->400]&/@
soln;

List@@(First/@Reduce[poly==0/.
{s->2,w1->1,en->5,r->3/2},w,Reals])//N

{q<-17.778,q==-17.778,q==-11.7695,q>-11.7695}


Bob Hanlon

---- mintoo <varun.tangri@gmail.com> wrote:
> I have a polynomial. A simple example is like this
>
> (w-w1) (w + 2 q +en^2 + s w^3) + r
> The actual example is more complicated. It is a function of several
> variables e.g. q, en, s, r etc..
> I also need to Collect & FullSimplify this expression.
> Finally, from that result, I want to plot the roots of this polynomial
> (imaginary & real part) vs. q (say) or vs en etc.. other variables can
> be given fixed values.
>
> I'll the thankful if you give me hints how to do this!!
>


David Park

2006-12-27, 8:18 am

It would help if you posted an evaluable example to the group. How could one
possibly find roots for the example that you give?

David Park
djmp@earthlink.net
http://home.earthlink.net/~djmp/

From: mintoo [mailto:varun.tangri@gmail.com]


I have a polynomial. A simple example is like this

(w-w1) (w + 2 q +en^2 + s w^3) + r
The actual example is more complicated. It is a function of several
variables e.g. q, en, s, r etc..
I also need to Collect & FullSimplify this expression.
Finally, from that result, I want to plot the roots of this polynomial
(imaginary & real part) vs. q (say) or vs en etc.. other variables can
be given fixed values.

I'll the thankful if you give me hints how to do this!!


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com