On Dec 2, 2:24 pm, Julie <[email protected]> wrote:
> Hi all,
>
> I am attempting to obtain coefficients of a generating function to
> obtain probabilites, but in order to obtain the coefficients, I first
> need to expand a power series, which is necessary for my paricular
> function.
> Is there a simple way to expand such a series in sage e.g. 2^x?
>
> (For my exact problem, the generating function contains 2 variables (p
> and y), and when expanded up to terms where p=1 for example, I have
> the formula:
> (0.030*0.248244^y)y+0.05721*(0.248244^y)p +0.08838*(0.248244^y)
>
> Thus, before being able to extract the coefficients of p^0*y^0, p1,
> y1,p*y etc, I need to expand 0.248244^y as a power series - will the
> same programming also hold for this problem?)
>
> Many thanks,
> Julie

I'm not familiar with generating functions but to extract coefficients
you can try:
sage: var('y p')
(y, p)
sage: s=taylor(0.248244^y,y,0,6)
sage: w=expand(0.030*s*y+0.05721*s*p +0.08838*s)
sage: w.polynomial(RR).coefficient([0,0])
0.0883800000000000
sage: w.polynomial(RR).coefficient([1,1])
-0.0797131613559558

Andrzej Chrzeszczyk

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to