Of the two methods, eval is more flexible (especially when dealing with a set of solutions), and will be used in the rest of the examples in this section. To find the value of y at a particular value of x or to graph the solution, you can use either the rhs function or the eval(expression, equations) command to assign the right-hand side of the solution to a variable. It returns 0 if the solution satisfies the ODEs. The odetest function takes the symbolic solution from dsolve and your ODEs as parameters. Test your solution with the odetest function. īasicODE ≔ diff y x, x = a ⋅ y x, y 0 = 5 īasicODE ≔ &DifferentialD &DifferentialD x y x = a y x, y 0 = 5īasicSolution ≔ y x = 5 &ExponentialE a x
The following expression finds a solution that satisfies the condition y = 5 when x = 0. To find the constant for a particular solution, include an initial value equation with the ODE in a set or list and then pass the set / list to dsolve. Terms of the form _Cn (where n is an integer) are constants of integration.īasicSolution ≔ y x = _C1 &ExponentialE a x The result is an equation that satisfies the ODE. Here, we assign the result to a variable called basicSolution. Use dsolve(basicODE) to find the solution. ĭefine a variable called basicODE and set it equal to the ODE.īasicODE ≔ diff y x, x = a ⋅ y x īasicODE ≔ &DifferentialD &DifferentialD x y x = a y x
#Prey 1.3.9 how to#
The following example shows how to find a symbolic solution to the ODE &DifferentialD &DifferentialD x y = a ⋅ y. Solving a Linear Two-Point BVP for a Second-order ODE Taking Derivatives and Integrals of Symbolic Solutions After you have a symbolic solution, you can assign it to a variable so that you can evaluate and graph it. The default behavior of dsolve is to find a symbolic solution for your ODE. The examples in each section are arranged from simple to more complex.įinally, if you do not find the information you are looking for in this topic, the Additional Resources section contains links to other pages that go into more detail about solving ODEs. This topic contains separate sections on how to find symbolic and numeric solutions since the techniques for solving those problems differ slightly. If you need to find derivatives or integrals of your solution, you should include equations for the derivatives and integrals in your system of ODEs. Most ODEs can be solved numerically even if they don't have a symbolic solution. Since they are integrated numerically, numeric solutions are approximations. Numeric solutions return a procedure that integrates your ODEs.
However, if you are taking an introductory course in ODEs, it is most likely that you'll be interested in finding symbolic solutions. Note that not every ODE or system of ODEs has a symbolic solution. These solutions are exact and can be easily manipulated to find, for example, a value at a point, a derivative of the solution, or an integral of the solution.
Symbolic solutions return equations that contains your independent variables. Unless noted otherwise, each example goes through the following steps:Īssigning the solutions to names (thus making them easier to plot and investigate).īefore you start looking at the examples on this page, you should consider what type of solution you need: symbolic or numeric. This topic introduces you to the commands and techniques used to solve ordinary differential equations (ODEs) in Maple.