# Dox's profile - activity

2019-07-30 03:47:49 -0500 marked best answer Differential forms and tensors

Dear all,

A long time ago I was trying to implement a SAGE code for working with Differential Forms with values in a certain Lie algebra, but due to my lack of programming knowledge, I couldn't.

This kind of objects are important for working with non-Abelin gauge theories.

Question

Is it possible to define and work with those objects?

So far there is no reference of it in the manual.

Thank you!

2019-05-20 07:11:07 -0500 marked best answer Size of Labels on a Plot

dear all:

I'd like to know if there is any way to change the size of the font of labels (in a plot) without changing the size of the numbers on the ticks.

Thank you

2019-05-17 14:46:48 -0500 commented answer Restricting a variable to a (real) range

Thank you @dsejas Yes, your comment was incredible useful! It drove me to a nice solution. Since I had a lot of assumptions, I was trying to find a way to drop the last assumption (still don't know it possible), and looking for that I found the with assuming(condition): code statement, which execute the code assuming the condition without registering in the assumptions() list! Thank you very much!

2019-05-17 09:18:03 -0500 asked a question Restricting a variable to a (real) range

Hi. I'm solving a differential equation which depends on two parameters $c1$ and $c2$. They are both positive

assume(c1 > 0)
assume(c2 > 0)


but in order to solve the equation, maxima ask me whether c2-3 is positive, negative or zero. With the condition

assume(c2 - 3 > 0)

the equation is solved; But imposing c2 - 3 < 0 triggers and inconsistency... I believe that it is due to the initial assumption.

Question

Is it possible to set a condition like assume(0 < c2 < 3)?

2019-05-14 02:41:24 -0500 asked a question Solving an ODE and simplifying the result

I'm interested in solving the differential equation $$3 h' + 3 h^2 = c_1,$$ where $c_1$ is a positive real number.

var('t')
var('c1', latex_name=r'c_1')
h = function('h')(t)
eq = -3*h^2 + c1 - 3*diff(h, t)
eq_sol = desolve(eq, h, ivar=t, contrib_ode=True)


The above code works, but it's not solved explicitly for $h$, so

h_sol = solve(eq_sol, h)
h_sol = h_sol
h_sol


This gives something like $$h\left(t\right) = \frac{\sqrt{3} \sqrt{c_{1}} {\left(e^{\left(\frac{2}{3} \, \sqrt{3} C \sqrt{c_{1}} + \frac{2}{3} \, \sqrt{3} \sqrt{c_{1}} t\right)} + 1\right)}}{3 \, {\left(e^{\left(\frac{2}{3} \, \sqrt{3} C \sqrt{c_{1}} + \frac{2}{3} \, \sqrt{3} \sqrt{c_{1}} t\right)} - 1\right)}},$$

in sage notation (non-LaTeX) it starts like

h(t) == 1/3*sqrt(3)*sqrt(c1)* ...


Question 1: Is there a way to allocate to the solution (i.e. h_sol) the RHS of the above? without the h(t) == part.

I had to set by hand (it is ease, but it would be nice to automatize the allocation)

var('C')    # the integration constant introduced above
h_sol = 1/3*sqrt(3)*sqrt(c1)* ...


Then, by simply looking at the solution it is clear that it can be simplified. I tried things like

h_sol = h_sol.canonicalize_radical()
h_sol = h_sol.collect_common_factors()
h_sol = h_sol.simplify_rectform(complexity_measure = None)


but none of them returns the expected result, which could be obtained from Mathematica's kernel

mathematica("DSolve[3*h'[t] + 3*h[t]^2 == C, h[t], t]//FullSimplify")


$$\sqrt{\frac{c_1}{3}} \tanh\left( \sqrt{\frac{c_1}{3}} (t - 3 c_2) \right)$$

Question 2: How could the expression h_sol be manipulated to obtain the hyperbolic tangent?

2018-12-04 02:18:37 -0500 asked a question Sagemanifold - Connection components from a tensor (not a metric)

Dear community.

This might sound dump, but I'm trying to determine whether a tensor satisfy the properties of a metric (under certain conditions). Of course it is a (0,2)-symmetric tensor, call it $S$, but I cannot (to my understanding) calculate the (Levi-Civita-like) connection components that would be associated to $S$... unless I declare it as a metric.

The way it is implemented makes sense... and it's solid!

## What I did...?

I defined like a metric and calculate the associated connection (and curvatures)

## Why should I do something else?

In the file src/sage/manifolds/differentiable/metric.py the metric is defined (as it should) to be symmetric, but it does not allow to consider extensions of General Relativity like say Einstein--Strauss model. Thus, I need an instance to calculate the derived quantities of a tensor that is a generalization of a metric.

### Question:

Is this possible?

2018-12-04 01:34:54 -0500 commented answer How to get the collection of all functions from X to Y in SageMath

Thanks for the theory!

2018-12-03 12:20:48 -0500 commented answer Subtitute functions - in a differential equation - Sagemanifold

hehehehe... Thank you again! I almost got it... but I tried .expression().

2018-12-03 12:18:05 -0500 commented answer Sagemanifold - only_nonredundant = True by default

Excellent! Thank you for the answer, and a wonderful use of the lambda function!

2018-12-03 11:37:06 -0500 asked a question Sagemanifold - only_nonredundant = True by default

Hi, I find the option only_nonredundant=True really helpful, but it is annoying to type over and over the option on the notebook. Is it possible to define the option globally (within a notebook)?

2018-12-03 11:33:37 -0500 asked a question Subtitute functions - in a differential equation - Sagemanifold

Dear community,

I have a differential equation that depends on a function $\xi(t)$, but is a component of a tensor (calculated with sagemanifold)

M = Manifold(4, 'M', latex_name=r"\mathcal{M}")
U.<t,r,th,ph> = M.chart(r't r:(0,+oo) th:(0,pi):\theta ph:(0,2*pi):\phi')
xi = function('xi')(t)
f = function('f')(t)
h = function('h')(t)
g = function('g')(t)
Ric = M.tensor_field(0,2, 'Ric')
Ric[0,0] = 3/2*f*h - 3/4*h^2 + 3/2*f*xi + 3/4*xi^2 - 3/2*diff(h, t) - 3/2*diff(xi, t)
Ric.display()


I'd like to define the restriction to $\xi = 0$, and assign it to a new tensor

Ric0 = M.tensor_field(0,2, 'Ric0')
Ric0[0,0] = Ric[0,0].substitute_expression({xi:0, diff(xi, t):0})
Ric0.display()


but I get an AttributeError because the

AttributeError: 'ChartFunctionRing_with_category.element_class' object has no attribute 'substitute_expression'


I know that it works for functions

var('t')
xi = function('xi')(t)
f = function('f')(t)
h = function('h')(t)
ode = 3/2*f*h - 3/4*h^2 + 3/2*f*xi + 3/4*xi^2 - 3/2*diff(h, t) - 3/2*diff(xi, t)
ode0 = ode.substitute_expression({xi:0, diff(xi, t):0})


## Question

Is there a way to substitute functions that are not 𝚜𝚊𝚐𝚎.𝚜𝚢𝚖𝚋𝚘𝚕𝚒𝚌.𝚎𝚡𝚙𝚛𝚎𝚜𝚜𝚒𝚘𝚗.𝙴𝚡𝚙𝚛𝚎𝚜𝚜𝚒𝚘𝚗 but ChartFunctionRing_with_category.element_class?

2018-11-28 15:16:13 -0500 commented question Sagemanifold: autoparallel curve equations

Currently I am not at work, I'll upload it tomorrow. Thanks for the interest.

2018-11-28 12:13:43 -0500 asked a question Sagemanifold: autoparallel curve equations

Hello community.

I'm interested in calculating the autoparallel curves defined by an affine connection (it has torsion). Following the recipes from the documentation notebooks in the sagemanifold web page I've achieved the goal with ease. However, in the result there is a function $h$, which is related with the torsion of the connection, shows up in the definition of the curve.

I expected this function not to show... because one usually argue that the contribution of the antisymmetric part of the connection to the geodesic (or autoparallel in this case) vanishes, based in symmetry arguments (it is contracted with a symmetric tensor).

Is the fact that I'm getting a contribution of the torsion in the equations a mistake in the algorithm of the curve equation or is a personal misunderstanding?

2018-11-22 07:25:43 -0500 commented question Assignation of components of a differential form (or multivector field) in sagemanifold

@eric_g: Thank you! I didn't know that... I was assigning the components one by one! (there was the tedious part)

2018-11-22 03:30:47 -0500 asked a question Assignation of components of a differential form (or multivector field) in sagemanifold

Dear all. I've crossed with the task of assigning components to a multivector field, and it's tedious! (specially higher ranks)

Question: Is there an efficient way of assigning components to tensors with symmetries?

2018-11-22 02:30:38 -0500 asked a question Tensor density in sagemanifolds?

Hello community.

I've just realized that within the class TensorField there are subclasses DiffForm and MultivectorField. I was wondering whether a maximal (i.e. rank $n$ in $n$ dimensions) differential form or multivector field are considered as tensor densities. I'm thinking in the Levi-Civita epsilon.

Well, more generally... Is there a way to assign a density weight to a tensor?

2018-08-28 08:09:20 -0500 answered a question How can I calculate this sum? (accept both sage(cocalc) and by hand)

I'm certain that the question is not correctly asked. Notice that in the sentence,

How can I calculate this sum?

1/1-(x+x^2)^2

there is no sum at all!

However, it seems that the OP wants to know if the expresion $$\frac{1}{1 - (x + x^2)^2} = \sum_{n = 0}^\infty (x + x^2)^{2n},$$ is valid.

If that is the question... I'd say yes, as long as $(x + x^2)^2 <1.$

2018-08-13 13:19:52 -0500 commented question How can I calculate this sum? (accept both sage(cocalc) and by hand)

2018-08-13 13:05:22 -0500 asked a question Solving a differential equation - From SageManifold

I'm interested in solving a differential equation obtained from a calculation from sagemanifold. I'll give a simple example, but the reason is that in general the equations are not as simple and one can introduce errors copying the equations.

I'd like to solve the equation given by the Ricci flat condition (for a certain affine connection).

reset()
M = Manifold(4, 'M', latex_name=r"\mathcal{M}")
U.<t,r,th,ph> = M.chart(r't r:(0,+oo) th:(0,pi):\theta ph:(0,2*pi):\phi')
nab = M.affine_connection('nabla', r'\nabla'); nab

k = var('k', latex_name=r'\kappa')
s = sqrt(1 - k * r**2)
f = function('f')(t)
g = function('g')(t)
h = function('h')(t)

nab[0,0,0] = f
nab[0,1,1] = g / (1 - k * r**2)
nab[0,2,2] = r**2 * g
nab[0,3,3] = r**2 * sin(th)**2 * g
nab[1,0,1] = h
nab[1,1,0] = h
nab[1,1,1] = k * r / (1 - k * r**2)
nab[1,2,2] = k * r**3 - r
nab[1,3,3] = (k * r **3 - r) * sin(th)**2
nab[2,0,2] = h
nab[2,1,2] = 1 / r
nab[2,2,0] = h
nab[2,2,1] = 1 / r
nab[2,3,3] = - cos(th) * sin(th)
nab[3,0,3] = h
nab[3,1,3] = 1 / r
nab[3,2,3] = cos(th) / sin(th)
nab[3,3,0] = h
nab[3,3,1] = 1 / r
nab[3,3,2] = cos(th) / sin(th)
nab.display()

Ric = M.tensor_field(0,2, 'R', latex_name=r'R')
Ric = nab.ricci()
print("Ricci tensor")
Ric.display_comp()


Now, the Ric[0,0] component yield a simple equation, and can be solved by the command

desolve(diff(h,t) + h**2 - f*h, h, ivar=t, contrib_ode=True)


However, I'd like to be able of telling Sage the following

desolve( Ric[0,0], h, ivar=t, contrib_ode=True)


but it seems that there is an incompatibility of types here...

type(diff(h,t) + h**2 - f*h)


returns <𝚝𝚢𝚙𝚎'𝚜𝚊𝚐𝚎.𝚜𝚢𝚖𝚋𝚘𝚕𝚒𝚌.𝚎𝚡𝚙𝚛𝚎𝚜𝚜𝚒𝚘𝚗.𝙴𝚡𝚙𝚛𝚎𝚜𝚜𝚒𝚘𝚗'>, while

type(Ric[0,0])


returns <𝚌𝚕𝚊𝚜𝚜'𝚜𝚊𝚐𝚎.𝚖𝚊𝚗𝚒𝚏𝚘𝚕𝚍𝚜.𝚌𝚑𝚊𝚛𝚝⎯𝚏𝚞𝚗𝚌.𝙲𝚑𝚊𝚛𝚝𝙵𝚞𝚗𝚌𝚝𝚒𝚘𝚗𝚁𝚒𝚗𝚐⎯𝚠𝚒𝚝𝚑⎯𝚌𝚊𝚝𝚎𝚐𝚘𝚛𝚢.𝚎𝚕𝚎𝚖𝚎𝚗𝚝⎯𝚌𝚕𝚊𝚜𝚜'>

Question:

What can I do to use the results from sagemanifolds to solve the differential equation?

Dear community, I'm aware that SAGE has maxima inside. Since I have a set of .mac files that allow me to compute quantities from Quantum Field Theory, I'd like to know if they can be loaded in a SAGE (jupyter) session... and How?