init structure

parent 8d317443
Pipeline #7358 failed with stages
in 18 seconds
/poetry.lock
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/
from .dynamic_solvers import *
from .functions import *
from .static_solvers import *
from decimal import Decimal
# TODO Метод левых прямоугольников
def left_rectangle_method(fx: callable, a, b, steps: int) -> float:
w = (b - a) / steps
return sum(fx(x) * w for x in range(a, b, w))
# TODO Метод правых прямоугольников
def right_rectangle_method(fx: callable, a, b, steps: int) -> float:
w = (b - a) / steps
return sum(fx(x) * w for x in range(a + w, b + w, w))
# TODO Метод трапеций
def trapezium_method(fx: callable, a: Decimal, b: Decimal, steps: int) -> Decimal:
w: Decimal = (b - a) / steps
x1 = a
res = Decimal(0)
for x in range(a + w, b + w, w):
y = fx((x1 + x) / 2)
x1 = x
res += y
return res
# TODO Метод парабол
def parabola_method(fx: callable, a: Decimal, b: Decimal, steps: int) -> Decimal:
pass
# TODO Метод переменного шага: Двойной пересчет
def double_count_method(fx: callable, a: Decimal, b: Decimal, steps: int) -> Decimal:
pass
# TODO Метод переменного шага: Некий секретный алгоритм
def mysterious_method(fx: callable, a: Decimal, b: Decimal, steps: int) -> Decimal:
pass
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment