/
shmachilin
/
MathCore
Обзор
Документация
Войти
/
shmachilin
/
MathCore
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
dev
Tests/MathCore.Algorithms/Integrals/Trapeze.cs
20 строк
440 B
Infarh
Рефакторинг
18 сен 2022, 15:27
18 сен 2022, 15:27
8a852d3
Код
Авторство
О чём код?
namespace MathCore.Algorithms.Integrals; public static class Trapeze { public static double IntegrateTrapeze(this Func<double, double> f, double a, double b, double dx = 0.01) { var x = a + dx; var I = 0d; var last_y = f(a); while (x < b) { var y = f(x); I += (y + last_y) / 2; last_y = y; x += dx; } return I * dx; } }