Symbolic Math Toolbox 

This example shows how to solve algebraic and differential equations using Symbolic Math Toolbox.
The solve function can handle a wide variety of algebraic equations, including both single equations and systems of equations. By default, the solver always tries to return a complete set of solutions, including complex solutions and multiple branches. For example, the following polynomial has two real and two complex solutions.
solve(x^4 + x^3  x = 1, x)
The Real option lets you omit complex solutions and return only real ones:
solve(x^4 + x^3  x = 1, x, Real)
By default, the solve function returns a very complete solution that takes into account all edge case situations.In situations where you know these edge cases will not occur, you can specify the IgnoreAnalyticConstraints option.This option switches the solver to a less strict mode of computation, and is very useful if you want to get a simpler solution that is typically valid but potentially incomplete for unlikely edge case situations.You can solve the same equation with and without this option to see the difference.
solve(ln(y) + ln(x + 1) = 1, y)
solve(ln(y) + ln(x + 1) = 1, y, IgnoreAnalyticConstraints)
Some equations, such as those that include trigonometric elements, have an infinite number of solutions. For such equations, the solver returns the solution in the form of membership.
solve(sin(x) = 1, x)
To get only one solution from the set, you can use the PrincipalValue option.
solve(sin(x) = 1, x, PrincipalValue)
The solve function can also be used to solve systems of equations. Simply specify the system of equations and the variables to solve for.
solve([y + x^2 = 1, x  y = 10], [x, y], VectorFormat)
As with an individual equation, if a system has an infinite number of solutions, the solver returns the solution in the form of membership.
solve([exp(x + y) = 1, x  y = 1], [x, y], VectorFormat)
In some cases, you may be able to express the system of equations in matrix form, .For these cases, you can use the linalg::matlinsolve function to solve the equations.
A := matrix(2, 2, [1, 2, 3, 4]):
b := matrix(2, 1, [5, 6]):
x := linalg::matlinsolve(A, b)
You can solve various types of ordinary differential equations using the standard solve function (i.e. the same function that is used to solve algebraic equations) or the ode::solve function. If you use the standard solve function, you must first define your equation as an ODE.The same underlying algorithm is used regardless of which approach you choose.
You can solve a simple 2nd order linear ODE using the standard solve function.
eqn := ode(y''(t) + y'(t) + y(t) = 0, y(t))
solve(eqn)
You can solve the same equation using the ode::solve function, which does not require you to declare the equation as an ODE.
ode::solve(y''(t) + y'(t) + y(t) = 0, y(t))
You can specify initial conditions and boundary conditions along with an ODE, which is often critical for real world problems in engineering and physics.
f := ode::solve({y''(t) = 2*t/y'(t), y(0) = 0, y'(0) = 1}, y(t))
You can visualize the solution to your differential equation using the plot function.Because the solver returns the result as a set, you must extract the solution from the set using brackets.
plot(f[1])