254A, Notes 1: Lie groups, Lie algebras, and the Baker-Campbell-Hausdorff formula

What's new

In this set of notes, we describe the basic analytic structure theory of Lie groups, by relating them to the simpler concept of a Lie algebra. Roughly speaking, the Lie algebra encodes the “infinitesimal” structure of a Lie group, but is a simpler object, being a vector space rather than a nonlinear manifold. Nevertheless, thanks to the fundamental theorems of Lie, the Lie algebra can be used to reconstruct the Lie group (at a local level, at least), by means of the exponential map and the Baker-Campbell-Hausdorff formula. As such, the local theory of Lie groups is completely described (in principle, at least) by the theory of Lie algebras, which leads to a number of useful consequences, such as the following:

  • (Local Lie implies Lie) A topological group $latex {G}&fg=000000$ is Lie (i.e. it is isomorphic to a Lie group) if and only if it is locally…

View original post 10,833 more words

SPICE Hacking — error estimators

The initial transient simulation is launched by https://github.com/zhuangh/ngspice/blob/master/src/spicelib/analysis/dctran.c

The “node convergence” in http://www.eecs.berkeley.edu/Pubs/TechRpts/1989/ERL-89-42.pdf

is done inside of https://github.com/zhuangh/ngspice/blob/master/src/spicelib/analysis/dctran.c#L770

the SPICE also has device error check.



In the device error check process, it uses “DEV”trunc to lunch cktterr.c

volttol = ckt->CKTabstol + ckt->CKTreltol * 
         MAX( fabs(ckt->CKTstate0[ccap]),
chargetol = MAX(fabs(ckt->CKTstate0[qcap]),
chargetol = ckt->CKTreltol * 

check the error from both current difference and average charge difference over certain step ckt->CKTdelta.

for(i=ckt->CKTorder+1;i >=0;i--) { 
       diff[i] = ckt->CKTstates[i][qcap]; 
for(i=0 ; i = ckt->CKTorder ; i++) { 
      deltmp[i] = ckt->CKTdeltaOld[i]; 
j = ckt->CKTorder; 
for (;;) {
    for(i=0;i >= j;i++) { 
        diff[i] = (diff[i] - diff[i+1])/deltmp[i]; 
    if (--j < 0) break; 
    for(i=0;i >= j;i++) { 
        deltmp[i] = deltmp[i+1] + ckt->CKTdeltaOld[i]; 

The diff is calculated by charge, instead of current.

Hacking SPICE — tracing the function pointer to launch transient simulation job


The data structure of SPICE analysis is  https://github.com/zhuangh/ngspice/blob/master/src/spicelib/analysis/analysis.h

struct SPICEanalysis {
    IFanalysis if_analysis;
    int size;
    int domain;
    int do_ic;
    int (*setParm)(CKTcircuit *ckt, JOB *anal,
                         int which, IFvalue *value);
    int (*askQuest)(CKTcircuit *ckt, JOB *anal, 
                         int which, IFvalue *value);
    int (*an_init)(CKTcircuit *ckt, JOB *job);
    int (*an_func)(CKTcircuit *ckt, int restart);

when SPICE run initialization for that type of variable, it has a corresponding format as (transient simulation as a example)

SPICEanalysis TRANinfo  = {
        "Transient analysis",



Then, https://github.com/zhuangh/ngspice/blob/master/src/spicelib/analysis/cktdojob.c#L208 initializes the analysis job using the seventh member of SPICEanalysis TRANinfo, which is a function pointer pointing to TRANinit.


launches the analysis job using the eighth member of SPICEanalysis TRANinfo, which is a function pointer pointing to DCtran.