목차
없음
본문내용
e 5.3.8.a
y' = (y/t)-(y/t)^2 , for 1<=t<=2 with y(1)=1 and h=0.1
*/
#include
float f(float w, float t);
main(){
int i, N = 10;
float t, h=0.1;
float w[11];
w[0] = 1;
for(i=0 ; i
t = h*i +1;
w[i+1] = w[i]+ h*f(w[i]+1/2*h*f(w[i],t),t+1/2*h);
}
for(i=0 ; i<=N ; i++){
t = 1 + h*i;
printf("w(%1.1f) = %f\n",t,w[i]);
}
}
float f(float w, float t){
return (w/t)-(w/t)*(w/t);
}
Result
y' = (y/t)-(y/t)^2 , for 1<=t<=2 with y(1)=1 and h=0.1
*/
#include
float f(float w, float t);
main(){
int i, N = 10;
float t, h=0.1;
float w[11];
w[0] = 1;
for(i=0 ; i
w[i+1] = w[i]+ h*f(w[i]+1/2*h*f(w[i],t),t+1/2*h);
}
for(i=0 ; i<=N ; i++){
t = 1 + h*i;
printf("w(%1.1f) = %f\n",t,w[i]);
}
}
float f(float w, float t){
return (w/t)-(w/t)*(w/t);
}
Result
소개글