计算二次方程的根 [英] Calculating the root of a quadratic equation

查看:98
本文介绍了计算二次方程的根的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用流程图和算法说明编写算法,以计算二次方程的根.

感谢您的想法!

Write the algorithm using a flow chart and the algorithm description for calculating the root of a quadratic equation.

Thanks for your ideas!

推荐答案

您到目前为止已经尝试了什么?这似乎是学校或大学的作业,假设您的老师或讲师也在阅读这些论坛.

您应该先在自己身边尝试一些事情,然后在遇到问题时提出问题.您必须尝试此处 [如何问一个好问题? [ ^ ]
What you have tried so far.? This seems like school or university assignment, assume that your teacher or lecturer is also reading these forums.

You should try something by your side first and then post question if you get stuck somewhere. You MUST try here[^] first.

Also refer How to ask a good question?[^]


开始于:

ax 2 + bx + c = 0

这两个可能的根由
给出
x 1 =(-b +(b 2 -4ac) 0.5 )/2a

x 2 =(-b-(b 2 -4ac) 0.5 )/2a

根据解决方案所在的域,您可能必须检查判别式小于0.判别式是平方根内的部分:b 2 -4ac.
如果解的域是实数 R ,则判别式小于零将意味着没有解.如果该域位于复数 C 的集合中,则即使判别式小于零,也将存在一个解决方案:

x 1 = -b/2a + J (| b 2 -4ac |) 0.5 /2a
x 2 = -b/2a- J (| b 2 -4ac |) 0.5 /2a

当判别式小于零时,二次方程的解始终是彼此的复共轭.

如果判别式为零x 1 = x 2 = -b/2a,则只有一个解.

现在剩下要做的就是输入系数a,b,c并进行计算.
我认为您不会觉得很难.试试看吧!

问候,

—曼弗雷德(Manfred)
Starting with:

ax2 + bx + c = 0

the two possible roots are given by

x1 = (-b + (b2 - 4ac)0.5) / 2a

x2 = (-b - (b2 - 4ac)0.5) / 2a

Depending on the domain in which the solution can lie, you might have to check the discriminant for being smaller than 0. The discriminant is the part inside the square root: b2 - 4ac.
If the domain of the solution are the real numbers R then the discriminant being less than zero will mean that there is no solution. Should the domain be in the set of complex numbers C a solution will exist even if the discriminant is less than zero:

x1 = -b/2a + J(|b2 - 4ac|)0.5/2a
x2 = -b/2a - J(|b2 - 4ac|)0.5/2a

Solutions of quadratic equations are always complex conjugates of each other when the discriminant is smaller than zero.

Should the discriminant be zero x1 = x2 = -b / 2a there is only one solution.

Now all that is left to do is input the coefficients a,b,c and do the calculations.
I don''t think you''ll find that too hard to do. Just give it a try!

Regards,

— Manfred


如果您知道如何手动解决(知道了,对吧?),那么您就有了算法.
If you know how to solve it manually (you know that, right?) then you have the algorithm.


这篇关于计算二次方程的根的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆