Published
Edited
Apr 16, 2020
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{pyPN`

out = PolyNum('const:(~1~,2~2~2~2~...~)') / 2 ; out._strPN_cut = 25 # display first 25 PN digits

# ((1/h) / (p²+p+4)) · exp(-T₀ √(p²+1))
h = 0.1
p_ = PolyNum('const:(~2~,-4~4~-4~4~...~)') / h # = 2/h * (~1~-1~)/(~1~1~)
T0 = 0.03
out2 = PolyNum(1/h) / ( p_**2 + p_ +4 ) * ( -T0 * (p_**2+1).sqrt() ).exp() ; out2._strPN_cut = 9

# window.globalVarJS
window._ans = f'''\
('const:(~1~,2~2~2~2~...~)') / 2
{out}
list: {list(out)[:20]}...

((1/h) / (p²+p+4)) · exp(-T₀ √(p²+1))
{out2}
'''
`;
return window._ans
//for py class x, ex.py: window._ansClass = x # window.globalVarJS
//var obj=window._ansClass; return obj.__class__.__str__(obj)
//https://stackoverflow.com/questions/47396494/brython-calling-methods-of-objects-from-a-seperate-python-file
}
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more