Ask Your Question

mattiav's profile - activity

2019-12-19 16:23:23 +0200 commented question Condition of type: STORAGE-EXHAUSTED

After some Googling I have found that it means that the program is using all the memory at disposition. How do I increase the memory limit?

2019-12-19 07:29:19 +0200 asked a question Condition of type: STORAGE-EXHAUSTED

While doing some long calculations I got the error:

Condition of type: STORAGE-EXHAUSTED

What does it mean? How do I get rid of it?

2019-12-18 16:56:05 +0200 received badge  Student (source)
2019-12-18 11:45:58 +0200 received badge  Scholar (source)
2019-12-18 11:16:14 +0200 asked a question Substituting variable value

I use the following code to calculate the Kretschmann scala of the Schwartzchild spacetime:

print("Initialization of  manifold, chart, and metric. Definitions of constants.")
M=Manifold(4,'M',structure='Lorentzian')
X.<t,r,th,ph> = M.chart(r"t r:(0,+oo) th:(0,pi):\theta ph:(0,2*pi):\phi")
m=var('m')

g=M.metric()

g[0,0]=-(1-2*m/r)
g[1,1]=1/(1-2*m/r)
g[2,2]=r^2
g[3,3]=r^2*sin(th)^2


print('Calculating Riemann tensor')
R = g.riemann()
print(R[:])
uR=R.up(g)
dR=R.down(g)

print('Calculating Kretschmann scalar')
kr= uR['^{abcd}']*dR['_{abcd}']
print(kr.expr())

It works, but now I want to substitute a value for the variable m. I have tried with:

kr.substitute(m==10)
kr.subs(m==10)
kr.substitute_expression(m==10)

but none of these work. How can I make the substituteion m=10?

2019-12-17 21:26:30 +0200 asked a question How do i plot a piecewise function with functional constraints?

I have to plot a function T(x,x) which equals xy if xy>0 and x+y otherwise. I have defined the function:

def T(x,y):
   if (x*y>0):
    return x*y
   else:
    return x+y

but it does not work.

2019-12-17 21:26:29 +0200 asked a question How do I define a piecewise function with functional restrictions?

I have to define a piecewise function T(x,y) which equals xy if xy>0 and x+y for x*y<=0. How do I do this? I have tried in this way:

def T(x,y):
  if (x>0):
    return x*y
  else:
    return x+y

but it does not work. How can I solve this problem?