How should I use the numerical method .n()?
If I want to numerically calculate an expression involving several terms and I am worried about efficiency should I numerically calculate each term? For example is there a difference between:
data = [ (sin(t)*exp(t)).n() for t in srange(0, 10, 0.01) ]
vs
data = [ sin(t).n()*exp(t).n() for t in srange(0, 10, 0.01) ]
?
In response to the specific question at the end:
[(sin(t)*exp(t)).n() for t in srange(0,10,0.01)] == [sin(t).n()*exp(t).n() for t in srange(0,10,0.01)]
returnsTrue
.This should not matter unless you expect some kind of precision loss (e.g., adding entities of significantly different magnitude).