cas_setup(0,0,0,1,0,[1e-10,1e-17],12,[1,50,0,25],0,0,0),xcas_mode(0);
cov_matrix([[1,2],[3,4],[5,6]]);
cov_matrix([[2,1,3],[4,2,1],[1,3,2],[3,1,4]]);
cov_matrix([[1,0,0],[0,1,0],[0,0,1],[1,1,1]]);
cov_matrix([[1,2,3],[4,5,6],[7,8,9],[2,4,6]]);
cov_matrix([[10,2],[3,40],[5,6],[7,80]]);
pca_eigenvalues([[2,1,1],[1,2,1],[1,1,2]]);
pca_eigenvalues([[4,2],[2,3]]);
pca_eigenvalues([[1,0,0],[0,2,0],[0,0,3]]);
pca_eigenvalues(cov_matrix([[1,2],[3,4],[5,6]]));
pca_eigenvalues(cov_matrix([[2,1,3],[4,2,1],[1,3,2],[3,1,4]]));
pca_explained_ratio([6,4,1]);
pca_explained_ratio([4,1]);
pca_explained_ratio([3,1,1]);
pca_explained_ratio([10,5,3,2]);
pca_explained_ratio(pca_eigenvalues([[2,1,1],[1,2,1],[1,1,2]]));
pca_V([[2,1,1],[1,2,1],[1,1,2]]);
pca_V([[4,2],[2,3]]);
pca_V([[1,0,0],[0,2,0],[0,0,3]]);
pca_V(cov_matrix([[1,2],[3,4],[5,6]]));
pca_V(cov_matrix([[2,1,3],[4,2,1],[1,3,2],[3,1,4]]));
pca_loadings([[2,1,1],[1,2,1],[1,1,2]]);
pca_loadings([[2,1,1],[1,2,1],[1,1,2]],1);
pca_loadings([[2,1,1],[1,2,1],[1,1,2]],2);
pca_loadings([[4,2],[2,3]],1);
pca_loadings(cov_matrix([[2,1,3],[4,2,1],[1,3,2],[3,1,4]]),2);
pca_loadings(cov_matrix([[1,2,3],[4,5,6],[7,8,9],[2,4,6]]),1);
pca_scores([[1,2],[3,4],[5,6]],1);
pca_scores([[2,1,3],[4,2,1],[1,3,2],[3,1,4]],1);
pca_scores([[2,1,3],[4,2,1],[1,3,2],[3,1,4]],2);
pca_scores([[1,0,0],[0,2,0],[0,0,3],[1,1,1]],2);
pca_scores([[10,2],[3,40],[5,6],[7,80]],1);
pca_select_q([[2,1,1],[1,2,1],[1,1,2]],0.80);
pca_select_q([[2,1,1],[1,2,1],[1,1,2]],0.90);
pca_select_q([[2,1,1],[1,2,1],[1,1,2]],1.0);
pca_select_q(cov_matrix([[2,1,3],[4,2,1],[1,3,2],[3,1,4]]),0.80);
pca_select_q(cov_matrix([[2,1,3],[4,2,1],[1,3,2],[3,1,4]]),0.95);
pca_select_q(cov_matrix([[1,2,3],[4,5,6],[7,8,9],[2,4,6]]),0.99);
pca([[1,2],[3,4],[5,6]],0.99);
pca([[2,1,3],[4,2,1],[1,3,2],[3,1,4]],0.80);
pca([[2,1,3],[4,2,1],[1,3,2],[3,1,4]],0.95);
pca([[1,0,0],[0,2,0],[0,0,3],[1,1,1]],0.90);
pca([[10,2],[3,40],[5,6],[7,80]],0.85);
pca([[1,2,3],[4,5,6],[7,8,9],[2,4,6]],1.0);
mlr_beta([[1],[2],[3],[4],[5]],[2.1,3.9,6.2,7.8,10.1]);
mlr_beta([[1,1],[2,3],[3,2],[4,5],[5,4],[6,6]],[3.1,7.9,6.8,12.5,11.2,16.0]);
mlr_predict([[1],[2],[3],[4],[5]],[0.05,1.99]);
mlr_predict([[1,1],[2,3],[3,2],[4,5],[5,4],[6,6]],[1.0,1.5,0.5]);
mlr_residuals([[1],[2],[3],[4],[5]],[2.1,3.9,6.2,7.8,10.1]);
mlr_residuals([[1,1],[2,3],[3,2],[4,5],[5,4],[6,6]],[3.1,7.9,6.8,12.5,11.2,16.0]);
mlr_r2([[1],[2],[3],[4],[5]],[2.1,3.9,6.2,7.8,10.1]);
mlr_r2([[1,1],[2,3],[3,2],[4,5],[5,4],[6,6]],[3.1,7.9,6.8,12.5,11.2,16.0]);
mlr_sigma2([[1],[2],[3],[4],[5]],[2.1,3.9,6.2,7.8,10.1]);
mlr_sigma2([[1,1],[2,3],[3,2],[4,5],[5,4],[6,6]],[3.1,7.9,6.8,12.5,11.2,16.0]);
mlr_mse([[1],[2],[3],[4],[5]],[2.1,3.9,6.2,7.8,10.1]);
mlr_mse([[1,1],[2,3],[3,2],[4,5],[5,4],[6,6]],[3.1,7.9,6.8,12.5,11.2,16.0]);
mlr_ic([[1],[2],[3],[4],[5]],[2.1,3.9,6.2,7.8,10.1]);
mlr_ic([[1,1],[2,3],[3,2],[4,5],[5,4],[6,6]],[3.1,7.9,6.8,12.5,11.2,16.0]);
mlr([[1],[2],[3],[4],[5]],[2.1,3.9,6.2,7.8,10.1]);
mlr([[1,1],[2,3],[3,2],[4,5],[5,4],[6,6]],[3.1,7.9,6.8,12.5,11.2,16.0]);
mlr([[1,5,2],[3,2,8],[2,8,1],[7,1,5],[4,6,3],[6,3,7],[5,4,4]],[12.1,18.3,22.5,28.7,19.4,25.6,23.2]);
size(brownian(1,4));
brownian(1,4)[0];
size(brownian(1,4,3));
size(brownian(1,4,3)[0]);
gbm(100,0.05,0,1,4)[0];
gbm(100,0.05,0,1,4)[4]-100*exp(0.05);
ornstein_uhlenbeck(3,1,0,0,1,4)[0];
ornstein_uhlenbeck(3,1,0,0,1,4)[4]-3*exp(-1);
ornstein_uhlenbeck(3,1,5,0,1,4)[4]-(5+(3-5)*exp(-1));
cir(0.03,1,0.04,0.1,1,12)[0];
size(cir(0.03,1,0.04,0.1,1,12));
sde_euler(-x,0,1,1,4)[0];
sde_euler(-x,0,1,1,4)[4]-0.75^4;
sde_milstein(-x,0,1,1,4)[4]-0.75^4;
size(sde_euler(0.05*x,0.2*x,100,1,10,5));
bs_price([100,100,0.05,0.2,1]);
bs_price([100,100,0.05,0.2,1,"call"]);
bs_price([100,100,0.05,0.2,1,"put"]);
bs_price([120,100,0.03,0.25,0.5,"call"]);
bs_price([120,100,0.03,0.25,0.5,"put"]);
bs_price([100,100,0.05,0.2,1,"call"])-bs_price([100,100,0.05,0.2,1,"put"]);
100-100*exp(-0.05*1);
bs_delta([100,100,0.05,0.2,1,"call"]);
bs_delta([100,100,0.05,0.2,1,"put"]);
bs_delta([100,100,0.05,0.2,1,"call"])-bs_delta([100,100,0.05,0.2,1,"put"]);
bs_gamma([100,100,0.05,0.2,1]);
bs_gamma([100,100,0.05,0.2,1,"call"])-bs_gamma([100,100,0.05,0.2,1,"put"]);
bs_vega([100,100,0.05,0.2,1]);
bs_theta([100,100,0.05,0.2,1,"call"]);
bs_rho([100,100,0.05,0.2,1,"call"]);
bs_greeks([100,100,0.05,0.2,1,"call"]);
bs_greeks([120,100,0.03,0.25,0.5,"put"]);
bs_implied_vol([10.450584,100,100,0.05,1,"call"]);
bs_implied_vol([5.573526,100,100,0.05,1,"put"]);
bs_implied_vol([22.762665,120,100,0.03,0.5,"call"]);
mc_estimate([2,4,4,4,5,5,7,9])[0][1]-5;
mc_estimate([2,4,4,4,5,5,7,9])[5][1];
mc_estimate([2,4,4,4,5,5,7,9])[3][1]-mc_estimate([2,4,4,4,5,5,7,9])[2][1]-2*mc_estimate([2,4,4,4,5,5,7,9])[1][1];
mc_estimate([1,1,1,1])[0][1]-1;
mc_estimate([1,1,1,1])[1][1];
size(mc_estimate([1,2,3,4,5]));
mc_estimate([1,2,3,4,5])[0][0];
mc_estimate([1,2,3,4,5])[4][0];
size(mc_mean(x*x,x,normald,[0,1],1000));
mc_mean(x*x,x,normald,[0,1],1000)[5][1];
size(mc_bs_price(100,100,0.05,0.2,1,10000));
mc_bs_price(100,100,0.05,0.2,1,10000)[5][1];
mc_bs_price(100,100,0.05,0.2,1,10000)[5][0];
mc_mean_antithetic(x,x,1000)[0][1];
mc_mean_antithetic(x,x,1000)[1][1];
size(mc_mean_antithetic(exp(x),x,1000));
mc_mean_antithetic(exp(x),x,1000)[5][1];
size(mc_bs_price_antithetic(100,100,0.05,0.2,1,10000));
mc_bs_price_antithetic(100,100,0.05,0.2,1,10000)[5][1];
mc_bs_price_antithetic(100,100,0.05,0.2,1,10000)[5][0];
