r/backtickbot • • Jul 22 '21

https://np.reddit.com/r/Julia/comments/op9lhr/julia_nested_array_comprehension_being_more_than/h64fw1t/

using SpecialFunctions, BenchmarkTools
dps = 301 #number of data points
x = range(0, 3, length=dps)
t = range(1, 2.592e7, length=dps)
const Ti, Ts, α = 12, -15, 0.138e-6
T(x,t) = Ts + 2(Ti - Ts) / sqrt(π) * erf(x / 2sqrt(α * t))
@btime z = [T(i,j) for i in $x, j in $t]

takes merely a few milliseconds for me

1 Upvotes

0 comments sorted by