Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
ode-solver-2021
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Величко Арсений Александрович
ode-solver-2021
Commits
10d87a87
Commit
10d87a87
authored
Dec 25, 2021
by
Величко Арсений Александрович
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
static solver signatures
parent
558802fa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
21 deletions
+10
-21
static_solvers.py
src/static_solvers/static_solvers.py
+10
-21
No files found.
src/static_solvers/static_solvers.py
View file @
10d87a87
from
decimal
import
Decimal
import
typing
as
tp
# 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
))
def
left_rectangle_method
(
fx
:
tp
.
Callable
[[
float
],
float
],
a
:
float
,
b
:
float
,
steps
:
int
)
->
float
:
pass
# 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
))
def
right_rectangle_method
(
fx
:
tp
.
Callable
[[
float
],
float
],
a
:
float
,
b
:
float
,
steps
:
int
)
->
float
:
pass
# 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
def
trapezium_method
(
fx
:
tp
.
Callable
[[
float
],
float
],
a
:
float
,
b
:
float
,
steps
:
int
)
->
float
:
pass
# TODO Метод парабол
def
parabola_method
(
fx
:
callable
,
a
:
Decimal
,
b
:
Decimal
,
steps
:
int
)
->
Decimal
:
def
parabola_method
(
fx
:
tp
.
Callable
[[
float
],
float
],
a
:
float
,
b
:
float
,
steps
:
int
)
->
float
:
pass
# TODO Метод переменного шага: Двойной пересчет
def
double_count_method
(
fx
:
callable
,
a
:
Decimal
,
b
:
Decimal
,
steps
:
int
)
->
Decimal
:
def
double_count_method
(
fx
:
tp
.
Callable
[[
float
],
float
],
a
:
float
,
b
:
float
,
steps
:
int
)
->
float
:
pass
# TODO Метод переменного шага: Некий секретный алгоритм
def
mysterious_method
(
fx
:
callable
,
a
:
Decimal
,
b
:
Decimal
,
steps
:
int
)
->
Decimal
:
def
mysterious_method
(
fx
:
tp
.
Callable
[[
float
],
float
],
a
:
float
,
b
:
float
,
steps
:
int
)
->
float
:
pass
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment