Skip to content

Plotly Dash app that finds the least squares solution to data in two variables using trigonometric polynomials.

Notifications You must be signed in to change notification settings

merillium/trig_least_squares

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This repo is currently a work in progress.

We solve the least squares problem using trigonometric polynomials with non-integer degree. The basis functions are [1, sin(ax), cos(bx)] where a,b can take on any value. There is also error handling for invalid inputs.

If you want to launch the Dash app locally, you can navigate into the venv directory with cd venv, then run the following commands:

pip install -r requirements.txt

python app.py

Current features:

  • uploading csvs with the option to select columns corresponding to x- and y- variables
  • error handling for invalid csvs or data
  • display the interpolating trigonometric polynomial within the chart
  • grid search of optimal a,b values for the period of the sine and cosine base functions
  • ability to select the index of the dataframe (convenient for timeseries data)
  • ability to modify the period of the basis functions (this might be important for more practical applications such as real data sets)
  • calculate and show metrics determining the least squares fit (r2)

Features in progress:

  • extrapolation of points not on the chart (e.g. evaluate f(10) for chart x range of [-5, 5])
  • specify the range of the function to display

Example below:

sample plot

About

Plotly Dash app that finds the least squares solution to data in two variables using trigonometric polynomials.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published