Tutorials › Calculus I › Uniform Grids and Step-Size Calculations

Euler's Method and Numerical Solutions · Tutorial 1423 of 1495

Uniform Grids and Step-Size Calculations

Learn to connect the initial and final times, a uniform step size, and the number of steps so that the time grid lands exactly at the target.

Advanced 9 min read

What You'll Learn

  • Define a uniform time grid from its initial time and positive step size.
  • Calculate the number of steps required to reach a final time.
  • Check whether a chosen step size divides the time interval exactly.
  • Find a compatible step size when the number of steps is specified.
  • Distinguish the number of steps from the number of grid points.
  • Keep time units consistent when calculating a grid.

Why the Time Grid Matters

A numerical method for an initial-value problem advances from one time to the next. Before carrying out those updates, we need to decide which times will be used. A uniform time grid divides an interval into steps of equal length. Its construction is simple, but a mismatch between the interval and the step size can prevent the grid from landing on the desired final time.

This tutorial focuses on the grid itself: how to describe it, calculate its number of steps, and choose a step size that reaches the endpoint exactly. The Forward Euler Update Rule uses successive grid times; here we establish how those times are organized, without performing the updates to the solution values.

Definition of a Uniform Time Grid

Let \(t_0\) be an initial time, let \(T\) be a later final time, and let \(h>0\) be a fixed step size. A uniform grid with \(N\) steps consists of the times \(t_0,t_1,\ldots,t_N\), where every consecutive pair differs by \(h\).

Definition: A uniform time grid from \(t_0\) to \(T\) with step size \(h\) and \(N\) steps is a sequence satisfying $$ t_n=t_0+nh,\qquad n=0,1,\ldots,N, $$ with \(N\) a positive integer and \(t_N=T\). The grid contains \(N+1\) points, because it includes both endpoints.

The index \(n\) identifies a grid point, beginning with \(n=0\). The first point is \(t_0\), the next is \(t_1=t_0+h\), and each later point is obtained by adding another \(h\). The value \(h\) measures the distance in time between adjacent points; it is not the number of points.

For the grid to reach \(T\), the interval length must equal the total length of all \(N\) steps. Thus the basic relationship is

$$ T-t_0=Nh. $$

This equation connects four quantities: the initial time, the final time, the step size, and the number of steps. If three are specified, the fourth is determined, provided the values are compatible.

Calculating the Number of Steps

If the interval endpoints and step size are given, solve the relationship \(T-t_0=Nh\) for \(N\). The quotient must be a positive integer for a uniform grid of that step size to end exactly at \(T\).

Rule: For \(T>t_0\) and \(h>0\), a uniform grid with step size \(h\) reaches \(T\) exactly if and only if $$ N=\frac{T-t_0}{h} $$ is a positive integer. When it is, the grid has \(N\) steps and \(N+1\) grid points.

The integer condition is essential. A noninteger quotient does not describe a whole number of equal steps from \(t_0\) to \(T\). It is not appropriate to round that quotient and still claim that all steps have the chosen length and the grid ends at \(T\).

Worked Example: Counting Steps on a Compatible Grid

Construct the grid from \(t_0=2\) minutes to \(T=8\) minutes using a step size \(h=1.5\) minutes. First calculate the interval length:

$$ T-t_0=8-2=6\text{ minutes}. $$

Then calculate the number of steps:

$$ N=\frac{T-t_0}{h} =\frac{6\text{ minutes}}{1.5\text{ minutes}} =4. $$

The quotient is a positive integer, so the grid reaches the final time exactly. Use \(t_n=t_0+nh\) for \(n=0,1,2,3,4\):

$$ \begin{aligned} t_0&=2+0(1.5)=2,\\ t_1&=2+1(1.5)=3.5,\\ t_2&=2+2(1.5)=5,\\ t_3&=2+3(1.5)=6.5,\\ t_4&=2+4(1.5)=8. \end{aligned} $$

There are \(4\) steps and \(5\) grid points. Check the endpoint using the total step length: \(t_0+Nh=2+4(1.5)=2+6=8=T\). Also, every consecutive difference is \(1.5\) minutes.

Choosing a Step Size from a Step Count

Sometimes the desired number of steps is chosen first. For example, a calculation may call for a fixed number \(N\) of equal subdivisions. Once \(t_0\), \(T\), and \(N\) are known, the step size is the interval length divided equally among those steps:

$$ h=\frac{T-t_0}{N}. $$

Here \(N\) must be a positive integer. This choice guarantees that \(N\) steps cover the interval because \(Nh=T-t_0\). If the endpoints have units of time and \(N\) is a count, \(h\) has the same time units as the endpoints.

Worked Example: Finding the Step Size for a Fixed Number of Steps

Divide the interval from \(t_0=0\) seconds to \(T=10\) seconds into \(N=8\) equal steps. The interval length is

$$ T-t_0=10-0=10\text{ seconds}. $$

Divide this length by the number of steps:

$$ h=\frac{T-t_0}{N} =\frac{10\text{ seconds}}{8} =1.25\text{ seconds}. $$

The grid points follow from \(t_n=0+n(1.25)\) for \(n=0,1,\ldots,8\):

$$ 0,\;1.25,\;2.50,\;3.75,\;5.00,\;6.25,\;7.50,\;8.75,\;10.00 \quad\text{seconds}. $$

There are eight intervals between these nine points. Check the endpoint: \(t_8=0+8(1.25)=10\) seconds. Check the spacing, for example \(t_3-t_2=3.75-2.50=1.25\) seconds; the formula \(t_n=t_0+nh\) gives that same difference for each consecutive pair.

Why the Grid Formula Works

The formula \(t_n=t_0+nh\) follows directly from the equal-spacing requirement. Each step adds \(h\). Starting from \(t_0\), after one step we have \(t_1=t_0+h\); after a second step, \(t_2=t_0+2h\). The same reasoning continues for any index.

Derivation: Suppose each consecutive grid time is separated by \(h\), so \(t_{k+1}-t_k=h\) for each \(k=0,\ldots,N-1\). Adding these equalities gives $$ (t_1-t_0)+(t_2-t_1)+\cdots+(t_N-t_{N-1})=Nh. $$ Every interior time appears once with a positive sign and once with a negative sign, so the left side simplifies to \(t_N-t_0\). Since \(t_N=T\), $$ T-t_0=Nh. $$ Likewise, adding the first \(n\) step lengths gives \(t_n-t_0=nh\), hence \(t_n=t_0+nh\). Thus the formula describes equal spacing and the endpoint condition precisely.

This derivation also explains why the point count is \(N+1\), not \(N\). There is one starting point, and each of the \(N\) steps adds one new point. Equivalently, the index list \(0,1,\ldots,N\) has \(N+1\) indices.

Checking Compatibility Before Listing the Grid

When the step size is specified, do not begin by generating approximate grid times and hoping the last one is close enough. First test the exact compatibility condition by calculating \((T-t_0)/h\). If this value is an integer, the requested uniform grid exists as stated. If it is not an integer, the selected step size does not divide the interval into a whole number of equal steps.

Worked Example: Detecting an Incompatible Step Size

Suppose \(t_0=1\) hour, \(T=6\) hours, and \(h=0.8\) hour. The interval length is

$$ T-t_0=6-1=5\text{ hours}. $$

The proposed number of steps would be

$$ \frac{T-t_0}{h} =\frac{5}{0.8} =6.25. $$

Since \(6.25\) is not an integer, there is no uniform grid with step size \(0.8\) hour that starts at \(1\) hour and ends at \(6\) hours. To make a uniform grid with eight steps, for instance, the compatible step size would instead be

$$ h=\frac{6-1}{8} =\frac{5}{8} =0.625\text{ hour}. $$

Check this alternative: \(1+8(0.625)=1+5=6\) hours. The original choice \(0.8\) hour is incompatible with the stated endpoints; the recalculated choice \(0.625\) hour is compatible with eight steps.

Keep Time Units Consistent

The interval length and step size must use the same time units before their quotient is calculated. Otherwise, the numerical quotient may not represent a number of steps. Convert one quantity first, then perform the division. The resulting step size should also be reported in the units used for the interval.

Worked Example: Converting Units Before Counting Steps

From \(t_0=30\) minutes to \(T=2\) hours, use a step size of \(h=15\) minutes. Convert the final time to minutes: \(2\text{ hours}=2(60)=120\text{ minutes}\). The interval length is therefore

$$ T-t_0=120-30=90\text{ minutes}. $$

Now both the interval and step size are in minutes, so

$$ N=\frac{90\text{ minutes}}{15\text{ minutes}}=6. $$

The grid times are \(t_n=30+15n\) minutes for \(n=0,\ldots,6\):

$$ 30,\;45,\;60,\;75,\;90,\;105,\;120 \quad\text{minutes}. $$

There are six steps and seven points. The final point is \(30+6(15)=120\) minutes, which is \(2\) hours, as required. Each listed time is 15 minutes after the preceding one.

Common Mistake: Rounding the Step Count

A frequent error is to calculate a noninteger step count and round it, while still treating the original step size as exact. Rounding changes the total distance covered. The endpoint check exposes the problem.

Common mistake: For the interval from \(1\) hour to \(6\) hours with \(h=0.8\) hour, one might write $$ N=\frac{6-1}{0.8}=6.25\approx 6 $$ and claim that six steps reach the endpoint. But six steps cover only \(6(0.8)=4.8\) hours, so the resulting last grid time is \(1+4.8=5.8\) hours, not \(6\) hours. The correction is to retain the compatibility check: \(6.25\) is not an integer, so the requested uniform grid does not reach the endpoint. Choose a compatible step size for the desired integer number of steps, or specify a compatible step size in the first place.

Rounding may be appropriate when reporting certain measured quantities, but it cannot repair the exact equality \(T-t_0=Nh\). In grid construction, the endpoint and uniform spacing are structural requirements, not approximate targets.

A Practical Construction Checklist

Before using a time grid in a numerical calculation, verify the quantities and the endpoint relationship. This short sequence helps prevent indexing and unit errors:

1
Identify the interval.
Record the initial time \(t_0\) and final time \(T\), with \(T>t_0\).
2
Match the units.
Express the interval length \(T-t_0\) and the step size in the same time units.
3
Determine the missing quantity.
Use \(N=(T-t_0)/h\) when \(h\) is given, or \(h=(T-t_0)/N\) when the positive integer \(N\) is given.
4
Check the endpoint and count.
Verify \(t_0+Nh=T\), and remember that the grid contains \(N+1\) points.

Why These Calculations Matter

A grid is the time structure on which a numerical solution is built. In Euler's method, each step uses information at one grid time to advance to the next. If the grid has the wrong number of steps, incorrect spacing, inconsistent units, or a last point that misses the target time, the subsequent computation is not being performed on the intended interval.

It is useful to keep three distinct quantities separate:

QuantityMeaning
\(h\)The time difference between consecutive grid points
\(N\)The number of equal steps from \(t_0\) to \(T\)
\(N+1\)The number of grid points, including both endpoints

The reliable check is always the endpoint identity \(t_0+Nh=T\), together with the requirement that \(N\) is an integer and \(h>0\). Those conditions ensure that the grid starts where intended, uses equal positive steps, and ends exactly at the specified final time.

Check Your Understanding

Use the endpoint relationship and distinguish carefully between steps and points.

  1. For \(t_0=3\), \(T=15\), and \(h=2\), how many steps and grid points are there?
  2. A uniform grid runs from \(t_0=4\) to \(T=16\) in six steps. What is \(h\)?
  3. For \(t_0=0\), \(T=5\), and \(h=1.2\), does the grid reach the endpoint exactly? Explain using the quotient.
  4. If a grid has 11 points, how many steps does it have?
  5. A time interval runs from 20 minutes to 2 hours with \(h=20\) minutes. How many steps are required? Show the unit conversion.

Test yourself: Calculus I final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon