Breakout sessions
n
function solve(f, x)
n
local steps, range = 30, 3
n
for i=0, steps do
n
y = f(-6+range*i/steps)
n
if y>x then
n
return -6+range*(i-1)/steps -
n
(y - x ) /
n
((y - f(-6+range*(i-1)/steps))*steps)
n
end
n
end
n
end
n
-- create plot area
n
if p==nil then
n
p = graph.plot('Simulation of the effect of random errors in RT')
n
p:show()
n
end
n
sigma_penumbra = 0.64
n
sigma_random = 0.00
n
dose_presc = 0.83
n
sigma_total = math.sqrt(sigma_penumbra*sigma_penumbra + sigma_random*sigma_random)
n
f0 = |v| num.integ(|t|randist.gaussian_pdf(t, sigma_penumbra), v-5, v+5)
n
f = |v| num.integ(|t|randist.gaussian_pdf(t, sigma_total ), v-5, v+5)
n
print('margin (cm) =', solve(f, dose_presc)-solve(f0, dose_presc))
n
require('mobdebug').off()
n
local ln2 = graph.fxline(f, -8, 8, 100)
n
--p:clear()
n
p:addline(ln2, 'blue')
n
p:addline(graph.fxline(|v|dose_presc, -10, 10), 'red')
n
require('mobdebug').on()