Disclosure: This post may contain affiliate links, meaning when you click the links and make a purchase, we receive a commission.

How to Solve Differential Equation in Excel (With Easy Steps)

Microsoft Excel is a powerful tool that can perform different mathematical operations. In this article, we will learn to solve a differential equation in Excel. A differential equation defines the relationship between one or more functions and their derivatives. Today, we will show step-by-step procedures to solve a differential equation in Excel. Using these steps, you can easily solve any differential equation in Excel. So, without any delay, let’s start the discussion.


Download Practice Book

You can download the practice book from here.


What Is Differential Equation?

A differential equation is an equation that contains one or more functions and the derivatives of one variable with respect to another variable. The differential equation can be written as:

dy/dx=f(x)

We have different order differential equations. The highest order of the derivative is called the order of the differential equation. Differential equations are mainly used to calculate growth and decay over time. Also, these equations are used to create different models. We can also see a huge application of differential equations in the field of physics.


Step-by-Step Procedures to Solve Differential Equation in Excel

Today, we will demonstrate the procedures to solve a first-order differential equation using Euler’s method in Excel. Let’s take a look at the question we will be solving today.

Suppose, we have a differential equation dy/dt+y=t and an initial value y(0)=0.5. So, the equation can be written as dy/dt = t-y. We need to compute the yvalues in a time interval (0,1.2). Let’s follow the steps below to see how we can solve the differential equation.


STEP 1: Create Dataset

  • First of all, we need to create a dataset to insert the iteration number (n), time value (t), y value, yexact value, and delta_t.
  • The delta_t is the separation value.
  • Also, you can display the equations to find the t(n+1) and y(n+1) values. We will implement these equations in the following sections.
  • We have also added the time interval and initial value to make the calculation easy.

Step-by-Step Procedures to Solve Differential Equation in Excel


STEP 2: Apply Formula for Time Values & Y-values

  • Secondly, we will apply formulas to calculate the time values and y-values.
  • At the start of the iteration, n is 0, t is 0, and y is 5.
  • Now, insert these values in Cells B5, C5, and D5 respectively.

Step-by-Step Procedures to Solve Differential Equation in Excel

  • After that, we will insert a formula to calculate the t-values.
  • To do so, select Cell C6 and type the formula below:
=C5+$G$5
  • Press Enter.

Step-by-Step Procedures to Solve Differential Equation in Excel

  • In the following step, we will find the y-values.
  • So, select Cell D6 and type the formula below:
=D5+(C5-D5)*$G$5
  • Press Enter to see the result.

Step-by-Step Procedures to Solve Differential Equation in Excel

Read More: How to Solve an Equation for X When Y is Given in Excel


STEP 3: Fill Columns

  • In the third step, we will fill the values of the n, t, and columns.
  • First of all, we will fill the iteration number (n) column.
  • To find the number of iterations, we need to divide the time interval by the delta_t value.
  • In our case, iteration number (n) = (2/0.1) = 12.
  • So, we need to fill the iteration column from 0 to 12.

Step-by-Step Procedures to Solve Differential Equation in Excel

  • After that, select both Cells C6 & D6 and drag the Fill Handle down.

Step-by-Step Procedures to Solve Differential Equation in Excel

  • Finally, you will get all the t and yvalues.

Step-by-Step Procedures to Solve Differential Equation in Excel


Similar Readings


STEP 4: Plot Data

  • At this moment, we need to plot the t and yvalues.
  • For that purpose, select the range C4:D17.

Step-by-Step Procedures to Solve Differential Equation in Excel

  • After that, go to the Insert tab and click on the Insert Scatter icon. A drop-down menu will appear.
  • Select Scatter with Lines from there.

Step-by-Step Procedures to Solve Differential Equation in Excel

  • As a result, you will see a chart on the sheet.
  • You can change the chart title according to your preferences.

Step-by-Step Procedures to Solve Differential Equation in Excel


STEP 5: Format Axis

  • In step 5, we will format the axis of the graph.
  • To do so, doubleclick on the horizontal axis. It will open the Format Axis options on the right side of the sheet.
  • Set the Minimum value to 0 and Maximum value to 1.2 in the Bounds section and press Enter to proceed.

Step-by-Step Procedures to Solve Differential Equation in Excel

  • Similarly, doubleclick on the vertical axis.
  • Then, set the Minimum value to 0.3 and Maximum value to 0.65 in the Bounds section and press Enter to proceed.

Step-by-Step Procedures to Solve Differential Equation in Excel

  • As a result, the graph will look like the picture below.

Step-by-Step Procedures to Solve Differential Equation in Excel


STEP 6: Find Exact Solution

  • Now, we will calculate the exact solution of the differential equation and match it with the numerical values.
  • In our case, the exact solution of the differential equation is y = -1 + t + 1.5*exp(-t).
  • So, select Cell E5 and type the formula below:
=-1+C5+1.5*EXP(-C5)

Step-by-Step Procedures to Solve Differential Equation in Excel

  • After that, press Enter and drag the Fill Handle down.

Step-by-Step Procedures to Solve Differential Equation in Excel

  • Finally, you will know the y-values of the exact solution.

Read More: How to Solve Algebraic Equations with Multiple Variables (3 Ways)


STEP 7: Plot Exact Solution on Same Chart

  • To compare the y-values of the exact solution with the numerical values, we need to plot them on the same chart.
  • To do so, rightclick on the chart to open the menu.
  • Click on the Select Data option.

  • In the Select Data Source dialog box, click on Add.

  • Now, insert the Series X and Y values in the Edit Series box.

  • Finally, click OK to get the plot of the exact solution.

Read More: How to Solve For x in Excel (2 Simple Ways)


Final Output

  • Finally, if we change the delta_t value in Cell G5, then the whole dataset will automatically update and show the solution for the updated delta_t value.

  • Furthermore, the graphs will also update automatically.


Conclusion

In this article, we have discussed step-by-step procedures to Solve a Differential Equation in Excel. I hope this article will help you to perform your tasks efficiently. Furthermore, we have also added the practice book at the beginning of the article. To test your skills, you can download it to exercise. Also, you can visit the ExcelDemy website for more articles like this. Lastly, if you have any suggestions or queries, feel free to ask in the comment section below.


Related Articles

Mursalin

Mursalin

Hi there! This is Mursalin. I am an Excel and VBA content developer at ExcelDemy. I am always motivated to gather knowledge from different sources and find solutions to problems in easier ways. I am currently working and doing research on Microsoft Excel. Here I will be posting articles related to Microsoft Excel.

We will be happy to hear your thoughts

Leave a reply

ExcelDemy
Logo