Ask Your Question
1

Representation as sums of squares built-in function

asked 2016-02-22 18:47:38 +0200

Holden gravatar image

updated 2016-02-22 19:31:24 +0200

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 19:04:06 +0200

slelievre gravatar image

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 19:26:42 +0200 )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-23 02:59:44 +0200 )edit

I see. Thanks.

Holden gravatar imageHolden ( 2016-02-23 23:20:38 +0200 )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 10:04:38 +0200 )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 10:05:22 +0200 )edit
slelievre gravatar imageslelievre ( 2016-02-24 10:08:13 +0200 )edit

@slelievre, thank you so much. I installed mathematica 10.3(latest issue) and was not able to call mathematica even if I followed all the instructions on how to use mathematica within sage. From what I read around the web, I have to downgrade to version 8 to be able to interface to mathematica from within Sage. Is that true or am I missing something with integrating version 10.3?

Holden gravatar imageHolden ( 2016-02-27 15:58:07 +0200 )edit
1

According to Sage trac ticket #16703, the interface to Mathematica 10 was fixed.

slelievre gravatar imageslelievre ( 2016-03-06 18:20:46 +0200 )edit
kcrisman gravatar imagekcrisman ( 2016-03-08 16:10:48 +0200 )edit

@slelievre, cool. Thanks.

Holden gravatar imageHolden ( 2018-03-16 23:16:03 +0200 )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 18:47:38 +0200

Seen: 388 times

Last updated: Feb 22 '16