2024-01-08 21:24:50 +0100 received badge ● Notable Question (source) 2024-01-08 21:24:50 +0100 received badge ● Popular Question (source) 2023-08-08 23:27:22 +0100 received badge ● Popular Question (source) 2023-06-15 21:27:04 +0100 commented answer What's the best way to access sage from a C program? I have: https://ask.sagemath.org/question/69124/call-sagemath-from-c/ and still no good answers. 2023-06-13 02:06:31 +0100 commented question call SageMath from C Added MWE...how about this - can I call Py_Initialize(), do those import calls, and then proceed with both C and Python 2023-06-13 02:04:57 +0100 edited question call SageMath from C call SageMath from C I wrote a little Graph Theory / Group Theory function in SageMath (using stuff from GAP, mostly), a 2023-06-12 17:16:13 +0100 received badge ● Editor (source) 2023-06-12 17:16:13 +0100 edited question call SageMath from C call SageMath from C I wrote a little Graph Theory / Group Theory function in SageMath (using stuff from GAP, mostly), a 2023-06-12 17:14:52 +0100 asked a question call SageMath from C call SageMath from C I wrote a little Graph Theory / Group Theory function in SageMath (using stuff from GAP, mostly), a 2022-01-09 17:49:12 +0100 received badge ● Notable Question (source) 2021-04-08 10:04:01 +0100 received badge ● Popular Question (source) 2021-03-21 22:11:33 +0100 received badge ● Popular Question (source) 2020-07-24 15:18:24 +0100 commented answer can't solve inequality for independent variable Unfortunately, it does help demonstrating that Mathematica does no better. I guess this is the answer ("Sage can't do what you want"), but I'll give a few days to see if anyone knows more. Thanks. 2020-07-23 17:26:30 +0100 asked a question can't solve inequality for independent variable One of the frustrations I'm always having with Sage is how it tries to "solve" inequalities. For a random example: sage: var('a b x') sage: f = (a - b * x^2) / (x-1) sage: solve(f > 0, x) [[x < 1, b*x^2 - a > 0], [1 < x, -b*x^2 + a > 0]]  Which I knew already (since it's just the numerator). Ok, so various signs and things matter, but the fact that it can't even tell me x^2 > a/b  is frustrating. Is there a reason, or a way to convince Sage to actually "solve" these in some way? 2020-06-04 21:22:28 +0100 commented answer abstract index notation and differential geometry Ok that does seem to be a partial solution, but it doesn't allow the metric to be represented with abstract indices. For example, the answer to this problem is generically $C^c_{ab}=2\delta ^c_{(a}\nabla_{b)}\ln \Omega-g_{ab}g^{cd}\nabla_d \ln \Omega$. 2020-06-02 00:43:51 +0100 commented answer abstract index notation and differential geometry Thanks: I will have to work out getting the latest version on my system before testing/marking correct, but it does seem that you've got a solution here. 2020-05-29 19:40:41 +0100 asked a question abstract index notation and differential geometry I am wondering if there are ways to use abstract index notation in sage. For example, could I define the tensor: $$C^c_{ab}=\frac{1}{2}g^{cd}(\tilde{\nabla_a} g_{bd}+\tilde{\nabla_b} g_{ad} - \tilde{\nabla_d} g_{ab})$$ this particular object describes the difference between two connections, $\nabla_a$ and $\tilde{\nabla}_b$. Can we define objects like this an manipulate them in Sage? My confusion comes from the common definition of the connection, a la nabla = g.connection()  Which is not directly a 1-tensor. Specifically, I would like to define a metric, $g_{ab}$, and a conformal transformation $\tilde{g_{ab}}=\Omega^2 g_{ab}$, the corresponding connections, and determine the tensor $C^a_{bc}$ for this particular case. (and of course, we know the answer because this the standard approach to conformal transformations in GR). 2020-02-19 23:01:01 +0100 commented answer Can't substitute H=dot(a)/a in SageMath Well, since this is my major frustration with Sage, I know that it is not a simple operation, but I can't for the life of me understand why it should be. Although your answer does the job, I'm going to select the other one as it doesn't require a new class definition. Although please, disagree and convince me! 2020-02-14 21:55:09 +0100 asked a question Can't substitute H=dot(a)/a in SageMath Hello all, I'm working with the Friedman equations, and I've gotten them down to the common form presented in terms of the scale factor. MWE incoming: M = Manifold(4, 'M', structure='Lorentzian') fr. = M.chart(r't r:[0,+oo) th:[0,pi]:\theta ph:[0,2*pi):\phi') var('G, Lambda, k', domain='real') a = M.scalar_field(function('a')(t), name='a') rho = M.scalar_field(function('rho')(t), name='rho') p = M.scalar_field(function('p')(t), name='p') g = M.metric() g[0,0] = -1 g[1,1] = a*a/(1 - k*r^2) g[2,2] = a*a*r^2 g[3,3] = a*a*(r*sin(th))^2 nabla = g.connection() Ricci = nabla.ricci() Ricci_scalar = g.ricci_scalar() E1 = Ricci - Ricci_scalar/2*g + Lambda*g print("First Friedmann equation:\n") E1[0,0].expr().expand() == 0  With the result being -Lambda + 3*diff(a(t), t)^2/a(t)^2 + 3*k/a(t)^2 == 0  Which is great, but I really want this to be in terms of the Hubble paramter $H=\dot{a}/a$. I can't make that substitution happen: var('h') eq1.substitute(diff(a.expr(),t)/a.expr()==h)  just spits out the same thing, -Lambda + 3*diff(a(t), t)^2/a(t)^2 + 3*k/a(t)^2 == 0  Any ideas? 2020-01-18 01:53:44 +0100 commented answer Unable to use substitute_function in SageManifolds Tried it both ways and they work. Thanks very much! So the .operator() returns the function, and the .expr() gives the expression of that function? 2019-05-17 10:40:52 +0100 received badge ● Good Question (source) 2018-05-08 22:39:07 +0100 received badge ● Supporter (source) 2018-05-08 22:38:48 +0100 received badge ● Scholar (source) 2018-05-08 17:45:27 +0100 received badge ● Nice Question (source) 2018-05-08 16:25:03 +0100 received badge ● Student (source) 2018-05-07 23:30:42 +0100 asked a question Alternating symbols with SageManifolds I would like to utilize the alternating symbol $\epsilon_{abcd}$ in SageManifolds. I've worked out that you can define the volume form like epsilon = g.volume_form() print(epsilon) ; epsilon.display() 4-form eps_g on the 4-dimensional differentiable manifold M eps_g = r^2*sqrt(-f(t))*abs(a(t))^3*sin(th) dt/\dr/\dth/\dph  And I can turn this into "the alternating 1-form" by dividing by the determinant of the metric. However, if I try to find the totally upper symbol $\epsilon^{abcd}$, which should just have components +1 and -1, I get epsilon_up=epsilon.up(g)*det*det print(epsilon_up);epsilon_up.display() Tensor field of type (4,0) on the 4-dimensional differentiable manifold M abs(a(t))^6/a(t)^6 d/dt*d/dr*d/dth*d/dph - abs(a(t))^6/a(t)^6 d/dt*d/dr*d/dph*d/dth - abs(a(t))^6/a(t)^6 d/dt*d/dth*d/dr*d/dph + abs(a(t))^6/a(t)^6 d/dt*d/dth*d/dph*d/dr + abs(a(t))^6/a(t)^6 d/dt*d/dph*d/dr*d/dth - abs(a(t))^6/a(t)^6 d/dt*d/dph*d/dth*d/dr - abs(a(t))^6/a(t)^6 d/dr*d/dt*d/dth*d/dph + abs(a(t))^6/a(t)^6 d/dr*d/dt*d/dph*d/dth + abs(a(t))^6/a(t)^6 d/dr*d/dth*d/dt*d/dph - abs(a(t))^6/a(t)^6 d/dr*d/dth*d/dph*d/dt - abs(a(t))^6/a(t)^6 d/dr*d/dph*d/dt*d/dth + abs(a(t))^6/a(t)^6 d/dr*d/dph*d/dth*d/dt + abs(a(t))^6/a(t)^6 d/dth*d/dt*d/dr*d/dph - abs(a(t))^6/a(t)^6 d/dth*d/dt*d/dph*d/dr - abs(a(t))^6/a(t)^6 d/dth*d/dr*d/dt*d/dph + abs(a(t))^6/a(t)^6 d/dth*d/dr*d/dph*d/dt + abs(a(t))^6/a(t)^6 d/dth*d/dph*d/dt*d/dr - abs(a(t))^6/a(t)^6 d/dth*d/dph*d/dr*d/dt - abs(a(t))^6/a(t)^6 d/dph*d/dt*d/dr*d/dth + abs(a(t))^6/a(t)^6 d/dph*d/dt*d/dth*d/dr + abs(a(t))^6/a(t)^6 d/dph*d/dr*d/dt*d/dth - abs(a(t))^6/a(t)^6 d/dph*d/dr*d/dth*d/dt - abs(a(t))^6/a(t)^6 d/dph*d/dth*d/dt*d/dr + abs(a(t))^6/a(t)^6 d/dph*d/dth*d/dr*d/dt  Which is just happening because at some point Sage has figured it out needs to keep track of the sign of a. Is there a direct way to define $\epsilon_{abcd}$ without accessing to the volume form at all? Essentially, I want to directly calculate things like the Euler Characteristic (and signature), which look like $$R_{abcd}R_{efgh}\epsilon^{abef}\epsilon^{cdgh}$$