Coverage for docs\source\examples\substitutions.py: 0%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"Example substitution; adapted from t_sub.py/t_NomialSubs /test_Basic"
2from gpkit import Variable
3x = Variable("x")
4p = x**2
5assert p.sub({x: 3}) == 9
6assert p.sub({x.key: 3}) == 9
7assert p.sub({"x": 3}) == 9