# A small question in John Burkardt's stochastic\_rk.f90 code

**URL:** <https://fortran-lang.discourse.group/t/a-small-question-in-john-burkardts-stochastic-rk-f90-code/1827>\
**Category:** Uncategorized\
**Created:** [September 12, 2021, 7:52pm UTC](https://fortran-lang.discourse.group/t/a-small-question-in-john-burkardts-stochastic-rk-f90-code/1827 "2021-09-12T19:52:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![CRquantum](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/crquantum/32/730_2.png) [@CRquantum](https://fortran-lang.discourse.group/u/CRquantum)\
**Post date:** [September 12, 2021, 7:52pm UTC](https://fortran-lang.discourse.group/t/a-small-question-in-john-burkardts-stochastic-rk-f90-code/1827/1 "2021-09-12T19:52:42Z")

</div>

Dear all, I have a quick question wrt the famous guy John Burkardt’s stochastic\_rk.f90 code.  
The main description is here,  
[https://people.math.sc.edu/Burkardt/f\_src/stochastic\_rk/stochastic\_rk.html](https://people.math.sc.edu/Burkardt/f_src/stochastic_rk/stochastic_rk.html)  
The stochastic\_rk.f90 code is below,  
[https://people.math.sc.edu/Burkardt/f\_src/stochastic\_rk/stochastic\_rk.f90](https://people.math.sc.edu/Burkardt/f_src/stochastic_rk/stochastic_rk.f90)

Now, In the subroutine for RK4  
rk4\_ti\_step ( x, t, h, q, fi, gi, seed, xstar )  
in the lines,  
t4 = t1 + a41 \* h + a42 \* h + a43 \* h  
x4 = x1 + a41 \* k1 + a42 \* k2

I wonder, should the expression for x4 be  
x4 = x1 + a41 \* k1 + a42 \* k2 + a43 \* k3

I mean, should there be the term + a43 \* k3 for x4?

Does anyone know? Thank you very much!

Also, does anyone know how to contact John Burkardt? I can only find his webpage, but not his email address.

---

<div class="post-metadata">

**Author:** ![ivanpribec](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/ivanpribec/32/3290_2.png) [@ivanpribec](https://fortran-lang.discourse.group/u/ivanpribec)\
**Post date:** [September 12, 2021, 9:01pm UTC](https://fortran-lang.discourse.group/t/a-small-question-in-john-burkardts-stochastic-rk-f90-code/1827/2 "2021-09-12T21:01:58Z")

</div>

Judging by Eq. 12 in the paper cited by Burkardt, it does look like a term is missing:

![image](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/1X/10f5136d08dc6025df4b7b6c498bdd4a04ce18ac.png)

For k\_4 (j = 4) the sum in the bracketed part of functions F and G, should go from i=1 to j - 1 = 3. This does seem to imply the line should read

```fortran
x4 = x1 + a41 * k1 + a42 * k2 + a43 * k3

```

---

<div class="post-metadata">

**Author:** ![CRquantum](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/crquantum/32/730_2.png) [@CRquantum](https://fortran-lang.discourse.group/u/CRquantum)\
**Post date:** [September 13, 2021, 3:43am UTC](https://fortran-lang.discourse.group/t/a-small-question-in-john-burkardts-stochastic-rk-f90-code/1827/3 "2021-09-13T03:43:03Z")

</div>

Thank you very much @ivanpribec, I think you are right.  
John Burkardt is likely missed the a43 \* k3 term for the rk4\_ti subroutine. ti means time-invariant.  
In his rk4\_tv subroutine, he did not miss the a43\*k3 term.

What is more, John Burkardt’s version of stochastic\_rk is a scalar version.  
Kasdin’s paper’s solution is a vector version.
