{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Weighted sum of Dirac Measures " ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "using TensorDec" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Series with 3 variables" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "x = @ring x1 x2 x3\n", "n = length(x)\n", "r = 4;" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Random weights in $[0,1]$" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "4-element Array{Float64,1}:\n", " 0.10310570990285539\n", " 0.659237146402671 \n", " 0.42854695858385483\n", " 0.9028954619877378 " ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "w0 = rand(Float64,r)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Random points in $[0,1]^n$" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "3×4 Array{Float64,2}:\n", " 0.894353 0.723909 0.847517 0.243868\n", " 0.621765 0.474676 0.889351 0.234888\n", " 0.448695 0.324577 0.0910113 0.929199" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Xi0 = rand(Float64,n,r)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Moment function of the sum of the Dirac measures of the points $\\Xi_0$ with weights $\\omega_0$ and its generating series up to degree 3." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.4339257411626396dx1*dx3 + 0.9702397337601841dx2 + 1.1382083719944895dx3 + 0.6585957641575078dx1*dx2 + 0.756553791183631dx3^3 + 0.14323371231850154dx2^2dx3 + 0.5978228622857406dx1^3 + 0.40844393047707755dx2^3 + 0.36208356970237654dx2*dx3 + 0.5016353149729792dx1^2dx2 + 0.17670723666808152dx1*dx2*dx3 + 0.7894555317442516dx1^2 + 0.8733277036829585dx3^2 + 1.1528284153895243dx1 + 0.5771697834203546dx2^2 + 0.22704558514092504dx1^2dx3 + 0.2619613422143817dx1*dx3^2 + 0.4425968864300194dx1*dx2^2 + 0.2321415223320108dx2*dx3^2 + 2.093785276877119" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mt = moment(w0, Xi0)\n", "s = series(mt, monoms(x, 3))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Decomposition of the series from its terms up to degree 3." ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "w, Xi = decompose(s);" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "4-element Array{Float64,1}:\n", " 0.4285469585838939 \n", " 0.10310570990277962\n", " 0.6592371464026707 \n", " 0.9028954619877747 " ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "w" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "3×4 Array{Float64,2}:\n", " 0.847517 0.894353 0.723909 0.243868\n", " 0.889351 0.621765 0.474676 0.234888\n", " 0.0910113 0.448695 0.324577 0.929199" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Xi" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "Julia 1.0.0", "language": "julia", "name": "julia-1.0" }, "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", "version": "1.0.0" } }, "nbformat": 4, "nbformat_minor": 1 }