How to Solve a First-Order Differential Equation in Excel (Easy Steps)

Understanding Differential Equations

  • A differential equation relates one or more functions to their derivatives with respect to an independent variable.
  • The highest order of the derivative determines the order of the differential equation.
  • Differential equations are used to model growth, decay, and various phenomena, including physics applications.

Problem Statement

  • Given the differential equation:

    dy/dx=f(x)
  • Initial condition:

  • We want to compute the values of

    in the time interval

    .


STEP 1 – Create a Dataset

  • 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.
  • Display the equations to find the t(n+1) and y(n+1) values.
  • Add the time interval and initial value to make the calculation easy.

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


STEP 2 – Apply the Formula for Time Values & Y-values

  • 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.
  • Insert these values in Cells B5, C5, and D5 respectively.

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

  • Insert a formula to calculate the t-values.
  • Select Cell C6 and enter the formula below:
=C5+$G$5
  • Press Enter.

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

  • To find the y-values:
    • Select Cell D6 and enter the formula below:
=D5+(C5-D5)*$G$5
    • Press Enter to see the result.

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


STEP 3 – Fill the Columns

  • To fill the values in the n, t, and columns:
    • To find the number of iterations (n), divide the time interval by the delta_t value.
    • In this problem statement the iteration number (n) = (2/0.1) = 12.
    • Fill the iteration column from 0 to 12.

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

    • Select both Cells C6 & D6 and drag the Fill Handle down.

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

    • The t and yvalues have been calculated.

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


STEP 4 – Plot the Data

  • To plot the t and yvalues, select the range C4:D17.

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

  • Go to the Insert tab and click on the Insert Scatter icon. A drop-down menu will appear.
  • Select Scatter with Lines.

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

  • As a result, a chart will display on the sheet.
  • Change the chart title according to your preferences.

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


STEP 5 – Format Axis

  • To format the axis of the graph:
    • 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.
    • Press Enter.

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

    • Doubleclick on the vertical axis.
    • Set the Minimum value to 0.3 and Maximum value to 0.65 in the Bounds section.
    • Press Enter.

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

  • The graph will look like the picture below:

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 6 – Find the Exact Solution

  • The exact solution of the differential equation is y = -1 + t + 1.5*exp(-t).
  • Select Cell E5 and enter the formula below:
=-1+C5+1.5*EXP(-C5)

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

  • Press Enter and drag the Fill Handle down.

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

  • The y-values of the exact solution have been calculated.


STEP 7 – Plot the Exact Solution on the Same Chart

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

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

  • Insert the Series X and Y values in the Edit Series box.

  • Click OK to get the plot of the exact solution.

Read More: How to Solve 2 Equations with 2 Unknowns in Excel


Final Output

  • If the delta_t value in Cell G5 is changed, the whole dataset will automatically update and show the solution for the updated delta_t value.

  • The graphs will also update automatically.

Read More: How to Solve Polynomial Equation in Excel


Download Practice Book

You can download the practice workbook from here:


Related Articles


<< Go Back to Excel Solve Equation | Excel Solver Examples | Solver in Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Mursalin Ibne Salehin
Mursalin Ibne Salehin

Mursalin Ibne Salehin holds a BSc in Electrical and Electronics Engineering from Bangladesh University of Engineering and Technology. Over the past 2 years, he has actively contributed to the ExcelDemy project, where he authored over 150 articles. He has also led a team with content development works. Currently, he is working as a Reviewer in the ExcelDemy Project. He likes using and learning about Microsoft Office, especially Excel. He is interested in data analysis with Excel, machine learning,... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo