First time here? Check out the FAQ!

Ask Your Question
-2

find coefficient of generating functions with three variable

asked 0 years ago

anonymous user

Anonymous

I want to write a sage math code to find the coefficient of x15d7r8 in the expansion of 11(xd+(xd)2+(xd)31+(xd)+(xd)2+(xd)3+xr+(xr)2+(xr)31+xr+(xr)2+(xr)3)

I use free version of ChatGPT,but it writes always wrong code because it knows SAGE until 2021. Can you help me ?

Preview: (hide)

Comments

Homework question?

Max Alekseyev gravatar imageMax Alekseyev ( 0 years ago )

1 Answer

Sort by » oldest newest most voted
1

answered 0 years ago

Emmanuel Charpentier gravatar image

updated 0 years ago

Well... your expression is a rational fraction of two polynomials, of degree 6 in x. There is no such thing as an x15 coefficient.

However, this fraction can be approximated (Taylor development) as series in x, whose coefficient in x15 may contain terms in d7, which may contain a term in r8. An obvious way to search is :

sage: foo=1/(1-((x*d+(x*d)^2+(x*d)^3)/(1+x*d+(x*d)^2+(x*d)^3)+(x*r+(x*r)^2+(x*r)^3)/(1+x*r+(x*r)^2+(x*r)^3)))
sage: foo.series(x, 16).coefficient(x^15).expand().coefficient(d^7).expand().coefficient(r^8)
3296

I use free version of ChatGPT,

Don't. For mathematical purposes, ChatGPT (and other LLM engines) are (expensive) noise|bullshit generators. Do it yourself.

EDIT : lazier alternative:

sage: R1.<x,d,r>=LazyPowerSeriesRing(QQbar)
sage: foo=1/(1-((x*d+(x*d)^2+(x*d)^3)/(1+x*d+(x*d)^2+(x*d)^3)+(x*r+(x*r)^2+(x*r)
....: ^3)/(1+x*r+(x*r)^2+(x*r)^3)))

foo is the (infinite) polynomial approximating youir fraction with an arbitrary precision. The term you seek is of total degree 30, therefore one of the terms of :

sage: foo[30] # Alternative : foo.coefficient(30)
x^15*d^12*r^3 + 65*x^15*d^11*r^4 + 546*x^15*d^10*r^5 + 1860*x^15*d^9*r^6 + 3296*x^15*d^8*r^7 + 3296*x^15*d^7*r^8 + 1860*x^15*d^6*r^9 + 546*x^15*d^5*r^10 + 65*x^15*d^4*r^11 + x^15*d^3*r^12

eliminating the terms of too high degree in d and r gives us the relevant term :

sage: foo[30].truncate(d, 8).truncate(r, 9)
3296*x^15*d^7*r^8

HTH,

Preview: (hide)
link

Comments

This problem admits an analytic solution, and I strongly suspect it's a homework problem, which does not require using any CAS.

Max Alekseyev gravatar imageMax Alekseyev ( 0 years ago )

I'd be quite interested by (hints to) your analytic solution...

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 0 years ago )

First hint is that the coefficient in question is the same as in 15k=0(...)k, where (...) denotes the same expression in parentheses as in the original expression.

Max Alekseyev gravatar imageMax Alekseyev ( 0 years ago )

@Emmanuel Charpentier: I don't want to spoil the problem for OP, but you are welcome to email me if anything is unclear.

Max Alekseyev gravatar imageMax Alekseyev ( 0 years ago )

I don't know how to mail someone on this site...

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 0 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 0 years ago

Seen: 271 times

Last updated: Sep 01 '24