Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Getting Points for Parabolas

0.00/5 (No votes)
26 Jan 2009 1  
Get all points needed for graphing parabolas
ParabollaSourceC_

Introduction 

Recently, I have been having a lot of algebra homework about graphing parabolas. It was a bit annoying doing the same process for all of my problems, so I decided to make a tool that will give me all the values I needed to graph:

  • Vertex: Point where lines intersect
  • Axis of symmetry: Line that will pass in the middle of the Parabola, in the X axis
  • Y-intercept: Point where Y axis is intercepted, and X = 0
  • Y-reflection: Another point to graph our Parabola

The Code

This code is really basic code, integers and decimals handling, so I will explain it a little bit.

decimal A = int.Parse(txt1.Text);
decimal B = int.Parse(txt2.Text);
decimal C = int.Parse(txt3.Text);
decimal X;
decimal Y;
decimal X_rf;
//Axis Of Sym Op                
decimal Axis_Sym = -1 * B / (2 * A);
axis_sym.Text = Axis_Sym.ToString();
X = Axis_Sym;
//Vertex Op
Y = A * (X * X) + B * X + C;
vertex.Text = X + " , " + Y;
//Y-Intercept Op
y_int.Text = X + " , " + C;
//Y_Ref Op              
X_rf = X + X;
y_ref.Text = X_rf + " , " + C; 

The code gets string values from 3 textboxes in the form, it converts the string value to decimal using Int.Parse(String). Once we have the decimal values (I used decimal in case the results of all the operations would come out as decimals). I'll describe the formulas to get the required points.

  • Axis of Symmetry: Here we find X  = -(B) / 2 * A   
  • Vertex: we need to get Y, so  Y = A(X)2 + B(X) + C so the vertex = (X, Y), a point in a coordinate plain.  
  • Y-Intercept : A point where X = 0, and the line touches Y axis = (0, C) 
  • Y-Reflection : Another point to graph our line = ( (X - X), C ) 

So that's it. We are ready to graph all the points, Soon I will add the code that actually graphs the points in a coordinate plane.

Points of Interest

This program was made by a 14 year old kid. This tool turned out to be really helpful.

History

  • 26th January, 2009: Initial post

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here