Code Monkey home page Code Monkey logo

quadplots's Introduction

quadplots

The quadplots program is an educational utility to create visualizations of basic quadrature methods. The current methods supported are Riemann sum (left, right, mid, max, min), Trapezoid rule, and Simpson's rule.

Usage

Basic usage of quadplots only requires an expression you want to graph (must be valid python), and the start and end points.

quadplots "x**2 - 3*x + 1" -2 3 

By default quadplots will graph a riemann sum with n=10 and use the midpoint method, but you can easily change these options.

quadplots "x**2 - 3*x + 1" -2 3 --method min --partitions 5

You can also change the type of quadrature method used

quadplots "x**3 - 8*x + 7" -2 3 --method min --partitions 4 --quad-type simpson 

If you want, instead of python functions, you can write latex by adding the --latex flag to the command.

quadplots "\exp{-x^{2}}" -2 4 --partitions 4 --quad_type simpson --latex

Finally, if you wish to animate the plot, you can pass --animate with a list of partitions you would like to see at each frame.

quadplots "\exp{-x^{2}}" -2 4 --partitions 4 --quad_type simpson --latex --animate 2 4 6 10 100

quadplots's People

Contributors

copontherun avatar

Watchers

 avatar

quadplots's Issues

Allow for multiple plots in one image in the cli

The functionality for this is built into the api currently, but not in the cli. I'll probably modify the --quad-type to accept multiple arguments instead of just one. Figuring out what to do with the layout could be tricky. If there are three graphs (eg. simpson, midpoint, and trapezoid) should they be arranged 1x3, or perhaps 2x2 with the third graph taking up the whole bottom, or maybe there should just be a blank spot. Something I'll have to think about...

Animated plots can have the axis jumping around

For Simpson's method, the max/min of the parabolas will occasionally be outside of the max/min of the function being analyzed, this can make the axis jump around during the animation (example below). While this isn't a huge deal, it's a little annoying and should be fixed. I think a simple method to fix it would be to fix the axis at += 5% of whatever the min/max of the function is. This might result in some of the parabolas going out of the image, but I'd rather that than the axis jumping around.

quadrature

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.