MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / ucal

Function ucal

maths/numerical_analysis/newton_forward_interpolation.py:8–20  ·  view source on GitHub ↗

>>> ucal(1, 2) 0 >>> ucal(1.1, 2) 0.11000000000000011 >>> ucal(1.2, 2) 0.23999999999999994

(u: float, p: int)

Source from the content-addressed store, hash-verified

6
7# for calculating u value
8def ucal(u: float, p: int) -> float:
9 """
10 >>> ucal(1, 2)
11 0
12 >>> ucal(1.1, 2)
13 0.11000000000000011
14 >>> ucal(1.2, 2)
15 0.23999999999999994
16 """
17 temp = u
18 for i in range(1, p):
19 temp = temp * (u - i)
20 return temp
21
22
23def main() -> None:

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected