# Dox's profile - activity

2019-07-30 10:47:49 +0100 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 14:11:07 +0100 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 21:46:48 +0100 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 16:18:03 +0100 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 09:41:24 +0100 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 09:18:37 +0100 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 08:34:54 +0100 commented answer How to get the collection of all functions from X to Y in SageMath

Thanks for the theory!

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

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

2018-12-03 19:18:05 +0100 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 18:37:06 +0100 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 18:33:37 +0100 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 22:16:13 +0100 commented question Sagemanifold: autoparallel curve equations

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

2018-11-28 19:13:43 +0100 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 14:25:43 +0100 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 10:30:47 +0100 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 09:30:38 +0100 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?

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.$