# Essays/Christoffel/Christoffel04

##### 10.5 Covariant Differentiation (ISS Section 33)

```NB. ... script (ijs) ...

f=:(*:@x1**:@sin@x2*x3)"1
```

```NB. ... execute (ijx) ...

\$f xpgen''
8000
```

```NB. ... script (ijs) ...

A=:((2*x1**:@sin@x2*x3),(2**:@x1*sin@x2*cos@x2*x3),*:@x1**:@sin@x2)"1
```

```NB. ... execute (ijx) ...

\$A xpgen''
8000 3
```

...

... check using the 'D.' primitive ...

...

```NB. ... execute (ijx) ...

+/@:((A((2^_21)teq[;])f D.1)"1) xpgen''
8000
```

```NB. ... script (ijs) ...

B=:axs@((0;dxdy),0;A)"1
```

```NB. ... execute (ijx) ...

\$B xpgen''
8000 3
```

...

... check using the 'D.' primitive ...

...

```NB. ... execute (ijx) ...

NB. ... example ...

nzmin B xpgen''
0.00220366
nzmin (2^_21)&tsz@(f@cxx D.1@cyy)"1 xpgen''
0.00220367
nzmax B xpgen''
29.1275
nzmax (2^_21)&tsz@(f@cxx D.1@cyy)"1 xpgen''
29.1275
nzcount B xpgen''
16000
nzcount (2^_21)&tsz@(f@cxx D.1@cyy)"1 xpgen''
16000

NB. ... so ...

+/@:((B((2^_19)teq[;])(2^_21)&tsz@(f@cxx D.1@cyy))"1) xpgen''
8000
```

```NB. ... script (ijs) ...

```

```NB. ... execute (ijx) ...

8000 3 3
```

...

... check using the 'D.' primitive ...

...

```NB. ... execute (ijx) ...

8000
```

```NB. ... script (ijs) ...

```

```NB. ... execute (ijx) ...

8000 3 3 3
```

...

... check using the 'D.' primitive ...

...

```NB. ... execute (ijx) ...

8000
```

```NB. ... script (ijs) ...

dBdyt1  =:axs@((0;dxdy),1;dBdyt1p0)
dBdyt2p0=:axs@((2;d2xdydx),0;dxdy)
dBdyt2  =:axs@((0;dBdyt2p0),0;A)
dBdy    =:(dBdyt1(+tz)dBdyt2)"1
```

```NB. ... execute (ijx) ...

\$dBdy xpgen''
8000 3 3
```

...

... check using the 'D.' primitive ...

...

```NB. ... execute (ijx) ...

+/@:((dBdy((2^_19)teq[;])(2^_23)&tsz@(0|:B@cxx D.1@cyy))"1) xpgen''
8000
```

```NB. ... script (ijs) ...

```

```NB. ... execute (ijx) ...

\$Acv xpgen''
8000 3 3
```

```NB. ... script (ijs) ...

Bcv=:(dBdy(-tz)axs@((2;gC2k),0;B))"1
```

```NB. ... execute (ijx) ...

\$Bcv xpgen''
8000 3 3
```

```NB. ... execute (ijx) ...

s0t1p0=:axs@((0;dxdy),1;Acv)
s0t1  =:axs@((0;dxdy),1;s0t1p0)
+/@:((Bcv-:s0t1)"1) xpgen''
8000
```

```NB. ... script (ijs) ...

```

```NB. ... execute (ijx) ...

\$dAcvdx xpgen''
8000 3 3 3
```

...

... check using the 'D.' primitive ...

...

```NB. ... execute (ijx) ...

+/@:((dAcvdx((2^_19)teq[;])0|:Acv D.1)"1) xpgen''
8000
```

```NB. ... script (ijs) ...

Acvcvp0=:(dAcvdx(-tz)(1|:axs@((2;hC2k),0;Acv))(+tz)0|:0|:axs@((2;hC2k),1;Acv))"1
Acvcv  =:(2^_42)&tsz@Acvcvp0      NB. special
```

```NB. ... execute (ijx) ...

\$Acvcv xpgen''
8000 3 3 3

nzmin Acvcvp0 xpgen''
5.68434e_14
nzmin Acvcv xpgen''
0.0244717
```

```NB. ... script (ijs) ...

Bcvcvp0=:axs@((0;dxdy),2;Acvcv)
Bcvcvp1=:axs@((0;dxdy),2;Bcvcvp0)
Bcvcv  =:axs@((0;dxdy),2;Bcvcvp1)"1
```

```NB. ... execute (ijx) ...

\$Bcvcv xpgen''
8000 3 3 3
```

```NB. ... execute (ijx) ...

NB. ... for this xpgen ...
NB. ... values calculated are within a reasonable range ...

nf0=:cxx;cyy;dxdy;dydx;d2xdydx;d2ydxdx;h20;h02;dh20dx;hC1k;hC2k;dhC2kdx

(0j_3&":@nzmin;0j_3&":@nzmax;6&":@nzcount)&>@(nf0,nf1) xpgen''
┌────────┬───────┬──────┐
│1.571e_2│1.020e1│ 24000│
├────────┼───────┼──────┤
│1.224e_2│9.877e0│ 24000│
├────────┼───────┼──────┤
│2.447e_3│1.263e1│ 64000│
├────────┼───────┼──────┤
│1.224e_2│9.877e0│ 64000│
├────────┼───────┼──────┤
│2.447e_4│7.973e1│152000│
├────────┼───────┼──────┤
│1.224e_2│9.877e0│152000│
├────────┼───────┼──────┤
│6.118e_3│1.000e2│ 24000│
├────────┼───────┼──────┤
│1.000e_2│1.635e2│ 24000│
├────────┼───────┼──────┤
│2.447e_2│9.978e1│ 24000│
├────────┼───────┼──────┤
│1.224e_2│4.989e1│ 72000│
├────────┼───────┼──────┤
│1.224e_2│1.000e1│ 72000│
├────────┼───────┼──────┤
│1.000e_2│4.086e1│ 80000│
├────────┼───────┼──────┤
│9.610e_4│1.379e2│  8000│
├────────┼───────┼──────┤
│3.844e_3│1.411e2│ 24000│
├────────┼───────┼──────┤
│2.204e_3│2.913e1│ 16000│
├────────┼───────┼──────┤
│5.191e_3│2.689e2│ 64000│
├────────┼───────┼──────┤
│2.076e_2│5.643e2│152000│
├────────┼───────┼──────┤
│5.142e_3│3.136e0│ 32000│
├────────┼───────┼──────┤
│1.922e_3│2.758e2│ 72000│
├────────┼───────┼──────┤
│5.142e_3│3.136e0│ 32000│
├────────┼───────┼──────┤
│7.688e_3│2.821e2│176000│
├────────┼───────┼──────┤
│2.447e_2│3.902e2│  8000│
├────────┼───────┼──────┤
│1.550e_3│4.927e1│ 64000│
└────────┴───────┴──────┘
```