수치해석 연습문제 풀이 1장
- 최초 등록일
- 2009.07.02
- 최종 저작일
- 2009.07
- 14페이지/ MS 워드
- 가격 2,000원
소개글
한양대학교 기계공학부 수치해석 연습문제 풀이입니다
목차
없음
본문내용
문제1.아래 함수의 도함수를 주어진 점들에 대하여 도함수의 정의를 이용하여 소수점 5째 짜리 까지 정확히 구하여라.
풀이
점 에서 의 도함수는 다음과 같이 정의 된다.
도함수의 정의에따라 를 감소시키며 허용 오차범위(소수점5째 자리)를 만족할 때까지 수치적으로 계산 하였다. 허용오차 한계는 Scarborough 가 제안한 방법을 적용하여 다음 식을 만족할 때까지 계산하였다.
여기서 참값 을 알지 못하므로 현재의 값을 참값으로 보고 이 값과 를 줄이기전의 값을 비교하여 계산하였다.
다음은 C로 작성한 프로그램 소스이다.
//Calculate Slope Program by Buyeol 2001//
#include <iostream.h>
#include <fstream.h>
#include <math.h>
#include <stdio.h>
#define pi 3.141592
/*Private function prototypes*/
double function(double x);
/*Main program*/
void main()
{
double error_range=0.5*pow(10,-5); //error range,down to 5 places of decimals
double error=0; //Error Value
double Fprime_Old=0; //Old slope value
double Fprime=0; //Calculated slope value
double h=1.0; //delta h
double x=pi/4.0;
FILE *fout;
//Open output file and write some string
fout=fopen("Output.txt","w");
fprintf(fout," Slope of function Y=e^x*sinx+(cosx)^2 at X=%10.8f\n\n",x);
//Calculating slope value until satisfy err
참고 자료
없음