Diffusion Mathematics: Difference between revisions

From bradwiki
Jump to navigation Jump to search
(Created page with " ==Common Mathematical Concepts in Diffusion== {{ExpandBox|Laplace operator| In mathematics the Laplace operator or Laplacian is a differential operator given by the diverg...")
 
No edit summary
Line 1: Line 1:
In no particular order, here are some common mathematical concepts often found in diffusion modeling. To simulate and quantify simple diffusion (e.g. 2D Brownian Motion) only requires a working knowledge of basic statistics and trigonometry. Modeling complex forms of diffusion requires the use of vector calculus and differential geometry. There is a thin boundary between simple and complex diffusion and the math becomes dense very quickly. For example, using just a few lines of code, one can easily simulate stochastic diffusion on a flat 2D surface:
<syntaxhighlight lang="matlab" line start="1" highlight="1" enclose="div">
Ndots = 100; Nsteps = Ndots;
D = .5;                    % Diffusion Rate
dm = 2;                    % dimensions
tau = 1;                    % time step
k = sqrt(dm*D*tau);        % stdev of D's step size distribution
xyl = ones(2,Ndots); xyds = xyl;
for t = 1:Nsteps
  [xyds] = GENSTEP(Ndots, k);
  [xyl] = ADDSTEP(Ndots, xyds, xyl);
end
%===========================================================%
function [xyds] = GENSTEP(Ndots, k)
    xyds = (k * randn(2,Ndots));
end
function [xyl] = ADDSTEP(Ndots, xyds, xyl)
  for j = 1:Ndots
    xyl(:,j) = xyl(:,j)+xyds(:,j);
  end
  gscatter(xyl(1,:),xyl(2,:));
end
</syntaxhighlight>
<br /><br />
{{Clear}}





Revision as of 13:40, 3 November 2013

In no particular order, here are some common mathematical concepts often found in diffusion modeling. To simulate and quantify simple diffusion (e.g. 2D Brownian Motion) only requires a working knowledge of basic statistics and trigonometry. Modeling complex forms of diffusion requires the use of vector calculus and differential geometry. There is a thin boundary between simple and complex diffusion and the math becomes dense very quickly. For example, using just a few lines of code, one can easily simulate stochastic diffusion on a flat 2D surface:

Ndots = 100; Nsteps = Ndots;

D = .5;                     % Diffusion Rate
dm = 2;                     % dimensions
tau = 1;                    % time step
k = sqrt(dm*D*tau);         % stdev of D's step size distribution
xyl = ones(2,Ndots); xyds = xyl;

for t = 1:Nsteps
   [xyds] = GENSTEP(Ndots, k);
   [xyl] = ADDSTEP(Ndots, xyds, xyl);
end
%===========================================================%
function [xyds] = GENSTEP(Ndots, k)
    xyds = (k * randn(2,Ndots));
end

function [xyl] = ADDSTEP(Ndots, xyds, xyl)
   for j = 1:Ndots
     xyl(:,j) = xyl(:,j)+xyds(:,j);
   end
   gscatter(xyl(1,:),xyl(2,:));
end




Common Mathematical Concepts in Diffusion

Laplace operator


In mathematics the Laplace operator or Laplacian is a differential operator given by the divergence of the gradient of a function on Euclidean space. It is usually denoted by the symbols ∇·∇, ∇2 or ∆. The Laplacian ∆f(p) of a function f at a point p, up to a constant depending on the dimension, is the rate at which the average value of f over spheres centered at p, deviates from f(p) as the radius of the sphere grows.