Skip to content

Commit

Permalink
Closes #2202
Browse files Browse the repository at this point in the history
Improve pseudo-code for spatialDistribution
  • Loading branch information
HansOlsson committed May 10, 2019
1 parent 32b7b2b commit 8e82588
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions chapters/operatorsandexpressions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ \subsubsection{spatialDistribution}\doublelabel{spatialdistribution}
out1:=interpolate(points, values, 1-(x-x0));
out0:=values[1]; // similar to in0 but avoiding algebraic loop
else
out0:=interpolate(points, values, (x-x0));
out0:=interpolate(points, values, 0-(x-x0));
out1:=values[end]; // similar to in1 but avoiding algebraic loop
end if;
when <acceptedStep> then
Expand All @@ -745,14 +745,14 @@ \subsubsection{spatialDistribution}\doublelabel{spatialdistribution}
m:=m-1;
end while;
values:=cat(1, {in0}, values[1:m], {interpolate(points, values,1-(x-x0))} );
points:=cat(1, {0}, points[1:m] .+ (x1-x0), {1} );
points:=cat(1, {0}, points[1:m] .+ (x-x0), {1} );
elseif x<x0 then
m:=1;
while (if m<size(points,1) then points[m]+(x-x0)<=0 else false) then
m:=m+1;
end while;
values:=cat(1, {interpolate(points, values, 0-(x-x0))},values[m:end],{in1});
points:=cat(1, {0}, points[m:end] .+ (x1-x0), {1});
points:=cat(1, {0}, points[m:end] .+ (x-x0), {1});
end if;
x0:=x;
end when;
Expand Down

0 comments on commit 8e82588

Please sign in to comment.