Compare commits

..

2 Commits

Author SHA1 Message Date
Dom
1984d97171
Refactorings (#8987)
* use np.dot

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* further improvements using array slicing

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-08-20 16:43:09 -07:00
Guduly
672e7bde2e
Update arc_length.py (#8964)
* Update arc_length.py

Wrote the output of testcase

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update arc_length.py

Added the requested changes

* Update arc_length.py

followed the change request

* Update arc_length.py

followed suggestions

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-08-20 16:39:29 -07:00
2 changed files with 3 additions and 4 deletions

View File

@ -33,10 +33,7 @@ def retroactive_resolution(
x: NDArray[float64] = np.zeros((rows, 1), dtype=float)
for row in reversed(range(rows)):
total = 0
for col in range(row + 1, columns):
total += coefficients[row, col] * x[col]
total = np.dot(coefficients[row, row + 1 :], x[row + 1 :])
x[row, 0] = (vector[row] - total) / coefficients[row, row]
return x

View File

@ -7,6 +7,8 @@ def arc_length(angle: int, radius: int) -> float:
3.9269908169872414
>>> arc_length(120, 15)
31.415926535897928
>>> arc_length(90, 10)
15.707963267948966
"""
return 2 * pi * radius * (angle / 360)