Skip to main content

Educational numerical methods library (roots and integration)

Project description

numlib

Небольшая библиотека на Python для численных методов:

  • Поиск корней: метод бисекции, метод Ньютона
  • Численное интегрирование: трапеции, Симпсон

Требования

  • Python >= 3.9

Установка (локально, как пакет)

Из корня проекта:

python -m pip install -e .

Установка зависимостей для разработки (тесты)

python -m pip install -e ".[dev]"

Запуск тестов

pytest -q

Примеры использования

Корни

import math
from numlib import bisection, newton

f = lambda x: x*x - 2
r1 = bisection(f, 1.0, 2.0)
print(r1.root, r1.converged)

g = lambda x: math.cos(x) - x
dg = lambda x: -math.sin(x) - 1
r2 = newton(g, dg, 1.0)
print(r2.root, r2.converged)

Интегрирование

import math
from numlib import trapezoidal, simpson

f = lambda x: math.sin(x)
print(trapezoidal(f, 0.0, math.pi, n=10000).value)
print(simpson(f, 0.0, math.pi, n=2000).value)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

numlib_bobr789008-0.1.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

numlib_bobr789008-0.1.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file numlib_bobr789008-0.1.0.tar.gz.

File metadata

  • Download URL: numlib_bobr789008-0.1.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for numlib_bobr789008-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0678d07643eac231d27b8ea6bac2dde6295243611b70475534bd599b242cf889
MD5 b6a2c84f42eeadf0bc16c11e45f66df2
BLAKE2b-256 5ce672561d726b1e61aa3b0e618739a1d7077696f9ab364e089725c4996f61a5

See more details on using hashes here.

File details

Details for the file numlib_bobr789008-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for numlib_bobr789008-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9d4fec4af927ea463de0696adc54f2c6a1b849a324d77325c03270ba98fd2a6f
MD5 16c91070d392d6475c127d07eb4f20b6
BLAKE2b-256 4019f068a2d2fa107218d04843ac24bfb7ea1dbe85b6d991745e30e2c76ac597

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page