IGNOU BCSL-058-Computer Oriented Numerical Techniques Lab, Latest Solved Assignment (July 2023 - January 2024 )

ignoustudymentor.com

Q5. Write a C/C++ program that approximates the solution of the initial value problem: y’ = f(t, y) with y(a) =y0over[a, b] using Euler’s method. Using the program approximate the solution of the initial value problem: y’ = -2ty^2 withy(0) =1

Sol)
#include <stdio.h>

// Define the function f(t, y) = -2ty^2
   double f(double t, double y) {
       return -2 * t * y * y;
}

// Euler’s method for solving the initial value problem void eulerMethod(double a, double b, double h, double y0) {
      double t = a;
      double y = y0;

      printf(“t = %lf, y = %lf\n”, t, y);

     while (t < b) {
             y = y + h * f(t, y);
             t = t + h;
             printf(“t = %lf, y = %lf\n”, t, y);
         }
     }

int main() {
double a = 0.0;           // Initial value of t (a) 
double b = 1.0;         // Final value of t (b)
double h = 0.1;        // Step size
double y0 = 1.0;     // Initial value of y (y(a))

printf(“Approximate solution using Euler’s method:\n”);
eulerMethod(a, b, h, y0);

return 0;
}

ignoustudymentor.com

BCSL-058

Handwriting Assignment

BCSL-058

Other Questions With Answers

Other Subjects

Click Here

Assignment Submission Last Date

The IGNOU open learning format requires students to submit study Assignments. Here is the final end date of the submission of this particular assignment according to the university calendar.

30th April (if Enrolled in the June Exams)

31st October (if Enrolled in the December Exams)

Student Quick Services

error: Content is protected !!