Coder Social home page Coder Social logo

specialmath's Introduction

Special Math

I created this labary to contain spcific methods that help me solve novel, yet common, problems.

These are written light-weight to run on micropython

Usage

Import the special math object that contains the methods

from specialmath import SpecialMath

sm = SpecialMath()

Methods

Mean

Mean takes a list of numbers and returns the average

sm.mean([1,2,3])

returns 2.0

SSE

SSE takes 2 lists of equal length and returns the sum of square error

sm.SSE([1,2,3],[2,3,4])

returns 3

Gen Sine

Returns a list that is a full rotation of a sine wave

  • Argument 1: length of output list
  • Argument 2: amplitude of sine wave
  • Argument 3: phase shift of sine wave
sm.gen_sin(10,8,2.5)
returns [-20.0, -16.18033988749895, -6.180339887498947, 6.180339887498947, 16.18033988749895, 20.0, 16.18033988749895, 6.180339887498959, -6.18
0339887498954, -16.180339887498945]

Fit sine

Returns a tuple size 2 that contains (1) the amplitude and (2) the phase shift. Takes 2 arguments :

  • Argument 1: Imput list containing the data to shape the sine wave to
  • Argument 2: Accuract factor, detirmines the number of itterations taken to estimate the wave properties. The higher the number, the more accurate and the longer computational time
sm.fit_sin([-4,0,4,0],8)

returns (3.9999744, 0.99993896484375)

To Do

Add a method to calculate the Standard Deviation

Acknowledgements

Written By Kipling Crossing

specialmath's People

Contributors

kipcrossing avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

vtt-info

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.