# Pullback with large symbolic expressions¶

## exp version¶

This worksheet is relative the ask.sagemath question Pullback computation hanging

In :
version()

Out:
'SageMath version 8.1, Release Date: 2017-12-07'
In :
%display latex

In :
M = Manifold(3, 'M')
X.<x,y,z> = M.chart()

N = Manifold(3, 'N')
XN.<a,b1,b2> = N.chart()

omega = N.diff_form(2)
omega[0,1] = 2*b2/a^3
omega[0,2] = -2*b1/a^3
omega[1,2] = -2/a^2
omega.display()

Out:

We enforce the use of the $\exp$ representation of $\cosh$ and $\sinh$:

In :
cosh_e(x) = (exp(x) + exp(-x))/2
sinh_e(x) = (exp(x) - exp(-x))/2

In :
r = sqrt(x^2+y^2+z^2)
t = var('t', domain='real')
STSa = r^(1/2)*(r*cosh_e(2*r*t) - z*sinh_e(2*r*t))^(-1/2)
STSb1 = (x*sinh_e(2*r*t)/r)*STSa
STSb2 = (y*sinh_e(2*r*t)/r)*STSa

STS = M.diffeomorphism(N, [STSa, STSb1, STSb2])
STS.display()

Out:
In :
%time STS.jacobian_matrix()[0,0]

CPU times: user 5.1 s, sys: 100 ms, total: 5.2 s
Wall time: 5.17 s

Out:
In :
%time s = STS.pullback(omega)
s

CPU times: user 4min 49s, sys: 1.18 s, total: 4min 50s
Wall time: 4min 49s

Out:

The number of characters in each of the non-vanishing components of $s$:

In :
[len(str(s[ind])) for ind in [(0,1), (0,2), (1,2)]]

Out:

The first 1000 characters of $s_{01}$:

In :
print(str(s[0,1])[:1000])

-1/2*(131072*z^20 + 655360*(x^2 + y^2)*z^18 + 1384448*(x^4 + 2*x^2*y^2 + y^4)*z^16 + 1605632*(x^6 + 3*x^4*y^2 + 3*x^2*y^4 + y^6)*z^14 + 1111552*(x^8 + 4*x^6*y^2 + 6*x^4*y^4 + 4*x^2*y^6 + y^8)*z^12 + 467456*(x^10 + 5*x^8*y^2 + 10*x^6*y^4 + 10*x^4*y^6 + 5*x^2*y^8 + y^10)*z^10 + 116160*(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12)*z^8 + 15744*(x^14 + 7*x^12*y^2 + 21*x^10*y^4 + 35*x^8*y^6 + 35*x^6*y^8 + 21*x^4*y^10 + 7*x^2*y^12 + y^14)*z^6 + 978*(x^16 + 8*x^14*y^2 + 28*x^12*y^4 + 56*x^10*y^6 + 70*x^8*y^8 + 56*x^6*y^10 + 28*x^4*y^12 + 8*x^2*y^14 + y^16)*z^4 + 18*(x^18 + 9*x^16*y^2 + 36*x^14*y^4 + 84*x^12*y^6 + 126*x^10*y^8 + 126*x^8*y^10 + 84*x^6*y^12 + 36*x^4*y^14 + 9*x^2*y^16 + y^18)*z^2 + 2*(65536*z^20 + 327680*(x^2 + y^2)*z^18 + 692224*(x^4 + 2*x^2*y^2 + y^4)*z^16 + 802816*(x^6 + 3*x^4*y^2 + 3*x^2*y^4 + y^6)*z^14 + 555776*(x^8 + 4*x^6*y^2 + 6*x^4*y^4 + 4*x^2*y^6 + y^8)*z^12 + 233728*(x^10 + 5*x^8*y^2 + 10*x^6*y^4 + 10*x^4*y^6 + 5*x^2*y^8 + y^10)*z^10 + 5

In [ ]: