Click here to Skip to main content
Click here to Skip to main content

Getting Points for Parabolas

By , 26 Jan 2009
 
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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Prox-YD
Software Developer (Senior) Prox-Young Developer
Honduras Honduras
Member
I started to code at the age of 12, with visual basic i made an advanced webbrowser called "BlueFlame", which won a computer fair in 2007, Then i moved to c#, but kept on with visual basic, started the "Prox" project at the age of 13 , meant to be an open source project, the project consists in :
Making good software, Good looking software.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Mobile
Web04 | 2.6.130523.1 | Last Updated 26 Jan 2009
Article Copyright 2009 by Prox-YD
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid