ldo regula

Regula Falsi方法 (Regula Falsi method)

About the method:

关于方法:

We often hear many children and even many adults complaining about the difficulty level that they face while solving complex polynomial equations. It is also difficult for many to follow the steps in a scientific calculator and find the roots of the equations.

我们经常听到许多儿童甚至许多成人抱怨他们在解决复杂的多项式方程式时面临的困难程度。 对于许多人来说,遵循科学计算器中的步骤并找到方程式的根源也是困难的。

Therefore, this is a program that would help engineering students and many shopkeepers, vendors to solve complex equations via the False Position method or the Regula Falsi method. It is also handy, easy and calculations need not be done.

因此,该程序可以帮助工程专业的学生以及许多店主,供应商通过False Position方法或Regula Falsi方法求解复杂的方程式。 它也方便,容易并且不需要进行计算。

Though this is an old method and not much used now it can be useful for those students who are willing to work on a complex project and on a difficult topic like this as they can create a better impression on their professors and fetch more marks. The method used is:

尽管这是一种古老的方法,但现在很少使用,但对于愿意从事复杂项目和类似难题的学生来说,它可能会很有用,因为他们可以给教授留下更好的印象并获得更多的分数。 使用的方法是

We start this procedure by locating two points x0 and x1 where the function has opposite signs. We now connect the two points f(x0) and f(x1) by a straight line and find where it cuts the x-axis. Let it cut the axis at x2. We find f(x2). If f(x2) and f(x0) are of opposite signs then we replace x1 by x2 and draw a straight line connecting f(x2) to f(x0) to find the new intersection point. If f(x2) and f(x0) are of the same sign then x0 is replaced by x2 and proceed as before. In both cases, the new interval of search is smaller than the initial interval and ultimately it is guaranteed to converge to the root.

我们通过定位函数具有相反符号的两个点x 0和x 1来开始此过程。 现在,我们通过一条直线连接两个点f(x 0 )和f(x 1 ),并找到它在x轴上的切割位置。 让它在x 2处切割轴。 我们找到f(x 2 )。 如果f(x 2 )和f(x 0 )具有相反的符号,则我们将x 1替换为x 2并绘制一条将f(x 2 )连接到f(x 0 )的直线以找到新的交点。 如果f(x 2 )和f(x 0 )具有相同的符号,则将x 0替换为x 2并像以前一样进行。 在这两种情况下,新的搜索间隔都小于初始间隔,并最终保证了收敛到根。

We will now get an equation to find the successive approximations to the root:

现在,我们将得到一个方程式,以求根的逐次逼近:

Problem:

问题:

To find the roots of the given polynomial equation using the Regula Falsi method. Here, we take the equation in the form of f(x) = ax2+ bx+c if the equation is a quadratic equation.

使用Regula Falsi方法查找给定多项式方程的根。 在这里,如果方程是二次方程,则采用f(x)= a x 2 + b x + c的形式。

Example: f(x) = x2-25

例如:f(x)= x 2 -25

In this method, we need to assume 2 numbers which might be the roots of the equation by equating the equation f(x) to zero {f(x) = 0}. If the actual roots do not lie between or are near to the assumed values, the program will not run. And if the actual roots lie between the assumed values then the program will give the approximate of exact answer.

在此方法中,我们需要通过将方程f(x)等于零{f(x)= 0}来假设2个数字可能是方程的根。 如果实际根不在假设值之间或附近,则程序将不会运行。 如果实际根位于假设值之间,则程序将给出精确答案的近似值。

.minHeight{ min-height: 250px; } @media (min-width: 1025px){ .minHeight{ min-height: 90px; } } .minHeight{ min-height: 250px; } @media (min-width: 1025px){ .minHeight{ min-height: 90px; } }

Example/program:

示例/程序:

#include <stdio.h>
#include <math.h>
#define ep 0.001
float poly(float ar[], int, float);
int main()
{float a[10],y0,y1,y2,x0,x1,x2,s,r;
int i,n;
char flag;
printf("\t\t\t*****REGULA FALSI METHOD*****");
//enter 2 if it is quadratic eq.
printf ("\n\n Please enter the degree of polynomial equation: ");
scanf ("%d", &n);
if (n>1)
{for (i=0;i<=n; i++)
{printf ("Enter the coefficient of x to the power %d: ", i);
scanf ("%f", &a[i]);
}
do
{//enter assumed values of roots
printf ("\n Enter the initial guesses of x0 and x1: ");
scanf ("%f %f",&x0,&x1);
y0=poly (a, n, x0);
y1=poly (a, n, x1);
} while (y0*y1>0);
printf ("\n x0           x1           x2          y0           y1           y2");
for (i=0; i<=100; i++)
{s= (x0*y1)-(y0*x1);
r= y1-y0;
x2 = s/r;
y2 = poly (a, n, x2);
if (fabs (y2)<= ep)
{flag ='T';
break;
}
printf("\n %f    %f    %f    %f   %f    %f",x0,x1,x2,y0,y1,y2);
if ((y2*y0)<0)
{x1=x2;
y1=y2;
}
else
{x0=x2;
y0=y2;
}
}
if(flag=='T')
printf("\n\n Convergent solution= %f",x2);
else
printf("Does not converge in 100 iterations.");
}
else
{printf("\n\tDegree not acceptable!");
}
return 0;
}
float poly(float ar[],int n,float x)
{int i;
float p;
p=ar[n];
for(i=n;i>=1;i--)
{p=ar[i-1]+(x*p);
}
return (p);
}

Output:

输出:

翻译自: https://www.includehelp.com/algorithms/find-the-roots-of-a-complex-polynomial-equation-using-regula-falsi-method-in-c.aspx

ldo regula

ldo regula_使用C中的Regula Falsi方法找到复多项式方程的根相关推荐

  1. stream map方法_Java Stream中map和flatMap方法

    最近看到一篇讲stream语法的文章,学习Java中map()和flatMap()方法之间的区别. 虽然看起来这两种方法都做同样的事情,都是做的映射操作,但实际上差之毫厘谬以千里. 通过演示Demo中 ...

  2. java中json重复数据结构_JS实现去除数组中重复json的方法示例

    本文实例讲述了JS实现去除数组中重复json的方法.分享给大家供大家参考,具体如下: var array = [{"name":"123"},{"na ...

  3. 继承实现的原理、子类中调用父类的方法、封装

    一.继承实现的原来 1.继承顺序 Python的类可以继承多个类.继承多个类的时候,其属性的寻找的方法有两种,分别是深度优先和广度优先. 如下的结构,新式类和经典类的属性查找顺序都一致.顺序为D--- ...

  4. 浅谈在ASP.NET中数据有效性校验的方法

    作者:未知 作为一名程序员,一定要对自己编写的程序的健壮性负责,因此数据的校验无论在商业逻辑还是系统实现都是必不可少的部分. 我这里总结了一种自认为比较不错的asp.net(C#)的数据校验方法,如大 ...

  5. JavaScript文件中调用AngularJS内部方法或改变$scope变量

    需要在其他JavaScript文件中调用AngularJS内部方法或改变$scope变量,同时还要保持双向数据绑定: 首先获取AngularJS application: 方法一:通过controll ...

  6. D3D中简单的截图方法 (转)

    [ZT]D3D中简单的截图方法 试了下,果然可以. 在渲染完所有东东后(Present之前) 获得BackBuffer表面 然后用D3DX的函数保存 void ScreenShot (char *fi ...

  7. hibernate4中取得connection的方法

    在hibernate3中,使用了c3p0连接池,尝试了多种办法取得connection对象,以下两种可以使用. Java代码  Connection conn; // 方法1:hibernate4中将 ...

  8. c#中接口的使用方法图解_C#图解教程 第十五章 接口

    接口 什么是接口 接口是指定一组函数成员而不实现它们的引用类型.所以只能类和结构来实现接口. 这种描述比较抽象,直接来看个示例. 下例中,Main方法创建并初始化了一个CA类的对象,并将该对象传递给P ...

  9. 你还在 Java 代码中写 set/get 方法?赶快试试这款插件吧!

    点击上方"方志朋",选择"设为星标" 回复"666"获取新整理的面试文章 作者:Mr.ml https://blog.csdn.net/Ma ...

最新文章

  1. 转- prototype
  2. aliyun 日志服务(Log Service,Log)是针对日志场景的一站式服务
  3. 【S操作】冰箱正常运行监控系统需求整理
  4. HASHSET不能预留容量问题
  5. navicat连接本地MySQL8.0.19报1251错误的解决办法
  6. URL与URI的不同
  7. 【Linux系统编程学习】 文件描述符
  8. 信息学奥赛一本通(1092:求出e的值)
  9. 吴恩达深度学习 —— 2.4 梯度下降
  10. java 16进制_JAVA十六进制数据接收与传输
  11. 夜班工作有哪些优缺点?
  12. java 读取mysql数据库_原生Java操作mysql数据库过程解析
  13. Markdown 调整图片位置与大小
  14. 慕课软件质量保证与测试(第九章.课后作业)
  15. Android color.xml设置透明度
  16. Kubesphere应用商店
  17. guzzlehttp resulted in a `409 Conflict` response 访问网址 laravel thinkphp
  18. 仅3w报价B站up主竟带来1200w播放!品牌高性价比B站投放标杆!
  19. Tomcat服务器端口修改
  20. 车载以太网技术(一)

热门文章

  1. linux grub rescue 光盘,Ubuntu9.10用安装光盘如何进入linux rescue方式?
  2. python四级中考有用的_一位中考生家长的后悔药:考前30多天,千万别做这7件傻事...
  3. linux非标准头文件,Linux学习:unix的标准化的实现(Linux中各种限制-数据类型-各种标准化头文件介绍)...
  4. mysql核心参数_MySQL技术体系之核心参数
  5. MySQL(8)存储过程和函数
  6. JDK源码解析之 java.lang.Throwable
  7. spring cloud eureka服务注册和调用
  8. eclipse快捷键、智能提示
  9. 30岁之前需要知道的10个人生底线,你知道几个?
  10. SCOM 2012知识分享-9:配置警报解决状态