Code_Aster ®
Version
7.4
Titrate:
Operator GENE_VARI_ALEA


Date:
08/02/05
Author (S):
S. CAMBIER, C. DESCELIERS Key
:
U4.36.07-B Page
: 1/6

Organization (S): EDF-R & D/AMA

Handbook of Utilization
U4.3- booklet: Function
Document: U4.36.07

Operator GENE_VARI_ALEA

1 Goal

To generate a realization of a real random variable of law of probability given (laws gamma or
exponential exits of the application of the maximum of entropy, [R4.03.05]).

Product a structure of data counts.
Handbook of Utilization
U4.3- booklet: Function
HT-66/05/004/A

Code_Aster ®
Version
7.4
Titrate:
Operator GENE_VARI_ALEA


Date:
08/02/05
Author (S):
S. CAMBIER, C. DESCELIERS Key
:
U4.36.07-B Page
: 2/6

2 Syntax

[table]
= GENE_VARI_ALEA
(


/STANDARD = “GAMMA” [DEFECT]




VALE_MOY

=
/
vale_moy
[R]
/
1.0
[DEFAUT]

BORNE_INF
=
/
has
[R]
/
0.
[DEFAUT]

COEF_VAR

=
/
delta
[R]
/0.1
[DEFAUT

/TYPE =
“EXPONENTIELLE”





VALE_MOY

=
/
vale_moy
[R]
/
0.
[DEFAUT]

BORNE_INF
=
/
has
[R]
/
- 1.0 [DEFAUT]

/TYPE =
“EXP_TRONQUEE”





VALE_MOY

=
/
vale_moy
[R]
/
0.
[DEFAUT]

BORNE_INF
=
/
has
[R]
/
- 1.0 [DEFAUT]

BORNE_SUP
=
/
B
[R]




/1.0 [DEFAUT]

INIT_ALEA
=
nor
[I]


);


Handbook of Utilization
U4.3- booklet: Function
HT-66/05/004/A

Code_Aster ®
Version
7.4
Titrate:
Operator GENE_VARI_ALEA


Date:
08/02/05
Author (S):
S. CAMBIER, C. DESCELIERS Key
:
U4.36.07-B Page
: 3/6

3 Operands

3.1 Word
keys
TYPE

According to information usable on the random variable to simulate, three types of law of probability are
available. If information available is a support not limited [has,
[
+, an average W, and one
scatter coefficient, the law is gamma. If information available is a support not limited
[has,
[
+ and an average W, the law is exponential. If information available is a support
compact [has, B] and an average W, the law is exponential truncated.

/STANDARD = “GAMMA” [DEFECT]

The random variable follows a law of probability of the type “gamma” of which distribution of
probability PW (dw) is defined by:

(2
-
W - has) 1
2
2
-



-


PW (dw)
2
1
W has
= I [has, +] (W)
(W - has) 2 exp-
dw
1

(W - has)
,
2



2


with (Z) = + z-1 -
T
E T dt.
0

/STANDARD = “EXPONENTIAL”

The random variable follows a law of “exponential” probability of the type of which distribution of
probability PW (dw) is defined by:


-
PW (dw)
1
W has
= I [has, +] (W)
exp-
,
dw
W - has
W - has
with I [has, + [(W) = 1 if W [has, + [
and I [has, + [(W) = 0 if W [has, [
+.

/STANDARD = “EXP_TRONQUEE”




The random variable follows a law of exponential probability of the type “truncated” of which
probability distribution PW (dw) is defined by:

P
-
W (dw)
K
= I [has,] (W)
kw
B
,
(K) E
dw

with I [B has,] (W) = 1 if W [has, B] and I [B has,] (W) = 0 if W [has, B] and where K is such as
(K
W -)
1 (K) - K (K) = 0, with (K)
- ak
B K
= E
- E and (K)
- ak
B K
= E has
- B E.

3.2 Word
key
VALE_MOY



VALE_MOY =/
W
[R]
/
0.
or
1.0
[DEFAUT]

Indicate the average value of the random variable to simulate.
Handbook of Utilization
U4.3- booklet: Function
HT-66/05/004/A

Code_Aster ®
Version
7.4
Titrate:
Operator GENE_VARI_ALEA


Date:
08/02/05
Author (S):
S. CAMBIER, C. DESCELIERS Key
:
U4.36.07-B Page
: 4/6

3.3 Word
key
COEF_VAR

COEF_VAR ² =/




/

0.1
[DEFAUT]

This key word informs the scatter coefficient (standard deviation report/ratio about absolute value of
average). The value taken by defect is 0.1.

3.4 Words
key
BORNE_INF AND BORNE_SUP

BORNE_INF
=
/
has
[R]






/
1.0
or
0.
[DEFAUT]
BORNE_SUP
=
/
B
[R]


/- 1.0 or 0.





[DEFAUT]

These key words inform the lower limit and the upper limit (when they exist)
support [has, B] or [has, + [
laws.

3.5 Operand
INIT_ALEA

INIT_ALEA
=
nor
[I]

Cause initialization in its nor-ième term of the continuation of pseudo-random numbers used
for the generation of the variables.

If key word INIT_ALEA misses, the terms used of the continuation are those immediately
consecutive with those already used. If no term were still used, the continuation is initialized with sound
first term.

Suggestion:

With less than one particular use, it is advised not to inform key word INIT_ALEA
in the operators according to: GENE_FONC_ALEA, GENE_VARI_ALEA and GENE_MATR_ALEA.
In this case, with the first call to the one of these operators, the continuation of pseudo numbers
random is initialized in its first term. The omission of key word INIT_ALEA to each one
calls of these operators in the command file guarantees independence
statistics of the pseudo-random numbers used.

Note:

The germ of the continuation remains identical of one execution to the other of Code_Aster; results
thus remain rigorously identical (one can thus test nonthe regression of results
statistics not converged). If one wishes to generate results statistically
independent from one execution to another, then it is necessary to use key word INIT_ALEA with
values raising the number of terms used in the former executions.

Caution:

The generator of random variable used is that of the module “random” of Python. It
depends on the version of Python exploited by Code_Aster. Not converged results
statistically can thus vary from one version to another of Code_Aster or a punt
form with the other, if the version of Python is not the same one and that between the two versions it
modulate random evolved/moved (case between Python 2.1 and 2.3).

Note:

In version Python 2.3, the period of the generator is 2 ** 19937-1 [bib1].
Handbook of Utilization
U4.3- booklet: Function
HT-66/05/004/A

Code_Aster ®
Version
7.4
Titrate:
Operator GENE_VARI_ALEA


Date:
08/02/05
Author (S):
S. CAMBIER, C. DESCELIERS Key
:
U4.36.07-B Page
: 5/6

4 Example

By call, the command generates only one realization of the random variable to simulate. For
to generate several achievements of the same random variable, it is necessary to repeat the command without
to change its parameters or to place the command in a loop of the process control language of
Code_Aster - the Python language. Each realization is statistically independent of the others
achievements.

In the following example, one generates NS achievements of a random variable gamma of average value
25000, of support and scatter coefficient 0.1 positive realities. These achievements are then
used as values of stiffness of shock.

ns=100

for K in arranges (1, ns+1):

# Generation
KN =GENE_VARI_ALEA (TYPE=' GAMMA',






BORNE_INF =0.,
VALE_MOY =25000.,
COEF_VAR =0.1,
)

# Extraction of the value in the produced table
VKN = KN [“NO.”, 1]

DYN=DYNA_TRAN_MODAL (




CHOC=_F (

RIGI_NOR = VKN,

)
)

# Here for example, statistical processing of DYN

TO DESTROY (CONCEPT=_F (NOM= (DYN, KN)))

# End of the loop (indentation)

For more complete examples, to consult [U2.08.05] or the case test SDNS01 [V5.06.001].

Handbook of Utilization
U4.3- booklet: Function
HT-66/05/004/A

Code_Aster ®
Version
7.4
Titrate:
Operator GENE_VARI_ALEA


Date:
08/02/05
Author (S):
S. CAMBIER, C. DESCELIERS Key
:
U4.36.07-B Page
: 6/6

5 Bibliography

[1]
Mr. Matsumoto and T. Nishimura, Mersenne Twister: With 623-dimensionally equidistributed
uniform pseudorandom number generator, ACM Transactions one Modeling and Computer
Simulation vol. 8, No 1, January pp.3-30 1998.

Handbook of Utilization
U4.3- booklet: Function
HT-66/05/004/A

Outline document