Friday, March 27, 2015

2nd order ODE of Josephson’s Junction



The system of two coupled non-linear 2nd order differential equations that represent the Josephson’s Junction phenomenon on superconductors is presented here, as adapted from Hairer et al
 

The equations describe the electron-pair interactions between two superconducting elements that are separated by a thin insulator, under the influence of an applied current source. The obvious first step in attempting to numerically integrate these equations is to decouple it.

Coupled equations can be decoupled in a variety of ways. Perhaps the easiest one is the brute-force method, where in a few algebraic sleights are performed to eliminate one the variables in either equation. In the subject case, multiplying the second equation by "alpha" and adding it to the first to eliminate one of the 2nd derivative variables. Subsequently, this equation can be substituted into the first equation to obtain the decoupled versions. 

The algebraic sleight works best with a limited set of equations (usually up to two at the most). As the number of equations increases, the algebraic decoupling process becomes rather cumbersome. An alternative is to use the matrix formulation instead. The Josephson equations then become:

 A matrix inversion can then be performed to obtain the decoupled equations: 


Since the matrix that requires the inversion is a constant, only a single inversion is required in the integration process.

And the two 2nd order ODE’s can be considered as being successfully decoupled. Numerical integration is just a step away, once the 2nd order ODE’s are converted to 1st order ODE’s.

Plotted below is the numerical solution of the equations, performed using a Rosenbrock technique. The initial conditions and values for the constants from Hairer et al were used for the analysis. 





Friday, March 20, 2015

Some observations on the Monte Carlo simulations



Setting aside the triviality of the premise for “calculating” pi (i.e., one needs to be cognizant of the fact that the area of the circle is represented using a pi term in it, implying that pi is already known to the user), this simple example illustrates the basics of the Monte Carlo technique. The following general observations can be made from the pi-experiment:

  •          A mathematical model needs to be in place in order to perform a sensitivity analysis of the system.
  •          Given a model, a prediction can be made for the steady state output of the system, for a set of input variables.
  •         Should a question arise on the validity of the outputs, the MC technique can be consulted. Specifically, the question can arise in the form of what variation can be statistically forecast in the outputs in the event of a variation in the inputs.
  •          Having posed the question thusly, the parametric statistical variation can be performed to the inputs over a bounded interval, and the behavior of the mathematical model can be obtained.

If the system being analyzed is linear, a bell-curve distribution can be expected for large sample sizes randomized multiple times. One needs to be cognizant of the fact that MC simulations are highly statistical, and depend heavily on the validity of both the input variables and the mathematical model. In the case of the pi-estimation experiment, a sample size of 1000 can only have a discrete number of marbles fall within the confines of the circle. Thus, the accuracy of the estimate for pi is limited to the 1000ths place; i.e., only three decimal places can be predicted for pi with a 1000-sample bin. For a 10,000 size bin, only a 4-digit accuracy can be predicted. However, repeated throws and subsequent averaging using the MC simulation can statistically result in values of pi that include far more number of digits. This is clear from the histograms shown earlier.

That greater accuracies can be seemingly predicted with a MC technique that is initially not available in the model is a rather disturbing thought. Adequate understanding of the Physics of the system being modeled, combined with proper bin sizes for the data analysis in a real-world system is thus an absolute necessity before one can launch off on an MC simulation to predict meaningful results.

Saturday, March 14, 2015

Estimating pi using the MC technique - part 3



Continuing the example from the previous post, histograms for three such throws are presented here. In each of these experiments, a VBA macro was incorporated to determine the distribution and the predicted value of pi. Sample sizes of 1000, 10000 and 100000 were used as a starting point, and each sample was randomized 100 times to determine the results.

As the sample size increases, the statistical analysis approaches closer to a bell-curve distribution, while the mean value of pi gets closer to the “expected” value. 




Incidentally, today is 3/14 - pi day. A special one, at 9:26:54 (or 53?!) am or pm. 

Saturday, March 7, 2015

Estimating pi using the MC technique - part 2



As is evident from the earlier post, the larger the sample size, the more is the number of digits in the estimate for pi. However, a question now arises as to whether or not this random sampling of marbles would hold good for every throw. The clichéd analogy is the well known problem that the probability of obtaining a head or a tail from a coin toss is 50%. While it is very well possible that the percentage may spike vastly from 50% for small sample sizes (aka beginner’s luck in gambling), the average gets closer to 50% as the number of tosses increases and stays pegged at 50% for very large sizes.

Getting back to estimating pi, the Monte Carlo analysis looks at analyzing the problem for several throws of the marbles, while each throw gets perturbed for its inputs (i.e., randomized probabilities) in order to obtain a contour map of the possibilities or regions for the occurrences of the solutions.

However, what’s to say that a random throw of marbles (no matter what the sample size is) that works for one throw will hold good for a 2nd throw, or any subsequent one? A second level analysis utilizing the MC technique can be incorporated, with multiple throws of randomized sample sizes in order to determine a statistical parametric output for large number of throws. 

To be cont'd