Ask Your Question

res0001's profile - activity

2024-02-28 10:28:05 +0200 received badge  Popular Question (source)
2024-01-31 03:00:14 +0200 marked best answer Fastest way to compute the coefficients of this generating function?

I need the first N coefficients of a certain generating function, with N around 30000. Using the following code, about 2.8 hrs were needed for N=10000, and 20 hrs for N=20000; unfortunately, it looks like N=30000 would require days:

N = 30000
R.<z> = PowerSeriesRing(ZZ, default_prec=N+1)
gf = (1-z)^2 * sum( z^n/(1 - 2*z + z^(n+1))^2 for n in range(N))
coeffs = gf.coefficients()

Question: Is there a better (faster!) way to do this in SageMath? E.g., some alternative to PowerSeriesRing, or some improvement to how I'm using it?

(Aside: The coefficients of this gf are theoretically expected to exhibit a certain phenomenon that doesn't show up until N is around 30000, and I'm just interested in confirming it.)

2024-01-30 03:46:04 +0200 commented answer Fastest way to compute the coefficients of this generating function?

Thanks for this answer! I hadn't realized one might find such a formula. Using your c(k) in a program to compute the fin

2024-01-30 02:46:37 +0200 commented answer Fastest way to compute the coefficients of this generating function?

Thanks for this answer! I hadn't realized one might find such a formula. Using your c(k) in a program to compute the fin

2024-01-30 02:15:15 +0200 commented answer Fastest way to compute the coefficients of this generating function?

Thanks for this answer! I hadn't realized one might find such a formula. Using your c(k) in a program to compute the fin

2024-01-29 21:35:38 +0200 received badge  Famous Question (source)
2024-01-29 21:06:54 +0200 edited question Fastest way to compute the coefficients of this generating function?

Fastest way to compute the coefficients of this generating function? I need the first N coefficients of a certain genera

2024-01-29 21:05:39 +0200 asked a question Fastest way to compute the coefficients of this generating function?

Fastest way to compute the coefficients of this generating function? I need the first N coefficients of a certain genera

2023-08-25 15:49:15 +0200 received badge  Notable Question (source)
2020-10-02 20:32:51 +0200 received badge  Famous Question (source)
2019-02-07 20:16:03 +0200 received badge  Popular Question (source)
2019-01-12 17:57:43 +0200 received badge  Famous Question (source)
2019-01-08 06:51:47 +0200 received badge  Notable Question (source)
2018-09-16 05:35:00 +0200 received badge  Notable Question (source)
2018-09-01 04:38:39 +0200 commented answer Conflicting Sage vs Wolfram evaluation of a limit?

Thanks -- that is good to know! Now I just need to know how to get Sage to compute the correct limit (i.e. Limit[V[a,w], a -> Infinity] should output $0$ instead of its current output of $1$).

2018-08-31 16:13:15 +0200 received badge  Supporter (source)
2018-08-30 07:26:56 +0200 received badge  Good Question (source)
2018-08-29 19:10:33 +0200 commented answer Conflicting Sage vs Wolfram evaluation of a limit?

The point is that the limit is computed to be 1 by Sage and 0 by Wolfram, in spite of the unstable behavior indicated by the plots. (I've edited to clarify.)

2018-08-29 17:03:51 +0200 received badge  Editor (source)
2018-08-29 16:17:24 +0200 asked a question Conflicting Sage vs Wolfram evaluation of a limit?

>Why are the following computed limits different (1 by Sage, 0 by Wolfram), and which (if either) is correct?

EDIT: Increasing the numerical precision in Wolfram produces a plot that strongly suggests that the limit is indeed $0$, which it had already computed. Presumably, Sage is computing the wrong limit simply because of inadequate numerical precision, so the question is now ...

How can I increase the numerical precision in Sage, so that limit() and plot() will produce the correct results (i.e., the limit should be $0$ and the plot should show a stable approach to $0$)?

Sage: (you can cut/paste/execute this code here)

#in()=
f(x) = exp(-x^2/2)/sqrt(2*pi)
F(x) = (1 + erf(x/sqrt(2)))/2
num1(a,w) = (a+w)*f(a+w) - a*f(a)
num2(a,w) = f(a+w) - f(a) 
den(a,w) = F(a+w) - F(a)
V(a,w) = 1 - num1(a,w)/den(a,w) - (num2(a,w)/den(a,w))^2
assume(w>0); print(limit(V(a,w), a=oo))
plot(V(a,1),a,0,8)

#out()=
1        #<--------- computed limit = 1

enter image description here

Wolfram: (you can execute this code here)

#in()=
f[x_]:=Exp[-x^2/2]/Sqrt[2*Pi]
F[x_]:=(1 + Erf[x/Sqrt[2]])/2 
num1[a_,w_] := (a+w)*f[a+w] - a*f[a]
num2[a_,w_] := f[a+w] - f[a]  
den[a_,w_] := F[a+w] - F[a]
V[a_,w_] := 1 - num1[a,w]/den[a,w] - (num2[a,w]/den[a,w])^2 
Assuming[w>0, Limit[V[a,w], a -> Infinity]]
Plot[V[a, 10], {a, 0, 100}, WorkingPrecision -> 128] 

#out()=
0        (* <--------- computed limit = 0 *)

enter image description here

(This is supposed to compute the limit, as a -> oo, of the variance of a standard normal distribution when truncated to the interval (a,a+w).)

2018-08-29 15:47:50 +0200 received badge  Nice Question (source)
2018-08-27 11:21:43 +0200 received badge  Student (source)
2018-08-27 10:34:10 +0200 received badge  Popular Question (source)
2018-05-27 18:00:38 +0200 received badge  Organizer (source)
2018-05-27 17:56:29 +0200 received badge  Scholar (source)
2018-05-27 17:46:07 +0200 commented answer Running Sagemath 8.2 natively in Windows, how to change the Jupyter default directory?

Thank you! That seems to be working after I changed my directory names to remove all spaces from them.

2018-05-27 17:01:50 +0200 commented answer Running Sagemath 8.2 natively in Windows, how to change the Jupyter default directory?

This is along the lines I'd hoped for, but unfortunately it doesn't work. (I also tried it using an equals sign: --notebook-dir=directory_name.)

2018-05-27 04:59:30 +0200 asked a question Running Sagemath 8.2 natively in Windows, how to change the Jupyter default directory?

With SageMath 8.2 running natively under Windows 10, the Jupyter dashboard opens by default in the directory C:\Users\<me>, so I then have to navigate to the desired directory that contains my Jupyter notebook .ipynb files.

How can I cause Jupyter to open directly in the desired directory?

The relevant Windows shortcut has the following Target Property:

"C:\Program Files\SageMath 8.2\runtime\bin\mintty.exe" -t 'SageMath 8.2 Notebook Server' -i sagemath.ico /bin/bash --login -c '/opt/sagemath-8.2/sage --notebook jupyter'

Can the sage --notebook jupyter portion be adjusted somehow to specify the desired directory?