/usr/share/sagemath/bin/sage-python: line 2: 96052 Killed sage -python "$@"

asked 2022-03-28 12:08:57 +0100

jarkky gravatar image

updated 2022-03-29 04:44:36 +0100

It looks the Python gets killed during running a long loop and task didn't finish.

[354, -70, 185, -239]
3.1415926589061544881
j = -48
/usr/share/sagemath/bin/sage-python: line 2: 96052 Killed                  sage -python "$@"

I hope to upload the run-file here... But I just paste it below:

eps=2^-52
digits=[2,3,5,7]
ndig=len(digits)
eran=[ceil(30*log(1/eps)/log(digits[i])) for i in range(1,ndig)]
eran2=[2*eran[i-1]+1 for i in range(1,ndig)]
nel=prod(eran2[0:ndig-2])
x=list(range(0,nel));
s=[x[i]%eran2[1] for i in range(0,nel)]
x=[(x[i]-s[i])/eran2[1] for i in range(0,nel)]
s=[(s[i]-eran[1]) for i in range(0,nel)]
s=[[(x[i]%eran2[0]-eran[0]) for i in range(0,nel)],s]
ldigits=[N(log(digits[i]),digits=25) for i in range(0,ndig)]
a=[ldigits[1]*s[0][i]+ldigits[2]*s[1][i] for i in range(0,nel)]
val=3.141592653589793238462643383279502884197
lval=N(log(val),digits=25)

bmm=[1 for k in range(0,eran2[2])]
r=[1 for k in range(0,eran2[2])]
t=[1 for k in range(0,eran2[2])]

# If the code crashes, set 'crash' to the last value of 'k' shown on the screen before the crash and rerun to finish the search
# Normally it should be set crash=0
crash=0
for k in range(crash,eran2[2]):
  j=k-eran[2]
  print("j,k =",j,k)
  am=[a[i]+ldigits[3]*j for i in range(0,nel)]
  b=[round((lval-am[i])/ldigits[0]) for i in range(0,nel)]
  b1=[am[i]+b[i]*ldigits[0] for i in range(0,nel)]
  bm=[abs(b1[i]-lval) for i in range(0,nel)]
  m=min(bm)
  f=bm.index(m)
  bmm[k]=bm[f]
  t[k]=[b[f],s[0][f],s[1][f],j]
  r[k]=digits[0]^t[k][0]*digits[1]^t[k][1]*digits[2]^t[k][2]*digits[3]^t[k][3]
  m=min(bmm)
  f=bmm.index(m)
  print(t[f])
  print(N(r[f],digits=20))

print("Final result:")

m=min(bmm)
f=bmm.index(m)

print(r[f])
print(t[f])

print(N(r[f],digits=20))
edit retag flag offensive close merge delete

Comments

Welcome to Ask Sage! Thank you for your question.

slelievre gravatar imageslelievre ( 2022-03-28 13:00:43 +0100 )edit

It may be running out of memory.

Max Alekseyev gravatar imageMax Alekseyev ( 2022-03-28 13:35:12 +0100 )edit

Could you please provide the code that leads to the error so that we can reproduce ?

tmonteil gravatar imagetmonteil ( 2022-03-28 21:26:17 +0100 )edit

The code (or commands run) were added above in the original email. The problem may not appear at once, but only after running it for 1hrs or so. I could not find problem with the memory.

jarkky gravatar imagejarkky ( 2022-03-29 19:03:18 +0100 )edit