{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "# Random vector manipulation" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The RandomVector object represents the concept of random variable.\n", "\n", "In this example we are going to exhibit some of its main methods." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "from __future__ import print_function\n", "import openturns as ot\n", "import math as m" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "# Create a random vector\n", "dist3d = ot.Normal(3)\n", "X = ot.RandomVector(dist3d)" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "3" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Get the dimension\n", "X.getDimension()" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
[0,0,0]
\n",
"
[[ 1 0 0 ]
\n",
" [ 0 1 0 ]
\n",
" [ 0 0 1 ]]
\n",
"
X0 | X1 | X2 | |
---|---|---|---|
0 | 0.3500420865302907 | -0.3550070491856397 | 1.437249310140903 |
1 | 0.8106679824694837 | 0.79315601145977 | -0.4705255986325704 |
2 | 0.26101793529769673 | -2.2900619818700854 | -1.2828852904549808 |
3 | -1.311781115463341 | -0.09078382658049489 | 0.9957932259165571 |
4 | -0.13945281896393122 | -0.5602056000378475 | 0.4454896972990519 |
X1 | |
---|---|
0 | 0.6082016512187646 |
1 | -1.2661731022166567 |
2 | -0.43826561996041397 |
3 | 1.2054782008285756 |
4 | -2.1813852346165143 |
X0 | X2 | |
---|---|---|
0 | 0.32292503034661274 | 0.44578529818450985 |
1 | -1.0380765948630941 | -0.8567122780208447 |
2 | 0.4736169171884015 | -0.12549774541256004 |
3 | 0.35141776801611424 | 1.7823586399387168 |
4 | 0.070207359297043 | -0.7813664602347197 |