CopOnTheRun / quadplots

Package to visualize quadrature methods
https://pypi.org/project/quadplots/
MIT License
0 stars 0 forks source link

Animated plots can have the axis jumping around #1

Open CopOnTheRun opened 5 months ago

CopOnTheRun commented 5 months ago

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

CopOnTheRun commented 3 months ago

I attempted to fix this today, but my first naive attempt did not pan out. Originally I was hoping I could just take the max and min y values on the interval, subtract them, the multiply that number by a (somewhat arbitrary) factor and add/subtract it to the max and min y values to get a pretty good bounds on the y axis. This method works for the above graph: $\exp{-x^{2}}$

quadrature

Unfortunately, for other graphs this method is less than stellar and cuts off a large portion of the parabolas: $\exp{x^2}$ quadrature

Part of me thinks that I'm just trading some edge cases for other edge cases here, I mean $e^{x^2}$ is kind of a weird graph, but I'd like to find something that is a complete solution. In other words if I could find the max and min y values of each parabola over each frame, then I could use the max y and min y to set the y axis limits. There may be a proof to the upper and lower bounds of each parabola, but I'm not privvy to it at the moment. If there is no lower bound (relative to the lower bound of a function of course) then cutting off part of the parabola might just be part of life.