Empirical Data Plot
I wish to make a plot of N vs Time where $N=$ # of edges in a graph. i.e. i want to make an empirical estimate of the time complexity it takes to compute certain things about a graph based on its number of edges.
so i guess i'm wanting to know how i can plot these data points in sage and find a polynomial that best fits?
i.e.
N = [(16,28,59,120)]
T = [(0.135,0.523,7.36,248)] --where time is measured in seconds
i'm a beginner so any help will be much appreciated.
It's highly unlikely that you'll want a polynomial that gives best fit; you can get a polynomial with a PERFECT fit if you choose a high enough degree polynomial! You may want to look at general books on data analysis.
That said, you could certainly try fitting to various things like `x^2` or `x log(x)` with `find_fit`, see http://www.sagemath.org/doc/reference/sage/numerical/optimize.html#sage.numerical.optimize.find_fit
well, i just want to know the order of growth. i.e. as the edges increase what is the order of growth in terms of time taken to compute my function.
@kcrisman is right. You can always have a polynomial of degree at most len(N)-1 that perfectly fits the solution. Finding such a polynomial would require the same time as inverting a (len(N)-1) x (len(N)-1) matrix. There possibly exists a more "straightforward" (but complex) expression too since the inverse of a Vandermond matrix is known.