/* Improved Eulers method implementation in CPP Language----- Md. Alamgir Hossain Department of Computer Science & Engineering. Jessore University of Science & Technology, Bangladesh. Email : alamgir.cse14.just@gmail.com */ #include<bits/stdc++.h> using namespace std; double equation(double x, double y) { ///Here enter the right side of your differential equation--- ///Some example of equation in the res variable-- ///You can check with your desired equation ///From here remove comment and check for another equation... double res; ///Equation start // res = (3*x*x)+1; //res = (x*x)+(y*y); res = x*y; // res = y+(x*x); // res = ((2*y)/x)+(x*x*x); //res = y-((2*x)/y); return res; } int main() { double x0,y0,h; cout<<"Enter the value of X0 : "; cin>>x0; cout<<"Enter the value of Y0 : "; cin>>y0; cout<<"Enter the value of h : "; cin>>h; int n; cout<<"Enter how many y you wants : "; cin>>n; cout<<"\nSerial----X----------Y-----------------------------------------------------\n"; cout<<"Y(1) "<<x0<<" "<<y0<<"\n"; cout<<"----------------------------------------------------------------------------\n"; for(int i=0;i<n-1;i++){ double x,y,y1,y2; x = x0+h; y1 = equation(x0,y0); y2 = equation(x0+h,y0+(h*equation(x0,y0))); y = y0+h*((y1+y2)/2); cout<<"Y("<<i+2<<")"<<" "<<x<<" "<<y<<"\n"; cout<<"---------------------------------------------------------------------------\n"; x0 = x; y0 = y; } return 0; } /* Input Example---For the Equation y' = (x*y); Enter the value of X0 : 1 Enter the value of Y0 : 1 Enter the value of h : .1 Enter how many y you wants : 10 Serial----X----------Y------------------------------------------------------ Y(1) 1 1 ---------------------------------------------------------------------------- Y(2) 1.1 1.1105 --------------------------------------------------------------------------- Y(3) 1.2 1.24554 --------------------------------------------------------------------------- Y(4) 1.3 1.41094 --------------------------------------------------------------------------- Y(5) 1.4 1.61426 --------------------------------------------------------------------------- Y(6) 1.5 1.86528 --------------------------------------------------------------------------- Y(7) 1.6 2.17678 --------------------------------------------------------------------------- Y(8) 1.7 2.56555 --------------------------------------------------------------------------- Y(9) 1.8 3.05378 --------------------------------------------------------------------------- Y(10) 1.9 3.67095 --------------------------------------------------------------------------- */
Improved Eulers method implementation in CPP Language
Click any Bellow Tabs/Tags
Alamgir-Hossain
(14)
Algorithms
(5)
Android problem
(2)
ANN
(1)
ArticleWriting
(26)
Artificial Intelligence
(1)
Assembly
(1)
Bangla Love Poem
(3)
Bangla Poem
(2)
best programming solution
(9)
Books
(2)
BUET IICT MSC Admission
-2021
(1)
C
(49)
Campus
(7)
CPP
(88)
Database
(4)
Differences
(2)
Fishing
(1)
HSC
(1)
Html
(4)
interesting programming solution
(9)
Interview
(2)
It job preparation
(7)
JAVA
(97)
JavaScript
(5)
JSON
(1)
lead generation
(1)
machine learning
(2)
ML Projects
(3)
NewsPaper
(19)
Others
(13)
Perl
(23)
Php
(4)
Poem
(4)
Presentation
(1)
ProblemSolving
(3)
Project
(21)
Prolog
(13)
Python
(33)
research
(18)
Research Tool
(1)
Security
(3)
Social Engineering
(1)
Testimonials
(5)
Tutorial
(2)
Writings
(15)
XML
(1)
YoutubeSEO
(1)
উক্তি
(1)
কবিতা-আলগীর হোসেন
(2)
লেখনী
(33)
LATEST
3-latest-65px
Popular Posts
-
All instructions for connection & insert data in mysql from java JSP and Servlet using tomcat serverFrom this tutorial you can learn about... All instructions for connection & insert data in mysql from java JSP and Servlet using tomc...
-
% Prolog program for addition and multplication-------- % Alamgir Hossain % CSE, JUST go :- write ( 'Enter first number : ' ...
-
Inverse Lagrange’s Interpolation Formula Theory : . Example : 1. Use Lagrange’s inverse interpolation fo...
-
Project Name : Online examination system. Framework : MVC framework in java(3 layer architecture). Language: JAVA JSP, SERVLET, JS...
-
Here is the source code for online exam system using PHP, MYSQL,AJAX, JAVASCRIPT etc.... Source code for Online Exam System
No comments:
Post a Comment