Coder Social home page Coder Social logo

virajdatt / taylor_series_gif Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 1.09 MB

Visualizing Taylor Series approximation as a gif. Learn how to create a gif out of the matplotlib graphs.

Makefile 0.08% Jupyter Notebook 98.75% Python 1.17%
python matplotlib-animation matplotlib-pyplot gif mathematical-modelling

taylor_series_gif's Introduction

taylor_series_gif

Introduction

Inspired from 3Blue1Brown to learn mathematics with vizualization and use these vizualization to better my intutions. I have created this repo which shows how Taylor series approximation gets better with additional degree of polyinomal added (specifically with the cos function as an example). Here I have utilized the python libraries matplotlib (to generate the graphs) and imageio (to create the gif).

Taylor Series Cos Approximation with new increasing polynomial terms

Code Details

  1. The src folder contains the source code, like the functions used to approximate the value of cos at a given value, plotting various values and creating the gif. The run_approx.py runs these functions implemented in the approx.py file.

  2. The tests folder contain a couple of test cases to confirm the code works as expected (TDD).

  3. The notebooks folder contains a jupter notebook which shows how to use the functions from src (approx.py) to vizualize things.

Feel free to play around and implement other functions(like sin, e^x) and see how the approxmiations get better.

TO-DO

Show how the Taylor Serier fails to approximate nasty discontinued function f(x) = 1/x when x<0 (As the funtion is undefined at x = 0 and if we start with x=1 we just get the upper right half the graph).

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.