Previous Up Next

9.2.5  Exponential regression: exponential_regression exponential_regression_plot

You might expect a set of points to lie on an exponential curve y=b ax. The exponential_regression command finds the values of a and b which give you the best fit exponential.


Example.
Input:

evalf(exponential_regression([[1,1],[2,4],[3,9],[4,16]]))

or:

evalf(exponential_regression([1,2,3,4],[1,4,9,16]))

(where the evalf is used to get a numeric approximation to an exact expression, see Section 6.8.1).
Output:

2.49146187923,0.5

so the best fit exponential curve will be y = 0.5*(2.49146187923)x.


The exponential_regression_plot command draws the best fit exponential.


Example.
Input:

exponential_regression_plot([1,2,3,4],[1,4,9,16])

Output:


Previous Up Next