the general equation for the parabola is
y = ax2 + bx + c
the vertex of a parabola is the coordinate from which it takes the sharpest turn whereas a is the straight-line used to generate the curve.
focus is the point with is equidistant from all points of the parabola.
here, we will find the vertex, focus, and directrix of a parabola. there is a mathematical formula that finds all these values. and we will make a program using the mathematical formula for it.
input:a = 10,b = 5,c = 4output:the vertex: (-0.25, 3.375)the focus: (-0.25, 3.4)y-directrix:-1036
解释根据给定的抛物线图形的数值,找到顶点、焦点和y方向的数学公式。
顶点 = {(-b/2a) , (4ac-b2/4a)}
焦点 = {(-b/2a), (4ac-b2+1/4a)}
方向 = c - (b2 +1)*4a
示例#include <iostream>using namespace std;int main() { float a = 10, b = 5, c = 4; cout << "the vertex: (" << (-b / (2 * a)) << ", " << (((4 * a * c) - (b * b)) / (4 * a)) << ")\n"; cout << "the focus: (" << (-b / (2 * a)) << ", " << (((4 * a * c) - (b * b) + 1) / (4 * a)) << ")\n"; cout << "y-directrix:" << c - ((b * b) + 1) * 4 * a;}
以上就是寻找抛物线的顶点、焦点和准线的c/c++程序的详细内容。
