MathGroup Archive 1998

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

Search the Archive

Re: Drawing curves with equation.



Olivier Gilloire wrote:
> 
> Hi,
> 
> I'm a c++ programmer, and I would like to learn how to draw a curve
> corresponding to an equation, given in a string format like "x^2".
> 
> My problem is not how to draw the curve, but rather how to analyze the
> string and interpret it as a mathematic equation.
> 
> code samples are welcome !!
> 
> Olivier Gilloire

If I understand you correctly, then all you need is ToExpression which
converts strings to expressions.

string="x^2"

Plot[ToExpression[string],{x,0,3}]

returns a nice plot of x^2
-- 
Remove the _nospam_ in the return address to respond.



  • Prev by Date: Re: ListPlot3D Color
  • Next by Date: Re: Simplifying algebraic expr: howto?
  • Prev by thread: Drawing curves with equation.
  • Next by thread: Re: Drawing curves with equation.