Advertisement
orneto

rungekutta

Jun 25th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4. float ed(float x, float y){
  5.  
  6. y=x-y+2; //insira aqui a função
  7. return (y);
  8. }
  9. float ds(float x, float y){
  10.  
  11. y=y-x-1; //insira aqui a função
  12. return (y);
  13. }
  14. int main(){
  15. float a=0, b=1, m=10, y0=2, h=(b-a/m), x=a, y=y0, yv[m];
  16. int i;
  17. for(i=0;i<m;i++){
  18. y = y+(h*ed(x,y))+h^2/2*ds(x,y);
  19. yv[i]=y;
  20. x=a+(i*h);
  21. }
  22. printf("%f", yv);
  23. return 0
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement