This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void Heun(NumericalModelWithODE model) => Heun(model, Console.Out); | |
| public static void Heun(NumericalModelWithODE model, TextWriter file) { | |
| var t = model.TimeStart; | |
| var te = model.TimeEnd; | |
| var x = model.InitialValues; | |
| file.WriteLine($"{t} {x}"); | |
| while (t <= te) { | |
| x += HeunUpdate(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void Rk4(NumericalModelWithODE model) => Rk4(model, Console.Out); | |
| public static void Rk4(NumericalModelWithODE model, TextWriter file) { | |
| var t = model.TimeStart; | |
| var te = model.TimeEnd; | |
| var x = model.InitialValues; | |
| const double frac6 = 1.0 / 6.0; | |
| var hDelta = Delta * 0.5; | |
| file.WriteLine($"{t} {x}"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.IO; | |
| namespace NumericalLib { | |
| public static class Solver { | |
| private enum NumericalMethod { | |
| Euler, | |
| Heun, | |
| Rk4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.IO; | |
| using NumericalLib; | |
| using static System.Math; | |
| namespace Projection { | |
| class Program { | |
| private class Projection : NumericalModelWithODE { |
OlderNewer