

SCILAB LINSPACE PC
Get the sensitivity indices average = polychaos_getmean ( pc ) var = polychaos_getvariance ( pc ) mprintf ( " Mean = %f\n ", average ) mprintf ( " Variance = %f\n ", var ) S = polychaos_getindexfirst ( pc ) mprintf ( " S1 = %f\n ", S ( 1 ) ) mprintf ( " S2 = %f\n ", S ( 2 ) ) ST = polychaos_getindextotal ( pc ) mprintf ( " ST1 = %f\n ", ST ( 1 ) ) mprintf ( " ST2 = %f\n ", ST ( 2 ) ) // Clean-up polychaos_destroy ( pc ) randvar_destroy ( vu1 ) randvar_destroy ( vu2 ) randvar_destroy ( vx1 ) randvar_destroy ( vx2 ) setrandvar_destroy ( srvu ) setrandvar_destroy ( srvx ) Compute the coefficients of the polynomial expansion polychaos_setdegree ( pc, degre ) polychaos_computeexp ( pc, srvx, " Integration " ) // 9. Perform the DOE inputdata = setrandvar_getsample ( srvu ) outputdata = Exemple ( inputdata ) polychaos_settarget ( pc, outputdata ) // 8. Create the polynomial ny = 1 pc = polychaos_new ( srvx, ny ) np = setrandvar_getsize ( srvx ) polychaos_setsizetarget ( pc, np ) // 7. Create the Design Of Experiments degre = 2 setrandvar_buildsample ( srvx, " Quadrature ", degre ) setrandvar_buildsample ( srvu, srvx ) // 6. A collection of uncertain parameters srvu = setrandvar_new ( ) setrandvar_addrandvar ( srvu, vu1 ) setrandvar_addrandvar ( srvu, vu2 ) // 5. Two uncertain parameters vu1 = randvar_new ( " Normale ", 1.0, 0.5 ) vu2 = randvar_new ( " Uniforme ", 1.0, 2.5 ) // 4. srvx = setrandvar_new ( ) setrandvar_addrandvar ( srvx, vx1 ) setrandvar_addrandvar ( srvx, vx2 ) // 3. Two stochastic (normalized) variables vx1 = randvar_new ( " Normale " ) vx2 = randvar_new ( " Uniforme " ) // 2. The current toolbox is a stand-alone component which uses only standard Scilab features. To achieve this goal, the interface uses a hash map, which stores the map between integer tokens and the address of the associated C++ objects. This way, the Scilab toolbox accurately reflects the C++ library, without the need to manage memory (this is performed by the toolbox). This object oriented approach allows to manage objects, even if the Scilab language itself is not currently object-oriented (August 2009). The current toolbox provides an object-oriented approach of the C++ NISP library. The mean, standard deviation or quantile can also be directly retrieved. Once computed, the expansion can be used as a regular function. The coefficients of the expansion are computed based on given numerical experiments which creates the association between the inputs and the outputs. “polychaos” is the class which allows to manage a polynomial chaos expansion. This feature allows to use the class as Design of Experiment tool (DOE). We can use, for example, a Monte-Carlo sampling or a Sobol low discrepancy sequence. Several methods are available to build a sampling from a set of random variables. “setrandvar”, is the class which allows to manage a set of random variables.

Various types of random variables are available, including uniform, normal, exponential, etc. “randvar” is the class which allows to manage a random variable. This allows to startup and shutdown the library, configure and quiery the verbose level or initialize the seed of the random number generator. “nisp” provides function to configure the global behaviour of the toolbox. #annulus nx = 500 ny = 500 r1 = 0.1 r2 = 0.The internal design of the system is based on the following components : I also wrote the corresponding Python codes for the generation of the same images (Appendix 2). I have finished all the required outputs and I extended the study to cover its applications (simulation of Fraunhofer Diffraction for each aperture/filter). I think, I have attained the objectives of this activity satisfactorily. For this activity, I would rate myself a 12.
