Ask Your Question

Daniel L's profile - activity

2023-11-24 10:11:46 +0200 received badge  Popular Question (source)
2023-09-12 11:26:56 +0200 received badge  Famous Question (source)
2023-05-19 22:09:42 +0200 received badge  Famous Question (source)
2023-05-19 22:09:42 +0200 received badge  Notable Question (source)
2022-11-19 21:31:13 +0200 received badge  Notable Question (source)
2022-06-06 18:17:12 +0200 received badge  Popular Question (source)
2022-05-04 01:06:14 +0200 edited question Jacobi theta q series

Jacobi theta q series I'd like to express the classical Jacobi theta series in Sage: $$\Theta_2(z) &= \sum_{n\in{\m

2022-05-04 01:00:32 +0200 asked a question Jacobi theta q series

Jacobi theta q series I'd like to express the classical Jacobi theta series in Sage: \begin{align} \Theta_2(z) &= \

2021-11-20 17:58:00 +0200 received badge  Notable Question (source)
2021-04-28 22:43:55 +0200 received badge  Famous Question (source)
2021-02-03 15:25:24 +0200 received badge  Popular Question (source)
2021-02-03 15:25:24 +0200 received badge  Notable Question (source)
2020-12-09 21:37:56 +0200 received badge  Notable Question (source)
2020-12-09 11:35:51 +0200 received badge  Famous Question (source)
2020-12-01 05:17:48 +0200 received badge  Notable Question (source)
2020-10-27 20:10:33 +0200 received badge  Popular Question (source)
2020-10-14 10:48:02 +0200 received badge  Popular Question (source)
2020-03-10 03:34:19 +0200 commented question Unimodular matrices with additional restrictions

Good point. This certainly works if the dimension is 8 e.g. the $E_8$ root lattice gram matrix: E8 lattice wiki. I edited the post. Thank you

2020-03-09 18:56:08 +0200 asked a question Unimodular matrices with additional restrictions

I'd like to generate some unimodular matrices over ZZ with some restrictions:

  1. the entries are between -2 and 2
  2. the matrix is symmetric: $A = A^t$

Item (1) above can be addressed with the option upper_bound. Simply searching for matrices satisfying (1) and (2),

for j in [1..1000]:
A = random_matrix(ZZ,3,3, algorithm = 'unimodular', upper_bound = 3, max_tries = 1000)
    if A == A.transpose():
        A

becomes extremely inefficient, especially as the dimension grows. Is there a way to enforce items (1),(2) within the unimodular algorithm? Or another workaround?

Edit: I originally also wanted the diagonal entries fixed at 2, but this is a bit too restrictive.

2020-03-09 18:34:07 +0200 received badge  Notable Question (source)
2020-02-26 18:30:01 +0200 commented answer continuous Fourier transform

Thank you!

2020-02-26 18:29:50 +0200 commented answer continuous Fourier transform

Thank you!

2020-02-21 17:07:18 +0200 received badge  Nice Question (source)
2020-02-19 20:38:32 +0200 asked a question continuous Fourier transform

I have some basic code to plot a "nice" real-valued function and its continuous Fourier transform. For example,

F(x) = e^(-x^2)*(1-x^2)
plot2 = F.plot(xmin = -5, xmax = 5, color = 'red')
### continuous Fourier transform on RR
var('xi')
fhat(xi) = integral((F(x)*exp(-2*pi*I*x*xi)),(x,-oo,oo))
plot1 = fhat(xi).real().plot(xmin = -5, xmax = 5)   #put fhat and f in the same plot
show(plot1 + plot2, xmin = -5, xmax = 5, ymin = -1, ymax = 2)

f and fourier transform

Like many things in Sage, I appreciate it when the code looks like the formal math. However, this code is not robust. For instance, if we change the function to

F(x) = e^(-x^2)*sin(x)/x

Then I get an error message "Variable 'xi' not found". I'd like to improve this code to work with a wider class of functions.

Thanks,

2019-09-12 14:01:42 +0200 received badge  Popular Question (source)
2019-06-06 21:29:14 +0200 received badge  Popular Question (source)
2019-04-30 03:42:53 +0200 received badge  Popular Question (source)
2019-03-01 12:40:51 +0200 received badge  Nice Question (source)
2018-07-01 23:32:37 +0200 received badge  Enthusiast
2018-07-01 00:13:48 +0200 commented answer Solving a power series equation

The workaround on the above thread works well. Thanks for the help!

2018-06-30 22:58:02 +0200 commented answer Solving a power series equation

When I run this code I get the following traceback error: ValueError: rtol too small (4.5e-16 < 8.88178e-16) I'm not sure what this means or why it's happening.

2018-06-29 19:52:53 +0200 asked a question Solving a power series equation

I'd like to solve the equation f(t) == 1 where f is a power series:

var('n,t')
a1 = float(4 + sqrt(8)) 
b1 = float(3 + sqrt(8)) 
c1 = b1
an = 4*n*(n-1)+a1*n
an1 = 4*n*(n+1) + a1*(n+1)
anr = b1 + 2*n*(4*n+a1)
bn = 1+2*n*(n-1)+n*(b1-1)
bn1 = 1+2*n*(n+1)+(n+1)*(b1-1)
bnr = c1 + 2*n*(2*n+b1-1)

def f(t):
return (1+b1)^-t + 3/2*a1^-t + 1/2*(2*b1)^-t + b1^-t  + 2*sum(an^-t +an1^-t + anr^-t + 2*bn^-t +2*bn1^-t + bnr^-t ,n,1,1000).n()

I've tried simply plugging in values for t and I estimate that if f(t) = 1 then t is approximately 1.51. I'd like to possibly do something like

solve(f(t) == 1,t)

but this appears to lock sage up and I have to interrupt the process. The true f function is actually an infinite series, but I am truncating it to the first 1000 terms. I know there are methods of solving series equations such as the method of regula falsi. Does Sage have anything like this? Thanks!

2018-04-22 20:45:13 +0200 asked a question problem loading large file

I have a file which was generated and saved from a Sage notebook worksheet:

save(G,'G4D200')

where G is a list of vectors of length roughly 20 million, and the file 'G4D200.sobj` is about 370Mb.

When I try to load this file later to do some analysis

new_G = load('/path_of_file.../G4D200.sobj')

my computer goes deep into swap memory (with python eating it all up) and basically freezes. I have done the exact same thing for smaller file sizes (<10Mb) with no issues. I've tried waiting over 30 minutes and nothing seems to happen. Is this possibly a memory issue? Something with Sage? Possible workaround? I'm running the Sage notebook in fedora linux with an older laptop with 8Gb of RAM.

Thanks!

2018-04-02 05:13:06 +0200 commented answer 3d plot, slow

Great, thanks for the help!

2018-03-22 21:52:29 +0200 commented question 3d plot, slow

Also, is there a way to crank up the resolution so the spheres don't look pixelated?

2018-03-22 19:47:01 +0200 asked a question 3d plot, slow

I have some graphical objects (spheres and planes) and I'm trying to create a nice picture to export as a .png (other options?). The problem I'm having is that the interactive mode (right clicking on the graphic) is so slow that the menu options freeze up. I'd like to preview the image (rotate it around, zoom, etc.) before saving so that I can make sure I've got the right picture. What is a more efficient/ faster way to create and export a 3d picture? Thanks!

var('x,y,z')

E1 = implicit_plot3d(x^2+y^2+z^2==1/4, (x,-1/2,3/2), (y,-1/2,sqrt(3)/2+1/2), (z,-0.5,0.5), color = 'gray', opacity = 0.6)

E2 = implicit_plot3d((x-1)^2+y^2+z^2==1/4, (x,-1/2,3/2), (y,-1/2,sqrt(3)/2+1/2), (z,-0.5,0.5), color = 'gray')

E3 = implicit_plot3d((x-1/2)^2+(y-sqrt(3)/2)^2+z^2==1/4, (x,-1/2,3/2), (y,-1/2,sqrt(3)/2+1/2), (z,-0.5,0.5), color = 'gray')

E4 = implicit_plot3d(z == -1/2, (x,-1,4), (y,-1,4), (z,-0.6,0.5), color = 'gray', opacity = 0.2)

E6 = implicit_plot3d((x+1/2)^2+(y-sqrt(3)/2)^2+z^2==1/4, (x,-1,3/2), (y,-1/2,sqrt(3)/2+1/2), (z,-0.5,0.5), color = 'gray')

S1 = implicit_plot3d((x-1)^2+y^2+(z-1/2)^2==1, (x,-1,3/2), (y,-1/2,sqrt(3)/2+1/2), (z,-0.5,0.5), color = 'blue', opacity = 0.2)

S2 = implicit_plot3d((x+1/2)^2+(y-sqrt(3)/2)^2+(z+1/2)^2==1, (x,-1,3/2), (y,-1/2,sqrt(3)/2+1/2), (z,-0.5,0.5), color = 'blue', opacity = 0.2)

show(E1+E2+E3+E6+M1+S1+S2, aspect_ratio = 1, frame = false)

Also, if I try

t = E1+E2+E3+E6+M1+S1+S2

t.save('spheres.png', aspect_ratio = 1, frame = false) then the picture is quite distorted. Is aspect_ratio not what I want for 3d plots?

2018-02-01 16:25:51 +0200 commented answer random matrix with determinant +- 1

This works. Nice simple solution. Thanks Dan.