plateform
stringclasses
1 value
repo_name
stringlengths
13
113
name
stringlengths
3
74
ext
stringclasses
1 value
path
stringlengths
12
229
size
int64
23
843k
source_encoding
stringclasses
9 values
md5
stringlengths
32
32
text
stringlengths
23
843k
github
uoa1184615/EquationFreeGit-master
patchSmooth1.m
.m
EquationFreeGit-master/Patch/patchSmooth1.m
376
utf_8
8eeed72eb5476e704fc56d7f0f700ded
% legacy interface patchSmooth1() auto-invokes new patchSys1() function dudt=patchSmooth1(t,u,patches) global smOOthCount if isempty(smOOthCount), smOOthCount=1; else smOOthCount=smOOthCount+1; end l2=log2(smOOthCount); if abs(l2-round(l2))<1e-9 warning('Use new patchSys1 instead of old patchSmooth1') end if nargin<3, global patches, end dudt=patchSys1(t,u,patches);
github
uoa1184615/EquationFreeGit-master
configPatches1.m
.m
EquationFreeGit-master/Patch/configPatches1.m
24,742
utf_8
7290399fac4ce9faab19acbc25ff17ed
% configPatches1() creates a data struct of the design of % 1D patches for later use by the patch functions such as % patchSys1(). AJR, Nov 2017 -- 23 Mar 2023 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{configPatches1()}: configure spatial patches in 1D} \label{sec:configPatches1} \localtableofcontents Makes the struct~\verb|patches| for use by the patch\slash gap-tooth time derivative\slash step function \verb|patchSys1()|. \cref{sec:configPatches1eg} lists an example of its use. \begin{matlab} %} function patches = configPatches1(fun,Xlim,Dom ... ,nPatch,ordCC,dx,nSubP,varargin) version = '2023-03-23'; %{ \end{matlab} \paragraph{Input} If invoked with no input arguments, then executes an example of simulating Burgers' \pde---see \cref{sec:configPatches1eg} for the example code. \begin{itemize} \item \verb|fun| is the name of the user function, \verb|fun(t,u,patches)| or \verb|fun(t,u)| or \verb|fun(t,u,patches,...)|, that computes time derivatives (or time-steps) of quantities on the 1D micro-grid within all the 1D~patches. \item \verb|Xlim| give the macro-space spatial domain of the computation, namely the interval $[ \verb|Xlim(1)|, \verb|Xlim(2)|]$. \item \verb|Dom| sets the type of macroscale conditions for the patches, and reflects the type of microscale boundary conditions of the problem. If \verb|Dom| is \verb|NaN| or \verb|[]|, then the field~\verb|u| is macro-periodic in the 1D spatial domain, and resolved on equi-spaced patches. If \verb|Dom| is a character string, then that specifies the \verb|.type| of the following structure, with \verb|.bcOffset| set to the default zero. Otherwise \verb|Dom| is a structure with the following components. \begin{itemize} \item \verb|.type|, string, of either \verb|'periodic'| (the default), \verb|'equispace'|, \verb|'chebyshev'|, \verb|'usergiven'|. For all cases except \verb|'periodic'|, users \emph{must} code into \verb|fun| the micro-grid boundary conditions that apply at the left(right) edge of the leftmost(rightmost) patches. \item \verb|.bcOffset|, optional one or two element array, in the cases of \verb|'equispace'| or \verb|'chebyshev'| the patches are placed so the left\slash right macroscale boundaries are aligned to the left\slash right edges of the corresponding extreme patches, but offset by \verb|bcOffset| of the sub-patch micro-grid spacing. For example, use \verb|bcOffset=0| when applying Dirichlet boundary values on the extreme edge micro-grid points, whereas use \verb|bcOffset=0.5| when applying Neumann boundary conditions halfway between the extreme edge micro-grid points. \item \verb|.X|, optional array, in the case~\verb|'usergiven'| it specifies the locations of the centres of the \verb|nPatch| patches---the user is responsible it makes sense. \end{itemize} \item \verb|nPatch| is the number of equi-spaced spatial patches. \item \verb|ordCC|, must be~$\geq -1$, is the `order' of interpolation across empty space of the macroscale patch values to the edge of the patches for inter-patch coupling: where \verb|ordCC| of~$0$ or~$-1$ gives spectral interpolation; and \verb|ordCC| being odd specifies staggered spatial grids. \item \verb|dx| (real) is usually the sub-patch micro-grid spacing in~\(x\). However, if \verb|Dom| is~\verb|NaN| (as for pre-2023), then \verb|dx| actually is \verb|ratio|, namely the ratio of (depending upon \verb|EdgyInt|) either the half-width or full-width of a patch to the equi-spacing of the patch mid-points---adjusted a little when $\verb|nEdge|>1$. So either $\verb|ratio|=\tfrac12$ means the patches abut and $\verb|ratio|=1$ is overlapping patches as in holistic discretisation, or $\verb|ratio|=1$ means the patches abut. Small~\verb|ratio| should greatly reduce computational time. \item \verb|nSubP| is the number of equi-spaced microscale lattice points in each patch. If not using \verb|EdgyInt|, then $\verb|nSubP/nEdge|$ must be odd integer so that there is/are centre-patch lattice point(s). So for the defaults of $\verb|nEdge|=1$ and not \verb|EdgyInt|, then \verb|nSubP| must be odd. \item \verb|'nEdge'|, \emph{optional}, default=1, the number of edge values set by interpolation at the edge regions of each patch. The default is one (suitable for microscale lattices with only nearest neighbour interactions). \item \verb|EdgyInt|, true/false, \emph{optional}, default=false. If true, then interpolate to left\slash right edge-values from right\slash left next-to-edge values. If false or omitted, then interpolate from centre-patch values. \item \verb|nEnsem|, \emph{optional-experimental}, default one, but if more, then an ensemble over this number of realisations. \item \verb|hetCoeffs|, \emph{optional}, default empty. Supply a 1D or 2D array of microscale heterogeneous coefficients to be used by the given microscale \verb|fun| in each patch. Say the given array~\verb|cs| is of size $m_x\times n_c$, where $n_c$~is the number of different sets of coefficients. The coefficients are to be the same for each and every patch; however, macroscale variations are catered for by the $n_c$~coefficients being $n_c$~parameters in some macroscale formula. \begin{itemize} \item If $\verb|nEnsem|=1$, then the array of coefficients is just tiled across the patch size to fill up each patch, starting from the first point in each patch. Best accuracy usually obtained when the periodicity of the coefficients is a factor of \verb|nSubP-2*nEdge| for \verb|EdgyInt|, or a factor of \verb|(nSubP-nEdge)/2| for not \verb|EdgyInt|. \item If $\verb|nEnsem|>1$ (value immaterial), then reset $\verb|nEnsem|:=m_x$ and construct an ensemble of all $m_x$~phase-shifts of the coefficients. In this scenario, the inter-patch coupling couples different members in the ensemble. When \verb|EdgyInt| is true, and when the coefficients are diffusivities\slash elasticities, then this coupling cunningly preserves symmetry. \end{itemize} \item \verb|nCore|, \emph{optional-experimental}, default one, but if more, and only for non-EdgyInt, then interpolates from an average over the core of a patch, a core of size ??. Then edge values are set according to interpolation of the averages?? or so that average at edges is the interpolant?? \item \verb|'parallel'|, true/false, \emph{optional}, default=false. If false, then all patch computations are on the user's main \textsc{cpu}---although a user may well separately invoke, say, a \textsc{gpu} to accelerate sub-patch computations. If true, and it requires that you have \Matlab's Parallel Computing Toolbox, then it will distribute the patches over multiple \textsc{cpu}s\slash cores. In \Matlab, only one array dimension can be split in the distribution, so it chooses the one space dimension~$x$. A user may correspondingly distribute arrays with property \verb|patches.codist|, or simply use formulas invoking the preset distributed arrays \verb|patches.x|. If a user has not yet established a parallel pool, then a `local' pool is started. \end{itemize} \paragraph{Output} The struct \verb|patches| is created and set with the following components. If no output variable is provided for \verb|patches|, then make the struct available as a global variable.\footnote{When using \texttt{spmd} parallel computing, it is generally best to avoid global variables, and so instead prefer using an explicit output variable.} \begin{matlab} %} if nargout==0, global patches, end patches.version = version; %{ \end{matlab} \begin{itemize} \item \verb|.fun| is the name of the user's function \verb|fun(t,u,patches)| or \verb|fun(t,u)| or \verb|fun(t,u,patches,...)|, that computes the time derivatives (or steps) on the patchy lattice. \item \verb|.ordCC| is the specified order of inter-patch coupling. \item \verb|.periodic|: either true, for interpolation on the macro-periodic domain; or false, for general interpolation by divided differences over non-periodic domain or unevenly distributed patches. \item \verb|.stag| is true for interpolation using only odd neighbouring patches as for staggered grids, and false for the usual case of all neighbour coupling. \item \verb|.Cwtsr| and \verb|.Cwtsl|, only for macro-periodic conditions, are the $\verb|ordCC|$-vector of weights for the inter-patch interpolation onto the right and left edges (respectively) with patch:macroscale ratio as specified or as derived from~\verb|dx|. \item \verb|.x| (4D) is $\verb|nSubP| \times1 \times1 \times \verb|nPatch|$ array of the regular spatial locations~$x_{iI}$ of the $i$th~microscale grid point in the $I$th~patch. \item \verb|.ratio|, only for macro-periodic conditions, is the size ratio of every patch. \item \verb|.nEdge| is, for each patch, the number of edge values set by interpolation at the edge regions of each patch. \item \verb|.le|, \verb|.ri| determine inter-patch coupling of members in an ensemble. Each a column vector of length~\verb|nEnsem|. \item \verb|.cs| either \begin{itemize} \item \verb|[]| 0D, or \item if $\verb|nEnsem|=1$, $(\verb|nSubP(1)|-1)\times n_c$ 2D array of microscale heterogeneous coefficients, or \item if $\verb|nEnsem|>1$, $(\verb|nSubP(1)|-1) \times n_c\times m_x$ 3D array of $m_x$~ensemble of phase-shifts of the microscale heterogeneous coefficients. \end{itemize} \item \verb|.parallel|, logical: true if patches are distributed over multiple \textsc{cpu}s\slash cores for the Parallel Computing Toolbox, otherwise false (the default is to activate the \emph{local} pool). \item \verb|.codist|, \emph{optional}, describes the particular parallel distribution of arrays over the active parallel pool. \end{itemize} \subsection{If no arguments, then execute an example} \label{sec:configPatches1eg} \begin{matlab} %} if nargin==0 disp('With no arguments, simulate example of Burgers PDE') %{ \end{matlab} The code here shows one way to get started: a user's script may have the following three steps (``\into'' denotes function recursion). \begin{enumerate}\def\itemsep{-1.5ex} \item configPatches1 \item ode15s integrator \into patchSys1 \into user's PDE \item process results \end{enumerate} Establish global patch data struct to point to and interface with a function coding Burgers' \pde: to be solved on $2\pi$-periodic domain, with eight patches, spectral interpolation couples the patches, with micro-grid spacing~$0.06$, and with seven microscale points forming each patch. \begin{matlab} %} global patches patches = configPatches1(@BurgersPDE, [0 2*pi], ... 'periodic', 8, 0, 0.06, 7); %{ \end{matlab} Set some initial condition, with some microscale randomness. \begin{matlab} %} u0=0.3*(1+sin(patches.x))+0.1*randn(size(patches.x)); %{ \end{matlab} Simulate in time using a standard stiff integrator and the interface function \verb|patchSys1()| (\cref{sec:patchSys1}). \begin{matlab} %} if ~exist('OCTAVE_VERSION','builtin') [ts,us] = ode15s( @patchSys1,[0 0.5],u0(:)); else % octave version [ts,us] = odeOcts(@patchSys1,[0 0.5],u0(:)); end %{ \end{matlab} Plot the simulation using only the microscale values interior to the patches: either set $x$-edges to \verb|nan| to leave the gaps; or use \verb|patchEdgyInt1| to re-interpolate correct patch edge values and thereby join the patches. \cref{fig:config1Burgers} illustrates an example simulation in time generated by the patch scheme applied to Burgers'~\pde. \begin{matlab} %} figure(1),clf if 1, patches.x([1 end],:,:,:)=nan; us=us.'; else us=reshape(patchEdgyInt1(us.'),[],length(ts)); end mesh(ts,patches.x(:),us) view(60,40), colormap(0.7*hsv) title('Burgers PDE: patches in space, continuous time') xlabel('time $t$'), ylabel('space $x$'), zlabel('$u(x,t)$') %{ \end{matlab} \begin{figure} \centering \caption{\label{fig:config1Burgers}field $u(x,t)$ of the patch scheme applied to Burgers'~\pde.} \includegraphics[scale=0.85]{configPatches1} \end{figure} Upon finishing execution of the example, optionally save the graph to be shown in \cref{fig:config1Burgers}, then exit this function. \begin{matlab} %} ifOurCf2eps(mfilename) return end%if nargin==0 %{ \end{matlab} \IfFileExists{../Patch/BurgersPDE.m}{\input{../Patch/BurgersPDE.m}}{} \IfFileExists{../Patch/odeOcts.m}{\input{../Patch/odeOcts.m}}{} \begin{devMan} \subsection{Parse input arguments and defaults} \begin{matlab} %} p = inputParser; fnValidation = @(f) isa(f, 'function_handle'); %test for fn name addRequired(p,'fun',fnValidation); addRequired(p,'Xlim',@isnumeric); %addRequired(p,'Dom'); % nothing yet decided addRequired(p,'nPatch',@isnumeric); addRequired(p,'ordCC',@isnumeric); addRequired(p,'dx',@isnumeric); addRequired(p,'nSubP',@isnumeric); addParameter(p,'nEdge',1,@isnumeric); addParameter(p,'EdgyInt',false,@islogical); addParameter(p,'nEnsem',1,@isnumeric); addParameter(p,'hetCoeffs',[],@isnumeric); addParameter(p,'parallel',false,@islogical); addParameter(p,'nCore',1,@isnumeric); parse(p,fun,Xlim,nPatch,ordCC,dx,nSubP,varargin{:}); %{ \end{matlab} Set the optional parameters. \begin{matlab} %} patches.nEdge = p.Results.nEdge; patches.EdgyInt = p.Results.EdgyInt; patches.nEnsem = p.Results.nEnsem; cs = p.Results.hetCoeffs; patches.parallel = p.Results.parallel; patches.nCore = p.Results.nCore; %{ \end{matlab} Check parameters. \begin{matlab} %} assert(Xlim(1)<Xlim(2) ... ,'two entries of Xlim must be ordered increasing') assert((mod(ordCC,2)==0)|(patches.nEdge==1) ... ,'Cannot yet have nEdge>1 and staggered patch grids') assert(3*patches.nEdge<=nSubP ... ,'too many edge values requested') assert(rem(nSubP,patches.nEdge)==0 ... ,'nSubP must be integer multiple of nEdge') if ~patches.EdgyInt, assert(rem(nSubP/patches.nEdge,2)==1 ... ,'for non-edgyInt, nSubP/nEdge must be odd integer') end if (patches.nEnsem>1)&(patches.nEdge>1) warning('not yet tested when both nEnsem and nEdge non-one') end if patches.nCore>1 warning('nCore>1 not yet tested in this version') end %{ \end{matlab} For compatibility with pre-2023 functions, if parameter \verb|Dom| is \verb|Nan|, then we set the \verb|ratio| to be the value of the so-called \verb|dx| parameter. \begin{matlab} %} if ~isstruct(Dom), pre2023=isnan(Dom); else pre2023=false; end if pre2023, ratio=dx; dx=nan; end %{ \end{matlab} Default macroscale conditions are periodic with evenly spaced patches. \begin{matlab} %} if isempty(Dom), Dom=struct('type','periodic'); end if (~isstruct(Dom))&isnan(Dom), Dom=struct('type','periodic'); end %{ \end{matlab} If \verb|Dom| is a string, then just set type to that string, and then get corresponding defaults for others fields. \begin{matlab} %} if ischar(Dom), Dom=struct('type',Dom); end %{ \end{matlab} Check what is and is not specified, and provide default of Dirichlet boundaries if no \verb|bcOffset| specified when needed. \begin{matlab} %} patches.periodic=false; switch Dom.type case 'periodic' patches.periodic=true; if isfield(Dom,'bcOffset') warning('bcOffset not available for Dom.type = periodic'), end if isfield(Dom,'X') warning('X not available for Dom.type = periodic'), end case {'equispace','chebyshev'} if ~isfield(Dom,'bcOffset'), Dom.bcOffset=[0;0]; end if length(Dom.bcOffset)==1 Dom.bcOffset=repmat(Dom.bcOffset,2,1); end if isfield(Dom,'X') warning('X not available for Dom.type = equispace or chebyshev') end case 'usergiven' if isfield(Dom,'bcOffset') warning('bcOffset not available for usergiven Dom.type'), end assert(isfield(Dom,'X'),'X required for Dom.type = usergiven') otherwise error([Dom.type ' is unknown Dom.type']) end%switch Dom.type %{ \end{matlab} \subsection{The code to make patches and interpolation} First, store the pointer to the time derivative function in the struct. \begin{matlab} %} patches.fun=fun; %{ \end{matlab} Second, store the order of interpolation that is to provide the values for the inter-patch coupling conditions. Spectral coupling is \verb|ordCC| of~$0$ and~$-1$. \begin{matlab} %} assert((ordCC>=-1) & (floor(ordCC)==ordCC), ... 'ordCC out of allowed range integer>=-1') %{ \end{matlab} For odd~\verb|ordCC|, interpolate based upon odd neighbouring patches as is useful for staggered grids. \begin{matlab} %} patches.stag=mod(ordCC,2); ordCC=ordCC+patches.stag; patches.ordCC=ordCC; %{ \end{matlab} Check for staggered grid and periodic case. \begin{matlab} %} if patches.stag, assert(mod(nPatch,2)==0, ... 'Require an even number of patches for staggered grid') end %{ \end{matlab} Third, set the centre of the patches in the macroscale grid of patches, depending upon \verb|Dom.type|. \begin{matlab} %} switch Dom.type %{ \end{matlab} %: case periodic The periodic case is evenly spaced within the spatial domain. Store the size ratio in \verb|patches|. \begin{matlab} %} case 'periodic' X=linspace(Xlim(1),Xlim(2),nPatch+1); DX=X(2)-X(1); X=X(1:nPatch)+diff(X)/2; pEI=patches.EdgyInt;% abbreviation pnE=patches.nEdge; % abbreviation if pre2023, dx = ratio*DX/(nSubP-pnE*(1+pEI))*(2-pEI); else ratio = dx/DX*(nSubP-pnE*(1+pEI))/(2-pEI); end patches.ratio=ratio; %{ \end{matlab} In the case of macro-periodicity, precompute the weightings to interpolate field values for coupling. \todo{Might sometime extend to coupling via derivative values.} \begin{matlab} %} if ordCC>0 [Cwtsr,Cwtsl] = patchCwts(ratio,ordCC,patches.stag); patches.Cwtsr = Cwtsr; patches.Cwtsl = Cwtsl; end %{ \end{matlab} %: case equispace The equi-spaced case is also evenly spaced but with the extreme edges aligned with the spatial domain boundaries, modified by the offset. %\todo{This warning needs refinement for multi-edges??} \begin{matlab} %} case 'equispace' X=linspace(Xlim(1)+((nSubP-1)/2-Dom.bcOffset(1))*dx ... ,Xlim(2)-((nSubP-1)/2-Dom.bcOffset(2))*dx ,nPatch); DX=diff(X(1:2)); width=(1+patches.EdgyInt)/2*(nSubP-1-patches.EdgyInt)*dx; if DX<width*0.999999 warning('too many equispace patches (double overlapping)') end %{ \end{matlab} %: case chebyshev The Chebyshev case is spaced according to the Chebyshev distribution in order to reduce macro-interpolation errors, \(X_i \propto -\cos(i\pi/N)\), but with the extreme edges aligned with the spatial domain boundaries, modified by the offset, and modified by possible `boundary layers'. \footnote{ However, maybe overlapping patches near a boundary should be viewed as some sort of spatial analogue of the `christmas tree' of projective integration and its projection to a slow manifold. Here maybe the overlapping patches allow for a `christmas tree' approach to the boundary layers. Needs to be explored??} \begin{matlab} %} case 'chebyshev' halfWidth=dx*(nSubP-1)/2; X1 = Xlim(1)+halfWidth-Dom.bcOffset(1)*dx; X2 = Xlim(2)-halfWidth+Dom.bcOffset(2)*dx; % X = (X1+X2)/2-(X2-X1)/2*cos(linspace(0,pi,nPatch)); %{ \end{matlab} Search for total width of `boundary layers' so that in the interior the patches are non-overlapping Chebyshev. But the width for assessing overlap of patches is the following variable \verb|width|. We need to find~\verb|b|, the number of patches `glued' together at the boundaries. \begin{matlab} %} pEI=patches.EdgyInt;% abbreviation pnE=patches.nEdge; % abbreviation width=(1+pEI)/2*(nSubP-pnE-pEI*pnE)*dx; for b=0:2:nPatch-2 DXmin=(X2-X1-b*width)/2*( 1-cos(pi/(nPatch-b-1)) ); if DXmin>width, break, end end%for if DXmin<width*0.999999 warning('too many Chebyshev patches (mid-domain overlap)') end %{ \end{matlab} Assign the centre-patch coordinates. \begin{matlab} %} X = [ X1+(0:b/2-1)*width ... (X1+X2)/2-(X2-X1-b*width)/2*cos(linspace(0,pi,nPatch-b)) ... X2+(1-b/2:0)*width ]; %{ \end{matlab} %: case usergiven The user-given case is entirely up to a user to specify, we just force it to have the correct shape of a row. \begin{matlab} %} case 'usergiven' X = reshape(Dom.X,1,[]); end%switch Dom.type %{ \end{matlab} Fourth, construct the microscale grid in each patch, centred about the given mid-points~\verb|X|. Reshape the grid to be 4D to suit dimensions (micro,Vars,Ens,macro). \begin{matlab} %} xs = dx*( (1:nSubP)-mean(1:nSubP) ); patches.x = reshape( xs'+X ,nSubP,1,1,nPatch); %{ \end{matlab} \subsection{Set ensemble inter-patch communication} For \verb|EdgyInt| or centre interpolation respectively, \begin{itemize} \item the right-edge\slash centre realisations \verb|1:nEnsem| are to interpolate to left-edge~\verb|le|, and \item the left-edge\slash centre realisations \verb|1:nEnsem| are to interpolate to~\verb|re|. \end{itemize} \verb|re| and \verb|li| are `transposes' of each other as \verb|re(li)=le(ri)| are both \verb|1:nEnsem|. Alternatively, one may use the statement \begin{verbatim} c=hankel(c(1:nSubP-1),c([nSubP 1:nSubP-2])); \end{verbatim} to \emph{correspondingly} generates all phase shifted copies of microscale heterogeneity (see \verb|homoDiffEdgy1| of \cref{sec:homoDiffEdgy1}). The default is nothing shifty. This setting reduces the number of if-statements in function \verb|patchEdgeInt1()|. \begin{matlab} %} nE = patches.nEnsem; patches.le = 1:nE; patches.ri = 1:nE; %{ \end{matlab} However, if heterogeneous coefficients are supplied via \verb|hetCoeffs|, then do some non-trivial replications. First, get microscale periods, patch size, and replicate many times in order to subsequently sub-sample: \verb|nSubP| times should be enough. If \verb|cs| is more then 2D, then the higher-dimensions are reshaped into the 2nd dimension. \begin{matlab} %} if ~isempty(cs) [mx,nc] = size(cs); nx = nSubP(1); cs = repmat(cs,nSubP,1); %{ \end{matlab} If only one member of the ensemble is required, then sub-sample to patch size, and store coefficients in \verb|patches| as is. \begin{matlab} %} if nE==1, patches.cs = cs(1:nx-1,:); else %{ \end{matlab} But for $\verb|nEnsem|>1$ an ensemble of $m_x$~phase-shifts of the coefficients is constructed from the over-supply. Here code phase-shifts over the periods---the phase shifts are like Hankel-matrices. \begin{matlab} %} patches.nEnsem = mx; patches.cs = nan(nx-1,nc,mx); for i = 1:mx is = (i:i+nx-2); patches.cs(:,:,i) = cs(is,:); end patches.cs = reshape(patches.cs,nx-1,nc,[]); %{ \end{matlab} Further, set a cunning left\slash right realisation of inter-patch coupling. The aim is to preserve symmetry in the system when also invoking \verb|EdgyInt|. What this coupling does without \verb|EdgyInt| is unknown. Use auto-replication. \begin{matlab} %} patches.le = mod((0:mx-1)'+mod(nx-2,mx),mx)+1; patches.ri = mod((0:mx-1)'-mod(nx-2,mx),mx)+1; %{ \end{matlab} Issue warning if the ensemble is likely to be affected by lack of scale separation. Need to justify this and the arbitrary threshold more carefully?? \begin{matlab} %} if ratio*patches.nEnsem>0.9, warning( ... 'Probably poor scale separation in ensemble of coupled phase-shifts') scaleSeparationParameter = ratio*patches.nEnsem end %{ \end{matlab} End the two if-statements. \begin{matlab} %} end%if-else nEnsem>1 end%if not-empty(cs) %{ \end{matlab} \paragraph{If parallel code} then first assume this is not within an \verb|spmd|-environment, and so we invoke \verb|spmd...end| (which starts a parallel pool if not already started). At this point, the global \verb|patches| is copied for each worker processor and so it becomes \emph{composite} when we distribute any one of the fields. Hereafter, {\em all fields in the global variable \verb|patches| must only be referenced within an \verb|spmd|-environment.}% \footnote{If subsequently outside spmd, then one must use functions like \texttt{getfield(patches\{1\},'a')}.} \begin{matlab} %} if patches.parallel % theparpool=gcp() spmd %{ \end{matlab} Second, choose to slice parallel workers in the spatial direction. \begin{matlab} %} pari = 1; patches.codist=codistributor1d(3+pari); %{ \end{matlab} \verb|patches.codist.Dimension| is the index that is split among workers. Then distribute the coordinate direction among the workers: the function must be invoked inside an \verb|spmd|-group in order for this to work---so we do not need \verb|parallel| in argument list. \begin{matlab} %} switch pari case 1, patches.x=codistributed(patches.x,patches.codist); otherwise error('should never have bad index for parallel distribution') end%switch end%spmd %{ \end{matlab} If not parallel, then clean out \verb|patches.codist| if it exists. May not need, but safer. \begin{matlab} %} else% not parallel if isfield(patches,'codist'), rmfield(patches,'codist'); end end%if-parallel %{ \end{matlab} \paragraph{Fin} \begin{matlab} %} end% function %{ \end{matlab} \end{devMan} %}
github
uoa1184615/EquationFreeGit-master
chanDispSpmd.m
.m
EquationFreeGit-master/Patch/chanDispSpmd.m
12,849
utf_8
7f77310d0654cfb42d486fbc11f9a69e
% chanDispSpmd simulates 2D shear dispersion in a long thin % channel with 1D patches as a Proof of Principle example of % parallel computing with spmd. AJR, Nov 2020 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{chanDispSpmd}: simulation of a 1D shear dispersion via simulation on small patches across a channel} \label{sec:chanDispSpmd} \localtableofcontents Simulate 1D shear dispersion along long thin channel, dispersion that is emergent from micro-scale dynamics in 2D space. Use 1D patches as a Proof of Principle example of parallel computing with \verb|spmd|. In this shear dispersion, although the micro-scale diffusivities are one-ish, the shear causes an effective longitudinal `diffusivity' of the order of~$\Pe^2$\,---which is typically much larger than the micro-scale diffusivity \cite[e.g.]{Taylor53}. The spatial domain is the channel (large) $L$-periodic in~$x$ and $|y|<1$\,. Seek to predict a concentration field~$c(x,y,t)$ satisfying the linear advection-diffusion~\pde \begin{equation} \D tc = -\Pe u(y)\D xc+\D x{}\Big[\kappa_x(y)\D xc\Big] +\D y{}\Big[\kappa_y(y)\D yc\Big]. \label{eq:pdeChanDisp} \end{equation} where \Pe\ denotes a Peclet number, parabolic advection velocity $u(y)=\tfrac32(1-y^2)$ with noise, and parabolic diffusivity $\kappa_x(y)=\kappa_y(y)=(1-y^2)$ with noise. The noise is to be multiplicative and log-normal to ensure advection and diffusion are all positive, and to be periodic in~$x$. For a microscale computation we discretise in space with $x$-spacing~$\delta x$, and $n_y$~points over $|y|<1$ with spacing $\delta y:=2/n_y$ at $y_j:=-1+(j-\tfrac12)\delta y$\,, $j=1:n_y$\,. Our microscale discretisation of \pde~\eqref{eq:pdeChanDisp} is then \begin{align}& \D t{c_{ij}}=-\Pe u(y_j)\frac{c_{i+1,j}-c_{i-1,j}}{2\delta x} +\frac{d_{i,j+1/2}-d_{i,j-1/2}}{\delta y} +\frac{D_{i+1/2,j}-D_{i-1/2,j}}{\delta x}\,, \nonumber\\&\quad d_{ij}:=\kappa_y(y_j)\frac{c_{i,j+1/2}-c_{i,j-1/2}}{\delta y}\,,\quad D_{ij}:=\kappa_x(y_j)\frac{c_{i+1/2,j}-c_{i-1/2,j}}{\delta x}\,. \label{eq:ddeChanDisp} \end{align} These are coded in \cref{sec:chanDispMicro} for the computation. Choose one of four cases: \begin{itemize} \item \verb|theCase=1| is corresponding code without parallelisation (in this toy problem it is much the quickest because there is no expensive interprocessor communication); \item \verb|theCase=2| illustrates that \verb|RK2mesoPatch| invokes \verb|spmd| computation if parallel has been configured. \item \verb|theCase=3| shows how users explicitly invoke \verb|spmd|-blocks around the time integration. \item \verb|theCase=4| invokes projective integration for long-time simulation via short bursts of the micro-computation, bursts done within \verb|spmd|-blocks for parallel computing. \end{itemize} First, clear all to remove any existing globals, old composites, etc---although a parallel pool persists. Then choose the case. \begin{matlab} %} clear all theCase = 1 %{ \end{matlab} The micro-scale \pde\ is evaluated at positions~$y_j$ across the channel, $|y|<1$\,. The even indexed points are the collocation points for the \pde, whereas the odd indexed points are the half-grid points for specification of $y$-diffusivities. \begin{matlab} %} ny = 7 y = linspace(-1,1,2*ny+1); yj = y(2:2:end); %{ \end{matlab} Set micro-scale advection (array~1) and diffusivity (array~2) with (roughly) parabolic shape \cite[e.g.]{Watt94b, MacKenzie03}. Here modify the parabola by a heterogeneous log-normal factor with specified period along the channel: modify the strength of the heterogeneity by the coefficient of~\verb|randn| from zero to perhaps one: coefficient~$0.3$ appears a good moderate value. Remember that \verb|configPatches1| reshapes \verb|cHetr| to~2D. \begin{matlab} %} mPeriod = 4 cHetr = shiftdim([3/2 1],-1).*(1-y.^2) ... .*exp(0.3*randn([mPeriod 2*ny+1 2])); %{ \end{matlab} Configure the patch scheme with some arbitrary choices of domain, patches, size ratios. Choose some random order of interpolation to see the alternatives. Set \verb|patches| information to be global so the info can be used for Cases~1--2 without being explicitly passed as arguments. Choose the parallel option if not Case~1, which invokes \verb|spmd|-block internally, so that field variables become \emph{distributed} across cpus. \begin{matlab} %} if theCase<=2, global patches, end nPatch=15 nSubP=2+mPeriod ratio=0.2+0.2*(theCase<4) Len=nPatch/ratio ordCC=2*randi([0 3]) disp('**** Setting configPatches1') patches = configPatches1(@chanDispMicro, [0 Len], nan ... , nPatch, ordCC, ratio, nSubP, 'EdgyInt',true ... ,'hetCoeffs',cHetr ,'parallel',(theCase>1) ); %{ \end{matlab} When using parallel then additional parameters to \verb|patches| should be set within a \verb|spmd| block (because \verb|patches| is a co-distributed structure). \begin{matlab} %} Peclet = 10 if theCase==1, patches.Pe = Peclet; else spmd, patches.Pe = Peclet; end end %{ \end{matlab} \subsection{Simulate heterogeneous advection-diffusion} Set initial conditions of a simulation as shown in \cref{fig:chanDispSpmdt0}. \begin{matlab} %} disp('**** Set initial condition and test dc0dt =') if theCase==1 %{ \end{matlab} Without parallel processing, invoke the usual operations. \begin{matlab} %} c0 = 10*exp(-(ratio*patches.x-2.5).^2/2) +0*yj; c0 = c0.*(1+0.2*rand(size(c0))); dc0dt = patchSys1(0,c0); %{ \end{matlab} With parallel, we must use an \verb|spmd|-block for computations: there is no difference in cases~2--4 here. Also, we must sometimes use \verb|patches.codist| to explicitly code how to distribute new arrays over the cpus. Now \verb|patchSys1| does not invoke \verb|spmd| so higher level code must, as here. Even if \verb|patches| is global, inside \verb|spmd|-block we \emph{must} pass it explicitly as a parameter to \verb|patchSys1|. \begin{matlab} %} else, spmd c0 = 10*exp(-(ratio*patches.x-2.5).^2/2) +0*yj; c0 = c0.*(1+0.2*rand(size(c0),patches.codist)); dc0dt = patchSys1(0,c0,patches) end%spmd end%if theCase %{ \end{matlab} \begin{figure} \centering \caption{\label{fig:chanDispSpmdt0}initial field~$u(x,y,0)$ of the patch scheme applied to a heterogeneous advection-diffusion~\pde. \cref{fig:chanDispSpmdtFin} plots the roughly smooth field values at time $t=4$. In this example the patches are relatively large, ratio~$0.4$, for visibility.} \includegraphics[scale=0.8]{chanDispSpmdt0} \end{figure} Integrate in time, either via the automatic \verb|ode23| or via \verb|RK2mesoPatch| which reduces communication between patches. By default, \verb|RK2mesoPatch| does ten micro-steps for each specified meso-step in~\verb|ts|. For stability: with noise up to~$0.3$, need micro-steps less than~$0.005$; with noise~$1$, need micro-steps less than~$0.0015$. \begin{matlab} %} warning('Integrating system in time, wait patiently') ts=4*linspace(0,1); %{ \end{matlab} Go to the selected case. \begin{matlab} %} switch theCase %{ \end{matlab} \begin{enumerate} \item For non-parallel, we could use \verb|RK2mesoPatch| as indicated below, but instead choose to use standard \verb|ode23| as here \verb|patchSys1| accesses patch information via global \verb|patches|. For post-processing, reshape each and every row of the computed solution to the correct array size---namely that of the initial condition. \begin{matlab} %} case 1 % [cs,uerrs] = RK2mesoPatch(ts,c0); [ts,cs] = ode23(@patchSys1,ts,c0(:)); cs=reshape(cs,[length(ts) size(c0)]); %{ \end{matlab} \item In the second case, \verb|RK2mesoPatch| detects a parallel patch code has been requested, but has only one cpu worker, so it auto-initiates an \verb|spmd|-block for the integration. Both this and the next case return \emph{composite} results, so just keep one version of the results. \begin{matlab} %} case 2 cs = RK2mesoPatch(ts,c0); cs = cs{1}; %{ \end{matlab} \item In this third case, a user could merge this explicit \verb|spmd|-block with the previous one that sets the initial conditions. \begin{matlab} %} case 3,spmd cs = RK2mesoPatch(ts,c0,[],patches); end%spmd cs = cs{1}; %{ \end{matlab} \item In this fourth case, use Projective Integration (PI) over long times (\verb|PIRK4| also works). Currently the PI is done serially, with parallel \verb|spmd|-blocks only invoked inside function \verb|aBurst()| (\cref{secmBfPI}) to compute each burst of the micro-scale simulation. For a Peclet number of ten, the macro-scale time-step needs to be less than about~$0.5$ (which here is very little projection)---presumably the mean advection in a macro-step needs to be less than about the patch spacing. The function \verb|microBurst()| here interfaces to \verb|aBurst()| (\cref{secCHS1mBfPI}) in order to provide shaped initial states, and to provide the patch information. \begin{matlab} %} case 4 microBurst = @(tb0,xb0,bT) ... aBurst(tb0 ,reshape(xb0,size(c0)) ,patches); ts = 0:0.7:5 cs = PIRK2(microBurst,ts,gather(c0(:))); cs = reshape(cs,[length(ts) size(c0)]); %{ \end{matlab} \end{enumerate} End the four cases. \begin{matlab} %} end%switch theCase %{ \end{matlab} \subsection{Plot the solution} Optionally set to save some plots to file. \begin{matlab} %} if 0, global OurCf2eps, OurCf2eps=true, end %{ \end{matlab} \paragraph{Animate the computed solution field over time} \begin{matlab} %} figure(1), clf, colormap(0.8*hsv) %{ \end{matlab} First get the $x$-coordinates and omit the patch-edge values from the plot (because they are not here interpolated). \begin{matlab} %} if theCase==1, x = patches.x; else, spmd x = gather( patches.x ); end%spmd x = x{1}; end x([1 end],:,:,:) = nan; %{ \end{matlab} For every time step draw the concentration values as a set of surfaces on 2D patches, with a short pause to display animation. \begin{matlab} %} nTimes = length(ts) for l = 1:nTimes %{ \end{matlab} At each time, squeeze sub-patch data into a 3D array, permute to get all the $x$-variation in the first two dimensions, and reshape into $x$-variation for each and every~$(y)$. \begin{matlab} %} c = reshape( permute( squeeze( ... cs(l,:,:,:,:) ) ,[1 3 2]) ,numel(x),ny); %{ \end{matlab} Draw surface of each patch, to show both micro-scale and macro-scale variation in space. \begin{matlab} %} if l==1 hp = surf(x(:),yj,c'); axis([0 Len -1 1 0 max(c(:))]) axis equal xlabel('space $x$'), ylabel('$y$'); zlabel('$c(x,y,t)$') ifOurCf2eps([mfilename 't0']) legend(['time = ' num2str(ts(l),'%4.2f')] ... ,'Location','north') disp('**** pausing, press blank to animate') pause else hp.ZData = c'; legend(['time = ' num2str(ts(l),'%4.2f')]) pause(0.1) end %{ \end{matlab} \begin{figure} \centering \caption{\label{fig:chanDispSpmdtFin}final field~$c(x,y,4)$ of the patch scheme applied to a heterogeneous advection-diffusion \pde~\eqref{eq:pdeChanDisp} with heterogeneous factor log-normal, here distributed $\exp[\mathcal N(0,1)]$. } \includegraphics[scale=0.8]{chanDispSpmdtFin} \end{figure} Finish the animation loop, and optionally save the final plot to file, \cref{fig:chanDispSpmdtFin}. \begin{matlab} %} end%for over time ifOurCf2eps([mfilename 'tFin']) %{ \end{matlab} \paragraph{Macro-scale view} Plot a macro-scale mesh of the predictions: at each of a selection of times, for every patch, plot the patch-mean value at the mean-$x$. \begin{matlab} %} figure(2), clf, colormap(0.8*hsv) X = squeeze(mean(x(2:end-1,:,:,:))); C = squeeze(mean(mean(cs(:,2:end-1,:,:,:),2),3)); j = 1:ceil(nTimes/30):nTimes; mesh(X,ts(j),C(j,:)); xlabel('space $x$'),ylabel('time $t$'),zlabel('$C(X,t)$') zlim([-0.1 11]) ifOurCf2eps([mfilename 'Macro']) %{ \end{matlab} \begin{figure} \centering \caption{\label{fig:chanDispSpmdMacro}macro-scale view of heterogeneous advection-diffusion~\pde\ along a (periodic) channel obtained via the patch scheme. } \includegraphics[scale=0.8]{chanDispSpmdMacro} \end{figure} \subsection{\texttt{microBurst} function for Projective Integration} \label{secCHS1mBfPI} Projective Integration stability appears to require bursts longer than~$0.2$. Each burst is done in parallel processing. Here use \verb|RK2mesoPatch| to take take meso-steps, each with default ten micro-steps so the micro-scale step is~$0.0033$. With macro-step~$0.5$, these parameters usually give stable projective integration. \begin{matlab} %} function [tbs,xbs] = aBurst(tb0,xb0,patches) normx=max(abs(xb0(:))); disp(['* aBurst t=' num2str(tb0) ' |x|=' num2str(normx)]) assert(normx<20,'solution exploding') tbs = tb0+(0:0.033:0.2); spmd xb0 = codistributed(xb0,patches.codist); xbs = RK2mesoPatch(tbs,xb0,[],patches); end%spmd xbs=reshape(xbs{1},length(tbs),[]); end%function %{ \end{matlab} Fin. \input{../Patch/chanDispMicro.m} %}
github
uoa1184615/EquationFreeGit-master
Combescure2022.m
.m
EquationFreeGit-master/Patch/Combescure2022.m
20,113
utf_8
1b2e5e650fdd07081db07d4a2c4c942a
% For an example nonlinear elasticity in 1D, simulate and % use MatCont to continue parametrised equilibria. An % example of working via patches in space. Adapted from the % example Figure 3(a) of Combescure(2022). AJR Nov 2022 -- % 13 Mar 2023 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{Combescure2022}: simulation and continuation of a 1D example nonlinear elasticity, via patches} \label{sec:Combescure2022} Here we explore a nonlinear 1D elasticity problem with complicated microstructure. Executes a simulation. \emph{But the main aim is to show how one may use the MatCont continuation toolbox \cite[]{Govaerts2019} together with the Patch Scheme toolbox} \cite[]{Maclean2020a} in order to explore parameter space by continuing branches of equilibria, etc. \begin{figure} \centering \caption{\label{fig:toyElas}1D arrangement of non-linear springs with connections to (a) next-to-neighbour node \protect\cite[Fig.~3(a)]{Combescure2022}. The blue box is one micro-cell of one period, width~\(2b\), containing an odd and an even~\(i\).} \setlength{\unitlength}{0.01\linewidth} \begin{picture}(100,31) \put(0,0){\framebox(100,31){}} \put(0,0){\includegraphics[width=\linewidth]{Figs/toyElas}} \put(36,4){\color{blue}\framebox(27,23){cell}} \end{picture} \end{figure} \cref{fig:toyElas} shows the microscale elasticity---adapted from Fig.~3(a) by \cite{Combescure2022}. Let the spatial microscale lattice be at rest at points~\(x_i\), with constant spacing~\(b\). With displacement variables~\(u_i(t)\), simulate the microscale lattice toy elasticity system with 2-periodicity: for \(p=1,2\) (respectively black and red in \cref{fig:toyElas}) and for every~\(i\), \begin{align} &\epsilon^p_i:=\frac1{pb}(u_{i+p/2}-u_{i-p/2}), &&\sigma^p_i:=w'_p(\epsilon^p_i), \nonumber\\ &\DD t{u_{i}}= \sum_{p=1}^2\frac1{pb}(\sigma^p_{i+p/2}-\sigma^p_{i-p/2}), &&w'_p(\epsilon):=\epsilon-M_p\epsilon^3+\epsilon^5. \label{eq:heteroNLE} \end{align} The system has a microscale heterogeneity via the two different functions~\(w'_p(\epsilon)\) \cite[\S4]{Combescure2022}: \begin{itemize} \item microscale `instability' (structure) arises with \(M_1:=2\) and \(M_2:=1\) (\cref{fig:Comb22diffuSvis2b,fig:Comb22cpl}(b)); and \item large scale `instability' (structure) arises with \(M_1:=-1\) and \(M_2:=3\) (\cref{fig:Comb22diffuLvis1,fig:Comb22cpl}(a)). \end{itemize} \paragraph{Microscale case} Set \(M_1:=2\) and \(M_2:=1\)\,. We fix the boundary conditions \(u(0)=0\) and parametrise solutions by~\(u(L)\). There are equilibria \(u\approx u(L)x/L\), but under large compression (large negative~\(u(L)\)) interesting structures develop. \cref{fig:Comb22diffuSvis2b} shows boundary layers with microscale variations develop for \(u(L)<-13\). This figure plots a strain~\(\epsilon\) as the strain is nearly constant across the interior, so the boundary layers show up clearly. As~\(u(L)\) decreases further, \cref{fig:Comb22diffuSvis2b} shows the family of equilibria form complicated folds. \cref{tblMicro} lists that MatCont also reports some branch points and neutral saddle equilibria in this same regime (see \cref{fig:Comb22cpl}(b)). I have not yet followed any of the branches. \begin{SCfigure} \centering \caption{\label{fig:Comb22diffuSvis2b}the case of microscale `instability' appears as fluctuations close to both boundaries. As the system is physically compressed, the equilibrium curve has complicated folds, as shown here (and \cref{fig:Comb22cpl}(b)).} \includegraphics[scale=0.8]{Comb22diffuSvis2b} \end{SCfigure} \begin{SCtable} \centering\caption{\label{tblMicro}Interesting equilibria for the cases of small scale instability: \(M_1:=2\), \(M_2:=1\) (\cref{fig:Comb22diffuSvis2b,fig:Comb22cpl}(b)). The rightmost column gives the \(-u(L)\)~parameter values for corresponding critical points in the three-patch code (\cref{fig:Comb22diffuSvis2N3}).} \begin{tabular}{@{}rp{12.1em}r@{}} \hline $-u(L)$&MatCont description &\text{Patch}\\\hline 14.684 & Branch point &14.599\\ 14.702 & Limit point &14.610\\ 14.612 & Neutral Saddle Equilibrium &-\\ 14.063 & Neutral Saddle Equilibrium &-\\ 13.972 & Limit point &13.817\\ 13.988 & Branch point &13.828\\ 17.184 & Branch point &17.197\\ - & Limit point &17.227\\ 17.183 & Neutral Saddle Equilibrium &17.211\\ %15.034 & Neutral Saddle Equilibrium \\ %15.024 & Limit point \\ %15.032 & Branch point \\ %17.987 & Branch point \\ %17.993 & Limit point \\ %17.987 & Neutral Saddle Equilibrium \\ \hline \end{tabular} \end{SCtable} The previous paragraph's discussion is for a full domain simulation, albeit done through an imposed computational framework of physically abutting patches. \cref{fig:Comb22diffuSvis2N3} shows the corresponding MatCont continuation for the patch scheme with \(N=3\) patches in the domain. Just three patches may well be reasonable as the structures in this problem are the two boundary layers, and a constant interior. \cref{fig:Comb22diffuSvis2N3} shows the patch scheme reasonably resolves these. \cref{tblMicro} also lists the special points, as reported by MatCont, in the equilibria of the patch scheme. The locations of these special points reasonably match those found by the full domain simulation. Importantly, MatCont is about \emph{ten times quicker to execute on the patches} than on the full domain code. This speed-up indicates that on larger scale problems the patch scheme could be very useful in continuation explorations. \begin{SCfigure} \centering \caption{\label{fig:Comb22diffuSvis2N3}using just three patches, the case of microscale instability appears as fluctuations close to both boundaries. As the system is physically compressed, the equilibrium curve has complicated folds, as shown, and that approximately match \cref{fig:Comb22diffuSvis2b}. But it is computed ten times quicker.} \includegraphics[scale=0.8]{Comb22diffuSvis2N3} \end{SCfigure} \paragraph{Large scale case} Set \(M_1:=-1\) and \(M_2:=3\)\,. We fix the boundary conditions \(u(0)=0\) and parametrise solutions by~\(u(L)\). There are equilibria \(u\approx u(L)x/L\), but under large compression (large negative~\(u(L)\)) interesting structures develop. \cref{fig:Comb22diffuLvis1} shows an interior region of higher magnitude strain develops. Again, this figure plots a strain~\(\epsilon\) as the strain is nearly constant across the domain, so the interior structure shows up clearly. As~\(u(L)\) decreases further, \cref{fig:Comb22diffuLvis1} shows the family of equilibria form complicated folds. \cref{tblLarge} lists that MatCont also reports some branch points and neutral saddle equilibria in this regime (see \cref{fig:Comb22cpl}(a)). I have not yet followed any of the branches. \begin{SCfigure} \centering \caption{\label{fig:Comb22diffuLvis1}the case of large scale `instability'. Spatial structure appears in the middle of the domain. As the system is physically compressed, the equilibrium curve has complicated folds, as shown here and in \cref{fig:Comb22cpl}(a).} \includegraphics[scale=0.8]{Comb22diffuLvis1} \end{SCfigure} \begin{SCtable} \centering\caption{\label{tblLarge}Interesting equilibria for the cases of large scale instability: \(M_1:=-1\), \(M_2:=3\) (\cref{fig:Comb22diffuLvis1,fig:Comb22cpl}(a)).} \begin{tabular}{@{}rp{12.1em}r@{}} \hline $-u(L)$&MatCont description \\\hline 21.295 & Limit point \\ 18.783 & Branch point \\ 18.762 & Neutral Saddle Equilibrium \\ 18.761 & Neutral Saddle Equilibrium \\ 18.761 & Limit point \\ 18.934 & Branch point \\ 19.393 & Branch point \\ 19.928 & Branch point \\ 20.490 & Branch point \\ 21.055 & Branch point \\ 21.627 & Branch point \\ \hline \end{tabular} % these are from N=3 patches %21.469 & Branch point \\ %23.342 & Neutral Saddle Equilibrium \\ %23.462 & Branch point \\ %29.95 & Hopf \\ \end{SCtable} The patch scheme with \(N=3\) patches does not make reasonable predictions here. I suspect this failure is because the nontrivial interior structure here occupies too much of the domain to fit into one `small' patch. Here the patch scheme may be useful if the physical domain is larger. \subsection{Configure heterogeneous toy elasticity systems} \label{sec:chtes} Set some physical parameters. Each cell is of width~\(dx:=2b\) as I choose to store~\(u_i\) for odd~\(i\) in \verb|u((i+1)/2,1,:)| and for even~\(i\) in \verb|u(i/2,2,:)|, that is, the the physical displacements form the array \begin{equation*} \verb|u|=\begin{bmatrix} u_1&u_2\\ u_3&u_4\\ u_5&u_6\\ \vdots&\vdots \end{bmatrix}. \end{equation*} Then corresponding velocities are adjoined as 3rd and 4th column. \begin{matlab} %} clear all global b M vis b = 1 % separation of lattice points N = 42 % # lattice steps in L L = b*N % length of domain %{ \end{matlab} The nonlinear coefficients of stress-strain are in array~\verb|M|, chosen by~\verb|theCase|. \begin{matlab} %} theCase = 2 switch theCase case 1, M = [0 0 0 0] % linear spring coefficients case 2, M = [ 2 1 1 1] % micro scale instability?? case 3, M = [-1 3 1 1] % large scale instability?? end% switch vis = 0.1 % does not appear to affect the equilibria tEnd = 25 %{ \end{matlab} Patch parameters: here \verb|nSubP| is the number of cells. \begin{matlab} %} edgyInt = true nSubP = 6, nPatch = 5 % gives full-domain on N=42, dx=2 %nSubP = 6, nPatch = 3 % patches for some crude comparison %{ \end{matlab} Establish the global data struct~\verb|patches| for the microscale heterogeneous lattice elasticity system~\cref{eq:heteroNLE}. Solved with \verb|nPatch| patches, and interpolation (as high-order as possible) to provide the edge-values of the inter-patch coupling conditions. \begin{matlab} %} global patches configPatches1(@heteroNLE,[0 L],'equispace',nPatch ... ,0,2*b,nSubP,'EdgyInt',edgyInt); xx = patches.x+[-1 1]*b/2; % staggered sub-cell positions %{ \end{matlab} \subsection{Simulate in time} Set the initial displacement and velocity of a simulation. Integrate some time using standard integrator. \begin{matlab} %} u0 = [ sin(pi/L*xx) -0*0.14*cos(pi/L*xx) ]; tic [ts,ust] = ode23(@patchSys1, tEnd*linspace(0,1,41), u0(:) ... ,[],patches,0); cpuIntegrateTime = toc %{ \end{matlab} \paragraph{Plot space-time surface of the simulation} To see the edge values of the patches, interpolate and then adjoin a row of \verb|nan|s between patches. Because of the odd/even storage we need to do a lot of permuting and reshaping. First, array of sub-cell coordinates in a column for each patch, separating patches also by an extra row of nans. \begin{matlab} %} xs = reshape( permute( xx ,[2 1 3 4]), 2*nSubP,nPatch); xs(end+1,:) = nan; %{ \end{matlab} Interpolate patch edge values, at all times simultaneously by including time data into the 2nd dimension, and 2nd reshaping it into the 3rd dimension. \begin{matlab} %} uvs = reshape( permute( reshape(ust ... ,length(ts),nSubP,4,1,nPatch) ,[2 3 1 4 5]) ,nSubP,[],1,nPatch); uvs = reshape( patchEdgeInt1(uvs) ,nSubP,4,[],nPatch); %{ \end{matlab} Extract displacement field, merge the 1st two columns, permute the time variations to the 3rd, separate patches by NaNs, and merge spatial data into the 1st column. \begin{matlab} %} us = reshape( permute( uvs(:,1:2,:,:) ... ,[2 1 4 3]) ,2*nSubP,nPatch,[]); us(end+1,:,:) = nan; us = reshape(us,[],length(ts)); %{ \end{matlab} Plot space-time surface of displacements over the macroscale duration of the simulation. \begin{matlab} %} figure(1), clf() mesh(ts,xs(:),us) view(60,40), colormap(0.8*jet), axis tight xlabel('time $t$'), ylabel('space $x$'), zlabel('$u(x,t)$') %{ \end{matlab} Ditto for the velocity. \begin{matlab} %} vs = reshape( permute( uvs(:,3:4,:,:) ... ,[2 1 4 3]) ,2*nSubP,nPatch,[]); vs(end+1,:,:) = nan; vs = reshape(vs,[],length(ts)); figure(2), clf() mesh(ts,xs(:),vs) view(60,40), colormap(0.8*jet), axis tight xlabel('time $t$'), ylabel('space $x$'), zlabel('$v(x,t)$') drawnow %{ \end{matlab} \subsection{MatCont continuation} First, use \verb|fsolve| to find an equilibrium at some starting compressive displacement---a compression that differs depending upon the case of nonlinearity. \begin{matlab} %} muL0 = 12+6*(theCase==3) u0 = [ -muL0*xx/L 0*xx ]; u0([1 end],:,:,:)=nan; patches.i = find(~isnan(u0)); nVars=length(patches.i) ueq=fsolve(@(v) dudtSys(0,v,muL0),u0(patches.i)); %{ \end{matlab} Start search for equilibria at other compression parameters. Starting from zero, need 1000+ to find both the large-scale and small-scale instability cases. But need less points when starting from parameter~\(12\) or so. \begin{matlab} %} disp('Searching for equilibria, may take 1000+ secs') [uv0,vec0]=init_EP_EP(@matContSys,ueq,muL0,[1]); opt=contset; % initialise MatCont options opt=contset(opt,'Singularities',true); %to report branch points, p.24 opt=contset(opt,'MaxNumPoints',400); % restricts how far matcont goes opt=contset(opt,'Backward',true); % strangely, needs to go backwards?? [uv,vec,s,h,f]=cont(@equilibrium, uv0, [], opt); %MatCont continuation %{ \end{matlab} \paragraph{Post-process the report} \begin{matlab} %} disp('List of interesting critical points') muLs=uv(nVars+1,:); for j=1:numel(s) disp([num2str(muLs(s(j).index),5) ' & ' s(j).msg ' \\']) end %{ \end{matlab} Find a range of parameter and corresponding indices where all the critical points occur. \begin{matlab} %} p1=muLs(end); pe=muLs(1); if numel(s)>3, for j=2:numel(s)-1 p1=min(p1,muLs(s(j).index)); pe=max(pe,muLs(s(j).index)); end, end pMid=(p1+pe)/2, pWid=abs(pe-p1) iPars=find(abs(muLs(:)-pMid)<pWid);%include some either side %{ \end{matlab} Choose an `evenly spaced' subset of the range so we only plot up to sixty of the parameter values reported in the range. \begin{matlab} %} nPars=numel(iPars) dP=ceil((nPars-1)/60) iP=1:dP:nPars; muLP=muLs(iPars(iP)); %{ \end{matlab} Interpolate patch edge values, at all parameters simultaneously by including parameter-wise data into the 2nd dimension, and 2nd reshaping it into the 3rd dimension. \begin{matlab} %} uvs=nan(numel(iP),numel(u0)); uvs(:,patches.i)=uv(1:nVars,iPars(iP))'; uvs = reshape( permute( reshape(uvs ... ,length(muLP),nSubP,4,1,nPatch) ,[2 3 1 4 5]) ,nSubP,[],1,nPatch); uvs = reshape( patchEdgeInt1(uvs) ,nSubP,4,[],nPatch); %{ \end{matlab} Extract displacement field, merge the 1st two columns, permute the parameter variations to the 3rd, separate patches by NaNs, and merge spatial data into the 1st column. \begin{matlab} %} us = reshape( permute( uvs(:,1:2,:,:) ... ,[2 1 4 3]) ,2*nSubP,nPatch,[]); us(end+1,:,:) = nan; us = reshape(us,[],length(muLP)); %{ \end{matlab} Plot space-time surface of displacements over the macroscale duration of the simulation. \begin{matlab} %} figure(4), clf() mesh(muLP,xs(:),us) view(60,40), colormap(0.8*jet), axis tight xlabel('-u(L)'), ylabel('space $x$'), zlabel('$u(x)$') %{ \end{matlab} Plot space-time surface of strain, differences in displacements, over the parameter variation. \begin{matlab} %} figure(5), clf() mesh(muLP,xs(1:end-1),diff(us)) view(45,20), colormap(0.8*jet), axis tight xlabel('$-u(L)$'), ylabel('space $x$'), zlabel('strain $\delta u(x)$') ifOurCf2eps(['Comb22diffu' num2str(theCase)],[12 9])%optionally save %{ \end{matlab} \begin{figure} \centering \caption{\label{fig:Comb22cpl}cross-sections through \cref{fig:Comb22diffuLvis1,fig:Comb22diffuSvis2b}: (a)~large scale case, at the mid-point in space of \cref{fig:Comb22diffuLvis1}; (b)~microscale case, in a boundary layer of \cref{fig:Comb22diffuSvis2b}. These cross-sections are labelled with the various critical points.} \begin{tabular}{@{}cc@{}} (a) large scale case & (b) microscale case\\ \includegraphics[scale=0.75]{Figs/Comb22cpl3}& \includegraphics[scale=0.75]{Figs/Comb22cpl2} \end{tabular} \end{figure} \paragraph{Labelled parameter plot} Get the labelled 2D plots of \cref{fig:Comb22cpl} via MatCont's \verb|cpl| function. In high-D problems it is unlikely that any one variable is a good thing to plot, so I show how to plot something else, here a strain. I use all the computed points so reform~\verb|uvs| (possibly better to have merged the critical points into the list of plotted parameters??). \begin{matlab} %} uvs = nan(numel(muLs),numel(u0)); uvs(:,patches.i) = uv(1:nVars,:)'; uvs = reshape( uvs ,[],nSubP,4,nPatch); %{ \end{matlab} As a function of the parameter, plot the strain in the middle of the domain (the middle of the middle patch), unless it is the microscale case when we plot a strain near the middle of the left boundary layer. \begin{matlab} %} if theCase==2, thePatch=1; else thePatch=(nPatch+1)/2; end%if figure(7),clf du = diff( uvs(:,nSubP/2,1:2,thePatch) ,1,3); cpl([muLs;du'],[],s); xlabel('$-u(L)$') if thePatch==1, ylabel('boundary layer strain') else ylabel('mid-domain strain') end ifOurCf2eps(['Comb22cpl' num2str(theCase)],[9 7])%optionally save %{ \end{matlab} \subsection{\texttt{matContSys}: basic function for MatCont analysis} This is the simple `odefile' of the patch scheme wrapped around the microcode. \begin{matlab} %} function out = matContSys%(t,coordinates,flag,y,z) out{1} = [];%@init; out{2} = @dudtSys; out{3} = [];%@jacobian; out{4} = [];%@jacobianp; out{5} = [];%@hessians; out{6} = [];%@hessiansp; out{7} = []; out{8} = []; out{9} = []; end% function matContSys %{ \end{matlab} \subsection{\texttt{dudtSys()}: wraps around the patch wrapper} This function adjoins \verb|patches| to the argument list, places the variables within the patch structure, and then extracts their time derivatives to return. Used by both MatCont and \verb|fsolve|. \begin{matlab} %} function ut = dudtSys(t,u,p) global patches %{ \end{matlab} The 4 here is the number of variables in each micro-cell, that is, notionally `at' each \(x\)-grid point. \begin{matlab} %} U=nan(1,4)+patches.x; U(patches.i)=u(:); Ut=patchSys1(t,U,patches,p); ut=Ut(patches.i); end %{ \end{matlab} \subsection{\texttt{heteroNLE()}: forced heterogeneous elasticity} \label{sec:heteroNLE} This function codes the lattice heterogeneous example elasticity inside the patches. Computes the time derivative at each point in the interior of a patch, output in~\verb|uvt|. \begin{matlab} %} function uvt = heteroNLE(t,uv,patches,muL) if nargin<4, muL=0; end% default end displacement is zero global b M vis %{ \end{matlab} Separate state vector into displacement and velocity fields: \(u_{ijI}\)~is the displacement at the \(j\)th~point in the \(i\)th 2-cell in the \(I\)th~patch; similarly for velocity~\(v_{ijI}\). That is, physically neighbouring points have different~\(j\), whereas physical next-to-neighbours have \(i\)~different by one. \begin{matlab} %} u=uv(:,1:2,:,:); v=uv(:,3:4,:,:); % separate u and v=du/dt %{ \end{matlab} Provide boundary conditions, here fixed displacement and velocity in the left/right sub-cells of the leftmost/rightmost patches. \begin{matlab} %} u(1,:,:,1)=0; v(1,:,:,1)=0; u(end,:,:,end)=-muL; v(end,:,:,end)=0; %{ \end{matlab} Compute the two different strain fields, and also a first derivative for some optional viscosity. \begin{matlab} %} eps2 = diff(u)/(2*b); eps1 = [u(:,2,:,:)-u(:,1,:,:) u([2:end 1],1,:,:)-u(:,2,:,:)]/b; eps1(end,2,:,:)=nan; % as this value is fake vx1 = [v(:,2,:,:)-v(:,1,:,:) v([2:end 1],1,:,:)-v(:,2,:,:)]/b; vx1(end,2,:,:)=nan; % as this value is fake %{ \end{matlab} Set corresponding nonlinear stresses \begin{matlab} %} sig2 = eps2-M(2)*eps2.^3+M(4)*eps2.^5; sig1 = eps1-M(1)*eps1.^3+M(3)*eps1.^5; %{ \end{matlab} Preallocate output array, and fill in time derivatives of displacement and velocity, from velocity and gradient of stresses, respectively. \begin{matlab} %} uvt = nan+uv; % preallocate output array i=2:size(uv,1)-1; % rate of change of position uvt(i,1:2,:,:) = v(i,:,:,:); % rate of change of velocity +some artificial viscosity?? uvt(i,3:4,:,:) = diff(sig2) ... +[ sig1(i,1,:,:)-sig1(i-1,2,:,:) diff(sig1(i,:,:,:),1,2)] ... +vis*[ vx1(i,1,:,:)-vx1(i-1,2,:,:) diff(vx1(i,:,:,:),1,2) ]; end% function heteroNLE %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
heteroDiff.m
.m
EquationFreeGit-master/Patch/heteroDiff.m
1,322
utf_8
e25f9b6b97e32d8fd2d51c533139ff0f
% Computes the time derivatives of heterogeneous diffusion % in 1D on patches. Used by homogenisationExample.m, % homoDiffEdgy1.m Optionally becomes Burgers PDE with % heterogeneous advection. AJR, Apr 2019 -- Nov 2020 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \subsection{\texttt{heteroDiff()}: heterogeneous diffusion} \label{sec:heteroDiff} This function codes the lattice heterogeneous diffusion inside the patches. For 2D input arrays~\verb|u| and~\verb|x| (via edge-value interpolation of \verb|patchSys1|, \cref{sec:patchSys1}), computes the time derivative~\cref{eq:HomogenisationExample} at each point in the interior of a patch, output in~\verb|ut|. The column vector of diffusivities~\(c_i\), and possibly Burgers' advection coefficients~\(b_i\), have previously been stored in struct~\verb|patches.cs|. \begin{matlab} %} function ut = heteroDiff(t,u,patches) dx = diff(patches.x(2:3)); % space step i = 2:size(u,1)-1; % interior points in a patch ut = nan+u; % preallocate output array ut(i,:,:,:) = diff(patches.cs(:,1,:).*diff(u))/dx^2; % possibly include heterogeneous Burgers' advection if size(patches.cs,2)>1 % check for advection coeffs buu = patches.cs(:,2,:).*u.^2; ut(i,:) = ut(i,:)-(buu(i+1,:)-buu(i-1,:))/(dx*2); end end% function %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
burgersMap.m
.m
EquationFreeGit-master/Patch/burgersMap.m
715
utf_8
cf2b2e562653643533e6ba812a3c7deb
% Microscale Euler step of the Burgers PDE on a lattice in % x. Used by BurgersExample.m AJR, 4 Apr 2019 -- Nov 2020 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \subsection{\texttt{burgersMap()}: discretise the PDE microscale} \label{sec:burgersMap} This function codes the microscale Euler integration map of the lattice differential equations inside the patches. Only the patch-interior values are mapped (\verb|patchSys1()| overrides the edge-values anyway). \begin{matlab} %} function u = burgersMap(t,u,patches) u = squeeze(u); dx = diff(patches.x(2:3)); dt = dx^2/2; i = 2:size(u,1)-1; u(i,:) = u(i,:) +dt*( diff(u,2)/dx^2 ... -20*u(i,:).*(u(i+1,:)-u(i-1,:))/(2*dx) ); end %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
hyperDiffHetero.m
.m
EquationFreeGit-master/Patch/hyperDiffHetero.m
5,091
utf_8
59b2e77ff7d0ff83e8b8355ac6ea570b
% Simulate a heterogeneous version of hyper-diffusion PDE in % 1D on patches as an example application with pairs of edge % points needing to be interpolated between patches in % space. AJR, 12 Apr 2023 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{hyperDiffHetero}: simulate a heterogeneous hyper-diffusion PDE in 1D on patches} \label{sec:hyperDiffHetero} \localtableofcontents \cref{fig:hyperDiffHeteroU} shows an example simulation in time generated by the patch scheme applied to a heterogeneous version of the hyper-diffusion \pde. That such simulations makes valid predictions was established by \cite{Bunder2013b} who proved that the scheme is accurate when the number of points in a patch is tied to a multiple of the periodicity of the pattern. \begin{figure} \centering \caption{\label{fig:hyperDiffHeteroU} hyper-diffusing field~\(u(x,t)\) in the patch scheme applied to microscale heterogeneous hyper-diffusion (\cref{sec:hyperDiffHetero}). The log-time axis shows: \(t<10^{-2}\), rapid decay of sub-patch micro-structure; \(10^{-2}<t<1\), meso-time quasi-equilibrium; and \(1<t<10^2\), slow decay of macroscale structures.} \includegraphics[scale=0.9]{hyperDiffHeteroUxt} \end{figure}% We aim to simulate the heterogeneous hyper-diffusion \pde \begin{equation} u_t= -D[c_1(x)Du] \quad\text{where operator } D := \partial_x( c_2(x) \partial_x ), \label{eq:hyperDiffHetero} \end{equation} for microscale periodic coefficients~\(c_l(x)\), and boundary conditions of \(u=u_x=0\) at \(x=0,L\). In this 1D space, the macroscale, homogenised, effective hyper-diffusion should be some unknown `average' of these coefficients, but we use the patch scheme to provide a computational homogenisation. We discretise the \pde\ to a lattice of values~\(u_i(t)\), with lattice spacing~\(dx\), and governed by \begin{equation*} \dot u_i = -D[c_{i1}D u_i] \quad\text{where operator } D := \delta( c_{i2}\delta )/dx^2 \end{equation*} in terms of centred difference operator \(\delta u_i := u_{i+1/2} - u_{i-1/2}\). Set the desired microscale periodicity, and correspondingly choose random microscale diffusion coefficients (with some subscripts shifted by a half). \begin{matlab} %} clear all basename = mfilename %global OurCf2eps, OurCf2eps=true %optional to save plots nGap = 3 % controls size of gap between patches nPtsPeriod = 5 dx = 0.5/nGap/nPtsPeriod %{ \end{matlab} Create some random heterogeneous coefficients, log-uniform. \begin{matlab} %} csVar = 1 cs = 0.2*exp( -csVar/2+csVar.*rand(nPtsPeriod,2) ) %{ \end{matlab} Establish global data struct~\verb|patches| for heterogeneous hyper-diffusion on a finite domain with, on average, one patch per unit length. Use seven patches, and use high-order interpolation with \(\verb|ordCC|=0\). \begin{matlab} %} nPatch = 7 nSubP = 2*nPtsPeriod+4 % or +2 for not-edgyInt Len = nPatch; ordCC = 0; dom.type = 'equispace'; dom.bcOffset = 0.5 % for BC type patches = configPatches1(@hyperDiffPDE,[0 Len],dom ... ,nPatch,ordCC,dx,nSubP,'EdgyInt',true,'nEdge',2 ... ,'hetCoeffs',cs); xs=squeeze(patches.x); %{ \end{matlab} \paragraph{Simulate in time} Set an initial condition, and here integrate forward in time using a standard method for stiff systems---because of the simplicity of linear problems this method works quite efficiently here. Integrate the interface \verb|patchSys1| (\cref{sec:patchSys1}) to the microscale differential equations. \begin{matlab} %} u0 = sin(2*pi/Len*patches.x).*rand(nSubP,1,1,nPatch); tic [ts,us] = ode15s(@patchSys1, [0 100], u0(:) ,[],patches); simulateTime = toc us = reshape(us,length(ts),numel(patches.x(:)),[]); %{ \end{matlab} Plot the simulation in \cref{fig:hyperDiffHeteroU}, using log-axis for time so we can see a little of both micro- and macro-dynamics. \begin{matlab} %} figure(1),clf xs([1:2 end-1:end],:) = nan; t0=min(find(ts>1e-5)); mesh(ts(t0:3:end),xs(:),us(t0:3:end,:)'), view(55,50) colormap(0.7*hsv) xlabel('time $t$'), ylabel('space $x$'), zlabel('$u(x,t)$') ca=gca; ca.XScale='log'; ca.XLim=ts([t0 end]); ifOurCf2eps([basename 'Uxt']) %{ \end{matlab} Fin. \subsection{Heterogeneous hyper-diffusion PDE inside patches} As a microscale discretisation of hyper-diffusion \pde~\cref{eq:hyperDiffHetero} \(u_t= -D[c_1(x)Du] \), where heterogeneous operator \(D = \partial_x( c_2(x) \partial_x )\). \begin{matlab} %} function ut=hyperDiffPDE(t,u,patches) dx=diff(patches.x(1:2)); % microscale spacing %{ \end{matlab} Code Dirichlet boundary conditions of zero function and derivative at left-end of left-patch, and right-end of right-patch. For slightly simpler coding, squeeze out the two singleton dimensions. \begin{matlab} %} u = squeeze(u); if ~patches.periodic % discretise BC u=u_x=0 u(1:2,1)=0; u(end-1:end,end)=0; end%if %{ \end{matlab} Here code straightforward centred discretisation in space. \begin{matlab} %} ut = nan+u; % preallocate output array v = patches.cs(2:end,1).*diff(patches.cs(:,2).*diff(u))/dx^2; ut(3:end-2,:) = -diff(patches.cs(2:end-1,2).*diff(v))/dx^2 ; end %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
rotFilmMicro.m
.m
EquationFreeGit-master/Patch/rotFilmMicro.m
3,955
utf_8
09ccd41412bd78572f9d4d444e4228c8
% rotFilmMicro() computes the time derivatives of a 2D % shallow water flow on a rotating heterogeneous substrate % on 2D patches in space. AJR, Dec 2020 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \subsection{\texttt{rotFilmMicro()}: 2D shallow water flow on a rotating heterogeneous substrate} \label{sec:rotFilmMicro} This function codes the heterogeneous shallow water flow~\eqref{eqs:spinddt} inside 2D patches. The \pde{}s are discretised on the multiscale lattice in terms of evolving variables~$h_{ijIJ}$, $u_{ijIJ}$ and~$v_{ijIJ}$. For 6D input array~\verb|huv| (via edge-value interpolation of \verb|patchEdgeInt2()|, \cref{sec:patchSys2}), computes the time derivatives~\eqref{eqs:spinddt} at each point in the interior of a patch, output in~\verb|huvt|. The heterogeneous bed drag and diffusivities,~$b_{ij}$ and~$\nu_{ij}$, have previously been merged and stored in the array~\verb|patches.cs| (2D${}\times3$): herein \verb|patches| is named~\verb|p|. \begin{matlab} %} function huvt = rotFilmMicro(t,huv,p) [nx,ny,~]=size(huv); % micro-grid points in patches i = 2:nx-1; % x interior points in a patch j = 2:ny-1; % y interior points in a patch dx = diff(p.x(2:3)); % x space step dy = diff(p.y(2:3)); % y space step huvt = nan+huv; % preallocate output array %{ \end{matlab} Set indices of fields in the arrays. Need to store different diffusivity values for the $x,y$-directions as they are evaluated at different points in space. \begin{matlab} %} h=1; u=2; v=3; b=1; nux=2; nuy=3; %{ \end{matlab} Use a staggered micro-grid so that $\verb|h(i,j)| =h_{ij}$, $\verb|u(i,j)| =u_{i+1/2,j}$, and $\verb|v(i,j)| =v_{i,j+1/2}$. We need the following to interpolate some quantities to other points on the staggered micro-grid. But the first two statements fill-in two needed corner values because they are not (currently) interpolated by \verb|patchEdgeInt2()|. \begin{matlab} %} huv(1,ny,u,:,:,:) = huv(2,ny,u,:,:,:)+huv(1,ny-1,u,:,:,:) ... -huv(2,ny-1,u,:,:,:); huv(nx,1,v,:,:,:) = huv(nx,2,v,:,:,:)+huv(nx-1,1,v,:,:,:) ... -huv(nx-1,2,v,:,:,:); v4u = (huv(i,j-1,v,:,:,:)+huv(i+1,j,v,:,:,:) ... +huv(i,j,v,:,:,:)+huv(i+1,j-1,v,:,:,:))/4; u4v = (huv(i,j+1,u,:,:,:)+huv(i-1,j,u,:,:,:) ... +huv(i,j,u,:,:,:)+huv(i-1,j+1,u,:,:,:))/4; h2u = (huv(2:nx,:,h,:,:,:)+huv(1:nx-1,:,h,:,:,:))/2; h2v = (huv(:,2:ny,h,:,:,:)+huv(:,1:ny-1,h,:,:,:))/2; %{ \end{matlab} Evaluate conservation of mass \pde~\eqref{eq:spindhdt} (needing averages of~$h$ at half-grid points): \begin{matlab} %} huvt(i,j,h,:,:,:) = ... - (h2u(i,j ,:,:,:,:).*huv(i ,j,u,:,:,:) ... -h2u(i-1,j,:,:,:,:).*huv(i-1,j,u,:,:,:) )/dx ... - (h2v(i,j ,:,:,:,:).*huv(i,j ,v,:,:,:) ... -h2v(i,j-1,:,:,:,:).*huv(i,j-1,v,:,:,:))/dy ; %{ \end{matlab} Evaluate the $x$-direction momentum \pde~\eqref{eq:spindvdt} (needing to interpolate component~$v$ to $u$-points): \begin{matlab} %} huvt(i,j,u,:,:,:) = ... - p.cs(i,j,b).*huv(i,j,u,:,:,:) + p.f.*v4u ... - huv(i,j,u,:,:,:).*(huv(i+1,j,u,:,:,:)-huv(i-1,j,u,:,:,:))/(2*dx) ... - v4u.*(huv(i,j+1,u,:,:,:)-huv(i,j-1,u,:,:,:))/(2*dy) ... - p.g*(huv(i+1,j,h,:,:,:)-huv(i,j,h,:,:,:))/dx ... + diff(p.cs(:,j,nux).*diff(huv(:,j,u,:,:,:),[],1),[],1)/dx^2 ... + diff(p.cs(i,:,nuy).*diff(huv(i,:,u,:,:,:),[],2),[],2)/dy^2 ; %{ \end{matlab} Evaluate the $y$-direction momentum \pde~\eqref{eq:spindvdt} (needing to interpolate component~$u$ to $v$-points): \begin{matlab} %} huvt(i,j,v,:,:,:) = ... - p.cs(i,j,b).*huv(i,j,v,:,:,:) - p.f.*u4v ... - u4v.*(huv(i+1,j,v,:,:,:)-huv(i-1,j,v,:,:,:))/(2*dx) ... - huv(i,j,v,:,:,:).*(huv(i,j+1,v,:,:,:)-huv(i,j-1,v,:,:,:))/(2*dy) ... - p.g*(huv(i,j+1,h,:,:,:)-huv(i,j,h,:,:,:))/dy ... + diff(p.cs(:,j,nux).*diff(huv(:,j,v,:,:,:),[],1),[],1)/dx^2 ... + diff(p.cs(i,:,nuy).*diff(huv(i,:,v,:,:,:),[],2),[],2)/dy^2 ; end% function %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
heteroBurstF.m
.m
EquationFreeGit-master/Patch/heteroBurstF.m
732
utf_8
e1c0b0563873325bb9e37ed4ee71f983
% Simulates a burst of the system linked to by the % configuration of patches. Used by ??.m % AJR, 4 Apr 2019 -- 21 Oct 2022 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \subsection{\texttt{heteroBurstF()}: a burst of heterogeneous diffusion} \label{sec:heteroBurstF} This code integrates in time the derivatives computed by \verb|heteroDiff| from within the patch coupling of \verb|patchSys1|. Try~\verb|ode23|, although \verb|ode45| may give smoother results. Sample every period of the microscale time fluctuations (or, at least, close to the period). \begin{matlab} %} function [ts, ucts] = heteroBurstF(ti, ui, bT) global microTimePeriod [ts,ucts] = ode45( @patchSys1,ti+(0:microTimePeriod:bT),ui(:)); end %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
waterWavePDE.m
.m
EquationFreeGit-master/Patch/waterWavePDE.m
2,385
utf_8
ca0bad5d58464a63a5c783c3f1be9605
% Codes a nonlinear water wave PDE on a staggered 1D grid % inside patches in space. Used by waterWaveExample.m % AJR, 4 Apr 2019 -- Nov 2020 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \subsection{\texttt{waterWavePDE()}: water wave PDE} \label{sec:waterWavePDE} This function codes the staggered lattice equation inside the patches for the nonlinear wave-like \pde\ system~\cref{eqs:patch:N}. Also, regularise the absolute value appearing the the \pde{}s via the one-line function~\verb|rabs()|. \begin{matlab} %} function Ut = waterWavePDE(t,U,patches) rabs = @(u) sqrt(1e-4 + u.^2); %{ \end{matlab} As before, set the micro-grid spacing, reserve space for time derivatives, and index the patch-interior points of the micro-grid. \begin{matlab} %} dx = diff(patches.x(2:3)); U = squeeze(U); Ut = nan(size(U)); ht = Ut; i = 2:size(U,1)-1; %{ \end{matlab} Need to estimate~\(h\) at all the \(u\)-points, so into~\verb|V| use averages, and linear extrapolation to patch-edges. \begin{matlab} %} ii = i(2:end-1); V = Ut; V(ii,:) = (U(ii+1,:)+U(ii-1,:))/2; V(1:2,:) = 2*U(2:3,:)-V(3:4,:); V(end-1:end,:) = 2*U(end-2:end-1,:)-V(end-3:end-2,:); %{ \end{matlab} Then estimate \(\D x{(hu)}\) from~\(u\) and the interpolated~\(h\) at the neighbouring micro-grid points. \begin{matlab} %} ht(i,:) = -(U(i+1,:).*V(i+1,:)-U(i-1,:).*V(i+1,:))/(2*dx); %{ \end{matlab} Correspondingly estimate the terms in the momentum \pde: \(u\)-values in~\(\verb|U|_i\) and~\(\verb|V|_{i\pm1}\); and \(h\)-values in~\(\verb|V|_i\) and~\(\verb|U|_{i\pm1}\). \begin{matlab} %} Ut(i,:) = -0.985*(U(i+1,:)-U(i-1,:))/(2*dx) ... -0.003*U(i,:).*rabs(U(i,:)./V(i,:)) ... -1.045*U(i,:).*(V(i+1,:)-V(i-1,:))/(2*dx) ... +0.26*rabs(V(i,:).*U(i,:)).*(V(i+1,:)-2*U(i,:)+V(i-1,:))/dx^2/2; %{ \end{matlab} where the mysterious division by two in the second derivative is due to using the averaged values of~\(u\) in the estimate: \begin{eqnarray*} u_{xx}&\approx&\frac1{4\delta^2}(u_{i-2}-2u_i+u_{i+2}) \\&=&\frac1{4\delta^2}(u_{i-2}+u_i-4u_i+u_i+u_{i+2}) \\&=&\frac1{2\delta^2}\left(\frac{u_{i-2}+u_i}2-2u_i+\frac{u_i+u_{i+2}}2\right) \\&=&\frac1{2\delta^2}\left(\bar u_{i-1}-2u_i+\bar u_{i+1}\right). \end{eqnarray*} Then overwrite the unwanted~\(\dot u_{ij}\) with the corresponding wanted~\(\dot h_{ij}\). \begin{matlab} %} Ut(patches.hPts) = ht(patches.hPts); end %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
configPatches2.m
.m
EquationFreeGit-master/Patch/configPatches2.m
31,145
utf_8
fe35a8aef7255a762724332dc96dcbe2
% configPatches2() creates a data struct of the design of 2D % patches for later use by the patch functions such as % patchSys2(). AJR, Nov 2018 -- 12 Apr 2023 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{configPatches2()}: configures spatial patches in 2D} \label{sec:configPatches2} \localtableofcontents Makes the struct~\verb|patches| for use by the patch\slash gap-tooth time derivative\slash step function \verb|patchSys2()|. \cref{sec:configPatches2eg} lists an example of its use. \begin{matlab} %} function patches = configPatches2(fun,Xlim,Dom ... ,nPatch,ordCC,dx,nSubP,varargin) version = '2023-04-12'; %{ \end{matlab} \paragraph{Input} If invoked with no input arguments, then executes an example of simulating a nonlinear diffusion \pde\ relevant to the lubrication flow of a thin layer of fluid---see \cref{sec:configPatches2eg} for an example code. \begin{itemize} \item \verb|fun| is the name of the user function, \verb|fun(t,u,patches)| or \verb|fun(t,u)| or \verb|fun(t,u,patches,...)|, that computes time-derivatives (or time-steps) of quantities on the 2D micro-grid within all the 2D~patches. \item \verb|Xlim| array/vector giving the rectangular macro-space domain of the computation, namely $[\verb|Xlim(1)|, \verb|Xlim(2)|] \times [\verb|Xlim(3)|, \verb|Xlim(4)|]$. If \verb|Xlim| has two elements, then the domain is the square domain of the same interval in both directions. \item \verb|Dom| sets the type of macroscale conditions for the patches, and reflects the type of microscale boundary conditions of the problem. If \verb|Dom| is \verb|NaN| or \verb|[]|, then the field~\verb|u| is doubly macro-periodic in the 2D spatial domain, and resolved on equi-spaced patches. If \verb|Dom| is a character string, then that specifies the \verb|.type| of the following structure, with \verb|.bcOffset| set to the default zero. Otherwise \verb|Dom| is a structure with the following components. \begin{itemize} \item \verb|.type|, string, of either \verb|'periodic'| (the default), \verb|'equispace'|, \verb|'chebyshev'|, \verb|'usergiven'|. For all cases except \verb|'periodic'|, users \emph{must} code into \verb|fun| the micro-grid boundary conditions that apply at the left\slash right\slash bottom\slash top edges of the leftmost\slash rightmost\slash bottommost\slash topmost patches, respectively. \item \verb|.bcOffset|, optional one, two or four element vector/array, in the cases of \verb|'equispace'| or \verb|'chebyshev'| the patches are placed so the left\slash right\slash top\slash bottom macroscale boundaries are aligned to the left\slash right\slash top\slash bottom edges of the corresponding extreme patches, but offset by \verb|.bcOffset| of the sub-patch micro-grid spacing. For example, use \verb|bcOffset=0| when the micro-code applies Dirichlet boundary values on the extreme edge micro-grid points, whereas use \verb|bcOffset=0.5| when the microcode applies Neumann boundary conditions halfway between the extreme edge micro-grid points. Similarly for the top and bottom edges. If \verb|.bcOffset| is a scalar, then apply the same offset to all boundaries. If two elements, then apply the first offset to both \(x\)-boundaries, and the second offset to both \(y\)-boundaries. If four elements, then apply the first two offsets to the respective \(x\)-boundaries, and the last two offsets to the respective \(y\)-boundaries. \item \verb|.X|, optional vector/array with \verb|nPatch(1)| elements, in the case \verb|'usergiven'| it specifies the \(x\)-locations of the centres of the patches---the user is responsible the locations makes sense. \item \verb|.Y|, optional vector/array with \verb|nPatch(2)| elements, in the case \verb|'usergiven'| it specifies the \(y\)-locations of the centres of the patches---the user is responsible the locations makes sense. \end{itemize} \item \verb|nPatch| sets the number of equi-spaced spatial patches: if scalar, then use the same number of patches in both directions, otherwise \verb|nPatch(1:2)| gives the number of patches~($\geq1$) in each direction. \item \verb|ordCC| is the `order' of interpolation for inter-patch coupling across empty space of the macroscale patch values to the edge-values of the patches: currently must be~$0,2,4,\ldots$; where $0$~gives spectral interpolation. \item \verb|dx| (real---scalar or two element) is usually the sub-patch micro-grid spacing in~\(x\) and~\(y\). If scalar, then use the same \verb|dx| in both directions, otherwise \verb|dx(1:2)| gives the spacing in each of the two directions. However, if \verb|Dom| is~\verb|NaN| (as for pre-2023), then \verb|dx| actually is \verb|ratio| (scalar or two element), namely the ratio of (depending upon \verb|EdgyInt|) either the half-width or full-width of a patch to the equi-spacing of the patch mid-points---adjusted a little when $\verb|nEdge|>1$. So either $\verb|ratio|=\tfrac12$ means the patches abut and $\verb|ratio|=1$ is overlapping patches as in holistic discretisation, or $\verb|ratio|=1$ means the patches abut. Small~\verb|ratio| should greatly reduce computational time. \item \verb|nSubP| is the number of equi-spaced microscale lattice points in each patch: if scalar, then use the same number in both directions, otherwise \verb|nSubP(1:2)| gives the number in each direction. If not using \verb|EdgyInt|, then $\verb|nSubP./nEdge|$ must be odd integer(s) so that there is/are centre-patch lattice lines. So for the defaults of $\verb|nEdge|=1$ and not \verb|EdgyInt|, then \verb|nSubP| must be odd. \item \verb|'nEdge'|, \emph{optional} (integer---scalar or two element), default=1, the width of edge values set by interpolation at the edge regions of each patch. If two elements, then respectively the width in \(x,y\)-directions. The default is one (suitable for microscale lattices with only nearest neighbour interactions). \item \verb|EdgyInt|, true/false, \emph{optional}, default=false. If true, then interpolate to left\slash right\slash top\slash bottom edge-values from right\slash left\slash bottom\slash top next-to-edge values. If false or omitted, then interpolate from centre cross-patch lines. \item \verb|nEnsem|, \emph{optional-experimental}, default one, but if more, then an ensemble over this number of realisations. \item \verb|hetCoeffs|, \emph{optional}, default empty. Supply a 2D or 3D array of microscale heterogeneous coefficients to be used by the given microscale \verb|fun| in each patch. Say the given array~\verb|cs| is of size $m_x\times m_y\times n_c$, where $n_c$~is the number of different sets of coefficients. For example, in heterogeneous diffusion, $n_c=2$ for the diffusivities in the \emph{two} different spatial directions (or $n_c=3$ for the diffusivity tensor). The coefficients are to be the same for each and every patch; however, macroscale variations are catered for by the $n_c$~coefficients being $n_c$~parameters in some macroscale formula. \begin{itemize} \item If $\verb|nEnsem|=1$, then the array of coefficients is just tiled across the patch size to fill up each patch, starting from the $(1,1)$-point in each patch. Best accuracy usually obtained when the periodicity of the coefficients is a factor of \verb|nSubP-2*nEdge| for \verb|EdgyInt|, or a factor of \verb|(nSubP-nEdge)/2| for not \verb|EdgyInt|. \item If $\verb|nEnsem|>1$ (value immaterial), then reset $\verb|nEnsem|:=m_x\cdot m_y$ and construct an ensemble of all $m_x\cdot m_y$ phase-shifts of the coefficients. In this scenario, the inter-patch coupling couples different members in the ensemble. When \verb|EdgyInt| is true, and when the coefficients are diffusivities\slash elasticities in~$x$ and~$y$ directions, respectively, then this coupling cunningly preserves symmetry. \end{itemize} \item \verb|'parallel'|, true/false, \emph{optional}, default=false. If false, then all patch computations are on the user's main \textsc{cpu}---although a user may well separately invoke, say, a \textsc{gpu} to accelerate sub-patch computations. If true, and it requires that you have \Matlab's Parallel Computing Toolbox, then it will distribute the patches over multiple \textsc{cpu}s\slash cores. In \Matlab, only one array dimension can be split in the distribution, so it chooses the one space dimension~$x,y$ corresponding to the highest~\verb|\nPatch| (if a tie, then chooses the rightmost of~$x,y$). A user may correspondingly distribute arrays with property \verb|patches.codist|, or simply use formulas invoking the preset distributed arrays \verb|patches.x|, and \verb|patches.y|. If a user has not yet established a parallel pool, then a `local' pool is started. \end{itemize} \paragraph{Output} The struct \verb|patches| is created and set with the following components. If no output variable is provided for \verb|patches|, then make the struct available as a global variable.\footnote{When using \texttt{spmd} parallel computing, it is generally best to avoid global variables, and so instead prefer using an explicit output variable.} \begin{matlab} %} if nargout==0, global patches, end patches.version = version; %{ \end{matlab} \begin{itemize} \item \verb|.fun| is the name of the user's function \verb|fun(t,u,patches)| or \verb|fun(t,u)| or \verb|fun(t,u,patches,...)|, that computes the time derivatives (or steps) on the patchy lattice. \item \verb|.ordCC| is the specified order of inter-patch coupling. \item \verb|.periodic|: either true, for interpolation on the macro-periodic domain; or false, for general interpolation by divided differences over non-periodic domain or unevenly distributed patches. \item \verb|.stag| is true for interpolation using only odd neighbouring patches as for staggered grids, and false for the usual case of all neighbour coupling---not yet implemented. \item \verb|.Cwtsr| and \verb|.Cwtsl|, only for macro-periodic conditions, are the $\verb|ordCC|\times 2$-array of weights for the inter-patch interpolation onto the right\slash top and left\slash bottom edges (respectively) with patch:macroscale ratio as specified or as derived from~\verb|dx|. \item \verb|.x| (6D) is $\verb|nSubP(1)| \times1 \times1 \times1 \times \verb|nPatch(1)| \times1$ array of the regular spatial locations~$x_{iI}$ of the microscale grid points in every patch. \item \verb|.y| (6D) is $1 \times \verb|nSubP(2)| \times1 \times1 \times1 \times \verb|nPatch(2)|$ array of the regular spatial locations~$y_{jJ}$ of the microscale grid points in every patch. \item \verb|.ratio| $1\times 2$, only for macro-periodic conditions, are the size ratios of every patch. \item \verb|.nEdge| $1\times 2$, is the width of edge values set by interpolation at the edge regions of each patch, in the \(x,y\)-directions respectively. \item \verb|.le|, \verb|.ri|, \verb|.bo|, \verb|.to| determine inter-patch coupling of members in an ensemble. Each a column vector of length~\verb|nEnsem|. \item \verb|.cs| either \begin{itemize} \item \verb|[]| 0D, or \item if $\verb|nEnsem|=1$, $(\verb|nSubP(1)|-1)\times (\verb|nSubP(2)|-1)\times n_c$ 3D array of microscale heterogeneous coefficients, or \item if $\verb|nEnsem|>1$, $(\verb|nSubP(1)|-1)\times (\verb|nSubP(2)|-1)\times n_c\times m_xm_y$ 4D array of $m_xm_y$~ensemble of phase-shifts of the microscale heterogeneous coefficients. \end{itemize} \item \verb|.parallel|, logical: true if patches are distributed over multiple \textsc{cpu}s\slash cores for the Parallel Computing Toolbox, otherwise false (the default is to activate the \emph{local} pool). \item \verb|.codist|, \emph{optional}, describes the particular parallel distribution of arrays over the active parallel pool. \end{itemize} \subsection{If no arguments, then execute an example} \label{sec:configPatches2eg} \begin{matlab} %} if nargin==0 disp('With no arguments, simulate example of nonlinear diffusion') %{ \end{matlab} The code here shows one way to get started: a user's script may have the following three steps (``\into'' denotes function recursion). \begin{enumerate}\def\itemsep{-1.5ex} \item configPatches2 \item ode23 integrator \into patchSys2 \into user's PDE \item process results \end{enumerate} Establish global patch data struct to interface with a function coding a nonlinear `diffusion' \pde: to be solved on $6\times4$-periodic domain, with $9\times7$ patches, spectral interpolation~($0$) couples the patches, with $5\times5$ points forming the micro-grid in each patch, and a sub-patch micro-grid spacing of~\(0.12\) (relatively large for visualisation). \cite{Roberts2011a} established that this scheme is consistent with the \pde\ (as the patch spacing decreases). \begin{matlab} %} global patches patches = configPatches2(@nonDiffPDE,[-3 3 -2 2] ... ,'periodic', [9 7], 0, 0.12, 5 ,'EdgyInt',false); %{ \end{matlab} Set an initial condition of a perturbed-Gaussian using auto-replication of the spatial grid. \begin{matlab} %} u0 = exp(-patches.x.^2-patches.y.^2); u0 = u0.*(0.9+0.1*rand(size(u0))); %{ \end{matlab} Initiate a plot of the simulation using only the microscale values interior to the patches: optionally set $x$~and $y$-edges to \verb|nan| to leave the gaps between patches. \begin{matlab} %} figure(1), clf, colormap(0.8*hsv) x = squeeze(patches.x); y = squeeze(patches.y); if 1, x([1 end],:) = nan; y([1 end],:) = nan; end %{ \end{matlab} Start by showing the initial conditions of \cref{fig:configPatches2ic} while the simulation computes. \begin{matlab} %} u = reshape(permute(squeeze(u0) ... ,[1 3 2 4]), [numel(x) numel(y)]); hsurf = mesh(x(:),y(:),u'); axis([-3 3 -3 3 -0.03 1]), view(60,40) legend('time = 0.00','Location','north') xlabel('space $x$'), ylabel('space $y$'), zlabel('$u(x,y)$') colormap(hsv) ifOurCf2eps([mfilename 'ic']) %{ \end{matlab} \begin{figure} \centering \caption{\label{fig:configPatches2ic}initial field~$u(x,y,t)$ at time $t=0$ of the patch scheme applied to a nonlinear `diffusion'~\pde: \cref{fig:configPatches2t3} plots the computed field at time $t=3$.} \includegraphics[scale=0.9]{configPatches2ic} \end{figure} Integrate in time to $t=4$ using standard functions. In \Matlab\ \verb|ode15s| would be natural as the patch scheme is naturally stiff, but \verb|ode23| is quicker \cite [Fig.~4] {Maclean2020a}. Ask for output at non-uniform times because the diffusion slows. \begin{matlab} %} disp('Wait to simulate nonlinear diffusion h_t=(h^3)_xx+(h^3)_yy') drawnow if ~exist('OCTAVE_VERSION','builtin') [ts,us] = ode23(@patchSys2,linspace(0,2).^2,u0(:)); else % octave version is quite slow for me lsode_options('absolute tolerance',1e-4); lsode_options('relative tolerance',1e-4); [ts,us] = odeOcts(@patchSys2,[0 1],u0(:)); end %{ \end{matlab} Animate the computed simulation to end with \cref{fig:configPatches2t3}. Use \verb|patchEdgeInt2| to interpolate patch-edge values. \begin{matlab} %} for i = 1:length(ts) u = patchEdgeInt2(us(i,:)); u = reshape(permute(squeeze(u) ... ,[1 3 2 4]), [numel(x) numel(y)]); set(hsurf,'ZData', u'); legend(['time = ' num2str(ts(i),'%4.2f')]) pause(0.1) end ifOurCf2eps([mfilename 't3']) %{ \end{matlab} \begin{figure} \centering \caption{\label{fig:configPatches2t3}field~$u(x,y,t)$ at time $t=3$ of the patch scheme applied to a nonlinear `diffusion'~\pde\ with initial condition in \cref{fig:configPatches2ic}.} \includegraphics[scale=0.9]{configPatches2t3} \end{figure} Upon finishing execution of the example, exit this function. \begin{matlab} %} return end%if no arguments %{ \end{matlab} \IfFileExists{../Patch/nonDiffPDE.m}{\input{../Patch/nonDiffPDE.m}}{} \begin{devMan} \subsection{Parse input arguments and defaults} \begin{matlab} %} p = inputParser; fnValidation = @(f) isa(f, 'function_handle');%test for fn name addRequired(p,'fun',fnValidation); addRequired(p,'Xlim',@isnumeric); %addRequired(p,'Dom'); % nothing yet decided addRequired(p,'nPatch',@isnumeric); addRequired(p,'ordCC',@isnumeric); addRequired(p,'dx',@isnumeric); addRequired(p,'nSubP',@isnumeric); addParameter(p,'nEdge',1,@isnumeric); addParameter(p,'EdgyInt',false,@islogical); addParameter(p,'nEnsem',1,@isnumeric); addParameter(p,'hetCoeffs',[],@isnumeric); addParameter(p,'parallel',false,@islogical); %addParameter(p,'nCore',1,@isnumeric); % not yet implemented parse(p,fun,Xlim,nPatch,ordCC,dx,nSubP,varargin{:}); %{ \end{matlab} Set the optional parameters. \begin{matlab} %} patches.nEdge = p.Results.nEdge; if numel(patches.nEdge)==1 patches.nEdge = repmat(patches.nEdge,1,2); end patches.EdgyInt = p.Results.EdgyInt; patches.nEnsem = p.Results.nEnsem; cs = p.Results.hetCoeffs; patches.parallel = p.Results.parallel; %patches.nCore = p.Results.nCore; %{ \end{matlab} Initially duplicate parameters for both space dimensions as needed. \begin{matlab} %} if numel(Xlim)==2, Xlim = repmat(Xlim,1,2); end if numel(nPatch)==1, nPatch = repmat(nPatch,1,2); end if numel(dx)==1, dx = repmat(dx,1,2); end if numel(nSubP)==1, nSubP = repmat(nSubP,1,2); end %{ \end{matlab} Check parameters. \begin{matlab} %} assert(Xlim(1)<Xlim(2) ... ,'first pair of Xlim must be ordered increasing') assert(Xlim(3)<Xlim(4) ... ,'second pair of Xlim must be ordered increasing') assert((mod(ordCC,2)==0)|all(patches.nEdge==1) ... ,'Cannot yet have nEdge>1 and staggered patch grids') assert(all(3*patches.nEdge<=nSubP) ... ,'too many edge values requested') assert(all(rem(nSubP,patches.nEdge)==0) ... ,'nSubP must be integer multiple of nEdge') if ~patches.EdgyInt, assert(all(rem(nSubP./patches.nEdge,2)==1) ... ,'for non-edgyInt, nSubP./nEdge must be odd integer') end if (patches.nEnsem>1)&all(patches.nEdge>1) warning('not yet tested when both nEnsem and nEdge non-one') end %if patches.nCore>1 % warning('nCore>1 not yet tested in this version') % end %{ \end{matlab} For compatibility with pre-2023 functions, if parameter \verb|Dom| is \verb|Nan|, then we set the \verb|ratio| to be the value of the so-called \verb|dx| vector. \begin{matlab} %} if ~isstruct(Dom), pre2023=isnan(Dom); else pre2023=false; end if pre2023, ratio=dx; dx=nan; end %{ \end{matlab} Default macroscale conditions are periodic with evenly spaced patches. \begin{matlab} %} if isempty(Dom), Dom=struct('type','periodic'); end if (~isstruct(Dom))&isnan(Dom), Dom=struct('type','periodic'); end %{ \end{matlab} If \verb|Dom| is a string, then just set type to that string, and subsequently set corresponding defaults for others fields. \begin{matlab} %} if ischar(Dom), Dom=struct('type',Dom); end %{ \end{matlab} We allow different macroscale domain conditions in the different directions. But for the moment do not allow periodic to be mixed with the others (as the interpolation mechanism is different code)---hence why we choose \verb|periodic| be seven characters, whereas the others are eight characters. The different conditions are coded in different rows of \verb|Dom.type|, so we duplicate the string if only one row specified. \begin{matlab} %} if size(Dom.type,1)==1, Dom.type=repmat(Dom.type,2,1); end %{ \end{matlab} Check what is and is not specified, and provide default of zero (Dirichlet boundaries) if no \verb|bcOffset| specified when needed. Do so for both directions independently. \begin{matlab} %} patches.periodic=false; for p=1:2 switch Dom.type(p,:) case 'periodic' patches.periodic=true; if isfield(Dom,'bcOffset') warning('bcOffset not available for Dom.type = periodic'), end msg=' not available for Dom.type = periodic'; if isfield(Dom,'X'), warning(['X' msg]), end if isfield(Dom,'Y'), warning(['Y' msg]), end case {'equispace','chebyshev'} if ~isfield(Dom,'bcOffset'), Dom.bcOffset=zeros(2,2); end % for mixed with usergiven, following should still work if numel(Dom.bcOffset)==1 Dom.bcOffset=repmat(Dom.bcOffset,2,2); end if numel(Dom.bcOffset)==2 Dom.bcOffset=repmat(Dom.bcOffset(:)',2,1); end msg=' not available for Dom.type = equispace or chebyshev'; if (p==1)& isfield(Dom,'X'), warning(['X' msg]), end if (p==2)& isfield(Dom,'Y'), warning(['Y' msg]), end case 'usergiven' % if isfield(Dom,'bcOffset') % warning('bcOffset not available for usergiven Dom.type'), end msg=' required for Dom.type = usergiven'; if p==1, assert(isfield(Dom,'X'),['X' msg]), end if p==2, assert(isfield(Dom,'Y'),['Y' msg]), end otherwise error([Dom.type ' is unknown Dom.type']) end%switch Dom.type end%for p %{ \end{matlab} \subsection{The code to make patches} First, store the pointer to the time derivative function in the struct. \begin{matlab} %} patches.fun = fun; %{ \end{matlab} Second, store the order of interpolation that is to provide the values for the inter-patch coupling conditions. Spectral coupling is \verb|ordCC| of~$0$ or (not yet??)~$-1$. \todo{Perhaps implement staggered spectral coupling.} \begin{matlab} %} assert((ordCC>=-1) & (floor(ordCC)==ordCC), ... 'ordCC out of allowed range integer>=-1') %{ \end{matlab} For odd~\verb|ordCC| do interpolation based upon odd neighbouring patches as is useful for staggered grids. \begin{matlab} %} patches.stag = mod(ordCC,2); assert(patches.stag==0,'staggered not yet implemented??') ordCC = ordCC+patches.stag; patches.ordCC = ordCC; %{ \end{matlab} Check for staggered grid and periodic case. \begin{matlab} %} if patches.stag, assert(all(mod(nPatch,2)==0), ... 'Require an even number of patches for staggered grid') end %{ \end{matlab} \paragraph{Set the macro-distribution of patches} Third, set the centre of the patches in the macroscale grid of patches. Loop over the coordinate directions, setting the distribution into~\verb|Q| and finally assigning to array of corresponding direction. \begin{matlab} %} for q=1:2 qq=2*q-1; %{ \end{matlab} Distribution depends upon \verb|Dom.type|: \begin{matlab} %} switch Dom.type(q,:) %{ \end{matlab} %: case periodic The periodic case is evenly spaced within the spatial domain. Store the size ratio in \verb|patches|. \begin{matlab} %} case 'periodic' Q=linspace(Xlim(qq),Xlim(qq+1),nPatch(q)+1); DQ=Q(2)-Q(1); Q=Q(1:nPatch(q))+diff(Q)/2; pEI=patches.EdgyInt; % abbreviation pnE=patches.nEdge(q);% abbreviation if pre2023, dx(q) = ratio(q)*DQ/(nSubP(q)-pnE*(1+pEI))*(2-pEI); else ratio(q) = dx(q)/DQ*(nSubP(q)-pnE*(1+pEI))/(2-pEI); end patches.ratio=ratio; %{ \end{matlab} %: case equispace The equi-spaced case is also evenly spaced but with the extreme edges aligned with the spatial domain boundaries, modified by the offset. \begin{matlab} %} case 'equispace' Q=linspace(Xlim(qq)+((nSubP(q)-1)/2-Dom.bcOffset(qq))*dx(q) ... ,Xlim(qq+1)-((nSubP(q)-1)/2-Dom.bcOffset(qq+1))*dx(q) ... ,nPatch(q)); DQ=diff(Q(1:2)); width=(1+patches.EdgyInt)/2*(nSubP(q)-1-patches.EdgyInt)*dx; if DQ<width*0.999999 warning('too many equispace patches (double overlapping)') end %{ \end{matlab} %: case chebyshev The Chebyshev case is spaced according to the Chebyshev distribution in order to reduce macro-interpolation errors, \(Q_i \propto -\cos(i\pi/N)\), but with the extreme edges aligned with the spatial domain boundaries, modified by the offset, and modified by possible `boundary layers'. \footnote{ However, maybe overlapping patches near a boundary should be viewed as some sort of spatially analogue of the `christmas tree' of projective integration and its integration to a slow manifold. Here maybe the overlapping patches allow for a `christmas tree' approach to the boundary layers. Needs to be explored??} \begin{matlab} %} case 'chebyshev' halfWidth=dx(q)*(nSubP(q)-1)/2; Q1 = Xlim(1)+halfWidth-Dom.bcOffset(qq)*dx(q); Q2 = Xlim(2)-halfWidth+Dom.bcOffset(qq+1)*dx(q); % Q = (Q1+Q2)/2-(Q2-Q1)/2*cos(linspace(0,pi,nPatch)); %{ \end{matlab} Search for total width of `boundary layers' so that in the interior the patches are non-overlapping Chebyshev. But the width for assessing overlap of patches is the following variable \verb|width|. \begin{matlab} %} pEI=patches.EdgyInt; % abbreviation pnE=patches.nEdge(q);% abbreviation width=(1+pEI)/2*(nSubP(q)-pnE*(1+pEI))*dx(q); for b=0:2:nPatch(q)-2 DQmin=(Q2-Q1-b*width)/2*( 1-cos(pi/(nPatch(q)-b-1)) ); if DQmin>width, break, end end%for if DQmin<width*0.999999 warning('too many Chebyshev patches (mid-domain overlap)') end %{ \end{matlab} Assign the centre-patch coordinates. \begin{matlab} %} Q =[ Q1+(0:b/2-1)*width ... (Q1+Q2)/2-(Q2-Q1-b*width)/2*cos(linspace(0,pi,nPatch(q)-b)) ... Q2+(1-b/2:0)*width ]; %{ \end{matlab} %: case usergiven The user-given case is entirely up to a user to specify, we just force it to have the correct shape of a row. \begin{matlab} %} case 'usergiven' if q==1, Q = reshape(Dom.X,1,[]); else Q = reshape(Dom.Y,1,[]); end%if end%switch Dom.type %{ \end{matlab} Assign \(Q\)-coordinates to the correct spatial direction. At this stage they are all rows. \begin{matlab} %} if q==1, X=Q; end if q==2, Y=Q; end end%for q %{ \end{matlab} \paragraph{Construct the micro-grids} Fourth, construct the microscale grid in each patch, centred about the given mid-points~\verb|X,Y|. Reshape the grid to be 6D to suit dimensions (micro,Vars,Ens,macro). \begin{matlab} %} xs = dx(1)*( (1:nSubP(1))-mean(1:nSubP(1)) ); patches.x = reshape( xs'+X ... ,nSubP(1),1,1,1,nPatch(1),1); ys = dx(2)*( (1:nSubP(2))-mean(1:nSubP(2)) ); patches.y = reshape( ys'+Y ... ,1,nSubP(2),1,1,1,nPatch(2)); %{ \end{matlab} \paragraph{Pre-compute weights for macro-periodic} In the case of macro-periodicity, precompute the weightings to interpolate field values for coupling. \todo{Might sometime extend to coupling via derivative values.} \begin{matlab} %} if patches.periodic ratio = reshape(ratio,1,2); % force to be row vector patches.ratio=ratio; if ordCC>0 [Cwtsr,Cwtsl] = patchCwts(ratio,ordCC,patches.stag); patches.Cwtsr = Cwtsr; patches.Cwtsl = Cwtsl; end%if end%if patches.periodic %{ \end{matlab} \subsection{Set ensemble inter-patch communication} For \verb|EdgyInt| or centre interpolation respectively, \begin{itemize} \item the right-edge\slash centre realisations \verb|1:nEnsem| are to interpolate to left-edge~\verb|le|, and \item the left-edge\slash centre realisations \verb|1:nEnsem| are to interpolate to~\verb|re|. \end{itemize} \verb|re| and \verb|li| are `transposes' of each other as \verb|re(li)=le(ri)| are both \verb|1:nEnsem|. Similarly for bottom-edge\slash centre interpolation to top-edge via~\verb|to|, and top-edge\slash centre interpolation to bottom-edge via~\verb|bo|. The default is nothing shifty. This setting reduces the number of if-statements in function \verb|patchEdgeInt2()|. \begin{matlab} %} nE = patches.nEnsem; patches.le = 1:nE; patches.ri = 1:nE; patches.bo = 1:nE; patches.to = 1:nE; %{ \end{matlab} However, if heterogeneous coefficients are supplied via \verb|hetCoeffs|, then do some non-trivial replications. First, get microscale periods, patch size, and replicate many times in order to subsequently sub-sample: \verb|nSubP| times should be enough. If \verb|cs| is more then 3D, then the higher-dimensions are reshaped into the 3rd dimension. \begin{matlab} %} if ~isempty(cs) [mx,my,nc] = size(cs); nx = nSubP(1); ny = nSubP(2); cs = repmat(cs,nSubP); %{ \end{matlab} If only one member of the ensemble is required, then sub-sample to patch size, and store coefficients in \verb|patches| as is. \begin{matlab} %} if nE==1, patches.cs = cs(1:nx-1,1:ny-1,:); else %{ \end{matlab} But for $\verb|nEnsem|>1$ an ensemble of $m_xm_y$~phase-shifts of the coefficients is constructed from the over-supply. Here code phase-shifts over the periods---the phase shifts are like Hankel-matrices. \begin{matlab} %} patches.nEnsem = mx*my; patches.cs = nan(nx-1,ny-1,nc,mx,my); for j = 1:my js = (j:j+ny-2); for i = 1:mx is = (i:i+nx-2); patches.cs(:,:,:,i,j) = cs(is,js,:); end end patches.cs = reshape(patches.cs,nx-1,ny-1,nc,[]); %{ \end{matlab} Further, set a cunning left\slash right\slash bottom\slash top realisation of inter-patch coupling. The aim is to preserve symmetry in the system when also invoking \verb|EdgyInt|. What this coupling does without \verb|EdgyInt| is unknown. Use auto-replication. \begin{matlab} %} le = mod((0:mx-1)+mod(nx-2,mx),mx)+1; patches.le = reshape( le'+mx*(0:my-1) ,[],1); ri = mod((0:mx-1)-mod(nx-2,mx),mx)+1; patches.ri = reshape( ri'+mx*(0:my-1) ,[],1); bo = mod((0:my-1)+mod(ny-2,my),my)+1; patches.bo = reshape( (1:mx)'+mx*(bo-1) ,[],1); to = mod((0:my-1)-mod(ny-2,my),my)+1; patches.to = reshape( (1:mx)'+mx*(to-1) ,[],1); %{ \end{matlab} Issue warning if the ensemble is likely to be affected by lack of scale separation. \todo{Maybe need to justify this and the arbitrary threshold more carefully??} \begin{matlab} %} if prod(ratio)*patches.nEnsem>0.9, warning( ... 'Probably poor scale separation in ensemble of coupled phase-shifts') scaleSeparationParameter = ratio*patches.nEnsem end %{ \end{matlab} End the two if-statements. \begin{matlab} %} end%if-else nEnsem>1 end%if not-empty(cs) %{ \end{matlab} \paragraph{If parallel code} then first assume this is not within an \verb|spmd|-environment, and so we invoke \verb|spmd...end| (which starts a parallel pool if not already started). At this point, the global \verb|patches| is copied for each worker processor and so it becomes \emph{composite} when we distribute any one of the fields. Hereafter, {\em all fields in the global variable \verb|patches| must only be referenced within an \verb|spmd|-environment.}% \footnote{If subsequently outside spmd, then one must use functions like \texttt{getfield(patches\{1\},'a')}.} \begin{matlab} %} if patches.parallel % theparpool=gcp() spmd %{ \end{matlab} Second, decide which dimension is to be sliced among parallel workers (for the moment, do not consider slicing the ensemble). Choose the direction of most patches, biased towards the last. \begin{matlab} %} [~,pari]=max(nPatch+0.01*(1:2)); patches.codist=codistributor1d(4+pari); %{ \end{matlab} \verb|patches.codist.Dimension| is the index that is split among workers. Then distribute the appropriate coordinate direction among the workers: the function must be invoked inside an \verb|spmd|-group in order for this to work---so we do not need \verb|parallel| in argument list. \begin{matlab} %} switch pari case 1, patches.x=codistributed(patches.x,patches.codist); case 2, patches.y=codistributed(patches.y,patches.codist); otherwise error('should never have bad index for parallel distribution') end%switch end%spmd %{ \end{matlab} If not parallel, then clean out \verb|patches.codist| if it exists. May not need, but safer. \begin{matlab} %} else% not parallel if isfield(patches,'codist'), rmfield(patches,'codist'); end end%if-parallel %{ \end{matlab} \paragraph{Fin} \begin{matlab} %} end% function %{ \end{matlab} \end{devMan} %}
github
uoa1184615/EquationFreeGit-master
SwiftHohenbergPattern.m
.m
EquationFreeGit-master/Patch/SwiftHohenbergPattern.m
6,925
utf_8
8c112fc501c1e2dc9975cdcca02022a3
% Simulate Swift--Hohenberg PDE in 1D on patches as an % example application of patches in space with pairs of edge % points needing to be interpolated between patches. AJR, % 28 Mar 2023 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{SwiftHohenbergPattern}: patterns of the Swift--Hohenberg PDE in 1D on patches} \label{sec:SwiftHohenbergPattern} \localtableofcontents \cref{fig:SwiftHohenbergPatternUxt} shows an example simulation in time generated by the patch scheme applied to the patterns arising from the Swift--Hohenberg \pde. That such simulations of patterns makes valid predictions was established by \cite{Bunder2013b} who proved that the scheme is accurate when the number of points in a patch is just more than a multiple of the periodicity of the pattern. \begin{figure} \centering \caption{\label{fig:SwiftHohenbergPatternUxt}the pattern forming field~\(u(x,t)\) in the patch (gap-tooth) scheme applied to a microscale discretisation of the Swift--Hohenberg \pde\ (\cref{sec:SwiftHohenbergPattern}). Physically we see the rapid decay of much microstructure, but also the meso-time growth of sub-patch-scale patterns, wavenumber~\(k_0\), that are modulated over the inter-patch distances and over long times.} \includegraphics[scale=0.9]{Figs/SwiftHohenbergPatternUxt} \end{figure}% Consider a lattice of values~\(u_i(t)\), with lattice spacing~\(dx\), and governed by a microscale centred discretisation of the Swift--Hohenberg \pde \begin{equation} \partial_tu = -(1+\partial_x^2/k_0^2)^2u+\Ra u-u^3, \label{eq:SwiftHohenbergPattern} \end{equation} with boundary conditions of \(u=u_x=0\) at \(x=0,L\). For \Ra\ just above critical, say \(\Ra=0.1\), the system rapidly evolves to spatial quasi-periodic solutions with period\({} \approx 0.166\) when wavenumber parameter \(k_0 = 38\). On medium times these spatial oscillations grow to near equilibrium amplitude of~\(\sqrt{\Ra}\), and over very long times the phases of the oscillations evolve in space to adapt to the boundaries. Set the desired microscale periodicity of the emergent pattern. \begin{matlab} %} clear all, close all %global OurCf2eps, OurCf2eps=true %optional to save plots Ra = 0.1 % Ra>0 leads to patterns nGap = 3 %waveLength = 0.496688741721854 /nGap %for nPatch==5 waveLength = 0.497630331753555 /nGap %for nPatch==7 %waveLength = 0.5 /nGap %for periodic case nPtsPeriod = 10 dx = waveLength/nPtsPeriod k0 = 2*pi/waveLength %{ \end{matlab} Establish global data struct~\verb|patches| for the Swift--Hohenberg \pde\ on some length domain. Use seven patches. Quartic (fourth-order) interpolation \(\verb|ordCC|=4\) provides values for the inter-patch coupling conditions. \begin{matlab} %} nPatch = 7 nSubP = 2*nPtsPeriod+4 %nSubP = 2*nGap*nPtsPeriod+4 % full-domain Len = nPatch; ordCC = 4; dom.type='equispace'; dom.bcOffset=0.5 patches = configPatches1(@SwiftHohenbergPDE,[0 Len],dom ... ,nPatch,ordCC,dx,nSubP,'EdgyInt',true,'nEdge',2); xs=squeeze(patches.x); %{ \end{matlab} \begin{figure} \centering \caption{\label{fig:SwiftHohenbergPatternEquilib} an equilibrium of the Swift--Hohenberg \pde\ on seven patches in 1D~space. In the sub-patch patterns, there is a small phase shift in the patterns from patch to patch. And the amplitude of the pattern has to go to `zero' at the boundaries. } \def\extraAxisOptions{small,mark size=1pt,width=12cm,height=4cm} \inputFigs{SwiftHohenbergPatternEquilib} \end{figure} \subsubsection{Find equilibrium with fsolve} Start the search from some guess. \begin{matlab} %} fprintf('\n**** Find equilibrium with fsolve\n') u = 0.4*sin(k0*patches.x); %{ \end{matlab} But set the pairs of patch-edge values to \verb|Nan| in order to use \verb|patches.i| to index the interior sub-patch points as they are the variables. \begin{matlab} %} u([1:2 end-1:end],:) = nan; patches.i = find(~isnan(u)); %{ \end{matlab} Seek the equilibrium, and report the norm of the residual, via the generic patch system wrapper \verb|theRes| (\cref{sec:theRes}). \begin{matlab} %} tic [u(patches.i),res] = fsolve(@(v) theRes(v,patches,k0,Ra) ... ,u(patches.i) ,optimoptions('fsolve','Display','off')); solveTime = toc normRes = norm(res) assert(normRes<1e-6,'**** fsolve solution not accurate') %{ \end{matlab} \paragraph{Plot the equilibrium} see \cref{fig:SwiftHohenbergPatternEquilib}. \begin{matlab} %} figure(1),clf subplot(2,1,1) plot(xs,squeeze(u),'.-') xlabel('space $x$'),ylabel('equilibrium $u(x)$') ifOurCf2tex([mfilename 'Equilib'])%optionally save %{ \end{matlab} \subsubsection{Simulate in time} Set an initial condition, and here integrate forward in time using a standard method for stiff systems---because of the simplicity of linear problems this method works quite efficiently here. Integrate the interface \verb|patchSys1| (\cref{sec:patchSys1}) to the microscale differential equations. \begin{matlab} %} fprintf('\n**** Simulate in time\n') u0 = 0*patches.x+0.1*randn(nSubP,1,1,nPatch); tic [ts,us] = ode15s(@patchSys1, [0 40], u0(:) ,[],patches,k0,Ra); simulateTime = toc us = reshape(us,length(ts),numel(patches.x(:)),[]); %{ \end{matlab} Plot the simulation in \cref{fig:SwiftHohenbergPatternUxt}. \begin{matlab} %} figure(2),clf xs([1:2 end-1:end],:) = nan; mesh(ts(1:3:end),xs(:),us(1:3:end,:)'), view(65,60) colormap(0.7*hsv) xlabel('time $t$'), ylabel('space $x$'), zlabel('$u(x,t)$') ifOurCf2eps([mfilename 'Uxt']) %{ \end{matlab} Fin. \subsection{The Swift--Hohenberg PDE and BCs inside patches} As a microscale discretisation of Swift--Hohenberg \pde\ \(u_t= -(1+\partial_{x}^2/k_0^2)^2u +\Ra u -u^3\), here code straightforward centred discretisation in space. \begin{matlab} %} function ut=SwiftHohenbergPDE(t,u,patches,k0,Ra) dx=diff(patches.x(1:2)); % microscale spacing i=3:size(u,1)-2; % interior points in patches %{ \end{matlab} Code Dirichlet boundary conditions of zero function and derivative, \(u=u_x=0\), at the left-end of the leftmost-patch, and the right-end of the rightmost-patch. For slightly simpler coding, squeeze out the two singleton dimensions. \begin{matlab} %} u = squeeze(u); u(1:2,1)=0; u(end-1:end,end)=0; %{ \end{matlab} Here code straightforward centred discretisation in space. \begin{matlab} %} ut=nan+u; % preallocate output array v = u(2:end-1,:)+diff(u,2)/dx^2/k0^2; ut(i,:) = -( v(2:end-1,:)+diff(v,2)/dx^2/k0^2 ) ... +Ra*u(i,:) -u(i,:).^3; end %{ \end{matlab} \subsection{\texttt{theRes()}: wrapper function to zero for equilibria} \label{sec:theRes} This functions converts a vector of values into the interior values of the patches, then evaluates the time derivative of the system at time zero, and returns the vector of patch-interior time derivatives. \begin{matlab} %} function f=theRes(u,patches,k0,Ra) v=nan(size(patches.x)); v(patches.i) = u; f = patchSys1(0,v(:),patches,k0,Ra); f = f(patches.i); end%function theRes %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
patchEdgeInt2.m
.m
EquationFreeGit-master/Patch/patchEdgeInt2.m
21,894
utf_8
69c7eba8d39f1ca697e955100def73e9
% patchEdgeInt2() provides the interpolation across 2D space % for 2D patches of simulations of a lattice system such as % a PDE discretisation. AJR, Nov 2018 -- 12 Apr 2023 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{patchEdgeInt2()}: sets 2D patch edge values from 2D macroscale interpolation} \label{sec:patchEdgeInt2} Couples 2D patches across 2D space by computing their edge values via macroscale interpolation. Research \cite[]{Roberts2011a, Bunder2019d} indicates the patch centre-values are sensible macroscale variables, and macroscale interpolation of these determine patch-edge values. However, for computational homogenisation in multi-D, interpolating patch next-to-edge values appears better \cite[]{Bunder2020a}. This function is primarily used by \verb|patchSys2()| but is also useful for user graphics. \footnote{Script \texttt{patchEdgeInt2test.m} verifies this code.} Communicate patch-design variables via a second argument (optional, except required for parallel computing of \verb|spmd|), or otherwise via the global struct~\verb|patches|. \begin{matlab} %} function u = patchEdgeInt2(u,patches) if nargin<2, global patches, end %{ \end{matlab} \paragraph{Input} \begin{itemize} \item \verb|u| is a vector\slash array of length $\verb|prod(nSubP)| \cdot \verb|nVars| \cdot \verb|nEnsem| \cdot \verb|prod(nPatch)|$ where there are $\verb|nVars| \cdot \verb|nEnsem|$ field values at each of the points in the $\verb|nSubP1| \cdot \verb|nSubP2| \cdot \verb|nPatch1| \cdot \verb|nPatch2|$ multiscale spatial grid on the $\verb|nPatch1| \cdot \verb|nPatch2|$ array of patches. \item \verb|patches| a struct set by \verb|configPatches2()| which includes the following information. \begin{itemize} \item \verb|.x| is $\verb|nSubP1| \times1 \times1 \times1 \times \verb|nPatch1| \times1 $ array of the spatial locations~$x_{iI}$ of the microscale grid points in every patch. Currently it \emph{must} be an equi-spaced lattice on the microscale index~$i$, but may be variable spaced in macroscale index~$I$. \item \verb|.y| is similarly $1 \times \verb|nSubP2| \times1 \times1 \times1 \times \verb|nPatch2|$ array of the spatial locations~$y_{jJ}$ of the microscale grid points in every patch. Currently it \emph{must} be an equi-spaced lattice on the microscale index~$j$, but may be variable spaced in macroscale index~$J$. \item \verb|.ordCC| is order of interpolation, currently only $\{0,2,4,\ldots\}$ \item \verb|.periodic| indicates whether macroscale is periodic domain, or alternatively that the macroscale has left, right, top and bottom boundaries so interpolation is via divided differences. \item \verb|.stag| in $\{0,1\}$ is one for staggered grid (alternating) interpolation. Currently must be zero. \item \verb|.Cwtsr| and \verb|.Cwtsl| are the coupling coefficients for finite width interpolation in both the $x,y$-directions---when invoking a periodic domain. \item \verb|.EdgyInt|, true/false, for determining patch-edge values by interpolation: true, from opposite-edge next-to-edge values (often preserves symmetry); false, from centre cross-patch values (near original scheme). \item \verb|.nEdge|, two elements, the width of edge values set by interpolation at the \(x,y\)-edge regions, respectively, of each patch (default is one for both \(x,y\)-edges). \item \verb|.nEnsem| the number of realisations in the ensemble. \item \verb|.parallel| whether serial or parallel. \end{itemize} \end{itemize} \paragraph{Output} \begin{itemize} \item \verb|u| is 6D array, $\verb|nSubP1| \cdot \verb|nSubP2| \cdot \verb|nVars| \cdot \verb|nEnsem| \cdot \verb|nPatch1| \cdot \verb|nPatch2|$, of the fields with edge values set by interpolation. \end{itemize} \begin{devMan} Test for reality of the field values, and define a function accordingly. Could be problematic if some variables are real and some are complex, or if variables are of quite different sizes. \begin{matlab} %} if max(abs(imag(u(:))))<1e-9*max(abs(u(:))) uclean=@(u) real(u); else uclean=@(u) u; end %{ \end{matlab} Determine the sizes of things. Any error arising in the reshape indicates~\verb|u| has the wrong size. \begin{matlab} %} [~,ny,~,~,~,Ny] = size(patches.y); [nx,~,~,~,Nx,~] = size(patches.x); nEnsem = patches.nEnsem; nVars = round(numel(u)/numel(patches.x)/numel(patches.y)/nEnsem); assert(numel(u) == nx*ny*Nx*Ny*nVars*nEnsem ... ,'patchEdgeInt2: input u has wrong size for parameters') u = reshape(u,[nx ny nVars nEnsem Nx Ny ]); %{ \end{matlab} For the moment assume the physical domain is either macroscale periodic or macroscale rectangle so that the coupling formulas are simplest. These index vectors point to patches and, if periodic, their four immediate neighbours. \begin{matlab} %} I=1:Nx; Ip=mod(I,Nx)+1; Im=mod(I-2,Nx)+1; J=1:Ny; Jp=mod(J,Ny)+1; Jm=mod(J-2,Ny)+1; %{ \end{matlab} \paragraph{Implement multiple width edges by folding} Subsample~\(x,y\) coordinates, noting it is only differences that count \emph{and} the microgrid~\(x,y\) spacing must be uniform. \begin{matlab} %} %x = patches.x; %if patches.nEdge(1)>1 % m = patches.nEdge(1); % x = x(1:m:nx,:,:,:,:,:); % nx = nx/m; % u = reshape(u,m,nx,ny,nVars,nEnsem,Nx,Ny); % nVars = nVars*m; % u = reshape( permute(u,[2:3 1 4:7]) ... % ,nx,ny,nVars,nEnsem,Nx,Ny); %end%if patches.nEdge(1) %y = patches.y; %if patches.nEdge(2)>1 % m = patches.nEdge(2); % y = y(:,1:m:ny,:,:,:,:); % ny = ny/m; % u = reshape(u,nx,m,ny,nVars,nEnsem,Nx,Ny); % nVars = nVars*m; % u = reshape( permute(u,[1 3 2 4:7]) ... % ,nx,ny,nVars,nEnsem,Nx,Ny); %end%if patches.nEdge(2) x = patches.x; y = patches.y; if mean(patches.nEdge)>1 mx = patches.nEdge(1); my = patches.nEdge(2); x = x(1:mx:nx,:,:,:,:,:); y = y(:,1:my:ny,:,:,:,:); nx = nx/mx; ny = ny/my; u = reshape(u,mx,nx,my,ny,nVars,nEnsem,Nx,Ny); nVars = nVars*mx*my; u = reshape( permute(u,[2 4 1 3 5:8]) ... ,nx,ny,nVars,nEnsem,Nx,Ny); end%if patches.nEdge %{ \end{matlab} The centre of each patch (as \verb|nx| and~\verb|ny| are odd for centre-patch interpolation) is at indices \begin{matlab} %} i0 = round((nx+1)/2); j0 = round((ny+1)/2); %{ \end{matlab} \subsection{Periodic macroscale interpolation schemes} \begin{matlab} %} if patches.periodic %{ \end{matlab} Get the size ratios of the patches. \begin{matlab} %} rx = patches.ratio(1); ry = patches.ratio(2); %{ \end{matlab} \subsubsection{Lagrange interpolation gives patch-edge values} Compute centred differences of the mid-patch values for the macro-interpolation, of all fields. Here the domain is macro-periodic. \begin{matlab} %} ordCC = patches.ordCC; if ordCC>0 % then finite-width polynomial interpolation %{ \end{matlab} Interpolate the three directions in succession, in this way we naturally fill-in corner values. Start with \(x\)-direction, and give most documentation for that case as the \(y\)-direction is essentially the same. \paragraph{\(x\)-normal edge values} The patch-edge values are either interpolated from the next-to-edge values, or from the centre-cross values (not the patch-centre value itself as that seems to have worse properties in general). Have not yet implemented core averages. \begin{matlab} %} if patches.EdgyInt % interpolate next-to-face values U = u([2 nx-1],2:(ny-1),:,:,I,J); else % interpolate centre-cross values U = u(i0,2:(ny-1),:,:,I,J); end;%if patches.EdgyInt %{ \end{matlab} Just in case any last array dimension(s) are one, we force a padding of the sizes, then adjoin the extra dimension for the subsequent array of differences. \begin{matlab} %} szUO=size(U); szUO=[szUO ones(1,6-length(szUO)) ordCC]; %{ \end{matlab} Use finite difference formulas for the interpolation, so store finite differences ($\mu\delta, \delta^2, \mu\delta^3, \delta^4, \ldots$) in these arrays. When parallel, in order to preserve the distributed array structure we use an index at the end for the differences. \begin{matlab} %} if ~patches.parallel, dmu = zeros(szUO); % 7D else dmu = zeros(szUO,patches.codist); % 7D end%if patches.parallel %{ \end{matlab} First compute differences $\mu\delta$ and $\delta^2$. \begin{matlab} %} if patches.stag % use only odd numbered neighbours error('polynomial interpolation not yet for staggered patch coupling') % dmux(:,:,:,:,I,:,1) = (Ux(:,:,:,:,Ip,:)+Ux(:,:,:,:,Im,:))/2; % \mu % dmux(:,:,:,:,I,:,2) = (Ux(:,:,:,:,Ip,:)-Ux(:,:,:,:,Im,:)); % \delta % Ip = Ip(Ip); Im = Im(Im); % increase shifts to \pm2 % dmuy(:,:,:,:,:,J,1) = (Ux(:,:,:,:,:,Jp)+Ux(:,:,:,:,:,Jm))/2; % \mu % dmuy(:,:,:,:,:,J,2) = (Ux(:,:,:,:,:,Jp)-Ux(:,:,:,:,:,Jm)); % \delta % Jp = Jp(Jp); Jm = Jm(Jm); % increase shifts to \pm2 else %disp('starting standard interpolation') dmu(:,:,:,:,I,:,1) = (U(:,:,:,:,Ip,:) ... -U(:,:,:,:,Im,:))/2; %\mu\delta dmu(:,:,:,:,I,:,2) = (U(:,:,:,:,Ip,:) ... -2*U(:,:,:,:,I,:) +U(:,:,:,:,Im,:)); %\delta^2 end% if patches.stag %{ \end{matlab} Recursively take $\delta^2$ of these to form successively higher order centred differences in space. \begin{matlab} %} for k = 3:ordCC dmu(:,:,:,:,I,:,k) = dmu(:,:,:,:,Ip,:,k-2) ... -2*dmu(:,:,:,:,I,:,k-2) +dmu(:,:,:,:,Im,:,k-2); end %{ \end{matlab} Interpolate macro-values to be Dirichlet edge values for each patch \cite[]{Roberts06d, Bunder2013b}, using weights computed in \verb|configPatches2()|. Here interpolate to specified order. For the case where next-to-edge values interpolate to the opposite edge-values: when we have an ensemble of configurations, different configurations might be coupled to each other, as specified by \verb|patches.le|, \verb|patches.ri|, \verb|patches.to| and \verb|patches.bo|. \begin{matlab} %} k=1+patches.EdgyInt; % use centre or two edges u(nx,2:(ny-1),:,patches.ri,I,:) ... = U(1,:,:,:,:,:)*(1-patches.stag) ... +sum( shiftdim(patches.Cwtsr(:,1),-6).*dmu(1,:,:,:,:,:,:) ,7); u(1 ,2:(ny-1),:,patches.le,I,:,:) ... = U(k,:,:,:,:,:)*(1-patches.stag) ... +sum( shiftdim(patches.Cwtsl(:,1),-6).*dmu(k,:,:,:,:,:,:) ,7); %{ \end{matlab} \paragraph{\(y\)-normal edge values} Interpolate from either the next-to-edge values, or the centre-cross-line values. \begin{matlab} %} if patches.EdgyInt % interpolate next-to-face values U = u(:,[2 ny-1],:,:,I,J); else % interpolate centre-cross values U = u(:,j0,:,:,I,J); end;%if patches.EdgyInt %{ \end{matlab} Adjoin extra dimension for the array of differences. \begin{matlab} %} szUO=size(U); szUO=[szUO ones(1,6-length(szUO)) ordCC]; %{ \end{matlab} Store finite differences ($\mu\delta, \delta^2, \mu\delta^3, \delta^4, \ldots$) in this array. \begin{matlab} %} if ~patches.parallel, dmu = zeros(szUO); % 7D else dmu = zeros(szUO,patches.codist); % 7D end%if patches.parallel %{ \end{matlab} First compute differences $\mu\delta$ and $\delta^2$. \begin{matlab} %} if patches.stag % use only odd numbered neighbours error('polynomial interpolation not yet for staggered patch coupling') else %disp('starting standard interpolation') dmu(:,:,:,:,:,J,1) = (U(:,:,:,:,:,Jp) ... -U(:,:,:,:,:,Jm))/2; %\mu\delta dmu(:,:,:,:,:,J,2) = (U(:,:,:,:,:,Jp) ... -2*U(:,:,:,:,:,J) +U(:,:,:,:,:,Jm)); %\delta^2 end% if stag %{ \end{matlab} Recursively take $\delta^2$. \begin{matlab} %} for k = 3:ordCC dmu(:,:,:,:,:,J,k) = dmu(:,:,:,:,:,Jp,k-2) ... -2*dmu(:,:,:,:,:,J,k-2) +dmu(:,:,:,:,:,Jm,k-2); end %{ \end{matlab} Interpolate macro-values using the weights pre-computed by \verb|configPatches2()|. An ensemble of configurations may have cross-coupling. \begin{matlab} %} k = 1+patches.EdgyInt; % use centre or two edges u(:,ny,:,patches.to,:,J) ... = U(:,1,:,:,:,:)*(1-patches.stag) ... +sum( shiftdim(patches.Cwtsr(:,2),-6).*dmu(:,1,:,:,:,:,:) ,7); u(:,1 ,:,patches.bo,:,J) ... = U(:,k,:,:,:,:)*(1-patches.stag) ... +sum( shiftdim(patches.Cwtsl(:,2),-6).*dmu(:,k,:,:,:,:,:) ,7); %{ \end{matlab} \subsubsection{Case of spectral interpolation} Assumes the domain is macro-periodic. \begin{matlab} %} else% patches.ordCC<=0, spectral interpolation %{ \end{matlab} We interpolate in terms of the patch index, $j$~say, not directly in space. As the macroscale fields are $N$-periodic in the patch index~$I$, the macroscale Fourier transform writes the centre-patch values as $U_I=\sum_{k}C_ke^{ik2\pi I/N}$. Then the edge-patch values $U_{I\pm r} =\sum_{k}C_ke^{ik2\pi/N(I\pm r)} =\sum_{k}C'_ke^{ik2\pi I/N}$ where $C'_k=C_ke^{ikr2\pi/N}$. For $N$~patches we resolve `wavenumbers' $|k|<N/2$, so set row vector $\verb|ks|=k2\pi/N$ for `wavenumbers' $\mathcode`\,="213B k=(0,1, \ldots, k_{\max}, -k_{\max}, \ldots, -1)$ for odd~$N$, and $\mathcode`\,="213B k=(0,1, \ldots, k_{\max}, \pm(k_{\max}+1) -k_{\max}, \ldots, -1)$ for even~$N$. Deal with staggered grid by doubling the number of fields and halving the number of patches (\verb|configPatches2| tests there are an even number of patches). Then the patch-ratio is effectively halved. The patch edges are near the middle of the gaps and swapped. \begin{matlab} %} if patches.stag % transform by doubling the number of fields error('staggered grid not yet implemented??') v=nan(size(u)); % currently to restore the shape of u u=cat(3,u(:,1:2:nPatch,:),u(:,2:2:nPatch,:)); stagShift=reshape(0.5*[ones(nVars,1);-ones(nVars,1)],1,1,[]); iV=[nVars+1:2*nVars 1:nVars]; % scatter interp to alternate field r=r/2; % ratio effectively halved nPatch=nPatch/2; % halve the number of patches nVars=nVars*2; % double the number of fields else % the values for standard spectral stagShift = 0; iV = 1:nVars; end%if patches.stag %{ \end{matlab} Interpolate the two directions in succession, in this way we naturally fill-in edge-corner values. Start with \(x\)-direction, and give most documentation for that case as the other is essentially the same. Need these indices of patch interior. \begin{matlab} %} ix = 2:nx-1; iy = 2:ny-1; %{ \end{matlab} \paragraph{\(x\)-normal edge values} Now set wavenumbers into a vector at the correct dimension. In the case of even~$N$ these compute the $+$-case for the highest wavenumber zig-zag mode, $\mathcode`\,="213B k=(0,1, \ldots, k_{\max}, +(k_{\max}+1) -k_{\max}, \ldots, -1)$. \begin{matlab} %} kMax = floor((Nx-1)/2); kr = shiftdim( rx*2*pi/Nx*(mod((0:Nx-1)+kMax,Nx)-kMax) ,-3); %{ \end{matlab} Compute the Fourier transform of the centre-cross values. Unless doing patch-edgy interpolation when FT the next-to-edge values. If there are an even number of points, then if complex, treat as positive wavenumber, but if real, treat as cosine. When using an ensemble of configurations, different configurations might be coupled to each other, as specified by \verb|patches.le|, \verb|patches.ri|, \verb|patches.to| and \verb|patches.bo|. \begin{matlab} %} if ~patches.EdgyInt Cm = fft( u(i0,iy,:,:,:,:) ,[],5); Cp = Cm; else Cm = fft( u( 2,iy ,:,patches.le,:,:) ,[],5); Cp = fft( u(nx-1,iy ,:,patches.ri,:,:) ,[],5); end%if ~patches.EdgyInt %{ \end{matlab} Now invert the Fourier transforms to complete interpolation. Enforce reality when appropriate. \begin{matlab} %} u(nx,iy,:,:,:,:) = uclean( ifft( ... Cm.*exp(1i*(stagShift+kr)) ,[],5) ); u( 1,iy,:,:,:,:) = uclean( ifft( ... Cp.*exp(1i*(stagShift-kr)) ,[],5) ); %{ \end{matlab} \paragraph{\(y\)-normal edge values} Set wavenumbers into a vector. \begin{matlab} %} kMax = floor((Ny-1)/2); kr = shiftdim( ry*2*pi/Ny*(mod((0:Ny-1)+kMax,Ny)-kMax) ,-4); %{ \end{matlab} Compute the Fourier transform of the patch values on the centre-lines for all the fields. \begin{matlab} %} if ~patches.EdgyInt Cm = fft( u(:,j0,:,:,:,:) ,[],6); Cp = Cm; else Cm = fft( u(:,2 ,:,patches.bo,:,:) ,[],6); Cp = fft( u(:,ny-1 ,:,patches.to,:,:) ,[],6); end%if ~patches.EdgyInt %{ \end{matlab} Invert the Fourier transforms to complete interpolation. \begin{matlab} %} u(:,ny,:,:,:,:) = uclean( ifft( ... Cm.*exp(1i*(stagShift+kr)) ,[],6) ); u(:, 1,:,:,:,:) = uclean( ifft( ... Cp.*exp(1i*(stagShift-kr)) ,[],6) ); %{ \end{matlab} \begin{matlab} %} end% if ordCC>0 else, so spectral %{ \end{matlab} \subsection{Non-periodic macroscale interpolation} \begin{matlab} %} else% patches.periodic false assert(~patches.stag, ... 'not yet implemented staggered grids for non-periodic') %{ \end{matlab} Determine the order of interpolation~\verb|px| and~\verb|py| (potentially different in the different directions!), and hence size of the (forward) divided difference tables in~\verb|F|~(7D) for interpolating to left/right, and top/bottom edges. Because of the product-form of the patch grid, and because we are doing \emph{only} either edgy interpolation or cross-patch interpolation (\emph{not} just the centre patch value), the interpolations are all 1D interpolations. \begin{matlab} %} if patches.ordCC<1 px = Nx-1; py = Ny-1; else px = min(patches.ordCC,Nx-1); py = min(patches.ordCC,Ny-1); end ix=2:nx-1; iy=2:ny-1; % indices of edge 'interior' (ix n/a) %{ \end{matlab} \subsubsection{\(x\)-direction values} Set function values in first `column' of the tables for every variable and across ensemble. For~\verb|EdgyInt|, the `reversal' of the next-to-edge values are because their values are to interpolate to the opposite edge of each patch. \todo{Have no plans to implement core averaging as yet.} \begin{matlab} %} F = nan(patches.EdgyInt+1,ny-2,nVars,nEnsem,Nx,Ny,px+1); if patches.EdgyInt % interpolate next-to-edge values F(:,:,:,:,:,:,1) = u([nx-1 2],iy,:,:,:,:); X = x([nx-1 2],:,:,:,:,:); else % interpolate mid-patch cross-patch values F(:,:,:,:,:,:,1) = u(i0,iy,:,:,:,:); X = x(i0,:,:,:,:,:); end%if patches.EdgyInt %{ \end{matlab} \paragraph{Form tables of divided differences} Compute tables of (forward) divided differences \cite[e.g.,][]{DividedDifferences} for every variable, and across ensemble, and for left/right edges. Recursively find all divided differences. \begin{matlab} %} for q = 1:px i = 1:Nx-q; F(:,:,:,:,i,:,q+1) ... = (F(:,:,:,:,i+1 ,:,q)-F(:,:,:,:,i,:,q)) ... ./(X(:,:,:,:,i+q,:) -X(:,:,:,:,i,:)); end %{ \end{matlab} \paragraph{Interpolate with divided differences} Now interpolate to find the edge-values on left/right edges at~\verb|Xedge| for every interior~\verb|Y|. \begin{matlab} %} Xedge = x([1 nx],:,:,:,:,:); %{ \end{matlab} Code Horner's recursive evaluation of the interpolation polynomials. Indices~\verb|i| are those of the left edge of each interpolation stencil, because the table is of forward differences. This alternative: the case of order~\(p_x\) and~\(p_y\) interpolation across the domain, asymmetric near the boundaries of the rectangular domain. \begin{matlab} %} i = max(1,min(1:Nx,Nx-ceil(px/2))-floor(px/2)); Uedge = F(:,:,:,:,i,:,px+1); for q = px:-1:1 Uedge = F(:,:,:,:,i,:,q)+(Xedge-X(:,:,:,:,i+q-1,:)).*Uedge; end %{ \end{matlab} Finally, insert edge values into the array of field values, using the required ensemble shifts. \begin{matlab} %} u(1 ,iy,:,patches.le,:,:) = Uedge(1,:,:,:,:,:); u(nx,iy,:,patches.ri,:,:) = Uedge(2,:,:,:,:,:); %{ \end{matlab} \subsubsection{\(y\)-direction values} Set function values in first `column' of the tables for every variable and across ensemble. \begin{matlab} %} F = nan(nx,patches.EdgyInt+1,nVars,nEnsem,Nx,Ny,py+1); if patches.EdgyInt % interpolate next-to-edge values F(:,:,:,:,:,:,1) = u(:,[ny-1 2],:,:,:,:); Y = y(:,[ny-1 2],:,:,:,:); else % interpolate mid-patch cross-patch values F(:,:,:,:,:,:,1) = u(:,j0,:,:,:,:); Y = y(:,j0,:,:,:,:); end; %{ \end{matlab} Form tables of divided differences. \begin{matlab} %} for q = 1:py j = 1:Ny-q; F(:,:,:,:,:,j,q+1) ... = (F(:,:,:,:,:,j+1 ,q)-F(:,:,:,:,:,j,q)) ... ./(Y(:,:,:,:,:,j+q) -Y(:,:,:,:,:,j)); end %{ \end{matlab} Interpolate to find the edge-values on top/bottom edges~\verb|Yedge| for every~\(x\). \begin{matlab} %} Yedge = y(:,[1 ny],:,:,:,:); %{ \end{matlab} Code Horner's recursive evaluation of the interpolation polynomials. Indices~\verb|j| are those of the bottom edge of each interpolation stencil, because the table is of forward differences. \begin{matlab} %} j = max(1,min(1:Ny,Ny-ceil(py/2))-floor(py/2)); Uedge = F(:,:,:,:,:,j,py+1); for q = py:-1:1 Uedge = F(:,:,:,:,:,j,q)+(Yedge-Y(:,:,:,:,:,j+q-1)).*Uedge; end %{ \end{matlab} Finally, insert edge values into the array of field values, using the required ensemble shifts. \begin{matlab} %} u(:,1 ,:,patches.bo,:,:) = Uedge(:,1,:,:,:,:); u(:,ny,:,patches.to,:,:) = Uedge(:,2,:,:,:,:); %{ \end{matlab} \subsubsection{Optional NaNs for safety} We want a user to set outer edge values on the extreme patches according to the microscale boundary conditions that hold at the extremes of the domain. Consequently, unless testing, override their computed interpolation values with~\verb|NaN|. \begin{matlab} %} if isfield(patches,'intTest')&&patches.intTest else % usual case u( 1,:,:,:, 1,:) = nan; u(nx,:,:,:,Nx,:) = nan; u(:, 1,:,:,:, 1) = nan; u(:,ny,:,:,:,Ny) = nan; end%if %{ \end{matlab} End of the non-periodic interpolation code. \begin{matlab} %} end%if patches.periodic else %{ \end{matlab} \paragraph{Unfold multiple edges} No need to restore~\(x,y\). \begin{matlab} %} if mean(patches.nEdge)>1 nVars = nVars/(mx*my); u = reshape( u ,nx,ny,mx,my,nVars,nEnsem,Nx,Ny); nx = nx*mx; ny = ny*my; u = reshape( permute(u,[3 1 4 2 5:8]) ... ,nx,ny,nVars,nEnsem,Nx,Ny); end%if patches.nEdge %{ \end{matlab} Fin, returning the 6D array of field values with interpolated edges. \begin{matlab} %} end% function patchEdgeInt2 %{ \end{matlab} \end{devMan} %}
github
uoa1184615/EquationFreeGit-master
waveFirst.m
.m
EquationFreeGit-master/Patch/waveFirst.m
987
utf_8
665ff1a1681b400ba148a4f1f8e7723e
% Computes the time derivatives of a 1D, heterogeneous, % first-order, wave PDE in 1D on patches. AJR, 17 Dec 2019 % -- Nov 2020 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \subsection{\texttt{waveFirst()}: first-order wave PDE} \label{sec:waveFirst} This function codes a lattice, first-order, heterogeneous, wave \pde\ inside patches. Optionally adds some viscous dissipation. For 2D input arrays~\verb|u| and~\verb|x| (via edge-value interpolation of \verb|patchSys1|, \cref{sec:patchSys1}), computes the time derivative~\cref{eq:waveEdgy1} at each point in the interior of a patch, output in~\verb|ut|. \begin{matlab} %} function ut = waveFirst(t,u,patches) u=squeeze(u); dx = diff(patches.x(2:3)); % space step i = 2:size(u,1)-1; % interior points in a patch ut = nan+u; % preallocate output array ut(i,:) = -(patches.cs(i).*u(i+1,:) ... -patches.cs(i-1).*u(i-1,:))/(2*dx) ... +patches.nu*diff(u,2)/dx^2; end% function %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
heteroWave3.m
.m
EquationFreeGit-master/Patch/heteroWave3.m
1,956
utf_8
69fefa988c006f6c2501b1435e78cb1c
% Computes the time derivatives of heterogeneous waves % in 3D on patches. AJR, Aug--Sep 2020 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \subsection{\texttt{heteroWave3()}: heterogeneous Waves} \label{sec:heteroWave3} This function codes the lattice heterogeneous waves inside the patches. The wave \pde\ is \begin{equation*} u_t=v,\quad v_t=\grad(C\divv u) \end{equation*} for diagonal matrix~\(C\) which has microscale variations. For 8D input arrays~\verb|u|, \verb|x|, \verb|y|, and~\verb|z| (via edge-value interpolation of \verb|patchSys3|, \cref{sec:patchSys3}), computes the time derivative at each point in the interior of a patch, output in~\verb|ut|. The three 3D array of heterogeneous coefficients,~$c^x_{ijk}$, $c^y_{ijk}$ and~$c^z_{ijk}$, have previously been stored in~\verb|patches.cs| (4D). Supply patch information as a third argument (required by parallel computation), or otherwise by a global variable. \begin{matlab} %} function ut = heteroWave3(t,u,patches) if nargin<3, global patches, end %{ \end{matlab} Microscale space-steps, and interior point indices. \begin{matlab} %} dx = diff(patches.x(2:3)); % x micro-scale step dy = diff(patches.y(2:3)); % y micro-scale step dz = diff(patches.z(2:3)); % z micro-scale step i = 2:size(u,1)-1; % x interior points in a patch j = 2:size(u,2)-1; % y interior points in a patch k = 2:size(u,3)-1; % z interior points in a patch %{ \end{matlab} Reserve storage and then assign interior patch values to the heterogeneous diffusion time derivatives. Using \verb|nan+u| appears quicker than \verb|nan(size(u),patches.codist)| \begin{matlab} %} ut = nan+u; % preallocate output array ut(i,j,k,1,:) = u(i,j,k,2,:); ut(i,j,k,2,:) ... =diff(patches.cs(:,j,k,1,:).*diff(u(:,j,k,1,:),1),1)/dx^2 ... +diff(patches.cs(i,:,k,2,:).*diff(u(i,:,k,1,:),1,2),1,2)/dy^2 ... +diff(patches.cs(i,j,:,3,:).*diff(u(i,j,:,1,:),1,3),1,3)/dz^2; end% function %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
SwiftHohenbergHetero.m
.m
EquationFreeGit-master/Patch/SwiftHohenbergHetero.m
13,941
utf_8
b586d4ee2d187e24411e6fdf3390a7bd
% Simulate a heterogeneous version of Swift--Hohenberg PDE % in 1D on patches as an example application with pairs of % edge points needing to be interpolated between patches in % space. AJR, 28 Mar 2023 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{SwiftHohenbergHetero}: patterns of a heterogeneous Swift--Hohenberg PDE in 1D on patches} \label{sec:SwiftHohenbergHetero} \localtableofcontents \cref{fig:SwiftHohenbergHeteroU} shows an example simulation in time generated by the patch scheme applied to the patterns arising from a heterogeneous version of the Swift--Hohenberg \pde. That such simulations of patterns makes valid predictions was established by \cite{Bunder2013b} who proved that the scheme is accurate when the number of points in a patch is tied to a multiple of the periodicity of the pattern. \begin{figure} \centering \caption{\label{fig:SwiftHohenbergHeteroU} the field~\(u(x,t)\) in the patch (gap-tooth) scheme applied to microscale heterogeneous Swift--Hohenberg \pde\ (\cref{sec:SwiftHohenbergHetero}). The heterogeneous coefficients are approximately uniform over~\([0.9,1.1]\). This heterogeneity has no noticeable affect on the simulation.} \includegraphics[scale=0.85]{r26479SwiftHohenbergHeteroUxt} \end{figure}% Consider a lattice of values~\(u_i(t)\), with lattice spacing~\(dx\), arising from a microscale discretisation of the pattern forming, heterogeneous, Swift--Hohenberg \pde \begin{equation} \partial_t u=-D[c_1(x)Du] +\Ra u-u^3, \quad D:=1+\partial_x[c_2(x)\partial_x\cdot]/k_0^2, \label{eq:SwiftHohenbergHetero} \end{equation} where \(c_\ell(x)\) have period~\(2\pi/k_0\). Coefficients~\(c_\ell\) are chosen iid random, nearly uniform, with mean near one. With mean one, the periodicity of~\(c_\ell\) approximately matches the periodicity of the resultant spatial pattern. The current patch scheme coding preserves symmetry in the case of periodic patches (for every order of interpolation). For equispace and chebyshev options, the coupling currently fails symmetry. Consider the spectrum in the symmetric cases of periodic patches (based upon only the cases \(N=5,7\)). There are \(2N\)~small eigenvalues, separated by a gap from the rest. In the homogeneous case, these occur as \(N\)~pairs. With small heterogeneity, they appear to split into \(N-1\)~pairs, and two distinct. With stronger heterogeneity (say~\(0.5\)), they \emph{often} appear to also split into two clusters, each of~\(N\) eigenvalues, with one small-valued cluster, and one meso-valued cluster---curious. Further analysis with sparse approximation of the invariant spaces suggests the following: \begin{itemize} \item for homogeneous, the \(2N\)~modes are local oscillations in each patch, with two modes each corresponding to phase shifts of the possible oscillations; \item for heterogeneous \begin{itemize} \item \(N\)~eigenmodes appear to be one phase `locking' to the heterogeneity; and \item \(N\)~eigenmodes appear to be other phase `locking' to the heterogeneity. Unless it is something to do with the coupling, but then it only appears with heterogeneity. \end{itemize} \end{itemize} Consider the spectrum with BCs of \(u=u_{xx}=0\) at ends. Non-symmetric so some eigenvalues are complex! For small or zero heterogeneity find \(2N-2\) eigenvalues are small. Effectively, two modes in each of \(N-2\) interior patches, and one mode each in the two end patches. With increasing heterogeneity (say above~\(0.3\)), the gap decreases as a couple (or some) of the small eigenvalues become larger in magnitude. Consider the spectrum with BCs of \(u=u_{x}=0\) at ends. Non-symmetric so some eigenvalues are complex! For small or zero heterogeneity find \(2N-4\) eigenvalues are small. Effectively, two modes in each of \(N-2\) interior patches. With increasing heterogeneity (say above~\(0.4\)), half \((N-2)\) of the small eigenvalues become larger in magnitude (presumably some phase `locking' to the heterogeneity): effectively forms two clusters of modes. Set the desired microscale periodicity of the patterns, here~\(0.062\), and on the microscale lattice of spacing~\(0.0062\), correspondingly choose random microscale material coefficients. The wavenumber of this microscale patterns is \(k_0\approx 101\). \begin{matlab} %} clear all %global OurCf2eps, OurCf2eps=true %optional to save plots basename = ['r' num2str(floor(1e5*rem(now,1))) mfilename] Ra = 0.1 % Ra>0 leads to patterns nGap = 8 % controls size of gap between patches waveLength = 0.496688741721854 /nGap %for nPatch==5 %waveLength = 0.497630331753555 /nGap %for nPatch==7 %waveLength = 0.5 /nGap %for periodic case nPtsPeriod = 10 dx = waveLength/nPtsPeriod k0 = 2*pi/waveLength %{ \end{matlab} Create some random heterogeneous coefficients. \begin{matlab} %} heteroVar = 0.99*[1 1] % must be <2 cl = 1./(1-heteroVar/2+heteroVar.*rand(nPtsPeriod,2)); cRange = quantile(cl,0:0.5:1) %{ \end{matlab} Establish global data struct~\verb|patches| for heterogeneous Swift--Hohenberg \pde\ with, on average, one patch per units length. Use seven patches to start with. Quartic (fourth-order) interpolation \(\verb|ordCC|=4\) provides values for the inter-patch coupling conditions. Or use as high-order as possible with \(\verb|ordCC|=0\). \begin{matlab} %} nPatch = 5 nSubP = 2*nPtsPeriod+4 % +2 for not-edgyInt %nSubP = 2*nGap*nPtsPeriod+4 % approx full-domain Len = nPatch; ordCC = 0; dom.type='equispace'; dom.bcOffset=0.5 patches = configPatches1(@heteroSwiftHohenbergPDE,[0 Len],dom ... ,nPatch,ordCC,dx,nSubP,'EdgyInt',true,'nEdge',2 ... ,'hetCoeffs',cl); xs=squeeze(patches.x); %{ \end{matlab} \subsubsection{Explore the Jacobian} Finds that with periodic patches, everything is symmetric. However, for equispace or chebyshev, the patch coupling is not symmetric---is this to be expected? \begin{matlab} %} fprintf('\n**** Explore the Jacobian\n') u0 = 0*patches.x; u0([1:2 end-1:end],:) = nan; patches.i = find(~isnan(u0)); nVars = numel(patches.i) Jac = nan(nVars); for j=1:nVars Jac(:,j)=theRes((1:nVars)==j,patches,k0,0,0); end %{ \end{matlab} Check on the symmetry of the Jacobian \begin{matlab} %} nonSymmetric = norm(Jac-Jac') Jac(abs(Jac)<1e-12)=0; antiJac = Jac-Jac'; antiJac(abs(antiJac)<1e-12)=0; figure(6),clf spy(Jac,'.'),hold on, spy(antiJac,'rx'),hold off if nonSymmetric>5e-9, warning('failed symmetry'), else Jac = (Jac+Jac')/2; %tweak to symmetry end %{ \end{matlab} Compute eigenvalues and eigenvectors. \begin{matlab} %} figure(5),clf [evec,mEval] = eig(-Jac ,'vector'); [~,j]=sort(real(mEval)); mEval=mEval(j); evec=evec(:,j); loglog(real(mEval),'.') ylabel('$-\Re\lambda$') ifOurCf2tex([basename 'Eval'])%optionally save %{ \end{matlab} \begin{SCfigure} \centering \caption{\label{fig:SwiftHohenbergHeteroEval} eigenvalues of the patch scheme on the heterogeneous Swift--Hohenberg \pde\ (linearised). With \(N=5\) patches and \bc{}s of \(u=u_x=0\) at \(x\in\{0,5\}\), there are \(2(N-2)=6\) small eigenvalues, \(|\lambda|<0.001\), corresponding to six slow modes in the interior.} \def\extraAxisOptions{mark size=1pt} \inputFigs{r26479SwiftHohenbergHeteroEval} \end{SCfigure} Explore sparse approximations of all the slowest together (lots of iterations required), or separately of the two clusters of the slowest (few iterations needed). First ascertain whether one or two clusters of small eigenvalues. \begin{matlab} %} logGaps=diff(log10(real(mEval))); [~,j]=sort(-logGaps); %someLogGaps=[logGaps(j(1:5)) j(1:5)] if logGaps(j(2))<0.4*logGaps(j(1)), nSlow=j(1) else nSlow=min( sort(j(1:2)) , 3*nPatch) end log10Gap=logGaps(nSlow) smallEvals=-mEval(1:nSlow(end)+2) %{ \end{matlab} Second, make eigenvectors all real, sparsely approximate cluster modes via an algorithm developed from \cite{ZhenfangHu2014}, and plot. \cref{fig:SwiftHohenbergHeteroEvec} shows that each pair of basis vectors are phase-shifted by~\(90^\circ\). \begin{matlab} %} js=find(imag(mEval)>0); evec(:,js)=imag(evec(:,js)); evec=real(evec); if numel(nSlow)==1, S = spcart(evec(:,1:nSlow)); else S = spcart(evec(:,1:nSlow(1))); S = [S spcart(evec(:,nSlow(1)+1:nSlow(2))) ]; end; figure(3),clf vStep=ceil(max(abs(S(:)))*10+1)/10 for j=1:nSlow(end) u0(patches.i)=S(:,j); plot(xs,vStep*(j-1)+squeeze(u0),'.-'),hold on end hold off, xlabel('space $x$') ifOurCf2tex([basename 'Evec'])%optionally save %{ \end{matlab} \begin{figure} \centering \caption{\label{fig:SwiftHohenbergHeteroEvec} sparse approximations of the eigenvectors of the six slow modes of \cref{fig:SwiftHohenbergHeteroEval}. Plotted are sparse basis vectors for the invariant space spanned by the six slow eigenvectors: each basis vector shifted vertically to separate. Thus a fair approximation is that there are effectively two modes for each of the \(N-2=3\) interior patches.} \def\extraAxisOptions{small, mark size=1pt, width=13cm, height=7cm} \inputFigs{r26479SwiftHohenbergHeteroEvec} \end{figure} Reorganise the eigenvectors to maybe clarify. \begin{matlab} %} [i,j]=find(abs(S)>vStep/2); j=find([1;diff(j)]); [i,k]=sort(i(j)); figure(4) for p=1:2 clf,subplot(2,1,1) for j=p:2:numel(k) u0(patches.i)=S(:,k(j)); plot(xs,squeeze(u0),'.-'),hold on end% for j hold off, xlabel('space $x$') ifOurCf2tex([basename 'Evec' num2str(p)])%optionally save end%for p %{ \end{matlab} \begin{figure} \centering \caption{\label{fig:SwiftHohenbergHeteroEvec2} sparse basis approximations for the invariant subspace of the six slow modes of \cref{fig:SwiftHohenbergHeteroEval}. A replot of \cref{fig:SwiftHohenbergHeteroEvec} but with three of the basis vectors superimposed in each of the two panels.} \def\extraAxisOptions{small, mark size=1pt, width=13cm, height=3cm} \inputFigs{r26479SwiftHohenbergHeteroEvec1} \inputFigs{r26479SwiftHohenbergHeteroEvec2} \end{figure} \subsubsection{Find an equilibrium with fsolve} Start the search from some guess. \begin{matlab} %} fprintf('\n**** Find equilibrium with fsolve\n') u = 0.4*sin(2*pi/waveLength*patches.x); %{ \end{matlab} But set the pairs of patch-edge values to \verb|Nan| in order to use \verb|patches.i| to index the interior sub-patch points as they are the variables. \begin{matlab} %} u([1:2 end-1:end],:) = nan; patches.i = find(~isnan(u)); %{ \end{matlab} Seek the equilibrium, and report the norm of the residual, via the generic patch system wrapper \verb|theRes| (\cref{sec:theResSWhetero}). \begin{matlab} %} tic [u(patches.i),res] = fsolve(@(v) theRes(v,patches,k0,Ra,1) ... ,u(patches.i) ,optimoptions('fsolve','Display','off')); solveTime = toc normRes = norm(res) if normRes>1e-7, warning('residual large: bad equilibrium'),end %{ \end{matlab} \paragraph{Plot the equilibrium} see \cref{fig:SwiftHohenbergHeteroEquilib}. \begin{matlab} %} figure(1),clf subplot(2,1,1) plot(xs,squeeze(u),'.-') xlabel('space $x$'),ylabel('equilibrium $u(x)$') ifOurCf2tex([basename 'Equilib'])%optionally save %{ \end{matlab} \begin{figure} \centering \caption{\label{fig:SwiftHohenbergHeteroEquilib} an equilibrium of the heterogeneous Swift--Hohenberg \pde\ determined by the patch scheme} \def\extraAxisOptions{small, mark size=1pt, width=13cm, height=4cm} \inputFigs{r26479SwiftHohenbergHeteroEquilib} \end{figure} \subsubsection{Simulate in time} Set an initial condition, and here integrate forward in time using a standard method for stiff systems---because of the simplicity of linear problems this method works quite efficiently here. Integrate the interface \verb|patchSys1| (\cref{sec:patchSys1}) to the microscale differential equations. \begin{matlab} %} fprintf('\n**** Simulate in time\n') u0 = 0*sin(2*pi/waveLength*patches.x)+0.1*randn(nSubP,1,1,nPatch); tic [ts,us] = ode15s(@patchSys1, [0 40], u0(:) ,[],patches,k0,Ra,1); simulateTime = toc us = reshape(us,length(ts),numel(patches.x(:)),[]); %{ \end{matlab} Plot the simulation in \cref{fig:SwiftHohenbergHeteroU}. \begin{matlab} %} figure(2),clf xs([1:2 end-1:end],:) = nan; mesh(ts(1:3:end),xs(:),us(1:3:end,:)'), view(65,60) colormap(0.7*hsv) xlabel('time $t$'), ylabel('space $x$'), zlabel('$u(x,t)$') ifOurCf2eps([basename 'Uxt']) %{ \end{matlab} Fin. \subsection{Heterogeneous SwiftHohenberg PDE+BCs inside patches} As a microscale discretisation of Swift--Hohenberg \pde\ \(u_t= -D[c_1(x)Du] +\Ra u -u^3\), where heterogeneous operator \(D = 1 +\partial_x( c_2(x) \partial_x )/k_0^2\). \begin{matlab} %} function ut=heteroSwiftHohenbergPDE(t,u,patches,k0,Ra,cubic) dx=diff(patches.x(1:2)); % microscale spacing i=3:size(u,1)-2; % interior points in patches %{ \end{matlab} Code a couple of different boundary conditions of zero function and derivative(s) at left-end of left-patch, and right-end of right-patch. For slightly simpler coding, squeeze out the two singleton dimensions. \begin{matlab} %} u = squeeze(u); if ~patches.periodic switch 1 case 1 % these are u=u_x=0 u(1:2,1)=0; u(end-1:end,end)=0; case 2 % these are u=u_{xx}=0 u(1:2,1) = [-u(3,1); 0]; u(end-1:end,end) = [0; -u(end-2,end)]; end% case end%if %{ \end{matlab} Here code straightforward centred discretisation in space. \begin{matlab} %} ut = nan+u; % preallocate output array v = u(2:end-1,:)+diff(patches.cs(: ,2).*diff(u))/dx^2/k0^2; v = v.*patches.cs(2:end,1); v = v(2:end-1,:)+diff(patches.cs(2:end-1,2).*diff(v))/dx^2/k0^2; ut(i,:) = -v +Ra*u(i,:) -cubic*u(i,:).^3; end %{ \end{matlab} \subsection{\texttt{theRes()}: a wrapper function} \label{sec:theResSWhetero} This functions converts a vector of values into the interior values of the patches, then evaluates the time derivative of the system at time zero, and returns the vector of patch-interior time derivatives. \begin{matlab} %} function f=theRes(u,patches,k0,Ra,cubic) v=nan(size(patches.x)); v(patches.i) = u; f = patchSys1(0,v(:),patches,k0,Ra,cubic); f = f(patches.i); end%function theRes %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
patchSys2.m
.m
EquationFreeGit-master/Patch/patchSys2.m
3,739
utf_8
89dfc4cb2288733f30c09a385da6fe21
% patchSys2() Provides an interface to time integrators % for the dynamics on patches in 2D coupled across space. % The system must be a lattice system such as PDE % discretisations. AJR, Nov 2018 -- 12 Apr 2023 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{patchSys2()}: interface 2D space to time integrators} \label{sec:patchSys2} To simulate in time with 2D spatial patches we often need to interface a users time derivative function with time integration routines such as \verb|ode23| or~\verb|PIRK2|. This function provides an interface. Communicate patch-design variables (\cref{sec:configPatches2}) either via the global struct~\verb|patches| or via an optional third argument. \verb|patches| is required for the parallel computing of \verb|spmd|, or if parameters are to be passed though to the user microscale function. \begin{matlab} %} function dudt = patchSys2(t,u,patches,varargin) if nargin<3, global patches, end %{ \end{matlab} \paragraph{Input} \begin{itemize} \item \verb|u| is a vector\slash array of length $\verb|prod(nSubP)| \cdot \verb|nVars| \cdot \verb|nEnsem| \cdot \verb|prod(nPatch)|$ where there are $\verb|nVars| \cdot \verb|nEnsem|$ field values at each of the points in the $\verb|nSubP(1)| \times \verb|nSubP(2)| \times \verb|nPatch(1)| \times \verb|nPatch(2)|$ grid. \item \verb|t| is the current time to be passed to the user's time derivative function. \item \verb|patches| a struct set by \verb|configPatches2()| with the following information used here. \begin{itemize} \item \verb|.fun| is the name of the user's function \verb|fun(t,u,patches,...)| that computes the time derivatives on the patchy lattice. The array~\verb|u| has size $\verb|nSubP(1)| \times \verb|nSubP(2)| \times \verb|nVars| \times \verb|nEsem| \times \verb|nPatch(1)| \times \verb|nPatch(2)|$. Time derivatives must be computed into the same sized array, although herein the patch edge-values are overwritten by zeros. \item \verb|.x| is $\verb|nSubP(1)| \times1 \times1 \times1 \verb|nPatch(1)| \times1$ array of the spatial locations~$x_{i}$ of the microscale $(i,j)$-grid points in every patch. Currently it \emph{must} be an equi-spaced lattice on both macro- and micro-scales. \item \verb|.y| is similarly $1 \times \verb|nSubP(2)| \times1 \times1 \times1 \times \verb|nPatch(2)|$ array of the spatial locations~$y_{j}$ of the microscale $(i,j)$-grid points in every patch. Currently it \emph{must} be an equi-spaced lattice on both macro- and micro-scales. \end{itemize} \item \verb|varargin|, optional, is arbitrary list of parameters to be passed onto the users time-derivative function as specified in configPatches2. \end{itemize} \paragraph{Output} \begin{itemize} \item \verb|dudt| is a vector\slash array of of time derivatives, but with patch edge-values set to zero. It is of total length $\verb|prod(nSubP)| \cdot \verb|nVars| \cdot \verb|nEnsem| \cdot \verb|prod(nPatch)|$ and the same dimensions as~\verb|u|. \end{itemize} \begin{devMan} Reshape the fields~\verb|u| as a 6D-array, and sets the edge values from macroscale interpolation of centre-patch values. \cref{sec:patchEdgeInt2} describes \verb|patchEdgeInt2()|. \begin{matlab} %} sizeu = size(u); u = patchEdgeInt2(u,patches); %{ \end{matlab} Ask the user function for the time derivatives computed in the array, overwrite its edge values with the dummy value of zero (as \verb|ode15s| chokes on NaNs), then return to the user\slash integrator as same sized array as input. \begin{matlab} %} dudt = patches.fun(t,u,patches,varargin{:}); m = patches.nEdge(1); dudt([1:m end-m+1:end],:,:) = 0; m = patches.nEdge(2); dudt(:,[1:m end-m+1:end],:) = 0; dudt = reshape(dudt,sizeu); %{ \end{matlab} Fin. \end{devMan} %}
github
uoa1184615/EquationFreeGit-master
patchSmooth2.m
.m
EquationFreeGit-master/Patch/patchSmooth2.m
376
utf_8
f8dd4fe1b147b1fab1ccfaee915fee3e
% legacy interface patchSmooth2() auto-invokes new patchSys2() function dudt=patchSmooth2(t,u,patches) global smOOthCount if isempty(smOOthCount), smOOthCount=1; else smOOthCount=smOOthCount+1; end l2=log2(smOOthCount); if abs(l2-round(l2))<1e-9 warning('Use new patchSys2 instead of old patchSmooth2') end if nargin<3, global patches, end dudt=patchSys2(t,u,patches);
github
uoa1184615/EquationFreeGit-master
wavePDE.m
.m
EquationFreeGit-master/Patch/wavePDE.m
897
utf_8
7602308553e43185da7a08cacefca52c
% Microscale discretisation of the 2D ideal wave PDE inside % 2D patches in space. Used by the example wave2D.m % AJR, 4 Apr 2019 -- Nov 2020 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \subsection{\texttt{wavePDE()}: Example of simple wave PDE inside patches} As a microscale discretisation of \(u_{tt}=\delsq(u)\), so code \(\dot u_{ijkl}=v_{ijkl}\) and \(\dot v_{ijkl} =\frac1{\delta x^2} (u_{i+1,j,k,l} -2u_{i,j,k,l} +u_{i-1,j,k,l}) + \frac1{\delta y^2} (u_{i,j+1,k,l} -2u_{i,j,k,l} +u_{i,j-1,k,l})\). \begin{matlab} %} function uvt = wavePDE(t,uv,patches) dx = diff(patches.x(1:2)); dy = diff(patches.y(1:2)); % microscale spacing i = 2:size(uv,1)-1; j = 2:size(uv,2)-1; % interior patch-points uvt = nan+uv; % preallocate storage uvt(i,j,1,:) = uv(i,j,2,:); uvt(i,j,2,:) = diff(uv(:,j,1,:),2,1)/dx^2 ... +diff(uv(i,:,1,:),2,2)/dy^2; end %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
twoscaleDiffEquil2Errs.m
.m
EquationFreeGit-master/Patch/twoscaleDiffEquil2Errs.m
12,228
utf_8
6ac1bdbb99ab92212ecd4b99b2944c73
% Explore errors in the steady state of twoscale % heterogeneous diffusion in 2D on patches as an example, % inspired by section 5.3.1 of Freese et al., 2211.13731. % AJR, 31 Jan 2023 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{twoscaleDiffEquil2Errs}: errors in equilibria of a 2D twoscale heterogeneous diffusion via small patches} \label{sec:twoscaleDiffEquil2Errs} \begin{figure} \centering\caption{\label{fig:twoscaleDiffEquil2Errsus} For various numbers of patches as indicated on the colorbar, plot the equilibrium of the multiscale diffusion problem of Freese with Dirichlet zero-value boundary conditions (\cref{sec:twoscaleDiffEquil2Errs}). We only compare solutions only in these 25~common patches.} \includegraphics[scale=0.8]{Figs/twoscaleDiffEquil2Errsus} \end{figure}% Here we find the steady state~\(u(x,y)\) to the heterogeneous \pde\ (inspired by Freese et al.\footnote{ \protect \url{http://arxiv.org/abs/2211.13731}} \S5.3.1) \begin{equation*} u_t=A(x,y)\grad\grad u+f, \end{equation*} on domain \([-1,1]^2\) with Dirichlet BCs, for coefficient `diffusion' matrix, varying with some microscale period~\(\epsilon\) (here \(\epsilon\approx 0.24, 0.12, 0.06, 0.03\)), of \begin{equation*} A:=\begin{bmatrix} 2& a\\a & 2 \end{bmatrix} \quad \text{with } a:=\sin(\pi x/\epsilon)\sin(\pi y/\epsilon), \end{equation*} and for forcing \(f:=10(x+y+\cos\pi x)\) (for which the solution has magnitude up to one).\footnote{Freese et al.\ had forcing \(f:=(x+\cos3\pi x)y^3\), but here we want smoother forcing so we get meaningful results in a minute or two computation.\footnote{Except in the `usergiven' case, for $N=65$, that is $152\,100$ unknowns, it takes an hour to compute the Jacobian, then chokes.} For the same reason we do not invoke their smaller \(\epsilon\approx 0.01\).} \begin{figure} \centering\caption{\label{fig:twoscaleDiffEquil2Errs} For various numbers of patches as indicated on the colorbar, plot the equilibrium of the multiscale diffusion problem of Freese with Dirichlet zero-value boundary conditions (\cref{sec:twoscaleDiffEquil2Errs}). We only compare solutions only in these 25~common patches.} \includegraphics[scale=0.8]{Figs/twoscaleDiffEquil2Errs} \end{figure}% Here we explore the errors for increasing number~\(N\) of patches (in both directions). Find mean-abs errors to be the following (for different orders of interpolation and patch distribution): \begin{equation*} \begin{array}{rcccc} N&5&9&17&33%&65 \\\hline \text{equispace, 2nd-order} &6\E2 &3\E2 &1\E2 &3\E3 \\ \text{equispace, 4th-order} &3\E2 &8\E3 &7\E4 &7\E5 \\ \text{chebyshev, 4th-order} &1\E2 &2\E2 &6\E3 &2\E3 \\ \text{usergiven, 4th-order} &1\E2 &2\E2 &4\E3 &\text{n/a} \\ \text{equispace, 6th-order} &3\E2 &1\E3 &1\E4 &2\E5 \\\hline \end{array} \end{equation*} \paragraph{Script start} Clear, and initiate global patches. Choose the type of patch distribution to be either `equispace', `chebyshev', or `usergiven'. Also set order of interpolation (fourth-order is good start). \begin{matlab} %} clear all global patches %global OurCf2eps, OurCf2eps=true %option to save plot switch 1 case 1, Dom.type = 'equispace' case 2, Dom.type = 'chebyshev' case 3, Dom.type = 'usergiven' end% switch ordInt = 4 %{ \end{matlab} \paragraph{First configure the patch system} Establish the microscale heterogeneity has micro-period \verb|mPeriod| on the spatial lattice. Then \verb|configPatches2| replicates the heterogeneity as needed to fill each patch. \begin{matlab} %} mPeriod = 6 z = (0.5:mPeriod)'/mPeriod; A = sin(2*pi*z).*sin(2*pi*z'); %{ \end{matlab} To use a hierarchy of patches with \verb|nPatch| of~5, 9, 17, \ldots, we need up to \(N\)~patches plus one~\verb|dx| to fit into the domain interval. Cater for up to some full-domain simulation---can compute \(\verb|log2Nmax|=5\) (\(\epsilon=0.06\)) within minutes: \begin{matlab} %} log2Nmax = 4 % >2 up to 6 OKish nPatchMax=2^log2Nmax+1 %{ \end{matlab} Set the periodicity~\(\epsilon\), and other microscale parameters. \begin{matlab} %} nPeriodsPatch = 1 % any integer nSubP = nPeriodsPatch*mPeriod+2 % for edgy int epsilon = 2/(nPatchMax*nPeriodsPatch+1/mPeriod) dx = epsilon/mPeriod %{ \end{matlab} \paragraph{For various numbers of patches} Choose five patches to be the coarsest number of patches. Define variables to store common results for the solutions from differing patches. Assign \verb|Ps| to be the indices of the common patches: for equispace set to the five common patches, but for `chebyshev' the only common ones are the three centre and boundary-adjacent patches. \begin{matlab} %} us=[]; xs=[]; ys=[]; nPs=[]; for log2N=log2Nmax:-1:2 if log2N==log2Nmax Ps=linspace(1,nPatchMax ... ,5-2*all(Dom.type=='chebyshev')) else Ps=(Ps+1)/2 end %{ \end{matlab} Set the number of patches in \((-1,1)\): \begin{matlab} %} nPatch = 2^log2N+1 %{ \end{matlab} In the case of `usergiven', we set the standard Chebyshev distribution of the patch-centres, which involves overlapping of patches near the boundaries! (instead of the coded chebyshev which has boundary layers of abutting patches, and non-overlapping Chebyshev between the boundary layers). \begin{matlab} %} if all(Dom.type=='usergiven') halfWidth = dx*(nSubP-1)/2; X1 = -1+halfWidth; X2 = 1-halfWidth; Dom.X = (X1+X2)/2-(X2-X1)/2*cos(linspace(0,pi,nPatch)); Dom.Y = Dom.X; end %{ \end{matlab} Configure the patches: \begin{matlab} %} configPatches2(@twoscaleDiffForce2,[-1 1],Dom,nPatch ... ,ordInt ,dx ,nSubP ,'EdgyInt',true ,'hetCoeffs',A ); %{ \end{matlab} Compute the time-constant forcing, and store in struct \verb|patches| for access by the microcode of \cref{sec:twoscaleDiffForce2}. \begin{matlab} %} if 1 patches.fu = 10*(patches.x+cos(pi*patches.x)+patches.y); else patches.fu = 8+0*patches.x+0*patches.y; end %{ \end{matlab} \paragraph{Solve for steady state} Set initial guess of either zero or a subsample of the previous, next-finer, solution. \verb|NaN| indicates patch-edge values. Index~\verb|i| are the indices of patch-interior points, and the number of unknowns is then its length. \begin{matlab} %} if log2N==log2Nmax u0 = zeros(nSubP,nSubP,1,1,nPatch,nPatch); else u0 = u0(:,:,:,:,1:2:end,1:2:end); end u0([1 end],:,:) = nan; u0(:,[1 end],:) = nan; patches.i = find(~isnan(u0)); nVariables = numel(patches.i) %{ \end{matlab} First try to solve via iterative solver \verb|bicgstab|, via the generic patch system wrapper \verb|theRes| (\cref{sec:theRes}). \begin{matlab} %} tic; maxIt = ceil(nVariables/10); rhsb = theRes( zeros(size(patches.i)) ); [uSoln,flag] = bicgstab(@(u) rhsb-theRes(u),rhsb ... ,1e-9,maxIt,[],[],u0(patches.i)); bicgTime = toc %{ \end{matlab} However, the above often fails (and \verb|fsolve| sometimes takes too long here), so then try a preconditioned version of \verb|bicgstab|. The preconditioner is derived from the Jacobian which is expensive to find (four minutes for \(N=33\), one hour for $N=65$), but we do so as follows. \begin{matlab} %} if flag>0, disp('**** bicg failed, trying ILU preconditioner') disp(['Computing Jacobian: wait roughly ' ... num2str(nPatch^4/4500,2) ' secs']) tic Jac=sparse(nVariables,nVariables); for j=1:nVariables Jac(:,j)=sparse( rhsb-theRes((1:nVariables)'==j) ); end formJacTime=toc %{ \end{matlab} Compute an incomplete \(LU\)-factorization, and use it as preconditioner to \verb|bicgstab|. \begin{matlab} %} tic [L,U] = ilu(Jac,struct('type','ilutp','droptol',1e-4)); LUfillFactor = (nnz(L)+nnz(U))/nnz(Jac) [uSoln,flag] = bicgstab(@(u) rhsb-theRes(u),rhsb ... ,1e-9,maxIt,L,U,u0(patches.i)); precondSolveTime=toc assert(flag==0,'preconditioner fails bicgstab. Lower droptol?') end%if flag %{ \end{matlab} Store the solution into the patches, and give magnitudes---Inf norm is max(abs()). \begin{matlab} %} normResidual = norm(theRes(uSoln),Inf) normSoln = norm(uSoln,Inf) u0(patches.i) = uSoln; u0 = patchEdgeInt2(u0); u0( 1 ,:,:,:, 1 ,:)=0; % left edge of left patches u0(end,:,:,:,end,:)=0; % right edge of right patches u0(:, 1 ,:,:,:, 1 )=0; % bottom edge of bottom patches u0(:,end,:,:,:,end)=0; % top edge of top patches assert(normResidual<1e-5,'poor--bad solution found') %{ \end{matlab} Concatenate the solution on common patches into stores. \begin{matlab} %} us=cat(5,us,squeeze(u0(:,:,:,:,Ps,Ps))); xs=cat(3,xs,squeeze(patches.x(:,:,:,:,Ps,:))); ys=cat(3,ys,squeeze(patches.y(:,:,:,:,:,Ps))); nPs = [nPs;nPatch]; %{ \end{matlab} End loop. Check micro-grids are aligned, then compute errors compared to the full-domain solution (or the highest resolution solution for the case of `usergiven'). \begin{matlab} %} end%for log2N assert(max(abs(reshape(diff(xs,1,3),[],1)))<1e-12,'x-coord failure') assert(max(abs(reshape(diff(ys,1,3),[],1)))<1e-12,'y-coord failure') errs = us-us(:,:,:,:,1); meanAbsErrs = mean(abs(reshape(errs,[],size(us,5)))) ratioErrs = meanAbsErrs(2:end)./meanAbsErrs(1:end-1) %{ \end{matlab} \paragraph{Plot solution in common patches} First reshape arrays to suit 2D space surface plots, inserting nans to separate patches. \begin{matlab} %} x = xs(:,:,1); y = ys(:,:,1); u=us; x(end+1,:)=nan; y(end+1,:)=nan; u(end+1,:,:)=nan; u(:,end+1,:)=nan; u = reshape(permute(u,[1 3 2 4 5]),numel(x),numel(y),[]); %{ \end{matlab} Plot the patch solution surfaces, with colour offset between surfaces (best if \(u\)-field has a range of one): blues are the full-domain solution, reds the coarsest patches. \begin{matlab} %} figure(1), clf, colormap(jet) for p=1:size(u,3) mesh(x(:),y(:),u(:,:,p)',p+u(:,:,p)'); hold on; end, hold off view(60,55) colorbar('Ticks',1:size(u,3) ... ,'TickLabels',[num2str(nPs) ['x';'x';'x'] num2str(nPs)]); xlabel('space $x$'), ylabel('space $y$'), zlabel('$u(x,y)$') ifOurCf2eps([mfilename 'us'])%optionally save %{ \end{matlab} \paragraph{Plot error surfaces} Plot the error surfaces, with colour offset between surfaces (best if \(u\)-field has a range of one): dark blue is the full-domain zero error, reds the coarsest patches. \begin{matlab} %} err=u(:,:,1)-u; maxAbsErr=max(abs(err(:))); figure(2), clf, colormap(jet) for p=1:size(u,3) mesh(x(:),y(:),err(:,:,p)',p+err(:,:,p)'/maxAbsErr); hold on; end, hold off view(60,55) colorbar('Ticks',1:size(u,3) ... ,'TickLabels',[num2str(nPs) ['x';'x';'x'] num2str(nPs)]); xlabel('space $x$'), ylabel('space $y$') zlabel('errors in $u(x,y)$') ifOurCf2eps(mfilename)%optionally save %{ \end{matlab} \subsection{\texttt{twoscaleDiffForce2()}: microscale discretisation inside patches of forced diffusion PDE} \label{sec:twoscaleDiffForce2} This function codes the lattice heterogeneous diffusion of the \pde\ inside the patches. For 6D input arrays~\verb|u|, \verb|x|, and~\verb|y|, computes the time derivative at each point in the interior of a patch, output in~\verb|ut|. \begin{matlab} %} function ut = twoscaleDiffForce2(t,u,patches) dx = diff(patches.x(2:3)); % x space step dy = diff(patches.y(2:3)); % y space step i = 2:size(u,1)-1; % x interior points in a patch j = 2:size(u,2)-1; % y interior points in a patch ut = nan+u; % preallocate output array %{ \end{matlab} Set Dirichlet boundary value of zero around the square domain. \begin{matlab} %} u( 1 ,:,:,:, 1 ,:)=0; % left edge of left patches u(end,:,:,:,end,:)=0; % right edge of right patches u(:, 1 ,:,:,:, 1 )=0; % bottom edge of bottom patches u(:,end,:,:,:,end)=0; % top edge of top patches %{ \end{matlab} Compute the time derivatives via stored forcing and coefficients. Easier to code by conflating the last four dimensions into the one~\verb|,:|. \begin{matlab} %} ut(i,j,:) ... = 2*diff(u(:,j,:),2,1)/dx^2 +2*diff(u(i,:,:),2,2)/dy^2 ... +2*patches.cs(i,j).*( u(i+1,j+1,:) -u(i-1,j+1,:) ... -u(i+1,j-1,:) +u(i-1,j-1,:) )/(4*dx*dy) ... +patches.fu(i,j,:); end%function twoscaleDiffForce2 %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
odeOcts.m
.m
EquationFreeGit-master/Patch/odeOcts.m
624
utf_8
934d39f5a5f7fb20467f467b642ff4f4
% Provides Matlab-like front-end to Octave ODE solver. Uses % non-stiff integrator as stiff ones are, surprisingly, far % too slow. But cannot use lsode, and hence this function, % recursively. Used by configPatches1.m, configPatches2.m, % ensembleAverageExample.m, homogenisationExample.m, % waterWaveExample.m, wave2D.m, and so on. AJR, 17 Aug 2020 %{ \begin{matlab} %} function [ts,xs] = odeOcts(dxdt,tSpan,x0) if length(tSpan)>2, ts = tSpan; else ts = linspace(tSpan(1),tSpan(end),21)'; end lsode_options('integration method','non-stiff'); xs = lsode(@(x,t) dxdt(t,x),x0,ts); end %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
patchEdgeInt1.m
.m
EquationFreeGit-master/Patch/patchEdgeInt1.m
16,444
utf_8
4d5890cdcc086ffde04fad57d210c2f8
% patchEdgeInt1() provides the interpolation across 1D space % for 1D patches of simulations of a lattice system such as % PDE discretisations. AJR & JB, Sep 2018 -- 23 Mar 2023 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{patchEdgeInt1()}: sets patch-edge values from interpolation over the 1D macroscale} \label{sec:patchEdgeInt1} Couples 1D patches across 1D space by computing their edge values from macroscale interpolation of either the mid-patch value \cite[]{Roberts00a, Roberts06d}, or the patch-core average \cite[]{Bunder2013b}, or the opposite next-to-edge values \cite[]{Bunder2020a}---this last alternative often maintains symmetry. This function is primarily used by \verb|patchSys1()| but is also useful for user graphics. When using core averages (not fully implemented), assumes the averages are sensible macroscale variables: then patch edge values are determined by macroscale interpolation of the core averages \citep{Bunder2013b}. \footnote{Script \texttt{patchEdgeInt1test.m} verifies this code.} Communicate patch-design variables via a second argument (optional, except required for parallel computing of \verb|spmd|), or otherwise via the global struct \verb|patches|. \begin{matlab} %} function u=patchEdgeInt1(u,patches) if nargin<2, global patches, end %{ \end{matlab} \paragraph{Input} \begin{itemize} \item \verb|u| is a vector\slash array of length $\verb|nSubP| \cdot \verb|nVars|\cdot \verb|nEnsem|\cdot \verb|nPatch|$ where there are $\verb|nVars|\cdot \verb|nEnsem|$ field values at each of the points in the $\verb|nSubP| \times \verb|nPatch|$ multiscale spatial grid. \item \verb|patches| a struct largely set by \verb|configPatches1()|, and which includes the following. \begin{itemize} \item \verb|.x| is $\verb|nSubP| \times1 \times1 \times \verb|nPatch|$ array of the spatial locations~$x_{iI}$ of the microscale grid points in every patch. Currently it \emph{must} be an equi-spaced lattice on the microscale index~$i$, but may be variable spaced in macroscale index~$I$. \item \verb|.ordCC| is order of interpolation, integer~$\geq -1$. \item \verb|.periodic| indicates whether macroscale is periodic domain, or alternatively that the macroscale has left and right boundaries so interpolation is via divided differences. \item \verb|.stag| in $\{0,1\}$ is one for staggered grid (alternating) interpolation, and zero for ordinary grid. \item \verb|.Cwtsr| and \verb|.Cwtsl| are the coupling coefficients for finite width interpolation---when invoking a periodic domain. \item \verb|.EdgyInt|, true/false, for determining patch-edge values by interpolation: true, from opposite-edge next-to-edge values (often preserves symmetry); false, from centre-patch values (original scheme). \item \verb|.nEdge|, for each patch, the number of edge values set by interpolation at the edge regions of each patch (default is one). \item \verb|.nEnsem| the number of realisations in the ensemble. \item \verb|.parallel| whether serial or parallel. \item \verb|.nCore| \todo{introduced sometime but not fully implemented yet, because prefer ensemble} \end{itemize} \end{itemize} \paragraph{Output} \begin{itemize} \item \verb|u| is 4D array, $\verb|nSubP| \times \verb|nVars| \times \verb|nEnsem| \times \verb|nPatch|$, of the fields with edge values set by interpolation. \end{itemize} \begin{devMan} Test for reality of the field values, and define a function accordingly. Could be problematic if some variables are real and some are complex, or if variables are of quite different sizes. \begin{matlab} %} if max(abs(imag(u(:))))<1e-9*max(abs(u(:))) uclean=@(u) real(u); else uclean=@(u) u; end %{ \end{matlab} Determine the sizes of things. Any error arising in the reshape indicates~\verb|u| has the wrong size. \begin{matlab} %} [nx,~,~,Nx] = size(patches.x); nEnsem = patches.nEnsem; nVars = round(numel(u)/numel(patches.x)/nEnsem); assert(numel(u) == nx*nVars*nEnsem*Nx ... ,'patchEdgeInt1: input u has wrong size for parameters') u = reshape(u,nx,nVars,nEnsem,Nx); %{ \end{matlab} If the user has not defined the patch core, then we assume it to be a single point in the middle of the patch, unless we are interpolating from next-to-edge values. These index vectors point to patches and their two immediate neighbours, for periodic domain. \begin{matlab} %} I = 1:Nx; Ip = mod(I,Nx)+1; Im = mod(I-2,Nx)+1; %{ \end{matlab} \paragraph{Implement multiple width edges by folding} Subsample~\(x\) coordinates, noting it is only differences that count \emph{and} the microgrid~\(x\) spacing must be uniform. \begin{matlab} %} x = patches.x; if patches.nEdge>1 nEdge = patches.nEdge; x = x(1:nEdge:nx,:,:,:); nx = nx/nEdge; u = reshape(u,nEdge,nx,nVars,nEnsem,Nx); nVars = nVars*nEdge; u = reshape( permute(u,[2 1 3:5]) ,nx,nVars,nEnsem,Nx); end%if patches.nEdge %{ \end{matlab} Calculate centre of each patch and the surrounding core (\verb|nx| and \verb|nCore| are both odd). \begin{matlab} %} i0 = round((nx+1)/2); c = round((patches.nCore-1)/2); %{ \end{matlab} \subsection{Periodic macroscale interpolation schemes} \begin{matlab} %} if patches.periodic %{ \end{matlab} Get the size ratios of the patches, then use finite width stencils or spectral. \begin{matlab} %} r = patches.ratio(1); if patches.ordCC>0 % then finite-width polynomial interpolation %{ \end{matlab} \paragraph{Lagrange interpolation gives patch-edge values} Consequently, compute centred differences of the patch core/edge averages/values for the macro-interpolation of all fields. Here the domain is macro-periodic. \begin{matlab} %} if patches.EdgyInt % interpolate next-to-edge values Ux = u([2 nx-1],:,:,I); else % interpolate mid-patch values/sums Ux = sum( u((i0-c):(i0+c),:,:,I) ,1); end; %{ \end{matlab} Just in case any last array dimension(s) are one, we force a padding of the sizes, then adjoin the extra dimension for the subsequent array of differences. \begin{matlab} %} szUxO=size(Ux); szUxO=[szUxO ones(1,4-length(szUxO)) patches.ordCC]; %{ \end{matlab} Use finite difference formulas for the interpolation, so store finite differences in these arrays. When parallel, in order to preserve the distributed array structure we use an index at the end for the differences. \begin{matlab} %} if patches.parallel dmu = zeros(szUxO,patches.codist); % 5D else dmu = zeros(szUxO); % 5D end %{ \end{matlab} First compute differences, either $\mu$ and $\delta$, or $\mu\delta$ and $\delta^2$ in space. \begin{matlab} %} if patches.stag % use only odd numbered neighbours dmu(:,:,:,I,1) = (Ux(:,:,:,Ip)+Ux(:,:,:,Im))/2; % \mu dmu(:,:,:,I,2) = (Ux(:,:,:,Ip)-Ux(:,:,:,Im)); % \delta Ip = Ip(Ip); Im = Im(Im); % increase shifts to \pm2 else % standard dmu(:,:,:,I,1) = (Ux(:,:,:,Ip)-Ux(:,:,:,Im))/2; % \mu\delta dmu(:,:,:,I,2) = (Ux(:,:,:,Ip)-2*Ux(:,:,:,I) ... +Ux(:,:,:,Im)); % \delta^2 end%if patches.stag %{ \end{matlab} Recursively take $\delta^2$ of these to form successively higher order centred differences in space. \begin{matlab} %} for k = 3:patches.ordCC dmu(:,:,:,:,k) = dmu(:,:,:,Ip,k-2) ... -2*dmu(:,:,:,I,k-2) +dmu(:,:,:,Im,k-2); end %{ \end{matlab} Interpolate macro-values to be Dirichlet edge values for each patch \cite[]{Roberts06d, Bunder2013b}, using weights computed in \verb|configPatches1()|. Here interpolate to specified order. For the case where single-point values interpolate to patch-edge values: when we have an ensemble of configurations, different realisations are coupled to each other as specified by \verb|patches.le| and \verb|patches.ri|. \begin{matlab} %} if patches.nCore==1 k=1+patches.EdgyInt; % use centre/core or two edges u(nx,:,patches.ri,I) = Ux(1,:,:,:)*(1-patches.stag) ... +sum( shiftdim(patches.Cwtsr,-4).*dmu(1,:,:,:,:) ,5); u(1 ,:,patches.le,I) = Ux(k,:,:,:)*(1-patches.stag) ... +sum( shiftdim(patches.Cwtsl,-4).*dmu(k,:,:,:,:) ,5); %{ \end{matlab} For a non-trivial core then more needs doing: the core (one or more) of each patch interpolates to the edge action regions. When more than one in the core, the edge is set depending upon near edge values so the average near the edge is correct. \begin{matlab} %} else% patches.nCore>1 error('not yet considered, july--dec 2020 ??') u(nx,:,:,I) = Ux(:,:,I)*(1-patches.stag) ... + reshape(-sum(u((nx-patches.nCore+1):(nx-1),:,:,I),1) ... + sum( patches.Cwtsr.*dmu ),Nx,nVars); u(1,:,:,I) = Ux(:,:,I)*(1-patches.stag) ... + reshape(-sum(u(2:patches.nCore,:,:,I),1) ... + sum( patches.Cwtsl.*dmu ),Nx,nVars); end%if patches.nCore %{ \end{matlab} \paragraph{Case of spectral interpolation} Assumes the domain is macro-periodic. \begin{matlab} %} else% patches.ordCC<=0, spectral interpolation %{ \end{matlab} As the macroscale fields are $N$-periodic, the macroscale Fourier transform writes the centre-patch values as $U_j = \sum_{k}C_ke^{ik2\pi j/N}$. Then the edge-patch values $U_{j\pm r} =\sum_{k}C_ke^{ik2\pi/N(j\pm r)} =\sum_{k}C'_ke^{ik2\pi j/N}$ where $C'_k = C_ke^{ikr2\pi/N}$. For \verb|Nx|~patches we resolve `wavenumbers' $|k|<\verb|Nx|/2$, so set row vector $\verb|ks| = k2\pi/N$ for `wavenumbers' $\mathcode`\,="213B k = (0,1, \ldots, k_{\max}, -k_{\max}, \ldots, -1)$ for odd~$N$, and $\mathcode`\,="213B k = (0,1, \ldots, k_{\max}, (k_{\max}+1), -k_{\max}, \ldots, -1)$ for even~$N$. Deal with staggered grid by doubling the number of fields and halving the number of patches (\verb|configPatches1()| tests that there are an even number of patches). Then the patch-ratio is effectively halved. The patch edges are near the middle of the gaps and swapped. \todo{Have not yet tested whether works for Edgy Interpolation.} \todo{Have not yet implemented multiple edge values for a staggered grid as I am uncertain whether it makes any sense. } \begin{matlab} %} if patches.stag % transform by doubling the number of fields v = nan(size(u)); % currently to restore the shape of u u = [u(:,:,:,1:2:Nx) u(:,:,:,2:2:Nx)]; stagShift = 0.5*[ones(1,nVars) -ones(1,nVars)]; iV = [nVars+1:2*nVars 1:nVars]; % scatter interp to alternate field r = r/2; % ratio effectively halved Nx = Nx/2; % halve the number of patches nVars = nVars*2; % double the number of fields else % the values for standard spectral stagShift = 0; iV = 1:nVars; end%if patches.stag %{ \end{matlab} Now set wavenumbers (when \verb|Nx| is even then highest wavenumber is~$\pi$). \begin{matlab} %} kMax = floor((Nx-1)/2); ks = shiftdim( ... 2*pi/Nx*(mod((0:Nx-1)+kMax,Nx)-kMax) ... ,-2); %{ \end{matlab} Compute the Fourier transform across patches of the patch centre or next-to-edge values for all the fields. If there are an even number of points, then if complex, treat as positive wavenumber, but if real, treat as cosine. When using an ensemble of configurations, different configurations might be coupled to each other, as specified by \verb|patches.le| and \verb|patches.ri|. \begin{matlab} %} if ~patches.EdgyInt Cleft = fft(u(i0 ,:,:,:),[],4); Cright = Cleft; else Cleft = fft(u(2 ,:,:,:),[],4); Cright= fft(u(nx-1,:,:,:),[],4); end %{ \end{matlab} The inverse Fourier transform gives the edge values via a shift a fraction~$r$ to the next macroscale grid point. \begin{matlab} %} u(nx,iV,patches.ri,:) = uclean( ifft( ... Cleft.*exp(1i*ks.*(stagShift+r)) ,[],4)); u(1 ,iV,patches.le,:) = uclean( ifft( ... Cright.*exp(1i*ks.*(stagShift-r)) ,[],4)); %{ \end{matlab} Restore staggered grid when appropriate. This dimensional shifting appears to work. Is there a better way to do this? \begin{matlab} %} if patches.stag nVars = nVars/2; u=reshape(u,nx,nVars,2,nEnsem,Nx); Nx = 2*Nx; v(:,:,:,1:2:Nx) = u(:,:,1,:,:); v(:,:,:,2:2:Nx) = u(:,:,2,:,:); u = v; end%if patches.stag end%if patches.ordCC %{ \end{matlab} \subsection{Non-periodic macroscale interpolation} \begin{matlab} %} else% patches.periodic false assert(~patches.stag, ... 'not yet implemented staggered grids for non-periodic') %{ \end{matlab} Determine the order of interpolation~\verb|p|, and hence size of the (forward) divided difference table in~\verb|F|. \begin{matlab} %} if patches.ordCC<1, patches.ordCC = Nx-1; end p = min(patches.ordCC,Nx-1); F = nan(patches.EdgyInt+1,nVars,nEnsem,Nx,p+1); %{ \end{matlab} Set function values in first `column' of the table for every variable and across ensemble. For~\verb|EdgyInt|, the `reversal' of the next-to-edge values are because their values are to interpolate to the opposite edge of each patch. \begin{matlab} %} if patches.EdgyInt % interpolate next-to-edge values F(:,:,:,:,1) = u([nx-1 2],:,:,I); X(:,:,:,:) = x([nx-1 2],:,:,I); else % interpolate mid-patch values/sums F(:,:,:,:,1) = sum( u((i0-c):(i0+c),:,:,I) ,1); X(:,:,:,:) = x(i0,:,:,I); end; %{ \end{matlab} Compute table of (forward) divided differences \cite[e.g.,][]{DividedDifferences} for every variable and across ensemble. \begin{matlab} %} for q = 1:p i = 1:Nx-q; F(:,:,:,i,q+1) = (F(:,:,:,i+1,q)-F(:,:,:,i,q)) ... ./(X(:,:,:,i+q) -X(:,:,:,i)); end %{ \end{matlab} Now interpolate to the edge-values at locations~\verb|Xedge|. \begin{matlab} %} Xedge = x([1 nx],:,:,:); %{ \end{matlab} Code Horner's evaluation of the interpolation polynomials. Indices~\verb|i| are those of the left end of each interpolation stencil because the table is of forward differences.\footnote{For EdgyInt, perhaps interpret odd order interpolation in such a way that first-order interpolations reduces to appropriate linear interpolation so that as patches abut the scheme is `full-domain'. May mean left-edge and right-edge have different indices. Explore sometime??} First alternative: the case of order~\(p\) interpolation across the domain, asymmetric near the boundary. Use this first alternative for now. \begin{matlab} %} if true i = max(1,min(1:Nx,Nx-ceil(p/2))-floor(p/2)); Uedge = F(:,:,:,i,p+1); for q = p:-1:1 Uedge = F(:,:,:,i,q)+(Xedge-X(:,:,:,i+q-1)).*Uedge; end %{ \end{matlab} Second alternative: lower the degree of interpolation near the boundary to maintain the band-width of the interpolation. Such symmetry might be essential for multi-D. \footnote{The aim is to preserve symmetry?? Does it?? As of Jan 2023 it only partially does---fails near boundaries, and maybe fails with uneven spacing.} \begin{matlab} %} else%if false i = max(1,I-floor(p/2)); %{ \end{matlab} For the tapering order of interpolation, form the interior mask~\verb|Q| (logical) that signifies which interpolations are to be done at order~\verb|q|. This logical mask spreads by two as each order~\verb|q| decreases. \begin{matlab} %} Q = (I-1>=floor(p/2)) & (Nx-I>=p/2); Imid = floor(Nx/2); %{ \end{matlab} Initialise to highest divide difference, surrounded by zeros. \begin{matlab} %} Uedge = zeros(patches.EdgyInt+1,nVars,nEnsem,Nx); Uedge(:,:,:,Q) = F(:,:,:,i(Q),p+1); %{ \end{matlab} Complete Horner evaluation of the relevant polynomials. \begin{matlab} %} for q = p:-1:1 Q = [Q(2:Imid) true(1,2) Q(Imid+1:end-1)]; % spread mask Uedge(:,:,:,Q) = F(:,:,:,i(Q),q) ... +(Xedge(:,:,:,Q)-X(:,:,:,i(Q)+q-1)).*Uedge(:,:,:,Q); end%for q end%if %{ \end{matlab} Finally, insert edge values into the array of field values, using the required ensemble shifts. \begin{matlab} %} u(1 ,:,patches.le,I) = Uedge(1,:,:,I); u(nx,:,patches.ri,I) = Uedge(2,:,:,I); %{ \end{matlab} We want a user to set the extreme patch edge values according to the microscale boundary conditions that hold at the extremes of the domain. Consequently, unless testing, override their computed interpolation values with~\verb|NaN|. \begin{matlab} %} if isfield(patches,'intTest')&&patches.intTest else % usual case u( 1,:,:, 1) = nan; u(nx,:,:,Nx) = nan; end%if %{ \end{matlab} End of the non-periodic interpolation code. \begin{matlab} %} end%if patches.periodic %{ \end{matlab} \paragraph{Unfold multiple edges} No need to restore~\(x\). \begin{matlab} %} if patches.nEdge>1 nVars = nVars/nEdge; u = reshape( u ,nx,nEdge,nVars,nEnsem,Nx); nx = nx*nEdge; u = reshape( permute(u,[2 1 3:5]) ,nx,nVars,nEnsem,Nx); end%if patches.nEdge %{ \end{matlab} Fin, returning the 4D array of field values. \end{devMan} %}
github
uoa1184615/EquationFreeGit-master
BurgersExample.m
.m
EquationFreeGit-master/Patch/BurgersExample.m
5,063
utf_8
5e4cae9564c08774f1a2d207d37608b7
% Simulate a microscale space-time map of Burgers' PDE % discretised. Simulate on spatial patches, and via % projective integration. % AJR, Nov 2017 -- Jul 2020 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{BurgersExample}: simulate Burgers' PDE on patches} \label{sec:BurgersExample} \localtableofcontents \cref{fig:config1Burgers} shows a previous example simulation in time generated by the patch scheme applied to Burgers' \pde. The code in the example of this section similarly applies the patch scheme to a microscale space-time map (\cref{fig:BurgersMapU}), a map derived as a microscale space-time discretisation of Burgers'~\pde. Then this example applies projective integration to simulate further in time. \begin{figure} \centering \caption{\label{fig:BurgersMapU}a short time simulation of the Burgers' map (\cref{sec:burgersMap}) on patches in space. It requires many very small time-steps only just visible in this mesh.} \includegraphics[scale=0.9]{BurgersExampleMapU} \end{figure}% \subsection{Script code to simulate a microscale space-time map} \label{sec:bescsmsts} This first part of the script implements the following patch\slash gap-tooth scheme (left-right arrows denote function recursion). \begin{enumerate}\def\itemsep{-1.5ex} \item configPatches1 \item burgerBurst \into patchSys1 \into burgersMap \item process results \end{enumerate} Establish global data struct for the microscale Burgers' map (\cref{sec:burgersMap}) solved on \(2\pi\)-periodic domain, with eight patches, each patch of half-size ratio~\(0.2\), with seven points within each patch, and say fourth-order interpolation provides edge-values that couple the patches. \begin{matlab} %} global patches nPatch = 8 ratio = 0.2 nSubP = 7 interpOrd = 4 Len = 2*pi configPatches1(@burgersMap,[0 Len],nan,nPatch,interpOrd,ratio,nSubP); %{ \end{matlab} Set an initial condition, and simulate a burst of the microscale space-time map over a time~\(0.2\) using the function \verb|burgerBurst()| (\cref{sec:burgerBurst}). \begin{matlab} %} u0 = 0.4*(1+sin(patches.x))+0.1*randn(size(patches.x)); [ts,us] = burgersBurst(0,u0,0.4); %{ \end{matlab} Plot the simulation. Use only the microscale values interior to the patches by setting the edges to \verb|nan| in order to leave gaps. \begin{matlab} %} figure(1),clf xs = patches.x; xs([1 end],:) = nan; mesh(ts,xs(:),us') xlabel('time $t$'), ylabel('space $x$'), zlabel('$u(x,t)$') view(105,45) %{ \end{matlab} Save the plot to file to form \cref{fig:BurgersMapU}. \begin{matlab} %} ifOurCf2eps([mfilename 'MapU']) %{ \end{matlab} \subsection{Alternatively use projective integration} \begin{figure} \centering \caption{\label{fig:BurgersU}macroscale space-time field \(u(x,t)\) in a basic projective integration of the patch scheme applied to the microscale Burgers' map.} \includegraphics[scale=0.9]{BurgersExampleU} \end{figure}% Around the microscale burst \verb|burgerBurst()|, wrap the projective integration function \verb|PIRK2()| of \cref{sec:PIRK2}. \cref{fig:BurgersU} shows the resultant macroscale prediction of the patch centre values on macroscale time-steps. This second part of the script implements the following design. \begin{enumerate} \def\itemsep{-1.5ex} \item configPatches1 (done in \cref{sec:bescsmsts}) \item PIRK2 \into burgerBurst \into patchSys1 \into burgersMap \item process results \end{enumerate} Mark that edge-values of patches are not to be used in the projective extrapolation by setting initial values to \nan. \begin{matlab} %} u0([1 end],:) = nan; %{ \end{matlab} Set the desired macroscale time-steps, and microscale burst length over the time domain. Then projectively integrate in time using \verb|PIRK2()| which is second-order accurate in the macroscale time-step. \begin{matlab} %} ts = linspace(0,0.5,11); bT = 3*(ratio*Len/nPatch/(nSubP/2-1))^2 addpath('../ProjInt') [us,tss,uss] = PIRK2(@burgersBurst,ts,u0(:),bT); %{ \end{matlab} Plot and save the macroscale predictions of the mid-patch values to give the macroscale mesh-surface of \cref{fig:BurgersU} that shows a progressing wave solution. \begin{matlab} %} figure(2),clf midP = (nSubP+1)/2; mesh(ts,xs(midP,:),us(:,midP:nSubP:end)') xlabel('time $t$'), ylabel('space $x$'), zlabel('$u(x,t)$') view(120,50) ifOurCf2eps([mfilename 'U']) %{ \end{matlab} Then plot and save the microscale mesh of the microscale bursts shown in \cref{fig:BurgersMicro} (a stereo pair). The details of the fine microscale mesh are almost invisible. \begin{figure} \centering \caption{\label{fig:BurgersMicro}the microscale field \(u(x,t)\) during each of the microscale bursts used in the projective integration. View this stereo pair cross-eyed.} \includegraphics[scale=0.85]{BurgersExampleMicro} \end{figure} \begin{matlab} %} figure(3),clf for k = 1:2, subplot(2,2,k) mesh(tss,xs(:),uss') ylabel('space $x$'),xlabel('time $t$'),zlabel('$u(x,t)$') axis tight, view(126-4*k,50) end ifOurCf2eps([mfilename 'Micro']) %{ \end{matlab} \input{../Patch/burgersMap.m} \input{../Patch/burgersBurst.m} Fin. %}
github
uoa1184615/EquationFreeGit-master
abdulleDiffEquil2.m
.m
EquationFreeGit-master/Patch/abdulleDiffEquil2.m
6,062
utf_8
010012d53be7d85d7b5cd2a2da563cb2
% Solve for steady state of multiscale heterogeneous diffusion % in 2D on patches as an example application, varied from % example of section 5.1 of Abdulle et al., (2020b). AJR, % 31 Jan 2023 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{abdulleDiffEquil2}: equilibrium of a 2D multiscale heterogeneous diffusion via small patches} \label{sec:abdulleDiffEquil2} Here we find the steady state~\(u(x,y)\) to the heterogeneous \pde\ \cite[inspired by][\S5.1]{Abdulle2020b} \begin{equation*} u_t=\divv[a(x,y)\grad u]+10, \end{equation*} on square domain \([0,1]^2\) with zero-Dirichlet BCs, for coefficient `diffusion' matrix, varying with period~\(\epsilon\) of (their~(45)) \begin{equation*} a:=\frac{2+1.8\sin2\pi x/\epsilon}{2+1.8\cos2\pi y/\epsilon} +\frac{2+\sin2\pi y/\epsilon}{2+1.8\cos2\pi x/\epsilon}. \end{equation*} \cref{fig:abdulleDiffEquil2} shows solutions have some nice microscale wiggles reflecting the heterogeneity. \begin{figure} \centering\caption{\label{fig:abdulleDiffEquil2}% Equilibrium of the macroscale diffusion problem of Abdulle with boundary conditions of Dirichlet zero-value except for \(x=0\) which is Neumann (\cref{sec:abdulleDiffEquil2}). Here the patches have a Chebyshev-like spatial distribution. The patch size is chosen large enough to see within.} \includegraphics[scale=0.8]{Figs/abdulleDiffEquil2} \end{figure} Clear, and initiate globals. \begin{matlab} %} clear all global patches %global OurCf2eps, OurCf2eps=true %option to save plot %{ \end{matlab} First establish the microscale heterogeneity has micro-period~\verb|mPeriod| on the spatial micro-grid lattice. Then \verb|configPatches2| replicates the heterogeneity to fill each patch. (These diffusion coefficients should really recognise the half-grid-point shifts, but let's not bother.) \begin{matlab} %} mPeriod = 6 x = (0.5:mPeriod)'/mPeriod; y=x'; a = (2+1.8*sin(2*pi*x))./(2+1.8*sin(2*pi*y)) ... +(2+ sin(2*pi*y))./(2+1.8*sin(2*pi*x)); diffusivityRange = [min(a(:)) max(a(:))] %{ \end{matlab} Set the periodicity~\(\epsilon\), here big enough so we can see the patches, and other microscale parameters. \begin{matlab} %} epsilon = 0.04 dx = epsilon/mPeriod nPeriodsPatch = 1 % any integer nSubP = nPeriodsPatch*mPeriod+2 % when edgy int %{ \end{matlab} \paragraph{Patch configuration} Choose either Dirichlet (default) or Neumann on the left boundary in coordination with micro-code in \cref{sec:abdulleDiffForce2} \begin{matlab} %} Dom.bcOffset = zeros(2); if 1, Dom.bcOffset(1)=0.5; end% left Neumann %{ \end{matlab} Say use \(7\times7\) patches in \((0,1)^2\), fourth order interpolation, and either `equispace' or `chebyshev': \begin{matlab} %} nPatch = 7 Dom.type='chebyshev'; configPatches2(@abdulleDiffForce2,[0 1],Dom ... ,nPatch ,4 ,dx ,nSubP ,'EdgyInt',true ,'hetCoeffs',a ); %{ \end{matlab} \paragraph{Solve for steady state} Set initial guess of zero, with \verb|NaN| to indicate patch-edge values. Index~\verb|i| are the indices of patch-interior points, and the number of unknowns is then its length. \begin{matlab} %} u0 = zeros(nSubP,nSubP,1,1,nPatch,nPatch); u0([1 end],:,:) = nan; u0(:,[1 end],:) = nan; patches.i = find(~isnan(u0)); nVariables = numel(patches.i) %{ \end{matlab} Solve by iteration. Use \verb|fsolve| for simplicity and robustness (and using \verb|optimoptions| to omit trace information), via the generic patch system wrapper \verb|theRes| (\cref{sec:theRes}), and give magnitudes. \begin{matlab} %} tic; uSoln = fsolve(@theRes,u0(patches.i) ... ,optimoptions('fsolve','Display','off')); solnTime = toc normResidual = norm(theRes(uSoln)) normSoln = norm(uSoln) %{ \end{matlab} Store the solution vector into the patches, and interpolate, but have not bothered to set boundary values so they stay NaN from the interpolation. \begin{matlab} %} u0(patches.i) = uSoln; u0 = patchEdgeInt2(u0); %{ \end{matlab} \paragraph{Draw solution profile} Separate patches with NaNs, then reshape arrays to suit 2D space surface plots. \begin{matlab} %} figure(1), clf, colormap(0.8*hsv) patches.x(end+1,:,:)=nan; u0(end+1,:,:)=nan; patches.y(:,end+1,:)=nan; u0(:,end+1,:)=nan; u = reshape(permute(squeeze(u0),[1 3 2 4]) ... , [numel(patches.x) numel(patches.y)]); %{ \end{matlab} Draw the patch solution surface, with boundary-values omitted as already~\verb|NaN| by not bothering to set them. \begin{matlab} %} mesh(patches.x(:),patches.y(:),u'); view(60,55) xlabel('space $x$'), ylabel('space $y$'), zlabel('$u(x,y)$') ifOurCf2eps(mfilename) %optionally save plot %{ \end{matlab} \subsection{\texttt{abdulleDiffForce2()}: microscale discretisation inside patches of forced diffusion PDE} \label{sec:abdulleDiffForce2} This function codes the lattice heterogeneous diffusion of the \pde\ inside the patches. For 6D input arrays~\verb|u|, \verb|x|, and~\verb|y|, computes the time derivative at each point in the interior of a patch, output in~\verb|ut|. \begin{matlab} %} function ut = abdulleDiffForce2(t,u,patches) dx = diff(patches.x(2:3)); % x space step dy = diff(patches.y(2:3)); % y space step i = 2:size(u,1)-1; % x interior points in a patch j = 2:size(u,2)-1; % y interior points in a patch ut = nan+u; % preallocate output array %{ \end{matlab} Set Dirichlet boundary value of zero around the square domain, but also cater for zero Neumann condition on the left boundary. \begin{matlab} %} u( 1 ,:,:,:, 1 ,:)=0; % left edge of left patches u(end,:,:,:,end,:)=0; % right edge of right patches u(:, 1 ,:,:,:, 1 )=0; % bottom edge of bottom patches u(:,end,:,:,:,end)=0; % top edge of top patches if 1, u(1,:,:,:,1,:)=u(2,:,:,:,1,:); end% left Neumann %{ \end{matlab} Compute the time derivatives via stored forcing and coefficients. Easier to code by conflating the last four dimensions into the one~\verb|,:|. \begin{matlab} %} ut(i,j,:) = diff(patches.cs(:,j).*diff(u(:,j,:)))/dx^2 ... + diff(patches.cs(i,:).*diff(u(i,:,:),1,2),1,2)/dy^2 ... + 10; end%function abdulleDiffForce2 %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
theRes.m
.m
EquationFreeGit-master/Patch/theRes.m
1,064
utf_8
a07136df69b41921155bba68f9943c58
% This functions converts a vector of values into the % interior values of the patches, then evaluates the time % derivative of the system at $t=1$, and returns the vector % of patch-interior time derivatives. AJR, 1 Feb 2023 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{theRes()}: wrapper function to zero for equilibria} \label{sec:theRes} This functions converts a vector of values into the interior values of the patches, then evaluates the time derivative of the system at time \(t=1\), and returns the vector of patch-interior time derivatives. \begin{matlab} %} function f=theRes(u) global patches switch numel(size(patches.x)) case 4, pSys = @patchSys1; v=nan(size(patches.x)); case 5, pSys = @patchSys2; v=nan(size(patches.x+patches.y)); case 6, pSys = @patchSys3; v=nan(size(patches.x+patches.y+patches.z)); otherwise error('number of dimensions is somehow wrong') end%switch v(patches.i) = u; f = pSys(1,v(:),patches); f = f(patches.i); end%function theRes %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
patchSys3.m
.m
EquationFreeGit-master/Patch/patchSys3.m
4,266
utf_8
5fe96a5fc1710aa27ba6225006093653
% patchSys3() provides an interface to time integrators % for the dynamics on patches in 3D coupled across space. % The system must be a lattice system such as PDE % discretisations. AJR, Aug 2020 -- 12 Apr 2023 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{patchSys3()}: interface 3D space to time integrators} \label{sec:patchSys3} To simulate in time with 3D spatial patches we often need to interface a users time derivative function with time integration routines such as \verb|ode23| or~\verb|PIRK2|. This function provides an interface. Communicate patch-design variables (\cref{sec:configPatches3}) either via the global struct~\verb|patches| or via an optional third argument. \verb|patches| is required for the parallel computing of \verb|spmd|, or if parameters are to be passed though to the user microscale function. \begin{matlab} %} function dudt = patchSys3(t,u,patches,varargin) if nargin<3, global patches, end %{ \end{matlab} \paragraph{Input} \begin{itemize} \item \verb|u| is a vector\slash array of length $\verb|prod(nSubP)| \cdot \verb|nVars| \cdot \verb|nEnsem| \cdot \verb|prod(nPatch)|$ where there are $\verb|nVars| \cdot \verb|nEnsem|$ field values at each of the points in the $\verb|nSubP(1)| \times \verb|nSubP(2)| \times \verb|nSubP(3)| \times \verb|nPatch(1)| \times \verb|nPatch(2)| \times \verb|nPatch(3)|$ spatial grid. \item \verb|t| is the current time to be passed to the user's time derivative function. \item \verb|patches| a struct set by \verb|configPatches3()| with the following information used here. \begin{itemize} \item \verb|.fun| is the name of the user's function \verb|fun(t,u,patches,...)| that computes the time derivatives on the patchy lattice. The array~\verb|u| has size $\verb|nSubP(1)| \times \verb|nSubP(2)| \times \verb|nSubP(3)| \times \verb|nVars| \times \verb|nEsem| \times \verb|nPatch(1)| \times \verb|nPatch(2)| \times \verb|nPatch(3)|$. Time derivatives must be computed into the same sized array, although herein the patch edge-values are overwritten by zeros. \item \verb|.x| is $\verb|nSubP(1)| \times1 \times1 \times1 \times1 \verb|nPatch(1)| \times1 \times1$ array of the spatial locations~$x_{i}$ of the microscale $(i,j,k)$-grid points in every patch. Currently it \emph{must} be an equi-spaced lattice on both macro- and microscales. \item \verb|.y| is similarly $1 \times \verb|nSubP(2)| \times1 \times1 \times1 \times1 \times \verb|nPatch(2)| \times1$ array of the spatial locations~$y_{j}$ of the microscale $(i,j,k)$-grid points in every patch. Currently it \emph{must} be an equi-spaced lattice on both macro- and microscales. \item \verb|.z| is similarly $1 \times1 \times \verb|nSubP(3)| \times1 \times1 \times1 \times1 \times \verb|nPatch(3)|$ array of the spatial locations~$z_{k}$ of the microscale $(i,j,k)$-grid points in every patch. Currently it \emph{must} be an equi-spaced lattice on both macro- and microscales. \end{itemize} \item \verb|varargin|, optional, is arbitrary list of parameters to be passed onto the users time-derivative function as specified in configPatches3. \end{itemize} \paragraph{Output} \begin{itemize} \item \verb|dudt| is a vector\slash array of of time derivatives, but with patch edge-values set to zero. It is of total length $\verb|prod(nSubP)| \cdot \verb|nVars| \cdot \verb|nEnsem| \cdot \verb|prod(nPatch)|$ and the same dimensions as~\verb|u|. \end{itemize} \begin{devMan} Sets the edge-face values from macroscale interpolation of centre-patch values, and if necessary, reshapes the fields~\verb|u| as a 8D-array. \cref{sec:patchEdgeInt3} describes \verb|patchEdgeInt3()|. \begin{matlab} %} sizeu = size(u); u = patchEdgeInt3(u,patches); %{ \end{matlab} Ask the user function for the time derivatives computed in the array, overwrite its edge\slash face values with the dummy value of zero (as \verb|ode15s| chokes on NaNs), then return to the user\slash integrator as same sized array as input. \begin{matlab} %} dudt = patches.fun(t,u,patches,varargin{:}); m = patches.nEdge(1); dudt([1:m end-m+1:end],:,:,:) = 0; m = patches.nEdge(2); dudt(:,[1:m end-m+1:end],:,:) = 0; m = patches.nEdge(3); dudt(:,:,[1:m end-m+1:end],:) = 0; dudt = reshape(dudt,sizeu); %{ \end{matlab} Fin. \end{devMan} %}
github
uoa1184615/EquationFreeGit-master
wave2D.m
.m
EquationFreeGit-master/Patch/wave2D.m
5,167
utf_8
3f6743ba731984dba4dc6a49149c40df
% Simulate the linear wave PDE in 2D on patches. % First it checks the spectrum of the system. % AJR, Nov 2018 -- 17 Apr 2020 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{wave2D}: example of a wave on patches in 2D} \label{sec:wave2D} \localtableofcontents For \(u(x,y,t)\), test and simulate the simple wave PDE in 2D space: \begin{equation*} \DD tu=\delsq u\,. \end{equation*} This script shows one way to get started: a user's script may have the following three steps (left-right arrows denote function recursion). \begin{enumerate}\def\itemsep{-1.5ex} \item configPatches2 \item ode15s integrator \into patchSys2 \into wavePDE \item process results \end{enumerate} \begin{devMan} Establish the global data struct \verb|patches| to interface with a function coding the wave \pde: to be solved on \(2\pi\)-periodic domain, with \(9\times9\) patches, spectral interpolation~(\(0\)) couples the patches, each patch of half-size ratio~\(0.25\) (big enough for visualisation), and with a \(5\times5\) micro-grid within each patch. \begin{matlab} %} global patches nSubP = 5; nPatch = 9; configPatches2(@wavePDE,[-pi pi], nan, nPatch, 0, 0.25, nSubP); %{ \end{matlab} \subsection{Check on the linear stability of the wave PDE} Construct the systems Jacobian via numerical differentiation. Set a zero equilibrium as basis. Then find the indices of patch-interior points as the only ones to vary in order to construct the Jacobian. \begin{matlab} %} disp('Check linear stability of the wave scheme') uv0 = zeros(nSubP,nSubP,2,1,nPatch,nPatch); uv0([1 end],:,:,:,:,:) = nan; uv0(:,[1 end],:,:,:,:) = nan; i = find(~isnan(uv0)); %{ \end{matlab} Now construct the Jacobian. Since this is a \emph{linear} wave \pde, use large perturbations. \begin{matlab} %} small = 1; jac = nan(length(i)); sizeJacobian = size(jac) for j = 1:length(i) uv = uv0(:); uv(i(j)) = uv(i(j))+small; tmp = patchSys2(0,uv)/small; jac(:,j) = tmp(i); end %{ \end{matlab} Now explore the eigenvalues a little: find the ten with the biggest real-part; if these are small enough, then the method may be good. \begin{matlab} %} evals = eig(jac); nEvals = length(evals) [~,k] = sort(-abs(real(evals))); evalsWithBiggestRealPart = evals(k(1:10)) if abs(real(evals(k(1))))>1e-4 warning('eigenvalue failure: real-part > 1e-4') return, end %{ \end{matlab} Check that the eigenvalues are close to true waves of the \pde\ (not yet the micro-discretised equations). \begin{matlab} %} kwave = 0:(nPatch-1)/2; freq = sort(reshape(sqrt(kwave'.^2+kwave.^2),1,[])); freq = freq(diff([-1 freq])>1e-9); freqerr = [freq; min(abs(imag(evals)-freq))] %{ \end{matlab} \subsection{Execute a simulation} Set a Gaussian initial condition using auto-replication of the spatial grid: here \verb|u0| and~\verb|v0| are in the form required for computation: \(n_x\times n_y\times 1\times 1\times N_x\times N_y\). \begin{matlab} %} u0 = exp(-patches.x.^2-patches.y.^2); v0 = zeros(size(u0)); %{ \end{matlab} Initiate a plot of the simulation using only the microscale values interior to the patches: set \(x\)~and \(y\)-edges to \verb|nan| to leave the gaps. Start by showing the initial conditions of \cref{fig:configPatches2ic} while the simulation computes. To mesh/surf plot we need to ?? `transpose' to size \(n_x\times N_x\times n_y\times N_y\), then reshape to size \(n_x\cdot N_x\times n_y\cdot N_y\). \begin{matlab} %} x = squeeze(patches.x); y = squeeze(patches.y); x([1 end],:) = nan; y([1 end],:) = nan; u = reshape(permute(squeeze(u0),[1 3 2 4]), [numel(x) numel(y)]); usurf = surf(x(:),y(:),u'); axis([-3 3 -3 3 -0.5 1]), view(60,40) xlabel('space $x$'), ylabel('space $y$'), zlabel('$u(x,y)$') legend('time = 0','Location','north') colormap(hsv) drawnow ifOurCf2eps([mfilename 'ic']) %{ \end{matlab} \begin{figure} \centering \caption{\label{fig:wave2Dic}initial field~\(u(x,y,t)\) at time \(t=0\) of the patch scheme applied to the simple wave~\pde: \cref{fig:wave2Dt6} plots the computed field at time \(t=2\).} \includegraphics[scale=0.9]{wave2Dic} \end{figure} Integrate in time using standard functions. \begin{matlab} %} disp('Wait while we simulate u_t=v, v_t=u_xx+u_yy') uv0 = cat(3,u0,v0); if ~exist('OCTAVE_VERSION','builtin') [ts,uvs] = ode23( @patchSys2,[0 6],uv0(:)); else % octave version is slower [ts,uvs] = odeOcts(@patchSys2,linspace(0,6),uv0(:)); end %{ \end{matlab} Animate the computed simulation to end with \cref{fig:wave2Dt6}. Because of the very small time-steps, subsample to plot at most 100 times. \begin{matlab} %} di = ceil(length(ts)/100); for i = [1:di:length(ts)-1 length(ts)] uv = patchEdgeInt2(uvs(i,:)); uv = reshape(permute(uv,[1 5 2 6 3 4]), [numel(x) numel(y) 2]); set(usurf,'ZData', uv(:,:,1)'); legend(['time = ' num2str(ts(i),2)]) pause(0.1) end ifOurCf2eps([mfilename 't' num2str(ts(end))]) %{ \end{matlab} \begin{figure} \centering \caption{\label{fig:wave2Dt6}field~\(u(x,y,t)\) at time \(t=6\) of the patch scheme applied to the simple wave~\pde\ with initial condition in \cref{fig:wave2Dic}.} \includegraphics[scale=0.9]{wave2Dt6} \end{figure} \input{../Patch/wavePDE.m} \input{../Patch/odeOcts.m} \end{devMan} %}
github
uoa1184615/EquationFreeGit-master
chanDispMicro.m
.m
EquationFreeGit-master/Patch/chanDispMicro.m
1,965
utf_8
c4fb6f8312af4299282260971007cb4a
% chanDispMicro() computes the time derivatives of % heterogeneous advection-diffusion in 2D along a long thin % channel on 1D array patches. AJR, Nov 2020 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \subsection{\texttt{chanDispMicro()}: heterogeneous 2D advection-diffusion in a long thin channel} \label{sec:chanDispMicro} This function codes the lattice heterogeneous diffusion inside the patches. For 4D input arrays of concentration~\verb|c| and spatial lattice~\verb|x| (via edge-value interpolation of \verb|patchSys1|, \cref{sec:patchSys1}), computes the time derivative~\eqref{eq:ddeChanDisp} at each point in the interior of a patch, output in~\verb|ct|. The heterogeneous advections and diffusivities,~$u_i(y_j)$ and~$\kappa_i(y_{j+1/2})$, have previously been merged and stored in the one array~\verb|patches.cs| (2D). \begin{matlab} %} function ct = chanDispMicro(t,c,p) [nx,ny,~,~]=size(c); % micro-grid points in patches ix = 2:nx-1; % x interior points in a patch dx = diff(p.x(2:3)); % x space step dy = 2/ny; % y space step ct = nan+c; % preallocate output array pcs = reshape(p.cs,nx-1,[],2); %{ \end{matlab} Compute the cross-channel flux using `ghost' nodes at channel boundaries, so that the flux is zero at $y=\pm1$ either because the boundary values are replicated so the differences are zero, or because the diffusivities in \verb|cs| are zero at the channel boundaries. \begin{matlab} %} ydif = pcs(ix,1:2:end,2) ... .*(c(ix,[1:end end],:,:)-c(ix,[1 1:end],:,:))/dy; %{ \end{matlab} Now evaluate advection-diffusion time derivative~\eqref{eq:ddeChanDisp}. Could use upwind advection and no longitudinal diffusion, or, as here, centred advection and diffusion. \begin{matlab} %} ct(ix,:,:,:) = (ydif(:,2:end,:,:)-ydif(:,1:end-1,:,:))/dy ... + diff(pcs(:,2:2:end,2).*diff(c))/dx^2 ... - p.Pe*pcs(ix,2:2:end,1).*(c(ix+1,:,:,:)-c(ix-1,:,:,:))/(2*dx); end% function %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
rotFilmSpmd.m
.m
EquationFreeGit-master/Patch/rotFilmSpmd.m
12,806
utf_8
5135d38aef148bbc8496b6f86a1675d5
% rotFilmSpmd simulates 2D fluid film flow on a rotating % substrate with 2D patches as a Proof of Principle example % of parallel computing with spmd. AJR, Dec 2020 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{rotFilmSpmd}: simulation of a 2D shallow water flow on a rotating heterogeneous substrate} \label{sec:rotFilmSpmd} \localtableofcontents As an example application, consider the flow of a shallow layer of fluid on a solid flat rotating substrate, such as in spin coating \citep[\S II.K, e.g.]{Wilson00, Oron97} or large-scale shallow water waves \cite[e.g.]{Dellar2005, Hereman2009}. Let $\xv=(x,y)$ parametrise location on the rotating substrate, and let the fluid layer have thickness~$h(\xv , t)$ and move with depth-averaged horizontal velocity $\vv (\xv , t)=(u,v)$. We take as given (with its simplified physics) that the (non-dimensional) governing set of \pde{}s is the nonlinear system \cite[eq.~(1), e.g.]{Bunder2018a} \begin{subequations}\label{eqs:spinddt}% \begin{align} \D th&=-{\nabla}\cdot (h\vv ), \label{eq:spindhdt}\\ \D t\vv&=\begin{bmatrix} -b & f\\-f &-b\end{bmatrix}\vv -(\vv \cdot\nabla)\vv -g{\nabla}h+\divv(\nu\grad\vec{v})\,, \label{eq:spindvdt} \end{align} \end{subequations} where $b(\xv)$~represents heterogeneous `bed' drag, $f$~is the Coriolis coefficient, $g$~is the acceleration due to gravity, $\nu(\xv)$~is a heterogeneous `kinematic viscosity', and we neglect surface tension. The aim is to simulate the macroscale dynamics which (for constant~$b$) is approximately that of the nonlinear diffusion $\D th\approx \frac{gb}{b^2+f^2}\divv(h\grad h)$ \cite[eq.~(2)]{Bunder2018a}. But there is no known algebraic closure for the macroscale in the case of heterogeneous~$b(\xv)$ and~$\nu(\xv)$, nonetheless the patch scheme automatically predicts a sensible macroscale for such heterogeneous dynamics (\cref{fig:rotFilmSpmdtFin}). For the microscale computation, \cref{sec:rotFilmMicro} discretises the \pde{}s~\eqref{eqs:spinddt} in space with $x,y$-spacing~$\delta x,\delta y$. Choose one of four cases: \begin{itemize} \item \verb|theCase=1| is corresponding code without parallelisation (in this toy problem it is much the quickest because there is no expensive communication); \item \verb|theCase=2| illustrates that \verb|RK2mesoPatch| invokes \verb|spmd| computation if parallel has been configured. \item \verb|theCase=3| shows how users explicitly invoke \verb|spmd|-blocks around the time integration. \item \verb|theCase=4| invokes projective integration for long-time simulation via short bursts of the micro-computation, bursts done within \verb|spmd|-blocks for parallel computing. \end{itemize} First, clear all to remove any existing globals, old composites, etc---although a parallel pool persists. Then choose the case. \begin{matlab} %} clear all theCase = 1 %{ \end{matlab} Set micro-scale bed drag (array~1) and diffusivity (arrays~2--3) to be a heterogeneous log-normal factor with specified period: modify the strength of the heterogeneity by the coefficient of~\verb|randn| from zero to perhaps one: coefficient~$0.3$ appears a good moderate value. \begin{matlab} %} mPeriod = 5 bnu = shiftdim([1 0.5 0.5],-1) ... .*exp(0.3*randn([mPeriod mPeriod 3])); %{ \end{matlab} Configure the patch scheme with these choices of domain, patches, size ratios---here each patch is square in space. In Cases~1--2, set \verb|patches| information to be global so the info can be used without being explicitly passed as arguments. \begin{matlab} %} if theCase<=2, global patches, end %{ \end{matlab} In Case~4, double the size of the domain and use more separated patches accordingly, to maintain the spatial microscale grid spacing to be~$0.055$. Here use fourth order edge-based coupling between patches. Choose the parallel option if not Case~1, which invokes \verb|spmd|-block internally, so that field variables become \emph{distributed} across cpus. \begin{matlab} %} nSubP = 2+mPeriod nPatch = 9 ratio = 0.2+0.2*(theCase<4) Len = 2*pi*(1+(theCase==4)) disp('**** Setting configPatches2') patches = configPatches2(@rotFilmMicro, [0 Len], nan ... , nPatch, 4, ratio, nSubP, 'EdgyInt',true ... ,'hetCoeffs',bnu ,'parallel',(theCase>1) ); %{ \end{matlab} When using parallel, any additional parameters to \verb|patches|, such as physical parameters for the microcode, must be set within a \verb|spmd| block (because \verb|patches| is a co-distributed structure). Here set frequency of substrate rotation, and strength of gravity. \begin{matlab} %} f = 5, g = 1 if theCase==1, patches.f = f; patches.g = g; else spmd, patches.f = f; patches.g = g; end end %{ \end{matlab} \subsection{Simulate heterogeneous advection-diffusion} Set initial conditions of a simulation as shown in \cref{fig:rotFilmSpmdt0}. Here the initial condition is a (periodic) quasi-Gaussian in~$h$ and zero velocity~\vv, with additive random perturbations. \begin{matlab} %} disp('**** Set initial condition and test dhuv0dt =') if theCase==1 %{ \end{matlab} When not parallel processing, invoke the usual operations. Here add a random noise to the velocity field, but keep~$h(x,y,0)$ smooth as shown by \cref{fig:rotFilmSpmdt0}. The \verb|shiftdim(...,-1)| moves the given row-vector of coefficients into the third dimension to become coefficients of the fields~$(h,u,v)$, respectively. \begin{matlab} %} huv0 = shiftdim([0.5 0 0],-1) ... .*exp(-cos(patches.x)/2-cos(patches.y)); huv0 = huv0+0.1*shiftdim([0 1 1],-1).*rand(size(huv0)); dhuv0dt = patchSys2(0,huv0); %{ \end{matlab} With parallel, we must use an \verb|spmd|-block for computations: there is no difference in Cases~2--4 here. Also, we must sometimes explicitly tell functions how to distribute some initial condition arrays over the cpus. Now \verb|patchSys2| does not invoke \verb|spmd| so higher level code must, as here. Even if \verb|patches| is global, inside an \verb|spmd|-block we \emph{must} pass \verb|patches| explicitly as a parameter to \verb|patchSys2|. \begin{matlab} %} else, spmd huv0 = shiftdim([0.5 0 0],-1) ... .*exp(-cos(patches.x)/2-cos(patches.y)); huv0 = huv0+0.1*rand(size(huv0),patches.codist); dhuv0dt = patchSys2(0,huv0,patches) end%spmd end%if theCase %{ \end{matlab} \begin{figure} \centering \caption{\label{fig:rotFilmSpmdt0}initial field~$h(x,y,0)$ of the patch scheme applied to the heterogeneous, shallow water, rotating substrate, \pde~\eqref{eqs:spinddt}. The micro-scale sub-patch colour displays the initial $y$-direction velocity field~$v(x,y,0)$. \cref{fig:rotFilmSpmdtFin} plots the roughly smooth field values at time $t=6$. In this example the patches are relatively large, ratio~$0.4$, for visibility.} \includegraphics[scale=0.8]{rotFilmSpmdt0} \end{figure} Integrate in time, either via the automatic \verb|ode23| or via \verb|RK2mesoPatch| which reduces communication between patches. By default, \verb|RK2mesoPatch| does ten micro-steps for each specified meso-step in~\verb|ts|. For stability: with noise up to~$0.3$, need micro-steps less than~$0.0003$; with noise~$1$, need micro-steps less than~$0.0001$. \begin{matlab} %} warning('Integrating system in time, wait a minute') ts=0:0.003:0.3; %{ \end{matlab} Go to the selected case. \begin{matlab} %} switch theCase %{ \end{matlab} \begin{enumerate} \item For non-parallel, we could use \verb|RK2mesoPatch| as indicated below, but instead choose to use standard \verb|ode23| as here \verb|patchSys2| accesses patch information via global \verb|patches|. For post-processing, reshape each and every row of the computed solution to the correct array size---namely that of the initial condition. \begin{matlab} %} case 1 % tic,[huvs,uerrs] = RK2mesoPatch(ts,huv0);toc [ts,huvs] = ode23(@patchSys2,[0 4],huv0(:)); huvs=reshape(huvs,[length(ts) size(huv0)]); %{ \end{matlab} \item In the second case, \verb|RK2mesoPatch| detects a parallel patch code has been requested, but has only one cpu worker, so it auto-initiates an \verb|spmd|-block for the integration. Both this and the next case return \emph{composite} results, so just keep one version of the results. \begin{matlab} %} case 2 huvs = RK2mesoPatch(ts,huv0); huvs = huvs{1}; %{ \end{matlab} \item In this third case, a user could merge this explicit \verb|spmd|-block with the previous one that sets the initial conditions. \begin{matlab} %} case 3,spmd huvs = RK2mesoPatch(ts,huv0,[],patches); end%spmd huvs = huvs{1}; %{ \end{matlab} \item In this fourth case, use Projective Integration (PI). Currently the PI is done serially, with parallel \verb|spmd|-blocks only invoked inside function \verb|aBurst()| (\cref{secRF2BfPI}) to compute each burst of the micro-scale simulation. The macro-scale time-step needs to be less than about~$0.1$ (which here is not much projection). The function \verb|microBurst()| interfaces to \verb|aBurst()| (\cref{secRF2BfPI}) in order to provide shaped initial states, and to provide the patch information. \begin{matlab} %} case 4 microBurst = @(tb0,xb0,bT) ... aBurst(tb0 ,reshape(xb0,size(huv0)) ,patches); ts = 0:0.1:1 huvs = PIRK2(microBurst,ts,gather(huv0(:))); huvs = reshape(huvs,[length(ts) size(huv0)]); %{ \end{matlab} \end{enumerate} End the four cases. \begin{matlab} %} end%switch theCase %{ \end{matlab} \subsection{Plot the solution} Optionally set to save some plots to file. \begin{matlab} %} if 0, global OurCf2eps, OurCf2eps=true, end %{ \end{matlab} \paragraph{Animate the computed solution field over time} \begin{matlab} %} figure(1), clf, colormap(0.8*jet) %{ \end{matlab} First get the $x$-coordinates and omit the patch-edge values from the plot (because they are not here interpolated). \begin{matlab} %} if theCase==1, x = patches.x; y = patches.y; else, spmd x = gather( patches.x ); y = gather( patches.y ); end%spmd x = x{1}; y = y{1}; end x([1 end],:,:,:,:,:) = nan; y(:,[1 end],:,:,:,:) = nan; %{ \end{matlab} Draw the field values as a patchy surface evolving over 100--200 time steps. \begin{matlab} %} nTimes = length(ts) for l = 1:ceil(nTimes/200):nTimes %{ \end{matlab} At each time, squeeze sub-patch data fields into three 4D arrays, permute to get all the $x/y$-variations in the first/last two dimensions, and and then reshape to~2D. \begin{matlab} %} h = reshape( permute( squeeze( ... huvs(l,:,:,1,1,:,:) ) ,[1 3 2 4]) ,numel(x),numel(y)); u = reshape( permute( squeeze( ... huvs(l,:,:,2,1,:,:) ) ,[1 3 2 4]) ,numel(x),numel(y)); v = reshape( permute( squeeze( ... huvs(l,:,:,3,1,:,:) ) ,[1 3 2 4]) ,numel(x),numel(y)); %{ \end{matlab} Draw surface of each patch, to show both micro-scale and macro-scale variation in space. Colour the surface according to the velocity~$v$ in the $y$-direction. \begin{matlab} %} if l==1 hp = surf(x(:),y(:),h',v'); axis([0 Len 0 Len 0 max(h(:))]) c = colorbar; c.Label.String = 'v(x,y,t)'; legend(['time = ' num2str(ts(l),'%4.2f')] ... ,'Location','north') axis equal xlabel('space $x$'), ylabel('space $y$'), zlabel('$h(x,y,t)$') ifOurCf2eps([mfilename 't0']) disp('**** pausing, press blank to begin animation') pause else hp.ZData = h'; hp.CData = v'; legend(['time = ' num2str(ts(l),'%4.2f')]) pause(0.1) end %{ \end{matlab} \begin{figure} \centering \caption{\label{fig:rotFilmSpmdtFin}final field~$h(x,y,6)$, coloured by~$v(x,y,6)$, of the patch scheme applied to the heterogeneous, shallow water, rotating substrate, \pde~\eqref{eqs:spinddt} with heterogeneous factors log-normal, here distributed $\exp[\mathcal N(0,1)]$. } \includegraphics[scale=0.8]{rotFilmSpmdtFin} \end{figure} Finish the animation loop, and optionally save the final plot to file, \cref{fig:rotFilmSpmdtFin}. \begin{matlab} %} end%for over time ifOurCf2eps([mfilename 'tFin']) %{ \end{matlab} \subsection{\texttt{microBurst} function for Projective Integration} \label{secRF2BfPI} Projective Integration stability appears to require bursts longer than~$0.01$. Each burst is done in parallel processing. Here use \verb|RK2mesoPatch| to take take meso-steps, each with default ten micro-steps so the micro-scale step is~$0.0003$. With macro-step~$0.1$, these parameters usually give stable projective integration. \begin{matlab} %} function [tbs,xbs] = aBurst(tb0,xb0,patches) normx=max(abs(xb0(:))); disp(['* aBurst t=' num2str(tb0) ' |x|=' num2str(normx)]) assert(normx<20,'solution exploding') tbs = tb0+(0:0.003:0.015); spmd xb0 = codistributed(xb0,patches.codist); xbs = RK2mesoPatch(tbs,xb0,[],patches); end%spmd xbs=reshape(xbs{1},length(tbs),[]); end%function %{ \end{matlab} Fin. \input{../Patch/rotFilmMicro.m} %}
github
uoa1184615/EquationFreeGit-master
patchCwts.m
.m
EquationFreeGit-master/Patch/patchCwts.m
2,679
utf_8
a72c06276a2b4c05eca69bc9515e179e
% Compute the weightings for the polynomial % interpolation of field values for coupling. % AJR, 7 Aug 2020 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{patchCwts}: weights of polynomial interpolation} \label{sec:patchCwts} \subsection{Introduction} Computes the weightings for the polynomial interpolation of field values for inter-patch coupling. Should work for any number of dimensions as determined by the number of elements in parameter \verb|ratio|. Used by \verb|configPatches|\(n\) for \(n=1,2,\ldots\)\,. \begin{matlab} %} function [Cwtsr,Cwtsl] = patchCwts(ratio,ordCC,stag) %{ \end{matlab} \paragraph{Input} \begin{itemize} \item \verb|ratio| row vector, one element for each axis of the spatial domain, of either the half-width or full-width of a patch to the spacing of the patch mid-points along that axis direction. \item \verb|ordCC| is the order of the polynomial interpolation for inter-patch coupling across empty space of the macroscale patch values to the edge-values of the patches: must be~\(2,4,\ldots\)\,. \item \verb|stag| is true for interpolation using only odd neighbouring patches as for staggered grids, and false for the usual case of all neighbour coupling---as yet only tested in 1D. \end{itemize} \paragraph{Output} For the \emph{global} struct \verb|patches|, constructs the following components. \begin{itemize} \item \verb|Cwtsr| and \verb|Cwtsl|, when \(n\)~is the number of elements of \verb|ratio|, are the \(\verb|ordCC|\times n\)-array of weights for the inter-patch interpolation onto the `right' edges and `left' edges (respectively) with patch:macroscale ratio as specified. \end{itemize} \begin{devMan} First check, reserve storage, and define some index vectors. \begin{matlab} %} assert(ordCC>0,'order of poly interp must be positive') Cwtsr=nan(ordCC,numel(ratio)); ks = (1:2:ordCC)'; ps = (1:ordCC/2)'-1; %{ \end{matlab} If staggered grid, then we need something like equation~(7) in \cite{Cao2014a}. But so far only tested for 1D?? \begin{matlab} %} if stag Cwtsr(ks ,:) = [ones(size(ratio)) ... cumprod( (ratio.^2-ks(1:end-1).^2)/4 ,1) ... ./factorial(2*ps(1:end-1)) ]; Cwtsr(ks+1,:) = [ratio/2 ... cumprod( (ratio.^2-ks(1:end-1).^2)/4 ,1) ... ./factorial(2*ps(1:end-1)+1).*ratio/2 ]; %{ \end{matlab} For non-staggered edge-to-edge or centre-to-edge interpolation, use these weights. \begin{matlab} %} else Cwtsr(ks ,:) = cumprod(ratio.^2-ps.^2,1) ... ./factorial(2*ps+1)./ratio; Cwtsr(ks+1,:) = cumprod(ratio.^2-ps.^2,1) ... ./factorial(2*ps+2); end Cwtsl = (-1).^((1:ordCC)'-stag).*Cwtsr; %{ \end{matlab} Fin. \end{devMan} %}
github
uoa1184615/EquationFreeGit-master
heteroDispersiveWave3.m
.m
EquationFreeGit-master/Patch/heteroDispersiveWave3.m
6,865
utf_8
1b4e4ff337d348654d1ae8b67f69492b
% Simulate in 3D on patches the heterogeneous dispersive % waves in a fourth-order wave PDE. AJR, 16 Apr 2023 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{heteroDispersiveWave3}: heterogeneous Dispersive Waves from 4th order PDE} \label{sec:heteroDispersiveWave3} This uses small spatial patches to simulate heterogeneous dispersive waves in 3D. The wave equation for~\(u(x,y,z,t)\) is the fourth-order in space \pde \begin{equation*} u_{tt}=-\delsq(C\delsq u) \end{equation*} for microscale variations in scalar~\(C(x,y,z)\). Initialise some Matlab aspects. \begin{matlab} %} clear all cMap=jet(64); cMap=0.8*cMap(7:end-7,:); % set colormap basename = [num2str(floor(1e5*rem(now,1))) mfilename] %global OurCf2eps, OurCf2eps=true %optional to save plots %{ \end{matlab} Set random heterogeneous coefficients of period two in each of the three directions. Crudely normalise by the harmonic mean so the macro-wave time scale is roughly one. \begin{matlab} %} mPeriod = [2 2 2]; cHetr = exp(0.9*randn(mPeriod)); cHetr = cHetr*mean(1./cHetr(:)) %{ \end{matlab} Establish global patch data struct to interface with a function coding a fourth-order heterogeneous wave \pde: to be solved on $[-\pi,\pi]^3$-periodic domain, with $5^3$~patches, spectral interpolation~($0$) couples the patches, each patch with micro-grid spacing~$0.22$ (relatively large for visualisation), and with $6^3$~points forming each patch. (Six because two edge layers on each of two faces, and two interior points for the \pde.) \begin{matlab} %} global patches patches = configPatches3(@heteroDispWave3,[-pi pi] ... ,'periodic', 5, 0, 0.22, mPeriod+4 ,'EdgyInt',true ... ,'hetCoeffs',cHetr ,'nEdge',2); %{ \end{matlab} Set a wave initial state using auto-replication of the spatial grid, and as \cref{fig:heteroDispersiveWave3ic} shows. This wave propagates diagonally across space. Concatenate the two \(u,v\)-fields to be the two components of the fourth dimension. \begin{matlab} %} u0 = 0.5+0.5*sin(patches.x+patches.y+patches.z); v0 = -0.5*cos(patches.x+patches.y+patches.z)*3; uv0 = cat(4,u0,v0); %{ \end{matlab} \begin{figure}\centering \caption{\label{fig:heteroDispersiveWave3ic} initial field~$u(x,y,z,t)$ at time $t=0$ of the patch scheme applied to a heterogeneous dispersive wave~\pde: \cref{fig:heteroDispersiveWave3fin} plots the computed field at time $t=6$.} \includegraphics[scale=0.9]{24168heteroDispersiveWave3ic} \end{figure} Integrate in time to $t=6$ using standard functions. In Matlab \verb|ode15s| would be natural as the patch scheme is naturally stiff, but \verb|ode23| is much quicker \cite[Fig.~4]{Maclean2020a}. \begin{matlab} %} disp('Simulate heterogeneous wave u_tt=delsq[C*delsq(u)]') tic [ts,us] = ode23(@patchSys3,linspace(0,6),uv0(:)); simulateTime=toc %{ \end{matlab} Animate the computed simulation to end with \cref{fig:heteroDispersiveWave3fin}. Use \verb|patchEdgeInt3| to obtain patch-face values in order to most easily reconstruct the array data structure. Replicate $x$, $y$, and~$z$ arrays to get individual spatial coordinates of every data point. Then, optionally, set faces to~\verb|nan| so the plot just shows patch-interior data. \begin{matlab} %} %% figure(1), clf, colormap(cMap) xs = patches.x+0*patches.y+0*patches.z; ys = patches.y+0*patches.x+0*patches.z; zs = patches.z+0*patches.y+0*patches.x; if 1, xs([1:2 end-1:end],:,:,:)=nan; xs(:,[1:2 end-1:end],:,:)=nan; xs(:,:,[1:2 end-1:end],:)=nan; end;%option j=find(~isnan(xs)); %{ \end{matlab} In the scatter plot, \verb|col()| maps the $u$-data values to the colour of the dots. \begin{matlab} %} col = @(u) sign(u).*abs(u); %{ \end{matlab} Loop to plot at each and every time step. \begin{matlab} %} for i = 1:length(ts) uv = patchEdgeInt3(us(i,:)); u = uv(:,:,:,1,:); for p=1:2 subplot(1,2,p) if (i==1) scat(p) = scatter3(xs(j),ys(j),zs(j),'.'); axis equal, caxis(col([0 1])), view(45-4*p,42) xlabel('$x$'), ylabel('$y$'), zlabel('$z$') end title(['view cross-eyed: time = ' num2str(ts(i),'%4.2f')]) set( scat(p),'CData',col(u(j)) ); end %{ \end{matlab} Optionally save the initial condition to graphic file for \cref{fig:heteroDispersiveWave3ic}, and optionally save the last plot. \begin{matlab} %} if i==1, ifOurCf2eps([basename 'ic']) disp('Type space character to animate simulation') pause else pause(0.1) end end% i-loop over all times ifOurCf2eps([basename 'fin']) %{ \end{matlab} \begin{figure}\centering \caption{\label{fig:heteroDispersiveWave3fin} field~$u(x,y,z,t)$ at time $t=6$ of the patch scheme applied to the heterogeneous dispersive wave~\pde\ with initial condition in \cref{fig:heteroDispersiveWave3ic}.} \includegraphics[scale=0.9]{24168heteroDispersiveWave3fin} \end{figure} \subsection{\texttt{heteroDispWave3()}: PDE function of 4th-order heterogeneous dispersive waves} \label{sec:heteroDispWave3} This function codes the lattice heterogeneous waves inside the patches. The wave \pde\ for \(u(x,y,z,t)\) and `velocity'~\(v(x,y,z,t)\) is \begin{equation*} u_t=v,\quad v_t=-\delsq(C\delsq u) \end{equation*} for microscale variations in scalar~\(C(x,y,z)\). For 8D input arrays~\verb|u|, \verb|x|, \verb|y|, and~\verb|z| (via edge-value interpolation of \verb|patchSys3|, \cref{sec:patchSys3}), computes the time derivative at each point in the interior of a patch, output in~\verb|ut|. The 3D array of heterogeneous coefficients,~$C_{ijk}$, $c^y_{ijk}$ and~$c^z_{ijk}$, have been stored in~\verb|patches.cs| (3D). Supply patch information as a third argument (required by parallel computation), or otherwise by a global variable. \begin{matlab} %} function ut = heteroDispWave3(t,u,patches) if nargin<3, global patches, end %{ \end{matlab} Micro-grid space steps. \begin{matlab} %} dx = diff(patches.x(2:3)); dy = diff(patches.y(2:3)); dz = diff(patches.z(2:3)); %{ \end{matlab} First, compute \(C\delsq u\) into say~\verb|u|, using indices for all but extreme micro-grid points. We use a single colon to represent the last four array dimensions because the result arrays are already dimensioned. \begin{matlab} %} I = 2:size(u,1)-1; J = 2:size(u,2)-1; K = 2:size(u,3)-1; u(I,J,K,1,:) = patches.cs(I,J,K,1,:).*( diff(u(:,J,K,1,:),2,1)/dx^2 ... +diff(u(I,:,K,1,:),2,2)/dy^2 +diff(u(I,J,:,1,:),2,3)/dz^2 ); %{ \end{matlab} Reserve storage, set lowercase indices to non-edge interior, and then assign interior patch values to the heterogeneous diffusion time derivatives. \begin{matlab} %} ut = nan+u; % preallocate output array i = I(2:end-1); j = J(2:end-1); k = K(2:end-1); ut(i,j,k,1,:) = u(i,j,k,2,:); % du/dt=v % dv/dt=delta^2 of above C*delta^2 ut(i,j,k,2,:) = -( diff(u(I,j,k,1,:),2,1)/dx^2 ... +diff(u(i,J,k,1,:),2,2)/dy^2 +diff(u(i,j,K,1,:),2,3)/dz^2 ); end% function %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
heteroWave2.m
.m
EquationFreeGit-master/Patch/heteroWave2.m
3,466
utf_8
e35ffe6516a19822a50855c63c3f34c9
% Computes the time derivatives of forced heterogeneous % waves (slightly damped) in 2D on patches. AJR, Aug 2021 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \subsection{\texttt{heteroWave2()}: heterogeneous Waves} \label{sec:heteroWave2} This function codes the lattice heterogeneous waves inside the patches. The forced wave \pde\ is \begin{equation*} u_t=v,\quad v_t=\grad(a\divv u)+f \end{equation*} for scalars~\(a(t,x,y)\) and~\(f(t,x,y)\) where~\(a\) has microscale variations. For 6D input arrays~\verb|u|, \verb|x|, and \verb|y| (via edge-value interpolation of \verb|patchSys2|, \cref{sec:patchSys2}), computes the time derivative at each point in the interior of a patch, output in~\verb|ut|. The four 2D arrays of heterogeneous interaction coefficients,~$c_{ijk}$, have previously been stored in~\verb|patches.cs| (3D). Supply patch information as a third argument (required by parallel computation), or otherwise by a global variable. \begin{matlab} %} function ut = heteroWave2(t,u,patches) if nargin<3, global patches, end %{ \end{matlab} Microscale space-steps, and interior point indices. \begin{matlab} %} dx = diff(patches.x(2:3)); % x micro-scale step dy = diff(patches.y(2:3)); % y micro-scale step i = 2:size(u,1)-1; % x interior points in a patch j = 2:size(u,2)-1; % y interior points in a patch assert(max(abs(u(:)))<9999,"u-field exploding") %{ \end{matlab} Form coefficients here---odd periodic extension. To avoid slight errors in periodicity (in full domain simulation), first adjust any coordinates crossing \(x=\pm1\) or \(y=\pm 1\). \begin{matlab} %} x=patches.x; y=patches.y; l=find(abs(x)>1); x(l)=x(l)-sign(x(l))*2; l=find(abs(y)>1); y(l)=y(l)-sign(y(l))*2; %{ \end{matlab} Then set at this time three possible forcing functions, although only use one depending upon \verb|patches.eff|. Forcing~\(f_1\) and~\(f_2\) are as specified by \S5.1 of \cite{Maier2021}, whereas~\(f_3\) here is~\(f\) in their \S5.2. \begin{matlab} %} f1 = ( (abs(x)>0.4)*(20*t+230*t^2) ... +(abs(x)<0.4)*(100*t+2300*t^2) ).*sign(x).*sign(y); f2 = 20*t*x.*(1-abs(x)).*y.*(1-abs(y)) ... +230*t^2*(sign(y).*x.*(1-abs(x))+sign(x).*y.*(1-abs(y))); f3 = (5*t+50*t^2)*sin(pi*x).*sin(pi*y); %{ \end{matlab} Also set the heterogeneous interactions at this time. \begin{matlab} %} ax = (patches.cs(:,:,1)+sin(2*pi*t)) ... .*(patches.cs(:,:,2)+sin(2*pi*t)); ay = (patches.cs(:,:,3)+sin(2*pi*t)) ... .*(patches.cs(:,:,4)+sin(2*pi*t)); %{ \end{matlab} Reserve storage (using \verb|nan+u| appears quickest), and then assign time derivatives for interior patch values due to the heterogeneous interaction and forcing. \begin{matlab} %} ut = nan+u; % preallocate output array ut(i,j,1,:) = u(i,j,2,:); ut(i,j,2,:) ... = diff(ax(:,j).*diff(u(:,j,1,:),1),1)/dx^2 ... +diff(ay(i,:).*diff(u(i,:,1,:),1,2),1,2)/dy^2 ... +(patches.eff==1)*f1(i,j,:,:) ... +(patches.eff==2)*f2(i,j,:,:) ... +(patches.eff==3)*f3(i,j,:,:) ... + 1e-4*(diff(u(:,j,2,:),2,1)/dx^2+diff(u(i,:,2,:),2,2)/dy^2); end% function %{ \end{matlab} In the last line above, the slight damping of~\(10^{-4}\) causes microscale modes to decay at rate~\(e^{-28t}\), with frequencies~\(2000\)--\(5000\), whereas macroscale modes decay with rates roughly~\(0.0005\)--\(0.05\) with frequencies~\(10\)--\(100\). This slight damping term may correspond to the weak damping of the backward Euler scheme adopted by \cite{Maier2021} for time integration. %}
github
uoa1184615/EquationFreeGit-master
nonDiffPDE.m
.m
EquationFreeGit-master/Patch/nonDiffPDE.m
876
utf_8
46e7abc9257ef65c252ffef6c7f1f550
% Microscale discretisation of a nonlinear diffusion PDE in % 2D space (x,y) in 2D patches. % AJR, 5 Apr 2019 -- Nov 2020 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \paragraph{Example of nonlinear diffusion PDE inside patches} As a microscale discretisation of \(u_t=\delsq(u^3)\), code \(\dot u_{ijkl} =\frac1{\delta x^2} (u_{i+1,j,k,l}^3 -2u_{i,j,k,l}^3 +u_{i-1,j,k,l}^3) + \frac1{\delta y^2} (u_{i,j+1,k,l}^3 -2u_{i,j,k,l}^3 +u_{i,j-1,k,l}^3)\). \begin{matlab} %} function ut = nonDiffPDE(t,u,patches) if nargin<3, global patches, end u = squeeze(u); % reduce to 4D dx = diff(patches.x(1:2)); % microgrid spacing dy = diff(patches.y(1:2)); i = 2:size(u,1)-1; j = 2:size(u,2)-1; % interior patch points ut = nan+u; % preallocate output array ut(i,j,:,:) = diff(u(:,j,:,:).^3,2,1)/dx^2 ... +diff(u(i,:,:,:).^3,2,2)/dy^2; end %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
homoDiffSoln2.m
.m
EquationFreeGit-master/Patch/homoDiffSoln2.m
12,114
utf_8
ea97f19a9c9f8e2b9ed86dec927b3395
% Solve for steady state of heterogeneous diffusion in 2D on % patches as an example application. The microscale is of % known period so we interpolate next-to-edge values to get % opposite edge values. This version implements scenarios % inspired by Biezemans et al. (2022) \S3, p.12. AJR, Apr % 2022 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{homoDiffSoln2}: steady state of a 2D heterogeneous diffusion via small patches} \label{sec:homoDiffSoln2} Here we find the steady state~\(u(x,y)\) to the heterogeneous \pde \begin{equation*} u_t=\divv[c(x,y)\grad u]-u+f, \quad\text{for } f=100\sin(\pi x)\sin(\pi y). \end{equation*} The heterogeneous diffusion~\(c\) varies over two orders of magnitude in small space distance~\(\epsilon\). I include~\(-u\) in the \pde\ to ensure a steady state with periodic BCs. \cref{sec:homoDiffSoln2Errs} gives a function that we invoke to explore the errors in the patch scheme solution. The spectral patch scheme is essentially exact. \cite{Biezemans2022} discussed an example homogenisation in 2D with heterogeneity of period~\(\epsilon:=\pi/150\) in both directions. Ensure integer multiple of heterogeneity periods in the domain, and initially use three times bigger~\(\epsilon\). \begin{matlab} %} epsilon = 1/round(50/pi) %{ \end{matlab} \cite{Biezemans2022} choose microscale mesh spacing of~$1/1024$, so the number of micro-grid points in one period would be~\(1024\epsilon\). But \emph{initially} use less. \begin{matlab} %} mPeriod = round(128*epsilon) %round(1024*epsilon) %{ \end{matlab} So the migro-grid spacing is exactly \begin{matlab} %} dx = epsilon/mPeriod %{ \end{matlab} \paragraph{Diffusivities} Now form one period of the heterogeneity diffusivities. \cite{Biezemans2022} used \(c=1 +100 \cos^2(\pi x/\epsilon) \sin^2(\pi y/\epsilon) \). Need to shift phases of the diffusivity by half-micro-grid for diffusivities in each direction to form two diffusivity matrices on the microscale lattice. Variables \verb|h,v| represent~\(\pi x/\epsilon\) or~\(\pi y/\epsilon\). \begin{matlab} %} cHetr=[]; v=pi*( 1:mPeriod)/mPeriod; h=pi*(0.5:mPeriod)/mPeriod; cHetr(:,:,1) = 1+100*cos(h').^2*sin(v).^2; cHetr(:,:,2) = 1+100*cos(v').^2*sin(h).^2; %{ \end{matlab} Plot surfaces of the diffusivity. \begin{matlab} %} figure(2),surf(h/pi,v/pi,cHetr(:,:,2)) hold on, surf(v/pi,h/pi,cHetr(:,:,1)) hold off, alpha 0.5, drawnow %{ \end{matlab} \paragraph{Patch configuration} As is common, \cite{Biezemans2022} implemented zero-Dirichlet BCs on $(0,1)^2$. Here these are more-or-less encompassed by implementing periodic BCs on $(-1,1)^2$. Initially use \(8\times8\) patches to have \(4\times4\) patches in \((0,1)^2\), which then have patch spacing~\(H\). \begin{matlab} %} nPatch = [8 8] H = 2./nPatch HepsilonRatio = H/epsilon %{ \end{matlab} Best when each patch spans an integral number of periods plus one grid step. The smallest such patches are \begin{matlab} %} nSubP = [1 1]*mPeriod+2 %{ \end{matlab} Consequently, the ratio of space computed on, to the space in the domain is the product of the following ratios in each direction, namely about~8\% here. \begin{matlab} %} ratio = ((nSubP-2)*dx)./H %{ \end{matlab} Specify spectral interpolation. The edgy interpolation is self-adjoint \cite[]{Bunder2020a} leading to a symmetric matrix problem. \begin{matlab} %} configPatches2(@hetDiffForce2,[-1 1 -1 1],nan,nPatch ... ,0,ratio,nSubP ,'EdgyInt',true ... ,'hetCoeffs',cHetr ); %{ \end{matlab} \paragraph{Solve for steady state} Set initial guess of zero, with \verb|NaN| to indicate patch-edge values. Index~\verb|i| are the indices of patch-interior points, and the number of unknowns is then its length. \begin{matlab} %} global patches i u0 = zeros([nSubP,1,1,nPatch]); u0([1 end],:,:) = nan; u0(:,[1 end],:) = nan; i = find(~isnan(u0)); nVars = numel(i) %{ \end{matlab} Solve by iteration. Could use \verb|fsolve| for nonlinear problems, but for linear it is much faster to use Conjugate-Gradient algorithm. \verb|gmres| is competitive, but appears to take twice as long. % uSoln=gmres(@(u) rhsb-theRes(u),rhsb,[],1e-9,maxIt); \begin{matlab} %} tic; if 0, uSoln=fsolve(@theRes,u0(i)); %{ \end{matlab} The above is for nonlinear \pde{}s. For linear \pde{}s, determine the \textsc{rhs} vector, and make a function that computes the matrix vector product. \begin{matlab} %} else maxIt = ceil(nVars/10); rhsb = theRes(u0(i)); uSoln = pcg(@(u) rhsb-theRes(u),rhsb,1e-9,maxIt); end solnTime = toc %{ \end{matlab} Store the solution into the patches, and give magnitudes. \begin{matlab} %} u0(i) = uSoln; normSoln = norm(uSoln) normResidual = norm(theRes(uSoln)) %{ \end{matlab} \paragraph{Draw solution profile} First reshape arrays to suit 2D space surface plots. \begin{matlab} %} figure(1), clf, colormap(hsv) x = squeeze(patches.x); y = squeeze(patches.y); u = reshape(permute(squeeze(u0),[1 3 2 4]), [numel(x) numel(y)]); %{ \end{matlab} Draw the patch solution surface in the positive quadrant, with edge-values omitted as already~\verb|NaN| by not bothering to interpolate them. \begin{matlab} %} surf(x(:),y(:),u'); view(60,40) maxu = ceil(max(u(:))*10)/10; axis([0 1 0 1 0 maxu]), caxis([0 maxu]) xlabel('$x$'), ylabel('$y$'), zlabel('$u(x,y)$') %{ \end{matlab} \paragraph{Assess errors in the patch scheme} Invoke the function with desired interpolation: \(0\),~spectral; \(2,4,\ldots\),~polynomial. \begin{matlab} %} errorsPatchScheme(0) %{ \end{matlab} \subsection{Microscale discretisation inside patches} \paragraph{\texttt{hetDiffForce2()}: heterogeneous diffusion PDE} This function, based upon \cref{sec:heteroDiff2}, codes the lattice heterogeneous diffusion of the \pde\ inside the patches. For 6D input arrays~\verb|u|, \verb|x|, and~\verb|y|, computes the time derivativeat each point in the interior of a patch, output in~\verb|ut|. The two 2D array of diffusivities,~$c^x_{ij}$ and~$c^y_{ij}$, are stored in~\verb|patches.cs| (3D). \begin{matlab} %} function ut = hetDiffForce2(t,u,patches) dx = diff(patches.x(2:3)); % x space step dy = diff(patches.y(2:3)); % y space step ix = 2:size(u,1)-1; % x interior points in a patch iy = 2:size(u,2)-1; % y interior points in a patch ut = nan+u; % preallocate output array fu = -u+100*sin(pi*patches.x).*sin(pi*patches.y); ut(ix,iy,:,:,:,:) ... = diff(patches.cs(:,iy,1).*diff(u(:,iy,:,:,:,:),1),1)/dx^2 ... +diff(patches.cs(ix,:,2).*diff(u(ix,:,:,:,:,:),1,2),1,2)/dy^2 ... +fu(ix,iy,:,:,:,:); end% function %{ \end{matlab} \paragraph{\texttt{theRes()}: function to zero} This functions converts a vector of values into the interior values of the patches, then evaluates the time derivative of the system, and returns the vector of patch-interior time derivatives. \begin{matlab} %} function f=theRes(u) global i patches v=nan(size(patches.x+patches.y)); v(i)=u; f=patchSys2(0,v(:),patches); f=f(i); end %{ \end{matlab} \subsection{Function to explore errors in the patch scheme} \label{sec:homoDiffSoln2Errs} We find the spectral interpolation patch scheme accurate to essentially zero errors, namely errors less than~\(10^{-10}\). Non-spectral interpolation has errors that decrease roughly like expected power of patch spacing. The single argument~\verb|ord| is~\(0\) for spectral interpolation and \(2,4,\ldots\) for corresponding polynomial interpolation schemes. \begin{matlab} %} function errorsPatchScheme(ord) warning('Assessing errors via varying number of patches') %{ \end{matlab} Use a hierarchy of cases with increasing number of patches---the number increasing by~\(3^2\) from one level to the next in the hierarchy. Then the higher resolution patches precisely contain the lower resolution cases. The case when index \verb|k=kMax| corresponds to the full-domain solution. \cite{Biezemans2022} use heterogeneity of period~\(\epsilon:=\pi/150\approx 0.021\) in both directions, here with \verb|kMax=3| use \(\epsilon\approx0.037\). Ensure integer multiple of heterogeneity periods in the full domain. \begin{matlab} %} kMax = 3 epsilon = 1/3^kMax %{ \end{matlab} \cite{Biezemans2022} choose microscale mesh spacing of~$1/1024$, so their number of micro-grid points in one period is~\(1024\epsilon\approx 21\). But here use less because less is plenty enough---the issue is the accuracy of the patch scheme to whatever micro-grid system is given, \emph{not} the accuracy of the micro-grid system to the \pde. \begin{matlab} %} mPeriod = 9 %{ \end{matlab} So the migro-grid spacing is \begin{matlab} %} dx = epsilon/mPeriod %{ \end{matlab} \paragraph{Diffusivities} Now form one period of the heterogeneity diffusivities exactly as in above code. \begin{matlab} %} cHetr=[]; v=pi*( 1:mPeriod)/mPeriod; h=pi*(0.5:mPeriod)/mPeriod; cHetr(:,:,1) = 1+100*cos(h').^2*sin(v).^2; cHetr(:,:,2) = 1+100*cos(v').^2*sin(h).^2; %{ \end{matlab} \paragraph{Loop over different patch spacings} \begin{matlab} %} for k=1:kMax nPatch = [2 2]*3^k %{ \end{matlab} \paragraph{Patch configuration} Zero-Dirichlet BCs on $(0,1)^2$ are more-or-less encompassed by implementing periodic BCs on $(-1,1)^2$. \begin{matlab} %} H = 2./nPatch HepsilonRatio = H/epsilon %{ \end{matlab} Best when each patch spans an integral number of periods plus one grid step. The smallest such patches are \begin{matlab} %} nSubP = [1 1]*mPeriod+2 %{ \end{matlab} Consequently, the ratios of space computed on is the following. The case \verb|k=kMax| gives a ratio of precisely one that characterises a full-domain problem. \begin{matlab} %} ratio = ((nSubP-2)*dx)./H %{ \end{matlab} The edgy interpolation leads to a symmetric matrix problem \cite[]{Bunder2020a}. \begin{matlab} %} configPatches2(@hetDiffForce2,[-1 1 -1 1],nan,nPatch ... ,ord,ratio,nSubP ,'EdgyInt',true ... ,'hetCoeffs',cHetr ); %{ \end{matlab} \paragraph{Solve for steady state} Set initial guess of zero, with \verb|NaN| to indicate patch-edge values. Index~\verb|i| are the indices of patch-interior points, and the number of unknowns is then its length. \begin{matlab} %} global patches i u0 = zeros([nSubP,1,1,nPatch]); u0([1 end],:,:) = nan; u0(:,[1 end],:) = nan; i = find(~isnan(u0)); nVars = numel(i) %{ \end{matlab} For this linear problem it is fast to solve with the Conjugate-Gradient algorithm. Determine the \textsc{rhs} vector, and use a function that computes the matrix vector product. \begin{matlab} %} tic rhsb = theRes(u0(i)); uSoln = pcg(@(u) rhsb-theRes(u),rhsb,1e-6,999); solnTime = toc %{ \end{matlab} Store the solution into the patches, and trace magnitudes. \begin{matlab} %} u0(i) = uSoln; normSoln = norm(uSoln) normResidual = norm(theRes(uSoln)) %{ \end{matlab} \paragraph{End loop over different patch spacings} Store 4D field values in cell array for post-processing. \begin{matlab} %} us{k}=squeeze(u0); end%for %{ \end{matlab} \paragraph{Compare errors across cases} There are nine patches common to all grids (36~if one counts all quadrants), indexed by the following patch indices. \begin{matlab} %} disp('**** Relate errors for different patch spacing ****') if ord==0, disp('**** Spectral interpolation between patches') else disp(['**** Polynomial interpolation, order ' num2str(ord)]) end i=2:nSubP-1; I{1}=1:3; for k=2:kMax, I{k}=3*I{k-1}-1; end %{ \end{matlab} Determine errors by computing difference between patch schemes: the final patch scheme is a full-domain solution and hence `exact'. Look at the \textsc{rms} error in each of the patches. Find the overall error for each patch, their ratios, and the rough order of decrease. \begin{matlab} %} rmsError=[]; errorRatios=[]; orderInH=[]; for k=1:kMax-1 error{k}=us{k}(i,i,I{k},I{k})-us{kMax}(i,i,I{kMax},I{kMax}); rmsError(:,:,k)=squeeze(rms(rms(error{k}))); if (k>1)&(ord>0) errorRatios(:,:,k-1)=rmsError(:,:,k)./rmsError(:,:,k-1); orderInH(:,:,k-1)=-log(errorRatios(:,:,k-1))/log(3); end end %{ \end{matlab} Display the results, and end the function. \begin{matlab} %} rmsError=rmsError errorRatios=errorRatios orderInH=orderInH end%function %{ \end{matlab} Fin. %}
github
uoa1184615/EquationFreeGit-master
heteroDiffF.m
.m
EquationFreeGit-master/Patch/heteroDiffF.m
1,742
utf_8
50afdf6b3a072798ee453482c350b375
% Computes the time derivatives of forced heterogeneous % diffusion in 1D on patches. AJR, Apr 2019 -- 3 Jan 2023 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \subsection{\texttt{heteroDiffF()}: forced heterogeneous diffusion} \label{sec:heteroDiffF} This function codes the lattice heterogeneous diffusion inside the patches with forcing and with microscale boundary conditions on the macroscale boundaries. Computes the time derivative at each point in the interior of a patch, output in~\verb|ut|. The column vector of diffusivities~\(a_i\) has been stored in struct~\verb|patches.cs|, as has the array of forcing coefficients. \begin{matlab} %} function ut = heteroDiffF(t,u,patches) %{ \end{matlab} Cater for the two cases: one of a non-autonomous forcing oscillating in time when \(\verb|microTimePeriod|>0\), or otherwise the case of an autonomous diffusion constant in time. \begin{matlab} %} global microTimePeriod if microTimePeriod>0 % optional time fluctuations at = cos(2*pi*t/microTimePeriod)/30; else at=0; end %{ \end{matlab} Two basic parameters, and initialise result array to NaNs. \begin{matlab} %} dx = diff(patches.x(2:3)); % space step i = 2:size(u,1)-1; % interior points in a patch ut = nan+u; % preallocate output array %{ \end{matlab} The macroscale Dirichlet boundary conditions are zero at the extreme edges of the two extreme patches. \begin{matlab} %} u( 1 ,:,:, 1 )=0; % left-edge of leftmost is zero u(end,:,:,end)=0; % right-edge of rightmost is zero %{ \end{matlab} Code the microscale forced diffusion. \begin{matlab} %} ut(i,:,:,:) = diff((patches.cs(:,1,:)+at).*diff(u))/dx^2 ... +patches.f2(i,:,:,:)*t^2+patches.f1(i,:,:,:)*t; end% function %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
patchSmooth3.m
.m
EquationFreeGit-master/Patch/patchSmooth3.m
376
utf_8
884dc8b5cd180f6a18e78fd7d0284768
% legacy interface patchSmooth3() auto-invokes new patchSys3() function dudt=patchSmooth3(t,u,patches) global smOOthCount if isempty(smOOthCount), smOOthCount=1; else smOOthCount=smOOthCount+1; end l2=log2(smOOthCount); if abs(l2-round(l2))<1e-9 warning('Use new patchSys3 instead of old patchSmooth3') end if nargin<3, global patches, end dudt=patchSys3(t,u,patches);
github
uoa1184615/EquationFreeGit-master
configPatches3.m
.m
EquationFreeGit-master/Patch/configPatches3.m
33,989
utf_8
a27ad1c3bdc45bd11440e731216fa33a
% configPatches3() creates a data struct of the design of 3D % patches for later use by the patch functions such as % patchSys3(). AJR, Aug 2020 -- 12 Apr 2023 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{configPatches3()}: configures spatial patches in 3D} \label{sec:configPatches3} \localtableofcontents Makes the struct~\verb|patches| for use by the patch\slash gap-tooth time derivative\slash step function \verb|patchSys3()|, and possibly other patch functions. \cref{sec:configPatches3eg,sec:homoDiffEdgy3} list examples of its use. \begin{matlab} %} function patches = configPatches3(fun,Xlim,Dom ... ,nPatch,ordCC,dx,nSubP,varargin) version = '2023-04-12'; %{ \end{matlab} \paragraph{Input} If invoked with no input arguments, then executes an example of simulating a heterogeneous wave \pde---see \cref{sec:configPatches3eg} for an example code. \begin{itemize} \item \verb|fun| is the name of the user function, \verb|fun(t,u,patches)| or \verb|fun(t,u)| or \verb|fun(t,u,patches,...)|, that computes time-derivatives (or time-steps) of quantities on the 3D micro-grid within all the 3D~patches. \item \verb|Xlim| array/vector giving the rectangular-cuboid macro-space domain of the computation: namely $[\verb|Xlim(1)|, \verb|Xlim(2)|] \times [\verb|Xlim(3)|, \verb|Xlim(4)| \times [\verb|Xlim(5)|, \verb|Xlim(6)|]$. If \verb|Xlim| has two elements, then the domain is the cubic domain of the same interval in all three directions. \item \verb|Dom| sets the type of macroscale conditions for the patches, and reflects the type of microscale boundary conditions of the problem. If \verb|Dom| is \verb|NaN| or \verb|[]|, then the field~\verb|u| is triply macro-periodic in the 3D spatial domain, and resolved on equi-spaced patches. If \verb|Dom| is a character string, then that specifies the \verb|.type| of the following structure, with \verb|.bcOffset| set to the default zero. Otherwise \verb|Dom| is a structure with the following components. \begin{itemize} \item \verb|.type|, string, of either \verb|'periodic'| (the default), \verb|'equispace'|, \verb|'chebyshev'|, \verb|'usergiven'|. For all cases except \verb|'periodic'|, users \emph{must} code into \verb|fun| the micro-grid boundary conditions that apply at the left\slash right\slash bottom\slash top\slash back\slash front faces of the leftmost\slash rightmost\slash bottommost\slash topmost\slash backmost\slash frontmost patches, respectively. \item \verb|.bcOffset|, optional one, three or six element vector/array, in the cases of \verb|'equispace'| or \verb|'chebyshev'| the patches are placed so the left\slash right macroscale boundaries are aligned to the left\slash right faces of the corresponding extreme patches, but offset by \verb|bcOffset| of the sub-patch micro-grid spacing. For example, use \verb|bcOffset=0| when the micro-code applies Dirichlet boundary values on the extreme face micro-grid points, whereas use \verb|bcOffset=0.5| when the microcode applies Neumann boundary conditions halfway between the extreme face micro-grid points. Similarly for the top, bottom, back, and front faces. If \verb|.bcOffset| is a scalar, then apply the same offset to all boundaries. If three elements, then apply the first offset to both \(x\)-boundaries, the second offset to both \(y\)-boundaries, and the third offset to both \(z\)-boundaries. If six elements, then apply the first two offsets to the respective \(x\)-boundaries, the middle two offsets to the respective \(y\)-boundaries, and the last two offsets to the respective \(z\)-boundaries. \item \verb|.X|, optional vector/array with \verb|nPatch(1)| elements, in the case \verb|'usergiven'| it specifies the \(x\)-locations of the centres of the patches---the user is responsible the locations makes sense. \item \verb|.Y|, optional vector/array with \verb|nPatch(2)| elements, in the case \verb|'usergiven'| it specifies the \(y\)-locations of the centres of the patches---the user is responsible the locations makes sense. \item \verb|.Z|, optional vector/array with \verb|nPatch(3)| elements, in the case \verb|'usergiven'| it specifies the \(z\)-locations of the centres of the patches---the user is responsible the locations makes sense. \end{itemize} \item \verb|nPatch| sets the number of equi-spaced spatial patches: if scalar, then use the same number of patches in all three directions, otherwise \verb|nPatch(1:3)| gives the number~($\geq1$) of patches in each direction. \item \verb|ordCC| is the `order' of interpolation for inter-patch coupling across empty space of the macroscale patch values to the face-values of the patches: currently must be~$0,2,4,\ldots$; where $0$~gives spectral interpolation. \item \verb|dx| (real---scalar or three elements) is usually the sub-patch micro-grid spacing in~\(x\), \(y\) and~\(z\). If scalar, then use the same \verb|dx| in all three directions, otherwise \verb|dx(1:3)| gives the spacing in each of the three directions. However, if \verb|Dom| is~\verb|NaN| (as for pre-2023), then \verb|dx| actually is \verb|ratio| (scalar or three elements), namely the ratio of (depending upon \verb|EdgyInt|) either the half-width or full-width of a patch to the equi-spacing of the patch mid-points---adjusted a little when $\verb|nEdge|>1$. So either $\verb|ratio|=\tfrac12$ means the patches abut and $\verb|ratio|=1$ is overlapping patches as in holistic discretisation, or $\verb|ratio|=1$ means the patches abut. Small~\verb|ratio| should greatly reduce computational time. \item \verb|nSubP| is the number of equi-spaced microscale lattice points in each patch: if scalar, then use the same number in all three directions, otherwise \verb|nSubP(1:3)| gives the number in each direction. If not using \verb|EdgyInt|, then $\verb|nSubP./nEdge|$ must be odd integer(s) so that there is/are centre-patch lattice planes. So for the defaults of $\verb|nEdge|=1$ and not \verb|EdgyInt|, then \verb|nSubP| must be odd. \item \verb|'nEdge'|, \emph{optional} (integer---scalar or three element), default=1, the width of face values set by interpolation at the face regions of each patch. If two elements, then respectively the width in \(x,y\)-directions. The default is one (suitable for microscale lattices with only nearest neighbour interactions). \item \verb|'EdgyInt'|, true/false, \emph{optional}, default=false. If true, then interpolate to left\slash right\slash top\slash bottom\slash front\slash back face-values from right\slash left\slash bottom\slash top\slash back\slash front next-to-face values. If false or omitted, then interpolate from centre-patch planes. \item \verb|'nEnsem'|, \emph{optional-experimental}, default one, but if more, then an ensemble over this number of realisations. \item \verb|'hetCoeffs'|, \emph{optional}, default empty. Supply a 3D or 4D array of microscale heterogeneous coefficients to be used by the given microscale \verb|fun| in each patch. Say the given array~\verb|cs| is of size $m_x\times m_y\times m_z\times n_c$, where $n_c$~is the number of different arrays of coefficients. For example, in heterogeneous diffusion, $n_c=3$ for the diffusivities in the \emph{three} different spatial directions (or $n_c=6$ for the diffusivity tensor). The coefficients are to be the same for each and every patch. However, macroscale variations are catered for by the $n_c$~coefficients being $n_c$~parameters in some macroscale formula. \begin{itemize} \item If $\verb|nEnsem|=1$, then the array of coefficients is just tiled across the patch size to fill up each patch, starting from the $(1,1,1)$-point in each patch. Best accuracy usually obtained when the periodicity of the coefficients is a factor of \verb|nSubP-2*nEdge| for \verb|EdgyInt|, or a factor of \verb|(nSubP-nEdge)/2| for not \verb|EdgyInt|. \item If $\verb|nEnsem|>1$ (value immaterial), then reset $\verb|nEnsem|:=m_x\cdot m_y\cdot m_z$ and construct an ensemble of all $m_x\cdot m_y\cdot m_z$ phase-shifts of the coefficients. In this scenario, the inter-patch coupling couples different members in the ensemble. When \verb|EdgyInt| is true, and when the coefficients are diffusivities\slash elasticities in $x,y,z$-directions, respectively, then this coupling cunningly preserves symmetry. \end{itemize} \item \verb|'parallel'|, true/false, \emph{optional}, default=false. If false, then all patch computations are on the user's main \textsc{cpu}---although a user may well separately invoke, say, a \textsc{gpu} to accelerate sub-patch computations. If true, and it requires that you have \Matlab's Parallel Computing Toolbox, then it will distribute the patches over multiple \textsc{cpu}s\slash cores. In \Matlab, only one array dimension can be split in the distribution, so it chooses the one space dimension~$x,y,z$ corresponding to the highest~\verb|nPatch| (if a tie, then chooses the rightmost of~$x,y,z$). A user may correspondingly distribute arrays with property \verb|patches.codist|, or simply use formulas invoking the preset distributed arrays \verb|patches.x|, \verb|patches.y|, and \verb|patches.z|. If a user has not yet established a parallel pool, then a `local' pool is started. \end{itemize} \paragraph{Output} The struct \verb|patches| is created and set with the following components. If no output variable is provided for \verb|patches|, then make the struct available as a global variable.\footnote{When using \texttt{spmd} parallel computing, it is generally best to avoid global variables, and so instead prefer using an explicit output variable.} \begin{matlab} %} if nargout==0, global patches, end patches.version = version; %{ \end{matlab} \begin{itemize} \item \verb|.fun| is the name of the user's function \verb|fun(t,u,patches)| or \verb|fun(t,u)| or \verb|fun(t,u,patches,...)| that computes the time derivatives (or steps) on the patchy lattice. \item \verb|.ordCC| is the specified order of inter-patch coupling. \item \verb|.periodic|: either true, for interpolation on the macro-periodic domain; or false, for general interpolation by divided differences over non-periodic domain or unevenly distributed patches. \item \verb|.stag| is true for interpolation using only odd neighbouring patches as for staggered grids, and false for the usual case of all neighbour coupling---not yet implemented. \item \verb|.Cwtsr| and \verb|.Cwtsl| are the $\verb|ordCC|\times 3$-array of weights for the inter-patch interpolation onto the right\slash top\slash front and left\slash bottom\slash back faces (respectively) with patch:macroscale ratio as specified or as derived from~\verb|dx|. \item \verb|.x| (8D) is $\verb|nSubP(1)| \times1 \times1 \times1 \times1 \times \verb|nPatch(1)| \times1 \times1$ array of the regular spatial locations~$x_{iI}$ of the microscale grid points in every patch. \item \verb|.y| (8D) is $1 \times \verb|nSubP(2)| \times1 \times1 \times1 \times1 \times \verb|nPatch(2)| \times1$ array of the regular spatial locations~$y_{jJ}$ of the microscale grid points in every patch. \item \verb|.z| (8D) is $1 \times1 \times \verb|nSubP(3)| \times1 \times1 \times1 \times1 \times \verb|nPatch(3)|$ array of the regular spatial locations~$z_{kK}$ of the microscale grid points in every patch. \item \verb|.ratio| $1\times 3$, only for macro-periodic conditions, are the size ratios of every patch. \item \verb|.nEdge| $1\times 3$, is the width of face values set by interpolation at the face regions of each patch, in the \(x,y,z\)-directions respectively. \item \verb|.le|, \verb|.ri|, \verb|.bo|, \verb|.to|, \verb|.ba|, \verb|.fr| determine inter-patch coupling of members in an ensemble. Each a column vector of length~\verb|nEnsem|. \item \verb|.cs| either \begin{itemize} \item \verb|[]| 0D, or \item if $\verb|nEnsem|=1$, $(\verb|nSubP(1)|-1)\times (\verb|nSubP(2)|-1)\times (\verb|nSubP(3)|-1)\times n_c$ 4D array of microscale heterogeneous coefficients, or \item if $\verb|nEnsem|>1$, $(\verb|nSubP(1)|-1)\times (\verb|nSubP(2)|-1)\times (\verb|nSubP(3)|-1)\times n_c\times m_xm_ym_z$ 5D array of $m_xm_ym_z$~ensemble of phase-shifts of the microscale heterogeneous coefficients. \end{itemize} \item \verb|.parallel|, logical: true if patches are distributed over multiple \textsc{cpu}s\slash cores for the Parallel Computing Toolbox, otherwise false (the default is to activate the \emph{local} pool). \item \verb|.codist|, \emph{optional}, describes the particular parallel distribution of arrays over the active parallel pool. \end{itemize} \subsection{If no arguments, then execute an example} \label{sec:configPatches3eg} \begin{matlab} %} if nargin==0 disp('With no arguments, simulate example of heterogeneous wave') %{ \end{matlab} The code here shows one way to get started: a user's script may have the following three steps (``\into'' denotes function recursion). \begin{enumerate}\def\itemsep{-1.5ex} \item configPatches3 \item ode23 integrator \into patchSys3 \into user's PDE \item process results \end{enumerate} Set random heterogeneous coefficients of period two in each of the three directions. Crudely normalise by the harmonic mean so the macro-wave time scale is roughly one. \begin{matlab} %} mPeriod = [2 2 2]; cHetr = exp(0.9*randn([mPeriod 3])); cHetr = cHetr*mean(1./cHetr(:)) %{ \end{matlab} Establish global patch data struct to interface with a function coding a nonlinear `diffusion' \pde: to be solved on $[-\pi,\pi]^3$-periodic domain, with $5^3$~patches, spectral interpolation~($0$) couples the patches, each patch with micro-grid spacing~$0.22$ (relatively large for visualisation), and with $4^3$~points forming each patch. \begin{matlab} %} global patches patches = configPatches3(@heteroWave3,[-pi pi] ... ,'periodic' , 5, 0, 0.22, mPeriod+2 ,'EdgyInt',true ... ,'hetCoeffs',cHetr); %{ \end{matlab} Set a wave initial state using auto-replication of the spatial grid, and as \cref{fig:configPatches3ic} shows. This wave propagates diagonally across space. Concatenate the two \(u,v\)-fields to be the two components of the fourth dimension. \begin{matlab} %} u0 = 0.5+0.5*sin(patches.x+patches.y+patches.z); v0 = -0.5*cos(patches.x+patches.y+patches.z)*sqrt(3); uv0 = cat(4,u0,v0); %{ \end{matlab} \begin{figure} \centering \caption{\label{fig:configPatches3ic}initial field~$u(x,y,z,t)$ at time $t=0$ of the patch scheme applied to a heterogeneous wave~\pde: \cref{fig:configPatches3fin} plots the computed field at time $t=6$.} \includegraphics[scale=0.9]{configPatches3ic} \end{figure} Integrate in time to $t=6$ using standard functions. In Matlab \verb|ode15s| would be natural as the patch scheme is naturally stiff, but \verb|ode23| is much quicker \cite[Fig.~4]{Maclean2020a}. \begin{matlab} %} disp('Simulate heterogeneous wave u_tt=div[C*grad(u)]') if ~exist('OCTAVE_VERSION','builtin') [ts,us] = ode23(@patchSys3,linspace(0,6),uv0(:)); else %disp('octave version is very slow for me') lsode_options('absolute tolerance',1e-4); lsode_options('relative tolerance',1e-4); [ts,us] = odeOcts(@patchSys3,[0 1 2],uv0(:)); end %{ \end{matlab} Animate the computed simulation to end with \cref{fig:configPatches3fin}. Use \verb|patchEdgeInt3| to obtain patch-face values in order to most easily reconstruct the array data structure. Replicate $x$, $y$, and~$z$ arrays to get individual spatial coordinates of every data point. Then, optionally, set faces to~\verb|nan| so the plot just shows patch-interior data. \begin{matlab} %} figure(1), clf, colormap(0.8*jet) xs = patches.x+0*patches.y+0*patches.z; ys = patches.y+0*patches.x+0*patches.z; zs = patches.z+0*patches.y+0*patches.x; if 1, xs([1 end],:,:,:)=nan; xs(:,[1 end],:,:)=nan; xs(:,:,[1 end],:)=nan; end;%option j=find(~isnan(xs)); %{ \end{matlab} In the scatter plot, these functions \verb|pix()| and \verb|col()| map the $u$-data values to the size of the dots and to the colour of the dots, respectively. \begin{matlab} %} pix = @(u) 15*abs(u)+7; col = @(u) sign(u).*abs(u); %{ \end{matlab} Loop to plot at each and every time step. \begin{matlab} %} for i = 1:length(ts) uv = patchEdgeInt3(us(i,:)); u = uv(:,:,:,1,:); for p=1:2 subplot(1,2,p) if (i==1)| exist('OCTAVE_VERSION','builtin') scat(p) = scatter3(xs(j),ys(j),zs(j),'filled'); axis equal, caxis(col([0 1])), view(45-5*p,25) xlabel('$x$'), ylabel('$y$'), zlabel('$z$') title('view stereo pair cross-eyed') end % in matlab just update values set(scat(p),'CData',col(u(j)) ... ,'SizeData',pix((8+xs(j)-ys(j)+zs(j))/6+0*u(j))); legend(['time = ' num2str(ts(i),'%4.2f')],'Location','north') end %{ \end{matlab} Optionally save the initial condition to graphic file for \cref{fig:configPatches2ic}, and optionally save the last plot. \begin{matlab} %} if i==1, ifOurCf2eps([mfilename 'ic']) disp('Type space character to animate simulation') pause else pause(0.05) end end% i-loop over all times ifOurCf2eps([mfilename 'fin']) %{ \end{matlab} \begin{figure} \centering \caption{\label{fig:configPatches3fin}field~$u(x,y,z,t)$ at time $t=6$ of the patch scheme applied to the heterogeneous wave~\pde\ with initial condition in \cref{fig:configPatches3ic}.} \includegraphics[scale=0.9]{configPatches3fin} \end{figure} Upon finishing execution of the example, exit this function. \begin{matlab} %} return end%if no arguments %{ \end{matlab} \IfFileExists{../Patch/heteroWave3.m}{\input{../Patch/heteroWave3.m}}{} \begin{devMan} \subsection{Parse input arguments and defaults} \begin{matlab} %} p = inputParser; fnValidation = @(f) isa(f, 'function_handle'); %test for fn name addRequired(p,'fun',fnValidation); addRequired(p,'Xlim',@isnumeric); %addRequired(p,'Dom'); % too flexible addRequired(p,'nPatch',@isnumeric); addRequired(p,'ordCC',@isnumeric); addRequired(p,'dx',@isnumeric); addRequired(p,'nSubP',@isnumeric); addParameter(p,'nEdge',1,@isnumeric); addParameter(p,'EdgyInt',false,@islogical); addParameter(p,'nEnsem',1,@isnumeric); addParameter(p,'hetCoeffs',[],@isnumeric); addParameter(p,'parallel',false,@islogical); %addParameter(p,'nCore',1,@isnumeric); % not yet implemented parse(p,fun,Xlim,nPatch,ordCC,dx,nSubP,varargin{:}); %{ \end{matlab} Set the optional parameters. \begin{matlab} %} patches.nEdge = p.Results.nEdge; if numel(patches.nEdge)==1 patches.nEdge = repmat(patches.nEdge,1,3); end patches.EdgyInt = p.Results.EdgyInt; patches.nEnsem = p.Results.nEnsem; cs = p.Results.hetCoeffs; patches.parallel = p.Results.parallel; %patches.nCore = p.Results.nCore; %{ \end{matlab} Initially duplicate parameters for three space dimensions as needed. \begin{matlab} %} if numel(Xlim)==2, Xlim = repmat(Xlim,1,3); end if numel(nPatch)==1, nPatch = repmat(nPatch,1,3); end if numel(dx)==1, dx = repmat(dx,1,3); end if numel(nSubP)==1, nSubP = repmat(nSubP,1,3); end %{ \end{matlab} Check parameters. \begin{matlab} %} assert(Xlim(1)<Xlim(2) ... ,'first pair of Xlim must be ordered increasing') assert(Xlim(3)<Xlim(4) ... ,'second pair of Xlim must be ordered increasing') assert(Xlim(5)<Xlim(6) ... ,'third pair of Xlim must be ordered increasing') assert((mod(ordCC,2)==0)|all(patches.nEdge==1) ... ,'Cannot yet have nEdge>1 and staggered patch grids') assert(all(3*patches.nEdge<=nSubP) ... ,'too many edge values requested') assert(all(rem(nSubP,patches.nEdge)==0) ... ,'nSubP must be integer multiple of nEdge') if ~patches.EdgyInt, assert(all(rem(nSubP./patches.nEdge,2)==1) ... ,'for non-edgyInt, nSubP./nEdge must be odd integer') end if (patches.nEnsem>1)&all(patches.nEdge>1) warning('not yet tested when both nEnsem and nEdge non-one') end %if patches.nCore>1 % warning('nCore>1 not yet tested in this version') % end %{ \end{matlab} For compatibility with pre-2023 functions, if parameter \verb|Dom| is \verb|Nan|, then we set the \verb|ratio| to be the value of the so-called \verb|dx| vector. \begin{matlab} %} if ~isstruct(Dom), pre2023=isnan(Dom); else pre2023=false; end if pre2023, ratio=dx; dx=nan; end %{ \end{matlab} Default macroscale conditions are periodic with evenly spaced patches. \begin{matlab} %} if isempty(Dom), Dom=struct('type','periodic'); end if (~isstruct(Dom))&isnan(Dom), Dom=struct('type','periodic'); end %{ \end{matlab} If \verb|Dom| is a string, then just set type to that string, and subsequently set corresponding defaults for others fields. \begin{matlab} %} if ischar(Dom), Dom=struct('type',Dom); end %{ \end{matlab} We allow different macroscale domain conditions in the different directions. But for the moment do not allow periodic to be mixed with the others (as the interpolation mechanism is different code)---hence why we choose \verb|periodic| be seven characters, whereas the others are eight characters. The different conditions are coded in different rows of \verb|Dom.type|, so we duplicate the string if only one row specified. \begin{matlab} %} if size(Dom.type,1)==1, Dom.type=repmat(Dom.type,3,1); end %{ \end{matlab} Check what is and is not specified, and provide default of Dirichlet boundaries if no \verb|bcOffset| specified when needed. Do so for all three directions independently. \begin{matlab} %} patches.periodic=false; for p=1:3 switch Dom.type(p,:) case 'periodic' patches.periodic=true; if isfield(Dom,'bcOffset') warning('bcOffset not available for Dom.type = periodic'), end msg=' not available for Dom.type = periodic'; if isfield(Dom,'X'), warning(['X' msg]), end if isfield(Dom,'Y'), warning(['Y' msg]), end if isfield(Dom,'Z'), warning(['Z' msg]), end case {'equispace','chebyshev'} if ~isfield(Dom,'bcOffset'), Dom.bcOffset=zeros(2,3); end % for mixed with usergiven, following should still work if numel(Dom.bcOffset)==1 Dom.bcOffset=repmat(Dom.bcOffset,2,3); end if numel(Dom.bcOffset)==3 Dom.bcOffset=repmat(Dom.bcOffset(:)',2,1); end msg=' not available for Dom.type = equispace or chebyshev'; if (p==1)& isfield(Dom,'X'), warning(['X' msg]), end if (p==2)& isfield(Dom,'Y'), warning(['Y' msg]), end if (p==3)& isfield(Dom,'Z'), warning(['Z' msg]), end case 'usergiven' % if isfield(Dom,'bcOffset') % warning('bcOffset not available for usergiven Dom.type'), end msg=' required for Dom.type = usergiven'; if p==1, assert(isfield(Dom,'X'),['X' msg]), end if p==2, assert(isfield(Dom,'Y'),['Y' msg]), end if p==3, assert(isfield(Dom,'Z'),['Z' msg]), end otherwise error([Dom.type ' is unknown Dom.type']) end%switch Dom.type end%for p %{ \end{matlab} \subsection{The code to make patches} First, store the pointer to the time derivative function in the struct. \begin{matlab} %} patches.fun = fun; %{ \end{matlab} Second, store the order of interpolation that is to provide the values for the inter-patch coupling conditions. Spectral coupling is \verb|ordCC| of~$0$ or (not yet??)~$-1$. \begin{matlab} %} assert((ordCC>=-1) & (floor(ordCC)==ordCC), ... 'ordCC out of allowed range integer>=-1') %{ \end{matlab} For odd~\verb|ordCC| do interpolation based upon odd neighbouring patches as is useful for staggered grids. \begin{matlab} %} patches.stag = mod(ordCC,2); assert(patches.stag==0,'staggered not yet implemented??') ordCC = ordCC+patches.stag; patches.ordCC = ordCC; %{ \end{matlab} Check for staggered grid and periodic case. \begin{matlab} %} if patches.stag, assert(all(mod(nPatch,2)==0), ... 'Require an even number of patches for staggered grid') end %{ \end{matlab} \paragraph{Set the macro-distribution of patches} Third, set the centre of the patches in the macroscale grid of patches. Loop over the coordinate directions, setting the distribution into~\verb|Q| and finally assigning to array of corresponding direction. \begin{matlab} %} for q=1:3 qq=2*q-1; %{ \end{matlab} Distribution depends upon \verb|Dom.type|: \begin{matlab} %} switch Dom.type(q,:) %{ \end{matlab} %: case periodic The periodic case is evenly spaced within the spatial domain. Store the size ratio in \verb|patches|. \begin{matlab} %} case 'periodic' Q=linspace(Xlim(qq),Xlim(qq+1),nPatch(q)+1); DQ=Q(2)-Q(1); Q=Q(1:nPatch(q))+diff(Q)/2; pEI=patches.EdgyInt;% abbreviation pnE=patches.nEdge(q);% abbreviation if pre2023, dx(q) = ratio(q)*DQ/(nSubP(q)-pnE*(1+pEI))*(2-pEI); else ratio(q) = dx(q)/DQ*(nSubP(q)-pnE*(1+pEI))/(2-pEI); end patches.ratio=ratio; %{ \end{matlab} %: case equispace The equi-spaced case is also evenly spaced but with the extreme edges aligned with the spatial domain boundaries, modified by the offset. \begin{matlab} %} case 'equispace' Q=linspace(Xlim(qq)+((nSubP(q)-1)/2-Dom.bcOffset(qq))*dx(q) ... ,Xlim(qq+1)-((nSubP(q)-1)/2-Dom.bcOffset(qq+1))*dx(q) ... ,nPatch(q)); DQ=diff(Q(1:2)); width=(1+patches.EdgyInt)/2*(nSubP(q)-1-patches.EdgyInt)*dx; if DQ<width*0.999999 warning('too many equispace patches (double overlapping)') end %{ \end{matlab} %: case chebyshev The Chebyshev case is spaced according to the Chebyshev distribution in order to reduce macro-interpolation errors, \(Q_i \propto -\cos(i\pi/N)\), but with the extreme edges aligned with the spatial domain boundaries, modified by the offset, and modified by possible `boundary layers'. \footnote{ However, maybe overlapping patches near a boundary should be viewed as some sort of spatially analogue of the `christmas tree' of projective integration and its integration to a slow manifold. Here maybe the overlapping patches allow for a `christmas tree' approach to the boundary layers. Needs to be explored??} \begin{matlab} %} case 'chebyshev' halfWidth=dx(q)*(nSubP(q)-1)/2; Q1 = Xlim(1)+halfWidth-Dom.bcOffset(qq)*dx(q); Q2 = Xlim(2)-halfWidth+Dom.bcOffset(qq+1)*dx(q); % Q = (Q1+Q2)/2-(Q2-Q1)/2*cos(linspace(0,pi,nPatch)); %{ \end{matlab} Search for total width of `boundary layers' so that in the interior the patches are non-overlapping Chebyshev. But the width for assessing overlap of patches is the following variable \verb|width|. \begin{matlab} %} pEI=patches.EdgyInt; % abbreviation pnE=patches.nEdge(q);% abbreviation width=(1+pEI)/2*(nSubP(q)-pnE*(1+pEI))*dx(q); for b=0:2:nPatch(q)-2 DQmin=(Q2-Q1-b*width)/2*( 1-cos(pi/(nPatch(q)-b-1)) ); if DQmin>width, break, end end%for if DQmin<width*0.999999 warning('too many Chebyshev patches (mid-domain overlap)') end%if %{ \end{matlab} Assign the centre-patch coordinates. \begin{matlab} %} Q =[ Q1+(0:b/2-1)*width ... (Q1+Q2)/2-(Q2-Q1-b*width)/2*cos(linspace(0,pi,nPatch(q)-b)) ... Q2+(1-b/2:0)*width ]; %{ \end{matlab} %: case usergiven The user-given case is entirely up to a user to specify, we just ensure it has the correct shape of a row. \begin{matlab} %} case 'usergiven' if q==1, Q = reshape(Dom.X,1,[]); end if q==2, Q = reshape(Dom.Y,1,[]); end if q==3, Q = reshape(Dom.Z,1,[]); end end%switch Dom.type %{ \end{matlab} Assign \(Q\)-coordinates to the correct spatial direction. At this stage they are all rows. \begin{matlab} %} if q==1, X=Q; end if q==2, Y=Q; end if q==3, Z=Q; end end%for q %{ \end{matlab} \paragraph{Construct the micro-grids} Fourth, construct the microscale grid in each patch, centred about the given mid-points~\verb|X,Y,Z|. Reshape the grid to be 8D to suit dimensions (micro,Vars,Ens,macro). \begin{matlab} %} xs = dx(1)*( (1:nSubP(1))-mean(1:nSubP(1)) ); patches.x = reshape( xs'+X ... ,nSubP(1),1,1,1,1,nPatch(1),1,1); ys = dx(2)*( (1:nSubP(2))-mean(1:nSubP(2)) ); patches.y = reshape( ys'+Y ... ,1,nSubP(2),1,1,1,1,nPatch(2),1); zs = dx(3)*( (1:nSubP(3))-mean(1:nSubP(3)) ); patches.z = reshape( zs'+Z ... ,1,1,nSubP(3),1,1,1,1,nPatch(3)); %{ \end{matlab} \paragraph{Pre-compute weights for macro-periodic} In the case of macro-periodicity, precompute the weightings to interpolate field values for coupling. \todo{Might sometime extend to coupling via derivative values.} \begin{matlab} %} if patches.periodic ratio = reshape(ratio,1,3); % force to be row vector patches.ratio = ratio; if ordCC>0 [Cwtsr,Cwtsl] = patchCwts(ratio,ordCC,patches.stag); patches.Cwtsr = Cwtsr; patches.Cwtsl = Cwtsl; end%if end%if patches.periodic %{ \end{matlab} \subsection{Set ensemble inter-patch communication} For \verb|EdgyInt| or centre interpolation respectively, \begin{itemize} \item the right-face\slash centre realisations \verb|1:nEnsem| are to interpolate to left-face~\verb|le|, and \item the left-face\slash centre realisations \verb|1:nEnsem| are to interpolate to~\verb|re|. \end{itemize} \verb|re| and \verb|li| are `transposes' of each other as \verb|re(li)=le(ri)| are both \verb|1:nEnsem|. Similarly for bottom-face\slash centre interpolation to top-face via~\verb|to|, top-face\slash centre interpolation to bottom-face via~\verb|bo|, back-face\slash centre interpolation to front-face via~\verb|fr|, and front-face\slash centre interpolation to back-face via~\verb|ba|. The default is nothing shifty. This setting reduces the number of if-statements in function \verb|patchEdgeInt3()|. \begin{matlab} %} nE = patches.nEnsem; patches.le = 1:nE; patches.ri = 1:nE; patches.bo = 1:nE; patches.to = 1:nE; patches.ba = 1:nE; patches.fr = 1:nE; %{ \end{matlab} However, if heterogeneous coefficients are supplied via \verb|hetCoeffs|, then do some non-trivial replications. First, get microscale periods, patch size, and replicate many times in order to subsequently sub-sample: \verb|nSubP| times should be enough. If \verb|cs| is more then 4D, then the higher-dimensions are reshaped into the 4th dimension. \begin{matlab} %} if ~isempty(cs) [mx,my,mz,nc] = size(cs); nx = nSubP(1); ny = nSubP(2); nz = nSubP(3); cs = repmat(cs,nSubP); %{ \end{matlab} If only one member of the ensemble is required, then sub-sample to patch size, and store coefficients in \verb|patches| as is. \begin{matlab} %} if nE==1, patches.cs = cs(1:nx-1,1:ny-1,1:nz-1,:); else %{ \end{matlab} But for $\verb|nEnsem|>1$ an ensemble of $m_xm_ym_z$~phase-shifts of the coefficients is constructed from the over-supply. Here code phase-shifts over the periods---the phase shifts are like Hankel-matrices. \begin{matlab} %} patches.nEnsem = mx*my*mz; patches.cs = nan(nx-1,ny-1,nz-1,nc,mx,my,mz); for k = 1:mz ks = (k:k+nz-2); for j = 1:my js = (j:j+ny-2); for i = 1:mx is = (i:i+nx-2); patches.cs(:,:,:,:,i,j,k) = cs(is,js,ks,:); end end end patches.cs = reshape(patches.cs,nx-1,ny-1,nz-1,nc,[]); %{ \end{matlab} Further, set a cunning left\slash right\slash bottom\slash top\slash front\slash back realisation of inter-patch coupling. The aim is to preserve symmetry in the system when also invoking \verb|EdgyInt|. What this coupling does without \verb|EdgyInt| is unknown. Use auto-replication. \begin{matlab} %} mmx=(0:mx-1)'; mmy=0:my-1; mmz=shiftdim(0:mz-1,-1); le = mod(mmx+mod(nx-2,mx),mx)+1; patches.le = reshape( le+mx*(mmy+my*mmz) ,[],1); ri = mod(mmx-mod(nx-2,mx),mx)+1; patches.ri = reshape( ri+mx*(mmy+my*mmz) ,[],1); bo = mod(mmy+mod(ny-2,my),my)+1; patches.bo = reshape( 1+mmx+mx*(bo-1+my*mmz) ,[],1); to = mod(mmy-mod(ny-2,my),my)+1; patches.to = reshape( 1+mmx+mx*(to-1+my*mmz) ,[],1); ba = mod(mmz+mod(nz-2,mz),mz)+1; patches.ba = reshape( 1+mmx+mx*(mmy+my*(ba-1)) ,[],1); fr = mod(mmz-mod(nz-2,mz),mz)+1; patches.fr = reshape( 1+mmx+mx*(mmy+my*(fr-1)) ,[],1); %{ \end{matlab} Issue warning if the ensemble is likely to be affected by lack of scale separation. \todo{Need to justify this and the arbitrary threshold more carefully??} \begin{matlab} %} if prod(ratio)*patches.nEnsem>0.9, warning( ... 'Probably poor scale separation in ensemble of coupled phase-shifts') scaleSeparationParameter = ratio*patches.nEnsem end %{ \end{matlab} End the two if-statements. \begin{matlab} %} end%if-else nEnsem>1 end%if not-empty(cs) %{ \end{matlab} \paragraph{If parallel code} then first assume this is not within an \verb|spmd|-environment, and so we invoke \verb|spmd...end| (which starts a parallel pool if not already started). At this point, the global \verb|patches| is copied for each worker processor and so it becomes \emph{composite} when we distribute any one of the fields. Hereafter, {\em all fields in the global variable \verb|patches| must only be referenced within an \verb|spmd|-environment.}% \footnote{If subsequently outside spmd, then one must use functions like \texttt{getfield(patches\{1\},'a')}.} \begin{matlab} %} if patches.parallel spmd %{ \end{matlab} Second, decide which dimension is to be sliced among parallel workers (for the moment, do not consider slicing the ensemble). Choose the direction of most patches, biased towards the last. \begin{matlab} %} [~,pari]=max(nPatch+0.01*(1:3)); patches.codist=codistributor1d(5+pari); %{ \end{matlab} \verb|patches.codist.Dimension| is the index that is split among workers. Then distribute the appropriate coordinate direction among the workers: the function must be invoked inside an \verb|spmd|-group in order for this to work---so we do not need \verb|parallel| in argument list. \begin{matlab} %} switch pari case 1, patches.x=codistributed(patches.x,patches.codist); case 2, patches.y=codistributed(patches.y,patches.codist); case 3, patches.z=codistributed(patches.z,patches.codist); otherwise error('should never have bad index for parallel distribution') end%switch end%spmd %{ \end{matlab} If not parallel, then clean out \verb|patches.codist| if it exists. May not need, but safer. \begin{matlab} %} else% not parallel if isfield(patches,'codist'), rmfield(patches,'codist'); end end%if-parallel %{ \end{matlab} \paragraph{Fin} \begin{matlab} %} end% function %{ \end{matlab} \end{devMan} %}
github
uoa1184615/EquationFreeGit-master
quasiLogAxes.m
.m
EquationFreeGit-master/Patch/quasiLogAxes.m
7,787
utf_8
2e66a0625f73ccf8ead15ef75a5bde19
% quasiLogAxes() transforms selected axes of the given plot % to a quasi-log axes (via asinh), including possibly % transforming color axis. AJR, 25 Sep 2021 -- 18 Apr 2023 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{quasiLogAxes()}: transforms some axes of a plot to quasi-log} \label{sec:quasiLogAxes} This function rescales some coordinates and labels the axes of the given 2D or 3D~plot. The original aim was to effectively show the complex spectrum of multiscale systems such as the patch scheme. The eigenvalues are over a wide range of magnitudes, but are signed. So we use a nonlinear asinh transformation of the axes, and then label the axes with reasonable ticks. The nonlinear rescaling is useful in other scenarios also. \begin{matlab} %} function quasiLogAxes(handle,xScale,yScale,zScale,cScale) %{ \end{matlab} \paragraph{Input} \begin{itemize} \item \verb|handle|: handle to your plot to transform, for example, obtained by \verb|handle=plot(...)| \item \verb|xScale| (optional, default~inf): if inf, then no transformation is done in the `x'-coordinate. Otherwise, when \verb|xScale| is not inf, transforms the plot \(x\)-coordinates with the \(\text{asinh}()\) function so that \begin{itemize} \item for \(|x|\lesssim x_{\text{scale}}\) the x-axis scaling is approximately linear, whereas \item for \(|x|\gtrsim x_{\text{scale}}\) the x-axis scaling is approximately signed-logarithmic. \end{itemize} \item \verb|yScale| (optional, default~inf): corresponds to \verb|xScale| for the second axis scaling. \item \verb|zScale| (optional, default~inf): corresponds to \verb|xScale| for a third axis scaling if it exists. \item \verb|cScale| (optional, default~inf): corresponds to \verb|xScale| but for a colormap, and colorbar scaling if one exists. \end{itemize} \paragraph{Output} None, just the transformed plot. \paragraph{Example} If invoked with no arguments, then execute an example. \begin{matlab} %} if nargin==0 % generate some data n=99; fast=(rand(n,1)<0.8); z = -rand(n,1).*(1+1e3*fast)+1i*randn(n,1).*(5+1e2*fast); % plot data and transform axes handle = plot(real(z),imag(z),'.'); xlabel('real-part'), ylabel('imag-part') quasiLogAxes(handle,1,10); return end% example %{ \end{matlab} Default values for scaling, \verb|inf| denotes no transformation of that axis. \begin{matlab} %} if nargin<5, cScale=inf; end if nargin<4, zScale=inf; end if nargin<3, yScale=inf; end if nargin<2, xScale=inf; end %{ \end{matlab} \begin{devMan} Get current limits of the plot to use if the user has set them already. And also get the pointer to the axes and to the figure of the plot. \begin{matlab} %} xlim0=xlim; ylim0=ylim; zlim0=zlim; clim0=caxis; theAxes = get(handle(1),'parent'); theFig = get(theAxes,'parent'); %{ \end{matlab} Find overall factors so the data is nonlinearly mapped to order oneish---so that then pgfplots et al.\ do not think there is an overall scaling factor on the axes. \begin{matlab} %} xFac=1e-99; yFac=xFac; zFac=xFac; cFac=xFac; for k=1:length(handle) if ~isinf(xScale) temp = asinh(handle(k).XData/xScale); xFac = max(xFac, max(abs(temp(:)),[],'omitnan') ); end if ~isinf(yScale) temp = asinh(handle(k).YData/yScale); yFac = max(yFac, max(abs(temp(:)),[],'omitnan') ); end if ~isinf(zScale) temp = asinh(handle(k).ZData/zScale); zFac = max(zFac, max(abs(temp(:)),[],'omitnan') ); end if ~isinf(cScale) temp = asinh(handle(k).CData/cScale); cFac = max(cFac, max(abs(temp(:)),[],'omitnan') ); end end%for xFac=9/xFac; yFac=9/yFac; zFac=9/zFac; cFac=9/cFac; %{ \end{matlab} Scale the plot data in the plot \verb|handle|. Give an error if it appears that the plot-data has already been transformed. Color data has to be transformed first because usually there is automatic flow from z-data to c-data. \begin{matlab} %} for k=1:length(handle) assert(~strcmp(handle(k).UserData,'quasiLogAxes'), ... 'Replot graph---it appears plot data is already transformed') if ~isinf(cScale) handle(k).CData = cFac*asinh(handle(k).CData/cScale); clim1=[min(handle(k).CData(:)) max(handle(k).CData(:))]; end if ~isinf(xScale) handle(k).XData = xFac*asinh(handle(k).XData/xScale); xlim1=[min(handle(k).XData(:)) max(handle(k).XData(:))]; end if ~isinf(yScale) handle(k).YData = yFac*asinh(handle(k).YData/yScale); ylim1=[min(handle(k).YData(:)) max(handle(k).YData(:))]; end if ~isinf(zScale) handle(k).ZData = zFac*asinh(handle(k).ZData/zScale); zlim1=[min(handle(k).ZData(:)) max(handle(k).ZData(:))]; end handle(k).UserData = 'quasiLogAxes'; end%for %{ \end{matlab} Set 4\%~padding around all margins of transformed data---crude but serviceable. Unless the axis had already been manually set, in which case use the transformed set limits. \begin{matlab} %} if ~isinf(xScale), if xlim('mode')=="manual" xlim1=xFac*asinh(xlim0/xScale); else xlim1=xlim1+0.04*diff(xlim1)*[-1 1]; end, end if ~isinf(yScale), if ylim('mode')=="manual" ylim1=yFac*asinh(ylim0/yScale); else ylim1=ylim1+0.04*diff(ylim1)*[-1 1]; end, end if ~isinf(zScale), if zlim('mode')=="manual" zlim1=zFac*asinh(zlim0/zScale); else zlim1=zlim1+0.04*diff(zlim1)*[-1 1]; end, end if ~isinf(cScale), if theAxes.CLimMode=="manual" clim1=cFac*asinh(clim0/cScale); else clim1=clim1+ 0*diff(clim1)*[-1 1]; end, end %{ \end{matlab} \paragraph{Scale axes, and tick marks on axes} \begin{matlab} %} if ~isinf(xScale) xlim(xlim1); tickingQuasiLogAxes(theAxes,'X',xlim1,xScale,xFac) end%if if ~isinf(yScale) ylim(ylim1); tickingQuasiLogAxes(theAxes,'Y',ylim1,yScale,yFac) end%if if ~isinf(zScale) zlim(zlim1); tickingQuasiLogAxes(theAxes,'Z',zlim1,zScale,zFac) end%if %{ \end{matlab} But for color, only tick when we find a colorbar. \begin{matlab} %} if ~isinf(cScale) caxis(clim1); for p=1:numel(theFig.Children) ca = theFig.Children(p); if class(ca) == "matlab.graphics.illustration.ColorBar" tickingQuasiLogAxes(ca,'C',clim1,cScale,cFac) break end end end%if %{ \end{matlab} Turn the grid on by default. \begin{matlab} %} grid on end%function %{ \end{matlab} \subsection{\texttt{tickingQuasiLogAxes()}: typeset ticks and labels on an axis} \begin{matlab} %} function tickingQuasiLogAxes(ca,Q,qlim1,qScale,qFac) %{ \end{matlab} \paragraph{Input} \begin{itemize} \item \verb|ca|: pointer to axes/colorbar dataset. \item \verb|Q|: character, either \texttt{X,Y,Z,C}. \item \verb|qlim1|: the scaled limits of the axis. \item \verb|qScale|: the scaling parameter for the axis. \item \verb|qFac|: the scaling factor for the axis. \end{itemize} \paragraph{Output} None, just the ticked and labelled axes. Get the order of magnitude of the horizontal data. \begin{matlab} %} qmax=max(abs(qlim1)); qmag=floor(log10(qScale*sinh(qmax/qFac))); %{ \end{matlab} Form a range of ticks, geometrically spaced, trim off the small values that would be too dense near zero (omit those within 6\% of \verb|qmax|). \begin{matlab} %} ticks=10.^(qmag+(-7:0)); j=find(ticks>qScale*sinh(0.06*qmax/qFac)); nj=length(j); if nj<3, ticks=[1;2;5]*ticks(j); elseif nj<5, ticks=[1;3]*ticks(j); else ticks=ticks(j); end ticks=sort([0;ticks(:);-ticks(:)]); %{ \end{matlab} Set the ticks in place according to the transformation. \begin{matlab} %} if Q=='C', p='s'; Q=''; else p=''; end set(ca,[Q 'Tick' p],qFac*asinh(ticks/qScale) ... ,[Q 'TickLabel' p],cellstr(num2str(ticks,4))) if Q=='X', set(ca,[Q 'TickLabelRotation'],40), end end%function qScaling %{ \end{matlab} \end{devMan} %}
github
uoa1184615/EquationFreeGit-master
idealWavePDE.m
.m
EquationFreeGit-master/Patch/idealWavePDE.m
2,006
utf_8
0a2c31be68f6887c7e2742e1896492fe
% Codes the ideal wave PDE on a staggered 1D grid inside % patches in space. Used by waterWaveExample.m % AJR, 4 Apr 2019 -- Nov 2020 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \subsection{\texttt{idealWavePDE()}: ideal wave PDE} \label{sec:idealWavePDE} This function codes the staggered lattice equation inside the patches for the ideal wave \pde\ system \(h_t=-u_x\) and \(u_t=-h_x\). Here code for a staggered micro-grid, index~\(i\), of staggered macroscale patches, index~\(j\): the array \begin{equation*} U_{ij}=\begin{cases} u_{ij}&i+j\text{ even},\\ h_{ij}& i+j\text{ odd}. \end{cases} \end{equation*} The output~\verb|Ut| contains the merged time derivatives of the two staggered fields. So set the micro-grid spacing and reserve space for time derivatives. \begin{matlab} %} function Ut = idealWavePDE(t,U,patches) dx = diff(patches.x(2:3)); U = squeeze(U); Ut = nan(size(U)); ht = Ut; %{ \end{matlab} Compute the \pde\ derivatives only at interior micro-grid points of the patches. \begin{matlab} %} i = 2:size(U,1)-1; %{ \end{matlab} Here `wastefully' compute time derivatives for both \pde{}s at all grid points---for simplicity---and then merge the staggered results. Since \(\dot h_{ij} \approx -(u_{i+1,j} -u_{i-1,j}) /(2\cdot dx) =-(U_{i+1,j} -U_{i-1,j}) /(2\cdot dx)\) as adding\slash subtracting one from the index of a \(h\)-value is the location of the neighbouring \(u\)-value on the staggered micro-grid. \begin{matlab} %} ht(i,:) = -(U(i+1,:)-U(i-1,:))/(2*dx); %{ \end{matlab} Since \(\dot u_{ij} \approx -(h_{i+1,j} -h_{i-1,j}) /(2\cdot dx) =-(U_{i+1,j} -U_{i-1,j}) /(2\cdot dx)\) as adding\slash subtracting one from the index of a \(u\)-value is the location of the neighbouring \(h\)-value on the staggered micro-grid. \begin{matlab} %} Ut(i,:) = -(U(i+1,:)-U(i-1,:))/(2*dx); %{ \end{matlab} Then overwrite the unwanted~\(\dot u_{ij}\) with the corresponding wanted~\(\dot h_{ij}\). \begin{matlab} %} Ut(patches.hPts) = ht(patches.hPts); end %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
heteroWave.m
.m
EquationFreeGit-master/Patch/heteroWave.m
1,364
utf_8
b07ccdac5060fc6af73096ee80efc543
% Computes the time derivatives of heterogeneous wave % in 1D on patches. Used by homoWaveEdgy1.m, % AJR, 26 Nov 2019 -- Nov 2020 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \subsection{\texttt{heteroWave()}: wave in heterogeneous media with weak viscous damping} \label{sec:heteroWave} This function codes the lattice heterogeneous wave equation, with weak viscosity, inside the patches. For 3D input array~\verb|u| (\(u_{ij} = \verb|u(i,1,j)|\) and \(v_{ij} = \verb|u(i,2,j)|\)) and 2D array~\verb|x| (obtained in full via edge-value interpolation of \verb|patchSys1|, \cref{sec:patchSys1}), computes the time derivatives at each point in the interior of a patch, output in~\verb|ut|: \begin{equation*} \D t{u_{ij}}=v_{ij}\,,\quad \D t{v_{ij}}= \frac1{dx^2}\delta[c_{i-1/2}\delta u_{ij}] +\frac{0.02}{dx^2}\delta^2 v_{ij}\,. \end{equation*} The column vector (or possibly array) of diffusion coefficients~\(c_i\) have previously been stored in struct~\verb|patches|. \begin{matlab} %} function ut = heteroWave(t,u,patches) u = squeeze(u); dx = diff(patches.x(2:3)); % space step i = 2:size(u,1)-1; % interior points in a patch ut = nan(size(u)); % preallocate output array ut(i,1,:) = u(i,2,:); % du/dt=v then dvdt= ut(i,2,:) = diff(patches.cs.*diff(u(:,1,:)))/dx^2 ... +0.02*diff(u(:,2,:),2)/dx^2; end% function %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
heteroLanLif1D.m
.m
EquationFreeGit-master/Patch/heteroLanLif1D.m
2,278
utf_8
d1c006eb26861126db87a18042695e33
% Computes the time derivatives of heterogeneous % Landau--Lifshitz PDE on 1D lattice within spatial patches. % From Leitenmaier & Runborg, arxiv.org/abs/2108.09463 and % used by homoLanLif1D.m AJR, Sep 2021 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \subsection{\texttt{heteroLanLif1D()}: heterogeneous Landau--Lifshitz PDE} \label{sec:heteroLanLif1D} This function codes the lattice heterogeneous Landau--Lifshitz PDE \cite[(1.1)]{Leitenmaier2021} inside patches in 1D space. For 4D input array~\verb|M| storing the three components of~\Mv\ (via edge-value interpolation of \verb|patchSys1|, \cref{sec:patchSys1}), computes the time derivative at each point in the interior of a patch, output in~\verb|Mt|. The column vector of coefficients \(c_i=1+\tfrac12\sin(2\pi x_i/\epsilon)\) have previously been stored in struct~\verb|patches.cs|. \begin{itemize} \item With \verb|ex5p1=0| computes the example \textsc{ex1} \cite[p.6]{Leitenmaier2021}. \item With \verb|ex5p1=1| computes the first 'locally periodic' example \cite[p.27]{Leitenmaier2021}. \end{itemize} \begin{matlab} %} function Mt = heteroLanLif1D(t,M,patches) global alpha ex5p1 dx = diff(patches.x(2:3)); % space step %{ \end{matlab} Compute the heterogeneous \(\Hv:=\divv(a\grad\Mv)\) \begin{matlab} %} a = patches.cs ... +ex5p1*(0.1+0.25*sin(2*pi*(patches.x(2:end,:,:,:)-dx/2)+1.1)); H = diff(a.*diff(M))/dx^2; %{ \end{matlab} At each microscale grid point, compute the cross-products \(\Mv\times \Hv\) and \(\Mv\times(\Mv\times \Hv)\) to then give the time derivative \(\Mv_t=-\Mv\times \Hv -\alpha \Mv\times (\Mv\times \Hv)\) \cite[(1.1)]{Leitenmaier2021}: \begin{matlab} %} i = 2:size(M,1)-1; % interior points in a patch MH=nan+H; % preallocate for MxH MH(:,3,:,:) = M(i,1,:,:).*H(:,2,:,:)-M(i,2,:,:).*H(:,1,:,:); MH(:,2,:,:) = M(i,3,:,:).*H(:,1,:,:)-M(i,1,:,:).*H(:,3,:,:); MH(:,1,:,:) = M(i,2,:,:).*H(:,3,:,:)-M(i,3,:,:).*H(:,2,:,:); MMH=nan+H; % preallocate for MxMxH MMH(:,3,:,:)= M(i,1,:,:).*MH(:,2,:,:)-M(i,2,:,:).*MH(:,1,:,:); MMH(:,2,:,:)= M(i,3,:,:).*MH(:,1,:,:)-M(i,1,:,:).*MH(:,3,:,:); MMH(:,1,:,:)= M(i,2,:,:).*MH(:,3,:,:)-M(i,3,:,:).*MH(:,2,:,:); Mt = nan+M; % preallocate output array Mt(i,:,:,:) = -MH-alpha*MMH; end% function %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
heteroDiff3.m
.m
EquationFreeGit-master/Patch/heteroDiff3.m
1,917
utf_8
1cd7c41c67dc5bb4941e58b0db310269
% heteroDiff3() computes the time derivatives of % heterogeneous diffusion in 3D on patches. Adapted from 2D % heterogeneous diffusion. JEB & AJR, May--Sep 2020 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \subsection{\texttt{heteroDiff3()}: heterogeneous diffusion} \label{sec:heteroDiff3} This function codes the lattice heterogeneous diffusion inside the patches. For 8D input array~\verb|u| (via edge-value interpolation of \verb|patchEdgeInt3|, such as by \verb|patchSys3|, \cref{sec:patchSys3}), computes the time derivative~\cref{eq:HomogenisationExample} at each point in the interior of a patch, output in~\verb|ut|. The three 3D array of diffusivities,~$c^x_{ijk}$, $c^y_{ijk}$ and~$c^z_{ijk}$, have previously been stored in~\verb|patches.cs| (4+D). Supply patch information as a third argument (required by parallel computation), or otherwise by a global variable. \begin{matlab} %} function ut = heteroDiff3(t,u,patches) if nargin<3, global patches, end %{ \end{matlab} Microscale space-steps. Q: is using \verb|i,j,k| slower than \verb|2:end-1|?? \begin{matlab} %} dx = diff(patches.x(2:3)); % x micro-scale step dy = diff(patches.y(2:3)); % y micro-scale step dz = diff(patches.z(2:3)); % z micro-scale step i = 2:size(u,1)-1; % x interior points in a patch j = 2:size(u,2)-1; % y interior points in a patch k = 2:size(u,3)-1; % y interior points in a patch %{ \end{matlab} Reserve storage and then assign interior patch values to the heterogeneous diffusion time derivatives. Using \verb|nan+u| appears quicker than \verb|nan(size(u),patches.codist)| \begin{matlab} %} ut = nan+u; % reserve storage ut(i,j,k,:,:,:,:,:) ... = diff(patches.cs(:,j,k,1,:).*diff(u(:,j,k,:,:,:,:,:),1),1)/dx^2 ... +diff(patches.cs(i,:,k,2,:).*diff(u(i,:,k,:,:,:,:,:),1,2),1,2)/dy^2 ... +diff(patches.cs(i,j,:,3,:).*diff(u(i,j,:,:,:,:,:,:),1,3),1,3)/dz^2; end% function %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
monoscaleDiffEquil2.m
.m
EquationFreeGit-master/Patch/monoscaleDiffEquil2.m
6,326
utf_8
e4091ed6937be2ebd3555e0a9985035e
% Solve for steady state of monoscale heterogeneous % diffusion in 2D on patches as an example application, from % section 5.2 of Freese, 2211.13731. AJR, 31 Jan 2023 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{monoscaleDiffEquil2}: equilibrium of a 2D monoscale heterogeneous diffusion via small patches} \label{sec:monoscaleDiffEquil2} Here we find the steady state~\(u(x,y)\), see \cref{fig:monoscaleDiffEquil2}, to the heterogeneous \pde (inspired by Freese et al.\footnote{ \protect \url{http://arxiv.org/abs/2211.13731}} \S5.2) \begin{equation*} u_t=A(x,y)\grad\grad u-f, \end{equation*} on domain \([-1,1]^2\) with Dirichlet BCs, for coefficient pseudo-diffusion matrix \begin{equation*} A:=\begin{bmatrix} 2& a\\a & 2 \end{bmatrix} \quad \text{with } a:=\sign(xy) \text{ or }a:=\sin(\pi x)\sin(\pi y), \end{equation*} and for forcing~\(f(x,y)\) such that the exact equilibrium is \(u = x\big(1-e^{1-|x|}\big) y \big(1-e^{1-|y|}\big)\). But for simplicity, let's obtain \(u = x(1-x^2) y(1-y^2)\) for which we code~\(f\) later---as determined by this Reduce algebra code. \begin{figure} \centering\begin{tabular}{@{}c@{\ }c@{}} \parbox[t]{10em}{\caption{\label{fig:monoscaleDiffEquil2}% Equilibrium of the macroscale diffusion problem of Freese with Dirichlet zero-value boundary conditions (\cref{sec:monoscaleDiffEquil2}). The patch size is not small so we can see the patches.}} & \def\extraAxisOptions{label shift={-1.5ex}} \raisebox{-\height}{\input{../Patch/Figs/monoscaleDiffEquil2}} \end{tabular} \end{figure} %let { df(sign(~x),~x)=>0 % , df(abs(~x),~x)=>sign(x) % , abs(~x)^2=>abs(x), sign(~x)^2=>1 }; %u:=x*(1-exp(1-abs(x)))*y*(1-exp(1-abs(y))); \begin{verbatim} on gcd; factor sin; u:=x*(1-x^2)*y*(1-y^2); a:=sin(pi*x)*sin(pi*y); f:=2*df(u,x,x)+2*a*df(u,x,y)+2*df(u,y,y); \end{verbatim} Clear, and initiate globals. \begin{matlab} %} clear all global patches %global OurCf2eps, OurCf2eps=true %option to save plot %{ \end{matlab} \paragraph{Patch configuration} Initially use \(7\times7\) patches in the square \((-1,1)^2\). For continuous forcing we may have small patches of any reasonable microgrid spacing---here the microgrid error dominates. \begin{matlab} %} nPatch = 7 nSubP = 5 dx = 0.03 %{ \end{matlab} Specify some order of interpolation. \begin{matlab} %} configPatches2(@monoscaleDiffForce2,[-1 1 -1 1],'equispace' ... ,nPatch ,4 ,dx ,nSubP ,'EdgyInt',true ); %{ \end{matlab} Compute the time-constant coefficient and time-constant forcing, and store them in struct \verb|patches| for access by the microcode of \cref{sec:monoscaleDiffForce2}. \begin{matlab} %} x=patches.x; y=patches.y; patches.A = sin(pi*x).*sin(pi*y); patches.fu = ... +2*patches.A.*(9*x.^2.*y.^2-3*x.^2-3*y.^2+1) ... +12*x.*y.*(x.^2+y.^2-2); %{ \end{matlab} By construction, the \pde\ has analytic solution \begin{matlab} %} uAnal = x.*(1-x.^2).*y.*(1-y.^2); %{ \end{matlab} \paragraph{Solve for steady state} Set initial guess of zero, with \verb|NaN| to indicate patch-edge values. Index~\verb|i| are the indices of patch-interior points, and the number of unknowns is then its length. \begin{matlab} %} u0 = zeros(nSubP,nSubP,1,1,nPatch,nPatch); u0([1 end],:,:) = nan; u0(:,[1 end],:) = nan; patches.i = find(~isnan(u0)); nVariables = numel(patches.i) %{ \end{matlab} Solve by iteration. Use \verb|fsolve| for simplicity and robustness (using \verb|optimoptions| to omit its trace information), and give magnitudes. \begin{matlab} %} tic; uSoln = fsolve(@theRes,u0(patches.i) ... ,optimoptions('fsolve','Display','off')); solnTime = toc normResidual = norm(theRes(uSoln)) normSoln = norm(uSoln) normError = norm(uSoln-uAnal(patches.i)) %{ \end{matlab} Store the solution vector into the patches, and interpolate, but have not bothered to set boundary values so they stay NaN from the interpolation. \begin{matlab} %} u0(patches.i) = uSoln; u0 = patchEdgeInt2(u0); %{ \end{matlab} \paragraph{Draw solution profile} Separate patches with NaNs, then reshape arrays to suit 2D space surface plots. \begin{matlab} %} figure(1), clf, colormap(0.8*hsv) x(end+1,:,:)=nan; u0(end+1,:,:)=nan; y(:,end+1,:)=nan; u0(:,end+1,:)=nan; u = reshape(permute(squeeze(u0),[1 3 2 4]), [numel(x) numel(y)]); %{ \end{matlab} Draw the patch solution surface, with boundary-values omitted as already~\verb|NaN| by not bothering to set them. \begin{matlab} %} mesh(x(:),y(:),u'); view(60,55) xlabel('space $x$'), ylabel('space $y$'), zlabel('$u(x,y)$') ifOurCf2tex(mfilename)%optionally save %{ \end{matlab} \subsection{\texttt{monoscaleDiffForce2()}: microscale discretisation inside patches of forced diffusion PDE} \label{sec:monoscaleDiffForce2} This function codes the lattice heterogeneous diffusion of the \pde\ inside the patches. For 6D input arrays~\verb|u|, \verb|x|, and~\verb|y|, computes the time derivative at each point in the interior of a patch, output in~\verb|ut|. \begin{matlab} %} function ut = monoscaleDiffForce2(t,u,patches) dx = diff(patches.x(2:3)); % x space step dy = diff(patches.y(2:3)); % y space step i = 2:size(u,1)-1; % x interior points in a patch j = 2:size(u,2)-1; % y interior points in a patch ut = nan+u; % preallocate output array %{ \end{matlab} Set Dirichlet boundary value of zero around the square domain. \begin{matlab} %} u( 1 ,:,:,:, 1 ,:)=0; % left edge of left patches u(end,:,:,:,end,:)=0; % right edge of right patches u(:, 1 ,:,:,:, 1 )=0; % bottom edge of bottom patches u(:,end,:,:,:,end)=0; % top edge of top patches %{ \end{matlab} Or code some function variation around the boundary, such as a function of~\(y\) on the left boundary, and a (constant) function of~\(x\) at the top boundary. \begin{matlab} %} if 0 u(1,:,:,:,1,:)=(1+patches.y)/2; % left edge of left patches u(:,end,:,:,:,end)=1; % top edge of top patches end%if %{ \end{matlab} Compute the time derivatives via stored forcing and coefficients. Easier to code by conflating the last four dimensions into the one~\verb|,:|. \begin{matlab} %} ut(i,j,:) ... = 2*diff(u(:,j,:),2,1)/dx^2 +2*diff(u(i,:,:),2,2)/dy^2 ... +2*patches.A(i,j,:).*( u(i+1,j+1,:) -u(i-1,j+1,:) ... -u(i+1,j-1,:) +u(i-1,j-1,:) )/(4*dx*dy) ... -patches.fu(i,j,:); end%function monoscaleDiffForce2 %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
heteroDiff2.m
.m
EquationFreeGit-master/Patch/heteroDiff2.m
1,225
utf_8
967c37585d32078f06055a9df468bf78
% Computes the time derivatives of heterogeneous diffusion % in 2D on patches. Adapted from 1D heterogeneous diffusion. % JEB & AJR, May 2020 -- Nov 2020 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \subsection{\texttt{heteroDiff2()}: heterogeneous diffusion} \label{sec:heteroDiff2} This function codes the lattice heterogeneous diffusion inside the patches. For 6D input arrays~\verb|u|, \verb|x|, and~\verb|y| (via edge-value interpolation of \verb|patchSys2|, \cref{sec:patchSys2}), computes the time derivative~\cref{eq:HomogenisationExample} at each point in the interior of a patch, output in~\verb|ut|. The two 2D array of diffusivities,~$c^x_{ij}$ and~$c^y_{ij}$, have previously been stored in~\verb|patches.cs| (3D). \begin{matlab} %} function ut = heteroDiff2(t,u,patches) dx = diff(patches.x(2:3)); % x space step dy = diff(patches.y(2:3)); % y space step ix = 2:size(u,1)-1; % x interior points in a patch iy = 2:size(u,2)-1; % y interior points in a patch ut = nan+u; % preallocate output array ut(ix,iy,:,:,:,:) ... = diff(patches.cs(:,iy,1,:).*diff(u(:,iy,:,:,:,:),1),1)/dx^2 ... +diff(patches.cs(ix,:,2,:).*diff(u(ix,:,:,:,:,:),1,2),1,2)/dy^2; end% function %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
randAdvecDiffEquil2.m
.m
EquationFreeGit-master/Patch/randAdvecDiffEquil2.m
6,879
utf_8
c3f92a6065c8df6d796e18a6ea619c96
% Solve for steady state of two-scale heterogeneous % diffusion in 2D on patches as an example application % involving Neumann boundary conditions, from section 6.2 of % Bonizzoni, 2211.15221. AJR, 1 Feb 2023 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{randAdvecDiffEquil2}: equilibrium of a 2D random heterogeneous advection-diffusion via small patches} \label{sec:randAdvecDiffEquil2} Here we find the steady state~\(u(x,y)\) of the heterogeneous \pde\ (inspired by Bonizzoni et al.\footnote{ \protect \url{http://arxiv.org/abs/2211.15221}} \S6.2) \begin{equation*} u_t=\mu_1\delsq u -(\cos\mu_2,\sin\mu_2)\cdot\grad u -u +f\,, \end{equation*} on domain \([0,1]^2\) with Neumann boundary conditions, for microscale random pseudo-diffusion and pseudo-advection coefficients, \(\mu_1(x,y)\in[0.01,0.1]\)\footnote{More interesting microscale structure arises here for~\(\mu_1\) a factor of three smaller.} and \(\mu_2(x,y)\in[0,2\pi)\), and for forcing \begin{equation*} f(x,y):=\exp\left[-\frac{(x-\mu_3)^2+(y-\mu_4)^2}{\mu_5^2}\right], \end{equation*} smoothly varying in space for fixed \(\mu_3, \mu_4 \in [0.25,0.75]\) and \(\mu_5 \in [0.1,0.25]\). The above system is dominantly diffusive for lengths scales \(\ell<0.01 = \min\mu_1\). Due to the randomness, we get different solutions each execution of this code. \cref{fig:randAdvecDiffEquil2} plots one example. A physical interpretation of the solution field is confounded because the problem is pseudo-advection-diffusion due to the varying coefficients being outside the \(\grad\)~operator. \begin{figure} \centering\caption{\label{fig:randAdvecDiffEquil2}% Equilibrium of the macroscale diffusion problem of Bonizzoni et al.\ with Neumann boundary conditions of zero (\cref{sec:randAdvecDiffEquil2}). Here the patches have a equispaced spatial distribution. The microscale periodicity, and hence the patch size, is chosen large enough to see within.} \includegraphics[scale=0.8]{Figs/randAdvecDiffEquil2} \end{figure} Clear, and initiate globals. \begin{matlab} %} clear all global patches %global OurCf2eps, OurCf2eps=true %option to save plot %{ \end{matlab} First establish the microscale heterogeneity has micro-period \verb|mPeriod| on the spatial lattice. Then \verb|configPatches2| replicates the heterogeneity to fill each patch. \begin{matlab} %} mPeriod = 4 mu1 = 0.01*10.^rand(mPeriod) mu2 = 2*pi*rand(mPeriod) cs = cat(3,mu1,cos(mu2),sin(mu2)); meanDiffAdvec=squeeze(mean(mean(cs))) %{ \end{matlab} Set the periodicity~\(\epsilon\), here big enough so we can see the patches, and other microscale parameters. \begin{matlab} %} epsilon = 0.04 dx = epsilon/mPeriod nPeriodsPatch = 1 % any integer nSubP = nPeriodsPatch*mPeriod+2 % for edgy int %{ \end{matlab} \paragraph{Patch configuration} Say use \(7\times7\) patches in \((0,1)^2\), fourth order interpolation, either `equispace' or `chebyshev', and the offset for Neumann boundary conditions: \begin{matlab} %} nPatch = 7 Dom.type= 'equispace'; Dom.bcOffset = 0.5; configPatches2(@randAdvecDiffForce2,[0 1],Dom ... ,nPatch ,4 ,dx ,nSubP ,'EdgyInt',true ,'hetCoeffs',cs ); %{ \end{matlab} Compute the time-constant forcing, and store in struct \verb|patches| for access by the microcode of \cref{sec:randAdvecDiffForce2}. \begin{matlab} %} mu = [ 0.25+0.5*rand(1,2) 0.1+0.15*rand ] patches.fu = exp(-((patches.x-mu(1)).^2 ... +(patches.y-mu(2)).^2)/mu(3)^2); %{ \end{matlab} \paragraph{Solve for steady state} Set initial guess of zero, with \verb|NaN| to indicate patch-edge values. Index~\verb|i| are the indices of patch-interior points, store in global patches for access by \verb|theRes|, and the number of unknowns is then its number of elements. \begin{matlab} %} u0 = zeros(nSubP,nSubP,1,1,nPatch,nPatch); u0([1 end],:,:) = nan; u0(:,[1 end],:) = nan; patches.i = find(~isnan(u0)); nVariables = numel(patches.i) %{ \end{matlab} Solve by iteration. Use \verb|fsolve| for simplicity and robustness (and using \verb|optimoptions| to omit trace information), via the generic patch system wrapper \verb|theRes| (\cref{sec:theRes}). \begin{matlab} %} tic; uSoln = fsolve(@theRes,u0(patches.i) ... ,optimoptions('fsolve','Display','off')); solnTime = toc normResidual = norm(theRes(uSoln)) normSoln = norm(uSoln) %{ \end{matlab} Store the solution vector into the patches, and interpolate, but have not bothered to set boundary values so they stay NaN from the interpolation. \begin{matlab} %} u0(patches.i) = uSoln; u0 = patchEdgeInt2(u0); %{ \end{matlab} \paragraph{Draw solution profile} Separate patches with NaNs, then reshape arrays to suit 2D space surface plots. \begin{matlab} %} figure(1), clf, colormap(0.8*hsv) patches.x(end+1,:,:)=nan; u0(end+1,:,:)=nan; patches.y(:,end+1,:)=nan; u0(:,end+1,:)=nan; u = reshape(permute(squeeze(u0),[1 3 2 4]) ... , [numel(patches.x) numel(patches.y)]); %{ \end{matlab} Draw the patch solution surface, with boundary-values omitted as already~\verb|NaN| by not bothering to set them. \begin{matlab} %} mesh(patches.x(:),patches.y(:),u'); view(60,55) xlabel('space $x$'), ylabel('space $y$'), zlabel('$u(x,y)$') ifOurCf2eps(mfilename) %optionally save plot %{ \end{matlab} \subsection{\texttt{randAdvecDiffForce2()}: microscale discretisation inside patches of forced diffusion PDE} \label{sec:randAdvecDiffForce2} This function codes the lattice heterogeneous diffusion of the \pde\ inside the patches. For 6D input arrays~\verb|u|, \verb|x|, and~\verb|y|, computes the time derivative at each point in the interior of a patch, output in~\verb|ut|. \begin{matlab} %} function ut = randAdvecDiffForce2(t,u,patches) dx = diff(patches.x(2:3)); % x space step dy = diff(patches.y(2:3)); % y space step i = 2:size(u,1)-1; % x interior points in a patch j = 2:size(u,2)-1; % y interior points in a patch ut = nan+u; % preallocate output array %{ \end{matlab} Set Neumann boundary condition of zero derivative around the square domain: that is, the edge value equals the next-to-edge value. \begin{matlab} %} u( 1 ,:,:,:, 1 ,:)=u( 2 ,:,:,:, 1 ,:); % left edge of left patches u(end,:,:,:,end,:)=u(end-1,:,:,:,end,:); % right edge of right patches u(:, 1 ,:,:,:, 1 )=u(:, 2 ,:,:,:, 1 ); % bottom edge of bottom patches u(:,end,:,:,:,end)=u(:,end-1,:,:,:,end); % top edge of top patches %{ \end{matlab} Compute the time derivatives via stored forcing and coefficients. Easier to code by conflating the last four dimensions into the one~\verb|,:|. \begin{matlab} %} ut(i,j,:) ... = patches.cs(i,j,1).*(diff(u(:,j,:),2,1)/dx^2 ... +diff(u(i,:,:),2,2)/dy^2)... -patches.cs(i,j,2).*(u(i+1,j,:)-u(i-1,j,:))/(2*dx) ... -patches.cs(i,j,3).*(u(i,j+1,:)-u(i,j-1,:))/(2*dy) ... -u(i,j,:) +patches.fu(i,j,:); end%function randAdvecDiffForce2 %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
SwiftHohenberg2dPattern.m
.m
EquationFreeGit-master/Patch/SwiftHohenberg2dPattern.m
7,101
utf_8
6c2e0a887d3bc61c45a03c76692f2e90
% Simulate Swift--Hohenberg PDE in 2D on patches as an % example application of patches in 2D space with pairs of % edge points needing to be interpolated between patches. % AJR, 13 Apr 2023 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{SwiftHohenberg2dPattern}: patterns of the Swift--Hohenberg PDE in 2D on patches} \label{sec:SwiftHohenberg2dPattern} \localtableofcontents \cref{fig:SwiftHohenberg2dPattern2,fig:SwiftHohenberg2dPattern3% ,fig:SwiftHohenberg2dPattern4,fig:SwiftHohenberg2dPattern5% ,fig:SwiftHohenberg2dPattern6,fig:SwiftHohenberg2dPattern7} show an example simulation in time generated by the patch scheme applied to the patterns arising from the 2D Swift--Hohenberg \pde. Consider a lattice of values~\(u_i(t)\), with lattice spacing~\(dx\), and governed by a microscale centred discretisation of the Swift--Hohenberg \pde \begin{equation} \partial_tu = -(1+\delsq/k_0^2)^2u+\Ra u-u^3, \label{eq:SwiftHohenberg2dPattern} \end{equation} with various boundary conditions at \(x,y=0,L\). For \Ra\ just above critical, say \(\Ra=0.1\), the system rapidly evolves to spatial quasi-periodic solutions with period\({} \approx 0.24\) when wavenumber parameter \(k_0 = 26\). These spatial oscillations are here resolved on a micro-grid of spacing~\(0.042\). On medium times these spatial oscillations grow to near equilibrium amplitude of~\(\sqrt{\Ra}\), and over very long times the phases of the oscillations evolve in space to adapt to the boundaries. Set the desired microscale periodicity, and correspondingly choose random microscale diffusion coefficients (with subscripts shifted by a half). \begin{matlab} %} clear all cMap=jet(64); cMap=0.8*cMap(7:end-7,:); % set colormap basename = ['r' num2str(floor(1e5*rem(now,1))) mfilename] %global OurCf2eps, OurCf2eps=true %optional to save plots Ra = 0.2 % Ra>0 leads to patterns nGapFac = 2 waveLength = 0.5/nGapFac nPtsPeriod = 6 dx = waveLength/nPtsPeriod k0 = 2.1*pi/waveLength %{ \end{matlab} The above factor~\(2.1\) is close to \(3/\sqrt2=2.1213\) for which \((\pm1,\pm2)\) modes have same linear growth-rate as~\((\pm2,0)\) modes. Establish global data struct~\verb|patches| for the Swift--Hohenberg \pde\ on some square domain. For simplicity, use five patches in each direction. Quartic (fourth-order) interpolation \(\verb|ordCC|=4\) provides values for the inter-patch coupling conditions. Set \verb|bcOffset| for different boundary conditions around the square domain. \begin{matlab} %} nPatch = 5 nSubP = 2*nPtsPeriod+4 Len = nPatch; ordCC = 4; dom.type='equispace'; dom.bcOffset=[0.5 0.5;1.0 1.5] patches = configPatches2(@SwiftHohenbergPDE,[0 Len],dom ... ,nPatch,ordCC,dx,nSubP,'EdgyInt',true,'nEdge',2); xs=squeeze(patches.x); ys=squeeze(patches.y); %{ \end{matlab} \subsubsection{Simulate in time} Set an initial condition, and here integrate forward in time using a standard method for stiff systems. Integrate the interface \verb|patchSys2| (\cref{sec:patchSys2}) to the microscale differential equations (despite the extreme stiffness, \verb|ode23| is ten times quicker than \verb|ode15s|). Because pattern evolution is eventually phase-diffusion, here sample the pattern at quadratically varying times. \begin{matlab} %} fprintf('\n**** Simulate in time\n') u0 = 0.3*( -1+2*rand(size(patches.x+patches.y)) ); Ts=400*linspace(0,1,97).^2; tic [ts,us] = ode23(@patchSys2, Ts, u0(:),[],patches,k0,Ra); simulateTime = toc us = reshape(us',nSubP,nSubP,nPatch,nPatch,[]); %{ \end{matlab} \foreach \p in {2,...,7}{% \begin{SCfigure}\centering \caption{\label{fig:SwiftHohenberg2dPattern\p} pattern field \(u(x,y,t)\) in the patch scheme applied to a microscale discretisation of the 2D Swift--Hohenberg \pde. \ifcase\p\or \or%2 At this early time much of the random sub-patch microstrucre has decayed leaving some random marginal modes starting to grow. \or%3 By now the local sub-patch patterns have reached a quasi-equilibrium amplitude. \or%4 Patterns within the patches are evolving to the preferred rolls, but with weak coupling to other patches. \or%5 Can see different effects arising at different types of boundaries. \else \ldots \fi} \includegraphics[scale=0.9]{r26336SwiftHohenberg2dPattern\p} \end{SCfigure} }%end foreach Plot the simulation such as that shown in \cref{fig:SwiftHohenberg2dPattern2,fig:SwiftHohenberg2dPattern3% ,fig:SwiftHohenberg2dPattern4,fig:SwiftHohenberg2dPattern5% ,fig:SwiftHohenberg2dPattern6,fig:SwiftHohenberg2dPattern7} First, reshape the data, omitting edge values. \begin{matlab} %} xs([1:2 end-1:end],:) = nan; ys([1:2 end-1:end],:) = nan; us = reshape( permute(us,[1 3 2 4 5]) ... ,nSubP*nPatch,nSubP*nPatch,[]); uRange=[min(us(:)) max(us(:))]; %{ \end{matlab} Second, plot six examples of the evolving pattern, equi-spaced in time-index. \begin{matlab} %} plots = round( 1+linspace(0,1,7)*(numel(ts)-1) ) for p=2:numel(plots) figure(p),clf mesh(xs(:),ys(:),us(:,:,plots(p))') axis equal, view(0,90) caxis(uRange), colormap(cMap), colorbar xlabel('space $x$'), ylabel('space $y$'), zlabel('$u(x,y,t)$') title(['time = ' num2str(ts(plots(p)),3)]) ifOurCf2eps([basename num2str(p)],[12 11]) end%for p %{ \end{matlab} Third, plot animation in time: starts after a key press. \begin{matlab} %} %% figure(1),clf cf=mesh(xs(:),ys(:),us(:,:,1)'); axis equal, view(0,90) caxis(uRange), colormap(cMap), colorbar xlabel('space $x$'), ylabel('space $y$'), zlabel('$u(x,y,t)$') title(['time = ' num2str(ts(1),3)]) ca=gca; disp('Press any key to start animation'),pause for p=2:numel(ts) cf.ZData=us(:,:,p)'; cf.CData=us(:,:,p)'; ca.Title.String=['time = ' num2str(ts(p),3)]; pause(0.1) end %{ \end{matlab} Fin. \subsection{The Swift--Hohenberg PDE and BCs inside patches} As a microscale discretisation of Swift--Hohenberg \pde\ \(u_t= -(1+\delsq/k_0^2)^2u +\Ra u -u^3\), here code straightforward centred discretisation in space. \begin{matlab} %} function ut=SwiftHohenbergPDE(t,u,patches,k0,Ra) dx=diff(patches.x(1:2)); % microscale spacing dy=diff(patches.y(1:2)); % microscale spacing i=3:size(u,1)-2; % interior points in patches j=3:size(u,2)-2; % interior points in patches %{ \end{matlab} Code various boundary conditions. For slightly simpler coding, squeeze out the two singleton dimensions. \begin{matlab} %} u = squeeze(u); u(1:2,:,1,:)=0; % u=u_x=0 at x=0 u(:,1:2,:,1)=0; % u=u_y=0 at y=0 u(end-1,:,end,:)=0; % u=0 at x=L u(end ,:,end,:)=-u(end-2,:,end,:); % u_x=0 at x=L u(:,end-1,:,end)=-u(:,end-2,:,end); % u_y=0 at y=L u(:,end ,:,end)=-u(:,end-3,:,end); % u_yyy=0 at y=L %{ \end{matlab} Here code straightforward centred discretisation in space. \begin{matlab} %} ut=nan+u; % preallocate output array v = u(2:end-1,2:end-1,:,:) ... +( diff(u(:,2:end-1,:,:),2,1)/dx^2 ... +diff(u(2:end-1,:,:,:),2,2)/dy^2 )/k0^2; ut(i,j,:,:) = -( v(2:end-1,2:end-1,:,:) ... +( diff(v(:,2:end-1,:,:),2,1)/dx^2 ... +diff(v(2:end-1,:,:,:),2,2)/dy^2 )/k0^2 ) ... +Ra*u(i,j,:,:) -u(i,j,:,:).^3; end %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
burgersBurst.m
.m
EquationFreeGit-master/Patch/burgersBurst.m
1,246
utf_8
f0f01615492ea5012e74cba12816fd17
% Simulates a burst in time of a microscale map that is % applied on patches in space. Used by BurgersExample.m % AJR, 4 Apr 2019 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \subsection{\texttt{burgerBurst()}: code a burst of the patch map} \label{sec:burgerBurst} \begin{matlab} %} function [ts, us] = burgersBurst(ti, ui, bT) %{ \end{matlab} First find and set the number of microscale time-steps. \begin{matlab} %} global patches dt = diff(patches.x(2:3))^2/2; ndt = ceil(bT/dt -0.2); ts = ti+(0:ndt)'*dt; %{ \end{matlab} Use \verb|patchSys1()| (\cref{sec:patchSys1}) to apply the microscale map over all time-steps in the burst. The \verb|patchSys1()| interface provides the interpolated edge-values of each patch. Store the results in rows to be consistent with \ode\ and projective integrators. \begin{matlab} %} us = nan(ndt+1,numel(ui)); us(1,:) = reshape(ui,1,[]); for j = 1:ndt ui = patchSys1(ts(j),ui); us(j+1,:) = reshape(ui,1,[]); end %{ \end{matlab} Linearly interpolate (extrapolate) to get the field values at the precise final time of the burst. Then return. \begin{matlab} %} ts(ndt+1) = ti+bT; us(ndt+1,:) = us(ndt,:) ... + diff(ts(ndt:ndt+1))/dt*diff(us(ndt:ndt+1,:)); end %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
RK2mesoPatch.m
.m
EquationFreeGit-master/Patch/RK2mesoPatch.m
8,304
utf_8
66bc19ff089e5222de4554896a9d96e6
% RK2mesoPatch() is a simple example of Runge--Kutta, 2nd % order, integration of a given deterministic system on % patches. AJR, Sept 2020 -- Dec 2020 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{RK2mesoPatch()}} \label{sec:RK2mesoPatch} This is a Runge--Kutta, 2nd order, integration of a given deterministic system of \ode{}s on patches. It invokes meso-time updates of the patch-edge values in order to reduce interpolation costs, and uses a linear variation in edge-values over the meso-time-step \cite[case \(Q=2\)]{Bunder2015a}. This function is aimed primarily for large problems executed on a computer cluster to markedly reduce expensive communication between computers. If using within projective integration, it appears quite tricky to get all the time-steps chosen appropriately. One has to choose times for: the micro-scale time-step, the meso-time interval between communications, the longer meso-time burst length, and the macro-scale integration time-step. \begin{matlab} %} function [xs,errs] = RK2mesoPatch(ts,x0,nMicro,patches) if nargin<4, global patches, end %{ \end{matlab} \paragraph{Input} \begin{itemize} \item \verb|patches.fun()| is a function such as \verb|dxdt=fun(t,x,patches)| that computes the right-hand side of the \ode\ \(d\xv/dt=\fv(t,\xv)\) where \xv~is a vector\slash array, \(t\)~is a scalar, and the result~\fv\ is a correspondingly sized vector\slash array. \item \verb|x0| is an vector\slash array of initial values at the time \verb|ts(1)|. \item \verb|ts| is a vector of meso-scale times to compute the approximate solution, say in~\(\RR^\ell\) for \(\ell\geq2\)\,. \item \verb|nMicro|, optional, default~\(10\), is the number of micro-time-steps taken for each meso-scale time-step. \item \verb|patches| struct set by \verb|configPatches|\(n\) and provided as either as parameter, or as a global variable. \end{itemize} \paragraph{Output} \begin{itemize} \item \verb|xs|, 5/7/9D (depending upon~\verb|nD|) array of length~\(\ell \times\cdots\) of approximate solution vector\slash array at the specified times. But, if using parallel computing via \verb|spmd|, then \verb|xs| is a \emph{composite} 5/7/9D~array, so outside of an \verb|spmd|-block access a single copy of the array via~\verb|xs{1}|. Similarly for~\verb|errs|. \item \verb|errs|, column vector in \(\RR^{\ell}\) of local error estimate for the step from~\(t_{k-1}\) to~\(t_k\). \end{itemize} \begin{devMan} \paragraph{Code of RK2 integration} Set default number of micro-scale time-steps in each requested meso-scale step of~\verb|ts|. Cannot use \verb|nargin| inside explicit \verb|spmd|, but can use it if the \verb|spmd| is already active from the code that invokes this function. \begin{matlab} %} if nargin<3|isempty(nMicro), nMicro=10; end %{ \end{matlab} If patches are set to be in parallel (there must be a parallel pool), but only one worker available (i.e., not already inside \verb|spmd|), then invoke function recursively inside \verb|spmd|. Q:~is \verb|numlabs| defined without the parallel computing toolbox?? \begin{matlab} %} if isequal(class(patches),'Composite') && numlabs==1 spmd, [xs,errs] = RK2mesoPatch(ts,x0,nMicro,patches); end% spmd assert(isequal(class(xs) ,'Composite'),' xs not composite') assert(isequal(class(errs),'Composite'),'errs not composite') return end %{ \end{matlab} Set the number of space dimensions from the number stored patch-size ratios. \begin{matlab} %} nD = length(patches.ratio); %{ \end{matlab} Set the micro-time-steps and create storage for outputs. \begin{matlab} %} dt = diff(ts)/nMicro; xs = nan([numel(ts) size(x0)]); errs = nan(numel(ts),1); %{ \end{matlab} Initialise first result to the given initial condition, and evaluate the initial time derivative into~\verb|f1|. Use inter-patch interpolation to ensure edge values of the initial condition are defined and are reasonable. \footnote{These \texttt{gather()} functions cause all-to-all interprocessor communication once every meso-step. Maybe better to use distributed array instead, (although need to then need to put time index last instead of first??), but we need to do some inter-cpu communication in order to estimate errors.} \begin{matlab} %} switch nD case 1, x0 = patchEdgeInt1(x0,patches); xs(1,:,:,:,:) = gather(x0); case 2, x0 = patchEdgeInt2(x0,patches); xs(1,:,:,:,:,:,:) = gather(x0); case 3, x0 = patchEdgeInt3(x0,patches); xs(1,:,:,:,:,:,:,:,:) = gather(x0); end;%switch nD errs(1) = 0; f1 = patches.fun(ts(1),x0,patches); %{ \end{matlab} Compute the meso-time-steps from~\(t_k\) to~\(t_{k+1}\), copying the derivative~\verb|f1| at the end of the last micro-time-step to be the derivative at the start of this one. \begin{matlab} %} for k = 1:numel(dt) %{ \end{matlab} Perform meso-time burst with the new interpolation for edge values, and an interpolation of the time derivatives to get derivative estimates of the edge-values. \begin{matlab} %} switch nD case 1, dx0 = patchEdgeInt1(f1,patches); case 2, dx0 = patchEdgeInt2(f1,patches); case 3, dx0 = patchEdgeInt3(f1,patches); end;%switch nD %{ \end{matlab} Perform the micro-time steps. \begin{matlab} %} for m=1:nMicro f0 = f1; % assert(iscodistributed(f0),'f0 not codist') %{ \end{matlab} For all micro-time derivative evaluations, include that the edge values are varying according to the estimate made at the start of the meso-time-step. \begin{matlab} %} switch nD case 1, f0([1 end],:,:,:)=dx0([1 end],:,:,:); case 2, f0([1 end],:,:,:,:,:)=dx0([1 end],:,:,:,:,:); f0(:,[1 end],:,:,:,:)=dx0(:,[1 end],:,:,:,:); case 3 f0([1 end],:,:,:,:,:,:,:)=dx0([1 end],:,:,:,:,:,:,:); f0(:,[1 end],:,:,:,:,:,:)=dx0(:,[1 end],:,:,:,:,:,:); f0(:,:,[1 end],:,:,:,:,:)=dx0(:,:,[1 end],:,:,:,:,:); end;%switch nD % assert(iscodistributed(f0),'f0 not codist two') %{ \end{matlab} Simple second-order accurate Runge--Kutta micro-scale time-step. \begin{matlab} %} xh = x0+f0*dt(k)/2; % assert(iscodistributed(xh),'xh not codist') fh = patches.fun(ts(k)+dt(k)*(m-0.5),xh,patches); % assert(iscodistributed(fh),'fh not codist one') switch nD case 1, fh([1 end],:,:,:)=dx0([1 end],:,:,:); case 2, fh([1 end],:,:,:,:,:)=dx0([1 end],:,:,:,:,:); fh(:,[1 end],:,:,:,:)=dx0(:,[1 end],:,:,:,:); case 3 fh([1 end],:,:,:,:,:,:,:)=dx0([1 end],:,:,:,:,:,:,:); fh(:,[1 end],:,:,:,:,:,:)=dx0(:,[1 end],:,:,:,:,:,:); fh(:,:,[1 end],:,:,:,:,:)=dx0(:,:,[1 end],:,:,:,:,:); end;%switch nD % assert(iscodistributed(fh),'fh not codist two') x0 = x0+fh*dt(k); % assert(iscodistributed(x0),'x0 not codist two') %{ \end{matlab} End the burst of micro-time-steps. \begin{matlab} %} end %{ \end{matlab} At the end of each meso-step burst, refresh the interpolate of the edge values, evaluate time-derivative, and temporarily fill-in edges of derivatives (to ensure error estimate is reasonable). \begin{matlab} %} switch nD case 1, x0 = patchEdgeInt1(x0,patches); xs(k+1,:,:,:,:) = gather(x0); case 2, x0 = patchEdgeInt2(x0,patches); xs(k+1,:,:,:,:,:,:) = gather(x0); case 3, x0 = patchEdgeInt3(x0,patches); xs(k+1,:,:,:,:,:,:,:,:) = gather(x0); end;%switch nD % assert(iscodistributed(x0),'x0 not codist three') f1 = patches.fun(ts(k+1),x0,patches); switch nD case 1, f1([1 end],:,:,:)=dx0([1 end],:,:,:); case 2, f1([1 end],:,:,:,:,:)=dx0([1 end],:,:,:,:,:); f1(:,[1 end],:,:,:,:)=dx0(:,[1 end],:,:,:,:); case 3 f1([1 end],:,:,:,:,:,:,:)=dx0([1 end],:,:,:,:,:,:,:); f1(:,[1 end],:,:,:,:,:,:)=dx0(:,[1 end],:,:,:,:,:,:); f1(:,:,[1 end],:,:,:,:,:)=dx0(:,:,[1 end],:,:,:,:,:); end;%switch nD %{ \end{matlab} Use the time derivative at~\(t_{k+1}\) to estimate an error by storing the difference with what Simpson's rule would estimate over the last micro-time step performed. \begin{matlab} %} f0=f0-2*fh+f1; % assert(iscodistributed(f0),'f2ndDeriv not codist') errs(k+1) = sqrt(gather(mean(f0(:).^2,'omitnan')))*dt(k)/6; end%for-loop end%function %{ \end{matlab} End of the function with results returned in~\verb|xs| and~\verb|errs|. \end{devMan} %}
github
uoa1184615/EquationFreeGit-master
BurgersPDE.m
.m
EquationFreeGit-master/Patch/BurgersPDE.m
894
utf_8
cdf32fe35b336290773eee01ed34c16b
% A microscale discretisation of Burgers' PDE on a lattice x. % AJR 5 Apr 2019 -- Jun 2020 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \paragraph{Example of Burgers PDE inside patches} As a microscale discretisation of Burgers' \pde\ \(u_t=u_{xx}-30uu_x\), here code \(\dot u_{ij} =\frac1{\delta x^2} (u_{i+1,j}-2u_{i,j}+u_{i-1,j}) -30u_{ij} \frac1{2\delta x}(u_{i+1,j}-u_{i-1,j})\). Here there is only one field variable, and one in the ensemble, so for simpler coding of the PDE we squeeze them out (with no need to reshape when via patchSys1()). \begin{matlab} %} function ut=BurgersPDE(t,u,patches) u=squeeze(u); % omit singleton dimensions dx=diff(patches.x(1:2)); % microscale spacing i=2:size(u,1)-1; % interior points in patches ut=nan+u; % preallocate output array ut(i,:)=diff(u,2)/dx^2 ... -30*u(i,:).*(u(i+1,:)-u(i-1,:))/(2*dx); end %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
twoscaleDiffEquil2.m
.m
EquationFreeGit-master/Patch/twoscaleDiffEquil2.m
5,874
utf_8
72360a5657f3775100239977c8460614
% Solve for steady state of twoscale heterogeneous diffusion % in 2D on patches as an example application, from section % 5.3.1 of Freese, 2211.13731. AJR, 31 Jan 2023 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{twoscaleDiffEquil2}: equilibrium of a 2D twoscale heterogeneous diffusion via small patches} \label{sec:twoscaleDiffEquil2} Here we find the steady state~\(u(x,y)\) to the heterogeneous \pde\ (inspired by Freese et al.\footnote{ \protect \url{http://arxiv.org/abs/2211.13731}} \S5.3.1) \begin{equation*} u_t=A(x,y)\grad\grad u-f, \end{equation*} on domain \([-1,1]^2\) with Dirichlet BCs, for coefficient `diffusion' matrix, varying with period~\(2\epsilon\) on the microscale \(\epsilon=2^{-7}\), of \begin{equation*} A:=\begin{bmatrix} 2& a\\a & 2 \end{bmatrix} \quad \text{with } a:=\sin(\pi x/\epsilon)\sin(\pi y/\epsilon), \end{equation*} and for forcing \(f:=(x+\cos3\pi x)y^3\). \begin{figure} \centering\begin{tabular}{@{}c@{\ }c@{}} \parbox[t]{10em}{\caption{\label{fig:twoscaleDiffEquil2}% Equilibrium of the multiscale diffusion problem of Freese with Dirichlet zero-value boundary conditions (\cref{sec:twoscaleDiffEquil2}). The patch size is not small so we can see the patches and the sub-patch grid. The solution~\(u(x,y)\) is boringly smooth.}} & \def\extraAxisOptions{label shift={-1.5ex}} \raisebox{-\height}{\input{../Patch/Figs/twoscaleDiffEquil2}} \end{tabular} \end{figure} Clear, and initiate globals. \begin{matlab} %} clear all global patches %global OurCf2eps, OurCf2eps=true %option to save plot %{ \end{matlab} First establish the microscale heterogeneity has micro-period \verb|mPeriod| on the spatial lattice. Set the phase of the heterogeneity so that each patch centre is a point of symmetry of the diffusivity. Then \verb|configPatches2| replicates the heterogeneity to fill each patch. \begin{matlab} %} mPeriod = 6 z = (0.5:mPeriod)'/mPeriod; A = sin(2*pi*z).*sin(2*pi*z'); %{ \end{matlab} Set the periodicity, via~\(\epsilon\), and other microscale parameters. \begin{matlab} %} nPeriodsPatch = 1 % any integer epsilon = 2^(-6) % 4 or 5 to see the patches dx = (2*epsilon)/mPeriod nSubP = nPeriodsPatch*mPeriod+2 % for edgy int %{ \end{matlab} \paragraph{Patch configuration} Say use \(7\times7\) patches in \((-1,1)^2\), fourth order interpolation, and either `equispace' or `chebyshev': \begin{matlab} %} nPatch = 7 configPatches2(@twoscaleDiffForce2,[-1 1],'equispace' ... ,nPatch ,4 ,dx ,nSubP ,'EdgyInt',true ,'hetCoeffs',A ); %{ \end{matlab} Compute the time-constant forcing, and store in struct \verb|patches| for access by the microcode of \cref{sec:twoscaleDiffForce2}. \begin{matlab} %} x = patches.x; y = patches.y; patches.fu = 100*(x+cos(3*pi*x)).*y.^3; %{ \end{matlab} \paragraph{Solve for steady state} Set initial guess of zero, with \verb|NaN| to indicate patch-edge values. Index~\verb|i| are the indices of patch-interior points, and the number of unknowns is then its length. \begin{matlab} %} u0 = zeros(nSubP,nSubP,1,1,nPatch,nPatch); u0([1 end],:,:) = nan; u0(:,[1 end],:) = nan; patches.i = find(~isnan(u0)); nVariables = numel(patches.i) %{ \end{matlab} Solve by iteration. Use \verb|fsolve| for simplicity and robustness (and using \verb|optimoptions| to omit trace information), via the generic patch system wrapper \verb|theRes| (\cref{sec:theRes}), and give magnitudes. \begin{matlab} %} tic; uSoln = fsolve(@theRes,u0(patches.i) ... ,optimoptions('fsolve','Display','off')); solveTime = toc normResidual = norm(theRes(uSoln)) normSoln = norm(uSoln) %{ \end{matlab} Store the solution vector into the patches, and interpolate, but have not bothered to set boundary values so they stay NaN from the interpolation. \begin{matlab} %} u0(patches.i) = uSoln; u0 = patchEdgeInt2(u0); %{ \end{matlab} \paragraph{Draw solution profile} Separate patches with NaNs, then reshape arrays to suit 2D space surface plots. \begin{matlab} %} figure(1), clf, colormap(0.8*hsv) x(end+1,:,:)=nan; u0(end+1,:,:)=nan; y(:,end+1,:)=nan; u0(:,end+1,:)=nan; u = reshape(permute(squeeze(u0),[1 3 2 4]), [numel(x) numel(y)]); %{ \end{matlab} Draw the patch solution surface, with boundary-values omitted as already~\verb|NaN| by not bothering to set them. \begin{matlab} %} mesh(x(:),y(:),u'); view(60,55) xlabel('space $x$'), ylabel('space $y$'), zlabel('$u(x,y)$') ifOurCf2tex(mfilename)%optionally save %{ \end{matlab} \subsection{\texttt{twoscaleDiffForce2()}: microscale discretisation inside patches of forced diffusion PDE} \label{sec:twoscaleDiffForce2} This function codes the lattice heterogeneous diffusion of the \pde\ inside the patches. For 6D input arrays~\verb|u|, \verb|x|, and~\verb|y|, computes the time derivative at each point in the interior of a patch, output in~\verb|ut|. \begin{matlab} %} function ut = twoscaleDiffForce2(t,u,patches) dx = diff(patches.x(2:3)); % x space step dy = diff(patches.y(2:3)); % y space step i = 2:size(u,1)-1; % x interior points in a patch j = 2:size(u,2)-1; % y interior points in a patch ut = nan+u; % preallocate output array %{ \end{matlab} Set Dirichlet boundary value of zero around the square domain. \begin{matlab} %} u( 1 ,:,:,:, 1 ,:)=0; % left edge of left patches u(end,:,:,:,end,:)=0; % right edge of right patches u(:, 1 ,:,:,:, 1 )=0; % bottom edge of bottom patches u(:,end,:,:,:,end)=0; % top edge of top patches %{ \end{matlab} Compute the time derivatives via stored forcing and coefficients. Easier to code by conflating the last four dimensions into the one~\verb|,:|. \begin{matlab} %} ut(i,j,:) ... = 2*diff(u(:,j,:),2,1)/dx^2 +2*diff(u(i,:,:),2,2)/dy^2 ... +2*patches.cs(i,j).*( u(i+1,j+1,:) -u(i-1,j+1,:) ... -u(i+1,j-1,:) +u(i-1,j-1,:) )/(4*dx*dy) ... -patches.fu(i,j,:); end%function twoscaleDiffForce2 %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
patchSys1.m
.m
EquationFreeGit-master/Patch/patchSys1.m
3,219
utf_8
a1fb92a0c8cf097956420a725b7f4cef
% patchSys1() provides an interface to time integrators for % the dynamics on patches coupled across space. The system % must be a lattice system such as PDE discretisations. % AJR, Nov 2017 -- 31 Mar 2023 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{patchSys1()}: interface 1D space to time integrators} \label{sec:patchSys1} To simulate in time with 1D spatial patches we often need to interface a user's time derivative function with time integration routines such as \verb|ode23| or~\verb|PIRK2|. This function provides an interface. Communicate patch-design variables (\cref{sec:configPatches1}) either via the global struct~\verb|patches| or via an optional third argument. \verb|patches| is required for the parallel computing of \verb|spmd|, or if parameters are to be passed though to the user microscale function. \begin{matlab} %} function dudt=patchSys1(t,u,patches,varargin) if nargin<3, global patches, end %{ \end{matlab} \paragraph{Input} \begin{itemize} \item \verb|u| is a vector\slash array of length $\verb|nSubP| \cdot \verb|nVars| \cdot \verb|nEnsem| \cdot \verb|nPatch|$ where there are $\verb|nVars| \cdot \verb|nEnsem|$ field values at each of the points in the $\verb|nSubP|\times \verb|nPatch|$ grid. \item \verb|t| is the current time to be passed to the user's time derivative function. \item \verb|patches| a struct set by \verb|configPatches1()| with the following information used here. \begin{itemize} \item \verb|.fun| is the name of the user's function \verb|fun(t,u,patches,...)| that computes the time derivatives on the patchy lattice. The array~\verb|u| has size $\verb|nSubP| \times \verb|nVars| \times \verb|nEnsem| \times \verb|nPatch|$. Time derivatives should be computed into the same sized array, then herein the patch edge values are overwritten by zeros. \item \verb|.x| is $\verb|nSubP| \times1 \times1 \times \verb|nPatch|$ array of the spatial locations~$x_{i}$ of the microscale grid points in every patch. Currently it \emph{must} be an equi-spaced lattice on the microscale. \end{itemize} \item \verb|varargin|, optional, is arbitrary number of parameters to be passed onto the users time-derivative function as specified in configPatches1. \end{itemize} \paragraph{Output} \begin{itemize} \item \verb|dudt| is a vector\slash array of of time derivatives, but with patch edge-values set to zero. It is of total length $\verb|nSubP| \cdot \verb|nVars| \cdot \verb|nEnsem| \cdot \verb|nPatch|$ and the same dimensions as~\verb|u|. \end{itemize} \begin{devMan} Reshape the fields~\verb|u| as a 4D-array, and sets the edge values from macroscale interpolation of centre-patch values. \cref{sec:patchEdgeInt1} describes \verb|patchEdgeInt1()|. \begin{matlab} %} sizeu = size(u); u = patchEdgeInt1(u,patches); %{ \end{matlab} Ask the user function for the time derivatives computed in the array, overwrite its edge values with the dummy value of zero (as \verb|ode15s| chokes on NaNs), then return to the user\slash integrator as same sized array as input. \begin{matlab} %} dudt=patches.fun(t,u,patches,varargin{:}); n=patches.nEdge; dudt([1:n end-n+1:end],:,:,:) = 0; dudt=reshape(dudt,sizeu); %{ \end{matlab} Fin. \end{devMan} %}
github
uoa1184615/EquationFreeGit-master
heteroBurst.m
.m
EquationFreeGit-master/Patch/heteroBurst.m
790
utf_8
44b59399b9035cafb49f59bce3a33b3a
% Simulates a burst of the system linked to by the % configuration of patches. Used by homogenisationExample.m, % homoDiffEdgy1.m, and maybe homoLanLif1D.m % AJR, 4 Apr 2019 -- Sep 2021 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \subsection{\texttt{heteroBurst()}: a burst of heterogeneous diffusion} \label{sec:heteroBurst} This code integrates in time the derivatives computed by \verb|heteroDiff| from within the patch coupling of \verb|patchSys1|. Try~\verb|ode23| or \verb|rk2Int|, although \verb|ode45| may give smoother results. \begin{matlab} %} function [ts, ucts] = heteroBurst(ti, ui, bT) if ~exist('OCTAVE_VERSION','builtin') [ts,ucts] = ode23( @patchSys1,[ti ti+bT],ui(:)); else % octave version [ts,ucts] = rk2Int(@patchSys1,[ti ti+bT],ui(:)); end end %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
MMburstAcc.m
.m
EquationFreeGit-master/ProjInt/MMburstAcc.m
1,007
utf_8
212e6fa96d948014cf0e9a656327a56c
% Short explanation for users typing "help fun" % Author, date %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \paragraph{Code an accurate burst of Michaelis--Menten enzyme kinetics} Integrate a burst of length~\verb|bT| of the \ode{}s for the Michaelis--Menten enzyme kinetics at parameter~\(\epsilon\) inherited from above. Code \textsc{ode}s in function~\verb|dMMdt| with variables \(x=\verb|x(1)|\) and \(y=\verb|x(2)|\). Starting at time~\verb|ti|, and state~\verb|xi| (row), we here use \verb|ode45| for accurate integrate in time. \begin{matlab} %} function [ts, xs] = MMburstAcc(ti, xi, bT) global MMepsilon dMMdt = @(t,x) [ -x(1)+(x(1)+0.5)*x(2) 1/MMepsilon*( x(1)-(x(1)+1)*x(2) ) ]; if ~exist('OCTAVE_VERSION','builtin') odeopts = odeset('RelTol',1e-8,'AbsTol',1e-8); [ts, xs] = ode45(dMMdt, [ti ti+bT], xi, odeopts); else % octave version, by default errors = 1e-8 ts = linspace(ti,ti+bT,11); xs = lsode(@(x,t) dMMdt(t,x),xi,ts); end end %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
PIRK2.m
.m
EquationFreeGit-master/ProjInt/PIRK2.m
14,636
utf_8
c60cf0db519e9b6bec8fb3ed5d3a4783
% PIRK2() implements second-order Projective Integration % with a user-specified microsolver. The macrosolver adapts % the explicit second-order Runge--Kutta Improved Euler % scheme. JM and AJR, Oct 2018 -- Oct 2020. Execute with no % arguments to see an example. %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{PIRK2()}: projective integration of second-order accuracy} \label{sec:PIRK2} \localtableofcontents \subsection{Introduction} This Projective Integration scheme implements a macroscale scheme that is analogous to the second-order Runge--Kutta Improved Euler integration. \begin{matlab} %} function [x, tms, xms, rm, svf] = PIRK2(microBurst, tSpan, x0, bT) %{ \end{matlab} \paragraph{Input} If there are no input arguments, then this function applies itself to the Michaelis--Menton example: see the code in \cref{sec:pirk2eg} as a basic template of how to use. \begin{itemize} \item \verb|microBurst()|, a user-coded function that computes a short-time burst of the microscale simulation. \begin{verbatim} [tOut, xOut] = microBurst(tStart, xStart, bT) \end{verbatim} \begin{itemize} \item Inputs: \verb|tStart|,~the start time of a burst of simulation; \(\verb|xStart|\),~the row \(n\)-vector of the starting state; \verb|bT|, \emph{optional}, the total time to simulate in the burst---if your \verb|microBurst()| determines the burst time, then replace~\verb|bT| in the argument list by~\verb|varargin|. \item Outputs: \verb|tOut|,~the column vector of solution times; and \verb|xOut|,~an array in which each \emph{row} contains the system state at corresponding times. \end{itemize} Be wary that for very large scale separations (such as \verb|MMepsilon<1e-5| in the Michaelis--Menten example), microscale integration by error-controlled variable-step routines (such as \verb|ode23/45|) often generate microscale variations that ruin the projective extrapolation of \verb|PIRK2()|. In such cases, a fixed time-step microscale integrator is much better (such as \verb|rk2Int()|). \item \verb|tSpan| is an \(\ell\)-vector of times at which the user requests output, of which the first element is always the initial time. \verb|PIRK2()| does not use adaptive time-stepping; the macroscale time-steps are (nearly) the steps between elements of \verb|tSpan|. \item \verb|x0| is an \(n\)-vector of initial values at the initial time \verb|tSpan(1)|. Elements of~\verb|x0| may be \verb|NaN|: such \verb|Nan|s are carried in the simulation through to the output, and often represent boundaries\slash edges in spatial fields. \item \verb|bT|, \emph{optional}, either missing, or empty~(\verb|[]|), or a scalar: if a given scalar, then it is the length of the micro-burst simulations---the minimum amount of time needed for the microscale simulation to relax to the slow manifold; else if missing or~\verb|[]|, then \verb|microBurst()| must itself determine the length of a burst. \begin{matlab} %} if nargin<4, bT=[]; end %{ \end{matlab} \end{itemize} \paragraph{Choose a long enough burst length} Suppose: firstly, you have some desired relative accuracy~\(\varepsilon\) that you wish to achieve (e.g., \(\varepsilon\approx0.01\) for two digit accuracy); secondly, the slow dynamics of your system occurs at rate\slash frequency of magnitude about~\(\alpha\); and thirdly, the rate of \emph{decay} of your fast modes are faster than the lower bound~\(\beta\) (e.g., if three fast modes decay roughly like \(e^{-12t}, e^{-34t}, e^{-56t}\) then \(\beta\approx 12\)). \begin{figure} \centering \def\aD{\alpha\Delta}\def\bD{\beta\Delta}\def\dD{\delta/\Delta} \caption{\label{fig:bTlength}Need macroscale step~\(\Delta\) such that $|\aD|\lesssim\sqrt{6\varepsilon}$ for given relative error~\(\varepsilon\) and slow rate~\(\alpha\), and then $\dD\gtrsim\frac1{\bD}\log|\bD|$ determines the minimum required burst length~\(\delta\) for every given fast rate~\(\beta\).} \tikzsetnextfilename{ProjInt/bTlength} \begin{tikzpicture} \begin{loglogaxis}[xlabel={$\bD$} ,ylabel={$(\dD)_{\min}$} ,domain=2.7:1000 ,grid=both ] \addplot+[no marks]{ln(x)/x}; \end{loglogaxis} \end{tikzpicture} \end{figure} Then set \begin{enumerate} \item a macroscale time-step, \(\Delta=\verb|diff(tSpan)|\), such that \(\alpha\Delta\approx\sqrt{6\varepsilon}\), and \item a microscale burst length, \(\delta=\verb|bT| \gtrsim \frac1\beta\log|\beta\Delta|\), see \cref{fig:bTlength}. \end{enumerate} \paragraph{Output} If there are no output arguments specified, then a plot is drawn of the computed solution~\verb|x| versus \verb|tSpan|. \begin{itemize} \item \verb|x|, an \(\ell \times n\) array of the approximate solution vector. Each row is an estimated state at the corresponding time in \verb|tSpan|. The simplest usage is then \verb|x = PIRK2(microBurst,tSpan,x0,bT)|. However, microscale details of the underlying Projective Integration computations may be helpful. \verb|PIRK2()| provides up to four optional outputs of the microscale bursts. \item \verb|tms|, optional, is an \(L\) dimensional column vector containing the microscale times within the burst simulations, each burst separated by~\verb|NaN|; \item \verb|xms|, optional, is an \(L\times n\) array of the corresponding microscale states---each rows is an accurate estimate of the state at the corresponding time~\verb|tms| and helps visualise details of the solution. \item \verb|rm|, optional, a struct containing the `remaining' applications of the microBurst required by the Projective Integration method during the calculation of the macrostep: \begin{itemize} \item \verb|rm.t|~is a column vector of microscale times; and \item \verb|rm.x|~is the array of corresponding burst states. \end{itemize} The states \verb|rm.x| do not have the same physical interpretation as those in \verb|xms|; the \verb|rm.x| are required in order to estimate the slow vector field during the calculation of the Runge--Kutta increments, and do \emph{not} accurately approximate the macroscale dynamics. \item \verb|svf|, optional, a struct containing the Projective Integration estimates of the slow vector field. \begin{itemize} \item \verb|svf.t| is a \(2\ell\) dimensional column vector containing all times at which the Projective Integration scheme is extrapolated along microBurst data to form a macrostep. \item \verb|svf.dx| is a \(2\ell\times n\) array containing the estimated slow vector field. \end{itemize} \end{itemize} \subsection{If no arguments, then execute an example} \label{sec:pirk2eg} \begin{matlab} %} if nargin==0 %{ \end{matlab} \paragraph{Example code for Michaelis--Menton dynamics} The Michaelis--Menten enzyme kinetics is expressed as a singularly perturbed system of differential equations for \(x(t)\) and~\(y(t)\): \begin{equation*} \frac{dx}{dt}=-x+(x+\tfrac12)y \quad\text{and}\quad \frac{dy}{dt}=\frac1\epsilon\big[x-(x+1)y\big] \end{equation*} (encoded in function \verb|MMburst()| in the next paragraph). With initial conditions \(x(0)=1\) and \(y(0)=0\), the following code computes and plots a solution over time \(0\leq t\leq6\) for parameter \(\epsilon=0.05\)\,. Since the rate of decay is \(\beta\approx 1/\epsilon\) we choose a burst length \(\epsilon\log(\Delta/\epsilon)\) as here the macroscale time-step \(\Delta=1\). \begin{matlab} %} global MMepsilon MMepsilon = 0.05 ts = 0:6 bT = MMepsilon*log( (ts(2)-ts(1))/MMepsilon ) [x,tms,xms] = PIRK2(@MMburst, ts, [1;0], bT); figure, plot(ts,x,'o:',tms,xms) title('Projective integration of Michaelis--Menten enzyme kinetics') xlabel('time t'), legend('x(t)','y(t)') %{ \end{matlab} Upon finishing execution of the example, exit this function. \begin{matlab} %} return end%if no arguments %{ \end{matlab} \input{../ProjInt/MMburst.m} \input{../ProjInt/odeOct.m} \begin{devMan} \subsection{The projective integration code} Determine the number of time-steps and preallocate storage for macroscale estimates. \begin{matlab} %} nT=length(tSpan); x=nan(nT,length(x0)); %{ \end{matlab} Get the number of expected outputs and set logical indices to flag what data should be saved. \begin{matlab} %} nArgOut=nargout(); saveMicro = (nArgOut>1); saveFullMicro = (nArgOut>3); saveSvf = (nArgOut>4); %{ \end{matlab} Run a preliminary application of the microBurst on the given initial state to help relax to the slow manifold. This is done in addition to the microBurst in the main loop, because the initial state is often far from the attracting slow manifold. Require the user to input and output rows of the system state. \begin{matlab} %} x0 = reshape(x0,1,[]); [relax_t,relax_x0] = microBurst(tSpan(1),x0,bT); %{ \end{matlab} Use the end point of this preliminary microBurst as the initial state for the loop of macro-steps. \begin{matlab} %} tSpan(1) = relax_t(end); x(1,:)=relax_x0(end,:); %{ \end{matlab} If saving information, then record the first application of the microBurst. Allocate cell arrays for times and states for outputs requested by the user, as concatenating cells is much faster than iteratively extending arrays. \begin{matlab} %} if saveMicro tms = cell(nT,1); xms = cell(nT,1); tms{1} = reshape(relax_t,[],1); xms{1} = relax_x0; if saveFullMicro rm.t = cell(nT,1); rm.x = cell(nT,1); if saveSvf svf.t = nan(2*nT-2,1); svf.dx = nan(2*nT-2,length(x0)); end end end %{ \end{matlab} \paragraph{Loop over the macroscale time-steps} Also set an initial rounding tolerance for checking. \begin{matlab} %} roundingTol = 1e-8; for jT = 2:nT T = tSpan(jT-1); %{ \end{matlab} If two applications of the microBurst would cover one entire macroscale time-step, then do so (setting some internal states to \verb|NaN|); else proceed to projective step. \begin{matlab} %} if ~isempty(bT) && 2*abs(bT)>=abs(tSpan(jT)-T) && bT*(tSpan(jT)-T)>0 [t1,xm1] = microBurst(T, x(jT-1,:), tSpan(jT)-T); x(jT,:) = xm1(end,:); t2 = nan; xm2 = nan(1,size(xm1,2)); dx1 = xm2; dx2 = xm2; else %{ \end{matlab} Run the first application of the microBurst; since this application directly follows from the initial conditions, or from the latest macrostep, this microscale information is physically meaningful as a simulation of the system. Extract the size of the final time-step. \begin{matlab} %} [t1,xm1] = microBurst(T, x(jT-1,:), bT); %{ \end{matlab} To estimate the derivative by numerical differentiation, we balance approximation error~\(\|\ddot x\|/dt\) with round-off error~\(\|x\|\epsilon/dt\) by the optimal time-step \(dt\approx\sqrt(\|x\|\epsilon/\|\ddot x\|)\). Omit~\(\|\ddot x\|\) as we do not know it. Also, limit~\(dt\) to at most the last tenth of the burst, and at least one step. \begin{matlab} %} nt = length(t1); optdt = min(0.1*(t1(nt)-t1(1)),sqrt(max(rms(xm1))*1e-15)); [~,kt] = min(abs(t1(nt)-optdt-t1(1:nt-1))); ktnt = [kt nt]; del = t1(nt)-t1(kt); %{ \end{matlab} Check for round-off error, and decrease tolerance so that warnings are not repeated unless things get worse. \begin{matlab} %} xt = [reshape(t1(ktnt),[],1) xm1(ktnt,:)]; if norm(diff(xt))/norm(xt,'fro') < roundingTol warning(['significant round-off error in 1st projection at T=' num2str(T)]) roundingTol = roundingTol/10; end %{ \end{matlab} Find the needed time-step to reach time \verb|tSpan(n+1)| and form a first estimate \verb|dx1| of the slow vector field. \begin{matlab} %} Dt = tSpan(jT)-t1(end); dx1 = (xm1(nt,:)-xm1(kt,:))/del; %{ \end{matlab} Project along \verb|dx1| to form an intermediate approximation of~\verb|x|; run another application of the microBurst and form a second estimate of the slow vector field (assuming the burst length is the same, or nearly so). \begin{matlab} %} xint = xm1(end,:) + (Dt-(t1(end)-t1(1)))*dx1; [t2,xm2] = microBurst(T+Dt, xint, bT); %{ \end{matlab} As before, choose~\(dt\) as best we can to estimate derivative. \begin{matlab} %} nt = length(t2); optdt = min(0.1*(t2(nt)-t2(1)),sqrt(max(rms(xm2))*1e-15)); [~,kt] = min(abs(t2(nt)-optdt-t2(1:nt-1))); ktnt = [kt nt]; del = t2(nt)-t2(kt); dx2 = (xm2(nt,:)-xm2(kt,:))/del; %{ \end{matlab} Check for round-off error, and decrease tolerance so that warnings are not repeated unless things get worse. \begin{matlab} %} xt = [reshape(t2(ktnt),[],1) xm2(ktnt,:)]; if norm(diff(xt))/norm(xt,'fro') < roundingTol warning(['significant round-off error in 2nd projection at T=' num2str(T)]) roundingTol = roundingTol/10; end %{ \end{matlab} Use the weighted average of the estimates of the slow vector field to take a macro-step. \begin{matlab} %} x(jT,:) = xm1(end,:) + Dt*(dx1+dx2)/2; %{ \end{matlab} Now end the if-statement that tests whether a projective step saves simulation time. \begin{matlab} %} end %{ \end{matlab} If saving trusted microscale data, then populate the cell arrays for the current loop iterate with the time-steps and output of the first application of the microBurst. Separate bursts by~\verb|NaN|s. \begin{matlab} %} if saveMicro tms{jT} = [reshape(t1,[],1); nan]; xms{jT} = [xm1; nan(1,size(xm1,2))]; %{ \end{matlab} If saving all microscale data, then repeat for the remaining applications of the microBurst. \begin{matlab} %} if saveFullMicro rm.t{jT} = [reshape(t2,[],1); nan]; rm.x{jT} = [xm2; nan(1,size(xm2,2))]; %{ \end{matlab} If saving Projective Integration estimates of the slow vector field, then populate the corresponding cells with times and estimates. \begin{matlab} %} if saveSvf svf.t(2*jT-3:2*jT-2) = [t1(end); t2(end)]; svf.dx(2*jT-3:2*jT-2,:) = [dx1; dx2]; end end end %{ \end{matlab} End the main loop over all the macro-steps. \begin{matlab} %} end %{ \end{matlab} Overwrite \verb|x(1,:)| with the specified initial condition \verb|tSpan(1)|. \begin{matlab} %} x(1,:) = reshape(x0,1,[]); %{ \end{matlab} For additional requested output, concatenate all the cells of time and state data into two arrays. \begin{matlab} %} if saveMicro tms = cell2mat(tms); xms = cell2mat(xms); if saveFullMicro rm.t = cell2mat(rm.t); rm.x = cell2mat(rm.x); end end %{ \end{matlab} \subsection{If no output specified, then plot the simulation} \begin{matlab} %} if nArgOut==0 figure, plot(tSpan,x,'o:') title('Projective Simulation with PIRK2') end %{ \end{matlab} This concludes \verb|PIRK2()|. \begin{matlab} %} end %{ \end{matlab} \end{devMan} %}
github
uoa1184615/EquationFreeGit-master
PIG.m
.m
EquationFreeGit-master/ProjInt/PIG.m
14,213
utf_8
3c6184d1532de0ab1665b48a3cdd7008
% PIG implements Projective Integration scheme with any % inbuilt integrator or user-specified integrator for the % slow-time macroscale, and with any inbuilt/user-specified % microsolver. JM & AJR, Sept 2018 -- Apr 2019. %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{PIG()}: Projective Integration via a General macroscale integrator} \label{sec:PIG} \localtableofcontents \subsection{Introduction} This is a Projective Integration scheme when the macroscale integrator is any specified coded method. The advantage is that one may use \script's inbuilt integration functions, with all their sophisticated error control and adaptive time-stepping, to do the macroscale integration\slash simulation. By default, for the microscale simulations \verb|PIG()| uses `constraint-defined manifold computing', \verb|cdmc()| (\cref{sec:cdmc}). This algorithm, initiated by \cite{Gear05}, uses a backward projection so that the simulation time is unchanged after running the microscale simulator. \begin{matlab} %} function [T,X,tms,xms,svf] = PIG(macroInt,microBurst,Tspan,x0 ... ,restrict,lift,cdmcFlag) %{ \end{matlab} \paragraph{Inputs:} \begin{itemize} \item \verb|macroInt()|, the numerical method that the user wants to apply on a slow-time macroscale. Either specify a standard \script\ integration function (such as \verb|'ode23'| or~\verb|'ode45|'), or code your own integration function using standard arguments. That is, if you code your own, then it must be \begin{equation*} \verb|[Ts,Xs] = macroInt(F,Tspan,X0)| \end{equation*} where \begin{itemize} \item function \verb|F(T,X)| notionally evaluates the time derivatives \(d\Xv/dt\) at any time; \item \verb|Tspan| is either the macro-time interval, or the vector of macroscale times at which macroscale values are to be returned; and \item \verb|X0| are the initial values of~\(\Xv\) at time \verb|Tspan(1)|. \end{itemize} Then the \(i\)th~\emph{row} of~\verb|Xs|, \verb|Xs(i,:)|, is to be the vector~\(\Xv(t)\) at time \(t=\verb|Ts(i)|\). Remember that in \verb|PIG()| the function \verb|F(T,X)| is to be estimated by Projective Integration. \item \verb|microBurst()| is a function that produces output from the user-specified code for a burst of microscale simulation. The function must internally specify\slash decide how long a burst it is to use. Usage \begin{equation*} \verb|[tbs,xbs] = microBurst(tb0,xb0)| \end{equation*} \emph{Inputs:} \verb|tb0| is the start time of a burst; \verb|xb0|~is the \(n\)-vector microscale state at the start of a burst. \emph{Outputs:} \verb|tbs|, the vector of solution times; and \verb|xbs|, the corresponding microscale states. \item \verb|Tspan|, a vector of macroscale times at which the user requests output. The first element is always the initial time. If \verb|macroInt| reports adaptively selected time steps (e.g., \verb|ode45|), then \verb|Tspan| consists of an initial and final time only. \item \verb|x0|, the \(n\)-vector of initial microscale values at the initial time~\verb|Tspan(1)|. \end{itemize} \paragraph{Optional Inputs:} \verb|PIG()| allows for none, two or three additional inputs after~\verb|x0|. If you distinguish distinct microscale and macroscale states and your aim is to do Projective Integration on the macroscale only, then lifting and restriction functions must be provided to convert between them. Usage \verb|PIG(...,restrict,lift)|: \begin{itemize} \item \verb|restrict(x)|, a function that takes an input high-dimensional, \(n\)-D, microscale state~\xv\ and computes the corresponding low-dimensional, \(N\)-D, macroscale state~\Xv; \item \verb|lift(X,xApprox)|, a function that converts an input low-dimensional, \(N\)-D, macroscale state~\Xv\ to a corresponding high-dimensional, \(n\)-D, microscale state~\xv, given that \verb|xApprox| is a recently computed microscale state on the slow manifold. \end{itemize} Either both \verb|restrict()| and \verb|lift()| are to be defined, or neither. If neither are defined, then they are assumed to be identity functions, so that \verb|N=n| in the following. If desired, the default constraint-defined manifold computing microsolver may be disabled, via \verb|PIG(...,restrict,lift,cdmcFlag)| \begin{itemize} \item \verb|cdmcFlag|, \emph{any} seventh input to \verb|PIG()|, will disable \verb|cdmc()|, e.g., the string \verb|'cdmc off'|. \end{itemize} If the \verb|cdmcFlag| is to be set without using a \verb|restrict()| or \verb|lift()| function, then use empty matrices~\verb|[]| for the restrict and lift functions. \paragraph{Output} Between zero and five outputs may be requested. If there are no output arguments specified, then a plot is drawn of the computed solution~\verb|X| versus~\verb|T|. Most often you would store the first two output results of \verb|PIG()|, via say \verb|[T,X] = PIG(...)|. \begin{itemize} \item \verb|T|, an \(L\)-vector of times at which \verb|macroInt| produced results. \item \verb|X|, an \(L \times N\) array of the computed solution: the \(i\)th~\emph{row} of~\verb|X|, \verb|X(i,:)|, is to be the macro-state vector~\(\Xv(t)\) at time \(t=\verb|T(i)|\). \end{itemize} However, microscale details of the underlying Projective Integration computations may be helpful, and so \verb|PIG()| provides some optional outputs of the microscale bursts, via \verb|[T,X,tms,xms] = PIG(...)| \begin{itemize} \item \verb|tms|, optional, is an \(\ell\)-dimensional column vector containing microscale times with bursts, each burst separated by~\verb|NaN|; \item \verb|xms|, optional, is an \(\ell\times n\) array of the corresponding microscale states. \end{itemize} In some contexts it may be helpful to see directly how Projective Integration approximates a reduced slow vector field, via \verb|[T,X,tms,xms,svf] = PIG(...)| in which \begin{itemize} \item \verb|svf|, optional, a struct containing the Projective Integration estimates of the slow vector field. \begin{itemize} \item \verb|svf.T| is a \(\hat L\)-dimensional column vector containing all times at which the microscale simulation data is extrapolated to form an estimate of \(d\xv/dt\) in \verb|macroInt()|. \item \verb|svf.dX| is a \(\hat L\times N\) array containing the estimated slow vector field. \end{itemize} \end{itemize} If \verb|macroInt()| is, for example, the forward Euler method (or the Runge--Kutta method), then \(\hat L = L\) (or \(\hat L = 4L \)). \subsection{If no arguments, then execute an example} \label{sec:pigeg} \begin{matlab} %} if nargin==0 %{ \end{matlab} \begin{figure} \centering \caption{\label{fig:PIGsing}Projective Integration by \texttt{PIG} of the example system~\eqref{eq:PIGsing} with \(\epsilon=10^{-3}\) (\cref{sec:pigeg}). The macroscale solution~\(X(t)\) is represented by just the blue circles. The microscale bursts are the microscale states \((x_1(t),x_2(t)) = (\text{red},\text{yellow})\) dots.} \includegraphics[scale=0.9]{PIGsing} \end{figure}% As a basic example, consider a microscale system of the singularly perturbed system of differential equations \begin{equation} \frac{dx_1}{dt}=\cos(x_1)\sin(x_2)\cos(t) \quad\text{and}\quad \frac{dx_2}{dt}=\frac1\epsilon\big[\cos(x_1)-x_2\big]. \label{eq:PIGsing} \end{equation} The macroscale variable is \(X(t)=x_1(t)\), and the evolution \(dX/dt\) is unclear. With initial condition \(X(0)=1\), the following code computes and plots a solution of the system~\eqref{eq:PIGsing} over time \(0\leq t\leq6\) for parameter \(\epsilon=10^{-3}\)(\cref{fig:PIGsing}). Whenever needed by \verb|microBurst()|, the microscale system~\eqref{eq:PIGsing} is initialised (`\verb|lift|ed') using \(x_2(t) = x_2^{\text{approx}}\) (yellow dots in \cref{fig:PIGsing}). First we code the right-hand side function of the microscale system~\eqref{eq:PIGsing} of \ode{}s. \begin{matlab} %} epsilon = 1e-3; dxdt=@(t,x) [ cos(x(1))*sin(x(2))*cos(t) ( cos(x(1))-x(2) )/epsilon ]; %{ \end{matlab} Second, we code microscale bursts, here using the standard \verb|ode45()|. We choose a burst length \(2 \epsilon \log(1/\epsilon)\) as the rate of decay is \(\beta\approx 1/\epsilon\) but we do not know the macroscale time-step invoked by \verb|macroInt()|, so blithely assume \(\Delta\le1\) and then double the usual formula for safety. \begin{matlab} %} bT = 2*epsilon*log(1/epsilon) if ~exist('OCTAVE_VERSION','builtin') micB='ode45'; else micB='rk2Int'; end microBurst = @(tb0, xb0) feval(micB,dxdt,[tb0 tb0+bT],xb0); %{ \end{matlab} Third, code functions to convert between macroscale and microscale states. \begin{matlab} %} restrict = @(x) x(1); lift = @(X,xApprox) [X; xApprox(2)]; %{ \end{matlab} Fourth, invoke \verb|PIG| to use \script's \verb|ode23|\slash\verb|lsode|, say, on the macroscale slow evolution. Integrate the micro-bursts over \(0\leq t\leq6\) from initial condition \(\xv(0)=(1,0)\). You could set \verb|Tspan=[0 -6]| to integrate backward in macroscale time with forward microscale bursts \cite[]{Gear03b, Frewen2009}. \begin{matlab} %} Tspan = [0 6]; x0 = [1;0]; if ~exist('OCTAVE_VERSION','builtin') macInt='ode23'; else macInt='odeOct'; end [Ts,Xs,tms,xms] = PIG(macInt,microBurst,Tspan,x0,restrict,lift); %{ \end{matlab} Plot output of this projective integration. \begin{matlab} %} figure, plot(Ts,Xs,'o:',tms,xms,'.') title('Projective integration of singularly perturbed ODE') xlabel('time t') legend('X(t) = x_1(t)','x_1(t) micro bursts','x_2(t) micro bursts') %{ \end{matlab} Upon finishing execution of the example, exit this function. \begin{matlab} %} return end%if no arguments %{ \end{matlab} \begin{devMan} \subsection{The projective integration code} If no lifting/restriction functions are provided, then assign them to be the identity functions. \begin{matlab} %} if nargin < 5 || isempty(restrict) lift=@(X,xApprox) X; restrict=@(x) x; end %{ \end{matlab} Get the number of expected outputs and set logical indices to flag what data should be saved. \begin{matlab} %} nArgOut = nargout(); saveMicro = (nArgOut>2); saveSvf = (nArgOut>4); %{ \end{matlab} Find the number of time-steps at which output is expected, and the number of variables. \begin{matlab} %} nT = length(Tspan)-1; nx = length(x0); nX = length(restrict(x0)); %{ \end{matlab} Reformulate the microsolver to use \verb|cdmc()|, unless flagged otherwise. The result is that the solution from microBurst will terminate at the given initial time. % Should be OK in Octave. \begin{matlab} %} if nargin<7 microBurst = @(t,x) cdmc(microBurst,t,x); else warning(['A ' class(cdmcFlag) ' seventh input to PIG().'... ' PIG will not use constraint-defined manifold computing.']) end %{ \end{matlab} Execute a preliminary application of the microBurst on the initial state. This is done in addition to the microBurst in the main loop, because the initial state is often far from the attracting slow manifold. \begin{matlab} %} [relaxT,x0MicroRelax] = microBurst(Tspan(1),x0); xMicroLast = x0MicroRelax(end,:).'; X0Relax = restrict(xMicroLast); %{ \end{matlab} Update the initial time. \begin{matlab} %} Tspan(1) = relaxT(end); %{ \end{matlab} Allocate cell arrays for times and states for any of the outputs requested by the user. If saving information, then record the first application of the microBurst. It is unknown a priori how many applications of microBurst will be required; this code may be run more efficiently if the correct number is used in place of \verb|nT+1| as the dimension of the cell arrays. \begin{matlab} %} if saveMicro tms=cell(nT+1,1); xms=cell(nT+1,1); n=1; tms{n} = reshape(relaxT,[],1); xms{n} = x0MicroRelax; if saveSvf svf.T = cell(nT+1,1); svf.dX = cell(nT+1,1); else svf = []; end else tms = []; xms = []; svf = []; end %{ \end{matlab} \paragraph{Define a function of macro simulation} The idea of \verb|PIG()| is to use the output from the \verb|microBurst()| to approximate an unknown function \verb|F(t,X)| that computes \(d\Xv/dt\). This approximation is then used in the system\slash user-defined `coarse solver' \verb|macroInt()|. The approximation is computed in the function \begin{matlab} %} function [dXdt]=PIFun(t,X) %{ \end{matlab} Run a microBurst from the given macroscale initial values. \begin{matlab} %} x = lift(X,xMicroLast); [tTmp,xMicroTmp] = microBurst(t,reshape(x,[],1)); xMicroLast = xMicroTmp(end,:).'; %{ \end{matlab} Compute the standard Projective Integration approximation of the slow vector field. \begin{matlab} %} X2 = restrict(xMicroTmp(end,:)); X1 = restrict(xMicroTmp(end-1,:)); dt = tTmp(end)-tTmp(end-1); dXdt = (X2 - X1).'/dt; %{ \end{matlab} Save the microscale data, and the Projective Integration slow vector field, if requested. \begin{matlab} %} if saveMicro n=n+1; tms{n} = [reshape(tTmp,[],1); nan]; xms{n} = [xMicroTmp; nan(1,nx)]; if saveSvf svf.T{n-1} = t; svf.dX{n-1} = dXdt; end end end% PIFun function %{ \end{matlab} \paragraph{Invoke the macroscale integration} Integrate \verb|PIF()| with the user-specified simulator \verb|macroInt()|. For some reason, in \script\ we need to use a one-line function, \verb|PIF|, that invokes the above macroscale function, \verb|PIFun|. We also need to use \verb|feval| because \verb|macroInt()| has multiple outputs. \begin{matlab} %} PIF = @(t,x) PIFun(t,x); [T,X] = feval(macroInt,PIF,Tspan,X0Relax.'); %{ \end{matlab} Overwrite \verb|X(1,:)| and \verb|T(1)|, which a user expects to be \verb|X0| and \verb|Tspan(1)| respectively, with the given initial conditions. \begin{matlab} %} X(1,:) = restrict(x0); T(1) = Tspan(1); %{ \end{matlab} Concatenate all the additional requested outputs into arrays. \begin{matlab} %} if saveMicro tms = cell2mat(tms); xms = cell2mat(xms); if saveSvf svf.T = cell2mat(svf.T); svf.dX = cell2mat(svf.dX); end end %{ \end{matlab} \subsection{If no output specified, then plot the simulation} \begin{matlab} %} if nArgOut==0 figure, plot(T,X,'o:') title('Projective Simulation via PIG') end %{ \end{matlab} This concludes \verb|PIG()|. \begin{matlab} %} end %{ \end{matlab} \end{devMan} %}
github
uoa1184615/EquationFreeGit-master
linearBurst.m
.m
EquationFreeGit-master/ProjInt/linearBurst.m
839
utf_8
ebbd668d39488aea22480543f39ccaa4
% Used by PIRKexample.m % AJR, Apr 2019 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \paragraph{A micro-burst simulation} Used by \verb|PIRKexample.m|. Code the micro-burst function using simple Euler steps. As a rule of thumb, the time-steps \verb|dt| should satisfy $\verb|dt| \le 1/|\verb|fastband|(1)|$ and the time to simulate with each application of the microsolver, \verb|bT|, should be larger than or equal to $1/|\verb|fastband|(2)|$. We set the integration scheme to be used in the microsolver. Since the time-steps are so small, we just use the forward Euler scheme \begin{matlab} %} function [ts, xs] = linearBurst(ti, xi, varargin) global dxdt dt = 0.001; ts = ti+(0:dt:0.05)'; nts = length(ts); xs = NaN(nts,length(xi)); xs(1,:)=xi; for k=2:nts xi = xi + dt*dxdt(ts(k),xi.').'; xs(k,:)=xi; end end %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
PIRK4.m
.m
EquationFreeGit-master/ProjInt/PIRK4.m
12,579
utf_8
9c94ee399df7625a5a3c86670fa4309f
% PIRK4 implements fourth-order Projective Integration with % a user-specified microsolver. The macrosolver adapts the % explicit fourth-order Runge--Kutta scheme. % JM, Oct 2018--Apr 2019. %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{PIRK4()}: projective integration of fourth-order accuracy} \label{sec:PIRK4} \localtableofcontents \subsection{Introduction} This Projective Integration scheme implements a macrosolver analogous to the fourth-order Runge--Kutta method. \begin{matlab} %} function [x, tms, xms, rm, svf] = PIRK4(microBurst, tSpan, x0, bT) %{ \end{matlab} See \cref{sec:PIRK2} as the inputs and outputs are the same as \verb|PIRK2()|. \paragraph{If no arguments, then execute an example} \begin{matlab} %} if nargin==0 %{ \end{matlab} \subparagraph{Example of Michaelis--Menton backwards in time} The Michaelis--Menten enzyme kinetics is expressed as a singularly perturbed system of differential equations for \(x(t)\) and~\(y(t)\) (encoded in function \verb|MMburst|): \begin{equation*} \frac{dx}{dt}=-x+(x+\tfrac12)y \quad\text{and}\quad \frac{dy}{dt}=\frac1\epsilon\big[x-(x+1)y\big]. \end{equation*} With initial conditions \(x(0)=y(0)=0.2\), the following code uses forward time bursts in order to integrate backwards in time to \(t=-5\) \cite[e.g.]{Frewen2009}. It plots the computed solution over time \(-5\leq t\leq0\) for parameter \(\epsilon=0.1\)\,. Since the rate of decay is \(\beta\approx 1/\epsilon\) we choose a burst length \(\epsilon\log(|\Delta|/\epsilon)\) as here the macroscale time-step \(\Delta=-1\). \begin{matlab} %} global MMepsilon MMepsilon = 0.1 ts = 0:-1:-5 bT = MMepsilon*log(abs(ts(2)-ts(1))/MMepsilon) [x,tms,xms,rm,svf] = PIRK4(@MMburst, ts, 0.2*[1;1], bT); figure, plot(ts,x,'o:',tms,xms) xlabel('time t'), legend('x(t)','y(t)') title('Backwards-time projective integration of Michaelis--Menten') %{ \end{matlab} Upon finishing execution of the example, exit this function. \begin{matlab} %} return end%if no arguments %{ \end{matlab} \input{../ProjInt/MMburst.m} \input{../ProjInt/odeOct.m} \begin{devMan} \paragraph{Input} If there are no input arguments, then this function applies itself to the Michaelis--Menton example: see the code in \cref{sec:pirk2eg} as a basic template of how to use. \begin{itemize} \item \verb|microBurst()|, a user-coded function that computes a short-time burst of the microscale simulation. \begin{verbatim} [tOut, xOut] = microBurst(tStart, xStart, bT) \end{verbatim} \begin{itemize} \item Inputs: \verb|tStart|,~the start time of a burst of simulation; \(\verb|xStart|\),~the row \(n\)-vector of the starting state; \verb|bT|, \emph{optional}, the total time to simulate in the burst---if your \verb|microBurst()| determines the burst time, then replace~\verb|bT| in the argument list by~\verb|varargin|. \item Outputs: \verb|tOut|,~the column vector of solution times; and \verb|xOut|,~an array in which each \emph{row} contains the system state at corresponding times. \end{itemize} \item \verb|tSpan| is an \(\ell\)-vector of times at which the user requests output, of which the first element is always the initial time. \verb|PIRK4()| does not use adaptive time-stepping; the macroscale time-steps are (nearly) the steps between elements of \verb|tSpan|. \item \verb|x0| is an \(n\)-vector of initial values at the initial time \verb|tSpan(1)|. Elements of~\verb|x0| may be \verb|NaN|: such \verb|Nan|s are carried in the simulation through to the output, and often represent boundaries\slash edges in spatial fields. \item \verb|bT|, \emph{optional}, either missing, or empty~(\verb|[]|), or a scalar: if a given scalar, then it is the length of the micro-burst simulations---the minimum amount of time needed for the microscale simulation to relax to the slow manifold; else if missing or~\verb|[]|, then \verb|microBurst()| must itself determine the length of a burst. \begin{matlab} %} if nargin<4, bT=[]; end %{ \end{matlab} \end{itemize} \paragraph{Output} If there are no output arguments specified, then a plot is drawn of the computed solution~\verb|x| versus \verb|tSpan|. \begin{itemize} \item \verb|x|, an \(\ell \times n\) array of the approximate solution vector. Each row is an estimated state at the corresponding time in \verb|tSpan|. The simplest usage is then \verb|x = PIRK4(microBurst,tSpan,x0,bT)|. However, microscale details of the underlying Projective Integration computations may be helpful. \verb|PIRK4()| provides up to four optional outputs of the microscale bursts. \item \verb|tms|, optional, is an \(L\) dimensional column vector containing the microscale times within the burst simulations, each burst separated by~\verb|NaN|; \item \verb|xms|, optional, is an \(L\times n\) array of the corresponding microscale states---each rows is an accurate estimate of the state at the corresponding time~\verb|tms| and helps visualise details of the solution. \item \verb|rm|, optional, a struct containing the `remaining' applications of the microBurst required by the Projective Integration method during the calculation of the macrostep: \begin{itemize} \item \verb|rm.t|~is a column vector of microscale times; and \item \verb|rm.x|~is the array of corresponding burst states. \end{itemize} The states \verb|rm.x| do not have the same physical interpretation as those in \verb|xms|; the \verb|rm.x| are required in order to estimate the slow vector field during the calculation of the Runge--Kutta increments, and do \emph{not} accurately approximate the macroscale dynamics. \item \verb|svf|, optional, a struct containing the Projective Integration estimates of the slow vector field. \begin{itemize} \item \verb|svf.t| is a \(4\ell\) dimensional column vector containing all times at which the Projective Integration scheme is extrapolated along microBurst data to form a macrostep. \item \verb|svf.dx| is a \(4\ell\times n\) array containing the estimated slow vector field. \end{itemize} \end{itemize} \subsection{The projective integration code} Determine the number of time-steps and preallocate storage for macroscale estimates. \begin{matlab} %} nT = length(tSpan); x = nan(nT,length(x0)); %{ \end{matlab} Get the number of expected outputs and set logical indices to flag what data should be saved. \begin{matlab} %} nArgOut = nargout(); saveMicro = (nArgOut>1); saveFullMicro = (nArgOut>3); saveSvf = (nArgOut>4); %{ \end{matlab} Run a preliminary application of the micro-burst on the initial state to help relax to the slow manifold. This is done in addition to the micro-burst in the main loop, because the initial state is often far from the attracting slow manifold. Require the user to input and output rows of the system state. \begin{matlab} %} x0 = reshape(x0,1,[]); [relax_t,relax_x0] = microBurst(tSpan(1),x0,bT); %{ \end{matlab} Use the end point of the micro-burst as the initial state for the macroscale time-steps. \begin{matlab} %} tSpan(1) = relax_t(end); x(1,:) = relax_x0(end,:); %{ \end{matlab} If saving information, then record the first application of the micro-burst. Allocate cell arrays for times and states for outputs requested by the user, as concatenating cells is much faster than iteratively extending arrays. \begin{matlab} %} if saveMicro tms = cell(nT,1); xms = cell(nT,1); tms{1} = reshape(relax_t,[],1); xms{1} = relax_x0; if saveFullMicro rm.t = cell(nT,1); rm.x = cell(nT,1); if saveSvf svf.t = nan(4*nT-4,1); svf.dx = nan(4*nT-4,length(x0)); end end end %{ \end{matlab} \paragraph{Loop over the macroscale time-steps} \begin{matlab} %} for jT = 2:nT T = tSpan(jT-1); %{ \end{matlab} If four applications of the micro-burst would cover the entire macroscale time-step, then do so (setting some internal states to \verb|NaN|); else proceed to projective step. \begin{matlab} %} if ~isempty(bT) && 4*abs(bT)>=abs(tSpan(jT)-T) && bT*(tSpan(jT)-T)>0 [t1,xm1] = microBurst(T, x(jT-1,:), tSpan(jT)-T); x(jT,:) = xm1(end,:); t2=nan; xm2=nan(1,size(xm1,2)); t3=nan; t4=nan; xm3=xm2; xm4 = xm2; dx1=xm2; dx2=xm2; else %{ \end{matlab} Run the first application of the micro-burst; since this application directly follows from the initial conditions, or from the latest macrostep, this microscale information is physically meaningful as a simulation of the system. Extract the size of the final time-step. \begin{matlab} %} [t1,xm1] = microBurst(T, x(jT-1,:), bT); del = t1(end)-t1(end-1); %{ \end{matlab} Check for round-off error. \begin{matlab} %} xt = [reshape(t1(end-1:end),[],1) xm1(end-1:end,:)]; roundingTol = 1e-8; if norm(diff(xt))/norm(xt,'fro') < roundingTol warning(['significant round-off error in 1st projection at T=' num2str(T)]) end %{ \end{matlab} Find the needed time-step to reach time \verb|tSpan(n+1)| and form a first estimate \verb|dx1| of the slow vector field. \begin{matlab} %} Dt = tSpan(jT)-t1(end); dx1 = (xm1(end,:)-xm1(end-1,:))/del; %{ \end{matlab} \emph{Assume} burst times are the same length for this macro-step, or effectively so (recall that \verb|bT| may be empty as it may be only coded and known in \verb|microBurst()|). \begin{matlab} %} abT = t1(end)-t1(1); %{ \end{matlab} Project along \verb|dx1| to form an intermediate approximation of \verb|x|; run another application of the micro-burst and form a second estimate of the slow vector field. \begin{matlab} %} xint = xm1(end,:) + (Dt/2-abT)*dx1; [t2,xm2] = microBurst(T+Dt/2, xint, bT); del = t2(end)-t2(end-1); dx2 = (xm2(end,:)-xm2(end-1,:))/del; xint = xm1(end,:) + (Dt/2-abT)*dx2; [t3,xm3] = microBurst(T+Dt/2, xint, bT); del = t3(end)-t3(end-1); dx3 = (xm3(end,:)-xm3(end-1,:))/del; xint = xm1(end,:) + (Dt-abT)*dx3; [t4,xm4] = microBurst(T+Dt, xint, bT); del = t4(end)-t4(end-1); dx4 = (xm4(end,:)-xm4(end-1,:))/del; %{ \end{matlab} Check for round-off error. \begin{matlab} %} xt = [reshape(t2(end-1:end),[],1) xm2(end-1:end,:)]; if norm(diff(xt))/norm(xt,'fro') < roundingTol warning(['significant round-off error in 2nd projection at T=' num2str(T)]) end %{ \end{matlab} Use the weighted average of the estimates of the slow vector field to take a macrostep. \begin{matlab} %} x(jT,:) = xm1(end,:) + Dt*(dx1 + 2*dx2 + 2*dx3 + dx4)/6; %{ \end{matlab} Now end the if-statement that tests whether a projective step saves simulation time. \begin{matlab} %} end %{ \end{matlab} If saving trusted microscale data, then populate the cell arrays for the current loop iterate with the time-steps and output of the first application of the micro-burst. Separate bursts by~\verb|NaN|s. \begin{matlab} %} if saveMicro tms{jT} = [reshape(t1,[],1); nan]; xms{jT} = [xm1; nan(1,size(xm1,2))]; %{ \end{matlab} If saving all microscale data, then repeat for the remaining applications of the micro-burst. \begin{matlab} %} if saveFullMicro rm.t{jT} = [reshape(t2,[],1); nan;... reshape(t3,[],1); nan;... reshape(t4,[],1); nan]; rm.x{jT} = [xm2; nan(1,size(xm2,2));... xm3; nan(1,size(xm2,2));... xm4; nan(1,size(xm2,2))]; %{ \end{matlab} If saving Projective Integration estimates of the slow vector field, then populate the corresponding cells with times and estimates. \begin{matlab} %} if saveSvf svf.t(4*jT-7:4*jT-4) = [t1(end); t2(end); t3(end); t4(end)]; svf.dx(4*jT-7:4*jT-4,:) = [dx1; dx2; dx3; dx4]; end end end %{ \end{matlab} End of the main loop of all macro-steps. \begin{matlab} %} end %{ \end{matlab} Overwrite \verb|x(1,:)| with the specified initial state \verb|tSpan(1)|. \begin{matlab} %} x(1,:) = reshape(x0,1,[]); %{ \end{matlab} For additional requested output, concatenate all the cells of time and state data into two arrays. \begin{matlab} %} if saveMicro tms = cell2mat(tms); xms = cell2mat(xms); if saveFullMicro rm.t = cell2mat(rm.t); rm.x = cell2mat(rm.x); end end %{ \end{matlab} \subsection{If no output specified, then plot the simulation} \begin{matlab} %} if nArgOut==0 figure, plot(tSpan,x,'o:') title('Projective Simulation with PIRK4') end %{ \end{matlab} This concludes \verb|PIRK4()|. \begin{matlab} %} end %{ \end{matlab} \end{devMan} %}
github
uoa1184615/EquationFreeGit-master
rk2Int.m
.m
EquationFreeGit-master/ProjInt/rk2Int.m
2,458
utf_8
73bec46b0040fb09024a567dff167dee
% rk2Int() is a simple example of Runge--Kutta, 2nd order, % integration of a given deterministic ODE. Used by % PIG.m, PIGExample.m, PIGExplore.m, homogenisationExample.m % AJR, 4 Apr 2019 %{ This is a simple example of Runge--Kutta, 2nd order, integration of a given deterministic \ode. \begin{matlab} %} function [ts,xs,errs] = rk2Int(dxdt,ts,x0) %{ \end{matlab} \paragraph{Input} \begin{itemize} \item \verb|dxdt()| is a function such as \verb|dxdt=dxdt(t,x)| that computes the right-hand side of the \ode\ \(d\xv/dt=\fv(\xv,t)\) where \xv~is a column vector, say in \(\RR^n\) for \(n\geq1\)\,, \(t\)~is a scalar, and the result~\fv\ is a column vector in~\(\RR^n\). \item \verb|x0| is an \(\RR^n\) vector of initial values at the time \verb|ts(1)|. \item \verb|ts| is the begin and end times of the integration, or vector of proposed micro-times. \end{itemize} \paragraph{Output} \begin{itemize} \item \verb|ts|, vector of~$\ell$ times (guess $\ell=11$). \item \verb|xs|, array in \(\RR^{\ell\times n}\) of approximate solution row vector at the specified times. \end{itemize} Compute the time-steps and create storage for outputs. Guess that ten time-steps is often adequate, but need at least sixty for homogenisationExample. \begin{matlab} %} ndt=max(10,numel(ts)-1); maxtry=6; for itry=1:maxtry ts = linspace(ts(1),ts(end),ndt+1).'; dt = diff(ts); xs = nan(numel(x0),numel(ts)); errs = nan(numel(ts),1); %{ \end{matlab} Initialise first result to the given initial condition, and evaluate the initial time derivative into~\verb|f1|. \begin{matlab} %} xs(:,1) = x0(:); errs(1) = 0; f1 = dxdt(ts(1),xs(:,1)); %{ \end{matlab} Compute the time-steps from~\(t_k\) to~\(t_{k+1}\), copying the derivative~\verb|f1| at the end of the last time-step to be the derivative at the start of this one. \begin{matlab} %} for k = 1:ndt f0 = f1; %{ \end{matlab} Simple second-order accurate time-step. \begin{matlab} %} xh = xs(:,k)+f0*dt(k)/2; fh = dxdt(ts(k)+dt(k)/2,xh); xs(:,k+1) = xs(:,k)+fh*dt(k); f1 = dxdt(ts(k+1),xs(:,k+1)); %{ \end{matlab} Use the time derivative at~\(t_{k+1}\) to estimate an error by storing the difference with what Simpson's rule would estimate. \begin{matlab} %} errs(k+1) = norm(f0-2*fh+f1)*dt(k)/6; end if norm(errs)<0.01*norm(xs(~isnan(xs)),1),break,end ndt = ndt*3; % triple the number of time steps if itry==maxtry, error('too many step reductions in rk2Int'), end end% try-loop xs = xs.'; %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
MMburst.m
.m
EquationFreeGit-master/ProjInt/MMburst.m
914
utf_8
cc5651080a0e3428d0668d1514648bbb
% Short explanation for users typing "help fun" % Author, date %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \paragraph{Code a burst of Michaelis--Menten enzyme kinetics} Integrate a burst of length~\verb|bT| of the \ode{}s for the Michaelis--Menten enzyme kinetics at parameter~\(\epsilon\) inherited from above. Code \textsc{ode}s in function~\verb|dMMdt| with variables \(x=\verb|x(1)|\) and \(y=\verb|x(2)|\). Starting at time~\verb|ti|, and state~\verb|xi| (row), we here simply use \script's \verb|ode23|\slash\verb|lsode| to integrate a burst in time. \begin{matlab} %} function [ts, xs] = MMburst(ti, xi, bT) global MMepsilon dMMdt = @(t,x) [ -x(1)+(x(1)+0.5)*x(2) 1/MMepsilon*( x(1)-(x(1)+1)*x(2) ) ]; if ~exist('OCTAVE_VERSION','builtin') [ts, xs] = ode23(dMMdt, [ti ti+bT], xi); else % octave version [ts, xs] = odeOct(dMMdt, [ti ti+bT], xi); end end %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
odeOct.m
.m
EquationFreeGit-master/ProjInt/odeOct.m
508
utf_8
8be6e35ca6931e20fbe997ac46b7015f
% Provides Matlab-like front-end to Octave ODE solver. But % cannot use lsode, and hence this, recursively. Used by % MMburst.m, PIG.m, PIGExample.m, PIGExplore.m % AJR, 4 Apr 2019 %{ \begin{matlab} %} function [ts,xs] = odeOct(dxdt,tSpan,x0) if length(tSpan)>2, ts = tSpan; else ts = linspace(tSpan(1),tSpan(end),21); end % mimic ode45 and ode23, but much slower for non-PI lsode_options('integration method','non-stiff'); xs = lsode(@(x,t) dxdt(t,x),x0,ts); end %{ \end{matlab} %}
github
uoa1184615/EquationFreeGit-master
bbgen.m
.m
EquationFreeGit-master/ProjInt/bbgen.m
1,062
utf_8
98e5f46df9870706e518440596bec800
%Generate a `black-box' microsolver suitable for PI from a standard %numerical method, an ordinary differential equation, and a given upper %bound on the time-step. %JM,Sept 2018. %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \subsection{\texttt{bbgen()}} \label{sec:bbgen} \verb|bbgen()| is a simple function that takes a standard numerical method and produces a black-box solver of the type required by the PI schemes. \begin{matlab} %} function bb = bbgen(solver,f,dt) %{ \end{matlab} \paragraph{Input} \begin{itemize} \item \verb|solver|, a standard numerical solver for ordinary differential equations \item \verb|f|, a function f(t,x) taking time and state inputs \item \verb|dt|, a time-step suitable for simulation with \verb|f| \end{itemize} \paragraph{Output} \verb|bb = bb|\((t_{in},x_{in},T)\) a `black-box' microsolver that initialises at \( (t_{in},x_{in}) \) and simulates forward a duration \(T\). \begin{devMan} \begin{matlab} %} bb = @(t_in,x_in,T) feval(solver,f,... linspace(t_in,t_in+T,1+ceil(T/dt)),x_in); end %{ \end{matlab} \end{devMan} %}
github
uoa1184615/EquationFreeGit-master
cdmc.m
.m
EquationFreeGit-master/ProjInt/cdmc.m
2,446
utf_8
d12a17f15f6948ac9b557d3c5befd9a3
% Relax a given initial condition to one onto the slow % manifold by two steps of the 'xmas-tree' algorithm. % JM & AJR, July 2018 -- Apr 2019 %!TEX root = ../Doc/eqnFreeDevMan.tex %{ \section{\texttt{cdmc()}: constraint defined manifold computing} \label{sec:cdmc} The function \verb|cdmc()| iteratively applies the given micro-burst and then projects backward to the initial time. The cumulative effect is to relax the variables to the attracting slow manifold, while keeping the `final' time for the output the same as the input time. \begin{matlab} %} function [ts, xs] = cdmc(microBurst, t0, x0) %{ \end{matlab} \paragraph{Input} \begin{itemize} \item \verb|microBurst()|, a black-box micro-burst function suitable for Projective Integration. See any of \verb|PIRK2()|, \verb|PIRK4()|, or \verb|PIG()| for a description of \verb|microBurst()|. \item \verb|t0|, an initial time. \item \verb|x0|, an initial state vector. \end{itemize} \paragraph{Output} \begin{itemize} \item \verb|ts|, a vector of times. \item \verb|xs|, an array of state estimates produced by \verb|microBurst()|. \end{itemize} This function is a wrapper for the micro-burst. For instance if the problem of interest is a dynamical system that is not too stiff, and which is simulated by the micro-burst function \verb|sol(t,x)|, one would invoke \verb|cdmc()| by defining \begin{verbatim} cdmcSol = @(t,x) cdmc(sol,t,x)| \end{verbatim} and thereafter use \verb|cdmcSol()| in place of \verb|sol()| as the microBurst in any Projective Integration scheme. The original microBurst \verb|sol()| could create large errors if used in the \verb|PIG()| scheme, but the output via \verb|cdmc()| should not. \begin{devMan} Begin with a standard application of the micro-burst. Need \verb|feval| as \verb|microBurst| has multiple outputs. \begin{matlab} %} [t1,x1] = feval(microBurst,t0,x0); bT = t1(end)-t1(1); %{ \end{matlab} Project backwards to before the initial time, then simulate just one burst forward to obtain a simulation burst that ends at the original~\verb|t0|. \begin{matlab} %} dxdt = (x1(end,:) - x1(end-1,:))/(t1(end) - t1(end-1)); x0 = x1(end,:)-2*bT*dxdt; t0 = t1(1)-bT; [t2,x2] = feval(microBurst,t0,x0.'); %{ \end{matlab} Return both sets of output(?), although only \verb|(t2,x2)| should be used in Projective Integration---maybe safer to return only \verb|(t2,x2)|. \begin{matlab} %} ts = [t1(:); t2(:)]; xs = [x1; x2]; %{ \end{matlab} \end{devMan} %}
github
PamirGhimire/visualServoing_ROSProject-master
checkratio.m
.m
visualServoing_ROSProject-master/IBVS_QrPointsBased/MATLAB/qrIdentifierDetection/checkratio.m
442
utf_8
60435c493dc630593aabf762f3736443
%% Function for checking bwbwb ratio for qr identifier detection % correct ratio = 1:1:3:1:1 % Pamir Ghimire, December 10, 2017 function ratiopositive = checkratio(b1, w1, b2, w2, b3) ratiopositive = false; input = [b1, w1, b2, w2, b3]; desired = [1, 1, 3, 1, 1]; input = input / min(input); tolerance = 0.7; if (norm(input - desired, 2) < tolerance) ratiopositive = true; else ratiopositive = false; end end
github
SergioMarreroMarrero/OldWorks-master
TaluDMet.m
.m
OldWorks-master/3)slopeSoftwareOptimized/Software/3.Interfaz guide/TaluDMet.m
41,106
utf_8
9f552c51f9fcf44098c45a2dd8fe1693
function varargout = TaluDMet(varargin) % TALUDMET MATLAB code for TaluDMet.fig % TALUDMET, by itself, creates coordenadax new TALUDMET or raises the existing % singleton*. % % Altura = TALUDMET returns the handle to coordenadax new TALUDMET or the handle to % the existing singleton*. % % TALUDMET('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in TALUDMET.M with the given input arguments. % % TALUDMET('Property','Value',...) creates coordenadax new TALUDMET or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before TaluDMet_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to TaluDMet_OpeningFcn via varargin. % % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one % instance to run (singleton)". % % See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the response to help TaluDMet % Last Modified by GUIDE v2.5 21-Jul-2015 12:58:14 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @TaluDMet_OpeningFcn, ... 'gui_OutputFcn', @TaluDMet_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []); if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end % End initialization code - DO NOT EDIT % --- Executes just before TaluDMet is made visible. function TaluDMet_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn. % hObject handle to figure % eventdata reserved - to be defined in coordenadax future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin command line arguments to TaluDMet (see VARARGIN) inicio % Choose default command line output for TaluDMet handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes TaluDMet wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = TaluDMet_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure % eventdata reserved - to be defined in coordenadax future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Get default command line output from handles structure varargout{1} = handles.output; % --- Executes on button press in dibujar. function dibujar_Callback(hObject, eventdata, handles) % hObject handle to dibujar (see GCBO) % eventdata reserved - to be defined in coordenadax future version of MATLAB % handles structure with handles and user data (see GUIDATA) %% Cambio de valores % Borrados try delete(handles.SuperficieTalud) end borradosparaploteos; borrarelmarco H=handles.H; B=handles.B; try axes(handles.axes1); % TALUD [x_talud,y_talud]=dibujotalud(H,B); handles.SuperficieTalud=plot(x_talud,y_talud,'k','LineWidth',3); axis equal hold on catch errordlg('Faltan datos por introducir','ERROR'); end a=handles.a; b=handles.b; R=handles.R; rebanadas=handles.rebanadas; try % DESlIZAMIENTO dibujodeslizamiento %% Plot Circunferencia handles.Circunferencia=plot(x_circunfe,y_circunfe,'y','LineWidth',1); %% Plot centro de circunferencia handles.CentroCirc=plot(a,b,'*r','LineWidth',2); %% Plot arco de circunferencia handles.ArcoCircunf=plot(arco_talud_x,arco_talud_y,'r','LineWidth',2); axis equal end vp=[handles.vpx handles.vpy]; vf=[handles.vfx handles.vfy]; vh=[handles.vpx handles.vfy]; vb=[handles.vfx handles.vpy]; try % Lineas handles.lynea1=line([vp(1) vh(1)],[vp(2) vh(2)]); handles.lynea2=line([vh(1) vf(1)],[vh(2) vf(2)]); handles.lynea3=line([vf(1) vb(1)],[vf(2) vb(2)]); handles.lynea4=line([vb(1) vp(1)],[vb(2) vp(2)]); % Puntos handles.punto1=plot(vp(1),vp(2),'b*'); handles.punto2=plot(vh(1),vh(2),'b*'); handles.punto3=plot(vb(1),vb(2),'b*'); handles.punto4=plot(vf(1),vf(2),'b*'); end handles.output = hObject; guidata(hObject, handles); % --- Executes on button press in limpiar. function limpiar_Callback(hObject, eventdata, handles) % hObject handle to limpiar (see GCBO) % eventdata reserved - to be defined in coordenadax future version of MATLAB % handles structure with handles and user data (see GUIDATA) cla; % set(gca,'YTickLabel',[],'XTickLabel',[]) % legend('off') set(handles.rgeometricos,'String','') set(handles.rtalud,'String','') handles.output = hObject; guidata(hObject, handles); % --- Executes on button press in RESET. function RESET_Callback(hObject, eventdata, handles) % hObject handle to RESET (see GCBO) % eventdata reserved - to be defined in coordenadax future version of MATLAB % handles structure with handles and user data (see GUIDATA) reseteo handles.output = hObject; guidata(hObject, handles); function coordenadax_Callback(hObject, eventdata, handles) % hObject handle to coordenadax (see GCBO) % eventdata reserved - to be defined in coordenadax future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of coordenadax as text % str2double(get(hObject,'String')) returns contents of coordenadax as coordenadax double handles.a=str2double(get(hObject,'String')); % Choose default command line output for TaluDMet handles.output = hObject; % Update handles structure guidata(hObject, handles); % --- Executes during object creation, after setting all properties. function coordenadax_CreateFcn(hObject, eventdata, handles) % hObject handle to coordenadax (see GCBO) % eventdata reserved - to be defined in coordenadax future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have coordenadax white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function coordenaday_Callback(hObject, eventdata, handles) % hObject handle to coordenaday (see GCBO) % eventdata reserved - to be defined in coordenadax future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of coordenaday as text % str2double(get(hObject,'String')) returns contents of coordenaday as coordenadax double handles.b=str2double(get(hObject,'String')); % Choose default command line output for TaluDMet handles.output = hObject; % Update handles structure guidata(hObject, handles); % --- Executes during object creation, after setting all properties. function coordenaday_CreateFcn(hObject, eventdata, handles) % hObject handle to coordenaday (see GCBO) % eventdata reserved - to be defined in coordenadax future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have coordenadax white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function Radio_Callback(hObject, eventdata, handles) % hObject handle to Radio (see GCBO) % eventdata reserved - to be defined in coordenadax future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of Radio as text % str2double(get(hObject,'String')) returns contents of Radio as coordenadax double handles.R=str2double(get(hObject,'String')); % Choose default command line output for TaluDMet handles.output = hObject; % Update handles structure guidata(hObject, handles); % --- Executes during object creation, after setting all properties. function Radio_CreateFcn(hObject, eventdata, handles) % hObject handle to Radio (see GCBO) % eventdata reserved - to be defined in coordenadax future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have coordenadax white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function Base_Callback(hObject, eventdata, handles) % hObject handle to COORDENADAY (see GCBO) % eventdata reserved - to be defined in coordenadax future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of COORDENADAY as text % str2double(get(hObject,'String')) returns contents of COORDENADAY as coordenadax double handles.B=str2double(get(hObject,'String')); % Choose default command line output for TaluDMet handles.output = hObject; % Update handles structure guidata(hObject, handles); % --- Executes during object creation, after setting all properties. function Base_CreateFcn(hObject, eventdata, handles) % hObject handle to COORDENADAY (see GCBO) % eventdata reserved - to be defined in coordenadax future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have coordenadax white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function Altura_Callback(hObject, eventdata, handles) % hObject handle to Altura (see GCBO) % eventdata reserved - to be defined in coordenadax future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of Altura as text % str2double(get(hObject,'String')) returns contents of Altura as coordenadax double handles.H=str2double(get(hObject,'String')); % Choose default command line output for TaluDMet handles.output = hObject; % Update handles structure guidata(hObject, handles); % --- Executes during object creation, after setting all properties. function Altura_CreateFcn(hObject, eventdata, handles) % hObject handle to Altura (see GCBO) % eventdata reserved - to be defined in coordenadax future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have coordenadax white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function angulorozamiento_Callback(hObject, eventdata, handles) % hObject handle to angulorozamiento (see GCBO) % eventdata reserved - to be defined in coordenadax future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of angulorozamiento as text % str2double(get(hObject,'String')) returns contents of angulorozamiento as coordenadax double handles.fi=str2double(get(hObject,'String')); % Choose default command line output for TaluDMet handles.output = hObject; % Update handles structure guidata(hObject, handles); % --- Executes during object creation, after setting all properties. function angulorozamiento_CreateFcn(hObject, eventdata, handles) % hObject handle to angulorozamiento (see GCBO) % eventdata reserved - to be defined in coordenadax future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have coordenadax white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function Especifico_Callback(hObject, eventdata, handles) % hObject handle to Especifico (see GCBO) % eventdata reserved - to be defined in coordenadax future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of Especifico as text % str2double(get(hObject,'String')) returns contents of Especifico as coordenadax double handles.gd=str2double(get(hObject,'String')); % Choose default command line output for TaluDMet handles.output = hObject; % Update handles structure guidata(hObject, handles); % --- Executes during object creation, after setting all properties. function Especifico_CreateFcn(hObject, eventdata, handles) % hObject handle to Especifico (see GCBO) % eventdata reserved - to be defined in coordenadax future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have coordenadax white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function Cohesion_Callback(hObject, eventdata, handles) % hObject handle to Cohesion (see GCBO) % eventdata reserved - to be defined in coordenadax future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of Cohesion as text % str2double(get(hObject,'String')) returns contents of Cohesion as coordenadax double handles.C=str2double(get(hObject,'String')); % Choose default command line output for TaluDMet handles.output = hObject; % Update handles structure guidata(hObject, handles); % --- Executes during object creation, after setting all properties. function Cohesion_CreateFcn(hObject, eventdata, handles) % hObject handle to Cohesion (see GCBO) % eventdata reserved - to be defined in coordenadax future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have coordenadax white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on slider movement. function slider1_Callback(hObject, eventdata, handles) % hObject handle to slider1 (see GCBO) % eventdata reserved - to be defined in coordenadax future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'Value') returns position of slider % get(hObject,'Min') and get(hObject,'Max') to determine range of slider slideRadio; handles.output = hObject; guidata(hObject, handles); % --- Executes during object creation, after setting all properties. function slider1_CreateFcn(hObject, eventdata, handles) % hObject handle to slider1 (see GCBO) % eventdata reserved - to be defined in coordenadax future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: slider controls usually have coordenadax light gray background. if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]); end % --- Executes on button press in centromanual. function centromanual_Callback(hObject, eventdata, handles) % hObject handle to centromanual (see GCBO) % eventdata reserved - to be defined in coordenadax future version of MATLAB % handles structure with handles and user data (see GUIDATA) centroginput %% Plot centro de circunferencia handles.output = hObject; guidata(hObject, handles); % --- Executes on button press in geometria. function geometria_Callback(hObject, eventdata, handles) % hObject handle to geometria (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) geometricos; % --- Executes on button press in Talud. function Talud_Callback(hObject, eventdata, handles) % hObject handle to Talud (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) propiedadestalud % --- Executes on button press in Factor. function Factor_Callback(hObject, eventdata, handles) % hObject handle to Factor (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- Executes on button press in rejas. function rejas_Callback(hObject, eventdata, handles) % hObject handle to rejas (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of rejas if (get(hObject,'Value') == get(hObject,'Max')) axes(handles.axes1); grid on else axes(handles.axes1); grid off end handles.output = hObject; guidata(hObject, handles); % --- Executes on button press in analizar. function analizar_Callback(hObject, eventdata, handles) % hObject handle to analizar (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) flujo handles.output = hObject; guidata(hObject, handles); % --- Executes on selection change in tipodeanalisis. function tipodeanalisis_Callback(hObject, eventdata, handles) % hObject handle to tipodeanalisis (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = cellstr(get(hObject,'String')) returns tipodeanalisis contents as cell array % contents{get(hObject,'Value')} returns selected item from tipodeanalisis analisistipo handles.output = hObject; guidata(hObject, handles); % --- Executes during object creation, after setting all properties. function tipodeanalisis_CreateFcn(hObject, eventdata, handles) % hObject handle to tipodeanalisis (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function puntospormetro_Callback(hObject, eventdata, handles) % hObject handle to puntospormetro (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of puntospormetro as text % str2double(get(hObject,'String')) returns contents of puntospormetro as a double precision=str2double(get(hObject,'String')); handles.ppm1=round(1/precision); handles.output = hObject; guidata(hObject, handles); % --- Executes during object creation, after setting all properties. function puntospormetro_CreateFcn(hObject, eventdata, handles) % hObject handle to puntospormetro (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on button press in marco. function marco_Callback(hObject, eventdata, handles) % hObject handle to marco (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) dibujarelmarco handles.output = hObject; guidata(hObject, handles); % --- Executes on selection change in metodousado. function metodousado_Callback(hObject, eventdata, handles) % hObject handle to metodousado (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = cellstr(get(hObject,'String')) returns metodousado contents as cell array % contents{get(hObject,'Value')} returns selected item from metodousado metodousar handles.output = hObject; guidata(hObject, handles); % --- Executes during object creation, after setting all properties. function metodousado_CreateFcn(hObject, eventdata, handles) % hObject handle to metodousado (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function reb_Callback(hObject, eventdata, handles) % hObject handle to reb (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of reb as text % str2double(get(hObject,'String')) returns contents of reb as a double handles.rebanadas=str2double(get(hObject,'String')); handles.output = hObject; guidata(hObject, handles); % --- Executes during object creation, after setting all properties. function reb_CreateFcn(hObject, eventdata, handles) % hObject handle to reb (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % -------------------------------------------------------------------- function uipushtool1_ClickedCallback(hObject, eventdata, handles) % hObject handle to uipushtool1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) cargardatos; handles.output = hObject; guidata(hObject, handles); % --- Executes on button press in LIMPIARPANTALLA. function LIMPIARPANTALLA_Callback(hObject, eventdata, handles) % hObject handle to LIMPIARPANTALLA (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) cla; set(gca,'YTickLabel',[],'XTickLabel',[]) legend('off') function limiteFS_Callback(hObject, eventdata, handles) % hObject handle to limiteFS (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of limiteFS as text % str2double(get(hObject,'String')) returns contents of limiteFS as a double handles.limFS=str2double(get(hObject,'String')); handles.output = hObject; guidata(hObject, handles); % --- Executes during object creation, after setting all properties. function limiteFS_CreateFcn(hObject, eventdata, handles) % hObject handle to limiteFS (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function PuntosR_Callback(hObject, eventdata, handles) % hObject handle to PuntosR (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of PuntosR as text % str2double(get(hObject,'String')) returns contents of PuntosR as a double handles.PTR=str2double(get(hObject,'String')); handles.output = hObject; guidata(hObject, handles); % --- Executes during object creation, after setting all properties. function PuntosR_CreateFcn(hObject, eventdata, handles) % hObject handle to PuntosR (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function pbasex_Callback(hObject, eventdata, handles) % hObject handle to pbasex (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of pbasex as text % str2double(get(hObject,'String')) returns contents of pbasex as a double handles.vbx=str2double(get(hObject,'String')); handles.output = hObject; guidata(hObject, handles); % --- Executes during object creation, after setting all properties. function pbasex_CreateFcn(hObject, eventdata, handles) % hObject handle to pbasex (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function palturax_Callback(hObject, eventdata, handles) % hObject handle to palturax (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of palturax as text % str2double(get(hObject,'String')) returns contents of palturax as a double handles.vhx=str2double(get(hObject,'String')); handles.output = hObject; guidata(hObject, handles); % --- Executes during object creation, after setting all properties. function palturax_CreateFcn(hObject, eventdata, handles) % hObject handle to palturax (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function pinicialx_Callback(hObject, eventdata, handles) % hObject handle to pinicialx (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of pinicialx as text % str2double(get(hObject,'String')) returns contents of pinicialx as a double handles.vpx=str2double(get(hObject,'String')); % handles.vhx=handles.vpx; % set(handles.palturax,'String',num2str(handles.vpx)) handles.output = hObject; guidata(hObject, handles); % --- Executes during object creation, after setting all properties. function pinicialx_CreateFcn(hObject, eventdata, handles) % hObject handle to pinicialx (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function pfinalx_Callback(hObject, eventdata, handles) % hObject handle to pfinalx (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of pfinalx as text % str2double(get(hObject,'String')) returns contents of pfinalx as a double handles.vfx=str2double(get(hObject,'String')); % handles.vbx=handles.vfx; % set(handles.pbasex,'String',num2str(handles.vbx)) handles.output = hObject; guidata(hObject, handles); % --- Executes during object creation, after setting all properties. function pfinalx_CreateFcn(hObject, eventdata, handles) % hObject handle to pfinalx (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on button press in borramarco. function borramarco_Callback(hObject, eventdata, handles) % hObject handle to borramarco (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) limpio=''; set(handles.pinicialx,'String',limpio) set(handles.pinicialy,'String',limpio) % set(handles.palturax,'String',limpio) % set(handles.palturay,'String',limpio) % set(handles.pbasex,'String',limpio) % set(handles.pbasey,'String',limpio) set(handles.pfinalx,'String',limpio) set(handles.pfinaly,'String',limpio) handles.vpx=nan; handles.vpy=nan; handles.vhx=nan; handles.vhy=nan; handles.vbx=nan; handles.vby=nan; handles.vfx=nan; handles.vfy=nan; borrarelmarco handles.output = hObject; guidata(hObject, handles); function pinicialy_Callback(hObject, eventdata, handles) % hObject handle to pinicialy (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of pinicialy as text % str2double(get(hObject,'String')) returns contents of pinicialy as a double vpy=str2double(get(hObject,'String')); handles.vpy=vpy; % handles.vby=vpy; % set(handles.pbasey,'String',num2str(vpy)); handles.output = hObject; guidata(hObject, handles); % --- Executes during object creation, after setting all properties. function pinicialy_CreateFcn(hObject, eventdata, handles) % hObject handle to pinicialy (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function palturay_Callback(hObject, eventdata, handles) % hObject handle to palturay (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of palturay as text % str2double(get(hObject,'String')) returns contents of palturay as a double handles.vhy=str2double(get(hObject,'String')); handles.output = hObject; guidata(hObject, handles); % --- Executes during object creation, after setting all properties. function palturay_CreateFcn(hObject, eventdata, handles) % hObject handle to palturay (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function pbasey_Callback(hObject, eventdata, handles) % hObject handle to pbasey (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of pbasey as text % str2double(get(hObject,'String')) returns contents of pbasey as a double handles.vby=str2double(get(hObject,'String')); handles.output = hObject; guidata(hObject, handles); % --- Executes during object creation, after setting all properties. function pbasey_CreateFcn(hObject, eventdata, handles) % hObject handle to pbasey (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function pfinaly_Callback(hObject, eventdata, handles) % hObject handle to pfinaly (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of pfinaly as text % str2double(get(hObject,'String')) returns contents of pfinaly as a double vfy=str2double(get(hObject,'String')); handles.vfy=vfy; % handles.vhy=handles.vfy; % set(handles.palturay,'String',num2str(vfy)) handles.output = hObject; guidata(hObject, handles); % --- Executes during object creation, after setting all properties. function pfinaly_CreateFcn(hObject, eventdata, handles) % hObject handle to pfinaly (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function puntospormetro2_Callback(hObject, eventdata, handles) % hObject handle to puntospormetro2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of puntospormetro2 as text % str2double(get(hObject,'String')) returns contents of puntospormetro2 as a double handles.ppm2=str2double(get(hObject,'String')); handles.output = hObject; guidata(hObject, handles); % --- Executes during object creation, after setting all properties. function puntospormetro2_CreateFcn(hObject, eventdata, handles) % hObject handle to puntospormetro2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function entorno_Callback(hObject, eventdata, handles) % hObject handle to entorno (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of entorno as text % str2double(get(hObject,'String')) returns contents of entorno as a double handles.ampl=str2double(get(hObject,'String')); handles.output = hObject; guidata(hObject, handles); % --- Executes during object creation, after setting all properties. function entorno_CreateFcn(hObject, eventdata, handles) % hObject handle to entorno (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function edit26_Callback(hObject, eventdata, handles) % hObject handle to edit26 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit26 as text % str2double(get(hObject,'String')) returns contents of edit26 as a double % --- Executes during object creation, after setting all properties. function edit26_CreateFcn(hObject, eventdata, handles) % hObject handle to edit26 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function edit27_Callback(hObject, eventdata, handles) % hObject handle to edit27 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit27 as text % str2double(get(hObject,'String')) returns contents of edit27 as a double % --- Executes during object creation, after setting all properties. function edit27_CreateFcn(hObject, eventdata, handles) % hObject handle to edit27 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function edit28_Callback(hObject, eventdata, handles) % hObject handle to edit28 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit28 as text % str2double(get(hObject,'String')) returns contents of edit28 as a double % --- Executes during object creation, after setting all properties. function edit28_CreateFcn(hObject, eventdata, handles) % hObject handle to edit28 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % -------------------------------------------------------------------- function uipushtool2_ClickedCallback(hObject, eventdata, handles) % hObject handle to uipushtool2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) guardardatos % --- Executes on button press in marcopt. function marcopt_Callback(hObject, eventdata, handles) % hObject handle to marcopt (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) [ca,cb] = ginput(1); handles.ca=ca; handles.cb=cb; l1=handles.ampl; % Punto inicial vp=[ca cb]-l1/2; vp=round(vp*1000)/1000; % Punto final vf=[ca cb]+l1/2; vf=round(vf*1000)/1000; % Vertice de altura. Altura vh=[vp(1) vf(2)]; % Vertice de longitud. Base vb=[vf(1) vp(2)]; axes(handles.axes1) verticesx=sort([vp(1) vf(1)]); verticesy=sort([vp(2) vf(2)]); a1=verticesx(1);a2=verticesx(2); b1=verticesy(1);b2=verticesy(2); handles.rectangulo31 =plot([a1,a2,a2,a1,a1],[b1,b1,b2,b2,b1]); handles.output = hObject; % Update handles structure guidata(hObject, handles); % --- Executes on button press in marcoborro. function marcoborro_Callback(hObject, eventdata, handles) % hObject handle to marcoborro (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) try delete(handles.rectangulo31); end
github
SergioMarreroMarrero/OldWorks-master
DSSStartup.m
.m
OldWorks-master/6)Montecarlo-LowVoltage/Software/apoyo/DSSStartup.m
425
utf_8
5a54c00cbb8bef30ce34a677898c1229
%-------------------------------------------------------------------------- function [Start,Obj,Text] = DSSStartup % Function for starting up the DSS %instantiate the DSS Object Obj = actxserver('OpenDSSEngine.DSS'); % %Start the DSS. Only needs to be executed the first time w/in a %Matlab session Start = Obj.Start(0); % Define the text interface Text = Obj.Text;
github
SergioMarreroMarrero/OldWorks-master
startAndGoal.m
.m
OldWorks-master/2)AutonomoDrive/Planification/Matlab/startAndGoal.m
1,716
utf_8
ebf0bf51e9e758eb6bfe21b6154955c9
function [start,goal] =startAndGoal(map,option) switch lower(option) case 'r' freeVal=find(map==0); % Start indexStart=round(rand*length(freeVal)); start=freeVal(indexStart); freeVal(indexStart)=[]; %Goal indexGoal=round(rand*length(freeVal)); goal=freeVal(indexGoal); case 'm' outsideMapStart=1;outsideMapGoal=1; % para entrar en el while plotMap(map); %start while outsideMapStart [x,y] = ginput(1); posStartRow=round(y); posStartColumn=round(x); outsideMapStart=map(posStartRow,posStartColumn)~=0; end %Goal while outsideMapGoal [x,y] = ginput(1); posGoalRow=round(y); posGoalColumn=round(x); outsideMapGoal=map(posGoalRow,posGoalColumn)~=0; end start=sub2ind(size(map),posStartRow,posStartColumn); goal=sub2ind(size(map),posGoalRow,posGoalColumn); case 'ml' outsideMapStart=1; % para entrar en el while plotMap(map); %start while outsideMapStart [x,y] = ginput(1); posStartRow=round(y); posStartColumn=round(x); outsideMapStart=map(posStartRow,posStartColumn)~=0; end start=sub2ind(size(map),posStartRow,posStartColumn); goal=1; end end function [mapcode]=plotMap(map) close all mapcode=imagesc(map); grid on [nrow,ncolumn]=size(map); set(gca,'xtick',1.5:1:nrow-0.5); set(gca,'ytick',1.5:1:ncolumn-0.5); end
github
SergioMarreroMarrero/OldWorks-master
localizationFunction.m
.m
OldWorks-master/2)AutonomoDrive/Planification/Matlab/localizacion/localizationFunction.m
5,378
utf_8
c71bf82b62c4a08f04b780adfa1d0f14
function [ whereTheRobotIs] = localizationFunction( map,posStart ) % 1) Definicion de algunas variables iniciales blockCode=-5;positionRobotcode=-10;posWhereRobotCouldBecode=-15; map(map==1)=blockCode; originalMap=map;mapPosition=map; pathThatRobotHaveDone=[]; % Store the path walked %2) pathThatRobotHaveDone=[pathThatRobotHaveDone posStart]; % Iniciamos el camino hecho con la posicion de partida %3) %%%%%%%%%%%%%%%PLOT%%%%%%%%%%%%%%%%% mapPosition(pathThatRobotHaveDone)=positionRobotcode; % Actualizamos el camino hecho, incorporando en el mapa la la variable pathThatRobotHaveDone plotMap(mapPosition); pause; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %4) %%%%%%%%%%%%%%%%WHERE IS THE ROBOT%%%%%%%%%%%%%%%%%%%%%%% [currentEnvMatrix]=whatRobotSee(map,posStart); [numMapRow,numMapColumn]=size(map); %5) %%%%Con este algoritmo creamos inicialmente los puntos en los que el robot %%%%podria estar, es decir, todos los puntos del mapa (en los que haya un cero) l=0; for i=2:numMapRow-1 % i,j=1 el borde del mapa es un muro for j= 2:numMapColumn-1 l=l+1; pointsWhereRobotCouldBe(l)=sub2ind(size(map),i,j); end end %6) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% [pointsWhereRobotCouldBe]=matchingMapEnviromentMatrix(map,currentEnvMatrix,pointsWhereRobotCouldBe); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %7) %%%%%%%%%%%%%%%PLOT%%%%%%%%%%%%%%%%% mapPosition(pathThatRobotHaveDone)=positionRobotcode; plotMap(mapPosition); putPoints(pointsWhereRobotCouldBe,map,'r*'); pause; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %8) while length(pointsWhereRobotCouldBe)>1 %8) %%%%%%%%%%%%%%%%MOVE%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% direction=selectDirection2Move(map,pathThatRobotHaveDone,blockCode); [pointsWhereRobotCouldBeAfterMove]=robotMove(direction,pointsWhereRobotCouldBe,map); % Averiguamos donde esta robot despues de moverse pathThatRobotHaveDone=[pathThatRobotHaveDone pointsWhereRobotCouldBeAfterMove(pointsWhereRobotCouldBe==pathThatRobotHaveDone(end))]; % Actualizamos la nueva posicion del robot %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %9) %%%%%%%%%%%%%%%PLOT%%%%%%%%%%%%%%%%% mapPosition(pathThatRobotHaveDone)=positionRobotcode; plotMap(mapPosition); putPoints(pointsWhereRobotCouldBe,map,'r*'); putPoints(pointsWhereRobotCouldBeAfterMove,map,'y*'); pause; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %10) %%%%%%%%%%%%%%%%WHERE IS THE ROBOT%%%%%%%%%%%%%%%%%%%%%%% [currentEnvMatrix]=whatRobotSee(map,pathThatRobotHaveDone(end)); [pointsWhereRobotCouldBe]=matchingMapEnviromentMatrix(map,currentEnvMatrix,pointsWhereRobotCouldBeAfterMove); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%PLOT%%%%%%%%%%%%%%%%% mapPosition(pathThatRobotHaveDone)=positionRobotcode; plotMap(mapPosition); putPoints(pointsWhereRobotCouldBe,map,'r*'); pause; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end whereTheRobotIs=pointsWhereRobotCouldBe; end function enviromentMatrix=whatRobotSee(map,pos) [posRow,posColumn]=ind2sub(size(map),pos); enviromentMatrix=nan(3); % iniciamos la variable j=0; for i=[-1 0 1] %1) j=j+1; enviromentMatrix(j,:)=map(posRow+i,posColumn-1:posColumn+1); %2) end end function pointsWhereRobotCouldBe=matchingMapEnviromentMatrix(map,enviromentMatrix,candidates) j=0; for matchPos=candidates %1)Para cada punto posible en que el robot se encuentre enviromentMatrixMatching=whatRobotSee(map,matchPos);%2) Sacamos la matriz del entorno de cada punto del mapa prob2behere=sum(sum(enviromentMatrixMatching==enviromentMatrix))==length(enviromentMatrix)^2; %2)Sumamos el numero de aciertos. Se suma dos veces porque sum() suma solo por columnas if prob2behere %3) Almacenamos el resultado en la lista pointsWhereRobotCouldBe j=j+1; pointsWhereRobotCouldBe(j)=matchPos; end end end function direction=selectDirection2Move(map,pathThatRobotHaveDone,blockCode) map(pathThatRobotHaveDone)=blockCode; [enviromentMatrix]=whatRobotSee(map,pathThatRobotHaveDone(end)); if enviromentMatrix(4)==0 direction=4; elseif enviromentMatrix(6)==0 direction=6; elseif enviromentMatrix(8)==0 direction=8; elseif enviromentMatrix(2)==0 direction=2; else disp('Something wrong') end end function pointsWhereRobotCouldBeAfterMove=robotMove(direction,pointsWhereRobotCouldBe,map) [currentRow,currentColumn]=ind2sub(size(map),pointsWhereRobotCouldBe); if direction==4 % Up resto 1 a fila refreshRow=currentRow-1; refreshtColumn=currentColumn; elseif direction==6 % Down sumo 1 a fila refreshRow=currentRow+1; refreshtColumn=currentColumn; elseif direction==2 % Left resto 1 a columna refreshRow=currentRow; refreshtColumn=currentColumn-1; elseif direction==8 % Right sumo 1 a columna refreshRow=currentRow; refreshtColumn=currentColumn+1; else disp('Something wrong inside robotMove') end pointsWhereRobotCouldBeAfterMove=sub2ind(size(map),refreshRow,refreshtColumn); end function putPoints(pointsWhereRobotCouldBe,map,codePlot) [pointColumn,pointRow]=ind2sub(size(map),pointsWhereRobotCouldBe); hold on plot(pointRow,pointColumn,codePlot); end
github
idnavid/misc-master
demo_gif.m
.m
misc-master/demo_gif.m
409
utf_8
43aefadbc9e033d9ceb47347da232fff
function demo_gif() filename = './clock.gif'; x = 0:0.1:100; for i = 1:100 plot(x,i*x/1000); ylim([0 10]) save_gif(filename,i) end end function save_gif(filename,n) frame = getframe; im = frame2im(frame); [imind,cm] = rgb2ind(im,256); % Write to the GIF File if n == 1 imwrite(imind,cm,filename,'gif', 'Loopcount',inf); else imwrite(imind,cm,filename,'gif','WriteMode','append'); end end
github
JuXinCheng/rtklib_2.4.2-master
plotlexion.m
.m
rtklib_2.4.2-master/util/testlex/plotlexion.m
1,593
utf_8
1333e9ae36ebce0dfcb9da8ab7972734
function plotlexion(file,index) % % plot lex ionosphere correction error % % 2010/12/09 0.1 new % if nargin<1, file='LEXION_20101204'; end if nargin<2, index=2; end eval(file); td=caltomjd(epoch); time=time(index); ep=mjdtocal(td+(time+0.5)/86400); ts=sprintf('%04.0f/%02.0f/%02.0f %02.0f:%02.0f',ep(1:5)); % plot lex ion figure('color','w'); plotmap(tec(:,:,index),lons,lats,['LEX Vertical Ionosphere Delay (L1) (m): ',ts]); % plot igs ion for i=1:length(lons) for j=1:length(lats) ion(j,i)=ion_tec(td,time,[0 pi/2],[lats(j),lons(i),0],'../lexerrdata','igr'); end end figure('color','w'); plotmap(ion,lons,lats,['IGR Vertical Ionosphere Delay (L1) (m): ',ts]); % plot vion map ---------------------------------------------------------------- function plotmap(ion,lons,lats,ti) fn='Times New Roman'; pos=[0.01 0.01 0.91 0.92]; cent=[137 35]; scale=8; gray=[.5 .5 .5]; range=0:0.01:10; gmt('mmap','proj','eq','cent',cent,'base',cent,'scale',6,'pos',pos,'fontname',fn); [lon,lat]=meshgrid(lons,lats); [xs,ys,zs]=gmt('lltoxy',lon,lat); [c,h]=contourf(xs,ys,ion,range); set(h,'edgecolor','none'); caxis(range([1,end])) gmt('mcoast','lcolor','none','scolor','none','ccolor',gray); gmt('mgrid','gint',5,'lint',5,'color',gray); lonr=[141.0 129.0 126.7 146.0 146.0 141.0]; % lex tec coverage latr=[ 45.5 34.7 26.0 26.0 45.5 45.5]; lonp=[130.0 118.0 115.7 157.0 157.0 130.0]; latp=[ 56.5 45.7 15.0 15.0 56.5 56.5]; gmt('mplot',lonr,latr,'k'); %gmt('mplot',lonp,latp,gray); title(ti); ggt('colorbarv',[0.94,0.015,0.015,0.92],range([1,end]),'',... 'fontname',fn);
github
JuXinCheng/rtklib_2.4.2-master
testionex.m
.m
rtklib_2.4.2-master/test/utest/testionex.m
326,974
utf_8
e8fe871f5e28acb961451acf230d028f
function testionex [tec,rms]=testdata1; range=0:0.01:10; figure [c,h]=contourf(0:2:360,90:-2:-90,tec,range); set(h,'edgecolor','none'); caxis(range([1,end])); title('vertical iono delay'); figure [c,h]=contourf(0:2:360,90:-2:-90,sqrt(rms),range); set(h,'edgecolor','none'); caxis(range([1,end])); title('vertical iono delay std'); tec=testdata2; figure, hold on, box on, grid on gray=[.5 .5 .5]; time=0:30:86400*2-30; plot(tec(:,1)/3600,tec(:,2),'.'); plot(tec(:,1)/3600,tec(:,2)-tec(:,3),'-','color',gray); plot(tec(:,1)/3600,tec(:,2)+tec(:,3),'-','color',gray); xlim(tec([1,end],1)/3600); ylim([0,10]); xlabel('time (hr)'); ylabel('iono delay (m)'); % test data 1 for tec function [tec,rms]=testdata1 tec=[ nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 0.68 0.68 0.68 0.68 0.69 0.69 0.69 0.69 0.69 0.69 0.69 0.69 0.69 0.69 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.71 0.71 0.71 0.72 0.72 0.72 0.72 0.72 0.72 0.72 0.73 0.73 0.73 0.73 0.73 0.73 0.74 0.74 0.74 0.74 0.74 0.74 0.74 0.74 0.75 0.75 0.75 0.75 0.74 0.74 0.74 0.74 0.75 0.75 0.75 0.75 0.75 0.76 0.76 0.76 0.76 0.76 0.77 0.77 0.77 0.77 0.78 0.78 0.79 0.79 0.79 0.79 0.80 0.80 0.81 0.81 0.81 0.81 0.81 0.82 0.82 0.82 0.83 0.83 0.84 0.84 0.85 0.85 0.85 0.85 0.85 0.85 0.85 0.86 0.86 0.87 0.87 0.86 0.86 0.86 0.86 0.86 0.86 0.86 0.85 0.84 0.84 0.84 0.84 0.84 0.83 0.83 0.83 0.82 0.82 0.82 0.82 0.82 0.81 0.81 0.80 0.79 0.79 0.79 0.78 0.78 0.77 0.77 0.77 0.76 0.76 0.76 0.75 0.75 0.75 0.74 0.74 0.74 0.73 0.73 0.73 0.72 0.71 0.71 0.70 0.70 0.69 0.69 0.68 0.68 0.68 0.68 0.68 0.68 0.68 0.68 0.68 0.68 0.67 0.67 0.67 0.67 0.67 0.67 0.67 0.67 0.68 0.68 0.68 0.68 0.68 0.68 0.68 0.68 0.68 0.68 0.68 0.68 0.68 0.62 0.62 0.62 0.63 0.63 0.63 0.64 0.64 0.64 0.64 0.64 0.64 0.64 0.65 0.65 0.66 0.66 0.66 0.66 0.66 0.66 0.66 0.66 0.66 0.67 0.67 0.67 0.67 0.67 0.67 0.67 0.68 0.69 0.69 0.69 0.69 0.69 0.69 0.69 0.69 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.71 0.71 0.71 0.71 0.71 0.71 0.72 0.72 0.72 0.73 0.73 0.73 0.74 0.74 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.78 0.78 0.79 0.80 0.81 0.81 0.81 0.82 0.83 0.84 0.84 0.85 0.86 0.86 0.87 0.87 0.87 0.87 0.87 0.88 0.88 0.88 0.89 0.89 0.89 0.89 0.88 0.88 0.88 0.88 0.88 0.88 0.88 0.87 0.87 0.87 0.87 0.86 0.85 0.85 0.84 0.83 0.83 0.83 0.82 0.81 0.81 0.80 0.79 0.78 0.78 0.77 0.76 0.75 0.74 0.73 0.73 0.72 0.72 0.72 0.71 0.70 0.70 0.69 0.69 0.69 0.68 0.68 0.67 0.66 0.65 0.64 0.64 0.64 0.63 0.62 0.62 0.62 0.62 0.62 0.61 0.61 0.61 0.61 0.61 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.62 0.62 0.62 0.62 0.62 0.62 0.56 0.57 0.57 0.57 0.57 0.57 0.58 0.59 0.59 0.59 0.59 0.60 0.60 0.60 0.61 0.61 0.61 0.61 0.61 0.62 0.62 0.62 0.62 0.62 0.62 0.62 0.62 0.62 0.62 0.62 0.62 0.63 0.63 0.64 0.64 0.64 0.64 0.64 0.64 0.64 0.64 0.64 0.65 0.65 0.65 0.65 0.65 0.65 0.65 0.65 0.65 0.65 0.65 0.66 0.66 0.67 0.67 0.67 0.67 0.67 0.67 0.68 0.68 0.69 0.69 0.69 0.69 0.70 0.71 0.71 0.72 0.73 0.73 0.74 0.75 0.75 0.77 0.78 0.79 0.80 0.81 0.82 0.83 0.84 0.85 0.85 0.86 0.87 0.87 0.88 0.89 0.89 0.89 0.89 0.89 0.90 0.90 0.90 0.90 0.90 0.90 0.90 0.90 0.90 0.90 0.91 0.90 0.90 0.89 0.89 0.89 0.88 0.87 0.86 0.86 0.85 0.84 0.83 0.82 0.80 0.79 0.78 0.77 0.76 0.75 0.74 0.72 0.71 0.70 0.69 0.69 0.68 0.67 0.66 0.66 0.65 0.64 0.63 0.62 0.62 0.62 0.61 0.60 0.59 0.58 0.57 0.57 0.57 0.57 0.56 0.55 0.55 0.55 0.55 0.54 0.54 0.54 0.54 0.54 0.54 0.54 0.54 0.54 0.54 0.54 0.54 0.54 0.54 0.54 0.54 0.54 0.54 0.54 0.55 0.55 0.56 0.56 0.56 0.56 0.56 0.56 0.54 0.53 0.52 0.52 0.53 0.54 0.54 0.55 0.55 0.55 0.55 0.55 0.55 0.56 0.56 0.57 0.57 0.57 0.57 0.57 0.57 0.57 0.57 0.57 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.59 0.59 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.61 0.62 0.62 0.62 0.62 0.63 0.63 0.63 0.63 0.64 0.64 0.65 0.66 0.66 0.67 0.68 0.68 0.69 0.69 0.70 0.71 0.71 0.73 0.74 0.75 0.77 0.78 0.79 0.79 0.80 0.82 0.83 0.83 0.84 0.85 0.86 0.88 0.88 0.88 0.88 0.90 0.91 0.91 0.91 0.92 0.93 0.94 0.94 0.94 0.95 0.95 0.96 0.96 0.96 0.95 0.94 0.93 0.91 0.90 0.89 0.87 0.86 0.84 0.82 0.80 0.78 0.76 0.75 0.74 0.72 0.71 0.70 0.69 0.67 0.66 0.65 0.63 0.62 0.61 0.60 0.59 0.58 0.58 0.57 0.57 0.56 0.55 0.55 0.54 0.53 0.53 0.52 0.51 0.51 0.50 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.50 0.50 0.50 0.50 0.51 0.52 0.52 0.52 0.52 0.52 0.52 0.52 0.53 0.54 0.50 0.50 0.49 0.49 0.50 0.50 0.50 0.51 0.51 0.51 0.51 0.52 0.52 0.53 0.53 0.53 0.53 0.53 0.53 0.54 0.54 0.54 0.54 0.55 0.55 0.56 0.56 0.56 0.56 0.56 0.56 0.56 0.56 0.56 0.56 0.56 0.56 0.56 0.56 0.55 0.55 0.55 0.55 0.55 0.54 0.54 0.54 0.55 0.55 0.55 0.55 0.55 0.56 0.56 0.56 0.57 0.57 0.58 0.58 0.58 0.58 0.59 0.59 0.60 0.60 0.61 0.62 0.62 0.63 0.64 0.64 0.65 0.67 0.68 0.69 0.70 0.71 0.72 0.73 0.74 0.75 0.77 0.78 0.79 0.80 0.82 0.83 0.85 0.86 0.88 0.89 0.90 0.91 0.92 0.94 0.95 0.96 0.97 0.98 0.99 1.01 1.01 1.01 1.01 1.01 1.01 1.00 0.99 0.97 0.96 0.94 0.93 0.91 0.90 0.88 0.86 0.85 0.83 0.82 0.80 0.78 0.76 0.74 0.72 0.70 0.69 0.67 0.66 0.64 0.63 0.61 0.59 0.58 0.57 0.56 0.55 0.53 0.52 0.51 0.51 0.50 0.49 0.48 0.47 0.46 0.45 0.45 0.45 0.45 0.44 0.44 0.44 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.46 0.46 0.46 0.46 0.47 0.48 0.48 0.48 0.48 0.49 0.49 0.49 0.50 0.50 0.47 0.47 0.48 0.48 0.47 0.47 0.47 0.48 0.48 0.48 0.48 0.49 0.49 0.49 0.50 0.50 0.50 0.50 0.50 0.51 0.52 0.52 0.52 0.52 0.53 0.53 0.53 0.53 0.53 0.53 0.53 0.53 0.53 0.53 0.53 0.53 0.53 0.53 0.53 0.53 0.53 0.52 0.52 0.51 0.51 0.50 0.50 0.51 0.51 0.51 0.52 0.52 0.53 0.53 0.53 0.53 0.54 0.54 0.54 0.54 0.55 0.56 0.56 0.57 0.57 0.58 0.59 0.60 0.61 0.62 0.63 0.65 0.66 0.67 0.68 0.69 0.70 0.72 0.73 0.74 0.76 0.77 0.79 0.81 0.82 0.84 0.86 0.88 0.90 0.92 0.93 0.95 0.97 0.98 1.00 1.02 1.03 1.05 1.06 1.07 1.08 1.08 1.08 1.08 1.07 1.06 1.05 1.04 1.02 1.01 0.99 0.97 0.95 0.93 0.91 0.89 0.87 0.86 0.84 0.82 0.80 0.78 0.75 0.73 0.71 0.68 0.66 0.64 0.62 0.61 0.59 0.58 0.57 0.55 0.53 0.52 0.50 0.49 0.48 0.47 0.47 0.46 0.45 0.44 0.44 0.43 0.43 0.43 0.43 0.42 0.42 0.42 0.43 0.43 0.43 0.43 0.43 0.43 0.43 0.43 0.43 0.43 0.43 0.43 0.43 0.43 0.44 0.44 0.44 0.44 0.44 0.45 0.46 0.46 0.46 0.46 0.46 0.47 0.47 0.47 0.47 0.45 0.45 0.46 0.46 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.46 0.47 0.47 0.47 0.48 0.48 0.49 0.49 0.49 0.49 0.50 0.51 0.51 0.51 0.51 0.51 0.51 0.52 0.52 0.52 0.52 0.51 0.51 0.51 0.51 0.51 0.51 0.51 0.50 0.49 0.49 0.48 0.48 0.48 0.48 0.49 0.50 0.50 0.50 0.51 0.51 0.51 0.52 0.52 0.52 0.53 0.54 0.54 0.55 0.56 0.57 0.57 0.59 0.60 0.61 0.63 0.64 0.66 0.67 0.68 0.69 0.70 0.72 0.74 0.76 0.77 0.79 0.81 0.84 0.86 0.88 0.91 0.93 0.95 0.97 0.99 1.01 1.03 1.05 1.07 1.09 1.11 1.13 1.15 1.16 1.17 1.17 1.17 1.17 1.17 1.15 1.14 1.12 1.11 1.09 1.08 1.06 1.04 1.02 0.99 0.97 0.94 0.92 0.90 0.87 0.85 0.82 0.80 0.77 0.75 0.72 0.69 0.66 0.64 0.62 0.60 0.58 0.57 0.55 0.54 0.52 0.50 0.49 0.48 0.47 0.46 0.45 0.45 0.44 0.44 0.43 0.43 0.43 0.43 0.43 0.42 0.42 0.42 0.43 0.43 0.42 0.42 0.42 0.43 0.43 0.43 0.43 0.43 0.43 0.43 0.43 0.43 0.43 0.44 0.44 0.44 0.44 0.44 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.44 0.44 0.44 0.44 0.44 0.44 0.43 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.43 0.44 0.44 0.45 0.46 0.46 0.47 0.47 0.47 0.48 0.49 0.49 0.49 0.49 0.50 0.51 0.51 0.52 0.52 0.51 0.51 0.51 0.50 0.50 0.50 0.50 0.49 0.49 0.48 0.48 0.47 0.47 0.47 0.48 0.48 0.49 0.49 0.49 0.50 0.50 0.51 0.52 0.53 0.53 0.54 0.55 0.56 0.56 0.57 0.59 0.60 0.61 0.63 0.64 0.65 0.67 0.69 0.71 0.72 0.74 0.75 0.77 0.79 0.82 0.83 0.85 0.89 0.92 0.95 0.98 1.00 1.03 1.06 1.08 1.10 1.12 1.14 1.16 1.18 1.20 1.22 1.24 1.26 1.27 1.28 1.29 1.28 1.28 1.28 1.26 1.25 1.23 1.21 1.19 1.17 1.15 1.12 1.10 1.07 1.04 1.01 0.98 0.96 0.92 0.89 0.85 0.83 0.80 0.77 0.73 0.70 0.68 0.65 0.63 0.61 0.59 0.57 0.55 0.54 0.52 0.51 0.49 0.48 0.47 0.47 0.46 0.45 0.45 0.44 0.44 0.44 0.44 0.44 0.44 0.44 0.43 0.44 0.44 0.44 0.43 0.43 0.43 0.44 0.44 0.44 0.44 0.44 0.44 0.44 0.44 0.44 0.44 0.44 0.44 0.44 0.44 0.44 0.44 0.44 0.44 0.45 0.45 0.45 0.45 0.44 0.44 0.44 0.43 0.43 0.42 0.42 0.42 0.42 0.41 0.40 0.40 0.39 0.39 0.39 0.39 0.39 0.39 0.40 0.42 0.43 0.43 0.44 0.44 0.45 0.46 0.47 0.49 0.49 0.50 0.51 0.51 0.52 0.52 0.52 0.52 0.52 0.52 0.51 0.51 0.50 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.50 0.50 0.51 0.52 0.52 0.53 0.54 0.55 0.56 0.57 0.59 0.60 0.61 0.63 0.64 0.65 0.67 0.68 0.69 0.71 0.73 0.75 0.77 0.79 0.81 0.82 0.84 0.87 0.90 0.92 0.94 0.96 0.99 1.02 1.06 1.09 1.12 1.15 1.19 1.21 1.23 1.25 1.28 1.30 1.32 1.33 1.35 1.37 1.39 1.40 1.42 1.43 1.42 1.42 1.41 1.39 1.38 1.36 1.34 1.32 1.28 1.25 1.22 1.19 1.15 1.12 1.09 1.06 1.02 0.98 0.94 0.89 0.85 0.82 0.78 0.75 0.71 0.69 0.68 0.65 0.63 0.60 0.59 0.57 0.56 0.54 0.52 0.51 0.49 0.49 0.49 0.49 0.47 0.46 0.45 0.45 0.45 0.46 0.47 0.47 0.47 0.47 0.46 0.46 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.44 0.44 0.44 0.44 0.44 0.44 0.44 0.44 0.44 0.43 0.43 0.43 0.43 0.44 0.44 0.44 0.44 0.44 0.44 0.43 0.42 0.42 0.42 0.41 0.41 0.40 0.40 0.39 0.38 0.38 0.38 0.38 0.38 0.38 0.38 0.39 0.40 0.42 0.43 0.44 0.45 0.46 0.47 0.49 0.50 0.51 0.52 0.53 0.54 0.55 0.55 0.55 0.55 0.55 0.55 0.54 0.53 0.53 0.52 0.51 0.51 0.51 0.51 0.51 0.51 0.52 0.52 0.53 0.54 0.54 0.55 0.57 0.58 0.59 0.60 0.62 0.64 0.65 0.67 0.68 0.70 0.72 0.73 0.75 0.77 0.79 0.81 0.82 0.84 0.86 0.88 0.90 0.92 0.95 0.97 1.00 1.03 1.05 1.08 1.10 1.13 1.17 1.20 1.22 1.25 1.28 1.32 1.34 1.37 1.39 1.41 1.43 1.45 1.47 1.49 1.50 1.52 1.53 1.54 1.55 1.54 1.53 1.52 1.51 1.50 1.48 1.46 1.43 1.40 1.37 1.33 1.29 1.25 1.21 1.17 1.12 1.07 1.02 0.97 0.92 0.89 0.85 0.82 0.79 0.77 0.74 0.72 0.69 0.67 0.64 0.62 0.60 0.59 0.57 0.56 0.55 0.54 0.53 0.52 0.51 0.51 0.50 0.49 0.49 0.49 0.49 0.50 0.49 0.49 0.48 0.49 0.49 0.49 0.49 0.48 0.48 0.48 0.48 0.47 0.45 0.45 0.45 0.45 0.44 0.44 0.43 0.43 0.43 0.43 0.43 0.42 0.42 0.42 0.42 0.43 0.43 0.44 0.44 0.43 0.43 0.43 0.43 0.43 0.43 0.42 0.42 0.41 0.40 0.40 0.39 0.38 0.38 0.38 0.38 0.38 0.38 0.40 0.41 0.42 0.44 0.46 0.47 0.48 0.50 0.52 0.54 0.56 0.58 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.58 0.57 0.57 0.56 0.56 0.55 0.55 0.55 0.55 0.55 0.56 0.57 0.57 0.58 0.59 0.60 0.62 0.63 0.65 0.66 0.68 0.69 0.71 0.73 0.76 0.78 0.80 0.82 0.83 0.85 0.87 0.90 0.92 0.94 0.97 0.99 1.01 1.04 1.06 1.08 1.10 1.13 1.16 1.19 1.22 1.24 1.28 1.31 1.34 1.36 1.39 1.43 1.46 1.49 1.51 1.54 1.56 1.58 1.60 1.62 1.63 1.64 1.64 1.65 1.66 1.66 1.66 1.66 1.65 1.63 1.61 1.59 1.56 1.53 1.49 1.45 1.42 1.38 1.33 1.28 1.23 1.18 1.13 1.08 1.03 0.98 0.95 0.92 0.89 0.86 0.83 0.80 0.77 0.74 0.71 0.69 0.67 0.64 0.62 0.61 0.60 0.59 0.58 0.57 0.56 0.55 0.54 0.54 0.53 0.53 0.52 0.52 0.52 0.51 0.51 0.51 0.51 0.51 0.51 0.51 0.51 0.50 0.49 0.48 0.47 0.46 0.46 0.46 0.45 0.44 0.44 0.43 0.43 0.42 0.42 0.41 0.41 0.41 0.41 0.42 0.42 0.42 0.43 0.43 0.43 0.43 0.45 0.45 0.46 0.46 0.45 0.45 0.44 0.43 0.42 0.42 0.41 0.41 0.41 0.41 0.41 0.42 0.43 0.45 0.46 0.48 0.50 0.52 0.54 0.56 0.58 0.61 0.62 0.64 0.65 0.65 0.66 0.65 0.65 0.65 0.64 0.63 0.62 0.62 0.61 0.60 0.59 0.59 0.59 0.60 0.60 0.61 0.62 0.63 0.64 0.65 0.67 0.69 0.70 0.72 0.74 0.75 0.78 0.80 0.82 0.85 0.87 0.90 0.92 0.94 0.96 0.98 1.01 1.04 1.06 1.09 1.12 1.15 1.17 1.20 1.22 1.25 1.28 1.31 1.34 1.36 1.39 1.42 1.45 1.48 1.51 1.53 1.57 1.60 1.63 1.65 1.67 1.70 1.72 1.74 1.75 1.76 1.76 1.76 1.76 1.77 1.77 1.77 1.77 1.76 1.73 1.71 1.68 1.65 1.62 1.58 1.54 1.50 1.46 1.41 1.36 1.31 1.26 1.21 1.17 1.12 1.07 1.04 1.00 0.96 0.93 0.89 0.86 0.82 0.79 0.76 0.73 0.71 0.69 0.67 0.65 0.63 0.62 0.60 0.59 0.58 0.57 0.57 0.56 0.56 0.55 0.55 0.54 0.53 0.52 0.52 0.53 0.52 0.52 0.52 0.52 0.52 0.51 0.50 0.49 0.48 0.47 0.46 0.45 0.45 0.44 0.44 0.43 0.43 0.42 0.42 0.41 0.41 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.44 0.45 0.48 0.49 0.50 0.50 0.50 0.50 0.49 0.48 0.47 0.47 0.46 0.46 0.46 0.47 0.47 0.48 0.50 0.52 0.54 0.55 0.57 0.60 0.63 0.65 0.67 0.69 0.70 0.72 0.72 0.73 0.73 0.73 0.72 0.71 0.71 0.70 0.69 0.67 0.66 0.65 0.65 0.64 0.64 0.65 0.65 0.66 0.67 0.69 0.70 0.71 0.73 0.75 0.77 0.79 0.81 0.83 0.86 0.88 0.91 0.94 0.96 0.99 1.02 1.04 1.07 1.10 1.13 1.15 1.19 1.22 1.25 1.28 1.30 1.33 1.37 1.40 1.43 1.46 1.48 1.51 1.53 1.56 1.59 1.62 1.64 1.67 1.70 1.72 1.75 1.77 1.79 1.82 1.84 1.86 1.86 1.87 1.87 1.87 1.86 1.86 1.85 1.85 1.85 1.84 1.81 1.79 1.76 1.73 1.70 1.66 1.62 1.58 1.53 1.49 1.45 1.40 1.36 1.31 1.27 1.22 1.17 1.13 1.08 1.04 1.00 0.96 0.92 0.88 0.84 0.81 0.78 0.76 0.74 0.71 0.69 0.66 0.64 0.63 0.62 0.60 0.59 0.58 0.57 0.57 0.57 0.57 0.55 0.53 0.52 0.53 0.53 0.53 0.52 0.52 0.52 0.52 0.52 0.51 0.50 0.49 0.47 0.46 0.45 0.44 0.44 0.44 0.43 0.43 0.43 0.43 0.43 0.43 0.43 0.43 0.43 0.43 0.44 0.46 0.47 0.47 0.48 0.52 0.53 0.55 0.56 0.56 0.57 0.56 0.56 0.55 0.55 0.55 0.55 0.55 0.56 0.57 0.58 0.60 0.62 0.65 0.67 0.70 0.72 0.74 0.76 0.78 0.80 0.80 0.81 0.81 0.81 0.81 0.81 0.80 0.79 0.78 0.76 0.75 0.74 0.72 0.71 0.70 0.69 0.69 0.69 0.69 0.70 0.72 0.74 0.75 0.77 0.78 0.81 0.83 0.85 0.87 0.89 0.93 0.96 0.99 1.01 1.04 1.07 1.10 1.14 1.17 1.20 1.24 1.28 1.32 1.35 1.38 1.41 1.45 1.47 1.50 1.53 1.55 1.58 1.60 1.63 1.66 1.68 1.71 1.73 1.76 1.79 1.81 1.84 1.86 1.87 1.88 1.90 1.92 1.93 1.93 1.93 1.93 1.93 1.93 1.93 1.93 1.92 1.91 1.89 1.87 1.85 1.82 1.79 1.75 1.71 1.67 1.64 1.61 1.57 1.52 1.48 1.44 1.40 1.35 1.30 1.25 1.20 1.16 1.11 1.07 1.02 0.98 0.95 0.91 0.89 0.86 0.83 0.80 0.76 0.73 0.70 0.68 0.66 0.64 0.62 0.60 0.59 0.57 0.57 0.57 0.57 0.55 0.53 0.52 0.52 0.52 0.52 0.52 0.52 0.53 0.54 0.53 0.52 0.51 0.50 0.49 0.47 0.46 0.45 0.44 0.44 0.44 0.44 0.44 0.44 0.44 0.45 0.46 0.47 0.47 0.47 0.48 0.48 0.49 0.51 0.52 0.61 0.62 0.64 0.65 0.66 0.67 0.68 0.68 0.68 0.67 0.67 0.67 0.68 0.69 0.71 0.73 0.74 0.76 0.77 0.79 0.82 0.84 0.86 0.89 0.91 0.93 0.92 0.92 0.92 0.92 0.92 0.90 0.89 0.88 0.87 0.85 0.83 0.81 0.79 0.78 0.76 0.76 0.75 0.75 0.76 0.76 0.78 0.79 0.81 0.82 0.83 0.86 0.88 0.91 0.93 0.96 0.99 1.02 1.05 1.09 1.12 1.15 1.19 1.23 1.26 1.29 1.33 1.37 1.41 1.45 1.48 1.52 1.55 1.58 1.61 1.64 1.67 1.70 1.72 1.75 1.77 1.79 1.81 1.84 1.86 1.89 1.91 1.92 1.94 1.95 1.96 1.97 1.98 1.98 1.98 1.97 1.97 1.96 1.96 1.96 1.96 1.94 1.92 1.90 1.88 1.86 1.84 1.81 1.78 1.75 1.72 1.69 1.65 1.61 1.57 1.53 1.49 1.45 1.41 1.36 1.32 1.27 1.22 1.18 1.14 1.10 1.06 1.02 0.99 0.95 0.91 0.88 0.85 0.81 0.77 0.74 0.71 0.68 0.65 0.63 0.61 0.59 0.57 0.56 0.56 0.56 0.54 0.53 0.52 0.52 0.52 0.52 0.53 0.54 0.54 0.55 0.55 0.55 0.54 0.53 0.53 0.52 0.51 0.50 0.49 0.48 0.48 0.48 0.48 0.49 0.49 0.50 0.51 0.51 0.52 0.52 0.53 0.55 0.56 0.59 0.61 0.71 0.73 0.75 0.77 0.79 0.81 0.82 0.83 0.83 0.83 0.83 0.84 0.84 0.85 0.86 0.88 0.89 0.91 0.92 0.94 0.96 0.98 1.01 1.02 1.03 1.05 1.04 1.02 1.01 1.00 0.99 0.98 0.96 0.95 0.93 0.92 0.89 0.87 0.85 0.84 0.82 0.82 0.81 0.82 0.82 0.83 0.84 0.85 0.86 0.86 0.87 0.90 0.93 0.95 0.98 1.00 1.04 1.07 1.10 1.14 1.18 1.21 1.25 1.29 1.33 1.36 1.41 1.45 1.49 1.53 1.57 1.60 1.64 1.68 1.71 1.74 1.77 1.79 1.82 1.84 1.87 1.89 1.90 1.92 1.94 1.96 1.98 2.00 2.01 2.02 2.03 2.03 2.03 2.02 2.02 2.01 2.00 2.00 1.99 1.98 1.96 1.95 1.93 1.91 1.89 1.87 1.85 1.82 1.80 1.77 1.75 1.71 1.68 1.64 1.60 1.56 1.53 1.49 1.45 1.41 1.37 1.33 1.29 1.25 1.21 1.17 1.13 1.09 1.05 1.01 0.96 0.93 0.89 0.85 0.82 0.78 0.74 0.70 0.67 0.65 0.63 0.60 0.58 0.57 0.56 0.55 0.55 0.54 0.54 0.54 0.55 0.56 0.57 0.58 0.58 0.59 0.59 0.59 0.59 0.58 0.57 0.57 0.57 0.56 0.55 0.54 0.53 0.53 0.53 0.54 0.54 0.55 0.56 0.57 0.58 0.59 0.62 0.64 0.66 0.69 0.71 0.82 0.85 0.88 0.90 0.93 0.95 0.96 0.98 0.99 1.00 1.00 1.01 1.01 1.02 1.03 1.04 1.05 1.06 1.08 1.09 1.11 1.13 1.14 1.15 1.15 1.16 1.14 1.12 1.10 1.08 1.06 1.04 1.02 1.00 0.98 0.96 0.94 0.93 0.91 0.89 0.87 0.87 0.87 0.87 0.88 0.89 0.89 0.90 0.91 0.91 0.92 0.94 0.97 0.99 1.02 1.04 1.07 1.11 1.14 1.18 1.22 1.26 1.30 1.34 1.38 1.42 1.47 1.51 1.55 1.59 1.63 1.68 1.72 1.75 1.79 1.82 1.84 1.87 1.90 1.92 1.95 1.96 1.98 2.00 2.02 2.04 2.05 2.06 2.08 2.08 2.09 2.08 2.08 2.07 2.06 2.06 2.05 2.04 2.02 2.00 1.97 1.95 1.93 1.91 1.89 1.87 1.85 1.83 1.81 1.78 1.76 1.73 1.70 1.66 1.63 1.59 1.56 1.52 1.49 1.45 1.42 1.38 1.34 1.30 1.26 1.22 1.18 1.14 1.10 1.06 1.02 0.98 0.94 0.90 0.86 0.82 0.78 0.74 0.70 0.68 0.65 0.63 0.61 0.59 0.58 0.57 0.57 0.57 0.58 0.59 0.59 0.61 0.63 0.64 0.65 0.66 0.66 0.66 0.66 0.65 0.65 0.65 0.65 0.64 0.63 0.61 0.61 0.60 0.60 0.60 0.61 0.62 0.63 0.65 0.67 0.69 0.71 0.74 0.76 0.79 0.82 0.94 0.97 1.00 1.03 1.06 1.09 1.11 1.13 1.14 1.15 1.16 1.16 1.17 1.17 1.18 1.19 1.20 1.21 1.22 1.24 1.25 1.26 1.27 1.28 1.27 1.26 1.24 1.22 1.19 1.16 1.12 1.09 1.07 1.04 1.02 1.00 0.99 0.97 0.96 0.94 0.92 0.92 0.92 0.92 0.93 0.94 0.94 0.95 0.95 0.96 0.96 0.98 1.00 1.03 1.05 1.08 1.11 1.15 1.18 1.22 1.26 1.31 1.35 1.39 1.43 1.47 1.51 1.55 1.59 1.64 1.69 1.73 1.77 1.81 1.85 1.88 1.91 1.93 1.96 1.99 2.01 2.03 2.05 2.07 2.09 2.11 2.12 2.13 2.13 2.14 2.15 2.14 2.13 2.13 2.12 2.11 2.10 2.09 2.06 2.03 2.00 1.97 1.94 1.92 1.91 1.89 1.86 1.84 1.81 1.79 1.77 1.74 1.71 1.68 1.65 1.63 1.59 1.55 1.52 1.48 1.45 1.41 1.37 1.34 1.30 1.26 1.22 1.18 1.15 1.11 1.07 1.03 0.99 0.95 0.90 0.86 0.82 0.78 0.75 0.72 0.69 0.67 0.64 0.62 0.61 0.60 0.61 0.62 0.63 0.64 0.66 0.68 0.69 0.71 0.73 0.74 0.75 0.75 0.75 0.75 0.74 0.74 0.74 0.73 0.72 0.71 0.70 0.70 0.70 0.70 0.70 0.72 0.74 0.76 0.77 0.79 0.82 0.85 0.88 0.91 0.94 1.07 1.10 1.12 1.15 1.19 1.22 1.24 1.26 1.27 1.29 1.30 1.31 1.31 1.32 1.32 1.32 1.33 1.34 1.35 1.37 1.38 1.39 1.39 1.39 1.38 1.36 1.34 1.31 1.28 1.23 1.19 1.15 1.12 1.09 1.07 1.04 1.02 1.00 0.98 0.97 0.96 0.95 0.95 0.95 0.96 0.97 0.97 0.97 0.98 0.98 0.99 1.01 1.03 1.06 1.09 1.12 1.15 1.19 1.22 1.27 1.32 1.35 1.39 1.43 1.47 1.51 1.56 1.60 1.65 1.69 1.74 1.78 1.82 1.85 1.89 1.93 1.96 2.00 2.02 2.04 2.06 2.08 2.10 2.12 2.15 2.18 2.19 2.20 2.21 2.22 2.22 2.22 2.21 2.21 2.20 2.19 2.17 2.15 2.13 2.09 2.06 2.03 2.00 1.97 1.94 1.92 1.88 1.85 1.82 1.80 1.77 1.75 1.73 1.70 1.67 1.64 1.61 1.58 1.54 1.51 1.48 1.44 1.40 1.36 1.33 1.30 1.27 1.23 1.20 1.16 1.12 1.08 1.04 1.00 0.95 0.91 0.87 0.83 0.80 0.77 0.75 0.72 0.69 0.68 0.68 0.68 0.69 0.69 0.71 0.73 0.75 0.77 0.79 0.81 0.82 0.84 0.85 0.86 0.86 0.85 0.84 0.84 0.83 0.82 0.82 0.81 0.81 0.81 0.82 0.82 0.83 0.85 0.87 0.88 0.90 0.91 0.94 0.97 1.01 1.04 1.07 1.16 1.19 1.22 1.26 1.29 1.32 1.34 1.36 1.38 1.39 1.40 1.41 1.42 1.42 1.43 1.43 1.44 1.45 1.46 1.47 1.48 1.49 1.50 1.49 1.48 1.47 1.44 1.41 1.37 1.32 1.28 1.23 1.19 1.15 1.11 1.08 1.06 1.04 1.02 1.00 0.98 0.98 0.98 0.98 0.98 0.99 0.99 0.99 0.99 1.00 1.00 1.03 1.05 1.08 1.12 1.16 1.20 1.23 1.28 1.32 1.37 1.41 1.45 1.49 1.53 1.58 1.62 1.66 1.70 1.75 1.80 1.84 1.88 1.92 1.95 1.98 2.01 2.04 2.06 2.08 2.10 2.13 2.15 2.18 2.20 2.23 2.25 2.27 2.29 2.30 2.30 2.30 2.30 2.30 2.29 2.28 2.26 2.23 2.21 2.17 2.14 2.10 2.06 2.03 1.99 1.95 1.92 1.88 1.85 1.81 1.78 1.76 1.74 1.72 1.70 1.68 1.65 1.61 1.58 1.55 1.52 1.48 1.45 1.42 1.38 1.35 1.32 1.29 1.25 1.21 1.17 1.13 1.09 1.05 1.01 0.97 0.94 0.90 0.86 0.84 0.81 0.80 0.78 0.78 0.78 0.79 0.80 0.81 0.83 0.85 0.88 0.90 0.92 0.93 0.95 0.96 0.97 0.97 0.97 0.97 0.96 0.95 0.95 0.94 0.93 0.92 0.92 0.93 0.93 0.94 0.95 0.96 0.98 1.00 1.02 1.04 1.06 1.08 1.11 1.14 1.16 1.23 1.27 1.30 1.33 1.36 1.40 1.42 1.44 1.45 1.46 1.48 1.48 1.48 1.49 1.49 1.50 1.51 1.52 1.53 1.55 1.56 1.57 1.57 1.57 1.57 1.56 1.53 1.49 1.45 1.40 1.35 1.30 1.25 1.20 1.17 1.13 1.11 1.09 1.07 1.05 1.03 1.03 1.02 1.02 1.01 1.01 1.01 1.01 1.02 1.03 1.05 1.08 1.11 1.14 1.18 1.22 1.26 1.30 1.35 1.39 1.43 1.47 1.51 1.55 1.59 1.63 1.68 1.72 1.77 1.82 1.87 1.91 1.95 1.99 2.02 2.05 2.07 2.09 2.11 2.13 2.15 2.17 2.19 2.22 2.26 2.29 2.32 2.34 2.36 2.38 2.39 2.39 2.40 2.40 2.39 2.38 2.36 2.33 2.30 2.26 2.22 2.18 2.13 2.09 2.05 2.00 1.96 1.92 1.88 1.84 1.81 1.79 1.77 1.75 1.73 1.72 1.69 1.65 1.62 1.59 1.56 1.53 1.50 1.47 1.44 1.41 1.38 1.35 1.31 1.27 1.22 1.19 1.15 1.12 1.07 1.03 0.99 0.96 0.93 0.92 0.91 0.90 0.89 0.89 0.90 0.91 0.93 0.95 0.97 1.00 1.03 1.05 1.07 1.08 1.09 1.10 1.10 1.10 1.10 1.09 1.09 1.08 1.07 1.05 1.04 1.02 1.03 1.04 1.05 1.06 1.07 1.08 1.10 1.11 1.12 1.13 1.15 1.17 1.19 1.21 1.23 1.29 1.32 1.35 1.38 1.41 1.44 1.45 1.47 1.49 1.50 1.52 1.52 1.52 1.52 1.53 1.53 1.55 1.56 1.58 1.60 1.61 1.62 1.62 1.63 1.63 1.63 1.59 1.55 1.51 1.46 1.41 1.35 1.30 1.26 1.21 1.17 1.15 1.13 1.12 1.10 1.08 1.07 1.06 1.06 1.05 1.04 1.05 1.05 1.06 1.08 1.10 1.14 1.17 1.21 1.25 1.30 1.34 1.39 1.43 1.46 1.50 1.54 1.58 1.62 1.66 1.70 1.74 1.79 1.84 1.89 1.93 1.98 2.02 2.05 2.08 2.11 2.13 2.15 2.17 2.18 2.20 2.22 2.24 2.27 2.31 2.35 2.38 2.41 2.44 2.46 2.48 2.49 2.50 2.50 2.49 2.48 2.46 2.43 2.39 2.34 2.30 2.25 2.21 2.16 2.11 2.06 2.01 1.97 1.92 1.88 1.84 1.82 1.80 1.78 1.77 1.76 1.73 1.70 1.67 1.64 1.61 1.58 1.56 1.53 1.50 1.48 1.45 1.41 1.37 1.33 1.28 1.25 1.21 1.17 1.13 1.09 1.06 1.03 1.02 1.01 1.01 1.01 1.01 1.01 1.03 1.05 1.07 1.10 1.13 1.16 1.18 1.20 1.22 1.23 1.23 1.23 1.23 1.22 1.22 1.20 1.19 1.18 1.17 1.15 1.14 1.12 1.13 1.14 1.16 1.17 1.18 1.19 1.20 1.20 1.20 1.21 1.22 1.24 1.26 1.28 1.29 1.34 1.37 1.39 1.41 1.43 1.45 1.46 1.48 1.50 1.51 1.52 1.52 1.52 1.53 1.53 1.54 1.56 1.58 1.60 1.62 1.63 1.64 1.65 1.66 1.66 1.66 1.63 1.60 1.56 1.50 1.45 1.40 1.35 1.30 1.26 1.21 1.19 1.17 1.15 1.14 1.13 1.11 1.10 1.09 1.08 1.08 1.09 1.09 1.11 1.14 1.17 1.21 1.25 1.29 1.34 1.39 1.43 1.47 1.51 1.55 1.58 1.62 1.66 1.69 1.73 1.77 1.81 1.86 1.90 1.95 1.99 2.03 2.07 2.11 2.14 2.17 2.19 2.21 2.23 2.23 2.24 2.27 2.29 2.33 2.36 2.40 2.44 2.49 2.52 2.54 2.57 2.58 2.59 2.59 2.58 2.57 2.54 2.51 2.47 2.42 2.37 2.33 2.28 2.23 2.18 2.13 2.08 2.02 1.97 1.93 1.88 1.86 1.84 1.83 1.81 1.80 1.77 1.75 1.73 1.70 1.68 1.65 1.62 1.60 1.57 1.55 1.51 1.48 1.44 1.40 1.35 1.31 1.27 1.23 1.19 1.16 1.14 1.12 1.11 1.11 1.11 1.12 1.13 1.14 1.17 1.19 1.22 1.25 1.28 1.31 1.34 1.35 1.37 1.38 1.37 1.36 1.34 1.33 1.31 1.29 1.27 1.25 1.24 1.23 1.23 1.22 1.23 1.23 1.24 1.25 1.27 1.27 1.28 1.28 1.28 1.28 1.29 1.31 1.32 1.33 1.34 1.38 1.40 1.42 1.43 1.44 1.45 1.46 1.48 1.49 1.49 1.49 1.50 1.51 1.51 1.52 1.53 1.55 1.57 1.58 1.59 1.61 1.63 1.65 1.66 1.67 1.67 1.65 1.62 1.58 1.53 1.48 1.43 1.37 1.33 1.29 1.25 1.22 1.20 1.18 1.17 1.15 1.14 1.13 1.12 1.11 1.10 1.12 1.13 1.15 1.19 1.22 1.27 1.32 1.37 1.43 1.48 1.52 1.56 1.59 1.63 1.67 1.70 1.74 1.77 1.80 1.83 1.87 1.91 1.95 2.00 2.05 2.08 2.12 2.16 2.19 2.22 2.24 2.26 2.28 2.30 2.32 2.34 2.36 2.39 2.43 2.47 2.52 2.57 2.61 2.63 2.65 2.66 2.67 2.67 2.66 2.65 2.61 2.57 2.53 2.49 2.45 2.40 2.35 2.30 2.24 2.19 2.14 2.09 2.04 1.99 1.95 1.92 1.90 1.88 1.86 1.85 1.83 1.81 1.79 1.77 1.75 1.73 1.70 1.68 1.65 1.62 1.59 1.56 1.52 1.47 1.43 1.38 1.34 1.30 1.27 1.23 1.21 1.20 1.19 1.20 1.20 1.22 1.24 1.27 1.30 1.33 1.36 1.38 1.42 1.45 1.49 1.50 1.51 1.50 1.48 1.46 1.44 1.41 1.38 1.36 1.33 1.32 1.31 1.30 1.30 1.30 1.30 1.30 1.31 1.32 1.33 1.34 1.34 1.35 1.35 1.35 1.35 1.36 1.37 1.37 1.38 1.42 1.43 1.44 1.44 1.44 1.45 1.45 1.46 1.47 1.46 1.45 1.46 1.46 1.46 1.48 1.49 1.51 1.53 1.55 1.56 1.58 1.61 1.63 1.64 1.65 1.65 1.63 1.60 1.57 1.52 1.48 1.43 1.37 1.33 1.29 1.25 1.23 1.21 1.19 1.17 1.15 1.13 1.12 1.11 1.11 1.10 1.12 1.14 1.17 1.21 1.26 1.32 1.38 1.44 1.50 1.56 1.60 1.64 1.68 1.72 1.75 1.78 1.80 1.83 1.86 1.89 1.93 1.96 2.01 2.05 2.10 2.14 2.18 2.21 2.25 2.29 2.31 2.34 2.36 2.39 2.41 2.43 2.45 2.48 2.53 2.57 2.61 2.66 2.69 2.71 2.72 2.73 2.73 2.72 2.70 2.69 2.65 2.61 2.57 2.53 2.49 2.44 2.39 2.33 2.28 2.23 2.18 2.14 2.09 2.05 2.01 1.99 1.96 1.94 1.93 1.92 1.90 1.88 1.86 1.84 1.82 1.80 1.79 1.76 1.73 1.70 1.67 1.64 1.60 1.55 1.51 1.46 1.42 1.37 1.34 1.30 1.29 1.28 1.28 1.29 1.31 1.33 1.35 1.38 1.42 1.45 1.48 1.51 1.54 1.57 1.60 1.60 1.60 1.59 1.56 1.54 1.50 1.46 1.42 1.39 1.36 1.34 1.33 1.32 1.32 1.32 1.32 1.32 1.33 1.35 1.37 1.38 1.39 1.40 1.41 1.41 1.41 1.42 1.42 1.42 1.42 1.45 1.45 1.45 1.45 1.44 1.44 1.44 1.44 1.44 1.43 1.42 1.41 1.41 1.41 1.43 1.44 1.45 1.47 1.49 1.52 1.55 1.57 1.60 1.61 1.62 1.62 1.60 1.58 1.55 1.50 1.46 1.41 1.37 1.33 1.29 1.25 1.23 1.20 1.18 1.16 1.13 1.12 1.10 1.10 1.10 1.10 1.13 1.16 1.20 1.26 1.32 1.38 1.45 1.51 1.57 1.63 1.68 1.73 1.77 1.79 1.82 1.84 1.86 1.88 1.91 1.93 1.97 2.01 2.05 2.09 2.14 2.19 2.23 2.28 2.33 2.37 2.40 2.43 2.46 2.49 2.52 2.55 2.58 2.61 2.65 2.70 2.73 2.77 2.79 2.81 2.82 2.81 2.81 2.79 2.76 2.73 2.69 2.64 2.60 2.55 2.51 2.46 2.41 2.37 2.32 2.27 2.23 2.19 2.15 2.11 2.07 2.04 2.02 2.00 1.98 1.96 1.95 1.94 1.93 1.91 1.90 1.89 1.88 1.86 1.83 1.80 1.77 1.73 1.70 1.65 1.60 1.55 1.51 1.46 1.42 1.38 1.37 1.36 1.37 1.38 1.40 1.43 1.45 1.48 1.51 1.55 1.57 1.60 1.63 1.65 1.67 1.67 1.67 1.66 1.62 1.59 1.54 1.50 1.45 1.41 1.37 1.36 1.35 1.34 1.34 1.33 1.34 1.34 1.35 1.38 1.40 1.42 1.44 1.45 1.46 1.47 1.47 1.47 1.46 1.46 1.45 1.49 1.48 1.48 1.47 1.45 1.43 1.42 1.42 1.41 1.40 1.39 1.38 1.37 1.37 1.38 1.39 1.41 1.42 1.44 1.47 1.51 1.53 1.56 1.57 1.58 1.58 1.56 1.54 1.51 1.47 1.43 1.39 1.35 1.31 1.27 1.24 1.21 1.18 1.15 1.13 1.11 1.10 1.09 1.09 1.10 1.11 1.15 1.19 1.24 1.31 1.38 1.45 1.52 1.58 1.65 1.71 1.76 1.81 1.85 1.87 1.89 1.91 1.92 1.94 1.96 1.98 2.02 2.06 2.10 2.15 2.19 2.25 2.31 2.36 2.42 2.47 2.51 2.55 2.58 2.62 2.66 2.70 2.74 2.77 2.82 2.86 2.89 2.92 2.94 2.95 2.95 2.93 2.92 2.89 2.84 2.80 2.74 2.68 2.63 2.58 2.54 2.49 2.45 2.40 2.35 2.31 2.27 2.23 2.19 2.16 2.12 2.09 2.07 2.05 2.03 2.01 2.00 2.00 2.00 1.99 1.99 1.97 1.96 1.94 1.92 1.90 1.87 1.84 1.80 1.75 1.71 1.66 1.60 1.56 1.52 1.47 1.46 1.45 1.45 1.46 1.48 1.50 1.52 1.55 1.58 1.61 1.63 1.66 1.68 1.70 1.72 1.72 1.72 1.70 1.66 1.62 1.58 1.53 1.48 1.44 1.39 1.38 1.36 1.35 1.34 1.34 1.35 1.36 1.37 1.40 1.43 1.46 1.48 1.50 1.51 1.53 1.52 1.52 1.51 1.50 1.49 1.54 1.52 1.50 1.48 1.46 1.43 1.41 1.40 1.39 1.38 1.38 1.37 1.35 1.35 1.35 1.36 1.37 1.38 1.41 1.44 1.47 1.49 1.52 1.53 1.53 1.53 1.51 1.49 1.46 1.43 1.40 1.36 1.31 1.27 1.24 1.20 1.17 1.14 1.12 1.10 1.08 1.07 1.07 1.08 1.10 1.12 1.17 1.22 1.28 1.36 1.44 1.51 1.59 1.66 1.72 1.79 1.83 1.88 1.91 1.94 1.96 1.98 1.99 2.01 2.03 2.05 2.09 2.13 2.17 2.22 2.27 2.33 2.40 2.46 2.52 2.58 2.63 2.68 2.73 2.78 2.83 2.88 2.93 2.98 3.02 3.07 3.10 3.14 3.15 3.14 3.14 3.11 3.08 3.03 2.96 2.90 2.83 2.76 2.70 2.65 2.59 2.54 2.50 2.45 2.40 2.35 2.31 2.27 2.23 2.20 2.17 2.14 2.12 2.10 2.08 2.06 2.05 2.05 2.05 2.05 2.06 2.05 2.03 2.02 2.00 1.98 1.96 1.93 1.90 1.86 1.81 1.76 1.71 1.66 1.61 1.56 1.55 1.53 1.53 1.53 1.54 1.55 1.57 1.59 1.62 1.64 1.66 1.68 1.69 1.71 1.73 1.73 1.73 1.71 1.68 1.64 1.60 1.55 1.51 1.47 1.43 1.41 1.39 1.37 1.37 1.36 1.37 1.39 1.41 1.44 1.47 1.50 1.53 1.55 1.57 1.59 1.58 1.58 1.56 1.55 1.54 1.58 1.55 1.52 1.49 1.46 1.43 1.41 1.39 1.38 1.37 1.36 1.36 1.35 1.34 1.34 1.33 1.34 1.36 1.38 1.40 1.43 1.45 1.47 1.48 1.48 1.48 1.46 1.44 1.41 1.38 1.35 1.31 1.27 1.23 1.19 1.15 1.13 1.10 1.08 1.06 1.04 1.05 1.05 1.07 1.09 1.12 1.19 1.25 1.32 1.40 1.48 1.56 1.65 1.72 1.79 1.85 1.90 1.94 1.98 2.00 2.03 2.04 2.06 2.07 2.09 2.11 2.16 2.20 2.25 2.31 2.37 2.44 2.51 2.58 2.66 2.73 2.79 2.84 2.91 2.98 3.05 3.11 3.17 3.22 3.28 3.33 3.37 3.41 3.42 3.42 3.41 3.36 3.32 3.25 3.16 3.07 2.98 2.90 2.83 2.76 2.70 2.64 2.59 2.54 2.48 2.42 2.36 2.30 2.26 2.22 2.19 2.19 2.18 2.16 2.13 2.09 2.09 2.08 2.08 2.09 2.09 2.09 2.09 2.09 2.08 2.06 2.04 2.02 1.99 1.95 1.92 1.86 1.80 1.74 1.69 1.64 1.61 1.59 1.58 1.58 1.58 1.59 1.60 1.61 1.63 1.64 1.65 1.67 1.68 1.69 1.70 1.70 1.70 1.70 1.68 1.66 1.62 1.58 1.54 1.51 1.48 1.46 1.44 1.43 1.42 1.41 1.43 1.44 1.46 1.48 1.51 1.54 1.58 1.60 1.62 1.64 1.63 1.63 1.61 1.59 1.58 1.63 1.59 1.54 1.51 1.47 1.44 1.42 1.40 1.39 1.38 1.38 1.37 1.35 1.34 1.34 1.33 1.34 1.35 1.36 1.38 1.40 1.42 1.43 1.44 1.43 1.43 1.41 1.39 1.36 1.32 1.28 1.24 1.20 1.17 1.13 1.10 1.07 1.05 1.03 1.02 1.01 1.02 1.03 1.05 1.08 1.12 1.19 1.26 1.34 1.43 1.52 1.60 1.69 1.76 1.83 1.90 1.95 2.00 2.04 2.07 2.09 2.11 2.12 2.14 2.16 2.18 2.23 2.29 2.35 2.43 2.50 2.58 2.66 2.75 2.83 2.91 2.99 3.07 3.15 3.24 3.33 3.40 3.47 3.54 3.61 3.68 3.72 3.77 3.79 3.78 3.77 3.71 3.64 3.56 3.46 3.35 3.26 3.16 3.08 3.00 2.93 2.86 2.79 2.72 2.65 2.58 2.50 2.42 2.35 2.29 2.23 2.22 2.22 2.21 2.21 2.20 2.18 2.15 2.14 2.14 2.13 2.13 2.13 2.13 2.13 2.13 2.11 2.09 2.06 2.02 1.98 1.92 1.86 1.81 1.76 1.70 1.68 1.65 1.63 1.62 1.61 1.61 1.61 1.61 1.62 1.63 1.63 1.64 1.65 1.66 1.67 1.68 1.69 1.69 1.68 1.67 1.65 1.62 1.60 1.58 1.56 1.54 1.53 1.52 1.52 1.52 1.52 1.53 1.55 1.57 1.59 1.62 1.64 1.67 1.69 1.70 1.70 1.69 1.68 1.65 1.63 1.69 1.64 1.58 1.54 1.50 1.46 1.45 1.43 1.41 1.40 1.39 1.38 1.36 1.35 1.34 1.33 1.33 1.34 1.35 1.36 1.38 1.39 1.40 1.40 1.39 1.38 1.36 1.34 1.31 1.27 1.23 1.18 1.14 1.10 1.07 1.04 1.02 1.00 0.98 0.97 0.97 0.98 1.00 1.02 1.07 1.11 1.18 1.25 1.34 1.44 1.54 1.63 1.72 1.80 1.87 1.95 2.00 2.06 2.10 2.14 2.17 2.19 2.20 2.23 2.25 2.28 2.34 2.40 2.48 2.56 2.64 2.73 2.82 2.92 3.01 3.11 3.21 3.31 3.41 3.52 3.63 3.72 3.81 3.90 3.99 4.08 4.14 4.19 4.22 4.21 4.21 4.14 4.08 3.99 3.87 3.76 3.66 3.56 3.47 3.37 3.27 3.18 3.09 2.99 2.89 2.79 2.69 2.60 2.51 2.44 2.37 2.35 2.33 2.32 2.31 2.30 2.27 2.24 2.22 2.20 2.18 2.17 2.17 2.16 2.16 2.16 2.14 2.12 2.10 2.06 2.03 1.97 1.91 1.86 1.81 1.76 1.73 1.70 1.68 1.66 1.64 1.63 1.62 1.62 1.62 1.62 1.63 1.63 1.64 1.65 1.66 1.67 1.68 1.69 1.69 1.69 1.69 1.68 1.68 1.66 1.65 1.65 1.64 1.64 1.64 1.64 1.64 1.64 1.64 1.65 1.66 1.68 1.70 1.72 1.75 1.77 1.76 1.75 1.73 1.71 1.69 1.74 1.68 1.63 1.58 1.53 1.49 1.47 1.45 1.43 1.42 1.41 1.40 1.38 1.37 1.35 1.34 1.34 1.33 1.34 1.34 1.35 1.36 1.36 1.36 1.35 1.34 1.32 1.29 1.25 1.21 1.17 1.13 1.08 1.05 1.01 0.98 0.96 0.94 0.93 0.93 0.92 0.94 0.97 1.00 1.05 1.10 1.17 1.25 1.34 1.45 1.56 1.65 1.75 1.84 1.91 1.98 2.05 2.11 2.17 2.21 2.25 2.28 2.30 2.33 2.37 2.40 2.47 2.54 2.62 2.70 2.79 2.89 2.99 3.10 3.21 3.33 3.45 3.57 3.69 3.81 3.94 4.06 4.18 4.30 4.41 4.52 4.59 4.67 4.70 4.70 4.71 4.66 4.61 4.54 4.43 4.32 4.21 4.10 3.98 3.86 3.74 3.62 3.49 3.36 3.23 3.09 2.97 2.85 2.74 2.65 2.56 2.52 2.48 2.45 2.43 2.41 2.37 2.33 2.30 2.27 2.23 2.22 2.20 2.18 2.18 2.17 2.15 2.14 2.11 2.07 2.04 1.99 1.93 1.88 1.84 1.80 1.77 1.74 1.71 1.69 1.66 1.65 1.64 1.63 1.63 1.62 1.63 1.63 1.64 1.65 1.67 1.69 1.71 1.72 1.74 1.75 1.76 1.77 1.77 1.77 1.76 1.77 1.77 1.77 1.77 1.76 1.75 1.74 1.73 1.73 1.73 1.75 1.76 1.78 1.80 1.82 1.81 1.80 1.78 1.76 1.74 1.78 1.73 1.68 1.62 1.57 1.52 1.49 1.47 1.45 1.44 1.43 1.42 1.40 1.39 1.37 1.35 1.34 1.33 1.33 1.33 1.32 1.33 1.34 1.33 1.32 1.31 1.27 1.24 1.20 1.16 1.11 1.07 1.03 1.00 0.96 0.93 0.91 0.90 0.89 0.89 0.89 0.91 0.94 0.98 1.03 1.09 1.17 1.26 1.36 1.47 1.58 1.68 1.78 1.87 1.95 2.03 2.10 2.17 2.24 2.29 2.34 2.38 2.42 2.46 2.50 2.54 2.61 2.68 2.76 2.86 2.95 3.06 3.16 3.28 3.41 3.54 3.68 3.82 3.96 4.11 4.25 4.40 4.56 4.71 4.84 4.98 5.06 5.15 5.21 5.23 5.25 5.23 5.21 5.17 5.09 5.02 4.88 4.75 4.62 4.47 4.33 4.18 4.02 3.85 3.67 3.49 3.34 3.18 3.04 2.91 2.78 2.72 2.65 2.60 2.56 2.53 2.48 2.42 2.37 2.33 2.29 2.26 2.23 2.20 2.18 2.16 2.15 2.13 2.10 2.07 2.03 1.99 1.94 1.90 1.86 1.83 1.80 1.77 1.74 1.71 1.68 1.66 1.65 1.64 1.64 1.63 1.64 1.65 1.66 1.69 1.71 1.74 1.77 1.79 1.82 1.84 1.86 1.87 1.88 1.88 1.88 1.89 1.90 1.90 1.89 1.88 1.86 1.84 1.83 1.83 1.82 1.82 1.82 1.83 1.84 1.86 1.85 1.85 1.83 1.80 1.78 1.82 1.77 1.71 1.66 1.61 1.56 1.53 1.51 1.48 1.46 1.45 1.43 1.41 1.39 1.37 1.35 1.33 1.32 1.31 1.31 1.30 1.30 1.30 1.29 1.28 1.27 1.23 1.20 1.16 1.12 1.07 1.03 0.99 0.96 0.93 0.89 0.88 0.87 0.86 0.87 0.88 0.90 0.92 0.96 1.02 1.09 1.19 1.28 1.39 1.50 1.61 1.71 1.82 1.91 1.99 2.08 2.16 2.23 2.31 2.37 2.44 2.49 2.54 2.59 2.63 2.68 2.76 2.84 2.92 3.02 3.12 3.23 3.35 3.48 3.61 3.75 3.91 4.06 4.22 4.38 4.55 4.73 4.92 5.09 5.24 5.39 5.49 5.60 5.68 5.73 5.78 5.79 5.81 5.80 5.76 5.73 5.61 5.50 5.36 5.20 5.03 4.85 4.67 4.47 4.24 4.01 3.81 3.61 3.42 3.24 3.07 2.96 2.86 2.78 2.71 2.65 2.58 2.52 2.46 2.40 2.34 2.30 2.26 2.22 2.19 2.16 2.14 2.12 2.09 2.06 2.03 1.99 1.95 1.92 1.88 1.85 1.82 1.79 1.75 1.72 1.69 1.68 1.66 1.66 1.66 1.66 1.68 1.70 1.72 1.75 1.79 1.83 1.86 1.89 1.91 1.93 1.95 1.97 1.98 1.99 2.00 2.01 2.02 2.02 2.01 2.00 1.98 1.96 1.94 1.92 1.90 1.89 1.89 1.89 1.89 1.90 1.89 1.87 1.86 1.84 1.82 1.84 1.80 1.75 1.70 1.66 1.61 1.58 1.55 1.52 1.49 1.46 1.43 1.41 1.38 1.36 1.33 1.32 1.31 1.30 1.28 1.27 1.27 1.26 1.26 1.25 1.24 1.20 1.17 1.13 1.09 1.05 1.00 0.96 0.92 0.90 0.88 0.87 0.85 0.85 0.86 0.86 0.89 0.92 0.97 1.04 1.10 1.21 1.32 1.43 1.54 1.65 1.76 1.86 1.96 2.05 2.14 2.23 2.31 2.39 2.47 2.55 2.61 2.68 2.74 2.79 2.85 2.93 3.00 3.09 3.19 3.29 3.42 3.55 3.69 3.82 3.96 4.11 4.26 4.42 4.59 4.75 4.96 5.16 5.35 5.52 5.69 5.80 5.92 6.01 6.08 6.16 6.21 6.26 6.29 6.29 6.30 6.24 6.18 6.08 5.93 5.77 5.58 5.38 5.16 4.91 4.66 4.42 4.17 3.94 3.71 3.48 3.34 3.19 3.07 2.96 2.85 2.76 2.66 2.58 2.51 2.44 2.38 2.31 2.26 2.22 2.19 2.16 2.14 2.11 2.08 2.04 2.00 1.96 1.93 1.90 1.86 1.84 1.81 1.78 1.75 1.71 1.70 1.69 1.69 1.70 1.71 1.74 1.77 1.80 1.85 1.89 1.92 1.96 1.99 2.01 2.04 2.05 2.06 2.08 2.09 2.10 2.11 2.12 2.11 2.10 2.09 2.06 2.04 2.02 2.00 1.98 1.97 1.95 1.94 1.93 1.93 1.91 1.90 1.88 1.86 1.84 1.85 1.81 1.77 1.73 1.69 1.65 1.62 1.58 1.54 1.51 1.47 1.44 1.41 1.38 1.35 1.32 1.30 1.29 1.27 1.26 1.25 1.24 1.24 1.24 1.22 1.21 1.18 1.14 1.11 1.06 1.02 0.98 0.94 0.91 0.89 0.87 0.86 0.86 0.86 0.87 0.88 0.91 0.94 0.99 1.05 1.12 1.24 1.35 1.47 1.59 1.70 1.82 1.93 2.03 2.13 2.23 2.32 2.41 2.50 2.60 2.69 2.76 2.83 2.90 2.96 3.02 3.09 3.16 3.25 3.35 3.46 3.60 3.74 3.87 4.01 4.15 4.29 4.43 4.58 4.74 4.89 5.09 5.29 5.48 5.66 5.84 5.96 6.08 6.19 6.28 6.38 6.45 6.52 6.58 6.64 6.69 6.68 6.68 6.62 6.50 6.39 6.19 5.99 5.78 5.56 5.33 5.03 4.74 4.46 4.19 3.93 3.74 3.56 3.40 3.26 3.13 3.00 2.87 2.76 2.66 2.57 2.49 2.41 2.34 2.30 2.25 2.22 2.18 2.15 2.11 2.08 2.04 2.00 1.97 1.93 1.90 1.87 1.84 1.82 1.78 1.75 1.74 1.73 1.74 1.76 1.78 1.82 1.86 1.90 1.95 1.99 2.02 2.05 2.07 2.09 2.11 2.12 2.13 2.14 2.15 2.17 2.17 2.17 2.17 2.16 2.15 2.13 2.11 2.08 2.05 2.03 2.01 1.98 1.96 1.94 1.92 1.91 1.90 1.88 1.87 1.85 1.84 1.81 1.78 1.75 1.72 1.69 1.65 1.61 1.57 1.53 1.49 1.45 1.42 1.38 1.35 1.32 1.29 1.27 1.25 1.24 1.23 1.22 1.22 1.21 1.20 1.19 1.16 1.13 1.09 1.05 1.01 0.97 0.93 0.90 0.88 0.87 0.87 0.87 0.87 0.89 0.90 0.93 0.96 1.01 1.08 1.16 1.27 1.39 1.51 1.64 1.77 1.88 2.00 2.11 2.21 2.32 2.42 2.52 2.63 2.73 2.83 2.91 2.99 3.06 3.12 3.17 3.24 3.32 3.41 3.52 3.62 3.77 3.91 4.05 4.19 4.32 4.45 4.57 4.70 4.84 4.98 5.16 5.34 5.51 5.68 5.86 5.98 6.10 6.21 6.31 6.41 6.49 6.58 6.67 6.76 6.86 6.90 6.95 6.94 6.88 6.82 6.65 6.48 6.29 6.07 5.85 5.54 5.23 4.93 4.66 4.39 4.17 3.96 3.77 3.60 3.44 3.28 3.13 2.99 2.86 2.73 2.63 2.54 2.46 2.40 2.33 2.29 2.25 2.20 2.16 2.12 2.09 2.06 2.02 1.98 1.95 1.92 1.89 1.86 1.83 1.80 1.79 1.79 1.80 1.83 1.86 1.91 1.96 2.01 2.05 2.10 2.12 2.15 2.17 2.18 2.19 2.18 2.18 2.18 2.18 2.19 2.19 2.19 2.18 2.18 2.18 2.15 2.13 2.10 2.07 2.04 2.01 1.98 1.95 1.92 1.90 1.88 1.87 1.86 1.85 1.84 1.83 1.81 1.80 1.77 1.74 1.71 1.67 1.63 1.59 1.55 1.51 1.47 1.42 1.38 1.35 1.32 1.29 1.26 1.24 1.23 1.21 1.21 1.20 1.20 1.18 1.17 1.14 1.12 1.08 1.05 1.01 0.97 0.93 0.91 0.89 0.88 0.88 0.88 0.89 0.90 0.91 0.95 0.98 1.03 1.11 1.19 1.31 1.43 1.56 1.69 1.83 1.95 2.07 2.19 2.30 2.41 2.52 2.63 2.74 2.86 2.97 3.05 3.13 3.20 3.26 3.31 3.38 3.45 3.55 3.66 3.78 3.92 4.07 4.20 4.34 4.47 4.57 4.68 4.79 4.90 5.02 5.17 5.31 5.46 5.61 5.75 5.86 5.97 6.07 6.17 6.26 6.35 6.44 6.54 6.67 6.80 6.89 6.98 7.03 7.03 7.03 6.91 6.78 6.61 6.39 6.17 5.89 5.60 5.33 5.08 4.83 4.60 4.37 4.16 3.95 3.75 3.58 3.42 3.25 3.09 2.93 2.81 2.70 2.60 2.51 2.43 2.38 2.32 2.27 2.22 2.18 2.14 2.11 2.08 2.05 2.02 1.98 1.94 1.91 1.88 1.86 1.86 1.86 1.88 1.92 1.96 2.02 2.07 2.12 2.17 2.22 2.24 2.27 2.28 2.28 2.28 2.25 2.23 2.21 2.19 2.17 2.17 2.17 2.17 2.17 2.17 2.14 2.11 2.09 2.05 2.02 1.98 1.95 1.91 1.89 1.86 1.85 1.84 1.83 1.83 1.83 1.82 1.81 1.81 1.79 1.76 1.74 1.70 1.66 1.62 1.57 1.53 1.48 1.44 1.39 1.35 1.32 1.29 1.26 1.24 1.22 1.20 1.20 1.20 1.20 1.18 1.17 1.14 1.12 1.08 1.05 1.01 0.97 0.94 0.92 0.91 0.89 0.89 0.89 0.90 0.91 0.93 0.96 0.99 1.05 1.12 1.20 1.33 1.46 1.60 1.74 1.88 2.01 2.14 2.27 2.38 2.50 2.61 2.72 2.84 2.96 3.09 3.16 3.24 3.31 3.37 3.43 3.50 3.57 3.66 3.78 3.90 4.04 4.18 4.31 4.43 4.55 4.65 4.75 4.85 4.94 5.03 5.14 5.25 5.36 5.47 5.57 5.65 5.74 5.82 5.89 5.96 6.04 6.13 6.24 6.37 6.51 6.63 6.76 6.85 6.91 6.97 6.89 6.81 6.69 6.52 6.35 6.11 5.87 5.63 5.40 5.16 4.94 4.72 4.50 4.29 4.08 3.89 3.70 3.52 3.34 3.17 3.02 2.87 2.74 2.65 2.55 2.48 2.41 2.34 2.29 2.24 2.21 2.19 2.16 2.13 2.09 2.06 2.03 2.00 1.97 1.95 1.95 1.96 1.99 2.04 2.09 2.16 2.22 2.28 2.33 2.39 2.41 2.43 2.42 2.40 2.37 2.32 2.27 2.22 2.19 2.16 2.15 2.15 2.14 2.13 2.13 2.10 2.08 2.05 2.02 2.00 1.96 1.92 1.89 1.87 1.85 1.83 1.81 1.81 1.81 1.82 1.82 1.82 1.82 1.80 1.78 1.76 1.72 1.69 1.64 1.59 1.54 1.49 1.45 1.41 1.37 1.34 1.31 1.28 1.26 1.24 1.23 1.22 1.22 1.21 1.20 1.18 1.16 1.13 1.10 1.06 1.02 0.99 0.95 0.93 0.91 0.89 0.90 0.90 0.91 0.93 0.94 0.97 1.00 1.06 1.14 1.21 1.35 1.48 1.63 1.77 1.92 2.06 2.20 2.33 2.46 2.58 2.69 2.81 2.93 3.04 3.16 3.25 3.33 3.40 3.45 3.50 3.58 3.65 3.74 3.85 3.96 4.10 4.24 4.37 4.50 4.62 4.72 4.81 4.90 4.97 5.05 5.12 5.19 5.27 5.33 5.40 5.43 5.46 5.49 5.52 5.56 5.63 5.70 5.81 5.94 6.07 6.21 6.35 6.46 6.54 6.63 6.61 6.60 6.53 6.42 6.31 6.13 5.95 5.77 5.57 5.37 5.17 4.97 4.77 4.56 4.35 4.15 3.95 3.76 3.57 3.39 3.23 3.07 2.93 2.81 2.69 2.61 2.53 2.46 2.40 2.34 2.32 2.29 2.27 2.25 2.22 2.20 2.17 2.15 2.13 2.10 2.12 2.14 2.18 2.23 2.29 2.36 2.44 2.50 2.54 2.58 2.59 2.59 2.57 2.51 2.46 2.38 2.30 2.23 2.18 2.13 2.12 2.11 2.10 2.10 2.10 2.08 2.06 2.03 2.00 1.97 1.94 1.91 1.89 1.86 1.84 1.82 1.81 1.81 1.81 1.82 1.83 1.82 1.81 1.80 1.78 1.76 1.73 1.69 1.65 1.60 1.55 1.51 1.47 1.43 1.40 1.37 1.34 1.32 1.30 1.29 1.28 1.27 1.26 1.25 1.24 1.22 1.19 1.16 1.13 1.09 1.04 1.01 0.98 0.95 0.93 0.91 0.92 0.92 0.93 0.94 0.95 0.98 1.02 1.08 1.16 1.25 1.38 1.52 1.66 1.82 1.97 2.12 2.26 2.40 2.52 2.64 2.75 2.87 2.99 3.10 3.21 3.30 3.38 3.45 3.51 3.56 3.63 3.70 3.78 3.89 3.99 4.12 4.26 4.40 4.53 4.66 4.76 4.86 4.95 5.02 5.09 5.14 5.19 5.22 5.25 5.27 5.25 5.23 5.22 5.21 5.20 5.25 5.31 5.39 5.51 5.63 5.76 5.90 6.02 6.13 6.23 6.26 6.29 6.28 6.23 6.17 6.06 5.94 5.81 5.65 5.49 5.31 5.13 4.95 4.75 4.55 4.36 4.16 3.97 3.78 3.59 3.43 3.26 3.12 2.99 2.86 2.78 2.69 2.61 2.56 2.50 2.47 2.45 2.42 2.40 2.38 2.37 2.35 2.33 2.32 2.31 2.33 2.36 2.40 2.46 2.52 2.59 2.66 2.70 2.74 2.77 2.76 2.74 2.70 2.62 2.54 2.44 2.35 2.27 2.22 2.17 2.15 2.12 2.12 2.12 2.12 2.11 2.09 2.07 2.04 2.01 1.98 1.95 1.92 1.89 1.86 1.85 1.83 1.82 1.83 1.83 1.84 1.83 1.81 1.79 1.77 1.75 1.72 1.69 1.65 1.61 1.57 1.53 1.49 1.46 1.43 1.40 1.39 1.37 1.36 1.36 1.35 1.34 1.33 1.31 1.30 1.28 1.25 1.22 1.18 1.13 1.08 1.05 1.02 0.99 0.97 0.95 0.95 0.95 0.95 0.96 0.97 1.00 1.04 1.10 1.19 1.29 1.42 1.56 1.71 1.86 2.02 2.17 2.32 2.45 2.57 2.68 2.80 2.91 3.02 3.13 3.23 3.31 3.38 3.45 3.51 3.57 3.63 3.70 3.78 3.89 3.99 4.12 4.26 4.40 4.54 4.68 4.79 4.91 5.00 5.08 5.16 5.20 5.23 5.25 5.24 5.23 5.17 5.12 5.06 5.01 4.96 4.98 5.00 5.05 5.15 5.24 5.37 5.49 5.61 5.73 5.85 5.91 5.98 6.01 6.01 6.01 5.95 5.88 5.79 5.67 5.55 5.39 5.23 5.06 4.88 4.70 4.51 4.32 4.13 3.94 3.76 3.60 3.45 3.31 3.18 3.05 2.97 2.88 2.81 2.75 2.69 2.66 2.63 2.61 2.60 2.58 2.57 2.56 2.55 2.55 2.55 2.58 2.61 2.65 2.71 2.77 2.82 2.88 2.91 2.93 2.96 2.93 2.90 2.83 2.73 2.63 2.53 2.43 2.35 2.30 2.25 2.22 2.20 2.19 2.20 2.20 2.19 2.18 2.16 2.13 2.10 2.07 2.03 1.99 1.95 1.92 1.89 1.87 1.85 1.85 1.84 1.86 1.84 1.82 1.80 1.78 1.76 1.72 1.69 1.66 1.62 1.58 1.55 1.52 1.49 1.47 1.45 1.44 1.44 1.43 1.43 1.43 1.42 1.41 1.39 1.37 1.35 1.32 1.28 1.24 1.19 1.14 1.10 1.07 1.04 1.01 0.99 0.98 0.98 0.98 0.99 1.00 1.03 1.06 1.13 1.22 1.32 1.46 1.59 1.74 1.90 2.07 2.21 2.35 2.48 2.59 2.71 2.82 2.93 3.03 3.13 3.22 3.28 3.34 3.40 3.45 3.51 3.58 3.65 3.74 3.85 3.97 4.10 4.24 4.39 4.54 4.69 4.82 4.95 5.07 5.16 5.26 5.30 5.33 5.34 5.31 5.29 5.21 5.13 5.04 4.96 4.88 4.86 4.84 4.86 4.92 4.98 5.09 5.20 5.31 5.42 5.53 5.62 5.70 5.77 5.82 5.87 5.85 5.82 5.77 5.67 5.58 5.44 5.29 5.13 4.97 4.81 4.63 4.44 4.26 4.08 3.90 3.76 3.62 3.49 3.37 3.25 3.17 3.09 3.02 2.96 2.90 2.87 2.85 2.83 2.83 2.82 2.81 2.80 2.80 2.80 2.81 2.85 2.88 2.92 2.97 3.02 3.06 3.11 3.14 3.14 3.15 3.10 3.05 2.97 2.85 2.73 2.64 2.55 2.47 2.42 2.37 2.34 2.32 2.31 2.31 2.32 2.31 2.30 2.28 2.25 2.22 2.17 2.13 2.08 2.03 1.99 1.95 1.92 1.89 1.88 1.86 1.90 1.87 1.83 1.81 1.79 1.77 1.74 1.70 1.67 1.64 1.61 1.58 1.56 1.54 1.53 1.53 1.53 1.53 1.52 1.52 1.51 1.50 1.48 1.46 1.44 1.41 1.38 1.35 1.31 1.26 1.22 1.17 1.13 1.09 1.07 1.04 1.03 1.01 1.01 1.02 1.02 1.06 1.09 1.15 1.25 1.35 1.48 1.62 1.77 1.92 2.08 2.22 2.36 2.49 2.59 2.70 2.80 2.90 3.00 3.09 3.18 3.22 3.26 3.30 3.35 3.39 3.48 3.58 3.68 3.80 3.91 4.06 4.21 4.37 4.53 4.69 4.85 5.00 5.14 5.26 5.37 5.43 5.49 5.51 5.48 5.46 5.36 5.27 5.18 5.08 4.98 4.93 4.87 4.85 4.88 4.90 4.98 5.06 5.14 5.23 5.31 5.41 5.50 5.60 5.68 5.76 5.78 5.80 5.78 5.71 5.63 5.50 5.36 5.21 5.05 4.89 4.72 4.55 4.38 4.22 4.06 3.93 3.80 3.68 3.57 3.46 3.38 3.30 3.24 3.19 3.13 3.11 3.08 3.07 3.06 3.05 3.05 3.05 3.06 3.07 3.09 3.12 3.16 3.20 3.24 3.28 3.32 3.36 3.37 3.37 3.36 3.28 3.21 3.11 3.00 2.89 2.79 2.68 2.60 2.55 2.50 2.47 2.45 2.44 2.44 2.44 2.43 2.42 2.40 2.37 2.34 2.29 2.23 2.18 2.13 2.08 2.03 1.99 1.95 1.93 1.90 1.94 1.91 1.87 1.85 1.82 1.80 1.76 1.72 1.69 1.65 1.62 1.61 1.60 1.59 1.59 1.59 1.60 1.61 1.61 1.61 1.60 1.58 1.55 1.53 1.50 1.48 1.44 1.40 1.36 1.32 1.28 1.23 1.18 1.14 1.11 1.08 1.06 1.04 1.04 1.04 1.05 1.09 1.12 1.19 1.27 1.36 1.49 1.62 1.76 1.91 2.07 2.20 2.33 2.45 2.55 2.66 2.76 2.85 2.95 3.03 3.12 3.15 3.17 3.21 3.25 3.29 3.40 3.50 3.62 3.74 3.86 4.02 4.17 4.33 4.51 4.68 4.86 5.03 5.20 5.34 5.49 5.58 5.67 5.72 5.72 5.73 5.66 5.59 5.50 5.41 5.31 5.24 5.16 5.12 5.12 5.11 5.15 5.19 5.24 5.30 5.36 5.45 5.54 5.63 5.72 5.82 5.85 5.88 5.86 5.80 5.74 5.61 5.48 5.33 5.17 5.00 4.84 4.68 4.52 4.37 4.23 4.10 3.98 3.87 3.77 3.67 3.58 3.50 3.43 3.38 3.33 3.32 3.31 3.31 3.32 3.33 3.34 3.35 3.36 3.36 3.37 3.40 3.44 3.47 3.51 3.54 3.56 3.59 3.58 3.54 3.50 3.42 3.34 3.24 3.14 3.03 2.92 2.81 2.73 2.67 2.62 2.60 2.58 2.56 2.54 2.53 2.53 2.52 2.51 2.49 2.47 2.41 2.35 2.29 2.23 2.17 2.11 2.06 2.01 1.98 1.94 1.99 1.95 1.92 1.89 1.86 1.83 1.79 1.75 1.72 1.69 1.66 1.66 1.66 1.66 1.66 1.67 1.68 1.69 1.70 1.69 1.68 1.66 1.63 1.60 1.58 1.55 1.51 1.47 1.43 1.39 1.35 1.30 1.24 1.20 1.16 1.12 1.10 1.08 1.07 1.08 1.08 1.12 1.15 1.21 1.29 1.37 1.50 1.62 1.75 1.89 2.03 2.16 2.28 2.39 2.49 2.59 2.68 2.78 2.86 2.94 3.02 3.06 3.10 3.14 3.19 3.24 3.35 3.45 3.56 3.69 3.81 3.96 4.11 4.28 4.46 4.64 4.83 5.03 5.22 5.40 5.58 5.71 5.84 5.93 5.98 6.02 5.99 5.95 5.90 5.83 5.76 5.68 5.59 5.53 5.50 5.47 5.48 5.50 5.53 5.57 5.61 5.68 5.75 5.82 5.90 5.98 6.00 6.02 6.01 5.94 5.88 5.75 5.62 5.48 5.32 5.16 5.00 4.84 4.70 4.56 4.43 4.31 4.19 4.08 3.98 3.87 3.79 3.71 3.64 3.59 3.53 3.53 3.53 3.54 3.55 3.57 3.59 3.61 3.62 3.63 3.64 3.65 3.67 3.69 3.72 3.74 3.74 3.73 3.70 3.63 3.56 3.47 3.39 3.30 3.21 3.12 3.02 2.93 2.85 2.79 2.72 2.70 2.68 2.66 2.64 2.63 2.63 2.63 2.63 2.61 2.60 2.54 2.48 2.42 2.34 2.27 2.20 2.14 2.08 2.03 1.99 2.06 2.02 1.98 1.95 1.91 1.88 1.84 1.79 1.76 1.73 1.71 1.71 1.71 1.72 1.73 1.74 1.75 1.76 1.77 1.76 1.75 1.72 1.70 1.67 1.65 1.62 1.58 1.54 1.50 1.45 1.41 1.35 1.30 1.25 1.21 1.16 1.14 1.11 1.10 1.11 1.12 1.15 1.18 1.24 1.31 1.39 1.50 1.62 1.74 1.87 2.01 2.12 2.23 2.33 2.42 2.51 2.60 2.68 2.76 2.84 2.92 2.97 3.03 3.09 3.15 3.22 3.31 3.41 3.51 3.63 3.75 3.89 4.04 4.20 4.38 4.57 4.78 4.99 5.21 5.42 5.63 5.81 5.98 6.12 6.21 6.31 6.32 6.34 6.34 6.30 6.27 6.18 6.10 6.03 5.98 5.93 5.93 5.93 5.94 5.97 5.99 6.03 6.08 6.12 6.16 6.20 6.21 6.23 6.20 6.13 6.06 5.94 5.81 5.67 5.51 5.36 5.20 5.05 4.91 4.78 4.65 4.54 4.42 4.31 4.21 4.10 4.01 3.93 3.86 3.81 3.75 3.75 3.74 3.75 3.77 3.78 3.81 3.84 3.85 3.85 3.86 3.86 3.87 3.87 3.88 3.89 3.85 3.82 3.75 3.65 3.55 3.46 3.37 3.29 3.22 3.15 3.08 3.01 2.95 2.88 2.82 2.79 2.76 2.74 2.73 2.72 2.73 2.73 2.73 2.71 2.70 2.65 2.60 2.54 2.46 2.38 2.30 2.23 2.16 2.11 2.06 2.15 2.10 2.05 2.01 1.97 1.93 1.88 1.83 1.80 1.77 1.74 1.75 1.76 1.77 1.79 1.80 1.81 1.82 1.82 1.81 1.80 1.78 1.75 1.73 1.70 1.66 1.63 1.59 1.55 1.50 1.45 1.40 1.35 1.30 1.25 1.20 1.17 1.14 1.13 1.13 1.14 1.17 1.21 1.26 1.33 1.40 1.51 1.62 1.74 1.87 2.00 2.10 2.20 2.29 2.36 2.44 2.51 2.59 2.67 2.74 2.82 2.89 2.95 3.02 3.11 3.19 3.28 3.37 3.46 3.57 3.68 3.82 3.95 4.11 4.29 4.47 4.69 4.91 5.15 5.39 5.64 5.85 6.07 6.25 6.40 6.55 6.63 6.71 6.75 6.75 6.75 6.69 6.63 6.57 6.51 6.46 6.44 6.43 6.42 6.43 6.43 6.44 6.45 6.46 6.46 6.46 6.45 6.45 6.41 6.34 6.27 6.15 6.02 5.89 5.73 5.58 5.44 5.30 5.16 5.03 4.90 4.79 4.67 4.56 4.46 4.35 4.26 4.17 4.09 4.04 3.99 3.97 3.95 3.95 3.96 3.97 3.99 4.01 4.02 4.02 4.02 4.02 4.02 4.02 4.00 3.99 3.92 3.85 3.75 3.62 3.49 3.40 3.30 3.23 3.19 3.15 3.11 3.07 3.02 2.97 2.92 2.88 2.84 2.82 2.82 2.81 2.81 2.80 2.79 2.78 2.77 2.74 2.70 2.64 2.57 2.49 2.41 2.33 2.26 2.20 2.15 2.24 2.18 2.12 2.07 2.02 1.96 1.92 1.87 1.83 1.80 1.77 1.78 1.80 1.82 1.84 1.87 1.87 1.87 1.86 1.85 1.83 1.81 1.78 1.75 1.72 1.69 1.66 1.62 1.58 1.54 1.49 1.44 1.39 1.33 1.28 1.22 1.19 1.15 1.14 1.15 1.15 1.20 1.24 1.30 1.36 1.43 1.53 1.64 1.75 1.88 2.01 2.10 2.20 2.27 2.33 2.39 2.45 2.52 2.58 2.66 2.73 2.80 2.87 2.95 3.04 3.13 3.22 3.30 3.39 3.49 3.59 3.72 3.86 4.01 4.18 4.35 4.58 4.81 5.05 5.32 5.59 5.83 6.08 6.31 6.51 6.72 6.85 6.98 7.07 7.11 7.14 7.11 7.08 7.04 7.00 6.97 6.94 6.91 6.89 6.86 6.84 6.81 6.78 6.76 6.73 6.71 6.68 6.65 6.61 6.53 6.46 6.35 6.23 6.10 5.97 5.83 5.69 5.56 5.42 5.29 5.16 5.05 4.94 4.83 4.72 4.61 4.51 4.42 4.34 4.28 4.22 4.19 4.16 4.14 4.13 4.12 4.12 4.12 4.13 4.13 4.14 4.14 4.14 4.12 4.08 4.04 3.95 3.85 3.73 3.59 3.44 3.35 3.26 3.20 3.18 3.15 3.12 3.10 3.07 3.05 3.02 2.99 2.97 2.94 2.91 2.87 2.85 2.84 2.83 2.83 2.83 2.80 2.77 2.73 2.66 2.60 2.51 2.43 2.36 2.30 2.24 2.32 2.26 2.20 2.14 2.07 2.00 1.95 1.89 1.85 1.82 1.78 1.80 1.82 1.85 1.89 1.93 1.92 1.91 1.89 1.86 1.83 1.81 1.78 1.75 1.72 1.69 1.66 1.63 1.60 1.57 1.53 1.48 1.42 1.36 1.29 1.23 1.19 1.16 1.14 1.15 1.17 1.22 1.27 1.33 1.41 1.48 1.58 1.69 1.80 1.91 2.03 2.11 2.19 2.25 2.30 2.35 2.40 2.46 2.51 2.58 2.64 2.71 2.79 2.87 2.96 3.06 3.14 3.21 3.30 3.39 3.48 3.61 3.74 3.88 4.05 4.21 4.43 4.64 4.89 5.16 5.43 5.71 6.00 6.25 6.49 6.72 6.90 7.08 7.21 7.30 7.39 7.39 7.39 7.38 7.35 7.33 7.29 7.25 7.20 7.14 7.08 7.04 6.99 6.94 6.90 6.85 6.80 6.74 6.69 6.62 6.55 6.45 6.34 6.23 6.12 6.01 5.88 5.75 5.63 5.52 5.41 5.30 5.19 5.08 4.98 4.87 4.77 4.67 4.58 4.51 4.44 4.40 4.37 4.34 4.32 4.29 4.28 4.26 4.25 4.25 4.24 4.24 4.23 4.20 4.13 4.07 3.96 3.85 3.74 3.62 3.49 3.41 3.32 3.26 3.23 3.19 3.18 3.17 3.16 3.15 3.14 3.11 3.07 3.03 2.98 2.93 2.90 2.88 2.86 2.86 2.85 2.84 2.82 2.78 2.72 2.66 2.58 2.50 2.44 2.38 2.32 2.38 2.31 2.25 2.18 2.10 2.02 1.96 1.90 1.85 1.82 1.79 1.81 1.83 1.86 1.91 1.97 1.95 1.93 1.90 1.87 1.83 1.80 1.78 1.74 1.71 1.68 1.65 1.63 1.60 1.57 1.54 1.48 1.43 1.36 1.30 1.23 1.20 1.16 1.15 1.17 1.18 1.24 1.30 1.37 1.46 1.54 1.64 1.73 1.84 1.94 2.05 2.12 2.19 2.25 2.29 2.33 2.37 2.42 2.47 2.52 2.58 2.65 2.72 2.79 2.88 2.97 3.05 3.12 3.21 3.29 3.38 3.50 3.61 3.74 3.90 4.05 4.25 4.46 4.70 4.96 5.23 5.52 5.82 6.09 6.35 6.61 6.81 7.01 7.18 7.31 7.44 7.47 7.50 7.50 7.48 7.47 7.42 7.37 7.31 7.23 7.15 7.08 7.01 6.95 6.89 6.84 6.78 6.73 6.67 6.61 6.55 6.46 6.37 6.28 6.19 6.10 5.99 5.88 5.78 5.68 5.58 5.48 5.38 5.28 5.18 5.07 4.97 4.87 4.78 4.71 4.63 4.59 4.54 4.50 4.48 4.45 4.42 4.40 4.37 4.36 4.34 4.31 4.29 4.23 4.15 4.08 3.97 3.87 3.77 3.67 3.57 3.50 3.43 3.37 3.34 3.30 3.29 3.28 3.26 3.25 3.24 3.20 3.16 3.10 3.04 2.98 2.94 2.91 2.89 2.88 2.87 2.85 2.83 2.80 2.74 2.69 2.62 2.56 2.49 2.44 2.38 2.40 2.33 2.26 2.19 2.11 2.03 1.97 1.90 1.86 1.83 1.79 1.81 1.82 1.85 1.91 1.96 1.94 1.92 1.89 1.86 1.83 1.79 1.76 1.72 1.69 1.66 1.64 1.61 1.59 1.56 1.54 1.48 1.42 1.36 1.29 1.23 1.20 1.17 1.16 1.18 1.20 1.27 1.34 1.42 1.51 1.61 1.70 1.79 1.88 1.98 2.08 2.14 2.21 2.26 2.30 2.33 2.37 2.40 2.44 2.49 2.54 2.61 2.67 2.74 2.82 2.90 2.97 3.04 3.12 3.20 3.28 3.39 3.49 3.61 3.75 3.88 4.08 4.27 4.49 4.75 5.00 5.29 5.57 5.85 6.12 6.38 6.61 6.83 7.01 7.16 7.31 7.35 7.39 7.41 7.40 7.39 7.34 7.28 7.21 7.12 7.02 6.93 6.84 6.77 6.71 6.65 6.61 6.57 6.52 6.47 6.42 6.36 6.29 6.23 6.15 6.08 6.00 5.93 5.84 5.76 5.67 5.59 5.50 5.41 5.31 5.22 5.12 5.03 4.94 4.86 4.78 4.72 4.67 4.62 4.59 4.56 4.52 4.48 4.45 4.41 4.38 4.34 4.29 4.23 4.15 4.08 3.99 3.90 3.81 3.73 3.65 3.59 3.54 3.49 3.46 3.42 3.40 3.39 3.37 3.35 3.32 3.26 3.20 3.14 3.07 3.00 2.96 2.92 2.89 2.87 2.85 2.83 2.81 2.77 2.73 2.68 2.62 2.56 2.50 2.45 2.40 2.37 2.30 2.23 2.16 2.09 2.02 1.96 1.91 1.86 1.83 1.80 1.81 1.81 1.84 1.88 1.92 1.91 1.90 1.87 1.84 1.81 1.77 1.73 1.70 1.66 1.63 1.61 1.59 1.57 1.54 1.52 1.46 1.40 1.34 1.28 1.22 1.19 1.17 1.18 1.21 1.24 1.32 1.39 1.48 1.58 1.67 1.76 1.85 1.94 2.02 2.11 2.17 2.23 2.28 2.32 2.36 2.38 2.41 2.45 2.49 2.54 2.59 2.65 2.71 2.78 2.85 2.92 2.98 3.05 3.12 3.20 3.29 3.38 3.48 3.61 3.73 3.91 4.08 4.29 4.53 4.76 5.03 5.29 5.55 5.82 6.08 6.31 6.54 6.73 6.87 7.02 7.06 7.10 7.12 7.12 7.12 7.06 7.00 6.92 6.82 6.71 6.61 6.50 6.42 6.37 6.32 6.29 6.26 6.23 6.20 6.17 6.13 6.10 6.05 6.01 5.97 5.91 5.86 5.80 5.74 5.68 5.61 5.54 5.46 5.38 5.29 5.20 5.11 5.03 4.95 4.86 4.80 4.75 4.69 4.64 4.60 4.55 4.50 4.45 4.40 4.35 4.31 4.26 4.21 4.14 4.07 4.00 3.92 3.86 3.79 3.73 3.68 3.63 3.59 3.56 3.53 3.50 3.48 3.45 3.41 3.36 3.29 3.22 3.14 3.07 2.99 2.95 2.90 2.86 2.83 2.81 2.78 2.75 2.72 2.67 2.63 2.57 2.51 2.46 2.42 2.37 2.31 2.24 2.18 2.11 2.06 2.00 1.94 1.88 1.84 1.81 1.79 1.80 1.81 1.83 1.85 1.87 1.86 1.85 1.83 1.79 1.75 1.72 1.69 1.66 1.62 1.59 1.57 1.55 1.53 1.50 1.48 1.43 1.37 1.32 1.27 1.22 1.20 1.19 1.20 1.24 1.28 1.37 1.45 1.54 1.64 1.74 1.83 1.92 2.00 2.08 2.16 2.21 2.26 2.31 2.34 2.37 2.40 2.42 2.46 2.50 2.55 2.60 2.65 2.71 2.78 2.84 2.89 2.95 3.00 3.07 3.13 3.21 3.29 3.38 3.48 3.59 3.74 3.90 4.09 4.30 4.51 4.75 4.98 5.22 5.47 5.72 5.93 6.14 6.32 6.45 6.58 6.62 6.67 6.69 6.68 6.67 6.62 6.57 6.49 6.39 6.28 6.17 6.06 5.98 5.93 5.88 5.85 5.83 5.81 5.80 5.80 5.78 5.77 5.76 5.74 5.73 5.71 5.68 5.65 5.62 5.59 5.53 5.47 5.41 5.34 5.28 5.20 5.12 5.05 4.98 4.90 4.84 4.77 4.71 4.65 4.60 4.53 4.47 4.41 4.35 4.30 4.26 4.21 4.16 4.11 4.06 4.00 3.94 3.89 3.84 3.78 3.74 3.71 3.67 3.64 3.60 3.57 3.54 3.49 3.44 3.38 3.29 3.21 3.12 3.04 2.96 2.90 2.84 2.79 2.76 2.73 2.70 2.66 2.63 2.59 2.55 2.50 2.45 2.40 2.35 2.31 2.23 2.16 2.10 2.04 1.99 1.95 1.89 1.84 1.80 1.77 1.75 1.76 1.77 1.78 1.79 1.80 1.80 1.79 1.77 1.73 1.69 1.65 1.61 1.58 1.55 1.53 1.51 1.49 1.46 1.44 1.41 1.37 1.33 1.29 1.25 1.20 1.21 1.21 1.24 1.29 1.33 1.42 1.51 1.61 1.70 1.80 1.89 1.97 2.05 2.12 2.19 2.24 2.30 2.34 2.36 2.38 2.40 2.43 2.46 2.51 2.56 2.60 2.65 2.70 2.76 2.82 2.87 2.92 2.97 3.02 3.07 3.14 3.21 3.30 3.39 3.48 3.62 3.75 3.91 4.10 4.28 4.49 4.70 4.91 5.12 5.34 5.52 5.69 5.84 5.95 6.06 6.10 6.15 6.16 6.13 6.10 6.05 6.00 5.93 5.85 5.76 5.68 5.61 5.53 5.46 5.38 5.35 5.32 5.31 5.31 5.32 5.32 5.33 5.34 5.36 5.37 5.37 5.37 5.36 5.34 5.33 5.29 5.26 5.22 5.18 5.13 5.08 5.02 4.96 4.91 4.85 4.79 4.73 4.67 4.61 4.56 4.50 4.44 4.38 4.32 4.26 4.22 4.17 4.13 4.08 4.03 3.98 3.93 3.88 3.85 3.81 3.77 3.73 3.70 3.66 3.63 3.59 3.54 3.48 3.40 3.31 3.22 3.12 3.03 2.93 2.84 2.78 2.72 2.67 2.64 2.60 2.57 2.53 2.50 2.47 2.45 2.40 2.35 2.31 2.27 2.23 2.13 2.07 2.00 1.95 1.90 1.85 1.81 1.77 1.74 1.73 1.71 1.72 1.73 1.74 1.75 1.76 1.74 1.73 1.70 1.66 1.61 1.57 1.53 1.50 1.47 1.45 1.44 1.42 1.40 1.38 1.36 1.33 1.30 1.27 1.24 1.21 1.23 1.24 1.27 1.33 1.39 1.48 1.57 1.66 1.75 1.85 1.93 2.01 2.08 2.15 2.21 2.26 2.31 2.35 2.38 2.41 2.42 2.44 2.47 2.52 2.57 2.60 2.64 2.68 2.72 2.77 2.82 2.87 2.91 2.96 3.00 3.08 3.15 3.23 3.31 3.40 3.51 3.62 3.76 3.92 4.08 4.26 4.44 4.62 4.79 4.96 5.10 5.25 5.36 5.44 5.53 5.56 5.59 5.58 5.55 5.51 5.46 5.41 5.36 5.29 5.23 5.17 5.12 5.06 4.98 4.90 4.87 4.84 4.82 4.82 4.83 4.84 4.86 4.88 4.91 4.94 4.95 4.97 4.98 4.99 4.99 4.98 4.98 4.96 4.94 4.91 4.88 4.85 4.81 4.77 4.73 4.69 4.65 4.60 4.55 4.50 4.44 4.38 4.32 4.27 4.22 4.17 4.12 4.08 4.03 3.99 3.94 3.90 3.86 3.83 3.80 3.76 3.73 3.69 3.64 3.60 3.54 3.48 3.39 3.29 3.19 3.09 2.99 2.89 2.78 2.68 2.63 2.57 2.53 2.49 2.46 2.43 2.39 2.37 2.34 2.32 2.28 2.24 2.20 2.17 2.13 2.01 1.95 1.89 1.84 1.79 1.75 1.72 1.70 1.68 1.67 1.66 1.67 1.69 1.70 1.71 1.72 1.70 1.68 1.65 1.60 1.55 1.50 1.46 1.42 1.40 1.38 1.37 1.35 1.34 1.33 1.31 1.29 1.28 1.26 1.25 1.24 1.26 1.28 1.32 1.38 1.45 1.53 1.62 1.71 1.79 1.88 1.95 2.03 2.09 2.15 2.21 2.26 2.30 2.34 2.38 2.42 2.44 2.46 2.48 2.52 2.56 2.59 2.62 2.65 2.68 2.71 2.75 2.80 2.84 2.89 2.93 3.00 3.08 3.15 3.24 3.33 3.42 3.51 3.63 3.77 3.91 4.06 4.22 4.36 4.49 4.62 4.72 4.82 4.90 4.96 5.01 5.02 5.03 5.01 4.98 4.95 4.90 4.85 4.81 4.75 4.70 4.67 4.64 4.60 4.53 4.47 4.44 4.40 4.38 4.38 4.38 4.39 4.41 4.43 4.46 4.49 4.52 4.55 4.57 4.59 4.60 4.62 4.63 4.64 4.64 4.63 4.63 4.62 4.60 4.58 4.56 4.54 4.52 4.49 4.45 4.41 4.37 4.32 4.27 4.22 4.18 4.14 4.10 4.05 4.01 3.96 3.92 3.87 3.83 3.80 3.76 3.72 3.68 3.63 3.57 3.52 3.44 3.36 3.26 3.15 3.03 2.92 2.81 2.71 2.62 2.52 2.47 2.42 2.38 2.35 2.32 2.28 2.25 2.22 2.20 2.18 2.14 2.11 2.07 2.04 2.01 1.86 1.82 1.77 1.73 1.69 1.66 1.64 1.62 1.61 1.61 1.62 1.64 1.66 1.67 1.68 1.68 1.66 1.64 1.60 1.55 1.50 1.45 1.41 1.37 1.34 1.32 1.31 1.30 1.29 1.28 1.28 1.28 1.27 1.27 1.28 1.28 1.31 1.34 1.38 1.45 1.51 1.59 1.67 1.75 1.83 1.90 1.96 2.02 2.08 2.13 2.18 2.22 2.27 2.32 2.36 2.41 2.44 2.47 2.49 2.52 2.55 2.57 2.60 2.62 2.63 2.65 2.69 2.72 2.76 2.81 2.85 2.93 3.00 3.08 3.17 3.26 3.35 3.43 3.54 3.66 3.78 3.91 4.03 4.14 4.23 4.32 4.38 4.45 4.49 4.52 4.54 4.53 4.51 4.49 4.46 4.44 4.39 4.35 4.31 4.27 4.22 4.21 4.20 4.18 4.14 4.11 4.07 4.04 4.02 4.01 4.00 4.01 4.02 4.04 4.06 4.08 4.11 4.14 4.17 4.19 4.22 4.24 4.27 4.29 4.30 4.32 4.33 4.34 4.35 4.35 4.36 4.36 4.36 4.34 4.32 4.30 4.28 4.25 4.22 4.18 4.15 4.12 4.08 4.05 4.00 3.96 3.90 3.85 3.80 3.76 3.72 3.66 3.60 3.53 3.47 3.41 3.31 3.21 3.10 2.99 2.87 2.75 2.64 2.54 2.45 2.37 2.32 2.27 2.23 2.20 2.17 2.14 2.11 2.08 2.05 2.03 1.99 1.96 1.93 1.90 1.86 1.72 1.69 1.66 1.63 1.61 1.59 1.58 1.57 1.57 1.58 1.59 1.61 1.63 1.64 1.65 1.66 1.63 1.60 1.57 1.51 1.46 1.41 1.36 1.32 1.29 1.27 1.26 1.25 1.25 1.26 1.27 1.28 1.29 1.31 1.33 1.35 1.38 1.41 1.46 1.52 1.58 1.65 1.72 1.78 1.84 1.90 1.95 1.99 2.04 2.08 2.13 2.17 2.22 2.27 2.32 2.37 2.41 2.45 2.48 2.51 2.53 2.55 2.57 2.59 2.60 2.61 2.63 2.65 2.69 2.73 2.78 2.85 2.92 3.00 3.09 3.18 3.28 3.38 3.48 3.58 3.69 3.78 3.88 3.96 4.01 4.06 4.10 4.14 4.15 4.15 4.14 4.11 4.09 4.06 4.03 3.99 3.96 3.93 3.90 3.87 3.85 3.84 3.84 3.82 3.80 3.78 3.76 3.74 3.73 3.72 3.70 3.70 3.70 3.71 3.71 3.72 3.74 3.77 3.80 3.83 3.86 3.89 3.92 3.94 3.97 3.99 4.03 4.06 4.09 4.10 4.12 4.14 4.16 4.17 4.17 4.17 4.17 4.16 4.15 4.13 4.11 4.08 4.06 4.02 3.97 3.93 3.88 3.83 3.77 3.70 3.64 3.57 3.51 3.44 3.36 3.28 3.18 3.07 2.96 2.84 2.71 2.60 2.49 2.39 2.31 2.22 2.18 2.13 2.09 2.06 2.03 2.00 1.98 1.95 1.92 1.88 1.85 1.82 1.79 1.75 1.72 1.62 1.60 1.58 1.57 1.55 1.54 1.54 1.53 1.54 1.56 1.58 1.60 1.62 1.63 1.62 1.62 1.59 1.57 1.53 1.47 1.42 1.38 1.33 1.30 1.27 1.25 1.25 1.25 1.26 1.28 1.29 1.32 1.34 1.37 1.40 1.44 1.48 1.51 1.56 1.61 1.67 1.71 1.76 1.80 1.84 1.87 1.91 1.94 1.98 2.01 2.05 2.09 2.14 2.19 2.24 2.29 2.34 2.38 2.42 2.45 2.48 2.51 2.53 2.55 2.56 2.58 2.59 2.60 2.63 2.66 2.70 2.76 2.83 2.91 3.00 3.09 3.19 3.29 3.38 3.48 3.58 3.65 3.71 3.77 3.81 3.85 3.87 3.89 3.89 3.86 3.84 3.82 3.79 3.76 3.73 3.70 3.67 3.64 3.62 3.61 3.60 3.58 3.57 3.56 3.56 3.56 3.55 3.53 3.52 3.50 3.48 3.47 3.46 3.46 3.46 3.46 3.48 3.51 3.53 3.56 3.58 3.60 3.63 3.66 3.69 3.72 3.76 3.80 3.83 3.87 3.90 3.93 3.96 3.99 4.00 4.02 4.03 4.04 4.04 4.03 4.03 4.00 3.98 3.95 3.90 3.86 3.81 3.75 3.68 3.61 3.53 3.46 3.38 3.30 3.22 3.14 3.03 2.93 2.82 2.70 2.58 2.48 2.37 2.28 2.20 2.12 2.07 2.02 1.98 1.95 1.93 1.90 1.87 1.84 1.81 1.78 1.74 1.70 1.67 1.64 1.62 1.55 1.55 1.54 1.53 1.52 1.51 1.51 1.51 1.53 1.55 1.57 1.58 1.59 1.59 1.58 1.58 1.55 1.52 1.48 1.44 1.39 1.35 1.31 1.28 1.27 1.25 1.26 1.27 1.28 1.31 1.34 1.37 1.41 1.44 1.49 1.53 1.57 1.62 1.66 1.70 1.74 1.77 1.80 1.83 1.85 1.87 1.89 1.91 1.93 1.96 1.99 2.03 2.07 2.12 2.17 2.21 2.26 2.31 2.35 2.39 2.42 2.45 2.47 2.49 2.50 2.52 2.53 2.54 2.56 2.59 2.61 2.68 2.74 2.82 2.90 2.99 3.08 3.18 3.27 3.36 3.45 3.50 3.55 3.59 3.62 3.65 3.65 3.66 3.65 3.63 3.61 3.58 3.55 3.52 3.49 3.46 3.44 3.42 3.41 3.41 3.40 3.40 3.40 3.40 3.40 3.41 3.40 3.39 3.38 3.36 3.34 3.32 3.30 3.29 3.29 3.29 3.30 3.31 3.33 3.35 3.37 3.39 3.42 3.44 3.47 3.50 3.54 3.58 3.61 3.65 3.69 3.73 3.77 3.81 3.83 3.86 3.88 3.89 3.91 3.91 3.91 3.89 3.88 3.85 3.81 3.77 3.71 3.65 3.59 3.51 3.43 3.34 3.26 3.17 3.08 2.99 2.89 2.79 2.69 2.58 2.47 2.38 2.29 2.20 2.12 2.05 2.00 1.95 1.91 1.89 1.86 1.83 1.80 1.77 1.74 1.70 1.67 1.63 1.60 1.58 1.55 1.53 1.53 1.52 1.52 1.51 1.50 1.50 1.51 1.52 1.54 1.56 1.56 1.57 1.56 1.55 1.55 1.51 1.48 1.45 1.41 1.37 1.33 1.30 1.28 1.27 1.26 1.28 1.29 1.32 1.35 1.39 1.43 1.48 1.52 1.57 1.61 1.66 1.70 1.74 1.77 1.80 1.82 1.84 1.85 1.86 1.87 1.88 1.88 1.90 1.93 1.95 1.99 2.03 2.07 2.12 2.16 2.21 2.26 2.30 2.33 2.37 2.39 2.41 2.43 2.44 2.46 2.47 2.48 2.50 2.52 2.54 2.60 2.66 2.73 2.81 2.89 2.98 3.06 3.14 3.22 3.29 3.34 3.38 3.41 3.44 3.46 3.45 3.45 3.44 3.43 3.42 3.39 3.36 3.33 3.30 3.27 3.27 3.26 3.26 3.26 3.26 3.27 3.28 3.29 3.30 3.31 3.30 3.29 3.28 3.26 3.24 3.22 3.21 3.19 3.19 3.18 3.18 3.19 3.20 3.21 3.23 3.24 3.26 3.28 3.30 3.32 3.36 3.39 3.43 3.47 3.50 3.55 3.59 3.63 3.67 3.70 3.72 3.75 3.76 3.77 3.78 3.77 3.76 3.73 3.70 3.66 3.60 3.55 3.48 3.40 3.33 3.24 3.15 3.06 2.96 2.87 2.77 2.67 2.57 2.48 2.38 2.30 2.22 2.14 2.07 2.00 1.96 1.91 1.88 1.85 1.83 1.80 1.77 1.74 1.70 1.67 1.64 1.61 1.58 1.56 1.53 1.55 1.54 1.53 1.52 1.52 1.52 1.52 1.52 1.53 1.55 1.56 1.56 1.56 1.55 1.54 1.52 1.49 1.46 1.42 1.39 1.35 1.32 1.30 1.29 1.29 1.29 1.31 1.33 1.36 1.40 1.44 1.49 1.55 1.59 1.64 1.69 1.72 1.76 1.80 1.83 1.86 1.86 1.87 1.87 1.87 1.87 1.87 1.87 1.88 1.90 1.93 1.97 2.01 2.05 2.09 2.14 2.18 2.22 2.26 2.29 2.33 2.34 2.36 2.37 2.39 2.41 2.41 2.42 2.44 2.46 2.49 2.54 2.58 2.64 2.71 2.79 2.87 2.94 3.01 3.07 3.12 3.16 3.20 3.22 3.24 3.26 3.26 3.27 3.26 3.25 3.24 3.22 3.21 3.19 3.16 3.14 3.14 3.14 3.15 3.16 3.16 3.18 3.19 3.21 3.22 3.23 3.22 3.22 3.21 3.19 3.17 3.16 3.15 3.13 3.12 3.11 3.12 3.12 3.13 3.13 3.14 3.14 3.15 3.16 3.18 3.19 3.22 3.24 3.27 3.31 3.34 3.39 3.43 3.47 3.51 3.54 3.57 3.60 3.62 3.63 3.64 3.63 3.63 3.61 3.58 3.55 3.50 3.45 3.39 3.31 3.23 3.15 3.06 2.97 2.88 2.78 2.68 2.58 2.48 2.40 2.32 2.24 2.17 2.10 2.04 1.99 1.95 1.91 1.88 1.85 1.83 1.80 1.78 1.74 1.71 1.67 1.64 1.61 1.59 1.57 1.55 1.59 1.58 1.57 1.56 1.56 1.56 1.56 1.56 1.56 1.57 1.58 1.57 1.56 1.55 1.53 1.51 1.48 1.45 1.41 1.38 1.35 1.33 1.31 1.30 1.31 1.32 1.35 1.38 1.41 1.45 1.48 1.54 1.59 1.65 1.69 1.74 1.78 1.82 1.84 1.86 1.88 1.88 1.88 1.88 1.87 1.87 1.87 1.87 1.88 1.90 1.92 1.95 1.99 2.04 2.08 2.13 2.17 2.21 2.24 2.26 2.29 2.31 2.33 2.34 2.35 2.35 2.36 2.37 2.38 2.41 2.44 2.47 2.50 2.55 2.62 2.70 2.75 2.81 2.86 2.91 2.96 2.98 3.01 3.03 3.05 3.07 3.08 3.08 3.09 3.09 3.09 3.08 3.07 3.06 3.04 3.02 3.03 3.05 3.06 3.07 3.09 3.10 3.12 3.14 3.15 3.17 3.16 3.15 3.15 3.14 3.13 3.12 3.11 3.10 3.09 3.09 3.09 3.09 3.09 3.09 3.09 3.09 3.09 3.09 3.09 3.10 3.11 3.13 3.15 3.18 3.21 3.25 3.29 3.33 3.37 3.41 3.44 3.47 3.49 3.50 3.51 3.51 3.51 3.50 3.48 3.46 3.41 3.37 3.31 3.25 3.18 3.09 3.00 2.91 2.82 2.73 2.64 2.55 2.46 2.38 2.31 2.24 2.18 2.12 2.07 2.01 1.98 1.95 1.92 1.89 1.87 1.84 1.82 1.79 1.75 1.72 1.69 1.66 1.63 1.61 1.59 1.66 1.64 1.62 1.61 1.61 1.61 1.61 1.61 1.61 1.61 1.61 1.60 1.58 1.56 1.53 1.50 1.47 1.44 1.42 1.40 1.37 1.36 1.35 1.34 1.35 1.35 1.38 1.41 1.44 1.49 1.53 1.58 1.64 1.69 1.74 1.79 1.82 1.86 1.88 1.90 1.91 1.91 1.91 1.91 1.90 1.89 1.89 1.89 1.91 1.93 1.95 1.99 2.02 2.06 2.10 2.14 2.17 2.21 2.23 2.26 2.28 2.29 2.31 2.32 2.32 2.33 2.33 2.33 2.34 2.36 2.38 2.42 2.45 2.49 2.54 2.59 2.63 2.68 2.71 2.74 2.77 2.80 2.83 2.85 2.87 2.89 2.89 2.90 2.91 2.91 2.92 2.91 2.91 2.91 2.91 2.92 2.92 2.93 2.95 2.97 2.99 3.01 3.03 3.05 3.06 3.08 3.08 3.08 3.08 3.08 3.08 3.08 3.08 3.07 3.07 3.06 3.06 3.07 3.07 3.06 3.06 3.06 3.06 3.06 3.05 3.05 3.06 3.08 3.09 3.11 3.14 3.17 3.19 3.23 3.27 3.31 3.33 3.36 3.38 3.39 3.40 3.41 3.41 3.41 3.39 3.38 3.35 3.31 3.27 3.21 3.16 3.08 3.01 2.93 2.84 2.75 2.67 2.59 2.52 2.44 2.37 2.32 2.26 2.21 2.16 2.12 2.08 2.05 2.02 1.98 1.95 1.91 1.88 1.85 1.81 1.77 1.74 1.71 1.68 1.67 1.66 1.74 1.72 1.69 1.68 1.68 1.67 1.67 1.67 1.67 1.67 1.66 1.64 1.62 1.59 1.56 1.52 1.49 1.46 1.44 1.42 1.40 1.39 1.38 1.38 1.39 1.39 1.42 1.45 1.48 1.53 1.57 1.62 1.68 1.73 1.77 1.82 1.85 1.89 1.91 1.93 1.95 1.95 1.95 1.94 1.94 1.94 1.94 1.94 1.95 1.98 2.00 2.04 2.07 2.10 2.13 2.16 2.19 2.21 2.23 2.25 2.26 2.27 2.28 2.29 2.30 2.30 2.30 2.30 2.31 2.33 2.34 2.37 2.39 2.42 2.45 2.49 2.52 2.55 2.58 2.60 2.62 2.64 2.66 2.68 2.70 2.71 2.72 2.73 2.73 2.74 2.75 2.75 2.76 2.76 2.77 2.78 2.79 2.80 2.82 2.85 2.87 2.89 2.91 2.93 2.95 2.96 2.98 2.99 2.99 3.00 3.01 3.01 3.02 3.02 3.02 3.01 3.02 3.03 3.04 3.04 3.03 3.03 3.03 3.02 3.02 3.02 3.02 3.03 3.04 3.06 3.08 3.10 3.13 3.16 3.19 3.22 3.25 3.27 3.29 3.31 3.33 3.34 3.35 3.35 3.34 3.33 3.31 3.28 3.25 3.20 3.16 3.10 3.04 2.98 2.91 2.84 2.77 2.70 2.63 2.57 2.50 2.45 2.39 2.34 2.29 2.24 2.20 2.17 2.13 2.09 2.04 2.00 1.96 1.92 1.88 1.84 1.81 1.78 1.76 1.75 1.74 1.83 1.80 1.77 1.76 1.75 1.74 1.74 1.74 1.74 1.73 1.71 1.69 1.67 1.64 1.60 1.57 1.54 1.51 1.48 1.46 1.45 1.44 1.43 1.43 1.43 1.44 1.46 1.49 1.52 1.56 1.60 1.66 1.71 1.76 1.81 1.85 1.89 1.92 1.95 1.96 1.98 1.99 1.99 1.99 1.99 2.00 2.00 2.00 2.02 2.04 2.06 2.09 2.12 2.14 2.17 2.19 2.20 2.22 2.23 2.24 2.25 2.26 2.26 2.27 2.27 2.27 2.27 2.28 2.28 2.30 2.31 2.33 2.34 2.36 2.38 2.40 2.42 2.44 2.46 2.48 2.50 2.51 2.53 2.54 2.55 2.56 2.57 2.57 2.58 2.58 2.58 2.59 2.59 2.60 2.61 2.63 2.64 2.65 2.67 2.70 2.72 2.74 2.76 2.78 2.81 2.83 2.84 2.86 2.88 2.89 2.91 2.92 2.93 2.94 2.94 2.95 2.96 2.97 2.98 2.99 2.99 2.98 2.98 2.98 2.98 2.98 2.98 2.98 2.99 3.01 3.03 3.05 3.08 3.11 3.13 3.16 3.19 3.21 3.24 3.26 3.28 3.29 3.31 3.31 3.31 3.31 3.29 3.27 3.25 3.22 3.19 3.14 3.10 3.05 3.00 2.95 2.89 2.83 2.78 2.72 2.67 2.61 2.55 2.49 2.44 2.38 2.34 2.30 2.25 2.20 2.15 2.10 2.06 2.01 1.97 1.92 1.89 1.86 1.84 1.83 1.83 1.90 1.88 1.85 1.83 1.83 1.82 1.82 1.82 1.81 1.79 1.77 1.75 1.73 1.70 1.67 1.63 1.60 1.58 1.55 1.53 1.51 1.50 1.49 1.48 1.49 1.49 1.51 1.53 1.56 1.60 1.64 1.70 1.75 1.80 1.85 1.89 1.93 1.96 1.99 2.01 2.03 2.03 2.04 2.05 2.06 2.06 2.07 2.08 2.09 2.11 2.13 2.14 2.16 2.18 2.19 2.21 2.21 2.22 2.23 2.23 2.23 2.24 2.24 2.24 2.24 2.23 2.24 2.25 2.26 2.27 2.28 2.29 2.31 2.32 2.33 2.34 2.36 2.37 2.38 2.39 2.40 2.41 2.43 2.43 2.43 2.43 2.43 2.43 2.43 2.43 2.43 2.43 2.43 2.43 2.44 2.46 2.47 2.48 2.50 2.53 2.55 2.57 2.59 2.61 2.64 2.67 2.69 2.71 2.73 2.75 2.77 2.79 2.81 2.83 2.85 2.86 2.88 2.89 2.90 2.91 2.92 2.92 2.92 2.92 2.92 2.92 2.93 2.94 2.95 2.96 2.98 3.00 3.03 3.06 3.09 3.12 3.15 3.18 3.20 3.22 3.24 3.26 3.28 3.29 3.29 3.30 3.29 3.28 3.26 3.24 3.22 3.19 3.16 3.13 3.10 3.06 3.02 2.97 2.93 2.87 2.82 2.76 2.71 2.65 2.59 2.53 2.48 2.43 2.37 2.31 2.25 2.20 2.15 2.10 2.05 2.00 1.97 1.93 1.91 1.91 1.90 1.96 1.95 1.93 1.91 1.91 1.90 1.89 1.87 1.86 1.85 1.83 1.82 1.80 1.77 1.75 1.72 1.69 1.66 1.63 1.60 1.58 1.57 1.56 1.56 1.56 1.56 1.58 1.60 1.63 1.67 1.70 1.75 1.80 1.84 1.89 1.93 1.97 2.01 2.04 2.06 2.08 2.09 2.10 2.11 2.12 2.13 2.13 2.14 2.15 2.17 2.19 2.20 2.21 2.21 2.21 2.21 2.21 2.22 2.22 2.21 2.21 2.21 2.21 2.21 2.21 2.21 2.21 2.22 2.23 2.23 2.24 2.25 2.27 2.28 2.29 2.31 2.31 2.32 2.33 2.33 2.34 2.34 2.35 2.35 2.34 2.34 2.33 2.31 2.30 2.30 2.29 2.28 2.28 2.27 2.27 2.27 2.29 2.31 2.33 2.34 2.35 2.38 2.41 2.43 2.46 2.48 2.51 2.54 2.56 2.59 2.61 2.64 2.67 2.69 2.72 2.74 2.76 2.78 2.80 2.81 2.83 2.83 2.84 2.84 2.85 2.86 2.87 2.88 2.90 2.92 2.94 2.96 2.99 3.02 3.05 3.09 3.12 3.16 3.19 3.20 3.21 3.23 3.25 3.27 3.28 3.30 3.30 3.30 3.29 3.28 3.26 3.24 3.22 3.20 3.18 3.15 3.12 3.09 3.04 2.99 2.94 2.89 2.84 2.78 2.71 2.65 2.59 2.54 2.48 2.42 2.35 2.30 2.24 2.18 2.13 2.08 2.04 2.00 1.98 1.97 1.96 2.04 2.02 1.99 1.98 1.97 1.96 1.95 1.93 1.91 1.90 1.89 1.87 1.86 1.84 1.82 1.80 1.78 1.75 1.73 1.70 1.68 1.66 1.65 1.63 1.63 1.62 1.64 1.66 1.69 1.73 1.77 1.82 1.86 1.90 1.94 1.98 2.02 2.06 2.09 2.12 2.14 2.16 2.17 2.18 2.19 2.19 2.20 2.21 2.21 2.22 2.23 2.23 2.22 2.22 2.22 2.22 2.21 2.20 2.20 2.19 2.18 2.18 2.17 2.17 2.18 2.18 2.18 2.18 2.19 2.21 2.23 2.24 2.25 2.27 2.28 2.29 2.30 2.31 2.31 2.31 2.31 2.31 2.31 2.31 2.30 2.29 2.27 2.26 2.25 2.23 2.21 2.19 2.18 2.17 2.16 2.16 2.16 2.16 2.17 2.18 2.19 2.21 2.23 2.25 2.28 2.30 2.33 2.35 2.38 2.41 2.43 2.46 2.49 2.52 2.55 2.58 2.60 2.62 2.65 2.66 2.68 2.70 2.72 2.73 2.75 2.77 2.78 2.79 2.81 2.84 2.86 2.90 2.93 2.97 3.00 3.03 3.07 3.10 3.13 3.15 3.18 3.20 3.23 3.24 3.26 3.27 3.28 3.29 3.29 3.29 3.29 3.28 3.26 3.25 3.23 3.21 3.18 3.15 3.11 3.07 3.03 2.98 2.93 2.87 2.82 2.76 2.71 2.65 2.59 2.52 2.46 2.39 2.33 2.27 2.22 2.17 2.13 2.09 2.07 2.05 2.04 2.11 2.08 2.06 2.04 2.03 2.02 2.00 1.99 1.97 1.96 1.95 1.94 1.92 1.91 1.90 1.89 1.87 1.85 1.83 1.80 1.78 1.76 1.74 1.72 1.71 1.70 1.71 1.73 1.76 1.80 1.83 1.88 1.92 1.96 2.00 2.05 2.08 2.12 2.15 2.17 2.20 2.21 2.22 2.23 2.23 2.24 2.24 2.24 2.25 2.25 2.25 2.24 2.23 2.22 2.21 2.21 2.19 2.18 2.17 2.16 2.15 2.14 2.13 2.13 2.14 2.15 2.15 2.16 2.18 2.20 2.21 2.23 2.25 2.27 2.28 2.30 2.30 2.30 2.31 2.31 2.31 2.30 2.29 2.28 2.27 2.26 2.25 2.24 2.22 2.20 2.17 2.15 2.12 2.10 2.09 2.08 2.07 2.06 2.06 2.07 2.08 2.09 2.10 2.11 2.13 2.15 2.17 2.19 2.22 2.24 2.27 2.30 2.33 2.36 2.39 2.42 2.44 2.47 2.49 2.52 2.54 2.56 2.58 2.60 2.62 2.65 2.67 2.69 2.71 2.74 2.77 2.81 2.85 2.89 2.93 2.96 3.00 3.03 3.07 3.10 3.13 3.15 3.18 3.20 3.22 3.24 3.26 3.27 3.28 3.28 3.28 3.27 3.27 3.26 3.24 3.23 3.21 3.18 3.15 3.12 3.09 3.05 3.01 2.96 2.91 2.86 2.81 2.75 2.69 2.63 2.56 2.50 2.43 2.37 2.32 2.26 2.22 2.17 2.14 2.13 2.11 2.20 2.17 2.14 2.12 2.10 2.08 2.07 2.05 2.04 2.02 2.01 2.00 1.99 1.98 1.98 1.97 1.95 1.94 1.92 1.90 1.89 1.86 1.83 1.82 1.80 1.79 1.80 1.82 1.84 1.88 1.91 1.95 1.99 2.02 2.06 2.10 2.13 2.16 2.19 2.22 2.24 2.25 2.26 2.27 2.27 2.27 2.27 2.26 2.26 2.26 2.25 2.24 2.22 2.21 2.19 2.18 2.16 2.15 2.13 2.12 2.11 2.10 2.09 2.10 2.10 2.11 2.13 2.15 2.16 2.19 2.21 2.23 2.25 2.27 2.29 2.31 2.32 2.32 2.32 2.32 2.32 2.31 2.29 2.28 2.28 2.27 2.25 2.24 2.22 2.20 2.17 2.14 2.11 2.09 2.07 2.05 2.04 2.03 2.02 2.01 2.01 2.01 2.02 2.03 2.04 2.05 2.06 2.07 2.09 2.12 2.14 2.17 2.19 2.22 2.25 2.27 2.30 2.32 2.34 2.37 2.40 2.42 2.44 2.46 2.49 2.52 2.55 2.57 2.60 2.64 2.67 2.71 2.75 2.79 2.83 2.87 2.91 2.95 2.99 3.03 3.06 3.09 3.11 3.14 3.17 3.19 3.21 3.22 3.23 3.23 3.24 3.24 3.24 3.23 3.22 3.21 3.20 3.18 3.17 3.15 3.13 3.10 3.07 3.03 2.98 2.93 2.88 2.83 2.77 2.71 2.65 2.58 2.52 2.46 2.41 2.35 2.31 2.27 2.23 2.21 2.20 2.29 2.26 2.23 2.20 2.18 2.16 2.14 2.12 2.10 2.09 2.07 2.06 2.05 2.05 2.05 2.05 2.03 2.02 2.01 2.00 1.98 1.96 1.93 1.92 1.90 1.89 1.90 1.91 1.94 1.97 2.00 2.03 2.06 2.09 2.12 2.15 2.18 2.20 2.23 2.25 2.28 2.28 2.29 2.29 2.29 2.29 2.28 2.27 2.26 2.25 2.24 2.22 2.21 2.19 2.17 2.15 2.13 2.11 2.10 2.08 2.07 2.07 2.06 2.07 2.08 2.09 2.11 2.13 2.16 2.18 2.21 2.24 2.27 2.29 2.31 2.33 2.34 2.36 2.36 2.36 2.35 2.34 2.33 2.32 2.31 2.31 2.29 2.27 2.25 2.23 2.21 2.19 2.16 2.14 2.11 2.08 2.07 2.05 2.04 2.02 2.00 1.99 1.99 1.99 2.00 2.00 2.01 2.01 2.02 2.04 2.05 2.07 2.09 2.11 2.13 2.15 2.17 2.19 2.21 2.24 2.26 2.28 2.30 2.33 2.36 2.39 2.42 2.46 2.49 2.52 2.55 2.60 2.64 2.69 2.73 2.77 2.81 2.86 2.90 2.94 2.97 3.00 3.03 3.05 3.08 3.10 3.12 3.13 3.15 3.16 3.17 3.17 3.18 3.17 3.17 3.16 3.16 3.16 3.15 3.15 3.14 3.12 3.09 3.06 3.01 2.97 2.92 2.87 2.82 2.76 2.71 2.65 2.59 2.54 2.49 2.44 2.40 2.36 2.33 2.31 2.29 2.35 2.33 2.32 2.29 2.27 2.24 2.22 2.20 2.19 2.17 2.16 2.15 2.13 2.12 2.12 2.11 2.10 2.10 2.09 2.08 2.06 2.04 2.02 2.01 1.99 1.98 1.99 1.99 2.01 2.05 2.08 2.10 2.12 2.14 2.17 2.19 2.21 2.23 2.25 2.27 2.29 2.29 2.29 2.29 2.29 2.29 2.28 2.26 2.25 2.24 2.22 2.21 2.19 2.17 2.15 2.13 2.11 2.09 2.07 2.06 2.05 2.05 2.05 2.05 2.07 2.08 2.10 2.13 2.16 2.19 2.22 2.26 2.29 2.32 2.34 2.37 2.38 2.40 2.40 2.40 2.40 2.40 2.39 2.38 2.38 2.37 2.36 2.34 2.33 2.32 2.31 2.28 2.25 2.23 2.20 2.18 2.15 2.12 2.10 2.08 2.06 2.05 2.04 2.03 2.02 2.01 2.01 2.01 2.01 2.01 2.01 2.03 2.04 2.05 2.06 2.06 2.08 2.10 2.12 2.13 2.14 2.17 2.20 2.22 2.25 2.27 2.31 2.34 2.37 2.40 2.44 2.48 2.53 2.57 2.62 2.66 2.70 2.74 2.78 2.82 2.86 2.88 2.91 2.94 2.96 2.99 3.01 3.03 3.04 3.06 3.07 3.08 3.08 3.09 3.09 3.09 3.09 3.10 3.10 3.10 3.10 3.08 3.06 3.04 3.00 2.97 2.93 2.89 2.85 2.80 2.74 2.69 2.64 2.59 2.56 2.52 2.48 2.44 2.41 2.38 2.35 2.42 2.40 2.38 2.36 2.34 2.32 2.30 2.28 2.27 2.26 2.25 2.24 2.22 2.21 2.20 2.19 2.18 2.17 2.15 2.14 2.13 2.11 2.10 2.09 2.08 2.07 2.07 2.07 2.08 2.10 2.12 2.13 2.15 2.16 2.18 2.21 2.21 2.22 2.23 2.25 2.26 2.27 2.27 2.27 2.27 2.26 2.25 2.24 2.22 2.21 2.20 2.18 2.16 2.14 2.12 2.10 2.09 2.07 2.06 2.05 2.05 2.05 2.05 2.05 2.07 2.08 2.11 2.14 2.17 2.21 2.24 2.28 2.32 2.36 2.38 2.41 2.43 2.46 2.47 2.47 2.47 2.47 2.48 2.48 2.48 2.47 2.47 2.46 2.45 2.44 2.42 2.40 2.38 2.36 2.33 2.31 2.28 2.25 2.23 2.20 2.18 2.16 2.14 2.13 2.12 2.10 2.09 2.08 2.07 2.06 2.05 2.05 2.06 2.06 2.06 2.06 2.07 2.07 2.08 2.08 2.09 2.11 2.13 2.15 2.17 2.20 2.22 2.25 2.28 2.32 2.36 2.39 2.43 2.47 2.51 2.55 2.58 2.62 2.66 2.69 2.71 2.74 2.77 2.79 2.81 2.83 2.85 2.87 2.89 2.91 2.93 2.94 2.95 2.96 2.96 2.97 2.97 2.98 2.98 2.98 2.98 2.98 2.97 2.95 2.94 2.92 2.89 2.86 2.83 2.79 2.74 2.71 2.67 2.63 2.59 2.56 2.53 2.50 2.47 2.45 2.42 2.46 2.45 2.43 2.41 2.39 2.38 2.36 2.34 2.33 2.32 2.31 2.30 2.29 2.28 2.26 2.24 2.22 2.20 2.18 2.17 2.15 2.15 2.14 2.14 2.13 2.12 2.12 2.12 2.12 2.13 2.14 2.14 2.15 2.15 2.16 2.17 2.18 2.18 2.19 2.20 2.21 2.21 2.22 2.22 2.22 2.22 2.21 2.20 2.19 2.18 2.16 2.15 2.13 2.12 2.10 2.08 2.08 2.07 2.06 2.05 2.05 2.05 2.05 2.06 2.08 2.10 2.13 2.17 2.21 2.24 2.28 2.33 2.37 2.41 2.44 2.47 2.49 2.52 2.54 2.54 2.55 2.56 2.57 2.58 2.58 2.59 2.59 2.59 2.59 2.58 2.57 2.55 2.53 2.51 2.49 2.46 2.44 2.41 2.39 2.36 2.33 2.31 2.29 2.27 2.25 2.23 2.22 2.20 2.18 2.17 2.15 2.14 2.13 2.13 2.12 2.11 2.11 2.10 2.10 2.10 2.10 2.11 2.13 2.14 2.15 2.17 2.19 2.22 2.24 2.27 2.30 2.33 2.36 2.40 2.43 2.46 2.49 2.52 2.55 2.57 2.59 2.61 2.64 2.66 2.68 2.70 2.71 2.73 2.74 2.76 2.77 2.79 2.80 2.81 2.82 2.82 2.83 2.84 2.85 2.86 2.87 2.86 2.86 2.85 2.84 2.83 2.81 2.80 2.78 2.75 2.72 2.70 2.67 2.64 2.61 2.58 2.55 2.53 2.51 2.49 2.46 2.48 2.46 2.45 2.43 2.42 2.40 2.38 2.36 2.35 2.34 2.33 2.32 2.31 2.29 2.27 2.24 2.22 2.20 2.18 2.16 2.15 2.14 2.14 2.14 2.13 2.12 2.12 2.12 2.12 2.12 2.12 2.12 2.12 2.12 2.11 2.11 2.11 2.12 2.12 2.13 2.13 2.14 2.14 2.15 2.15 2.16 2.16 2.16 2.15 2.14 2.13 2.12 2.11 2.11 2.10 2.08 2.08 2.08 2.07 2.07 2.06 2.07 2.07 2.09 2.11 2.14 2.18 2.22 2.26 2.30 2.34 2.39 2.43 2.47 2.50 2.53 2.56 2.58 2.61 2.63 2.64 2.66 2.68 2.69 2.70 2.71 2.72 2.72 2.73 2.72 2.72 2.70 2.69 2.67 2.65 2.63 2.61 2.59 2.56 2.54 2.51 2.48 2.46 2.43 2.41 2.39 2.37 2.35 2.33 2.31 2.29 2.27 2.26 2.24 2.22 2.21 2.20 2.18 2.18 2.17 2.16 2.17 2.17 2.18 2.18 2.19 2.21 2.23 2.25 2.26 2.28 2.31 2.33 2.36 2.38 2.40 2.42 2.44 2.46 2.48 2.50 2.51 2.53 2.54 2.56 2.58 2.59 2.60 2.62 2.63 2.64 2.65 2.66 2.67 2.68 2.69 2.70 2.72 2.73 2.74 2.76 2.76 2.76 2.75 2.75 2.74 2.73 2.72 2.71 2.70 2.68 2.66 2.64 2.62 2.59 2.57 2.55 2.53 2.52 2.50 2.48 2.47 2.45 2.43 2.42 2.40 2.39 2.37 2.35 2.34 2.32 2.31 2.29 2.27 2.25 2.23 2.21 2.19 2.17 2.15 2.13 2.11 2.11 2.10 2.09 2.08 2.08 2.08 2.08 2.08 2.08 2.08 2.07 2.06 2.06 2.05 2.04 2.04 2.04 2.04 2.04 2.04 2.04 2.05 2.06 2.07 2.09 2.10 2.11 2.11 2.11 2.10 2.11 2.11 2.11 2.10 2.10 2.10 2.10 2.10 2.10 2.09 2.10 2.11 2.13 2.16 2.20 2.24 2.29 2.33 2.38 2.42 2.46 2.50 2.53 2.56 2.59 2.62 2.65 2.68 2.70 2.73 2.76 2.79 2.81 2.82 2.84 2.84 2.85 2.85 2.85 2.85 2.85 2.84 2.83 2.81 2.80 2.78 2.76 2.74 2.71 2.69 2.66 2.64 2.61 2.59 2.56 2.54 2.52 2.50 2.47 2.45 2.42 2.40 2.38 2.36 2.34 2.33 2.31 2.29 2.28 2.27 2.27 2.26 2.25 2.25 2.25 2.26 2.27 2.28 2.30 2.31 2.32 2.34 2.35 2.36 2.37 2.39 2.40 2.41 2.43 2.45 2.45 2.46 2.47 2.48 2.49 2.50 2.51 2.52 2.52 2.53 2.54 2.55 2.56 2.57 2.58 2.59 2.61 2.63 2.64 2.66 2.66 2.66 2.66 2.66 2.66 2.65 2.65 2.64 2.62 2.61 2.60 2.58 2.57 2.55 2.53 2.52 2.51 2.50 2.48 2.47 2.42 2.41 2.39 2.38 2.36 2.34 2.33 2.31 2.29 2.27 2.24 2.22 2.20 2.19 2.17 2.16 2.14 2.12 2.10 2.08 2.06 2.05 2.04 2.03 2.02 2.01 2.01 2.00 2.00 2.00 2.00 2.00 2.00 1.99 1.98 1.96 1.96 1.95 1.95 1.94 1.93 1.94 1.95 1.96 1.98 2.00 2.02 2.05 2.07 2.07 2.08 2.09 2.10 2.11 2.12 2.13 2.13 2.13 2.13 2.14 2.14 2.16 2.17 2.20 2.23 2.27 2.32 2.36 2.41 2.45 2.48 2.52 2.56 2.59 2.62 2.65 2.68 2.71 2.74 2.78 2.81 2.84 2.87 2.90 2.92 2.94 2.95 2.96 2.97 2.97 2.97 2.97 2.97 2.96 2.95 2.94 2.92 2.90 2.88 2.86 2.84 2.82 2.80 2.78 2.76 2.74 2.72 2.69 2.67 2.64 2.61 2.59 2.56 2.54 2.52 2.50 2.48 2.46 2.44 2.42 2.40 2.39 2.38 2.37 2.37 2.37 2.37 2.37 2.37 2.37 2.37 2.38 2.38 2.39 2.39 2.39 2.40 2.41 2.42 2.42 2.42 2.43 2.43 2.44 2.44 2.44 2.44 2.45 2.45 2.45 2.45 2.46 2.46 2.47 2.48 2.48 2.50 2.52 2.54 2.55 2.57 2.57 2.58 2.58 2.57 2.57 2.57 2.57 2.56 2.55 2.53 2.52 2.51 2.49 2.48 2.47 2.46 2.46 2.45 2.43 2.42 2.33 2.32 2.30 2.29 2.27 2.26 2.25 2.23 2.21 2.18 2.15 2.14 2.12 2.10 2.09 2.07 2.05 2.03 2.01 1.99 1.97 1.96 1.95 1.94 1.93 1.92 1.92 1.91 1.90 1.90 1.89 1.90 1.90 1.90 1.90 1.90 1.89 1.89 1.88 1.86 1.84 1.84 1.84 1.86 1.88 1.91 1.94 1.97 2.00 2.03 2.07 2.08 2.10 2.12 2.13 2.14 2.15 2.16 2.17 2.18 2.18 2.21 2.24 2.27 2.30 2.34 2.38 2.43 2.47 2.50 2.54 2.56 2.59 2.62 2.65 2.67 2.71 2.74 2.78 2.82 2.86 2.90 2.94 2.96 2.98 3.00 3.02 3.03 3.04 3.04 3.05 3.05 3.05 3.05 3.05 3.04 3.03 3.01 3.00 2.99 2.97 2.95 2.93 2.91 2.89 2.87 2.85 2.83 2.81 2.79 2.77 2.74 2.72 2.70 2.68 2.66 2.63 2.61 2.59 2.57 2.56 2.55 2.53 2.52 2.50 2.49 2.49 2.49 2.48 2.48 2.47 2.47 2.47 2.46 2.46 2.45 2.45 2.46 2.46 2.45 2.45 2.44 2.44 2.44 2.44 2.44 2.44 2.44 2.44 2.43 2.43 2.43 2.43 2.43 2.43 2.43 2.44 2.44 2.45 2.46 2.47 2.47 2.47 2.46 2.46 2.46 2.46 2.46 2.46 2.45 2.44 2.43 2.42 2.41 2.40 2.39 2.38 2.37 2.35 2.34 2.33 2.23 2.21 2.19 2.18 2.17 2.16 2.15 2.13 2.11 2.09 2.07 2.05 2.03 2.01 1.99 1.98 1.96 1.94 1.92 1.91 1.89 1.88 1.86 1.85 1.84 1.83 1.83 1.82 1.81 1.81 1.80 1.80 1.80 1.81 1.81 1.81 1.81 1.81 1.81 1.80 1.80 1.80 1.79 1.79 1.80 1.81 1.84 1.87 1.91 1.96 2.01 2.05 2.08 2.11 2.13 2.15 2.17 2.18 2.19 2.21 2.22 2.26 2.29 2.33 2.36 2.39 2.43 2.46 2.49 2.51 2.54 2.57 2.59 2.62 2.66 2.69 2.73 2.77 2.81 2.85 2.89 2.92 2.96 2.98 3.01 3.03 3.04 3.06 3.07 3.08 3.09 3.09 3.10 3.10 3.09 3.09 3.08 3.08 3.07 3.06 3.05 3.04 3.02 3.01 3.00 2.98 2.96 2.95 2.93 2.91 2.89 2.86 2.84 2.82 2.81 2.79 2.77 2.74 2.72 2.71 2.70 2.68 2.67 2.65 2.63 2.61 2.61 2.60 2.59 2.58 2.58 2.57 2.56 2.55 2.54 2.53 2.52 2.51 2.50 2.50 2.49 2.48 2.47 2.46 2.45 2.45 2.44 2.44 2.43 2.43 2.42 2.41 2.40 2.40 2.39 2.39 2.39 2.38 2.38 2.39 2.39 2.39 2.38 2.38 2.38 2.38 2.37 2.37 2.36 2.35 2.34 2.33 2.32 2.31 2.30 2.29 2.28 2.26 2.25 2.24 2.23 2.12 2.10 2.08 2.07 2.06 2.05 2.04 2.02 2.00 1.99 1.98 1.96 1.94 1.92 1.91 1.89 1.87 1.85 1.84 1.83 1.81 1.80 1.79 1.78 1.77 1.76 1.75 1.74 1.73 1.73 1.72 1.72 1.72 1.72 1.72 1.71 1.72 1.73 1.73 1.74 1.75 1.75 1.75 1.75 1.75 1.75 1.77 1.80 1.83 1.87 1.91 1.97 2.02 2.07 2.10 2.14 2.16 2.17 2.19 2.22 2.25 2.28 2.31 2.34 2.37 2.39 2.42 2.45 2.48 2.51 2.53 2.56 2.59 2.62 2.66 2.70 2.74 2.79 2.83 2.86 2.89 2.92 2.94 2.96 2.99 3.02 3.03 3.04 3.06 3.07 3.08 3.09 3.09 3.10 3.10 3.09 3.09 3.09 3.09 3.09 3.09 3.07 3.06 3.05 3.05 3.04 3.02 3.01 2.99 2.98 2.96 2.94 2.92 2.91 2.90 2.88 2.86 2.84 2.83 2.81 2.80 2.79 2.77 2.76 2.74 2.72 2.71 2.69 2.68 2.67 2.66 2.65 2.63 2.62 2.60 2.59 2.58 2.57 2.55 2.55 2.54 2.52 2.51 2.50 2.48 2.46 2.46 2.45 2.44 2.43 2.42 2.41 2.39 2.38 2.37 2.36 2.35 2.34 2.33 2.33 2.33 2.32 2.32 2.31 2.30 2.30 2.29 2.29 2.28 2.26 2.25 2.23 2.22 2.21 2.19 2.18 2.17 2.15 2.14 2.13 2.12 2.01 2.00 1.98 1.97 1.96 1.95 1.93 1.92 1.91 1.89 1.88 1.87 1.86 1.84 1.83 1.82 1.80 1.78 1.77 1.76 1.75 1.74 1.73 1.73 1.72 1.71 1.70 1.69 1.69 1.68 1.67 1.67 1.67 1.67 1.67 1.66 1.67 1.68 1.68 1.69 1.70 1.71 1.72 1.73 1.74 1.75 1.76 1.78 1.79 1.81 1.83 1.89 1.96 2.02 2.07 2.12 2.14 2.15 2.18 2.23 2.27 2.29 2.30 2.32 2.34 2.36 2.40 2.43 2.46 2.50 2.54 2.57 2.60 2.63 2.67 2.70 2.74 2.78 2.81 2.83 2.86 2.88 2.90 2.92 2.94 2.97 2.98 2.99 3.01 3.02 3.03 3.04 3.05 3.05 3.06 3.06 3.06 3.06 3.07 3.07 3.07 3.06 3.06 3.05 3.04 3.02 3.02 3.01 3.00 2.99 2.98 2.97 2.95 2.94 2.93 2.92 2.90 2.89 2.88 2.87 2.86 2.84 2.83 2.82 2.80 2.78 2.77 2.75 2.74 2.73 2.71 2.70 2.68 2.66 2.65 2.64 2.62 2.61 2.59 2.58 2.57 2.56 2.54 2.53 2.51 2.48 2.47 2.46 2.44 2.43 2.42 2.40 2.39 2.37 2.35 2.33 2.32 2.31 2.30 2.29 2.28 2.27 2.26 2.25 2.24 2.23 2.22 2.21 2.20 2.19 2.17 2.15 2.13 2.11 2.10 2.08 2.06 2.05 2.04 2.02 2.01 1.93 1.92 1.91 1.89 1.88 1.87 1.85 1.84 1.83 1.82 1.80 1.80 1.79 1.78 1.77 1.75 1.75 1.74 1.73 1.73 1.72 1.71 1.70 1.69 1.69 1.69 1.69 1.69 1.69 1.68 1.67 1.67 1.67 1.68 1.68 1.69 1.70 1.70 1.71 1.71 1.72 1.73 1.73 1.75 1.77 1.79 1.81 1.83 1.85 1.89 1.93 1.98 2.02 2.07 2.11 2.16 2.17 2.17 2.19 2.22 2.26 2.29 2.32 2.35 2.38 2.40 2.44 2.47 2.50 2.52 2.55 2.58 2.60 2.62 2.64 2.66 2.70 2.73 2.75 2.77 2.79 2.81 2.83 2.85 2.87 2.89 2.90 2.92 2.93 2.94 2.96 2.96 2.97 2.97 2.97 2.97 2.98 2.98 2.99 2.99 2.99 2.99 2.99 2.98 2.98 2.97 2.96 2.96 2.95 2.95 2.94 2.93 2.93 2.92 2.90 2.89 2.88 2.88 2.87 2.86 2.86 2.84 2.83 2.82 2.81 2.79 2.78 2.77 2.75 2.74 2.73 2.71 2.70 2.69 2.68 2.66 2.64 2.62 2.61 2.59 2.58 2.57 2.56 2.54 2.51 2.48 2.47 2.46 2.44 2.42 2.40 2.39 2.38 2.36 2.34 2.32 2.31 2.30 2.28 2.26 2.24 2.23 2.21 2.20 2.19 2.18 2.16 2.15 2.13 2.11 2.09 2.08 2.06 2.04 2.03 2.01 1.99 1.97 1.96 1.95 1.93 1.92 1.90 1.88 1.87 1.85 1.84 1.83 1.82 1.80 1.80 1.79 1.78 1.78 1.77 1.76 1.75 1.75 1.74 1.74 1.74 1.73 1.73 1.72 1.72 1.72 1.73 1.73 1.73 1.73 1.73 1.72 1.73 1.73 1.74 1.75 1.77 1.77 1.78 1.79 1.81 1.83 1.84 1.85 1.87 1.89 1.92 1.94 1.97 1.99 2.03 2.06 2.09 2.12 2.15 2.17 2.20 2.21 2.22 2.23 2.25 2.26 2.28 2.30 2.32 2.34 2.35 2.38 2.41 2.43 2.45 2.47 2.49 2.51 2.53 2.55 2.57 2.59 2.62 2.64 2.66 2.68 2.69 2.70 2.72 2.73 2.75 2.76 2.77 2.79 2.80 2.81 2.81 2.81 2.82 2.82 2.83 2.83 2.83 2.83 2.84 2.84 2.84 2.84 2.84 2.84 2.84 2.84 2.84 2.84 2.83 2.82 2.82 2.82 2.82 2.81 2.81 2.81 2.80 2.79 2.79 2.78 2.77 2.76 2.76 2.75 2.74 2.73 2.71 2.70 2.69 2.68 2.67 2.66 2.65 2.64 2.62 2.61 2.60 2.58 2.56 2.54 2.53 2.52 2.50 2.49 2.47 2.46 2.45 2.43 2.41 2.39 2.37 2.35 2.34 2.32 2.31 2.29 2.27 2.26 2.24 2.23 2.21 2.19 2.17 2.16 2.14 2.12 2.11 2.10 2.08 2.07 2.05 2.03 2.01 1.99 1.97 1.96 1.95 1.93 1.93 1.92 1.95 1.93 1.92 1.91 1.90 1.88 1.87 1.86 1.85 1.85 1.84 1.84 1.83 1.83 1.82 1.81 1.81 1.81 1.81 1.81 1.81 1.81 1.81 1.81 1.81 1.82 1.82 1.82 1.82 1.82 1.83 1.83 1.84 1.85 1.85 1.86 1.88 1.89 1.91 1.92 1.93 1.94 1.95 1.97 1.99 2.02 2.03 2.05 2.07 2.09 2.11 2.13 2.15 2.17 2.19 2.21 2.22 2.23 2.25 2.26 2.27 2.28 2.29 2.30 2.32 2.33 2.34 2.36 2.37 2.39 2.40 2.41 2.43 2.44 2.46 2.47 2.49 2.50 2.52 2.53 2.55 2.55 2.56 2.57 2.58 2.59 2.60 2.61 2.62 2.63 2.64 2.64 2.65 2.65 2.66 2.67 2.67 2.67 2.67 2.68 2.68 2.69 2.69 2.69 2.69 2.69 2.69 2.69 2.69 2.69 2.70 2.70 2.70 2.70 2.70 2.70 2.69 2.68 2.68 2.68 2.67 2.67 2.67 2.66 2.66 2.65 2.64 2.63 2.62 2.61 2.60 2.59 2.58 2.57 2.56 2.56 2.54 2.53 2.52 2.50 2.48 2.48 2.47 2.46 2.44 2.43 2.42 2.40 2.39 2.37 2.36 2.34 2.33 2.31 2.30 2.29 2.27 2.26 2.24 2.23 2.21 2.20 2.18 2.17 2.15 2.14 2.12 2.10 2.09 2.08 2.07 2.06 2.04 2.03 2.02 2.00 1.99 1.97 1.96 1.95 1.95 2.01 2.01 2.00 2.00 1.98 1.97 1.97 1.96 1.95 1.95 1.95 1.94 1.94 1.94 1.93 1.93 1.93 1.93 1.93 1.93 1.93 1.93 1.94 1.94 1.94 1.94 1.94 1.94 1.95 1.95 1.95 1.96 1.97 1.97 1.98 1.99 2.00 2.01 2.02 2.03 2.03 2.04 2.05 2.07 2.08 2.09 2.10 2.12 2.13 2.14 2.15 2.16 2.17 2.18 2.19 2.21 2.22 2.23 2.25 2.26 2.27 2.27 2.28 2.29 2.30 2.31 2.32 2.32 2.33 2.34 2.35 2.36 2.36 2.37 2.38 2.39 2.40 2.41 2.42 2.43 2.44 2.44 2.44 2.45 2.46 2.47 2.48 2.48 2.48 2.49 2.50 2.50 2.51 2.52 2.52 2.52 2.52 2.52 2.53 2.53 2.54 2.54 2.55 2.55 2.55 2.55 2.55 2.55 2.55 2.56 2.56 2.56 2.56 2.56 2.56 2.56 2.56 2.55 2.55 2.55 2.55 2.55 2.54 2.54 2.54 2.53 2.53 2.52 2.51 2.51 2.50 2.49 2.48 2.48 2.47 2.46 2.45 2.44 2.43 2.42 2.41 2.41 2.40 2.39 2.38 2.37 2.36 2.35 2.34 2.33 2.32 2.31 2.30 2.29 2.28 2.27 2.26 2.25 2.23 2.22 2.21 2.20 2.19 2.18 2.17 2.16 2.15 2.13 2.12 2.11 2.10 2.09 2.08 2.08 2.07 2.06 2.05 2.03 2.02 2.02 2.01 nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan ]; rms=[ nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 0.11 0.11 0.11 0.11 0.11 0.11 0.12 0.12 0.13 0.12 0.12 0.12 0.13 0.13 0.13 0.13 0.13 0.13 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.17 0.17 0.17 0.17 0.17 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.16 0.16 0.16 0.16 0.16 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.12 0.12 0.12 0.12 0.13 0.12 0.12 0.12 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.09 0.09 0.09 0.09 0.09 0.09 0.09 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.11 0.11 0.11 0.12 0.12 0.12 0.12 0.12 0.12 0.12 0.12 0.13 0.14 0.14 0.14 0.14 0.14 0.14 0.15 0.15 0.15 0.15 0.15 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.17 0.17 0.17 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.17 0.17 0.17 0.17 0.17 0.17 0.16 0.16 0.16 0.16 0.16 0.16 0.15 0.15 0.15 0.15 0.15 0.15 0.14 0.14 0.14 0.13 0.13 0.13 0.13 0.13 0.13 0.12 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.12 0.12 0.12 0.12 0.12 0.12 0.12 0.12 0.12 0.12 0.12 0.12 0.12 0.12 0.12 0.12 0.12 0.12 0.12 0.13 0.13 0.13 0.12 0.12 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.12 0.12 0.12 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.10 0.10 0.09 0.09 0.09 0.09 0.09 0.09 0.09 0.09 0.09 0.09 0.09 0.09 0.09 0.09 0.09 0.09 0.09 0.09 0.09 0.09 0.09 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.09 0.09 0.09 0.09 0.10 0.10 0.11 0.11 0.11 0.11 0.11 0.11 0.12 0.12 0.13 0.13 0.13 0.13 0.14 0.14 0.14 0.14 0.14 0.15 0.15 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.17 0.17 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.17 0.17 0.16 0.16 0.16 0.16 0.16 0.16 0.15 0.15 0.14 0.14 0.14 0.14 0.13 0.13 0.12 0.12 0.12 0.12 0.12 0.11 0.11 0.10 0.09 0.09 0.09 0.09 0.09 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.09 0.09 0.09 0.09 0.09 0.09 0.09 0.09 0.09 0.09 0.09 0.09 0.10 0.10 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.12 0.12 0.13 0.12 0.12 0.12 0.12 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.12 0.12 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.09 0.09 0.09 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.07 0.08 0.08 0.08 0.08 0.09 0.09 0.10 0.10 0.10 0.10 0.11 0.11 0.11 0.11 0.12 0.13 0.13 0.13 0.13 0.14 0.14 0.15 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.17 0.18 0.18 0.18 0.18 0.17 0.17 0.16 0.16 0.16 0.16 0.15 0.15 0.15 0.15 0.14 0.13 0.13 0.13 0.13 0.12 0.12 0.11 0.10 0.10 0.09 0.08 0.08 0.08 0.08 0.07 0.07 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.05 0.06 0.06 0.06 0.06 0.06 0.07 0.08 0.08 0.09 0.10 0.10 0.11 0.11 0.11 0.11 0.11 0.11 0.12 0.12 0.13 0.12 0.12 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.09 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.07 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.06 0.06 0.07 0.07 0.07 0.07 0.08 0.08 0.08 0.08 0.09 0.10 0.10 0.11 0.11 0.11 0.12 0.12 0.12 0.13 0.14 0.14 0.15 0.15 0.15 0.15 0.15 0.15 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.17 0.17 0.17 0.16 0.16 0.16 0.16 0.16 0.16 0.15 0.15 0.15 0.15 0.14 0.13 0.13 0.12 0.12 0.11 0.10 0.10 0.09 0.08 0.08 0.08 0.08 0.07 0.07 0.06 0.06 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.03 0.03 0.03 0.03 0.04 0.05 0.06 0.07 0.07 0.08 0.08 0.09 0.10 0.10 0.11 0.11 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.11 0.11 0.11 0.11 0.11 0.12 0.12 0.13 0.13 0.13 0.13 0.12 0.12 0.12 0.11 0.11 0.11 0.11 0.11 0.11 0.10 0.10 0.09 0.09 0.09 0.09 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.07 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.04 0.04 0.04 0.05 0.05 0.05 0.05 0.05 0.05 0.06 0.06 0.06 0.07 0.08 0.08 0.08 0.08 0.09 0.09 0.10 0.11 0.11 0.11 0.11 0.12 0.12 0.13 0.13 0.14 0.14 0.14 0.14 0.14 0.14 0.15 0.15 0.15 0.15 0.15 0.15 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.15 0.15 0.15 0.14 0.13 0.13 0.12 0.11 0.11 0.11 0.10 0.10 0.09 0.09 0.08 0.08 0.07 0.06 0.06 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.04 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.04 0.05 0.06 0.07 0.08 0.08 0.09 0.10 0.10 0.11 0.11 0.11 0.11 0.10 0.10 0.09 0.09 0.09 0.09 0.09 0.09 0.09 0.09 0.09 0.09 0.09 0.09 0.09 0.10 0.10 0.10 0.10 0.10 0.11 0.12 0.12 0.12 0.13 0.13 0.13 0.14 0.14 0.14 0.14 0.14 0.14 0.13 0.13 0.13 0.12 0.12 0.12 0.12 0.12 0.11 0.11 0.11 0.10 0.09 0.09 0.09 0.09 0.09 0.08 0.08 0.08 0.07 0.07 0.07 0.06 0.06 0.06 0.06 0.06 0.06 0.05 0.05 0.06 0.06 0.06 0.05 0.05 0.05 0.05 0.05 0.05 0.04 0.04 0.04 0.05 0.05 0.05 0.05 0.05 0.05 0.06 0.06 0.07 0.08 0.08 0.08 0.09 0.09 0.09 0.10 0.11 0.11 0.11 0.11 0.11 0.12 0.12 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.14 0.14 0.14 0.14 0.14 0.14 0.15 0.15 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.16 0.15 0.15 0.14 0.14 0.13 0.13 0.12 0.12 0.12 0.11 0.11 0.10 0.10 0.09 0.08 0.08 0.07 0.06 0.06 0.06 0.06 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.04 0.03 0.03 0.02 0.02 0.02 0.02 0.03 0.04 0.04 0.05 0.06 0.07 0.08 0.09 0.10 0.10 0.11 0.11 0.11 0.11 0.11 0.10 0.09 0.09 0.09 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.09 0.09 0.10 0.10 0.10 0.11 0.12 0.12 0.13 0.14 0.14 0.14 0.14 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.14 0.14 0.14 0.14 0.14 0.14 0.13 0.13 0.12 0.11 0.11 0.10 0.10 0.10 0.10 0.09 0.09 0.09 0.09 0.08 0.07 0.07 0.07 0.07 0.07 0.07 0.06 0.06 0.06 0.07 0.07 0.07 0.06 0.06 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.06 0.06 0.07 0.08 0.08 0.08 0.08 0.09 0.10 0.10 0.11 0.11 0.12 0.12 0.12 0.12 0.12 0.12 0.12 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.14 0.14 0.14 0.14 0.15 0.15 0.16 0.16 0.16 0.17 0.17 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.17 0.17 0.17 0.17 0.16 0.15 0.15 0.14 0.14 0.14 0.14 0.13 0.12 0.12 0.11 0.10 0.10 0.09 0.08 0.08 0.07 0.06 0.06 0.05 0.05 0.05 0.05 0.05 0.05 0.04 0.04 0.04 0.03 0.03 0.03 0.03 0.04 0.05 0.06 0.06 0.07 0.08 0.09 0.10 0.11 0.11 0.11 0.10 0.10 0.10 0.10 0.09 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.09 0.09 0.10 0.11 0.12 0.12 0.13 0.14 0.14 0.15 0.16 0.16 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.16 0.16 0.15 0.15 0.15 0.15 0.14 0.13 0.13 0.12 0.12 0.11 0.11 0.11 0.10 0.10 0.10 0.10 0.09 0.09 0.08 0.08 0.08 0.08 0.07 0.07 0.07 0.07 0.08 0.08 0.08 0.08 0.07 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.07 0.08 0.08 0.09 0.10 0.10 0.10 0.10 0.12 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.12 0.11 0.11 0.11 0.12 0.12 0.13 0.13 0.13 0.13 0.14 0.15 0.15 0.16 0.17 0.17 0.18 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.20 0.20 0.21 0.20 0.20 0.19 0.19 0.18 0.18 0.18 0.18 0.17 0.16 0.16 0.15 0.14 0.14 0.13 0.12 0.12 0.11 0.10 0.10 0.09 0.08 0.08 0.07 0.06 0.06 0.06 0.06 0.06 0.06 0.05 0.04 0.03 0.03 0.03 0.05 0.06 0.07 0.07 0.08 0.09 0.09 0.10 0.11 0.11 0.11 0.10 0.10 0.10 0.10 0.09 0.08 0.08 0.09 0.10 0.10 0.10 0.09 0.09 0.08 0.08 0.08 0.08 0.09 0.10 0.10 0.10 0.10 0.12 0.13 0.14 0.14 0.15 0.16 0.16 0.17 0.18 0.18 0.18 0.18 0.19 0.19 0.19 0.19 0.19 0.19 0.18 0.18 0.17 0.16 0.16 0.16 0.16 0.15 0.15 0.14 0.13 0.13 0.12 0.11 0.11 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.09 0.08 0.08 0.08 0.08 0.11 0.10 0.10 0.09 0.09 0.09 0.09 0.08 0.08 0.08 0.08 0.07 0.07 0.07 0.07 0.08 0.08 0.09 0.10 0.10 0.11 0.12 0.13 0.14 0.15 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.15 0.15 0.14 0.14 0.13 0.13 0.13 0.13 0.13 0.13 0.12 0.12 0.12 0.12 0.13 0.13 0.14 0.15 0.15 0.16 0.17 0.18 0.19 0.20 0.20 0.21 0.21 0.21 0.21 0.22 0.22 0.22 0.22 0.22 0.21 0.21 0.21 0.20 0.20 0.20 0.20 0.19 0.19 0.18 0.18 0.17 0.17 0.17 0.16 0.16 0.15 0.14 0.14 0.13 0.12 0.12 0.11 0.10 0.10 0.09 0.09 0.09 0.09 0.08 0.08 0.07 0.07 0.07 0.08 0.09 0.09 0.09 0.09 0.10 0.11 0.11 0.12 0.13 0.13 0.12 0.12 0.12 0.12 0.12 0.12 0.12 0.13 0.14 0.13 0.13 0.12 0.11 0.09 0.09 0.09 0.09 0.10 0.10 0.10 0.11 0.11 0.12 0.13 0.14 0.14 0.15 0.16 0.16 0.17 0.18 0.18 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.18 0.18 0.17 0.16 0.16 0.15 0.15 0.15 0.15 0.14 0.13 0.13 0.12 0.11 0.11 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.10 0.09 0.09 0.09 0.08 0.08 0.08 0.08 0.08 0.09 0.10 0.10 0.11 0.12 0.13 0.15 0.16 0.17 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.17 0.17 0.16 0.14 0.14 0.13 0.13 0.13 0.13 0.13 0.12 0.11 0.12 0.13 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.19 0.20 0.21 0.21 0.22 0.22 0.22 0.23 0.23 0.23 0.23 0.22 0.22 0.22 0.22 0.22 0.22 0.22 0.22 0.22 0.21 0.21 0.21 0.21 0.20 0.20 0.19 0.19 0.18 0.18 0.18 0.16 0.15 0.15 0.14 0.13 0.12 0.11 0.11 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.11 0.11 0.11 0.12 0.12 0.13 0.14 0.14 0.15 0.15 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.15 0.14 0.13 0.12 0.11 0.11 0.11 0.12 0.12 0.12 0.12 0.13 0.13 0.14 0.14 0.15 0.15 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.18 0.18 0.17 0.16 0.16 0.15 0.14 0.14 0.14 0.13 0.12 0.12 0.11 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.11 0.11 0.11 0.11 0.11 0.11 0.12 0.12 0.11 0.11 0.11 0.11 0.11 0.10 0.10 0.09 0.09 0.09 0.09 0.09 0.10 0.10 0.11 0.12 0.13 0.15 0.16 0.17 0.19 0.19 0.20 0.21 0.21 0.21 0.21 0.21 0.21 0.21 0.20 0.20 0.19 0.19 0.17 0.16 0.15 0.14 0.14 0.13 0.13 0.13 0.12 0.12 0.12 0.13 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.19 0.20 0.21 0.21 0.22 0.23 0.23 0.23 0.23 0.23 0.23 0.23 0.23 0.23 0.23 0.23 0.23 0.23 0.23 0.23 0.23 0.23 0.23 0.23 0.23 0.22 0.22 0.21 0.21 0.20 0.20 0.19 0.18 0.17 0.16 0.15 0.14 0.13 0.12 0.11 0.10 0.11 0.12 0.12 0.12 0.12 0.12 0.12 0.12 0.13 0.14 0.15 0.15 0.16 0.17 0.18 0.18 0.19 0.19 0.19 0.19 0.18 0.18 0.18 0.17 0.17 0.16 0.15 0.14 0.14 0.13 0.14 0.14 0.14 0.14 0.14 0.15 0.15 0.15 0.15 0.15 0.16 0.17 0.17 0.17 0.18 0.18 0.18 0.18 0.18 0.19 0.19 0.19 0.19 0.19 0.19 0.18 0.18 0.17 0.16 0.16 0.15 0.14 0.14 0.13 0.12 0.12 0.11 0.11 0.10 0.10 0.09 0.09 0.09 0.09 0.10 0.10 0.10 0.10 0.11 0.11 0.11 0.11 0.11 0.12 0.12 0.13 0.12 0.12 0.12 0.12 0.12 0.11 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.11 0.12 0.13 0.14 0.16 0.17 0.18 0.20 0.21 0.22 0.23 0.23 0.24 0.25 0.25 0.24 0.23 0.23 0.22 0.21 0.21 0.20 0.19 0.17 0.16 0.15 0.15 0.14 0.14 0.13 0.13 0.13 0.13 0.13 0.14 0.15 0.16 0.17 0.18 0.18 0.19 0.19 0.20 0.21 0.21 0.22 0.22 0.22 0.22 0.22 0.22 0.22 0.22 0.22 0.22 0.22 0.22 0.22 0.22 0.22 0.23 0.23 0.23 0.23 0.23 0.24 0.24 0.24 0.23 0.23 0.22 0.21 0.21 0.20 0.19 0.18 0.17 0.15 0.14 0.13 0.13 0.12 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.19 0.20 0.21 0.21 0.20 0.19 0.19 0.18 0.18 0.18 0.18 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.17 0.16 0.16 0.15 0.14 0.14 0.13 0.12 0.12 0.11 0.11 0.10 0.10 0.10 0.09 0.09 0.08 0.08 0.09 0.10 0.10 0.10 0.10 0.11 0.11 0.11 0.11 0.12 0.12 0.13 0.11 0.12 0.13 0.13 0.13 0.13 0.12 0.12 0.11 0.11 0.11 0.11 0.11 0.12 0.12 0.13 0.14 0.16 0.17 0.18 0.19 0.21 0.23 0.25 0.25 0.26 0.27 0.27 0.27 0.27 0.26 0.25 0.25 0.24 0.22 0.21 0.20 0.19 0.17 0.16 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.16 0.16 0.17 0.18 0.18 0.19 0.19 0.20 0.21 0.21 0.20 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.18 0.18 0.19 0.19 0.20 0.21 0.21 0.22 0.23 0.23 0.24 0.24 0.24 0.24 0.24 0.24 0.24 0.23 0.23 0.22 0.21 0.20 0.19 0.18 0.17 0.17 0.16 0.15 0.15 0.15 0.15 0.14 0.14 0.13 0.13 0.13 0.13 0.14 0.15 0.15 0.16 0.17 0.18 0.19 0.20 0.21 0.21 0.20 0.19 0.19 0.19 0.19 0.19 0.18 0.18 0.18 0.18 0.18 0.18 0.19 0.19 0.19 0.19 0.19 0.19 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.17 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.15 0.14 0.14 0.13 0.12 0.12 0.11 0.11 0.11 0.11 0.10 0.09 0.09 0.08 0.08 0.08 0.08 0.09 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.11 0.11 0.11 0.11 0.11 0.12 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.14 0.14 0.15 0.16 0.16 0.17 0.18 0.20 0.22 0.24 0.25 0.26 0.27 0.29 0.29 0.29 0.29 0.28 0.27 0.26 0.25 0.24 0.22 0.21 0.20 0.19 0.17 0.17 0.16 0.15 0.15 0.15 0.15 0.15 0.15 0.16 0.16 0.17 0.18 0.18 0.19 0.19 0.19 0.19 0.20 0.20 0.19 0.19 0.18 0.18 0.17 0.17 0.16 0.16 0.15 0.15 0.16 0.16 0.17 0.18 0.18 0.19 0.19 0.20 0.21 0.22 0.23 0.23 0.23 0.23 0.23 0.23 0.23 0.23 0.22 0.21 0.21 0.20 0.19 0.19 0.18 0.17 0.17 0.16 0.15 0.15 0.14 0.14 0.13 0.13 0.13 0.13 0.14 0.15 0.15 0.16 0.17 0.17 0.18 0.19 0.19 0.20 0.20 0.21 0.20 0.20 0.19 0.19 0.19 0.19 0.19 0.19 0.20 0.20 0.21 0.21 0.21 0.21 0.21 0.20 0.19 0.19 0.18 0.18 0.17 0.17 0.16 0.16 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.14 0.14 0.14 0.13 0.12 0.12 0.11 0.11 0.10 0.10 0.10 0.09 0.09 0.09 0.09 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.11 0.11 0.11 0.12 0.13 0.14 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.16 0.17 0.17 0.18 0.19 0.21 0.23 0.25 0.26 0.26 0.28 0.29 0.30 0.30 0.30 0.30 0.29 0.28 0.26 0.25 0.24 0.22 0.21 0.20 0.19 0.18 0.17 0.16 0.16 0.15 0.15 0.15 0.16 0.16 0.16 0.17 0.18 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.18 0.18 0.17 0.16 0.15 0.14 0.14 0.14 0.13 0.13 0.13 0.14 0.14 0.15 0.16 0.16 0.17 0.19 0.19 0.20 0.21 0.21 0.22 0.22 0.22 0.22 0.22 0.22 0.21 0.20 0.20 0.20 0.19 0.19 0.19 0.19 0.18 0.17 0.16 0.15 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.15 0.15 0.16 0.17 0.17 0.18 0.19 0.20 0.20 0.20 0.19 0.19 0.19 0.20 0.20 0.21 0.21 0.21 0.21 0.22 0.22 0.21 0.21 0.20 0.20 0.19 0.19 0.18 0.17 0.17 0.16 0.15 0.15 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.14 0.14 0.14 0.13 0.12 0.12 0.12 0.11 0.11 0.11 0.10 0.10 0.10 0.10 0.10 0.09 0.09 0.09 0.09 0.09 0.09 0.10 0.10 0.11 0.11 0.12 0.13 0.15 0.16 0.16 0.17 0.17 0.17 0.18 0.18 0.18 0.18 0.18 0.19 0.19 0.20 0.21 0.22 0.23 0.25 0.27 0.27 0.28 0.29 0.30 0.31 0.31 0.31 0.30 0.29 0.28 0.26 0.25 0.24 0.22 0.20 0.19 0.18 0.18 0.17 0.16 0.16 0.15 0.15 0.16 0.16 0.16 0.17 0.17 0.18 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.18 0.17 0.16 0.16 0.14 0.13 0.12 0.12 0.12 0.12 0.12 0.12 0.12 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.19 0.19 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.19 0.19 0.19 0.20 0.20 0.20 0.19 0.18 0.17 0.15 0.15 0.15 0.15 0.15 0.15 0.14 0.13 0.12 0.12 0.12 0.13 0.13 0.13 0.14 0.15 0.16 0.17 0.18 0.18 0.19 0.19 0.19 0.19 0.20 0.21 0.21 0.21 0.21 0.22 0.22 0.22 0.22 0.21 0.21 0.20 0.20 0.19 0.18 0.17 0.16 0.15 0.15 0.14 0.14 0.13 0.13 0.13 0.13 0.14 0.14 0.15 0.15 0.15 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.15 0.14 0.14 0.14 0.13 0.13 0.12 0.11 0.11 0.10 0.10 0.10 0.09 0.09 0.09 0.08 0.08 0.09 0.09 0.10 0.11 0.12 0.13 0.14 0.16 0.17 0.17 0.18 0.19 0.20 0.20 0.20 0.20 0.21 0.21 0.22 0.23 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.29 0.30 0.30 0.31 0.31 0.31 0.30 0.29 0.27 0.26 0.25 0.23 0.21 0.19 0.19 0.18 0.17 0.17 0.16 0.16 0.16 0.16 0.16 0.16 0.17 0.18 0.18 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.18 0.17 0.16 0.14 0.13 0.12 0.11 0.11 0.11 0.11 0.11 0.11 0.12 0.12 0.13 0.14 0.15 0.16 0.17 0.17 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.19 0.19 0.20 0.20 0.20 0.21 0.21 0.19 0.18 0.17 0.16 0.15 0.15 0.15 0.14 0.14 0.14 0.12 0.11 0.11 0.11 0.11 0.11 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.17 0.18 0.19 0.19 0.20 0.21 0.21 0.21 0.21 0.22 0.22 0.22 0.22 0.21 0.21 0.21 0.20 0.19 0.18 0.16 0.15 0.14 0.14 0.13 0.13 0.13 0.13 0.13 0.13 0.14 0.15 0.16 0.16 0.17 0.18 0.18 0.19 0.19 0.19 0.19 0.19 0.18 0.18 0.17 0.16 0.16 0.15 0.14 0.13 0.13 0.12 0.11 0.11 0.10 0.10 0.10 0.09 0.09 0.08 0.09 0.09 0.10 0.12 0.13 0.13 0.14 0.16 0.17 0.18 0.19 0.21 0.22 0.23 0.23 0.23 0.23 0.24 0.25 0.25 0.26 0.27 0.27 0.28 0.29 0.29 0.30 0.31 0.31 0.31 0.31 0.30 0.30 0.29 0.27 0.26 0.25 0.23 0.22 0.21 0.19 0.18 0.17 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.17 0.18 0.18 0.19 0.19 0.19 0.19 0.19 0.19 0.18 0.17 0.17 0.16 0.14 0.13 0.12 0.12 0.11 0.11 0.11 0.11 0.11 0.12 0.12 0.13 0.14 0.16 0.17 0.17 0.18 0.18 0.18 0.18 0.18 0.18 0.17 0.17 0.16 0.16 0.16 0.17 0.18 0.19 0.20 0.21 0.21 0.21 0.21 0.20 0.19 0.18 0.17 0.16 0.15 0.15 0.14 0.13 0.12 0.11 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.11 0.12 0.13 0.15 0.16 0.17 0.18 0.19 0.19 0.20 0.21 0.21 0.21 0.21 0.21 0.21 0.21 0.21 0.21 0.20 0.20 0.19 0.18 0.16 0.16 0.15 0.14 0.14 0.13 0.13 0.13 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.19 0.20 0.21 0.21 0.21 0.21 0.21 0.21 0.21 0.20 0.19 0.19 0.18 0.17 0.16 0.15 0.14 0.13 0.13 0.12 0.11 0.11 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.12 0.13 0.13 0.15 0.17 0.18 0.20 0.22 0.23 0.24 0.24 0.25 0.25 0.25 0.26 0.26 0.26 0.26 0.27 0.27 0.28 0.29 0.29 0.29 0.29 0.30 0.30 0.30 0.28 0.27 0.26 0.25 0.23 0.22 0.21 0.20 0.19 0.18 0.17 0.17 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.17 0.18 0.18 0.19 0.19 0.19 0.19 0.19 0.19 0.18 0.17 0.17 0.16 0.14 0.13 0.12 0.12 0.11 0.11 0.11 0.12 0.12 0.13 0.14 0.14 0.16 0.17 0.18 0.19 0.19 0.19 0.19 0.19 0.18 0.18 0.18 0.18 0.17 0.17 0.16 0.17 0.19 0.20 0.21 0.22 0.23 0.23 0.23 0.23 0.22 0.21 0.19 0.18 0.17 0.16 0.14 0.13 0.11 0.11 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.11 0.12 0.13 0.13 0.15 0.16 0.17 0.18 0.18 0.19 0.19 0.20 0.21 0.21 0.21 0.21 0.21 0.20 0.20 0.19 0.19 0.18 0.16 0.15 0.14 0.14 0.13 0.13 0.13 0.14 0.14 0.15 0.16 0.17 0.19 0.20 0.21 0.21 0.22 0.23 0.23 0.24 0.24 0.24 0.23 0.23 0.22 0.21 0.21 0.20 0.19 0.19 0.18 0.17 0.16 0.15 0.14 0.13 0.13 0.12 0.11 0.11 0.10 0.10 0.10 0.11 0.11 0.12 0.13 0.14 0.16 0.17 0.19 0.21 0.23 0.24 0.25 0.25 0.26 0.26 0.26 0.26 0.26 0.26 0.26 0.27 0.27 0.28 0.29 0.29 0.29 0.29 0.29 0.29 0.28 0.27 0.26 0.24 0.22 0.21 0.19 0.18 0.17 0.17 0.16 0.16 0.15 0.15 0.15 0.15 0.15 0.14 0.14 0.15 0.15 0.16 0.17 0.17 0.18 0.19 0.19 0.19 0.18 0.18 0.18 0.17 0.17 0.16 0.15 0.14 0.13 0.13 0.12 0.12 0.12 0.13 0.14 0.14 0.15 0.16 0.17 0.18 0.19 0.20 0.20 0.21 0.21 0.21 0.20 0.20 0.20 0.20 0.19 0.19 0.18 0.19 0.20 0.21 0.22 0.24 0.24 0.25 0.25 0.25 0.25 0.24 0.23 0.22 0.20 0.18 0.16 0.14 0.13 0.12 0.11 0.10 0.10 0.10 0.10 0.10 0.10 0.11 0.11 0.12 0.12 0.13 0.15 0.16 0.17 0.18 0.19 0.19 0.20 0.20 0.20 0.20 0.20 0.20 0.19 0.19 0.18 0.17 0.16 0.16 0.15 0.14 0.13 0.13 0.13 0.13 0.14 0.15 0.16 0.18 0.19 0.21 0.22 0.23 0.24 0.25 0.25 0.25 0.25 0.25 0.24 0.24 0.23 0.22 0.22 0.21 0.20 0.20 0.19 0.19 0.18 0.17 0.16 0.15 0.15 0.14 0.13 0.13 0.12 0.11 0.11 0.11 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.19 0.20 0.22 0.23 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.26 0.27 0.27 0.28 0.29 0.29 0.29 0.28 0.28 0.27 0.26 0.24 0.23 0.21 0.19 0.18 0.17 0.16 0.15 0.14 0.14 0.14 0.14 0.14 0.13 0.13 0.13 0.13 0.13 0.13 0.14 0.15 0.15 0.16 0.17 0.17 0.18 0.18 0.18 0.19 0.18 0.18 0.17 0.17 0.16 0.15 0.14 0.14 0.14 0.14 0.14 0.14 0.15 0.16 0.17 0.18 0.19 0.21 0.21 0.22 0.23 0.24 0.24 0.23 0.22 0.22 0.22 0.22 0.21 0.21 0.21 0.22 0.23 0.24 0.25 0.26 0.26 0.27 0.27 0.27 0.27 0.26 0.25 0.23 0.21 0.19 0.17 0.15 0.14 0.13 0.12 0.11 0.10 0.10 0.10 0.11 0.11 0.11 0.11 0.11 0.13 0.14 0.15 0.17 0.18 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.18 0.17 0.16 0.15 0.15 0.14 0.14 0.14 0.14 0.14 0.15 0.17 0.18 0.20 0.21 0.23 0.25 0.26 0.27 0.27 0.27 0.27 0.26 0.26 0.25 0.24 0.23 0.22 0.21 0.20 0.20 0.19 0.19 0.18 0.18 0.17 0.17 0.17 0.16 0.15 0.15 0.14 0.13 0.13 0.13 0.13 0.13 0.13 0.14 0.15 0.15 0.16 0.17 0.18 0.19 0.21 0.22 0.23 0.23 0.24 0.24 0.24 0.23 0.23 0.24 0.24 0.24 0.25 0.26 0.26 0.27 0.28 0.28 0.28 0.27 0.26 0.25 0.23 0.22 0.21 0.19 0.18 0.17 0.15 0.14 0.13 0.13 0.13 0.12 0.12 0.11 0.11 0.11 0.11 0.11 0.11 0.12 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.20 0.20 0.20 0.20 0.19 0.19 0.17 0.16 0.15 0.15 0.15 0.15 0.15 0.16 0.17 0.19 0.20 0.21 0.23 0.24 0.25 0.26 0.26 0.26 0.25 0.25 0.25 0.25 0.25 0.24 0.23 0.24 0.24 0.25 0.26 0.27 0.27 0.28 0.29 0.29 0.30 0.29 0.28 0.27 0.25 0.23 0.21 0.19 0.18 0.16 0.15 0.14 0.12 0.12 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.13 0.14 0.15 0.16 0.18 0.18 0.19 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.19 0.18 0.17 0.16 0.16 0.15 0.15 0.15 0.15 0.15 0.15 0.17 0.19 0.21 0.23 0.25 0.26 0.28 0.29 0.29 0.30 0.29 0.28 0.28 0.27 0.26 0.24 0.22 0.21 0.20 0.19 0.18 0.18 0.17 0.17 0.18 0.18 0.18 0.18 0.17 0.17 0.16 0.16 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.16 0.16 0.16 0.17 0.18 0.19 0.19 0.19 0.20 0.20 0.21 0.20 0.20 0.20 0.20 0.21 0.22 0.22 0.23 0.25 0.26 0.27 0.29 0.29 0.27 0.26 0.25 0.23 0.22 0.21 0.19 0.18 0.16 0.14 0.14 0.13 0.12 0.12 0.11 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.11 0.12 0.13 0.15 0.16 0.17 0.19 0.20 0.21 0.22 0.22 0.22 0.22 0.21 0.20 0.19 0.18 0.17 0.16 0.17 0.18 0.19 0.20 0.21 0.23 0.25 0.26 0.27 0.28 0.28 0.28 0.27 0.27 0.26 0.27 0.27 0.27 0.27 0.26 0.26 0.26 0.27 0.28 0.29 0.30 0.31 0.31 0.31 0.31 0.30 0.30 0.29 0.27 0.26 0.24 0.22 0.20 0.18 0.16 0.15 0.14 0.13 0.12 0.11 0.11 0.10 0.10 0.11 0.11 0.13 0.14 0.15 0.16 0.16 0.18 0.19 0.20 0.20 0.21 0.21 0.21 0.21 0.20 0.19 0.19 0.18 0.18 0.17 0.16 0.16 0.16 0.16 0.16 0.16 0.18 0.20 0.22 0.24 0.26 0.28 0.30 0.31 0.31 0.31 0.30 0.30 0.29 0.27 0.26 0.24 0.22 0.20 0.18 0.16 0.16 0.15 0.15 0.16 0.16 0.17 0.18 0.18 0.19 0.19 0.19 0.18 0.18 0.18 0.18 0.17 0.15 0.15 0.16 0.16 0.16 0.16 0.15 0.15 0.16 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.18 0.19 0.20 0.21 0.22 0.24 0.26 0.27 0.29 0.29 0.28 0.27 0.26 0.25 0.23 0.21 0.19 0.18 0.17 0.15 0.14 0.13 0.12 0.12 0.11 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.11 0.12 0.13 0.15 0.16 0.18 0.20 0.21 0.22 0.24 0.24 0.25 0.25 0.24 0.24 0.22 0.21 0.20 0.19 0.19 0.19 0.19 0.20 0.21 0.22 0.24 0.26 0.28 0.29 0.30 0.30 0.30 0.30 0.29 0.29 0.28 0.28 0.28 0.27 0.27 0.28 0.28 0.29 0.30 0.31 0.31 0.32 0.32 0.32 0.32 0.31 0.30 0.29 0.27 0.26 0.24 0.22 0.20 0.18 0.16 0.15 0.14 0.13 0.12 0.11 0.11 0.10 0.10 0.10 0.10 0.11 0.13 0.14 0.15 0.16 0.18 0.19 0.20 0.21 0.22 0.22 0.22 0.22 0.22 0.22 0.21 0.20 0.19 0.18 0.18 0.17 0.16 0.16 0.17 0.18 0.19 0.21 0.24 0.26 0.29 0.30 0.31 0.32 0.32 0.32 0.31 0.30 0.28 0.26 0.25 0.23 0.21 0.19 0.17 0.15 0.14 0.14 0.14 0.14 0.15 0.16 0.17 0.18 0.20 0.21 0.21 0.21 0.20 0.20 0.19 0.18 0.18 0.17 0.17 0.16 0.17 0.16 0.15 0.15 0.15 0.15 0.15 0.14 0.14 0.14 0.14 0.14 0.14 0.15 0.15 0.16 0.18 0.19 0.21 0.24 0.26 0.27 0.29 0.29 0.29 0.29 0.27 0.25 0.23 0.21 0.19 0.18 0.17 0.16 0.14 0.13 0.12 0.12 0.11 0.10 0.10 0.10 0.10 0.10 0.10 0.11 0.12 0.13 0.15 0.16 0.18 0.20 0.21 0.23 0.25 0.26 0.27 0.28 0.28 0.27 0.26 0.25 0.24 0.23 0.21 0.20 0.20 0.20 0.21 0.22 0.24 0.25 0.27 0.28 0.30 0.31 0.31 0.31 0.31 0.30 0.29 0.29 0.29 0.29 0.29 0.29 0.29 0.30 0.31 0.32 0.33 0.33 0.33 0.33 0.33 0.32 0.31 0.30 0.29 0.27 0.26 0.24 0.23 0.21 0.19 0.17 0.16 0.14 0.13 0.12 0.11 0.11 0.11 0.11 0.10 0.10 0.11 0.12 0.14 0.15 0.16 0.18 0.20 0.21 0.22 0.24 0.24 0.24 0.24 0.24 0.23 0.22 0.21 0.20 0.19 0.18 0.17 0.17 0.17 0.17 0.18 0.20 0.22 0.24 0.27 0.29 0.31 0.32 0.32 0.32 0.32 0.31 0.30 0.28 0.26 0.24 0.22 0.20 0.19 0.17 0.15 0.14 0.13 0.12 0.13 0.14 0.15 0.17 0.19 0.20 0.22 0.22 0.23 0.23 0.22 0.21 0.20 0.19 0.19 0.18 0.17 0.19 0.17 0.15 0.14 0.14 0.14 0.13 0.13 0.12 0.12 0.12 0.12 0.12 0.13 0.13 0.14 0.16 0.18 0.21 0.23 0.25 0.27 0.28 0.29 0.29 0.29 0.28 0.26 0.24 0.22 0.20 0.19 0.17 0.16 0.14 0.13 0.12 0.12 0.11 0.10 0.10 0.10 0.10 0.10 0.11 0.11 0.13 0.14 0.16 0.18 0.19 0.21 0.23 0.25 0.27 0.28 0.29 0.30 0.30 0.29 0.28 0.27 0.25 0.24 0.22 0.21 0.21 0.21 0.21 0.22 0.24 0.25 0.27 0.28 0.30 0.31 0.31 0.31 0.31 0.31 0.30 0.30 0.30 0.30 0.30 0.30 0.31 0.31 0.32 0.33 0.35 0.35 0.35 0.35 0.34 0.33 0.32 0.31 0.29 0.28 0.26 0.25 0.24 0.22 0.20 0.19 0.17 0.15 0.14 0.13 0.11 0.11 0.11 0.11 0.11 0.11 0.12 0.12 0.13 0.14 0.16 0.18 0.20 0.22 0.23 0.25 0.25 0.26 0.25 0.24 0.23 0.22 0.22 0.21 0.20 0.19 0.18 0.17 0.17 0.17 0.18 0.20 0.22 0.24 0.26 0.29 0.30 0.31 0.32 0.32 0.32 0.31 0.30 0.28 0.26 0.24 0.22 0.20 0.19 0.17 0.15 0.14 0.13 0.13 0.13 0.14 0.16 0.18 0.19 0.21 0.23 0.24 0.25 0.25 0.24 0.24 0.23 0.21 0.20 0.19 0.19 0.20 0.18 0.16 0.15 0.14 0.13 0.13 0.12 0.11 0.11 0.11 0.11 0.11 0.11 0.12 0.13 0.15 0.18 0.20 0.22 0.24 0.25 0.27 0.28 0.28 0.29 0.28 0.26 0.25 0.23 0.21 0.19 0.17 0.16 0.14 0.13 0.12 0.12 0.11 0.10 0.10 0.10 0.10 0.10 0.11 0.11 0.13 0.14 0.16 0.18 0.20 0.22 0.25 0.27 0.28 0.29 0.30 0.30 0.30 0.30 0.29 0.27 0.25 0.23 0.22 0.21 0.20 0.19 0.20 0.21 0.22 0.24 0.26 0.28 0.29 0.31 0.32 0.32 0.33 0.32 0.32 0.32 0.32 0.32 0.32 0.32 0.33 0.33 0.34 0.35 0.36 0.36 0.37 0.37 0.36 0.35 0.33 0.32 0.31 0.29 0.27 0.26 0.25 0.24 0.22 0.20 0.19 0.18 0.16 0.14 0.12 0.11 0.10 0.10 0.12 0.13 0.12 0.12 0.12 0.13 0.15 0.17 0.20 0.22 0.24 0.26 0.26 0.26 0.26 0.25 0.24 0.23 0.22 0.21 0.20 0.19 0.18 0.17 0.17 0.18 0.18 0.20 0.22 0.24 0.26 0.28 0.29 0.30 0.31 0.32 0.32 0.31 0.30 0.28 0.26 0.25 0.23 0.21 0.19 0.18 0.17 0.16 0.15 0.15 0.15 0.15 0.17 0.19 0.20 0.22 0.24 0.25 0.26 0.26 0.26 0.26 0.25 0.24 0.23 0.21 0.20 0.21 0.19 0.17 0.16 0.15 0.15 0.13 0.12 0.11 0.10 0.10 0.10 0.10 0.10 0.12 0.13 0.15 0.17 0.19 0.21 0.23 0.25 0.27 0.28 0.28 0.28 0.26 0.25 0.23 0.21 0.19 0.18 0.17 0.16 0.14 0.13 0.12 0.12 0.11 0.10 0.10 0.10 0.10 0.10 0.11 0.11 0.13 0.15 0.17 0.19 0.21 0.24 0.26 0.28 0.29 0.29 0.29 0.29 0.29 0.28 0.28 0.26 0.24 0.22 0.21 0.19 0.19 0.18 0.19 0.20 0.21 0.23 0.25 0.27 0.29 0.31 0.32 0.33 0.34 0.35 0.36 0.36 0.37 0.37 0.37 0.37 0.37 0.36 0.36 0.36 0.36 0.36 0.37 0.37 0.37 0.37 0.36 0.35 0.33 0.31 0.29 0.28 0.27 0.26 0.25 0.24 0.23 0.22 0.20 0.18 0.16 0.14 0.11 0.10 0.12 0.13 0.13 0.13 0.13 0.14 0.15 0.17 0.20 0.22 0.24 0.26 0.27 0.27 0.27 0.26 0.24 0.23 0.22 0.21 0.20 0.19 0.19 0.18 0.18 0.19 0.19 0.21 0.23 0.25 0.26 0.28 0.29 0.30 0.31 0.31 0.31 0.30 0.30 0.29 0.27 0.26 0.25 0.23 0.22 0.21 0.19 0.18 0.17 0.16 0.16 0.16 0.18 0.19 0.20 0.22 0.24 0.26 0.27 0.28 0.28 0.28 0.27 0.26 0.25 0.23 0.21 0.24 0.22 0.20 0.18 0.17 0.16 0.15 0.13 0.12 0.11 0.10 0.10 0.10 0.10 0.12 0.13 0.15 0.17 0.19 0.20 0.21 0.23 0.24 0.25 0.25 0.25 0.24 0.23 0.22 0.20 0.18 0.17 0.16 0.14 0.13 0.12 0.11 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.11 0.13 0.15 0.18 0.20 0.22 0.24 0.25 0.27 0.28 0.28 0.28 0.28 0.28 0.27 0.26 0.25 0.24 0.22 0.21 0.19 0.18 0.18 0.17 0.17 0.19 0.20 0.22 0.25 0.27 0.29 0.31 0.33 0.36 0.37 0.38 0.40 0.41 0.43 0.44 0.45 0.45 0.44 0.43 0.42 0.41 0.41 0.42 0.42 0.42 0.42 0.41 0.40 0.39 0.37 0.35 0.33 0.32 0.31 0.30 0.29 0.28 0.27 0.27 0.26 0.25 0.24 0.19 0.15 0.11 0.10 0.08 0.09 0.10 0.11 0.13 0.15 0.17 0.20 0.22 0.25 0.27 0.27 0.28 0.27 0.26 0.24 0.24 0.23 0.22 0.21 0.19 0.19 0.18 0.18 0.19 0.19 0.21 0.22 0.24 0.25 0.26 0.28 0.29 0.30 0.30 0.31 0.30 0.30 0.29 0.28 0.27 0.26 0.25 0.23 0.22 0.21 0.20 0.19 0.18 0.17 0.16 0.18 0.19 0.20 0.22 0.24 0.26 0.27 0.28 0.28 0.29 0.29 0.29 0.28 0.26 0.24 0.25 0.24 0.22 0.21 0.19 0.17 0.16 0.15 0.13 0.12 0.11 0.11 0.11 0.11 0.12 0.13 0.15 0.16 0.18 0.19 0.20 0.21 0.22 0.22 0.22 0.22 0.22 0.21 0.20 0.18 0.17 0.15 0.14 0.12 0.11 0.10 0.10 0.09 0.09 0.09 0.10 0.11 0.11 0.12 0.14 0.15 0.18 0.20 0.22 0.23 0.24 0.25 0.25 0.26 0.26 0.26 0.25 0.25 0.24 0.23 0.22 0.21 0.20 0.19 0.18 0.17 0.16 0.16 0.16 0.18 0.19 0.22 0.25 0.28 0.30 0.33 0.35 0.38 0.40 0.42 0.44 0.47 0.50 0.52 0.53 0.54 0.53 0.51 0.50 0.49 0.48 0.48 0.48 0.48 0.47 0.47 0.45 0.43 0.41 0.40 0.38 0.37 0.36 0.36 0.35 0.35 0.34 0.32 0.31 0.29 0.27 0.21 0.16 0.11 0.07 0.04 0.05 0.06 0.08 0.11 0.14 0.17 0.20 0.22 0.24 0.27 0.27 0.27 0.27 0.26 0.24 0.24 0.23 0.22 0.21 0.19 0.19 0.18 0.18 0.18 0.19 0.19 0.20 0.22 0.23 0.25 0.26 0.28 0.29 0.30 0.31 0.31 0.30 0.30 0.30 0.30 0.28 0.27 0.26 0.24 0.23 0.22 0.21 0.20 0.19 0.17 0.18 0.19 0.20 0.22 0.23 0.25 0.27 0.28 0.29 0.29 0.29 0.29 0.28 0.27 0.25 0.26 0.25 0.23 0.22 0.20 0.19 0.17 0.16 0.15 0.13 0.12 0.12 0.11 0.12 0.12 0.12 0.13 0.14 0.16 0.17 0.18 0.19 0.19 0.20 0.20 0.20 0.19 0.19 0.18 0.16 0.15 0.13 0.12 0.10 0.10 0.09 0.09 0.09 0.09 0.10 0.10 0.12 0.14 0.15 0.17 0.18 0.20 0.22 0.24 0.24 0.24 0.24 0.24 0.23 0.23 0.22 0.22 0.21 0.21 0.20 0.20 0.19 0.18 0.17 0.16 0.16 0.15 0.15 0.16 0.18 0.20 0.24 0.27 0.30 0.33 0.35 0.38 0.41 0.44 0.46 0.48 0.51 0.55 0.57 0.59 0.60 0.59 0.58 0.57 0.56 0.55 0.54 0.53 0.52 0.52 0.51 0.49 0.47 0.46 0.44 0.43 0.43 0.42 0.42 0.42 0.42 0.40 0.38 0.36 0.33 0.30 0.25 0.19 0.14 0.09 0.04 0.05 0.06 0.08 0.11 0.14 0.17 0.20 0.22 0.24 0.26 0.26 0.27 0.27 0.26 0.25 0.24 0.23 0.22 0.21 0.19 0.19 0.18 0.18 0.18 0.18 0.19 0.19 0.20 0.22 0.23 0.24 0.26 0.27 0.29 0.30 0.30 0.31 0.31 0.31 0.32 0.30 0.29 0.28 0.27 0.26 0.24 0.23 0.21 0.20 0.19 0.19 0.20 0.21 0.22 0.23 0.24 0.26 0.27 0.28 0.29 0.29 0.29 0.28 0.27 0.26 0.26 0.24 0.23 0.22 0.21 0.19 0.18 0.17 0.16 0.14 0.13 0.13 0.12 0.12 0.11 0.11 0.12 0.12 0.13 0.14 0.16 0.16 0.17 0.17 0.17 0.17 0.17 0.16 0.15 0.14 0.12 0.11 0.10 0.09 0.08 0.08 0.08 0.09 0.10 0.11 0.12 0.14 0.16 0.18 0.20 0.21 0.23 0.24 0.24 0.24 0.24 0.23 0.22 0.21 0.20 0.19 0.18 0.17 0.17 0.17 0.17 0.17 0.16 0.16 0.15 0.15 0.15 0.15 0.16 0.19 0.21 0.25 0.29 0.33 0.35 0.38 0.41 0.44 0.47 0.50 0.52 0.55 0.57 0.59 0.61 0.64 0.63 0.63 0.62 0.62 0.61 0.59 0.57 0.55 0.54 0.52 0.52 0.51 0.50 0.49 0.48 0.48 0.48 0.48 0.48 0.48 0.46 0.44 0.42 0.39 0.36 0.31 0.26 0.21 0.15 0.10 0.10 0.10 0.11 0.13 0.16 0.18 0.21 0.23 0.24 0.26 0.26 0.26 0.26 0.26 0.26 0.24 0.23 0.22 0.21 0.19 0.19 0.18 0.18 0.18 0.18 0.18 0.19 0.19 0.20 0.21 0.22 0.23 0.25 0.27 0.29 0.30 0.30 0.31 0.32 0.32 0.32 0.31 0.31 0.29 0.28 0.26 0.24 0.22 0.21 0.20 0.21 0.21 0.22 0.22 0.23 0.24 0.25 0.26 0.26 0.27 0.27 0.27 0.27 0.26 0.26 0.24 0.24 0.23 0.22 0.21 0.19 0.18 0.17 0.16 0.15 0.15 0.14 0.13 0.13 0.12 0.11 0.11 0.11 0.12 0.12 0.13 0.14 0.14 0.15 0.15 0.15 0.15 0.15 0.14 0.12 0.10 0.09 0.08 0.08 0.07 0.06 0.07 0.08 0.09 0.11 0.13 0.16 0.18 0.20 0.21 0.23 0.23 0.24 0.24 0.23 0.23 0.21 0.19 0.17 0.16 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.16 0.18 0.20 0.23 0.27 0.32 0.35 0.38 0.41 0.43 0.46 0.48 0.51 0.54 0.55 0.56 0.58 0.62 0.65 0.66 0.66 0.66 0.65 0.63 0.61 0.59 0.57 0.56 0.54 0.54 0.54 0.54 0.54 0.54 0.54 0.54 0.54 0.54 0.54 0.52 0.50 0.48 0.46 0.44 0.39 0.33 0.29 0.24 0.19 0.18 0.17 0.17 0.18 0.19 0.21 0.23 0.25 0.25 0.26 0.26 0.26 0.26 0.25 0.24 0.24 0.23 0.22 0.21 0.19 0.19 0.18 0.18 0.17 0.16 0.16 0.16 0.17 0.18 0.19 0.21 0.22 0.24 0.26 0.28 0.29 0.30 0.31 0.32 0.32 0.32 0.32 0.32 0.31 0.29 0.27 0.25 0.24 0.23 0.23 0.23 0.23 0.23 0.23 0.23 0.23 0.23 0.23 0.24 0.24 0.24 0.24 0.24 0.24 0.24 0.23 0.22 0.22 0.21 0.20 0.19 0.18 0.17 0.16 0.15 0.15 0.13 0.12 0.11 0.11 0.10 0.10 0.10 0.10 0.10 0.10 0.11 0.12 0.12 0.13 0.13 0.13 0.12 0.11 0.10 0.08 0.07 0.06 0.06 0.06 0.06 0.08 0.09 0.10 0.12 0.14 0.17 0.19 0.21 0.22 0.23 0.23 0.23 0.22 0.21 0.20 0.18 0.16 0.15 0.13 0.12 0.12 0.12 0.12 0.13 0.13 0.14 0.14 0.15 0.15 0.15 0.15 0.16 0.18 0.21 0.24 0.28 0.32 0.36 0.39 0.42 0.44 0.47 0.49 0.51 0.52 0.53 0.53 0.54 0.57 0.60 0.62 0.64 0.65 0.65 0.65 0.63 0.61 0.59 0.58 0.57 0.56 0.55 0.55 0.55 0.55 0.55 0.55 0.55 0.55 0.55 0.53 0.51 0.49 0.47 0.45 0.41 0.37 0.33 0.29 0.25 0.24 0.23 0.23 0.23 0.23 0.25 0.26 0.27 0.26 0.26 0.25 0.24 0.23 0.22 0.22 0.21 0.20 0.20 0.20 0.19 0.19 0.18 0.18 0.17 0.16 0.16 0.16 0.17 0.17 0.18 0.19 0.21 0.22 0.24 0.26 0.28 0.30 0.31 0.33 0.34 0.34 0.34 0.33 0.32 0.31 0.29 0.28 0.27 0.26 0.25 0.25 0.25 0.25 0.25 0.24 0.24 0.24 0.24 0.23 0.23 0.23 0.23 0.23 0.23 0.23 0.22 0.21 0.21 0.21 0.20 0.19 0.18 0.17 0.16 0.15 0.15 0.13 0.12 0.11 0.10 0.10 0.09 0.09 0.09 0.09 0.09 0.10 0.11 0.12 0.12 0.13 0.12 0.12 0.11 0.09 0.07 0.06 0.05 0.05 0.05 0.06 0.07 0.09 0.11 0.13 0.16 0.18 0.20 0.21 0.22 0.23 0.22 0.22 0.21 0.19 0.18 0.16 0.14 0.12 0.11 0.10 0.11 0.11 0.12 0.12 0.13 0.14 0.14 0.15 0.15 0.15 0.15 0.16 0.18 0.21 0.24 0.28 0.31 0.35 0.39 0.42 0.45 0.47 0.49 0.49 0.50 0.49 0.48 0.49 0.50 0.52 0.55 0.58 0.59 0.60 0.60 0.60 0.59 0.59 0.59 0.59 0.59 0.58 0.57 0.57 0.56 0.57 0.57 0.57 0.56 0.55 0.54 0.52 0.50 0.48 0.46 0.43 0.39 0.36 0.32 0.28 0.27 0.26 0.26 0.26 0.26 0.27 0.28 0.28 0.27 0.26 0.24 0.23 0.21 0.20 0.19 0.19 0.18 0.18 0.18 0.19 0.18 0.17 0.17 0.16 0.16 0.16 0.15 0.16 0.16 0.17 0.19 0.20 0.22 0.25 0.27 0.29 0.32 0.33 0.35 0.36 0.36 0.36 0.35 0.34 0.33 0.32 0.30 0.29 0.29 0.28 0.28 0.28 0.28 0.28 0.27 0.27 0.26 0.26 0.25 0.24 0.23 0.23 0.23 0.22 0.22 0.22 0.21 0.21 0.21 0.20 0.19 0.18 0.17 0.16 0.15 0.14 0.13 0.12 0.11 0.10 0.09 0.09 0.08 0.08 0.09 0.09 0.11 0.12 0.13 0.14 0.14 0.14 0.13 0.12 0.10 0.08 0.07 0.05 0.05 0.05 0.06 0.07 0.09 0.12 0.14 0.17 0.19 0.21 0.22 0.22 0.23 0.22 0.21 0.19 0.18 0.16 0.14 0.12 0.11 0.10 0.10 0.11 0.12 0.12 0.13 0.14 0.15 0.16 0.16 0.16 0.16 0.16 0.17 0.18 0.21 0.23 0.27 0.30 0.34 0.38 0.42 0.44 0.47 0.48 0.48 0.47 0.46 0.44 0.44 0.44 0.44 0.46 0.48 0.50 0.50 0.51 0.52 0.53 0.55 0.56 0.57 0.57 0.57 0.57 0.57 0.57 0.57 0.58 0.58 0.57 0.57 0.55 0.53 0.52 0.49 0.47 0.44 0.40 0.37 0.33 0.29 0.27 0.26 0.25 0.26 0.27 0.28 0.28 0.28 0.27 0.25 0.23 0.21 0.20 0.19 0.17 0.17 0.16 0.16 0.17 0.17 0.17 0.16 0.16 0.16 0.16 0.16 0.15 0.16 0.16 0.17 0.19 0.21 0.24 0.27 0.30 0.32 0.34 0.36 0.37 0.39 0.39 0.39 0.38 0.37 0.36 0.35 0.34 0.33 0.32 0.32 0.32 0.31 0.31 0.31 0.31 0.31 0.30 0.29 0.28 0.26 0.25 0.24 0.23 0.22 0.22 0.23 0.22 0.22 0.21 0.20 0.20 0.19 0.17 0.16 0.14 0.13 0.12 0.11 0.11 0.09 0.08 0.09 0.09 0.10 0.11 0.13 0.14 0.16 0.17 0.17 0.18 0.17 0.16 0.15 0.13 0.11 0.09 0.07 0.06 0.07 0.07 0.09 0.11 0.13 0.16 0.18 0.20 0.22 0.23 0.23 0.23 0.21 0.20 0.19 0.17 0.15 0.14 0.13 0.12 0.11 0.11 0.12 0.13 0.15 0.16 0.17 0.18 0.19 0.19 0.19 0.19 0.18 0.18 0.19 0.20 0.21 0.25 0.29 0.32 0.36 0.40 0.43 0.45 0.46 0.46 0.45 0.43 0.41 0.40 0.39 0.38 0.38 0.38 0.39 0.39 0.39 0.41 0.43 0.45 0.48 0.51 0.52 0.53 0.54 0.55 0.56 0.56 0.56 0.57 0.57 0.58 0.56 0.55 0.53 0.50 0.47 0.44 0.40 0.36 0.33 0.29 0.26 0.24 0.23 0.24 0.25 0.25 0.26 0.26 0.25 0.24 0.22 0.20 0.19 0.17 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.17 0.18 0.19 0.21 0.24 0.27 0.30 0.33 0.35 0.36 0.38 0.39 0.41 0.41 0.41 0.41 0.40 0.40 0.39 0.39 0.38 0.37 0.37 0.36 0.35 0.35 0.35 0.35 0.34 0.33 0.32 0.31 0.30 0.28 0.26 0.25 0.24 0.23 0.24 0.24 0.23 0.22 0.22 0.21 0.20 0.19 0.17 0.15 0.13 0.12 0.10 0.10 0.10 0.10 0.11 0.12 0.14 0.16 0.18 0.20 0.22 0.23 0.24 0.24 0.23 0.22 0.20 0.17 0.15 0.13 0.11 0.10 0.10 0.10 0.12 0.14 0.16 0.18 0.19 0.21 0.22 0.23 0.23 0.23 0.21 0.20 0.19 0.17 0.15 0.15 0.15 0.15 0.15 0.15 0.16 0.17 0.19 0.20 0.21 0.22 0.22 0.22 0.22 0.21 0.20 0.19 0.19 0.20 0.21 0.24 0.28 0.31 0.35 0.39 0.42 0.44 0.45 0.44 0.44 0.41 0.39 0.37 0.35 0.34 0.32 0.30 0.29 0.28 0.28 0.29 0.30 0.32 0.36 0.39 0.42 0.45 0.48 0.49 0.50 0.52 0.53 0.54 0.56 0.57 0.56 0.56 0.54 0.51 0.49 0.45 0.42 0.38 0.34 0.29 0.25 0.21 0.19 0.19 0.19 0.21 0.22 0.23 0.23 0.23 0.21 0.19 0.18 0.17 0.16 0.16 0.16 0.16 0.16 0.16 0.17 0.18 0.18 0.17 0.16 0.17 0.18 0.19 0.20 0.21 0.24 0.26 0.29 0.32 0.34 0.35 0.37 0.38 0.40 0.42 0.43 0.44 0.44 0.44 0.44 0.43 0.43 0.42 0.41 0.41 0.40 0.39 0.39 0.38 0.37 0.37 0.36 0.35 0.34 0.32 0.31 0.29 0.27 0.26 0.24 0.26 0.25 0.24 0.23 0.22 0.21 0.20 0.19 0.17 0.15 0.13 0.12 0.11 0.12 0.13 0.14 0.15 0.17 0.19 0.22 0.24 0.26 0.28 0.30 0.30 0.31 0.29 0.27 0.25 0.22 0.19 0.17 0.15 0.14 0.14 0.14 0.15 0.16 0.18 0.20 0.22 0.23 0.24 0.24 0.23 0.23 0.21 0.20 0.19 0.18 0.17 0.17 0.17 0.18 0.19 0.20 0.21 0.22 0.24 0.25 0.26 0.26 0.26 0.25 0.24 0.22 0.21 0.20 0.20 0.20 0.21 0.24 0.27 0.30 0.34 0.38 0.40 0.43 0.44 0.44 0.44 0.41 0.39 0.36 0.35 0.33 0.31 0.29 0.27 0.25 0.22 0.22 0.21 0.22 0.24 0.26 0.29 0.32 0.35 0.38 0.40 0.43 0.46 0.48 0.51 0.53 0.53 0.54 0.53 0.52 0.50 0.47 0.45 0.41 0.36 0.32 0.27 0.22 0.19 0.17 0.16 0.17 0.18 0.19 0.20 0.20 0.19 0.18 0.18 0.17 0.16 0.16 0.16 0.16 0.17 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.19 0.20 0.21 0.22 0.25 0.28 0.30 0.33 0.35 0.36 0.37 0.38 0.40 0.42 0.43 0.45 0.45 0.46 0.46 0.46 0.46 0.46 0.45 0.44 0.44 0.43 0.42 0.41 0.40 0.39 0.38 0.37 0.36 0.35 0.33 0.31 0.29 0.27 0.26 0.27 0.26 0.25 0.24 0.23 0.22 0.20 0.19 0.17 0.16 0.14 0.14 0.13 0.14 0.16 0.18 0.20 0.22 0.25 0.28 0.31 0.33 0.35 0.36 0.36 0.35 0.33 0.32 0.29 0.26 0.22 0.20 0.18 0.17 0.17 0.17 0.17 0.18 0.20 0.22 0.24 0.24 0.24 0.24 0.23 0.23 0.21 0.20 0.20 0.20 0.20 0.21 0.21 0.22 0.24 0.25 0.26 0.28 0.29 0.30 0.31 0.30 0.29 0.28 0.26 0.25 0.23 0.21 0.21 0.21 0.22 0.25 0.27 0.30 0.34 0.37 0.40 0.42 0.43 0.43 0.44 0.42 0.40 0.38 0.36 0.33 0.32 0.30 0.27 0.25 0.22 0.20 0.17 0.16 0.16 0.16 0.19 0.22 0.24 0.26 0.29 0.32 0.36 0.39 0.43 0.46 0.48 0.50 0.50 0.50 0.49 0.48 0.46 0.43 0.39 0.34 0.29 0.24 0.20 0.17 0.15 0.15 0.16 0.16 0.17 0.19 0.18 0.17 0.17 0.16 0.16 0.16 0.16 0.17 0.17 0.18 0.18 0.18 0.18 0.18 0.18 0.19 0.19 0.21 0.23 0.25 0.28 0.31 0.33 0.35 0.37 0.37 0.37 0.38 0.40 0.42 0.44 0.45 0.46 0.46 0.47 0.47 0.47 0.47 0.47 0.46 0.45 0.44 0.43 0.42 0.42 0.40 0.39 0.38 0.37 0.37 0.35 0.33 0.31 0.29 0.27 0.28 0.27 0.26 0.25 0.24 0.23 0.22 0.20 0.19 0.17 0.16 0.16 0.16 0.17 0.19 0.21 0.24 0.27 0.30 0.33 0.36 0.38 0.39 0.40 0.39 0.39 0.36 0.34 0.32 0.29 0.26 0.23 0.20 0.19 0.19 0.19 0.19 0.20 0.22 0.23 0.25 0.25 0.25 0.25 0.24 0.23 0.21 0.20 0.20 0.21 0.22 0.23 0.25 0.26 0.28 0.30 0.31 0.32 0.33 0.33 0.34 0.33 0.32 0.31 0.29 0.27 0.26 0.24 0.23 0.23 0.23 0.26 0.29 0.31 0.34 0.37 0.39 0.41 0.43 0.44 0.44 0.43 0.41 0.39 0.37 0.35 0.33 0.30 0.28 0.25 0.23 0.20 0.17 0.15 0.14 0.13 0.14 0.15 0.16 0.18 0.19 0.22 0.26 0.29 0.34 0.38 0.41 0.44 0.46 0.46 0.47 0.46 0.45 0.43 0.39 0.36 0.31 0.26 0.23 0.20 0.17 0.16 0.15 0.15 0.16 0.17 0.16 0.15 0.15 0.15 0.16 0.16 0.16 0.16 0.17 0.17 0.17 0.18 0.18 0.18 0.18 0.19 0.20 0.22 0.25 0.28 0.31 0.34 0.36 0.36 0.37 0.37 0.37 0.38 0.39 0.41 0.42 0.44 0.45 0.46 0.46 0.47 0.47 0.47 0.47 0.47 0.46 0.45 0.44 0.43 0.42 0.41 0.40 0.39 0.38 0.37 0.35 0.33 0.32 0.30 0.28 0.28 0.27 0.27 0.26 0.25 0.25 0.23 0.22 0.21 0.19 0.18 0.18 0.18 0.20 0.22 0.25 0.28 0.32 0.34 0.37 0.39 0.40 0.42 0.42 0.41 0.40 0.38 0.35 0.33 0.30 0.28 0.25 0.22 0.21 0.20 0.20 0.21 0.22 0.23 0.25 0.26 0.26 0.26 0.25 0.24 0.22 0.21 0.20 0.20 0.22 0.23 0.25 0.27 0.29 0.31 0.33 0.34 0.35 0.36 0.36 0.36 0.35 0.35 0.34 0.33 0.31 0.30 0.28 0.27 0.26 0.25 0.28 0.30 0.32 0.35 0.38 0.40 0.42 0.43 0.44 0.45 0.44 0.42 0.40 0.38 0.36 0.33 0.30 0.28 0.25 0.22 0.21 0.19 0.18 0.17 0.17 0.16 0.15 0.14 0.14 0.14 0.16 0.18 0.21 0.26 0.31 0.34 0.37 0.40 0.41 0.42 0.42 0.42 0.41 0.38 0.35 0.31 0.28 0.25 0.22 0.20 0.18 0.16 0.15 0.16 0.16 0.15 0.14 0.14 0.14 0.15 0.15 0.16 0.16 0.16 0.17 0.17 0.18 0.18 0.18 0.18 0.19 0.21 0.23 0.27 0.31 0.33 0.36 0.36 0.36 0.35 0.35 0.35 0.36 0.37 0.38 0.40 0.41 0.43 0.44 0.45 0.46 0.47 0.47 0.47 0.47 0.47 0.46 0.45 0.44 0.43 0.42 0.41 0.40 0.39 0.37 0.35 0.33 0.32 0.30 0.28 0.29 0.29 0.28 0.27 0.27 0.26 0.25 0.23 0.22 0.21 0.19 0.20 0.21 0.22 0.25 0.28 0.31 0.34 0.37 0.39 0.41 0.41 0.42 0.42 0.40 0.39 0.37 0.35 0.33 0.30 0.28 0.25 0.22 0.21 0.21 0.21 0.22 0.22 0.23 0.25 0.26 0.26 0.26 0.25 0.23 0.21 0.21 0.21 0.22 0.23 0.24 0.27 0.30 0.32 0.34 0.36 0.36 0.37 0.37 0.36 0.36 0.37 0.38 0.39 0.39 0.39 0.36 0.34 0.32 0.31 0.29 0.31 0.32 0.34 0.36 0.39 0.41 0.43 0.44 0.45 0.45 0.44 0.43 0.41 0.38 0.36 0.32 0.29 0.26 0.24 0.21 0.20 0.19 0.18 0.19 0.19 0.19 0.18 0.18 0.18 0.18 0.17 0.17 0.18 0.21 0.24 0.28 0.31 0.33 0.34 0.36 0.36 0.36 0.35 0.34 0.32 0.30 0.27 0.25 0.23 0.21 0.20 0.19 0.18 0.17 0.16 0.16 0.15 0.15 0.15 0.15 0.15 0.16 0.17 0.17 0.18 0.18 0.18 0.18 0.18 0.18 0.20 0.22 0.25 0.29 0.32 0.33 0.34 0.34 0.33 0.32 0.32 0.32 0.33 0.34 0.36 0.38 0.40 0.42 0.44 0.45 0.46 0.47 0.47 0.48 0.49 0.48 0.47 0.46 0.45 0.44 0.43 0.41 0.40 0.39 0.37 0.35 0.33 0.32 0.31 0.29 0.29 0.29 0.28 0.27 0.27 0.26 0.25 0.23 0.22 0.22 0.21 0.21 0.22 0.24 0.26 0.29 0.32 0.34 0.36 0.38 0.39 0.39 0.40 0.39 0.38 0.36 0.34 0.32 0.30 0.28 0.26 0.25 0.23 0.22 0.22 0.21 0.22 0.23 0.24 0.25 0.26 0.26 0.26 0.25 0.24 0.22 0.22 0.21 0.22 0.24 0.26 0.28 0.31 0.33 0.34 0.36 0.36 0.36 0.35 0.34 0.33 0.35 0.37 0.39 0.41 0.43 0.40 0.38 0.36 0.34 0.33 0.33 0.34 0.35 0.37 0.39 0.41 0.43 0.44 0.45 0.45 0.44 0.43 0.41 0.38 0.36 0.32 0.28 0.25 0.22 0.20 0.20 0.20 0.21 0.22 0.23 0.23 0.23 0.23 0.23 0.23 0.22 0.21 0.20 0.20 0.20 0.23 0.25 0.27 0.28 0.29 0.30 0.30 0.30 0.29 0.27 0.26 0.24 0.23 0.21 0.20 0.20 0.19 0.19 0.18 0.18 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.18 0.20 0.23 0.25 0.28 0.31 0.31 0.31 0.31 0.31 0.31 0.31 0.31 0.32 0.33 0.34 0.36 0.37 0.39 0.42 0.44 0.46 0.48 0.48 0.49 0.49 0.49 0.48 0.47 0.46 0.44 0.43 0.41 0.40 0.38 0.36 0.34 0.32 0.31 0.30 0.29 0.27 0.27 0.27 0.26 0.26 0.26 0.25 0.23 0.22 0.21 0.20 0.21 0.21 0.23 0.26 0.28 0.30 0.33 0.34 0.35 0.36 0.36 0.35 0.34 0.33 0.32 0.30 0.29 0.27 0.26 0.24 0.24 0.23 0.23 0.22 0.22 0.23 0.24 0.25 0.26 0.27 0.26 0.25 0.24 0.23 0.22 0.21 0.21 0.22 0.24 0.26 0.28 0.30 0.32 0.33 0.35 0.34 0.33 0.32 0.31 0.30 0.32 0.33 0.36 0.38 0.41 0.39 0.38 0.37 0.37 0.36 0.36 0.35 0.36 0.37 0.39 0.40 0.41 0.42 0.43 0.44 0.42 0.41 0.39 0.38 0.36 0.32 0.29 0.26 0.23 0.20 0.22 0.23 0.25 0.27 0.29 0.29 0.29 0.29 0.27 0.26 0.25 0.23 0.22 0.21 0.20 0.22 0.24 0.25 0.26 0.28 0.28 0.29 0.29 0.27 0.26 0.25 0.23 0.22 0.22 0.21 0.22 0.22 0.22 0.21 0.21 0.21 0.21 0.21 0.20 0.20 0.19 0.19 0.18 0.17 0.16 0.16 0.15 0.16 0.17 0.19 0.21 0.24 0.26 0.28 0.30 0.30 0.30 0.30 0.30 0.30 0.30 0.30 0.31 0.32 0.33 0.34 0.36 0.37 0.40 0.42 0.44 0.47 0.48 0.48 0.49 0.48 0.47 0.46 0.44 0.43 0.41 0.39 0.38 0.36 0.35 0.33 0.31 0.29 0.28 0.27 0.25 0.25 0.25 0.25 0.25 0.25 0.23 0.22 0.21 0.20 0.19 0.19 0.20 0.22 0.24 0.27 0.29 0.30 0.31 0.32 0.32 0.31 0.30 0.29 0.28 0.27 0.26 0.25 0.24 0.23 0.22 0.22 0.22 0.22 0.22 0.23 0.23 0.24 0.25 0.26 0.27 0.26 0.25 0.24 0.22 0.21 0.21 0.21 0.21 0.23 0.25 0.26 0.28 0.30 0.31 0.32 0.31 0.30 0.28 0.27 0.26 0.27 0.29 0.31 0.33 0.36 0.36 0.37 0.37 0.37 0.37 0.37 0.37 0.37 0.37 0.38 0.38 0.38 0.39 0.39 0.40 0.39 0.38 0.36 0.35 0.34 0.31 0.28 0.25 0.24 0.22 0.24 0.27 0.30 0.32 0.35 0.35 0.35 0.34 0.31 0.28 0.26 0.24 0.23 0.23 0.22 0.24 0.26 0.27 0.29 0.30 0.31 0.32 0.31 0.30 0.29 0.27 0.26 0.25 0.25 0.25 0.25 0.26 0.26 0.26 0.25 0.25 0.25 0.24 0.24 0.23 0.22 0.21 0.20 0.19 0.18 0.17 0.16 0.16 0.19 0.21 0.23 0.25 0.27 0.28 0.29 0.29 0.29 0.29 0.29 0.29 0.28 0.28 0.28 0.29 0.30 0.31 0.33 0.35 0.37 0.40 0.42 0.45 0.46 0.47 0.47 0.46 0.45 0.43 0.42 0.40 0.39 0.37 0.35 0.34 0.32 0.30 0.28 0.27 0.26 0.25 0.22 0.23 0.23 0.23 0.23 0.22 0.21 0.20 0.19 0.18 0.17 0.18 0.19 0.20 0.23 0.25 0.27 0.28 0.28 0.28 0.28 0.26 0.24 0.23 0.22 0.21 0.21 0.21 0.21 0.21 0.21 0.21 0.21 0.21 0.22 0.23 0.23 0.24 0.25 0.25 0.26 0.25 0.24 0.23 0.22 0.21 0.20 0.20 0.20 0.21 0.22 0.23 0.24 0.26 0.27 0.28 0.27 0.25 0.24 0.23 0.22 0.22 0.23 0.25 0.27 0.30 0.32 0.34 0.36 0.37 0.37 0.37 0.37 0.37 0.36 0.35 0.35 0.34 0.34 0.34 0.34 0.34 0.33 0.32 0.31 0.30 0.27 0.25 0.24 0.23 0.23 0.27 0.31 0.34 0.37 0.39 0.39 0.39 0.37 0.34 0.30 0.27 0.25 0.24 0.25 0.25 0.27 0.29 0.32 0.34 0.36 0.37 0.37 0.37 0.36 0.34 0.33 0.32 0.31 0.30 0.30 0.30 0.30 0.30 0.30 0.30 0.30 0.29 0.28 0.27 0.26 0.25 0.24 0.23 0.22 0.20 0.19 0.18 0.19 0.21 0.24 0.25 0.27 0.28 0.29 0.29 0.29 0.29 0.29 0.28 0.28 0.26 0.25 0.24 0.25 0.25 0.27 0.29 0.32 0.35 0.38 0.40 0.42 0.43 0.44 0.44 0.43 0.42 0.41 0.39 0.37 0.35 0.34 0.32 0.30 0.28 0.26 0.25 0.23 0.23 0.22 0.19 0.20 0.21 0.21 0.20 0.19 0.19 0.18 0.17 0.16 0.15 0.16 0.17 0.19 0.21 0.23 0.24 0.25 0.25 0.24 0.23 0.21 0.20 0.19 0.18 0.16 0.17 0.18 0.18 0.19 0.19 0.20 0.21 0.21 0.22 0.23 0.23 0.24 0.24 0.24 0.24 0.24 0.23 0.22 0.22 0.21 0.20 0.20 0.19 0.19 0.18 0.19 0.20 0.21 0.22 0.23 0.21 0.20 0.19 0.19 0.18 0.19 0.19 0.21 0.23 0.26 0.29 0.32 0.35 0.36 0.37 0.37 0.36 0.35 0.33 0.31 0.30 0.30 0.29 0.28 0.28 0.28 0.28 0.27 0.26 0.24 0.23 0.22 0.22 0.23 0.24 0.29 0.33 0.37 0.39 0.41 0.40 0.39 0.38 0.35 0.32 0.30 0.27 0.27 0.28 0.29 0.32 0.34 0.37 0.41 0.44 0.44 0.45 0.45 0.44 0.42 0.40 0.38 0.37 0.37 0.37 0.37 0.36 0.35 0.35 0.34 0.33 0.33 0.32 0.30 0.28 0.27 0.26 0.26 0.25 0.24 0.24 0.24 0.25 0.26 0.28 0.28 0.28 0.28 0.29 0.29 0.29 0.29 0.29 0.28 0.28 0.26 0.24 0.22 0.22 0.21 0.23 0.25 0.28 0.31 0.34 0.36 0.38 0.39 0.40 0.41 0.40 0.39 0.38 0.36 0.34 0.32 0.29 0.27 0.26 0.24 0.23 0.22 0.21 0.20 0.19 0.17 0.18 0.18 0.18 0.18 0.18 0.18 0.17 0.16 0.16 0.16 0.16 0.16 0.17 0.18 0.19 0.20 0.21 0.21 0.20 0.19 0.18 0.16 0.15 0.14 0.14 0.15 0.16 0.17 0.19 0.21 0.21 0.22 0.23 0.23 0.24 0.24 0.24 0.24 0.24 0.24 0.24 0.23 0.22 0.21 0.20 0.19 0.17 0.17 0.16 0.15 0.16 0.17 0.18 0.18 0.19 0.18 0.17 0.17 0.16 0.15 0.15 0.16 0.17 0.20 0.23 0.27 0.31 0.34 0.36 0.37 0.36 0.35 0.33 0.31 0.28 0.27 0.25 0.24 0.23 0.22 0.22 0.21 0.21 0.21 0.20 0.21 0.21 0.22 0.23 0.24 0.28 0.32 0.35 0.37 0.39 0.39 0.38 0.37 0.35 0.32 0.30 0.28 0.28 0.29 0.31 0.35 0.39 0.43 0.47 0.50 0.51 0.52 0.51 0.49 0.47 0.47 0.46 0.45 0.44 0.44 0.43 0.43 0.42 0.40 0.39 0.38 0.36 0.34 0.31 0.29 0.27 0.26 0.24 0.23 0.22 0.22 0.23 0.23 0.23 0.24 0.24 0.24 0.24 0.25 0.27 0.27 0.27 0.26 0.25 0.24 0.22 0.20 0.19 0.19 0.19 0.20 0.22 0.25 0.27 0.30 0.32 0.33 0.34 0.35 0.35 0.35 0.34 0.33 0.31 0.29 0.27 0.26 0.24 0.23 0.22 0.20 0.19 0.18 0.18 0.17 0.16 0.17 0.18 0.19 0.19 0.19 0.18 0.18 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.18 0.19 0.19 0.17 0.16 0.15 0.13 0.13 0.13 0.13 0.15 0.16 0.18 0.20 0.22 0.23 0.24 0.25 0.24 0.24 0.24 0.24 0.23 0.23 0.22 0.22 0.22 0.21 0.20 0.19 0.17 0.16 0.15 0.14 0.14 0.14 0.15 0.15 0.16 0.16 0.16 0.15 0.15 0.14 0.14 0.14 0.14 0.15 0.18 0.21 0.25 0.29 0.32 0.33 0.35 0.34 0.33 0.31 0.28 0.26 0.23 0.21 0.19 0.19 0.18 0.18 0.18 0.18 0.18 0.19 0.20 0.21 0.22 0.22 0.23 0.27 0.31 0.34 0.35 0.37 0.36 0.36 0.34 0.32 0.31 0.29 0.28 0.28 0.30 0.32 0.36 0.41 0.45 0.49 0.53 0.54 0.55 0.55 0.53 0.52 0.51 0.50 0.49 0.49 0.49 0.48 0.47 0.46 0.44 0.43 0.41 0.39 0.36 0.33 0.30 0.27 0.25 0.22 0.20 0.17 0.17 0.16 0.16 0.16 0.17 0.18 0.18 0.20 0.22 0.24 0.24 0.24 0.23 0.21 0.19 0.17 0.15 0.14 0.15 0.16 0.18 0.20 0.22 0.24 0.26 0.27 0.28 0.29 0.29 0.29 0.29 0.29 0.28 0.26 0.25 0.24 0.23 0.22 0.21 0.20 0.19 0.18 0.18 0.17 0.16 0.18 0.19 0.20 0.21 0.20 0.20 0.19 0.19 0.18 0.18 0.18 0.18 0.18 0.18 0.17 0.16 0.17 0.17 0.17 0.15 0.14 0.13 0.12 0.12 0.12 0.13 0.15 0.17 0.20 0.22 0.24 0.25 0.26 0.26 0.25 0.24 0.24 0.23 0.22 0.21 0.20 0.20 0.20 0.20 0.19 0.18 0.17 0.16 0.15 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.13 0.12 0.12 0.12 0.13 0.15 0.18 0.21 0.25 0.28 0.31 0.33 0.32 0.30 0.28 0.26 0.23 0.21 0.18 0.17 0.16 0.16 0.16 0.16 0.17 0.18 0.19 0.20 0.21 0.22 0.22 0.23 0.27 0.31 0.33 0.34 0.34 0.34 0.33 0.31 0.30 0.28 0.28 0.27 0.28 0.30 0.32 0.36 0.41 0.45 0.49 0.52 0.53 0.54 0.54 0.53 0.52 0.52 0.51 0.51 0.51 0.51 0.51 0.50 0.48 0.46 0.44 0.43 0.41 0.38 0.35 0.32 0.28 0.25 0.22 0.18 0.15 0.13 0.11 0.11 0.12 0.12 0.14 0.15 0.17 0.19 0.21 0.21 0.21 0.20 0.18 0.16 0.15 0.13 0.13 0.14 0.15 0.17 0.19 0.20 0.22 0.23 0.24 0.24 0.25 0.24 0.24 0.24 0.24 0.23 0.22 0.21 0.21 0.21 0.21 0.21 0.20 0.20 0.20 0.19 0.19 0.18 0.21 0.22 0.22 0.22 0.22 0.21 0.20 0.20 0.19 0.18 0.18 0.18 0.18 0.17 0.17 0.17 0.16 0.16 0.16 0.14 0.13 0.13 0.12 0.12 0.13 0.14 0.16 0.19 0.21 0.24 0.26 0.27 0.27 0.27 0.26 0.24 0.23 0.23 0.21 0.20 0.19 0.19 0.19 0.19 0.18 0.18 0.17 0.16 0.16 0.15 0.15 0.14 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.12 0.11 0.10 0.09 0.10 0.12 0.14 0.17 0.21 0.24 0.27 0.30 0.29 0.27 0.26 0.23 0.21 0.19 0.17 0.16 0.16 0.15 0.16 0.17 0.18 0.19 0.20 0.21 0.21 0.22 0.24 0.25 0.28 0.31 0.32 0.32 0.32 0.30 0.29 0.28 0.26 0.25 0.25 0.25 0.26 0.28 0.30 0.35 0.39 0.43 0.46 0.49 0.50 0.50 0.50 0.49 0.48 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.47 0.45 0.43 0.41 0.39 0.36 0.32 0.29 0.26 0.23 0.19 0.15 0.13 0.11 0.11 0.11 0.11 0.12 0.13 0.15 0.16 0.17 0.18 0.19 0.19 0.18 0.17 0.16 0.16 0.16 0.16 0.17 0.18 0.19 0.19 0.20 0.20 0.21 0.21 0.21 0.21 0.20 0.20 0.19 0.19 0.19 0.19 0.20 0.21 0.21 0.22 0.22 0.22 0.23 0.23 0.22 0.21 0.23 0.23 0.23 0.22 0.22 0.21 0.20 0.19 0.18 0.17 0.16 0.16 0.16 0.17 0.17 0.18 0.17 0.17 0.16 0.15 0.15 0.14 0.13 0.14 0.15 0.16 0.19 0.21 0.24 0.26 0.28 0.28 0.28 0.27 0.26 0.24 0.22 0.20 0.19 0.19 0.18 0.18 0.18 0.18 0.17 0.16 0.16 0.16 0.16 0.15 0.15 0.14 0.13 0.13 0.14 0.15 0.14 0.13 0.12 0.10 0.08 0.07 0.07 0.07 0.08 0.10 0.13 0.16 0.19 0.22 0.24 0.24 0.24 0.24 0.22 0.21 0.20 0.19 0.18 0.18 0.18 0.19 0.20 0.21 0.22 0.23 0.23 0.23 0.24 0.26 0.28 0.30 0.32 0.32 0.31 0.29 0.27 0.25 0.24 0.22 0.21 0.21 0.21 0.22 0.25 0.28 0.32 0.35 0.39 0.41 0.44 0.44 0.44 0.43 0.42 0.41 0.41 0.42 0.43 0.44 0.45 0.45 0.45 0.45 0.44 0.44 0.42 0.40 0.38 0.35 0.32 0.30 0.27 0.24 0.21 0.18 0.16 0.14 0.13 0.12 0.11 0.11 0.11 0.12 0.13 0.15 0.16 0.17 0.18 0.19 0.19 0.20 0.21 0.21 0.20 0.19 0.19 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.17 0.16 0.16 0.16 0.17 0.18 0.19 0.21 0.22 0.23 0.24 0.24 0.24 0.24 0.24 0.23 0.23 0.21 0.22 0.22 0.22 0.20 0.19 0.18 0.17 0.16 0.16 0.16 0.17 0.17 0.18 0.19 0.19 0.19 0.19 0.18 0.17 0.16 0.15 0.15 0.15 0.16 0.18 0.20 0.23 0.25 0.27 0.29 0.29 0.29 0.28 0.25 0.23 0.21 0.19 0.18 0.17 0.17 0.17 0.17 0.16 0.16 0.16 0.16 0.16 0.16 0.15 0.15 0.14 0.13 0.13 0.14 0.15 0.15 0.15 0.14 0.11 0.08 0.07 0.06 0.06 0.07 0.08 0.10 0.12 0.14 0.17 0.19 0.20 0.20 0.20 0.20 0.20 0.20 0.19 0.19 0.19 0.19 0.20 0.21 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.29 0.29 0.30 0.29 0.28 0.27 0.25 0.23 0.21 0.21 0.20 0.19 0.19 0.20 0.22 0.24 0.27 0.30 0.33 0.34 0.36 0.36 0.36 0.35 0.34 0.33 0.33 0.34 0.35 0.36 0.38 0.39 0.40 0.40 0.40 0.40 0.39 0.37 0.35 0.33 0.31 0.29 0.26 0.23 0.21 0.18 0.16 0.14 0.13 0.12 0.11 0.11 0.11 0.12 0.14 0.16 0.17 0.19 0.19 0.20 0.21 0.21 0.22 0.22 0.21 0.19 0.18 0.17 0.16 0.16 0.15 0.15 0.15 0.15 0.16 0.16 0.17 0.17 0.18 0.19 0.21 0.22 0.23 0.24 0.23 0.23 0.23 0.23 0.23 0.22 0.21 0.19 0.19 0.20 0.19 0.18 0.17 0.16 0.16 0.15 0.16 0.16 0.17 0.18 0.19 0.20 0.20 0.20 0.20 0.20 0.19 0.18 0.18 0.17 0.17 0.19 0.20 0.22 0.24 0.26 0.28 0.29 0.29 0.28 0.27 0.24 0.22 0.20 0.19 0.18 0.17 0.16 0.17 0.17 0.17 0.17 0.17 0.17 0.16 0.16 0.15 0.15 0.14 0.13 0.13 0.13 0.14 0.15 0.16 0.15 0.13 0.10 0.09 0.07 0.07 0.07 0.07 0.08 0.09 0.11 0.13 0.15 0.16 0.17 0.18 0.19 0.19 0.20 0.21 0.21 0.21 0.21 0.21 0.21 0.21 0.22 0.23 0.24 0.25 0.27 0.29 0.30 0.30 0.30 0.29 0.28 0.26 0.24 0.21 0.20 0.19 0.19 0.19 0.20 0.20 0.19 0.19 0.22 0.25 0.27 0.28 0.29 0.28 0.28 0.27 0.26 0.25 0.26 0.26 0.27 0.29 0.31 0.32 0.33 0.34 0.34 0.34 0.33 0.32 0.31 0.29 0.28 0.26 0.24 0.22 0.20 0.18 0.16 0.14 0.13 0.12 0.11 0.12 0.12 0.13 0.15 0.16 0.18 0.19 0.20 0.20 0.21 0.21 0.22 0.21 0.20 0.19 0.17 0.16 0.15 0.15 0.15 0.15 0.15 0.16 0.17 0.18 0.18 0.19 0.19 0.20 0.21 0.22 0.23 0.23 0.22 0.22 0.21 0.21 0.20 0.20 0.19 0.17 0.16 0.16 0.16 0.15 0.15 0.15 0.14 0.14 0.15 0.16 0.18 0.19 0.21 0.21 0.22 0.22 0.22 0.22 0.21 0.20 0.19 0.19 0.19 0.20 0.20 0.22 0.24 0.26 0.27 0.29 0.28 0.27 0.26 0.23 0.21 0.20 0.19 0.18 0.17 0.17 0.18 0.18 0.19 0.19 0.19 0.18 0.17 0.16 0.16 0.15 0.14 0.13 0.13 0.13 0.13 0.14 0.15 0.15 0.13 0.12 0.11 0.10 0.09 0.08 0.07 0.08 0.08 0.09 0.11 0.12 0.14 0.15 0.16 0.18 0.19 0.21 0.22 0.23 0.23 0.23 0.22 0.22 0.21 0.22 0.23 0.24 0.25 0.27 0.29 0.31 0.31 0.31 0.30 0.28 0.26 0.23 0.21 0.19 0.19 0.18 0.19 0.20 0.20 0.18 0.16 0.17 0.19 0.20 0.21 0.21 0.20 0.19 0.18 0.18 0.17 0.18 0.19 0.20 0.22 0.24 0.25 0.26 0.27 0.28 0.28 0.28 0.27 0.26 0.25 0.24 0.23 0.21 0.20 0.18 0.17 0.15 0.13 0.12 0.11 0.11 0.11 0.11 0.12 0.13 0.15 0.16 0.18 0.19 0.19 0.20 0.20 0.20 0.19 0.18 0.17 0.16 0.15 0.15 0.15 0.15 0.16 0.17 0.18 0.19 0.19 0.20 0.20 0.20 0.21 0.21 0.21 0.22 0.22 0.21 0.20 0.19 0.19 0.18 0.17 0.17 0.14 0.13 0.13 0.12 0.12 0.12 0.13 0.13 0.14 0.15 0.17 0.19 0.20 0.22 0.23 0.25 0.25 0.24 0.24 0.22 0.21 0.20 0.20 0.19 0.19 0.19 0.21 0.23 0.25 0.26 0.27 0.26 0.26 0.24 0.23 0.21 0.20 0.19 0.18 0.18 0.18 0.19 0.19 0.20 0.20 0.20 0.19 0.18 0.17 0.16 0.15 0.14 0.14 0.13 0.14 0.14 0.14 0.15 0.15 0.14 0.14 0.13 0.12 0.11 0.10 0.09 0.09 0.08 0.09 0.10 0.11 0.12 0.14 0.15 0.16 0.18 0.20 0.23 0.24 0.24 0.24 0.23 0.22 0.22 0.23 0.23 0.24 0.26 0.27 0.29 0.31 0.31 0.31 0.30 0.28 0.26 0.23 0.21 0.19 0.18 0.18 0.19 0.20 0.19 0.17 0.15 0.14 0.14 0.14 0.14 0.13 0.12 0.11 0.10 0.10 0.10 0.12 0.13 0.14 0.16 0.18 0.19 0.19 0.20 0.21 0.23 0.22 0.21 0.21 0.20 0.20 0.19 0.18 0.17 0.15 0.14 0.13 0.12 0.11 0.10 0.09 0.09 0.08 0.09 0.11 0.12 0.14 0.15 0.16 0.17 0.17 0.17 0.17 0.17 0.15 0.14 0.14 0.14 0.15 0.15 0.16 0.17 0.19 0.19 0.19 0.19 0.20 0.21 0.21 0.21 0.21 0.21 0.21 0.20 0.19 0.17 0.17 0.16 0.15 0.15 0.14 0.11 0.11 0.10 0.10 0.10 0.10 0.11 0.12 0.14 0.16 0.18 0.20 0.22 0.23 0.25 0.26 0.25 0.25 0.24 0.22 0.21 0.20 0.19 0.18 0.19 0.19 0.21 0.22 0.23 0.24 0.24 0.24 0.23 0.22 0.21 0.19 0.19 0.19 0.19 0.19 0.19 0.20 0.21 0.21 0.21 0.21 0.20 0.19 0.18 0.17 0.16 0.16 0.15 0.15 0.16 0.16 0.17 0.18 0.18 0.18 0.18 0.17 0.15 0.14 0.13 0.11 0.10 0.09 0.08 0.09 0.10 0.11 0.12 0.14 0.16 0.18 0.20 0.22 0.23 0.24 0.24 0.24 0.24 0.24 0.24 0.24 0.26 0.27 0.28 0.30 0.31 0.31 0.31 0.30 0.28 0.26 0.23 0.21 0.19 0.18 0.16 0.17 0.18 0.17 0.16 0.15 0.13 0.12 0.11 0.09 0.08 0.07 0.06 0.05 0.06 0.06 0.07 0.08 0.09 0.10 0.11 0.12 0.13 0.14 0.15 0.16 0.16 0.15 0.15 0.15 0.15 0.15 0.15 0.14 0.14 0.13 0.12 0.10 0.09 0.08 0.06 0.06 0.06 0.07 0.08 0.10 0.11 0.12 0.13 0.14 0.15 0.15 0.15 0.14 0.14 0.13 0.13 0.13 0.14 0.15 0.16 0.17 0.18 0.18 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.18 0.17 0.16 0.15 0.14 0.13 0.13 0.12 0.11 0.10 0.09 0.09 0.09 0.09 0.10 0.12 0.13 0.15 0.17 0.19 0.21 0.23 0.25 0.26 0.27 0.27 0.26 0.25 0.23 0.21 0.20 0.19 0.18 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.20 0.20 0.20 0.19 0.18 0.19 0.19 0.20 0.20 0.21 0.21 0.22 0.22 0.22 0.22 0.21 0.20 0.19 0.18 0.18 0.17 0.16 0.16 0.17 0.18 0.19 0.20 0.20 0.20 0.20 0.19 0.18 0.16 0.14 0.13 0.11 0.10 0.09 0.10 0.10 0.12 0.13 0.15 0.17 0.19 0.21 0.23 0.24 0.25 0.26 0.26 0.27 0.27 0.27 0.27 0.28 0.29 0.29 0.30 0.31 0.30 0.30 0.29 0.27 0.26 0.23 0.21 0.19 0.18 0.16 0.15 0.14 0.14 0.14 0.15 0.14 0.13 0.12 0.11 0.09 0.08 0.07 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.07 0.07 0.08 0.09 0.10 0.10 0.09 0.10 0.10 0.11 0.11 0.11 0.11 0.11 0.10 0.10 0.09 0.08 0.08 0.08 0.08 0.08 0.08 0.10 0.11 0.12 0.13 0.13 0.14 0.15 0.15 0.15 0.14 0.14 0.13 0.14 0.14 0.15 0.15 0.16 0.16 0.16 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.16 0.16 0.15 0.14 0.13 0.13 0.12 0.11 0.11 0.10 0.10 0.09 0.09 0.09 0.09 0.10 0.12 0.14 0.16 0.18 0.20 0.23 0.25 0.27 0.28 0.30 0.29 0.27 0.26 0.24 0.22 0.20 0.18 0.16 0.15 0.14 0.15 0.15 0.15 0.16 0.17 0.17 0.17 0.18 0.18 0.18 0.19 0.19 0.20 0.20 0.21 0.22 0.22 0.23 0.23 0.23 0.22 0.21 0.20 0.19 0.18 0.18 0.17 0.18 0.18 0.19 0.21 0.22 0.23 0.23 0.23 0.22 0.20 0.19 0.17 0.15 0.13 0.12 0.11 0.11 0.11 0.12 0.14 0.16 0.18 0.19 0.21 0.23 0.25 0.26 0.27 0.28 0.28 0.29 0.29 0.30 0.30 0.30 0.30 0.31 0.31 0.30 0.30 0.28 0.27 0.25 0.22 0.20 0.18 0.17 0.15 0.15 0.14 0.14 0.16 0.17 0.16 0.15 0.14 0.13 0.12 0.11 0.10 0.09 0.08 0.07 0.06 0.05 0.04 0.04 0.03 0.04 0.04 0.05 0.06 0.06 0.06 0.05 0.06 0.06 0.07 0.07 0.07 0.07 0.07 0.08 0.08 0.08 0.08 0.08 0.08 0.09 0.09 0.10 0.10 0.11 0.12 0.13 0.13 0.14 0.15 0.15 0.15 0.14 0.14 0.14 0.15 0.15 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.15 0.15 0.15 0.15 0.15 0.14 0.14 0.14 0.13 0.13 0.12 0.11 0.11 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.13 0.15 0.17 0.20 0.22 0.25 0.28 0.30 0.31 0.32 0.31 0.29 0.27 0.25 0.23 0.20 0.17 0.15 0.13 0.12 0.12 0.12 0.12 0.12 0.13 0.14 0.14 0.15 0.16 0.17 0.18 0.19 0.19 0.20 0.20 0.21 0.22 0.22 0.22 0.22 0.21 0.21 0.20 0.19 0.18 0.18 0.18 0.18 0.19 0.20 0.22 0.24 0.24 0.25 0.25 0.24 0.22 0.21 0.19 0.17 0.15 0.13 0.12 0.12 0.11 0.13 0.14 0.16 0.18 0.19 0.21 0.23 0.25 0.26 0.28 0.29 0.29 0.30 0.31 0.32 0.32 0.32 0.31 0.31 0.31 0.30 0.30 0.28 0.26 0.24 0.22 0.20 0.18 0.17 0.15 0.16 0.16 0.16 0.17 0.19 0.18 0.18 0.17 0.16 0.15 0.14 0.13 0.12 0.11 0.09 0.08 0.06 0.05 0.04 0.02 0.03 0.04 0.04 0.04 0.05 0.04 0.04 0.03 0.04 0.04 0.04 0.04 0.05 0.05 0.06 0.06 0.07 0.08 0.08 0.09 0.09 0.10 0.10 0.11 0.11 0.12 0.13 0.13 0.14 0.15 0.15 0.15 0.15 0.15 0.15 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.15 0.15 0.14 0.14 0.14 0.13 0.13 0.13 0.13 0.13 0.12 0.12 0.11 0.11 0.10 0.10 0.10 0.12 0.11 0.11 0.11 0.11 0.12 0.15 0.17 0.20 0.22 0.25 0.28 0.30 0.32 0.33 0.34 0.32 0.30 0.28 0.25 0.22 0.19 0.16 0.13 0.11 0.09 0.09 0.09 0.09 0.10 0.10 0.11 0.12 0.13 0.14 0.16 0.16 0.17 0.18 0.19 0.19 0.20 0.20 0.21 0.21 0.21 0.20 0.19 0.19 0.18 0.18 0.18 0.18 0.19 0.20 0.21 0.22 0.24 0.25 0.25 0.26 0.25 0.24 0.22 0.20 0.18 0.16 0.14 0.13 0.12 0.12 0.13 0.14 0.16 0.17 0.19 0.21 0.23 0.25 0.26 0.28 0.29 0.30 0.31 0.32 0.32 0.32 0.32 0.32 0.31 0.31 0.30 0.29 0.28 0.26 0.25 0.23 0.21 0.19 0.18 0.17 0.17 0.18 0.19 0.19 0.20 0.20 0.20 0.20 0.19 0.19 0.17 0.16 0.15 0.13 0.12 0.10 0.08 0.07 0.05 0.04 0.04 0.05 0.05 0.05 0.05 0.05 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.05 0.06 0.06 0.07 0.08 0.09 0.10 0.10 0.10 0.11 0.11 0.12 0.12 0.13 0.14 0.14 0.14 0.15 0.15 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.15 0.15 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.13 0.12 0.12 0.12 0.12 0.13 0.13 0.13 0.13 0.14 0.15 0.17 0.20 0.22 0.25 0.28 0.30 0.33 0.34 0.34 0.34 0.32 0.30 0.28 0.24 0.21 0.18 0.15 0.12 0.10 0.08 0.08 0.08 0.08 0.09 0.10 0.10 0.11 0.12 0.12 0.13 0.14 0.16 0.17 0.17 0.18 0.19 0.19 0.19 0.19 0.19 0.19 0.18 0.18 0.18 0.18 0.18 0.18 0.19 0.20 0.21 0.22 0.24 0.25 0.25 0.26 0.25 0.25 0.23 0.21 0.19 0.18 0.16 0.14 0.14 0.13 0.14 0.14 0.15 0.17 0.18 0.20 0.22 0.24 0.26 0.28 0.29 0.30 0.31 0.32 0.32 0.32 0.31 0.31 0.31 0.31 0.30 0.28 0.27 0.27 0.26 0.24 0.22 0.21 0.20 0.19 0.19 0.19 0.20 0.20 0.21 0.21 0.21 0.21 0.21 0.21 0.20 0.19 0.17 0.16 0.15 0.13 0.12 0.10 0.08 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.06 0.06 0.07 0.07 0.08 0.09 0.09 0.10 0.10 0.10 0.10 0.11 0.12 0.12 0.13 0.14 0.14 0.15 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.15 0.14 0.14 0.13 0.17 0.17 0.17 0.17 0.18 0.19 0.21 0.24 0.26 0.28 0.30 0.32 0.34 0.35 0.35 0.34 0.32 0.29 0.26 0.23 0.20 0.17 0.14 0.13 0.12 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.12 0.12 0.12 0.13 0.14 0.15 0.15 0.16 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.18 0.19 0.20 0.21 0.22 0.24 0.24 0.25 0.25 0.24 0.23 0.22 0.20 0.18 0.17 0.15 0.14 0.14 0.13 0.14 0.14 0.15 0.17 0.18 0.20 0.22 0.23 0.25 0.26 0.27 0.28 0.29 0.29 0.30 0.30 0.30 0.29 0.29 0.28 0.27 0.27 0.26 0.25 0.25 0.24 0.23 0.22 0.21 0.21 0.20 0.20 0.20 0.20 0.21 0.21 0.21 0.21 0.20 0.20 0.20 0.19 0.19 0.18 0.17 0.16 0.15 0.13 0.12 0.10 0.09 0.08 0.08 0.08 0.08 0.07 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.05 0.06 0.06 0.07 0.07 0.07 0.07 0.07 0.07 0.08 0.09 0.11 0.12 0.13 0.14 0.14 0.15 0.16 0.16 0.16 0.16 0.16 0.17 0.18 0.18 0.18 0.18 0.18 0.19 0.19 0.19 0.19 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.19 0.19 0.18 0.18 0.17 0.22 0.22 0.22 0.22 0.23 0.23 0.25 0.26 0.28 0.29 0.31 0.32 0.33 0.33 0.33 0.32 0.30 0.28 0.25 0.22 0.19 0.17 0.15 0.14 0.14 0.13 0.13 0.13 0.13 0.13 0.12 0.12 0.12 0.11 0.11 0.11 0.12 0.12 0.12 0.13 0.14 0.14 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.16 0.17 0.18 0.19 0.20 0.21 0.23 0.23 0.23 0.23 0.23 0.22 0.21 0.19 0.17 0.16 0.15 0.14 0.14 0.13 0.13 0.14 0.14 0.16 0.17 0.19 0.21 0.22 0.24 0.25 0.26 0.26 0.27 0.27 0.27 0.27 0.26 0.26 0.26 0.26 0.25 0.24 0.24 0.24 0.23 0.23 0.22 0.21 0.21 0.20 0.19 0.19 0.19 0.19 0.19 0.19 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.17 0.15 0.14 0.13 0.12 0.11 0.11 0.10 0.09 0.09 0.08 0.08 0.07 0.07 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.05 0.05 0.05 0.06 0.05 0.05 0.05 0.05 0.06 0.07 0.09 0.10 0.12 0.13 0.14 0.15 0.16 0.17 0.17 0.18 0.18 0.19 0.19 0.20 0.19 0.19 0.19 0.20 0.20 0.21 0.21 0.22 0.22 0.23 0.23 0.23 0.23 0.24 0.24 0.24 0.24 0.23 0.22 0.22 0.27 0.27 0.26 0.26 0.27 0.27 0.28 0.28 0.29 0.29 0.30 0.31 0.31 0.31 0.30 0.29 0.27 0.25 0.23 0.21 0.19 0.17 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.15 0.14 0.14 0.13 0.13 0.12 0.12 0.12 0.12 0.12 0.13 0.14 0.14 0.14 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.16 0.17 0.18 0.19 0.20 0.21 0.22 0.23 0.22 0.22 0.21 0.21 0.19 0.18 0.16 0.15 0.14 0.14 0.13 0.12 0.13 0.13 0.14 0.15 0.16 0.18 0.20 0.21 0.22 0.23 0.23 0.24 0.24 0.24 0.24 0.24 0.23 0.23 0.23 0.22 0.22 0.22 0.21 0.21 0.21 0.21 0.21 0.21 0.20 0.19 0.19 0.18 0.18 0.17 0.17 0.16 0.15 0.14 0.14 0.14 0.14 0.14 0.15 0.15 0.16 0.15 0.14 0.14 0.13 0.13 0.12 0.12 0.11 0.10 0.10 0.09 0.08 0.08 0.08 0.07 0.07 0.07 0.07 0.07 0.07 0.06 0.06 0.05 0.05 0.05 0.04 0.04 0.04 0.05 0.06 0.07 0.09 0.11 0.12 0.14 0.15 0.16 0.17 0.17 0.18 0.19 0.20 0.20 0.21 0.21 0.21 0.20 0.20 0.21 0.21 0.22 0.22 0.23 0.24 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.28 0.28 0.27 0.27 0.32 0.31 0.31 0.30 0.30 0.30 0.30 0.29 0.29 0.29 0.29 0.29 0.29 0.28 0.27 0.25 0.24 0.22 0.21 0.20 0.20 0.19 0.19 0.19 0.19 0.19 0.18 0.18 0.18 0.17 0.17 0.16 0.16 0.15 0.14 0.14 0.14 0.14 0.14 0.14 0.15 0.15 0.15 0.15 0.16 0.17 0.16 0.15 0.15 0.16 0.17 0.17 0.18 0.19 0.20 0.21 0.22 0.22 0.22 0.22 0.21 0.20 0.20 0.18 0.16 0.14 0.14 0.13 0.12 0.12 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.19 0.19 0.20 0.21 0.21 0.21 0.21 0.21 0.20 0.20 0.20 0.20 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.20 0.20 0.21 0.20 0.19 0.19 0.18 0.17 0.16 0.15 0.13 0.12 0.11 0.09 0.08 0.09 0.09 0.10 0.11 0.12 0.12 0.12 0.12 0.12 0.12 0.12 0.11 0.11 0.10 0.10 0.09 0.09 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.07 0.07 0.06 0.06 0.05 0.05 0.05 0.06 0.07 0.08 0.10 0.11 0.13 0.15 0.15 0.16 0.17 0.17 0.18 0.19 0.20 0.21 0.21 0.20 0.20 0.20 0.21 0.21 0.21 0.22 0.22 0.23 0.25 0.26 0.27 0.29 0.30 0.31 0.32 0.32 0.32 0.32 0.32 0.32 0.36 0.35 0.34 0.34 0.33 0.32 0.31 0.30 0.29 0.28 0.28 0.27 0.26 0.25 0.24 0.23 0.22 0.21 0.21 0.21 0.21 0.21 0.21 0.21 0.21 0.21 0.20 0.20 0.19 0.19 0.18 0.18 0.18 0.18 0.17 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.17 0.17 0.18 0.17 0.17 0.17 0.17 0.18 0.19 0.19 0.20 0.21 0.23 0.23 0.23 0.22 0.22 0.21 0.20 0.19 0.17 0.15 0.13 0.12 0.12 0.11 0.11 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.18 0.19 0.19 0.19 0.19 0.19 0.19 0.18 0.17 0.17 0.16 0.16 0.16 0.16 0.16 0.17 0.17 0.18 0.19 0.19 0.19 0.19 0.19 0.19 0.18 0.17 0.16 0.15 0.13 0.11 0.08 0.06 0.03 0.03 0.03 0.04 0.05 0.06 0.07 0.08 0.08 0.09 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.09 0.08 0.08 0.09 0.10 0.11 0.12 0.13 0.14 0.15 0.15 0.16 0.17 0.17 0.18 0.19 0.19 0.19 0.19 0.18 0.18 0.18 0.18 0.19 0.19 0.21 0.22 0.23 0.25 0.26 0.28 0.30 0.32 0.33 0.34 0.35 0.35 0.36 0.36 0.36 0.38 0.38 0.37 0.36 0.35 0.34 0.32 0.31 0.30 0.29 0.28 0.26 0.25 0.24 0.24 0.23 0.23 0.22 0.22 0.22 0.22 0.22 0.22 0.22 0.22 0.22 0.22 0.21 0.21 0.21 0.20 0.20 0.20 0.20 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.20 0.20 0.20 0.20 0.20 0.21 0.22 0.22 0.23 0.24 0.24 0.24 0.24 0.24 0.23 0.22 0.21 0.20 0.19 0.17 0.15 0.13 0.12 0.12 0.11 0.11 0.10 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.18 0.18 0.18 0.18 0.18 0.16 0.15 0.15 0.14 0.14 0.14 0.14 0.14 0.15 0.15 0.16 0.17 0.18 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.18 0.17 0.15 0.13 0.11 0.09 0.07 0.06 0.04 0.03 0.03 0.03 0.03 0.04 0.05 0.06 0.07 0.08 0.08 0.09 0.09 0.10 0.10 0.10 0.10 0.11 0.11 0.12 0.12 0.12 0.12 0.12 0.12 0.12 0.13 0.13 0.14 0.14 0.13 0.13 0.14 0.14 0.14 0.15 0.16 0.16 0.16 0.17 0.17 0.18 0.18 0.18 0.18 0.18 0.18 0.17 0.17 0.17 0.17 0.17 0.18 0.18 0.19 0.21 0.22 0.24 0.26 0.28 0.30 0.32 0.34 0.35 0.36 0.37 0.37 0.38 0.38 0.39 0.38 0.38 0.37 0.36 0.35 0.33 0.32 0.30 0.29 0.28 0.26 0.25 0.24 0.23 0.23 0.23 0.24 0.24 0.23 0.23 0.23 0.23 0.23 0.23 0.23 0.22 0.22 0.22 0.23 0.24 0.24 0.24 0.24 0.24 0.23 0.23 0.23 0.23 0.23 0.22 0.23 0.23 0.24 0.24 0.24 0.24 0.24 0.24 0.25 0.26 0.26 0.27 0.27 0.27 0.27 0.27 0.26 0.26 0.24 0.23 0.22 0.20 0.19 0.17 0.15 0.14 0.12 0.11 0.11 0.11 0.12 0.13 0.14 0.15 0.16 0.16 0.17 0.18 0.18 0.19 0.18 0.18 0.17 0.16 0.15 0.14 0.13 0.12 0.12 0.12 0.12 0.13 0.13 0.14 0.15 0.17 0.18 0.19 0.19 0.19 0.20 0.20 0.20 0.19 0.19 0.18 0.16 0.15 0.14 0.12 0.10 0.09 0.08 0.07 0.06 0.05 0.05 0.06 0.07 0.07 0.08 0.09 0.09 0.10 0.11 0.11 0.11 0.11 0.12 0.12 0.13 0.14 0.14 0.14 0.14 0.14 0.15 0.15 0.16 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.17 0.16 0.16 0.16 0.16 0.17 0.17 0.18 0.19 0.21 0.23 0.25 0.27 0.29 0.31 0.33 0.35 0.36 0.38 0.38 0.39 0.39 0.39 0.38 0.38 0.37 0.36 0.36 0.34 0.32 0.30 0.29 0.28 0.26 0.25 0.24 0.23 0.23 0.23 0.24 0.23 0.23 0.22 0.22 0.22 0.22 0.22 0.23 0.23 0.24 0.25 0.26 0.27 0.28 0.28 0.28 0.28 0.28 0.28 0.28 0.28 0.27 0.27 0.27 0.28 0.28 0.28 0.29 0.29 0.29 0.29 0.29 0.30 0.30 0.31 0.31 0.31 0.31 0.30 0.29 0.28 0.27 0.26 0.25 0.23 0.21 0.19 0.18 0.16 0.14 0.13 0.13 0.13 0.13 0.14 0.15 0.16 0.17 0.18 0.18 0.19 0.19 0.20 0.20 0.19 0.18 0.17 0.15 0.14 0.13 0.12 0.11 0.11 0.11 0.11 0.11 0.12 0.13 0.15 0.16 0.17 0.18 0.19 0.19 0.20 0.20 0.20 0.20 0.19 0.19 0.18 0.17 0.16 0.15 0.14 0.13 0.12 0.11 0.10 0.09 0.09 0.10 0.10 0.10 0.11 0.11 0.12 0.12 0.12 0.13 0.13 0.13 0.14 0.14 0.14 0.15 0.15 0.15 0.16 0.17 0.17 0.17 0.18 0.18 0.18 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.18 0.18 0.18 0.17 0.17 0.17 0.17 0.17 0.16 0.16 0.15 0.15 0.15 0.15 0.16 0.17 0.18 0.20 0.22 0.24 0.26 0.28 0.30 0.32 0.33 0.35 0.37 0.38 0.39 0.39 0.39 0.38 0.38 0.37 0.36 0.35 0.33 0.32 0.30 0.29 0.27 0.26 0.25 0.24 0.23 0.22 0.22 0.22 0.22 0.21 0.20 0.21 0.21 0.21 0.22 0.23 0.24 0.26 0.27 0.28 0.30 0.31 0.31 0.32 0.32 0.32 0.32 0.32 0.32 0.32 0.32 0.32 0.32 0.32 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.34 0.35 0.35 0.35 0.35 0.34 0.32 0.32 0.31 0.30 0.28 0.26 0.24 0.22 0.20 0.19 0.18 0.17 0.16 0.15 0.16 0.17 0.17 0.18 0.19 0.19 0.20 0.20 0.21 0.22 0.22 0.22 0.21 0.19 0.17 0.16 0.14 0.13 0.12 0.10 0.10 0.10 0.10 0.11 0.11 0.13 0.14 0.15 0.16 0.18 0.18 0.19 0.19 0.20 0.21 0.20 0.20 0.19 0.19 0.18 0.18 0.17 0.17 0.16 0.16 0.15 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.16 0.16 0.17 0.17 0.18 0.18 0.18 0.18 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.18 0.18 0.18 0.18 0.17 0.17 0.16 0.16 0.16 0.15 0.15 0.14 0.13 0.13 0.13 0.13 0.14 0.15 0.17 0.18 0.20 0.22 0.24 0.26 0.28 0.30 0.32 0.34 0.36 0.37 0.38 0.39 0.37 0.37 0.37 0.37 0.35 0.34 0.32 0.30 0.29 0.27 0.26 0.25 0.23 0.22 0.21 0.19 0.19 0.19 0.19 0.19 0.18 0.19 0.19 0.20 0.22 0.24 0.26 0.27 0.29 0.31 0.32 0.34 0.35 0.36 0.36 0.36 0.36 0.36 0.36 0.37 0.37 0.37 0.37 0.37 0.37 0.37 0.37 0.37 0.37 0.37 0.37 0.38 0.39 0.39 0.38 0.37 0.37 0.36 0.35 0.35 0.34 0.32 0.30 0.28 0.26 0.24 0.23 0.22 0.20 0.19 0.18 0.19 0.19 0.20 0.20 0.21 0.22 0.22 0.23 0.24 0.24 0.24 0.24 0.24 0.22 0.21 0.19 0.17 0.16 0.14 0.13 0.12 0.12 0.11 0.11 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.18 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.18 0.18 0.18 0.18 0.17 0.17 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.17 0.17 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.17 0.16 0.16 0.16 0.16 0.15 0.15 0.14 0.13 0.13 0.12 0.11 0.11 0.10 0.10 0.11 0.11 0.13 0.14 0.16 0.18 0.19 0.22 0.25 0.27 0.29 0.31 0.33 0.35 0.36 0.37 0.37 0.35 0.35 0.35 0.34 0.33 0.32 0.30 0.29 0.27 0.26 0.25 0.23 0.21 0.20 0.19 0.18 0.18 0.17 0.17 0.17 0.17 0.18 0.19 0.20 0.22 0.24 0.26 0.28 0.30 0.32 0.34 0.35 0.36 0.37 0.38 0.38 0.38 0.38 0.38 0.39 0.39 0.39 0.40 0.40 0.40 0.40 0.40 0.40 0.40 0.41 0.41 0.41 0.42 0.41 0.41 0.40 0.39 0.39 0.38 0.37 0.37 0.35 0.33 0.31 0.30 0.28 0.27 0.26 0.25 0.24 0.23 0.23 0.23 0.24 0.24 0.25 0.26 0.26 0.27 0.28 0.28 0.28 0.28 0.28 0.26 0.25 0.24 0.22 0.21 0.19 0.17 0.16 0.16 0.15 0.14 0.14 0.14 0.14 0.14 0.15 0.15 0.16 0.16 0.17 0.18 0.18 0.19 0.19 0.19 0.19 0.19 0.20 0.21 0.21 0.20 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.18 0.18 0.18 0.18 0.17 0.17 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.17 0.17 0.17 0.17 0.17 0.18 0.17 0.17 0.16 0.16 0.15 0.14 0.14 0.13 0.13 0.12 0.11 0.11 0.10 0.10 0.10 0.10 0.10 0.10 0.11 0.11 0.13 0.14 0.16 0.18 0.19 0.22 0.24 0.26 0.28 0.30 0.31 0.32 0.33 0.34 0.35 0.32 0.32 0.31 0.31 0.30 0.29 0.28 0.26 0.25 0.24 0.23 0.22 0.20 0.19 0.18 0.17 0.16 0.16 0.15 0.16 0.16 0.18 0.20 0.21 0.23 0.24 0.26 0.28 0.30 0.32 0.33 0.34 0.36 0.37 0.37 0.38 0.38 0.39 0.39 0.39 0.39 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.42 0.42 0.43 0.43 0.43 0.42 0.42 0.41 0.40 0.39 0.38 0.37 0.36 0.34 0.33 0.32 0.31 0.30 0.29 0.29 0.28 0.27 0.27 0.27 0.28 0.28 0.29 0.30 0.30 0.31 0.32 0.32 0.32 0.31 0.31 0.30 0.29 0.28 0.26 0.25 0.23 0.22 0.21 0.20 0.20 0.19 0.19 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.19 0.19 0.19 0.19 0.20 0.20 0.20 0.21 0.21 0.21 0.21 0.20 0.20 0.20 0.20 0.20 0.19 0.19 0.19 0.19 0.19 0.18 0.18 0.18 0.18 0.17 0.16 0.16 0.16 0.16 0.16 0.15 0.15 0.15 0.15 0.16 0.16 0.16 0.15 0.15 0.16 0.16 0.16 0.15 0.15 0.14 0.14 0.13 0.12 0.12 0.12 0.11 0.11 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.11 0.11 0.13 0.14 0.15 0.17 0.19 0.20 0.22 0.24 0.26 0.27 0.29 0.30 0.31 0.32 0.32 0.30 0.29 0.28 0.28 0.27 0.26 0.25 0.24 0.23 0.22 0.21 0.20 0.19 0.18 0.17 0.16 0.16 0.15 0.16 0.16 0.17 0.18 0.20 0.21 0.22 0.24 0.25 0.27 0.29 0.30 0.31 0.32 0.34 0.35 0.35 0.36 0.36 0.37 0.37 0.37 0.37 0.37 0.38 0.38 0.39 0.39 0.40 0.41 0.42 0.42 0.42 0.43 0.43 0.43 0.43 0.42 0.42 0.41 0.40 0.39 0.38 0.37 0.35 0.34 0.34 0.33 0.33 0.32 0.32 0.32 0.31 0.31 0.32 0.32 0.33 0.33 0.34 0.35 0.35 0.36 0.36 0.36 0.35 0.35 0.34 0.33 0.32 0.31 0.30 0.29 0.28 0.27 0.26 0.26 0.25 0.24 0.24 0.23 0.23 0.22 0.22 0.22 0.22 0.22 0.22 0.21 0.21 0.21 0.21 0.22 0.22 0.22 0.22 0.22 0.22 0.22 0.21 0.21 0.21 0.21 0.20 0.20 0.20 0.19 0.19 0.18 0.18 0.18 0.18 0.17 0.16 0.16 0.16 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.16 0.15 0.15 0.14 0.14 0.14 0.14 0.14 0.14 0.13 0.13 0.12 0.12 0.11 0.11 0.11 0.11 0.10 0.10 0.10 0.10 0.10 0.10 0.11 0.11 0.12 0.13 0.15 0.16 0.17 0.18 0.20 0.21 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.30 0.27 0.27 0.26 0.26 0.25 0.24 0.24 0.23 0.22 0.21 0.19 0.19 0.18 0.18 0.17 0.16 0.16 0.16 0.17 0.17 0.18 0.19 0.19 0.20 0.21 0.22 0.24 0.25 0.26 0.27 0.28 0.29 0.31 0.31 0.32 0.32 0.33 0.33 0.33 0.33 0.33 0.33 0.34 0.34 0.35 0.36 0.37 0.39 0.40 0.41 0.42 0.42 0.42 0.42 0.42 0.42 0.41 0.41 0.40 0.39 0.39 0.38 0.37 0.36 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.36 0.36 0.37 0.38 0.39 0.39 0.40 0.40 0.40 0.41 0.40 0.40 0.40 0.39 0.39 0.38 0.38 0.37 0.36 0.34 0.34 0.33 0.32 0.32 0.31 0.31 0.30 0.29 0.29 0.28 0.28 0.28 0.27 0.27 0.26 0.26 0.26 0.25 0.25 0.24 0.24 0.24 0.24 0.24 0.23 0.23 0.22 0.22 0.22 0.21 0.21 0.20 0.19 0.19 0.18 0.18 0.18 0.18 0.17 0.16 0.16 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.14 0.14 0.14 0.14 0.13 0.13 0.13 0.13 0.13 0.13 0.12 0.12 0.12 0.11 0.11 0.11 0.11 0.10 0.10 0.10 0.11 0.12 0.12 0.13 0.13 0.15 0.16 0.17 0.18 0.18 0.19 0.21 0.22 0.23 0.24 0.25 0.26 0.26 0.27 0.27 0.26 0.26 0.26 0.26 0.25 0.24 0.24 0.23 0.22 0.21 0.19 0.19 0.18 0.18 0.17 0.16 0.16 0.16 0.17 0.17 0.18 0.19 0.19 0.20 0.20 0.21 0.22 0.22 0.23 0.24 0.24 0.25 0.26 0.26 0.26 0.26 0.27 0.27 0.28 0.28 0.28 0.28 0.28 0.28 0.30 0.31 0.33 0.35 0.36 0.38 0.39 0.40 0.40 0.41 0.41 0.41 0.41 0.41 0.40 0.39 0.37 0.37 0.37 0.37 0.37 0.37 0.38 0.39 0.39 0.39 0.39 0.40 0.40 0.41 0.43 0.44 0.44 0.45 0.46 0.46 0.47 0.46 0.46 0.45 0.45 0.45 0.45 0.44 0.44 0.43 0.42 0.42 0.41 0.40 0.40 0.39 0.38 0.38 0.37 0.36 0.36 0.35 0.34 0.34 0.33 0.32 0.32 0.31 0.31 0.30 0.29 0.29 0.28 0.27 0.27 0.26 0.25 0.25 0.24 0.23 0.23 0.22 0.21 0.21 0.20 0.19 0.19 0.18 0.18 0.17 0.16 0.16 0.16 0.16 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.14 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.13 0.12 0.11 0.12 0.13 0.13 0.13 0.13 0.14 0.14 0.15 0.15 0.15 0.16 0.17 0.18 0.19 0.19 0.21 0.22 0.23 0.24 0.24 0.25 0.26 0.26 0.26 0.26 0.26 0.26 0.26 0.26 0.25 0.24 0.24 0.23 0.22 0.22 0.21 0.20 0.19 0.19 0.18 0.18 0.17 0.16 0.16 0.16 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.18 0.19 0.19 0.19 0.19 0.20 0.20 0.21 0.21 0.21 0.21 0.22 0.22 0.22 0.22 0.23 0.24 0.24 0.27 0.29 0.32 0.34 0.36 0.38 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.38 0.37 0.37 0.37 0.38 0.38 0.39 0.40 0.41 0.42 0.42 0.43 0.44 0.44 0.45 0.46 0.48 0.49 0.50 0.51 0.51 0.51 0.51 0.51 0.51 0.51 0.51 0.51 0.50 0.50 0.49 0.49 0.48 0.47 0.47 0.46 0.45 0.45 0.44 0.44 0.44 0.44 0.42 0.41 0.40 0.40 0.39 0.38 0.38 0.37 0.36 0.34 0.34 0.33 0.32 0.32 0.31 0.30 0.29 0.28 0.27 0.27 0.25 0.24 0.23 0.23 0.22 0.21 0.20 0.19 0.18 0.18 0.17 0.16 0.16 0.16 0.16 0.15 0.15 0.15 0.15 0.15 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.15 0.15 0.16 0.16 0.16 0.16 0.17 0.17 0.18 0.19 0.19 0.20 0.21 0.22 0.23 0.24 0.24 0.24 0.25 0.26 0.26 0.26 0.26 0.26 0.26 0.26 0.26 0.26 0.25 0.25 0.24 0.23 0.22 0.21 0.20 0.20 0.19 0.19 0.18 0.17 0.17 0.16 0.16 0.15 0.15 0.15 0.15 0.15 0.14 0.14 0.14 0.14 0.15 0.15 0.15 0.15 0.15 0.16 0.17 0.17 0.17 0.18 0.18 0.18 0.18 0.18 0.18 0.19 0.19 0.21 0.23 0.26 0.29 0.32 0.34 0.36 0.37 0.38 0.39 0.38 0.37 0.37 0.37 0.37 0.38 0.38 0.39 0.39 0.40 0.41 0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49 0.51 0.52 0.52 0.53 0.54 0.55 0.55 0.55 0.55 0.55 0.56 0.56 0.56 0.56 0.55 0.55 0.55 0.54 0.53 0.53 0.52 0.51 0.51 0.50 0.50 0.49 0.48 0.48 0.47 0.46 0.45 0.44 0.43 0.42 0.42 0.41 0.40 0.39 0.37 0.36 0.35 0.34 0.34 0.33 0.32 0.31 0.29 0.28 0.27 0.26 0.25 0.23 0.22 0.21 0.20 0.20 0.19 0.19 0.18 0.18 0.17 0.17 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.17 0.17 0.17 0.17 0.17 0.17 0.18 0.18 0.19 0.19 0.19 0.20 0.20 0.20 0.21 0.22 0.22 0.23 0.24 0.25 0.25 0.25 0.25 0.26 0.27 0.27 0.26 0.26 0.27 0.27 0.27 0.26 0.26 0.26 0.25 0.25 0.24 0.23 0.22 0.22 0.21 0.20 0.20 0.19 0.19 0.18 0.17 0.17 0.16 0.16 0.15 0.15 0.15 0.14 0.14 0.14 0.14 0.14 0.14 0.13 0.13 0.13 0.14 0.14 0.14 0.15 0.15 0.15 0.15 0.15 0.15 0.16 0.16 0.16 0.17 0.19 0.20 0.22 0.25 0.28 0.30 0.33 0.35 0.36 0.36 0.35 0.36 0.36 0.37 0.38 0.38 0.39 0.39 0.40 0.41 0.42 0.43 0.44 0.45 0.47 0.48 0.49 0.51 0.53 0.53 0.54 0.55 0.56 0.57 0.57 0.58 0.58 0.59 0.60 0.60 0.60 0.60 0.60 0.60 0.59 0.59 0.58 0.58 0.57 0.57 0.56 0.56 0.55 0.55 0.54 0.53 0.52 0.52 0.51 0.50 0.49 0.48 0.47 0.46 0.44 0.43 0.42 0.41 0.39 0.39 0.38 0.37 0.35 0.34 0.32 0.31 0.30 0.29 0.28 0.27 0.25 0.24 0.23 0.22 0.22 0.21 0.20 0.20 0.19 0.19 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.19 0.19 0.19 0.19 0.19 0.19 0.20 0.20 0.20 0.21 0.21 0.22 0.23 0.23 0.23 0.23 0.24 0.24 0.25 0.26 0.26 0.26 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.28 0.28 0.28 0.27 0.27 0.26 0.26 0.25 0.25 0.25 0.25 0.24 0.24 0.23 0.22 0.22 0.21 0.21 0.20 0.19 0.19 0.18 0.18 0.17 0.17 0.18 0.17 0.16 0.16 0.16 0.16 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.16 0.16 0.17 0.17 0.17 0.17 0.18 0.19 0.20 0.23 0.26 0.29 0.31 0.34 0.34 0.34 0.35 0.36 0.38 0.38 0.38 0.38 0.39 0.40 0.41 0.42 0.43 0.45 0.46 0.47 0.48 0.50 0.52 0.53 0.54 0.55 0.56 0.56 0.57 0.58 0.59 0.60 0.61 0.61 0.62 0.62 0.62 0.62 0.62 0.62 0.62 0.61 0.61 0.60 0.60 0.60 0.60 0.59 0.59 0.58 0.57 0.57 0.55 0.54 0.53 0.53 0.52 0.51 0.49 0.48 0.47 0.46 0.44 0.43 0.42 0.42 0.40 0.39 0.37 0.35 0.34 0.33 0.32 0.32 0.30 0.29 0.28 0.27 0.25 0.25 0.24 0.23 0.23 0.22 0.22 0.22 0.21 0.21 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.21 0.21 0.22 0.22 0.22 0.22 0.22 0.22 0.23 0.23 0.23 0.23 0.23 0.24 0.25 0.25 0.26 0.26 0.26 0.27 0.27 0.27 0.28 0.28 0.28 0.28 0.28 0.28 0.28 0.28 0.28 0.28 0.28 0.29 0.29 0.28 0.28 0.28 0.28 0.28 0.28 0.27 0.27 0.26 0.26 0.26 0.26 0.25 0.24 0.24 0.24 0.24 0.23 0.23 0.22 0.21 0.21 0.22 0.23 0.22 0.21 0.21 0.21 0.21 0.21 0.21 0.21 0.21 0.21 0.21 0.21 0.21 0.21 0.21 0.21 0.21 0.21 0.21 0.21 0.22 0.22 0.24 0.26 0.28 0.30 0.32 0.34 0.36 0.39 0.38 0.36 0.36 0.38 0.39 0.40 0.40 0.41 0.42 0.42 0.44 0.45 0.46 0.46 0.47 0.48 0.50 0.51 0.51 0.52 0.53 0.55 0.56 0.56 0.57 0.57 0.58 0.59 0.59 0.60 0.61 0.61 0.62 0.62 0.62 0.62 0.62 0.62 0.62 0.62 0.62 0.62 0.61 0.61 0.60 0.59 0.59 0.58 0.57 0.57 0.56 0.54 0.53 0.53 0.52 0.51 0.49 0.48 0.48 0.47 0.46 0.44 0.43 0.42 0.41 0.39 0.38 0.37 0.35 0.34 0.33 0.33 0.32 0.31 0.29 0.29 0.28 0.27 0.27 0.26 0.25 0.25 0.24 0.24 0.24 0.24 0.24 0.24 0.24 0.24 0.24 0.24 0.24 0.24 0.24 0.24 0.24 0.25 0.25 0.26 0.26 0.26 0.26 0.26 0.26 0.27 0.27 0.28 0.28 0.28 0.28 0.29 0.29 0.29 0.29 0.29 0.29 0.29 0.29 0.29 0.29 0.29 0.29 0.29 0.29 0.31 0.30 0.29 0.29 0.29 0.29 0.29 0.29 0.29 0.29 0.29 0.29 0.29 0.29 0.28 0.28 0.28 0.28 0.28 0.28 0.28 0.28 0.28 0.28 0.28 0.28 0.28 0.28 0.28 0.28 0.28 0.28 0.28 0.28 0.28 0.29 0.28 0.28 0.28 0.29 0.30 0.30 0.30 0.31 0.32 0.33 0.33 0.34 0.35 0.37 0.39 0.40 0.41 0.42 0.43 0.44 0.43 0.43 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49 0.49 0.50 0.51 0.51 0.52 0.53 0.54 0.54 0.55 0.56 0.56 0.57 0.57 0.58 0.58 0.58 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.58 0.57 0.57 0.56 0.56 0.56 0.56 0.55 0.54 0.53 0.53 0.52 0.51 0.49 0.48 0.48 0.47 0.46 0.46 0.44 0.43 0.42 0.41 0.40 0.39 0.38 0.37 0.36 0.35 0.35 0.34 0.33 0.32 0.32 0.31 0.31 0.30 0.30 0.30 0.29 0.29 0.28 0.28 0.28 0.28 0.28 0.28 0.28 0.28 0.28 0.28 0.28 0.28 0.28 0.28 0.28 0.29 0.29 0.30 0.30 0.30 0.30 0.30 0.30 0.30 0.30 0.30 0.30 0.30 0.31 0.31 0.32 0.31 0.31 0.31 0.31 0.31 0.31 0.31 0.31 0.31 0.31 0.34 0.34 0.33 0.33 0.33 0.32 0.32 0.32 0.32 0.32 0.32 0.32 0.32 0.32 0.32 0.32 0.33 0.33 0.33 0.33 0.33 0.34 0.34 0.34 0.34 0.33 0.33 0.33 0.33 0.34 0.34 0.34 0.34 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.42 0.42 0.43 0.43 0.44 0.44 0.45 0.45 0.45 0.45 0.45 0.44 0.44 0.44 0.44 0.44 0.44 0.44 0.44 0.45 0.45 0.46 0.46 0.46 0.47 0.47 0.48 0.48 0.49 0.49 0.49 0.50 0.51 0.51 0.51 0.52 0.52 0.53 0.53 0.53 0.53 0.53 0.54 0.54 0.54 0.55 0.55 0.55 0.55 0.55 0.54 0.54 0.53 0.53 0.52 0.52 0.52 0.52 0.52 0.51 0.50 0.50 0.49 0.49 0.48 0.47 0.47 0.46 0.45 0.45 0.44 0.43 0.42 0.42 0.42 0.41 0.40 0.39 0.39 0.38 0.38 0.37 0.37 0.36 0.36 0.35 0.35 0.35 0.34 0.34 0.34 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.32 0.32 0.32 0.32 0.32 0.32 0.32 0.32 0.32 0.33 0.33 0.34 0.33 0.33 0.33 0.33 0.33 0.33 0.34 0.33 0.33 0.33 0.33 0.33 0.34 0.34 0.34 0.34 0.34 0.34 0.34 0.34 0.34 0.34 0.37 0.37 0.37 0.37 0.36 0.36 0.36 0.37 0.37 0.36 0.36 0.36 0.37 0.37 0.37 0.37 0.37 0.37 0.38 0.38 0.38 0.38 0.38 0.38 0.38 0.38 0.38 0.38 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.40 0.41 0.41 0.42 0.42 0.42 0.43 0.43 0.43 0.43 0.43 0.44 0.44 0.44 0.44 0.44 0.44 0.44 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.46 0.46 0.46 0.46 0.46 0.47 0.47 0.47 0.47 0.47 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.47 0.47 0.46 0.46 0.46 0.46 0.46 0.45 0.45 0.44 0.44 0.44 0.43 0.43 0.43 0.42 0.42 0.42 0.41 0.41 0.40 0.40 0.40 0.40 0.39 0.39 0.39 0.39 0.39 0.38 0.38 0.38 0.38 0.38 0.38 0.38 0.38 0.38 0.38 0.37 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.37 0.37 0.36 0.36 0.36 0.36 0.36 0.37 0.37 0.37 0.36 0.36 0.36 0.36 0.36 0.37 0.37 0.37 0.37 0.37 0.37 0.37 0.37 0.37 nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan ]; % test data 1 for tec function tec=testdata2 tec=[ 0 nan nan 30 nan nan 60 nan nan 90 nan nan 120 nan nan 150 nan nan 180 nan nan 210 nan nan 240 nan nan 270 nan nan 300 nan nan 330 nan nan 360 nan nan 390 nan nan 420 nan nan 450 nan nan 480 nan nan 510 nan nan 540 nan nan 570 nan nan 600 nan nan 630 nan nan 660 nan nan 690 nan nan 720 nan nan 750 nan nan 780 nan nan 810 nan nan 840 nan nan 870 nan nan 900 nan nan 930 nan nan 960 nan nan 990 nan nan 1020 nan nan 1050 nan nan 1080 nan nan 1110 nan nan 1140 nan nan 1170 nan nan 1200 nan nan 1230 nan nan 1260 nan nan 1290 nan nan 1320 nan nan 1350 nan nan 1380 nan nan 1410 nan nan 1440 nan nan 1470 nan nan 1500 nan nan 1530 nan nan 1560 nan nan 1590 nan nan 1620 nan nan 1650 nan nan 1680 nan nan 1710 nan nan 1740 nan nan 1770 nan nan 1800 nan nan 1830 nan nan 1860 nan nan 1890 nan nan 1920 nan nan 1950 nan nan 1980 nan nan 2010 nan nan 2040 nan nan 2070 nan nan 2100 nan nan 2130 nan nan 2160 nan nan 2190 nan nan 2220 nan nan 2250 nan nan 2280 nan nan 2310 nan nan 2340 nan nan 2370 nan nan 2400 nan nan 2430 nan nan 2460 nan nan 2490 nan nan 2520 nan nan 2550 nan nan 2580 nan nan 2610 nan nan 2640 nan nan 2670 nan nan 2700 nan nan 2730 nan nan 2760 nan nan 2790 nan nan 2820 nan nan 2850 nan nan 2880 nan nan 2910 nan nan 2940 nan nan 2970 nan nan 3000 nan nan 3030 nan nan 3060 nan nan 3090 nan nan 3120 nan nan 3150 nan nan 3180 nan nan 3210 nan nan 3240 nan nan 3270 nan nan 3300 nan nan 3330 nan nan 3360 nan nan 3390 nan nan 3420 nan nan 3450 nan nan 3480 nan nan 3510 nan nan 3540 nan nan 3570 nan nan 3600 nan nan 3630 nan nan 3660 nan nan 3690 nan nan 3720 nan nan 3750 nan nan 3780 nan nan 3810 nan nan 3840 nan nan 3870 nan nan 3900 nan nan 3930 nan nan 3960 nan nan 3990 nan nan 4020 nan nan 4050 nan nan 4080 nan nan 4110 nan nan 4140 nan nan 4170 nan nan 4200 nan nan 4230 nan nan 4260 nan nan 4290 nan nan 4320 nan nan 4350 nan nan 4380 nan nan 4410 nan nan 4440 nan nan 4470 nan nan 4500 nan nan 4530 nan nan 4560 nan nan 4590 nan nan 4620 nan nan 4650 nan nan 4680 nan nan 4710 nan nan 4740 nan nan 4770 nan nan 4800 nan nan 4830 nan nan 4860 nan nan 4890 nan nan 4920 nan nan 4950 nan nan 4980 nan nan 5010 nan nan 5040 nan nan 5070 nan nan 5100 nan nan 5130 nan nan 5160 nan nan 5190 nan nan 5220 nan nan 5250 nan nan 5280 nan nan 5310 nan nan 5340 nan nan 5370 nan nan 5400 nan nan 5430 nan nan 5460 nan nan 5490 nan nan 5520 nan nan 5550 nan nan 5580 nan nan 5610 nan nan 5640 nan nan 5670 nan nan 5700 nan nan 5730 nan nan 5760 nan nan 5790 nan nan 5820 nan nan 5850 nan nan 5880 nan nan 5910 nan nan 5940 nan nan 5970 nan nan 6000 nan nan 6030 nan nan 6060 nan nan 6090 nan nan 6120 nan nan 6150 nan nan 6180 nan nan 6210 nan nan 6240 nan nan 6270 nan nan 6300 nan nan 6330 nan nan 6360 nan nan 6390 nan nan 6420 nan nan 6450 nan nan 6480 nan nan 6510 nan nan 6540 nan nan 6570 nan nan 6600 nan nan 6630 nan nan 6660 nan nan 6690 nan nan 6720 nan nan 6750 nan nan 6780 nan nan 6810 nan nan 6840 nan nan 6870 nan nan 6900 nan nan 6930 nan nan 6960 nan nan 6990 nan nan 7020 nan nan 7050 nan nan 7080 nan nan 7110 nan nan 7140 nan nan 7170 nan nan 7200 nan nan 7230 nan nan 7260 nan nan 7290 nan nan 7320 nan nan 7350 nan nan 7380 nan nan 7410 nan nan 7440 nan nan 7470 nan nan 7500 nan nan 7530 nan nan 7560 nan nan 7590 nan nan 7620 nan nan 7650 nan nan 7680 nan nan 7710 nan nan 7740 nan nan 7770 nan nan 7800 nan nan 7830 nan nan 7860 nan nan 7890 nan nan 7920 nan nan 7950 nan nan 7980 nan nan 8010 nan nan 8040 nan nan 8070 nan nan 8100 nan nan 8130 nan nan 8160 nan nan 8190 nan nan 8220 nan nan 8250 nan nan 8280 nan nan 8310 nan nan 8340 nan nan 8370 nan nan 8400 nan nan 8430 nan nan 8460 nan nan 8490 nan nan 8520 nan nan 8550 nan nan 8580 nan nan 8610 nan nan 8640 nan nan 8670 nan nan 8700 nan nan 8730 nan nan 8760 nan nan 8790 nan nan 8820 nan nan 8850 nan nan 8880 nan nan 8910 nan nan 8940 nan nan 8970 nan nan 9000 nan nan 9030 nan nan 9060 nan nan 9090 nan nan 9120 nan nan 9150 nan nan 9180 nan nan 9210 nan nan 9240 nan nan 9270 nan nan 9300 nan nan 9330 nan nan 9360 nan nan 9390 nan nan 9420 nan nan 9450 nan nan 9480 nan nan 9510 nan nan 9540 nan nan 9570 nan nan 9600 nan nan 9630 nan nan 9660 nan nan 9690 nan nan 9720 nan nan 9750 nan nan 9780 nan nan 9810 nan nan 9840 nan nan 9870 nan nan 9900 nan nan 9930 nan nan 9960 nan nan 9990 nan nan 10020 nan nan 10050 nan nan 10080 nan nan 10110 nan nan 10140 nan nan 10170 nan nan 10200 nan nan 10230 nan nan 10260 nan nan 10290 nan nan 10320 nan nan 10350 nan nan 10380 nan nan 10410 nan nan 10440 nan nan 10470 nan nan 10500 nan nan 10530 nan nan 10560 nan nan 10590 nan nan 10620 nan nan 10650 nan nan 10680 nan nan 10710 nan nan 10740 nan nan 10770 nan nan 10800 nan nan 10830 nan nan 10860 nan nan 10890 nan nan 10920 nan nan 10950 nan nan 10980 nan nan 11010 nan nan 11040 nan nan 11070 nan nan 11100 nan nan 11130 nan nan 11160 nan nan 11190 nan nan 11220 nan nan 11250 nan nan 11280 nan nan 11310 nan nan 11340 nan nan 11370 nan nan 11400 nan nan 11430 nan nan 11460 nan nan 11490 nan nan 11520 nan nan 11550 nan nan 11580 nan nan 11610 nan nan 11640 nan nan 11670 nan nan 11700 nan nan 11730 nan nan 11760 nan nan 11790 nan nan 11820 nan nan 11850 nan nan 11880 nan nan 11910 nan nan 11940 nan nan 11970 nan nan 12000 nan nan 12030 nan nan 12060 nan nan 12090 nan nan 12120 nan nan 12150 nan nan 12180 nan nan 12210 nan nan 12240 nan nan 12270 nan nan 12300 nan nan 12330 nan nan 12360 nan nan 12390 nan nan 12420 nan nan 12450 nan nan 12480 nan nan 12510 nan nan 12540 nan nan 12570 nan nan 12600 nan nan 12630 nan nan 12660 nan nan 12690 nan nan 12720 nan nan 12750 nan nan 12780 nan nan 12810 nan nan 12840 nan nan 12870 nan nan 12900 nan nan 12930 nan nan 12960 nan nan 12990 nan nan 13020 nan nan 13050 nan nan 13080 nan nan 13110 nan nan 13140 nan nan 13170 nan nan 13200 nan nan 13230 nan nan 13260 nan nan 13290 nan nan 13320 nan nan 13350 nan nan 13380 nan nan 13410 nan nan 13440 nan nan 13470 nan nan 13500 nan nan 13530 nan nan 13560 nan nan 13590 nan nan 13620 nan nan 13650 nan nan 13680 nan nan 13710 nan nan 13740 nan nan 13770 nan nan 13800 nan nan 13830 nan nan 13860 nan nan 13890 nan nan 13920 nan nan 13950 nan nan 13980 nan nan 14010 nan nan 14040 nan nan 14070 nan nan 14100 nan nan 14130 nan nan 14160 nan nan 14190 nan nan 14220 nan nan 14250 nan nan 14280 nan nan 14310 nan nan 14340 nan nan 14370 nan nan 14400 nan nan 14430 nan nan 14460 nan nan 14490 nan nan 14520 nan nan 14550 nan nan 14580 nan nan 14610 nan nan 14640 nan nan 14670 nan nan 14700 nan nan 14730 nan nan 14760 nan nan 14790 nan nan 14820 nan nan 14850 nan nan 14880 nan nan 14910 nan nan 14940 nan nan 14970 nan nan 15000 nan nan 15030 nan nan 15060 nan nan 15090 nan nan 15120 nan nan 15150 nan nan 15180 nan nan 15210 nan nan 15240 nan nan 15270 nan nan 15300 nan nan 15330 nan nan 15360 nan nan 15390 nan nan 15420 nan nan 15450 nan nan 15480 nan nan 15510 nan nan 15540 nan nan 15570 nan nan 15600 nan nan 15630 nan nan 15660 nan nan 15690 nan nan 15720 nan nan 15750 nan nan 15780 nan nan 15810 nan nan 15840 nan nan 15870 nan nan 15900 nan nan 15930 nan nan 15960 nan nan 15990 nan nan 16020 nan nan 16050 nan nan 16080 nan nan 16110 nan nan 16140 nan nan 16170 nan nan 16200 nan nan 16230 nan nan 16260 nan nan 16290 nan nan 16320 nan nan 16350 nan nan 16380 nan nan 16410 nan nan 16440 nan nan 16470 nan nan 16500 nan nan 16530 nan nan 16560 nan nan 16590 nan nan 16620 nan nan 16650 nan nan 16680 nan nan 16710 nan nan 16740 nan nan 16770 nan nan 16800 nan nan 16830 nan nan 16860 nan nan 16890 nan nan 16920 nan nan 16950 nan nan 16980 nan nan 17010 nan nan 17040 nan nan 17070 nan nan 17100 nan nan 17130 nan nan 17160 nan nan 17190 nan nan 17220 nan nan 17250 nan nan 17280 nan nan 17310 nan nan 17340 nan nan 17370 nan nan 17400 nan nan 17430 nan nan 17460 nan nan 17490 nan nan 17520 nan nan 17550 nan nan 17580 nan nan 17610 nan nan 17640 nan nan 17670 nan nan 17700 nan nan 17730 nan nan 17760 nan nan 17790 nan nan 17820 nan nan 17850 nan nan 17880 nan nan 17910 nan nan 17940 nan nan 17970 nan nan 18000 nan nan 18030 nan nan 18060 nan nan 18090 nan nan 18120 nan nan 18150 nan nan 18180 nan nan 18210 nan nan 18240 nan nan 18270 nan nan 18300 nan nan 18330 nan nan 18360 nan nan 18390 nan nan 18420 nan nan 18450 nan nan 18480 nan nan 18510 nan nan 18540 nan nan 18570 nan nan 18600 nan nan 18630 nan nan 18660 nan nan 18690 nan nan 18720 nan nan 18750 nan nan 18780 nan nan 18810 nan nan 18840 nan nan 18870 nan nan 18900 nan nan 18930 nan nan 18960 nan nan 18990 nan nan 19020 nan nan 19050 nan nan 19080 nan nan 19110 nan nan 19140 nan nan 19170 nan nan 19200 nan nan 19230 nan nan 19260 nan nan 19290 nan nan 19320 nan nan 19350 nan nan 19380 nan nan 19410 nan nan 19440 nan nan 19470 nan nan 19500 nan nan 19530 nan nan 19560 nan nan 19590 nan nan 19620 nan nan 19650 nan nan 19680 nan nan 19710 nan nan 19740 nan nan 19770 nan nan 19800 nan nan 19830 nan nan 19860 nan nan 19890 nan nan 19920 nan nan 19950 nan nan 19980 nan nan 20010 nan nan 20040 nan nan 20070 nan nan 20100 nan nan 20130 nan nan 20160 nan nan 20190 nan nan 20220 nan nan 20250 nan nan 20280 nan nan 20310 nan nan 20340 nan nan 20370 nan nan 20400 nan nan 20430 nan nan 20460 nan nan 20490 nan nan 20520 nan nan 20550 nan nan 20580 nan nan 20610 nan nan 20640 nan nan 20670 nan nan 20700 nan nan 20730 nan nan 20760 nan nan 20790 nan nan 20820 nan nan 20850 nan nan 20880 nan nan 20910 nan nan 20940 nan nan 20970 nan nan 21000 nan nan 21030 nan nan 21060 nan nan 21090 nan nan 21120 nan nan 21150 nan nan 21180 nan nan 21210 nan nan 21240 nan nan 21270 nan nan 21300 nan nan 21330 nan nan 21360 nan nan 21390 nan nan 21420 nan nan 21450 nan nan 21480 nan nan 21510 nan nan 21540 nan nan 21570 nan nan 21600 nan nan 21630 nan nan 21660 nan nan 21690 nan nan 21720 nan nan 21750 nan nan 21780 nan nan 21810 nan nan 21840 nan nan 21870 nan nan 21900 nan nan 21930 nan nan 21960 nan nan 21990 nan nan 22020 nan nan 22050 nan nan 22080 nan nan 22110 nan nan 22140 nan nan 22170 nan nan 22200 nan nan 22230 nan nan 22260 nan nan 22290 nan nan 22320 nan nan 22350 nan nan 22380 nan nan 22410 nan nan 22440 nan nan 22470 nan nan 22500 nan nan 22530 nan nan 22560 nan nan 22590 nan nan 22620 nan nan 22650 nan nan 22680 nan nan 22710 nan nan 22740 nan nan 22770 nan nan 22800 nan nan 22830 nan nan 22860 nan nan 22890 nan nan 22920 nan nan 22950 nan nan 22980 nan nan 23010 nan nan 23040 nan nan 23070 nan nan 23100 nan nan 23130 nan nan 23160 nan nan 23190 nan nan 23220 nan nan 23250 nan nan 23280 nan nan 23310 nan nan 23340 nan nan 23370 nan nan 23400 nan nan 23430 nan nan 23460 nan nan 23490 nan nan 23520 nan nan 23550 nan nan 23580 nan nan 23610 nan nan 23640 nan nan 23670 nan nan 23700 nan nan 23730 nan nan 23760 nan nan 23790 nan nan 23820 nan nan 23850 nan nan 23880 nan nan 23910 nan nan 23940 nan nan 23970 nan nan 24000 nan nan 24030 nan nan 24060 nan nan 24090 nan nan 24120 nan nan 24150 nan nan 24180 nan nan 24210 nan nan 24240 nan nan 24270 nan nan 24300 nan nan 24330 nan nan 24360 nan nan 24390 nan nan 24420 nan nan 24450 nan nan 24480 nan nan 24510 nan nan 24540 nan nan 24570 nan nan 24600 nan nan 24630 nan nan 24660 nan nan 24690 nan nan 24720 nan nan 24750 nan nan 24780 nan nan 24810 nan nan 24840 nan nan 24870 nan nan 24900 nan nan 24930 nan nan 24960 nan nan 24990 nan nan 25020 nan nan 25050 nan nan 25080 nan nan 25110 nan nan 25140 nan nan 25170 nan nan 25200 nan nan 25230 nan nan 25260 nan nan 25290 nan nan 25320 nan nan 25350 nan nan 25380 nan nan 25410 nan nan 25440 nan nan 25470 nan nan 25500 nan nan 25530 nan nan 25560 nan nan 25590 nan nan 25620 nan nan 25650 nan nan 25680 nan nan 25710 nan nan 25740 nan nan 25770 nan nan 25800 nan nan 25830 nan nan 25860 nan nan 25890 nan nan 25920 nan nan 25950 nan nan 25980 nan nan 26010 nan nan 26040 nan nan 26070 nan nan 26100 nan nan 26130 nan nan 26160 nan nan 26190 nan nan 26220 nan nan 26250 nan nan 26280 nan nan 26310 nan nan 26340 nan nan 26370 nan nan 26400 nan nan 26430 nan nan 26460 nan nan 26490 nan nan 26520 nan nan 26550 nan nan 26580 nan nan 26610 nan nan 26640 nan nan 26670 nan nan 26700 nan nan 26730 nan nan 26760 nan nan 26790 nan nan 26820 nan nan 26850 nan nan 26880 nan nan 26910 nan nan 26940 nan nan 26970 nan nan 27000 nan nan 27030 nan nan 27060 nan nan 27090 nan nan 27120 nan nan 27150 nan nan 27180 nan nan 27210 nan nan 27240 nan nan 27270 nan nan 27300 nan nan 27330 nan nan 27360 nan nan 27390 nan nan 27420 nan nan 27450 nan nan 27480 nan nan 27510 nan nan 27540 nan nan 27570 nan nan 27600 nan nan 27630 nan nan 27660 nan nan 27690 nan nan 27720 nan nan 27750 nan nan 27780 nan nan 27810 nan nan 27840 nan nan 27870 nan nan 27900 nan nan 27930 nan nan 27960 nan nan 27990 nan nan 28020 nan nan 28050 nan nan 28080 nan nan 28110 nan nan 28140 nan nan 28170 nan nan 28200 nan nan 28230 nan nan 28260 nan nan 28290 nan nan 28320 nan nan 28350 nan nan 28380 nan nan 28410 nan nan 28440 nan nan 28470 nan nan 28500 nan nan 28530 nan nan 28560 nan nan 28590 nan nan 28620 nan nan 28650 nan nan 28680 nan nan 28710 nan nan 28740 nan nan 28770 nan nan 28800 nan nan 28830 nan nan 28860 nan nan 28890 nan nan 28920 nan nan 28950 nan nan 28980 nan nan 29010 nan nan 29040 nan nan 29070 nan nan 29100 nan nan 29130 nan nan 29160 nan nan 29190 nan nan 29220 nan nan 29250 nan nan 29280 nan nan 29310 nan nan 29340 nan nan 29370 nan nan 29400 nan nan 29430 nan nan 29460 nan nan 29490 nan nan 29520 nan nan 29550 nan nan 29580 nan nan 29610 nan nan 29640 nan nan 29670 nan nan 29700 nan nan 29730 nan nan 29760 nan nan 29790 nan nan 29820 nan nan 29850 nan nan 29880 nan nan 29910 nan nan 29940 nan nan 29970 nan nan 30000 nan nan 30030 nan nan 30060 nan nan 30090 nan nan 30120 nan nan 30150 nan nan 30180 nan nan 30210 nan nan 30240 nan nan 30270 nan nan 30300 nan nan 30330 nan nan 30360 nan nan 30390 nan nan 30420 nan nan 30450 nan nan 30480 nan nan 30510 nan nan 30540 nan nan 30570 nan nan 30600 nan nan 30630 nan nan 30660 nan nan 30690 nan nan 30720 nan nan 30750 nan nan 30780 nan nan 30810 nan nan 30840 nan nan 30870 nan nan 30900 nan nan 30930 nan nan 30960 nan nan 30990 nan nan 31020 nan nan 31050 nan nan 31080 nan nan 31110 nan nan 31140 nan nan 31170 nan nan 31200 nan nan 31230 nan nan 31260 nan nan 31290 nan nan 31320 nan nan 31350 nan nan 31380 nan nan 31410 nan nan 31440 nan nan 31470 nan nan 31500 nan nan 31530 nan nan 31560 nan nan 31590 nan nan 31620 nan nan 31650 nan nan 31680 nan nan 31710 nan nan 31740 nan nan 31770 nan nan 31800 nan nan 31830 nan nan 31860 nan nan 31890 nan nan 31920 nan nan 31950 nan nan 31980 nan nan 32010 nan nan 32040 nan nan 32070 nan nan 32100 nan nan 32130 nan nan 32160 nan nan 32190 nan nan 32220 nan nan 32250 nan nan 32280 nan nan 32310 nan nan 32340 nan nan 32370 nan nan 32400 nan nan 32430 nan nan 32460 nan nan 32490 nan nan 32520 nan nan 32550 nan nan 32580 nan nan 32610 nan nan 32640 nan nan 32670 nan nan 32700 nan nan 32730 nan nan 32760 nan nan 32790 nan nan 32820 nan nan 32850 nan nan 32880 nan nan 32910 nan nan 32940 nan nan 32970 nan nan 33000 nan nan 33030 nan nan 33060 nan nan 33090 nan nan 33120 nan nan 33150 nan nan 33180 nan nan 33210 nan nan 33240 nan nan 33270 nan nan 33300 nan nan 33330 nan nan 33360 nan nan 33390 nan nan 33420 nan nan 33450 nan nan 33480 nan nan 33510 nan nan 33540 nan nan 33570 nan nan 33600 nan nan 33630 nan nan 33660 nan nan 33690 nan nan 33720 nan nan 33750 nan nan 33780 nan nan 33810 nan nan 33840 nan nan 33870 nan nan 33900 nan nan 33930 nan nan 33960 nan nan 33990 nan nan 34020 nan nan 34050 nan nan 34080 nan nan 34110 nan nan 34140 nan nan 34170 nan nan 34200 nan nan 34230 nan nan 34260 nan nan 34290 nan nan 34320 nan nan 34350 nan nan 34380 nan nan 34410 nan nan 34440 nan nan 34470 nan nan 34500 nan nan 34530 nan nan 34560 nan nan 34590 nan nan 34620 nan nan 34650 nan nan 34680 nan nan 34710 nan nan 34740 nan nan 34770 nan nan 34800 nan nan 34830 nan nan 34860 nan nan 34890 nan nan 34920 nan nan 34950 nan nan 34980 nan nan 35010 nan nan 35040 nan nan 35070 nan nan 35100 nan nan 35130 nan nan 35160 nan nan 35190 nan nan 35220 nan nan 35250 nan nan 35280 nan nan 35310 nan nan 35340 nan nan 35370 nan nan 35400 nan nan 35430 nan nan 35460 nan nan 35490 nan nan 35520 nan nan 35550 nan nan 35580 nan nan 35610 nan nan 35640 nan nan 35670 nan nan 35700 nan nan 35730 nan nan 35760 nan nan 35790 nan nan 35820 nan nan 35850 nan nan 35880 nan nan 35910 nan nan 35940 nan nan 35970 nan nan 36000 nan nan 36030 nan nan 36060 nan nan 36090 nan nan 36120 nan nan 36150 nan nan 36180 nan nan 36210 nan nan 36240 nan nan 36270 nan nan 36300 nan nan 36330 nan nan 36360 nan nan 36390 nan nan 36420 nan nan 36450 nan nan 36480 nan nan 36510 nan nan 36540 nan nan 36570 nan nan 36600 nan nan 36630 nan nan 36660 nan nan 36690 nan nan 36720 nan nan 36750 nan nan 36780 nan nan 36810 nan nan 36840 nan nan 36870 nan nan 36900 nan nan 36930 nan nan 36960 nan nan 36990 nan nan 37020 nan nan 37050 nan nan 37080 nan nan 37110 nan nan 37140 nan nan 37170 nan nan 37200 nan nan 37230 nan nan 37260 nan nan 37290 nan nan 37320 nan nan 37350 nan nan 37380 nan nan 37410 nan nan 37440 nan nan 37470 nan nan 37500 nan nan 37530 nan nan 37560 nan nan 37590 nan nan 37620 nan nan 37650 nan nan 37680 nan nan 37710 nan nan 37740 nan nan 37770 nan nan 37800 nan nan 37830 nan nan 37860 nan nan 37890 nan nan 37920 nan nan 37950 nan nan 37980 nan nan 38010 nan nan 38040 nan nan 38070 nan nan 38100 nan nan 38130 nan nan 38160 nan nan 38190 nan nan 38220 nan nan 38250 nan nan 38280 nan nan 38310 nan nan 38340 nan nan 38370 nan nan 38400 nan nan 38430 nan nan 38460 nan nan 38490 nan nan 38520 nan nan 38550 nan nan 38580 nan nan 38610 nan nan 38640 nan nan 38670 nan nan 38700 nan nan 38730 nan nan 38760 nan nan 38790 nan nan 38820 nan nan 38850 nan nan 38880 nan nan 38910 nan nan 38940 nan nan 38970 nan nan 39000 nan nan 39030 nan nan 39060 nan nan 39090 nan nan 39120 nan nan 39150 nan nan 39180 nan nan 39210 nan nan 39240 nan nan 39270 nan nan 39300 nan nan 39330 nan nan 39360 nan nan 39390 nan nan 39420 nan nan 39450 nan nan 39480 nan nan 39510 nan nan 39540 nan nan 39570 nan nan 39600 nan nan 39630 nan nan 39660 nan nan 39690 nan nan 39720 nan nan 39750 nan nan 39780 nan nan 39810 nan nan 39840 nan nan 39870 nan nan 39900 nan nan 39930 nan nan 39960 nan nan 39990 nan nan 40020 nan nan 40050 nan nan 40080 nan nan 40110 nan nan 40140 nan nan 40170 nan nan 40200 nan nan 40230 nan nan 40260 nan nan 40290 nan nan 40320 nan nan 40350 nan nan 40380 nan nan 40410 nan nan 40440 nan nan 40470 nan nan 40500 nan nan 40530 nan nan 40560 nan nan 40590 nan nan 40620 nan nan 40650 nan nan 40680 nan nan 40710 nan nan 40740 nan nan 40770 nan nan 40800 nan nan 40830 nan nan 40860 nan nan 40890 nan nan 40920 nan nan 40950 nan nan 40980 nan nan 41010 nan nan 41040 nan nan 41070 nan nan 41100 nan nan 41130 nan nan 41160 nan nan 41190 nan nan 41220 nan nan 41250 nan nan 41280 nan nan 41310 nan nan 41340 nan nan 41370 nan nan 41400 nan nan 41430 nan nan 41460 nan nan 41490 nan nan 41520 nan nan 41550 nan nan 41580 nan nan 41610 nan nan 41640 nan nan 41670 nan nan 41700 nan nan 41730 nan nan 41760 nan nan 41790 nan nan 41820 nan nan 41850 nan nan 41880 nan nan 41910 nan nan 41940 nan nan 41970 nan nan 42000 nan nan 42030 nan nan 42060 nan nan 42090 nan nan 42120 nan nan 42150 nan nan 42180 nan nan 42210 nan nan 42240 nan nan 42270 nan nan 42300 nan nan 42330 nan nan 42360 nan nan 42390 nan nan 42420 nan nan 42450 nan nan 42480 nan nan 42510 nan nan 42540 nan nan 42570 nan nan 42600 nan nan 42630 nan nan 42660 nan nan 42690 nan nan 42720 nan nan 42750 nan nan 42780 nan nan 42810 nan nan 42840 nan nan 42870 nan nan 42900 nan nan 42930 nan nan 42960 nan nan 42990 nan nan 43020 nan nan 43050 nan nan 43080 nan nan 43110 nan nan 43140 nan nan 43170 nan nan 43200 2.858 0.146 43230 2.864 0.149 43260 2.871 0.151 43290 2.877 0.154 43320 2.884 0.156 43350 2.890 0.159 43380 2.897 0.161 43410 2.903 0.164 43440 2.909 0.166 43470 2.916 0.169 43500 2.922 0.171 43530 2.928 0.174 43560 2.934 0.176 43590 2.940 0.178 43620 2.947 0.181 43650 2.953 0.183 43680 2.959 0.185 43710 2.965 0.188 43740 2.971 0.190 43770 2.977 0.192 43800 2.983 0.195 43830 2.989 0.197 43860 2.995 0.199 43890 3.001 0.202 43920 3.006 0.204 43950 3.012 0.206 43980 3.018 0.209 44010 3.024 0.211 44040 3.030 0.213 44070 3.035 0.215 44100 3.041 0.218 44130 3.047 0.220 44160 3.052 0.222 44190 3.058 0.224 44220 3.063 0.226 44250 3.069 0.229 44280 3.074 0.231 44310 3.080 0.233 44340 3.085 0.235 44370 3.091 0.237 44400 3.096 0.239 44430 3.101 0.242 44460 3.106 0.244 44490 3.111 0.246 44520 3.115 0.249 44550 3.120 0.251 44580 3.125 0.253 44610 3.130 0.256 44640 3.134 0.258 44670 3.139 0.260 44700 3.144 0.263 44730 3.148 0.265 44760 3.153 0.267 44790 3.158 0.269 44820 3.162 0.271 44850 3.167 0.274 44880 3.171 0.276 44910 3.175 0.278 44940 3.180 0.280 44970 3.184 0.282 45000 3.189 0.284 45030 3.193 0.287 45060 3.197 0.289 45090 3.201 0.291 45120 3.206 0.293 45150 3.210 0.295 45180 3.214 0.297 45210 3.218 0.299 45240 3.222 0.301 45270 3.226 0.303 45300 3.230 0.305 45330 3.234 0.307 45360 3.238 0.309 45390 3.242 0.311 45420 3.246 0.313 45450 3.250 0.315 45480 3.254 0.317 45510 3.258 0.319 45540 3.262 0.321 45570 3.265 0.323 45600 3.269 0.325 45630 3.273 0.327 45660 3.277 0.328 45690 3.280 0.330 45720 3.284 0.332 45750 3.287 0.333 45780 3.291 0.335 45810 3.295 0.337 45840 3.298 0.339 45870 3.302 0.340 45900 3.305 0.342 45930 3.309 0.344 45960 3.312 0.345 45990 3.316 0.347 46020 3.319 0.349 46050 3.323 0.350 46080 3.326 0.352 46110 3.329 0.354 46140 3.333 0.355 46170 3.336 0.357 46200 3.339 0.359 46230 3.343 0.360 46260 3.346 0.362 46290 3.349 0.364 46320 3.353 0.365 46350 3.356 0.367 46380 3.359 0.368 46410 3.362 0.370 46440 3.365 0.372 46470 3.368 0.373 46500 3.372 0.375 46530 3.375 0.376 46560 3.378 0.378 46590 3.381 0.379 46620 3.384 0.381 46650 3.387 0.382 46680 3.390 0.384 46710 3.393 0.385 46740 3.396 0.387 46770 3.399 0.389 46800 3.402 0.390 46830 3.405 0.391 46860 3.408 0.391 46890 3.412 0.392 46920 3.415 0.393 46950 3.418 0.393 46980 3.421 0.394 47010 3.425 0.395 47040 3.428 0.395 47070 3.431 0.396 47100 3.435 0.397 47130 3.438 0.397 47160 3.441 0.398 47190 3.444 0.399 47220 3.447 0.399 47250 3.451 0.400 47280 3.454 0.401 47310 3.457 0.402 47340 3.460 0.402 47370 3.463 0.403 47400 3.467 0.404 47430 3.470 0.404 47460 3.473 0.405 47490 3.476 0.406 47520 3.479 0.406 47550 3.482 0.407 47580 3.486 0.408 47610 3.489 0.408 47640 3.492 0.409 47670 3.495 0.410 47700 3.498 0.410 47730 3.501 0.411 47760 3.504 0.412 47790 3.507 0.412 47820 3.511 0.413 47850 3.514 0.414 47880 3.517 0.414 47910 3.520 0.415 47940 3.523 0.416 47970 3.526 0.416 48000 3.529 0.417 48030 3.534 0.418 48060 3.539 0.418 48090 3.543 0.419 48120 3.548 0.419 48150 3.553 0.420 48180 3.558 0.420 48210 3.563 0.421 48240 3.568 0.421 48270 3.573 0.422 48300 3.578 0.423 48330 3.583 0.423 48360 3.588 0.424 48390 3.593 0.424 48420 3.598 0.425 48450 3.603 0.425 48480 3.608 0.426 48510 3.613 0.427 48540 3.619 0.427 48570 3.624 0.428 48600 3.629 0.428 48630 3.634 0.429 48660 3.639 0.430 48690 3.645 0.430 48720 3.650 0.431 48750 3.655 0.431 48780 3.661 0.432 48810 3.666 0.433 48840 3.671 0.433 48870 3.677 0.434 48900 3.682 0.435 48930 3.688 0.435 48960 3.693 0.436 48990 3.698 0.437 49020 3.704 0.437 49050 3.709 0.438 49080 3.715 0.438 49110 3.721 0.439 49140 3.726 0.440 49170 3.732 0.440 49200 3.737 0.441 49230 3.745 0.442 49260 3.752 0.443 49290 3.760 0.444 49320 3.767 0.445 49350 3.775 0.447 49380 3.783 0.448 49410 3.791 0.449 49440 3.798 0.450 49470 3.806 0.451 49500 3.814 0.452 49530 3.822 0.453 49560 3.830 0.454 49590 3.838 0.455 49620 3.846 0.457 49650 3.855 0.458 49680 3.863 0.459 49710 3.871 0.460 49740 3.879 0.461 49770 3.888 0.462 49800 3.896 0.463 49830 3.905 0.465 49860 3.913 0.466 49890 3.922 0.467 49920 3.930 0.468 49950 3.939 0.469 49980 3.948 0.470 50010 3.957 0.472 50040 3.966 0.473 50070 3.974 0.474 50100 3.983 0.475 50130 3.992 0.476 50160 4.001 0.477 50190 4.010 0.479 50220 4.020 0.480 50250 4.029 0.481 50280 4.038 0.482 50310 4.047 0.483 50340 4.057 0.485 50370 4.066 0.486 50400 4.076 0.487 50430 4.086 0.488 50460 4.096 0.490 50490 4.107 0.491 50520 4.117 0.492 50550 4.128 0.494 50580 4.138 0.495 50610 4.148 0.496 50640 4.158 0.497 50670 4.168 0.499 50700 4.179 0.500 50730 4.189 0.501 50760 4.199 0.502 50790 4.209 0.504 50820 4.219 0.505 50850 4.229 0.506 50880 4.239 0.507 50910 4.248 0.508 50940 4.258 0.510 50970 4.268 0.511 51000 4.278 0.512 51030 4.288 0.513 51060 4.297 0.515 51090 4.307 0.516 51120 4.317 0.517 51150 4.326 0.518 51180 4.336 0.519 51210 4.345 0.521 51240 4.355 0.522 51270 4.364 0.523 51300 4.373 0.524 51330 4.383 0.525 51360 4.392 0.527 51390 4.401 0.528 51420 4.411 0.529 51450 4.420 0.530 51480 4.429 0.531 51510 4.438 0.532 51540 4.447 0.534 51570 4.456 0.535 51600 4.465 0.536 51630 4.472 0.537 51660 4.479 0.538 51690 4.486 0.539 51720 4.493 0.540 51750 4.500 0.542 51780 4.507 0.543 51810 4.514 0.544 51840 4.520 0.545 51870 4.527 0.546 51900 4.534 0.547 51930 4.541 0.548 51960 4.548 0.549 51990 4.554 0.550 52020 4.561 0.552 52050 4.568 0.553 52080 4.575 0.554 52110 4.581 0.555 52140 4.588 0.556 52170 4.595 0.557 52200 4.601 0.558 52230 4.608 0.559 52260 4.614 0.560 52290 4.621 0.561 52320 4.628 0.562 52350 4.634 0.564 52380 4.641 0.565 52410 4.647 0.566 52440 4.654 0.567 52470 4.660 0.568 52500 4.667 0.569 52530 4.673 0.570 52560 4.680 0.571 52590 4.686 0.572 52620 4.692 0.573 52650 4.699 0.574 52680 4.705 0.575 52710 4.711 0.576 52740 4.718 0.577 52770 4.724 0.578 52800 4.730 0.579 52830 4.735 0.578 52860 4.740 0.577 52890 4.745 0.577 52920 4.750 0.576 52950 4.754 0.575 52980 4.759 0.574 53010 4.764 0.573 53040 4.768 0.572 53070 4.773 0.572 53100 4.778 0.571 53130 4.782 0.570 53160 4.787 0.569 53190 4.792 0.569 53220 4.796 0.568 53250 4.801 0.567 53280 4.806 0.566 53310 4.810 0.566 53340 4.815 0.565 53370 4.819 0.564 53400 4.824 0.564 53430 4.828 0.563 53460 4.833 0.562 53490 4.837 0.562 53520 4.842 0.561 53550 4.846 0.560 53580 4.851 0.560 53610 4.855 0.559 53640 4.860 0.559 53670 4.864 0.558 53700 4.868 0.557 53730 4.873 0.557 53760 4.877 0.556 53790 4.882 0.556 53820 4.886 0.555 53850 4.890 0.555 53880 4.895 0.554 53910 4.899 0.554 53940 4.903 0.553 53970 4.907 0.553 54000 4.912 0.552 54030 4.914 0.552 54060 4.916 0.551 54090 4.919 0.551 54120 4.921 0.550 54150 4.923 0.550 54180 4.926 0.550 54210 4.928 0.549 54240 4.930 0.549 54270 4.933 0.548 54300 4.935 0.548 54330 4.938 0.547 54360 4.940 0.547 54390 4.943 0.547 54420 4.945 0.546 54450 4.948 0.546 54480 4.950 0.545 54510 4.953 0.545 54540 4.955 0.544 54570 4.958 0.544 54600 4.960 0.544 54630 4.963 0.543 54660 4.966 0.543 54690 4.968 0.542 54720 4.971 0.542 54750 4.974 0.542 54780 4.977 0.541 54810 4.979 0.541 54840 4.982 0.541 54870 4.985 0.540 54900 4.988 0.540 54930 4.991 0.539 54960 4.994 0.539 54990 4.996 0.539 55020 4.999 0.538 55050 5.002 0.538 55080 5.005 0.538 55110 5.008 0.537 55140 5.011 0.537 55170 5.014 0.537 55200 5.017 0.536 55230 5.018 0.536 55260 5.018 0.535 55290 5.018 0.535 55320 5.018 0.534 55350 5.019 0.534 55380 5.019 0.533 55410 5.019 0.533 55440 5.020 0.532 55470 5.020 0.532 55500 5.021 0.531 55530 5.021 0.531 55560 5.022 0.530 55590 5.023 0.530 55620 5.023 0.529 55650 5.024 0.529 55680 5.024 0.528 55710 5.025 0.528 55740 5.026 0.527 55770 5.027 0.527 55800 5.027 0.526 55830 5.028 0.525 55860 5.029 0.525 55890 5.030 0.524 55920 5.031 0.524 55950 5.032 0.523 55980 5.033 0.523 56010 5.034 0.522 56040 5.035 0.521 56070 5.036 0.521 56100 5.037 0.520 56130 5.038 0.520 56160 5.039 0.519 56190 5.041 0.519 56220 5.042 0.518 56250 5.043 0.517 56280 5.044 0.517 56310 5.046 0.516 56340 5.047 0.516 56370 5.048 0.515 56400 5.050 0.514 56430 5.050 0.513 56460 5.050 0.511 56490 5.050 0.510 56520 5.051 0.509 56550 5.051 0.507 56580 5.051 0.506 56610 5.052 0.504 56640 5.052 0.503 56670 5.052 0.501 56700 5.053 0.500 56730 5.053 0.498 56760 5.054 0.497 56790 5.054 0.495 56820 5.055 0.494 56850 5.056 0.493 56880 5.056 0.491 56910 5.057 0.490 56940 5.058 0.488 56970 5.058 0.487 57000 5.059 0.485 57030 5.060 0.484 57060 5.061 0.482 57090 5.062 0.481 57120 5.063 0.479 57150 5.064 0.478 57180 5.065 0.476 57210 5.066 0.475 57240 5.067 0.473 57270 5.068 0.472 57300 5.069 0.470 57330 5.070 0.469 57360 5.071 0.467 57390 5.073 0.465 57420 5.074 0.464 57450 5.075 0.462 57480 5.077 0.461 57510 5.078 0.459 57540 5.079 0.458 57570 5.081 0.456 57600 5.082 0.455 57630 5.079 0.453 57660 5.076 0.452 57690 5.073 0.450 57720 5.070 0.449 57750 5.067 0.447 57780 5.064 0.446 57810 5.061 0.444 57840 5.058 0.443 57870 5.055 0.441 57900 5.052 0.440 57930 5.050 0.438 57960 5.047 0.437 57990 5.044 0.435 58020 5.041 0.434 58050 5.039 0.432 58080 5.036 0.431 58110 5.033 0.429 58140 5.031 0.428 58170 5.028 0.426 58200 5.025 0.425 58230 5.023 0.423 58260 5.020 0.422 58290 5.018 0.420 58320 5.015 0.419 58350 5.013 0.417 58380 5.010 0.415 58410 5.008 0.414 58440 5.006 0.412 58470 5.003 0.411 58500 5.001 0.409 58530 4.999 0.408 58560 4.997 0.406 58590 4.994 0.405 58620 4.992 0.403 58650 4.990 0.401 58680 4.988 0.400 58710 4.986 0.398 58740 4.984 0.397 58770 4.981 0.395 58800 4.979 0.394 58830 4.975 0.392 58860 4.971 0.391 58890 4.967 0.390 58920 4.962 0.389 58950 4.958 0.388 58980 4.954 0.386 59010 4.950 0.385 59040 4.946 0.384 59070 4.942 0.383 59100 4.938 0.382 59130 4.934 0.380 59160 4.930 0.379 59190 4.926 0.378 59220 4.922 0.377 59250 4.918 0.376 59280 4.914 0.374 59310 4.911 0.373 59340 4.907 0.372 59370 4.903 0.371 59400 4.900 0.369 59430 4.896 0.368 59460 4.892 0.367 59490 4.889 0.366 59520 4.885 0.364 59550 4.882 0.363 59580 4.878 0.362 59610 4.875 0.361 59640 4.871 0.359 59670 4.868 0.358 59700 4.865 0.357 59730 4.861 0.356 59760 4.858 0.354 59790 4.855 0.353 59820 4.852 0.352 59850 4.849 0.351 59880 4.845 0.349 59910 4.842 0.348 59940 4.839 0.347 59970 4.836 0.345 60000 4.833 0.344 60030 4.831 0.343 60060 4.828 0.341 60090 4.826 0.339 60120 4.823 0.338 60150 4.820 0.336 60180 4.818 0.335 60210 4.815 0.333 60240 4.813 0.332 60270 4.810 0.331 60300 4.808 0.329 60330 4.805 0.328 60360 4.803 0.326 60390 4.800 0.325 60420 4.798 0.324 60450 4.795 0.322 60480 4.793 0.321 60510 4.790 0.319 60540 4.788 0.318 60570 4.785 0.317 60600 4.783 0.316 60630 4.780 0.314 60660 4.778 0.313 60690 4.775 0.312 60720 4.773 0.311 60750 4.770 0.309 60780 4.768 0.308 60810 4.765 0.307 60840 4.763 0.306 60870 4.760 0.305 60900 4.758 0.303 60930 4.755 0.302 60960 4.753 0.301 60990 4.750 0.300 61020 4.748 0.299 61050 4.745 0.298 61080 4.743 0.297 61110 4.740 0.296 61140 4.738 0.295 61170 4.736 0.294 61200 4.733 0.293 61230 4.729 0.293 61260 4.724 0.293 61290 4.720 0.294 61320 4.715 0.294 61350 4.711 0.294 61380 4.707 0.294 61410 4.702 0.295 61440 4.698 0.295 61470 4.694 0.295 61500 4.690 0.295 61530 4.685 0.296 61560 4.681 0.296 61590 4.677 0.296 61620 4.673 0.296 61650 4.669 0.296 61680 4.665 0.297 61710 4.661 0.297 61740 4.657 0.297 61770 4.653 0.297 61800 4.649 0.297 61830 4.645 0.297 61860 4.641 0.298 61890 4.637 0.298 61920 4.633 0.298 61950 4.629 0.298 61980 4.625 0.298 62010 4.621 0.298 62040 4.617 0.298 62070 4.614 0.299 62100 4.610 0.299 62130 4.606 0.299 62160 4.602 0.299 62190 4.599 0.299 62220 4.595 0.299 62250 4.591 0.299 62280 4.588 0.299 62310 4.584 0.299 62340 4.581 0.299 62370 4.577 0.299 62400 4.573 0.299 62430 4.570 0.300 62460 4.566 0.300 62490 4.562 0.301 62520 4.558 0.301 62550 4.554 0.302 62580 4.550 0.302 62610 4.546 0.303 62640 4.543 0.303 62670 4.539 0.304 62700 4.535 0.305 62730 4.531 0.305 62760 4.527 0.306 62790 4.524 0.306 62820 4.520 0.307 62850 4.516 0.307 62880 4.512 0.308 62910 4.509 0.308 62940 4.505 0.309 62970 4.501 0.309 63000 4.498 0.310 63030 4.494 0.310 63060 4.490 0.311 63090 4.487 0.311 63120 4.483 0.312 63150 4.480 0.312 63180 4.476 0.313 63210 4.472 0.313 63240 4.469 0.314 63270 4.465 0.315 63300 4.462 0.315 63330 4.458 0.316 63360 4.455 0.316 63390 4.451 0.317 63420 4.448 0.317 63450 4.444 0.318 63480 4.441 0.318 63510 4.438 0.319 63540 4.434 0.319 63570 4.431 0.320 63600 4.427 0.320 63630 4.426 0.320 63660 4.424 0.319 63690 4.423 0.318 63720 4.422 0.318 63750 4.420 0.317 63780 4.419 0.316 63810 4.417 0.316 63840 4.416 0.315 63870 4.415 0.315 63900 4.413 0.314 63930 4.412 0.313 63960 4.411 0.313 63990 4.410 0.312 64020 4.409 0.311 64050 4.407 0.311 64080 4.406 0.310 64110 4.405 0.309 64140 4.404 0.309 64170 4.403 0.308 64200 4.402 0.307 64230 4.401 0.306 64260 4.400 0.306 64290 4.398 0.305 64320 4.397 0.304 64350 4.396 0.304 64380 4.396 0.303 64410 4.395 0.302 64440 4.394 0.301 64470 4.393 0.301 64500 4.392 0.300 64530 4.391 0.299 64560 4.390 0.298 64590 4.389 0.298 64620 4.388 0.297 64650 4.388 0.296 64680 4.387 0.295 64710 4.386 0.295 64740 4.385 0.294 64770 4.385 0.293 64800 4.384 0.292 64830 4.380 0.293 64860 4.376 0.294 64890 4.372 0.296 64920 4.368 0.297 64950 4.364 0.298 64980 4.360 0.299 65010 4.356 0.300 65040 4.352 0.301 65070 4.348 0.301 65100 4.344 0.302 65130 4.340 0.303 65160 4.336 0.304 65190 4.332 0.305 65220 4.329 0.306 65250 4.325 0.307 65280 4.321 0.308 65310 4.317 0.308 65340 4.314 0.309 65370 4.310 0.310 65400 4.306 0.311 65430 4.303 0.311 65460 4.299 0.312 65490 4.295 0.313 65520 4.292 0.313 65550 4.288 0.314 65580 4.285 0.315 65610 4.281 0.315 65640 4.278 0.316 65670 4.274 0.317 65700 4.271 0.317 65730 4.267 0.318 65760 4.264 0.318 65790 4.261 0.319 65820 4.257 0.319 65850 4.254 0.320 65880 4.251 0.320 65910 4.248 0.321 65940 4.244 0.321 65970 4.241 0.322 66000 4.238 0.322 66030 4.233 0.322 66060 4.229 0.323 66090 4.224 0.323 66120 4.219 0.323 66150 4.215 0.324 66180 4.210 0.324 66210 4.206 0.324 66240 4.201 0.325 66270 4.196 0.325 66300 4.192 0.325 66330 4.187 0.326 66360 4.182 0.326 66390 4.178 0.327 66420 4.173 0.327 66450 4.168 0.327 66480 4.163 0.328 66510 4.159 0.328 66540 4.154 0.328 66570 4.149 0.329 66600 4.145 0.329 66630 4.140 0.329 66660 4.135 0.330 66690 4.130 0.330 66720 4.126 0.330 66750 4.121 0.331 66780 4.116 0.331 66810 4.111 0.331 66840 4.106 0.332 66870 4.102 0.332 66900 4.097 0.332 66930 4.092 0.333 66960 4.087 0.333 66990 4.082 0.333 67020 4.078 0.334 67050 4.073 0.334 67080 4.068 0.334 67110 4.063 0.335 67140 4.058 0.335 67170 4.053 0.335 67200 4.048 0.336 67230 4.042 0.335 67260 4.036 0.335 67290 4.029 0.335 67320 4.023 0.335 67350 4.017 0.335 67380 4.010 0.334 67410 4.004 0.334 67440 3.998 0.334 67470 3.991 0.334 67500 3.985 0.334 67530 3.978 0.333 67560 3.972 0.333 67590 3.966 0.333 67620 3.959 0.333 67650 3.953 0.332 67680 3.946 0.332 67710 3.940 0.332 67740 3.933 0.332 67770 3.927 0.331 67800 3.921 0.331 67830 3.914 0.331 67860 3.908 0.331 67890 3.901 0.330 67920 3.895 0.330 67950 3.888 0.330 67980 3.882 0.329 68010 3.876 0.329 68040 3.869 0.329 68070 3.863 0.329 68100 3.856 0.328 68130 3.850 0.328 68160 3.843 0.328 68190 3.837 0.327 68220 3.830 0.327 68250 3.824 0.327 68280 3.817 0.326 68310 3.811 0.326 68340 3.804 0.326 68370 3.798 0.325 68400 3.791 0.325 68430 3.784 0.325 68460 3.776 0.325 68490 3.768 0.325 68520 3.760 0.325 68550 3.753 0.324 68580 3.745 0.324 68610 3.737 0.324 68640 3.729 0.324 68670 3.722 0.324 68700 3.714 0.324 68730 3.706 0.324 68760 3.698 0.324 68790 3.690 0.323 68820 3.682 0.323 68850 3.675 0.323 68880 3.667 0.323 68910 3.659 0.323 68940 3.651 0.323 68970 3.643 0.323 69000 3.635 0.322 69030 3.627 0.322 69060 3.619 0.322 69090 3.611 0.322 69120 3.603 0.322 69150 3.595 0.322 69180 3.587 0.322 69210 3.579 0.321 69240 3.571 0.321 69270 3.563 0.321 69300 3.555 0.321 69330 3.547 0.321 69360 3.539 0.321 69390 3.531 0.321 69420 3.523 0.321 69450 3.515 0.320 69480 3.507 0.320 69510 3.499 0.320 69540 3.491 0.320 69570 3.483 0.320 69600 3.475 0.320 69630 3.467 0.320 69660 3.458 0.320 69690 3.450 0.320 69720 3.442 0.320 69750 3.433 0.320 69780 3.425 0.320 69810 3.416 0.320 69840 3.408 0.320 69870 3.399 0.320 69900 3.391 0.320 69930 3.382 0.320 69960 3.374 0.320 69990 3.365 0.320 70020 3.357 0.320 70050 3.348 0.320 70080 3.339 0.320 70110 3.331 0.320 70140 3.322 0.321 70170 3.313 0.321 70200 3.304 0.321 70230 3.295 0.321 70260 3.287 0.321 70290 3.278 0.321 70320 3.269 0.321 70350 3.260 0.321 70380 3.251 0.322 70410 3.242 0.322 70440 3.233 0.322 70470 3.224 0.322 70500 3.215 0.322 70530 3.206 0.323 70560 3.197 0.323 70590 3.188 0.323 70620 3.178 0.323 70650 3.169 0.323 70680 3.160 0.324 70710 3.151 0.324 70740 3.142 0.324 70770 3.132 0.324 70800 3.123 0.325 70830 3.116 0.324 70860 3.109 0.324 70890 3.102 0.323 70920 3.095 0.323 70950 3.088 0.322 70980 3.080 0.322 71010 3.073 0.322 71040 3.066 0.321 71070 3.059 0.321 71100 3.052 0.320 71130 3.044 0.320 71160 3.037 0.319 71190 3.030 0.319 71220 3.022 0.318 71250 3.015 0.318 71280 3.008 0.318 71310 3.000 0.317 71340 2.993 0.317 71370 2.986 0.316 71400 2.978 0.316 71430 2.971 0.316 71460 2.963 0.315 71490 2.956 0.315 71520 2.948 0.314 71550 2.941 0.314 71580 2.933 0.314 71610 2.926 0.313 71640 2.918 0.313 71670 2.910 0.312 71700 2.903 0.312 71730 2.895 0.312 71760 2.887 0.311 71790 2.880 0.311 71820 2.872 0.311 71850 2.864 0.310 71880 2.857 0.310 71910 2.849 0.310 71940 2.841 0.309 71970 2.833 0.309 72000 2.825 0.309 72030 2.817 0.310 72060 2.809 0.311 72090 2.801 0.312 72120 2.793 0.313 72150 2.785 0.314 72180 2.777 0.315 72210 2.769 0.316 72240 2.761 0.317 72270 2.753 0.318 72300 2.745 0.320 72330 2.737 0.321 72360 2.729 0.322 72390 2.721 0.323 72420 2.714 0.324 72450 2.706 0.325 72480 2.698 0.326 72510 2.690 0.327 72540 2.682 0.328 72570 2.675 0.328 72600 2.667 0.329 72630 2.659 0.330 72660 2.652 0.331 72690 2.644 0.332 72720 2.636 0.333 72750 2.629 0.334 72780 2.621 0.335 72810 2.613 0.336 72840 2.606 0.337 72870 2.598 0.337 72900 2.591 0.338 72930 2.583 0.339 72960 2.576 0.340 72990 2.568 0.341 73020 2.561 0.342 73050 2.554 0.342 73080 2.546 0.343 73110 2.539 0.344 73140 2.531 0.345 73170 2.524 0.346 73200 2.517 0.346 73230 2.512 0.346 73260 2.507 0.346 73290 2.502 0.346 73320 2.496 0.346 73350 2.491 0.346 73380 2.486 0.346 73410 2.481 0.346 73440 2.476 0.346 73470 2.471 0.345 73500 2.466 0.345 73530 2.460 0.345 73560 2.455 0.345 73590 2.450 0.345 73620 2.445 0.345 73650 2.440 0.345 73680 2.434 0.344 73710 2.429 0.344 73740 2.424 0.344 73770 2.419 0.344 73800 2.413 0.344 73830 2.408 0.343 73860 2.403 0.343 73890 2.397 0.343 73920 2.392 0.343 73950 2.387 0.342 73980 2.381 0.342 74010 2.376 0.342 74040 2.371 0.342 74070 2.365 0.341 74100 2.360 0.341 74130 2.355 0.341 74160 2.349 0.340 74190 2.344 0.340 74220 2.338 0.340 74250 2.333 0.339 74280 2.328 0.339 74310 2.322 0.339 74340 2.317 0.338 74370 2.311 0.338 74400 2.306 0.338 74430 2.302 0.337 74460 2.299 0.336 74490 2.295 0.336 74520 2.292 0.335 74550 2.288 0.334 74580 2.284 0.334 74610 2.281 0.333 74640 2.277 0.332 74670 2.273 0.332 74700 2.270 0.331 74730 2.266 0.330 74760 2.262 0.330 74790 2.258 0.329 74820 2.254 0.328 74850 2.251 0.328 74880 2.247 0.327 74910 2.243 0.326 74940 2.239 0.326 74970 2.235 0.325 75000 2.231 0.324 75030 2.227 0.324 75060 2.222 0.323 75090 2.218 0.322 75120 2.214 0.322 75150 2.210 0.321 75180 2.206 0.321 75210 2.201 0.320 75240 2.197 0.319 75270 2.193 0.319 75300 2.188 0.318 75330 2.184 0.318 75360 2.180 0.317 75390 2.175 0.316 75420 2.171 0.316 75450 2.166 0.315 75480 2.162 0.315 75510 2.157 0.314 75540 2.153 0.313 75570 2.148 0.313 75600 2.143 0.312 75630 2.140 0.312 75660 2.138 0.311 75690 2.135 0.310 75720 2.132 0.309 75750 2.129 0.309 75780 2.126 0.308 75810 2.123 0.307 75840 2.120 0.306 75870 2.117 0.306 75900 2.114 0.305 75930 2.111 0.304 75960 2.108 0.303 75990 2.105 0.302 76020 2.102 0.302 76050 2.098 0.301 76080 2.095 0.300 76110 2.092 0.299 76140 2.089 0.298 76170 2.086 0.297 76200 2.082 0.296 76230 2.079 0.296 76260 2.076 0.295 76290 2.073 0.294 76320 2.069 0.293 76350 2.066 0.292 76380 2.063 0.291 76410 2.059 0.290 76440 2.056 0.289 76470 2.052 0.288 76500 2.049 0.287 76530 2.045 0.286 76560 2.042 0.285 76590 2.038 0.284 76620 2.035 0.283 76650 2.031 0.282 76680 2.028 0.281 76710 2.024 0.280 76740 2.021 0.279 76770 2.017 0.278 76800 2.013 0.277 76830 2.012 0.277 76860 2.010 0.276 76890 2.009 0.276 76920 2.007 0.275 76950 2.006 0.275 76980 2.004 0.275 77010 2.003 0.274 77040 2.001 0.274 77070 1.999 0.273 77100 1.998 0.273 77130 1.996 0.272 77160 1.995 0.272 77190 1.993 0.272 77220 1.991 0.271 77250 1.990 0.271 77280 1.988 0.270 77310 1.986 0.270 77340 1.984 0.269 77370 1.983 0.269 77400 1.981 0.268 77430 1.979 0.268 77460 1.977 0.267 77490 1.976 0.267 77520 1.974 0.266 77550 1.972 0.266 77580 1.970 0.265 77610 1.968 0.265 77640 1.966 0.264 77670 1.965 0.264 77700 1.963 0.263 77730 1.961 0.262 77760 1.959 0.262 77790 1.957 0.261 77820 1.955 0.261 77850 1.953 0.260 77880 1.951 0.260 77910 1.949 0.259 77940 1.947 0.258 77970 1.945 0.258 78000 1.943 0.257 78030 1.941 0.257 78060 1.940 0.257 78090 1.938 0.256 78120 1.937 0.256 78150 1.935 0.256 78180 1.933 0.255 78210 1.932 0.255 78240 1.930 0.255 78270 1.928 0.255 78300 1.927 0.254 78330 1.925 0.254 78360 1.923 0.254 78390 1.921 0.253 78420 1.920 0.253 78450 1.918 0.253 78480 1.916 0.252 78510 1.914 0.252 78540 1.912 0.252 78570 1.910 0.251 78600 1.909 0.251 78630 1.907 0.251 78660 1.905 0.250 78690 1.903 0.250 78720 1.901 0.250 78750 1.899 0.249 78780 1.897 0.249 78810 1.895 0.249 78840 1.893 0.248 78870 1.891 0.248 78900 1.889 0.247 78930 1.887 0.247 78960 1.885 0.247 78990 1.882 0.246 79020 1.880 0.246 79050 1.878 0.246 79080 1.876 0.245 79110 1.874 0.245 79140 1.872 0.244 79170 1.870 0.244 79200 1.867 0.244 79230 1.866 0.244 79260 1.865 0.244 79290 1.864 0.244 79320 1.863 0.244 79350 1.863 0.245 79380 1.862 0.245 79410 1.861 0.245 79440 1.860 0.245 79470 1.859 0.246 79500 1.858 0.246 79530 1.858 0.246 79560 1.857 0.246 79590 1.856 0.247 79620 1.855 0.247 79650 1.855 0.247 79680 1.854 0.248 79710 1.853 0.248 79740 1.853 0.248 79770 1.852 0.249 79800 1.852 0.249 79830 1.851 0.249 79860 1.851 0.250 79890 1.850 0.250 79920 1.850 0.250 79950 1.849 0.251 79980 1.849 0.251 80010 1.849 0.252 80040 1.848 0.252 80070 1.848 0.252 80100 1.847 0.253 80130 1.847 0.253 80160 1.847 0.254 80190 1.847 0.254 80220 1.846 0.255 80250 1.846 0.255 80280 1.846 0.256 80310 1.846 0.256 80340 1.846 0.256 80370 1.846 0.257 80400 1.846 0.258 80430 1.845 0.258 80460 1.845 0.258 80490 1.845 0.258 80520 1.844 0.259 80550 1.844 0.259 80580 1.844 0.259 80610 1.843 0.260 80640 1.843 0.260 80670 1.843 0.260 80700 1.843 0.261 80730 1.843 0.261 80760 1.843 0.261 80790 1.843 0.261 80820 1.843 0.262 80850 1.843 0.262 80880 1.843 0.262 80910 1.843 0.263 80940 1.843 0.263 80970 1.843 0.263 81000 1.843 0.263 81030 1.843 0.264 81060 1.843 0.264 81090 1.843 0.264 81120 1.844 0.265 81150 1.844 0.265 81180 1.844 0.265 81210 1.845 0.265 81240 1.845 0.266 81270 1.845 0.266 81300 1.846 0.266 81330 1.846 0.266 81360 1.846 0.267 81390 1.847 0.267 81420 1.847 0.267 81450 1.848 0.267 81480 1.849 0.268 81510 1.849 0.268 81540 1.850 0.268 81570 1.850 0.269 81600 1.851 0.269 81630 1.852 0.269 81660 1.853 0.269 81690 1.854 0.270 81720 1.855 0.270 81750 1.857 0.270 81780 1.858 0.270 81810 1.859 0.270 81840 1.860 0.271 81870 1.861 0.271 81900 1.862 0.271 81930 1.863 0.271 81960 1.865 0.272 81990 1.866 0.272 82020 1.867 0.272 82050 1.868 0.272 82080 1.869 0.273 82110 1.870 0.273 82140 1.872 0.273 82170 1.873 0.273 82200 1.874 0.274 82230 1.875 0.274 82260 1.876 0.274 82290 1.878 0.274 82320 1.879 0.274 82350 1.880 0.275 82380 1.881 0.275 82410 1.883 0.275 82440 1.884 0.275 82470 1.885 0.275 82500 1.887 0.276 82530 1.888 0.276 82560 1.889 0.276 82590 1.890 0.276 82620 1.892 0.277 82650 1.893 0.277 82680 1.894 0.277 82710 1.896 0.277 82740 1.897 0.277 82770 1.898 0.278 82800 1.900 0.278 82830 1.900 0.278 82860 1.901 0.278 82890 1.902 0.278 82920 1.903 0.278 82950 1.903 0.278 82980 1.904 0.278 83010 1.905 0.278 83040 1.905 0.278 83070 1.906 0.278 83100 1.907 0.278 83130 1.907 0.278 83160 1.908 0.278 83190 1.909 0.278 83220 1.909 0.278 83250 1.910 0.278 83280 1.910 0.278 83310 1.911 0.278 83340 1.912 0.278 83370 1.912 0.278 83400 1.913 0.278 83430 1.913 0.278 83460 1.914 0.278 83490 1.914 0.278 83520 1.915 0.278 83550 1.915 0.278 83580 1.916 0.278 83610 1.916 0.278 83640 1.917 0.278 83670 1.917 0.277 83700 1.918 0.277 83730 1.918 0.277 83760 1.918 0.277 83790 1.919 0.277 83820 1.919 0.277 83850 1.920 0.277 83880 1.920 0.277 83910 1.920 0.276 83940 1.921 0.276 83970 1.921 0.276 84000 1.921 0.276 84030 1.921 0.276 84060 1.921 0.277 84090 1.921 0.277 84120 1.920 0.278 84150 1.920 0.278 84180 1.920 0.278 84210 1.919 0.279 84240 1.919 0.279 84270 1.918 0.280 84300 1.918 0.280 84330 1.918 0.281 84360 1.917 0.281 84390 1.916 0.281 84420 1.916 0.282 84450 1.915 0.282 84480 1.915 0.283 84510 1.914 0.283 84540 1.913 0.284 84570 1.913 0.284 84600 1.912 0.284 84630 1.911 0.285 84660 1.910 0.285 84690 1.910 0.286 84720 1.909 0.286 84750 1.908 0.286 84780 1.907 0.287 84810 1.906 0.287 84840 1.905 0.288 84870 1.904 0.288 84900 1.903 0.289 84930 1.902 0.289 84960 1.901 0.289 84990 1.900 0.290 85020 1.899 0.290 85050 1.898 0.291 85080 1.897 0.291 85110 1.895 0.291 85140 1.894 0.292 85170 1.893 0.292 85200 1.892 0.293 85230 1.891 0.292 85260 1.890 0.292 85290 1.889 0.292 85320 1.887 0.292 85350 1.886 0.291 85380 1.885 0.291 85410 1.884 0.291 85440 1.883 0.291 85470 1.882 0.290 85500 1.880 0.290 85530 1.879 0.290 85560 1.878 0.289 85590 1.877 0.289 85620 1.875 0.289 85650 1.874 0.288 85680 1.873 0.288 85710 1.871 0.288 85740 1.870 0.287 85770 1.869 0.287 85800 1.867 0.286 85830 1.866 0.286 85860 1.864 0.286 85890 1.863 0.285 85920 1.861 0.285 85950 1.860 0.284 85980 1.858 0.284 86010 1.857 0.283 86040 1.855 0.283 86070 1.854 0.282 86100 1.852 0.282 86130 1.850 0.281 86160 1.849 0.281 86190 1.847 0.280 86220 1.845 0.280 86250 1.844 0.279 86280 1.842 0.278 86310 1.840 0.278 86340 1.838 0.277 86370 1.837 0.277 86400 1.835 0.276 86430 1.832 0.276 86460 1.830 0.276 86490 1.828 0.276 86520 1.825 0.276 86550 1.823 0.276 86580 1.821 0.276 86610 1.818 0.277 86640 1.816 0.277 86670 1.814 0.277 86700 1.811 0.277 86730 1.809 0.277 86760 1.807 0.277 86790 1.804 0.277 86820 1.802 0.277 86850 1.800 0.277 86880 1.797 0.277 86910 1.795 0.277 86940 1.793 0.277 86970 1.790 0.277 87000 1.788 0.277 87030 1.786 0.277 87060 1.784 0.277 87090 1.781 0.278 87120 1.779 0.278 87150 1.777 0.278 87180 1.774 0.278 87210 1.772 0.278 87240 1.770 0.278 87270 1.768 0.278 87300 1.765 0.278 87330 1.763 0.278 87360 1.761 0.278 87390 1.759 0.278 87420 1.756 0.278 87450 1.754 0.278 87480 1.752 0.278 87510 1.750 0.278 87540 1.747 0.278 87570 1.745 0.278 87600 1.743 0.278 87630 1.741 0.279 87660 1.739 0.279 87690 1.737 0.279 87720 1.736 0.279 87750 1.734 0.280 87780 1.732 0.280 87810 1.730 0.280 87840 1.728 0.280 87870 1.726 0.281 87900 1.725 0.281 87930 1.723 0.281 87960 1.721 0.281 87990 1.719 0.281 88020 1.718 0.281 88050 1.716 0.282 88080 1.714 0.282 88110 1.712 0.282 88140 1.710 0.282 88170 1.709 0.282 88200 1.707 0.282 88230 1.705 0.282 88260 1.703 0.283 88290 1.702 0.283 88320 1.700 0.283 88350 1.698 0.283 88380 1.696 0.283 88410 1.695 0.283 88440 1.693 0.283 88470 1.691 0.283 88500 1.690 0.283 88530 1.688 0.283 88560 1.686 0.283 88590 1.684 0.283 88620 1.683 0.283 88650 1.681 0.283 88680 1.679 0.283 88710 1.678 0.283 88740 1.676 0.283 88770 1.674 0.283 88800 1.672 0.283 88830 1.671 0.283 88860 1.669 0.283 88890 1.667 0.282 88920 1.665 0.282 88950 1.663 0.282 88980 1.661 0.281 89010 1.660 0.281 89040 1.658 0.281 89070 1.656 0.280 89100 1.654 0.280 89130 1.652 0.280 89160 1.651 0.279 89190 1.649 0.279 89220 1.647 0.279 89250 1.645 0.278 89280 1.643 0.278 89310 1.641 0.278 89340 1.640 0.277 89370 1.638 0.277 89400 1.636 0.277 89430 1.634 0.276 89460 1.632 0.276 89490 1.630 0.276 89520 1.629 0.275 89550 1.627 0.275 89580 1.625 0.275 89610 1.623 0.274 89640 1.621 0.274 89670 1.619 0.273 89700 1.618 0.273 89730 1.616 0.273 89760 1.614 0.272 89790 1.612 0.272 89820 1.610 0.271 89850 1.609 0.271 89880 1.607 0.271 89910 1.605 0.270 89940 1.603 0.270 89970 1.601 0.269 90000 1.599 0.269 90030 1.598 0.269 90060 1.596 0.269 90090 1.594 0.269 90120 1.592 0.269 90150 1.590 0.269 90180 1.588 0.269 90210 1.586 0.269 90240 1.585 0.269 90270 1.583 0.269 90300 1.581 0.269 90330 1.579 0.269 90360 1.577 0.269 90390 1.575 0.268 90420 1.573 0.268 90450 1.571 0.268 90480 1.569 0.268 90510 1.567 0.268 90540 1.565 0.268 90570 1.563 0.268 90600 1.561 0.268 90630 1.560 0.268 90660 1.558 0.268 90690 1.556 0.268 90720 1.554 0.268 90750 1.552 0.268 90780 1.550 0.267 90810 1.548 0.267 90840 1.546 0.267 90870 1.544 0.267 90900 1.542 0.267 90930 1.539 0.267 90960 1.537 0.267 90990 1.535 0.267 91020 1.533 0.266 91050 1.531 0.266 91080 1.529 0.266 91110 1.527 0.266 91140 1.525 0.266 91170 1.523 0.266 91200 1.521 0.266 91230 1.520 0.266 91260 1.519 0.266 91290 1.517 0.267 91320 1.516 0.267 91350 1.515 0.268 91380 1.514 0.268 91410 1.513 0.269 91440 1.512 0.269 91470 1.511 0.270 91500 1.509 0.270 91530 1.508 0.270 91560 1.507 0.271 91590 1.506 0.271 91620 1.505 0.272 91650 1.504 0.272 91680 1.502 0.273 91710 1.501 0.273 91740 1.500 0.274 91770 1.499 0.274 91800 1.498 0.275 91830 1.497 0.275 91860 1.496 0.276 91890 1.494 0.276 91920 1.493 0.277 91950 1.492 0.277 91980 1.491 0.277 92010 1.490 0.278 92040 1.489 0.278 92070 1.488 0.279 92100 1.486 0.279 92130 1.485 0.280 92160 1.484 0.281 92190 1.483 0.281 92220 1.482 0.282 92250 1.481 0.282 92280 1.479 0.283 92310 1.478 0.283 92340 1.477 0.284 92370 1.476 0.284 92400 1.475 0.285 92430 1.474 0.285 92460 1.474 0.285 92490 1.474 0.285 92520 1.473 0.285 92550 1.473 0.285 92580 1.473 0.286 92610 1.472 0.286 92640 1.472 0.286 92670 1.471 0.286 92700 1.471 0.286 92730 1.471 0.286 92760 1.470 0.287 92790 1.470 0.287 92820 1.470 0.287 92850 1.469 0.287 92880 1.469 0.287 92910 1.468 0.287 92940 1.468 0.288 92970 1.468 0.288 93000 1.467 0.288 93030 1.467 0.288 93060 1.467 0.288 93090 1.466 0.289 93120 1.466 0.289 93150 1.466 0.289 93180 1.465 0.289 93210 1.465 0.289 93240 1.465 0.290 93270 1.465 0.290 93300 1.464 0.290 93330 1.464 0.290 93360 1.464 0.290 93390 1.463 0.291 93420 1.463 0.291 93450 1.463 0.291 93480 1.462 0.291 93510 1.462 0.292 93540 1.462 0.292 93570 1.462 0.292 93600 1.461 0.292 93630 1.461 0.292 93660 1.461 0.293 93690 1.461 0.293 93720 1.460 0.293 93750 1.460 0.293 93780 1.460 0.294 93810 1.460 0.294 93840 1.459 0.294 93870 1.459 0.294 93900 1.459 0.294 93930 1.459 0.295 93960 1.458 0.295 93990 1.458 0.295 94020 1.458 0.295 94050 1.458 0.296 94080 1.457 0.296 94110 1.457 0.296 94140 1.457 0.296 94170 1.457 0.296 94200 1.457 0.297 94230 1.456 0.297 94260 1.456 0.297 94290 1.456 0.297 94320 1.456 0.298 94350 1.456 0.298 94380 1.455 0.298 94410 1.455 0.298 94440 1.455 0.298 94470 1.455 0.299 94500 1.455 0.299 94530 1.455 0.299 94560 1.454 0.299 94590 1.454 0.299 94620 1.454 0.300 94650 1.454 0.300 94680 1.454 0.300 94710 1.454 0.300 94740 1.454 0.301 94770 1.453 0.301 94800 1.453 0.301 94830 1.453 0.301 94860 1.453 0.301 94890 1.454 0.301 94920 1.454 0.301 94950 1.454 0.300 94980 1.454 0.300 95010 1.454 0.300 95040 1.454 0.300 95070 1.454 0.300 95100 1.454 0.300 95130 1.455 0.300 95160 1.455 0.300 95190 1.455 0.300 95220 1.455 0.300 95250 1.455 0.300 95280 1.455 0.300 95310 1.455 0.300 95340 1.455 0.299 95370 1.455 0.299 95400 1.455 0.299 95430 1.455 0.299 95460 1.455 0.299 95490 1.455 0.299 95520 1.456 0.299 95550 1.456 0.299 95580 1.456 0.299 95610 1.456 0.299 95640 1.456 0.299 95670 1.456 0.299 95700 1.456 0.299 95730 1.456 0.299 95760 1.456 0.299 95790 1.456 0.299 95820 1.456 0.299 95850 1.456 0.299 95880 1.456 0.299 95910 1.456 0.299 95940 1.456 0.299 95970 1.456 0.299 96000 1.456 0.299 96030 1.456 0.300 96060 1.456 0.300 96090 1.456 0.300 96120 1.455 0.300 96150 1.455 0.301 96180 1.455 0.301 96210 1.455 0.301 96240 1.455 0.301 96270 1.455 0.302 96300 1.455 0.302 96330 1.455 0.302 96360 1.455 0.303 96390 1.454 0.303 96420 1.454 0.303 96450 1.454 0.303 96480 1.454 0.304 96510 1.454 0.304 96540 1.454 0.304 96570 1.454 0.305 96600 1.454 0.305 96630 1.454 0.305 96660 1.454 0.305 96690 1.454 0.306 96720 1.454 0.306 96750 1.454 0.306 96780 1.454 0.306 96810 1.454 0.307 96840 1.453 0.307 96870 1.453 0.307 96900 1.453 0.308 96930 1.453 0.308 96960 1.453 0.308 96990 1.453 0.308 97020 1.453 0.309 97050 1.453 0.309 97080 1.453 0.309 97110 1.453 0.309 97140 1.453 0.310 97170 1.453 0.310 97200 1.453 0.310 97230 1.453 0.310 97260 1.453 0.310 97290 1.453 0.310 97320 1.452 0.311 97350 1.452 0.311 97380 1.452 0.311 97410 1.452 0.311 97440 1.452 0.311 97470 1.451 0.311 97500 1.451 0.311 97530 1.451 0.311 97560 1.451 0.312 97590 1.451 0.312 97620 1.450 0.312 97650 1.450 0.312 97680 1.450 0.312 97710 1.450 0.312 97740 1.450 0.312 97770 1.449 0.312 97800 1.449 0.313 97830 1.449 0.313 97860 1.449 0.313 97890 1.449 0.313 97920 1.448 0.313 97950 1.448 0.313 97980 1.448 0.314 98010 1.448 0.314 98040 1.448 0.314 98070 1.447 0.314 98100 1.447 0.314 98130 1.447 0.314 98160 1.447 0.315 98190 1.447 0.315 98220 1.446 0.315 98250 1.446 0.315 98280 1.446 0.315 98310 1.446 0.316 98340 1.446 0.316 98370 1.445 0.316 98400 1.445 0.316 98430 1.445 0.316 98460 1.445 0.316 98490 1.445 0.316 98520 1.444 0.316 98550 1.444 0.316 98580 1.444 0.316 98610 1.444 0.316 98640 1.444 0.316 98670 1.444 0.316 98700 1.444 0.316 98730 1.443 0.316 98760 1.443 0.316 98790 1.443 0.316 98820 1.443 0.316 98850 1.443 0.316 98880 1.443 0.316 98910 1.443 0.316 98940 1.443 0.316 98970 1.443 0.316 99000 1.443 0.316 99030 1.443 0.316 99060 1.443 0.316 99090 1.443 0.316 99120 1.443 0.316 99150 1.443 0.316 99180 1.443 0.316 99210 1.443 0.316 99240 1.443 0.316 99270 1.443 0.316 99300 1.444 0.316 99330 1.444 0.316 99360 1.444 0.316 99390 1.444 0.315 99420 1.444 0.315 99450 1.444 0.315 99480 1.444 0.315 99510 1.445 0.315 99540 1.445 0.315 99570 1.445 0.315 99600 1.445 0.315 99630 1.444 0.315 99660 1.443 0.315 99690 1.443 0.314 99720 1.442 0.314 99750 1.441 0.314 99780 1.440 0.314 99810 1.439 0.314 99840 1.439 0.314 99870 1.438 0.313 99900 1.437 0.313 99930 1.436 0.313 99960 1.435 0.313 99990 1.435 0.313 100020 1.434 0.313 100050 1.433 0.313 100080 1.432 0.312 100110 1.431 0.312 100140 1.431 0.312 100170 1.430 0.312 100200 1.429 0.312 100230 1.428 0.312 100260 1.427 0.311 100290 1.426 0.311 100320 1.426 0.311 100350 1.425 0.311 100380 1.424 0.311 100410 1.423 0.311 100440 1.422 0.310 100470 1.422 0.310 100500 1.421 0.310 100530 1.420 0.310 100560 1.419 0.310 100590 1.418 0.310 100620 1.418 0.309 100650 1.417 0.309 100680 1.416 0.309 100710 1.415 0.309 100740 1.414 0.309 100770 1.413 0.309 100800 1.413 0.309 100830 1.411 0.308 100860 1.410 0.307 100890 1.408 0.307 100920 1.406 0.306 100950 1.405 0.306 100980 1.403 0.306 101010 1.402 0.305 101040 1.401 0.305 101070 1.399 0.304 101100 1.398 0.304 101130 1.396 0.303 101160 1.395 0.303 101190 1.393 0.302 101220 1.392 0.302 101250 1.390 0.301 101280 1.389 0.301 101310 1.388 0.300 101340 1.386 0.300 101370 1.385 0.299 101400 1.384 0.299 101430 1.382 0.299 101460 1.381 0.298 101490 1.380 0.298 101520 1.378 0.297 101550 1.377 0.297 101580 1.376 0.297 101610 1.374 0.296 101640 1.373 0.296 101670 1.372 0.295 101700 1.371 0.295 101730 1.369 0.295 101760 1.368 0.294 101790 1.367 0.294 101820 1.366 0.293 101850 1.364 0.293 101880 1.363 0.293 101910 1.362 0.292 101940 1.361 0.292 101970 1.360 0.291 102000 1.359 0.291 102030 1.358 0.291 102060 1.357 0.290 102090 1.356 0.290 102120 1.356 0.289 102150 1.355 0.289 102180 1.354 0.288 102210 1.354 0.288 102240 1.353 0.288 102270 1.352 0.287 102300 1.352 0.287 102330 1.351 0.286 102360 1.350 0.286 102390 1.350 0.285 102420 1.349 0.285 102450 1.348 0.285 102480 1.348 0.284 102510 1.347 0.284 102540 1.347 0.283 102570 1.346 0.283 102600 1.346 0.282 102630 1.345 0.282 102660 1.345 0.281 102690 1.344 0.281 102720 1.344 0.281 102750 1.343 0.280 102780 1.343 0.280 102810 1.342 0.279 102840 1.342 0.279 102870 1.341 0.278 102900 1.341 0.278 102930 1.340 0.277 102960 1.340 0.277 102990 1.339 0.276 103020 1.339 0.276 103050 1.339 0.276 103080 1.338 0.275 103110 1.338 0.275 103140 1.338 0.274 103170 1.337 0.274 103200 1.337 0.273 103230 1.336 0.273 103260 1.336 0.273 103290 1.335 0.273 103320 1.335 0.273 103350 1.335 0.273 103380 1.334 0.273 103410 1.334 0.273 103440 1.333 0.273 103470 1.333 0.273 103500 1.332 0.273 103530 1.332 0.273 103560 1.332 0.273 103590 1.331 0.273 103620 1.331 0.273 103650 1.331 0.273 103680 1.330 0.272 103710 1.330 0.272 103740 1.329 0.272 103770 1.329 0.272 103800 1.329 0.272 103830 1.328 0.272 103860 1.328 0.272 103890 1.328 0.272 103920 1.327 0.272 103950 1.327 0.272 103980 1.327 0.272 104010 1.327 0.272 104040 1.326 0.272 104070 1.326 0.272 104100 1.326 0.272 104130 1.325 0.272 104160 1.325 0.271 104190 1.325 0.271 104220 1.325 0.271 104250 1.324 0.271 104280 1.324 0.271 104310 1.324 0.271 104340 1.324 0.271 104370 1.324 0.271 104400 1.323 0.271 104430 1.324 0.271 104460 1.325 0.272 104490 1.326 0.272 104520 1.327 0.272 104550 1.327 0.272 104580 1.328 0.273 104610 1.329 0.273 104640 1.330 0.273 104670 1.331 0.273 104700 1.331 0.273 104730 1.332 0.274 104760 1.333 0.274 104790 1.334 0.274 104820 1.334 0.274 104850 1.335 0.274 104880 1.336 0.275 104910 1.337 0.275 104940 1.337 0.275 104970 1.338 0.275 105000 1.339 0.275 105030 1.340 0.275 105060 1.340 0.275 105090 1.341 0.276 105120 1.342 0.276 105150 1.343 0.276 105180 1.343 0.276 105210 1.344 0.276 105240 1.345 0.276 105270 1.345 0.276 105300 1.346 0.276 105330 1.347 0.276 105360 1.348 0.277 105390 1.348 0.277 105420 1.349 0.277 105450 1.350 0.277 105480 1.350 0.277 105510 1.351 0.277 105540 1.352 0.277 105570 1.352 0.277 105600 1.353 0.277 105630 1.354 0.277 105660 1.354 0.278 105690 1.355 0.278 105720 1.355 0.278 105750 1.356 0.279 105780 1.356 0.279 105810 1.357 0.279 105840 1.357 0.279 105870 1.358 0.280 105900 1.359 0.280 105930 1.359 0.280 105960 1.360 0.281 105990 1.360 0.281 106020 1.361 0.281 106050 1.361 0.281 106080 1.362 0.282 106110 1.362 0.282 106140 1.363 0.282 106170 1.363 0.282 106200 1.364 0.283 106230 1.364 0.283 106260 1.365 0.283 106290 1.366 0.283 106320 1.366 0.284 106350 1.367 0.284 106380 1.367 0.284 106410 1.368 0.284 106440 1.368 0.285 106470 1.369 0.285 106500 1.369 0.285 106530 1.370 0.285 106560 1.370 0.285 106590 1.371 0.286 106620 1.372 0.286 106650 1.372 0.286 106680 1.373 0.286 106710 1.373 0.287 106740 1.374 0.287 106770 1.374 0.287 106800 1.375 0.287 106830 1.375 0.288 106860 1.376 0.288 106890 1.376 0.289 106920 1.377 0.289 106950 1.377 0.290 106980 1.378 0.291 107010 1.378 0.291 107040 1.379 0.292 107070 1.379 0.292 107100 1.380 0.293 107130 1.380 0.293 107160 1.381 0.294 107190 1.381 0.295 107220 1.382 0.295 107250 1.382 0.296 107280 1.383 0.296 107310 1.383 0.297 107340 1.384 0.297 107370 1.384 0.298 107400 1.385 0.298 107430 1.385 0.299 107460 1.386 0.299 107490 1.387 0.300 107520 1.387 0.301 107550 1.388 0.301 107580 1.388 0.302 107610 1.389 0.302 107640 1.389 0.303 107670 1.390 0.303 107700 1.390 0.304 107730 1.391 0.304 107760 1.392 0.305 107790 1.392 0.305 107820 1.393 0.306 107850 1.393 0.306 107880 1.394 0.307 107910 1.395 0.307 107940 1.395 0.308 107970 1.396 0.308 108000 1.396 0.309 108030 1.396 0.309 108060 1.395 0.310 108090 1.394 0.310 108120 1.393 0.311 108150 1.392 0.311 108180 1.391 0.312 108210 1.390 0.312 108240 1.389 0.313 108270 1.388 0.313 108300 1.388 0.314 108330 1.387 0.314 108360 1.386 0.315 108390 1.385 0.315 108420 1.384 0.315 108450 1.383 0.316 108480 1.382 0.316 108510 1.381 0.317 108540 1.381 0.317 108570 1.380 0.318 108600 1.379 0.318 108630 1.378 0.318 108660 1.377 0.319 108690 1.376 0.319 108720 1.375 0.320 108750 1.374 0.320 108780 1.374 0.320 108810 1.373 0.321 108840 1.372 0.321 108870 1.371 0.321 108900 1.370 0.322 108930 1.369 0.322 108960 1.368 0.322 108990 1.367 0.323 109020 1.366 0.323 109050 1.366 0.323 109080 1.365 0.324 109110 1.364 0.324 109140 1.363 0.324 109170 1.362 0.324 109200 1.361 0.325 109230 1.360 0.325 109260 1.359 0.325 109290 1.358 0.326 109320 1.357 0.326 109350 1.356 0.326 109380 1.355 0.327 109410 1.354 0.327 109440 1.353 0.327 109470 1.352 0.328 109500 1.351 0.328 109530 1.350 0.328 109560 1.349 0.329 109590 1.348 0.329 109620 1.347 0.329 109650 1.346 0.329 109680 1.345 0.330 109710 1.344 0.330 109740 1.343 0.330 109770 1.342 0.331 109800 1.342 0.331 109830 1.341 0.331 109860 1.340 0.331 109890 1.339 0.332 109920 1.338 0.332 109950 1.337 0.332 109980 1.337 0.332 110010 1.336 0.333 110040 1.335 0.333 110070 1.334 0.333 110100 1.333 0.333 110130 1.333 0.334 110160 1.332 0.334 110190 1.331 0.334 110220 1.330 0.334 110250 1.330 0.335 110280 1.329 0.335 110310 1.328 0.335 110340 1.327 0.335 110370 1.327 0.335 110400 1.326 0.336 110430 1.325 0.335 110460 1.324 0.335 110490 1.322 0.334 110520 1.321 0.334 110550 1.320 0.333 110580 1.319 0.333 110610 1.318 0.332 110640 1.317 0.332 110670 1.315 0.331 110700 1.314 0.331 110730 1.313 0.330 110760 1.312 0.330 110790 1.311 0.330 110820 1.310 0.329 110850 1.309 0.329 110880 1.307 0.328 110910 1.306 0.328 110940 1.305 0.327 110970 1.304 0.327 111000 1.303 0.326 111030 1.302 0.326 111060 1.301 0.325 111090 1.300 0.325 111120 1.299 0.324 111150 1.298 0.324 111180 1.297 0.323 111210 1.296 0.323 111240 1.295 0.322 111270 1.294 0.322 111300 1.293 0.321 111330 1.292 0.321 111360 1.291 0.321 111390 1.290 0.320 111420 1.289 0.320 111450 1.288 0.319 111480 1.287 0.319 111510 1.286 0.318 111540 1.285 0.318 111570 1.284 0.317 111600 1.283 0.317 111630 1.282 0.316 111660 1.282 0.315 111690 1.281 0.315 111720 1.281 0.314 111750 1.280 0.313 111780 1.280 0.313 111810 1.279 0.312 111840 1.279 0.311 111870 1.278 0.311 111900 1.278 0.310 111930 1.277 0.309 111960 1.277 0.309 111990 1.276 0.308 112020 1.276 0.308 112050 1.275 0.307 112080 1.275 0.306 112110 1.275 0.306 112140 1.274 0.305 112170 1.274 0.304 112200 1.273 0.304 112230 1.273 0.303 112260 1.272 0.303 112290 1.272 0.302 112320 1.272 0.301 112350 1.271 0.301 112380 1.271 0.300 112410 1.271 0.300 112440 1.270 0.299 112470 1.270 0.298 112500 1.270 0.298 112530 1.269 0.297 112560 1.269 0.297 112590 1.269 0.296 112620 1.268 0.296 112650 1.268 0.295 112680 1.268 0.294 112710 1.267 0.294 112740 1.267 0.293 112770 1.267 0.293 112800 1.267 0.292 112830 1.266 0.292 112860 1.265 0.291 112890 1.264 0.291 112920 1.263 0.290 112950 1.262 0.290 112980 1.261 0.289 113010 1.260 0.289 113040 1.259 0.288 113070 1.258 0.288 113100 1.257 0.287 113130 1.256 0.287 113160 1.255 0.286 113190 1.254 0.286 113220 1.254 0.285 113250 1.253 0.285 113280 1.252 0.284 113310 1.251 0.284 113340 1.250 0.283 113370 1.249 0.283 113400 1.248 0.282 113430 1.247 0.282 113460 1.246 0.281 113490 1.246 0.281 113520 1.245 0.280 113550 1.244 0.280 113580 1.243 0.279 113610 1.242 0.279 113640 1.241 0.278 113670 1.240 0.278 113700 1.240 0.278 113730 1.239 0.277 113760 1.238 0.277 113790 1.237 0.276 113820 1.236 0.276 113850 1.235 0.275 113880 1.235 0.275 113910 1.234 0.275 113940 1.233 0.274 113970 1.232 0.274 114000 1.231 0.273 114030 1.230 0.273 114060 1.228 0.273 114090 1.227 0.273 114120 1.225 0.273 114150 1.224 0.273 114180 1.222 0.273 114210 1.220 0.273 114240 1.219 0.274 114270 1.217 0.274 114300 1.216 0.274 114330 1.214 0.274 114360 1.213 0.274 114390 1.211 0.274 114420 1.210 0.274 114450 1.208 0.274 114480 1.206 0.274 114510 1.205 0.274 114540 1.203 0.274 114570 1.202 0.274 114600 1.200 0.274 114630 1.199 0.274 114660 1.197 0.274 114690 1.196 0.274 114720 1.194 0.274 114750 1.192 0.274 114780 1.191 0.275 114810 1.189 0.275 114840 1.188 0.275 114870 1.186 0.275 114900 1.185 0.275 114930 1.183 0.275 114960 1.182 0.275 114990 1.180 0.275 115020 1.178 0.275 115050 1.177 0.275 115080 1.175 0.276 115110 1.174 0.276 115140 1.172 0.276 115170 1.171 0.276 115200 1.169 0.276 115230 1.168 0.276 115260 1.168 0.276 115290 1.167 0.275 115320 1.166 0.275 115350 1.166 0.275 115380 1.165 0.274 115410 1.165 0.274 115440 1.164 0.274 115470 1.163 0.274 115500 1.163 0.273 115530 1.162 0.273 115560 1.162 0.273 115590 1.161 0.273 115620 1.161 0.272 115650 1.160 0.272 115680 1.160 0.272 115710 1.159 0.272 115740 1.159 0.271 115770 1.158 0.271 115800 1.158 0.271 115830 1.157 0.271 115860 1.157 0.270 115890 1.156 0.270 115920 1.156 0.270 115950 1.155 0.269 115980 1.155 0.269 116010 1.155 0.269 116040 1.154 0.269 116070 1.154 0.268 116100 1.153 0.268 116130 1.153 0.268 116160 1.153 0.268 116190 1.152 0.267 116220 1.152 0.267 116250 1.152 0.267 116280 1.151 0.267 116310 1.151 0.266 116340 1.151 0.266 116370 1.150 0.266 116400 1.150 0.265 116430 1.151 0.266 116460 1.152 0.266 116490 1.153 0.266 116520 1.154 0.266 116550 1.155 0.266 116580 1.156 0.266 116610 1.156 0.266 116640 1.157 0.266 116670 1.158 0.266 116700 1.159 0.266 116730 1.160 0.266 116760 1.161 0.266 116790 1.162 0.266 116820 1.163 0.266 116850 1.164 0.266 116880 1.165 0.266 116910 1.166 0.266 116940 1.167 0.266 116970 1.168 0.266 117000 1.169 0.266 117030 1.170 0.266 117060 1.171 0.266 117090 1.172 0.266 117120 1.173 0.266 117150 1.174 0.266 117180 1.175 0.266 117210 1.176 0.266 117240 1.177 0.266 117270 1.178 0.266 117300 1.180 0.266 117330 1.181 0.266 117360 1.182 0.266 117390 1.183 0.266 117420 1.184 0.266 117450 1.185 0.266 117480 1.186 0.266 117510 1.187 0.266 117540 1.188 0.265 117570 1.190 0.265 117600 1.191 0.265 117630 1.194 0.265 117660 1.196 0.265 117690 1.199 0.266 117720 1.202 0.266 117750 1.205 0.266 117780 1.207 0.266 117810 1.210 0.266 117840 1.213 0.266 117870 1.216 0.266 117900 1.218 0.266 117930 1.221 0.266 117960 1.224 0.266 117990 1.227 0.266 118020 1.229 0.266 118050 1.232 0.266 118080 1.235 0.266 118110 1.237 0.266 118140 1.240 0.267 118170 1.243 0.267 118200 1.246 0.267 118230 1.248 0.267 118260 1.251 0.267 118290 1.254 0.267 118320 1.256 0.267 118350 1.259 0.267 118380 1.262 0.267 118410 1.264 0.267 118440 1.267 0.267 118470 1.270 0.267 118500 1.272 0.267 118530 1.275 0.267 118560 1.278 0.267 118590 1.280 0.268 118620 1.283 0.268 118650 1.286 0.268 118680 1.288 0.268 118710 1.291 0.268 118740 1.294 0.268 118770 1.296 0.268 118800 1.299 0.268 118830 1.303 0.268 118860 1.307 0.269 118890 1.311 0.269 118920 1.315 0.269 118950 1.319 0.269 118980 1.323 0.270 119010 1.327 0.270 119040 1.331 0.270 119070 1.336 0.270 119100 1.340 0.271 119130 1.344 0.271 119160 1.348 0.271 119190 1.352 0.271 119220 1.356 0.271 119250 1.360 0.272 119280 1.364 0.272 119310 1.368 0.272 119340 1.372 0.272 119370 1.376 0.272 119400 1.380 0.273 119430 1.384 0.273 119460 1.388 0.273 119490 1.392 0.273 119520 1.396 0.273 119550 1.400 0.274 119580 1.405 0.274 119610 1.409 0.274 119640 1.413 0.274 119670 1.417 0.274 119700 1.421 0.275 119730 1.425 0.275 119760 1.429 0.275 119790 1.433 0.275 119820 1.437 0.275 119850 1.441 0.275 119880 1.445 0.275 119910 1.449 0.276 119940 1.453 0.276 119970 1.457 0.276 120000 1.461 0.276 120030 1.467 0.276 120060 1.472 0.277 120090 1.477 0.277 120120 1.482 0.277 120150 1.488 0.277 120180 1.493 0.278 120210 1.498 0.278 120240 1.503 0.278 120270 1.508 0.279 120300 1.514 0.279 120330 1.519 0.279 120360 1.524 0.280 120390 1.529 0.280 120420 1.534 0.280 120450 1.539 0.280 120480 1.544 0.281 120510 1.550 0.281 120540 1.555 0.281 120570 1.560 0.282 120600 1.565 0.282 120630 1.570 0.282 120660 1.575 0.283 120690 1.580 0.283 120720 1.585 0.284 120750 1.590 0.284 120780 1.595 0.284 120810 1.600 0.285 120840 1.605 0.285 120870 1.610 0.285 120900 1.615 0.286 120930 1.620 0.286 120960 1.625 0.286 120990 1.630 0.287 121020 1.635 0.287 121050 1.640 0.288 121080 1.645 0.288 121110 1.650 0.288 121140 1.655 0.289 121170 1.659 0.289 121200 1.664 0.290 121230 1.670 0.290 121260 1.675 0.290 121290 1.680 0.291 121320 1.685 0.291 121350 1.690 0.292 121380 1.695 0.292 121410 1.701 0.293 121440 1.706 0.293 121470 1.711 0.293 121500 1.716 0.294 121530 1.721 0.294 121560 1.726 0.295 121590 1.731 0.295 121620 1.737 0.296 121650 1.742 0.296 121680 1.747 0.297 121710 1.752 0.297 121740 1.757 0.297 121770 1.762 0.298 121800 1.767 0.298 121830 1.772 0.299 121860 1.777 0.299 121890 1.782 0.300 121920 1.787 0.300 121950 1.792 0.301 121980 1.797 0.301 122010 1.803 0.302 122040 1.808 0.302 122070 1.813 0.303 122100 1.818 0.303 122130 1.823 0.304 122160 1.828 0.304 122190 1.833 0.305 122220 1.838 0.305 122250 1.843 0.306 122280 1.847 0.306 122310 1.852 0.307 122340 1.857 0.307 122370 1.862 0.308 122400 1.867 0.309 122430 1.872 0.308 122460 1.876 0.308 122490 1.881 0.308 122520 1.885 0.308 122550 1.890 0.307 122580 1.894 0.307 122610 1.899 0.307 122640 1.903 0.307 122670 1.908 0.306 122700 1.912 0.306 122730 1.917 0.306 122760 1.921 0.306 122790 1.926 0.305 122820 1.930 0.305 122850 1.935 0.305 122880 1.939 0.305 122910 1.944 0.304 122940 1.948 0.304 122970 1.953 0.304 123000 1.957 0.304 123030 1.962 0.303 123060 1.966 0.303 123090 1.971 0.303 123120 1.975 0.303 123150 1.980 0.302 123180 1.984 0.302 123210 1.988 0.302 123240 1.993 0.302 123270 1.997 0.301 123300 2.002 0.301 123330 2.006 0.301 123360 2.011 0.301 123390 2.015 0.300 123420 2.019 0.300 123450 2.024 0.300 123480 2.028 0.300 123510 2.033 0.299 123540 2.037 0.299 123570 2.041 0.299 123600 2.046 0.299 123630 2.050 0.298 123660 2.054 0.297 123690 2.058 0.297 123720 2.062 0.296 123750 2.065 0.295 123780 2.069 0.295 123810 2.073 0.294 123840 2.077 0.293 123870 2.081 0.293 123900 2.085 0.292 123930 2.089 0.291 123960 2.092 0.291 123990 2.096 0.290 124020 2.100 0.289 124050 2.104 0.289 124080 2.108 0.288 124110 2.112 0.288 124140 2.115 0.287 124170 2.119 0.286 124200 2.123 0.286 124230 2.127 0.285 124260 2.131 0.284 124290 2.134 0.284 124320 2.138 0.283 124350 2.142 0.282 124380 2.146 0.282 124410 2.149 0.281 124440 2.153 0.280 124470 2.157 0.280 124500 2.161 0.279 124530 2.164 0.278 124560 2.168 0.278 124590 2.172 0.277 124620 2.175 0.276 124650 2.179 0.276 124680 2.183 0.275 124710 2.186 0.274 124740 2.190 0.274 124770 2.194 0.273 124800 2.197 0.272 124830 2.200 0.272 124860 2.202 0.272 124890 2.204 0.271 124920 2.206 0.271 124950 2.208 0.270 124980 2.210 0.270 125010 2.213 0.270 125040 2.215 0.269 125070 2.217 0.269 125100 2.219 0.268 125130 2.221 0.268 125160 2.223 0.268 125190 2.225 0.267 125220 2.227 0.267 125250 2.230 0.266 125280 2.232 0.266 125310 2.234 0.266 125340 2.236 0.265 125370 2.238 0.265 125400 2.240 0.264 125430 2.242 0.264 125460 2.244 0.263 125490 2.246 0.263 125520 2.248 0.263 125550 2.251 0.262 125580 2.253 0.262 125610 2.255 0.261 125640 2.257 0.261 125670 2.259 0.260 125700 2.261 0.260 125730 2.263 0.259 125760 2.265 0.259 125790 2.267 0.258 125820 2.269 0.258 125850 2.271 0.257 125880 2.273 0.257 125910 2.275 0.256 125940 2.277 0.256 125970 2.279 0.255 126000 2.281 0.255 126030 2.283 0.254 126060 2.285 0.253 126090 2.287 0.252 126120 2.288 0.251 126150 2.290 0.250 126180 2.292 0.249 126210 2.294 0.249 126240 2.295 0.248 126270 2.297 0.247 126300 2.299 0.246 126330 2.300 0.245 126360 2.302 0.244 126390 2.303 0.243 126420 2.305 0.242 126450 2.306 0.241 126480 2.308 0.240 126510 2.309 0.239 126540 2.311 0.238 126570 2.312 0.237 126600 2.314 0.236 126630 2.315 0.235 126660 2.317 0.234 126690 2.318 0.233 126720 2.319 0.232 126750 2.321 0.231 126780 2.322 0.230 126810 2.323 0.229 126840 2.325 0.228 126870 2.326 0.227 126900 2.327 0.226 126930 2.328 0.225 126960 2.329 0.224 126990 2.331 0.223 127020 2.332 0.222 127050 2.333 0.221 127080 2.334 0.220 127110 2.335 0.219 127140 2.336 0.218 127170 2.337 0.217 127200 2.338 0.216 127230 2.340 0.216 127260 2.343 0.215 127290 2.345 0.215 127320 2.347 0.214 127350 2.349 0.214 127380 2.351 0.213 127410 2.353 0.212 127440 2.355 0.212 127470 2.357 0.211 127500 2.359 0.211 127530 2.361 0.210 127560 2.363 0.210 127590 2.365 0.209 127620 2.366 0.209 127650 2.368 0.208 127680 2.370 0.207 127710 2.372 0.207 127740 2.373 0.206 127770 2.375 0.206 127800 2.377 0.205 127830 2.378 0.204 127860 2.380 0.204 127890 2.381 0.203 127920 2.383 0.202 127950 2.384 0.202 127980 2.386 0.201 128010 2.387 0.200 128040 2.389 0.200 128070 2.390 0.199 128100 2.391 0.198 128130 2.393 0.197 128160 2.394 0.197 128190 2.395 0.196 128220 2.396 0.195 128250 2.398 0.194 128280 2.399 0.194 128310 2.400 0.193 128340 2.401 0.192 128370 2.402 0.191 128400 2.403 0.190 128430 2.406 0.189 128460 2.409 0.189 128490 2.412 0.188 128520 2.415 0.187 128550 2.418 0.186 128580 2.421 0.185 128610 2.424 0.184 128640 2.426 0.183 128670 2.429 0.182 128700 2.432 0.181 128730 2.435 0.180 128760 2.437 0.179 128790 2.440 0.179 128820 2.443 0.178 128850 2.445 0.177 128880 2.448 0.175 128910 2.450 0.174 128940 2.453 0.173 128970 2.455 0.172 129000 2.458 0.171 129030 2.460 0.170 129060 2.463 0.169 129090 2.465 0.168 129120 2.467 0.167 129150 2.470 0.166 129180 2.472 0.164 129210 2.474 0.163 129240 2.476 0.162 129270 2.479 0.161 129300 2.481 0.160 129330 2.483 0.158 129360 2.485 0.157 129390 2.487 0.156 129420 2.489 0.154 129450 2.491 0.153 129480 2.493 0.152 129510 2.495 0.150 129540 2.497 0.149 129570 2.499 0.148 129600 2.501 0.146 129630 2.507 0.148 129660 2.513 0.150 129690 2.520 0.152 129720 2.526 0.153 129750 2.532 0.155 129780 2.539 0.157 129810 2.545 0.159 129840 2.551 0.161 129870 2.557 0.162 129900 2.564 0.164 129930 2.570 0.166 129960 2.576 0.167 129990 2.582 0.169 130020 2.588 0.171 130050 2.594 0.173 130080 2.600 0.174 130110 2.606 0.176 130140 2.612 0.177 130170 2.618 0.179 130200 2.624 0.181 130230 2.630 0.182 130260 2.636 0.184 130290 2.642 0.185 130320 2.648 0.187 130350 2.654 0.188 130380 2.660 0.190 130410 2.665 0.192 130440 2.671 0.193 130470 2.677 0.195 130500 2.683 0.196 130530 2.688 0.198 130560 2.694 0.199 130590 2.700 0.201 130620 2.705 0.202 130650 2.711 0.203 130680 2.717 0.205 130710 2.722 0.206 130740 2.728 0.208 130770 2.733 0.209 130800 2.739 0.211 130830 2.745 0.212 130860 2.751 0.214 130890 2.758 0.216 130920 2.764 0.218 130950 2.770 0.220 130980 2.776 0.222 131010 2.783 0.224 131040 2.789 0.226 131070 2.795 0.227 131100 2.801 0.229 131130 2.807 0.231 131160 2.814 0.233 131190 2.820 0.234 131220 2.826 0.236 131250 2.832 0.238 131280 2.838 0.240 131310 2.844 0.241 131340 2.850 0.243 131370 2.856 0.245 131400 2.862 0.246 131430 2.868 0.248 131460 2.874 0.249 131490 2.880 0.251 131520 2.885 0.253 131550 2.891 0.254 131580 2.897 0.256 131610 2.903 0.257 131640 2.909 0.259 131670 2.915 0.260 131700 2.920 0.262 131730 2.926 0.263 131760 2.932 0.265 131790 2.937 0.266 131820 2.943 0.268 131850 2.949 0.269 131880 2.954 0.271 131910 2.960 0.272 131940 2.966 0.273 131970 2.971 0.275 132000 2.977 0.276 132030 2.983 0.277 132060 2.988 0.278 132090 2.994 0.280 132120 3.000 0.281 132150 3.006 0.282 132180 3.011 0.283 132210 3.017 0.284 132240 3.023 0.285 132270 3.028 0.287 132300 3.034 0.288 132330 3.039 0.289 132360 3.045 0.290 132390 3.050 0.291 132420 3.056 0.292 132450 3.061 0.293 132480 3.067 0.294 132510 3.072 0.295 132540 3.078 0.297 132570 3.083 0.298 132600 3.088 0.299 132630 3.094 0.300 132660 3.099 0.301 132690 3.104 0.302 132720 3.110 0.303 132750 3.115 0.304 132780 3.120 0.305 132810 3.125 0.306 132840 3.130 0.307 132870 3.136 0.308 132900 3.141 0.309 132930 3.146 0.309 132960 3.151 0.310 132990 3.156 0.311 133020 3.161 0.312 133050 3.166 0.313 133080 3.171 0.314 133110 3.176 0.315 133140 3.181 0.316 133170 3.186 0.317 133200 3.191 0.318 133230 3.196 0.319 133260 3.201 0.320 133290 3.206 0.321 133320 3.212 0.322 133350 3.217 0.323 133380 3.222 0.324 133410 3.227 0.325 133440 3.232 0.326 133470 3.237 0.327 133500 3.242 0.328 133530 3.247 0.329 133560 3.252 0.330 133590 3.257 0.331 133620 3.262 0.332 133650 3.267 0.332 133680 3.272 0.333 133710 3.277 0.334 133740 3.282 0.335 133770 3.287 0.336 133800 3.291 0.337 133830 3.296 0.338 133860 3.301 0.339 133890 3.306 0.340 133920 3.310 0.341 133950 3.315 0.342 133980 3.320 0.342 134010 3.324 0.343 134040 3.329 0.344 134070 3.334 0.345 134100 3.338 0.346 134130 3.343 0.347 134160 3.347 0.348 134190 3.352 0.348 134220 3.356 0.349 134250 3.361 0.350 134280 3.365 0.351 134310 3.370 0.352 134340 3.374 0.352 134370 3.378 0.353 134400 3.383 0.354 134430 3.388 0.354 134460 3.393 0.355 134490 3.398 0.355 134520 3.403 0.355 134550 3.408 0.356 134580 3.412 0.356 134610 3.417 0.356 134640 3.422 0.357 134670 3.427 0.357 134700 3.432 0.357 134730 3.437 0.357 134760 3.441 0.358 134790 3.446 0.358 134820 3.451 0.358 134850 3.456 0.359 134880 3.460 0.359 134910 3.465 0.359 134940 3.470 0.359 134970 3.474 0.359 135000 3.479 0.360 135030 3.483 0.360 135060 3.488 0.360 135090 3.493 0.360 135120 3.497 0.361 135150 3.502 0.361 135180 3.506 0.361 135210 3.511 0.361 135240 3.515 0.361 135270 3.519 0.361 135300 3.524 0.361 135330 3.528 0.362 135360 3.533 0.362 135390 3.537 0.362 135420 3.541 0.362 135450 3.546 0.362 135480 3.550 0.362 135510 3.554 0.362 135540 3.558 0.362 135570 3.563 0.362 135600 3.567 0.362 135630 3.573 0.363 135660 3.578 0.364 135690 3.584 0.364 135720 3.590 0.365 135750 3.596 0.365 135780 3.601 0.366 135810 3.607 0.366 135840 3.613 0.367 135870 3.619 0.367 135900 3.624 0.368 135930 3.630 0.368 135960 3.636 0.369 135990 3.642 0.369 136020 3.648 0.370 136050 3.653 0.370 136080 3.659 0.370 136110 3.665 0.371 136140 3.671 0.371 136170 3.677 0.371 136200 3.682 0.372 136230 3.688 0.372 136260 3.694 0.372 136290 3.700 0.372 136320 3.706 0.373 136350 3.712 0.373 136380 3.717 0.373 136410 3.723 0.373 136440 3.729 0.373 136470 3.735 0.373 136500 3.741 0.374 136530 3.747 0.374 136560 3.753 0.374 136590 3.758 0.374 136620 3.764 0.374 136650 3.770 0.374 136680 3.776 0.374 136710 3.782 0.374 136740 3.788 0.374 136770 3.794 0.374 136800 3.800 0.373 136830 3.808 0.374 136860 3.816 0.374 136890 3.825 0.374 136920 3.833 0.375 136950 3.841 0.375 136980 3.849 0.376 137010 3.858 0.376 137040 3.866 0.376 137070 3.874 0.377 137100 3.882 0.377 137130 3.891 0.377 137160 3.899 0.378 137190 3.907 0.378 137220 3.915 0.379 137250 3.923 0.379 137280 3.931 0.379 137310 3.939 0.380 137340 3.947 0.380 137370 3.955 0.381 137400 3.963 0.381 137430 3.971 0.381 137460 3.979 0.382 137490 3.987 0.382 137520 3.995 0.383 137550 4.003 0.383 137580 4.011 0.383 137610 4.019 0.384 137640 4.026 0.384 137670 4.034 0.385 137700 4.042 0.385 137730 4.050 0.386 137760 4.058 0.386 137790 4.065 0.386 137820 4.073 0.387 137850 4.081 0.387 137880 4.088 0.388 137910 4.096 0.388 137940 4.104 0.389 137970 4.111 0.389 138000 4.119 0.390 138030 4.126 0.391 138060 4.132 0.392 138090 4.139 0.393 138120 4.146 0.394 138150 4.153 0.395 138180 4.159 0.396 138210 4.166 0.397 138240 4.173 0.398 138270 4.180 0.398 138300 4.187 0.399 138330 4.193 0.400 138360 4.200 0.401 138390 4.207 0.402 138420 4.214 0.403 138450 4.220 0.404 138480 4.227 0.405 138510 4.234 0.406 138540 4.241 0.406 138570 4.247 0.407 138600 4.254 0.408 138630 4.261 0.409 138660 4.268 0.410 138690 4.274 0.411 138720 4.281 0.411 138750 4.288 0.412 138780 4.295 0.413 138810 4.302 0.414 138840 4.308 0.414 138870 4.315 0.415 138900 4.322 0.416 138930 4.329 0.417 138960 4.335 0.417 138990 4.342 0.418 139020 4.349 0.419 139050 4.356 0.419 139080 4.362 0.420 139110 4.369 0.421 139140 4.376 0.421 139170 4.383 0.422 139200 4.389 0.423 139230 4.396 0.422 139260 4.404 0.421 139290 4.411 0.421 139320 4.418 0.420 139350 4.424 0.419 139380 4.431 0.418 139410 4.438 0.418 139440 4.445 0.417 139470 4.452 0.416 139500 4.459 0.416 139530 4.466 0.415 139560 4.473 0.415 139590 4.480 0.414 139620 4.487 0.414 139650 4.493 0.413 139680 4.500 0.413 139710 4.507 0.412 139740 4.514 0.412 139770 4.521 0.411 139800 4.527 0.411 139830 4.534 0.410 139860 4.541 0.410 139890 4.548 0.410 139920 4.554 0.409 139950 4.561 0.409 139980 4.568 0.409 140010 4.575 0.408 140040 4.581 0.408 140070 4.588 0.408 140100 4.594 0.407 140130 4.601 0.407 140160 4.608 0.407 140190 4.614 0.407 140220 4.621 0.407 140250 4.627 0.407 140280 4.634 0.407 140310 4.641 0.406 140340 4.647 0.406 140370 4.654 0.406 140400 4.660 0.406 140430 4.664 0.406 140460 4.667 0.407 140490 4.671 0.407 140520 4.675 0.407 140550 4.678 0.407 140580 4.682 0.407 140610 4.686 0.407 140640 4.689 0.407 140670 4.693 0.407 140700 4.697 0.408 140730 4.700 0.408 140760 4.704 0.408 140790 4.708 0.408 140820 4.711 0.408 140850 4.715 0.408 140880 4.719 0.408 140910 4.722 0.409 140940 4.726 0.409 140970 4.730 0.409 141000 4.733 0.409 141030 4.737 0.409 141060 4.740 0.409 141090 4.744 0.409 141120 4.748 0.409 141150 4.751 0.410 141180 4.755 0.410 141210 4.759 0.410 141240 4.762 0.410 141270 4.766 0.410 141300 4.770 0.410 141330 4.773 0.410 141360 4.777 0.411 141390 4.781 0.411 141420 4.784 0.411 141450 4.788 0.411 141480 4.792 0.411 141510 4.795 0.411 141540 4.799 0.411 141570 4.803 0.411 141600 4.806 0.412 141630 4.807 0.411 141660 4.808 0.411 141690 4.810 0.411 141720 4.811 0.411 141750 4.812 0.411 141780 4.813 0.410 141810 4.814 0.410 141840 4.815 0.410 141870 4.817 0.410 141900 4.818 0.409 141930 4.819 0.409 141960 4.820 0.409 141990 4.821 0.408 142020 4.823 0.408 142050 4.824 0.408 142080 4.825 0.407 142110 4.827 0.407 142140 4.828 0.407 142170 4.829 0.406 142200 4.831 0.406 142230 4.832 0.406 142260 4.833 0.405 142290 4.835 0.405 142320 4.836 0.404 142350 4.838 0.404 142380 4.839 0.403 142410 4.840 0.403 142440 4.842 0.402 142470 4.843 0.402 142500 4.845 0.401 142530 4.846 0.401 142560 4.848 0.400 142590 4.849 0.400 142620 4.851 0.399 142650 4.852 0.398 142680 4.854 0.398 142710 4.856 0.397 142740 4.857 0.397 142770 4.859 0.396 142800 4.860 0.395 142830 4.860 0.394 142860 4.859 0.394 142890 4.859 0.393 142920 4.858 0.392 142950 4.857 0.391 142980 4.857 0.390 143010 4.856 0.389 143040 4.856 0.388 143070 4.855 0.387 143100 4.854 0.386 143130 4.854 0.385 143160 4.853 0.384 143190 4.853 0.384 143220 4.852 0.383 143250 4.852 0.382 143280 4.851 0.381 143310 4.850 0.380 143340 4.850 0.379 143370 4.849 0.378 143400 4.849 0.377 143430 4.848 0.376 143460 4.848 0.375 143490 4.847 0.374 143520 4.847 0.373 143550 4.846 0.372 143580 4.846 0.371 143610 4.845 0.370 143640 4.845 0.369 143670 4.844 0.368 143700 4.844 0.367 143730 4.843 0.366 143760 4.843 0.365 143790 4.842 0.364 143820 4.842 0.363 143850 4.841 0.362 143880 4.841 0.361 143910 4.840 0.360 143940 4.840 0.359 143970 4.839 0.358 144000 4.839 0.357 144030 4.836 0.356 144060 4.832 0.355 144090 4.829 0.355 144120 4.826 0.354 144150 4.823 0.353 144180 4.820 0.352 144210 4.817 0.351 144240 4.814 0.350 144270 4.812 0.349 144300 4.809 0.349 144330 4.806 0.348 144360 4.803 0.347 144390 4.801 0.346 144420 4.798 0.345 144450 4.795 0.344 144480 4.793 0.344 144510 4.790 0.343 144540 4.787 0.342 144570 4.785 0.341 144600 4.783 0.340 144630 4.780 0.340 144660 4.778 0.339 144690 4.775 0.338 144720 4.773 0.337 144750 4.771 0.336 144780 4.769 0.335 144810 4.766 0.335 144840 4.764 0.334 144870 4.762 0.333 144900 4.760 0.332 144930 4.758 0.332 144960 4.756 0.331 144990 4.754 0.330 145020 4.752 0.329 145050 4.750 0.329 145080 4.748 0.328 145110 4.747 0.327 145140 4.745 0.326 145170 4.743 0.325 145200 4.741 0.325 145230 4.738 0.324 145260 4.735 0.324 145290 4.732 0.323 145320 4.728 0.323 145350 4.725 0.322 145380 4.722 0.322 145410 4.719 0.321 145440 4.717 0.321 145470 4.714 0.320 145500 4.711 0.320 145530 4.708 0.319 145560 4.706 0.319 145590 4.703 0.318 145620 4.700 0.318 145650 4.698 0.317 145680 4.696 0.317 145710 4.693 0.316 145740 4.691 0.316 145770 4.689 0.315 145800 4.686 0.315 145830 4.684 0.314 145860 4.682 0.314 145890 4.680 0.313 145920 4.678 0.312 145950 4.676 0.312 145980 4.675 0.311 146010 4.673 0.311 146040 4.671 0.310 146070 4.669 0.310 146100 4.668 0.309 146130 4.666 0.308 146160 4.665 0.308 146190 4.663 0.307 146220 4.662 0.307 146250 4.660 0.306 146280 4.659 0.306 146310 4.658 0.305 146340 4.657 0.304 146370 4.656 0.304 146400 4.655 0.303 146430 4.654 0.302 146460 4.652 0.302 146490 4.651 0.301 146520 4.650 0.300 146550 4.649 0.299 146580 4.648 0.299 146610 4.647 0.298 146640 4.646 0.297 146670 4.645 0.297 146700 4.644 0.296 146730 4.643 0.295 146760 4.642 0.294 146790 4.641 0.294 146820 4.640 0.293 146850 4.639 0.292 146880 4.638 0.292 146910 4.637 0.291 146940 4.636 0.290 146970 4.635 0.290 147000 4.634 0.289 147030 4.634 0.288 147060 4.633 0.288 147090 4.632 0.287 147120 4.631 0.286 147150 4.630 0.286 147180 4.629 0.285 147210 4.629 0.284 147240 4.628 0.284 147270 4.627 0.283 147300 4.626 0.282 147330 4.626 0.282 147360 4.625 0.281 147390 4.624 0.280 147420 4.623 0.280 147450 4.623 0.279 147480 4.622 0.278 147510 4.621 0.278 147540 4.621 0.277 147570 4.620 0.277 147600 4.619 0.276 147630 4.616 0.277 147660 4.613 0.278 147690 4.610 0.278 147720 4.607 0.279 147750 4.604 0.280 147780 4.601 0.281 147810 4.598 0.282 147840 4.595 0.282 147870 4.592 0.283 147900 4.589 0.284 147930 4.586 0.285 147960 4.583 0.285 147990 4.580 0.286 148020 4.578 0.287 148050 4.575 0.288 148080 4.572 0.288 148110 4.570 0.289 148140 4.567 0.290 148170 4.565 0.290 148200 4.562 0.291 148230 4.560 0.292 148260 4.557 0.292 148290 4.555 0.293 148320 4.552 0.294 148350 4.550 0.294 148380 4.548 0.295 148410 4.545 0.296 148440 4.543 0.296 148470 4.541 0.297 148500 4.539 0.298 148530 4.537 0.298 148560 4.535 0.299 148590 4.533 0.299 148620 4.531 0.300 148650 4.529 0.301 148680 4.527 0.301 148710 4.525 0.302 148740 4.523 0.302 148770 4.521 0.303 148800 4.519 0.303 148830 4.516 0.305 148860 4.513 0.306 148890 4.510 0.308 148920 4.507 0.309 148950 4.504 0.311 148980 4.501 0.312 149010 4.498 0.314 149040 4.495 0.315 149070 4.492 0.317 149100 4.489 0.318 149130 4.486 0.320 149160 4.483 0.321 149190 4.481 0.323 149220 4.478 0.324 149250 4.475 0.326 149280 4.472 0.327 149310 4.469 0.329 149340 4.467 0.330 149370 4.464 0.332 149400 4.461 0.333 149430 4.458 0.335 149460 4.456 0.336 149490 4.453 0.338 149520 4.451 0.339 149550 4.448 0.341 149580 4.445 0.342 149610 4.443 0.344 149640 4.440 0.345 149670 4.438 0.347 149700 4.435 0.348 149730 4.433 0.349 149760 4.430 0.351 149790 4.428 0.352 149820 4.425 0.354 149850 4.423 0.355 149880 4.420 0.357 149910 4.418 0.358 149940 4.416 0.360 149970 4.413 0.361 150000 4.411 0.363 150030 4.410 0.363 150060 4.409 0.363 150090 4.409 0.363 150120 4.408 0.363 150150 4.407 0.362 150180 4.406 0.362 150210 4.406 0.362 150240 4.405 0.362 150270 4.404 0.362 150300 4.404 0.362 150330 4.403 0.362 150360 4.403 0.362 150390 4.402 0.362 150420 4.402 0.362 150450 4.401 0.361 150480 4.401 0.361 150510 4.401 0.361 150540 4.400 0.361 150570 4.400 0.361 150600 4.400 0.361 150630 4.399 0.361 150660 4.399 0.360 150690 4.399 0.360 150720 4.399 0.360 150750 4.399 0.360 150780 4.399 0.360 150810 4.398 0.360 150840 4.398 0.360 150870 4.398 0.359 150900 4.398 0.359 150930 4.398 0.359 150960 4.399 0.359 150990 4.399 0.359 151020 4.399 0.358 151050 4.399 0.358 151080 4.399 0.358 151110 4.399 0.358 151140 4.400 0.358 151170 4.400 0.357 151200 4.400 0.357 151230 4.395 0.358 151260 4.390 0.359 151290 4.384 0.360 151320 4.379 0.361 151350 4.374 0.362 151380 4.369 0.363 151410 4.364 0.364 151440 4.359 0.365 151470 4.354 0.366 151500 4.349 0.367 151530 4.344 0.368 151560 4.339 0.369 151590 4.334 0.370 151620 4.329 0.371 151650 4.324 0.372 151680 4.320 0.373 151710 4.315 0.374 151740 4.310 0.375 151770 4.305 0.376 151800 4.301 0.377 151830 4.296 0.377 151860 4.292 0.378 151890 4.287 0.379 151920 4.283 0.380 151950 4.278 0.381 151980 4.274 0.382 152010 4.270 0.383 152040 4.265 0.384 152070 4.261 0.385 152100 4.257 0.385 152130 4.252 0.386 152160 4.248 0.387 152190 4.244 0.388 152220 4.240 0.389 152250 4.236 0.390 152280 4.232 0.390 152310 4.228 0.391 152340 4.224 0.392 152370 4.220 0.393 152400 4.216 0.394 152430 4.211 0.393 152460 4.205 0.393 152490 4.200 0.393 152520 4.195 0.393 152550 4.189 0.393 152580 4.184 0.392 152610 4.179 0.392 152640 4.174 0.392 152670 4.168 0.392 152700 4.163 0.392 152730 4.158 0.392 152760 4.153 0.392 152790 4.148 0.391 152820 4.142 0.391 152850 4.137 0.391 152880 4.132 0.391 152910 4.127 0.391 152940 4.122 0.391 152970 4.117 0.391 153000 4.112 0.391 153030 4.107 0.391 153060 4.102 0.391 153090 4.097 0.390 153120 4.092 0.390 153150 4.087 0.390 153180 4.082 0.390 153210 4.078 0.390 153240 4.073 0.390 153270 4.068 0.390 153300 4.063 0.390 153330 4.058 0.390 153360 4.053 0.390 153390 4.049 0.390 153420 4.044 0.390 153450 4.039 0.390 153480 4.035 0.390 153510 4.030 0.390 153540 4.025 0.390 153570 4.021 0.390 153600 4.016 0.390 153630 4.011 0.389 153660 4.005 0.389 153690 4.000 0.388 153720 3.995 0.387 153750 3.989 0.386 153780 3.984 0.385 153810 3.979 0.384 153840 3.973 0.383 153870 3.968 0.383 153900 3.963 0.382 153930 3.958 0.381 153960 3.953 0.380 153990 3.947 0.379 154020 3.942 0.378 154050 3.937 0.377 154080 3.932 0.377 154110 3.927 0.376 154140 3.922 0.375 154170 3.917 0.374 154200 3.912 0.373 154230 3.907 0.372 154260 3.902 0.372 154290 3.897 0.371 154320 3.892 0.370 154350 3.887 0.369 154380 3.882 0.368 154410 3.877 0.368 154440 3.872 0.367 154470 3.868 0.366 154500 3.863 0.365 154530 3.858 0.364 154560 3.853 0.364 154590 3.848 0.363 154620 3.844 0.362 154650 3.839 0.361 154680 3.834 0.361 154710 3.830 0.360 154740 3.825 0.359 154770 3.820 0.358 154800 3.816 0.358 154830 3.809 0.356 154860 3.802 0.355 154890 3.795 0.354 154920 3.788 0.353 154950 3.781 0.352 154980 3.774 0.351 155010 3.767 0.350 155040 3.760 0.348 155070 3.753 0.347 155100 3.746 0.346 155130 3.739 0.345 155160 3.732 0.344 155190 3.725 0.342 155220 3.719 0.341 155250 3.712 0.340 155280 3.705 0.339 155310 3.698 0.338 155340 3.691 0.337 155370 3.685 0.335 155400 3.678 0.334 155430 3.671 0.333 155460 3.664 0.332 155490 3.658 0.331 155520 3.651 0.329 155550 3.644 0.328 155580 3.637 0.327 155610 3.631 0.326 155640 3.624 0.324 155670 3.617 0.323 155700 3.611 0.322 155730 3.604 0.321 155760 3.598 0.319 155790 3.591 0.318 155820 3.584 0.317 155850 3.578 0.316 155880 3.571 0.314 155910 3.565 0.313 155940 3.558 0.312 155970 3.552 0.311 156000 3.545 0.309 156030 3.539 0.308 156060 3.532 0.307 156090 3.526 0.305 156120 3.520 0.304 156150 3.513 0.303 156180 3.507 0.302 156210 3.500 0.300 156240 3.494 0.299 156270 3.487 0.298 156300 3.481 0.297 156330 3.475 0.295 156360 3.468 0.294 156390 3.462 0.293 156420 3.455 0.292 156450 3.449 0.290 156480 3.442 0.289 156510 3.436 0.288 156540 3.429 0.287 156570 3.422 0.286 156600 3.416 0.284 156630 3.409 0.283 156660 3.403 0.282 156690 3.396 0.281 156720 3.390 0.280 156750 3.383 0.279 156780 3.376 0.278 156810 3.370 0.276 156840 3.363 0.275 156870 3.356 0.274 156900 3.350 0.273 156930 3.343 0.272 156960 3.336 0.271 156990 3.330 0.270 157020 3.323 0.269 157050 3.316 0.268 157080 3.310 0.267 157110 3.303 0.266 157140 3.296 0.265 157170 3.289 0.264 157200 3.283 0.263 157230 3.276 0.262 157260 3.269 0.261 157290 3.262 0.260 157320 3.255 0.259 157350 3.248 0.258 157380 3.241 0.258 157410 3.234 0.257 157440 3.227 0.256 157470 3.220 0.255 157500 3.212 0.254 157530 3.205 0.253 157560 3.198 0.253 157590 3.191 0.252 157620 3.184 0.251 157650 3.176 0.250 157680 3.169 0.249 157710 3.162 0.248 157740 3.155 0.247 157770 3.147 0.247 157800 3.140 0.246 157830 3.132 0.245 157860 3.125 0.244 157890 3.118 0.243 157920 3.110 0.242 157950 3.103 0.241 157980 3.095 0.240 158010 3.088 0.239 158040 3.080 0.239 158070 3.073 0.238 158100 3.065 0.237 158130 3.057 0.236 158160 3.050 0.235 158190 3.042 0.234 158220 3.034 0.233 158250 3.027 0.232 158280 3.019 0.231 158310 3.011 0.230 158340 3.003 0.229 158370 2.995 0.228 158400 2.988 0.227 158430 2.979 0.228 158460 2.970 0.228 158490 2.961 0.228 158520 2.953 0.228 158550 2.944 0.228 158580 2.935 0.228 158610 2.927 0.229 158640 2.918 0.229 158670 2.909 0.229 158700 2.901 0.229 158730 2.892 0.229 158760 2.884 0.229 158790 2.875 0.230 158820 2.867 0.230 158850 2.858 0.230 158880 2.850 0.230 158910 2.842 0.230 158940 2.833 0.230 158970 2.825 0.231 159000 2.816 0.231 159030 2.808 0.231 159060 2.800 0.231 159090 2.792 0.231 159120 2.783 0.231 159150 2.775 0.232 159180 2.767 0.232 159210 2.759 0.232 159240 2.751 0.232 159270 2.743 0.232 159300 2.734 0.232 159330 2.726 0.233 159360 2.718 0.233 159390 2.710 0.233 159420 2.702 0.233 159450 2.694 0.233 159480 2.686 0.233 159510 2.678 0.233 159540 2.671 0.234 159570 2.663 0.234 159600 2.655 0.234 159630 2.649 0.234 159660 2.642 0.235 159690 2.636 0.235 159720 2.630 0.235 159750 2.624 0.236 159780 2.617 0.236 159810 2.611 0.236 159840 2.605 0.236 159870 2.599 0.237 159900 2.593 0.237 159930 2.587 0.237 159960 2.581 0.237 159990 2.575 0.238 160020 2.569 0.238 160050 2.563 0.238 160080 2.557 0.238 160110 2.551 0.239 160140 2.545 0.239 160170 2.539 0.239 160200 2.533 0.239 160230 2.527 0.239 160260 2.521 0.240 160290 2.515 0.240 160320 2.510 0.240 160350 2.504 0.240 160380 2.498 0.240 160410 2.492 0.240 160440 2.487 0.240 160470 2.481 0.240 160500 2.475 0.241 160530 2.469 0.241 160560 2.464 0.241 160590 2.458 0.241 160620 2.453 0.241 160650 2.447 0.241 160680 2.441 0.241 160710 2.436 0.241 160740 2.430 0.241 160770 2.425 0.241 160800 2.419 0.241 160830 2.416 0.241 160860 2.413 0.241 160890 2.409 0.241 160920 2.406 0.241 160950 2.403 0.241 160980 2.400 0.241 161010 2.396 0.241 161040 2.393 0.241 161070 2.390 0.241 161100 2.386 0.241 161130 2.383 0.241 161160 2.380 0.241 161190 2.377 0.241 161220 2.373 0.240 161250 2.370 0.240 161280 2.367 0.240 161310 2.363 0.240 161340 2.360 0.240 161370 2.357 0.240 161400 2.354 0.240 161430 2.350 0.240 161460 2.347 0.240 161490 2.344 0.240 161520 2.341 0.240 161550 2.338 0.240 161580 2.334 0.240 161610 2.331 0.240 161640 2.328 0.240 161670 2.325 0.240 161700 2.321 0.240 161730 2.318 0.239 161760 2.315 0.239 161790 2.312 0.239 161820 2.309 0.239 161850 2.305 0.239 161880 2.302 0.239 161910 2.299 0.239 161940 2.296 0.239 161970 2.293 0.239 162000 2.289 0.239 162030 2.287 0.239 162060 2.285 0.239 162090 2.282 0.240 162120 2.280 0.240 162150 2.277 0.240 162180 2.275 0.240 162210 2.273 0.241 162240 2.270 0.241 162270 2.268 0.241 162300 2.265 0.241 162330 2.263 0.241 162360 2.260 0.242 162390 2.258 0.242 162420 2.255 0.242 162450 2.253 0.242 162480 2.250 0.242 162510 2.248 0.243 162540 2.245 0.243 162570 2.243 0.243 162600 2.240 0.243 162630 2.237 0.243 162660 2.235 0.243 162690 2.232 0.243 162720 2.230 0.243 162750 2.227 0.244 162780 2.224 0.244 162810 2.222 0.244 162840 2.219 0.244 162870 2.217 0.244 162900 2.214 0.244 162930 2.211 0.244 162960 2.208 0.244 162990 2.206 0.244 163020 2.203 0.244 163050 2.200 0.244 163080 2.198 0.244 163110 2.195 0.245 163140 2.192 0.245 163170 2.189 0.245 163200 2.187 0.245 163230 2.184 0.245 163260 2.182 0.245 163290 2.180 0.246 163320 2.177 0.246 163350 2.175 0.246 163380 2.173 0.246 163410 2.170 0.247 163440 2.168 0.247 163470 2.166 0.247 163500 2.163 0.248 163530 2.161 0.248 163560 2.158 0.248 163590 2.156 0.248 163620 2.153 0.249 163650 2.150 0.249 163680 2.148 0.249 163710 2.145 0.249 163740 2.143 0.250 163770 2.140 0.250 163800 2.137 0.250 163830 2.135 0.251 163860 2.132 0.251 163890 2.129 0.251 163920 2.126 0.251 163950 2.123 0.251 163980 2.121 0.252 164010 2.118 0.252 164040 2.115 0.252 164070 2.112 0.252 164100 2.109 0.253 164130 2.106 0.253 164160 2.103 0.253 164190 2.100 0.253 164220 2.097 0.253 164250 2.094 0.254 164280 2.091 0.254 164310 2.088 0.254 164340 2.085 0.254 164370 2.082 0.254 164400 2.078 0.255 164430 2.076 0.254 164460 2.074 0.254 164490 2.072 0.253 164520 2.070 0.253 164550 2.068 0.252 164580 2.066 0.252 164610 2.064 0.251 164640 2.061 0.250 164670 2.059 0.250 164700 2.057 0.249 164730 2.055 0.249 164760 2.053 0.248 164790 2.050 0.247 164820 2.048 0.247 164850 2.046 0.246 164880 2.043 0.246 164910 2.041 0.245 164940 2.039 0.244 164970 2.036 0.244 165000 2.034 0.243 165030 2.031 0.242 165060 2.029 0.242 165090 2.026 0.241 165120 2.024 0.240 165150 2.021 0.239 165180 2.019 0.239 165210 2.016 0.238 165240 2.014 0.237 165270 2.011 0.236 165300 2.008 0.236 165330 2.006 0.235 165360 2.003 0.234 165390 2.000 0.233 165420 1.998 0.232 165450 1.995 0.232 165480 1.992 0.231 165510 1.989 0.230 165540 1.987 0.229 165570 1.984 0.228 165600 1.981 0.227 165630 1.978 0.228 165660 1.975 0.228 165690 1.972 0.228 165720 1.968 0.228 165750 1.965 0.228 165780 1.962 0.229 165810 1.960 0.229 165840 1.957 0.229 165870 1.954 0.229 165900 1.951 0.229 165930 1.948 0.230 165960 1.945 0.230 165990 1.942 0.230 166020 1.940 0.230 166050 1.937 0.231 166080 1.934 0.231 166110 1.932 0.231 166140 1.929 0.231 166170 1.927 0.232 166200 1.924 0.232 166230 1.922 0.232 166260 1.919 0.232 166290 1.917 0.233 166320 1.914 0.233 166350 1.912 0.233 166380 1.910 0.233 166410 1.907 0.234 166440 1.905 0.234 166470 1.903 0.234 166500 1.901 0.235 166530 1.899 0.235 166560 1.897 0.235 166590 1.894 0.235 166620 1.892 0.236 166650 1.890 0.236 166680 1.888 0.236 166710 1.886 0.237 166740 1.885 0.237 166770 1.883 0.237 166800 1.881 0.238 166830 1.880 0.238 166860 1.878 0.238 166890 1.877 0.238 166920 1.876 0.237 166950 1.875 0.237 166980 1.874 0.237 167010 1.873 0.237 167040 1.872 0.237 167070 1.871 0.237 167100 1.870 0.237 167130 1.869 0.237 167160 1.868 0.237 167190 1.867 0.237 167220 1.866 0.237 167250 1.865 0.237 167280 1.864 0.237 167310 1.864 0.237 167340 1.863 0.237 167370 1.862 0.237 167400 1.861 0.237 167430 1.860 0.237 167460 1.860 0.237 167490 1.859 0.237 167520 1.858 0.237 167550 1.858 0.237 167580 1.857 0.237 167610 1.857 0.237 167640 1.856 0.237 167670 1.855 0.237 167700 1.855 0.237 167730 1.854 0.237 167760 1.854 0.237 167790 1.854 0.237 167820 1.853 0.237 167850 1.853 0.237 167880 1.852 0.237 167910 1.852 0.237 167940 1.852 0.237 167970 1.851 0.237 168000 1.851 0.238 168030 1.851 0.238 168060 1.850 0.238 168090 1.850 0.238 168120 1.849 0.239 168150 1.849 0.239 168180 1.849 0.239 168210 1.848 0.239 168240 1.848 0.240 168270 1.847 0.240 168300 1.847 0.240 168330 1.847 0.240 168360 1.846 0.240 168390 1.846 0.241 168420 1.845 0.241 168450 1.845 0.241 168480 1.845 0.241 168510 1.844 0.242 168540 1.844 0.242 168570 1.843 0.242 168600 1.843 0.242 168630 1.843 0.243 168660 1.842 0.243 168690 1.842 0.243 168720 1.841 0.243 168750 1.841 0.243 168780 1.840 0.244 168810 1.840 0.244 168840 1.840 0.244 168870 1.839 0.244 168900 1.839 0.245 168930 1.838 0.245 168960 1.838 0.245 168990 1.838 0.245 169020 1.837 0.245 169050 1.837 0.246 169080 1.836 0.246 169110 1.836 0.246 169140 1.836 0.246 169170 1.835 0.246 169200 1.835 0.247 169230 1.835 0.247 169260 1.835 0.247 169290 1.835 0.247 169320 1.835 0.248 169350 1.835 0.248 169380 1.835 0.248 169410 1.834 0.249 169440 1.834 0.249 169470 1.834 0.249 169500 1.834 0.250 169530 1.834 0.250 169560 1.834 0.250 169590 1.834 0.250 169620 1.833 0.251 169650 1.833 0.251 169680 1.833 0.251 169710 1.833 0.251 169740 1.833 0.252 169770 1.832 0.252 169800 1.832 0.252 169830 1.832 0.252 169860 1.832 0.253 169890 1.831 0.253 169920 1.831 0.253 169950 1.831 0.253 169980 1.830 0.254 170010 1.830 0.254 170040 1.830 0.254 170070 1.829 0.254 170100 1.829 0.254 170130 1.828 0.255 170160 1.828 0.255 170190 1.827 0.255 170220 1.827 0.255 170250 1.827 0.255 170280 1.826 0.256 170310 1.826 0.256 170340 1.825 0.256 170370 1.825 0.256 170400 1.824 0.256 170430 1.824 0.257 170460 1.823 0.257 170490 1.823 0.257 170520 1.822 0.257 170550 1.822 0.258 170580 1.821 0.258 170610 1.820 0.258 170640 1.820 0.258 170670 1.819 0.258 170700 1.819 0.259 170730 1.818 0.259 170760 1.817 0.259 170790 1.816 0.259 170820 1.816 0.259 170850 1.815 0.260 170880 1.814 0.260 170910 1.813 0.260 170940 1.812 0.260 170970 1.811 0.260 171000 1.810 0.260 171030 1.809 0.261 171060 1.809 0.261 171090 1.807 0.261 171120 1.806 0.261 171150 1.805 0.261 171180 1.804 0.261 171210 1.803 0.261 171240 1.802 0.261 171270 1.801 0.262 171300 1.800 0.262 171330 1.798 0.262 171360 1.797 0.262 171390 1.796 0.262 171420 1.795 0.262 171450 1.793 0.262 171480 1.792 0.262 171510 1.790 0.262 171540 1.789 0.262 171570 1.788 0.262 171600 1.786 0.262 171630 1.786 0.262 171660 1.785 0.262 171690 1.785 0.263 171720 1.784 0.263 171750 1.784 0.263 171780 1.783 0.263 171810 1.782 0.263 171840 1.782 0.263 171870 1.781 0.263 171900 1.781 0.263 171930 1.780 0.263 171960 1.779 0.263 171990 1.779 0.263 172020 1.778 0.263 172050 1.777 0.263 172080 1.776 0.263 172110 1.776 0.263 172140 1.775 0.263 172170 1.774 0.263 172200 1.773 0.263 172230 1.772 0.263 172260 1.772 0.262 172290 1.771 0.262 172320 1.770 0.262 172350 1.769 0.262 172380 1.768 0.262 172410 1.767 0.262 172440 1.766 0.262 172470 1.765 0.262 172500 1.764 0.262 172530 1.763 0.261 172560 1.762 0.261 172590 1.761 0.261 172620 1.760 0.261 172650 1.759 0.261 172680 1.758 0.261 172710 1.757 0.260 172740 1.756 0.260 172770 1.755 0.260 172800 1.754 0.260 172830 1.752 0.260 172860 1.751 0.260 172890 1.750 0.260 172920 1.748 0.261 172950 1.747 0.261 172980 1.745 0.261 173010 1.744 0.261 173040 1.743 0.261 173070 1.741 0.262 173100 1.740 0.262 173130 1.739 0.262 173160 1.737 0.262 173190 1.736 0.262 173220 1.734 0.262 173250 1.733 0.263 173280 1.732 0.263 173310 1.730 0.263 173340 1.729 0.263 173370 1.727 0.263 173400 1.726 0.263 173430 1.724 0.264 173460 1.723 0.264 173490 1.722 0.264 173520 1.720 0.264 173550 1.719 0.264 173580 1.717 0.264 173610 1.716 0.264 173640 1.714 0.264 173670 1.713 0.265 173700 1.712 0.265 173730 1.710 0.265 173760 1.709 0.265 173790 1.707 0.265 173820 1.706 0.265 173850 1.704 0.265 173880 1.703 0.265 173910 1.701 0.265 173940 1.700 0.265 173970 1.698 0.265 174000 1.697 0.265 174030 1.695 0.266 174060 1.694 0.266 174090 1.692 0.266 174120 1.691 0.266 174150 1.689 0.266 174180 1.688 0.266 174210 1.686 0.266 174240 1.685 0.267 174270 1.683 0.267 174300 1.682 0.267 174330 1.680 0.267 174360 1.679 0.267 174390 1.677 0.267 174420 1.676 0.267 174450 1.674 0.268 174480 1.673 0.268 174510 1.671 0.268 174540 1.669 0.268 174570 1.668 0.268 174600 1.666 0.268 174630 1.665 0.268 174660 1.663 0.269 174690 1.662 0.269 174720 1.660 0.269 174750 1.659 0.269 174780 1.657 0.269 174810 1.655 0.269 174840 1.654 0.269 174870 1.652 0.270 174900 1.651 0.270 174930 1.649 0.270 174960 1.647 0.270 174990 1.646 0.270 175020 1.644 0.270 175050 1.643 0.270 175080 1.641 0.271 175110 1.639 0.271 175140 1.638 0.271 175170 1.636 0.271 175200 1.635 0.271 175230 1.633 0.271 175260 1.632 0.271 175290 1.630 0.271 175320 1.629 0.271 175350 1.627 0.270 175380 1.626 0.270 175410 1.624 0.270 175440 1.623 0.270 175470 1.621 0.270 175500 1.620 0.270 175530 1.618 0.270 175560 1.617 0.270 175590 1.615 0.270 175620 1.614 0.270 175650 1.612 0.270 175680 1.611 0.270 175710 1.609 0.270 175740 1.608 0.269 175770 1.606 0.269 175800 1.605 0.269 175830 1.603 0.269 175860 1.602 0.269 175890 1.600 0.269 175920 1.599 0.269 175950 1.597 0.269 175980 1.596 0.269 176010 1.594 0.269 176040 1.593 0.269 176070 1.591 0.269 176100 1.590 0.269 176130 1.588 0.269 176160 1.587 0.269 176190 1.585 0.269 176220 1.584 0.269 176250 1.582 0.269 176280 1.581 0.269 176310 1.579 0.269 176340 1.578 0.269 176370 1.577 0.269 176400 1.575 0.269 176430 1.573 0.269 176460 1.571 0.270 176490 1.569 0.270 176520 1.567 0.271 176550 1.566 0.271 176580 1.564 0.272 176610 1.562 0.272 176640 1.560 0.273 176670 1.558 0.273 176700 1.556 0.273 176730 1.555 0.274 176760 1.553 0.274 176790 1.551 0.275 176820 1.549 0.275 176850 1.547 0.276 176880 1.546 0.276 176910 1.544 0.277 176940 1.542 0.277 176970 1.540 0.278 177000 1.538 0.278 177030 1.537 0.279 177060 1.535 0.279 177090 1.533 0.280 177120 1.531 0.280 177150 1.530 0.281 177180 1.528 0.281 177210 1.526 0.282 177240 1.525 0.282 177270 1.523 0.283 177300 1.521 0.283 177330 1.520 0.284 177360 1.518 0.284 177390 1.516 0.285 177420 1.515 0.285 177450 1.513 0.286 177480 1.511 0.286 177510 1.510 0.287 177540 1.508 0.287 177570 1.506 0.288 177600 1.505 0.288 177630 1.504 0.289 177660 1.504 0.289 177690 1.503 0.289 177720 1.503 0.290 177750 1.502 0.290 177780 1.502 0.290 177810 1.501 0.290 177840 1.501 0.291 177870 1.501 0.291 177900 1.500 0.291 177930 1.500 0.291 177960 1.500 0.292 177990 1.499 0.292 178020 1.499 0.292 178050 1.499 0.292 178080 1.499 0.293 178110 1.498 0.293 178140 1.498 0.293 178170 1.498 0.293 178200 1.498 0.294 178230 1.498 0.294 178260 1.498 0.294 178290 1.498 0.294 178320 1.498 0.295 178350 1.497 0.295 178380 1.497 0.295 178410 1.497 0.295 178440 1.497 0.296 178470 1.497 0.296 178500 1.498 0.296 178530 1.498 0.296 178560 1.498 0.297 178590 1.498 0.297 178620 1.498 0.297 178650 1.498 0.297 178680 1.498 0.298 178710 1.499 0.298 178740 1.499 0.298 178770 1.499 0.298 178800 1.499 0.299 178830 1.500 0.299 178860 1.500 0.299 178890 1.501 0.299 178920 1.501 0.299 178950 1.502 0.300 178980 1.503 0.300 179010 1.503 0.300 179040 1.504 0.300 179070 1.504 0.301 179100 1.505 0.301 179130 1.506 0.301 179160 1.506 0.301 179190 1.507 0.301 179220 1.507 0.302 179250 1.508 0.302 179280 1.509 0.302 179310 1.509 0.302 179340 1.510 0.303 179370 1.511 0.303 179400 1.511 0.303 179430 1.512 0.303 179460 1.513 0.304 179490 1.513 0.304 179520 1.514 0.304 179550 1.515 0.304 179580 1.516 0.305 179610 1.516 0.305 179640 1.517 0.305 179670 1.518 0.305 179700 1.519 0.306 179730 1.519 0.306 179760 1.520 0.306 179790 1.521 0.307 179820 1.522 0.307 179850 1.522 0.307 179880 1.523 0.307 179910 1.524 0.308 179940 1.525 0.308 179970 1.525 0.308 180000 1.526 0.309 180030 1.526 0.308 180060 1.525 0.308 180090 1.525 0.308 180120 1.524 0.307 180150 1.523 0.307 180180 1.523 0.307 180210 1.522 0.307 180240 1.522 0.306 180270 1.521 0.306 180300 1.521 0.306 180330 1.520 0.306 180360 1.519 0.305 180390 1.519 0.305 180420 1.518 0.305 180450 1.518 0.305 180480 1.517 0.304 180510 1.517 0.304 180540 1.516 0.304 180570 1.516 0.303 180600 1.515 0.303 180630 1.515 0.303 180660 1.515 0.303 180690 1.514 0.302 180720 1.514 0.302 180750 1.513 0.302 180780 1.513 0.302 180810 1.512 0.301 180840 1.512 0.301 180870 1.511 0.301 180900 1.511 0.301 180930 1.511 0.300 180960 1.510 0.300 180990 1.510 0.300 181020 1.510 0.300 181050 1.509 0.299 181080 1.509 0.299 181110 1.508 0.299 181140 1.508 0.298 181170 1.508 0.298 181200 1.507 0.298 181230 1.507 0.297 181260 1.506 0.297 181290 1.506 0.296 181320 1.505 0.296 181350 1.505 0.295 181380 1.505 0.295 181410 1.504 0.294 181440 1.504 0.294 181470 1.503 0.294 181500 1.503 0.293 181530 1.502 0.293 181560 1.502 0.292 181590 1.501 0.292 181620 1.501 0.291 181650 1.500 0.291 181680 1.500 0.291 181710 1.499 0.290 181740 1.499 0.290 181770 1.498 0.289 181800 1.498 0.289 181830 1.497 0.289 181860 1.497 0.288 181890 1.496 0.288 181920 1.496 0.288 181950 1.496 0.287 181980 1.495 0.287 182010 1.495 0.287 182040 1.494 0.286 182070 1.494 0.286 182100 1.493 0.286 182130 1.493 0.285 182160 1.492 0.285 182190 1.492 0.285 182220 1.491 0.285 182250 1.491 0.284 182280 1.490 0.284 182310 1.490 0.284 182340 1.489 0.284 182370 1.489 0.283 182400 1.488 0.283 182430 1.487 0.283 182460 1.486 0.282 182490 1.485 0.282 182520 1.484 0.282 182550 1.483 0.281 182580 1.482 0.281 182610 1.480 0.281 182640 1.479 0.280 182670 1.478 0.280 182700 1.477 0.280 182730 1.476 0.279 182760 1.475 0.279 182790 1.474 0.279 182820 1.473 0.278 182850 1.472 0.278 182880 1.470 0.278 182910 1.469 0.277 182940 1.468 0.277 182970 1.467 0.277 183000 1.466 0.276 183030 1.465 0.276 183060 1.464 0.276 183090 1.463 0.275 183120 1.462 0.275 183150 1.461 0.275 183180 1.460 0.275 183210 1.459 0.274 183240 1.458 0.274 183270 1.456 0.274 183300 1.455 0.274 183330 1.454 0.273 183360 1.453 0.273 183390 1.452 0.273 183420 1.451 0.272 183450 1.450 0.272 183480 1.449 0.272 183510 1.448 0.272 183540 1.447 0.271 183570 1.446 0.271 183600 1.445 0.271 183630 1.444 0.271 183660 1.443 0.271 183690 1.441 0.270 183720 1.440 0.270 183750 1.439 0.270 183780 1.438 0.270 183810 1.437 0.269 183840 1.436 0.269 183870 1.434 0.269 183900 1.433 0.269 183930 1.432 0.269 183960 1.431 0.268 183990 1.430 0.268 184020 1.429 0.268 184050 1.428 0.268 184080 1.426 0.268 184110 1.425 0.267 184140 1.424 0.267 184170 1.423 0.267 184200 1.422 0.267 184230 1.421 0.267 184260 1.420 0.266 184290 1.419 0.266 184320 1.418 0.266 184350 1.417 0.266 184380 1.416 0.266 184410 1.415 0.266 184440 1.414 0.266 184470 1.413 0.265 184500 1.412 0.265 184530 1.411 0.265 184560 1.410 0.265 184590 1.409 0.265 184620 1.408 0.265 184650 1.407 0.264 184680 1.406 0.264 184710 1.405 0.264 184740 1.404 0.264 184770 1.403 0.264 184800 1.402 0.264 184830 1.400 0.264 184860 1.399 0.263 184890 1.397 0.263 184920 1.396 0.263 184950 1.395 0.263 184980 1.393 0.262 185010 1.392 0.262 185040 1.390 0.262 185070 1.389 0.262 185100 1.387 0.261 185130 1.386 0.261 185160 1.385 0.261 185190 1.383 0.260 185220 1.382 0.260 185250 1.381 0.260 185280 1.379 0.259 185310 1.378 0.259 185340 1.377 0.259 185370 1.375 0.258 185400 1.374 0.258 185430 1.373 0.258 185460 1.372 0.257 185490 1.370 0.257 185520 1.369 0.257 185550 1.368 0.256 185580 1.367 0.256 185610 1.365 0.256 185640 1.364 0.255 185670 1.363 0.255 185700 1.362 0.254 185730 1.361 0.254 185760 1.359 0.254 185790 1.358 0.253 185820 1.357 0.253 185850 1.356 0.252 185880 1.355 0.252 185910 1.354 0.251 185940 1.353 0.251 185970 1.351 0.251 186000 1.350 0.250 186030 1.349 0.250 186060 1.349 0.249 186090 1.348 0.249 186120 1.347 0.248 186150 1.346 0.248 186180 1.345 0.247 186210 1.344 0.247 186240 1.343 0.246 186270 1.342 0.246 186300 1.341 0.245 186330 1.340 0.245 186360 1.339 0.244 186390 1.338 0.244 186420 1.337 0.243 186450 1.337 0.243 186480 1.336 0.242 186510 1.335 0.242 186540 1.334 0.241 186570 1.333 0.240 186600 1.332 0.240 186630 1.331 0.239 186660 1.330 0.239 186690 1.330 0.238 186720 1.329 0.238 186750 1.328 0.237 186780 1.327 0.236 186810 1.326 0.236 186840 1.325 0.235 186870 1.324 0.235 186900 1.324 0.234 186930 1.323 0.233 186960 1.322 0.233 186990 1.321 0.232 187020 1.320 0.231 187050 1.319 0.231 187080 1.318 0.230 187110 1.318 0.229 187140 1.317 0.229 187170 1.316 0.228 187200 1.315 0.227 187230 1.314 0.227 187260 1.312 0.227 187290 1.311 0.226 187320 1.310 0.226 187350 1.308 0.226 187380 1.307 0.225 187410 1.306 0.225 187440 1.304 0.225 187470 1.303 0.224 187500 1.302 0.224 187530 1.300 0.224 187560 1.299 0.223 187590 1.298 0.223 187620 1.296 0.223 187650 1.295 0.222 187680 1.294 0.222 187710 1.293 0.222 187740 1.291 0.222 187770 1.290 0.221 187800 1.289 0.221 187830 1.288 0.221 187860 1.286 0.220 187890 1.285 0.220 187920 1.284 0.220 187950 1.283 0.219 187980 1.282 0.219 188010 1.281 0.219 188040 1.279 0.218 188070 1.278 0.218 188100 1.277 0.218 188130 1.276 0.217 188160 1.275 0.217 188190 1.274 0.217 188220 1.273 0.216 188250 1.272 0.216 188280 1.271 0.216 188310 1.270 0.215 188340 1.269 0.215 188370 1.268 0.215 188400 1.267 0.214 188430 1.266 0.215 188460 1.266 0.215 188490 1.266 0.215 188520 1.265 0.216 188550 1.265 0.216 188580 1.265 0.216 188610 1.264 0.217 188640 1.264 0.217 188670 1.264 0.217 188700 1.263 0.218 188730 1.263 0.218 188760 1.263 0.218 188790 1.262 0.219 188820 1.262 0.219 188850 1.262 0.219 188880 1.262 0.219 188910 1.261 0.220 188940 1.261 0.220 188970 1.261 0.220 189000 1.260 0.221 189030 1.260 0.221 189060 1.260 0.221 189090 1.260 0.221 189120 1.259 0.222 189150 1.259 0.222 189180 1.259 0.222 189210 1.259 0.222 189240 1.258 0.223 189270 1.258 0.223 189300 1.258 0.223 189330 1.258 0.223 189360 1.257 0.224 189390 1.257 0.224 189420 1.257 0.224 189450 1.257 0.224 189480 1.257 0.224 189510 1.256 0.225 189540 1.256 0.225 189570 1.256 0.225 189600 1.256 0.225 189630 1.256 0.226 189660 1.256 0.226 189690 1.256 0.227 189720 1.257 0.228 189750 1.257 0.228 189780 1.257 0.229 189810 1.257 0.229 189840 1.257 0.230 189870 1.258 0.230 189900 1.258 0.231 189930 1.258 0.231 189960 1.258 0.232 189990 1.259 0.232 190020 1.259 0.233 190050 1.259 0.234 190080 1.259 0.234 190110 1.260 0.235 190140 1.260 0.235 190170 1.260 0.236 190200 1.260 0.236 190230 1.261 0.237 190260 1.261 0.237 190290 1.261 0.238 190320 1.262 0.238 190350 1.262 0.239 190380 1.262 0.239 190410 1.262 0.240 190440 1.263 0.240 190470 1.263 0.241 190500 1.263 0.241 190530 1.264 0.242 190560 1.264 0.242 190590 1.264 0.243 190620 1.265 0.243 190650 1.265 0.243 190680 1.265 0.244 190710 1.266 0.244 190740 1.266 0.245 190770 1.266 0.245 190800 1.267 0.246 190830 1.267 0.246 190860 1.268 0.247 190890 1.269 0.247 190920 1.270 0.247 190950 1.270 0.248 190980 1.271 0.248 191010 1.272 0.249 191040 1.273 0.249 191070 1.273 0.250 191100 1.274 0.250 191130 1.275 0.250 191160 1.276 0.251 191190 1.276 0.251 191220 1.277 0.252 191250 1.278 0.252 191280 1.279 0.252 191310 1.280 0.253 191340 1.280 0.253 191370 1.281 0.254 191400 1.282 0.254 191430 1.283 0.254 191460 1.284 0.255 191490 1.285 0.255 191520 1.285 0.255 191550 1.286 0.256 191580 1.287 0.256 191610 1.288 0.256 191640 1.289 0.257 191670 1.290 0.257 191700 1.290 0.258 191730 1.291 0.258 191760 1.292 0.258 191790 1.293 0.259 191820 1.294 0.259 191850 1.295 0.259 191880 1.295 0.260 191910 1.296 0.260 191940 1.297 0.260 191970 1.298 0.260 192000 1.299 0.261 192030 1.300 0.261 192060 1.301 0.262 192090 1.302 0.262 192120 1.303 0.262 192150 1.303 0.263 192180 1.304 0.263 192210 1.305 0.264 192240 1.306 0.264 192270 1.307 0.264 192300 1.308 0.265 192330 1.309 0.265 192360 1.310 0.266 192390 1.311 0.266 192420 1.312 0.266 192450 1.313 0.267 192480 1.313 0.267 192510 1.314 0.267 192540 1.315 0.268 192570 1.316 0.268 192600 1.317 0.268 192630 1.318 0.269 192660 1.319 0.269 192690 1.320 0.269 192720 1.321 0.269 192750 1.322 0.270 192780 1.323 0.270 192810 1.324 0.270 192840 1.325 0.271 192870 1.326 0.271 192900 1.327 0.271 192930 1.328 0.271 192960 1.329 0.272 192990 1.330 0.272 193020 1.331 0.272 193050 1.332 0.272 193080 1.333 0.273 193110 1.334 0.273 193140 1.335 0.273 193170 1.336 0.273 193200 1.337 0.273 193230 1.338 0.274 193260 1.338 0.274 193290 1.339 0.275 193320 1.340 0.275 193350 1.340 0.276 193380 1.341 0.276 193410 1.342 0.277 193440 1.342 0.277 193470 1.343 0.278 193500 1.344 0.278 193530 1.344 0.279 193560 1.345 0.279 193590 1.346 0.280 193620 1.346 0.280 193650 1.347 0.280 193680 1.348 0.281 193710 1.348 0.281 193740 1.349 0.282 193770 1.350 0.282 193800 1.350 0.283 193830 1.351 0.283 193860 1.352 0.284 193890 1.352 0.284 193920 1.353 0.285 193950 1.354 0.285 193980 1.354 0.286 194010 1.355 0.286 194040 1.356 0.287 194070 1.356 0.287 194100 1.357 0.288 194130 1.358 0.288 194160 1.359 0.288 194190 1.359 0.289 194220 1.360 0.289 194250 1.361 0.290 194280 1.361 0.290 194310 1.362 0.291 194340 1.363 0.291 194370 1.363 0.292 194400 1.364 0.292 194430 1.363 0.292 194460 1.362 0.292 194490 1.362 0.292 194520 1.361 0.293 194550 1.360 0.293 194580 1.359 0.293 194610 1.359 0.293 194640 1.358 0.293 194670 1.357 0.293 194700 1.356 0.293 194730 1.356 0.293 194760 1.355 0.293 194790 1.354 0.293 194820 1.354 0.293 194850 1.353 0.293 194880 1.352 0.293 194910 1.351 0.293 194940 1.351 0.294 194970 1.350 0.294 195000 1.349 0.294 195030 1.348 0.294 195060 1.348 0.294 195090 1.347 0.294 195120 1.346 0.294 195150 1.345 0.294 195180 1.345 0.294 195210 1.344 0.294 195240 1.343 0.294 195270 1.342 0.294 195300 1.342 0.294 195330 1.341 0.294 195360 1.340 0.294 195390 1.339 0.295 195420 1.339 0.295 195450 1.338 0.295 195480 1.337 0.295 195510 1.336 0.295 195540 1.336 0.295 195570 1.335 0.295 195600 1.334 0.295 195630 1.333 0.295 195660 1.331 0.294 195690 1.330 0.294 195720 1.328 0.294 195750 1.327 0.293 195780 1.325 0.293 195810 1.324 0.293 195840 1.322 0.292 195870 1.321 0.292 195900 1.319 0.292 195930 1.318 0.291 195960 1.317 0.291 195990 1.315 0.291 196020 1.314 0.290 196050 1.312 0.290 196080 1.311 0.290 196110 1.309 0.289 196140 1.308 0.289 196170 1.306 0.289 196200 1.305 0.288 196230 1.304 0.288 196260 1.302 0.288 196290 1.301 0.287 196320 1.299 0.287 196350 1.298 0.287 196380 1.297 0.286 196410 1.295 0.286 196440 1.294 0.286 196470 1.292 0.285 196500 1.291 0.285 196530 1.290 0.285 196560 1.288 0.284 196590 1.287 0.284 196620 1.286 0.284 196650 1.284 0.283 196680 1.283 0.283 196710 1.281 0.283 196740 1.280 0.282 196770 1.279 0.282 196800 1.277 0.282 196830 1.276 0.281 196860 1.275 0.280 196890 1.273 0.279 196920 1.272 0.279 196950 1.271 0.278 196980 1.269 0.277 197010 1.268 0.276 197040 1.267 0.276 197070 1.266 0.275 197100 1.264 0.274 197130 1.263 0.273 197160 1.262 0.273 197190 1.261 0.272 197220 1.260 0.271 197250 1.259 0.270 197280 1.257 0.270 197310 1.256 0.269 197340 1.255 0.268 197370 1.254 0.267 197400 1.253 0.267 197430 1.252 0.266 197460 1.251 0.265 197490 1.250 0.264 197520 1.249 0.264 197550 1.248 0.263 197580 1.247 0.262 197610 1.246 0.261 197640 1.245 0.261 197670 1.244 0.260 197700 1.243 0.259 197730 1.242 0.259 197760 1.241 0.258 197790 1.240 0.257 197820 1.239 0.256 197850 1.238 0.256 197880 1.237 0.255 197910 1.237 0.254 197940 1.236 0.253 197970 1.235 0.253 198000 1.234 0.252 198030 1.233 0.251 198060 1.232 0.251 198090 1.231 0.250 198120 1.230 0.250 198150 1.229 0.249 198180 1.228 0.249 198210 1.227 0.248 198240 1.226 0.248 198270 1.225 0.247 198300 1.224 0.247 198330 1.223 0.246 198360 1.223 0.246 198390 1.222 0.245 198420 1.221 0.245 198450 1.220 0.244 198480 1.219 0.244 198510 1.218 0.243 198540 1.217 0.243 198570 1.217 0.242 198600 1.216 0.242 198630 1.215 0.241 198660 1.214 0.241 198690 1.213 0.240 198720 1.213 0.240 198750 1.212 0.240 198780 1.211 0.239 198810 1.210 0.239 198840 1.210 0.238 198870 1.209 0.238 198900 1.208 0.237 198930 1.207 0.237 198960 1.207 0.237 198990 1.206 0.236 199020 1.205 0.236 199050 1.205 0.235 199080 1.204 0.235 199110 1.203 0.234 199140 1.203 0.234 199170 1.202 0.234 199200 1.202 0.233 199230 1.201 0.233 199260 1.200 0.233 199290 1.199 0.233 199320 1.199 0.233 199350 1.198 0.233 199380 1.197 0.233 199410 1.196 0.233 199440 1.196 0.233 199470 1.195 0.233 199500 1.194 0.233 199530 1.194 0.234 199560 1.193 0.234 199590 1.192 0.234 199620 1.191 0.234 199650 1.191 0.234 199680 1.190 0.234 199710 1.189 0.234 199740 1.189 0.234 199770 1.188 0.234 199800 1.187 0.234 199830 1.187 0.234 199860 1.186 0.234 199890 1.185 0.234 199920 1.185 0.234 199950 1.184 0.234 199980 1.183 0.235 200010 1.183 0.235 200040 1.182 0.235 200070 1.181 0.235 200100 1.181 0.235 200130 1.180 0.235 200160 1.179 0.235 200190 1.179 0.235 200220 1.178 0.235 200250 1.178 0.236 200280 1.177 0.236 200310 1.176 0.236 200340 1.176 0.236 200370 1.175 0.236 200400 1.174 0.236 200430 1.174 0.237 200460 1.174 0.237 200490 1.174 0.238 200520 1.174 0.238 200550 1.174 0.239 200580 1.173 0.239 200610 1.173 0.240 200640 1.173 0.241 200670 1.173 0.241 200700 1.173 0.242 200730 1.172 0.242 200760 1.172 0.243 200790 1.172 0.243 200820 1.172 0.244 200850 1.172 0.245 200880 1.172 0.245 200910 1.172 0.246 200940 1.171 0.246 200970 1.171 0.247 201000 1.171 0.247 201030 1.171 0.248 201060 1.171 0.249 201090 1.171 0.249 201120 1.171 0.250 201150 1.170 0.250 201180 1.170 0.251 201210 1.170 0.252 201240 1.170 0.252 201270 1.170 0.253 201300 1.170 0.253 201330 1.170 0.254 201360 1.170 0.255 201390 1.170 0.255 201420 1.170 0.256 201450 1.169 0.257 201480 1.169 0.257 201510 1.169 0.258 201540 1.169 0.259 201570 1.169 0.259 201600 1.169 0.260 201630 1.169 0.260 201660 1.169 0.261 201690 1.168 0.261 201720 1.168 0.262 201750 1.168 0.262 201780 1.168 0.263 201810 1.168 0.263 201840 1.168 0.264 201870 1.167 0.264 201900 1.167 0.265 201930 1.167 0.265 201960 1.167 0.266 201990 1.167 0.266 202020 1.167 0.267 202050 1.166 0.267 202080 1.166 0.268 202110 1.166 0.268 202140 1.166 0.268 202170 1.166 0.269 202200 1.166 0.269 202230 1.166 0.270 202260 1.165 0.270 202290 1.165 0.270 202320 1.165 0.271 202350 1.165 0.271 202380 1.165 0.272 202410 1.165 0.272 202440 1.165 0.272 202470 1.165 0.273 202500 1.165 0.273 202530 1.164 0.273 202560 1.164 0.274 202590 1.164 0.274 202620 1.164 0.274 202650 1.164 0.275 202680 1.164 0.275 202710 1.164 0.275 202740 1.164 0.275 202770 1.164 0.276 202800 1.164 0.276 202830 1.165 0.276 202860 1.167 0.276 202890 1.168 0.276 202920 1.169 0.276 202950 1.171 0.276 202980 1.172 0.276 203010 1.174 0.276 203040 1.175 0.276 203070 1.176 0.276 203100 1.178 0.276 203130 1.179 0.276 203160 1.180 0.276 203190 1.182 0.276 203220 1.183 0.276 203250 1.185 0.276 203280 1.186 0.276 203310 1.187 0.276 203340 1.189 0.276 203370 1.190 0.276 203400 1.191 0.276 203430 1.193 0.276 203460 1.194 0.276 203490 1.195 0.276 203520 1.197 0.276 203550 1.198 0.276 203580 1.199 0.276 203610 1.201 0.276 203640 1.202 0.276 203670 1.203 0.276 203700 1.205 0.276 203730 1.206 0.276 203760 1.207 0.276 203790 1.209 0.276 203820 1.210 0.276 203850 1.211 0.276 203880 1.213 0.276 203910 1.214 0.276 203940 1.215 0.276 203970 1.217 0.276 204000 1.218 0.276 204030 1.220 0.276 204060 1.222 0.277 204090 1.224 0.277 204120 1.226 0.278 204150 1.228 0.278 204180 1.229 0.278 204210 1.231 0.279 204240 1.233 0.279 204270 1.235 0.280 204300 1.237 0.280 204330 1.239 0.280 204360 1.241 0.281 204390 1.243 0.281 204420 1.245 0.282 204450 1.246 0.282 204480 1.248 0.283 204510 1.250 0.283 204540 1.252 0.283 204570 1.254 0.284 204600 1.256 0.284 204630 1.258 0.285 204660 1.259 0.285 204690 1.261 0.285 204720 1.263 0.286 204750 1.265 0.286 204780 1.267 0.287 204810 1.268 0.287 204840 1.270 0.287 204870 1.272 0.288 204900 1.274 0.288 204930 1.275 0.289 204960 1.277 0.289 204990 1.279 0.289 205020 1.281 0.290 205050 1.282 0.290 205080 1.284 0.291 205110 1.286 0.291 205140 1.287 0.291 205170 1.289 0.292 205200 1.291 0.292 205230 1.294 0.292 205260 1.297 0.293 205290 1.300 0.293 205320 1.302 0.293 205350 1.305 0.293 205380 1.308 0.293 205410 1.311 0.294 205440 1.314 0.294 205470 1.317 0.294 205500 1.320 0.294 205530 1.323 0.294 205560 1.326 0.294 205590 1.329 0.295 205620 1.332 0.295 205650 1.334 0.295 205680 1.337 0.295 205710 1.340 0.295 205740 1.343 0.295 205770 1.346 0.296 205800 1.349 0.296 205830 1.352 0.296 205860 1.355 0.296 205890 1.358 0.296 205920 1.361 0.296 205950 1.364 0.296 205980 1.366 0.296 206010 1.369 0.297 206040 1.372 0.297 206070 1.375 0.297 206100 1.378 0.297 206130 1.381 0.297 206160 1.384 0.297 206190 1.387 0.297 206220 1.390 0.297 206250 1.393 0.297 206280 1.396 0.297 206310 1.399 0.298 206340 1.401 0.298 206370 1.404 0.298 206400 1.407 0.298 206430 1.412 0.298 206460 1.416 0.297 206490 1.420 0.297 206520 1.425 0.297 206550 1.429 0.297 206580 1.433 0.297 206610 1.438 0.296 206640 1.442 0.296 206670 1.447 0.296 206700 1.451 0.296 206730 1.455 0.296 206760 1.460 0.296 206790 1.464 0.295 206820 1.468 0.295 206850 1.472 0.295 206880 1.477 0.295 206910 1.481 0.295 206940 1.485 0.295 206970 1.490 0.294 207000 1.494 0.294 207030 1.498 0.294 207060 1.502 0.294 207090 1.507 0.294 207120 1.511 0.294 207150 1.515 0.294 207180 1.519 0.294 207210 1.523 0.293 207240 1.528 0.293 207270 1.532 0.293 207300 1.536 0.293 207330 1.540 0.293 207360 1.544 0.293 207390 1.549 0.293 207420 1.553 0.293 207450 1.557 0.293 207480 1.561 0.293 207510 1.565 0.292 207540 1.569 0.292 207570 1.574 0.292 207600 1.578 0.292 207630 1.582 0.292 207660 1.587 0.292 207690 1.591 0.292 207720 1.596 0.292 207750 1.600 0.292 207780 1.605 0.292 207810 1.609 0.292 207840 1.614 0.292 207870 1.618 0.292 207900 1.623 0.292 207930 1.627 0.292 207960 1.632 0.292 207990 1.636 0.292 208020 1.641 0.292 208050 1.645 0.292 208080 1.649 0.292 208110 1.654 0.292 208140 1.658 0.292 208170 1.663 0.292 208200 1.667 0.292 208230 1.671 0.292 208260 1.676 0.292 208290 1.680 0.292 208320 1.685 0.292 208350 1.689 0.292 208380 1.693 0.292 208410 1.698 0.292 208440 1.702 0.292 208470 1.706 0.292 208500 1.711 0.292 208530 1.715 0.292 208560 1.719 0.292 208590 1.724 0.292 208620 1.728 0.292 208650 1.732 0.292 208680 1.737 0.292 208710 1.741 0.292 208740 1.745 0.292 208770 1.749 0.292 208800 1.754 0.292 208830 1.759 0.292 208860 1.764 0.292 208890 1.769 0.292 208920 1.775 0.292 208950 1.780 0.292 208980 1.785 0.292 209010 1.791 0.291 209040 1.796 0.291 209070 1.801 0.291 209100 1.806 0.291 209130 1.812 0.291 209160 1.817 0.291 209190 1.822 0.291 209220 1.828 0.291 209250 1.833 0.291 209280 1.838 0.291 209310 1.843 0.291 209340 1.849 0.290 209370 1.854 0.290 209400 1.859 0.290 209430 1.864 0.290 209460 1.870 0.290 209490 1.875 0.290 209520 1.880 0.290 209550 1.886 0.290 209580 1.891 0.290 209610 1.896 0.290 209640 1.901 0.290 209670 1.907 0.290 209700 1.912 0.290 209730 1.917 0.290 209760 1.922 0.290 209790 1.928 0.290 209820 1.933 0.290 209850 1.938 0.290 209880 1.944 0.290 209910 1.949 0.290 209940 1.954 0.290 209970 1.959 0.290 210000 1.965 0.290 210030 1.969 0.289 210060 1.973 0.289 210090 1.978 0.288 210120 1.982 0.288 210150 1.987 0.288 210180 1.991 0.287 210210 1.995 0.287 210240 2.000 0.286 210270 2.004 0.286 210300 2.009 0.286 210330 2.013 0.285 210360 2.017 0.285 210390 2.022 0.285 210420 2.026 0.284 210450 2.030 0.284 210480 2.035 0.284 210510 2.039 0.283 210540 2.043 0.283 210570 2.048 0.282 210600 2.052 0.282 210630 2.056 0.282 210660 2.061 0.281 210690 2.065 0.281 210720 2.069 0.281 210750 2.074 0.280 210780 2.078 0.280 210810 2.082 0.280 210840 2.087 0.280 210870 2.091 0.279 210900 2.095 0.279 210930 2.099 0.279 210960 2.104 0.278 210990 2.108 0.278 211020 2.112 0.278 211050 2.117 0.277 211080 2.121 0.277 211110 2.125 0.277 211140 2.129 0.277 211170 2.134 0.276 211200 2.138 0.276 211230 2.141 0.276 211260 2.144 0.276 211290 2.147 0.276 211320 2.149 0.275 211350 2.152 0.275 211380 2.155 0.275 211410 2.158 0.275 211440 2.161 0.275 211470 2.164 0.275 211500 2.167 0.275 211530 2.169 0.274 211560 2.172 0.274 211590 2.175 0.274 211620 2.178 0.274 211650 2.181 0.274 211680 2.184 0.273 211710 2.186 0.273 211740 2.189 0.273 211770 2.192 0.273 211800 2.195 0.273 211830 2.198 0.272 211860 2.200 0.272 211890 2.203 0.272 211920 2.206 0.272 211950 2.209 0.272 211980 2.211 0.271 212010 2.214 0.271 212040 2.217 0.271 212070 2.219 0.271 212100 2.222 0.271 212130 2.225 0.270 212160 2.228 0.270 212190 2.230 0.270 212220 2.233 0.270 212250 2.236 0.269 212280 2.238 0.269 212310 2.241 0.269 212340 2.244 0.269 212370 2.246 0.268 212400 2.249 0.268 212430 2.253 0.268 212460 2.256 0.268 212490 2.260 0.268 212520 2.263 0.268 212550 2.267 0.268 212580 2.271 0.268 212610 2.274 0.268 212640 2.278 0.267 212670 2.281 0.267 212700 2.285 0.267 212730 2.288 0.267 212760 2.292 0.267 212790 2.295 0.267 212820 2.299 0.267 212850 2.303 0.267 212880 2.306 0.267 212910 2.309 0.267 212940 2.313 0.267 212970 2.316 0.267 213000 2.320 0.267 213030 2.323 0.267 213060 2.327 0.267 213090 2.330 0.266 213120 2.334 0.266 213150 2.337 0.266 213180 2.340 0.266 213210 2.344 0.266 213240 2.347 0.266 213270 2.351 0.266 213300 2.354 0.266 213330 2.357 0.266 213360 2.361 0.266 213390 2.364 0.266 213420 2.367 0.266 213450 2.371 0.266 213480 2.374 0.266 213510 2.377 0.266 213540 2.380 0.265 213570 2.384 0.265 213600 2.387 0.265 213630 2.392 0.265 213660 2.397 0.265 213690 2.402 0.266 213720 2.407 0.266 213750 2.412 0.266 213780 2.417 0.266 213810 2.422 0.266 213840 2.427 0.266 213870 2.432 0.266 213900 2.437 0.266 213930 2.442 0.266 213960 2.447 0.266 213990 2.452 0.266 214020 2.457 0.266 214050 2.462 0.266 214080 2.467 0.266 214110 2.471 0.266 214140 2.476 0.266 214170 2.481 0.266 214200 2.486 0.266 214230 2.491 0.266 214260 2.496 0.266 214290 2.501 0.266 214320 2.506 0.266 214350 2.511 0.266 214380 2.516 0.266 214410 2.521 0.266 214440 2.526 0.266 214470 2.531 0.266 214500 2.536 0.266 214530 2.540 0.266 214560 2.545 0.266 214590 2.550 0.266 214620 2.555 0.266 214650 2.560 0.266 214680 2.565 0.266 214710 2.570 0.266 214740 2.575 0.266 214770 2.580 0.266 214800 2.584 0.265 214830 2.590 0.265 214860 2.596 0.265 214890 2.602 0.265 214920 2.609 0.265 214950 2.615 0.265 214980 2.621 0.265 215010 2.627 0.265 215040 2.633 0.265 215070 2.639 0.265 215100 2.645 0.265 215130 2.651 0.265 215160 2.657 0.265 215190 2.663 0.265 215220 2.669 0.265 215250 2.675 0.265 215280 2.681 0.265 215310 2.687 0.265 215340 2.693 0.264 215370 2.699 0.264 215400 2.705 0.264 215430 2.711 0.264 215460 2.717 0.264 215490 2.723 0.264 215520 2.729 0.264 215550 2.735 0.263 215580 2.741 0.263 215610 2.747 0.263 215640 2.753 0.263 215670 2.759 0.263 215700 2.765 0.262 215730 2.771 0.262 215760 2.777 0.262 215790 2.783 0.262 215820 2.789 0.261 215850 2.795 0.261 215880 2.801 0.261 215910 2.807 0.261 215940 2.813 0.260 215970 2.819 0.260 216000 nan nan 216030 nan nan 216060 nan nan 216090 nan nan 216120 nan nan 216150 nan nan 216180 nan nan 216210 nan nan 216240 nan nan 216270 nan nan 216300 nan nan 216330 nan nan 216360 nan nan 216390 nan nan 216420 nan nan 216450 nan nan 216480 nan nan 216510 nan nan 216540 nan nan 216570 nan nan 216600 nan nan 216630 nan nan 216660 nan nan 216690 nan nan 216720 nan nan 216750 nan nan 216780 nan nan 216810 nan nan 216840 nan nan 216870 nan nan 216900 nan nan 216930 nan nan 216960 nan nan 216990 nan nan 217020 nan nan 217050 nan nan 217080 nan nan 217110 nan nan 217140 nan nan 217170 nan nan 217200 nan nan 217230 nan nan 217260 nan nan 217290 nan nan 217320 nan nan 217350 nan nan 217380 nan nan 217410 nan nan 217440 nan nan 217470 nan nan 217500 nan nan 217530 nan nan 217560 nan nan 217590 nan nan 217620 nan nan 217650 nan nan 217680 nan nan 217710 nan nan 217740 nan nan 217770 nan nan 217800 nan nan 217830 nan nan 217860 nan nan 217890 nan nan 217920 nan nan 217950 nan nan 217980 nan nan 218010 nan nan 218040 nan nan 218070 nan nan 218100 nan nan 218130 nan nan 218160 nan nan 218190 nan nan 218220 nan nan 218250 nan nan 218280 nan nan 218310 nan nan 218340 nan nan 218370 nan nan 218400 nan nan 218430 nan nan 218460 nan nan 218490 nan nan 218520 nan nan 218550 nan nan 218580 nan nan 218610 nan nan 218640 nan nan 218670 nan nan 218700 nan nan 218730 nan nan 218760 nan nan 218790 nan nan 218820 nan nan 218850 nan nan 218880 nan nan 218910 nan nan 218940 nan nan 218970 nan nan 219000 nan nan 219030 nan nan 219060 nan nan 219090 nan nan 219120 nan nan 219150 nan nan 219180 nan nan 219210 nan nan 219240 nan nan 219270 nan nan 219300 nan nan 219330 nan nan 219360 nan nan 219390 nan nan 219420 nan nan 219450 nan nan 219480 nan nan 219510 nan nan 219540 nan nan 219570 nan nan 219600 nan nan 219630 nan nan 219660 nan nan 219690 nan nan 219720 nan nan 219750 nan nan 219780 nan nan 219810 nan nan 219840 nan nan 219870 nan nan 219900 nan nan 219930 nan nan 219960 nan nan 219990 nan nan 220020 nan nan 220050 nan nan 220080 nan nan 220110 nan nan 220140 nan nan 220170 nan nan 220200 nan nan 220230 nan nan 220260 nan nan 220290 nan nan 220320 nan nan 220350 nan nan 220380 nan nan 220410 nan nan 220440 nan nan 220470 nan nan 220500 nan nan 220530 nan nan 220560 nan nan 220590 nan nan 220620 nan nan 220650 nan nan 220680 nan nan 220710 nan nan 220740 nan nan 220770 nan nan 220800 nan nan 220830 nan nan 220860 nan nan 220890 nan nan 220920 nan nan 220950 nan nan 220980 nan nan 221010 nan nan 221040 nan nan 221070 nan nan 221100 nan nan 221130 nan nan 221160 nan nan 221190 nan nan 221220 nan nan 221250 nan nan 221280 nan nan 221310 nan nan 221340 nan nan 221370 nan nan 221400 nan nan 221430 nan nan 221460 nan nan 221490 nan nan 221520 nan nan 221550 nan nan 221580 nan nan 221610 nan nan 221640 nan nan 221670 nan nan 221700 nan nan 221730 nan nan 221760 nan nan 221790 nan nan 221820 nan nan 221850 nan nan 221880 nan nan 221910 nan nan 221940 nan nan 221970 nan nan 222000 nan nan 222030 nan nan 222060 nan nan 222090 nan nan 222120 nan nan 222150 nan nan 222180 nan nan 222210 nan nan 222240 nan nan 222270 nan nan 222300 nan nan 222330 nan nan 222360 nan nan 222390 nan nan 222420 nan nan 222450 nan nan 222480 nan nan 222510 nan nan 222540 nan nan 222570 nan nan 222600 nan nan 222630 nan nan 222660 nan nan 222690 nan nan 222720 nan nan 222750 nan nan 222780 nan nan 222810 nan nan 222840 nan nan 222870 nan nan 222900 nan nan 222930 nan nan 222960 nan nan 222990 nan nan 223020 nan nan 223050 nan nan 223080 nan nan 223110 nan nan 223140 nan nan 223170 nan nan 223200 nan nan 223230 nan nan 223260 nan nan 223290 nan nan 223320 nan nan 223350 nan nan 223380 nan nan 223410 nan nan 223440 nan nan 223470 nan nan 223500 nan nan 223530 nan nan 223560 nan nan 223590 nan nan 223620 nan nan 223650 nan nan 223680 nan nan 223710 nan nan 223740 nan nan 223770 nan nan 223800 nan nan 223830 nan nan 223860 nan nan 223890 nan nan 223920 nan nan 223950 nan nan 223980 nan nan 224010 nan nan 224040 nan nan 224070 nan nan 224100 nan nan 224130 nan nan 224160 nan nan 224190 nan nan 224220 nan nan 224250 nan nan 224280 nan nan 224310 nan nan 224340 nan nan 224370 nan nan 224400 nan nan 224430 nan nan 224460 nan nan 224490 nan nan 224520 nan nan 224550 nan nan 224580 nan nan 224610 nan nan 224640 nan nan 224670 nan nan 224700 nan nan 224730 nan nan 224760 nan nan 224790 nan nan 224820 nan nan 224850 nan nan 224880 nan nan 224910 nan nan 224940 nan nan 224970 nan nan 225000 nan nan 225030 nan nan 225060 nan nan 225090 nan nan 225120 nan nan 225150 nan nan 225180 nan nan 225210 nan nan 225240 nan nan 225270 nan nan 225300 nan nan 225330 nan nan 225360 nan nan 225390 nan nan 225420 nan nan 225450 nan nan 225480 nan nan 225510 nan nan 225540 nan nan 225570 nan nan 225600 nan nan 225630 nan nan 225660 nan nan 225690 nan nan 225720 nan nan 225750 nan nan 225780 nan nan 225810 nan nan 225840 nan nan 225870 nan nan 225900 nan nan 225930 nan nan 225960 nan nan 225990 nan nan 226020 nan nan 226050 nan nan 226080 nan nan 226110 nan nan 226140 nan nan 226170 nan nan 226200 nan nan 226230 nan nan 226260 nan nan 226290 nan nan 226320 nan nan 226350 nan nan 226380 nan nan 226410 nan nan 226440 nan nan 226470 nan nan 226500 nan nan 226530 nan nan 226560 nan nan 226590 nan nan 226620 nan nan 226650 nan nan 226680 nan nan 226710 nan nan 226740 nan nan 226770 nan nan 226800 nan nan 226830 nan nan 226860 nan nan 226890 nan nan 226920 nan nan 226950 nan nan 226980 nan nan 227010 nan nan 227040 nan nan 227070 nan nan 227100 nan nan 227130 nan nan 227160 nan nan 227190 nan nan 227220 nan nan 227250 nan nan 227280 nan nan 227310 nan nan 227340 nan nan 227370 nan nan 227400 nan nan 227430 nan nan 227460 nan nan 227490 nan nan 227520 nan nan 227550 nan nan 227580 nan nan 227610 nan nan 227640 nan nan 227670 nan nan 227700 nan nan 227730 nan nan 227760 nan nan 227790 nan nan 227820 nan nan 227850 nan nan 227880 nan nan 227910 nan nan 227940 nan nan 227970 nan nan 228000 nan nan 228030 nan nan 228060 nan nan 228090 nan nan 228120 nan nan 228150 nan nan 228180 nan nan 228210 nan nan 228240 nan nan 228270 nan nan 228300 nan nan 228330 nan nan 228360 nan nan 228390 nan nan 228420 nan nan 228450 nan nan 228480 nan nan 228510 nan nan 228540 nan nan 228570 nan nan 228600 nan nan 228630 nan nan 228660 nan nan 228690 nan nan 228720 nan nan 228750 nan nan 228780 nan nan 228810 nan nan 228840 nan nan 228870 nan nan 228900 nan nan 228930 nan nan 228960 nan nan 228990 nan nan 229020 nan nan 229050 nan nan 229080 nan nan 229110 nan nan 229140 nan nan 229170 nan nan 229200 nan nan 229230 nan nan 229260 nan nan 229290 nan nan 229320 nan nan 229350 nan nan 229380 nan nan 229410 nan nan 229440 nan nan 229470 nan nan 229500 nan nan 229530 nan nan 229560 nan nan 229590 nan nan 229620 nan nan 229650 nan nan 229680 nan nan 229710 nan nan 229740 nan nan 229770 nan nan 229800 nan nan 229830 nan nan 229860 nan nan 229890 nan nan 229920 nan nan 229950 nan nan 229980 nan nan 230010 nan nan 230040 nan nan 230070 nan nan 230100 nan nan 230130 nan nan 230160 nan nan 230190 nan nan 230220 nan nan 230250 nan nan 230280 nan nan 230310 nan nan 230340 nan nan 230370 nan nan 230400 nan nan 230430 nan nan 230460 nan nan 230490 nan nan 230520 nan nan 230550 nan nan 230580 nan nan 230610 nan nan 230640 nan nan 230670 nan nan 230700 nan nan 230730 nan nan 230760 nan nan 230790 nan nan 230820 nan nan 230850 nan nan 230880 nan nan 230910 nan nan 230940 nan nan 230970 nan nan 231000 nan nan 231030 nan nan 231060 nan nan 231090 nan nan 231120 nan nan 231150 nan nan 231180 nan nan 231210 nan nan 231240 nan nan 231270 nan nan 231300 nan nan 231330 nan nan 231360 nan nan 231390 nan nan 231420 nan nan 231450 nan nan 231480 nan nan 231510 nan nan 231540 nan nan 231570 nan nan 231600 nan nan 231630 nan nan 231660 nan nan 231690 nan nan 231720 nan nan 231750 nan nan 231780 nan nan 231810 nan nan 231840 nan nan 231870 nan nan 231900 nan nan 231930 nan nan 231960 nan nan 231990 nan nan 232020 nan nan 232050 nan nan 232080 nan nan 232110 nan nan 232140 nan nan 232170 nan nan 232200 nan nan 232230 nan nan 232260 nan nan 232290 nan nan 232320 nan nan 232350 nan nan 232380 nan nan 232410 nan nan 232440 nan nan 232470 nan nan 232500 nan nan 232530 nan nan 232560 nan nan 232590 nan nan 232620 nan nan 232650 nan nan 232680 nan nan 232710 nan nan 232740 nan nan 232770 nan nan 232800 nan nan 232830 nan nan 232860 nan nan 232890 nan nan 232920 nan nan 232950 nan nan 232980 nan nan 233010 nan nan 233040 nan nan 233070 nan nan 233100 nan nan 233130 nan nan 233160 nan nan 233190 nan nan 233220 nan nan 233250 nan nan 233280 nan nan 233310 nan nan 233340 nan nan 233370 nan nan 233400 nan nan 233430 nan nan 233460 nan nan 233490 nan nan 233520 nan nan 233550 nan nan 233580 nan nan 233610 nan nan 233640 nan nan 233670 nan nan 233700 nan nan 233730 nan nan 233760 nan nan 233790 nan nan 233820 nan nan 233850 nan nan 233880 nan nan 233910 nan nan 233940 nan nan 233970 nan nan 234000 nan nan 234030 nan nan 234060 nan nan 234090 nan nan 234120 nan nan 234150 nan nan 234180 nan nan 234210 nan nan 234240 nan nan 234270 nan nan 234300 nan nan 234330 nan nan 234360 nan nan 234390 nan nan 234420 nan nan 234450 nan nan 234480 nan nan 234510 nan nan 234540 nan nan 234570 nan nan 234600 nan nan 234630 nan nan 234660 nan nan 234690 nan nan 234720 nan nan 234750 nan nan 234780 nan nan 234810 nan nan 234840 nan nan 234870 nan nan 234900 nan nan 234930 nan nan 234960 nan nan 234990 nan nan 235020 nan nan 235050 nan nan 235080 nan nan 235110 nan nan 235140 nan nan 235170 nan nan 235200 nan nan 235230 nan nan 235260 nan nan 235290 nan nan 235320 nan nan 235350 nan nan 235380 nan nan 235410 nan nan 235440 nan nan 235470 nan nan 235500 nan nan 235530 nan nan 235560 nan nan 235590 nan nan 235620 nan nan 235650 nan nan 235680 nan nan 235710 nan nan 235740 nan nan 235770 nan nan 235800 nan nan 235830 nan nan 235860 nan nan 235890 nan nan 235920 nan nan 235950 nan nan 235980 nan nan 236010 nan nan 236040 nan nan 236070 nan nan 236100 nan nan 236130 nan nan 236160 nan nan 236190 nan nan 236220 nan nan 236250 nan nan 236280 nan nan 236310 nan nan 236340 nan nan 236370 nan nan 236400 nan nan 236430 nan nan 236460 nan nan 236490 nan nan 236520 nan nan 236550 nan nan 236580 nan nan 236610 nan nan 236640 nan nan 236670 nan nan 236700 nan nan 236730 nan nan 236760 nan nan 236790 nan nan 236820 nan nan 236850 nan nan 236880 nan nan 236910 nan nan 236940 nan nan 236970 nan nan 237000 nan nan 237030 nan nan 237060 nan nan 237090 nan nan 237120 nan nan 237150 nan nan 237180 nan nan 237210 nan nan 237240 nan nan 237270 nan nan 237300 nan nan 237330 nan nan 237360 nan nan 237390 nan nan 237420 nan nan 237450 nan nan 237480 nan nan 237510 nan nan 237540 nan nan 237570 nan nan 237600 nan nan 237630 nan nan 237660 nan nan 237690 nan nan 237720 nan nan 237750 nan nan 237780 nan nan 237810 nan nan 237840 nan nan 237870 nan nan 237900 nan nan 237930 nan nan 237960 nan nan 237990 nan nan 238020 nan nan 238050 nan nan 238080 nan nan 238110 nan nan 238140 nan nan 238170 nan nan 238200 nan nan 238230 nan nan 238260 nan nan 238290 nan nan 238320 nan nan 238350 nan nan 238380 nan nan 238410 nan nan 238440 nan nan 238470 nan nan 238500 nan nan 238530 nan nan 238560 nan nan 238590 nan nan 238620 nan nan 238650 nan nan 238680 nan nan 238710 nan nan 238740 nan nan 238770 nan nan 238800 nan nan 238830 nan nan 238860 nan nan 238890 nan nan 238920 nan nan 238950 nan nan 238980 nan nan 239010 nan nan 239040 nan nan 239070 nan nan 239100 nan nan 239130 nan nan 239160 nan nan 239190 nan nan 239220 nan nan 239250 nan nan 239280 nan nan 239310 nan nan 239340 nan nan 239370 nan nan 239400 nan nan 239430 nan nan 239460 nan nan 239490 nan nan 239520 nan nan 239550 nan nan 239580 nan nan 239610 nan nan 239640 nan nan 239670 nan nan 239700 nan nan 239730 nan nan 239760 nan nan 239790 nan nan 239820 nan nan 239850 nan nan 239880 nan nan 239910 nan nan 239940 nan nan 239970 nan nan 240000 nan nan 240030 nan nan 240060 nan nan 240090 nan nan 240120 nan nan 240150 nan nan 240180 nan nan 240210 nan nan 240240 nan nan 240270 nan nan 240300 nan nan 240330 nan nan 240360 nan nan 240390 nan nan 240420 nan nan 240450 nan nan 240480 nan nan 240510 nan nan 240540 nan nan 240570 nan nan 240600 nan nan 240630 nan nan 240660 nan nan 240690 nan nan 240720 nan nan 240750 nan nan 240780 nan nan 240810 nan nan 240840 nan nan 240870 nan nan 240900 nan nan 240930 nan nan 240960 nan nan 240990 nan nan 241020 nan nan 241050 nan nan 241080 nan nan 241110 nan nan 241140 nan nan 241170 nan nan 241200 nan nan 241230 nan nan 241260 nan nan 241290 nan nan 241320 nan nan 241350 nan nan 241380 nan nan 241410 nan nan 241440 nan nan 241470 nan nan 241500 nan nan 241530 nan nan 241560 nan nan 241590 nan nan 241620 nan nan 241650 nan nan 241680 nan nan 241710 nan nan 241740 nan nan 241770 nan nan 241800 nan nan 241830 nan nan 241860 nan nan 241890 nan nan 241920 nan nan 241950 nan nan 241980 nan nan 242010 nan nan 242040 nan nan 242070 nan nan 242100 nan nan 242130 nan nan 242160 nan nan 242190 nan nan 242220 nan nan 242250 nan nan 242280 nan nan 242310 nan nan 242340 nan nan 242370 nan nan 242400 nan nan 242430 nan nan 242460 nan nan 242490 nan nan 242520 nan nan 242550 nan nan 242580 nan nan 242610 nan nan 242640 nan nan 242670 nan nan 242700 nan nan 242730 nan nan 242760 nan nan 242790 nan nan 242820 nan nan 242850 nan nan 242880 nan nan 242910 nan nan 242940 nan nan 242970 nan nan 243000 nan nan 243030 nan nan 243060 nan nan 243090 nan nan 243120 nan nan 243150 nan nan 243180 nan nan 243210 nan nan 243240 nan nan 243270 nan nan 243300 nan nan 243330 nan nan 243360 nan nan 243390 nan nan 243420 nan nan 243450 nan nan 243480 nan nan 243510 nan nan 243540 nan nan 243570 nan nan 243600 nan nan 243630 nan nan 243660 nan nan 243690 nan nan 243720 nan nan 243750 nan nan 243780 nan nan 243810 nan nan 243840 nan nan 243870 nan nan 243900 nan nan 243930 nan nan 243960 nan nan 243990 nan nan 244020 nan nan 244050 nan nan 244080 nan nan 244110 nan nan 244140 nan nan 244170 nan nan 244200 nan nan 244230 nan nan 244260 nan nan 244290 nan nan 244320 nan nan 244350 nan nan 244380 nan nan 244410 nan nan 244440 nan nan 244470 nan nan 244500 nan nan 244530 nan nan 244560 nan nan 244590 nan nan 244620 nan nan 244650 nan nan 244680 nan nan 244710 nan nan 244740 nan nan 244770 nan nan 244800 nan nan 244830 nan nan 244860 nan nan 244890 nan nan 244920 nan nan 244950 nan nan 244980 nan nan 245010 nan nan 245040 nan nan 245070 nan nan 245100 nan nan 245130 nan nan 245160 nan nan 245190 nan nan 245220 nan nan 245250 nan nan 245280 nan nan 245310 nan nan 245340 nan nan 245370 nan nan 245400 nan nan 245430 nan nan 245460 nan nan 245490 nan nan 245520 nan nan 245550 nan nan 245580 nan nan 245610 nan nan 245640 nan nan 245670 nan nan 245700 nan nan 245730 nan nan 245760 nan nan 245790 nan nan 245820 nan nan 245850 nan nan 245880 nan nan 245910 nan nan 245940 nan nan 245970 nan nan 246000 nan nan 246030 nan nan 246060 nan nan 246090 nan nan 246120 nan nan 246150 nan nan 246180 nan nan 246210 nan nan 246240 nan nan 246270 nan nan 246300 nan nan 246330 nan nan 246360 nan nan 246390 nan nan 246420 nan nan 246450 nan nan 246480 nan nan 246510 nan nan 246540 nan nan 246570 nan nan 246600 nan nan 246630 nan nan 246660 nan nan 246690 nan nan 246720 nan nan 246750 nan nan 246780 nan nan 246810 nan nan 246840 nan nan 246870 nan nan 246900 nan nan 246930 nan nan 246960 nan nan 246990 nan nan 247020 nan nan 247050 nan nan 247080 nan nan 247110 nan nan 247140 nan nan 247170 nan nan 247200 nan nan 247230 nan nan 247260 nan nan 247290 nan nan 247320 nan nan 247350 nan nan 247380 nan nan 247410 nan nan 247440 nan nan 247470 nan nan 247500 nan nan 247530 nan nan 247560 nan nan 247590 nan nan 247620 nan nan 247650 nan nan 247680 nan nan 247710 nan nan 247740 nan nan 247770 nan nan 247800 nan nan 247830 nan nan 247860 nan nan 247890 nan nan 247920 nan nan 247950 nan nan 247980 nan nan 248010 nan nan 248040 nan nan 248070 nan nan 248100 nan nan 248130 nan nan 248160 nan nan 248190 nan nan 248220 nan nan 248250 nan nan 248280 nan nan 248310 nan nan 248340 nan nan 248370 nan nan 248400 nan nan 248430 nan nan 248460 nan nan 248490 nan nan 248520 nan nan 248550 nan nan 248580 nan nan 248610 nan nan 248640 nan nan 248670 nan nan 248700 nan nan 248730 nan nan 248760 nan nan 248790 nan nan 248820 nan nan 248850 nan nan 248880 nan nan 248910 nan nan 248940 nan nan 248970 nan nan 249000 nan nan 249030 nan nan 249060 nan nan 249090 nan nan 249120 nan nan 249150 nan nan 249180 nan nan 249210 nan nan 249240 nan nan 249270 nan nan 249300 nan nan 249330 nan nan 249360 nan nan 249390 nan nan 249420 nan nan 249450 nan nan 249480 nan nan 249510 nan nan 249540 nan nan 249570 nan nan 249600 nan nan 249630 nan nan 249660 nan nan 249690 nan nan 249720 nan nan 249750 nan nan 249780 nan nan 249810 nan nan 249840 nan nan 249870 nan nan 249900 nan nan 249930 nan nan 249960 nan nan 249990 nan nan 250020 nan nan 250050 nan nan 250080 nan nan 250110 nan nan 250140 nan nan 250170 nan nan 250200 nan nan 250230 nan nan 250260 nan nan 250290 nan nan 250320 nan nan 250350 nan nan 250380 nan nan 250410 nan nan 250440 nan nan 250470 nan nan 250500 nan nan 250530 nan nan 250560 nan nan 250590 nan nan 250620 nan nan 250650 nan nan 250680 nan nan 250710 nan nan 250740 nan nan 250770 nan nan 250800 nan nan 250830 nan nan 250860 nan nan 250890 nan nan 250920 nan nan 250950 nan nan 250980 nan nan 251010 nan nan 251040 nan nan 251070 nan nan 251100 nan nan 251130 nan nan 251160 nan nan 251190 nan nan 251220 nan nan 251250 nan nan 251280 nan nan 251310 nan nan 251340 nan nan 251370 nan nan 251400 nan nan 251430 nan nan 251460 nan nan 251490 nan nan 251520 nan nan 251550 nan nan 251580 nan nan 251610 nan nan 251640 nan nan 251670 nan nan 251700 nan nan 251730 nan nan 251760 nan nan 251790 nan nan 251820 nan nan 251850 nan nan 251880 nan nan 251910 nan nan 251940 nan nan 251970 nan nan 252000 nan nan 252030 nan nan 252060 nan nan 252090 nan nan 252120 nan nan 252150 nan nan 252180 nan nan 252210 nan nan 252240 nan nan 252270 nan nan 252300 nan nan 252330 nan nan 252360 nan nan 252390 nan nan 252420 nan nan 252450 nan nan 252480 nan nan 252510 nan nan 252540 nan nan 252570 nan nan 252600 nan nan 252630 nan nan 252660 nan nan 252690 nan nan 252720 nan nan 252750 nan nan 252780 nan nan 252810 nan nan 252840 nan nan 252870 nan nan 252900 nan nan 252930 nan nan 252960 nan nan 252990 nan nan 253020 nan nan 253050 nan nan 253080 nan nan 253110 nan nan 253140 nan nan 253170 nan nan 253200 nan nan 253230 nan nan 253260 nan nan 253290 nan nan 253320 nan nan 253350 nan nan 253380 nan nan 253410 nan nan 253440 nan nan 253470 nan nan 253500 nan nan 253530 nan nan 253560 nan nan 253590 nan nan 253620 nan nan 253650 nan nan 253680 nan nan 253710 nan nan 253740 nan nan 253770 nan nan 253800 nan nan 253830 nan nan 253860 nan nan 253890 nan nan 253920 nan nan 253950 nan nan 253980 nan nan 254010 nan nan 254040 nan nan 254070 nan nan 254100 nan nan 254130 nan nan 254160 nan nan 254190 nan nan 254220 nan nan 254250 nan nan 254280 nan nan 254310 nan nan 254340 nan nan 254370 nan nan 254400 nan nan 254430 nan nan 254460 nan nan 254490 nan nan 254520 nan nan 254550 nan nan 254580 nan nan 254610 nan nan 254640 nan nan 254670 nan nan 254700 nan nan 254730 nan nan 254760 nan nan 254790 nan nan 254820 nan nan 254850 nan nan 254880 nan nan 254910 nan nan 254940 nan nan 254970 nan nan 255000 nan nan 255030 nan nan 255060 nan nan 255090 nan nan 255120 nan nan 255150 nan nan 255180 nan nan 255210 nan nan 255240 nan nan 255270 nan nan 255300 nan nan 255330 nan nan 255360 nan nan 255390 nan nan 255420 nan nan 255450 nan nan 255480 nan nan 255510 nan nan 255540 nan nan 255570 nan nan 255600 nan nan 255630 nan nan 255660 nan nan 255690 nan nan 255720 nan nan 255750 nan nan 255780 nan nan 255810 nan nan 255840 nan nan 255870 nan nan 255900 nan nan 255930 nan nan 255960 nan nan 255990 nan nan 256020 nan nan 256050 nan nan 256080 nan nan 256110 nan nan 256140 nan nan 256170 nan nan 256200 nan nan 256230 nan nan 256260 nan nan 256290 nan nan 256320 nan nan 256350 nan nan 256380 nan nan 256410 nan nan 256440 nan nan 256470 nan nan 256500 nan nan 256530 nan nan 256560 nan nan 256590 nan nan 256620 nan nan 256650 nan nan 256680 nan nan 256710 nan nan 256740 nan nan 256770 nan nan 256800 nan nan 256830 nan nan 256860 nan nan 256890 nan nan 256920 nan nan 256950 nan nan 256980 nan nan 257010 nan nan 257040 nan nan 257070 nan nan 257100 nan nan 257130 nan nan 257160 nan nan 257190 nan nan 257220 nan nan 257250 nan nan 257280 nan nan 257310 nan nan 257340 nan nan 257370 nan nan 257400 nan nan 257430 nan nan 257460 nan nan 257490 nan nan 257520 nan nan 257550 nan nan 257580 nan nan 257610 nan nan 257640 nan nan 257670 nan nan 257700 nan nan 257730 nan nan 257760 nan nan 257790 nan nan 257820 nan nan 257850 nan nan 257880 nan nan 257910 nan nan 257940 nan nan 257970 nan nan 258000 nan nan 258030 nan nan 258060 nan nan 258090 nan nan 258120 nan nan 258150 nan nan 258180 nan nan 258210 nan nan 258240 nan nan 258270 nan nan 258300 nan nan 258330 nan nan 258360 nan nan 258390 nan nan 258420 nan nan 258450 nan nan 258480 nan nan 258510 nan nan 258540 nan nan 258570 nan nan 258600 nan nan 258630 nan nan 258660 nan nan 258690 nan nan 258720 nan nan 258750 nan nan 258780 nan nan 258810 nan nan 258840 nan nan 258870 nan nan 258900 nan nan 258930 nan nan 258960 nan nan 258990 nan nan 259020 nan nan 259050 nan nan 259080 nan nan 259110 nan nan 259140 nan nan 259170 nan nan 259200 nan nan ];
github
JuXinCheng/rtklib_2.4.2-master
testionppp.m
.m
rtklib_2.4.2-master/test/utest/testionppp.m
1,136
utf_8
7023ec339e81fd7fa267d573c3d2d588
function testionppp % % test RTCA/DO229C bug (A.4.4.10.1 A-22,23) % az=0:0.1:360; figure, axes, hold on, box on, grid on; pos=[80,0]; for i=1:length(az), posp(i,:)=ionppp(pos,[az(i),0]); end plot(posp(:,2),posp(:,1),'.'); pos=[-75,170]; for i=1:length(az), posp(i,:)=ionppp(pos,[az(i),0]); end plot(posp(:,2),posp(:,1),'.'); xlim([-180,180]); ylim([-90,90]); % pierce point ----------------------------------------------------------------- function posp=ionppp(pos,azel) re=6378; hion=350; pos=pos*pi/180; azel=azel*pi/180; rp=re/(re+hion)*cos(azel(2)); ap=pi/2-azel(2)-asin(rp); posp(1)=asin(sin(pos(1))*cos(ap)+cos(pos(1))*sin(ap)*cos(azel(1))); %if (pos(1)> 70.0*pi/180& tan(ap)*cos(azel(1))>tan(pi/2-pos(1)))|... % (pos(1)>-70.0*pi/180&-tan(ap)*cos(azel(1))>tan(pi/2-pos(1))) % DO229C if (pos(1)> 70.0*pi/180& tan(ap)*cos(azel(1))>tan(pi/2-pos(1)))|... (pos(1)<-70.0*pi/180&-tan(ap)*cos(azel(1))>tan(pi/2+pos(1))) % corrected posp(2)=pos(2)+pi-asin(sin(ap)*sin(azel(1))/cos(posp(1))); else posp(2)=pos(2)+asin(sin(ap)*sin(azel(1))/cos(posp(1))); end posp=posp*180/pi; if posp(2)>180, posp(2)=posp(2)-360; end
github
JuXinCheng/rtklib_2.4.2-master
plotigp.m
.m
rtklib_2.4.2-master/test/utest/plotigp.m
1,278
utf_8
bf7bb7d90d3221bbc76f008e0c03363f
function plotigp figure mesh=readmesh; gmt('mmap','proj','eq','cent',[135,35],'scale',10,'pos',[0,0,1,1]); gmt('mcoast'); gmt('mgrid','gint',2,'lint',10,'color',[.5 .5 .5]); for i=1:size(mesh,1) gmt('mplot',mesh(i,1),mesh(i,2),'r','marker','.','markersize',10); end plotarea([36,138],15); % plot ipp area ---------------------------------------------------------------- function plotarea(pos,elmask) posp=[]; for az=0:3:360 posp=[posp;igppos(pos*pi/180,[az,elmask]*pi/180)*180/pi]; end gmt('mplot',pos(2),pos(1),'b','marker','.','markersize',10); gmt('mplot',posp(:,2),posp(:,1),'b'); % read mesh data --------------------------------------------------------------- function mesh=readmesh mesh=[]; fp=fopen('../../nicttec/vtec/2011/001.txt','r'); while 1 s=fgets(fp); if ~ischar(s), break; end v=sscanf(s,' Mesh %d: (%f, %f)'); if length(v)<2, continue; end mesh=[mesh;v(2:3)']; end fclose(fp); % igp position ----------------------------------------------------------------- function posp=igppos(pos,azel) re=6380; hion=350; rp=re/(re+hion)*cos(azel(2)); ap=pi/2-azel(2)-asin(rp); sinap=sin(ap); tanap=tan(ap); cosaz=cos(azel(1)); posp(1)=asin(sin(pos(1))*cos(ap)+cos(pos(1))*sinap*cosaz); posp(2)=pos(2)+asin(sinap*sin(azel(1))/cos(posp(1)));
github
moskante/OpenTouch_Matlab-master
pause_arduino.m
.m
OpenTouch_Matlab-master/CODE/pause_arduino.m
955
utf_8
bdb85291db86dfe46bafa65788160ecc
%Function pause_arduino make a pause (blocking!) for a time interval equal %to interval and read the voltage specified by aruino_board/pin and write %it to an output file. %interval: time interval in seconds %arduino_board: an arduino object %pin: the pin to read %fileout: serial object to write on. % %Example %myresults = fopen('test.txt', 'wt'); %uno = arduino('COM4', 'uno') %test = pause_arduino(2, uno, 'A3', myresults) %fclose(myresults) %clear all function [out] = pause_arduino(interval, arduino_board, pin, serial_id) myformat = '%4f\t %4f\n'; %Start the stopwatch timer tstart = tic; %enter the main loop while(1) %read serial port voltage = readVoltage(arduino_board, pin); %save current time ti = toc(tstart); %output to serial object serial_id fprintf(serial_id, myformat, [voltage ti]); if(ti >= interval) break; end end out = ti;
github
douyouzhe/Machine-Learning-for-Signal-Processing-master
pdco.m
.m
Machine-Learning-for-Signal-Processing-master/LDA_language_classification/Code/pdco.m
54,596
utf_8
9b21477124e43a4155c4b72508dccb8f
function [x,y,z,inform,PDitns,CGitns,time] = ... pdco( Fname,Aname,b,bl,bu,d1,d2,options,x0,y0,z0,xsize,zsize ) %----------------------------------------------------------------------- % pdco.m: Primal-Dual Barrier Method for Convex Objectives (23 Sep 2003) %----------------------------------------------------------------------- % [x,y,z,inform,PDitns,CGitns,time] = ... % pdco(Fname,Aname,b,bl,bu,d1,d2,options,x0,y0,z0,xsize,zsize); % % solves optimization problems of the form % % minimize phi(x) + 1/2 norm(D1*x)^2 + 1/2 norm(r)^2 % x,r % subject to A*x + D2*r = b, bl <= x <= bu, r unconstrained, % % where % phi(x) is a smooth convex function defined by function Fname; % A is an m x n matrix defined by matrix or function Aname; % b is a given m-vector; % D1, D2 are positive-definite diagonal matrices defined from d1, d2. % In particular, d2 indicates the accuracy required for % satisfying each row of Ax = b. % % D1 and D2 (via d1 and d2) provide primal and dual regularization % respectively. They ensure that the primal and dual solutions % (x,r) and (y,z) are unique and bounded. % % A scalar d1 is equivalent to d1 = ones(n,1), D1 = diag(d1). % A scalar d2 is equivalent to d2 = ones(m,1), D2 = diag(d2). % Typically, d1 = d2 = 1e-4. % These values perturb phi(x) only slightly (by about 1e-8) and request % that A*x = b be satisfied quite accurately (to about 1e-8). % Set d1 = 1e-4, d2 = 1 for least-squares problems with bound constraints. % The problem is then equivalent to % % minimize phi(x) + 1/2 norm(d1*x)^2 + 1/2 norm(A*x - b)^2 % subject to bl <= x <= bu. % % More generally, d1 and d2 may be n and m vectors containing any positive % values (preferably not too small, and typically no larger than 1). % Bigger elements of d1 and d2 improve the stability of the solver. % % At an optimal solution, if x(j) is on its lower or upper bound, % the corresponding z(j) is positive or negative respectively. % If x(j) is between its bounds, z(j) = 0. % If bl(j) = bu(j), x(j) is fixed at that value and z(j) may have % either sign. % % Also, r and y satisfy r = D2 y, so that Ax + D2^2 y = b. % Thus if d2(i) = 1e-4, the i-th row of Ax = b will be satisfied to % approximately 1e-8. This determines how large d2(i) can safely be. % % % EXTERNAL FUNCTIONS: % options = pdcoSet; provided with pdco.m % [obj,grad,hess] = Fname( x ); provided by user % y = Aname( name,mode,m,n,x ); provided by user if pdMat % is a string, not a matrix % % INPUT ARGUMENTS: % Fname may be an explicit n x 1 column vector c, % or a string containing the name of a function Fname.m %%%!!! Revised 12/16/04 !!! % (Fname cannot be a function handle) % such that [obj,grad,hess] = Fname(x) defines % obj = phi(x) : a scalar, % grad = gradient of phi(x) : an n-vector, % hess = diag(Hessian of phi): an n-vector. % Examples: % If phi(x) is the linear function c'*x, Fname could be % be the vector c, or the name or handle of a function % that returns % [obj,grad,hess] = [c'*x, c, zeros(n,1)]. % If phi(x) is the entropy function E(x) = sum x(j) log x(j), % Fname should return % [obj,grad,hess] = [E(x), log(x)+1, 1./x]. % Aname may be an explicit m x n matrix A (preferably sparse!), % or a string containing the name of a function Aname.m %%%!!! Revised 12/16/04 !!! % (Aname cannot be a function handle) % such that y = aname( name,mode,m,n,x ) % returns y = A*x (mode=1) or y = A'*x (mode=2). % The input parameter "name" will be the string 'Aname' % or whatever the name of the actual function is. % b is an m-vector. % bl is an n-vector of lower bounds. Non-existent bounds % may be represented by bl(j) = -Inf or bl(j) <= -1e+20. % bu is an n-vector of upper bounds. Non-existent bounds % may be represented by bu(j) = Inf or bu(j) >= 1e+20. % d1, d2 may be positive scalars or positive vectors (see above). % options is a structure that may be set and altered by pdcoSet % (type help pdcoSet). % x0, y0, z0 provide an initial solution. % xsize, zsize are estimates of the biggest x and z at the solution. % They are used to scale (x,y,z). Good estimates % should improve the performance of the barrier method. % % % OUTPUT ARGUMENTS: % x is the primal solution. % y is the dual solution associated with Ax + D2 r = b. % z is the dual solution associated with bl <= x <= bu. % inform = 0 if a solution is found; % = 1 if too many iterations were required; % = 2 if the linesearch failed too often. % = 3 if the step lengths became too small. % PDitns is the number of Primal-Dual Barrier iterations required. % CGitns is the number of Conjugate-Gradient iterations required % if an iterative solver is used (LSQR). % time is the cpu time used. %---------------------------------------------------------------------- % PRIVATE FUNCTIONS: % pdxxxbounds % pdxxxdistrib % pdxxxlsqr % pdxxxlsqrmat % pdxxxmat % pdxxxmerit % pdxxxresid1 % pdxxxresid2 % pdxxxstep % % GLOBAL VARIABLES: % global pdDDD1 pdDDD2 pdDDD3 % % % NOTES: % The matrix A should be reasonably well scaled: norm(A,inf) =~ 1. % The vector b and objective phi(x) may be of any size, but ensure that % xsize and zsize are reasonably close to norm(x,inf) and norm(z,inf) % at the solution. % % The files defining Fname and Aname % must not be called Fname.m or Aname.m!! % % % AUTHOR: % Michael Saunders, Systems Optimization Laboratory (SOL), % Stanford University, Stanford, California, USA. % [email protected] % % CONTRIBUTORS: % Byunggyoo Kim, Samsung, Seoul, Korea. % [email protected] % % DEVELOPMENT: % 20 Jun 1997: Original version of pdsco.m derived from pdlp0.m. % 29 Sep 2002: Original version of pdco.m derived from pdsco.m. % Introduced D1, D2 in place of gamma*I, delta*I % and allowed for general bounds bl <= x <= bu. % 06 Oct 2002: Allowed for fixed variabes: bl(j) = bu(j) for any j. % 15 Oct 2002: Eliminated some work vectors (since m, n might be LARGE). % Modularized residuals, linesearch % 16 Oct 2002: pdxxx..., pdDDD... names rationalized. % pdAAA eliminated (global copy of A). % Aname is now used directly as an explicit A or a function. % NOTE: If Aname is a function, it now has an extra parameter. % 23 Oct 2002: Fname and Aname can now be function handles. % 01 Nov 2002: Bug fixed in feval in pdxxxmat. % 19 Apr 2003: Bug fixed in pdxxxbounds. % 07 Aug 2003: Let d1, d2 be scalars if input that way. % 10 Aug 2003: z isn't needed except at the end for output. % 10 Aug 2003: mu0 is now an absolute value -- the initial mu. % 13 Aug 2003: Access only z1(low) and z2(upp) everywhere. % stepxL, stepxU introduced to keep x within bounds. % (With poor starting points, dx may take x outside, % where phi(x) may not be defined. % Entropy once gave complex values for the gradient!) % 16 Sep 2003: Fname can now be a vector c, implying a linear obj c'*x. % 19 Sep 2003: Large system K4 dv = rhs implemented. % 23 Sep 2003: Options LSproblem and LSmethod replaced by Method. % 18 Nov 2003: stepxL, stepxU gave trouble on lptest (see 13 Aug 2003). % Disabled them for now. Nonlinear problems need good x0. % 19 Nov 2003: Bugs with x(fix) and z(fix). % In particular, x(fix) = bl(fix) throughout, so Objective % in iteration log is correct for LPs with explicit c vector. %----------------------------------------------------------------------- global pdDDD1 pdDDD2 pdDDD3 fprintf('\n --------------------------------------------------------') fprintf('\n pdco.m Version of 19 Nov 2003') fprintf('\n Primal-dual barrier method to minimize a convex function') fprintf('\n subject to linear constraints Ax + r = b, bl <= x <= bu') fprintf('\n --------------------------------------------------------\n') m = length(b); n = length(bl); %--------------------------------------------------------------------- % Decode Fname. %--------------------------------------------------------------------- %%%!!! Revised 12/16/04 !!! % Fname cannot be a function handle operator = ischar(Fname); explicitF = ~operator; if explicitF fprintf('\n') disp('The objective is linear') else fname = Fname; fprintf('\n') disp(['The objective function is named ' fname]) end %--------------------------------------------------------------------- % Decode Aname. %--------------------------------------------------------------------- %%%!!! Revised 12/16/04 !!! % Aname cannot be a function handle operator = ischar(Aname) || isa(Aname, 'function_handle'); explicitA = ~operator; if explicitA % assume Aname is an explicit matrix A. nnzA = nnz(Aname); if issparse(Aname) fprintf('The matrix A is an explicit sparse matrix') else fprintf('The matrix A is an explicit dense matrix' ) end fprintf('\n\nm = %8g n = %8g nnz(A) =%9g', m,n,nnzA) else if ischar(Aname) disp(['The matrix A is an operator defined by ' Aname]) end fprintf('\nm = %8g n = %8g', m,n) end normb = norm(b ,inf); normx0 = norm(x0,inf); normy0 = norm(y0,inf); normz0 = norm(z0,inf); fprintf('\nmax |b | = %8g max |x0| = %8.1e', normb , normx0) fprintf( ' xsize = %8.1e', xsize) fprintf('\nmax |y0| = %8g max |z0| = %8.1e', normy0, normz0) fprintf( ' zsize = %8.1e', zsize) %--------------------------------------------------------------------- % Initialize. %--------------------------------------------------------------------- true = 1; false = 0; zn = zeros(n,1); nb = n + m; nkkt = nb; CGitns = 0; inform = 0; % 07 Aug 2003: No need for next lines. %if length(d1)==1, d1 = d1*ones(n,1); end % Allow scalar d1, d2 %if length(d2)==1, d2 = d2*ones(m,1); end % to mean d1*e, d2*e %--------------------------------------------------------------------- % Grab input options. %--------------------------------------------------------------------- maxitn = options.MaxIter; featol = options.FeaTol; opttol = options.OptTol; steptol = options.StepTol; stepSame = options.StepSame; % 1 means stepx==stepz x0min = options.x0min; z0min = options.z0min; mu0 = options.mu0; Method = options.Method; itnlim = options.LSQRMaxIter * min(m,n); atol1 = options.LSQRatol1; % Initial atol atol2 = options.LSQRatol2; % Smallest atol, unless atol1 is smaller conlim = options.LSQRconlim; wait = options.wait; %--------------------------------------------------------------------- % Set other parameters. %--------------------------------------------------------------------- kminor = 0; % 1 stops after each iteration eta = 1e-4; % Linesearch tolerance for "sufficient descent" maxf = 10; % Linesearch backtrack limit (function evaluations) maxfail = 1; % Linesearch failure limit (consecutive iterations) bigcenter = 1e+3; % mu is reduced if center < bigcenter thresh = 1e-8; % For sparse LU with Method=41 % Parameters for LSQR. atolmin = eps; % Smallest atol if linesearch back-tracks btol = 0; % Should be small (zero is ok) show = false; % Controls LSQR iteration log gamma = max(d1); delta = max(d2); fprintf('\n\nx0min = %8g featol = %8.1e', x0min, featol) fprintf( ' d1max = %8.1e', gamma) fprintf( '\nz0min = %8g opttol = %8.1e', z0min, opttol) fprintf( ' d2max = %8.1e', delta) fprintf( '\nmu0 = %8.1e steptol = %8g', mu0 , steptol) fprintf( ' bigcenter= %8g' , bigcenter) fprintf('\n\nLSQR:') fprintf('\natol1 = %8.1e atol2 = %8.1e', atol1 , atol2 ) fprintf( ' btol = %8.1e', btol ) fprintf('\nconlim = %8.1e itnlim = %8g' , conlim, itnlim) fprintf( ' show = %8g' , show ) % Method = 3; %%% Hardwire LSQR % Method = 41; %%% Hardwire K4 and sparse LU fprintf('\n\nMethod = %8g (1=chol 2=QR 3=LSQR 41=K4)', Method) if wait fprintf('\n\nReview parameters... then type "return"\n') keyboard end if eta < 0 fprintf('\n\nLinesearch disabled by eta < 0') end %--------------------------------------------------------------------- % All parameters have now been set. % Check for valid Method. %--------------------------------------------------------------------- time = cputime; if operator if Method==3 % relax else fprintf('\n\nWhen A is an operator, we have to use Method = 3') Method = 3; end end if Method== 1, solver = ' Chol'; head3 = ' Chol'; elseif Method== 2, solver = ' QR'; head3 = ' QR'; elseif Method== 3, solver = ' LSQR'; head3 = ' atol LSQR Inexact'; elseif Method==41, solver = ' LU'; head3 = ' L U res'; else error('Method must be 1, 2, 3, or 41') end %--------------------------------------------------------------------- % Categorize bounds and allow for fixed variables by modifying b. %--------------------------------------------------------------------- [low,upp,fix] = pdxxxbounds( bl,bu ); nfix = length(fix); if nfix > 0 x1 = zn; x1(fix) = bl(fix); r1 = pdxxxmat( Aname, 1, m, n, x1 ); b = b - r1; % At some stage, might want to look at normfix = norm(r1,inf); end %--------------------------------------------------------------------- % Scale the input data. % The scaled variables are % xbar = x/beta, % ybar = y/zeta, % zbar = z/zeta. % Define % theta = beta*zeta; % The scaled function is % phibar = ( 1 /theta) fbar(beta*xbar), % gradient = (beta /theta) grad, % Hessian = (beta2/theta) hess. %--------------------------------------------------------------------- beta = xsize; if beta==0, beta = 1; end % beta scales b, x. zeta = zsize; if zeta==0, zeta = 1; end % zeta scales y, z. theta = beta*zeta; % theta scales obj. % (theta could be anything, but theta = beta*zeta makes % scaled grad = grad/zeta = 1 approximately if zeta is chosen right.) bl(fix)= bl(fix)/beta; bu(fix)= bu(fix)/beta; bl(low)= bl(low)/beta; bu(upp)= bu(upp)/beta; d1 = d1*( beta/sqrt(theta) ); d2 = d2*( sqrt(theta)/beta ); beta2 = beta^2; b = b /beta; y0 = y0/zeta; x0 = x0/beta; z0 = z0/zeta; %--------------------------------------------------------------------- % Initialize vectors that are not fully used if bounds are missing. %--------------------------------------------------------------------- rL = zn; rU = zn; cL = zn; cU = zn; x1 = zn; x2 = zn; z1 = zn; z2 = zn; dx1 = zn; dx2 = zn; dz1 = zn; dz2 = zn; clear zn %--------------------------------------------------------------------- % Initialize x, y, z1, z2, objective, etc. % 10 Aug 2003: z isn't needed here -- just at end for output. %--------------------------------------------------------------------- x = x0; y = y0; x(fix) = bl(fix); x(low) = max( x(low) , bl(low)); x(upp) = min( x(upp) , bu(upp)); x1(low)= max( x(low) - bl(low), x0min ); x2(upp)= max(bu(upp) - x(upp), x0min ); z1(low)= max( z0(low) , z0min ); z2(upp)= max(-z0(upp) , z0min ); clear x0 y0 z0 %%%%%%%%%% Assume hess is diagonal for now. %%%%%%%%%%%%%%%%%% if explicitF obj = (Fname'*x)*beta; grad = Fname; hess = zeros(n,1); else [obj,grad,hess] = feval( Fname, (x*beta) ); end obj = obj /theta; % Scaled obj. grad = grad*(beta /theta) + (d1.^2).*x;% grad includes x regularization. H = hess*(beta2/theta) + (d1.^2); % H includes x regularization. %--------------------------------------------------------------------- % Compute primal and dual residuals: % r1 = b - A*x - d2.^2*y % r2 = grad - A'*y + (z2-z1) % rL = bl - x + x1 % rU = -bu + x + x2 %--------------------------------------------------------------------- [r1,r2,rL,rU,Pinf,Dinf] = ... pdxxxresid1( Aname,fix,low,upp, ... b,bl,bu,d1,d2,grad,rL,rU,x,x1,x2,y,z1,z2 ); %--------------------------------------------------------------------- % Initialize mu and complementarity residuals: % cL = mu*e - X1*z1. % cU = mu*e - X2*z2. % % 25 Jan 2001: Now that b and obj are scaled (and hence x,y,z), % we should be able to use mufirst = mu0 (absolute value). % 0.1 worked poorly on StarTest1 with x0min = z0min = 0.1. % 29 Jan 2001: We might as well use mu0 = x0min * z0min; % so that most variables are centered after a warm start. % 29 Sep 2002: Use mufirst = mu0*(x0min * z0min), % regarding mu0 as a scaling of the initial center. % 07 Aug 2003: mulast is controlled by opttol. % mufirst should not be smaller. % 10 Aug 2003: Revert to mufirst = mu0 (absolute value). %--------------------------------------------------------------------- % mufirst = mu0*(x0min * z0min); mufirst = mu0; mulast = 0.1 * opttol; mufirst = max( mufirst, mulast ); mu = mufirst; [cL,cU,center,Cinf,Cinf0] = ... pdxxxresid2( mu,low,upp,cL,cU,x1,x2,z1,z2 ); fmerit = pdxxxmerit( low,upp,r1,r2,rL,rU,cL,cU ); % Initialize other things. PDitns = 0; converged = 0; atol = atol1; atol2 = max( atol2, atolmin ); atolmin = atol2; pdDDD2 = d2; % Global vector for diagonal matrix D2 % Iteration log. stepx = 0; stepz = 0; nf = 0; itncg = 0; nfail = 0; head1 = '\n\nItn mu stepx stepz Pinf Dinf'; head2 = ' Cinf Objective nf center'; fprintf([ head1 head2 head3 ]) regterm = norm(d1.*x)^2 + norm(d2.*y)^2; objreg = obj + 0.5*regterm; objtrue = objreg * theta; fprintf('\n%3g ', PDitns ) fprintf('%6.1f%6.1f' , log10(Pinf ), log10(Dinf)) fprintf('%6.1f%15.7e', log10(Cinf0), objtrue ) fprintf(' %8.1f' , center ) if Method==41 fprintf(' thresh=%7.1e', thresh) end if kminor fprintf('\n\nStart of first minor itn...\n') keyboard end %--------------------------------------------------------------------- % Main loop. %--------------------------------------------------------------------- while ~converged PDitns = PDitns + 1; % 31 Jan 2001: Set atol according to progress, a la Inexact Newton. % 07 Feb 2001: 0.1 not small enough for Satellite problem. Try 0.01. % 25 Apr 2001: 0.01 seems wasteful for Star problem. % Now that starting conditions are better, go back to 0.1. r3norm = max([Pinf Dinf Cinf]); atol = min([atol r3norm*0.1]); atol = max([atol atolmin ]); if Method<=3 %----------------------------------------------------------------- % Solve (*) for dy. %----------------------------------------------------------------- % Define a damped Newton iteration for solving f = 0, % keeping x1, x2, z1, z2 > 0. We eliminate dx1, dx2, dz1, dz2 % to obtain the system % % [-H2 A' ] [dx] = [w ], H2 = H + D1^2 + X1inv Z1 + X2inv Z2, % [ A D2^2] [dy] = [r1] w = r2 - X1inv(cL + Z1 rL) % + X2inv(cU + Z2 rU), % % which is equivalent to the least-squares problem % % min || [ D A']dy - [ D w ] ||, D = H2^{-1/2}. (*) % || [ D2 ] [D2inv r1] || %----------------------------------------------------------------- H(low) = H(low) + z1(low)./x1(low); H(upp) = H(upp) + z2(upp)./x2(upp); w = r2; w(low) = w(low) - (cL(low) + z1(low).*rL(low))./x1(low); w(upp) = w(upp) + (cU(upp) + z2(upp).*rU(upp))./x2(upp); H = 1./H; % H is now Hinv (NOTE!) H(fix) = 0; D = sqrt(H); pdDDD1 = D; rw = [explicitA Method m n 0 0 0]; % Passed to LSQR. if Method==1 % -------------------------------------------------------------- % Use chol to get dy % -------------------------------------------------------------- AD = Aname*sparse( 1:n, 1:n, D, n, n ); ADDA = AD*AD' + sparse( 1:m, 1:m, (d2.^2), m, m ); if PDitns==1, P = symamd(ADDA); end % Do ordering only once. [R,indef] = chol(ADDA(P,P)); if indef fprintf('\n\n chol says AD^2A'' is not pos def') fprintf('\n Use bigger d2, or set options.Method = 2 or 3') break end % dy = ADDA \ rhs; rhs = Aname*(H.*w) + r1; dy = R \ (R'\rhs(P)); dy(P) = dy; elseif Method==2 % -------------------------------------------------------------- % Use QR to get dy % -------------------------------------------------------------- DAt = sparse( 1:n, 1:n, D, n, n )*(Aname'); if PDitns==1, P = colamd(DAt); end % Do ordering only once. if length(d2)==1 D2 = d2*speye(m); else D2 = spdiags(d2,0,m,m); end DAt = [ DAt; D2 ]; rhs = [ D.*w; r1./d2 ]; % dy = DAt \ rhs; [rhs,R] = qr(DAt(:,P),rhs,0); dy = R \ rhs; dy(P) = dy; else % -------------------------------------------------------------- % Method=3. Use LSQR (iterative solve) to get dy % -------------------------------------------------------------- rhs = [ D.*w; r1./d2 ]; damp = 0; if explicitA % A is a sparse matrix. precon = true; if precon % Construct diagonal preconditioner for LSQR AD = Aname*sparse( 1:n, 1:n, D, n, n ); AD = AD.^2; wD = sum(AD,2); % Sum of sqrs of each row of AD. %(Sparse) wD = sqrt( full(wD) + (d2.^2) ); %(Dense) pdDDD3 = 1./wD; clear AD wD end else % A is an operator precon = false; end rw(7) = precon; info.atolmin = atolmin; info.r3norm = fmerit; % Must be the 2-norm here. [ dy, istop, itncg, outfo ] = ... pdxxxlsqr( nb,m,'pdxxxlsqrmat',Aname,rw,rhs,damp, ... atol,btol,conlim,itnlim,show,info ); if precon, dy = pdDDD3 .* dy; end if istop==3 | istop==7 % conlim or itnlim fprintf('\n LSQR stopped early: istop = %3d', istop) end atolold = outfo.atolold; atol = outfo.atolnew; r3ratio = outfo.r3ratio; CGitns = CGitns + itncg; end % computation of dy % dy is now known. Get dx, dx1, dx2, dz1, dz2. grad = pdxxxmat( Aname,2,m,n,dy ); % grad = A'dy grad(fix) = 0; % Is this needed? % grad is a work vector dx = H .* (grad - w); dx1(low) = - rL(low) + dx(low); dx2(upp) = - rU(upp) - dx(upp); dz1(low) = (cL(low) - z1(low).*dx1(low)) ./ x1(low); dz2(upp) = (cU(upp) - z2(upp).*dx2(upp)) ./ x2(upp); elseif Method==41 %----------------------------------------------------------------- % Solve the symmetric-structure 4 x 4 system K4 dv = t: % % ( X1 Z1 ) [dz1] = [tL], tL = cL + Z1 rL % ( X2 -Z2 ) [dz2] [tU] tU = cU + Z2 rU % ( I -I -H1 A' ) [dx ] [r2] % ( A D2^2 ) [dy ] [r1] %----------------------------------------------------------------- X1 = ones(n,1); X1(low) = x1(low); X2 = ones(n,1); X2(upp) = x2(upp); if length(d2)==1 D22 = d2^2*speye(m); else D22 = spdiags(d2.^2,0,m,m); end Onn = sparse(n,n); Omn = sparse(m,n); if PDitns==1 % First time through: Choose LU ordering from % lower-triangular part of dummy K4 I1 = sparse( low, low, ones(length(low),1), n, n ); I2 = sparse( upp, upp, ones(length(upp),1), n, n ); K4 =[speye(n) Onn Onn Omn' Onn speye(n) Onn Omn' I1 I2 speye(n) Omn' Omn Omn Aname speye(m)]; p = symamd(K4); % disp(' '); keyboard end K4 = [spdiags(X1,0,n,n) Onn spdiags(z1,0,n,n) Omn' Onn spdiags(X2,0,n,n) -spdiags(z2,0,n,n) Omn' I1 -I2 -spdiags(H,0,n,n) Aname' Omn Omn Aname D22]; tL = zeros(n,1); tL(low) = cL(low) + z1(low).*rL(low); tU = zeros(n,1); tU(upp) = cU(upp) + z2(upp).*rU(upp); rhs = [tL; tU; r2; r1]; % dv = K4 \ rhs; % BIG SYSTEM! [L,U,P] = lu( K4(p,p), thresh ); % P K4 = L U dv = U \ (L \ (P*rhs(p))); dv(p) = dv; resK4 = norm((K4*dv - rhs),inf) / norm(rhs,inf); dz1 = dv( 1: n); dz2 = dv( n+1:2*n); dx = dv(2*n+1:3*n); dy = dv(3*n+1:3*n+m); dx1(low) = - rL(low) + dx(low); dx2(upp) = - rU(upp) - dx(upp); end %------------------------------------------------------------------- % Find the maximum step. % 13 Aug 2003: We need stepxL, stepxU also to keep x feasible % so that nonlinear functions are defined. % 18 Nov 2003: But this gives stepx = 0 for lptest. (??) %-------------------------------------------------------------------- stepx1 = pdxxxstep( x1(low), dx1(low) ); stepx2 = pdxxxstep( x2(upp), dx2(upp) ); stepz1 = pdxxxstep( z1(low), dz1(low) ); stepz2 = pdxxxstep( z2(upp), dz2(upp) ); % stepxL = pdxxxstep( x(low), dx(low) ); % stepxU = pdxxxstep( x(upp), dx(upp) ); % stepx = min( [stepx1, stepx2, stepxL, stepxU] ); stepx = min( [stepx1, stepx2] ); stepz = min( [stepz1, stepz2] ); stepx = min( [steptol*stepx, 1] ); stepz = min( [steptol*stepz, 1] ); if stepSame % For NLPs, force same step stepx = min( stepx, stepz ); % (true Newton method) stepz = stepx; end %------------------------------------------------------------------- % Backtracking linesearch. %------------------------------------------------------------------- fail = true; nf = 0; while nf < maxf nf = nf + 1; x = x + stepx * dx; y = y + stepz * dy; x1(low) = x1(low) + stepx * dx1(low); x2(upp) = x2(upp) + stepx * dx2(upp); z1(low) = z1(low) + stepz * dz1(low); z2(upp) = z2(upp) + stepz * dz2(upp); if explicitF obj = (Fname'*x)*beta; grad = Fname; hess = zeros(n,1); else [obj,grad,hess] = feval( Fname, (x*beta) ); end obj = obj /theta; grad = grad*(beta /theta) + (d1.^2).*x; H = hess*(beta2/theta) + (d1.^2); [r1,r2,rL,rU,Pinf,Dinf] = ... pdxxxresid1( Aname,fix,low,upp, ... b,bl,bu,d1,d2,grad,rL,rU,x,x1,x2,y,z1,z2 ); [cL,cU,center,Cinf,Cinf0] = ... pdxxxresid2( mu,low,upp,cL,cU,x1,x2,z1,z2 ); fmeritnew = pdxxxmerit( low,upp,r1,r2,rL,rU,cL,cU ); step = min( stepx, stepz ); if fmeritnew <= (1 - eta*step)*fmerit fail = false; break; end % Merit function didn't decrease. % Restore variables to previous values. % (This introduces a little error, but save lots of space.) x = x - stepx * dx; y = y - stepz * dy; x1(low) = x1(low) - stepx * dx1(low); x2(upp) = x2(upp) - stepx * dx2(upp); z1(low) = z1(low) - stepz * dz1(low); z2(upp) = z2(upp) - stepz * dz2(upp); % Back-track. % If it's the first time, % make stepx and stepz the same. if nf==1 & stepx~=stepz stepx = step; elseif nf < maxf stepx = stepx/2; end; stepz = stepx; end if fail fprintf('\n Linesearch failed (nf too big)'); nfail = nfail + 1; else nfail = 0; end %------------------------------------------------------------------- % Set convergence measures. %-------------------------------------------------------------------- regterm = norm(d1.*x)^2 + norm(d2.*y)^2; objreg = obj + 0.5*regterm; objtrue = objreg * theta; primalfeas = Pinf <= featol; dualfeas = Dinf <= featol; complementary = Cinf0 <= opttol; enough = PDitns>= 4; % Prevent premature termination. converged = primalfeas & dualfeas & complementary & enough; %------------------------------------------------------------------- % Iteration log. %------------------------------------------------------------------- str1 = sprintf('\n%3g%5.1f' , PDitns , log10(mu) ); str2 = sprintf('%6.3f%6.3f' , stepx , stepz ); if stepx < 0.001 | stepz < 0.001 str2 = sprintf('%6.1e%6.1e' , stepx , stepz ); end str3 = sprintf('%6.1f%6.1f' , log10(Pinf) , log10(Dinf)); str4 = sprintf('%6.1f%15.7e', log10(Cinf0), objtrue ); str5 = sprintf('%3g%8.1f' , nf , center ); if center > 99999 str5 = sprintf('%3g%8.1e' , nf , center ); end fprintf([str1 str2 str3 str4 str5]) if Method== 1 if PDitns==1, fprintf(' %8g', nnz(R)); end elseif Method== 2 if PDitns==1, fprintf(' %8g', nnz(R)); end elseif Method== 3 fprintf(' %5.1f%7g%7.3f', log10(atolold), itncg, r3ratio) elseif Method==41, resK4 = max( resK4, 1e-99 ); fprintf(' %8g%8g%6.1f', nnz(L),nnz(U),log10(resK4)) end %------------------------------------------------------------------- % Test for termination. %------------------------------------------------------------------- if kminor fprintf( '\nStart of next minor itn...\n') keyboard end if converged fprintf('\nConverged') elseif PDitns >= maxitn fprintf('\nToo many iterations') inform = 1; break elseif nfail >= maxfail fprintf('\nToo many linesearch failures') inform = 2; break elseif step <= 1e-10 fprintf('\nStep lengths too small') inform = 3; break else % Reduce mu, and reset certain residuals. stepmu = min( stepx , stepz ); stepmu = min( stepmu, steptol ); muold = mu; mu = mu - stepmu * mu; if center >= bigcenter, mu = muold; end % mutrad = mu0*(sum(Xz)/n); % 24 May 1998: Traditional value, but % mu = min(mu,mutrad ); % it seemed to decrease mu too much. mu = max(mu,mulast); % 13 Jun 1998: No need for smaller mu. [cL,cU,center,Cinf,Cinf0] = ... pdxxxresid2( mu,low,upp,cL,cU,x1,x2,z1,z2 ); fmerit = pdxxxmerit( low,upp,r1,r2,rL,rU,cL,cU ); % Reduce atol for LSQR (and SYMMLQ). % NOW DONE AT TOP OF LOOP. atolold = atol; % if atol > atol2 % atolfac = (mu/mufirst)^0.25; % atol = max( atol*atolfac, atol2 ); % end % atol = min( atol, mu ); % 22 Jan 2001: a la Inexact Newton. % atol = min( atol, 0.5*mu ); % 30 Jan 2001: A bit tighter % If the linesearch took more than one function (nf > 1), % we assume the search direction needed more accuracy % (though this may be true only for LPs). % 12 Jun 1998: Ask for more accuracy if nf > 2. % 24 Nov 2000: Also if the steps are small. % 30 Jan 2001: Small steps might be ok with warm start. % 06 Feb 2001: Not necessarily. Reinstated tests in next line. if nf > 2 | step <= 0.01 atol = atolold*0.1; end end end %--------------------------------------------------------------------- % End of main loop. %--------------------------------------------------------------------- % Print statistics. x(fix) = 0; % Exclude x(fix) temporarily from |x|. z = zeros(n,1); % Exclude z(fix) also. z(low) = z1(low); z(upp) = z(upp) - z2(upp); fprintf('\n\nmax |x| =%10.3f', norm(x,inf)) fprintf(' max |y| =%10.3f', norm(y,inf)) fprintf(' max |z| =%10.3f', norm(z,inf)) % excludes z(fix) fprintf(' scaled') bl(fix)= bl(fix)*beta; % Unscale bl, bu, x, y, z. bu(fix)= bu(fix)*beta; bl(low)= bl(low)*beta; bu(upp)= bu(upp)*beta; x = x*beta; y = y*zeta; z = z*zeta; fprintf( '\nmax |x| =%10.3f', norm(x,inf)) fprintf(' max |y| =%10.3f', norm(y,inf)) fprintf(' max |z| =%10.3f', norm(z,inf)) % excludes z(fix) fprintf(' unscaled') x(fix) = bl(fix); % Reinstate x(fix). % Reconstruct b. b = b *beta; if nfix > 0 x1 = zeros(n,1); x1(fix) = bl(fix); r1 = pdxxxmat( Aname, 1, m, n, x1 ); b = b + r1; fprintf('\nmax |x| and max |z| exclude fixed variables') end % Evaluate function at final point. % Reconstruct z. This finally defines z(fix). if explicitF obj = (Fname'*x); grad = Fname; hess = zeros(n,1); else [obj,grad,hess] = feval( Fname, x ); end z = grad - pdxxxmat( Aname,2,m,n,y ); % z = grad - A'y time = cputime - time; str1 = sprintf('\nPDitns =%10g', PDitns ); str2 = sprintf( 'itns =%10g', CGitns ); fprintf( [str1 ' ' solver str2] ) fprintf(' time =%10.1f', time); pdxxxdistrib( abs(x),abs(z) ); % Private function if wait keyboard end %----------------------------------------------------------------------- % End function pdco.m %----------------------------------------------------------------------- function [low,upp,fix] = pdxxxbounds( bl,bu ) % Categorize various types of bounds. % pos overlaps with low. % neg overlaps with upp. % two overlaps with low and upp. % fix and free are disjoint from all other sets. bigL = -9.9e+19; bigU = 9.9e+19; pos = find( bl==0 & bu>=bigU ); neg = find( bl<=bigL & bu==0 ); low = find( bl> bigL & bl< bu ); upp = find( bu< bigU & bl< bu ); two = find( bl> bigL & bu< bigU & bl< bu ); fix = find( bl==bu ); free = find( bl<=bigL & bu>=bigU ); fprintf('\n\nBounds:\n [0,inf] [-inf,0]') fprintf(' Finite bl Finite bu Two bnds Fixed Free') fprintf('\n %8g %9g %10g %10g %9g %7g %7g', ... length(pos), length(neg), length(low), ... length(upp), length(two), length(fix), length(free)) %----------------------------------------------------------------------- % End private function pdxxxbounds %----------------------------------------------------------------------- function pdxxxdistrib( x,z ) % pdxxxdistrib(x) or pdxxxdistrib(x,z) prints the % distribution of 1 or 2 vectors. % % 18 Dec 2000. First version with 2 vectors. two = nargin > 1; fprintf('\n\nDistribution of vector x') if two, fprintf(' z'); end x1 = 10^(floor(log10(max(x)+eps)) + 1); z1 = 10^(floor(log10(max(z)+eps)) + 1); x1 = max(x1,z1); kmax = 10; for k = 1:kmax x2 = x1; x1 = x1/10; if k==kmax, x1 = 0; end nx = length(find(x>=x1 & x<x2)); fprintf('\n[%7.3g,%7.3g )%10g', x1, x2, nx); if two nz = length(find(z>=x1 & z<x2)); fprintf('%10g', nz); end end disp(' ') %----------------------------------------------------------------------- % End private function pdxxxdistrib %----------------------------------------------------------------------- function [ x, istop, itn, outfo ] = ... pdxxxlsqr( m, n, aprodname, iw, rw, b, damp, ... atol, btol, conlim, itnlim, show, info ) % Special version of LSQR for use with pdco.m. % It continues with a reduced atol if a pdco-specific test isn't % satisfied with the input atol. % % LSQR solves Ax = b or min ||b - Ax||_2 if damp = 0, % or min || (b) - ( A )x || otherwise. % || (0) (damp I) ||2 % A is an m by n matrix defined by y = aprod( mode,m,n,x,iw,rw ), % where the parameter 'aprodname' refers to a function 'aprod' that % performs the matrix-vector operations. % If mode = 1, aprod must return y = Ax without altering x. % If mode = 2, aprod must return y = A'x without altering x. % WARNING: The file containing the function 'aprod' % must not be called aprodname.m !!!! %----------------------------------------------------------------------- % LSQR uses an iterative (conjugate-gradient-like) method. % For further information, see % 1. C. C. Paige and M. A. Saunders (1982a). % LSQR: An algorithm for sparse linear equations and sparse least squares, % ACM TOMS 8(1), 43-71. % 2. C. C. Paige and M. A. Saunders (1982b). % Algorithm 583. LSQR: Sparse linear equations and least squares problems, % ACM TOMS 8(2), 195-209. % 3. M. A. Saunders (1995). Solution of sparse rectangular systems using % LSQR and CRAIG, BIT 35, 588-604. % % Input parameters: % iw, rw are not used by lsqr, but are passed to aprod. % atol, btol are stopping tolerances. If both are 1.0e-9 (say), % the final residual norm should be accurate to about 9 digits. % (The final x will usually have fewer correct digits, % depending on cond(A) and the size of damp.) % conlim is also a stopping tolerance. lsqr terminates if an estimate % of cond(A) exceeds conlim. For compatible systems Ax = b, % conlim could be as large as 1.0e+12 (say). For least-squares % problems, conlim should be less than 1.0e+8. % Maximum precision can be obtained by setting % atol = btol = conlim = zero, but the number of iterations % may then be excessive. % itnlim is an explicit limit on iterations (for safety). % show = 1 gives an iteration log, % show = 0 suppresses output. % info is a structure special to pdco.m, used to test if % was small enough, and continuing if necessary with smaller atol. % % % Output parameters: % x is the final solution. % istop gives the reason for termination. % istop = 1 means x is an approximate solution to Ax = b. % = 2 means x approximately solves the least-squares problem. % rnorm = norm(r) if damp = 0, where r = b - Ax, % = sqrt( norm(r)**2 + damp**2 * norm(x)**2 ) otherwise. % xnorm = norm(x). % var estimates diag( inv(A'A) ). Omitted in this special version. % outfo is a structure special to pdco.m, returning information % about whether atol had to be reduced. % % Other potential output parameters: % anorm, acond, arnorm, xnorm % % 1990: Derived from Fortran 77 version of LSQR. % 22 May 1992: bbnorm was used incorrectly. Replaced by anorm. % 26 Oct 1992: More input and output parameters added. % 01 Sep 1994: Matrix-vector routine is now a parameter 'aprodname'. % Print log reformatted. % 14 Jun 1997: show added to allow printing or not. % 30 Jun 1997: var added as an optional output parameter. % It returns an estimate of diag( inv(A'A) ). % 12 Feb 2001: atol can now be reduced and iterations continued if necessary. % info, outfo are new problem-dependent parameters for such purposes. % In this version they are specialized for pdco.m. %----------------------------------------------------------------------- % Initialize. msg=['The exact solution is x = 0 ' 'Ax - b is small enough, given atol, btol ' 'The least-squares solution is good enough, given atol ' 'The estimate of cond(Abar) has exceeded conlim ' 'Ax - b is small enough for this machine ' 'The least-squares solution is good enough for this machine' 'Cond(Abar) seems to be too large for this machine ' 'The iteration limit has been reached ']; % wantvar= nargout >= 6; % if wantvar, var = zeros(n,1); end itn = 0; istop = 0; nstop = 0; ctol = 0; if conlim > 0, ctol = 1/conlim; end; anorm = 0; acond = 0; dampsq = damp^2; ddnorm = 0; res2 = 0; xnorm = 0; xxnorm = 0; z = 0; cs2 = -1; sn2 = 0; % Set up the first vectors u and v for the bidiagonalization. % These satisfy beta*u = b, alfa*v = A'u. u = b(1:m); x = zeros(n,1); alfa = 0; beta = norm( u ); if beta > 0 u = (1/beta) * u; v = feval( aprodname, 2, m, n, u, iw, rw ); alfa = norm( v ); end if alfa > 0 v = (1/alfa) * v; w = v; end arnorm = alfa * beta; if arnorm==0, disp(msg(1,:)); return, end rhobar = alfa; phibar = beta; bnorm = beta; rnorm = beta; head1 = ' Itn x(1) Function'; head2 = ' Compatible LS Norm A Cond A'; if show disp(' ') disp([head1 head2]) test1 = 1; test2 = alfa / beta; str1 = sprintf( '%6g %12.5e %10.3e', itn, x(1), rnorm ); str2 = sprintf( ' %8.1e %8.1e', test1, test2 ); disp([str1 str2]) end %---------------------------------------------------------------- % Main iteration loop. %---------------------------------------------------------------- while itn < itnlim itn = itn + 1; % Perform the next step of the bidiagonalization to obtain the % next beta, u, alfa, v. These satisfy the relations % beta*u = A*v - alfa*u, % alfa*v = A'*u - beta*v. u = feval( aprodname, 1, m, n, v, iw, rw ) - alfa*u; beta = norm( u ); if beta > 0 u = (1/beta) * u; anorm = norm([anorm alfa beta damp]); v = feval( aprodname, 2, m, n, u, iw, rw ) - beta*v; alfa = norm( v ); if alfa > 0, v = (1/alfa) * v; end end % Use a plane rotation to eliminate the damping parameter. % This alters the diagonal (rhobar) of the lower-bidiagonal matrix. rhobar1 = norm([rhobar damp]); cs1 = rhobar / rhobar1; sn1 = damp / rhobar1; psi = sn1 * phibar; phibar = cs1 * phibar; % Use a plane rotation to eliminate the subdiagonal element (beta) % of the lower-bidiagonal matrix, giving an upper-bidiagonal matrix. rho = norm([rhobar1 beta]); cs = rhobar1/ rho; sn = beta / rho; theta = sn * alfa; rhobar = - cs * alfa; phi = cs * phibar; phibar = sn * phibar; tau = sn * phi; % Update x and w. t1 = phi /rho; t2 = - theta/rho; dk = (1/rho)*w; x = x + t1*w; w = v + t2*w; ddnorm = ddnorm + norm(dk)^2; % if wantvar, var = var + dk.*dk; end % Use a plane rotation on the right to eliminate the % super-diagonal element (theta) of the upper-bidiagonal matrix. % Then use the result to estimate norm(x). delta = sn2 * rho; gambar = - cs2 * rho; rhs = phi - delta * z; zbar = rhs / gambar; xnorm = sqrt(xxnorm + zbar^2); gamma = norm([gambar theta]); cs2 = gambar / gamma; sn2 = theta / gamma; z = rhs / gamma; xxnorm = xxnorm + z^2; % Test for convergence. % First, estimate the condition of the matrix Abar, % and the norms of rbar and Abar'rbar. acond = anorm * sqrt( ddnorm ); res1 = phibar^2; res2 = res2 + psi^2; rnorm = sqrt( res1 + res2 ); arnorm = alfa * abs( tau ); % Now use these norms to estimate certain other quantities, % some of which will be small near a solution. test1 = rnorm / bnorm; test2 = arnorm/( anorm * rnorm ); test3 = 1 / acond; t1 = test1 / (1 + anorm * xnorm / bnorm); rtol = btol + atol * anorm * xnorm / bnorm; % The following tests guard against extremely small values of % atol, btol or ctol. (The user may have set any or all of % the parameters atol, btol, conlim to 0.) % The effect is equivalent to the normal tests using % atol = eps, btol = eps, conlim = 1/eps. if itn >= itnlim, istop = 7; end if 1 + test3 <= 1, istop = 6; end if 1 + test2 <= 1, istop = 5; end if 1 + t1 <= 1, istop = 4; end % Allow for tolerances set by the user. if test3 <= ctol, istop = 3; end if test2 <= atol, istop = 2; end if test1 <= rtol, istop = 1; end %------------------------------------------------------------------- % SPECIAL TEST THAT DEPENDS ON pdco.m. % Aname in pdco is iw in lsqr. % dy is x % Other stuff is in info. % We allow for diagonal preconditioning in pdDDD3. %------------------------------------------------------------------- if istop > 0 r3new = arnorm; r3ratio = r3new / info.r3norm; atolold = atol; atolnew = atol; if atol > info.atolmin if r3ratio <= 0.1 % dy seems good % Relax elseif r3ratio <= 0.5 % Accept dy but make next one more accurate. atolnew = atolnew * 0.1; else % Recompute dy more accurately fprintf('\n ') fprintf(' ') fprintf(' %5.1f%7g%7.3f', log10(atolold), itn, r3ratio) atol = atol * 0.1; atolnew = atol; istop = 0; end end outfo.atolold = atolold; outfo.atolnew = atolnew; outfo.r3ratio = r3ratio; end %------------------------------------------------------------------- % See if it is time to print something. %------------------------------------------------------------------- prnt = 0; if n <= 40 , prnt = 1; end if itn <= 10 , prnt = 1; end if itn >= itnlim-10, prnt = 1; end if rem(itn,10)==0 , prnt = 1; end if test3 <= 2*ctol , prnt = 1; end if test2 <= 10*atol , prnt = 1; end if test1 <= 10*rtol , prnt = 1; end if istop ~= 0 , prnt = 1; end if prnt==1 if show str1 = sprintf( '%6g %12.5e %10.3e', itn, x(1), rnorm ); str2 = sprintf( ' %8.1e %8.1e', test1, test2 ); str3 = sprintf( ' %8.1e %8.1e', anorm, acond ); disp([str1 str2 str3]) end end if istop > 0, break, end end % End of iteration loop. % Print the stopping condition. if show disp(' ') disp('LSQR finished') disp(msg(istop+1,:)) disp(' ') str1 = sprintf( 'istop =%8g itn =%8g', istop, itn ); str2 = sprintf( 'anorm =%8.1e acond =%8.1e', anorm, acond ); str3 = sprintf( 'rnorm =%8.1e arnorm =%8.1e', rnorm, arnorm ); str4 = sprintf( 'bnorm =%8.1e xnorm =%8.1e', bnorm, xnorm ); disp([str1 ' ' str2]) disp([str3 ' ' str4]) disp(' ') end %----------------------------------------------------------------------- % End private function pdxxxlsqr %----------------------------------------------------------------------- function y = pdxxxlsqrmat( mode, mlsqr, nlsqr, x, Aname, rw ) % pdxxxlsqrmat is required by pdco.m (when it calls pdxxxlsqr.m). % It forms Mx or M'x for some operator M that depends on Method below. % % mlsqr, nlsqr are the dimensions of the LS problem that lsqr is solving. % % Aname is pdco's Aname. % % rw contains parameters [explicitA Method LSdamp] % from pdco.m to say which least-squares subproblem is being solved. % % global pdDDD1 pdDDD3 provides various diagonal matrices % for each value of Method. %----------------------------------------------------------------------- % 17 Mar 1998: First version to go with pdsco.m and lsqr.m. % 01 Apr 1998: global pdDDD1 pdDDD3 now used for efficiency. % 11 Feb 2000: Added diagonal preconditioning for LSQR, solving for dy. % 14 Dec 2000: Added diagonal preconditioning for LSQR, solving for dx. % 12 Feb 2001: Included in pdco.m as private function. % Specialized to allow only solving for dy. % 03 Oct 2002: First version to go with pdco.m with general H2 and D2. % 16 Oct 2002: Aname is now the user's Aname. %----------------------------------------------------------------------- global pdDDD1 pdDDD2 pdDDD3 Method = rw(2); precon = rw(7); if Method==3 % The operator M is [ D1 A'; D2 ]. m = nlsqr; n = mlsqr - m; if mode==1 if precon, x = pdDDD3.*x; end t = pdxxxmat( Aname, 2, m, n, x ); % Ask 'aprod' to form t = A'x. y = [ (pdDDD1.*t); (pdDDD2.*x) ]; else t = pdDDD1.*x(1:n); y = pdxxxmat( Aname, 1, m, n, t ); % Ask 'aprod' to form y = A t. y = y + pdDDD2.*x(n+1:mlsqr); if precon, y = pdDDD3.*y; end end else error('Error in pdxxxlsqrmat: Only Method = 3 is allowed at present') end %----------------------------------------------------------------------- % End private function pdxxxlsqrmat %----------------------------------------------------------------------- function y = pdxxxmat( Aname, mode, m, n, x ) % y = pdxxxmat( Aname, mode, m, n, x ) % computes y = Ax (mode=1) or A'x (mode=2) % for a matrix A defined by pdco's input parameter Aname. %----------------------------------------------------------------------- % 04 Apr 1998: Default A*x and A'*y function for pdco.m. % Assumed A was a global matrix pdAAA created by pdco.m % from the user's input parameter A. % 16 Oct 2002: pdAAA eliminated to save storage. % User's parameter Aname is now passed thru to here. % 01 Nov 2002: Bug: feval had one too many parameters. %----------------------------------------------------------------------- if (ischar(Aname) || isa(Aname, 'function_handle')) y = feval( Aname, mode, m, n, x ); else if mode==1, y = Aname*x; else y = Aname'*x; end end %----------------------------------------------------------------------- % End private function pdxxxmat %----------------------------------------------------------------------- function fmerit = pdxxxmerit( low,upp,r1,r2,rL,rU,cL,cU ) % Evaluate the merit function for Newton's method. % It is the 2-norm of the three sets of residuals. f = [norm(r1) norm(r2) norm(rL(low)) norm(rU(upp)) norm(cL(low)) norm(cU(upp))]; fmerit = norm(f); %----------------------------------------------------------------------- % End private function pdxxxmerit %----------------------------------------------------------------------- function [r1,r2,rL,rU,Pinf,Dinf] = ... pdxxxresid1( Aname,fix,low,upp, ... b,bl,bu,d1,d2,grad,rL,rU,x,x1,x2,y,z1,z2 ) % Form residuals for the primal and dual equations. % rL, rU are output, but we input them as full vectors % initialized (permanently) with any relevant zeros. % 13 Aug 2003: z2-z1 coded more carefully % (although MATLAB was doing the right thing). % 19 Nov 2003: r2(fix) = 0 has to be done after r2 = grad - r2; m = length(b); n = length(bl); x(fix) = 0; r1 = pdxxxmat( Aname, 1, m, n, x ); r2 = pdxxxmat( Aname, 2, m, n, y ); r1 = b - r1 - (d2.^2).*y; r2 = grad - r2; % + (z2-z1); % grad includes (d1.^2)*x r2(fix) = 0; r2(upp) = r2(upp) + z2(upp); r2(low) = r2(low) - z1(low); rL(low) = ( bl(low) - x(low)) + x1(low); rU(upp) = (- bu(upp) + x(upp)) + x2(upp); Pinf = max([norm(r1,inf) norm(rL(low),inf) norm(rU(upp),inf)]); Dinf = norm(r2,inf); Pinf = max( Pinf, 1e-99 ); Dinf = max( Dinf, 1e-99 ); %----------------------------------------------------------------------- % End private function pdxxxresid1 %----------------------------------------------------------------------- function [cL,cU,center,Cinf,Cinf0] = ... pdxxxresid2( mu,low,upp,cL,cU,x1,x2,z1,z2 ) % Form residuals for the complementarity equations. % cL, cU are output, but we input them as full vectors % initialized (permanently) with any relevant zeros. % Cinf is the complementarity residual for X1 z1 = mu e, etc. % Cinf0 is the same for mu=0 (i.e., for the original problem). x1z1 = x1(low).*z1(low); x2z2 = x2(upp).*z2(upp); cL(low) = mu - x1z1; cU(upp) = mu - x2z2; maxXz = max( [max(x1z1) max(x2z2)] ); minXz = min( [min(x1z1) min(x2z2)] ); maxXz = max( maxXz, 1e-99 ); minXz = max( minXz, 1e-99 ); center = maxXz / minXz; Cinf = max([norm(cL(low),inf) norm(cU(upp),inf)]); Cinf0 = maxXz; %----------------------------------------------------------------------- % End private function pdxxxresid2 %----------------------------------------------------------------------- function step = pdxxxstep( x, dx ) % Assumes x > 0. % Finds the maximum step such that x + step*dx >= 0. step = 1e+20; blocking = find( dx < 0 ); if length( blocking ) > 0 steps = x(blocking) ./ (- dx(blocking)); step = min( steps ); end % % Copyright (c) 2006. Michael Saunders % % % Part of SparseLab Version:100 % Created Tuesday March 28, 2006 % This is Copyrighted Material % For Copying permissions see COPYING.m % Comments? e-mail [email protected] %
github
TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox-master
dvar4abcdk.m
.m
Predictor-Based-Subspace-IDentification-toolbox-master/dvar4abcdk.m
3,316
utf_8
058df17bcb6eb4c30e5c5e4b0a78d9bf
function [P,sigma,dA,dB,dC,dD,dK] = dvar4abcdk(x,u,y,f,p,A,B,C,D,K,U,Zps) %DVAR4ABCDK Asymptotic variance of the PBSIDopt (VARX only) estimation % P=dvar4abck(x,u,f,p,A,B,C,DK,U,Zps) returns the covariance of the % estimated state space matrices and acts as a pre-processor for dvar2frd. % The latter is used to calculate the probalistic error bounds around the % identified bode diagrams. The data matrices U and Zps can be obtained % from dordvarx. % % [P,sigma]=dvar4abck(x,u,f,p,A,B,C,D,K,U,Zps) also returns the covariance % matrix of the innovation noise. % % [P,sigma,dA,dB,dC,dD,dK]=dvar4abck(x,u,f,p,A,B,C,D,K,U,Zps) % Ivo Houtzager % Delft Center of Systems and Control % Delft University of Technology % The Netherlands, 2010 % check number if input arguments if nargin < 12 error('DVAR4ABCDK requires twelve input arguments.') end % check the size of the windows if f > p error('Future window size f must equal or smaller then past window p. (f <= p)') end % check dimensions of inputs if size(y,2) < size(y,1) y = y'; end if size(x,2) < size(x,1) x = x'; end N = size(y,2); l = size(y,1); n = size(x,1); if isempty(u); r = 0; u = zeros(0,N); else if size(u,2) < size(u,1) u = u'; end r = size(u,1); if ~isequal(N,length(u)) error('The number of rows of vectors/matrices u and y must be the same.') end end if l == 0 error('DVAR4ABCDK requires an output vector y.') end % store the past and future vectors m = r+l; z = [u; y]; Z = zeros(p*m,N-p); for i = 1:p Z((i-1)*m+1:i*m,:) = z(:,i:N+i-p-1); end % select the only the system order U = U(1:n,:); if size(Zps,2)/m > p Zps = Zps(:,1:p*m); end % remove the window sizes from input and output vector u = u(:,p+1:p+size(x,2)); y = y(:,p+1:p+size(x,2)); % calculate the innovation sequence e = y - C*x - D*u; sigma = (e*e')/length(e); %% Asymptotic variance LL = pinv([x(:,1:end-1); u(:,1:end-1); e(:,1:end-1)]); LL2 = pinv([x; u]); Term1 = ObsContSum(Zps,speye(N-p),l,r,f,p,LL,Z(:,2:end),U); Term2 = ObsContSum(Zps,speye(N-p),l,r,f,p,LL,Z(:,1:end-1),A*U); Term3 = ObsContSum(Zps,speye(N-p),l,r,f,p,LL2,Z,-C*U); alpha1P = Term1-Term2; alpha2P = Term3; beta1 = -kron(LL'*Z(:,1:end-1)'*Zps',K); beta2 = -kron(LL2'*Z'*Zps',eye(l)); if l==1 P = sigma*[alpha1P+beta1;alpha2P+beta2]*[alpha1P+beta1;alpha2P+beta2]'; else P = [alpha1P+beta1;alpha2P+beta2]*sparse(kron(speye(N-p),sigma))*[alpha1P+beta1;alpha2P+beta2]'; end if nargout > 2 dTh = [alpha1P+beta1;alpha2P+beta2]*e(:); dA = reshape(dTh(1:n*n,1),n,n); dB = reshape(dTh(n*n+1:n*n+n*r,1),n,r); dK = reshape(dTh(n*n+n*r+1:n*n+n*r+n*l,1),n,l); dC = reshape(dTh(n*n+n*r+n*l+1:n*n+n*r+n*l+n*l,1),l,n); dD = reshape(dTh(n*n+n*r+n*l+n*l+1:n*n+n*r+n*l+n*l+l*r,1),l,r); end end function SumKron = ObsContSum(Zps,Y,l,r,f,p,LL,Z,S) q = size(Y,1); for i = 1:p CK(:,1+(l+r)*(i-1):(l+r)*i) = Y*Zps(:,1+(l+r)*(i-1):(l+r)*i); end SumKron = zeros(size(LL,2)*size(S,1),size(Y,2)*l); for i = 1:f GammaK = zeros(q,(l+r)*p); GammaK(:,1+(l+r)*(i-1):(l+r)*p) = CK(:,1:(l+r)*(p+1-i)); SumKron = SumKron + kron(LL'*Z'*GammaK',S(:,1+l*(i-1):l*i)); end end
github
TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox-master
lordvarxydist.m
.m
Predictor-Based-Subspace-IDentification-toolbox-master/lordvarxydist.m
6,288
utf_8
bd92ed5b69652e03f4a87777bf0d9b4d
function [S,X] = lordvarxydist(u,d,y,mu,f,p,reg,opt,c,noD,ObsMatPoint) %LORDVARXYDIST is LORDVARX for a special case with output disturbances % x(k+1) = A kron(mu(k),x(k)) + B kron(mu(k),u(k)) + K kron(mu(k),e(k)) % y(k) = C x(k) + [Du, Dd] [u(k); kron(mu(k),d(k))] + e(k) % % if c(4)=1 then Dd is not varying with the scheduling mu % % See also: lordvarx.m and lx2abcdkydist.m. % % References: % [1] J.W. van Wingerden, and M. Verhaegen, ``Subspace identification % of Bilinear and LPV systems for open- and closed-loop data'', % Automatica 45, pp 372--381, 2009. % Pieter Gebraad % Delft Center of Systems and Control % Delft University of Technology % The Netherlands, 2011 % check number if input arguments if nargin < 6 error('LORDVARX requires four or five input arguments.') end % assign default values to unspecified parameters if (nargin < 11) || isempty(ObsMatPoint) ObsMatPoint = 0; end if (nargin < 10) || isempty(noD) noD = 0; end if (nargin < 9) || isempty(c) c = [0 0 0 0]; end if (nargin < 8) || isempty(opt) opt = 'gcv'; end if (nargin < 7) || isempty(reg) reg = 'none'; end % check the size of the windows if f > p error('Future window size f must equal or smaller then past window p. (f <= p)') end % check dimensions of inputs if size(y,2) < size(y,1) y = y'; end if size(mu,2) < size(mu,1) mu = mu'; end if size(d,2) < size(d,1) d = d'; end N = size(y,2); l = size(y,1); rd = size(d,1); if ~isequal(N,length(d)) error('The number of rows of vectors/matrices d and y must be the same.') end s = size(mu,1); if isempty(u); r = 0; u = zeros(0,N); else if size(u,2) < size(u,1) u = u'; end r = size(u,1); if ~isequal(N,length(u)) error('The number of rows of vectors/matrices u and y must be the same.') end end if l == 0 error('LORDVARX requires an output vector y.') end if s == 0 error('LORDVARX requires a scheduling sequence mu, use DORDVARX for LTI systems.') end if c(4)==0 d = khatrirao(mu,d); end % determine sizes k = r*s.^(1-c(2)+(1-c(1))*(p-1:-1:0))+ l*s.^(1-c(3)+(1-c(1))*(p-1:-1:0)); q = sum(k); if q > (N-p) if ~strcmpi(reg,'bpdn') if ObsMatPoint == 1 warning('lordvarx:ObsMatPoint1ThenNoKernel','Taking the observability matrix for p = ones(1,m) is not implemented for the kernel method. LORDVARX continues with ObsMatPoint=1, without kernel method.') kernel = 0; elseif ObsMatPoint == 0 kernel = 1; else error('ObsMatPoint should be 0 or 1') end else warning('lordvarx:BpdnThenNoKernel','The BPDN regularization is not implemented for the kernel method. LORDVARX continues with BPDN method, without kernel method.') kernel = 0; end else kernel = 0; end % store the past and future vectors if kernel Z = zeros(N-p,N-p); for j = 0:p-1 Z = optkernel(Z,u,y,mu,p,c,0,j); end else Z = zeros(q,N-p); if (c(2) == 0) && (c(3) == 0) z = [khatrirao(mu,u); khatrirao(mu,y)]; elseif (c(2) == 1) && (c(3) == 0) z = [u; khatrirao(mu,y)]; elseif (c(2) == 0) && (c(3) == 1) z = [khatrirao(mu,u); y]; elseif (c(2) == 1) && (c(3) == 1) z = [u; y]; end for i = 1:p Z(sum(k(1:i-1))+1:sum(k(1:i-1))+k(p),:) = z(:,i:N+i-p-1); if c(1) ~= 0 for j = (i+1):p Z(sum(k(1:i-1))+1:sum(k(1:i-1))+k(p-j+i),:) = khatrirao(mu(:,j:N+j-p-1),Z(sum(k(1:i-1))+1:sum(k(1:i-1))+k(p-j+i+1),:)); end end end end Y = y(:,p+1:N); U = u(:,p+1:N); d = d(:,p+1:N); % solve VARX/KERNEL problem if kernel if ~noD Z = Z + U'*U + d'*d; end A = kernregress(Y,Z,reg,opt); else if ~noD Z = [Z; U; d]; end VARX = regress(Y,Z,reg,opt); end % construct LambdaKappaZ if kernel LKZ = zeros(f*l,N-p); for i = 0:f-1 Z = zeros(N-p,N-p); for j = i:p-1 Z = optkernel(Z,u,y,mu,p,c,i,j); end LKZ(i*l+1:(i+1)*l,:) = A*Z; end % singular value decomposition [~,S,V] = svd(LKZ,'econ'); else if c(1) == 0 if ObsMatPoint % consider the observability matrix in the operating point p = ones(1,m) LKZ = zeros(f*l,N-p); for i = 1:f for j = i:p for h = 1:s^(i-1) LKZ((i-1)*l+1:i*l,:) = LKZ((i-1)*l+1:i*l,:) + VARX(:,sum(k(1:j-i))+((h-1)*k(j)+1:h*k(j)))*Z(sum(k(1:j-1))+1:sum(k(1:j)),:); end end end % singular value decomposition [~,S,V] = svd(LKZ,'econ'); else % consider the observability matrix in the operating point p = [1,zeros(1,m-1)] LK = zeros(f*l,q); for i = 1:f for j = i:p LK((i-1)*l+1:i*l,sum(k(1:j-1))+1:sum(k(1:j))) = VARX(:,sum(k(1:j-i))+1:sum(k(1:j-i))+k(j)); end end % singular value decomposition [~,S,V] = svd(LK*Z(1:q,:),'econ'); end else LK = zeros(f*l,q); for i = 1:f LK((i-1)*l+1:i*l,q-(p-i+1)*(q/p)+1:q) = VARX(:,1:(p-i+1)*(q/p)); end % singular value decomposition [~,S,V] = svd(LK*Z(1:q,:),'econ'); end end X = diag(sqrt(diag(S)))*V'; S = diag(S)'; end function Z = optkernel(Z,u,y,mu,p,c,i,j) N = size(y,2); P = 1:1:N-p; T = ones(N-p,N-p); if all(c == 0) for v = 0:p-j-1 T = T.*(mu(:,P+v+j-i)'*mu(:,P+v+j)); end Z = Z + T.*([u(:,P+j-i); y(:,P+j-i)]'*[u(:,P+j); y(:,P+j)]); else for v = 1:(1-c(1))*(p-j-1) T = T.*(mu(:,P+v+j-i)'*mu(:,P+v+j)); end if c(2) Z = Z + T.*(u(:,P+j-i)'*u(:,P+j)); else Z = Z + T.*(mu(:,P+j-i)'*mu(:,P+j)).*(u(:,P+j-i)'*u(:,P+j)); end if c(3) Z = Z + T.*(y(:,P+j-i)'*y(:,P+j)); else Z = Z + T.*(mu(:,P+j-i)'*mu(:,P+j)).*(y(:,P+j-i)'*y(:,P+j)); end end end
github
TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox-master
dvar2eig.m
.m
Predictor-Based-Subspace-IDentification-toolbox-master/dvar2eig.m
602
utf_8
34202c6ba1c8543cd49f5820c2b1e2ff
function [E,covE] = dvar2eig(P,A) %DVAR2EIG Eigenvalues and its covariance estimation % [E,covE]=dvar2frd(P,A) returns the estimated eigenvalues and its % covariance for the state space matrix A and its covariance P. % Ivo Houtzager % Delft Center of Systems and Control % Delft University of Technology % The Netherlands, 2010 n = size(A,1); P = P(1:n^2,1:n^2); J = jacobianest(@(x) eigen(x,n),A(:)); covE = J*P*J'; E = eig(A); end function dE = eigen(A,n) A = reshape(A,n,n); E = eig(A); dE = zeros(2*n,1); dE(1:2:end) = real(E); dE(2:2:end) = imag(E); end
github
TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox-master
spaavf.m
.m
Predictor-Based-Subspace-IDentification-toolbox-master/spaavf.m
8,045
utf_8
45c5f4decdd81c84cde81c45ea634e7c
function [G,w,Coh] = spaavf(u,y,r,dt,Nband,Nfft,ZeroPadding,Wname) %SPAAVF Spectral analysis with frequency averaging % [G,W]=SPAAVF(U,Y,Ts,Nband) determines a frequency-domain estimate % SYS=FRD(G,W) of the transfer function of the plant. The sample time is % given in Ts. Nband is the number of frequency bands to average. % Averaging in the frequency domain is used to get a smoother frequency % response function. The spectrum is smoothed locally in the region of % the target frequencies, as a weighted average of values to the right % and left of a target frequency. The variance of the spectrum will % decrease as the number of frequencies used in the smoothing increases. % As the bandwidth increases, more spectral ordinates are averaged, and % hence the resulting estimator becomes smoother, more stable and has % smaller variance. % % [G,W]=SPAAVF(U,Y,R,Ts,Nband) determines a frequency-domain estimate % SYS=FRD(G,W) of the transfer function of the plant operating in % closed-loop. Because the conventional transfer function estimate, will % give a biased estimate under closed-loop [2]. An unbiased alternative % is to use cross-spectral between the input/output signals with an % external excitation signal r [1]. Hence, we define the estimate: % G(exp(j*omega)) = Phi_yr(omega)*inv(Phi_ur(omega)) % % [G,W]=SPAAVF(...,Ts,Nband,Nfft) specifies the number of evaluated % frequencies. For large data sequences it is wortwhile to choose the % value Nfft as function of the power of two. In this case a faster % method is used durring the FFT. Nfft <= length(u), unless zeros are % added. See also, FFT. % % [G,W]=SPAAVF(...,Ts,Nband,Nfft,ZeroPading) adds additional zeros to % the data sequences. Usefull for increasing the number of evaluated % frequencies. % % [G,W]=SPAAVF(...,Ts,Nband,Nfft,ZeroPading,Wname) specifies and aplies % an window to the data. Windowing weigths the data, it increases the % importance of the data in the middle of the vector and decreases the % importance of the data at the end and the beginning, thus reducing the % effect of spectral leakage. See also, WINDOW. % % References: % [1] Akaike, H., Some problems in the application of the cross-spectral % method, In spectral analysis of time series, pp. 81-107, Wiley, % New York, 1967. % [2] van den Hof, P., System Identification, Lecture Notes, Delft, 2007. % Revision 2: Now also works properly for MIMO cases. % Ivo Houtzager % Delft Center of Systems and Control % Delft University of Technology % The Netherlands, 2010 % Check closed-loop if isequal(length(u),length(r)); clmode = 1; else clmode = 0; if nargin == 7 Wname = ZeroPadding; end if nargin == 6 ZeroPadding = Nfft; end if nargin == 5 Nfft = Nband; end Nband = dt; dt = r; end % Transpose vectors if needed if size(u,2) < size(u,1); u = u'; end nu = size(u,1); % number of inputs if size(y,2) < size(y,1); y = y'; end ny = size(y,1); % number of inputs if clmode if size(r,2) < size(r,1); r = r'; end nr = size(r,1); % number of inputs end % Apply window and zeros if needed if nargin == (7+clmode) u = u.*(ones(nu,1)*window(Wname,size(u,2))'); y = y.*(ones(ny,1)*window(Wname,size(u,2))'); if clmode r = r.*(ones(nr,1)*window(Wname,length(u))'); end end if nargin == (6+clmode) u = [u zeros(nu,ZeroPadding)]; y = [y zeros(ny,ZeroPadding)]; if clmode r = [r zeros(nr,ZeroPadding)]; end end if nargin < (5+clmode) Nfft = []; end % Some administration Fs = 1./dt; % Sample frequency N = length(u); % Number of samples T = N*dt; % Total time if isempty(Nfft) f = (0:N-1)'/T; % Frequency vector (double sided) else f = (linspace(0,N-1,Nfft))'/T; % Frequency vector (double sided) end Nf = length(f); % Determine Fourier transforms U = zeros(nu,1,Nf); Y = zeros(ny,1,Nf); for i = 1:nu ut = dt*fft(u(i,:),Nfft); for k = 1:Nf U(i,:,k) = ut(k); end end for i = 1:ny yt = dt*fft(y(i,:),Nfft); for k = 1:Nf Y(i,:,k) = yt(k); end end if clmode R = zeros(nr,1,Nf); for i = 1:nr rt = dt*fft(r(i,:),Nfft); for k = 1:Nf R(i,:,k) = rt(k); end end end % Do closed-loop or open-loop if clmode % Determine spectral densities Sur = zeros(nu,nr,Nf); Srr = zeros(nr,nr,Nf); Syr = zeros(ny,nr,Nf); Syy = zeros(ny,ny,Nf); for k = 1:Nf Sur(:,:,k) = (1/T).*U(:,:,k)*R(:,:,k)'; Srr(:,:,k) = (1/T).*R(:,:,k)*R(:,:,k)'; Syr(:,:,k) = (1/T).*Y(:,:,k)*R(:,:,k)'; Syy(:,:,k) = (1/T).*Y(:,:,k)*Y(:,:,k)'; end % Apply frequency averaging Nmod = floor(Nf/Nband); mSur = zeros(nu,nr,Nmod); mSrr = zeros(nr,nr,Nmod); mSyr = zeros(ny,nr,Nmod); mSyy = zeros(ny,ny,Nmod); mf = freqAvg(f,Nband); for i = 1:nr for j = 1:nr tSur = Sur(i,j,:); tSur = freqAvg(tSur(:),Nband); mSur(i,j,:) = tSur; tSrr = Srr(i,j,:); tSrr = freqAvg(tSrr(:),Nband); mSrr(i,j,:) = tSrr; end end for i = 1:ny for j = 1:ny tSyy = Syy(i,j,:); tSyy = freqAvg(tSyy(:),Nband); mSyy(i,j,:) = tSyy; end for j = 1:nr tSyr = Syr(i,j,:); tSyr = freqAvg(tSyr(:),Nband); mSyr(i,j,:) = tSyr; end end % Estimate transfer function G = zeros(ny,nr,Nmod); for k = 1:Nmod G(:,:,k) = mSyr(:,:,k)/mSur(:,:,k); end % Squared coherence Cohuy function between r and y if nr == ny && nargout == 3 Coh = zeros(ny,nr,Nmod); for k = 1:Nmod Coh(:,:,k) = sqrtm(abs(mSyr(:,:,k))*abs(mSyr(:,:,k))/(mSyy(:,:,k)*mSrr(:,:,k))); end end else % Determine spectral densities Suu = zeros(nu,nu,Nf); Syu = zeros(ny,nu,Nf); Syy = zeros(ny,ny,Nf); for k = 1:Nf Suu(:,:,k) = (1/T).*U(:,:,k)*U(:,:,k)'; Syu(:,:,k) = (1/T).*Y(:,:,k)*U(:,:,k)'; Syy(:,:,k) = (1/T).*Y(:,:,k)*Y(:,:,k)'; end % Apply frequency averaging Nmod = floor(Nf/Nband); mSuu = zeros(nu,nu,Nmod); mSyu = zeros(ny,nu,Nmod); mSyy = zeros(ny,ny,Nmod); mf = freqAvg(f,Nband); for i = 1:nu for j = 1:nu tSuu = Suu(i,j,:); tSuu = freqAvg(tSuu(:),Nband); mSuu(i,j,:) = tSuu; end end for i = 1:ny for j = 1:ny tSyy = Syy(i,j,:); tSyy = freqAvg(tSyy(:),Nband); mSyy(i,j,:) = tSyy; end for j = 1:nu tSyu = Syu(i,j,:); tSyu = freqAvg(tSyu(:),Nband); mSyu(i,j,:) = tSyu; end end % Estimate transfer function G = zeros(ny,nu,Nmod); for k = 1:Nmod G(:,:,k) = conj(mSyu(:,:,k)*pinv(mSuu(:,:,k))); end % Squared coherence Cohuy function between u and y if nu == ny && nargout == 3 Coh = zeros(ny,nu,Nmod); for k = 1:Nmod Coh(:,:,k) = conj(sqrtm(abs(mSyu(:,:,k))*abs(mSyu(:,:,k))*pinv(mSyy(:,:,k)*mSuu(:,:,k)))); end end end % Construct function output fmax = Fs/2; fi = find(mf <= fmax); w = mf(fi).*2*pi; G = G(:,:,fi); if nu == ny && nargout == 3 Coh = Coh(:,:,fi); end end function out = freqAvg(in,nrbands) %FREQAVG Frequency averaging % out=freqAvg(in,nrbands) averages the input 'in' over the number of % frequency bands 'nrbands'. N = length(in); Nmod = floor((N/nrbands)); % number of remaining frequencies after averaging tmp = zeros(nrbands,Nmod); % initialization of temporary matrix for averaging: nrband rows and nmod columns tmp(:) = in(1:nrbands*Nmod); % arrange the samples of 'in' in the elements of tmp. out = mean(tmp,1)'; % average over columns and make it a vector end
github
TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox-master
dnyquistdetsd.m
.m
Predictor-Based-Subspace-IDentification-toolbox-master/dnyquistdetsd.m
2,246
utf_8
316ca202611ed3a61b547168e98175f9
function dnyquistdetsd(G,covG,sd,Greal) %DNYQUISTDETSD Nyquist diagram with probalistic error bounds (det(G)) % dnyquistdetsd(G,covG,sd) plots the nyquist diagram using the determinant % of the estimated frequency response given in G and the frequency bounds % given in covG and sd. The value sd is the standard deviation and is % larger than zero. % % dnyquistdetsd(G,covG,sd,Greal) includes the plot of the determinant of % the frequency response given in Greal if nargin > 3 if ~isequal(size(G,3),size(covG,3),size(Greal,3)) error('Number of frequencies points should be the same!') end else if ~isequal(size(G,3),size(covG,3)) error('Number of frequencies points should be the same!') end end l = size(G,1); r = size(G,2); Gdet = zeros(1,size(G,3)); covGdet = zeros(2,2,size(G,3)); if nargin > 3 Gdetreal = zeros(1,size(G,3)); end for k = 1:size(G,3) Gdet(1,k) = det(G(:,:,k)); if nargin > 3 Gdetreal(1,k) = det(Greal(:,:,k)); end X = zeros(2*l,r); X(1:2:end,:) = real(G(:,:,k)); X(2:2:end,:) = imag(G(:,:,k)); J = jacobianest(@(x) deter(x,l,r),X(:)); P = zeros(l*r*2); for i = 1:l for j = 1:r P((i-1)*r*2+(j-1)*2+(1:2),(i-1)*r*2+(j-1)*2+(1:2)) = squeeze(covG(i,j,k,:,:)); end end covGdet(:,:,k) = J*P*J'; end if l == r figure hold on; [sdreal,sdimag] = pol2cart(unwrap(angle(Gdet)),max(squeeze(abs(Gdet)),1e-5)); for k = 1:size(G,3) ellipsebnd(covGdet(:,:,k),[sdreal(k); sdimag(k)],'conf',erf(sd/sqrt(2)),'style','k') end plot(sdreal',sdimag','k','Linewidth',2); if nargin > 3 [sdreal,sdimag] = pol2cart(unwrap(angle(Gdetreal)),max(squeeze(abs(Gdetreal)),1e-5)); plot(sdreal',sdimag','k--','Linewidth',1); end %axis equal; vline(0,'k:'); hline(0,'k:'); xlabel('Real axis'); ylabel('Imaginary axis'); box on; hold off; else error('Only for square MIMO systems!') end end function dD = deter(G,l,r) Gr = G(1:2:end,:); Gi = G(2:2:end,:); G = reshape(Gr,l,r) + 1i.*reshape(Gi,l,r); D = det(G); dD = zeros(2,1); dD(1,1) = real(D); dD(2,1) = imag(D); end
github
TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox-master
lordvarx.m
.m
Predictor-Based-Subspace-IDentification-toolbox-master/lordvarx.m
8,773
utf_8
44ca081bff91cd9866ddbcc209c13735
function [S,X] = lordvarx(u,y,mu,f,p,reg,opt,c,noD,ObsMatPoint) %LORDVARX Closed-loop LPV system identification using the PBSIDopt method. % [S,X]=lordvarx(u,y,mu,f,p) delivers information about the order of the % Linear Parameter Varing system and acts as a pre-processor for lmodx. % The latter is used to identify an open-loop or closed-loop system for % the N-by-r, N-by-l and N-by-m data matrices u, y and mu, where r, l and % m are the number of inputs, outputs and scheduling parameters. The input % matrix u, output matrix y and scheduling matrix mu must have the same % number of observations but can have different numbers of variables. The % past and future window size p and f must be higher then the expected % system order n. The outputs are the singular values S, which can be used % to determine the order of the identifiable system. Further the state % matrix X is returned, which has to be forwarded to lmodx. % % The data u,y,mu can be supplied in batches to prevent out-of-memory % errors when using a large number of samples: supply u,y,mu in a cell % array with different parts of the data in each cell. % See Example 5 ([PBSID toolbox path]/examples/ex05_lti_wts_batch.m) % % [S,X]=lordvarx(u,y,mu,f,p,reg,opt) adds a regularization to the % identification problem. The additional inputs are the regularization % method and selection parameters: reg = {'none', 'tikh', 'tsvd'} and opt % = {'gcv', 'lcurve', or any regularisation value as scalar}. With % regularisation, the solver can better deal with singular covariance % matrices. (default reg='none' and opt='gcv') % If reg = {'bpdn'} and opt = {'sv', or a scalar between 0 and 1} % then sparse estimation through Basis Pursuit Denoising is used. The % solver can then better deal with a past window that is chosen too % large. % See help private/regress for more details. % % [S,X]=lordvarx(u,y,mu,f,p,reg,opt,c) specifies which of the system % matrices are constant and not parameter-varing. For each of the matrices % A, B, and K an 1 or 0 can be given in the vector c. % % [S,X]=lordvarx(u,y,mu,f,p,reg,opt,c,noD) if noD=1, then the direct % feedtrough term D is not considered during estimatoion. Note the direct % feedtrough term D can improve the results when estimating low-order % models from high-order models. (default noD=0) % % [S,X]=lordvarx(u,y,mu,f,p,reg,opt,c,noD,ObsMatPoint) with ObsMatPoint=1, % then in estimation of the state sequence, we consider the observability % matrix in the operating point p = ones(1,m), which may yield better % results in some cases than with the default ObsMatPoint=0, which takes % the observability matrix in the operating point p = [1,zeros(1,m-1)]. % % See also: lmodx.m, lx2abcdk.m, and lx2abck.m. % % References: % [1] J.W. van Wingerden, and M. Verhaegen, ``Subspace identification % of Bilinear and LPV systems for open- and closed-loop data'', % Automatica 45, pp 372--381, 2009. % Ivo Houtzager % Delft Center of Systems and Control % Delft University of Technology % The Netherlands, 2010 % Pieter Gebraad % Delft Center of Systems and Control % Delft University of Technology % The Netherlands, 2011 % Jan-Willem van Wingerden % Delft Center of Systems and Control % Delft University of Technology % The Netherlands, 2015 % check number if input arguments if nargin < 4 error('LORDVARX requires four or five input arguments.') end % assign default values to unspecified parameters if (nargin < 10) || isempty(ObsMatPoint) ObsMatPoint = 0; end if (nargin < 9) || isempty(noD) noD = 0; end if (nargin < 8) || isempty(c) c = [0 0 0]; end if (nargin < 7) || isempty(opt) opt = 'gcv'; end if (nargin < 6) || isempty(reg) reg = 'none'; end % check the size of the windows if f > p error('Future window size f must equal or smaller then past window p. (f <= p)') end % check dimensions of inputs if size(y,2) < size(y,1) y = y'; end if size(mu,2) < size(mu,1) mu = mu'; end N = size(y,2); l = size(y,1); s = size(mu,1); if isempty(u); r = 0; u = zeros(0,N); else if size(u,2) < size(u,1) u = u'; end r = size(u,1); if ~isequal(N,length(u)) error('The number of rows of vectors/matrices u and y must be the same.') end end if l == 0 error('LORDVARX requires an output vector y.') end if s == 0 error('LORDVARX requires a scheduling sequence mu, use DORDVARX for LTI systems.') end % determine sizes m = r+l; k = r*s.^(1-c(2)+(1-c(1))*(p-1:-1:0))+ l*s.^(1-c(3)+(1-c(1))*(p-1:-1:0)); q = sum(k); if q > (N-p) if ~strcmpi(reg,'bpdn') if ObsMatPoint == 1 warning('lordvarx:ObsMatPoint1ThenNoKernel','Taking the observability matrix for p = ones(1,m) is not implemented for the kernel method. LORDVARX continues with ObsMatPoint=1, without kernel method.') kernel = 0; elseif ObsMatPoint == 0 kernel = 1; else error('ObsMatPoint should be 0 or 1') end else warning('lordvarx:BpdnThenNoKernel','The BPDN regularization is not implemented for the kernel method. LORDVARX continues with BPDN method, without kernel method.') kernel = 0; end else kernel = 0; end % store the past and future vectors if kernel Z = zeros(N-p,N-p); for j = 0:p-1 Z = optkernel(Z,u,y,mu,p,c,0,j); end else Z = zeros(q,N-p); if (c(2) == 0) && (c(3) == 0) z = [khatrirao(mu,u); khatrirao(mu,y)]; elseif (c(2) == 1) && (c(3) == 0) z = [u; khatrirao(mu,y)]; elseif (c(2) == 0) && (c(3) == 1) z = [khatrirao(mu,u); y]; elseif (c(2) == 1) && (c(3) == 1) z = [u; y]; end for i = 1:p Z(sum(k(1:i-1))+1:sum(k(1:i-1))+k(p),:) = z(:,i:N+i-p-1); if c(1) == 0 for j = (i+1):p Z(sum(k(1:i-1))+1:sum(k(1:i-1))+k(p-j+i),:) = khatrirao(mu(:,j:N+j-p-1),Z(sum(k(1:i-1))+1:sum(k(1:i-1))+k(p-j+i+1),:)); end end end end % solve VARX/KERNEL problem if kernel Y = y(:,p+1:N); U = u(:,p+1:N); if ~noD Z = Z + U'*U; end A = kernregress(Y,Z,reg,opt); else Y = y(:,p+1:N); U = u(:,p+1:N); if ~noD Z = [Z; U]; end VARX = regress(Y,Z,reg,opt); end % construct LambdaKappaZ if kernel LKZ = zeros(f*l,N-p); for i = 0:f-1 Z = zeros(N-p,N-p); for j = i:p-1 Z = optkernel(Z,u,y,mu,p,c,i,j); end LKZ(i*l+1:(i+1)*l,:) = A*Z; end % singular value decomposition [~,S,V] = svd(LKZ,'econ'); else if c(1) == 0 if ObsMatPoint % consider the observability matrix in the operating point p = ones(1,m) LKZ = zeros(f*l,N-p); for i = 1:f for j = i:p for h = 1:s^(i-1) LKZ((i-1)*l+1:i*l,:) = LKZ((i-1)*l+1:i*l,:) + VARX(:,sum(k(1:j-i))+((h-1)*k(j)+1:h*k(j)))*Z(sum(k(1:j-1))+1:sum(k(1:j)),:); end end end % singular value decomposition [~,S,V] = svd(LKZ,'econ'); else % consider the observability matrix in the operating point p = [1,zeros(1,m-1)] LK = zeros(f*l,q); for i = 1:f for j = i:p LK((i-1)*l+1:i*l,sum(k(1:j-1))+1:sum(k(1:j))) = VARX(:,sum(k(1:j-i))+1:sum(k(1:j-i))+k(j)); end end % singular value decomposition [~,S,V] = svd(LK*Z(1:q,:),'econ'); end else LK = zeros(f*l,q); for i = 1:f LK((i-1)*l+1:i*l,q-(p-i+1)*(q/p)+1:q) = VARX(:,1:(p-i+1)*(q/p)); end % singular value decomposition [~,S,V] = svd(LK*Z(1:q,:),'econ'); end end X = diag(sqrt(diag(S)))*V'; S = diag(S)'; end function Z = optkernel(Z,u,y,mu,p,c,i,j) N = size(y,2); P = 1:1:N-p; T = ones(N-p,N-p); if all(c == 0) for v = 0:p-j-1 T = T.*(mu(:,P+v+j-i)'*mu(:,P+v+j)); end Z = Z + T.*([u(:,P+j-i); y(:,P+j-i)]'*[u(:,P+j); y(:,P+j)]); else for v = 1:(1-c(1))*(p-j-1) T = T.*(mu(:,P+v+j-i)'*mu(:,P+v+j)); end if c(2) Z = Z + T.*(u(:,P+j-i)'*u(:,P+j)); else Z = Z + T.*(mu(:,P+j-i)'*mu(:,P+j)).*(u(:,P+j-i)'*u(:,P+j)); end if c(3) Z = Z + T.*(y(:,P+j-i)'*y(:,P+j)); else Z = Z + T.*(mu(:,P+j-i)'*mu(:,P+j)).*(y(:,P+j-i)'*y(:,P+j)); end end end
github
TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox-master
dvar4abck.m
.m
Predictor-Based-Subspace-IDentification-toolbox-master/dvar4abck.m
3,215
utf_8
02975a072981cc80129a641df8b8fd61
function [P,sigma,dA,dB,dC,dK] = dvar4abck(x,u,y,f,p,A,B,C,K,U,Zps) %DVAR4ABCK Asymptotic variance of the PBSIDopt (VARX only) estimation % P=dvar4abck(x,u,f,p,A,B,C,K,U,Zps) returns the covariance of the % estimated state space matrices and acts as a pre-processor for dvar2frd. % The latter is used to calculate the probalistic error bounds around the % identified bode diagrams. The data matrices U and Zps can be obtained % from dordvarx. % % [P,sigma]=dvar4abck(x,u,f,p,A,B,C,K,U,Zps) also returns the covariance % matrix of the innovation noise. % % [P,sigma,dA,dB,dC,dK]=dvar4abck(x,u,f,p,A,B,C,K,U,Zps) % Ivo Houtzager % Delft Center of Systems and Control % Delft University of Technology % The Netherlands, 2010 % check number if input arguments if nargin < 11 error('DVAR4ABCK requires eleven input arguments.') end % check the size of the windows if f > p error('Future window size f must equal or smaller then past window p. (f <= p)') end % check dimensions of inputs if size(y,2) < size(y,1) y = y'; end if size(x,2) < size(x,1) x = x'; end N = size(y,2); l = size(y,1); n = size(x,1); if isempty(u); r = 0; u = zeros(0,N); else if size(u,2) < size(u,1) u = u'; end r = size(u,1); if ~isequal(N,length(u)) error('The number of rows of vectors/matrices u and y must be the same.') end end if l == 0 error('DVAR4ABCK requires an output vector y.') end % store the past and future vectors m = r+l; z = [u; y]; Z = zeros(p*m,N-p); for i = 1:p Z((i-1)*m+1:i*m,:) = z(:,i:N+i-p-1); end % select the only the system order U = U(1:n,:); if size(Zps,2)/m > p Zps = Zps(:,1:p*m); end % remove the window sizes from input and output vector u = u(:,p+1:p+size(x,2)); y = y(:,p+1:p+size(x,2)); % calculate the innovation sequence e = y - C*x; sigma = (e*e')/length(e); % asymptotic variance LL = pinv([x(:,1:end-1); u(:,1:end-1); e(:,1:end-1)]); LL2 = pinv(x); Term1 = ObsContSum(Zps,speye(N-p),l,r,f,p,LL,Z(:,2:end),U); Term2 = ObsContSum(Zps,speye(N-p),l,r,f,p,LL,Z(:,1:end-1),A*U); Term3 = ObsContSum(Zps,speye(N-p),l,r,f,p,LL2,Z,-C*U); alpha1P = Term1-Term2; alpha2P = Term3; beta1 = -kron(LL'*Z(:,1:end-1)'*Zps',K); beta2 = -kron(LL2'*Z'*Zps',eye(l)); if l==1 P = sigma*[alpha1P+beta1;alpha2P+beta2]*[alpha1P+beta1;alpha2P+beta2]'; else P = [alpha1P+beta1;alpha2P+beta2]*sparse(kron(speye(N-p),sigma))*[alpha1P+beta1;alpha2P+beta2]'; end if nargout > 2 dTh = [alpha1P+beta1;alpha2P+beta2]*e(:); dA = reshape(dTh(1:n*n,1),n,n); dB = reshape(dTh(n*n+1:n*n+n*r,1),n,r); dK = reshape(dTh(n*n+n*r+1:n*n+n*r+n*l,1),n,l); dC = reshape(dTh(n*n+n*r+n*l+1:n*n+n*r+n*l+n*l,1),l,n); end end function SumKron = ObsContSum(Zps,Y,l,r,f,p,LL,Z,S) q = size(Y,1); for i = 1:p CK(:,1+(l+r)*(i-1):(l+r)*i) = Y*Zps(:,1+(l+r)*(i-1):(l+r)*i); end SumKron = zeros(size(LL,2)*size(S,1),size(Y,2)*l); for i = 1:f GammaK = zeros(q,(l+r)*p); GammaK(:,1+(l+r)*(i-1):(l+r)*p) = CK(:,1:(l+r)*(p+1-i)); SumKron = SumKron + kron(LL'*Z'*GammaK',S(:,1+l*(i-1):l*i)); end end
github
TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox-master
rpbsid.m
.m
Predictor-Based-Subspace-IDentification-toolbox-master/rpbsid.m
14,530
utf_8
c27e37236a8ce6a7bf4db32bc0bc7212
function [Ak,Bk,Ck,Dk,Kk,err,eigA,regA] = rpbsid(u,y,f,p,n,W,idopts,rlsopts,A,B,C,D,K,s) %RPBSID Recursive Predictor-based Subspace IDentification % [A,B,C,D,K]=rpbsid(u,y,f,p,n) reursively estimates the matrices A, B, C, % D and K of the state space model: % % x(N) = A x(N-1) + B u(N-1) + K e(N-1) % y(N-1) = C x(N-1) + D u(N-1) + e(N-1) % % where N is the number of observations. The input matrix u and output % matrix y must have the same number of observations but can have % different numbers of variables. The past and future window size p and f % must be higher then the expected order n. % % [A,B,C,D,K]=rpbsid(u,y,f,p,n,S) specifies the n times f*l permutation % matrix S. The default is S=[eye(n) zeros(n,n-f)]. % % [A,B,C,D,K]=rpbsid(u,y,f,p,n,S,idopts) specifies the identification % options. The default is idopts = % struct('method','varx','weight',0,'ltv',0,'noD',0,'past',0,'Kalm',0); % % [A,B,C,D,K]=rpbsid(u,y,f,p,n,S,idopts,rlsopts) specified the recursive % least squares options. The default is rlsopts = struct('lambda',[0.999 % 0.999 0.999],'ireg',[1e-6 1e-6 1e6],'reg',0); % % [A,B,C,D,K]=rpbsid(u,y,f,p,n,S,idopts,rlsopts,S,A0,B0,C0,D0,K0,Ts) % specifies the initial state-space matrices and sampling time. % % [A,B,C,D,K,err]=rpbsid(u,y,f,p,n,S) resturns the prediction error of the % recursive least squares solvers. % % [A,B,C,D,K,err,eigA]=rpbsid(u,y,f,p,n,S) returns the eigenvalue and % damping vectors over time. % % [A,B,C,D,K,err,eigA,regA]=rpbsid(u,y,f,p,n,S) returns the regularisation % over time. % % [A,B,C,D,K,err,eigA,regA]=rpbsid(u,y,f,p,n,S,idopts,rlsopts,A0,B0,C0,D0,K0,Ts) % specifies the sampling of returned vector err, eigA. The default is Ts=0 % (off). % % References: % [1] Ali H. Sayed, "Adaptive Filters", Wiley and Sons, 2008 % Ivo Houtzager % Delft Center of Systems and Control % The Netherlands, 2010 % check number if input arguments if nargin < 5 error('RPBSID requires at least five input arguments.') end % Determine sizes if size(u,1) > size(u,2) u = u'; end if size(y,1) > size(y,2) y = y'; end r = size(u,1); l = size(y,1); N = size(y,2); % Assign known values to the parameters if nargin < 14 || isempty(s) s = 0; end if nargin < 13 || isempty(K) K = zeros(n,l); end if nargin < 12 || isempty(D) D = zeros(l,r); end if nargin < 11 || isempty(C) C = zeros(l,n); end if nargin < 10 || isempty(B) B = zeros(n,r); end if nargin < 9 || isempty(A) A = zeros(n,n); end if nargin < 8 || isempty(idopts) rlsopts = struct('ireg',[1e-6 1e-6 1e-6],'lambda',[0.999 0.999 0.999],'reg',0); end if nargin < 7 || isempty(idopts) idopts = struct('method','varx','weight',0,'ltv',0,'noD',0,'past',0,'Kalm',0); end if nargin < 6 || isempty(W) W = [eye(n) zeros(n,f*l-n)]; end switch lower(idopts.method) case 'fir' m = r; case 'varx' m = r+l; case 'varmax' m = r+2*l; otherwise error('Unknown type.') end % Initialisation of recursive least squares iterations % Estimation of the Markov parameters Plk = rlsopts.ireg(1); % Initial inverse of sample covariance matrix CKD = zeros(l,p*m+~idopts.noD*r); % Initial solution CKDS = zeros(f*l,p*m+~idopts.noD*r); % Initial solutions P = zeros((p+f-1)*m,1); % Initial regression vector reg_min = rlsopts.reg(1); % Estimation of the output matrices Pcd = rlsopts.ireg(2); if idopts.noD CD = C; else CD = [C D]; end % Estimation of the state matrices Pabk = rlsopts.ireg(3); if strcmpi(idopts.method,'fir') ABK = [A B]; else ABK = [A B K]; end % Initialisation of forward Ricatti iterations (if selected) if idopts.Kalm Px = rlsopts.ireg(3).*eye(n); Q = rlsopts.ireg(3).*eye(n); R = rlsopts.ireg(3).*eye(l); S = zeros(n,l); end % Allocate state-space matrices for return if s > 0 Ak = zeros(n,n,floor(N/s)); Bk = zeros(n,r,floor(N/s)); Ck = zeros(l,n,floor(N/s)); Dk = zeros(l,r,floor(N/s)); Ak(:,:,1) = A; Bk(:,:,1) = B; Ck(:,:,1) = C; Dk(:,:,1) = D; if strcmpi(idopts.method,'varx') || strcmpi(idopts.method,'varmax') Kk = zeros(n,l,floor(N/s)); Kk(:,:,1) = K; end end if nargout > 5 err = zeros(2*l+n,N); end if nargout > 6 eigA = zeros(n,N); end if nargout > 7 regA = zeros(1,N); end if idopts.past if norm(W) > 1; Pw = 1/rlsopts.ireg(1); else Pw = rlsopts.ireg(1); end W = W'; end % Store vectors for next iteration start = 2; U1 = u(:,start-1); Y1 = y(:,start-1); E1 = zeros(l,1); Xf1 = zeros(n,1); % Start recursive identification h = 1; startA = 3; for k = start:1:N % New signal vector switch lower(idopts.method) case 'fir' P = [P(m+1:end,:); U1]; case 'varx' P = [P(m+1:end,:); U1; Y1]; case 'varmax' P = [P(m+1:end,:); U1; Y1; E1]; otherwise error('Unknown type.') end Y = y(:,k); U = u(:,k); if idopts.noD Z = P((f-1)*m+1:end,:); else Z = [P((f-1)*m+1:end,:); U]; end if k >= p % Solve Regression problem recursively if reg_min ~= 0 [CKD,Plk] = rls_ew_track_reg(Z,Y,CKD,Plk,rlsopts.lambda(1),reg_min); else [CKD,Plk] = rls_ew_track(Z,Y,CKD,Plk,rlsopts.lambda(1)); end if nargout > 5 err(1:l,k-f+1) = Y - CKD*Z; end if nargout > 7 regA(:,k) = reg_min; end CKDS(1:(f-1)*l,:) = CKDS(l+1:f*l,:); CKDS((f-1)*l+1:f*l,:) = CKD; end if k >= startA*p % Construction of observability times controllability LK = zeros(l*f,m*p); if idopts.ltv if idopts.weight for i = 0:f-1 LK(i*l+1:(i+1)*l,i*m+1:p*m) = CKDS(i*l+1:(i+1)*l,1:(p-i)*m); if i ~= 0 for j = 0:i-1 LK(i*l+1:(i+1)*l,:) = LK(i*l+1:(i+1)*l,:) + CKDS(i*l+1:(i+1)*l,(p-i+j)*m+r+(1:l))*LK(j*l+1:(j+1)*l,:); end end end else for i = 1:f LK((i-1)*l+1:i*l,p*m-(p-i+1)*m+1:p*m) = CKDS((i-1)*l+1:i*l,1:(p-i+1)*m); end end else if idopts.weight for i = 0:f-1 LK(i*l+1:(i+1)*l,i*m+1:p*m) = CKD(:,1:(p-i)*m); if i ~= 0 for j = 0:i-1 LK(i*l+1:(i+1)*l,:) = LK(i*l+1:(i+1)*l,:) + CKD(:,(p-i+j)*m+r+(1:l))*LK(j*l+1:(j+1)*l,:); end end end else for i = 1:f LK((i-1)*l+1:i*l,p*m-(p-i+1)*m+1:p*m) = CKD(:,1:(p-i+1)*m); end end end % Predicte future signal vector (= state estimate X) if idopts.ltv Xf = LK*P(1:p*m,:); Uf1 = P((p-1)*m+1:(p-1)*m+r,1); Yf1 = P((p-1)*m+r+1:(p-1)*m+r+l,1); else Xf = LK*P((f-1)*m+1:(p+f-1)*m,:); Uf1 = P((p+f-2)*m+1:(p+f-2)*m+r,1); Yf1 = P((p+f-2)*m+r+1:(p+f-2)*m+r+l,1); end if idopts.past [W,Pw] = rls_ew_track(W'*Xf,Xf,W,Pw,rlsopts.lambda(1)); Xf = W'*Xf; else Xf = W*Xf; end end if k >= startA*p+1 % The estimation of the system matrices if idopts.noD [CD,Pcd] = rls_ew_track(Xf1,Yf1,CD,Pcd,rlsopts.lambda(2)); if nargout > 5 err(l+1:2*l,k) = Yf1 - CD*Xf1; end Ef1 = Yf1 - CD*Xf1; else [CD,Pcd] = rls_ew_track([Xf1; Uf1],Yf1,CD,Pcd,rlsopts.lambda(2)); if nargout > 5 err(l+1:2*l,k-f+1) = Yf1 - CD*[Xf1; Uf1]; end Ef1 = Yf1 - CD*[Xf1; Uf1]; end if strcmpi(idopts.method,'fir') [ABK,Pabk] = rls_ew_track([Xf1; Uf1],Xf,ABK,Pabk,rlsopts.lambda(3)); if nargout > 5 err(2*l+1:2*l+n,k) = Xf - ABK*[Xf1; Uf1]; end if nargout > 6 eigA(:,k) = sort(eig(ABK(:,1:n))); end else [ABK,Pabk] = rls_ew_track([Xf1; Uf1; Ef1],Xf,ABK,Pabk,rlsopts.lambda(3)); if nargout > 5 err(2*l+1:2*l+n,k) = Xf - ABK*[Xf1; Uf1; Ef1]; end if nargout > 6 eigA(:,k) = sort(eig(ABK(:,1:n))); end end % Estimate stable Kalman gain by the forward Riccati iteration if idopts.Kalm VW = [Xf; Yf1] - [ABK(:,1:n+r); CD zeros(l,idopts.noD*r)]*[Xf1; Uf1]; VW = VW*VW'; Q = 0.5.*(VW(1:n,1:n) + rlsopts.lambda(3).*Q); R = 0.5.*(VW(n+1:n+l,n+1:n+l) + rlsopts.lambda(3).*R); S = 0.5.*(VW(1:n,n+1:n+l) + rlsopts.lambda(3).*S); K = (ABK(:,1:n)*Px*CD(:,1:n)' + S)/(R + CD(:,1:n)*Px*CD(:,1:n)'); Px = ABK(:,1:n)*Px*ABK(:,1:n)' + Q - ABK(:,(n+r+1):(n+r+l))*(ABK(:,1:n)*Px*CD(:,1:n)' + S)'; end end % Store state-space matrices (if selected) if k-f == h*s && s ~= 0 if k >= startA*p+1 Ak(:,:,h) = ABK(:,1:n); Ck(:,:,h) = CD(:,1:n); if strcmpi(idopts.method,'fir') Bk(:,:,h) = ABK(:,n+1:n+r); if idopts.noD Dk(:,:,h) = zeros(l,r); else Dk(:,:,h) = CD(:,n+1:n+r); end else if idopts.Kalm Bk(:,:,h) = [ABK(:,n+1:n+r) K]; else Bk(:,:,h) = ABK(:,n+1:end); end if idopts.noD Dk(:,:,h) = [zeros(l,r) eye(l)]; else Dk(:,:,h) = [CD(:,n+1:n+r) eye(l)]; end end end h = h + 1; end % Store vectors and matrices for next iteration if k >= startA*p Xf1 = Xf; end if k < startA*p+1 E = E1; end Y1 = Y; U1 = U; E1 = E; end if nargout >= 1 && s == 0 % Store state-space matrices Ak = ABK(:,1:n); Ck = CD(:,1:n); if strcmpi(idopts.method,'fir') Bk = ABK(:,n+1:n+r); if idopts.noD Dk = zeros(l,r); else Dk = CD(:,n+1:n+r); end else Bk = ABK(:,n+1:n+r); if idopts.Kalm Kk = K; else Kk = ABK(:,n+r+1:end); end if idopts.noD Dk = zeros(l,r); else Dk = CD(:,n+1:n+r); end end end end % end of function RPBSID function [theta,P] = rls_ew_track(z,y,theta,P,lambda) %RLS_EW_TRACK Exponentially Weighted RLS iteration % [THETA,P]=RLS_EW_TRACK(Z,Y,THETA,P,LAMBDA) applies one iteration of % exponentially weighted regularized least-squares problem. In recursive % least-squares, we deal with the issue of an increasing amount of date Z % and Y. At each iteration, THETA is the solution. The scalar LAMBDA is % called the forgetting factor since past data are exponentially weighted % less heavily than more recent data. % Ivo Houtzager % Delft Center of Systems and Control % The Netherlands, 2010 % Assign default values to unspecified parameters mz = size(z,1); if (nargin < 5) || isempty(lambda) lambda = 1; end if (nargin < 4) || isempty(P) P = zeros(mz); elseif isscalar(P) P = (1/P).*eye(mz); end if (nargin < 3) || isempty(theta) theta = zeros(size(y,1),mz); end % Exponentially-Weighted, Tracking, Regularized, Least-Squares Iteration P = (1/lambda).*(P - P*(z*z')*P./(lambda + z'*P*z)); P = 0.5.*(P+P'); % force symmetric e = y - theta*z; theta = theta + e*z'*P; end % end of function RLS_EW_TRACK function [theta,P] = rls_ew_track_reg(z,y,theta,P,lambda,reg_min) %RLS_EW_TRACK_REG Exponentially Weighted and Regularized RLS iteration % [THETA,P]=RLS_EW_TRACK_REG(Z,Y,THETA,P,LAMBDA,REG) applies one iteration % of exponentially weighted regularized least-squares problem. In % recursive least-squares, we deal with the issue of an inceasing amount % of date Z and Y. At each iteration, THETA is the solution. The scalar % LAMBDA is called the forgetting factor since past data are exponentially % weighted less heavily than more recent data. % Ivo Houtzager % Delft Center of Systems and Control % The Netherlands, 2010 % Assign default values to unspecified parameters mz = size(z,1); if (nargin < 6) || isempty(reg_min) reg_min = 0; end if (nargin < 5) || isempty(lambda) lambda = 1; end if (nargin < 4) || isempty(P) P = zeros(mz); elseif isscalar(P) P = (1/P).*eye(mz); end if (nargin < 3) || isempty(theta) theta = zeros(size(y,1),mz); end % Exponentially-Weighted, Tracking, Regularized, Least-Squares Iteration P = (1/lambda).*(P - P*(z*z')*P./(lambda + z'*P*z)); P = 0.5.*(P+P'); % force symmetric if isscalar(reg_min) opts.SYM = true; opts.POSDEF = true; P1 = linsolve((eye(size(P)) + reg_min^2.*P),P,opts); e = y - theta*z; theta = theta + e*z'*P1; elseif strcmpi(reg_min,'tikh') [U,S,V] = svd(pinv(P)); s = diag(S); YP = (y-theta*z)'; if isscalar(opt) reg_min = opt; elseif strcmpi(opt,'lcurve') reg_min = reglcurve(YP,U,s); elseif strcmpi(opt,'gcv') reg_min = reggcv(YP,U,s); end theta = theta + (V*(diag(s./(s.^2 + reg_min^2)))*U'*YP)'; elseif strcmpi(reg_min,'tsvd') [U,S,V] = svd(pinv(P)); s = diag(S); YP = (y-theta*z)'; if isscalar(opt) k_min = opt; elseif strcmpi(opt,'lcurve') k_min = reglcurve(YP,U,s,'tsvd'); elseif strcmpi(opt,'gcv') k_min = reggcv(YP,U,s,'tsvd'); end theta = theta + (V(:,1:k_min)*diag(1./s(1:k_min))*U(:,1:k_min)'*YP)'; end end % end of function RLS_EW_TRACK
github
TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox-master
sim.m
.m
Predictor-Based-Subspace-IDentification-toolbox-master/@idafflpv/sim.m
3,203
utf_8
0b3bda0b8d5cab02080d8f3436ebb3d0
function [y,t,x] = sim(sys,u,t,p,e,x0) %SIM Linear response simulation of affine LPV state-space model. % [Y,T,X] = SIM(M,U,T,MU) returns the output response of the IDAFFLPV % model M to the input and scheduling signal described by U, MU and T. % The time vector T consists of regularly spaced time samples, U and MU is % are matrices with as many columns as inputs and scheduling variables and % whose i-th row specifies the input value at time T(i). For discrete-time % models, U should be sampled at the same rate as M. % % [Y,T,X] = SIM(M,U,T,MU,E) adds the innovation noise to the simulation. % % [Y,T,X] = SIM(M,U,T,MU,E,X0) specifies the initial state vector X0 at % time T(1). X0 is set to zero when omitted. % Get the system matrices [a b c d k] = getABCDK(sys); % Define sizes N = length(t); Ny = size(c,1); [Ns,nu] = size(u); [Nn,np] = size(p); if size(u,1) < size(u,2); u = u'; end if size(t,1) < size(t,2); t = t'; end if size(p,1) < size(p,2); p = p'; end if ~(nargin < 5 || isempty(e)) if size(e,1) < size(e,2); e = e'; end else e = zeros(N,Ny); end [Ny,Nu,Nx,Np] = size(sys); % Computability and consistency checks if ~isequal(N,Ns,Nn) error('Number of samples in vector T, U and P must be equal.') end if nu ~= Nu error('Input data U must have as many columns as system inputs.') end if np ~= Np error('Input data P must have as many columns as scheduling parameters.') end % Assign values to unspecified parameters if nargin < 6 || isempty(x0) x0 = zeros(Nx,1); elseif length(x0)~=Nx error('Length of initial condition X0 must match number of states.') end if isct(sys) % Continuous models % Determine the states tspan = [t(1) t(end)]; options = odeset('RelTol',1e-6,'AbsTol',1e-6); [tc,x] = ode15s(@statesim,tspan,x0,options,t,u,p,e,a,b,k); % Determine the output y = zeros(length(tc),Ny); uc = interp1q(t,u,tc)'; pc = interp1q(t,p,tc)'; ec = interp1q(t,e,tc)'; for i = 1:length(tc) y(i,:) = c*(kron([1; pc(:,i)],x(i,:)')) + d*(kron([1; pc(:,i)],uc(:,i))) + ec(:,i); end % Format output arrays y = y.'; t = tc; else % Discrete models Ts = sys.Ts; if length(t)>1 && Ts>0 && abs(t(2)-t(1)-Ts)>1e-4*Ts error('Time step must match sample time of discrete-time models.') end bt = zeros(Nx,(Np+1)*(Nu+Ny)); dt = zeros(Ny,(Np+1)*(Nu+Ny)); for i = 1:Np+1 bt(:,(i-1)*(Nu+Ny)+1:i*(Nu+Ny)) = [b(:,(i-1)*Nu+1:i*Nu) k(:,(i-1)*Ny+1:i*Ny)]; if i == 1 dt(:,(i-1)*(Nu+Ny)+1:i*(Nu+Ny)) = [d(:,(i-1)*Nu+1:i*Nu) eye(Ny)]; else dt(:,(i-1)*(Nu+Ny)+1:i*(Nu+Ny)) = [d(:,(i-1)*Nu+1:i*Nu) zeros(Ny)]; end end [y,x] = lpvsim(a,bt,c,dt,p,[u e],[],x0); end end % State-derivative function used for the simulation of continuous models function dx = statesim(ts,xs,t,u,p,e,a,b,k) ps = interp1q(t,p,ts)'; us = interp1q(t,u,ts)'; es = interp1q(t,e,ts)'; dx = a*(kron([1; ps],xs)) + b*(kron([1; ps],us))+ k*(kron([1; ps],es)); end
github
TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox-master
display.m
.m
Predictor-Based-Subspace-IDentification-toolbox-master/@idafflpv/display.m
7,346
utf_8
7b6e9ea522f9f96baae2cb837ea575e0
function display(sys) %IDAFFLPV/DISPLAY Pretty-print for IDAFFLPV models. % Get size [Ny,Nu] = size(sys); % Use ISSTATIC to account for delays StaticFlag = isstatic(sys); % Handle various types if ((Ny==0 || Nu==0) && StaticFlag) disp(xlate('Empty affine LPV state-space model.')) else % Display name disp(xlate(sys.Name)) % Single IDAFFLPV model dispsys(sys,'') % Display IDAFFLPV properties (sample times) if ~StaticFlag, if sys.Ts<0, disp(xlate('Sampling time: unspecified')) elseif sys.Ts>0, disp(sprintf('Sampling time: %0.5g',sys.Ts)) end end % Last line if StaticFlag, disp(xlate('Static gain.')) elseif sys.Ts==0, disp(xlate('Continuous-time affine LPV state-space model.')) else disp(xlate('Discrete-time affine LPV state-space model.')); end end end function dispsys(sys,LeftMargin) %DISPLAY Pretty-print for affine LPV state-space models. % Print matrices printsys(sys.a,sys.b,sys.c,sys.d,sys.k,sys.InputName,sys.OutputName,sys.StateName,sys.SchedulingName,LeftMargin); end function printsys(a,b,c,d,k,ulabels,ylabels,xlabels,plabels,LeftMargin) %PRINTSYS Print system in pretty format. % % PRINTSYS is used to print state space systems with labels to the % right and above the system matrices. % % PRINTSYS(A,B,C,D,K,E,ULABELS,YLABELS,XLABELS) prints the state-space % system with the input, output and state labels contained in the % cellarrays ULABELS, YLABELS, and XLABELS, respectively. % % PRINTSYS(A,B,C,D,K) prints the system with numerical labels. % % See also: PRINTMAT nx = size(a,1); np = size(a,2)/nx; [ny,nu] = size(d); nu = nu/np; if ((isempty(ulabels) || isequal('',ulabels{:})) && (isempty(plabels) || isequal('',plabels{:}))) for j=1:np for i=1:nu, if j == 1 ulabels{i} = sprintf('u%d',i); else ulabels{(j-1)*nu+i} = sprintf('u%d*p%d',i,j-1); end end end elseif (isempty(ulabels) || isequal('',ulabels{:})) for j=1:np if j ~= 1 if isempty(plabels{j-1}) plabels{j-1} = '?'; end end for i=1:nu, if j == 1 ulabels{i} = sprintf('u%d',i); else ulabels{(j-1)*nu+i} = strcat(sprintf('u%d',i),'*',plabels{j-1}); end end end else for j=1:np if j ~= 1 if isempty(plabels{j-1}) plabels{j-1} = '?'; end end for i=1:nu, if j == 1 if isempty(ulabels{i}) ulabels{i} = '?'; end else ulabels{(j-1)*nu+i} = strcat(ulabels{i},'*',plabels{j-1}); end end end end if ((isempty(ylabels) || isequal('',ylabels{:})) && (isempty(plabels) || isequal('',plabels{:}))) for j=1:np for i=1:ny, if j == 1 ylabels{i} = sprintf('y%d',i); else ylabels{(j-1)*ny+i} = sprintf('y%d*p%d',i,j-1); end end end elseif (isempty(ylabels) || isequal('',ylabels{:})) for j=1:np if j ~= 1 if isempty(plabels{j-1}) plabels{j-1} = '?'; end end for i=1:ny, if j == 1 ylabels{i} = sprintf('y%d',i); else ylabels{(j-1)*ny+i} = strcat(sprintf('y%d',i),'*',plabels{j-1}); end end end else for j=1:np if j ~= 1 if isempty(plabels{j-1}) plabels{j-1} = '?'; end end for i=1:ny, if j == 1 if isempty(ylabels{i}) ylabels{i} = '?'; end else ylabels{(j-1)*ny+i} = strcat(ylabels{i},'*',plabels{j-1}); end end end end if ((isempty(xlabels) || isequal('',xlabels{:})) && (isempty(plabels) || isequal('',plabels{:}))) for j=1:np for i=1:nx, if j == 1 xlabels{i} = sprintf('x%d',i); else xlabels{(j-1)*nx+i} = sprintf('x%d*p%d',i,j-1); end end end elseif (isempty(xlabels) || isequal('',xlabels{:})) for j=1:np if j ~= 1 if isempty(plabels{j-1}) plabels{j-1} = '?'; end end for i=1:nx, if j == 1 xlabels{i} = sprintf('x%d',i); else xlabels{(j-1)*nx+i} = strcat(sprintf('x%d',i),'*',plabels{j-1}); end end end else for j=1:np if j ~= 1 if isempty(plabels{j-1}) plabels{j-1} = '?'; end end for i=1:nx, if j == 1 if isempty(xlabels{i}) xlabels{i} = '?'; end else xlabels{(j-1)*nx+i} = strcat(xlabels{i},'*',plabels{j-1}); end end end end disp(' ') if isempty(a), % Gain matrix printmat(d,[LeftMargin 'd'],ylabels,ulabels); else printmat(a,[LeftMargin 'a'],xlabels,xlabels); printmat(b,[LeftMargin 'b'],xlabels,ulabels); printmat(c,[LeftMargin 'c'],ylabels,xlabels); printmat(d,[LeftMargin 'd'],ylabels,ulabels); printmat(k,[LeftMargin 'k'],xlabels,ylabels); end end function printmat(a,name,rlab,clab) %PRINTMAT Print matrix with labels. % PRINTMAT(A,NAME,RLAB,CLAB) prints the matrix A with the row labels % RLAB and column labels CLAB. NAME is a string used to name the % matrix. RLAB and CLAB are cell vectors of strings. % % See also PRINTSYS. CWS = get(0,'CommandWindowSize'); % max number of char. per line MaxLength = round(.9*CWS(1)); [nrows,ncols] = size(a); len = 12; % Max length of labels Space = ' '; % Print name %disp(' ') if ~isempty(name), disp([name,' = ']), end % Empty case if (nrows==0) || (ncols==0), if (nrows==0) && (ncols==0), disp(' []') else disp(sprintf(' Empty matrix: %d-by-%d',nrows,ncols)); end disp(' ') return end % Row labels RowLabels = strjust(strvcat(' ',rlab{1:nrows}),'left'); RowLabels = RowLabels(:,1:min(len,end)); RowLabels = [Space(ones(nrows+1,1),ones(3,1)),RowLabels]; % Construct matrix display Columns = cell(1,ncols); prec = 3 + isreal(a); for ct=1:ncols, clab{ct} = clab{ct}(:,1:min(end,len)); col = [clab(ct); cellstr(deblank(num2str(a(:,ct),prec)))]; col = strrep(col,'+0i',''); % xx+0i->xx Columns{ct} = strjust(strvcat(col{:}),'right'); end % Equalize column width lc = cellfun('size',Columns,2); lcmax = max(lc)+2; for ct=1:ncols, Columns{ct} = [Space(ones(nrows+1,1),ones(lcmax-lc(ct),1)) , Columns{ct}]; end % Display MAXCOL columns at a time maxcol = max(1,round((MaxLength-size(RowLabels,2))/lcmax)); for ct=1:ceil(ncols/maxcol) disp([RowLabels Columns{(ct-1)*maxcol+1:min(ct*maxcol,ncols)}]); disp(' '); end end
github
TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox-master
findstates.m
.m
Predictor-Based-Subspace-IDentification-toolbox-master/@idafflpv/findstates.m
5,220
utf_8
80ca78bbdbfb3de9885bda4a8fe898d2
function x0 = findstates(sys,u,y,t,p,type,wn) %FINDSTATES Estimate initial states of the model for a given data set. % X0 = FINDSTATES(M,U,Y,T,MU) returns the residue response and initial % state of the IDAFFLPV model M to the input and scheduling signal % described by U, Y, MU and T. The time vector T consists of regularly % spaced time samples, U, Y, and MU is are matrices with as many columns % as inputs and scheduling variables and whose i-th row specifies the % input value at time T(i). For discrete-time models, U, Y, and MU should % be sampled at the same rate as M. % % X0 = FINDSTATES(M,U,Y,T,MU,'Type') specifies the type of LPV predictor. % 'K' specifies that K is not dependent on scheduling, or 'CD' specifies % that C and D is not dependent on scheduling. Default is Type = 'CD'. % % X0 = FINDSTATES(M,U,Y,T,MU,'Type',P) specifies the past window P. The % default is P = 5*size(M.a,1). % % NOTE: This is only possible if K or C and D are not dependent on the % scheduling sequence. % Define sizes N = length(t); if size(u,1) < size(u,2); u = u'; end if size(y,1) < size(y,2); y = y'; end if size(t,1) < size(t,2); t = t'; end if size(p,1) < size(p,2); p = p'; end [Ns,nu] = size(u); [Nn,np] = size(p); [Ni,ny] = size(y); [Ny,Nu,Nx,Np] = size(sys); % Computability and consistency checks if ~isequal(N,Ns,Nn,Ni) error('Number of samples in vector T, U and P must be equal.') end if ny ~= Ny error('Input data Y must have as many columns as system outputs.') end if nu ~= Nu error('Input data U must have as many columns as system inputs.') end if np ~= Np error('Input data P must have as many columns as scheduling parameters.') end % Assign values to unspecified parameters if nargin < 7 || isempty(wn) wn = 5*Nx; end if nargin < 6 || isempty(type) type = 'CD'; end % Get the system matrices [a b c d k] = getABCDK(sys); if strcmpi(type,'CD') for i = 1:Np+1 a(:,(i-1)*Nx+1:i*Nx) = a(:,(i-1)*Nx+1:i*Nx) - k(:,(i-1)*Ny+1:i*Ny)*c(:,1:Nx); b(:,(i-1)*Nu+1:i*Nu) = b(:,(i-1)*Nu+1:i*Nu) - k(:,(i-1)*Ny+1:i*Ny)*d(:,1:Nu); end elseif strcmpi(type,'K') for i = 1:Np+1 a(:,(i-1)*Nx+1:i*Nx) = a(:,(i-1)*Nx+1:i*Nx) - k(:,1:Ny)*c(:,(i-1)*Nx+1:i*Nx); b(:,(i-1)*Nu+1:i*Nu) = b(:,(i-1)*Nu+1:i*Nu) - k(:,1:Ny)*d(:,(i-1)*Nu+1:i*Nu); end else error('Type not recognized!') end bt = zeros(Nx,(Np+1)*(Nu+Ny)); dt = zeros(Ny,(Np+1)*(Nu+Ny)); for i = 1:Np+1 bt(:,(i-1)*(Nu+Ny)+1:i*(Nu+Ny)) = [b(:,(i-1)*Nu+1:i*Nu) k(:,(i-1)*Ny+1:i*Ny)]; dt(:,(i-1)*(Nu+Ny)+1:i*(Nu+Ny)) = [d(:,(i-1)*Nu+1:i*Nu) zeros(ny)]; end b = bt; d = dt; u = [u y]; if isct(sys) % Continuous models yr = y; options = optimset('Display','off'); x0 = lsqnonlin(@residue,ones(Nx,1),[],[],options,u(1:wn,:),yr(1:wn,:),t(1:wn,:),p(1:wn,:),a,b,c,d,type); else % Get the system matrices [Altv,Bltv,Cltv,Dltv] = lpv2ltv(a,b,c,d,p(1:wn,:)); [HU,Gamma] = lift(Altv,Bltv,Cltv,Dltv,wn); Y = y(1:wn,:)'; Y = Y(:); U = u(1:wn,:)'; U = U(:); Y = Y - HU*U; x0 = pinv(Gamma)*Y; end end % State-derivative function used for the simulation of continuous models function cost = residue(x0,u,yr,t,p,a,b,c,d,type) Ny = size(yr,2); if strcmpi(type,'K') error('Continuous models with varying C and D is not yet implemented.') end % Determine the states tspan = [t(1) t(end)]; options = odeset('RelTol',1e-6,'AbsTol',1e-6); [tc,x] = ode15s(@statesim,tspan,x0,options,t,u,p,a,b); % Determine the output y = zeros(length(tc),Ny); uc = interp1q(t,u,tc)'; pc = interp1q(t,p,tc)'; for i = 1:length(tc) y(i,:) = c*(kron([1; pc(:,i)],x(i,:)')) + d*(kron([1; pc(:,i)],uc(:,i))); end % Format output arrays y = y.'; t = tc; yc = interp1q(t,yr,tc)'; cost = pec(yc,y); end % State-derivative function used for the simulation of continuous models function dx = statesim(ts,xs,t,u,p,a,b) ps = interp1q(t,p,ts)'; us = interp1q(t,u,ts)'; dx = a*(kron([1; ps],xs)) + b*(kron([1; ps],us)); end function [HU,Gamma] = lift(A,B,C,D,p) %LIFT Lift state-spave matrices % written by, I. Houtzager [2007] % Delft Center of Systems and Control % determine lpv system sizes r = size(B{1},2); % The number of inputs l = size(C{1},1); % The number of outputs n = size(A{1},1); % The number of states % build lifted impulse matrix HU = zeros(p*l,p*r); Gamma = zeros(p*l,n); for i = 1:p for j = 1:p if i == j if isempty(D) HU((i-1)*l+1:i*l,(j-1)*r+1:j*r) = zeros(l,r); else HU((i-1)*l+1:i*l,(j-1)*r+1:j*r) = D{i}; end elseif j < i if j == i-1 HU((i-1)*l+1:i*l,(j-1)*r+1:j*r) = C{i}*B{j}; else T = C{i}; for k = i-1:-1:j+1 T = T*A{k}; end HU((i-1)*l+1:i*l,(j-1)*r+1:j*r) = T*B{j}; end end end T = C{i}; for k = i-1:-1:1 T = T*A{k}; end Gamma((i-1)*l+1:i*l,:) = T; end end
github
TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox-master
predict.m
.m
Predictor-Based-Subspace-IDentification-toolbox-master/@idafflpv/predict.m
3,900
utf_8
1550385bd044b2391df567f2e4ec70de
function [y,t,x] = predict(sys,u,y,t,p,x0,type) %PREDICT Linear response simulation of affine LPV state-space predictor. % [Y,T,X] = PREDICT(M,U,Y,T,MU) returns the predicted output response of % the IDAFFLPV model M to the input and scheduling signal described by U, % Y, MU and T. The time vector T consists of regularly spaced time % samples, U, Y, and MU is are matrices with as many columns as inputs and % scheduling variables and whose i-th row specifies the input value at % time T(i). For discrete-time models, U, Y, and MU should be sampled at % the same rate as M. % % [Y,T,X] = PREDICT(M,U,Y,T,MU,X0) specifies the initial state vector X0 % at time T(1). X0 is taken from model. % % [Y,T,X] = PREDICT(M,U,Y,T,MU,X0,'Type') specifies the type of LPV % predictor. 'K' specifies that K does not dependent on scheduling, or % 'CD' specifies that C and D does not dependent on scheduling. Default is % Type = 'CD'. % % NOTE: This is only possible if K or C and D are not dependent on the % scheduling sequence. % Define sizes N = length(t); if size(u,1) < size(u,2); u = u'; end if size(y,1) < size(y,2); y = y'; end if size(t,1) < size(t,2); t = t'; end if size(p,1) < size(p,2); p = p'; end [Ns,nu] = size(u); [Nn,np] = size(p); [Ni,ny] = size(y); [Ny,Nu,Nx,Np] = size(sys); % Computability and consistency checks if ~isequal(N,Ns,Nn,Ni) error('Number of samples in vector T, U and P must be equal.') end if ny ~= Ny error('Input data Y must have as many columns as system outputs.') end if nu ~= Nu error('Input data U must have as many columns as system inputs.') end if np ~= Np error('Input data P must have as many columns as scheduling parameters.') end % Assign values to unspecified parameters if nargout < 7 || isempty(type) type = 'CD'; end if nargout < 5 || isempty(x0) x0 = sys.x0; elseif length(x0)~=Nx error('Length of initial condition X0 must match number of states.') end % Get the system matrices [a b c d k] = getABCDK(sys); if strcmpi(type,'CD') for i = 1:Np+1 a(:,(i-1)*Nx+1:i*Nx) = a(:,(i-1)*Nx+1:i*Nx) - k(:,(i-1)*Ny+1:i*Ny)*c(:,1:Nx); b(:,(i-1)*Nu+1:i*Nu) = b(:,(i-1)*Nu+1:i*Nu) - k(:,(i-1)*Ny+1:i*Ny)*d(:,1:Nu); end elseif strcmpi(type,'K') for i = 1:Np+1 a(:,(i-1)*Nx+1:i*Nx) = a(:,(i-1)*Nx+1:i*Nx) - k(:,1:Ny)*c(:,(i-1)*Nx+1:i*Nx); b(:,(i-1)*Nu+1:i*Nu) = b(:,(i-1)*Nu+1:i*Nu) - k(:,1:Ny)*d(:,(i-1)*Nu+1:i*Nu); end else error('Type not recognized!') end bt = zeros(Nx,(Np+1)*(Nu+Ny)); dt = zeros(Ny,(Np+1)*(Nu+Ny)); for i = 1:Np+1 bt(:,(i-1)*(Nu+Ny)+1:i*(Nu+Ny)) = [b(:,(i-1)*Nu+1:i*Nu) k(:,(i-1)*Ny+1:i*Ny)]; dt(:,(i-1)*(Nu+Ny)+1:i*(Nu+Ny)) = [d(:,(i-1)*Nu+1:i*Nu) zeros(ny)]; end b = bt; d = dt; u = [u y]; if isct(sys) % Continuous models % Determine the states tspan = [t(1) t(end)]; options = odeset('RelTol',1e-6,'AbsTol',1e-6); [tc,x] = ode15s(@statesim,tspan,x0,options,t,u,p,a,b); % Determine the output y = zeros(length(tc),Ny); uc = interp1q(t,u,tc)'; pc = interp1q(t,p,tc)'; for i = 1:length(tc) y(i,:) = c*(kron([1; pc(:,i)],x(i,:)')) + d*(kron([1; pc(:,i)],uc(:,i))); end % Format output arrays y = y.'; t = tc; else % Discrete models Ts = sys.Ts; if length(t)>1 && Ts>0 && abs(t(2)-t(1)-Ts)>1e-4*Ts error('Time step must match sample time of discrete-time models.') end % Discrete simulation of LPV systems [y,x] = lpvsim(a,b,c,d,p,u,[],x0); end end % State-derivative function used for the simulation of continuous models function dx = statesim(ts,xs,t,u,p,a,b) ps = interp1q(t,p,ts)'; us = interp1q(t,u,ts)'; dx = a*(kron([1; ps],xs)) + b*(kron([1; ps],us)); end
github
TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox-master
resid.m
.m
Predictor-Based-Subspace-IDentification-toolbox-master/@idafflpv/resid.m
4,059
utf_8
7f209685ad0625e1c20982807dfff7e1
function [e,t] = resid(sys,u,y,t,p,x0,type) %RESID Compute the residuals associated with an IDAFFLPV. % E = RESID(M,U,Y,T,MU) returns the residue response of the IDAFFLPV model % M to the input and scheduling signal described by U, Y, MU and T. The % time vector T consists of regularly spaced time samples, U, Y, and MU is % are matrices with as many columns as inputs and scheduling variables and % whose i-th row specifies the input value at time T(i). For discrete-time % models, U, Y, and MU should be sampled at the same rate as M. % % E = RESID(M,U,Y,T,MU,X0) specifies the initial state vector X0 at time % T(1). X0 is taken from model. % % E = RESID(M,U,Y,T,MU,X0,'Type') specifies the type of LPV predictor. 'K' % specifies that K does not dependent on scheduling, or 'CD' specifies % that C and D does not dependent on scheduling. Default is Type = 'CD'. % % NOTE: This is only possible if K or C and D are not dependent on the % scheduling sequence. % Define sizes N = length(t); if size(u,1) < size(u,2); u = u'; end if size(y,1) < size(y,2); y = y'; end if size(t,1) < size(t,2); t = t'; end if size(p,1) < size(p,2); p = p'; end [Ns,nu] = size(u); [Nn,np] = size(p); [Ni,ny] = size(y); [Ny,Nu,Nx,Np] = size(sys); % Computability and consistency checks if ~isequal(N,Ns,Nn,Ni) error('Number of samples in vector T, U and P must be equal.') end if ny ~= Ny error('Input data Y must have as many columns as system outputs.') end if nu ~= Nu error('Input data U must have as many columns as system inputs.') end if np ~= Np error('Input data P must have as many columns as scheduling parameters.') end % Assign values to unspecified parameters if nargout < 7 || isempty(type) type = 'CD'; end if nargout < 5 || isempty(x0) x0 = sys.x0; elseif length(x0)~=Nx error('Length of initial condition X0 must match number of states.') end % Get the system matrices [a b c d k] = getABCDK(sys); if strcmpi(type,'CD') for i = 1:Np+1 a(:,(i-1)*Nx+1:i*Nx) = a(:,(i-1)*Nx+1:i*Nx) - k(:,(i-1)*Ny+1:i*Ny)*c(:,1:Nx); b(:,(i-1)*Nu+1:i*Nu) = b(:,(i-1)*Nu+1:i*Nu) - k(:,(i-1)*Ny+1:i*Ny)*d(:,1:Nu); end elseif strcmpi(type,'K') for i = 1:Np+1 a(:,(i-1)*Nx+1:i*Nx) = a(:,(i-1)*Nx+1:i*Nx) - k(:,1:Ny)*c(:,(i-1)*Nx+1:i*Nx); b(:,(i-1)*Nu+1:i*Nu) = b(:,(i-1)*Nu+1:i*Nu) - k(:,1:Ny)*d(:,(i-1)*Nu+1:i*Nu); end else error('Type not recognized!') end bt = zeros(Nx,(Np+1)*(Nu+Ny)); dt = zeros(Ny,(Np+1)*(Nu+Ny)); for i = 1:Np+1 bt(:,(i-1)*(Nu+Ny)+1:i*(Nu+Ny)) = [b(:,(i-1)*Nu+1:i*Nu) k(:,(i-1)*Ny+1:i*Ny)]; if i == 1 dt(:,(i-1)*(Nu+Ny)+1:i*(Nu+Ny)) = [d(:,(i-1)*Nu+1:i*Nu) -eye(Ny)]; else dt(:,(i-1)*(Nu+Ny)+1:i*(Nu+Ny)) = [d(:,(i-1)*Nu+1:i*Nu) zeros(ny)]; end end b = bt; d = dt; u = [u y]; if isct(sys) % Continuous models if strcmpi(type,'K') error('Continuous models with varying C and D is not yet implemented.') end % Determine the states tspan = [t(1) t(end)]; options = odeset('RelTol',1e-6,'AbsTol',1e-6); [tc,x] = ode15s(@statesim,tspan,x0,options,t,u,p,a,b); % Determine the output e = zeros(length(tc),Ny); uc = interp1q(t,u,tc)'; pc = interp1q(t,p,tc)'; for i = 1:length(tc) e(i,:) = c*(kron([1; pc(:,i)],x(i,:)')) + d*(kron([1; pc(:,i)],uc(:,i))); end % Format output arrays e = e.'; t = tc; else % Discrete models Ts = sys.Ts; if length(t)>1 && Ts>0 && abs(t(2)-t(1)-Ts)>1e-4*Ts error('Time step must match sample time of discrete-time models.') end % Discrete simulation of LPV systems e = lpvsim(a,b,c,d,p,u,[],x0); end end % State-derivative function used for the simulation of continuous models function dx = statesim(ts,xs,t,u,p,a,b) ps = interp1q(t,p,ts)'; us = interp1q(t,u,ts)'; dx = a*(kron([1; ps],xs)) + b*(kron([1; ps],us)); end
github
TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox-master
spg_mmv.m
.m
Predictor-Based-Subspace-IDentification-toolbox-master/private/spg_mmv.m
2,900
utf_8
fdede75f442cc17862d6d4252d0d7cfd
function [x,r,g,info] = spg_mmv( A, B, sigma, options, x0) %SPG_MMV Solve multi-measurement basis pursuit denoise (BPDN) % % SPG_MMV is designed to solve the basis pursuit denoise problem % % (BPDN) minimize ||X||_1,2 subject to ||A X - B||_2,2 <= SIGMA, % % where A is an M-by-N matrix, B is an M-by-G matrix, and SIGMA is a % nonnegative scalar. In all cases below, A can be an explicit M-by-N % matrix or matrix-like object for which the operations A*x and A'*y % are defined (i.e., matrix-vector multiplication with A and its % adjoint.) % % Also, A can be a function handle that points to a function with the % signature % % v = A(w,mode) which returns v = A *w if mode == 1; % v = A'*w if mode == 2. % % X = SPG_MMV(A,B,SIGMA) solves the BPDN problem. If SIGMA=0 or % SIGMA=[], then the basis pursuit (BP) problem is solved; i.e., the % constraints in the BPDN problem are taken as AX=B. % % X = SPG_MMV(A,B,SIGMA,OPTIONS) specifies options that are set using % SPGSETPARMS. % % [X,R,G,INFO] = SPG_BPDN(A,B,SIGMA,OPTIONS) additionally returns the % residual R = B - A*X, the objective gradient G = A'*R, and an INFO % structure. (See SPGL1 for a description of this last output argument.) % % See also spgl1, spgSetParms, spg_bp, spg_lasso. % Copyright 2008, Ewout van den Berg and Michael P. Friedlander % http://www.cs.ubc.ca/labs/scl/spgl1 % $Id$ if ~exist('options','var'), options = []; end if ~exist('x0','var'), x0 = []; else x0 = x0(:); end if ~exist('sigma','var'), sigma = 0; end if ~exist('B','var') || isempty(B) error('Second argument cannot be empty.'); end if ~exist('A','var') || isempty(A) error('First argument cannot be empty.'); end groups = size(B,2); if isa(A,'function_handle') y = A(B(:,1),2); m = size(B,1); n = length(y); A = @(x,mode) blockDiagonalImplicit(A,m,n,groups,x,mode); else m = size(A,1); n = size(A,2); A = @(x,mode) blockDiagonalExplicit(A,m,n,groups,x,mode); end % Set projection specific functions options.project = @(x,weight,tau) NormL12_project(groups,x,weight,tau); options.primal_norm = @(x,weight ) NormL12_primal(groups,x,weight); options.dual_norm = @(x,weight ) NormL12_dual(groups,x,weight); tau = 0; [x,r,g,info] = spgl1(A,B(:),tau,sigma,x0,options); n = round(length(x) / groups); m = size(B,1); x = reshape(x,n,groups); y = reshape(r,m,groups); g = reshape(g,n,groups); function y = blockDiagonalImplicit(A,m,n,g,x,mode) if mode == 1 y = zeros(m*g,1); for i=1:g y(1+(i-1)*m:i*m) = A(x(1+(i-1)*n:i*n),mode); end else y = zeros(n*g,1); for i=1:g y(1+(i-1)*n:i*n) = A(x(1+(i-1)*m:i*m),mode); end end function y = blockDiagonalExplicit(A,m,n,g,x,mode) if mode == 1 y = A * reshape(x,n,g); y = y(:); else x = reshape(x,m,g); y = (x' * A)'; y = y(:); end
github
TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox-master
spg_mmv_stopvali.m
.m
Predictor-Based-Subspace-IDentification-toolbox-master/private/spg_mmv_stopvali.m
3,198
utf_8
1590321e24fb5c98666449eb424584dc
function [x,r,g,info] = spg_mmv_stopvali( A, B, A2, B2, sigma, options, x0) %SPG_MMV Solve multi-measurement basis pursuit denoise (BPDN) % % SPG_MMV is designed to solve the basis pursuit denoise problem % % (BPDN) minimize ||X||_1,2 subject to ||A X - B||_2,2 <= SIGMA, % % where A is an M-by-N matrix, B is an M-by-G matrix, and SIGMA is a % nonnegative scalar. In all cases below, A can be an explicit M-by-N % matrix or matrix-like object for which the operations A*x and A'*y % are defined (i.e., matrix-vector multiplication with A and its % adjoint.) % % Also, A can be a function handle that points to a function with the % signature % % v = A(w,mode) which returns v = A *w if mode == 1; % v = A'*w if mode == 2. % % X = SPG_MMV(A,B,SIGMA) solves the BPDN problem. If SIGMA=0 or % SIGMA=[], then the basis pursuit (BP) problem is solved; i.e., the % constraints in the BPDN problem are taken as AX=B. % % X = SPG_MMV(A,B,SIGMA,OPTIONS) specifies options that are set using % SPGSETPARMS. % % [X,R,G,INFO] = SPG_BPDN(A,B,SIGMA,OPTIONS) additionally returns the % residual R = B - A*X, the objective gradient G = A'*R, and an INFO % structure. (See SPGL1 for a description of this last output argument.) % % See also spgl1, spgSetParms, spg_bp, spg_lasso. % Copyright 2008, Ewout van den Berg and Michael P. Friedlander % http://www.cs.ubc.ca/labs/scl/spgl1 % $Id$ if ~exist('options','var'), options = []; end if ~exist('x0','var'), x0 = []; else x0 = x0(:); end if ~exist('sigma','var'), sigma = 0; end if ~exist('B','var') || isempty(B) error('Second argument cannot be empty.'); end if ~exist('A','var') || isempty(A) error('First argument cannot be empty.'); end groups = size(B,2); if isa(A,'function_handle') y = A(B(:,1),2); m = size(B,1); n = length(y); A = @(x,mode) blockDiagonalImplicit(A,m,n,groups,x,mode); else m = size(A,1); n = size(A,2); A = @(x,mode) blockDiagonalExplicit(A,m,n,groups,x,mode); end if isa(A2,'function_handle') y2 = A2(B2(:,1),2); m2 = size(B2,1); n2 = length(y2); A2 = @(x,mode) blockDiagonalImplicit(A2,m2,n2,groups,x,mode); else m2 = size(A2,1); n2 = size(A2,2); A2 = @(x,mode) blockDiagonalExplicit(A2,m2,n2,groups,x,mode); end % Set projection specific functions options.project = @(x,weight,tau) NormL12_project(groups,x,weight,tau); options.primal_norm = @(x,weight ) NormL12_primal(groups,x,weight); options.dual_norm = @(x,weight ) NormL12_dual(groups,x,weight); tau = 0; [x,r,g,info] = spgl1_stopvali(A,B(:),A2,B2(:),tau,sigma,x0,options); n = round(length(x) / groups); m = size(B,1); x = reshape(x,n,groups); y = reshape(r,m,groups); g = reshape(g,n,groups); function y = blockDiagonalImplicit(A,m,n,g,x,mode) if mode == 1 y = zeros(m*g,1); for i=1:g y(1+(i-1)*m:i*m) = A(x(1+(i-1)*n:i*n),mode); end else y = zeros(n*g,1); for i=1:g y(1+(i-1)*n:i*n) = A(x(1+(i-1)*m:i*m),mode); end end function y = blockDiagonalExplicit(A,m,n,g,x,mode) if mode == 1 y = A * reshape(x,n,g); y = y(:); else x = reshape(x,m,g); y = (x' * A)'; y = y(:); end
github
TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox-master
spgl1_stopvali.m
.m
Predictor-Based-Subspace-IDentification-toolbox-master/private/spgl1_stopvali.m
31,870
utf_8
10a3cc0feb68137df5dc691058289e6d
function [x,r,g,info] = spgl1_stopvali( A, b, A2, b2, tau, sigma, x, options ) %SPGL1 Solve basis pursuit, basis pursuit denoise, and LASSO % % [x, r, g, info] = spgl1(A, b, tau, sigma, x0, options) % % --------------------------------------------------------------------- % Solve the basis pursuit denoise (BPDN) problem % % (BPDN) minimize ||x||_1 subj to ||Ax-b||_2 <= sigma, % % or the l1-regularized least-squares problem % % (LASSO) minimize ||Ax-b||_2 subj to ||x||_1 <= tau. % --------------------------------------------------------------------- % % INPUTS % ====== % A is an m-by-n matrix, explicit or an operator. % If A is a function, then it must have the signature % % y = A(x,mode) if mode == 1 then y = A x (y is m-by-1); % if mode == 2 then y = A'x (y is n-by-1). % % b is an m-vector. % tau is a nonnegative scalar; see (LASSO). % sigma if sigma != inf or != [], then spgl1 will launch into a % root-finding mode to find the tau above that solves (BPDN). % In this case, it's STRONGLY recommended that tau = 0. % x0 is an n-vector estimate of the solution (possibly all % zeros). If x0 = [], then SPGL1 determines the length n via % n = length( A'b ) and sets x0 = zeros(n,1). % options is a structure of options from spgSetParms. Any unset options % are set to their default value; set options=[] to use all % default values. % % OUTPUTS % ======= % x is a solution of the problem % r is the residual, r = b - Ax % g is the gradient, g = -A'r % info is a structure with the following information: % .tau final value of tau (see sigma above) % .rNorm two-norm of the optimal residual % .rGap relative duality gap (an optimality measure) % .gNorm Lagrange multiplier of (LASSO) % .stat = 1 found a BPDN solution % = 2 found a BP sol'n; exit based on small gradient % = 3 found a BP sol'n; exit based on small residual % = 4 found a LASSO solution % = 5 error: too many iterations % = 6 error: linesearch failed % = 7 error: found suboptimal BP solution % = 8 error: too many matrix-vector products % .time total solution time (seconds) % .nProdA number of multiplications with A % .nProdAt number of multiplications with A' % % OPTIONS % ======= % Use the options structure to control various aspects of the algorithm: % % options.fid File ID to direct log output % .verbosity 0=quiet, 1=some output, 2=more output. % .iterations Max. number of iterations (default if 10*m). % .bpTol Tolerance for identifying a basis pursuit solution. % .optTol Optimality tolerance (default is 1e-4). % .decTol Larger decTol means more frequent Newton updates. % .subspaceMin 0=no subspace minimization, 1=subspace minimization. % % EXAMPLE % ======= % m = 120; n = 512; k = 20; % m rows, n cols, k nonzeros. % p = randperm(n); x0 = zeros(n,1); x0(p(1:k)) = sign(randn(k,1)); % A = randn(m,n); [Q,R] = qr(A',0); A = Q'; % b = A*x0 + 0.005 * randn(m,1); % opts = spgSetParms('optTol',1e-4); % [x,r,g,info] = spgl1(A, b, 0, 1e-3, [], opts); % Find BP sol'n. % % AUTHORS % ======= % Ewout van den Berg ([email protected]) % Michael P. Friedlander ([email protected]) % Scientific Computing Laboratory (SCL) % University of British Columbia, Canada. % % BUGS % ==== % Please send bug reports or comments to % Michael P. Friedlander ([email protected]) % Ewout van den Berg ([email protected]) % 15 Apr 07: First version derived from spg.m. % Michael P. Friedlander ([email protected]). % Ewout van den Berg ([email protected]). % 17 Apr 07: Added root-finding code. % 18 Apr 07: sigma was being compared to 1/2 r'r, rather than % norm(r), as advertised. Now immediately change sigma to % (1/2)sigma^2, and changed log output accordingly. % 24 Apr 07: Added quadratic root-finding code as an option. % 24 Apr 07: Exit conditions need to guard against small ||r|| % (ie, a BP solution). Added test1,test2,test3 below. % 15 May 07: Trigger to update tau is now based on relative difference % in objective between consecutive iterations. % 15 Jul 07: Added code to allow a limited number of line-search % errors. % 23 Feb 08: Fixed bug in one-norm projection using weights. Thanks % to Xiangrui Meng for reporting this bug. % 26 May 08: The simple call spgl1(A,b) now solves (BPDN) with sigma=0. % spgl1.m % $Id: spgl1.m 1225 2009-01-30 20:36:31Z ewout78 $ % % ---------------------------------------------------------------------- % This file is part of SPGL1 (Spectral Projected-Gradient for L1). % % Copyright (C) 2007 Ewout van den Berg and Michael P. Friedlander, % Department of Computer Science, University of British Columbia, Canada. % All rights reserved. E-mail: <{ewout78,mpf}@cs.ubc.ca>. % % SPGL1 is free software; you can redistribute it and/or modify it % under the terms of the GNU Lesser General Public License as % published by the Free Software Foundation; either version 2.1 of the % License, or (at your option) any later version. % % SPGL1 is distributed in the hope that it will be useful, but WITHOUT % ANY WARRANTY; without even the implied warranty of MERCHANTABILITY % or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General % Public License for more details. % % You should have received a copy of the GNU Lesser General Public % License along with SPGL1; if not, write to the Free Software % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 % USA % ---------------------------------------------------------------------- REVISION = '$Revision: 1017 $'; DATE = '$Date: 2008-06-16 22:43:07 -0700 (Mon, 16 Jun 2008) $'; REVISION = REVISION(11:end-1); DATE = DATE(35:50); tic; % Start your watches! m = length(b); %---------------------------------------------------------------------- % Check arguments. %---------------------------------------------------------------------- if ~exist('options','var'), options = []; end if ~exist('x','var'), x = []; end if ~exist('sigma','var'), sigma = []; end if ~exist('tau','var'), tau = []; end if nargin < 2 || isempty(b) || isempty(A) error('At least two arguments are required'); elseif isempty(tau) && isempty(sigma) tau = 0; sigma = 0; singleTau = false; elseif isempty(sigma) % && ~isempty(tau) <-- implied singleTau = true; else if isempty(tau) tau = 0; end singleTau = false; end %---------------------------------------------------------------------- % Grab input options and set defaults where needed. %---------------------------------------------------------------------- defaultopts = spgSetParms(... 'fid' , 1 , ... % File ID for output 'verbosity' , 2 , ... % Verbosity level 'iterations' , 10*m , ... % Max number of iterations 'nPrevVals' , 3 , ... % Number previous func values for linesearch 'bpTol' , 1e-06 , ... % Tolerance for basis pursuit solution 'optTol' , 1e-04 , ... % Optimality tolerance 'decTol' , 1e-04 , ... % Req'd rel. change in primal obj. for Newton 'stepMin' , 1e-16 , ... % Minimum spectral step 'stepMax' , 1e+05 , ... % Maximum spectral step 'rootMethod' , 2 , ... % Root finding method: 2=quad,1=linear (not used). 'activeSetIt', Inf , ... % Exit with EXIT_ACTIVE_SET if nnz same for # its. 'subspaceMin', 0 , ... % Use subspace minimization 'iscomplex' , NaN , ... % Flag set to indicate complex problem 'maxMatvec' , Inf , ... % Maximum matrix-vector multiplies allowed 'weights' , 1 , ... % Weights W in ||Wx||_1 'project' , @NormL1_project , ... 'primal_norm', @NormL1_primal , ... 'dual_norm' , @NormL1_dual ... ); options = spgSetParms(defaultopts, options); fid = options.fid; logLevel = options.verbosity; maxIts = options.iterations; nPrevVals = options.nPrevVals; bpTol = options.bpTol; optTol = options.optTol; decTol = options.decTol; stepMin = options.stepMin; stepMax = options.stepMax; activeSetIt = options.activeSetIt; subspaceMin = options.subspaceMin; maxMatvec = max(3,options.maxMatvec); weights = options.weights; maxLineErrors = 10; % Maximum number of line-search failures. pivTol = 1e-12; % Threshold for significant Newton step. %---------------------------------------------------------------------- % Initialize local variables. %---------------------------------------------------------------------- iter = 0; itnTotLSQR = 0; % Total SPGL1 and LSQR iterations. nProdA = 0; nProdAt = 0; nProdA2 = 0; nProdA2t = 0; lastFv = -inf(nPrevVals,1); % Last m function values. nLineTot = 0; % Total no. of linesearch steps. printTau = false; nNewton = 0; bNorm = norm(b,2); stat = false; timeProject = 0; timeMatProd = 0; nnzIter = 0; % No. of its with fixed pattern. nnzIdx = []; % Active-set indicator. subspace = false; % Flag if did subspace min in current itn. stepG = 1; % Step length for projected gradient. testUpdateTau = 0; % Previous step did not update tau % Determine initial x, vector length n, and see if problem is complex explicit = ~(isa(A,'function_handle')); if isempty(x) if isnumeric(A) n = size(A,2); realx = isreal(A) && isreal(b); else x = Aprod(b,2); n = length(x); realx = isreal(x) && isreal(b); end x = zeros(n,1); else n = length(x); realx = isreal(x) && isreal(b); end if isnumeric(A), realx = realx && isreal(A); end; % Override options when options.iscomplex flag is set if (~isnan(options.iscomplex)), realx = (options.iscomplex == 0); end % Check if all weights (if any) are strictly positive. In previous % versions we also checked if the number of weights was equal to % n. In the case of multiple measurement vectors, this no longer % needs to apply, so the check was removed. if ~isempty(weights) if any(~isfinite(weights)) error('Entries in options.weights must be finite'); end if any(weights <= 0) error('Entries in options.weights must be strictly positive'); end else weights = 1; end % Quick exit if sigma >= ||b||. Set tau = 0 to short-circuit the loop. if bNorm <= sigma printf('W: sigma >= ||b||. Exact solution is x = 0.\n'); tau = 0; singleTau = true; end % Don't do subspace minimization if x is complex. if ~realx && subspaceMin printf('W: Subspace minimization disabled when variables are complex.\n'); subspaceMin = false; end % Pre-allocate iteration info vectors xNorm1 = zeros(min(maxIts,10000),1); rNorm2 = zeros(min(maxIts,10000),1); r2Norm2 = zeros(min(maxIts,10000),1); lambda = zeros(min(maxIts,10000),1); % Exit conditions (constants). EXIT_ROOT_FOUND = 1; EXIT_BPSOL1_FOUND = 2; EXIT_BPSOL2_FOUND = 3; EXIT_OPTIMAL = 4; EXIT_ITERATIONS = 5; EXIT_LINE_ERROR = 6; EXIT_SUBOPTIMAL_BP = 7; EXIT_MATVEC_LIMIT = 8; EXIT_ACTIVE_SET = 9; % [sic] EXIT_ERRORVALINCR = 10; %---------------------------------------------------------------------- % Log header. %---------------------------------------------------------------------- printf('\n'); printf(' %s\n',repmat('=',1,80)); printf(' SPGL1 v.%s (%s)\n', REVISION, DATE); printf(' %s\n',repmat('=',1,80)); printf(' %-22s: %8i %4s' ,'No. rows' ,m ,''); printf(' %-22s: %8i\n' ,'No. columns' ,n ); printf(' %-22s: %8.2e %4s' ,'Initial tau' ,tau ,''); printf(' %-22s: %8.2e\n' ,'Two-norm of b' ,bNorm ); printf(' %-22s: %8.2e %4s' ,'Optimality tol' ,optTol ,''); if singleTau printf(' %-22s: %8.2e\n' ,'Target one-norm of x' ,tau ); else printf(' %-22s: %8.2e\n','Target objective' ,sigma ); end printf(' %-22s: %8.2e %4s' ,'Basis pursuit tol' ,bpTol ,''); printf(' %-22s: %8i\n' ,'Maximum iterations',maxIts ); printf('\n'); if singleTau logB = ' %5i %13.7e %13.7e %9.2e %6.1f %6i %6i'; logH = ' %5s %13s %13s %9s %6s %6s %6s\n'; printf(logH,'Iter','Objective','Relative Gap','gNorm','stepG','nnzX','nnzG'); else logB = ' %5i %13.7e %13.7e %9.2e %9.3e %6.1f %6i %6i'; logH = ' %5s %13s %13s %9s %9s %6s %6s %6s %13s\n'; printf(logH,'Iter','Objective','Relative Gap','Rel Error',... 'gNorm','stepG','nnzX','nnzG','tau'); end % Project the starting point and evaluate function and gradient. x = project(x,tau); r = b - Aprod(x,1); % r = b - Ax r2 = b2 - A2prod(x,1); % r = b2 - A2x g = - Aprod(r,2); % g = -A'r f = r'*r / 2; f2 = r2'*r2 / 2; % Required for nonmonotone strategy. lastFv(1) = f; fBest = f; f2Best = f2; xBest = x; fOld = f; f2Old = f2; % Compute projected gradient direction and initial steplength. dx = project(x - g, tau) - x; dxNorm = norm(dx,inf); if dxNorm < (1 / stepMax) gStep = stepMax; else gStep = min( stepMax, max(stepMin, 1/dxNorm) ); end %---------------------------------------------------------------------- % MAIN LOOP. %---------------------------------------------------------------------- while 1 %------------------------------------------------------------------ % Test exit conditions. %------------------------------------------------------------------ % Compute quantities needed for log and exit conditions. gNorm = options.dual_norm(-g,weights); rNorm = norm(r, 2); r2Norm = norm(r2, 2); gap = r'*(r-b) + tau*gNorm; rGap = abs(gap) / max(1,f); aError1 = rNorm - sigma; aError2 = f - sigma^2 / 2; rError1 = abs(aError1) / max(1,rNorm); rError2 = abs(aError2) / max(1,f); % Count number of consecutive iterations with identical support. nnzOld = nnzIdx; [nnzX,nnzG,nnzIdx,nnzDiff] = activeVars(x,g,nnzIdx,options); if nnzDiff nnzIter = 0; else nnzIter = nnzIter + 1; if nnzIter >= activeSetIt, stat=EXIT_ACTIVE_SET; end end % Single tau: Check if we're optimal. % The 2nd condition is there to guard against large tau. if singleTau if rGap <= optTol || rNorm < optTol*bNorm stat = EXIT_OPTIMAL; end % Multiple tau: Check if found root and/or if tau needs updating. else if rGap <= max(optTol, rError2) || rError1 <= optTol % The problem is nearly optimal for the current tau. % Check optimality of the current root. test1 = rNorm <= bpTol * bNorm; test2 = gNorm <= bpTol * rNorm; test3 = rError1 <= optTol; test4 = rNorm <= sigma; test5 = f2 > f2Old; if test4, stat=EXIT_SUBOPTIMAL_BP;end % Found suboptimal BP sol. if test3, stat=EXIT_ROOT_FOUND; end % Found approx root. if test2, stat=EXIT_BPSOL2_FOUND; end % Gradient zero -> BP sol. if test1, stat=EXIT_BPSOL1_FOUND; end % Resid minim'zd -> BP sol. if test5, stat=EXIT_ERRORVALINCR; end end testRelChange1 = (abs(f - fOld) <= decTol * f); testRelChange2 = (abs(f - fOld) <= 1e-1 * f * (abs(rNorm - sigma))); testUpdateTau = ((testRelChange1 && rNorm > 2 * sigma) || ... (testRelChange2 && rNorm <= 2 * sigma)) && ... ~stat && ~testUpdateTau; if testUpdateTau % Update tau. tauOld = tau; tau = max(0,tau + (rNorm * aError1) / gNorm); nNewton = nNewton + 1; printTau = abs(tauOld - tau) >= 1e-6 * tau; % For log only. if tau < tauOld % The one-norm ball has decreased. Need to make sure that the % next iterate if feasible, which we do by projecting it. x = project(x,tau); end % Remember the residual norm on validation data at tau update f2Old = r2'*r2 / 2; end end % Too many its and not converged. if ~stat && iter >= maxIts stat = EXIT_ITERATIONS; end %------------------------------------------------------------------ % Print log, update history and act on exit conditions. %------------------------------------------------------------------ if logLevel >= 2 || singleTau || printTau || iter == 0 || stat tauFlag = ' '; subFlag = ''; if printTau, tauFlag = sprintf(' %13.7e',tau); end if subspace, subFlag = sprintf(' S %2i',itnLSQR); end if singleTau printf(logB,iter,rNorm,rGap,gNorm,log10(stepG),nnzX,nnzG); if subspace printf(' %s',subFlag); end else printf(logB,iter,rNorm,rGap,rError1,gNorm,log10(stepG),nnzX,nnzG); if printTau || subspace printf(' %s',[tauFlag subFlag]); end end printf('\n'); end printTau = false; subspace = false; % Update history info xNorm1(iter+1) = options.primal_norm(x,weights); rNorm2(iter+1) = rNorm; r2Norm2(iter+1) = r2Norm; lambda(iter+1) = gNorm; if stat, break; end % Act on exit conditions. %================================================================== % Iterations begin here. %================================================================== iter = iter + 1; xOld = x; fOld = f; gOld = g; rOld = r; try %--------------------------------------------------------------- % Projected gradient step and linesearch. %--------------------------------------------------------------- [f,x,r,nLine,stepG,lnErr] = ... spgLineCurvy(x,gStep*g,max(lastFv),@Aprod,b,@project,tau); r2 = b2 - A2prod(x,1); f2 = r2'*r2 / 2; nLineTot = nLineTot + nLine; if lnErr % Projected backtrack failed. Retry with feasible dir'n linesearch. x = xOld; dx = project(x - gStep*g, tau) - x; gtd = g'*dx; [f,x,r,nLine,lnErr] = spgLine(f,x,dx,gtd,max(lastFv),@Aprod,b); r2 = b2 - A2prod(x,1); f2 = r2'*r2 / 2; nLineTot = nLineTot + nLine; end if lnErr % Failed again. Revert to previous iterates and damp max BB step. if maxLineErrors <= 0 stat = EXIT_LINE_ERROR; else stepMax = stepMax / 10; printf(['W: Linesearch failed with error %i. '... 'Damping max BB scaling to %6.1e.\n'],lnErr,stepMax); maxLineErrors = maxLineErrors - 1; end end %--------------------------------------------------------------- % Subspace minimization (only if active-set change is small). %--------------------------------------------------------------- doSubspaceMin = false; if subspaceMin g = - Aprod(r,2); [nnzX,nnzG,nnzIdx,nnzDiff] = activeVars(x,g,nnzOld,options); if ~nnzDiff if nnzX == nnzG, itnMaxLSQR = 20; else itnMaxLSQR = 5; end nnzIdx = abs(x) >= optTol; doSubspaceMin = true; end end if doSubspaceMin % LSQR parameters damp = 1e-5; aTol = 1e-1; bTol = 1e-1; conLim = 1e12; showLSQR = 0; ebar = sign(x(nnzIdx)); nebar = length(ebar); Sprod = @(y,mode)LSQRprod(@Aprod,nnzIdx,ebar,n,y,mode); [dxbar, istop, itnLSQR] = ... lsqr(m,nebar,Sprod,r,damp,aTol,bTol,conLim,itnMaxLSQR,showLSQR); itnTotLSQR = itnTotLSQR + itnLSQR; if istop ~= 4 % LSQR iterations successful. Take the subspace step. % Push dx back into full space: dx = Z dx. dx = zeros(n,1); dx(nnzIdx) = dxbar - (1/nebar)*(ebar'*dxbar)*dxbar; % Find largest step to a change in sign. block1 = nnzIdx & x < 0 & dx > +pivTol; block2 = nnzIdx & x > 0 & dx < -pivTol; alpha1 = Inf; alpha2 = Inf; if any(block1), alpha1 = min(-x(block1) ./ dx(block1)); end if any(block2), alpha2 = min(-x(block2) ./ dx(block2)); end alpha = min([1 alpha1 alpha2]); ensure(alpha >= 0); ensure(ebar'*dx(nnzIdx) <= optTol); % Update variables. x = x + alpha*dx; r = b - Aprod(x,1); f = r'*r / 2; r2 = b2 - A2prod(x,1); f2 = r2'*r2 / 2; subspace = true; end end ensure(options.primal_norm(x,weights) <= tau+optTol); %--------------------------------------------------------------- % Update gradient and compute new Barzilai-Borwein scaling. %--------------------------------------------------------------- g = - Aprod(r,2); s = x - xOld; y = g - gOld; sts = s'*s; sty = s'*y; if sty <= 0, gStep = stepMax; else gStep = min( stepMax, max(stepMin, sts/sty) ); end catch % Detect matrix-vector multiply limit error err = lasterror; if strcmp(err.identifier,'SPGL1:MaximumMatvec') stat = EXIT_MATVEC_LIMIT; iter = iter - 1; x = xOld; f = fOld; g = gOld; r = rOld; break; else rethrow(err); end end %------------------------------------------------------------------ % Update function history. %------------------------------------------------------------------ if singleTau || f > sigma^2 / 2 % Don't update if superoptimal. lastFv(mod(iter,nPrevVals)+1) = f; if fBest > f fBest = f; if f2Best >= f2 f2Best = f2; xBest = x; BestIter = iter; end end end end % while 1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Restore best solution (only if solving single problem). if f2 >= f2Best || f >= fBest rNorm = sqrt(2*fBest); x = xBest; r = b - Aprod(x,1); r2 = b2 - A2prod(x,1); g = - Aprod(r,2); gNorm = options.dual_norm(g,weights); rNorm = norm(r, 2); r2Norm = norm(r2, 2); printf('\n Restoring best iterate to objective ||r|| = %13.7e\n',rNorm); printf('\n ................................... ||r2|| = %13.7e\n',r2Norm); end % Final cleanup before exit. info.tau = tau; info.rNorm = rNorm; info.r2Norm = r2Norm; info.rGap = rGap; info.gNorm = gNorm; info.rGap = rGap; info.stat = stat; info.iter = iter; info.nProdA = nProdA; info.nProdAt = nProdAt; info.nNewton = nNewton; info.timeProject = timeProject; info.timeMatProd = timeMatProd; info.itnLSQR = itnTotLSQR; info.options = options; info.timeTotal = toc; info.xNorm1 = xNorm1(1:iter); info.rNorm2 = rNorm2(1:iter); info.r2Norm2 = r2Norm2(1:iter); info.lambda = lambda(1:iter); % Print final output. switch (stat) case EXIT_OPTIMAL printf('\n EXIT -- Optimal solution found\n') case EXIT_ITERATIONS printf('\n ERROR EXIT -- Too many iterations\n'); case EXIT_ROOT_FOUND printf('\n EXIT -- Found a root\n'); case {EXIT_BPSOL1_FOUND, EXIT_BPSOL2_FOUND} printf('\n EXIT -- Found a BP solution\n'); case EXIT_LINE_ERROR printf('\n ERROR EXIT -- Linesearch error (%i)\n',lnErr); case EXIT_SUBOPTIMAL_BP printf('\n EXIT -- Found a suboptimal BP solution\n'); case EXIT_MATVEC_LIMIT printf('\n EXIT -- Maximum matrix-vector operations reached\n'); case EXIT_ACTIVE_SET printf('\n EXIT -- Found a possible active set\n'); case EXIT_ERRORVALINCR printf('\n EXIT -- Increase of prediction error on validation data\n'); otherwise error('Unknown termination condition\n'); end printf('\n'); printf(' %-20s: %6i %6s %-20s: %6.1f\n',... 'Products with A',nProdA,'','Total time (secs)',info.timeTotal); printf(' %-20s: %6i %6s %-20s: %6.1f\n',... 'Products with A''',nProdAt,'','Project time (secs)',timeProject); printf(' %-20s: %6i %6s %-20s: %6.1f\n',... 'Newton iterations',nNewton,'','Mat-vec time (secs)',timeMatProd); printf(' %-20s: %6i %6s %-20s: %6i\n', ... 'Line search its',nLineTot,'','Subspace iterations',itnTotLSQR); printf('\n'); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % NESTED FUNCTIONS. These share some vars with workspace above. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function z = Aprod(x,mode) if (nProdA + nProdAt >= maxMatvec) error('SPGL1:MaximumMatvec',''); end tStart = toc; if mode == 1 nProdA = nProdA + 1; if explicit, z = A*x; else z = A(x,1); end elseif mode == 2 nProdAt = nProdAt + 1; if explicit, z = A'*x; else z = A(x,2); end else error('Wrong mode!'); end timeMatProd = timeMatProd + (toc - tStart); end % function Aprod %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function z = A2prod(x,mode) if (nProdA2 + nProdA2t >= maxMatvec) error('SPGL1:MaximumMatvec',''); end tStart = toc; if mode == 1 nProdA2 = nProdA2 + 1; if explicit, z = A2*x; else z = A2(x,1); end elseif mode == 2 nProdA2t = nProdA2t + 1; if explicit, z = A2'*x; else z = A2(x,2); end else error('Wrong mode!'); end timeMatProd = timeMatProd + (toc - tStart); end % function Aprod %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function printf(varargin) if logLevel > 0 fprintf(fid,varargin{:}); end end % function printf %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function x = project(x, tau) tStart = toc; x = options.project(x,weights,tau); timeProject = timeProject + (toc - tStart); end % function project %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % End of nested functions. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end % function spg %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % PRIVATE FUNCTIONS. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [nnzX,nnzG,nnzIdx,nnzDiff] = activeVars(x,g,nnzIdx,options) % Find the current active set. % nnzX is the number of nonzero x. % nnzG is the number of elements in nnzIdx. % nnzIdx is a vector of primal/dual indicators. % nnzDiff is the no. of elements that changed in the support. xTol = min(.1,10*options.optTol); gTol = min(.1,10*options.optTol); gNorm = options.dual_norm(g,options.weights); nnzOld = nnzIdx; % Reduced costs for postive & negative parts of x. z1 = gNorm + g; z2 = gNorm - g; % Primal/dual based indicators. xPos = x > xTol & z1 < gTol; %g < gTol;% xNeg = x < -xTol & z2 < gTol; %g > gTol;% nnzIdx = xPos | xNeg; % Count is based on simple primal indicator. nnzX = sum(abs(x) >= xTol); nnzG = sum(nnzIdx); if isempty(nnzOld) nnzDiff = inf; else nnzDiff = sum(nnzIdx ~= nnzOld); end end % function spgActiveVars %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function z = LSQRprod(Aprod,nnzIdx,ebar,n,dx,mode) % Matrix multiplication for subspace minimization. % Only called by LSQR. nbar = length(ebar); if mode == 1 y = zeros(n,1); y(nnzIdx) = dx - (1/nbar)*(ebar'*dx)*ebar; % y(nnzIdx) = Z*dx z = Aprod(y,1); % z = S Z dx else y = Aprod(dx,2); z = y(nnzIdx) - (1/nbar)*(ebar'*y(nnzIdx))*ebar; end end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [fNew,xNew,rNew,iter,err] = spgLine(f,x,d,gtd,fMax,Aprod,b) % Nonmonotone linesearch. EXIT_CONVERGED = 0; EXIT_ITERATIONS = 1; maxIts = 10; step = 1; iter = 0; gamma = 1e-4; gtd = -abs(gtd); % 03 Aug 07: If gtd is complex, % then should be looking at -abs(gtd). while 1 % Evaluate trial point and function value. xNew = x + step*d; rNew = b - Aprod(xNew,1); fNew = rNew'*rNew / 2; % Check exit conditions. if fNew < fMax + gamma*step*gtd % Sufficient descent condition. err = EXIT_CONVERGED; break elseif iter >= maxIts % Too many linesearch iterations. err = EXIT_ITERATIONS; break end % New linesearch iteration. iter = iter + 1; % Safeguarded quadratic interpolation. if step <= 0.1 step = step / 2; else tmp = (-gtd*step^2) / (2*(fNew-f-step*gtd)); if tmp < 0.1 || tmp > 0.9*step || isnan(tmp) tmp = step / 2; end step = tmp; end end % while 1 end % function spgLine %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [fNew,xNew,rNew,iter,step,err] = ... spgLineCurvy(x,g,fMax,Aprod,b,project,tau) % Projected backtracking linesearch. % On entry, % g is the (possibly scaled) steepest descent direction. EXIT_CONVERGED = 0; EXIT_ITERATIONS = 1; EXIT_NODESCENT = 2; gamma = 1e-4; maxIts = 10; step = 1; sNorm = 0; scale = 1; % Safeguard scaling. (See below.) nSafe = 0; % No. of safeguarding steps. iter = 0; debug = false; % Set to true to enable log. n = length(x); if debug fprintf(' %5s %13s %13s %13s %8s\n',... 'LSits','fNew','step','gts','scale'); end while 1 % Evaluate trial point and function value. xNew = project(x - step*scale*g, tau); rNew = b - Aprod(xNew,1); fNew = rNew'*rNew / 2; s = xNew - x; gts = scale * g' * s; if gts >= 0 % Should we check real and complex parts individually? err = EXIT_NODESCENT; break end if debug fprintf(' LS %2i %13.7e %13.7e %13.6e %8.1e\n',... iter,fNew,step,gts,scale); end % 03 Aug 07: If gts is complex, then should be looking at -abs(gts). if fNew < fMax - gamma*step*abs(gts) % Sufficient descent condition. err = EXIT_CONVERGED; break elseif iter >= maxIts % Too many linesearch iterations. err = EXIT_ITERATIONS; break end % New linesearch iteration. iter = iter + 1; step = step / 2; % Safeguard: If stepMax is huge, then even damped search % directions can give exactly the same point after projection. If % we observe this in adjacent iterations, we drastically damp the % next search direction. % 31 May 07: Damp consecutive safeguarding steps. sNormOld = sNorm; sNorm = norm(s) / sqrt(n); % if sNorm >= sNormOld if abs(sNorm - sNormOld) <= 1e-6 * sNorm gNorm = norm(g) / sqrt(n); scale = sNorm / gNorm / (2^nSafe); nSafe = nSafe + 1; end end % while 1 end % function spgLineCurvy
github
TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox-master
kernmatrix.m
.m
Predictor-Based-Subspace-IDentification-toolbox-master/private/kernmatrix.m
3,842
utf_8
f5ac9d877d0e03e735508333491c3fcb
function omega = kernmatrix(Xtrain,kernel_type,kernel_pars,Xt) %KERNMATRIX Construct the positive (semi-) definite and symmetric kernel matrix % % Omega = kernel_matrix(X, kernel_fct, sig2) % % This matrix should be positive definite if the kernel function % satisfies the Mercer condition. Construct the kernel values for % all test data points in the rows of Xt, relative to the points of X. % % Omega_Xt = kernel_matrix(X, kernel_fct, sig2, Xt) % % % Full syntax: % % Omega = kernel_matrix(X, kernel_fct, sig2) % Omega = kernel_matrix(X, kernel_fct, sig2, Xt) % % Outputs: % Omega : N x N (N x Nt) kernel matrix % Inputs: % X : N x d matrix with the inputs of the training data % kernel : Kernel type (by default 'RBF_kernel') % sig2 : Kernel parameter (bandwidth in the case of the 'RBF_kernel') % Xt(*) : Nt x d matrix with the inputs of the test data % Copyright (c) 2002, KULeuven-ESAT-SCD, % License & help @ http://www.esat.kuleuven.ac.be/sista/lssvmlab nb_data = size(Xtrain,1); if nb_data> 3000, error('Too memory intensive, the kernel matrix is restricted to size 3000 x 3000 '); end if strcmpi(kernel_type,'rbf'), if nargin<4, XXh = sum(Xtrain.^2,2)*ones(1,nb_data); omega = (XXh+XXh') - 2*(Xtrain*Xtrain'); omega = exp(-omega./kernel_pars(1)); else XXh1 = sum(Xtrain.^2,2)*ones(1,size(Xt,1)); XXh2 = sum(Xt.^2,2)*ones(1,nb_data); omega = XXh1+XXh2' - 2*Xtrain*Xt'; omega = exp(-omega./kernel_pars(1)); end else if nargin<4, omega = zeros(nb_data,nb_data); for i=1:nb_data, omega(i:end,i) = feval(lower(kernel_type),Xtrain(i,:),Xtrain(i:end,:),kernel_pars); omega(i,i:end) = omega(i:end,i)'; end else if size(Xt,2)~=size(Xtrain,2), error('dimension test data not equal to dimension traindata;'); end omega = zeros(nb_data, size(Xt,1)); for i=1:size(Xt,1), omega(:,i) = feval(lower(kernel_type),Xt(i,:),Xtrain,kernel_pars); end end end end function x = lin(a,b,c) % kernel function for implicit higher dimension mapping, based on % the standard inner-product % % x = lin_kernel(a,b) % % 'a' can only contain one datapoint in a row, 'b' can contain N % datapoints of the same dimension as 'a'. % % see also: % poly_kernel, RBF_kernel, MLP_kernel, trainlssvm, simlssvm % Copyright (c) 2002, KULeuven-ESAT-SCD, License & help @ http://www.esat.kuleuven.ac.be/sista/lssvmlab x = zeros(size(b,1),1); for i=1:size(b,1), x(i,1) = a*b(i,:)'; end end function x = poly(a,b,d) % polynomial kernel function for implicit higher dimension mapping % % X = poly_kernel(a,b,[t,degree]) % % 'a' can only contain one datapoint in a row, 'b' can contain N % datapoints of the same dimension as 'a'. % % x = (a*b'+t^2).^degree; % % see also: % RBF_kernel, lin_kernel, MLP_kernel, trainlssvm, simlssvm % % Copyright (c) 2002, KULeuven-ESAT-SCD, License & help @ http://www.esat.kuleuven.ac.be/sista/lssvmlab if length(d)>1, d=d(2); t=d(1); else d = d(1);t=1; end d = (abs(d)>=1)*abs(d)+(abs(d)<1); % >=1 !! x = zeros(size(b,1),1); for i=1:size(b,1), x(i,1) = (a*b(i,:)'+t^2).^d; end end function x = mlp(a,b, par) % Multi Layer Perceptron kernel function for implicit higher dimension mapping % % x = MLP_kernel(a,b,[s,t]) % % 'a' can only contain one datapoint in a row, 'b' can contain N % datapoints of the same dimension as 'a'. % % x = tanh(s*a'b+t^2) % % see also: % poly_kernel, lin_kernel, RBF_kernel, trainlssvm, simlssvm % Copyright (c) 2002, KULeuven-ESAT-SCD, License & help @ http://www.esat.kuleuven.ac.be/sista/lssvmlab if length(par)==1, par(2) = 1; end x = zeros(size(b,1),1); for i=1:size(b,1), dp = a*b(i,:)'; x(i,1) = tanh(par(1)*dp + par(2)^2); end end
github
TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox-master
ellipsebnd.m
.m
Predictor-Based-Subspace-IDentification-toolbox-master/private/ellipsebnd.m
8,035
utf_8
888067d692a8d486bbb999fcfaa52bf7
function h=ellipsebnd(varargin) % ELLIPSEBND - plot an error ellipse, or ellipsoid, defining confidence region % ELLIPSEBND(C22) - Given a 2x2 covariance matrix, plot the % associated error ellipse, at the origin. It returns a graphics handle % of the ellipse that was drawn. % % ELLIPSEBND(C33) - Given a 3x3 covariance matrix, plot the % associated error ellipsoid, at the origin, as well as its projections % onto the three axes. Returns a vector of 4 graphics handles, for the % three ellipses (in the X-Y, Y-Z, and Z-X planes, respectively) and for % the ellipsoid. % % ELLIPSEBND(C,MU) - Plot the ellipse, or ellipsoid, centered at MU, % a vector whose length should match that of C (which is 2x2 or 3x3). % % ELLIPSEBND(...,'Property1',Value1,'Name2',Value2,...) sets the % values of specified properties, including: % 'C' - Alternate method of specifying the covariance matrix % 'mu' - Alternate method of specifying the ellipse (-oid) center % 'conf' - A value betwen 0 and 1 specifying the confidence interval. % the default is 0.5 which is the 50% error ellipse. % 'scale' - Allow the plot the be scaled to difference units. % 'style' - A plotting style used to format ellipses. % 'clip' - specifies a clipping radius. Portions of the ellipse, -oid, % outside the radius will not be shown. % % NOTES: C must be positive definite for this function to work properly. default_properties = struct(... 'C', [], ... % The covaraince matrix (required) 'mu', [], ... % Center of ellipse (optional) 'conf', 0.5, ... % Percent confidence/100 'scale', 1, ... % Scale factor, e.g. 1e-3 to plot m as km 'style', '', ... % Plot style 'clip', inf); % Clipping radius if length(varargin) >= 1 && isnumeric(varargin{1}) default_properties.C = varargin{1}; varargin(1) = []; end if length(varargin) >= 1 && isnumeric(varargin{1}) default_properties.mu = varargin{1}; varargin(1) = []; end if length(varargin) >= 1 && isnumeric(varargin{1}) default_properties.conf = varargin{1}; varargin(1) = []; end if length(varargin) >= 1 && isnumeric(varargin{1}) default_properties.scale = varargin{1}; varargin(1) = []; end if length(varargin) >= 1 && ~ischar(varargin{1}) error('Invalid parameter/value pair arguments.') end prop = getopt(default_properties, varargin{:}); C = prop.C; if isempty(prop.mu) mu = zeros(length(C),1); else mu = prop.mu; end conf = prop.conf; scale = prop.scale; style = prop.style; if conf <= 0 || conf >= 1 error('conf parameter must be in range 0 to 1, exclusive') end [r,c] = size(C); if r ~= c || (r ~= 2 && r ~= 3) error(['Don''t know what to do with ',num2str(r),'x',num2str(c),' matrix']) end x0=mu(1); y0=mu(2); % Compute quantile for the desired percentile k = sqrt(qchisq(conf,r)); % r is the number of dimensions (degrees of freedom) hold_state = get(gca,'nextplot'); if r==3 && c==3 z0=mu(3); % Make the matrix has positive eigenvalues - else it's not a valid covariance matrix! if any(eig(C) <=0) error('The covariance matrix must be positive definite (it has non-positive eigenvalues)') end % C is 3x3; extract the 2x2 matricies, and plot the associated error % ellipses. They are drawn in space, around the ellipsoid; it may be % preferable to draw them on the axes. Cxy = C(1:2,1:2); Cyz = C(2:3,2:3); Czx = C([3 1],[3 1]); [x,y,z] = getpoints(Cxy,prop.clip); h1=plot3(x0+k*x,y0+k*y,z0+k*z,prop.style);hold on [y,z,x] = getpoints(Cyz,prop.clip); h2=plot3(x0+k*x,y0+k*y,z0+k*z,prop.style);hold on [z,x,y] = getpoints(Czx,prop.clip); h3=plot3(x0+k*x,y0+k*y,z0+k*z,prop.style);hold on [eigvec,eigval] = eig(C); [X,Y,Z] = ellipsoid(0,0,0,1,1,1); XYZ = [X(:),Y(:),Z(:)]*sqrt(eigval)*eigvec'; X(:) = scale*(k*XYZ(:,1)+x0); Y(:) = scale*(k*XYZ(:,2)+y0); Z(:) = scale*(k*XYZ(:,3)+z0); h4=surf(X,Y,Z); colormap gray alpha(0.3) camlight if nargout h=[h1 h2 h3 h4]; end elseif r==2 && c==2 % Make the matrix has positive eigenvalues - else it's not a valid covariance matrix! if any(eig(C) <=0) error('The covariance matrix must be positive definite (it has non-positive eigenvalues)') end [x,y,z] = getpoints(C,prop.clip); h1=plot(scale*(x0+k*x),scale*(y0+k*y),prop.style); set(h1,'zdata',z+1) if nargout h=h1; end else error('C (covaraince matrix) must be specified as a 2x2 or 3x3 matrix)') end %axis equal set(gca,'nextplot',hold_state); end % getpoints - Generate x and y points that define an ellipse, given a 2x2 % covariance matrix, C. z, if requested, is all zeros with same shape as % x and y. function [x,y,z] = getpoints(C,clipping_radius) n=100; % Number of points around ellipse p=0:pi/n:2*pi; % angles around a circle [eigvec,eigval] = eig(C); % Compute eigen-stuff xy = [cos(p'),sin(p')] * sqrt(eigval) * eigvec'; % Transformation x = xy(:,1); y = xy(:,2); z = zeros(size(x)); % Clip data to a bounding radius if nargin >= 2 r = sqrt(sum(xy.^2,2)); % Euclidian distance (distance from center) x(r > clipping_radius) = nan; y(r > clipping_radius) = nan; z(r > clipping_radius) = nan; end end function x=qchisq(P,n) % QCHISQ(P,N) - quantile of the chi-square distribution. if nargin<2 n=1; end s0 = P==0; s1 = P==1; s = P>0 & P<1; x = 0.5*ones(size(P)); x(s0) = -inf; x(s1) = inf; x(~(s0|s1|s))=nan; for ii=1:14 dx = -(pchisq(x(s),n)-P(s))./dchisq(x(s),n); x(s) = x(s)+dx; if all(abs(dx) < 1e-6) break; end end end function F=pchisq(x,n) % PCHISQ(X,N) - Probability function of the chi-square distribution. if nargin<2 n=1; end F=zeros(size(x)); if rem(n,2) == 0 s = x>0; k = 0; for jj = 0:n/2-1; k = k + (x(s)/2).^jj/factorial(jj); end F(s) = 1-exp(-x(s)/2).*k; else for ii=1:numel(x) if x(ii) > 0 F(ii) = quadl(@dchisq,0,x(ii),1e-6,0,n); else F(ii) = 0; end end end end function f=dchisq(x,n) % DCHISQ(X,N) - Density function of the chi-square distribution. if nargin<2 n=1; end f=zeros(size(x)); s = x>=0; f(s) = x(s).^(n/2-1).*exp(-x(s)/2)./(2^(n/2)*gamma(n/2)); end function properties = getopt(properties,varargin) %GETOPT - Process paired optional arguments as 'prop1',val1,'prop2',val2,... % % getopt(properties,varargin) returns a modified properties structure, % given an initial properties structure, and a list of paired arguments. % Each argumnet pair should be of the form property_name,val where % property_name is the name of one of the field in properties, and val is % the value to be assigned to that structure field. % % No validation of the values is performed. % % EXAMPLE: % properties = struct('zoom',1.0,'aspect',1.0,'gamma',1.0,'file',[],'bg',[]); % properties = getopt(properties,'aspect',0.76,'file','mydata.dat') % would return: % properties = % zoom: 1 % aspect: 0.7600 % gamma: 1 % file: 'mydata.dat' % bg: [] % % Typical usage in a function: % properties = getopt(properties,varargin{:}) % Process the properties (optional input arguments) prop_names = fieldnames(properties); TargetField = []; for ii=1:length(varargin) arg = varargin{ii}; if isempty(TargetField) if ~ischar(arg) error('Propery names must be character strings'); end f = find(strcmp(prop_names, arg)); if length(f) == 0 error('%s ',['invalid property ''',arg,'''; must be one of:'],prop_names{:}); end TargetField = arg; else % properties.(TargetField) = arg; % Ver 6.5 and later only properties = setfield(properties, TargetField, arg); % Ver 6.1 friendly TargetField = ''; end end if ~isempty(TargetField) error('Property names and values must be specified in pairs.'); end end
github
TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox-master
reggcv.m
.m
Predictor-Based-Subspace-IDentification-toolbox-master/private/reggcv.m
4,183
utf_8
96e102b790fbfa5f01c26445d60a36fc
function reg_min=reggcv(Y,Vn,Sn,method,show) %REGGCV Compute regularization using generalized cross validation. % Determine the regularization parameter for ordkernel % using Generalized Cross-Validation (GCV). It plots the % GCV function as a function of the regularization % parameter and finds its minimum. % % Syntax: % reg=reggcv(Y,V,S) % reg=reggcv(Y,V,S,method,show) % % Input: % Y,V,S Data matrices from lpvkernel or bilkernel. % method Regularization method to be used. % 'Tikh' - Tikhonov regularization (default). % 'tsvd' - Truncated singular value decomposition. % show Display intermediate steps of the algorithm. % % Output: % reg Regularization paramater for the kernel % subspace identification method of ordkernel. % Written by Vincent Verdult, May 2004. % Based on Regularization Tools by P. C. Hansen % default method if nargin<4 method='Tikh'; end if nargin<5 show=0; end if size(Y,1)~=size(Vn,1) error('The number of rows in Y must equal the number of rows in V.') end if size(Vn,1)~=size(Vn,2) error('V must be a square matrix.') end if size(Sn,2)~=1 error('S must be a column vector.') end if size(Vn,1)~=size(Sn,1) error('The number of rows in S must equal the number of rows in V.') end % Initialization. N = size(Sn,1); beta = Vn'*Y; % Tikhonov regularization if (strncmp(method,'Tikh',4) || strncmp(method,'tikh',4)) npoints = 200; % Number of points on the curve. smin_ratio = 16*eps; % Smallest regularization parameter. reg_param = zeros(npoints,1); G = zeros(npoints,1); s = sqrt(Sn); reg_param(npoints) = max([s(N),s(1)*smin_ratio]); ratio = (s(1)/reg_param(npoints))^(1/(npoints-1)); for i=npoints-1:-1:1 reg_param(i) = ratio*reg_param(i+1); end if show==1 disp('Calculating GCV curve.') end % Vector of GCV-function values. for i=1:npoints G(i) = reggcvfun(reg_param(i),Sn,beta); end % Plot GCV function. if show==1 loglog(reg_param,G,'-'), xlabel('\lambda'), ylabel('G(\lambda)') title('GCV function') end % Find minimum if show==1 disp('Searching GCV minimum') OPT=optimset('Display','iter'); else OPT=optimset('Display','off'); end [minG,minGi] = min(G); % Initial guess. reg_min = fminbnd(@reggcvfun,... reg_param(min(minGi+1,npoints)),... reg_param(max(minGi-1,1)),OPT,Sn,beta); % Minimizer. minG = reggcvfun(reg_min,Sn,beta); % Minimum of GCV function. if show==1 ax = axis; HoldState = ishold; hold on; loglog(reg_min,minG,'*r',[reg_min,reg_min],[minG/1000,minG],':r') title(['GCV function, minimum at \lambda = ',num2str(reg_min)]) axis(ax) if (~HoldState) hold off end end % Truncated SVD elseif (strncmp(method,'tsvd',4) || strncmp(method,'TSVD',4)) rho=zeros(1,N-1); G=zeros(1,N-1); rho(N-1) = sum(beta(N,:).^2); G(N-1) = rho(N-1); for k=N-2:-1:1 rho(k) = rho(k+1) + sum(beta(k+1,:).^2); G(k) = rho(k)/((N - k)^2); end reg_param = (1:N-1)'; % Plot GCV function. if show==1 semilogy(reg_param,G,'o'), xlabel('k'), ylabel('G(k)') title('GCV function') end % Find minimum [minG,reg_min] = min(G); if show==1 ax = axis; HoldState = ishold; hold on; semilogy(reg_min,minG,'*r',[reg_min,reg_min],[minG/1000,minG],':r') title(['GCV function, minimum at k = ',num2str(reg_min)]) axis(ax); if (~HoldState) hold off end end else error('Illegal method.') end end function G=reggcvfun(lam,s2,beta) % reggcvfun Computes GCV function for reggcv. % Auxiliary function for reggcv. % % Written by Vincent Verdult, May 2004. % Based on Regularization Tools by P. C. Hansen f=lam^2./(s2+lam^2); G=norm((f*ones(1,size(beta,2))).*beta,'fro')^2/(sum(f)^2); end
github
TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox-master
jacobianest.m
.m
Predictor-Based-Subspace-IDentification-toolbox-master/private/jacobianest.m
5,842
utf_8
46460a027f39b6c92c0f0b818d2e1721
function [jac,err] = jacobianest(fun,x0) % gradest: estimate of the Jacobian matrix of a vector valued function of n variables % usage: [jac,err] = jacobianest(fun,x0) % % % arguments: (input) % fun - (vector valued) analytical function to differentiate. % fun must be a function of the vector or array x0. % % x0 - vector location at which to differentiate fun % If x0 is an nxm array, then fun is assumed to be % a function of n*m variables. % % % arguments: (output) % jac - array of first partial derivatives of fun. % Assuming that x0 is a vector of length p % and fun returns a vector of length n, then % jac will be an array of size (n,p) % % err - vector of error estimates corresponding to % each partial derivative in jac. % % % Example: (nonlinear least squares) % xdata = (0:.1:1)'; % ydata = 1+2*exp(0.75*xdata); % fun = @(c) ((c(1)+c(2)*exp(c(3)*xdata)) - ydata).^2; % % [jac,err] = jacobianest(fun,[1 1 1]) % % jac = % -2 -2 0 % -2.1012 -2.3222 -0.23222 % -2.2045 -2.6926 -0.53852 % -2.3096 -3.1176 -0.93528 % -2.4158 -3.6039 -1.4416 % -2.5225 -4.1589 -2.0795 % -2.629 -4.7904 -2.8742 % -2.7343 -5.5063 -3.8544 % -2.8374 -6.3147 -5.0518 % -2.9369 -7.2237 -6.5013 % -3.0314 -8.2403 -8.2403 % % err = % 5.0134e-15 5.0134e-15 0 % 5.0134e-15 0 2.8211e-14 % 5.0134e-15 8.6834e-15 1.5804e-14 % 0 7.09e-15 3.8227e-13 % 5.0134e-15 5.0134e-15 7.5201e-15 % 5.0134e-15 1.0027e-14 2.9233e-14 % 5.0134e-15 0 6.0585e-13 % 5.0134e-15 1.0027e-14 7.2673e-13 % 5.0134e-15 1.0027e-14 3.0495e-13 % 5.0134e-15 1.0027e-14 3.1707e-14 % 5.0134e-15 2.0053e-14 1.4013e-12 % % (At [1 2 0.75], jac should be numerically zero) % % % See also: derivest, gradient, gradest % % % Author: John D'Errico % e-mail: [email protected] % Release: 1.0 % Release date: 3/6/2007 % get the length of x0 for the size of jac nx = numel(x0); MaxStep = 100; StepRatio = 2; % was a string supplied? if ischar(fun) fun = str2func(fun); end % get fun at the center point f0 = fun(x0); f0 = f0(:); n = length(f0); if n==0 % empty begets empty jac = zeros(0,nx); err = jac; return end relativedelta = MaxStep*StepRatio .^(0:-1:-25); nsteps = length(relativedelta); % total number of derivatives we will need to take jac = zeros(n,nx); err = jac; for i = 1:nx x0_i = x0(i); if x0_i ~= 0 delta = x0_i*relativedelta; else delta = relativedelta; end % evaluate at each step, centered around x0_i % difference to give a second order estimate fdel = zeros(n,nsteps); for j = 1:nsteps fdif = fun(swapelement(x0,i,x0_i + delta(j))) - ... fun(swapelement(x0,i,x0_i - delta(j))); fdel(:,j) = fdif(:); end % these are pure second order estimates of the % first derivative, for each trial delta. derest = fdel.*repmat(0.5 ./ delta,n,1); % The error term on these estimates has a second order % component, but also some 4th and 6th order terms in it. % Use Romberg exrapolation to improve the estimates to % 6th order, as well as to provide the error estimate. % loop here, as rombextrap coupled with the trimming % will get complicated otherwise. for j = 1:n [der_romb,errest] = rombextrap(StepRatio,derest(j,:),[2 4]); % trim off 3 estimates at each end of the scale nest = length(der_romb); trim = [1:3, nest+(-2:0)]; [der_romb,tags] = sort(der_romb); der_romb(trim) = []; tags(trim) = []; errest = errest(tags); % now pick the estimate with the lowest predicted error [err(j,i),ind] = min(errest); jac(j,i) = der_romb(ind); end end end % mainline function end % ======================================= % sub-functions % ======================================= function vec = swapelement(vec,ind,val) % swaps val as element ind, into the vector vec vec(ind) = val; end % sub-function end % ============================================ % subfunction - romberg extrapolation % ============================================ function [der_romb,errest] = rombextrap(StepRatio,der_init,rombexpon) % do romberg extrapolation for each estimate % % StepRatio - Ratio decrease in step % der_init - initial derivative estimates % rombexpon - higher order terms to cancel using the romberg step % % der_romb - derivative estimates returned % errest - error estimates % amp - noise amplification factor due to the romberg step srinv = 1/StepRatio; % do nothing if no romberg terms nexpon = length(rombexpon); rmat = ones(nexpon+2,nexpon+1); % two romberg terms rmat(2,2:3) = srinv.^rombexpon; rmat(3,2:3) = srinv.^(2*rombexpon); rmat(4,2:3) = srinv.^(3*rombexpon); % qr factorization used for the extrapolation as well % as the uncertainty estimates [qromb,rromb] = qr(rmat,0); % the noise amplification is further amplified by the Romberg step. % amp = cond(rromb); % this does the extrapolation to a zero step size. ne = length(der_init); rhs = vec2mat(der_init,nexpon+2,ne - (nexpon+2)); rombcoefs = rromb\(qromb'*rhs); der_romb = rombcoefs(1,:)'; % uncertainty estimate of derivative prediction s = sqrt(sum((rhs - rmat*rombcoefs).^2,1)); rinv = rromb\eye(nexpon+1); cov1 = sum(rinv.^2,2); % 1 spare dof errest = s'*12.7062047361747*sqrt(cov1(1)); end % rombextrap % ============================================ % subfunction - vec2mat % ============================================ function mat = vec2mat(vec,n,m) % forms the matrix M, such that M(i,j) = vec(i+j-1) [i,j] = ndgrid(1:n,0:m-1); ind = i+j; mat = vec(ind); if n==1 mat = mat'; end end % vec2mat
github
TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox-master
spgl1.m
.m
Predictor-Based-Subspace-IDentification-toolbox-master/private/spgl1.m
30,253
utf_8
03d7576dbae19e8aa54fe160c192f10a
function [x,r,g,info] = spgl1( A, b, tau, sigma, x, options ) %SPGL1 Solve basis pursuit, basis pursuit denoise, and LASSO % % [x, r, g, info] = spgl1(A, b, tau, sigma, x0, options) % % --------------------------------------------------------------------- % Solve the basis pursuit denoise (BPDN) problem % % (BPDN) minimize ||x||_1 subj to ||Ax-b||_2 <= sigma, % % or the l1-regularized least-squares problem % % (LASSO) minimize ||Ax-b||_2 subj to ||x||_1 <= tau. % --------------------------------------------------------------------- % % INPUTS % ====== % A is an m-by-n matrix, explicit or an operator. % If A is a function, then it must have the signature % % y = A(x,mode) if mode == 1 then y = A x (y is m-by-1); % if mode == 2 then y = A'x (y is n-by-1). % % b is an m-vector. % tau is a nonnegative scalar; see (LASSO). % sigma if sigma != inf or != [], then spgl1 will launch into a % root-finding mode to find the tau above that solves (BPDN). % In this case, it's STRONGLY recommended that tau = 0. % x0 is an n-vector estimate of the solution (possibly all % zeros). If x0 = [], then SPGL1 determines the length n via % n = length( A'b ) and sets x0 = zeros(n,1). % options is a structure of options from spgSetParms. Any unset options % are set to their default value; set options=[] to use all % default values. % % OUTPUTS % ======= % x is a solution of the problem % r is the residual, r = b - Ax % g is the gradient, g = -A'r % info is a structure with the following information: % .tau final value of tau (see sigma above) % .rNorm two-norm of the optimal residual % .rGap relative duality gap (an optimality measure) % .gNorm Lagrange multiplier of (LASSO) % .stat = 1 found a BPDN solution % = 2 found a BP sol'n; exit based on small gradient % = 3 found a BP sol'n; exit based on small residual % = 4 found a LASSO solution % = 5 error: too many iterations % = 6 error: linesearch failed % = 7 error: found suboptimal BP solution % = 8 error: too many matrix-vector products % .time total solution time (seconds) % .nProdA number of multiplications with A % .nProdAt number of multiplications with A' % % OPTIONS % ======= % Use the options structure to control various aspects of the algorithm: % % options.fid File ID to direct log output % .verbosity 0=quiet, 1=some output, 2=more output. % .iterations Max. number of iterations (default if 10*m). % .bpTol Tolerance for identifying a basis pursuit solution. % .optTol Optimality tolerance (default is 1e-4). % .decTol Larger decTol means more frequent Newton updates. % .subspaceMin 0=no subspace minimization, 1=subspace minimization. % % EXAMPLE % ======= % m = 120; n = 512; k = 20; % m rows, n cols, k nonzeros. % p = randperm(n); x0 = zeros(n,1); x0(p(1:k)) = sign(randn(k,1)); % A = randn(m,n); [Q,R] = qr(A',0); A = Q'; % b = A*x0 + 0.005 * randn(m,1); % opts = spgSetParms('optTol',1e-4); % [x,r,g,info] = spgl1(A, b, 0, 1e-3, [], opts); % Find BP sol'n. % % AUTHORS % ======= % Ewout van den Berg ([email protected]) % Michael P. Friedlander ([email protected]) % Scientific Computing Laboratory (SCL) % University of British Columbia, Canada. % % BUGS % ==== % Please send bug reports or comments to % Michael P. Friedlander ([email protected]) % Ewout van den Berg ([email protected]) % 15 Apr 07: First version derived from spg.m. % Michael P. Friedlander ([email protected]). % Ewout van den Berg ([email protected]). % 17 Apr 07: Added root-finding code. % 18 Apr 07: sigma was being compared to 1/2 r'r, rather than % norm(r), as advertised. Now immediately change sigma to % (1/2)sigma^2, and changed log output accordingly. % 24 Apr 07: Added quadratic root-finding code as an option. % 24 Apr 07: Exit conditions need to guard against small ||r|| % (ie, a BP solution). Added test1,test2,test3 below. % 15 May 07: Trigger to update tau is now based on relative difference % in objective between consecutive iterations. % 15 Jul 07: Added code to allow a limited number of line-search % errors. % 23 Feb 08: Fixed bug in one-norm projection using weights. Thanks % to Xiangrui Meng for reporting this bug. % 26 May 08: The simple call spgl1(A,b) now solves (BPDN) with sigma=0. % spgl1.m % $Id: spgl1.m 1225 2009-01-30 20:36:31Z ewout78 $ % % ---------------------------------------------------------------------- % This file is part of SPGL1 (Spectral Projected-Gradient for L1). % % Copyright (C) 2007 Ewout van den Berg and Michael P. Friedlander, % Department of Computer Science, University of British Columbia, Canada. % All rights reserved. E-mail: <{ewout78,mpf}@cs.ubc.ca>. % % SPGL1 is free software; you can redistribute it and/or modify it % under the terms of the GNU Lesser General Public License as % published by the Free Software Foundation; either version 2.1 of the % License, or (at your option) any later version. % % SPGL1 is distributed in the hope that it will be useful, but WITHOUT % ANY WARRANTY; without even the implied warranty of MERCHANTABILITY % or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General % Public License for more details. % % You should have received a copy of the GNU Lesser General Public % License along with SPGL1; if not, write to the Free Software % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 % USA % ---------------------------------------------------------------------- REVISION = '$Revision: 1017 $'; DATE = '$Date: 2008-06-16 22:43:07 -0700 (Mon, 16 Jun 2008) $'; REVISION = REVISION(11:end-1); DATE = DATE(35:50); tic; % Start your watches! m = length(b); %---------------------------------------------------------------------- % Check arguments. %---------------------------------------------------------------------- if ~exist('options','var'), options = []; end if ~exist('x','var'), x = []; end if ~exist('sigma','var'), sigma = []; end if ~exist('tau','var'), tau = []; end if nargin < 2 || isempty(b) || isempty(A) error('At least two arguments are required'); elseif isempty(tau) && isempty(sigma) tau = 0; sigma = 0; singleTau = false; elseif isempty(sigma) % && ~isempty(tau) <-- implied singleTau = true; else if isempty(tau) tau = 0; end singleTau = false; end %---------------------------------------------------------------------- % Grab input options and set defaults where needed. %---------------------------------------------------------------------- defaultopts = spgSetParms(... 'fid' , 1 , ... % File ID for output 'verbosity' , 2 , ... % Verbosity level 'iterations' , 10*m , ... % Max number of iterations 'nPrevVals' , 3 , ... % Number previous func values for linesearch 'bpTol' , 1e-06 , ... % Tolerance for basis pursuit solution 'optTol' , 1e-04 , ... % Optimality tolerance 'decTol' , 1e-04 , ... % Req'd rel. change in primal obj. for Newton 'stepMin' , 1e-16 , ... % Minimum spectral step 'stepMax' , 1e+05 , ... % Maximum spectral step 'rootMethod' , 2 , ... % Root finding method: 2=quad,1=linear (not used). 'activeSetIt', Inf , ... % Exit with EXIT_ACTIVE_SET if nnz same for # its. 'subspaceMin', 0 , ... % Use subspace minimization 'iscomplex' , NaN , ... % Flag set to indicate complex problem 'maxMatvec' , Inf , ... % Maximum matrix-vector multiplies allowed 'weights' , 1 , ... % Weights W in ||Wx||_1 'project' , @NormL1_project , ... 'primal_norm', @NormL1_primal , ... 'dual_norm' , @NormL1_dual ... ); options = spgSetParms(defaultopts, options); fid = options.fid; logLevel = options.verbosity; maxIts = options.iterations; nPrevVals = options.nPrevVals; bpTol = options.bpTol; optTol = options.optTol; decTol = options.decTol; stepMin = options.stepMin; stepMax = options.stepMax; activeSetIt = options.activeSetIt; subspaceMin = options.subspaceMin; maxMatvec = max(3,options.maxMatvec); weights = options.weights; maxLineErrors = 10; % Maximum number of line-search failures. pivTol = 1e-12; % Threshold for significant Newton step. %---------------------------------------------------------------------- % Initialize local variables. %---------------------------------------------------------------------- iter = 0; itnTotLSQR = 0; % Total SPGL1 and LSQR iterations. nProdA = 0; nProdAt = 0; lastFv = -inf(nPrevVals,1); % Last m function values. nLineTot = 0; % Total no. of linesearch steps. printTau = false; nNewton = 0; bNorm = norm(b,2); stat = false; timeProject = 0; timeMatProd = 0; nnzIter = 0; % No. of its with fixed pattern. nnzIdx = []; % Active-set indicator. subspace = false; % Flag if did subspace min in current itn. stepG = 1; % Step length for projected gradient. testUpdateTau = 0; % Previous step did not update tau % Determine initial x, vector length n, and see if problem is complex explicit = ~(isa(A,'function_handle')); if isempty(x) if isnumeric(A) n = size(A,2); realx = isreal(A) && isreal(b); else x = Aprod(b,2); n = length(x); realx = isreal(x) && isreal(b); end x = zeros(n,1); else n = length(x); realx = isreal(x) && isreal(b); end if isnumeric(A), realx = realx && isreal(A); end; % Override options when options.iscomplex flag is set if (~isnan(options.iscomplex)), realx = (options.iscomplex == 0); end % Check if all weights (if any) are strictly positive. In previous % versions we also checked if the number of weights was equal to % n. In the case of multiple measurement vectors, this no longer % needs to apply, so the check was removed. if ~isempty(weights) if any(~isfinite(weights)) error('Entries in options.weights must be finite'); end if any(weights <= 0) error('Entries in options.weights must be strictly positive'); end else weights = 1; end % Quick exit if sigma >= ||b||. Set tau = 0 to short-circuit the loop. if bNorm <= sigma printf('W: sigma >= ||b||. Exact solution is x = 0.\n'); tau = 0; singleTau = true; end % Don't do subspace minimization if x is complex. if ~realx && subspaceMin printf('W: Subspace minimization disabled when variables are complex.\n'); subspaceMin = false; end % Pre-allocate iteration info vectors xNorm1 = zeros(min(maxIts,10000),1); rNorm2 = zeros(min(maxIts,10000),1); lambda = zeros(min(maxIts,10000),1); % Exit conditions (constants). EXIT_ROOT_FOUND = 1; EXIT_BPSOL1_FOUND = 2; EXIT_BPSOL2_FOUND = 3; EXIT_OPTIMAL = 4; EXIT_ITERATIONS = 5; EXIT_LINE_ERROR = 6; EXIT_SUBOPTIMAL_BP = 7; EXIT_MATVEC_LIMIT = 8; EXIT_ACTIVE_SET = 9; % [sic] %---------------------------------------------------------------------- % Log header. %---------------------------------------------------------------------- printf('\n'); printf(' %s\n',repmat('=',1,80)); printf(' SPGL1 v.%s (%s)\n', REVISION, DATE); printf(' %s\n',repmat('=',1,80)); printf(' %-22s: %8i %4s' ,'No. rows' ,m ,''); printf(' %-22s: %8i\n' ,'No. columns' ,n ); printf(' %-22s: %8.2e %4s' ,'Initial tau' ,tau ,''); printf(' %-22s: %8.2e\n' ,'Two-norm of b' ,bNorm ); printf(' %-22s: %8.2e %4s' ,'Optimality tol' ,optTol ,''); if singleTau printf(' %-22s: %8.2e\n' ,'Target one-norm of x' ,tau ); else printf(' %-22s: %8.2e\n','Target objective' ,sigma ); end printf(' %-22s: %8.2e %4s' ,'Basis pursuit tol' ,bpTol ,''); printf(' %-22s: %8i\n' ,'Maximum iterations',maxIts ); printf('\n'); if singleTau logB = ' %5i %13.7e %13.7e %9.2e %6.1f %6i %6i'; logH = ' %5s %13s %13s %9s %6s %6s %6s\n'; printf(logH,'Iter','Objective','Relative Gap','gNorm','stepG','nnzX','nnzG'); else logB = ' %5i %13.7e %13.7e %9.2e %9.3e %6.1f %6i %6i'; logH = ' %5s %13s %13s %9s %9s %6s %6s %6s %13s\n'; printf(logH,'Iter','Objective','Relative Gap','Rel Error',... 'gNorm','stepG','nnzX','nnzG','tau'); end % Project the starting point and evaluate function and gradient. x = project(x,tau); r = b - Aprod(x,1); % r = b - Ax g = - Aprod(r,2); % g = -A'r f = r'*r / 2; % Required for nonmonotone strategy. lastFv(1) = f; fBest = f; xBest = x; fOld = f; % Compute projected gradient direction and initial steplength. dx = project(x - g, tau) - x; dxNorm = norm(dx,inf); if dxNorm < (1 / stepMax) gStep = stepMax; else gStep = min( stepMax, max(stepMin, 1/dxNorm) ); end %---------------------------------------------------------------------- % MAIN LOOP. %---------------------------------------------------------------------- while 1 %------------------------------------------------------------------ % Test exit conditions. %------------------------------------------------------------------ % Compute quantities needed for log and exit conditions. gNorm = options.dual_norm(-g,weights); rNorm = norm(r, 2); gap = r'*(r-b) + tau*gNorm; rGap = abs(gap) / max(1,f); aError1 = rNorm - sigma; aError2 = f - sigma^2 / 2; rError1 = abs(aError1) / max(1,rNorm); rError2 = abs(aError2) / max(1,f); % Count number of consecutive iterations with identical support. nnzOld = nnzIdx; [nnzX,nnzG,nnzIdx,nnzDiff] = activeVars(x,g,nnzIdx,options); if nnzDiff nnzIter = 0; else nnzIter = nnzIter + 1; if nnzIter >= activeSetIt, stat=EXIT_ACTIVE_SET; end end % Single tau: Check if we're optimal. % The 2nd condition is there to guard against large tau. if singleTau if rGap <= optTol || rNorm < optTol*bNorm stat = EXIT_OPTIMAL; end % Multiple tau: Check if found root and/or if tau needs updating. else if rGap <= max(optTol, rError2) || rError1 <= optTol % The problem is nearly optimal for the current tau. % Check optimality of the current root. test1 = rNorm <= bpTol * bNorm; test2 = gNorm <= bpTol * rNorm; test3 = rError1 <= optTol; test4 = rNorm <= sigma; if test4, stat=EXIT_SUBOPTIMAL_BP;end % Found suboptimal BP sol. if test3, stat=EXIT_ROOT_FOUND; end % Found approx root. if test2, stat=EXIT_BPSOL2_FOUND; end % Gradient zero -> BP sol. if test1, stat=EXIT_BPSOL1_FOUND; end % Resid minim'zd -> BP sol. end testRelChange1 = (abs(f - fOld) <= decTol * f); testRelChange2 = (abs(f - fOld) <= 1e-1 * f * (abs(rNorm - sigma))); testUpdateTau = ((testRelChange1 && rNorm > 2 * sigma) || ... (testRelChange2 && rNorm <= 2 * sigma)) && ... ~stat && ~testUpdateTau; if testUpdateTau % Update tau. tauOld = tau; tau = max(0,tau + (rNorm * aError1) / gNorm); nNewton = nNewton + 1; printTau = abs(tauOld - tau) >= 1e-6 * tau; % For log only. if tau < tauOld % The one-norm ball has decreased. Need to make sure that the % next iterate if feasible, which we do by projecting it. x = project(x,tau); end end end % Too many its and not converged. if ~stat && iter >= maxIts stat = EXIT_ITERATIONS; end %------------------------------------------------------------------ % Print log, update history and act on exit conditions. %------------------------------------------------------------------ if logLevel >= 2 || singleTau || printTau || iter == 0 || stat tauFlag = ' '; subFlag = ''; if printTau, tauFlag = sprintf(' %13.7e',tau); end if subspace, subFlag = sprintf(' S %2i',itnLSQR); end if singleTau printf(logB,iter,rNorm,rGap,gNorm,log10(stepG),nnzX,nnzG); if subspace printf(' %s',subFlag); end else printf(logB,iter,rNorm,rGap,rError1,gNorm,log10(stepG),nnzX,nnzG); if printTau || subspace printf(' %s',[tauFlag subFlag]); end end printf('\n'); end printTau = false; subspace = false; % Update history info xNorm1(iter+1) = options.primal_norm(x,weights); rNorm2(iter+1) = rNorm; lambda(iter+1) = gNorm; if stat, break; end % Act on exit conditions. %================================================================== % Iterations begin here. %================================================================== iter = iter + 1; xOld = x; fOld = f; gOld = g; rOld = r; try %--------------------------------------------------------------- % Projected gradient step and linesearch. %--------------------------------------------------------------- [f,x,r,nLine,stepG,lnErr] = ... spgLineCurvy(x,gStep*g,max(lastFv),@Aprod,b,@project,tau); nLineTot = nLineTot + nLine; if lnErr % Projected backtrack failed. Retry with feasible dir'n linesearch. x = xOld; dx = project(x - gStep*g, tau) - x; gtd = g'*dx; [f,x,r,nLine,lnErr] = spgLine(f,x,dx,gtd,max(lastFv),@Aprod,b); nLineTot = nLineTot + nLine; end if lnErr % Failed again. Revert to previous iterates and damp max BB step. if maxLineErrors <= 0 stat = EXIT_LINE_ERROR; else stepMax = stepMax / 10; printf(['W: Linesearch failed with error %i. '... 'Damping max BB scaling to %6.1e.\n'],lnErr,stepMax); maxLineErrors = maxLineErrors - 1; end end %--------------------------------------------------------------- % Subspace minimization (only if active-set change is small). %--------------------------------------------------------------- doSubspaceMin = false; if subspaceMin g = - Aprod(r,2); [nnzX,nnzG,nnzIdx,nnzDiff] = activeVars(x,g,nnzOld,options); if ~nnzDiff if nnzX == nnzG, itnMaxLSQR = 20; else itnMaxLSQR = 5; end nnzIdx = abs(x) >= optTol; doSubspaceMin = true; end end if doSubspaceMin % LSQR parameters damp = 1e-5; aTol = 1e-1; bTol = 1e-1; conLim = 1e12; showLSQR = 0; ebar = sign(x(nnzIdx)); nebar = length(ebar); Sprod = @(y,mode)LSQRprod(@Aprod,nnzIdx,ebar,n,y,mode); [dxbar, istop, itnLSQR] = ... lsqr(m,nebar,Sprod,r,damp,aTol,bTol,conLim,itnMaxLSQR,showLSQR); itnTotLSQR = itnTotLSQR + itnLSQR; if istop ~= 4 % LSQR iterations successful. Take the subspace step. % Push dx back into full space: dx = Z dx. dx = zeros(n,1); dx(nnzIdx) = dxbar - (1/nebar)*(ebar'*dxbar)*dxbar; % Find largest step to a change in sign. block1 = nnzIdx & x < 0 & dx > +pivTol; block2 = nnzIdx & x > 0 & dx < -pivTol; alpha1 = Inf; alpha2 = Inf; if any(block1), alpha1 = min(-x(block1) ./ dx(block1)); end if any(block2), alpha2 = min(-x(block2) ./ dx(block2)); end alpha = min([1 alpha1 alpha2]); ensure(alpha >= 0); ensure(ebar'*dx(nnzIdx) <= optTol); % Update variables. x = x + alpha*dx; r = b - Aprod(x,1); f = r'*r / 2; subspace = true; end end ensure(options.primal_norm(x,weights) <= tau+optTol); %--------------------------------------------------------------- % Update gradient and compute new Barzilai-Borwein scaling. %--------------------------------------------------------------- g = - Aprod(r,2); s = x - xOld; y = g - gOld; sts = s'*s; sty = s'*y; if sty <= 0, gStep = stepMax; else gStep = min( stepMax, max(stepMin, sts/sty) ); end catch % Detect matrix-vector multiply limit error err = lasterror; if strcmp(err.identifier,'SPGL1:MaximumMatvec') stat = EXIT_MATVEC_LIMIT; iter = iter - 1; x = xOld; f = fOld; g = gOld; r = rOld; break; else rethrow(err); end end %------------------------------------------------------------------ % Update function history. %------------------------------------------------------------------ if singleTau || f > sigma^2 / 2 % Don't update if superoptimal. lastFv(mod(iter,nPrevVals)+1) = f; if fBest > f fBest = f; xBest = x; end end end % while 1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Restore best solution (only if solving single problem). if singleTau && f > fBest rNorm = sqrt(2*fBest); printf('\n Restoring best iterate to objective %13.7e\n',rNorm); x = xBest; r = b - Aprod(x,1); g = - Aprod(r,2); gNorm = options.dual_norm(g,weights); rNorm = norm(r, 2); end % Final cleanup before exit. info.tau = tau; info.rNorm = rNorm; info.rGap = rGap; info.gNorm = gNorm; info.rGap = rGap; info.stat = stat; info.iter = iter; info.nProdA = nProdA; info.nProdAt = nProdAt; info.nNewton = nNewton; info.timeProject = timeProject; info.timeMatProd = timeMatProd; info.itnLSQR = itnTotLSQR; info.options = options; info.timeTotal = toc; info.xNorm1 = xNorm1(1:iter); info.rNorm2 = rNorm2(1:iter); info.lambda = lambda(1:iter); % Print final output. switch (stat) case EXIT_OPTIMAL printf('\n EXIT -- Optimal solution found\n') case EXIT_ITERATIONS printf('\n ERROR EXIT -- Too many iterations\n'); case EXIT_ROOT_FOUND printf('\n EXIT -- Found a root\n'); case {EXIT_BPSOL1_FOUND, EXIT_BPSOL2_FOUND} printf('\n EXIT -- Found a BP solution\n'); case EXIT_LINE_ERROR printf('\n ERROR EXIT -- Linesearch error (%i)\n',lnErr); case EXIT_SUBOPTIMAL_BP printf('\n EXIT -- Found a suboptimal BP solution\n'); case EXIT_MATVEC_LIMIT printf('\n EXIT -- Maximum matrix-vector operations reached\n'); case EXIT_ACTIVE_SET printf('\n EXIT -- Found a possible active set\n'); otherwise error('Unknown termination condition\n'); end printf('\n'); printf(' %-20s: %6i %6s %-20s: %6.1f\n',... 'Products with A',nProdA,'','Total time (secs)',info.timeTotal); printf(' %-20s: %6i %6s %-20s: %6.1f\n',... 'Products with A''',nProdAt,'','Project time (secs)',timeProject); printf(' %-20s: %6i %6s %-20s: %6.1f\n',... 'Newton iterations',nNewton,'','Mat-vec time (secs)',timeMatProd); printf(' %-20s: %6i %6s %-20s: %6i\n', ... 'Line search its',nLineTot,'','Subspace iterations',itnTotLSQR); printf('\n'); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % NESTED FUNCTIONS. These share some vars with workspace above. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function z = Aprod(x,mode) if (nProdA + nProdAt >= maxMatvec) error('SPGL1:MaximumMatvec',''); end tStart = toc; if mode == 1 nProdA = nProdA + 1; if explicit, z = A*x; else z = A(x,1); end elseif mode == 2 nProdAt = nProdAt + 1; if explicit, z = A'*x; else z = A(x,2); end else error('Wrong mode!'); end timeMatProd = timeMatProd + (toc - tStart); end % function Aprod %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function printf(varargin) if logLevel > 0 fprintf(fid,varargin{:}); end end % function printf %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function x = project(x, tau) tStart = toc; x = options.project(x,weights,tau); timeProject = timeProject + (toc - tStart); end % function project %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % End of nested functions. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end % function spg %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % PRIVATE FUNCTIONS. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [nnzX,nnzG,nnzIdx,nnzDiff] = activeVars(x,g,nnzIdx,options) % Find the current active set. % nnzX is the number of nonzero x. % nnzG is the number of elements in nnzIdx. % nnzIdx is a vector of primal/dual indicators. % nnzDiff is the no. of elements that changed in the support. xTol = min(.1,10*options.optTol); gTol = min(.1,10*options.optTol); gNorm = options.dual_norm(g,options.weights); nnzOld = nnzIdx; % Reduced costs for postive & negative parts of x. z1 = gNorm + g; z2 = gNorm - g; % Primal/dual based indicators. xPos = x > xTol & z1 < gTol; %g < gTol;% xNeg = x < -xTol & z2 < gTol; %g > gTol;% nnzIdx = xPos | xNeg; % Count is based on simple primal indicator. nnzX = sum(abs(x) >= xTol); nnzG = sum(nnzIdx); if isempty(nnzOld) nnzDiff = inf; else nnzDiff = sum(nnzIdx ~= nnzOld); end end % function spgActiveVars %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function z = LSQRprod(Aprod,nnzIdx,ebar,n,dx,mode) % Matrix multiplication for subspace minimization. % Only called by LSQR. nbar = length(ebar); if mode == 1 y = zeros(n,1); y(nnzIdx) = dx - (1/nbar)*(ebar'*dx)*ebar; % y(nnzIdx) = Z*dx z = Aprod(y,1); % z = S Z dx else y = Aprod(dx,2); z = y(nnzIdx) - (1/nbar)*(ebar'*y(nnzIdx))*ebar; end end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [fNew,xNew,rNew,iter,err] = spgLine(f,x,d,gtd,fMax,Aprod,b) % Nonmonotone linesearch. EXIT_CONVERGED = 0; EXIT_ITERATIONS = 1; maxIts = 10; step = 1; iter = 0; gamma = 1e-4; gtd = -abs(gtd); % 03 Aug 07: If gtd is complex, % then should be looking at -abs(gtd). while 1 % Evaluate trial point and function value. xNew = x + step*d; rNew = b - Aprod(xNew,1); fNew = rNew'*rNew / 2; % Check exit conditions. if fNew < fMax + gamma*step*gtd % Sufficient descent condition. err = EXIT_CONVERGED; break elseif iter >= maxIts % Too many linesearch iterations. err = EXIT_ITERATIONS; break end % New linesearch iteration. iter = iter + 1; % Safeguarded quadratic interpolation. if step <= 0.1 step = step / 2; else tmp = (-gtd*step^2) / (2*(fNew-f-step*gtd)); if tmp < 0.1 || tmp > 0.9*step || isnan(tmp) tmp = step / 2; end step = tmp; end end % while 1 end % function spgLine %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [fNew,xNew,rNew,iter,step,err] = ... spgLineCurvy(x,g,fMax,Aprod,b,project,tau) % Projected backtracking linesearch. % On entry, % g is the (possibly scaled) steepest descent direction. EXIT_CONVERGED = 0; EXIT_ITERATIONS = 1; EXIT_NODESCENT = 2; gamma = 1e-4; maxIts = 10; step = 1; sNorm = 0; scale = 1; % Safeguard scaling. (See below.) nSafe = 0; % No. of safeguarding steps. iter = 0; debug = false; % Set to true to enable log. n = length(x); if debug fprintf(' %5s %13s %13s %13s %8s\n',... 'LSits','fNew','step','gts','scale'); end while 1 % Evaluate trial point and function value. xNew = project(x - step*scale*g, tau); rNew = b - Aprod(xNew,1); fNew = rNew'*rNew / 2; s = xNew - x; gts = scale * g' * s; if gts >= 0 % Should we check real and complex parts individually? err = EXIT_NODESCENT; break end if debug fprintf(' LS %2i %13.7e %13.7e %13.6e %8.1e\n',... iter,fNew,step,gts,scale); end % 03 Aug 07: If gts is complex, then should be looking at -abs(gts). if fNew < fMax - gamma*step*abs(gts) % Sufficient descent condition. err = EXIT_CONVERGED; break elseif iter >= maxIts % Too many linesearch iterations. err = EXIT_ITERATIONS; break end % New linesearch iteration. iter = iter + 1; step = step / 2; % Safeguard: If stepMax is huge, then even damped search % directions can give exactly the same point after projection. If % we observe this in adjacent iterations, we drastically damp the % next search direction. % 31 May 07: Damp consecutive safeguarding steps. sNormOld = sNorm; sNorm = norm(s) / sqrt(n); % if sNorm >= sNormOld if abs(sNorm - sNormOld) <= 1e-6 * sNorm gNorm = norm(g) / sqrt(n); scale = sNorm / gNorm / (2^nSafe); nSafe = nSafe + 1; end end % while 1 end % function spgLineCurvy
github
TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox-master
exls.m
.m
Predictor-Based-Subspace-IDentification-toolbox-master/private/exls.m
9,640
utf_8
41bd2c44a083af85a79ab91715bffc82
function [VARMAX,Z] = exls(Y,Z,p,r,method,tol,reg,opt,VARMAX0) %EXLS Extended Least Squares % [VARMAX,Z] = EXLS(Y,Z,P,R,METHOD,TOL,REG,OPT,VARMAX0) computes the % extended least squares regression for the VARMAX estimation problem % using recursive least squares. This function is intended for DORDVARMAX. % Ivo Houtzager % Delft Center of Systems and Control % Delft University of Technology % The Netherlands, 2010 % assign default values to unspecified parameters if (nargin < 8) || isempty(opt) opt = 'gcv'; end if (nargin < 7) || isempty(reg) reg = 'tikh'; end if (nargin < 6) || isempty(tol) tol = 1e-4; end if (nargin < 5) || isempty(method) method = 'els'; end % if strcmpi(method,'gradient') || strcmpi(method,'grad') % if ~strcmpi(reg,'none') % error('Gradient method does not support regularisation!') % end % end ireg = sqrt(tol); % determine size N = size(Y,2)+p; l = size(Y,1); m = r+2*l; % calculate initial VARMAX solution if nargin < 9 || isempty(VARMAX0) if ~strcmpi(reg,'none') if strcmpi(method,'gradient') || strcmpi(method,'grad') [VARMAX,reg_min] = regress(Y,Z,reg,opt); else VARMAX = zeros(l,size(Z,1)); end else VARMAX = zeros(l,size(Z,1)); end else if ~strcmpi(reg,'none') [~,reg_min] = regress(Y,Z,reg,opt,VARMAX0); end VARMAX = VARMAX0; end cost1 = 1e10; switch lower(method) case {'grad','gradient'} % do the VARMAX whitening iterations lambda = 1; if isscalar('opt') reg_min = opt; else reg_min = 0; end maxit = 100; ok = true; k = 1; while ok == true && k <= maxit % evaluate function E = eval_varmax(Z,Y,VARMAX,r,l,p,N); if strcmpi(reg,'nuclear') || strcmpi(reg,'nuc') cost = norm(E','fro')^2 + reg_min^2*sum(svd(VARMAX)); else cost = norm(E','fro')^2 + reg_min^2*norm(VARMAX,'fro')^2; end % check residue if abs(cost1 - cost) <= tol^2*N ok = false; end % store the past and future vectors e = zeros(l,N); e(:,p+1:end) = E; for i = 1:p Z((i-1)*m+r+l+1:i*m,:) = e(:,i:N+i-p-1); end % compute regularization if ~(strcmpi(reg,'none') || strcmpi(reg,'nuclear') || strcmpi(reg,'nuc')) [~,reg_min] = regress(Y,Z,reg,opt); end % recalculate gradient step k = k + 1; if strcmpi(reg,'nuclear') || strcmpi(reg,'nuc') lambda = fminbnd(@(x) (norm(eval_varmax(Z,Y,VARMAX + x.*(E*Z'),r,l,p,N)','fro')^2 + reg_min^2*sum(svd(VARMAX + x.*(E*Z'))))/N,0,lambda); else lambda = fminbnd(@(x) (norm(eval_varmax(Z,Y,VARMAX + x.*(E*Z'),r,l,p,N)','fro')^2 + reg_min^2*norm(VARMAX + x.*(E*Z'),'fro')^2)/N,0,lambda); end % step update VARMAX = VARMAX + lambda.*(E*Z'); if strcmpi(reg,'nuclear') || strcmpi(reg,'nuc') % step update with tresholding VARMAX = VARMAX + lambda.*(E*Z'); [U,S,V] = svd(VARMAX); if size(Y,1) == 1 VARMAX = U*diag(max(S(1,1)-reg_min^2*lambda,0))*V(:,1)'; else VARMAX = U*diag(max(diag(S)-reg_min^2*lambda,0))*V(:,1:length(diag(S)))'; end else % apply shrinkage VARMAX = (1/(1+2*lambda*reg_min^2))*VARMAX; end % swap cost1 = cost; end case 'els' % do the VARMAX whitening iterations PS = ireg; if isscalar('opt') reg_min = opt; else reg_min = 0; end lambda = tol^(1/N); maxit = 10; ok = true; k = 1; PS0 = PS; while ok == true && k <= maxit if ~strcmpi(reg,'none') && ~isscalar('opt') Y1 = Y.*(ones(size(Y,1),1)*lambda.^(length(Y)-1:-1:0)); Z1 = Z.*(ones(size(Z,1),1)*lambda.^(length(Z)-1:-1:0)); [~,reg_min] = regress(Y1,Z1,reg,opt,VARMAX); end PS = PS0; for i = 1:N-p if ~strcmpi(reg,'none') [VARMAX,PS] = rls_ew_track_reg(Z(:,i),Y(:,i),VARMAX,PS,lambda,reg_min); else [VARMAX,PS] = rls_ew_track(Z(:,i),Y(:,i),VARMAX,PS,lambda); end E = Y(:,i) - VARMAX*Z(:,i); if i ~= N-p for j = 1:l Z((1:p-1)*(l+r)+(0:p-2)*l+j,i+1) = Z((2:p)*(l+r)+(1:p-1)*l+j,i); Z(p*(l+r)+(p-1)*l+j,i+1) = E(j); end end end % pre-allocate matrices E = Y - VARMAX*Z; % check residue cost = norm(E','fro')^2 + reg_min^2*norm(VARMAX,'fro')^2; if abs(cost1 - cost) <= tol^2*N ok = false; end % store the past and future vectors e = zeros(l,N); e(:,p+1:end) = E; for i = 1:p Z((i-1)*m+r+l+1:i*m,:) = e(:,i:N+i-p-1); end % recalculate forgetting factor k = k + 1; lambda = (lambda^N)^(1/(k*N)); % swap cost1 = cost; end otherwise disp('Unknown method.') end end function E = eval_varmax(Z,Y,VARMAX,r,l,p,N) %EVAL_VARMAX Evaluate VARMAX Markov parameters m = 2*l+r; q = tf([0 1],[1 0],1,'Variable','z^-1'); e = zeros(l,N); H = eye(l); for i = 1:p H = H - VARMAX(:,(i-1)*m+r+l+1:i*m).*q^i; Z((i-1)*m+r+l+1:i*m,:) = e(:,i:N+i-p-1); end N = inv(N); E = Y - VARMAX*Z; T = 0:N-1; E = lsim(H,E',T')'; end function [theta,P] = rls_ew_track(z,y,theta,P,lambda) %RLS_EW_TRACK Exponentially Weighted RLS iteration % [THETA,P]=RLS_EW_TRACK(Z,Y,THETA,P,LAMBDA) applies one iteration of % exponentially weighted regularized least-squares problem. In recursive % least-squares, we deal with the issue of an inceasing amount of date Z % and Y. At each iteration, THETA is the solution. The scalar LAMBDA is % called the forgetting factor since past data are exponentially weighted % less heavily than more recent data. % Ivo Houtzager % Delft Center of Systems and Control % The Netherlands, 2010 % Assign default values to unspecified parameters mz = size(z,1); if (nargin < 5) || isempty(lambda) lambda = 1; end if (nargin < 4) || isempty(P) P = zeros(mz); elseif isscalar(P) P = (1/P).*eye(mz); end if (nargin < 3) || isempty(theta) theta = zeros(size(y,1),mz); end % Exponentially-Weighted, Tracking, Regularized, Least-Squares Iteration P = (1/lambda).*(P - P*(z*z')*P./(lambda + z'*P*z)); P = 0.5.*(P+P'); % force symmetric e = y - theta*z; theta = theta + e*z'*P; end % end of function RLS_EW_TRACK function [theta,P] = rls_ew_track_reg(z,y,theta,P,lambda,reg_min) %RLS_EW_TRACK_REG Exponentially Weighted and Regularized RLS iteration % [THETA,P]=RLS_EW_TRACK_REG(Z,Y,THETA,P,LAMBDA,REG) applies one iteration % of exponentially weighted regularized least-squares problem. In % recursive least-squares, we deal with the issue of an inceasing amount % of date Z and Y. At each iteration, THETA is the solution. The scalar % LAMBDA is called the forgetting factor since past data are exponentially % weighted less heavily than more recent data. % Ivo Houtzager % Delft Center of Systems and Control % The Netherlands, 2010 % Assign default values to unspecified parameters mz = size(z,1); if (nargin < 6) || isempty(reg_min) reg_min = 0; end if (nargin < 5) || isempty(lambda) lambda = 1; end if (nargin < 4) || isempty(P) P = zeros(mz); elseif isscalar(P) P = (1/P).*eye(mz); end if (nargin < 3) || isempty(theta) theta = zeros(size(y,1),mz); end % Exponentially-Weighted, Tracking, Regularized, Least-Squares Iteration P = (1/lambda).*(P - P*(z*z')*P./(lambda + z'*P*z)); P = 0.5.*(P+P'); % force symmetric if isscalar(reg_min) opts.SYM = true; opts.POSDEF = true; P1 = linsolve((eye(size(P)) + reg_min^2.*P),P,opts); e = y - theta*z; theta = theta + e*z'*P1; elseif strcmpi(reg_min,'tikh') [U,S,V] = svd(pinv(P)); s = diag(S); YP = (y-theta*z)'; if isscalar(opt) reg_min = opt; elseif strcmpi(opt,'lcurve') reg_min = reglcurve(YP,U,s); elseif strcmpi(opt,'gcv') reg_min = reggcv(YP,U,s); end theta = theta + (V*(diag(s./(s.^2 + reg_min^2)))*U'*YP)'; elseif strcmpi(reg_min,'tsvd') [U,S,V] = svd(pinv(P)); s = diag(S); YP = (y-theta*z)'; if isscalar(opt) k_min = opt; elseif strcmpi(opt,'lcurve') k_min = reglcurve(YP,U,s,'tsvd'); elseif strcmpi(opt,'gcv') k_min = reggcv(YP,U,s,'tsvd'); end theta = theta + (V(:,1:k_min)*diag(1./s(1:k_min))*U(:,1:k_min)'*YP)'; end end % end of function RLS_EW_TRACK
github
TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox-master
oneProjectorMex.m
.m
Predictor-Based-Subspace-IDentification-toolbox-master/private/oneProjectorMex.m
3,797
utf_8
df5afe507062bc6b713674d862bf73cd
function [x, itn] = oneProjectorMex(b,d,tau) % [x, itn] = oneProjectorMex(b,d,tau) % Return the orthogonal projection of the vector b >=0 onto the % (weighted) L1 ball. In case vector d is specified, matrix D is % defined as diag(d), otherwise the identity matrix is used. % % On exit, % x solves minimize ||b-x||_2 st ||Dx||_1 <= tau. % itn is the number of elements of b that were thresholded. % % See also spgl1, oneProjector. % oneProjectorMex.m % $Id: oneProjectorMex.m 1200 2008-11-21 19:58:28Z mpf $ % % ---------------------------------------------------------------------- % This file is part of SPGL1 (Spectral Projected Gradient for L1). % % Copyright (C) 2007 Ewout van den Berg and Michael P. Friedlander, % Department of Computer Science, University of British Columbia, Canada. % All rights reserved. E-mail: <{ewout78,mpf}@cs.ubc.ca>. % % SPGL1 is free software; you can redistribute it and/or modify it % under the terms of the GNU Lesser General Public License as % published by the Free Software Foundation; either version 2.1 of the % License, or (at your option) any later version. % % SPGL1 is distributed in the hope that it will be useful, but WITHOUT % ANY WARRANTY; without even the implied warranty of MERCHANTABILITY % or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General % Public License for more details. % % You should have received a copy of the GNU Lesser General Public % License along with SPGL1; if not, write to the Free Software % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 % USA % ---------------------------------------------------------------------- if nargin < 3 tau = d; d = 1; end if isscalar(d) [x,itn] = oneProjectorMex_I(b,tau/abs(d)); else [x,itn] = oneProjectorMex_D(b,d,tau); end end % function oneProjectorMex % ---------------------------------------------------------------------- function [x,itn] = oneProjectorMex_I(b,tau) % ---------------------------------------------------------------------- % Initialization n = length(b); x = zeros(n,1); bNorm = norm(b,1); % Check for quick exit. if (tau >= bNorm), x = b; itn = 0; return; end if (tau < eps ), itn = 0; return; end % Preprocessing (b is assumed to be >= 0) [b,idx] = sort(b,'descend'); % Descending. csb = -tau; alphaPrev = 0; for j= 1:n csb = csb + b(j); alpha = csb / j; % We are done as soon as the constraint can be satisfied % without exceeding the current minimum value of b if alpha >= b(j) break; end alphaPrev = alpha; end % Set the solution by applying soft-thresholding with % the previous value of alpha x(idx) = max(0,b - alphaPrev); % Set number of iterations itn = j; end % ---------------------------------------------------------------------- function [x,itn] = oneProjectorMex_D(b,d,tau) % ---------------------------------------------------------------------- % Initialization n = length(b); x = zeros(n,1); % Check for quick exit. if (tau >= norm(d.*b,1)), x = b; itn = 0; return; end if (tau < eps ), itn = 0; return; end % Preprocessing (b is assumed to be >= 0) [bd,idx] = sort(b ./ d,'descend'); % Descending. b = b(idx); d = d(idx); % Optimize csdb = 0; csd2 = 0; soft = 0; alpha1 = 0; i = 1; while (i <= n) csdb = csdb + d(i).*b(i); csd2 = csd2 + d(i).*d(i); alpha1 = (csdb - tau) / csd2; alpha2 = bd(i); if alpha1 >= alpha2 break; end soft = alpha1; i = i + 1; end x(idx(1:i-1)) = b(1:i-1) - d(1:i-1) * max(0,soft); % Set number of iterations itn = i; end
github
TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox-master
lsqr.m
.m
Predictor-Based-Subspace-IDentification-toolbox-master/private/lsqr.m
11,849
utf_8
b60925c5944249161e00049c67d30868
function [ x, istop, itn, r1norm, r2norm, anorm, acond, arnorm, xnorm, var ]... = lsqr( m, n, A, b, damp, atol, btol, conlim, itnlim, show ) % % [ x, istop, itn, r1norm, r2norm, anorm, acond, arnorm, xnorm, var ]... % = lsqr( m, n, A, b, damp, atol, btol, conlim, itnlim, show ); % % LSQR solves Ax = b or min ||b - Ax||_2 if damp = 0, % or min || (b) - ( A )x || otherwise. % || (0) (damp I) ||2 % A is an m by n matrix defined or a function handle of aprod( mode,x ), % that performs the matrix-vector operations. % If mode = 1, aprod must return y = Ax without altering x. % If mode = 2, aprod must return y = A'x without altering x. %----------------------------------------------------------------------- % LSQR uses an iterative (conjugate-gradient-like) method. % For further information, see % 1. C. C. Paige and M. A. Saunders (1982a). % LSQR: An algorithm for sparse linear equations and sparse least squares, % ACM TOMS 8(1), 43-71. % 2. C. C. Paige and M. A. Saunders (1982b). % Algorithm 583. LSQR: Sparse linear equations and least squares problems, % ACM TOMS 8(2), 195-209. % 3. M. A. Saunders (1995). Solution of sparse rectangular systems using % LSQR and CRAIG, BIT 35, 588-604. % % Input parameters: % atol, btol are stopping tolerances. If both are 1.0e-9 (say), % the final residual norm should be accurate to about 9 digits. % (The final x will usually have fewer correct digits, % depending on cond(A) and the size of damp.) % conlim is also a stopping tolerance. lsqr terminates if an estimate % of cond(A) exceeds conlim. For compatible systems Ax = b, % conlim could be as large as 1.0e+12 (say). For least-squares % problems, conlim should be less than 1.0e+8. % Maximum precision can be obtained by setting % atol = btol = conlim = zero, but the number of iterations % may then be excessive. % itnlim is an explicit limit on iterations (for safety). % show = 1 gives an iteration log, % show = 0 suppresses output. % % Output parameters: % x is the final solution. % istop gives the reason for termination. % istop = 1 means x is an approximate solution to Ax = b. % = 2 means x approximately solves the least-squares problem. % r1norm = norm(r), where r = b - Ax. % r2norm = sqrt( norm(r)^2 + damp^2 * norm(x)^2 ) % = r1norm if damp = 0. % anorm = estimate of Frobenius norm of Abar = [ A ]. % [damp*I] % acond = estimate of cond(Abar). % arnorm = estimate of norm(A'*r - damp^2*x). % xnorm = norm(x). % var (if present) estimates all diagonals of (A'A)^{-1} (if damp=0) % or more generally (A'A + damp^2*I)^{-1}. % This is well defined if A has full column rank or damp > 0. % (Not sure what var means if rank(A) < n and damp = 0.) % % % 1990: Derived from Fortran 77 version of LSQR. % 22 May 1992: bbnorm was used incorrectly. Replaced by anorm. % 26 Oct 1992: More input and output parameters added. % 01 Sep 1994: Matrix-vector routine is now a parameter 'aprodname'. % Print log reformatted. % 14 Jun 1997: show added to allow printing or not. % 30 Jun 1997: var added as an optional output parameter. % 07 Aug 2002: Output parameter rnorm replaced by r1norm and r2norm. % Michael Saunders, Systems Optimization Laboratory, % Dept of MS&E, Stanford University. % 03 Jul 2007: Modified 'aprodname' to A, which can either be an m by n % matrix, or a function handle. % Ewout van den Berg, University of British Columbia % 03 Jul 2007: Modified 'test2' condition, omitted 'test1'. % Ewout van den Berg, University of British Columbia %----------------------------------------------------------------------- % Initialize. msg=['The exact solution is x = 0 ' 'Ax - b is small enough, given atol, btol ' 'The least-squares solution is good enough, given atol ' 'The estimate of cond(Abar) has exceeded conlim ' 'Ax - b is small enough for this machine ' 'The least-squares solution is good enough for this machine' 'Cond(Abar) seems to be too large for this machine ' 'The iteration limit has been reached ']; wantvar= nargout >= 6; if wantvar, var = zeros(n,1); end if show disp(' ') disp('LSQR Least-squares solution of Ax = b') str1 = sprintf('The matrix A has %8g rows and %8g cols', m, n); str2 = sprintf('damp = %20.14e wantvar = %8g', damp,wantvar); str3 = sprintf('atol = %8.2e conlim = %8.2e', atol, conlim); str4 = sprintf('btol = %8.2e itnlim = %8g' , btol, itnlim); disp(str1); disp(str2); disp(str3); disp(str4); end itn = 0; istop = 0; nstop = 0; ctol = 0; if conlim > 0, ctol = 1/conlim; end; anorm = 0; acond = 0; dampsq = damp^2; ddnorm = 0; res2 = 0; xnorm = 0; xxnorm = 0; z = 0; cs2 = -1; sn2 = 0; % Set up the first vectors u and v for the bidiagonalization. % These satisfy beta*u = b, alfa*v = A'u. u = b(1:m); x = zeros(n,1); alfa = 0; beta = norm( u ); if beta > 0 u = (1/beta) * u; v = Aprod(u,2); alfa = norm( v ); end if alfa > 0 v = (1/alfa) * v; w = v; end arnorm = alfa * beta; if arnorm == 0 if show, disp(msg(1,:)); end return end arnorm0= arnorm; rhobar = alfa; phibar = beta; bnorm = beta; rnorm = beta; r1norm = rnorm; r2norm = rnorm; head1 = ' Itn x(1) r1norm r2norm '; head2 = ' Compatible LS Norm A Cond A'; if show disp(' ') disp([head1 head2]) test1 = 1; test2 = alfa / beta; str1 = sprintf( '%6g %12.5e', itn, x(1) ); str2 = sprintf( ' %10.3e %10.3e', r1norm, r2norm ); str3 = sprintf( ' %8.1e %8.1e', test1, test2 ); disp([str1 str2 str3]) end %------------------------------------------------------------------ % Main iteration loop. %------------------------------------------------------------------ while itn < itnlim itn = itn + 1; % Perform the next step of the bidiagonalization to obtain the % next beta, u, alfa, v. These satisfy the relations % beta*u = a*v - alfa*u, % alfa*v = A'*u - beta*v. u = Aprod(v,1) - alfa*u; beta = norm( u ); if beta > 0 u = (1/beta) * u; anorm = norm([anorm alfa beta damp]); v = Aprod(u, 2) - beta*v; alfa = norm( v ); if alfa > 0, v = (1/alfa) * v; end end % Use a plane rotation to eliminate the damping parameter. % This alters the diagonal (rhobar) of the lower-bidiagonal matrix. rhobar1 = norm([rhobar damp]); cs1 = rhobar / rhobar1; sn1 = damp / rhobar1; psi = sn1 * phibar; phibar = cs1 * phibar; % Use a plane rotation to eliminate the subdiagonal element (beta) % of the lower-bidiagonal matrix, giving an upper-bidiagonal matrix. rho = norm([rhobar1 beta]); cs = rhobar1/ rho; sn = beta / rho; theta = sn * alfa; rhobar = - cs * alfa; phi = cs * phibar; phibar = sn * phibar; tau = sn * phi; % Update x and w. t1 = phi /rho; t2 = - theta/rho; dk = (1/rho)*w; x = x + t1*w; w = v + t2*w; ddnorm = ddnorm + norm(dk)^2; if wantvar, var = var + dk.*dk; end % Use a plane rotation on the right to eliminate the % super-diagonal element (theta) of the upper-bidiagonal matrix. % Then use the result to estimate norm(x). delta = sn2 * rho; gambar = - cs2 * rho; rhs = phi - delta * z; zbar = rhs / gambar; xnorm = sqrt(xxnorm + zbar^2); gamma = norm([gambar theta]); cs2 = gambar / gamma; sn2 = theta / gamma; z = rhs / gamma; xxnorm = xxnorm + z^2; % Test for convergence. % First, estimate the condition of the matrix Abar, % and the norms of rbar and Abar'rbar. acond = anorm * sqrt( ddnorm ); res1 = phibar^2; res2 = res2 + psi^2; rnorm = sqrt( res1 + res2 ); arnorm = alfa * abs( tau ); % 07 Aug 2002: % Distinguish between % r1norm = ||b - Ax|| and % r2norm = rnorm in current code % = sqrt(r1norm^2 + damp^2*||x||^2). % Estimate r1norm from % r1norm = sqrt(r2norm^2 - damp^2*||x||^2). % Although there is cancellation, it might be accurate enough. r1sq = rnorm^2 - dampsq * xxnorm; r1norm = sqrt( abs(r1sq) ); if r1sq < 0, r1norm = - r1norm; end r2norm = rnorm; % Now use these norms to estimate certain other quantities, % some of which will be small near a solution. test1 = rnorm / bnorm; test2 = arnorm / arnorm0; % test2 = arnorm/( anorm * rnorm ); test3 = 1 / acond; t1 = test1 / (1 + anorm * xnorm / bnorm); rtol = btol + atol * anorm * xnorm / bnorm; % The following tests guard against extremely small values of % atol, btol or ctol. (The user may have set any or all of % the parameters atol, btol, conlim to 0.) % The effect is equivalent to the normal tests using % atol = eps, btol = eps, conlim = 1/eps. if itn >= itnlim, istop = 7; end if 1 + test3 <= 1, istop = 6; end if 1 + test2 <= 1, istop = 5; end if 1 + t1 <= 1, istop = 4; end % Allow for tolerances set by the user. if test3 <= ctol, istop = 3; end if test2 <= atol, istop = 2; end % if test1 <= rtol, istop = 1; end % See if it is time to print something. prnt = 0; if n <= 40 , prnt = 1; end if itn <= 10 , prnt = 1; end if itn >= itnlim-10, prnt = 1; end if rem(itn,10) == 0 , prnt = 1; end if test3 <= 2*ctol , prnt = 1; end if test2 <= 10*atol , prnt = 1; end % if test1 <= 10*rtol , prnt = 1; end if istop ~= 0 , prnt = 1; end if prnt == 1 if show str1 = sprintf( '%6g %12.5e', itn, x(1) ); str2 = sprintf( ' %10.3e %10.3e', r1norm, r2norm ); str3 = sprintf( ' %8.1e %8.1e', test1, test2 ); str4 = sprintf( ' %8.1e %8.1e', anorm, acond ); disp([str1 str2 str3 str4]) end end if istop > 0, break, end end % End of iteration loop. % Print the stopping condition. if show disp(' ') disp('LSQR finished') disp(msg(istop+1,:)) disp(' ') str1 = sprintf( 'istop =%8g r1norm =%8.1e', istop, r1norm ); str2 = sprintf( 'anorm =%8.1e arnorm =%8.1e', anorm, arnorm ); str3 = sprintf( 'itn =%8g r2norm =%8.1e', itn, r2norm ); str4 = sprintf( 'acond =%8.1e xnorm =%8.1e', acond, xnorm ); disp([str1 ' ' str2]) disp([str3 ' ' str4]) disp(' ') end %----------------------------------------------------------------------- % End of lsqr.m %----------------------------------------------------------------------- function z = Aprod(x,mode) if mode == 1 if isnumeric(A), z = A*x; else z = A(x,1); end else if isnumeric(A), z = (x'*A)'; else z = A(x,2); end end end % function Aprod end
github
TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox-master
reglcurve.m
.m
Predictor-Based-Subspace-IDentification-toolbox-master/private/reglcurve.m
9,669
utf_8
4ba1982fb3c44a326be1ff4bec03edef
function reg_c=reglcurve(Y,Vn,Sn,method,show) %REGLCURVE Compute regularization using L-curve criterion. % Determine the regularization parameter for ordkernel % using L-curve criterion. It plots the L-curve and % find its corner. If the regularization method is % 'tsvd' then the Spline Toolbox is needed to determine % the corner. If this toolbox is not available NaN is % returned. % % Syntax: % reg=reglcurve(Y,V,S) % reg=reglcurve(Y,V,S,method,show) % % Input: % Y,V,S Data matrices from lpvkernel or bilkernel. % method Regularization method to be used. % 'Tikh' - Tikhonov regularization (default). % 'tsvd' - Truncated singular value decomposition. % show Display intermediate steps of the algorithm. % % Output: % reg Regularization paramater for the kernel % subspace identification method of ordkernel. % Written by Vincent Verdult, May 2004. % Based on Regularization Tools by P. C. Hansen % default method if nargin<4 method='Tikh'; end if nargin<5 show=0; end if size(Y,1)~=size(Vn,1) error('The number of rows in Y must equal the number of rows in V.') end if size(Vn,1)~=size(Vn,2) error('V must be a square matrix.') end if size(Sn,2)~=1 error('S must be a column vector.') end if size(Vn,1)~=size(Sn,1) error('The number of rows in S must equal the number of rows in V.') end % Initialization. N = size(Sn,1); s=sqrt(Sn); beta = Vn'*Y; xi = diag(1./s)*beta; %%%%%%%%%%%%%%%% % Tikhonov regularization if (strncmp(method,'Tikh',4) || strncmp(method,'tikh',4)) SkipCorner=0; txt = 'Tikh.'; marker='-'; npoints = 200; % Number of points on the curve. smin_ratio = 16*eps; % Smallest regularization parameter. eta = zeros(npoints,1); rho = zeros(npoints,1); reg_param = zeros(npoints,1); reg_param(npoints) = max([s(N),s(1)*smin_ratio]); ratio = (s(1)/reg_param(npoints))^(1/(npoints-1)); if show==1 disp('Calculation points on L-curve') end for i=npoints-1:-1:1 reg_param(i) = ratio*reg_param(i+1); end n=size(xi,2); for i=1:npoints f = Sn./(Sn + reg_param(i)^2); eta(i) = norm((f*ones(1,n)).*xi,'fro'); rho(i) = norm(((1-f)*ones(1,n)).*beta,'fro'); end % locate corner if show==1 disp('Calculating curvature of L-curve') end % The L-curve is differentiable; computation of curvature in % log-log scale is easy. % Compute g = - curvature of L-curve. g = reglcfun(reg_param,Sn,beta,xi); % Locate the corner. If the curvature is negative everywhere, % then define the leftmost point of the L-curve as the corner. if show==1 disp('Searching for corner in L-curve') OPT=optimset('Display','iter'); else OPT=optimset('Display','off'); end [gmin,gi] = min(g); reg_c = fminbnd(@reglcfun,... reg_param(min(gi+1,length(g))),reg_param(max(gi-1,1)),... OPT,Sn,beta,xi); % Minimizer. kappa_max = - reglcfun(reg_c,Sn,beta,xi); % Maximum curvature. if (kappa_max < 0) lr = length(rho); reg_c = reg_param(lr); rho_c = rho(lr); eta_c = eta(lr); else f = Sn./(Sn + reg_c^2); eta_c = norm((f*ones(1,n)).*xi,'fro'); rho_c = norm(((1-f)*ones(1,n)).*beta,'fro'); end %%%%%%%%%%%%%%%% % Truncated SVD elseif (strncmp(method,'tsvd',4) || strncmp(method,'TSVD',4)) % spline toolbox needed for determination of the corner. SkipCorner = exist('splines','dir')~=7; txt = 'TSVD'; marker='o'; eta = zeros(N,1); rho = zeros(N,1); eta(1) = sum(xi(1,:).^2); for k=2:N eta(k) = eta(k-1) + sum(xi(k,:).^2); end eta = sqrt(eta); rho(N) = eps^2; for k=N-1:-1:1 rho(k) = rho(k+1) + sum(beta(k+1,:).^2); end rho = sqrt(rho); reg_param = (1:N)'; % Determine corner using Splines if (SkipCorner) reg_c = NaN; else % The L-curve is discrete and may include unwanted fine-grained % corners. Use local smoothing, followed by fitting a 2-D spline % curve to the smoothed discrete L-curve. % Set default parameters for treatment of discrete L-curve. deg = 2; % Degree of local smooting polynomial. q = 2; % Half-width of local smoothing interval. order = 4; % Order of fitting 2-D spline curve. % Neglect singular values less than s_thr. s_thr = eps; index = find(s > s_thr); rho_t = rho(index); eta_t = eta(index); reg_param_t = reg_param(index); % Convert to logarithms. lr = length(rho_t); lrho = log(rho_t); leta = log(eta_t); slrho = lrho; sleta = leta; % For all interior points k = q+1:length(rho)-q-1 on the discrete % L-curve, perform local smoothing with a polynomial of degree deg % to the points k-q:k+q. v = (-q:q)'; A = zeros(2*q+1,deg+1); A(:,1) = ones(length(v),1); for j = 2:deg+1 A(:,j) = A(:,j-1).*v; end for k = q+1:lr-q-1 cr = A\lrho(k+v); slrho(k) = cr(1); ce = A\leta(k+v); sleta(k) = ce(1); end % Fit a 2-D spline curve to the smoothed discrete L-curve. sp = spmak(1:lr+order,[slrho';sleta']); pp = ppbrk(sp2pp(sp),[4,lr+1]); % Extract abscissa and ordinate splines and differentiate them. % Compute as many function values as default in spleval. P = spleval(pp); dpp = fnder(pp); D = spleval(dpp); ddpp = fnder(pp,2); DD = spleval(ddpp); ppx = P(1,:); ppy = P(2,:); dppx = D(1,:); dppy = D(2,:); ddppx = DD(1,:); ddppy = DD(2,:); % Compute the corner of the discretized .spline curve via max. curvature. % No need to refine this corner, since the final regularization % parameter is discrete anyway. % Define curvature = 0 where both dppx and dppy are zero. k1 = dppx.*ddppy - ddppx.*dppy; k2 = (dppx.^2 + dppy.^2).^(1.5); I_nz = find(k2 ~= 0); kappa = zeros(1,length(dppx)); kappa(I_nz) = -k1(I_nz)./k2(I_nz); [kmax,ikmax] = max(kappa); x_corner = ppx(ikmax); y_corner = ppy(ikmax); % Locate the point on the discrete L-curve which is closest to the % corner of the spline curve. Prefer a point below and to the % left of the corner. If the curvature is negative everywhere, % then define the leftmost point of the L-curve as the corner. if (kmax < 0) reg_c = reg_param_t(lr); rho_c = rho_t(lr); eta_c = eta_t(lr); else index = find(lrho < x_corner & leta < y_corner); if ~isempty(index) [dummy,rpi] = min((lrho(index)-x_corner).^2 + (leta(index)-y_corner).^2); rpi = index(rpi); else [dummy,rpi] = min((lrho-x_corner).^2 + (leta-y_corner).^2); end reg_c = reg_param_t(rpi); rho_c = rho_t(rpi); eta_c = eta_t(rpi); end end else error('Illegal method') end %%%%%%%%%%%%%%%% % Plot if show==1 N=length(rho); loglog(rho(2:end-1),eta(2:end-1)) ax = axis; ni = round(N/10); if (max(eta)/min(eta) > 10 || max(rho)/min(rho) > 10) loglog(rho,eta,marker,rho(ni:ni:N),eta(ni:ni:N),'x') else plot(rho,eta,marker,rho(ni:ni:N),eta(ni:ni:N),'x') end HoldState = ishold; hold on; for k = ni:ni:N text(rho(k),eta(k),num2str(reg_param(k))); end if ~(SkipCorner) loglog([min(rho)/100,rho_c],[eta_c,eta_c],':r',... [rho_c,rho_c],[min(eta)/100,eta_c],':r') title(['L-curve, ',txt,' corner at ',num2str(reg_c)]); else title('L-curve') end axis(ax) if (~HoldState) hold off end xlabel('residual norm || A x - b ||_2') ylabel('solution norm || x ||_2') end end function g = reglcfun(lambda,Sn,beta,xi) % reglcfun Computes L-curve for reglcurve. % Auxiliary function for reglcurve. % % Written by Vincent Verdult, May 2004. % Based on Regularization Tools by P. C. Hansen % Initialization. L=size(lambda,1); n=size(xi,2); phi = zeros(L,1); dphi = zeros(L,1); psi = zeros(L,1); dpsi = zeros(L,1); eta = zeros(L,1); rho = zeros(L,1); % Compute some intermediate quantities. for i = 1:L f = Sn./(Sn + lambda(i)^2); cf = 1 - f; eta(i) = norm((f*ones(1,n)).*xi,'fro'); rho(i) = norm((cf*ones(1,n)).*beta,'fro'); f1 = -2*f.*cf/lambda(i); f2 = -f1.*(3-4*f)/lambda(i); phi(i) = sum(f.*f1.*sum(xi.^2,2)); psi(i) = sum(cf.*f1.*sum(beta.^2,2)); dphi(i) = sum((f1.^2 + f.*f2).*sum(xi.^2,2)); dpsi(i) = sum((-f1.^2 + cf.*f2).*sum(beta.^2,2)); end % Now compute the first and second derivatives of eta and rho % with respect to lambda; deta = phi./eta; drho = -psi./rho; ddeta = dphi./eta - deta.*(deta./eta); ddrho = -dpsi./rho - drho.*(drho./rho); % Convert to derivatives of log(eta) and log(rho). dlogeta = deta./eta; dlogrho = drho./rho; ddlogeta = ddeta./eta - (dlogeta).^2; ddlogrho = ddrho./rho - (dlogrho).^2; % Let g = curvature. g = - (dlogrho.*ddlogeta - ddlogrho.*dlogeta)./... (dlogrho.^2 + dlogeta.^2).^(1.5); end
github
TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox-master
kernmatrix.m
.m
Predictor-Based-Subspace-IDentification-toolbox-master/extra/backwards/private/kernmatrix.m
3,842
utf_8
f5ac9d877d0e03e735508333491c3fcb
function omega = kernmatrix(Xtrain,kernel_type,kernel_pars,Xt) %KERNMATRIX Construct the positive (semi-) definite and symmetric kernel matrix % % Omega = kernel_matrix(X, kernel_fct, sig2) % % This matrix should be positive definite if the kernel function % satisfies the Mercer condition. Construct the kernel values for % all test data points in the rows of Xt, relative to the points of X. % % Omega_Xt = kernel_matrix(X, kernel_fct, sig2, Xt) % % % Full syntax: % % Omega = kernel_matrix(X, kernel_fct, sig2) % Omega = kernel_matrix(X, kernel_fct, sig2, Xt) % % Outputs: % Omega : N x N (N x Nt) kernel matrix % Inputs: % X : N x d matrix with the inputs of the training data % kernel : Kernel type (by default 'RBF_kernel') % sig2 : Kernel parameter (bandwidth in the case of the 'RBF_kernel') % Xt(*) : Nt x d matrix with the inputs of the test data % Copyright (c) 2002, KULeuven-ESAT-SCD, % License & help @ http://www.esat.kuleuven.ac.be/sista/lssvmlab nb_data = size(Xtrain,1); if nb_data> 3000, error('Too memory intensive, the kernel matrix is restricted to size 3000 x 3000 '); end if strcmpi(kernel_type,'rbf'), if nargin<4, XXh = sum(Xtrain.^2,2)*ones(1,nb_data); omega = (XXh+XXh') - 2*(Xtrain*Xtrain'); omega = exp(-omega./kernel_pars(1)); else XXh1 = sum(Xtrain.^2,2)*ones(1,size(Xt,1)); XXh2 = sum(Xt.^2,2)*ones(1,nb_data); omega = XXh1+XXh2' - 2*Xtrain*Xt'; omega = exp(-omega./kernel_pars(1)); end else if nargin<4, omega = zeros(nb_data,nb_data); for i=1:nb_data, omega(i:end,i) = feval(lower(kernel_type),Xtrain(i,:),Xtrain(i:end,:),kernel_pars); omega(i,i:end) = omega(i:end,i)'; end else if size(Xt,2)~=size(Xtrain,2), error('dimension test data not equal to dimension traindata;'); end omega = zeros(nb_data, size(Xt,1)); for i=1:size(Xt,1), omega(:,i) = feval(lower(kernel_type),Xt(i,:),Xtrain,kernel_pars); end end end end function x = lin(a,b,c) % kernel function for implicit higher dimension mapping, based on % the standard inner-product % % x = lin_kernel(a,b) % % 'a' can only contain one datapoint in a row, 'b' can contain N % datapoints of the same dimension as 'a'. % % see also: % poly_kernel, RBF_kernel, MLP_kernel, trainlssvm, simlssvm % Copyright (c) 2002, KULeuven-ESAT-SCD, License & help @ http://www.esat.kuleuven.ac.be/sista/lssvmlab x = zeros(size(b,1),1); for i=1:size(b,1), x(i,1) = a*b(i,:)'; end end function x = poly(a,b,d) % polynomial kernel function for implicit higher dimension mapping % % X = poly_kernel(a,b,[t,degree]) % % 'a' can only contain one datapoint in a row, 'b' can contain N % datapoints of the same dimension as 'a'. % % x = (a*b'+t^2).^degree; % % see also: % RBF_kernel, lin_kernel, MLP_kernel, trainlssvm, simlssvm % % Copyright (c) 2002, KULeuven-ESAT-SCD, License & help @ http://www.esat.kuleuven.ac.be/sista/lssvmlab if length(d)>1, d=d(2); t=d(1); else d = d(1);t=1; end d = (abs(d)>=1)*abs(d)+(abs(d)<1); % >=1 !! x = zeros(size(b,1),1); for i=1:size(b,1), x(i,1) = (a*b(i,:)'+t^2).^d; end end function x = mlp(a,b, par) % Multi Layer Perceptron kernel function for implicit higher dimension mapping % % x = MLP_kernel(a,b,[s,t]) % % 'a' can only contain one datapoint in a row, 'b' can contain N % datapoints of the same dimension as 'a'. % % x = tanh(s*a'b+t^2) % % see also: % poly_kernel, lin_kernel, RBF_kernel, trainlssvm, simlssvm % Copyright (c) 2002, KULeuven-ESAT-SCD, License & help @ http://www.esat.kuleuven.ac.be/sista/lssvmlab if length(par)==1, par(2) = 1; end x = zeros(size(b,1),1); for i=1:size(b,1), dp = a*b(i,:)'; x(i,1) = tanh(par(1)*dp + par(2)^2); end end