Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
| Download
Views: 1794
Image: ubuntu2004
1
def generator():
2
"""
3
Generates
4
y'=F(t,y)
5
where F is discontinuous/nondifferentiable
6
at certain points
7
"""
8
t = var('t')
9
y,yp = mi_vars("y","y'")
10
t0,y0,b = [randrange(2,7)*choice([-1,1]) for _ in range(3)]
11
a = randrange(2,4)
12
powerd = choice([3,5])
13
powern = choice([1,2,4,7,8])
14
F = choice([
15
randrange(2,7)*(a*y+b*t-a*y0-b*t0)^(powern/powerd),
16
])
17
unique = (powerd<powern)
18
19
return {
20
"F": F,
21
"Fy": F.diff(y),
22
"t0": t0,
23
"y0": y0,
24
"unique": unique,
25
}
26
27