Ask Your Question
1

Representation as sums of squares built-in function

asked 2016-02-22 11:47:38 -0500

Holden gravatar image

updated 2016-02-22 12:31:24 -0500

Is there a Sage implementation of writing a number as a sum of k squares for any k as described in the ticket here: trac.sagemath.org/ticket/16308 ?

Thank you!

Please see my comment below the first answer.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-02-22 12:04:06 -0500

This works:

sage: sum_of_k_squares(4, 2016)
(0, 4, 8, 44)
edit flag offensive delete link more

Comments

@slelievre, thank you! I have confused my self a lot and I was actually looking for a built in function that outputs r_k(n) which is the number of ways of writing a given number n as a sum of k-squares. For instance r_4(1) = 8. There is SquaresR[] built-in function in Mathematica but I can't interface to it within Sage. Is there such a built-in function in Sage?

Holden gravatar imageHolden ( 2016-02-22 12:26:42 -0500 )edit

I don't believe we have that. For some values of k this would be easy but for others I think it's an open problem (haven't looked at this for a bit).

kcrisman gravatar imagekcrisman ( 2016-02-22 19:59:44 -0500 )edit

I see. Thanks.

Holden gravatar imageHolden ( 2016-02-23 16:20:38 -0500 )edit

@Holden If you have Mathematica and Sage on the same computer, you should be able to use Mathematica from within Sage.

slelievre gravatar imageslelievre ( 2016-02-24 03:04:38 -0500 )edit

@Holden: maybe open a separate question "Number of representations of an integer as a sum of k squares"

slelievre gravatar imageslelievre ( 2016-02-24 03:05:22 -0500 )edit

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: 2016-02-22 11:47:38 -0500

Seen: 83 times

Last updated: Feb 22 '16