### Related

##### lsum-makelist-random-sum

lsum(k,k,makelist(lsu...

Calculate

##### lsum-makelist-random-sum

lsum(i,i,makelist(ran...

Calculate

##### lsum

f(n) := lsum(5^i^2, i...

Calculate

##### lsum-makelist-random-sum

lsum(k,k,makelist(lsu...

Calculate

##### lsum-matrix-transpose

t: matrix([t11,t12,t1...

j: matrix([1,0,0],[0,...

z0: list_matrix_entri...

Calculate

##### lsum

a:[1,2,3,4,1,2,3];

be:\exp ^(a);

ae:be/lsum(i,i,be);

Calculate

##### lsum-sum

lsum(x^i,i,[1,n]);

Calculate

##### lsum-sum

lsum (1/n^2, n, [1,in...

Calculate

##### lsum-matrix-solve

P:matrix([0.59,1.76,2...

V:matrix([X],[10],[10]);

Q:P . V;

Calculate

##### lsum-makelist-random

makelist(lsum(i,i,mak...

Calculate

### lsum

Run Example
```(%i1)build_info();

Maxima version: 5.21.1
Maxima build date: 7:25 9/18/2010
Host type: x86_64-unknown-linux-gnu
Lisp implementation type: GNU Common Lisp (GCL)
Lisp implementation version: GCL 2.6.7

(%o1)
(%i2) /* compute angles for intrinsic Tait-Bryan angles * on axes y-z'-x'', conventionally named pitch, yaw, and roll * (following terminology on Wikipedia page for "Euler angles") * via method expounded by G. Slabaugh: * http://www.staff.city.ac.uk/~sbbh653/publications/euler.pdf * * Argument R is a 3x3 rotation matrix. * Return value is a list of two triples, [[pitch1, yaw1, roll1], [pitch2, yaw2, roll2]], * because there are always two solutions. */intrinsic_yzx (R) :=  if equal (R[2, 1], 1) or equal (R[2, 1], -1)    then intrinsic_yzx_yaw_pi2 (R)    else block ([pitch1, pitch2, yaw1, yaw2, roll1, roll2],      yaw1 : asin (R[2, 1]),       yaw2 : %pi - yaw1,      pitch1 : atan2 (-R[3, 1]/cos(yaw1), R[1, 1]/cos(yaw1)),      pitch2 : atan2 (-R[3, 1]/cos(yaw2), R[1, 1]/cos(yaw2)),      roll1 : atan2 (-R[2, 3]/cos(yaw1), R[2, 2]/cos(yaw1)),      roll2 : atan2 (-R[2, 3]/cos(yaw2), R[2, 2]/cos(yaw2)),      [[pitch1, yaw1, roll1], [pitch2, yaw2, roll2]]);
(%o2) intrinsic_yzx(R) := if equal(R    , 1) or equal(R    , - 1)
2, 1               2, 1
then intrinsic_yzx_yaw_pi2(R) else block([pitch1, pitch2, yaw1, yaw2, roll1,
roll2], yaw1 : asin(R    ), yaw2 : %pi - yaw1,
2, 1
- R         R                         - R         R
3, 1      1, 1                        3, 1      1, 1
pitch1 : atan2(---------, ---------), pitch2 : atan2(---------, ---------),
cos(yaw1)  cos(yaw1)                  cos(yaw2)  cos(yaw2)
- R         R                        - R         R
2, 3      2, 2                       2, 3      2, 2
roll1 : atan2(---------, ---------), roll2 : atan2(---------, ---------),
cos(yaw1)  cos(yaw1)                 cos(yaw2)  cos(yaw2)
[[pitch1, yaw1, roll1], [pitch2, yaw2, roll2]])
(%i3) intrinsic_yzx_yaw_pi2 (R) :=  block ([pitch1, pitch2, yaw1, yaw2, roll1, roll2],    yaw1 : %pi/2,    roll1 : 0, /* could be anything */    pitch1 : -roll1 + atan2 (R[3, 2], R[3, 3]),    yaw2 : -%pi/2,    roll2 : 0, /* could be anything */    pitch2 : roll2 + atan2 (R[1, 3], R[1, 2]),    [[pitch1, yaw1, roll1], [pitch2, yaw2, roll2]]);
(%o3) intrinsic_yzx_yaw_pi2(R) := block([pitch1, pitch2, yaw1, yaw2, roll1,
%pi
roll2], yaw1 : ---, roll1 : 0, pitch1 : - roll1 + atan2(R    , R    ),
2                                        3, 2   3, 3
- %pi
yaw2 : -----, roll2 : 0, pitch2 : roll2 + atan2(R    , R    ),
2                                       1, 3   1, 2
[[pitch1, yaw1, roll1], [pitch2, yaw2, roll2]])
(%i4) set_random_state (make_random_state (1));
(%o4)                                done
(%i5) random_3d_unit () := (random_3d (), %%/norm(%%));
%%
(%o5)             random_3d_unit() := (random_3d(), --------)
norm(%%)
(%i6) random_3d () := makelist (random (10), i, 1, 3);
(%o6)            random_3d() := makelist(random(10), i, 1, 3)
(%i7) norm (v) := sqrt (lsum (x^2, x, v));
2
(%o7)                   norm(v) := sqrt(lsum(x , x, v))
(%i8) u : random_3d_unit ();
5          9          4
(%o8)                  [---------, ---------, ---------]
sqrt(122)  sqrt(122)  sqrt(122)
(%i9) v : random_3d_unit ();
8         3         3
(%o9)                   [--------, --------, --------]
sqrt(82)  sqrt(82)  sqrt(82)
(%i10) R(a,b):= block ([v, s, c], v:cross(a,b), s:norm(v), c:dot(a,b), ident(length(a)) + ssc(v) + (ssc(v).ssc(v))*(1 - c)/s^2, ratsimp(%%));
(%o10) R(a, b) := block([v, s, c], v : cross(a, b), s : norm(v),
(ssc(v) . ssc(v)) (1 - c)
c : dot(a, b), ident(length(a)) + ssc(v) + -------------------------,
2
s
ratsimp(%%))
(%i11) cross(a,b) := [a[2]*b[3]-b[2]*a[3], -(a[1]*b[3]-b[1]*a[3]), a[1]*b[2]-b[1]*a[2]];
(%o11) cross(a, b) := [a  b  - b  a , - (a  b  - b  a ), a  b  - b  a ]
2  3    2  3      1  3    1  3    1  2    1  2
(%i12) norm(v):= sqrt(v[1]^2 + v[2]^2 + v[3]^2);
2    2    2
(%o12)                   norm(v) := sqrt(v  + v  + v )
1    2    3
(%i13) dot(a,b):= a[1]*b[1]+a[2]*b[2]+a[3]*b[3];
(%o13)                dot(a, b) := a  b  + a  b  + a  b
1  1    2  2    3  3
(%i14) ssc(v) := matrix ([0, -v[3], v[2]], [v[3], 0, -v[1]], [-v[2], v[1], 0]);
(%o14)   ssc(v) := matrix([0, - v , v ], [v , 0, - v ], [- v , v , 0])
3   2     3        1       2   1
(%i15) Ruv : float (R (u, v));
[  0.80240796270139   0.58412740488141   0.12221553199131  ]
[                                                          ]
(%o15)   [ - 0.5556446634958   0.80598226750272  - 0.20408721762966 ]
[                                                          ]
[ - 0.21771648840189  0.09585280036434   0.97129386456431  ]
(%i16) intrinsic_yzx (Ruv);

rat: replaced -1.5556446634958 by -7758/4987 = -1.55564467615801

rat: replaced 0.4443553365042 by 4987/11223 = 0.44435534170899
(%o16) [[0.26495004690786, - 0.58913814199809, 0.24800273610235],
[- 2.876642606681936, %pi + 0.58913814199809, - 2.89358991748744]]
(%i17) ```
Run Example
```lsum(i,i,makelist(random(6)+1,i,1,5))/5.0;
(%o1)                                 3.6
(%i2) ```
Run Example
```load (distrib);
(%o1)     /usr/share/maxima/5.21.1/share/contrib/distrib/distrib.mac
(%i2) p: 1/10;
1
(%o2)                                 --
10
(%i3) n: 40;
(%o3)                                 40
(%i4) float(1-cdf_binomial(9,n,p));
(%o4)                         0.0050630536578344
(%i5) oa: 1-lsum(pdf_binomial(k,n,p), k, [0,1,2,3,4,5,6,7,8,9]);
12657634144585988229726995152568104783
(%o5)              ----------------------------------------
2500000000000000000000000000000000000000
(%i6) float(oa);
(%o6)                         0.0050630536578344
(%i7) ob: 1-lsum( binomial(n,k) * p^k * (1-p)^(n-k) , k, [0,1,2,3,4,5,6,7,8,9]);
12657634144585988229726995152568104783
(%o7)              ----------------------------------------
2500000000000000000000000000000000000000
(%i8) float(ob);
(%o8)                         0.0050630536578344
(%i9) ```

Help for Lsum