MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Creation and evaluation of polynomials

  • To: mathgroup at smc.vnet.net
  • Subject: [mg89475] Re: [mg89436] Creation and evaluation of polynomials
  • From: "Szabolcs HorvÃt" <szhorvat at gmail.com>
  • Date: Tue, 10 Jun 2008 03:43:13 -0400 (EDT)
  • References: <200806091019.GAA05076@smc.vnet.net>

On Mon, Jun 9, 2008 at 13:19,  <jmgomezgoo at gmail.com> wrote:
> Hi!
>
> Image we have a function that create a Polynomial:
>
> polynomial[{1,0,0,0,1,0,1,}] -> p^5 + 3p^2
>
> And we want to calulate roots and the derivate of this polynomial.
>
> I try with ToString[polynomial[{1,0,0,0,1,0,1}]] in order to use
> convert the polynomial expression to string first and later use
>
> ToExpression[]
>
> and calculate roots
>
> D[ToExpression[ToString[polynomial[{1,0,0,0,1,0,1}]], x]
>
> like the next examples:
>
> D[ToExpression["x^2+2x"], x]
>
> or
>
> NSolve[ToExpression["x^2+2x==x"], x]
>
>
> But ToString erase ^ symbol.
>
> Somebody knows how to solve it?
>

I don't see any reason for converting to a string and then back.  Why
do you want to do that?

The answer: ToString[x^2, InputForm]


  • Prev by Date: Re: Selecting Element from List via Pattern Matching
  • Next by Date: Many problems with 6.0, possibly java
  • Previous by thread: Re: Creation and evaluation of polynomials
  • Next by thread: Re: Creation and evaluation of polynomials