Jump to content

approximating graphs with polynomials

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
mordi05

mordi05

    Newbie

  • Members
  • Pip
  • 2 posts
Hello.
I am trying to write a program that can approximate graphs I might have with polynomials. With this I mean that I have a picture of a graph, that I don't know the equation for, and I want to draw larger and larger polynomials until I get an "acceptable" match.

Would this be possible? I guess I would need a starting value i.e. the center of the graph, and some user input as to whether it gets better or worse.

Or even some way of tracing/drawing on the graph, collecting the coordinates and then finding the function?

Now, I know how I could approximate a known function i.e. with Taylor series, but as I stated I would not know the function.

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
If you have sufficient data points, I would use Cubic Splines to create the approximations. Taylor polynomials work well locally, but tend to be pretty bad short distances away from the area of interest. This is a common problem with any polynomial of high degree.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
mordi05

mordi05

    Newbie

  • Members
  • Pip
  • 2 posts
Thank, you. That makes sense. I will certainly look into it.

Of course I would not know the coordinates of each point point on the graph initially. Only approximately what they are from looking at the graph. However, I think I could solve this be inputting the scale on the axis, and some kind of mouse click in the data points to collect pretty accurate coordinates.

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Since a cubic spline is an approximation, that should work well.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog