Summarize the method of undetermined coefficients Do you thi
Summarize the method of undetermined coefficients. Do you think it would be possible to write a computer program to evaluate the undetermined coefficients so that one could simply enter into a computer a certain differential equation and the computer would print out the solution?
Solution
The method of undetermined coefficients is a technique to finding a particular solution to linear constant-coefficient differential equations and recurrence relations.If the nonhomogeneous equation f( x) in the second order general nonhomogeneous differential equation , then the method of undetermined coefficients can be used to obtain a particular solution
Progrm to evluate undetermined coefficients:
#include <stdio.h>
 #include <stdlib.h>
 #define MAXSIZE 10
 
 void main()
 {
 int arr[MAXSIZE];
 int i, num, power;
 float x, Sum;
 
 printf(\"Enter order for the polynomial \ \");
 scanf(\"%d\", &num);
 printf(\"Enter the value of x \ \");
 scanf(\"%f\", &x);
 printf(\"Enter %d coefficients \ \", num + 1);
 for (i = 0; i <= num; i++)
 {
 scanf(\"%d\", &arr[i]);
 }
 Sum = arr[0];
 for (i = 1; i <= num; i++)
 {
 Sum = Sum * x + arr[i];
 }
 power = num;
 
 printf(\"Ploynomial generated: \ \");
 for (i = 0; i <= num; i++)
 {
 if (power < 0)
 {
 break;
 }
 if (arr[i] > 0)
 printf(\" + \");
 else if (arr[i] < 0)
 printf(\" - \");
 else
 printf(\" \");
 printf(\"%dx^%d \", abs(arr[i]), power--);
 }
 printf(\"\  Total sum of polynomial afer evaluation = %6.2f \ \", Sum);
 }

