Ask Your Question

dantetante's profile - activity

2024-03-07 15:15:30 +0100 asked a question base-n expansion of integers

n-adic expansion of integers If I use Integer('z',36) I get 35 as expected, but Integer('z',37) throws an error, from wh

2024-01-15 03:39:19 +0100 received badge  Notable Question (source)
2023-11-18 09:00:04 +0100 received badge  Popular Question (source)
2023-10-28 06:08:16 +0100 received badge  Famous Question (source)
2023-01-13 20:26:53 +0100 received badge  Popular Question (source)
2022-11-20 11:24:35 +0100 asked a question use Python cryptography package with Sage

use Python cryptography package with Sage I am wondering if I can import the cryptography package from here https://cryp

2022-10-13 10:41:12 +0100 received badge  Popular Question (source)
2022-10-08 13:59:45 +0100 commented answer How to find source code, search_src rises Warning

For those also interested in following this question: Shoup is available here https://shoup.net/ntb/ an the paper of Wan

2022-10-08 13:54:35 +0100 commented answer How to find source code, search_src rises Warning

ok, so znorder was there but I didn't see it ;-) what I did then: clone the pari folder from github, grep for string zno

2022-10-08 13:53:14 +0100 commented answer How to find source code, search_src rises Warning

ok, so znorder was there but I didn't see it ;-) what I did then: clone the pari folder from github, grep for string zno

2022-09-30 11:49:25 +0100 commented question How to find source code, search_src rises Warning

@John: many thanks! But, how did you get to the string return sage.rings.integer.Integer(self.__pari__().znorder())? In

2022-09-29 13:16:11 +0100 asked a question How to find source code, search_src rises Warning

How to find source code, search_src rises Warning I want to investigate how sage is computing the multiplicative order o

2022-08-25 08:14:20 +0100 answered a question error in decoding shift cryptosystem

You have to read the docs! You don't use enciphering and deciphering. The decryption is not the same as encoding, which

2022-04-05 19:49:49 +0100 commented answer How to attach a simple Sage script in a Sage Jupyter notebook

Can anyone explain why load works and attach doesn't?

2022-03-04 19:38:12 +0100 received badge  Notable Question (source)
2022-01-23 11:07:56 +0100 edited question can I use @interact also with the command line?

can I use @interact also with the command line? I understand that @interact is to be used inside of Jupyter. But since I

2022-01-23 11:05:28 +0100 edited question can I use @interact also with the command line?

can I use @interact also with the command line? I understand that @interact is to be used inside of Jupyter. But since I

2022-01-23 11:04:30 +0100 edited question can I use @interact also with the command line?

can I use @interact also with the command line? I understand that @interact is to be used inside of Jupyter. But since I

2022-01-23 11:04:01 +0100 edited question can I use @interact also with the command line?

can I use @interact also with the command line? I understand that @interact is to be used inside of Jupyter. But since I

2022-01-23 11:02:34 +0100 asked a question can I use @interact also with the command line?

can I use @interact also with the command line? I understand that @interact is to be used inside of Jupyter. But since I

2021-09-03 09:26:12 +0100 asked a question Why are there two different options for Sage in Jupyter's "New" menu?

Who offers the dropdown menu of Jupyter two different Sage options? When I open a Jupyter Session and klick on >>N

2021-07-02 00:01:13 +0100 received badge  Nice Question (source)
2021-07-01 08:12:48 +0100 asked a question why can't I compute the zeros of an integer polynomial using solve()?

why can't I compute the zeros of an integer polynomial using solve()? This works fine, producing complex roots: x=var('

2021-06-24 11:47:55 +0100 received badge  Popular Question (source)
2021-05-18 01:56:04 +0100 received badge  Notable Question (source)
2021-05-18 01:56:04 +0100 received badge  Popular Question (source)
2021-02-09 16:30:52 +0100 commented answer limit of fourier series

Yes, but it does not answer my question ;-) I want to compute the limit function f(x), restricted to x from 0 to 2*\pi

2021-02-06 10:02:56 +0100 received badge  Organizer (source)
2021-02-06 10:00:40 +0100 asked a question limit of fourier series

I'd like to compute the limit of $$\sum_{k=1}^{n}\frac{1}{k^2+1}\sin(kx)$$ I did the following already:

def b(k):
        return(1/(k**2+1))
def a(k,x):
        return(b(k)*sin(k*x))
def s(n,x):
        s=0 
        for k in range(1,n+1):
                s=s+a(k,x)
        return(s)
var('x,n')
f=s(1000,x)
plot(f,0,2*pi)

I already tried computing it by hand, looked in Bronstein, searched the internet, but didn't find any solution. But I'm no specialist in Analysis, so perhaps somebody can help? Clearly the series converges for every x in [0,2*pi] ...

2020-09-08 17:57:25 +0100 received badge  Supporter (source)
2020-09-03 19:30:14 +0100 answered a question Can sagetex generate tex files?

Since you didn't provide an example I'm not 100% sure what you want to do. Anyway you should have a look at jinja:

https://pypi.org/project/Jinja2/

2020-09-03 07:26:14 +0100 received badge  Editor (source)
2020-09-03 07:23:29 +0100 asked a question How to handle very large numbers

I want to play around with factorials. I found that factorial(10**9) takes about 20 minutes (on my machine, which is a Mac mini with 8GB Memory). Then I tried factorial(10**10) and there I got this:

/Applications/...pathtoSageMath/sage/src/bin/sage-python: line 2:   975 Killed: 9              sage - python "$@"

Then I searched for a SageMath Stirling Formula, which I didn't find (only some related stuff), so I tried it myself:

sage: def s(n):
....:     x=sqrt(2*pi*n)*((n/e)**n)
....:     return x.numerical_approx()
....: 
sage: s(5)
118.019167957590
sage: s(6)
710.078184642185
sage: s(10**10)

This gave me an error after some minutes:

RuntimeError
...
 4047                            relational_operator(self._gobj))
   4048         else:
-> 4049             x = g_pow(self._gobj, nexp._gobj)
   4050         return new_Expression_from_GEx(self._parent, x)
   4051 

RuntimeError: size of exponent exceeds signed long size

Then I tried s(10**9), there I got another error:

python3(755,0x10fbecdc0) malloc: can't allocate region
:*** mach_vm_map(size=18446744073151754240, flags: 100) failed (error code=3)
python3(755,0x10fbecdc0) malloc: *** set a breakpoint in malloc_error_break to debug
sig_error() without sig_on()
------------------------------------------------------------------------
(no backtrace available)
------------------------------------------------------------------------
Unhandled SIGABRT: An abort() occurred.
This probably occurred because a *compiled* module has a bug
in it and is not properly wrapped with sig_on(), sig_off().
Python will now terminate.

So what can I do? Is there a special library for very large reals or int or some special commands for getting an approximation of how many decimals a factorial will have? Could I use the log somehow or would this have the same runtime problems?

The reason why I'm asking is that I am rewriting a text which is 20 years old and there's a statement that factorial(10**100) could not be computed (ok, I believe that because of factorial being between O(2**n) and O(2**(2**n))) and factorial(10**8) would take many hours, which was not the case on my machine (see above).

And last but not least I would like to know if there is an upper bound for numbers that sage can handle. I thought not, but now I know otherwise ;-) Also hints to good literature on these topics would be appreciated.

2020-08-20 18:22:48 +0100 commented answer sagetex linebreak

I really need long number output, because I work with cryptography and number theory stuff and people want to copy and paste.

2020-08-20 18:20:59 +0100 answered a question sagetex linebreak

I found a solution myself (and already posted it on tex.stackexchange). Here it is:

\documentclass[ DIV=16, a6paper, 11pt]{scrartcl} 
% arara: lualatex
% arara: sagetex
% arara: lualatex
% !TEX TS-program = sage
% !TEX encoding = UTF-8 Unicode
\usepackage{seqsplit}
\usepackage{sagetex}
\lstset{
literate=
{1}{1\allowbreak}1
{2}{2\allowbreak}1
{3}{3\allowbreak}1
{4}{4\allowbreak}1
{5}{5\allowbreak}1
{6}{6\allowbreak}1
{7}{7\allowbreak}1
{8}{8\allowbreak}1
{9}{9\allowbreak}1
{0}{0\allowbreak}1,
breaklines=true}
\begin{document}
\begin{sagecommandline}
sage: factorial(50)
\end{sagecommandline}
\seqsplit{%
30414093201713378043612608166064768844377641568960512000000000000}
\end{document}
2020-08-16 14:11:31 +0100 asked a question sagetex linebreak

When using the environment sagecommandline of sagetex with long number output, how can I get automatic line breaks? I already tried to change sagetex.sty (putting breaklines=true at several places), but nothing changed. Here is my minimal example: (p.s. I asked the same question also on tex.stackexchange)

\documentclass[
a6paper, 11pt, oneside,
english,ngerman]{scrartcl} 

% !TEX TS-program = sage
% !TEX encoding = UTF-8 Unicode

\usepackage[headsep=0cm,footskip=1.5em,includeheadfoot=true,
top=0cm,bottom=0cm,left=.5cm,right=.5cm,]{geometry}
\usepackage{sagetex}

\lstdefinestyle{SageOutput}{style=DefaultSageOutput,breaklines=true}

\begin{document}
\begin{sagecommandline}
sage: factorial(100)+1
sage: factorial(50)+1
sage: factorial(10)
\end{sagecommandline}
\end{document}
2020-04-05 14:52:37 +0100 received badge  Student (source)
2020-04-05 14:07:20 +0100 asked a question How to find out the difference between M.determinant(), M.det() and det(M)?

I am quite new to sagemath, but an experienced mathematician ... so I tried computing determinants for a given Matrix M and found different solutions. I found that M.det() is short for M.determinant() after searching the index and going further from there. But I did not find something for the syntax det(M). Inspire of being not a programmer, I am interested in

a) where could I search to find the difference? b) what is the difference, if any?

Many thank! Doris