Given a string str which represents a polynomial and a number N, the task is to integrate this polynomial with respect to X at the given value N.
Input: str = “90x4 + 24x3 + 18x2 + 18x”, N = 1.
Given, dy/dx = 90*(X4) + 24* (X3) + 18* (X2) + 18*(X). On integrating this equation, we get 18*(X5) + 6*(X4) + 6*(X3) + 9*(X2) and substituting the value X = 1, we get:
18 + 6 + 6 + 9 = 39.
Input: str = “4x3 + 2x2 + 3x”, N = 2
Approach: The idea is to use the identity of the integration. For some given function X with the power of N, the integration of this term is given by:
Therefore, the following steps are followed to compute the answer:
- Get the string.
- Split the string and perform the integration based on the above formula.
- Substitute the value of N in the obtained expression.
- Add all the individual values to get the final integral value.
Below is the implementation of the above approach:
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Program to find the indefinite Integration of the given Polynomial
- Sgn value of a polynomial
- Content of a Polynomial
- Program to differentiate the given Polynomial
- Program for Derivative of a Polynomial
- Minimize the sum of roots of a given polynomial
- Complete the sequence generated by a polynomial
- Horner's Method for Polynomial Evaluation
- Finding nth term of any Polynomial Sequence
- Python | Finding Solutions of a Polynomial Equation
- String hashing using Polynomial rolling hash function
- Count of N digit Numbers having no pair of equal consecutive Digits
- Smallest String consisting of a String S exactly K times as a Substring
- Minimum Count of Bit flips required to make a Binary String Palindromic
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.