95 lines
626 B
Text
95 lines
626 B
Text
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
from symbolic_math import *
|
||
|
|
|
||
|
|
|
||
|
|
g = Lambda(x, exp(-x**(-2)))
|
||
|
|
g
|
||
|
|
|
||
|
|
|
||
|
|
h = Lambda(x, a + b*(1-g(x)))
|
||
|
|
h
|
||
|
|
|
||
|
|
|
||
|
|
r = Lambda(x, (a / h(x)))
|
||
|
|
r
|
||
|
|
|
||
|
|
|
||
|
|
F = Lambda((x,t), (exp(h(x)*t)*(1-r(x))+r(x))**(-1))
|
||
|
|
F
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
F0 = Lambda(t, limit(F(x,t), x, 0))
|
||
|
|
F0
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
# !uv pip install plotnine polars
|
||
|
|
|
||
|
|
|
||
|
|
from plotnine import ggplot, aes, geom_point, geom_smooth
|
||
|
|
|
||
|
|
|
||
|
|
from polars import read_csv
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
dtypes = {"x": float, "y": float}
|
||
|
|
|
||
|
|
df = read_csv(
|
||
|
|
"data.csv",
|
||
|
|
schema_overrides = dtypes
|
||
|
|
)
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
(
|
||
|
|
ggplot(data=df, mapping = aes(x = "x", y = "y"))
|
||
|
|
+ geom_point()
|
||
|
|
+ geom_smooth(method="lm", color="blue")
|
||
|
|
)
|
||
|
|
|
||
|
|
|
||
|
|
|