Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

280

281

282

283

284

285

286

287

288

289

290

291

292

293

294

295

296

297

298

299

300

301

302

303

304

305

306

307

308

309

310

311

312

313

314

315

316

317

318

319

320

321

322

323

324

325

326

327

328

329

330

331

332

333

334

335

336

337

338

339

340

341

342

343

344

345

346

347

348

349

350

351

352

353

354

355

356

357

358

359

360

361

362

363

364

365

366

367

368

369

370

371

372

373

374

375

376

377

378

379

380

381

382

383

384

385

386

387

388

389

390

391

392

393

394

395

396

397

398

399

400

401

402

403

404

405

406

407

408

409

410

411

412

413

414

415

416

417

418

419

420

421

422

423

424

425

426

427

428

429

430

431

432

433

434

435

436

437

438

439

440

441

442

443

444

445

446

447

448

449

450

451

452

453

454

455

456

457

458

459

460

461

462

463

464

465

466

467

468

469

470

471

472

473

474

475

476

477

478

479

480

481

482

483

484

485

486

487

488

489

490

491

492

493

494

495

496

497

498

499

500

501

502

503

504

505

506

507

508

509

510

511

512

513

514

515

516

517

518

519

520

521

522

523

524

525

526

527

528

529

530

531

532

533

534

535

536

537

538

539

540

541

542

543

544

545

546

547

548

549

550

551

552

553

554

555

556

557

558

559

560

561

562

563

564

565

566

567

568

569

570

571

572

573

574

575

576

577

578

579

580

581

582

583

584

585

586

587

588

589

590

591

592

593

594

595

596

597

598

599

600

601

602

603

604

605

606

607

608

609

610

611

612

613

614

615

616

617

618

619

620

621

622

623

624

625

626

627

628

629

630

631

632

633

634

635

636

637

638

639

640

641

642

643

644

645

646

647

648

649

650

651

652

653

654

655

656

657

658

659

660

661

662

663

664

665

666

667

668

669

670

671

672

673

674

675

676

677

678

679

680

681

682

683

684

685

686

687

688

689

690

691

692

693

694

695

696

697

698

699

700

701

702

703

704

705

706

707

708

709

710

711

712

713

714

715

716

717

718

719

720

721

722

723

724

725

726

727

728

729

730

731

732

733

734

735

736

737

738

739

740

741

742

743

744

745

746

747

748

749

750

751

752

753

754

755

756

757

758

759

760

761

762

763

764

765

766

767

768

769

770

771

772

773

774

775

776

777

778

779

780

781

782

783

784

785

786

787

788

789

790

791

792

793

794

795

796

797

798

799

800

801

802

803

804

805

806

807

808

809

810

811

812

813

814

815

816

817

818

819

820

821

822

823

824

825

826

827

828

829

830

831

832

833

834

835

836

837

838

839

840

841

842

843

844

845

846

847

848

849

850

851

852

853

854

855

856

857

858

859

860

861

862

863

864

865

866

867

868

869

870

871

872

873

874

875

876

877

878

879

880

881

882

883

884

885

886

887

888

889

890

891

892

893

894

895

896

897

898

899

900

901

902

903

904

905

906

907

908

909

910

911

912

913

914

915

916

917

918

919

920

921

922

923

924

925

926

927

928

929

930

931

932

933

934

935

936

937

938

939

940

941

942

943

944

945

946

947

948

949

950

951

952

953

954

955

956

957

958

959

960

961

962

963

964

965

966

967

968

969

970

971

972

973

974

975

976

977

978

979

980

981

982

983

984

985

986

987

988

989

990

991

992

993

994

995

996

997

998

999

1000

1001

1002

1003

1004

1005

1006

1007

1008

1009

1010

1011

1012

1013

1014

1015

1016

1017

1018

1019

1020

1021

1022

1023

1024

1025

1026

1027

1028

1029

1030

1031

1032

1033

1034

1035

1036

1037

1038

1039

1040

1041

1042

1043

1044

1045

1046

1047

1048

1049

1050

1051

1052

1053

1054

1055

1056

1057

1058

1059

1060

1061

1062

1063

1064

1065

1066

1067

1068

1069

1070

1071

1072

1073

1074

1075

1076

1077

1078

1079

1080

1081

1082

1083

1084

1085

1086

1087

1088

1089

1090

1091

1092

1093

1094

1095

1096

1097

1098

1099

1100

1101

1102

1103

1104

1105

1106

1107

1108

1109

1110

1111

1112

1113

1114

1115

1116

1117

1118

1119

1120

1121

1122

1123

1124

1125

1126

1127

1128

1129

1130

1131

1132

1133

1134

1135

1136

1137

1138

1139

1140

1141

1142

1143

1144

1145

1146

1147

1148

1149

1150

1151

1152

1153

1154

1155

1156

1157

1158

1159

1160

1161

1162

1163

1164

1165

1166

1167

1168

1169

1170

1171

1172

1173

1174

1175

1176

1177

1178

1179

1180

1181

1182

1183

1184

1185

1186

1187

1188

1189

1190

1191

1192

1193

1194

1195

1196

1197

1198

1199

1200

1201

1202

1203

1204

1205

1206

1207

1208

1209

1210

1211

1212

1213

1214

1215

1216

1217

1218

1219

1220

1221

1222

1223

1224

1225

1226

1227

1228

1229

1230

1231

1232

1233

1234

1235

1236

1237

1238

1239

1240

1241

1242

1243

1244

1245

1246

1247

1248

1249

1250

1251

1252

1253

1254

1255

1256

1257

1258

1259

1260

1261

1262

1263

1264

1265

1266

1267

1268

1269

1270

1271

1272

1273

1274

1275

1276

1277

1278

1279

1280

1281

1282

1283

1284

1285

1286

1287

1288

1289

1290

1291

1292

1293

1294

1295

1296

1297

1298

1299

1300

1301

1302

1303

1304

1305

1306

1307

1308

1309

1310

1311

1312

1313

1314

1315

1316

1317

1318

1319

1320

1321

1322

1323

1324

1325

1326

1327

1328

1329

1330

1331

1332

1333

1334

1335

1336

1337

1338

1339

1340

1341

1342

1343

1344

1345

1346

1347

1348

1349

1350

1351

1352

1353

1354

1355

1356

1357

1358

1359

1360

1361

1362

1363

1364

1365

1366

1367

1368

1369

1370

1371

1372

1373

1374

1375

1376

1377

1378

1379

1380

1381

1382

1383

1384

1385

1386

1387

1388

1389

1390

1391

1392

1393

1394

1395

1396

1397

1398

1399

1400

1401

1402

1403

1404

1405

1406

1407

1408

1409

1410

1411

1412

1413

1414

1415

1416

1417

1418

1419

1420

1421

1422

1423

1424

1425

1426

1427

1428

1429

1430

1431

1432

1433

1434

1435

1436

1437

1438

1439

1440

1441

1442

1443

1444

1445

1446

1447

1448

1449

1450

1451

1452

1453

1454

1455

1456

1457

1458

1459

1460

1461

1462

1463

1464

1465

1466

1467

1468

1469

1470

1471

1472

1473

1474

1475

1476

1477

1478

1479

1480

1481

1482

1483

1484

1485

1486

1487

1488

1489

1490

1491

1492

1493

1494

1495

1496

1497

1498

1499

1500

1501

1502

1503

1504

1505

1506

1507

1508

1509

1510

1511

1512

1513

1514

1515

1516

1517

1518

1519

1520

1521

1522

1523

1524

1525

1526

1527

1528

1529

1530

1531

1532

1533

1534

1535

1536

1537

1538

1539

1540

1541

1542

1543

1544

1545

1546

1547

1548

1549

1550

1551

1552

1553

1554

1555

1556

1557

1558

1559

1560

1561

1562

1563

1564

1565

1566

1567

1568

1569

1570

1571

1572

1573

1574

1575

1576

1577

1578

1579

1580

1581

1582

1583

1584

1585

1586

1587

1588

1589

1590

1591

1592

1593

1594

1595

1596

1597

1598

1599

1600

1601

1602

1603

1604

1605

1606

1607

1608

1609

1610

1611

1612

1613

1614

1615

1616

1617

1618

1619

1620

1621

1622

1623

1624

1625

1626

1627

1628

1629

1630

1631

1632

1633

1634

1635

1636

1637

1638

1639

1640

1641

1642

1643

1644

1645

1646

1647

1648

1649

1650

1651

1652

1653

1654

1655

1656

1657

1658

1659

1660

1661

1662

1663

1664

1665

1666

1667

1668

1669

1670

1671

1672

1673

1674

1675

1676

1677

1678

1679

1680

1681

1682

1683

1684

1685

1686

1687

1688

1689

1690

1691

1692

1693

1694

1695

1696

1697

1698

1699

1700

1701

1702

1703

1704

1705

1706

1707

1708

1709

1710

1711

1712

1713

1714

1715

1716

1717

1718

1719

1720

1721

1722

1723

1724

1725

1726

1727

1728

1729

1730

1731

1732

1733

1734

1735

1736

1737

1738

1739

1740

1741

1742

1743

1744

1745

1746

1747

1748

1749

1750

1751

1752

1753

1754

1755

1756

1757

1758

1759

1760

1761

1762

1763

1764

1765

1766

1767

1768

1769

1770

1771

1772

1773

1774

1775

1776

1777

1778

1779

1780

1781

1782

1783

1784

1785

1786

1787

1788

1789

1790

1791

1792

1793

1794

1795

1796

1797

1798

1799

1800

1801

1802

1803

1804

1805

1806

1807

1808

1809

1810

1811

1812

1813

1814

1815

1816

1817

1818

1819

1820

1821

1822

1823

1824

1825

1826

1827

1828

1829

1830

1831

1832

1833

1834

1835

1836

1837

1838

1839

1840

1841

1842

1843

1844

1845

1846

1847

1848

1849

1850

1851

1852

1853

1854

1855

1856

1857

1858

1859

1860

1861

1862

1863

1864

1865

1866

1867

1868

1869

1870

1871

1872

1873

1874

1875

1876

1877

1878

1879

1880

1881

1882

1883

1884

1885

1886

1887

1888

1889

1890

1891

1892

1893

1894

1895

1896

1897

1898

1899

1900

1901

1902

1903

1904

1905

1906

1907

1908

1909

1910

1911

1912

1913

1914

1915

1916

1917

1918

1919

1920

1921

1922

1923

1924

1925

1926

1927

1928

1929

1930

1931

1932

1933

1934

1935

1936

1937

1938

1939

1940

1941

1942

1943

1944

1945

1946

1947

1948

1949

1950

1951

1952

1953

1954

1955

1956

1957

1958

1959

1960

1961

1962

1963

1964

1965

1966

1967

1968

1969

1970

1971

1972

1973

1974

1975

1976

1977

1978

1979

1980

1981

1982

1983

1984

1985

1986

1987

1988

1989

1990

1991

1992

1993

1994

1995

1996

1997

1998

1999

2000

2001

2002

2003

2004

2005

2006

2007

2008

2009

2010

2011

2012

2013

2014

2015

2016

2017

2018

2019

2020

2021

2022

2023

2024

2025

2026

2027

2028

2029

2030

2031

2032

2033

2034

2035

2036

2037

2038

2039

2040

2041

2042

2043

2044

2045

2046

2047

2048

2049

2050

2051

2052

2053

2054

2055

2056

2057

2058

2059

2060

2061

2062

2063

2064

2065

2066

2067

2068

2069

2070

2071

2072

2073

2074

2075

2076

2077

2078

2079

2080

2081

2082

2083

2084

2085

2086

2087

2088

2089

2090

2091

2092

2093

2094

2095

2096

2097

2098

2099

2100

2101

2102

2103

2104

2105

2106

2107

2108

2109

2110

2111

2112

2113

2114

2115

2116

2117

2118

2119

2120

2121

2122

2123

2124

2125

2126

2127

2128

2129

2130

2131

2132

2133

2134

2135

2136

2137

2138

2139

2140

2141

2142

2143

2144

2145

2146

2147

2148

r""" 

Vector Field Modules 

 

The set of vector fields along a differentiable manifold `U` with values on 

a differentiable manifold `M` via a differentiable map `\Phi: U \to M` 

(possibly `U = M` and `\Phi=\mathrm{Id}_M`) is a module over the algebra 

`C^k(U)` of differentiable scalar fields on `U`. If `\Phi` is the identity 

map, this module is considered a Lie algebroid under the Lie bracket `[\ ,\ ]` 

(cf. :wikipedia:`Lie_algebroid`). It is a free module if and only if `M` is 

parallelizable. Accordingly, there are two classes for vector field modules: 

 

- :class:`VectorFieldModule` for vector fields with values on a 

generic (in practice, not parallelizable) differentiable manifold `M`. 

- :class:`VectorFieldFreeModule` for vector fields with values on a 

parallelizable manifold `M`. 

 

AUTHORS: 

 

- Eric Gourgoulhon, Michal Bejger (2014-2015): initial version 

- Travis Scrimshaw (2016): structure of Lie algebroid (:trac:`20771`) 

 

REFERENCES: 

 

- [KN1963]_ 

- [Lee2013]_ 

- [ONe1983]_ 

 

""" 

 

#****************************************************************************** 

# Copyright (C) 2015 Eric Gourgoulhon <eric.gourgoulhon@obspm.fr> 

# Copyright (C) 2015 Michal Bejger <bejger@camk.edu.pl> 

# Copyright (C) 2016 Travis Scrimshaw <tscrimsh@umn.edu> 

# 

# Distributed under the terms of the GNU General Public License (GPL) 

# as published by the Free Software Foundation; either version 2 of 

# the License, or (at your option) any later version. 

# http://www.gnu.org/licenses/ 

#****************************************************************************** 

 

from sage.structure.unique_representation import UniqueRepresentation 

from sage.structure.parent import Parent 

from sage.categories.modules import Modules 

from sage.misc.cachefunc import cached_method 

from sage.rings.integer import Integer 

from sage.tensor.modules.finite_rank_free_module import FiniteRankFreeModule 

from sage.manifolds.differentiable.vectorfield import (VectorField, 

VectorFieldParal) 

 

class VectorFieldModule(UniqueRepresentation, Parent): 

r""" 

Module of vector fields along a differentiable manifold `U` 

with values on a differentiable manifold `M`, via a differentiable 

map `U \rightarrow M`. 

 

Given a differentiable map 

 

.. MATH:: 

 

\Phi:\ U \longrightarrow M, 

 

the *vector field module* `\mathfrak{X}(U,\Phi)` is the set of 

all vector fields of the type 

 

.. MATH:: 

 

v:\ U \longrightarrow TM 

 

(where `TM` is the tangent bundle of `M`) such that 

 

.. MATH:: 

 

\forall p \in U,\ v(p) \in T_{\Phi(p)}M, 

 

where `T_{\Phi(p)}M` is the tangent space to `M` at the point `\Phi(p)`. 

 

The set `\mathfrak{X}(U,\Phi)` is a module over `C^k(U)`, the ring 

(algebra) of differentiable scalar fields on `U` (see 

:class:`~sage.manifolds.differentiable.scalarfield_algebra.DiffScalarFieldAlgebra`). 

Furthermore, it is a Lie algebroid under the Lie bracket (cf. 

:wikipedia:`Lie_algebroid`) 

 

.. MATH:: 

 

[X, Y] = X \circ Y - Y \circ X 

 

over the scalarfields if `\Phi` is the identity map. That is to say 

the Lie bracket is antisymmetric, bilinear over the base field, 

satisfies the Jacobi identity, and `[X, fY] = X(f) Y + f[X, Y]`. 

 

The standard case of vector fields *on* a differentiable manifold 

corresponds to `U = M` and `\Phi = \mathrm{Id}_M`; we then denote 

`\mathfrak{X}(M,\mathrm{Id}_M)` by merely `\mathfrak{X}(M)`. Other common 

cases are `\Phi` being an immersion and `\Phi` being a curve in `M` 

(`U` is then an open interval of `\RR`). 

 

.. NOTE:: 

 

If `M` is parallelizable, the class :class:`VectorFieldFreeModule` 

should be used instead. 

 

INPUT: 

 

- ``domain`` -- differentiable manifold `U` along which the 

vector fields are defined 

- ``dest_map`` -- (default: ``None``) destination map 

`\Phi:\ U \rightarrow M` 

(type: :class:`~sage.manifolds.differentiable.diff_map.DiffMap`); 

if ``None``, it is assumed that `U = M` and `\Phi` is the identity 

map of `M` (case of vector fields *on* `M`) 

 

EXAMPLES: 

 

Module of vector fields on the 2-sphere:: 

 

sage: M = Manifold(2, 'M') # the 2-dimensional sphere S^2 

sage: U = M.open_subset('U') # complement of the North pole 

sage: c_xy.<x,y> = U.chart() # stereographic coordinates from the North pole 

sage: V = M.open_subset('V') # complement of the South pole 

sage: c_uv.<u,v> = V.chart() # stereographic coordinates from the South pole 

sage: M.declare_union(U,V) # S^2 is the union of U and V 

sage: xy_to_uv = c_xy.transition_map(c_uv, (x/(x^2+y^2), y/(x^2+y^2)), 

....: intersection_name='W', restrictions1= x^2+y^2!=0, 

....: restrictions2= u^2+v^2!=0) 

sage: uv_to_xy = xy_to_uv.inverse() 

sage: XM = M.vector_field_module() ; XM 

Module X(M) of vector fields on the 2-dimensional differentiable 

manifold M 

 

`\mathfrak{X}(M)` is a module over the algebra `C^k(M)`:: 

 

sage: XM.category() 

Category of modules over Algebra of differentiable scalar fields on the 

2-dimensional differentiable manifold M 

sage: XM.base_ring() is M.scalar_field_algebra() 

True 

 

`\mathfrak{X}(M)` is not a free module:: 

 

sage: isinstance(XM, FiniteRankFreeModule) 

False 

 

because `M = S^2` is not parallelizable:: 

 

sage: M.is_manifestly_parallelizable() 

False 

 

On the contrary, the module of vector fields on `U` is a free module, 

since `U` is parallelizable (being a coordinate domain):: 

 

sage: XU = U.vector_field_module() 

sage: isinstance(XU, FiniteRankFreeModule) 

True 

sage: U.is_manifestly_parallelizable() 

True 

 

The zero element of the module:: 

 

sage: z = XM.zero() ; z 

Vector field zero on the 2-dimensional differentiable manifold M 

sage: z.display(c_xy.frame()) 

zero = 0 

sage: z.display(c_uv.frame()) 

zero = 0 

 

The module `\mathfrak{X}(M)` coerces to any module of vector fields defined 

on a subdomain of `M`, for instance `\mathfrak{X}(U)`:: 

 

sage: XU.has_coerce_map_from(XM) 

True 

sage: XU.coerce_map_from(XM) 

Coercion map: 

From: Module X(M) of vector fields on the 2-dimensional 

differentiable manifold M 

To: Free module X(U) of vector fields on the Open subset U of the 

2-dimensional differentiable manifold M 

 

The conversion map is actually the restriction of vector fields defined 

on `M` to `U`. 

 

""" 

Element = VectorField 

 

def __init__(self, domain, dest_map=None): 

r""" 

Construct the module of vector fields taking values on a (a priori) 

non-parallelizable differentiable manifold. 

 

TESTS:: 

 

sage: M = Manifold(2, 'M') # the 2-dimensional sphere S^2 

sage: U = M.open_subset('U') # complement of the North pole 

sage: c_xy.<x,y> = U.chart() # stereographic coordinates from the North pole 

sage: V = M.open_subset('V') # complement of the South pole 

sage: c_uv.<u,v> = V.chart() # stereographic coordinates from the South pole 

sage: M.declare_union(U,V) # S^2 is the union of U and V 

sage: xy_to_uv = c_xy.transition_map(c_uv, (x/(x^2+y^2), y/(x^2+y^2)), 

....: intersection_name='W', restrictions1= x^2+y^2!=0, 

....: restrictions2= u^2+v^2!=0) 

sage: from sage.manifolds.differentiable.vectorfield_module import VectorFieldModule 

sage: XM = VectorFieldModule(M, dest_map=M.identity_map()); XM 

Module X(M) of vector fields on the 2-dimensional differentiable 

manifold M 

sage: XM is M.vector_field_module() 

True 

sage: TestSuite(XM).run(skip='_test_elements') 

 

In the above test suite, _test_elements is skipped because of the 

_test_pickling error of the elements (to be fixed in class 

TensorField) 

 

""" 

self._domain = domain 

name = "X(" + domain._name 

latex_name = r"\mathfrak{X}\left(" + domain._latex_name 

if dest_map is None: 

dest_map = domain.identity_map() 

self._dest_map = dest_map 

if dest_map is not domain.identity_map(): 

dm_name = dest_map._name 

dm_latex_name = dest_map._latex_name 

if dm_name is None: 

dm_name = "unnamed map" 

if dm_latex_name is None: 

dm_latex_name = r"\mathrm{unnamed\; map}" 

name += "," + dm_name 

latex_name += "," + dm_latex_name 

self._name = name + ")" 

self._latex_name = latex_name + r"\right)" 

self._ambient_domain = self._dest_map._codomain 

# The member self._ring is created for efficiency (to avoid 

# calls to self.base_ring()): 

self._ring = domain.scalar_field_algebra() 

Parent.__init__(self, base=self._ring, 

category=Modules(self._ring)) 

# Dictionary of the tensor modules built on self 

# (keys = (k,l) --the tensor type) 

# This dictionary is to be extended on need by the method tensor_module 

self._tensor_modules = {(1,0): self} # self is considered as the set 

# of tensors of type (1,0) 

# Dictionaries of exterior powers of self and of its dual 

# (keys = p --the power degree) 

# These dictionaries are to be extended on need by the methods 

# exterior_power and dual_exterior_power 

self._exterior_powers = {1: self} 

self._dual_exterior_powers = {} 

 

#### Parent methods 

 

def _element_constructor_(self, comp=[], frame=None, name=None, 

latex_name=None): 

r""" 

Construct an element of the module 

 

TESTS:: 

 

sage: M = Manifold(2, 'M') 

sage: U = M.open_subset('U'); V = M.open_subset('V') 

sage: c_xy.<x,y> = U.chart(); c_uv.<u,v> = V.chart() 

sage: M.declare_union(U,V) 

sage: XM = M.vector_field_module() 

sage: v = XM([-x,y], frame=c_xy.frame(), name='v'); v 

Vector field v on the 2-dimensional differentiable manifold M 

sage: v.display() 

v = -x d/dx + y d/dy 

sage: XM(0) is XM.zero() 

True 

 

""" 

if isinstance(comp, (int, Integer)) and comp == 0: 

return self.zero() 

if isinstance(comp, VectorField): 

if (self._domain.is_subset(comp._domain) 

and self._ambient_domain.is_subset(comp._ambient_domain)): 

return comp.restrict(self._domain) 

else: 

raise ValueError("cannot convert the {} ".format(comp) + 

"to a vector field in {}".format(self)) 

resu = self.element_class(self, name=name, latex_name=latex_name) 

if comp != []: 

resu.set_comp(frame)[:] = comp 

return resu 

 

def _an_element_(self): 

r""" 

Construct some (unnamed) element of the module. 

 

TESTS:: 

 

sage: M = Manifold(2, 'M') 

sage: U = M.open_subset('U'); V = M.open_subset('V') 

sage: c_xy.<x,y> = U.chart(); c_uv.<u,v> = V.chart() 

sage: M.declare_union(U,V) 

sage: XM = M.vector_field_module() 

sage: XM._an_element_() 

Vector field on the 2-dimensional differentiable manifold M 

 

""" 

resu = self.element_class(self) 

# Non-trivial open covers of the domain: 

open_covers = self._domain.open_covers()[1:] # the open cover 0 

# is trivial 

if open_covers != []: 

oc = open_covers[0] # the first non-trivial open cover is selected 

for dom in oc: 

vmodule_dom = dom.vector_field_module( 

dest_map=self._dest_map.restrict(dom)) 

resu.set_restriction(vmodule_dom._an_element_()) 

return resu 

 

def _coerce_map_from_(self, other): 

r""" 

Determine whether coercion to self exists from other parent. 

 

TESTS:: 

 

sage: M = Manifold(2, 'M') 

sage: U = M.open_subset('U') 

sage: XM = M.vector_field_module() 

sage: XU = U.vector_field_module() 

sage: XM._coerce_map_from_(XU) 

False 

sage: XU._coerce_map_from_(XM) 

True 

 

""" 

if isinstance(other, (VectorFieldModule, VectorFieldFreeModule)): 

return self._domain.is_subset(other._domain) and \ 

self._ambient_domain.is_subset(other._ambient_domain) 

else: 

return False 

 

#### End of parent methods 

 

def _repr_(self): 

r""" 

String representation of the object. 

 

TESTS:: 

 

sage: M = Manifold(2, 'M') 

sage: XM = M.vector_field_module() 

sage: XM._repr_() 

'Module X(M) of vector fields on the 2-dimensional differentiable manifold M' 

sage: repr(XM) # indirect doctest 

'Module X(M) of vector fields on the 2-dimensional differentiable manifold M' 

sage: XM # indirect doctest 

Module X(M) of vector fields on the 2-dimensional differentiable 

manifold M 

 

""" 

description = "Module " 

if self._name is not None: 

description += self._name + " " 

description += "of vector fields " 

if self._dest_map is self._domain.identity_map(): 

description += "on the {}".format(self._domain) 

else: 

description += ("along the {}".format(self._domain) 

+ " mapped into the {}".format(self._ambient_domain)) 

return description 

 

def _latex_(self): 

r""" 

LaTeX representation of the object. 

 

TESTS:: 

 

sage: M = Manifold(2, 'M') 

sage: XM = M.vector_field_module() 

sage: XM._latex_() 

'\\mathfrak{X}\\left(M\\right)' 

sage: latex(XM) # indirect doctest 

\mathfrak{X}\left(M\right) 

 

""" 

if self._latex_name is None: 

return r'\mbox{' + str(self) + r'}' 

else: 

return self._latex_name 

 

def domain(self): 

r""" 

Return the domain of the vector fields in this module. 

 

If the module is `\mathfrak{X}(U,\Phi)`, returns the domain `U` of 

`\Phi`. 

 

OUTPUT: 

 

- instance of 

:class:`~sage.manifolds.differentiable.manifold.DifferentiableManifold` 

representing the domain of the vector fields that belong to this 

module 

 

EXAMPLES:: 

 

sage: M = Manifold(5, 'M') 

sage: XM = M.vector_field_module() 

sage: XM.domain() 

5-dimensional differentiable manifold M 

sage: U = Manifold(2, 'U') 

sage: Phi = U.diff_map(M, name='Phi') 

sage: XU = U.vector_field_module(dest_map=Phi) 

sage: XU.domain() 

2-dimensional differentiable manifold U 

 

""" 

return self._domain 

 

def ambient_domain(self): 

r""" 

Return the manifold in which the vector fields of this module take 

their values. 

 

If the module is `\mathfrak{X}(U,\Phi)`, returns the codomain `M` of 

`\Phi`. 

 

OUTPUT: 

 

- instance of 

:class:`~sage.manifolds.differentiable.manifold.DifferentiableManifold` 

representing the manifold in which the vector fields of this 

module take their values 

 

EXAMPLES:: 

 

sage: M = Manifold(5, 'M') 

sage: XM = M.vector_field_module() 

sage: XM.ambient_domain() 

5-dimensional differentiable manifold M 

sage: U = Manifold(2, 'U') 

sage: Phi = U.diff_map(M, name='Phi') 

sage: XU = U.vector_field_module(dest_map=Phi) 

sage: XU.ambient_domain() 

5-dimensional differentiable manifold M 

 

""" 

return self._ambient_domain 

 

def destination_map(self): 

r""" 

Return the differential map associated to this module. 

 

The differential map associated to this module is the map 

 

.. MATH:: 

 

\Phi:\ U \longrightarrow M 

 

such that this module is the set `\mathfrak{X}(U,\Phi)` of all 

vector fields of the type 

 

.. MATH:: 

 

v:\ U \longrightarrow TM 

 

(where `TM` is the tangent bundle of `M`) such that 

 

.. MATH:: 

 

\forall p \in U,\ v(p) \in T_{\Phi(p)}M, 

 

where `T_{\Phi(p)}M` is the tangent space to `M` at the 

point `\Phi(p)`. 

 

OUTPUT: 

 

- instance of 

:class:`~sage.manifolds.differentiable.diff_map.DiffMap` 

representing the differential map `\Phi` 

 

EXAMPLES:: 

 

sage: M = Manifold(5, 'M') 

sage: XM = M.vector_field_module() 

sage: XM.destination_map() 

Identity map Id_M of the 5-dimensional differentiable manifold M 

sage: U = Manifold(2, 'U') 

sage: Phi = U.diff_map(M, name='Phi') 

sage: XU = U.vector_field_module(dest_map=Phi) 

sage: XU.destination_map() 

Differentiable map Phi from the 2-dimensional differentiable 

manifold U to the 5-dimensional differentiable manifold M 

 

""" 

return self._dest_map 

 

def tensor_module(self, k, l): 

r""" 

Return the module of type-`(k,l)` tensors on ``self``. 

 

INPUT: 

 

- ``k`` -- non-negative integer; the contravariant rank, 

the tensor type being `(k,l)` 

- ``l`` -- non-negative integer; the covariant rank, 

the tensor type being `(k,l)` 

 

OUTPUT: 

 

- instance of 

:class:`~sage.manifolds.differentiable.tensorfield_module.TensorFieldModule` 

representing the module `T^{(k,l)}(U,\Phi)` of type-`(k,l)` 

tensors on the vector field module 

 

EXAMPLES: 

 

A tensor field module on a 2-dimensional differentiable manifold:: 

 

sage: M = Manifold(2, 'M') 

sage: XM = M.vector_field_module() 

sage: XM.tensor_module(1,2) 

Module T^(1,2)(M) of type-(1,2) tensors fields on the 2-dimensional 

differentiable manifold M 

 

The special case of tensor fields of type (1,0):: 

 

sage: XM.tensor_module(1,0) 

Module X(M) of vector fields on the 2-dimensional differentiable 

manifold M 

 

The result is cached:: 

 

sage: XM.tensor_module(1,2) is XM.tensor_module(1,2) 

True 

sage: XM.tensor_module(1,0) is XM 

True 

 

See 

:class:`~sage.manifolds.differentiable.tensorfield_module.TensorFieldModule` 

for more examples and documentation. 

 

""" 

from sage.manifolds.differentiable.tensorfield_module import \ 

TensorFieldModule 

if (k,l) not in self._tensor_modules: 

self._tensor_modules[(k,l)] = TensorFieldModule(self, (k,l)) 

return self._tensor_modules[(k,l)] 

 

def exterior_power(self, p): 

r""" 

Return the `p`-th exterior power of ``self``. 

 

If the vector field module ``self`` is `\mathfrak{X}(U,\Phi)`, 

its `p`-th exterior power is the set `A^p(U, \Phi)` of 

`p`-vector fields along `U` with values on `\Phi(U)`. It is a 

module over `C^k(U)`, the ring (algebra) of differentiable 

scalar fields on `U`. 

 

INPUT: 

 

- ``p`` -- non-negative integer 

 

OUTPUT: 

 

- for `p=0`, the base ring, i.e. `C^k(U)` 

- for `p=1`, the vector field module ``self``, since 

`A^1(U, \Phi) = \mathfrak{X}(U,\Phi)` 

- for `p \geq 2`, instance of 

:class:`~sage.manifolds.differentiable.multivector_module.MultivectorModule` 

representing the module `A^p(U,\Phi)` 

 

EXAMPLES:: 

 

sage: M = Manifold(2, 'M') 

sage: XM = M.vector_field_module() 

sage: XM.exterior_power(2) 

Module A^2(M) of 2-vector fields on the 2-dimensional 

differentiable manifold M 

sage: XM.exterior_power(1) 

Module X(M) of vector fields on the 2-dimensional 

differentiable manifold M 

sage: XM.exterior_power(1) is XM 

True 

sage: XM.exterior_power(0) 

Algebra of differentiable scalar fields on the 2-dimensional 

differentiable manifold M 

sage: XM.exterior_power(0) is M.scalar_field_algebra() 

True 

 

.. SEEALSO:: 

 

:class:`~sage.manifolds.differentiable.multivector_module.MultivectorModule` 

for more examples and documentation. 

 

""" 

from sage.manifolds.differentiable.multivector_module import \ 

MultivectorModule 

if p == 0: 

return self._ring 

if p not in self._exterior_powers: 

self._exterior_powers[p] = MultivectorModule(self, p) 

return self._exterior_powers[p] 

 

def dual_exterior_power(self, p): 

r""" 

Return the `p`-th exterior power of the dual of the vector field 

module. 

 

If the vector field module is `\mathfrak{X}(U,\Phi)`, the 

`p`-th exterior power of its dual is the set `\Omega^p(U, \Phi)` 

of `p`-forms along `U` with values on `\Phi(U)`. It is a module 

over `C^k(U)`, the ring (algebra) of differentiable scalar 

fields on `U`. 

 

INPUT: 

 

- ``p`` -- non-negative integer 

 

OUTPUT: 

 

- for `p=0`, the base ring, i.e. `C^k(U)` 

- for `p \geq 1`, instance of 

:class:`~sage.manifolds.differentiable.diff_form_module.DiffFormModule` 

representing the module `\Omega^p(U,\Phi)` 

 

EXAMPLES:: 

 

sage: M = Manifold(2, 'M') 

sage: XM = M.vector_field_module() 

sage: XM.dual_exterior_power(2) 

Module Omega^2(M) of 2-forms on the 2-dimensional differentiable 

manifold M 

sage: XM.dual_exterior_power(1) 

Module Omega^1(M) of 1-forms on the 2-dimensional differentiable 

manifold M 

sage: XM.dual_exterior_power(1) is XM.dual() 

True 

sage: XM.dual_exterior_power(0) 

Algebra of differentiable scalar fields on the 2-dimensional 

differentiable manifold M 

sage: XM.dual_exterior_power(0) is M.scalar_field_algebra() 

True 

 

.. SEEALSO:: 

 

:class:`~sage.manifolds.differentiable.diff_form_module.DiffFormModule` 

for more examples and documentation. 

 

""" 

from sage.manifolds.differentiable.diff_form_module import \ 

DiffFormModule 

if p == 0: 

return self._ring 

if p not in self._dual_exterior_powers: 

self._dual_exterior_powers[p] = DiffFormModule(self, p) 

return self._dual_exterior_powers[p] 

 

def dual(self): 

r""" 

Return the dual module. 

 

EXAMPLES:: 

 

sage: M = Manifold(2, 'M') 

sage: XM = M.vector_field_module() 

sage: XM.dual() 

Module Omega^1(M) of 1-forms on the 2-dimensional differentiable 

manifold M 

 

""" 

return self.dual_exterior_power(1) 

 

def general_linear_group(self): 

r""" 

Return the general linear group of ``self``. 

 

If the vector field module is `\mathfrak{X}(U,\Phi)`, the *general 

linear group* is the group `\mathrm{GL}(\mathfrak{X}(U,\Phi))` of 

automorphisms of `\mathfrak{X}(U, \Phi)`. Note that an automorphism 

of `\mathfrak{X}(U,\Phi)` can also be viewed as a *field* along `U` 

of automorphisms of the tangent spaces of `M \supset \Phi(U)`. 

 

OUTPUT: 

 

- instance of class 

:class:`~sage.manifolds.differentiable.automorphismfield_group.AutomorphismFieldGroup` 

representing `\mathrm{GL}(\mathfrak{X}(U,\Phi))` 

 

EXAMPLES:: 

 

sage: M = Manifold(2, 'M') 

sage: XM = M.vector_field_module() 

sage: XM.general_linear_group() 

General linear group of the Module X(M) of vector fields on the 

2-dimensional differentiable manifold M 

 

.. SEEALSO:: 

 

:class:`~sage.manifolds.differentiable.automorphismfield_group.AutomorphismFieldGroup` 

for more examples and documentation. 

 

""" 

from sage.manifolds.differentiable.automorphismfield_group import \ 

AutomorphismFieldGroup 

return AutomorphismFieldGroup(self) 

 

def tensor(self, tensor_type, name=None, latex_name=None, sym=None, 

antisym=None, specific_type=None): 

r""" 

Construct a tensor on ``self``. 

 

The tensor is actually a tensor field on the domain of 

the vector field module. 

 

INPUT: 

 

- ``tensor_type`` -- pair (k,l) with k being the contravariant rank 

and l the covariant rank 

- ``name`` -- (string; default: ``None``) name given to the tensor 

- ``latex_name`` -- (string; default: ``None``) LaTeX symbol to denote 

the tensor; if none is provided, the LaTeX symbol is set to ``name`` 

- ``sym`` -- (default: ``None``) a symmetry or a list of symmetries 

among the tensor arguments: each symmetry is described by a tuple 

containing the positions of the involved arguments, with the 

convention position=0 for the first argument; for instance: 

 

* ``sym=(0,1)`` for a symmetry between the 1st and 2nd arguments 

* ``sym=[(0,2),(1,3,4)]`` for a symmetry between the 1st and 3rd 

arguments and a symmetry between the 2nd, 4th and 5th arguments 

 

- ``antisym`` -- (default: ``None``) antisymmetry or list of 

antisymmetries among the arguments, with the same convention 

as for ``sym`` 

- ``specific_type`` -- (default: ``None``) specific subclass of 

:class:`~sage.manifolds.differentiable.tensorfield.TensorField` for 

the output 

 

OUTPUT: 

 

- instance of 

:class:`~sage.manifolds.differentiable.tensorfield.TensorField` 

representing the tensor defined on the vector field module with the 

provided characteristics 

 

EXAMPLES:: 

 

sage: M = Manifold(2, 'M') 

sage: XM = M.vector_field_module() 

sage: XM.tensor((1,2), name='t') 

Tensor field t of type (1,2) on the 2-dimensional differentiable 

manifold M 

sage: XM.tensor((1,0), name='a') 

Vector field a on the 2-dimensional differentiable manifold M 

sage: XM.tensor((0,2), name='a', antisym=(0,1)) 

2-form a on the 2-dimensional differentiable manifold M 

 

.. SEEALSO:: 

 

:class:`~sage.manifolds.differentiable.tensorfield.TensorField` 

for more examples and documentation. 

 

""" 

from sage.manifolds.differentiable.automorphismfield import \ 

AutomorphismField 

from sage.manifolds.differentiable.metric import \ 

PseudoRiemannianMetric 

if tensor_type==(1,0): 

return self.element_class(self, name=name, 

latex_name=latex_name) 

elif tensor_type == (0,1): 

return self.linear_form(name=name, latex_name=latex_name) 

elif tensor_type == (1,1) and specific_type is not None: 

if issubclass(specific_type, AutomorphismField): 

return self.automorphism(name=name, 

latex_name=latex_name) 

elif tensor_type[0] == 0 and tensor_type[1] > 1 and antisym: 

if isinstance(antisym[0], (int, Integer)): 

# a single antisymmetry is provided as a tuple or a 

# range object; it is converted to a 1-item list: 

antisym = [tuple(antisym)] 

if isinstance(antisym, list): 

antisym0 = antisym[0] 

else: 

antisym0 = antisym 

if len(antisym0) == tensor_type[1]: 

return self.alternating_form(tensor_type[1], name=name, 

latex_name=latex_name) 

elif tensor_type[0] > 1 and tensor_type[1] == 0 and antisym: 

if isinstance(antisym[0], (int, Integer)): 

# a single antisymmetry is provided as a tuple or a 

# range object; it is converted to a 1-item list: 

antisym = [tuple(antisym)] 

if isinstance(antisym, list): 

antisym0 = antisym[0] 

else: 

antisym0 = antisym 

if len(antisym0) == tensor_type[0]: 

return self.alternating_contravariant_tensor( 

tensor_type[0], name=name, 

latex_name=latex_name) 

elif tensor_type==(0,2) and specific_type is not None: 

if issubclass(specific_type, PseudoRiemannianMetric): 

return self.metric(name, latex_name=latex_name) 

# NB: the signature is not treated 

# Generic case 

return self.tensor_module(*tensor_type).element_class(self, 

tensor_type, name=name, latex_name=latex_name, 

sym=sym, antisym=antisym) 

 

def alternating_contravariant_tensor(self, degree, name=None, 

latex_name=None): 

r""" 

Construct an alternating contravariant tensor on the vector 

field module ``self``. 

 

An alternating contravariant tensor on ``self`` is actually a 

multivector field along the differentiable manifold `U` over 

which ``self`` is defined. 

 

INPUT: 

 

- ``degree`` -- degree of the alternating contravariant tensor 

(i.e. its tensor rank) 

- ``name`` -- (default: ``None``) string; name given to the 

alternating contravariant tensor 

- ``latex_name`` -- (default: ``None``) string; LaTeX symbol to 

denote the alternating contravariant tensor; if none is 

provided, the LaTeX symbol is set to ``name`` 

 

OUTPUT: 

 

- instance of 

:class:`~sage.manifolds.differentiable.multivectorfield.MultivectorField` 

 

EXAMPLES:: 

 

sage: M = Manifold(2, 'M') 

sage: XM = M.vector_field_module() 

sage: XM.alternating_contravariant_tensor(2, name='a') 

2-vector field a on the 2-dimensional differentiable 

manifold M 

 

An alternating contravariant tensor of degree 1 is simply 

a vector field:: 

 

sage: XM.alternating_contravariant_tensor(1, name='a') 

Vector field a on the 2-dimensional differentiable 

manifold M 

 

.. SEEALSO:: 

 

:class:`~sage.manifolds.differentiable.multivectorfield.MultivectorField` 

for more examples and documentation. 

 

""" 

if degree == 0: 

return self._domain.scalar_field(name=name, latex_name=latex_name) 

if degree == 1: 

return self.element_class(self, name=name, 

latex_name=latex_name) 

return self.exterior_power(degree).element_class(self, degree, 

name=name, latex_name=latex_name) 

 

def alternating_form(self, degree, name=None, latex_name=None): 

r""" 

Construct an alternating form on the vector field module 

``self``. 

 

An alternating form on ``self`` is actually a differential form 

along the differentiable manifold `U` over which ``self`` is 

defined. 

 

INPUT: 

 

- ``degree`` -- the degree of the alternating form 

(i.e. its tensor rank) 

- ``name`` -- (string; optional) name given to the alternating 

form 

- ``latex_name`` -- (string; optional) LaTeX symbol to denote 

the alternating form; if none is provided, the LaTeX symbol is 

set to ``name`` 

 

OUTPUT: 

 

- instance of 

:class:`~sage.manifolds.differentiable.diff_form.DiffForm` 

 

EXAMPLES:: 

 

sage: M = Manifold(2, 'M') 

sage: XM = M.vector_field_module() 

sage: XM.alternating_form(2, name='a') 

2-form a on the 2-dimensional differentiable manifold M 

sage: XM.alternating_form(1, name='a') 

1-form a on the 2-dimensional differentiable manifold M 

 

.. SEEALSO:: 

 

:class:`~sage.manifolds.differentiable.diff_form.DiffForm` 

for more examples and documentation. 

 

""" 

if degree == 0: 

return self._domain.scalar_field(name=name, latex_name=latex_name) 

return self.dual_exterior_power(degree).element_class(self, 

degree, name=name, latex_name=latex_name) 

 

def linear_form(self, name=None, latex_name=None): 

r""" 

Construct a linear form on the vector field module. 

 

A linear form on the vector field module is actually a field 

of linear forms (i.e. a 1-form) along the differentiable 

manifold `U` over which the vector field module is defined. 

 

INPUT: 

 

- ``name`` -- (string; optional) name given to the linear form 

- ``latex_name`` -- (string; optional) LaTeX symbol to denote 

the linear form; if none is provided, the LaTeX symbol is 

set to ``name`` 

 

OUTPUT: 

 

- instance of 

:class:`~sage.manifolds.differentiable.diff_form.DiffForm` 

 

EXAMPLES:: 

 

sage: M = Manifold(2, 'M') 

sage: XM = M.vector_field_module() 

sage: XM.linear_form() 

1-form on the 2-dimensional differentiable manifold M 

sage: XM.linear_form(name='a') 

1-form a on the 2-dimensional differentiable manifold M 

 

.. SEEALSO:: 

 

:class:`~sage.manifolds.differentiable.diff_form.DiffForm` 

for more examples and documentation. 

 

""" 

return self.dual_exterior_power(1).element_class(self, 1, 

name=name, latex_name=latex_name) 

 

def automorphism(self, name=None, latex_name=None): 

r""" 

Construct an automorphism of the vector field module. 

 

An automorphism of the vector field module is actually a field 

of tangent-space automorphisms along the differentiable manifold 

`U` over which the vector field module is defined. 

 

INPUT: 

 

- ``name`` -- (string; optional) name given to the automorphism 

- ``latex_name`` -- (string; optional) LaTeX symbol to denote 

the automorphism; if none is provided, the LaTeX symbol is 

set to ``name`` 

 

OUTPUT: 

 

- instance of 

:class:`~sage.manifolds.differentiable.automorphismfield.AutomorphismField` 

 

EXAMPLES:: 

 

sage: M = Manifold(2, 'M') 

sage: XM = M.vector_field_module() 

sage: XM.automorphism() 

Field of tangent-space automorphisms on the 2-dimensional 

differentiable manifold M 

sage: XM.automorphism(name='a') 

Field of tangent-space automorphisms a on the 2-dimensional 

differentiable manifold M 

 

.. SEEALSO:: 

 

:class:`~sage.manifolds.differentiable.automorphismfield.AutomorphismField` 

for more examples and documentation. 

 

""" 

return self.general_linear_group().element_class(self, 

name=name, latex_name=latex_name) 

 

@cached_method 

def identity_map(self, name='Id', latex_name=None): 

r""" 

Construct the identity map on the vector field module. 

 

The identity map on the vector field module is actually a field 

of tangent-space identity maps along the differentiable manifold 

`U` over which the vector field module is defined. 

 

INPUT: 

 

- ``name`` -- (string; default: ``'Id'``) name given to the 

identity map 

- ``latex_name`` -- (string; optional) LaTeX symbol to denote 

the identity map; if none is provided, the LaTeX symbol is 

set to ``'\mathrm{Id}'`` if ``name`` is ``'Id'`` and 

to ``name`` otherwise 

 

OUTPUT: 

 

- instance of 

:class:`~sage.manifolds.differentiable.automorphismfield.AutomorphismField` 

 

EXAMPLES:: 

 

sage: M = Manifold(2, 'M') 

sage: XM = M.vector_field_module() 

sage: XM.identity_map() 

Field of tangent-space identity maps on the 2-dimensional 

differentiable manifold M 

 

""" 

resu = self.general_linear_group().one() 

if latex_name is None: 

latex_name = name 

resu.set_name(name=name, latex_name=latex_name) 

return resu 

 

@cached_method 

def zero(self): 

""" 

Return the zero of ``self``. 

 

EXAMPLES:: 

 

sage: M = Manifold(2, 'M') 

sage: X.<x,y> = M.chart() # makes M parallelizable 

sage: XM = M.vector_field_module() 

sage: XM.zero() 

Vector field zero on the 2-dimensional differentiable 

manifold M 

""" 

elt = self.element_class(self, name='zero', latex_name='0') 

for frame in self._domain._frames: 

if self._dest_map.restrict(frame._domain) == frame._dest_map: 

elt.add_comp(frame) 

# (since new components are initialized to zero) 

return elt 

 

def metric(self, name, signature=None, latex_name=None): 

r""" 

Construct a pseudo-Riemannian metric (nondegenerate symmetric bilinear 

form) on the current vector field module. 

 

A pseudo-Riemannian metric of the vector field module is actually a 

field of tangent-space non-degenerate symmetric bilinear forms along 

the manifold `U` on which the vector field module is defined. 

 

INPUT: 

 

- ``name`` -- (string) name given to the metric 

- ``signature`` -- (integer; default: ``None``) signature `S` of the 

metric: `S = n_+ - n_-`, where `n_+` (resp. `n_-`) is the number of 

positive terms (resp. number of negative terms) in any diagonal 

writing of the metric components; if ``signature`` is not provided, 

`S` is set to the manifold's dimension (Riemannian signature) 

- ``latex_name`` -- (string; default: ``None``) LaTeX symbol to denote 

the metric; if ``None``, it is formed from ``name`` 

 

OUTPUT: 

 

- instance of 

:class:`~sage.manifolds.differentiable.metric.PseudoRiemannianMetric` 

representing the defined pseudo-Riemannian metric. 

 

EXAMPLES:: 

 

sage: M = Manifold(2, 'M') 

sage: XM = M.vector_field_module() 

sage: XM.metric('g') 

Riemannian metric g on the 2-dimensional differentiable manifold M 

sage: XM.metric('g', signature=0) 

Lorentzian metric g on the 2-dimensional differentiable manifold M 

 

.. SEEALSO:: 

 

:class:`~sage.manifolds.differentiable.metric.PseudoRiemannianMetric` 

for more documentation. 

 

""" 

from sage.manifolds.differentiable.metric import PseudoRiemannianMetric 

return PseudoRiemannianMetric(self, name, signature=signature, 

latex_name=latex_name) 

 

 

#****************************************************************************** 

 

class VectorFieldFreeModule(FiniteRankFreeModule): 

r""" 

Free module of vector fields along a differentiable manifold `U` with 

values on a parallelizable manifold `M`, via a differentiable map 

`U \rightarrow M`. 

 

Given a differentiable map 

 

.. MATH:: 

 

\Phi:\ U \longrightarrow M 

 

the *vector field module* `\mathfrak{X}(U,\Phi)` is the set of all vector 

fields of the type 

 

.. MATH:: 

 

v:\ U \longrightarrow TM 

 

(where `TM` is the tangent bundle of `M`) such that 

 

.. MATH:: 

 

\forall p \in U,\ v(p) \in T_{\Phi(p)} M, 

 

where `T_{\Phi(p)} M` is the tangent space to `M` at the point `\Phi(p)`. 

 

Since `M` is parallelizable, the set `\mathfrak{X}(U,\Phi)` is a 

free module over `C^k(U)`, the ring (algebra) of differentiable 

scalar fields on `U` (see 

:class:`~sage.manifolds.differentiable.scalarfield_algebra.DiffScalarFieldAlgebra`). 

In fact, it carries the structure of a finite-dimensional Lie algebroid 

(cf. :wikipedia:`Lie_algebroid`). 

 

The standard case of vector fields *on* a differentiable manifold 

corresponds to `U=M` and `\Phi = \mathrm{Id}_M`; we then denote 

`\mathfrak{X}(M,\mathrm{Id}_M)` by merely `\mathfrak{X}(M)`. Other common 

cases are `\Phi` being an immersion and `\Phi` being a curve in `M` (`U` is 

then an open interval of `\RR`). 

 

.. NOTE:: 

 

If `M` is not parallelizable, the class :class:`VectorFieldModule` 

should be used instead, for `\mathfrak{X}(U,\Phi)` is no longer a 

free module. 

 

INPUT: 

 

- ``domain`` -- differentiable manifold `U` along which the vector fields 

are defined 

- ``dest_map`` -- (default: ``None``) destination map 

`\Phi:\ U \rightarrow M` 

(type: :class:`~sage.manifolds.differentiable.diff_map.DiffMap`); if 

``None``, it is assumed that `U=M` and `\Phi` is the identity map of 

`M` (case of vector fields *on* `M`) 

 

EXAMPLES: 

 

Module of vector fields on `\RR^2`:: 

 

sage: M = Manifold(2, 'R^2') 

sage: cart.<x,y> = M.chart() # Cartesian coordinates on R^2 

sage: XM = M.vector_field_module() ; XM 

Free module X(R^2) of vector fields on the 2-dimensional differentiable 

manifold R^2 

sage: XM.category() 

Category of finite dimensional modules 

over Algebra of differentiable scalar fields 

on the 2-dimensional differentiable manifold R^2 

sage: XM.base_ring() is M.scalar_field_algebra() 

True 

 

Since `\RR^2` is obviously parallelizable, ``XM`` is a free module:: 

 

sage: isinstance(XM, FiniteRankFreeModule) 

True 

 

Some elements:: 

 

sage: XM.an_element().display() 

2 d/dx + 2 d/dy 

sage: XM.zero().display() 

zero = 0 

sage: v = XM([-y,x]) ; v 

Vector field on the 2-dimensional differentiable manifold R^2 

sage: v.display() 

-y d/dx + x d/dy 

 

An example of module of vector fields with a destination map `\Phi` 

different from the identity map, namely a mapping 

`\Phi: I \rightarrow \RR^2`, where `I` is an open interval of `\RR`:: 

 

sage: I = Manifold(1, 'I') 

sage: canon.<t> = I.chart('t:(0,2*pi)') 

sage: Phi = I.diff_map(M, coord_functions=[cos(t), sin(t)], name='Phi', 

....: latex_name=r'\Phi') ; Phi 

Differentiable map Phi from the 1-dimensional differentiable manifold 

I to the 2-dimensional differentiable manifold R^2 

sage: Phi.display() 

Phi: I --> R^2 

t |--> (x, y) = (cos(t), sin(t)) 

sage: XIM = I.vector_field_module(dest_map=Phi) ; XIM 

Free module X(I,Phi) of vector fields along the 1-dimensional 

differentiable manifold I mapped into the 2-dimensional differentiable 

manifold R^2 

sage: XIM.category() 

Category of finite dimensional modules 

over Algebra of differentiable scalar fields 

on the 1-dimensional differentiable manifold I 

 

The rank of the free module `\mathfrak{X}(I,\Phi)` is the dimension 

of the manifold `\RR^2`, namely two:: 

 

sage: XIM.rank() 

2 

 

A basis of it is induced by the coordinate vector frame of `\RR^2`:: 

 

sage: XIM.bases() 

[Vector frame (I, (d/dx,d/dy)) with values on the 2-dimensional 

differentiable manifold R^2] 

 

Some elements of this module:: 

 

sage: XIM.an_element().display() 

2 d/dx + 2 d/dy 

sage: v = XIM([t, t^2]) ; v 

Vector field along the 1-dimensional differentiable manifold I with 

values on the 2-dimensional differentiable manifold R^2 

sage: v.display() 

t d/dx + t^2 d/dy 

 

The test suite is passed:: 

 

sage: TestSuite(XIM).run() 

 

Let us now consider the module of vector fields on the circle `S^1`; we 

start by constructing the `S^1` manifold:: 

 

sage: M = Manifold(1, 'S^1') 

sage: U = M.open_subset('U') # the complement of one point 

sage: c_t.<t> = U.chart('t:(0,2*pi)') # the standard angle coordinate 

sage: V = M.open_subset('V') # the complement of the point t=pi 

sage: M.declare_union(U,V) # S^1 is the union of U and V 

sage: c_u.<u> = V.chart('u:(0,2*pi)') # the angle t-pi 

sage: t_to_u = c_t.transition_map(c_u, (t-pi,), intersection_name='W', 

....: restrictions1 = t!=pi, restrictions2 = u!=pi) 

sage: u_to_t = t_to_u.inverse() 

sage: W = U.intersection(V) 

 

`S^1` cannot be covered by a single chart, so it cannot be covered by 

a coordinate frame. It is however parallelizable and we introduce a global 

vector frame as follows. We notice that on their common subdomain, `W`, 

the coordinate vectors `\partial/\partial t` and `\partial/\partial u` 

coincide, as we can check explicitly:: 

 

sage: c_t.frame()[0].display(c_u.frame().restrict(W)) 

d/dt = d/du 

 

Therefore, we can extend `\partial/\partial t` to all `V` and hence to all 

`S^1`, to form a vector field on `S^1` whose components w.r.t. both 

`\partial/\partial t` and `\partial/\partial u` are 1:: 

 

sage: e = M.vector_frame('e') 

sage: U.set_change_of_frame(e.restrict(U), c_t.frame(), 

....: U.tangent_identity_field()) 

sage: V.set_change_of_frame(e.restrict(V), c_u.frame(), 

....: V.tangent_identity_field()) 

sage: e[0].display(c_t.frame()) 

e_0 = d/dt 

sage: e[0].display(c_u.frame()) 

e_0 = d/du 

 

Equipped with the frame `e`, the manifold `S^1` is manifestly 

parallelizable:: 

 

sage: M.is_manifestly_parallelizable() 

True 

 

Consequently, the module of vector fields on `S^1` is a free module:: 

 

sage: XM = M.vector_field_module() ; XM 

Free module X(S^1) of vector fields on the 1-dimensional differentiable 

manifold S^1 

sage: isinstance(XM, FiniteRankFreeModule) 

True 

sage: XM.category() 

Category of finite dimensional modules 

over Algebra of differentiable scalar fields 

on the 1-dimensional differentiable manifold S^1 

sage: XM.base_ring() is M.scalar_field_algebra() 

True 

 

The zero element:: 

 

sage: z = XM.zero() ; z 

Vector field zero on the 1-dimensional differentiable manifold S^1 

sage: z.display() 

zero = 0 

sage: z.display(c_t.frame()) 

zero = 0 

 

The module `\mathfrak{X}(S^1)` coerces to any module of vector fields 

defined on a subdomain of `S^1`, for instance `\mathfrak{X}(U)`:: 

 

sage: XU = U.vector_field_module() ; XU 

Free module X(U) of vector fields on the Open subset U of the 

1-dimensional differentiable manifold S^1 

sage: XU.has_coerce_map_from(XM) 

True 

sage: XU.coerce_map_from(XM) 

Coercion map: 

From: Free module X(S^1) of vector fields on the 1-dimensional 

differentiable manifold S^1 

To: Free module X(U) of vector fields on the Open subset U of the 

1-dimensional differentiable manifold S^1 

 

The conversion map is actually the restriction of vector fields defined 

on `S^1` to `U`. 

 

The Sage test suite for modules is passed:: 

 

sage: TestSuite(XM).run() 

 

""" 

 

Element = VectorFieldParal 

 

def __init__(self, domain, dest_map=None): 

r""" 

Construct the free module of vector fields with values on a 

parallelizable manifold. 

 

TESTS:: 

 

sage: M = Manifold(2, 'M') 

sage: X.<x,y> = M.chart() # makes M parallelizable 

sage: from sage.manifolds.differentiable.vectorfield_module \ 

....: import VectorFieldFreeModule 

sage: XM = VectorFieldFreeModule(M, dest_map=M.identity_map()); XM 

Free module X(M) of vector fields on the 2-dimensional 

differentiable manifold M 

sage: XM is M.vector_field_module() 

True 

sage: TestSuite(XM).run() 

 

""" 

from sage.manifolds.differentiable.scalarfield import DiffScalarField 

self._domain = domain 

if dest_map is None: 

dest_map = domain.identity_map() 

self._dest_map = dest_map 

self._ambient_domain = self._dest_map._codomain 

name = "X(" + domain._name 

latex_name = r"\mathfrak{X}\left(" + domain._latex_name 

if dest_map is not domain.identity_map(): 

dm_name = dest_map._name 

dm_latex_name = dest_map._latex_name 

if dm_name is None: 

dm_name = "unnamed map" 

if dm_latex_name is None: 

dm_latex_name = r"\mathrm{unnamed\; map}" 

name += "," + dm_name 

latex_name += "," + dm_latex_name 

name += ")" 

latex_name += r"\right)" 

manif = self._ambient_domain.manifold() 

cat = Modules(domain.scalar_field_algebra()).FiniteDimensional() 

FiniteRankFreeModule.__init__(self, domain.scalar_field_algebra(), 

manif._dim, name=name, latex_name=latex_name, 

start_index=manif._sindex, 

output_formatter=DiffScalarField.coord_function, 

category=cat) 

# 

# Special treatment when self._dest_map != identity: 

# bases of self are created from vector frames of the ambient domain 

# 

self._induced_bases = {} 

if self._dest_map != self._domain.identity_map(): 

for frame in self._ambient_domain._top_frames: 

basis = self.basis(from_frame=frame) 

self._induced_bases[frame] = basis 

 

# Initialization of the components of the zero element: 

zero = self.zero() 

for frame in self._domain._frames: 

if frame._dest_map == self._dest_map: 

zero.add_comp(frame) # since new components are 

# initialized to zero 

 

#### Parent methods 

 

def _element_constructor_(self, comp=[], basis=None, name=None, 

latex_name=None): 

r""" 

Construct an element of ``self``. 

 

TESTS:: 

 

sage: M = Manifold(2, 'M') 

sage: X.<x,y> = M.chart() # makes M parallelizable 

sage: XM = M.vector_field_module() 

sage: v = XM([-y,x], name='v'); v 

Vector field v on the 2-dimensional differentiable manifold M 

sage: v.display() 

v = -y d/dx + x d/dy 

sage: XM(0) is XM.zero() 

True 

 

""" 

if isinstance(comp, (int, Integer)) and comp == 0: 

return self.zero() 

if isinstance(comp, VectorField): 

if (self._domain.is_subset(comp._domain) 

and self._ambient_domain.is_subset(comp._ambient_domain)): 

return comp.restrict(self._domain) 

else: 

raise ValueError("cannot convert the {}".format(comp) + 

"to a vector field in {}".format(self)) 

resu = self.element_class(self, name=name, latex_name=latex_name) 

if comp != []: 

resu.set_comp(basis)[:] = comp 

return resu 

 

# Rem: _an_element_ is declared in the superclass FiniteRankFreeModule 

 

def _coerce_map_from_(self, other): 

r""" 

Determine whether coercion to ``self`` exists from parent ``other``. 

 

TESTS:: 

 

sage: M = Manifold(2, 'M') 

sage: X.<x,y> = M.chart() # makes M parallelizable 

sage: U = M.open_subset('U') 

sage: XM = M.vector_field_module() 

sage: XU = U.vector_field_module() 

sage: XM._coerce_map_from_(XU) 

False 

sage: XU._coerce_map_from_(XM) 

True 

 

""" 

if isinstance(other, (VectorFieldModule, VectorFieldFreeModule)): 

return (self._domain.is_subset(other._domain) 

and self._ambient_domain.is_subset(other._ambient_domain)) 

else: 

return False 

 

#### End of parent methods 

 

#### Methods to be redefined by derived classes of FiniteRankFreeModule #### 

 

def _repr_(self): 

r""" 

String representation of ``self``. 

 

TESTS:: 

 

sage: M = Manifold(2, 'M') 

sage: X.<x,y> = M.chart() # makes M parallelizable 

sage: XM = M.vector_field_module() 

sage: XM._repr_() 

'Free module X(M) of vector fields on the 2-dimensional differentiable manifold M' 

sage: repr(XM) # indirect doctest 

'Free module X(M) of vector fields on the 2-dimensional differentiable manifold M' 

sage: XM # indirect doctest 

Free module X(M) of vector fields on the 2-dimensional 

differentiable manifold M 

 

""" 

description = "Free module " 

if self._name is not None: 

description += self._name + " " 

description += "of vector fields " 

if self._dest_map is self._domain.identity_map(): 

description += "on the {}".format(self._domain) 

else: 

description += "along the {}".format(self._domain) + \ 

" mapped into the {}".format(self._ambient_domain) 

return description 

 

def domain(self): 

r""" 

Return the domain of the vector fields in ``self``. 

 

If the module is `\mathfrak{X}(U, \Phi)`, returns the domain `U` 

of `\Phi`. 

 

OUTPUT: 

 

- a 

:class:`~sage.manifolds.differentiable.manifold.DifferentiableManifold` 

representing the domain of the vector fields that belong to this 

module 

 

EXAMPLES:: 

 

sage: M = Manifold(3, 'M') 

sage: X.<x,y,z> = M.chart() # makes M parallelizable 

sage: XM = M.vector_field_module() 

sage: XM.domain() 

3-dimensional differentiable manifold M 

sage: U = Manifold(2, 'U') 

sage: Y.<u,v> = U.chart() 

sage: Phi = U.diff_map(M, {(Y,X): [u+v, u-v, u*v]}, name='Phi') 

sage: XU = U.vector_field_module(dest_map=Phi) 

sage: XU.domain() 

2-dimensional differentiable manifold U 

 

""" 

return self._domain 

 

def ambient_domain(self): 

r""" 

Return the manifold in which the vector fields of ``self`` 

take their values. 

 

If the module is `\mathfrak{X}(U, \Phi)`, returns the codomain `M` 

of `\Phi`. 

 

OUTPUT: 

 

- a 

:class:`~sage.manifolds.differentiable.manifold.DifferentiableManifold` 

representing the manifold in which the vector fields of ``self`` 

take their values 

 

EXAMPLES:: 

 

sage: M = Manifold(3, 'M') 

sage: X.<x,y,z> = M.chart() # makes M parallelizable 

sage: XM = M.vector_field_module() 

sage: XM.ambient_domain() 

3-dimensional differentiable manifold M 

sage: U = Manifold(2, 'U') 

sage: Y.<u,v> = U.chart() 

sage: Phi = U.diff_map(M, {(Y,X): [u+v, u-v, u*v]}, name='Phi') 

sage: XU = U.vector_field_module(dest_map=Phi) 

sage: XU.ambient_domain() 

3-dimensional differentiable manifold M 

 

""" 

return self._ambient_domain 

 

def destination_map(self): 

r""" 

Return the differential map associated to ``self``. 

 

The differential map associated to this module is the map 

 

.. MATH:: 

 

\Phi:\ U \longrightarrow M 

 

such that this module is the set `\mathfrak{X}(U,\Phi)` of all vector 

fields of the type 

 

.. MATH:: 

 

v:\ U \longrightarrow TM 

 

(where `TM` is the tangent bundle of `M`) such that 

 

.. MATH:: 

 

\forall p \in U,\ v(p) \in T_{\Phi(p)} M, 

 

where `T_{\Phi(p)} M` is the tangent space to `M` at the 

point `\Phi(p)`. 

 

OUTPUT: 

 

- a :class:`~sage.manifolds.differentiable.diff_map.DiffMap` 

representing the differential map `\Phi` 

 

EXAMPLES:: 

 

sage: M = Manifold(3, 'M') 

sage: X.<x,y,z> = M.chart() # makes M parallelizable 

sage: XM = M.vector_field_module() 

sage: XM.destination_map() 

Identity map Id_M of the 3-dimensional differentiable manifold M 

sage: U = Manifold(2, 'U') 

sage: Y.<u,v> = U.chart() 

sage: Phi = U.diff_map(M, {(Y,X): [u+v, u-v, u*v]}, name='Phi') 

sage: XU = U.vector_field_module(dest_map=Phi) 

sage: XU.destination_map() 

Differentiable map Phi from the 2-dimensional differentiable 

manifold U to the 3-dimensional differentiable manifold M 

 

""" 

return self._dest_map 

 

def tensor_module(self, k, l): 

r""" 

Return the free module of all tensors of type `(k, l)` defined 

on ``self``. 

 

INPUT: 

 

- ``k`` -- non-negative integer; the contravariant rank, 

the tensor type being `(k, l)` 

- ``l`` -- non-negative integer; the covariant rank, 

the tensor type being `(k, l)` 

 

OUTPUT: 

 

- a 

:class:`~sage.manifolds.differentiable.tensorfield_module.TensorFieldFreeModule` 

representing the free module of type-`(k,l)` tensors on the 

vector field module 

 

EXAMPLES: 

 

A tensor field module on a 2-dimensional differentiable manifold:: 

 

sage: M = Manifold(2, 'M') 

sage: X.<x,y> = M.chart() # makes M parallelizable 

sage: XM = M.vector_field_module() 

sage: XM.tensor_module(1,2) 

Free module T^(1,2)(M) of type-(1,2) tensors fields on the 

2-dimensional differentiable manifold M 

 

The special case of tensor fields of type (1,0):: 

 

sage: XM.tensor_module(1,0) 

Free module X(M) of vector fields on the 2-dimensional 

differentiable manifold M 

 

The result is cached:: 

 

sage: XM.tensor_module(1,2) is XM.tensor_module(1,2) 

True 

sage: XM.tensor_module(1,0) is XM 

True 

 

.. SEEALSO:: 

 

:class:`~sage.manifolds.differentiable.tensorfield_module.TensorFieldFreeModule` 

for more examples and documentation. 

 

""" 

from sage.manifolds.differentiable.tensorfield_module import \ 

TensorFieldFreeModule 

if (k,l) not in self._tensor_modules: 

self._tensor_modules[(k,l)] = TensorFieldFreeModule(self, (k,l)) 

return self._tensor_modules[(k,l)] 

 

def exterior_power(self, p): 

r""" 

Return the `p`-th exterior power of ``self``. 

 

If the vector field module ``self`` is `\mathfrak{X}(U,\Phi)`, 

its `p`-th exterior power is the set `A^p(U, \Phi)` of 

`p`-vector fields along `U` with values on `\Phi(U)`. It is a 

free module over `C^k(U)`, the ring (algebra) of differentiable 

scalar fields on `U`. 

 

INPUT: 

 

- ``p`` -- non-negative integer 

 

OUTPUT: 

 

- for `p=0`, the base ring, i.e. `C^k(U)` 

- for `p=1`, the vector field free module ``self``, since 

`A^1(U, \Phi) = \mathfrak{X}(U,\Phi)` 

- for `p \geq 2`, instance of 

:class:`~sage.manifolds.differentiable.multivector_module.MultivectorFreeModule` 

representing the module `A^p(U,\Phi)` 

 

EXAMPLES:: 

 

sage: M = Manifold(2, 'M') 

sage: X.<x,y> = M.chart() # makes M parallelizable 

sage: XM = M.vector_field_module() 

sage: XM.exterior_power(2) 

Free module A^2(M) of 2-vector fields on the 2-dimensional 

differentiable manifold M 

sage: XM.exterior_power(1) 

Free module X(M) of vector fields on the 2-dimensional 

differentiable manifold M 

sage: XM.exterior_power(1) is XM 

True 

sage: XM.exterior_power(0) 

Algebra of differentiable scalar fields on the 2-dimensional 

differentiable manifold M 

sage: XM.exterior_power(0) is M.scalar_field_algebra() 

True 

 

.. SEEALSO:: 

 

:class:`~sage.manifolds.differentiable.multivector_module.MultivectorFreeModule` 

for more examples and documentation. 

 

""" 

from sage.manifolds.differentiable.multivector_module import \ 

MultivectorFreeModule 

if p == 0: 

return self._ring 

if p not in self._exterior_powers: 

self._exterior_powers[p] = MultivectorFreeModule(self, p) 

return self._exterior_powers[p] 

 

def dual_exterior_power(self, p): 

r""" 

Return the `p`-th exterior power of the dual of ``self``. 

 

If the vector field module ``self`` is `\mathfrak{X}(U,\Phi)`, 

the `p`-th exterior power of its dual is the set 

`\Omega^p(U, \Phi)` of `p`-forms along `U` with values on 

`\Phi(U)`. It is a free module over `C^k(U)`, the ring (algebra) 

of differentiable scalar fields on `U`. 

 

INPUT: 

 

- ``p`` -- non-negative integer 

 

OUTPUT: 

 

- for `p=0`, the base ring, i.e. `C^k(U)` 

- for `p \geq 1`, a 

:class:`~sage.manifolds.differentiable.diff_form_module.DiffFormFreeModule` 

representing the module `\Omega^p(U,\Phi)` 

 

EXAMPLES:: 

 

sage: M = Manifold(2, 'M') 

sage: X.<x,y> = M.chart() # makes M parallelizable 

sage: XM = M.vector_field_module() 

sage: XM.dual_exterior_power(2) 

Free module Omega^2(M) of 2-forms on the 2-dimensional 

differentiable manifold M 

sage: XM.dual_exterior_power(1) 

Free module Omega^1(M) of 1-forms on the 2-dimensional 

differentiable manifold M 

sage: XM.dual_exterior_power(1) is XM.dual() 

True 

sage: XM.dual_exterior_power(0) 

Algebra of differentiable scalar fields on the 2-dimensional 

differentiable manifold M 

sage: XM.dual_exterior_power(0) is M.scalar_field_algebra() 

True 

 

.. SEEALSO:: 

 

:class:`~sage.manifolds.differentiable.diff_form_module.DiffFormFreeModule` 

for more examples and documentation. 

 

""" 

from sage.manifolds.differentiable.diff_form_module import \ 

DiffFormFreeModule 

if p == 0: 

return self._ring 

if p not in self._dual_exterior_powers: 

self._dual_exterior_powers[p] = DiffFormFreeModule(self, p) 

return self._dual_exterior_powers[p] 

 

def general_linear_group(self): 

r""" 

Return the general linear group of ``self``. 

 

If the vector field module is `\mathfrak{X}(U,\Phi)`, the *general 

linear group* is the group `\mathrm{GL}(\mathfrak{X}(U,\Phi))` of 

automorphisms of `\mathfrak{X}(U,\Phi)`. Note that an automorphism of 

`\mathfrak{X}(U,\Phi)` can also be viewed as a *field* along `U` of 

automorphisms of the tangent spaces of `V=\Phi(U)`. 

 

OUTPUT: 

 

- a 

:class:`~sage.manifolds.differentiable.automorphismfield_group.AutomorphismFieldParalGroup` 

representing `\mathrm{GL}(\mathfrak{X}(U,\Phi))` 

 

EXAMPLES:: 

 

sage: M = Manifold(2, 'M') 

sage: X.<x,y> = M.chart() # makes M parallelizable 

sage: XM = M.vector_field_module() 

sage: XM.general_linear_group() 

General linear group of the Free module X(M) of vector fields on 

the 2-dimensional differentiable manifold M 

 

.. SEEALSO:: 

 

:class:`~sage.manifolds.differentiable.automorphismfield_group.AutomorphismFieldParalGroup` 

for more examples and documentation. 

 

""" 

from sage.manifolds.differentiable.automorphismfield_group import \ 

AutomorphismFieldParalGroup 

return AutomorphismFieldParalGroup(self) 

 

def basis(self, symbol=None, latex_symbol=None, from_frame=None, 

indices=None, latex_indices=None, symbol_dual=None, 

latex_symbol_dual=None): 

r""" 

Define a basis of ``self``. 

 

A basis of the vector field module is actually a vector frame along 

the differentiable manifold `U` over which the vector field module 

is defined. 

 

If the basis specified by the given symbol already exists, it is 

simply returned. 

If no argument is provided the module's default basis is returned. 

 

INPUT: 

 

- ``symbol`` -- (default: ``None``) either a string, to be used as a 

common base for the symbols of the elements of the basis, or a 

tuple of strings, representing the individual symbols of the 

elements of the basis 

- ``latex_symbol`` -- (default: ``None``) either a string, to be used 

as a common base for the LaTeX symbols of the elements of the basis, 

or a tuple of strings, representing the individual LaTeX symbols 

of the elements of the basis; if ``None``, ``symbol`` is used in 

place of ``latex_symbol`` 

- ``from_frame`` -- (default: ``None``) vector frame `\tilde{e}` 

on the codomain `M` of the destination map `\Phi` of ``self``; 

the returned basis `e` is then such that for all `p \in U`, 

we have `e(p) = \tilde{e}(\Phi(p))` 

- ``indices`` -- (default: ``None``; used only if ``symbol`` is a 

single string) tuple of strings representing the indices 

labelling the elements of the basis; if ``None``, the indices will be 

generated as integers within the range declared on ``self`` 

- ``latex_indices`` -- (default: ``None``) tuple of strings 

representing the indices for the LaTeX symbols of the elements of 

the basis; if ``None``, ``indices`` is used instead 

- ``symbol_dual`` -- (default: ``None``) same as ``symbol`` but for the 

dual basis; if ``None``, ``symbol`` must be a string and is used 

for the common base of the symbols of the elements of the dual basis 

- ``latex_symbol_dual`` -- (default: ``None``) same as ``latex_symbol`` 

but for the dual basis 

 

OUTPUT: 

 

- a :class:`~sage.manifolds.differentiable.vectorframe.VectorFrame` 

representing a basis on ``self`` 

 

EXAMPLES:: 

 

sage: M = Manifold(2, 'M') 

sage: X.<x,y> = M.chart() # makes M parallelizable 

sage: XM = M.vector_field_module() 

sage: e = XM.basis('e'); e 

Vector frame (M, (e_0,e_1)) 

 

See :class:`~sage.manifolds.differentiable.vectorframe.VectorFrame` 

for more examples and documentation. 

 

""" 

from sage.manifolds.differentiable.vectorframe import VectorFrame 

if symbol is None: 

if from_frame is None: 

return self.default_basis() 

else: 

symbol = from_frame._symbol 

latex_symbol = from_frame._latex_symbol 

indices = from_frame._indices 

latex_indices = from_frame._latex_indices 

symbol_dual = from_frame._symbol_dual 

latex_symbol_dual = from_frame._latex_symbol_dual 

for other in self._known_bases: 

if symbol == other._symbol: 

return other 

return VectorFrame(self, symbol, latex_symbol=latex_symbol, 

from_frame=from_frame, indices=indices, 

latex_indices=latex_indices, 

symbol_dual=symbol_dual, 

latex_symbol_dual=latex_symbol_dual) 

 

def tensor(self, tensor_type, name=None, latex_name=None, sym=None, 

antisym=None, specific_type=None): 

r""" 

Construct a tensor on ``self``. 

 

The tensor is actually a tensor field along the differentiable 

manifold `U` over which ``self`` is defined. 

 

INPUT: 

 

- ``tensor_type`` -- pair (k,l) with k being the contravariant rank 

and l the covariant rank 

- ``name`` -- (string; default: ``None``) name given to the tensor 

- ``latex_name`` -- (string; default: ``None``) LaTeX symbol to denote 

the tensor; if none is provided, the LaTeX symbol is set to ``name`` 

- ``sym`` -- (default: ``None``) a symmetry or a list of symmetries 

among the tensor arguments: each symmetry is described by a tuple 

containing the positions of the involved arguments, with the 

convention position=0 for the first argument; for instance: 

 

* ``sym = (0,1)`` for a symmetry between the 1st and 2nd arguments 

* ``sym = [(0,2), (1,3,4)]`` for a symmetry between the 1st and 3rd 

arguments and a symmetry between the 2nd, 4th and 5th arguments 

 

- ``antisym`` -- (default: ``None``) antisymmetry or list of 

antisymmetries among the arguments, with the same convention 

as for ``sym`` 

- ``specific_type`` -- (default: ``None``) specific subclass of 

:class:`~sage.manifolds.differentiable.tensorfield_paral.TensorFieldParal` 

for the output 

 

OUTPUT: 

 

- a 

:class:`~sage.manifolds.differentiable.tensorfield_paral.TensorFieldParal` 

representing the tensor defined on ``self`` with the provided 

characteristics 

 

EXAMPLES:: 

 

sage: M = Manifold(2, 'M') 

sage: X.<x,y> = M.chart() # makes M parallelizable 

sage: XM = M.vector_field_module() 

sage: XM.tensor((1,2), name='t') 

Tensor field t of type (1,2) on the 2-dimensional 

differentiable manifold M 

sage: XM.tensor((1,0), name='a') 

Vector field a on the 2-dimensional differentiable 

manifold M 

sage: XM.tensor((0,2), name='a', antisym=(0,1)) 

2-form a on the 2-dimensional differentiable manifold M 

sage: XM.tensor((2,0), name='a', antisym=(0,1)) 

2-vector field a on the 2-dimensional differentiable 

manifold M 

 

See 

:class:`~sage.manifolds.differentiable.tensorfield_paral.TensorFieldParal` 

for more examples and documentation. 

 

""" 

from sage.manifolds.differentiable.automorphismfield import ( 

AutomorphismField, AutomorphismFieldParal) 

from sage.manifolds.differentiable.metric import \ 

PseudoRiemannianMetric 

if tensor_type == (1,0): 

return self.element_class(self, name=name, 

latex_name=latex_name) 

elif tensor_type == (0,1): 

return self.linear_form(name=name, latex_name=latex_name) 

elif tensor_type == (1,1) and specific_type is not None: 

if issubclass(specific_type, 

(AutomorphismField, AutomorphismFieldParal)): 

return self.automorphism(name=name, latex_name=latex_name) 

elif tensor_type[0] == 0 and tensor_type[1] > 1 and antisym: 

if isinstance(antisym[0], (int, Integer)): 

# a single antisymmetry is provided as a tuple or a 

# range object; it is converted to a 1-item list: 

antisym = [tuple(antisym)] 

if isinstance(antisym, list): 

antisym0 = antisym[0] 

else: 

antisym0 = antisym 

if len(antisym0) == tensor_type[1]: 

return self.alternating_form(tensor_type[1], name=name, 

latex_name=latex_name) 

elif tensor_type[0] > 1 and tensor_type[1] == 0 and antisym: 

if isinstance(antisym[0], (int, Integer)): 

# a single antisymmetry is provided as a tuple or a 

# range object; it is converted to a 1-item list: 

antisym = [tuple(antisym)] 

if isinstance(antisym, list): 

antisym0 = antisym[0] 

else: 

antisym0 = antisym 

if len(antisym0) == tensor_type[0]: 

return self.alternating_contravariant_tensor( 

tensor_type[0], name=name, 

latex_name=latex_name) 

elif tensor_type==(0,2) and specific_type is not None: 

if issubclass(specific_type, PseudoRiemannianMetric): 

return self.metric(name, latex_name=latex_name) 

# NB: the signature is not treated 

# Generic case 

return self.tensor_module(*tensor_type).element_class(self, 

tensor_type, name=name, latex_name=latex_name, 

sym=sym, antisym=antisym) 

 

def tensor_from_comp(self, tensor_type, comp, name=None, 

latex_name=None): 

r""" 

Construct a tensor on ``self`` from a set of components. 

 

The tensor is actually a tensor field along the differentiable 

manifold `U` over which the vector field module is defined. 

The tensor symmetries are deduced from those of the components. 

 

INPUT: 

 

- ``tensor_type`` -- pair `(k,l)` with `k` being the contravariant 

rank and `l` the covariant rank 

- ``comp`` -- :class:`~sage.tensor.modules.comp.Components`; 

the tensor components in a given basis 

- ``name`` -- string (default: ``None``); name given to the tensor 

- ``latex_name`` -- string (default: ``None``); LaTeX symbol to denote 

the tensor; if ``None``, the LaTeX symbol is set to ``name`` 

 

OUTPUT: 

 

- a 

:class:`~sage.manifolds.differentiable.tensorfield_paral.TensorFieldParal` 

representing the tensor defined on the vector field module with the 

provided characteristics 

 

EXAMPLES: 

 

A 2-dimensional set of components transformed into a type-`(1,1)` 

tensor field:: 

 

sage: M = Manifold(2, 'M') 

sage: X.<x,y> = M.chart() 

sage: XM = M.vector_field_module() 

sage: from sage.tensor.modules.comp import Components 

sage: comp = Components(M.scalar_field_algebra(), X.frame(), 2, 

....: output_formatter=XM._output_formatter) 

sage: comp[:] = [[1+x, -y], [x*y, 2-y^2]] 

sage: t = XM.tensor_from_comp((1,1), comp, name='t'); t 

Tensor field t of type (1,1) on the 2-dimensional differentiable 

manifold M 

sage: t.display() 

t = (x + 1) d/dx*dx - y d/dx*dy + x*y d/dy*dx + (-y^2 + 2) d/dy*dy 

 

The same set of components transformed into a type-`(0,2)` 

tensor field:: 

 

sage: t = XM.tensor_from_comp((0,2), comp, name='t'); t 

Tensor field t of type (0,2) on the 2-dimensional differentiable 

manifold M 

sage: t.display() 

t = (x + 1) dx*dx - y dx*dy + x*y dy*dx + (-y^2 + 2) dy*dy 

 

""" 

from sage.tensor.modules.comp import (CompWithSym, CompFullySym, 

CompFullyAntiSym) 

 

# 0/ Compatibility checks: 

if comp._ring is not self._ring: 

raise ValueError("the components are not defined on the " + 

"same ring as the module") 

if comp._frame not in self._known_bases: 

raise ValueError("the components are not defined on a " + 

"basis of the module") 

if comp._nid != tensor_type[0] + tensor_type[1]: 

raise ValueError("number of component indices not " + 

"compatible with the tensor type") 

# 

# 1/ Construction of the tensor: 

if tensor_type == (1,0): 

resu = self.element_class(self, name=name, 

latex_name=latex_name) 

elif tensor_type == (0,1): 

resu = self.linear_form(name=name, latex_name=latex_name) 

elif (tensor_type[0] == 0 and tensor_type[1] > 1 

and isinstance(comp, CompFullyAntiSym)): 

resu = self.alternating_form(tensor_type[1], name=name, 

latex_name=latex_name) 

elif (tensor_type[0] > 1 and tensor_type[1] == 0 

and isinstance(comp, CompFullyAntiSym)): 

resu = self.alternating_contravariant_tensor(tensor_type[0], 

name=name, latex_name=latex_name) 

else: 

resu = self.tensor_module(*tensor_type).element_class(self, 

tensor_type, name=name, latex_name=latex_name) 

# Tensor symmetries deduced from those of comp: 

if isinstance(comp, CompWithSym): 

resu._sym = comp._sym 

resu._antisym = comp._antisym 

# 

# 2/ Tensor components set to comp: 

resu._components[comp._frame] = comp 

# 

return resu 

 

def sym_bilinear_form(self, name=None, latex_name=None): 

r""" 

Construct a symmetric bilinear form on ``self``. 

 

A symmetric bilinear form on the vector field module is 

actually a field of tangent-space symmetric bilinear forms 

along the differentiable manifold `U` over which the vector 

field module is defined. 

 

INPUT: 

 

- ``name`` -- string (default: ``None``); name given to the 

symmetric bilinear bilinear form 

- ``latex_name`` -- string (default: ``None``); LaTeX symbol to 

denote the symmetric bilinear form; if ``None``, the LaTeX 

symbol is set to ``name`` 

 

OUTPUT: 

 

- a 

:class:`~sage.manifolds.differentiable.tensorfield_paral.TensorFieldParal` 

of tensor type `(0,2)` and symmetric 

 

EXAMPLES:: 

 

sage: M = Manifold(2, 'M') 

sage: X.<x,y> = M.chart() # makes M parallelizable 

sage: XM = M.vector_field_module() 

sage: XM.sym_bilinear_form(name='a') 

Field of symmetric bilinear forms a on the 2-dimensional 

differentiable manifold M 

 

.. SEEALSO:: 

 

:class:`~sage.manifolds.differentiable.tensorfield_paral.TensorFieldParal` 

for more examples and documentation. 

 

""" 

return self.tensor((0,2), name=name, latex_name=latex_name, 

sym=(0,1)) 

 

#### End of methods to be redefined by derived classes of FiniteRankFreeModule #### 

 

def metric(self, name, signature=None, latex_name=None): 

r""" 

Construct a pseudo-Riemannian metric (nondegenerate symmetric bilinear 

form) on the current vector field module. 

 

A pseudo-Riemannian metric of the vector field module is actually a 

field of tangent-space non-degenerate symmetric bilinear forms along 

the manifold `U` on which the vector field module is defined. 

 

INPUT: 

 

- ``name`` -- (string) name given to the metric 

- ``signature`` -- (integer; default: ``None``) signature `S` of the 

metric: `S = n_+ - n_-`, where `n_+` (resp. `n_-`) is the number of 

positive terms (resp. number of negative terms) in any diagonal 

writing of the metric components; if ``signature`` is not provided, 

`S` is set to the manifold's dimension (Riemannian signature) 

- ``latex_name`` -- (string; default: ``None``) LaTeX symbol to denote 

the metric; if ``None``, it is formed from ``name`` 

 

OUTPUT: 

 

- instance of 

:class:`~sage.manifolds.differentiable.metric.PseudoRiemannianMetricParal` 

representing the defined pseudo-Riemannian metric. 

 

EXAMPLES:: 

 

sage: M = Manifold(2, 'M') 

sage: X.<x,y> = M.chart() # makes M parallelizable 

sage: XM = M.vector_field_module() 

sage: XM.metric('g') 

Riemannian metric g on the 2-dimensional differentiable manifold M 

sage: XM.metric('g', signature=0) 

Lorentzian metric g on the 2-dimensional differentiable manifold M 

 

.. SEEALSO:: 

 

:class:`~sage.manifolds.differentiable.metric.PseudoRiemannianMetricParal` 

for more documentation. 

 

""" 

from sage.manifolds.differentiable.metric import \ 

PseudoRiemannianMetricParal 

return PseudoRiemannianMetricParal(self, name, signature=signature, 

latex_name=latex_name)