% mulsphere.m Berechnung des Volumens von mahrdimensionalen "Kugeln"
%  durch verkettete Integration im symbolischen Modus
syms x r R L K M H G D n real
s2 =simple( 2*int(sqrt(r^2-x^2), -r, r));
     s3 = simple( int(subs(s2,r,sqrt(R^2-x^2)), -R, R));
     s4 = simple(int(subs(s3,R,sqrt(L^2-x^2)), -L, L));
     s5 = simple(int(subs(s4,L,sqrt(K^2-x^2)), -K, K));
     s6 = simple(int(subs(s5,K,sqrt(M^2-x^2)), -M, M));
     s7 = simple(int(subs(s6,M,sqrt(H^2-x^2)), -H, H));
     s8 = simple(int(subs(s7,H,sqrt(G^2-x^2)), -G, G));
     s9 = simple(int(subs(s8,G,sqrt(D^2-x^2)), -D, D));
s2
%     subs('2*pi^(n/2)/(n/2-1)!*R^n/n',n,2)
 s3
%     subs('2^((n+1)/2)*pi^((n-1)/2)/(n-2)!*R^n/n',n,3)
     subs('R^n/n*2*pi^(n/2)/gamma(n/2)',n,3)
 s4
%     subs('2*pi^(n/2)/(n/2-1)!*R^n/n',n,4)
     subs('R^n/n*2*pi^(n/2)/gamma(n/2)',n,4)
 s5
%     subs('2^((n+1)/2)*pi^((n-1)/2)/(n-2)!*R^n/n',n,5)
     subs('R^n/n*2*pi^(n/2)/gamma(n/2)',n,5)
s6
%     subs('2*pi^(n/2)/(n/2-1)!*R^n/n',n,6)
     subs('R^n/n*2*pi^(n/2)/gamma(n/2)',n,6)
 s7
%     subs('2^((n+1)/2)*pi^((n-1)/2)/(n-2)!*R^n/n',n,7)
     subs('R^n/n*2*pi^(n/2)/gamma(n/2)',n,7)
s8
%     subs('2*pi^(n/2)/(n/2-1)!*R^n/n',n,8)
     subs('R^n/n*2*pi^(n/2)/gamma(n/2)',n,8)
% 
vols =     [ s2 s3; s4 s5; s6 s7; s8 s9]
     subs('R^n/n*2*pi^(n/2)/gamma(n/2)',n,[2 3; 4 5; 6 7; 8 9])

