//1
help eigenvalue

a=4;b=%pi

A=[1 2 3;4 5 6; 7 8 9]
C=A'

//2
[A,[0 0 0]']
[A;[0,0,0]]

X=[1:20]
X=[X,21]
Y=[1:2:20]
Z=linspace(1,5,50);

//3
2+1:5
2+(1:5)
[2:1/10:%pi]

b=A(2,:)
c=A(:,3)
B=A(1:2,1:2)

//4
M=A(:,1:2)

length(A)
size(A)
A+C,A*C,2*A
A+1
n=4; I4=eye(n,n)
B=zeros(n,n)
D=ones(3,2)
p=2; A^p
det(A)
trace(A)
spec(A)
sum(X)
cumsum(X)

//5
Y=5*ones(10,1)

//6
pscal=A(:,1)'*A(:,2)

//7
S=sum([0:2:99])

(A<3)|(A>7)
1*(A>2)

//8
sqrt(2:2:10)

//9
Co=cos(1:100)
sum(Co>0.5)

A^2
A.^2

A*C
A.*C

1./A
1 ./A

//10
[1:10]^2

//11
1 ./[1:10]

//12
cumsum(1 ./[1:10])

rand
X=rand(1,1000);
D=rand(2,3)
m=mean(X)
v=variance(X)
sigma=std(X)

//13
X=rand(1,2000);
mean(X) //a comparer a 0.5

//14
mean(X^3) //a comparer a 0.25

//15
Y=rand(1,20)
N=sum(Y<0.3)
//N suit une loi binomiale(20,0.3)

//16 
help grand // option 'nor', 'exp' et 'poi'

//17 
Z=grand(1,100,'nor',0,2);
//Attention le dernier parametre de la loi normale est son ecart-type, pas sa variance
mean(Z)
variance(Z) // a comparer a 0 et 4

//18
Po=grand(1,100,'poi',2);
mean(Po)
variance(Po) // a comparer a 2 et 2

//19 voir fichier blabla.sce

t=linspace(-2,2,50);
plot2d(t,exp(t)+3,5)
// ou pour les habitues de matlab
plot(t,exp(t)+3,'r')
xtitle("graphe","temps","fn")

//20
clf
t=linspace(-%pi,%pi,100);
plot2d(t,cos(t))
plot2d(t,1-t^2/2,3)
plot2d(t,0.5*ones(t))
plot2d([%pi/2,%pi/2],[-1,1])
// ou encore, pour les habitues de matlab
clf
plot(t,cos(t))
plot(t,1-t^2/2,'g')
plot(t,0.5*ones(t))
plot([%pi/2,%pi/2],[-1,1])

//ou encore, plusieurs courbes a la fois :
clf
plot2d(t',[cos(t') 1-t'^2/2,0.5*ones(t')]) // Necessite des vecteurs colonnes
plot2d([%pi/2,%pi/2],[-1,1])
clf

//21
clf
X=grand(1,100,'nor',0,1);
X2=grand(1,1000,'nor',0,1);
X3=grand(1,10000,'nor',0,1);
histplot(10,X)
histplot(30,X2,style=3)
histplot(100,X3,style=2)

//22
t=[-3:0.1:3]; 
plot2d(t,dnorm(t))



exec('truc.sci', -1)
toto(2)
toto([1:10])

//23 voir fichier densnormale.sci, a executer

//24 
clf
X=grand(1,1000,'exp',0.5);
histplot(30,X,style=3)
t=[0:0.1:5]
plot2d(t,dexp(t,2))


