Graphing a Quadratic Equation: Zooming In & Out

Click For Summary

Discussion Overview

The discussion revolves around graphing a quadratic equation, specifically the equation x^2 + x + 10 = 0, and how to implement zooming functionality in a graphing program. Participants explore the mathematical principles behind zooming in and out on a graph, as well as practical programming approaches to achieve this effect.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • Some participants inquire about the method to change the scale for zooming effects when graphing a quadratic equation.
  • One participant suggests using a TI calculator's zoom functions but later clarifies that they are looking for a mathematical approach for programming.
  • Another participant discusses the setup of coordinates and scales when graphing, emphasizing the need for discrete values to plot points accurately.
  • There is a contention regarding the correct interpretation of the equation x^2 + x + 10 = 0, with some asserting it has no real solutions while others suggest plotting the function f(x) = x^2 + x + 10 to visualize this.
  • A participant proposes a mathematical formula for zooming in and out by adjusting the interval of the domain and range based on a zoom factor.
  • Participants share programming snippets to illustrate how they plot points and how changing the increment in their loops affects the density of plotted points.
  • There is a discussion about the implications of plotting a restricted range and how it relates to zooming in on the graph.

Areas of Agreement / Disagreement

Participants express differing views on the interpretation of the original equation and its graphing implications. While some agree on the method of zooming in and out mathematically, there is no consensus on the best approach to implement this in programming, and some participants remain uncertain about the effectiveness of their proposed solutions.

Contextual Notes

Some participants note that the original equation has no real solutions, which may affect how the graph is interpreted. Additionally, there are unresolved questions about the implementation of zooming in programming, particularly regarding the transformation of plotted ranges.

physicsuser
Messages
82
Reaction score
1
Now I am trying to graph this thing.

Lets say I have x^2+x+10=0

So yah... I plot them for -10<x<10 and get the y values...

What I would like to know is how do I change the scale as to get zoom in and zoom out effect?
 
Mathematics news on Phys.org
physicsuser said:
Now I am trying to graph this thing.

Lets say I have x^2+x+10=0

So yah... I plot them for -10<x<10 and get the y values...

What I would like to know is how do I change the scale as to get zoom in and zoom out effect?

I'm assuming you mean on a calculator?

If you are using a ti calculator, then you can go to window>zoom. You can use the various types of zoom, such as zoombox, zoomin, etc...

but take note that these zooms change the x range, and y range.
 
FrogPad said:
I'm assuming you mean on a calculator?

If you are using a ti calculator, then you can go to window>zoom. You can use the various types of zoom, such as zoombox, zoomin, etc...

but take note that these zooms change the x range, and y range.


no... what is the math behind the zoom? I am writing a program. Do I just divide the whole thing to zoom in and multiply to zoom out?
 
What do you mean what is the math behind the zoom...

Maybe I'm making this harder than it is, so I'll just put my thoughts out.

Lets say you are graphing y=x.

You first setup your coordinates.
Lets say:
x= -10..10
y= -10..10

Now setup a scale,
x_scl = 1
y_scl = 1

Now have the program draw the axis.
Now have the program plot within this window. You are using discrete values here, so you have a restricted domain. You will feed the function values from -10 to 10, such as r_n1 = -10, -9.9, -9.8, ... this will depend on the resolution of your drawing window. Each of these f(r_n) values gives you a point (r_n, f(r_n)) that will correspond to a pixel on the screen.

So now if you zoom in on the orgin for example, your domain would be x=-5..5 for example, and might have the discrete values, r_n2=-5,-4.95,-4.9,...
If we count r_n1 and r_n2 we notice they have the same number of elements. It's just that r_n2 is feeding the function a different set of values, and in return you are getting a different set of points to plot (the zoomed points).

...ahhh.
I see what you are saying now with the, "do I multiply, divide, ..." Honestly I don't know if that would work, I would have to play around with it. So I'm assuming you are using a plotting routine of the language then, and not creating a generic plotting function. If you don't need to create a plotting function, why don't you just use software out there to do your task.
A quick google search has this, http://www.mathworks.com/access/helpdesk/help/toolbox/dotnetbuilder/ug/index.html?/access/helpdesk/help/toolbox/dotnetbuilder/ug/bqhr8rn-1.html

or you could use the free Maxima,
http://maxima.sourceforge.net/index.shtml

to do your plotting.
 
Last edited by a moderator:
physicsuser said:
Now I am trying to graph this thing.

Lets say I have x^2+x+10=0

So yah... I plot them for -10<x<10 and get the y values...

What I would like to know is how do I change the scale as to get zoom in and zoom out effect?

You can't plot x^2+x+10=0, because it represents an equation, which, by the way, has no solution. If you had an equation of this form which had a solution, the only thing you could plot would be the solution, which is represented by one or two points.
 
radou said:
You can't plot x^2+x+10=0, because it represents an equation, which, by the way, has no solution. If you had an equation of this form which had a solution, the only thing you could plot would be the solution, which is represented by one or two points.

I'd imagine he wants to plot f(x)=x^2+x+10, and then see graphically that there are no real solutions to f(x)=0. Could be wrong though... all my assumptions in this thread seem to have failed thus far:)
 
FrogPad said:
I'd imagine he wants to plot f(x)=x^2+x+10, and then see graphically that there are no real solutions to f(x)=0. Could be wrong though... all my assumptions in this thread seem to have failed thus far:)

You're right, of course he could plot f(x)=x^2+x+10 and g(x)=0 separately and see that f(x)=g(x) has no real solutions.
 
Uhg... I don't know how to explain this...

I have a function f(x)=aX^2+bX+c
I want to plot point (x,f(x))--i know how to do that
I want to be able to zoom in/out the graph--need help here

here is an example

http://www.analyzemath.com/quadraticg/quadraticg.htm

click the start button under "interactive tutorial" and check out the zoom in and zoom out buttons.
 
Last edited:
physicsuser said:
Uhg... I don't know how to explain this...

I have a function f(x)=aX^2+bX+c
I want to plot point (x,f(x))
I want to be able to zoom in/out the graph

here is an example

http://www.analyzemath.com/quadraticg/quadraticg.htm

click the start button under "interactive tutorial" and check out the zoom in and zoom out buttons.

Zooming in and zooming out would mean changing the interval in the domain of the function which is to be plotted in the sense of making it smaller to zoom in, or greater to zoom out.
 
  • #10
radou said:
Zooming in and zooming out would mean changing the interval in the domain of the function which is to be plotted in the sense of making it smaller to zoom in, or greater to zoom out.

can you explain in more detail please?
 
  • #11
physicsuser said:
can you explain in more detail please?

Say you're plotting your function f on an interval I = [a, b], where the 'plot' means the graph, i.e. the set S = {x, f(x) : x is in [a, b]}. Now, zooming in would mean taking a proper subset of I, let's say I', and plotting the graph for I'.
 
  • #12
physicsuser said:
I want to plot point (x,f(x))--i know how to do that

how are you doing this?
 
  • #13
If you know how to plot points, then zooming is a simple matter of restricting the domain and choosing a new range. If your original interval was [a, b] then you could zoom to

[tex]\left[\frac{b+a}{2}-\frac{b-a}{2Z},\frac{b+a}{2}+\frac{b-a}{2Z}\right][/tex]

where Z is the zoom factor. To zoom in 2x, set Z = 2; to zoom in 100x, set Z = 100. Zoom out by using the reciprocal of the zoom factor (Z= 1/2 or Z = 1/100, in these examples).

You can change the range in the same way, or have it fit the equation by calculating the max and min of the function over the interval and setting the top and bottom on that basis.
 
  • #14
FrogPad said:
how are you doing this?

well I just go over a loop and plot points...

for(x=-10;x<10;x++)
{
y=a*x^2+b*x+c;
point(x,y);
}
 
  • #15
physicsuser said:
well I just go over a loop and plot points...

for(x=-10;x<10;x++)
{
y=a*x^2+b*x+c;
point(x,y);
}

What does,

for(x=-5;x<5;x=x+0.5)
{
y=a*x^2+b*x+c;
point(x,y);
}

do?
 
  • #16
FrogPad said:
What does,

for(x=-5;x<5;x=x+0.5)
{
y=a*x^2+b*x+c;
point(x,y);
}

do?

nothing... it just makes more points
 
Last edited:
  • #17
physicsuser said:
it makes a point(x,y);
it plots one point?

EDIT:
I see you edited your post.

Yes it makes more points... do you see how that is actually a zoomed in portion?
 
Last edited:
  • #18
FrogPad said:
it plots one point?

sorry didn't read what you said...

from 1 to 2 it will make points (x=1,y),(x=1.5,y),(x=2,y)... don't see how it would zoom in or out.
 
  • #19
Is this a project for school?
 
  • #20
Did you see my post #13? I think I answered your question.
 
  • #21
no I am a nerd...

This is just extra feature for the project.
 
  • #22
CRGreathouse said:
Did you see my post #13? I think I answered your question.


yes I did

and I am trying to implement it as we speak
 
  • #23
CRGreathouse said:
Did you see my post #13? I think I answered your question.


I am not sure that it worked...

Look at the picture...
I did what you suggested and it just drew a small graph..
 

Attachments

  • graph2.jpg
    graph2.jpg
    24.4 KB · Views: 482
  • #24
Well, I can't see your picture but I can guess one thing that might be happening. You're still plotting on the original range, just a restricted portion of it. In this case you'll have to reverse the transformation when plotting.
 
  • #25
CRGreathouse said:
Well, I can't see your picture but I can guess one thing that might be happening. You're still plotting on the original range, just a restricted portion of it. In this case you'll have to reverse the transformation when plotting.

cant see the picture?
http://www.hobojjr.yurx.com/graph2.jpg
What do you mean by restrict the range? How do I do that?
 
Last edited by a moderator:
  • #26
You have two different domains of points to think about:
1. The points on the graph of the function. For example (3, 3^2 + 3 + 10) = (1, 22) or (1, 12) or (0, 10), etc.
2. The points on the portion of the screen where you are drawing. This will have a fixed range and it depends on the pixels in the drawing field.

Now, depending on what kind of graphics you are using and in what language, there may already be tools that convert from 1. to 2. seamlessly so that you don't have to think about it. But if you want to plot the points manually one by one in domain 2. based on the values in domain 1., then you'll need to maintain a few values:
minScreenx, maxScreenx, minScreeny, maxScreeny
which represent the boundary box of the actual pixels on the screen (domain 2), and then have
minwinx, maxwinx, minwiny, maxwiny
which represent the zoom window that you want to have.
then you can define a function plotScreenPoint, something like this:
Code:
plotScreenPoint (x, y) where x and y represent the point in domain 1
   let winx = (x - minwinx) / (maxwinx - minwinx)
   let winy = (y - minwiny) / (maxwiny - minwiny)
   if 0 <= winx <= 1 and 0 <= winy <= 1 then
     let screenx = winx * (maxscreenx - minscreenx) + minscreenx
     let screeny = winy * (maxscreeny - minscreeny) + minscreeny
     point(screenx, screeny)
   otherwise do nothing
Basically you have winx representing the proportion from the left across the viewing field that the point is, and winy representing the proportion from the bottom across the viewing field that the point is. This also assumes that your screen coordinates are right side up (i.e. positive x and positive y are at the top right) but since you didn't mention that I assume they are.

Edit: oh, I see you're working in Java. Java has lots of library tools for manipulating and scaling graphics--not sure if you want to bother learning to use them, but they're probably the "right" way to do it.
 
Last edited:
  • #27
Maybe he just wants a simple programming answer instead of a mathematical one.

I assume you already know how to plot a graph at fixed intervals and your only difficulty is expanding it to variable intervals. This is quite easy then, all you need is another variable called Zoom in which you store the zoom level. If you were using 0.5 intervals then your zoom level was that of 0.5. Now replace that 0.5 with Zoom and use 1 as an initialised value for Zoom.

Now all that is needed to keep things simple is an x range which is divisable by all your possible zooms. Use zooms which are exponents of 2 and make the maximum and minimum zooms as 16 and 1/16.

Next to finish it up, add the zoom feature to your program like so:
Zoom out => if (Zoom < 16) Zoom = Zoom*2;
Zoom in => if (Zoom > 1/16) Zoom = Zoom div 2;

I hope that this is enough to get you going and tweaking anything I left out. Maybe all that you need to figure out is how to make your points lie well physically on the screen. But I'll leave it all up to the nerd :) Good luck!
 
  • #28
thanks I'll try it tomorrow. But I think I got an easy fix by using smaller intervals in x incremented by 0.1. The graph looks nicer but I am not sure that it's mathematicaly correct.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 16 ·
Replies
16
Views
5K
  • · Replies 19 ·
Replies
19
Views
4K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K