from sympy import *
from sympy.solvers.solveset import solveset
init_printing()

"""
Explanation: Solvers
End of explanation
"""


a, b, c, d, x, y, z, t = symbols('a b c d x y z t')
f, g, h = symbols('f g h', cls=Function)

"""
Explanation: For each exercise, fill in the function according to its docstring.
End of explanation
"""


def quadratic():
    return solveset(a*x**2 + b*x + c, x)
quadratic()

"""
Explanation: Algebraic Equations
Write a function that computes the quadratic equation.
End of explanation
"""


def cubic():
    return solveset(x**3 + a*x**2 + b*x + c, x)
cubic()

"""
Explanation: Write a function that computes the general solution to the cubic $x^3 + ax^2 + bx + c$.
End of explanation
"""


dsolve(f(t).diff(t) - a*f(t), f(t))

"""
Explanation: Differential Equations
A population that grows without bound is modeled by the differential equation
$$f'(t)=af(t)$$
Solve this differential equation using SymPy.
End of explanation
"""


dsolve(f(t).diff(t) - f(t)*(1 - f(t)), f(t))

"""
Explanation: If the population growth is bounded, it is modeled by 
$$f'(t) = f(t)(1 - f(t))$$
Solve this differential equation using SymPy.
End of explanation
"""


