Graphing a Quadratic Equation: Zooming In & Out

In summary: I'm sorry, I don't know how to explain it any more clearly. Zooming in and out on a graph means changing the scale or range of the x and y values that are being plotted. For example, if you want to zoom in on a specific area of the graph, you would change the x and y values to be smaller so that the plotted points appear closer together. If you want to zoom out and see a larger portion of the graph, you would change the x and y values to be larger so that the plotted points appear further apart. The specific method for changing the scale will depend on the graphing tool or program you are using.
  • #1
physicsuser
82
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
  • #2
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.
 
  • #3
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?
 
  • #4
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:
  • #5
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.
 
  • #6
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:)
 
  • #7
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.
 
  • #8
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:
  • #9
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: 428
  • #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.
 

FAQ: Graphing a Quadratic Equation: Zooming In & Out

What is a quadratic equation?

A quadratic equation is an equation that contains a variable raised to the second power, also known as a squared term. It is in the form of ax^2 + bx + c = 0, where a, b, and c are constants and x is the variable.

What is the purpose of graphing a quadratic equation?

The purpose of graphing a quadratic equation is to visually represent the relationship between the variable and the constants in the equation. It allows us to see the shape of the curve and the location of the roots or solutions of the equation.

How do you graph a quadratic equation?

To graph a quadratic equation, plot points by substituting different values for x into the equation and solving for y. Once you have a few points, you can plot them on a coordinate plane and connect them with a smooth curve.

What does it mean to "zoom in" on a quadratic graph?

Zooming in on a quadratic graph means to make the scale of the graph smaller in order to focus on a specific area of the curve. This allows us to see the details and behavior of the curve in a smaller range of values.

Why would you "zoom out" on a quadratic graph?

Zooming out on a quadratic graph means to make the scale of the graph larger in order to see the overall behavior of the curve over a wider range of values. This can help us identify the general shape and direction of the curve and its key features such as the vertex and intercepts.

Similar threads

Replies
16
Views
4K
Replies
5
Views
1K
Replies
4
Views
2K
Replies
5
Views
3K
Replies
4
Views
1K
Back
Top