I'm making a graphing calculator with JavaScript and I'm able to graph simple functions in the form y=f(x). However, I can't figure out how I'd graph implicit equations(eg. y^2+x^3=3x+3x^2-2). I figure you can get a bunch of points belonging to the function by iterating over values of y and solving for x using root estimation methods, but I have no good way of figuring out how to connect the points. Are there any good ways to do this?
#Graphing implicit equations
43 messages · Page 1 of 1 (latest)
Just change your code instead of going over every x value and plotting a point based on the value of the function there,
have it go over every x and y, and plot a point if the equation is true
Unfortunately doesn't work
The thing is I'm dealing with pixels
And that means you can't have infinite precision
You have to include pixels that technically aren't part of the graph to make the whole thing continuous
Consider a•sin(x), where a is some large number
Yes no graphing calculator has that
Yea
So I have to connect the points together
If not I could just get a bunch of disconnected points
Also there's a possibility that it misses some points, for the range of x given
Yea so for function plotting in the form y=f(x),I just iterate over the pixel x coordinates, translate them to graph x coordinates and find the corresponding y
Which does the job quite well
Added bonus of no nested for loops
For implicits I'm a bit stumped though
An example of what would happen in some cases if we're iterated over every pixel, but didn't connect the points, with some vertical line
differentials
I use the derivative to find out which points to connect?
@pulsar flame would I be able to graph a line segment of length √2 on a screen
No. The pixels deceive you.
Alright mb
How would I graph implicit equations on a screen
Go on
The Constructivist Perspective: Pixels
A constructivist wants every step in the graphing process to be given by a finite, explicit procedure. This means you need:
• An algorithmm that takes as input an implicit equation (for example, F(x, y) = 0) and a finite region of the plane to examine.
• Finite resolution “pixels” or intervals, aannd
• A method to decide - using an algorithm - that a piece of the graph exists in each pixel with controlled error.
In other words, you want to “construct” the graph by showing, in each finite subinterval, how the function behaves.
Yea fair
So yea im using interval bisection
Then iterating over y for the range of values of y to solve for x such that F(x,y)=0
So that gives me a bunch of coordinates
But they won't be necessarily be continuous
For functions I just estimated by drawing vertical lines to connect the pixels to those beside it
But with implicit equations I don't know how I'd link them
Exactly. It’s like every pixel is a tiny, finite universe where a bit of the graph appears - except the cosmos refuses to hand out irrationals and real numbers on a silver platter. As well as continuous curves. We’re stuck with rationals, pixels, and a perpetual “this is as close as you get” vibe. https://media.tenor.com/FNvvUTbZoU8AAAAC/yes-thanos.gif
So how do we at least estimate the shape