y轴截距标准误差
The x-intercept is the point where the line cut the x-axis and the y-intercept of the line is a point where the line will cut the y-axis. As we all have learned in the coordinate geometry that how we find the x-intercept and y-intercept of the given line and also in this tutorial we will use the same concept that we have learned in the coordinate geometry. Here, the coordinate of two-points will be given by the user by which the line passes. To solve this problem, the idea is very simple that initially find the equation of the line by using the mathematical formula y = m*x+c where m is the slope of the line and c is constant. After this to know the x-intercept of the line just put the value of y is zero and the corresponding value of x is x-intercept and similarly for y-intercept just put the value of x is zero and the corresponding value of y is y-intercept. Before going to solve this problem, we will the algorithm and try to understand the approach.
x截距是线切割x轴的点,而y截距是线将切割y轴的点 。 正如我们都在坐标几何中了解到如何找到给定线的x轴截距和y轴截距一样,在本教程中,我们将使用在坐标几何中所学的相同概念。 此处,两点的坐标将由线通过的用户给出。 为了解决这个问题,这个想法很简单,首先使用数学公式y = m * x + c找到线的方程式,其中m是线的斜率, c是常数。 在此之后知道线的x截距只是将y的值设为零,而x的对应值是x截距 ;类似地,对于y截距,只是将x的值设为 0且y的对应值便是y截距 。 在解决此问题之前,我们将对算法进行尝试,并尝试理解该方法。
Algorithm to solve this problem:
解决此问题的算法:
Take the coordinate of the two-point by the user from which the line will pass.
由用户获取线将通过的两点坐标。
Find the slope of the line by using the formula m = (y2-y1)//(x2-x1).
通过使用公式m =(y2-y1)//(x2-x1)来找到直线的斜率。
Now, write the equation of the line by using the mathematical formula y = m*x+c where c is constant.
现在,使用数学公式y = m * x + c来写直线方程,其中c为常数。
To find the value of constant c just put the given one point coordinate in the expression of the line i.e y = m*x+c.
要找到常数c的值,只需将给定的一个点坐标放在直线的表达式中,即y = m * x + c 。
Here, to know the x-intercept just put the value of y is zero in the equation of the line.
在这里,要知道x截距只是将y的值放在直线方程中为零。
Also to find the y-intercept just put the value of x is zero in the expression of the line.
还要找到y截距,只需将x的值放在该行的表达式中为零即可。
Print the value of x-intercept and y-intercept of the line.
打印该行的x截距和y截距的值。
Now, we will write the Python program by implementing the above algorithm in a simple way.
现在,我们将通过简单的方式实现上述算法来编写Python程序。
a,b,p,q=map(int,input('Enter the coordinates of the points:').split())
m=(q-b)/(p-a)
y=b
x=a
c=y-(m*x)
#to find x-intercept.
y=0
x=(y-c)/m
print('x-intercept of the line:',x)
#to find y-intercept.
x=0
y=(m*x)+c
print('y-intercept of the line:',y)
Output
输出量
Enter the coordinates of the points: 5 2 2 7
The x-intercept of the line: 6.2
The y-intercept of the line: 10.333333333333334
y轴截距标准误差