Subscribe Us

Responsive Advertisement

Advertisement

12.Eular method

 


12.Eular method

by ujjal roy


//dy/dx=x+y;

#include<bits/stdc++.h>

using namespace std;

double f(double x,double y)

{

    return x+y;

}

int main()

{

    double x0,y0,x,y,h;

    cout<<"Enter X0 and Y0 : ";

    cin>>x0>>y0;

    cout<<"Enter X : ";

    cin>>x;

    h=(x-x0)/5.0;

    for(int i=0;i<5;i++)

    {

        y=y0+h*f(x0,y0);

        y0=y;

        x0=x0+h;


    }

    cout<<y<<endl;




    return 0;

}


Post a Comment

0 Comments