i am a programmer really, and i am trying to make a program that allows the user to select 1 of a few methods to estimate a graph. I am struggling on the improved Euler (Heun) method.(adsbygoogle = window.adsbygoogle || []).push({});

This is what i have, if you image in it iterating until 100 seconds has passed.

dxdt_1 = a*(y - x);

dydt_1 = x*(b - z) - y;

dzdt_1 = (x*y) - (c*z);

printf("dxdt = %.5f\ndydt = %.5f\ndzdt = %.5f", dxdt_1, dydt_1, dzdt_1);

//standard Euler

x_predict = x + dxdt_1*dt;

y_predict = y + dydt_1*dt;

z_predict = z + dzdt_1*dt;

printf("x_predict = %.5f\ny_predict = %.5f\nz_predict = %.5f", x_predict, y_predict, z_predict);

dxdt_2 = a*(y_predict - x_predict);

dydt_2 = x*(b - z) - (y_predict);

dzdt_2 = (x_predict*y_predict) - (c*(z_predict));

printf("dxdt_2 = %.5f\ndydt_2 = %.5f\ndzdt_2 = %.5f", dxdt_2, dydt_2, dzdt_2);

x_grad = (dxdt_1 + dxdt_2)/2;

y_grad = (dydt_1 + dydt_2)/2;

z_grad = (dzdt_1 + dzdt_2)/2;

printf("x_grad = %.5f\ny_grad = %.5f\nz_grad = %.5f", x_grad, y_grad, z_grad);

x = x + x_grad*dt;

y = y + y_grad*dt;

z = z + z_grad*dt;

The example is the Lorenz equations.

Thanks

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Improved Euler (Heun) method

Can you offer guidance or do you also need help?

Draft saved
Draft deleted

Loading...

Similar Threads - Improved Euler Heun | Date |
---|---|

I Euler, De Moivre and a printing error | Thursday at 8:00 AM |

How to Improve my maths | Sep 16, 2015 |

Tips to Improve Math Skills? | Nov 29, 2011 |

Any suggestions on how to improve the solution to this recurrence relation? | Aug 26, 2010 |

How to improve at Mathematics? | Mar 6, 2009 |

**Physics Forums - The Fusion of Science and Community**