Use python code to solve IVP. Code must print both general and particular solutions. Please paste full python code for your answer. IVP: y′=(5x^2)(y^2)+(125x^2), y(−7π)=10
Below is an example of code for the problem 7x″−3x′−57x=0, x(2π)=9, x′(−π)=5exp(3) :
from sympy import *
y = symbols('y')
x = Function('x')
x = dsolve(7*diff(x(y),y,2)-3*diff(x(y),y)-57*x(y),x(y))
print('The general solution is: ',x,'.',sep='')
x = x.rhs
xp = diff(x,y)
y0, y0p = 2*pi, -pi
x0, x0p = 9, 5*exp(3)
x0LHS, x0pLHS = x.subs(y,y0) - x0, xp.subs(y,y0p) - x0p
C1, C2 = symbols('C1 C2')
C = solve([x0LHS,x0pLHS],[C1,C2])
print('The particular solution is: x =
',x.subs(C).evalf(),'.',sep='')
Get Answers For Free
Most questions answered within 1 hours.