# Differential Equations on Octave

In this lesson, I will explain how to calculate a differential equation on Octave through a practical example.

**What do you need?** To follow this lesson, you must have already installed Symbolic on Octave.

Create the symbol of the function f(x) using the command **syms**.

syms y(x)

Now, write the differential equation y''(x)+y'(x)=0 in the variable eqz.

To write the derivatives, use the differentiation function **diff()**

eqz = diff(y,x,2) + diff(y,x,1) == 0

In the above command, the second derivative y''(x) is obtained with **diff(y,x,2)**, while the first derivative y'(x) is obtained with **diff(y,x,1)**.

To solve the differential equation, use the **dsolve()** function.

dsolve(eqz)

This function calculates and displays the **general solution of the differential equation**.

y(x) = c_{1} + c_{2} e^{-x}

With the diff() function in Octave, you can calculate the general solution of any homogeneous or non-homogeneous differential equation of any order.