ASKSAGE: Sage Q&A Forum - Latest question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 22 Nov 2017 14:05:37 -0600Numerical approximation of multiple integralhttps://ask.sagemath.org/question/39733/numerical-approximation-of-multiple-integral/ I want to numerical integrate:
$$\int_{-\infty}^{A_1} \int_{-\infty}^{A_2-x_1} p(x_1)p(x_2)dx_1dx_2 ,$$
where $p(x_i)$ is a random variable that has a normal distribution with mean $\mu_i$ and standard deviation $\sigma_i$.
I faced with several problems:
1. I can't integrate even this simply integral:
import scipy.stats as st
integrate(st.norm.pdf(x), x)
The result is error: `TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''`
2. How to integrate multiple integrals with different $A_i$.alifacerWed, 22 Nov 2017 14:05:37 -0600https://ask.sagemath.org/question/39733/Help finding expected value of sum of random variableshttps://ask.sagemath.org/question/32739/help-finding-expected-value-of-sum-of-random-variables/I'm very much a Sage newbie, and I'm having trouble solving for the expected value of a discrete summation. I'll admit that I'm well removed from statistics, linear algebra, and econometrics, so it might be that what I'm trying to accomplish is illogical.
Consider the following parameters:
<b>E</b> ~ N(0,1) (i.e., E is a random variable distributed standard normal)
<b>M</b> ~ U(1,*m*) (i.e., M is a uniformly distributed random variable varying between 1 and *m*)
<b>A</b> = | Σ E×M | over the interval (1,N) (or the absolute value of the summation of E times M over interval 1,N)
I'd like to find the expected value of A as a function of N (or the limit of A as N goes to infinity, assuming A converges to a real number). Can I use Sage to solve for something like this (assuming it's solvable, which I think it is based on some simulation results)?
gsu2014Tue, 08 Mar 2016 11:45:16 -0600https://ask.sagemath.org/question/32739/How to generate normal noise for a functionhttps://ask.sagemath.org/question/25933/how-to-generate-normal-noise-for-a-function/
sage: func(x) = x^2
sage: func_noise = func + normalvariate(0,1); func_noise
x |--> x^2 - 0.4436993396832335
How can one force the `normalvariate` to generate the number only on function evaluation?
fehuWed, 25 Feb 2015 15:45:44 -0600https://ask.sagemath.org/question/25933/