수치해석2
- 최초 등록일
- 2000.09.21
- 최종 저작일
- 2000.09
- 2페이지/ 실행파일
- 가격 10,000원
목차
문제 1 다음 방정식의 가장 작은 양의 근을 도식적으로 추정하고, 2분법으로 방정식의 근을 유효숫자 3자리까지 정확히 계산하라.
본문내용
(a) e-x - cosx = 0
/* Problem 1-(a) by bisection method */
#include <stdio.h>
#include <math.h>
float fn(float X); /* supposed function define */
float error(float Xnew,float Xold); /* error percent function define */
main()
{
float x1=1.0,x2=1.5,x3new=0.,x3old=0.,fn1=0.,fn2=0.,fn3=0. ;
/* define of a variable */
x3new = (x1+x2)/2. ; /* average value by bisection method */
fn1 = fn(x1) ; /* function value of x1 */
fn2 = fn(x2) ; /* function value of x2 */
fn3 = fn(x3new) ; /* function value of the x3new */
printf("x1 fn1 x2 fn2 x3 fn3 error%\n");
while( error(x3new,x3old) > 0.05 ) /* limited error percent */
{
x3old = x3new ; /* insert from new x3value to old x3value */
if( fn1*fn3 > 0 ) /* compare function1 with function3 */
참고 자료
없음