//Eulers Method to solve a differential equation #include#include #include using namespace std; double df(double x, double y) //function for defining dy/dx { double a=x+y; //dy/dx=x+y return a; } int main() { int n; double x0,y0,x,y,h; //for initial values, width, etc. cout.precision(5); //for precision cout.setf(ios::fixed); cout<<"\nEnter the initial values of x and y respectively:\n"; //Initial values cin>>x0>>y0; cout<<"\nFor what value of x do you want to find the value of y\n"; cin>>x; cout<<"\nEnter the width of the sub-interval:\n"; //input width cin>>h; cout<<"x"< 0.0000001) //I couldn't just write "while(x0 Explanation of the Code:
I’m a physicist specializing in computational material science with a PhD in Physics from Friedrich-Schiller University Jena, Germany. I write efficient codes for simulating light-matter interactions at atomic scales. I like to develop Physics, DFT, and Machine Learning related apps and software from time to time. Can code in most of the popular languages. I like to share my knowledge in Physics and applications using this Blog and a YouTube channel.
[wpedon id="7041" align="center"]
Hello
My son teacher have told them to program a program in C++ which can solve non-homogenous problems in differential eq. I tried best to teach him but couldnt solve it
Can i have a program or tutorial?
Hi Sajjad,
I don’t have any experience with solving non-homogeneous equations numerically. One might proceed by finding the solution to the associated differential equation. Then the complimentary and the particular solution.
You might find the following link helpful.
http://tutorial.math.lamar.edu/Classes/DE/NonhomogeneousDE.aspx
Good Luck!
Hey ! Do you work as a freelancer? I need help with a project. Send me your email.