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

r""" 

Sets of Morphisms between Differentiable Manifolds 

 

The class :class:`DifferentiableManifoldHomset` implements sets of morphisms 

between two differentiable manifolds over the same topological field `K` 

(in most applications, `K = \RR` or `K = \CC`), a morphism being a 

*differentiable map* for the category of differentiable manifolds. 

 

The subclass :class:`DifferentiableCurveSet` is devoted to the specific case 

of differential curves, i.e. morphisms whose domain is an open interval of 

`\RR`. 

 

The subclass :class:`IntegratedCurveSet` is devoted to differentiable 

curves that are defined as a solution to a system of second order 

differential equations. 

 

The subclass :class:`IntegratedAutoparallelCurveSet` is devoted to 

differentiable curves that are defined as autoparallel curves with respect to 

a certain affine connection. 

 

The subclass :class:`IntegratedGeodesicSet` is devoted to differentiable 

curves that are defined as geodesics with respect to to a certain metric. 

 

AUTHORS: 

 

- Eric Gourgoulhon (2015): initial version 

- Travis Scrimshaw (2016): review tweaks 

- Karim Van Aelst (2017): sets of integrated curves 

 

 

REFERENCES: 

 

- [Lee2013]_ 

- [KN1963]_ 

 

""" 

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

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

# 

# 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.manifolds.manifold_homset import TopologicalManifoldHomset 

from sage.manifolds.differentiable.diff_map import DiffMap 

from sage.manifolds.differentiable.curve import DifferentiableCurve 

from sage.manifolds.differentiable.integrated_curve import IntegratedCurve 

from sage.manifolds.differentiable.integrated_curve import IntegratedAutoparallelCurve 

from sage.manifolds.differentiable.integrated_curve import IntegratedGeodesic 

from sage.misc.cachefunc import cached_method 

 

class DifferentiableManifoldHomset(TopologicalManifoldHomset): 

r""" 

Set of differentiable maps between two differentiable manifolds. 

 

Given two differentiable manifolds `M` and `N` over a topological field `K`, 

the class :class:`DifferentiableManifoldHomset` implements the set 

`\mathrm{Hom}(M,N)` of morphisms (i.e. differentiable maps) 

`M\rightarrow N`. 

 

This is a Sage *parent* class, whose *element* class is 

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

 

INPUT: 

 

- ``domain`` -- differentiable manifold `M` (domain of the morphisms), 

as an instance of 

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

- ``codomain`` -- differentiable manifold `N` (codomain of the morphisms), 

as an instance of 

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

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

``None``, Hom(M,N) will be used 

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

homset; if ``None``, `\mathrm{Hom}(M,N)` will be used 

 

EXAMPLES: 

 

Set of differentiable maps between a 2-dimensional differentiable manifold 

and a 3-dimensional one:: 

 

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

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

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

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

sage: H = Hom(M, N) ; H 

Set of Morphisms from 2-dimensional differentiable manifold M to 

3-dimensional differentiable manifold N in Category of smooth 

manifolds over Real Field with 53 bits of precision 

sage: type(H) 

<class 'sage.manifolds.differentiable.manifold_homset.DifferentiableManifoldHomset_with_category'> 

sage: H.category() 

Category of homsets of topological spaces 

sage: latex(H) 

\mathrm{Hom}\left(M,N\right) 

sage: H.domain() 

2-dimensional differentiable manifold M 

sage: H.codomain() 

3-dimensional differentiable manifold N 

 

An element of ``H`` is a differentiable map from ``M`` to ``N``:: 

 

sage: H.Element 

<class 'sage.manifolds.differentiable.diff_map.DiffMap'> 

sage: f = H.an_element() ; f 

Differentiable map from the 2-dimensional differentiable manifold M to the 

3-dimensional differentiable manifold N 

sage: f.display() 

M --> N 

(x, y) |--> (u, v, w) = (0, 0, 0) 

 

The test suite is passed:: 

 

sage: TestSuite(H).run() 

 

When the codomain coincides with the domain, the homset is a set of 

*endomorphisms* in the category of differentiable manifolds:: 

 

sage: E = Hom(M, M) ; E 

Set of Morphisms from 2-dimensional differentiable manifold M to 

2-dimensional differentiable manifold M in Category of smooth 

manifolds over Real Field with 53 bits of precision 

sage: E.category() 

Category of endsets of topological spaces 

sage: E.is_endomorphism_set() 

True 

sage: E is End(M) 

True 

 

In this case, the homset is a monoid for the law of morphism composition:: 

 

sage: E in Monoids() 

True 

 

This was of course not the case for ``H = Hom(M, N)``:: 

 

sage: H in Monoids() 

False 

 

The identity element of the monoid is of course the identity map of ``M``:: 

 

sage: E.one() 

Identity map Id_M of the 2-dimensional differentiable manifold M 

sage: E.one() is M.identity_map() 

True 

sage: E.one().display() 

Id_M: M --> M 

(x, y) |--> (x, y) 

 

The test suite is passed by ``E``:: 

 

sage: TestSuite(E).run() 

 

This test suite includes more tests than in the case of ``H``, since ``E`` 

has some extra structure (monoid). 

 

""" 

 

Element = DiffMap 

 

def __init__(self, domain, codomain, name=None, latex_name=None): 

r""" 

TESTS:: 

 

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

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

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

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

sage: H = Hom(M, N) ; H 

Set of Morphisms from 2-dimensional differentiable manifold M to 

3-dimensional differentiable manifold N in Category of smooth 

manifolds over Real Field with 53 bits of precision 

sage: TestSuite(H).run() 

 

Test for an endomorphism set:: 

 

sage: E = Hom(M, M) ; E 

Set of Morphisms from 2-dimensional differentiable manifold M to 

2-dimensional differentiable manifold M in Category of smooth 

manifolds over Real Field with 53 bits of precision 

sage: TestSuite(E).run() 

 

""" 

from sage.manifolds.differentiable.manifold import \ 

DifferentiableManifold 

if not isinstance(domain, DifferentiableManifold): 

raise TypeError("domain = {} is not an ".format(domain) + 

"instance of DifferentiableManifold") 

if not isinstance(codomain, DifferentiableManifold): 

raise TypeError("codomain = {} is not an ".format(codomain) + 

"instance of DifferentiableManifold") 

TopologicalManifoldHomset.__init__(self, domain, codomain, name=name, 

latex_name=latex_name) 

 

#### Parent methods #### 

 

def _coerce_map_from_(self, other): 

r""" 

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

 

EXAMPLES:: 

 

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

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

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

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

sage: H = Hom(M,N) 

sage: H._coerce_map_from_(ZZ) 

False 

sage: H._coerce_map_from_(M) 

False 

sage: H._coerce_map_from_(N) 

False 

 

""" 

#!# for the time being: 

return False 

 

#### End of parent methods #### 

 

 

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

 

class DifferentiableCurveSet(DifferentiableManifoldHomset): 

r""" 

Set of differentiable curves in a differentiable manifold. 

 

Given an open interval `I` of `\RR` (possibly `I = \RR`) and 

a differentiable manifold `M` over `\RR`, this is the set 

`\mathrm{Hom}(I,M)` of morphisms (i.e. differentiable curves) `I \to M`. 

 

INPUT: 

 

- ``domain`` -- 

:class:`~sage.manifolds.differentiable.real_line.OpenInterval` 

if an open interval `I \subset \RR` (domain of the morphisms), 

or :class:`~sage.manifolds.differentiable.real_line.RealLine` 

if `I = \RR` 

- ``codomain`` -- 

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

differentiable manifold `M` (codomain of the morphisms) 

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

curves; if ``None``, ``Hom(I, M)`` will be used 

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

the set of curves; if ``None``, `\mathrm{Hom}(I,M)` will be used 

 

EXAMPLES: 

 

Set of curves `\RR \longrightarrow M`, where `M` is a 2-dimensional 

manifold:: 

 

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

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

sage: R.<t> = RealLine() ; R 

Real number line R 

sage: H = Hom(R, M) ; H 

Set of Morphisms from Real number line R to 2-dimensional 

differentiable manifold M in Category of smooth manifolds over Real 

Field with 53 bits of precision 

sage: H.category() 

Category of homsets of topological spaces 

sage: latex(H) 

\mathrm{Hom}\left(\Bold{R},M\right) 

sage: H.domain() 

Real number line R 

sage: H.codomain() 

2-dimensional differentiable manifold M 

 

An element of ``H`` is a curve in ``M``:: 

 

sage: c = H.an_element(); c 

Curve in the 2-dimensional differentiable manifold M 

sage: c.display() 

R --> M 

t |--> (x, y) = (1/(t^2 + 1) - 1/2, 0) 

 

The test suite is passed:: 

 

sage: TestSuite(H).run() 

 

The set of curves `(0,1) \longrightarrow U`, where `U` is an open 

subset of `M`:: 

 

sage: I = R.open_interval(0, 1) ; I 

Real interval (0, 1) 

sage: U = M.open_subset('U', coord_def={X: x^2+y^2<1}) ; U 

Open subset U of the 2-dimensional differentiable manifold M 

sage: H = Hom(I, U) ; H 

Set of Morphisms from Real interval (0, 1) to Open subset U of the 

2-dimensional differentiable manifold M in Join of Category of 

subobjects of sets and Category of smooth manifolds over Real Field 

with 53 bits of precision 

 

An element of ``H`` is a curve in ``U``:: 

 

sage: c = H.an_element() ; c 

Curve in the Open subset U of the 2-dimensional differentiable 

manifold M 

sage: c.display() 

(0, 1) --> U 

t |--> (x, y) = (1/(t^2 + 1) - 1/2, 0) 

 

The set of curves `\RR \longrightarrow \RR` is a set of (manifold) 

endomorphisms:: 

 

sage: E = Hom(R, R) ; E 

Set of Morphisms from Real number line R to Real number line R in 

Category of smooth manifolds over Real Field with 53 bits of precision 

sage: E.category() 

Category of endsets of topological spaces 

sage: E.is_endomorphism_set() 

True 

sage: E is End(R) 

True 

 

It is a monoid for the law of morphism composition:: 

 

sage: E in Monoids() 

True 

 

The identity element of the monoid is the identity map of `\RR`:: 

 

sage: E.one() 

Identity map Id_R of the Real number line R 

sage: E.one() is R.identity_map() 

True 

sage: E.one().display() 

Id_R: R --> R 

t |--> t 

 

A "typical" element of the monoid:: 

 

sage: E.an_element().display() 

R --> R 

t |--> 1/(t^2 + 1) - 1/2 

 

The test suite is passed by ``E``:: 

 

sage: TestSuite(E).run() 

 

Similarly, the set of curves `I \longrightarrow I` is a monoid, whose 

elements are (manifold) endomorphisms:: 

 

sage: EI = Hom(I, I) ; EI 

Set of Morphisms from Real interval (0, 1) to Real interval (0, 1) in 

Join of Category of subobjects of sets and 

Category of smooth manifolds over Real Field with 53 bits of precision 

sage: EI.category() 

Category of endsets of subobjects of sets and topological spaces 

sage: EI is End(I) 

True 

sage: EI in Monoids() 

True 

 

The identity element and a "typical" element of this monoid:: 

 

sage: EI.one() 

Identity map Id_(0, 1) of the Real interval (0, 1) 

sage: EI.one().display() 

Id_(0, 1): (0, 1) --> (0, 1) 

t |--> t 

sage: EI.an_element().display() 

(0, 1) --> (0, 1) 

t |--> 1/2/(t^2 + 1) + 1/4 

 

The test suite is passed by ``EI``:: 

 

sage: TestSuite(EI).run() 

 

""" 

Element = DifferentiableCurve 

 

def __init__(self, domain, codomain, name=None, latex_name=None): 

r""" 

Initialize ``self``. 

 

TESTS:: 

 

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

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

sage: R.<t> = RealLine() 

sage: H = Hom(R, M); H 

Set of Morphisms from Real number line R to 3-dimensional 

differentiable manifold M in Category of smooth manifolds over 

Real Field with 53 bits of precision 

sage: TestSuite(H).run() 

sage: Hom(R, M) is Hom(R, M) 

True 

sage: H = Hom(R, R); H 

Set of Morphisms from Real number line R to Real number line R in 

Category of smooth manifolds over Real Field with 53 bits of 

precision 

sage: TestSuite(H).run() 

sage: I = R.open_interval(-1, 2) 

sage: H = Hom(I, M); H 

Set of Morphisms from Real interval (-1, 2) to 3-dimensional 

differentiable manifold M in Join of Category of subobjects of 

sets and Category of smooth manifolds over Real Field with 53 bits 

of precision 

sage: TestSuite(H).run() 

sage: H = Hom(I, I); H 

Set of Morphisms from Real interval (-1, 2) to Real interval (-1, 2) 

in Join of Category of subobjects of sets and Category of smooth 

manifolds over Real Field with 53 bits of precision 

sage: TestSuite(H).run() 

 

""" 

from sage.manifolds.differentiable.real_line import OpenInterval 

if not isinstance(domain, OpenInterval): 

raise TypeError("{} is not an open real interval".format(domain)) 

DifferentiableManifoldHomset.__init__(self, domain, codomain, name=name, 

latex_name=latex_name) 

 

#### Parent methods #### 

 

def _element_constructor_(self, coord_expression, name=None, 

latex_name=None, is_isomorphism=False, 

is_identity=False): 

r""" 

Construct an element of ``self``, i.e. a differentiable curve 

`I \to M`, where `I` is a real interval and `M` some 

differentiable manifold. 

 

OUTPUT: 

 

- :class:`~sage.manifolds.differentiable.curve.DifferentiableCurve` 

 

EXAMPLES:: 

 

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

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

sage: R.<t> = RealLine() ; R 

Real number line R 

sage: H = Hom(R, M) 

sage: c = H({X: [sin(t), sin(2*t)/2]}, name='c') ; c 

Curve c in the 2-dimensional differentiable manifold M 

sage: c = Hom(R, R)({}, is_identity=True) ; c 

Identity map Id_R of the Real number line R 

 

""" 

# Standard construction 

return self.element_class(self, coord_expression=coord_expression, 

name=name, latex_name=latex_name, 

is_isomorphism=is_isomorphism, 

is_identity=is_identity) 

 

def _an_element_(self): 

r""" 

Construct some element of ``self``. 

 

OUTPUT: 

 

- :class:`~sage.manifolds.differentiable.curve.DifferentiableCurve` 

 

EXAMPLES:: 

 

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

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

sage: R.<t> = RealLine() 

sage: c = Hom(R,M)._an_element_() ; c 

Curve in the 3-dimensional differentiable manifold M 

sage: c.display() 

R --> M 

t |--> (x, y, z) = (1/(t^2 + 1) - 1/2, 0, 0) 

 

:: 

 

sage: I = R.open_interval(0, pi) 

sage: c = Hom(I,M)._an_element_() ; c 

Curve in the 3-dimensional differentiable manifold M 

sage: c.display() 

(0, pi) --> M 

t |--> (x, y, z) = (1/(t^2 + 1) - 1/2, 0, 0) 

 

:: 

 

sage: c = Hom(I,I)._an_element_() ; c 

Differentiable map from the Real interval (0, pi) to itself 

sage: c.display() 

(0, pi) --> (0, pi) 

t |--> 1/4*pi + 1/2*pi/(t^2 + 1) 

 

""" 

from sage.rings.infinity import Infinity 

from sage.rings.rational_field import QQ 

dom = self.domain() 

codom = self.codomain() 

# A simple curve is constructed around a point of the codomain: 

chart2 = codom.default_chart() 

target_point = chart2.domain().an_element() 

target_coord = list(target_point.coord(chart2)) 

bounds = chart2._bounds[0] # bounds of first coordinate 

# Determination of an interval (x1, x2) around target_point: 

xmin = bounds[0][0] 

xmax = bounds[1][0] 

one_half = QQ(1) / QQ(2) 

if xmin == -Infinity: 

if xmax == Infinity: 

x1 = - one_half 

x2 = one_half 

else: 

x1 = xmax - 3*one_half 

x2 = xmax - one_half 

else: 

if xmax == Infinity: 

x1 = xmin + one_half 

x2 = xmin + 3*one_half 

else: 

dx = (xmax - xmin) / 4 

x1 = xmin + dx 

x2 = xmax - dx 

# The coordinate function defining the curve: 

t = dom.canonical_coordinate() 

target_coord[0] = x1 + (x2-x1) / (1+t*t) 

coord_expression = {chart2: target_coord} 

return self.element_class(self, coord_expression) 

 

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

 

class IntegratedCurveSet(DifferentiableCurveSet): 

r""" 

Set of integrated curves in a differentiable manifold. 

 

INPUT: 

 

- ``domain`` -- 

:class:`~sage.manifolds.differentiable.real_line.OpenInterval` 

open interval `I \subset \RR` with finite boundaries (domain of 

the morphisms) 

- ``codomain`` -- 

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

differentiable manifold `M` (codomain of the morphisms) 

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

integrated curves; if ``None``, ``Hom_integrated(I, M)`` will be 

used 

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

denote the set of integrated curves; if ``None``, 

`\mathrm{Hom_{integrated}}(I,M)` will be used 

 

EXAMPLES: 

 

This parent class needs to be imported:: 

 

sage: from sage.manifolds.differentiable.manifold_homset import IntegratedCurveSet 

 

Integrated curves are only allowed to be defined on an interval with 

finite bounds. 

This forbids to define an instance of this parent class whose domain 

has infinite bounds:: 

 

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

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

sage: R.<t> = RealLine() 

sage: H = IntegratedCurveSet(R, M) 

Traceback (most recent call last): 

... 

ValueError: both boundaries of the interval defining the domain 

of a Homset of integrated curves need to be finite 

 

An instance whose domain is an interval with finite bounds allows to 

build an integrated curve defined on the interval:: 

 

sage: I = R.open_interval(-1, 2) 

sage: H = IntegratedCurveSet(I, M) ; H 

Set of Morphisms from Real interval (-1, 2) to 2-dimensional 

differentiable manifold M in Category of homsets of subobjects 

of sets and topological spaces which actually are integrated 

curves 

sage: eqns_rhs = [1,1] 

sage: vels = X.symbolic_velocities() 

sage: t = var('t') 

sage: p = M.point((3,4)) 

sage: Tp = M.tangent_space(p) 

sage: v = Tp((1,2)) 

sage: c = H(eqns_rhs, vels, t, v, name='c') ; c 

Integrated curve c in the 2-dimensional differentiable 

manifold M 

 

A "typical" element of ``H`` is a curve in ``M``:: 

 

sage: d = H.an_element(); d 

Integrated curve in the 2-dimensional differentiable manifold M 

sage: sys = d.system(verbose=True) 

Curve in the 2-dimensional differentiable manifold M integrated 

over the Real interval (-1, 2) as a solution to the following 

system, written with respect to Chart (M, (x, y)): 

<BLANKLINE> 

Initial point: Point on the 2-dimensional differentiable 

manifold M with coordinates [0, 0] with respect to Chart (M, (x, y)) 

Initial tangent vector: Tangent vector at Point on the 

2-dimensional differentiable manifold M with components 

[1/4, 0] with respect to Chart (M, (x, y)) 

<BLANKLINE> 

d(x)/dt = Dx 

d(y)/dt = Dy 

d(Dx)/dt = -1/4*sin(t + 1) 

d(Dy)/dt = 0 

<BLANKLINE> 

 

The test suite is passed:: 

 

sage: TestSuite(H).run() 

 

More generally, an instance of this class may be defined with 

abstract bounds `(a,b)`:: 

 

sage: [a,b] = var('a b') 

sage: J = R.open_interval(a, b) 

sage: H = IntegratedCurveSet(J, M) ; H 

Set of Morphisms from Real interval (a, b) to 2-dimensional 

differentiable manifold M in Category of homsets of subobjects 

of sets and topological spaces which actually are integrated 

curves 

 

A "typical" element of ``H`` is a curve in ``M``:: 

 

sage: f = H.an_element(); f 

Integrated curve in the 2-dimensional differentiable manifold M 

sage: sys = f.system(verbose=True) 

Curve in the 2-dimensional differentiable manifold M integrated 

over the Real interval (a, b) as a solution to the following 

system, written with respect to Chart (M, (x, y)): 

<BLANKLINE> 

Initial point: Point on the 2-dimensional differentiable 

manifold M with coordinates [0, 0] with respect to Chart (M, (x, y)) 

Initial tangent vector: Tangent vector at Point on the 

2-dimensional differentiable manifold M with components 

[1/4, 0] with respect to Chart (M, (x, y)) 

<BLANKLINE> 

d(x)/dt = Dx 

d(y)/dt = Dy 

d(Dx)/dt = -1/4*sin(-a + t) 

d(Dy)/dt = 0 

<BLANKLINE> 

 

Yet, even in the case of abstract bounds, considering any of them to 

be infinite is still prohibited since no numerical integration could 

be performed:: 

 

sage: f.solve(parameters_values={a:-1, b:+oo}) 

Traceback (most recent call last): 

... 

ValueError: both boundaries of the interval need to be finite 

 

The set of integrated curves `J \longrightarrow J` is a set of 

numerical (manifold) endomorphisms:: 

 

sage: H = IntegratedCurveSet(J, J); H 

Set of Morphisms from Real interval (a, b) to Real interval 

(a, b) in Category of endsets of subobjects of sets and 

topological spaces which actually are integrated curves 

sage: H.category() 

Category of endsets of subobjects of sets and topological spaces 

 

It is a monoid for the law of morphism composition:: 

 

sage: H in Monoids() 

True 

 

Although it is a monoid, no identity map is implemented via the 

``one`` method of this class or any of its subclasses. 

This is justified by the lack of relevance of the identity map 

within the framework of this parent class and its subclasses, whose 

purpose is mainly devoted to numerical issues (therefore, the user 

is left free to set a numerical version of the identity if needed):: 

 

sage: H.one() 

Traceback (most recent call last): 

... 

ValueError: the identity is not implemented for integrated 

curves and associated subclasses 

 

A "typical" element of the monoid:: 

 

sage: g = H.an_element() ; g 

Integrated curve in the Real interval (a, b) 

sage: sys = g.system(verbose=True) 

Curve in the Real interval (a, b) integrated over the Real 

interval (a, b) as a solution to the following system, written 

with respect to Chart ((a, b), (t,)): 

<BLANKLINE> 

Initial point: Point on the Real number line R with coordinates 

[0] with respect to Chart ((a, b), (t,)) 

Initial tangent vector: Tangent vector at Point on the Real 

number line R with components [1/4] with respect to 

Chart ((a, b), (t,)) 

<BLANKLINE> 

d(t)/ds = Dt 

d(Dt)/ds = -1/4*sin(-a + s) 

<BLANKLINE> 

 

The test suite is passed, tests ``_test_one`` and ``_test_prod`` being 

skipped for reasons mentioned above:: 

 

sage: TestSuite(H).run(skip=["_test_one", "_test_prod"]) 

 

""" 

 

Element = IntegratedCurve 

 

def __init__(self, domain, codomain, name=None, latex_name=None): 

r""" 

Initialize ``self``. 

 

TESTS:: 

 

sage: from sage.manifolds.differentiable.manifold_homset import IntegratedCurveSet 

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

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

sage: R.<t> = RealLine() 

sage: H = IntegratedCurveSet(R, M) 

Traceback (most recent call last): 

... 

ValueError: both boundaries of the interval defining the 

domain of a Homset of integrated curves need to be finite 

sage: I = R.open_interval(-1, 2) 

sage: H = IntegratedCurveSet(I, M) ; H 

Set of Morphisms from Real interval (-1, 2) to 3-dimensional 

differentiable manifold M in Category of homsets of 

subobjects of sets and topological spaces which actually 

are integrated curves 

sage: TestSuite(H).run() 

sage: H = IntegratedCurveSet(I, I); H 

Set of Morphisms from Real interval (-1, 2) to Real interval 

(-1, 2) in Category of endsets of subobjects of sets and 

topological spaces which actually are integrated curves 

sage: TestSuite(H).run(skip=["_test_one", "_test_prod"]) 

 

""" 

 

from sage.rings.infinity import Infinity 

 

DifferentiableCurveSet.__init__(self, domain, codomain, 

name=name, latex_name=latex_name) 

 

# checking argument 'domain': 't_min' and 't_max' are only 

# allowed to be either expressions of finite real values 

t_min = domain.lower_bound() 

t_max = domain.upper_bound() 

if t_min == -Infinity or t_max == +Infinity: 

raise ValueError("both boundaries of the interval " + 

"defining the domain of a Homset of " + 

"integrated curves need to be finite") 

 

if name is None: 

self._name = "Hom_integrated({},{})".format(domain._name, 

codomain._name) 

else: 

self._name = name 

if latex_name is None: 

self._latex_name = r"\mathrm{{Hom}_{integrated}}" 

self._latex_name += r"\left({},{}\right)".format( 

domain._latex_name, codomain._latex_name) 

else: 

self._latex_name = latex_name 

 

#### Parent methods #### 

 

def _repr_(self): 

""" 

TESTS:: 

 

sage: from sage.manifolds.differentiable.manifold_homset import IntegratedCurveSet 

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

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

sage: R.<t> = RealLine() 

sage: I = R.open_interval(-1, 2) 

sage: H = IntegratedCurveSet(I, M) ; H 

Set of Morphisms from Real interval (-1, 2) to 3-dimensional 

differentiable manifold M in Category of homsets of 

subobjects of sets and topological spaces which actually 

are integrated curves 

 

""" 

description = "Set of Morphisms " 

description += "from {} to {} in {} ".format(self._domain, 

self._codomain, self.category()) 

description += "which actually are integrated curves" 

return description 

 

 

def _element_constructor_(self, equations_rhs, velocities, 

curve_parameter, initial_tangent_vector, chart=None, 

name=None, latex_name=None, verbose=False): 

r""" 

Construct an element of ``self``, i.e. an integrated curve 

`I \to M`, where `I` is a real interval and `M` some 

differentiable manifold. 

 

OUTPUT: 

 

- :class:`~sage.manifolds.differentiable.integrated_curve.IntegratedCurve` 

 

EXAMPLES:: 

 

sage: from sage.manifolds.differentiable.manifold_homset import IntegratedCurveSet 

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

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

sage: R.<t> = RealLine() 

sage: I = R.open_interval(-1, 2) 

sage: H = IntegratedCurveSet(I, M) 

sage: eqns_rhs = [1,1] 

sage: vels = X.symbolic_velocities() 

sage: t = var('t') 

sage: p = M.point((3,4)) 

sage: Tp = M.tangent_space(p) 

sage: v = Tp((1,2)) 

sage: c = H(eqns_rhs, vels, t, v, name='c') ; c 

Integrated curve c in the 2-dimensional differentiable 

manifold M 

 

""" 

# Standard construction 

return self.element_class(self, equations_rhs, velocities, 

curve_parameter, initial_tangent_vector, chart=chart, 

name=name, latex_name=latex_name, verbose=verbose) 

 

def _an_element_(self): 

r""" 

Construct some element of ``self``. 

 

OUTPUT: 

 

- :class:`~sage.manifolds.differentiable.integrated_curve.IntegratedCurve` 

 

EXAMPLES:: 

 

sage: from sage.manifolds.differentiable.manifold_homset import IntegratedCurveSet 

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

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

sage: R.<t> = RealLine() 

sage: I = R.open_interval(-1, 2) 

sage: H = IntegratedCurveSet(I, M) 

sage: c = H._an_element_() ; c 

Integrated curve in the 2-dimensional differentiable 

manifold M 

sage: sys = c.system(verbose=True) 

Curve in the 2-dimensional differentiable manifold M 

integrated over the Real interval (-1, 2) as a solution to 

the following system, written with respect to Chart (M, (x, y)): 

<BLANKLINE> 

Initial point: Point on the 2-dimensional differentiable 

manifold M with coordinates [0, 0] with respect to 

Chart (M, (x, y)) 

Initial tangent vector: Tangent vector at Point on the 

2-dimensional differentiable manifold M with components 

[1/4, 0] with respect to Chart (M, (x, y)) 

<BLANKLINE> 

d(x)/dt = Dx 

d(y)/dt = Dy 

d(Dx)/dt = -1/4*sin(t + 1) 

d(Dy)/dt = 0 

<BLANKLINE> 

sage: sol = c.solve() 

sage: interp = c.interpolate() 

sage: p = c(1) ; p 

Point on the 2-dimensional differentiable manifold M 

sage: p.coordinates() # abs tol 1e-12 

(0.22732435599328793, 0.0) 

sage: H = IntegratedCurveSet(I, I) 

sage: c = H._an_element_() ; c 

Integrated curve in the Real interval (-1, 2) 

sage: sys = c.system(verbose=True) 

Curve in the Real interval (-1, 2) integrated over the Real 

interval (-1, 2) as a solution to the following system, 

written with respect to Chart ((-1, 2), (t,)): 

<BLANKLINE> 

Initial point: Point on the Real number line R with 

coordinates [1/2] with respect to Chart ((-1, 2), (t,)) 

Initial tangent vector: Tangent vector at Point on the Real 

number line R with components [3/8] with respect to 

Chart ((-1, 2), (t,)) 

<BLANKLINE> 

d(t)/ds = Dt 

d(Dt)/ds = -3/8*sin(s + 1) 

sage: sol = c.solve() 

sage: interp = c.interpolate() 

sage: p = c(1) ; p 

Point on the Real number line R 

sage: p.coordinates() # abs tol 1e-12 

(0.840986533989932,) 

 

""" 

 

from sage.categories.homset import Hom 

from sage.functions.trig import sin 

from sage.symbolic.ring import var 

 

dom = self.domain() 

t = dom.canonical_coordinate() 

t_min = dom.lower_bound() # this is either an expression or a 

# finite value thanks to tests in '__init__' 

t_max = dom.upper_bound() # this is either an expression or a 

# finite value thanks to tests in '__init__' 

 

codom = self.codomain() 

dim = codom.dim() 

chart2 = codom.default_chart() 

# In case the codomain coincides with the domain, 

# it is important to distinguish between the canonical 

# coordinate, and the curve parameter since, in such a 

# situation, the coordinate should not be used to denote the 

# curve parameter, since it actually becomes a function of the 

# curve parameter, and such a function is an unknown of the 

# system defining the curve. 

# In other cases, it might still happen for a coordinate of the 

# codomain to be denoted the same as the canonical coordinate of 

# the domain (for instance, the codomain could be another 

# real interval, different from the domain, and yet with same 

# letter denoting its canonical coordinate). 

# In such case, an error is raised from method 'init' 

# of class IntegratedCurve; to solve it, the user is 

# free to change the name of the codomain coordinate in the 

# chart used on the codomain. 

if dom == codom: 

param = var('s') 

if t == param: # the canonical coordinate of the domain 

# might be the expression 's' even though it was affected 

# above to the variable 't' 

param = var('u') 

else: 

param = t 

 

# An analytical curve is used to find a region of the codomain 

# where a certain integrated curve may be defined: 

H = Hom(dom, codom) 

c = H.an_element() 

x0_A = c.expr()[0].substitute({t:1}) 

x0_B = c.expr()[0].substitute({t:0}) # necessarily, x0_A < x0_B 

p_coords = [x0_A] + list(c.expr()[1:dim]) 

p = codom.point(p_coords) 

 

# The initial tangent vector: 

v_comps = [(x0_B-x0_A)/2] + [0 for i in range(dim-1)] 

v = codom.tangent_space(p)(v_comps) 

 

# The equations defining the curve: 

eqns_rhs=[-(x0_B-x0_A)/2*sin(param-t_min)]+[0 for i in range(dim-1)] 

# combined with the initial components above, all velocities 

# vanish, except the first one, which is a cosine function. 

# This differential system results in a curve constant in all 

# its coordinates, except the first one, which oscillates around 

# the value 'x0_A' with an amplitude '(x0_B-x0_A)/2' 

 

# The symbolic expressions for the velocities: 

vels = chart2.symbolic_velocities() 

 

return self.element_class(self,eqns_rhs,vels,param,v) 

 

def one(self): 

r""" 

Raise an error refusing to provide the identity element. 

This overrides the ``one`` method of class 

:class:`~sage.manifolds.manifold_homset.TopologicalManifoldHomset`, 

which would actually raise an error as well, due to lack of option 

``is_identity`` in ``element_constructor`` method of ``self``. 

 

TESTS:: 

 

sage: from sage.manifolds.differentiable.manifold_homset import IntegratedCurveSet 

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

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

sage: R.<t> = RealLine() 

sage: I = R.open_interval(-1, 2) 

sage: H = IntegratedCurveSet(I, M) 

sage: H.one() 

Traceback (most recent call last): 

... 

TypeError: Set of Morphisms from Real interval (-1, 2) to 

3-dimensional differentiable manifold M in Category of 

homsets of subobjects of sets and topological spaces which 

actually are integrated curves is not a monoid 

sage: H = IntegratedCurveSet(I, I) 

sage: H.one() 

Traceback (most recent call last): 

... 

ValueError: the identity is not implemented for integrated 

curves and associated subclasses 

 

""" 

 

if self.codomain() != self.domain(): 

raise TypeError("{} is not a monoid".format(self)) 

else: 

raise ValueError("the identity is not implemented for " + 

"integrated curves and associated " + 

"subclasses") 

 

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

 

class IntegratedAutoparallelCurveSet(IntegratedCurveSet): 

r""" 

Set of integrated autoparallel curves in a differentiable manifold. 

 

INPUT: 

 

- ``domain`` -- 

:class:`~sage.manifolds.differentiable.real_line.OpenInterval` 

open interval `I \subset \RR` with finite boundaries (domain of 

the morphisms) 

- ``codomain`` -- 

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

differentiable manifold `M` (codomain of the morphisms) 

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

integrated autoparallel curves; if ``None``, 

``Hom_autoparallel(I, M)`` will be used 

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

the set of integrated autoparallel curves; if ``None``, 

`\mathrm{Hom_{autoparallel}}(I,M)` will be used 

 

EXAMPLES: 

 

This parent class needs to be imported:: 

 

sage: from sage.manifolds.differentiable.manifold_homset import IntegratedAutoparallelCurveSet 

 

Integrated autoparallel curves are only allowed to be defined on an 

interval with finite bounds. 

This forbids to define an instance of this parent class whose domain 

has infinite bounds:: 

 

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

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

sage: R.<t> = RealLine() 

sage: H = IntegratedAutoparallelCurveSet(R, M) 

Traceback (most recent call last): 

... 

ValueError: both boundaries of the interval defining the domain 

of a Homset of integrated autoparallel curves need to be finite 

 

An instance whose domain is an interval with finite bounds allows to 

build a curve that is autoparallel with respect to a connection 

defined on the codomain:: 

 

sage: I = R.open_interval(-1, 2) 

sage: H = IntegratedAutoparallelCurveSet(I, M) ; H 

Set of Morphisms from Real interval (-1, 2) to 2-dimensional 

differentiable manifold M in Category of homsets of subobjects 

of sets and topological spaces which actually are integrated 

autoparallel curves with respect to a certain affine connection 

sage: nab = M.affine_connection('nabla') 

sage: nab[0,1,0], nab[0,0,1] = 1,2 

sage: nab.torsion()[:] 

[[[0, -1], [1, 0]], [[0, 0], [0, 0]]] 

sage: t = var('t') 

sage: p = M.point((3,4)) 

sage: Tp = M.tangent_space(p) 

sage: v = Tp((1,2)) 

sage: c = H(nab, t, v, name='c') ; c 

Integrated autoparallel curve c in the 2-dimensional 

differentiable manifold M 

 

A "typical" element of ``H`` is an autoparallel curve in ``M``:: 

 

sage: d = H.an_element(); d 

Integrated autoparallel curve in the 2-dimensional 

differentiable manifold M 

sage: sys = d.system(verbose=True) 

Autoparallel curve in the 2-dimensional differentiable manifold 

M equipped with Affine connection nab on the 2-dimensional 

differentiable manifold M, and integrated over the Real 

interval (-1, 2) as a solution to the following equations, 

written with respect to Chart (M, (x, y)): 

<BLANKLINE> 

Initial point: Point on the 2-dimensional differentiable 

manifold M with coordinates [0, -1/2] with respect to 

Chart (M, (x, y)) 

Initial tangent vector: Tangent vector at Point on the 

2-dimensional differentiable manifold M with components 

[-1/6/(e^(-1) - 1), 1/3] with respect to Chart (M, (x, y)) 

<BLANKLINE> 

d(x)/dt = Dx 

d(y)/dt = Dy 

d(Dx)/dt = -Dx*Dy 

d(Dy)/dt = 0 

<BLANKLINE> 

 

The test suite is passed:: 

 

sage: TestSuite(H).run() 

 

For any open interval `J` with finite bounds `(a,b)`, all curves are 

autoparallel with respect to any connection. 

Therefore, the set of autoparallel curves `J \longrightarrow J` is a 

set of numerical (manifold) endomorphisms that is a monoid for the 

law of morphism composition:: 

 

sage: [a,b] = var('a b') 

sage: J = R.open_interval(a, b) 

sage: H = IntegratedAutoparallelCurveSet(J, J); H 

Set of Morphisms from Real interval (a, b) to Real interval 

(a, b) in Category of endsets of subobjects of sets and 

topological spaces which actually are integrated autoparallel 

curves with respect to a certain affine connection 

sage: H.category() 

Category of endsets of subobjects of sets and topological spaces 

sage: H in Monoids() 

True 

 

Although it is a monoid, no identity map is implemented via the 

``one`` method of this class or its subclass devoted to geodesics. 

This is justified by the lack of relevance of the identity map 

within the framework of this parent class and its subclass, whose 

purpose is mainly devoted to numerical issues (therefore, the user 

is left free to set a numerical version of the identity if needed):: 

 

sage: H.one() 

Traceback (most recent call last): 

... 

ValueError: the identity is not implemented for integrated 

curves and associated subclasses 

 

A "typical" element of the monoid:: 

 

sage: g = H.an_element() ; g 

Integrated autoparallel curve in the Real interval (a, b) 

sage: sys = g.system(verbose=True) 

Autoparallel curve in the Real interval (a, b) equipped with 

Affine connection nab on the Real interval (a, b), and 

integrated over the Real interval (a, b) as a solution to the 

following equations, written with respect to Chart ((a, b), (t,)): 

<BLANKLINE> 

Initial point: Point on the Real number line R with coordinates 

[0] with respect to Chart ((a, b), (t,)) 

Initial tangent vector: Tangent vector at Point on the Real 

number line R with components 

[-(e^(1/2) - 1)/(a - b)] with respect to 

Chart ((a, b), (t,)) 

<BLANKLINE> 

d(t)/ds = Dt 

d(Dt)/ds = -Dt^2 

<BLANKLINE> 

 

The test suite is passed, tests ``_test_one`` and ``_test_prod`` being 

skipped for reasons mentioned above:: 

 

sage: TestSuite(H).run(skip=["_test_one", "_test_prod"]) 

 

""" 

 

Element = IntegratedAutoparallelCurve 

 

def __init__(self, domain, codomain, name=None, latex_name=None): 

r""" 

Initialize ``self``. 

 

TESTS:: 

 

sage: from sage.manifolds.differentiable.manifold_homset import IntegratedAutoparallelCurveSet 

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

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

sage: R.<t> = RealLine() 

sage: H = IntegratedAutoparallelCurveSet(R, M) 

Traceback (most recent call last): 

... 

ValueError: both boundaries of the interval defining the 

domain of a Homset of integrated autoparallel curves need 

to be finite 

sage: I = R.open_interval(-1, 2) 

sage: H = IntegratedAutoparallelCurveSet(I, M) ; H 

Set of Morphisms from Real interval (-1, 2) to 3-dimensional 

differentiable manifold M in Category of homsets of 

subobjects of sets and topological spaces which actually are 

integrated autoparallel curves with respect to a certain 

affine connection 

sage: TestSuite(H).run() 

sage: H = IntegratedAutoparallelCurveSet(I, I); H 

Set of Morphisms from Real interval (-1, 2) to Real interval 

(-1, 2) in Category of endsets of subobjects of sets and 

topological spaces which actually are integrated 

autoparallel curves with respect to a certain affine connection 

sage: TestSuite(H).run(skip=["_test_one", "_test_prod"]) 

 

""" 

 

from sage.rings.infinity import Infinity 

 

DifferentiableCurveSet.__init__(self, domain, codomain, 

name=name, latex_name=latex_name) 

 

# checking argument 'domain' 

t_min = domain.lower_bound() 

t_max = domain.upper_bound() 

if t_min == -Infinity or t_max == +Infinity: 

raise ValueError("both boundaries of the interval " + 

"defining the domain of a Homset of " + 

"integrated autoparallel curves need to " + 

"be finite") 

 

if name is None: 

self._name = "Hom_autoparallel" 

self._name += "({},{})".format(domain._name, codomain._name) 

else: 

self._name = name 

if latex_name is None: 

self._latex_name=r"\mathrm{{Hom}_{autoparallel}}" 

self._latex_name+= r"\left({},{}\right)".format( 

domain._latex_name, codomain._latex_name) 

else: 

self._latex_name = latex_name 

 

#### Parent methods #### 

 

def _repr_(self): 

""" 

TESTS:: 

 

sage: from sage.manifolds.differentiable.manifold_homset import IntegratedAutoparallelCurveSet 

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

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

sage: R.<t> = RealLine() 

sage: I = R.open_interval(-1, 2) 

sage: H = IntegratedAutoparallelCurveSet(I, M) ; H 

Set of Morphisms from Real interval (-1, 2) to 3-dimensional 

differentiable manifold M in Category of homsets of 

subobjects of sets and topological spaces which actually 

are integrated autoparallel curves with respect to a certain 

affine connection 

 

""" 

 

description = "Set of Morphisms " 

description += "from {} to {} in {} ".format(self._domain, 

self._codomain, self.category()) 

description += "which actually are integrated autoparallel " 

description += "curves with respect to a certain affine connection" 

return description 

 

 

def _element_constructor_(self, affine_connection, curve_parameter, 

initial_tangent_vector, chart=None, name=None, 

latex_name=None, verbose=False): 

r""" 

Construct an element of ``self``, i.e. an integrated 

autoparallel curve `I \to M`, where `I` is a real interval and 

`M` some differentiable manifold. 

 

OUTPUT: 

 

- :class:`~sage.manifolds.differentiable.integrated_curve.IntegratedAutoparallelCurve` 

 

EXAMPLES:: 

 

sage: from sage.manifolds.differentiable.manifold_homset import IntegratedAutoparallelCurveSet 

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

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

sage: R.<t> = RealLine() 

sage: I = R.open_interval(-1, 2) 

sage: H = IntegratedAutoparallelCurveSet(I, M) 

sage: nab = M.affine_connection('nabla') 

sage: nab[0,1,0], nab[0,0,1] = 1,2 

sage: nab.torsion()[:] 

[[[0, -1], [1, 0]], [[0, 0], [0, 0]]] 

sage: t = var('t') 

sage: p = M.point((3,4)) 

sage: Tp = M.tangent_space(p) 

sage: v = Tp((1,2)) 

sage: c = H(nab, t, v, name='c') ; c 

Integrated autoparallel curve c in the 2-dimensional 

differentiable manifold M 

 

""" 

# Standard construction 

return self.element_class(self, affine_connection, 

curve_parameter, initial_tangent_vector, chart=chart, 

name=name,latex_name=latex_name, verbose=verbose) 

 

def _an_element_(self): 

r""" 

Construct some element of ``self``. 

 

OUTPUT: 

 

- :class:`~sage.manifolds.differentiable.integrated_curve.IntegratedAutoparallelCurve` 

 

EXAMPLES:: 

 

sage: from sage.manifolds.differentiable.manifold_homset import IntegratedAutoparallelCurveSet 

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

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

sage: R.<t> = RealLine() 

sage: [a,b] = var('a b') 

sage: J = R.open_interval(a, b) 

sage: H = IntegratedAutoparallelCurveSet(J, M) 

sage: c = H._an_element_() ; c 

Integrated autoparallel curve in the 2-dimensional 

differentiable manifold M 

sage: sys = c.system(verbose=True) 

Autoparallel curve in the 2-dimensional differentiable 

manifold M equipped with Affine connection nab on the 

2-dimensional differentiable manifold M, and integrated 

over the Real interval (a, b) as a solution to the 

following equations, written with respect to Chart (M, (x, y)): 

<BLANKLINE> 

Initial point: Point on the 2-dimensional differentiable 

manifold M with coordinates [0, -1/2] 

with respect to Chart (M, (x, y)) 

Initial tangent vector: Tangent vector at Point on the 

2-dimensional differentiable manifold M with components 

[1/2/((a - b)*(e^(-1) - 1)), -1/(a - b)] with respect to 

Chart (M, (x, y)) 

<BLANKLINE> 

d(x)/dt = Dx 

d(y)/dt = Dy 

d(Dx)/dt = -Dx*Dy 

d(Dy)/dt = 0 

<BLANKLINE> 

sage: sol = c.solve(parameters_values={a:0,b:4}) 

sage: interp = c.interpolate() 

sage: p = c(1) ; p 

Point on the 2-dimensional differentiable manifold M 

sage: p.coordinates() # abs tol 1e-12 

(0.1749660043664451, -0.2499999999999998) 

sage: I = R.open_interval(-1, 2) 

sage: H = IntegratedAutoparallelCurveSet(I, I) 

sage: c = H._an_element_() ; c 

Integrated autoparallel curve in the Real interval (-1, 2) 

sage: sys = c.system(verbose=True) 

Autoparallel curve in the Real interval (-1, 2) equipped 

with Affine connection nab on the Real interval (-1, 2), 

and integrated over the Real interval (-1, 2) as a solution 

to the following equations, written with respect to 

Chart ((-1, 2), (t,)): 

<BLANKLINE> 

Initial point: Point on the Real number line R with 

coordinates [1/2] with respect to Chart ((-1, 2), (t,)) 

Initial tangent vector: Tangent vector at Point on the Real 

number line R with components [1/3*e^(3/4) - 1/3] 

with respect to Chart ((-1, 2), (t,)) 

<BLANKLINE> 

d(t)/ds = Dt 

d(Dt)/ds = -Dt^2 

<BLANKLINE> 

sage: sol = c.solve() 

sage: interp = c.interpolate() 

sage: p = c(1) ; p 

Point on the Real number line R 

sage: p.coordinates() # abs tol 1e-12 

(1.0565635215890166,) 

 

""" 

 

from sage.rings.infinity import Infinity 

from sage.rings.rational_field import QQ 

from sage.categories.homset import Hom 

from sage.symbolic.ring import var 

from sage.functions.log import exp 

 

dom = self.domain() 

t = dom.canonical_coordinate() 

t_min = dom.lower_bound() # this is either an expression or a 

# finite value thanks to tests in '__init__' 

t_max = dom.upper_bound() # idem 

 

codom = self.codomain() 

dim = codom.dim() 

i0 = codom.start_index() 

chart2 = codom.default_chart() 

x = chart2[:][0] 

# In case the codomain coincides with the domain, 

# it is important to distinguish between the canonical 

# coordinate, and the curve parameter since, in such a 

# situation, the coordinate should not be used to denote the 

# curve parameter, since it actually becomes a function of the 

# curve parameter, and such a function is an unknown of the 

# system defining the curve. 

# In other cases, it might still happen for a coordinate of the 

# codomain to be denoted the same as the canonical coordinate of 

# the domain (for instance, the codomain could be another 

# real interval, different from the domain, and yet with same 

# letter denoting its canonical coordinate). 

# In such case, an error is raised from method 'init' 

# of class IntegratedCurve; to solve it, the user is 

# free to change the name of the codomain coordinate in the 

# chart used on the codomain. 

if dom == codom: 

param = var('s') 

else: 

param = t 

 

# An analytical curve is used to find a region of the codomain 

# where a certain integrated autoparallel curve may be defined: 

H = Hom(dom, codom) 

c = H.an_element() 

x_A = c.expr()[0].substitute({t:1}) 

x_B = c.expr()[0].substitute({t:0}) # necessarily, x_A < x_B 

 

if dim == 1: 

nab = codom.affine_connection('nab') 

nab.set_coef()[i0,i0,i0] = 1 

 

# The initial point: 

p = codom.point([x_A]) 

 

# The initial tangent vector: 

x_dot_A = (exp(x_B - x_A) - 1)/(t_max - t_min) 

v = codom.tangent_space(p)([x_dot_A]) 

 

return self.element_class(self, nab, param, v) 

# the autoparallel curve returned will correspond to the 

# following analytical solution: 

# x(t) = ln( x_dot_A*(t-t_min) + 1 ) + x_A, which is such 

# that x(t_min) = x_A and x(t_max) = x_B due to x_dot_A 

# set to the value above 

 

# else: (i.e. dim >= 2) 

 

nab = codom.affine_connection('nab') 

nab.set_coef()[i0,i0,i0+1] = 1 

 

y_bounds = chart2._bounds[1] # bounds of second coordinate 

# Determination of an interval (y_A, y_B) around target_point: 

y_min = y_bounds[0][0] 

y_max = y_bounds[1][0] 

one_half = QQ(1) / QQ(2) 

if y_min == -Infinity: 

if y_max == Infinity: 

y_A = - one_half 

y_B = one_half 

else: 

y_A = y_max - 3*one_half 

y_B = y_max - one_half 

else: 

if y_max == Infinity: 

y_A = y_min + one_half 

y_B = y_min + 3*one_half 

else: 

dy = (y_max - y_min) / 4 

y_A = y_min + dy 

y_B = y_max - dy 

 

# The initial point: 

p_coords = [x_A] + [y_A] + list(c.expr()[2:dim]) 

p = codom.point(p_coords) 

 

# The initial tangent vector: 

y_dot_A = (y_B - y_A) / (t_max - t_min) 

x_dot_A = y_dot_A*(x_B - x_A) / (1-exp(-y_dot_A*(t_max-t_min))) 

v_comps = [x_dot_A] + [y_dot_A] + [0 for i in range(dim-2)] 

v = codom.tangent_space(p)(v_comps) 

 

return self.element_class(self, nab, param, v) 

# the autoparallel curve returned will correspond to the 

# following analytical solution: 

# all coordinates other than the first two coordinates are 

# constant, and 

# x(t) = x_dot_A/y_dot_A*(1 - exp(-y_dot_A*(t-t_min))) + x_A 

# y(t) = y_dot_A*(t-t_min) + y_A 

# This solution is such that 

# x(t_min) = x_A and x(t_max) = x_B due to x_dot_A set to the 

# value above, and 

# y(t_min) = y_A and y(t_max) = y_B due to y_dot_A set to the 

# value above 

 

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

 

class IntegratedGeodesicSet(IntegratedAutoparallelCurveSet): 

r""" 

Set of integrated geodesic in a differentiable manifold. 

 

INPUT: 

 

- ``domain`` -- 

:class:`~sage.manifolds.differentiable.real_line.OpenInterval` 

open interval `I \subset \RR` with finite boundaries (domain of 

the morphisms) 

- ``codomain`` -- 

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

differentiable manifold `M` (codomain of the morphisms) 

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

integrated geodesics; if ``None``, ``Hom_geodesic(I, M)`` will be used 

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

the set of integrated geodesics; if ``None``, 

`\mathrm{Hom_{geodesic}}(I,M)` will be used 

 

EXAMPLES: 

 

This parent class needs to be imported:: 

 

sage: from sage.manifolds.differentiable.manifold_homset import IntegratedGeodesicSet 

 

Integrated geodesics are only allowed to be defined on an interval 

with finite bounds. 

This forbids to define an instance of this parent class whose domain 

has infinite bounds:: 

 

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

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

sage: R.<t> = RealLine() 

sage: H = IntegratedGeodesicSet(R, M) 

Traceback (most recent call last): 

... 

ValueError: both boundaries of the interval defining the domain 

of a Homset of integrated geodesics need to be finite 

 

An instance whose domain is an interval with finite bounds allows to 

build a geodesic with respect to a metric defined on the codomain:: 

 

sage: I = R.open_interval(-1, 2) 

sage: H = IntegratedGeodesicSet(I, M) ; H 

Set of Morphisms from Real interval (-1, 2) to 2-dimensional 

differentiable manifold M in Category of homsets of subobjects 

of sets and topological spaces which actually are integrated 

geodesics with respect to a certain metric 

sage: g = M.metric('g') 

sage: g[0,0], g[1,1], g[0,1] = 1, 1, 2 

sage: t = var('t') 

sage: p = M.point((3,4)) 

sage: Tp = M.tangent_space(p) 

sage: v = Tp((1,2)) 

sage: c = H(g, t, v, name='c') ; c 

Integrated geodesic c in the 2-dimensional differentiable 

manifold M 

 

A "typical" element of ``H`` is a geodesic in ``M``:: 

 

sage: d = H.an_element(); d 

Integrated geodesic in the 2-dimensional differentiable 

manifold M 

sage: sys = d.system(verbose=True) 

Geodesic in the 2-dimensional differentiable manifold M equipped 

with Riemannian metric g on the 2-dimensional differentiable 

manifold M, and integrated over the Real interval (-1, 2) as a 

solution to the following geodesic equations, written 

with respect to Chart (M, (x, y)): 

<BLANKLINE> 

Initial point: Point on the 2-dimensional differentiable 

manifold M with coordinates [0, 0] with respect to 

Chart (M, (x, y)) 

Initial tangent vector: Tangent vector at Point on the 

2-dimensional differentiable manifold M with components 

[1/3*e^(1/2) - 1/3, 0] with respect to Chart (M, (x, y)) 

<BLANKLINE> 

d(x)/dt = Dx 

d(y)/dt = Dy 

d(Dx)/dt = -Dx^2 

d(Dy)/dt = 0 

 

The test suite is passed:: 

 

sage: TestSuite(H).run() 

 

For any open interval `J` with finite bounds `(a,b)`, all curves are 

geodesics with respect to any metric. 

Therefore, the set of geodesics `J \longrightarrow J` is a set of 

numerical (manifold) endomorphisms that is a monoid for the law of 

morphism composition:: 

 

sage: [a,b] = var('a b') 

sage: J = R.open_interval(a, b) 

sage: H = IntegratedGeodesicSet(J, J); H 

Set of Morphisms from Real interval (a, b) to Real interval 

(a, b) in Category of endsets of subobjects of sets and 

topological spaces which actually are integrated geodesics 

with respect to a certain metric 

sage: H.category() 

Category of endsets of subobjects of sets and topological spaces 

sage: H in Monoids() 

True 

 

Although it is a monoid, no identity map is implemented via the 

``one`` method of this class. 

This is justified by the lack of relevance of the identity map 

within the framework of this parent class, whose purpose is mainly 

devoted to numerical issues (therefore, the user is left free to set 

a numerical version of the identity if needed):: 

 

sage: H.one() 

Traceback (most recent call last): 

... 

ValueError: the identity is not implemented for integrated 

curves and associated subclasses 

 

A "typical" element of the monoid:: 

 

sage: g = H.an_element() ; g 

Integrated geodesic in the Real interval (a, b) 

sage: sys = g.system(verbose=True) 

Geodesic in the Real interval (a, b) equipped with Riemannian 

metric g on the Real interval (a, b), and integrated over the 

Real interval (a, b) as a solution to the following geodesic 

equations, written with respect to Chart ((a, b), (t,)): 

<BLANKLINE> 

Initial point: Point on the Real number line R with coordinates 

[0] with respect to Chart ((a, b), (t,)) 

Initial tangent vector: Tangent vector at Point on the Real 

number line R with components [-(e^(1/2) - 1)/(a - b)] 

with respect to Chart ((a, b), (t,)) 

<BLANKLINE> 

d(t)/ds = Dt 

d(Dt)/ds = -Dt^2 

<BLANKLINE> 

 

The test suite is passed, tests ``_test_one`` and ``_test_prod`` being 

skipped for reasons mentioned above:: 

 

sage: TestSuite(H).run(skip=["_test_one", "_test_prod"]) 

 

""" 

 

Element = IntegratedGeodesic 

 

def __init__(self, domain, codomain, name=None, latex_name=None): 

r""" 

Initialize ``self``. 

 

TESTS:: 

 

sage: from sage.manifolds.differentiable.manifold_homset import IntegratedGeodesicSet 

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

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

sage: R.<t> = RealLine() 

sage: H = IntegratedGeodesicSet(R, M) 

Traceback (most recent call last): 

... 

ValueError: both boundaries of the interval defining the 

domain of a Homset of integrated geodesics need to be 

finite 

sage: I = R.open_interval(-1, 2) 

sage: H = IntegratedGeodesicSet(I, M) ; H 

Set of Morphisms from Real interval (-1, 2) to 3-dimensional 

differentiable manifold M in Category of homsets of 

subobjects of sets and topological spaces which actually 

are integrated geodesics with respect to a certain metric 

sage: TestSuite(H).run() 

sage: H = IntegratedGeodesicSet(I, I); H 

Set of Morphisms from Real interval (-1, 2) to Real interval 

(-1, 2) in Category of endsets of subobjects of sets and 

topological spaces which actually are integrated geodesics 

with respect to a certain metric 

sage: TestSuite(H).run(skip=["_test_one", "_test_prod"]) 

 

""" 

 

from sage.rings.infinity import Infinity 

 

DifferentiableCurveSet.__init__(self, domain, codomain, 

name=name, latex_name=latex_name) 

 

# checking argument 'domain' 

t_min = domain.lower_bound() 

t_max = domain.upper_bound() 

if t_min == -Infinity or t_max == +Infinity: 

raise ValueError("both boundaries of the interval " + 

"defining the domain of a Homset of " + 

"integrated geodesics need to be finite") 

 

if name is None: 

self._name = "Hom_geodesic" 

self._name += "({},{})".format(domain._name, codomain._name) 

else: 

self._name = name 

if latex_name is None: 

self._latex_name = r"\mathrm{{Hom}_{geodesic}}" 

self._latex_name+= r"\left({},{}\right)".format( 

domain._latex_name, codomain._latex_name) 

else: 

self._latex_name = latex_name 

 

#### Parent methods #### 

 

def _repr_(self): 

""" 

TESTS:: 

 

sage: from sage.manifolds.differentiable.manifold_homset import IntegratedGeodesicSet 

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

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

sage: R.<t> = RealLine() 

sage: I = R.open_interval(-1, 2) 

sage: H = IntegratedGeodesicSet(I, M) ; H 

Set of Morphisms from Real interval (-1, 2) to 3-dimensional 

differentiable manifold M in Category of homsets of 

subobjects of sets and topological spaces which actually 

are integrated geodesics with respect to a certain metric 

 

""" 

description = "Set of Morphisms " 

description += "from {} to {} in {} ".format(self._domain, 

self._codomain, self.category()) 

description += "which actually are integrated geodesics " 

description += "with respect to a certain metric" 

return description 

 

def _element_constructor_(self, metric, curve_parameter, 

initial_tangent_vector, chart=None, name=None, 

latex_name=None, verbose=False): 

r""" 

Construct an element of ``self``, i.e. an integrated geodesic 

`I \to M`, where `I` is a real interval and 

`M` some differentiable manifold. 

 

OUTPUT: 

 

- :class:`~sage.manifolds.differentiable.integrated_curve.IntegratedGeodesic` 

 

EXAMPLES:: 

 

sage: from sage.manifolds.differentiable.manifold_homset import IntegratedGeodesicSet 

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

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

sage: R.<t> = RealLine() 

sage: I = R.open_interval(-1, 2) 

sage: H = IntegratedGeodesicSet(I, M) 

sage: g = M.metric('g') 

sage: g[0,0], g[1,1], g[0,1] = 1, 1, 2 

sage: t = var('t') 

sage: p = M.point((3,4)) 

sage: Tp = M.tangent_space(p) 

sage: v = Tp((1,2)) 

sage: c = H(g, t, v, name='c') ; c 

Integrated geodesic c in the 2-dimensional differentiable 

manifold M 

 

""" 

# Standard construction 

return self.element_class(self, metric, curve_parameter, 

initial_tangent_vector, chart=chart, name=name, 

latex_name=latex_name, verbose=verbose) 

 

def _an_element_(self): 

r""" 

Construct some element of ``self``. 

 

OUTPUT: 

 

- :class:`~sage.manifolds.differentiable.integrated_curve.IntegratedGeodesic` 

 

EXAMPLES:: 

 

sage: from sage.manifolds.differentiable.manifold_homset import IntegratedGeodesicSet 

sage: M = Manifold(4, 'M', start_index=1) 

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

sage: R.<t> = RealLine() 

sage: [a,b] = var('a b') 

sage: J = R.open_interval(a, b) 

sage: H = IntegratedGeodesicSet(J, M) 

sage: c = H._an_element_() ; c 

Integrated geodesic in the 4-dimensional differentiable 

manifold M 

sage: sys = c.system(verbose=True) 

Geodesic in the 4-dimensional differentiable manifold M 

equipped with Riemannian metric g on the 4-dimensional 

differentiable manifold M, and integrated over the Real 

interval (a, b) as a solution to the following geodesic 

equations, written with respect to Chart (M, (w, x, y, z)): 

<BLANKLINE> 

Initial point: Point on the 4-dimensional differentiable 

manifold M with coordinates [0, 0, 0, 0] with respect to 

Chart (M, (w, x, y, z)) 

Initial tangent vector: Tangent vector at Point on the 

4-dimensional differentiable manifold M with components 

[-(e^(1/2) - 1)/(a - b), 0, 0, 0] with respect to 

Chart (M, (w, x, y, z)) 

<BLANKLINE> 

d(w)/dt = Dw 

d(x)/dt = Dx 

d(y)/dt = Dy 

d(z)/dt = Dz 

d(Dw)/dt = -Dw^2 

d(Dx)/dt = 0 

d(Dy)/dt = 0 

d(Dz)/dt = 0 

<BLANKLINE> 

sage: sol = c.solve(parameters_values={a:1,b:6}) 

sage: interp = c.interpolate() 

sage: p = c(3) ; p 

Point on the 4-dimensional differentiable manifold M 

sage: p.coordinates() # abs tol 1e-12 

(0.2307056927167852, 0.0, 0.0, 0.0) 

sage: I = R.open_interval(-1, 2) 

sage: H = IntegratedGeodesicSet(I, I) 

sage: c = H._an_element_() ; c 

Integrated geodesic in the Real interval (-1, 2) 

sage: sys = c.system(verbose=True) 

Geodesic in the Real interval (-1, 2) equipped with 

Riemannian metric g on the Real interval (-1, 2), and 

integrated over the Real interval (-1, 2) as a solution to 

the following geodesic equations, written with respect to 

Chart ((-1, 2), (t,)): 

<BLANKLINE> 

Initial point: Point on the Real number line R with 

coordinates [1/2] with respect to Chart ((-1, 2), (t,)) 

Initial tangent vector: Tangent vector at Point on the Real 

number line R with components [1/3*e^(3/4) - 1/3] 

with respect to Chart ((-1, 2), (t,)) 

<BLANKLINE> 

d(t)/ds = Dt 

d(Dt)/ds = -Dt^2 

<BLANKLINE> 

sage: sol = c.solve() 

sage: interp = c.interpolate() 

sage: p = c(1) ; p 

Point on the Real number line R 

sage: p.coordinates() # abs tol 1e-12 

(1.0565635215890166,) 

 

""" 

 

from sage.categories.homset import Hom 

from sage.symbolic.ring import var 

from sage.functions.log import exp 

 

dom = self.domain() 

t = dom.canonical_coordinate() 

t_min = dom.lower_bound() # this is either an expression or a 

# finite value thanks to tests in '__init__' 

t_max = dom.upper_bound() # idem 

 

codom = self.codomain() 

dim = codom.dim() 

i0 = codom.start_index() 

chart2 = codom.default_chart() 

x = chart2[:][0] 

# In case the codomain coincides with the domain, 

# it is important to distinguish between the canonical 

# coordinate, and the curve parameter since, in such a 

# situation, the coordinate should not be used to denote the 

# curve parameter, since it actually becomes a function of the 

# curve parameter, and such a function is an unknown of the 

# system defining the curve. 

# In other cases, it might still happen for a coordinate of the 

# codomain to be denoted the same as the canonical coordinate of 

# the domain (for instance, the codomain could be another 

# real interval, different from the domain, and yet with same 

# letter denoting its canonical coordinate). 

# In such case, an error is raised from method 'init' 

# of class IntegratedCurve; to solve it, the user is 

# free to change the name of the codomain coordinate in the 

# chart used on the codomain. 

if dom == codom: 

param = var('s') 

else: 

param = t 

 

# An analytical curve is used to find a region of the codomain 

# where a certain integrated autoparallel curve may be defined: 

H = Hom(dom, codom) 

c = H.an_element() 

x_A = c.expr()[0].substitute({t:1}) 

x_B = c.expr()[0].substitute({t:0}) # necessarily, x_A < x_B 

 

g = codom.metric('g') 

g[i0,i0] = exp(2*x) 

if dim > 1: 

for i in range(1,dim): 

g[i0+i,i0+i] = 1 

 

# The initial point: 

p_coords = [x_A] + list(c.expr()[1:dim]) 

p = codom.point(p_coords) 

 

# The initial tangent vector: 

x_dot_A = (exp(x_B - x_A) - 1)/(t_max - t_min) 

v_comps = [x_dot_A] + [0 for i in range(dim-1)] 

v = codom.tangent_space(p)(v_comps) 

 

return self.element_class(self, g, param, v) 

# the geodesic returned will correspond to the following 

# analytical solution: 

# all coordinates other than the first one are constant, and 

# x(t) = ln( x_dot_A*(t-t_min) + 1 ) + x_A, which is such that 

# x(t_min) = x_A and x(t_max) = x_B due to x_dot_A set to the 

# value above