miguelriemoliveira / OptimizationUtils

A set of utilities for using the python scipy optimizer functions
GNU General Public License v3.0
6 stars 0 forks source link

Creating a quartic polynomial that fits a cosine function #34

Closed miguelriemoliveira closed 4 years ago

miguelriemoliveira commented 5 years ago

Hi @afonsocastro ,

The goal is to create a script which optimizes the four parameters of a polynomial function so that it fits a cosine within the -pi/2 and pi/2 range.

You must create a new test script here https://github.com/miguelriemoliveira/OptimizationUtils/tree/master/test

The script should define a class Polynomial as follows. The polynomial is a quartic and thus has four parameters. These are the values to be optimized.

class Polynomial:

   ___init___(self):
      self.param1 = 0
      self.param2 = 0
      self.params_3_and_4 = [0 0]

The different way of defining the params is so that you can gain agility with the OptimizationUtils. These four params are the parameters of a quartic polynomial (see https://mycurvefit.com/)

The objective function must compute the values given by the function in 30 equally spaced values between -pi/2 and pi/2.

The function must return a list of residuals (errors).

Create a visualization function that plots a cosine function

Can you show me this by Thursday? Good luck.