Application Center - Maplesoft

App Preview:

Curve Fitting with Maple

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application



Curve Fitting with Maple 

? Maplesoft, a division of Waterloo Maple Inc., 2007 




Maple includes a number of assistants that allows a user to experiment and easily perform key tasks.  This Tips and Technique will focus on the Curve Fitting Assistant.  This assistant provides a quick and easy method to fit a curve to a set of data points and to experiment to find the best curve for your data set.  The assistant provides a graph showing both the points in your data as well as the curve returned by the choosen curve fitting algorithm. 

Launching the Assistant 


There are three methods to launch the Curve Fitting Assistant, the first is by going to Tools > Assistants > Curve Fitting.  The second method is to create/import a two column Matrix, two column Array, or a List of Lists (where the sub list all contain two numbers); then right-click on the output and select Curve Fitting > Interactive Curve Fitting from the context menu. 


A final method is to calling the following function: 




The first method will launch the Curve Fitting Assistant with no data loaded and you will need to add the data before continuing with the assistant.  The second method will launch the assistant with the data that you clicked on already loaded into the assistant.  By passing no data to the third method, the Curve Fitting Assistant will launch with no data loaded.  By passing the data as the argument of the command, you will launch the Curve Fitting Assistant with the data loaded into the assistant. 

Inserting Data 


If the Curve Fitting Assistant was launched without any data being loaded, the first window of the assistant is: 




This window allows you to enter in the Typesetting:-mrow(Typesetting:-mi( and Typesetting:-mrow(Typesetting:-mi( values by hand or to click the Import button that will bring up Maple's Import Assistant. 


Fitting the Curve 


Once the data is imported into the Curve Fitting Assistant you will get the following window: 




This window has a plot to the left, an indication of the vertical range of the plot and relevant curve fitting commands to the right.  At the bottom of the window there is a box for the result of the selected curve fitting algorithm.  The plot is also be updated with the curve returned by the curve fitting algorithm that is selected. 


Note: The Rational Interpolation selection shows up only if the data contains no decimal values.  The Thiele Interpolation shows up only if the Typesetting:-mrow(Typesetting:-mi( values in the data are unique. 


For the Rational Interpolation and Splines options there are sliders that allow you to control the maximum degree of the numerator and denominator being used or the degree of the spline being used during the curve fitting procedure. 





The Least Squares section provides an input box for the user to specify an expression in terms of Typesetting:-mrow(Typesetting:-mi(.  The parameters will be fit by the Least Squares command with values according to this procedure.  Only expressions that are linear in terms of the parameters are allowed. 




To apply the fitting command, click the Plot button that is to the right of the algorithm options. 




The Curve Fitting Assistant allows you to experiment with different curve fitting algorithms and easily see the plot of the resulting curve.  This interface also allows for experimenting with setting different settings for the curve fitting procedure.  Once you have found the curve that you are looking for, you can click Done to have the equation that is in the bottom box of the window inserted into the document.  By clicking the Cancel button, the window will be closed without the equation being inserted into the document. 


Package Overview 


Within Maple, there is a package that contains the following command to fit a curve to your input data: 

  • BSpline BSplineCurve Interactive LeastSquares PolynomialInterpolation RationalInterpolation Spline ThieleInterpolation


The commands within this package are the same commands that are called by the Curve Fitting Assistant.  Once you have determined the command that best suites your data set, you can call the command directly without needing the Curve Fitting Assistant.  More information on each of the commands can be found on the help page for each that is linked above. 


Legal Notice: The copyright for this application is owned by Maplesoft. The application is intended to demonstrate the use of Maple to solve a particular problem. It has been made available for product evaluation purposes only and may not be used in any other context without the express permission of Maplesoft.