ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 16 Nov 2018 05:53:39 -0600Conversion from symbolic expression to polynomial stuckhttp://ask.sagemath.org/question/44302/conversion-from-symbolic-expression-to-polynomial-stuck/I have a very long symbolic expression with six variables:
> (E_mu, E_xi3, ISP, T, V_mu, V_xi3, Z,
> m, mu, n_I, n_P, xi_1, xi_3)
I call the expression AN. I want to convert it in a polynomial of two variables (mu and xi_3). I tried the following command:
AP = AN.polynomial(None,ring=SR['mu,xi_3'])
This works for simple expressions but the command remains stuck for the given expression. My aim is to get the monomials of the polynomial. mu and xi_3 are random variables and I want to compute the expectation of AN (E[AN]). Thus, I could substitute the expectations in the expression.
AN is a numerator, so it is not a fraction. Moreover, I also tried simply_rational but it did not help to convert.
Is there anyway to convert easily ?
EDIT : [I put the symbolic expression in a framabin.](https://framabin.org/p/?2417942055fc9fc9#Oenpb+BI567QXYcVCzjO4zkLRC0byQaNdhi2XW/CUkY=)borostackFri, 16 Nov 2018 05:53:39 -0600http://ask.sagemath.org/question/44302/Symbolic expectations and double integralshttp://ask.sagemath.org/question/8648/symbolic-expectations-and-double-integrals/I'd like to compute the following expectation ($U$ and $V$ are independent and normally distributed or Gaussian)
$a_{k,p}=E(|U|^p|U+\sqrt{k-1}V|^p)$
Is there a way to directly compute those expectations in Sage ?
If I write it down, I obtain a double integral which I already tried to compute with maxima like this (ok here, you can only see the starting point with the inner integral with respect to $v$ first)
load(distrib);
n(x):=pdf_normal(x, 0, 1);
inner_integral: integrate(abs(u+sqrt(k-1)*v)^p*n(v), v, minf, inf);
but to no avail.
NB: The absolute central moment $a_{1,p/2}$ can be easily obtained with maxima with
ratsimp(integrate(abs(x)^p*n(x), x, minf, inf));
but no 'simple' expression as for the aforementioned double integral.
Any hint?Green diodSat, 21 Jan 2012 02:07:56 -0600http://ask.sagemath.org/question/8648/