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

r""" 

Coordinate Charts on Differentiable Manifolds 

 

The class :class:`DiffChart` implements coordinate charts on a differentiable 

manifold over a topological field `K` (in most applications, `K = \RR` or 

`K = \CC`). 

 

The subclass :class:`RealDiffChart` is devoted 

to the case `K=\RR`, for which the concept of coordinate range is meaningful. 

Moreover, :class:`RealDiffChart` is endowed with some plotting 

capabilities (cf. method :meth:`~sage.manifolds.chart.RealChart.plot`). 

 

Transition maps between charts are implemented via the class 

:class:`DiffCoordChange`. 

 

AUTHORS: 

 

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

 

REFERENCES: 

 

- Chap. 1 of [Lee2013]_ 

 

""" 

 

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

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

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

# 

# 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.misc.cachefunc import cached_method 

from sage.manifolds.chart import Chart, RealChart, CoordChange 

from sage.manifolds.differentiable.vectorframe import CoordFrame 

 

class DiffChart(Chart): 

r""" 

Chart on a differentiable manifold. 

 

Given a differentiable manifold `M` of dimension `n` over a topological 

field `K`, a *chart* is a member `(U,\varphi)` of the manifold's 

differentiable atlas; `U` is then an open subset of `M` and 

`\varphi: U \rightarrow V \subset K^n` is a homeomorphism from 

`U` to an open subset `V` of `K^n`. 

 

The components `(x^1,\ldots,x^n)` of `\varphi`, defined by 

`\varphi(p) = (x^1(p),\ldots,x^n(p))\in K^n` for any point `p\in U`, are 

called the *coordinates* of the chart `(U,\varphi)`. 

 

INPUT: 

 

- ``domain`` -- open subset `U` on which the chart is defined 

- ``coordinates`` -- (default: '' (empty string)) single string defining 

the coordinate symbols, with ' ' (whitespace) as a separator; each item 

has at most two fields, separated by ':': 

 

1. The coordinate symbol (a letter or a few letters) 

2. (optional) The LaTeX spelling of the coordinate; if not provided the 

coordinate symbol given in the first field will be used. 

 

If it contains any LaTeX expression, the string ``coordinates`` must be 

declared with the prefix 'r' (for "raw") to allow for a proper treatment 

of LaTeX's backslash character (see examples below). 

If no LaTeX spelling is to be set for any coordinate, the argument 

``coordinates`` can be omitted when the shortcut operator ``<,>`` is 

used via Sage preparser (see examples below) 

- ``names`` -- (default: ``None``) unused argument, except if 

``coordinates`` is not provided; it must then be a tuple containing 

the coordinate symbols (this is guaranteed if the shortcut operator 

``<,>`` is used). 

- ``calc_method`` -- (default: ``None``) string defining the calculus 

method for computations involving coordinates of the chart; must be 

one of 

 

- ``'SR'``: Sage's default symbolic engine (Symbolic Ring) 

- ``'sympy'``: SymPy 

- ``None``: the default of 

:class:`~sage.manifolds.calculus_method.CalculusMethod` will be 

used 

 

EXAMPLES: 

 

A chart on a complex 2-dimensional differentiable manifold:: 

 

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

sage: X = M.chart('x y'); X 

Chart (M, (x, y)) 

sage: latex(X) 

\left(M,(x, y)\right) 

sage: type(X) 

<class 'sage.manifolds.differentiable.chart.DiffChart'> 

 

To manipulate the coordinates `(x,y)` as global variables, one has to set:: 

 

sage: x,y = X[:] 

 

However, a shortcut is to use the declarator ``<x,y>`` in the left-hand 

side of the chart declaration (there is then no need to pass the string 

``'x y'`` to ``chart()``):: 

 

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

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

Chart (M, (x, y)) 

 

The coordinates are then immediately accessible:: 

 

sage: y 

y 

sage: x is X[0] and y is X[1] 

True 

 

The trick is performed by Sage preparser:: 

 

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

"X = M.chart(names=('x', 'y',)); (x, y,) = X._first_ngens(2)" 

 

Note that ``x`` and ``y`` declared in ``<x,y>`` are mere Python variable 

names and do not have to coincide with the coordinate symbols; 

for instance, one may write:: 

 

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

sage: X.<x1,y1> = M.chart('x y'); X 

Chart (M, (x, y)) 

 

Then ``y`` is not known as a global Python variable and the 

coordinate `y` is accessible only through the global variable ``y1``:: 

 

sage: y1 

y 

sage: latex(y1) 

y 

sage: y1 is X[1] 

True 

 

However, having the name of the Python variable coincide with the 

coordinate symbol is quite convenient; so it is recommended to declare:: 

 

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

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

 

In the above example, the chart X covers entirely the manifold M:: 

 

sage: X.domain() 

2-dimensional complex manifold M 

 

Of course, one may declare a chart only on an open subset of M:: 

 

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

sage: Y.<z1, z2> = U.chart(r'z1:\zeta_1 z2:\zeta_2'); Y 

Chart (U, (z1, z2)) 

sage: Y.domain() 

Open subset U of the 2-dimensional complex manifold M 

 

In the above declaration, we have also specified some LaTeX writing 

of the coordinates different from the text one:: 

 

sage: latex(z1) 

{\zeta_1} 

 

Note the prefix ``r`` in front of the string ``r'z1:\zeta_1 z2:\zeta_2'``; 

it makes sure that the backslash character is treated as an ordinary 

character, to be passed to the LaTeX interpreter. 

 

Coordinates are Sage symbolic variables (see 

:mod:`sage.symbolic.expression`):: 

 

sage: type(z1) 

<type 'sage.symbolic.expression.Expression'> 

 

In addition to the Python variable name provided in the operator ``<.,.>``, 

the coordinates are accessible by their indices:: 

 

sage: Y[0], Y[1] 

(z1, z2) 

 

The index range is that declared during the creation of the manifold. By 

default, it starts at 0, but this can be changed via the parameter 

``start_index``:: 

 

sage: M1 = Manifold(2, 'M_1', field='complex', start_index=1) 

sage: Z.<u,v> = M1.chart() 

sage: Z[1], Z[2] 

(u, v) 

 

The full set of coordinates is obtained by means of the operator 

``[:]``:: 

 

sage: Y[:] 

(z1, z2) 

 

Each constructed chart is automatically added to the manifold's user 

atlas:: 

 

sage: M.atlas() 

[Chart (M, (x, y)), Chart (U, (z1, z2))] 

 

and to the atlas of the chart's domain:: 

 

sage: U.atlas() 

[Chart (U, (z1, z2))] 

 

Manifold subsets have a *default chart*, which, unless changed via the 

method 

:meth:`~sage.manifolds.manifold.TopologicalManifold.set_default_chart`, 

is the first defined chart on the subset (or on a open subset of it):: 

 

sage: M.default_chart() 

Chart (M, (x, y)) 

sage: U.default_chart() 

Chart (U, (z1, z2)) 

 

The default charts are not privileged charts on the manifold, but rather 

charts whose name can be skipped in the argument list of functions having 

an optional ``chart=`` argument. 

 

The action of the chart map `\varphi` on a point is obtained by means of 

the call operator, i.e. the operator ``()``:: 

 

sage: p = M.point((1+i, 2), chart=X); p 

Point on the 2-dimensional complex manifold M 

sage: X(p) 

(I + 1, 2) 

sage: X(p) == p.coord(X) 

True 

 

A vector frame is naturally associated to each chart:: 

 

sage: X.frame() 

Coordinate frame (M, (d/dx,d/dy)) 

sage: Y.frame() 

Coordinate frame (U, (d/dz1,d/dz2)) 

 

as well as a dual frame (basis of 1-forms):: 

 

sage: X.coframe() 

Coordinate coframe (M, (dx,dy)) 

sage: Y.coframe() 

Coordinate coframe (U, (dz1,dz2)) 

 

.. SEEALSO:: 

 

:class:`~sage.manifolds.differentiable.chart.RealDiffChart` for charts 

on differentiable manifolds over `\RR`. 

 

""" 

def __init__(self, domain, coordinates='', names=None, calc_method=None): 

r""" 

Construct a chart. 

 

TESTS:: 

 

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

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

sage: X 

Chart (M, (x, y)) 

sage: type(X) 

<class 'sage.manifolds.differentiable.chart.DiffChart'> 

sage: assumptions() # no assumptions on x,y set by X._init_coordinates 

[] 

sage: TestSuite(X).run() 

 

""" 

Chart.__init__(self, domain, coordinates=coordinates, names=names, 

calc_method=calc_method) 

# Construction of the coordinate frame associated to the chart: 

self._frame = CoordFrame(self) 

self._coframe = self._frame._coframe 

 

def transition_map(self, other, transformations, intersection_name=None, 

restrictions1=None, restrictions2=None): 

r""" 

Construct the transition map between the current chart, 

`(U,\varphi)` say, and another one, `(V,\psi)` say. 

 

If `n` is the manifold's dimension, the *transition map* is the 

map 

 

.. MATH:: 

 

\psi\circ\varphi^{-1}: \varphi(U\cap V) \subset K^n 

\rightarrow \psi(U\cap V) \subset K^n, 

 

where `K` is the manifold's base field. In other words, the 

transition map expresses the coordinates `(y^1,\ldots,y^n)` of 

`(V,\psi)` in terms of the coordinates `(x^1,\ldots,x^n)` of 

`(U,\varphi)` on the open subset where the two charts intersect, i.e. 

on `U\cap V`. 

 

By definition, the transition map `\psi\circ\varphi^{-1}` must be 

of classe `C^k`, where `k` is the degree of differentiability of the 

manifold (cf. 

:meth:`~sage.manifolds.differentiable.manifold.DifferentiableManifold.diff_degree`). 

 

INPUT: 

 

- ``other`` -- the chart `(V,\psi)` 

- ``transformations`` -- tuple (or list) `(Y_1,\ldots,Y_2)`, where 

`Y_i` is the symbolic expression of the coordinate `y^i` in terms 

of the coordinates `(x^1,\ldots,x^n)` 

- ``intersection_name`` -- (default: ``None``) name to be given to the 

subset `U\cap V` if the latter differs from `U` or `V` 

- ``restrictions1`` -- (default: ``None``) list of conditions on the 

coordinates of the current chart that define `U\cap V` if the 

latter differs from `U`. ``restrictions1`` must be a list of 

of symbolic equalities or inequalities involving the 

coordinates, such as x>y or x^2+y^2 != 0. The items of the list 

``restrictions1`` are combined with the ``and`` operator; if some 

restrictions are to be combined with the ``or`` operator instead, 

they have to be passed as a tuple in some single item of the list 

``restrictions1``. For example, ``restrictions1`` = [x>y, 

(x!=0, y!=0), z^2<x] means (x>y) and ((x!=0) or (y!=0)) and (z^2<x). 

If the list ``restrictions1`` contains only one item, this item can 

be passed as such, i.e. writing x>y instead of the single-element 

list [x>y]. 

- ``restrictions2`` -- (default: ``None``) list of conditions on the 

coordinates of the chart `(V,\psi)` that define `U\cap V` if the 

latter differs from `V` (see ``restrictions1`` for the syntax) 

 

OUTPUT: 

 

- The transition map `\psi\circ\varphi^{-1}` defined on `U\cap V`, as an 

instance of :class:`DiffCoordChange`. 

 

EXAMPLES: 

 

Transition map between two stereographic charts on the circle `S^1`:: 

 

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

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

sage: cU.<x> = U.chart() # Stereographic chart from the North pole 

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

sage: cV.<y> = V.chart() # Stereographic chart from the South pole 

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

sage: trans = cU.transition_map(cV, 1/x, intersection_name='W', 

....: restrictions1= x!=0, restrictions2 = y!=0) 

sage: trans 

Change of coordinates from Chart (W, (x,)) to Chart (W, (y,)) 

sage: trans.display() 

y = 1/x 

 

The subset `W`, intersection of `U` and `V`, has been created by 

``transition_map()``:: 

 

sage: M.list_of_subsets() 

[1-dimensional differentiable manifold S^1, 

Open subset U of the 1-dimensional differentiable manifold S^1, 

Open subset V of the 1-dimensional differentiable manifold S^1, 

Open subset W of the 1-dimensional differentiable manifold S^1] 

sage: W = M.list_of_subsets()[3] 

sage: W is U.intersection(V) 

True 

sage: M.atlas() 

[Chart (U, (x,)), Chart (V, (y,)), Chart (W, (x,)), Chart (W, (y,))] 

 

Transition map between the polar chart and the Cartesian one on 

`\RR^2`:: 

 

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

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

sage: U = M.open_subset('U') # the complement of the half line {y=0, x >= 0} 

sage: c_spher.<r,phi> = U.chart(r'r:(0,+oo) phi:(0,2*pi):\phi') 

sage: trans = c_spher.transition_map(c_cart, (r*cos(phi), r*sin(phi)), 

....: restrictions2=(y!=0, x<0)) 

sage: trans 

Change of coordinates from Chart (U, (r, phi)) to Chart (U, (x, y)) 

sage: trans.display() 

x = r*cos(phi) 

y = r*sin(phi) 

 

In this case, no new subset has been created since `U\cap M = U`:: 

 

sage: M.list_of_subsets() 

[2-dimensional differentiable manifold R^2, 

Open subset U of the 2-dimensional differentiable manifold R^2] 

 

but a new chart has been created: `(U, (x, y))`:: 

 

sage: M.atlas() 

[Chart (R^2, (x, y)), Chart (U, (r, phi)), Chart (U, (x, y))] 

 

""" 

dom1 = self._domain 

dom2 = other._domain 

dom = dom1.intersection(dom2, name=intersection_name) 

if dom is dom1: 

chart1 = self 

else: 

chart1 = self.restrict(dom, restrictions1) 

if dom is dom2: 

chart2 = other 

else: 

chart2 = other.restrict(dom, restrictions2) 

if not isinstance(transformations, (tuple, list)): 

transformations = [transformations] 

return DiffCoordChange(chart1, chart2, *transformations) 

 

def frame(self): 

r""" 

Return the vector frame (coordinate frame) associated with ``self``. 

 

OUTPUT: 

 

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

representing the coordinate frame 

 

EXAMPLES: 

 

Coordinate frame associated with some chart on a 2-dimensional 

manifold:: 

 

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

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

sage: c_xy.frame() 

Coordinate frame (M, (d/dx,d/dy)) 

sage: type(c_xy.frame()) 

<class 'sage.manifolds.differentiable.vectorframe.CoordFrame'> 

 

Check that ``c_xy.frame()`` is indeed the coordinate frame associated 

with the coordinates `(x,y)`:: 

 

sage: ex = c_xy.frame()[0] ; ex 

Vector field d/dx on the 2-dimensional differentiable manifold M 

sage: ey = c_xy.frame()[1] ; ey 

Vector field d/dy on the 2-dimensional differentiable manifold M 

sage: ex(M.scalar_field(x)).display() 

M --> R 

(x, y) |--> 1 

sage: ex(M.scalar_field(y)).display() 

M --> R 

(x, y) |--> 0 

sage: ey(M.scalar_field(x)).display() 

M --> R 

(x, y) |--> 0 

sage: ey(M.scalar_field(y)).display() 

M --> R 

(x, y) |--> 1 

 

""" 

return self._frame 

 

def coframe(self): 

r""" 

Return the coframe (basis of coordinate differentials) associated 

with ``self``. 

 

OUTPUT: 

 

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

representing the coframe 

 

EXAMPLES: 

 

Coordinate coframe associated with some chart on a 2-dimensional 

manifold:: 

 

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

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

sage: c_xy.coframe() 

Coordinate coframe (M, (dx,dy)) 

sage: type(c_xy.coframe()) 

<class 'sage.manifolds.differentiable.vectorframe.CoordCoFrame'> 

 

Check that ``c_xy.coframe()`` is indeed the coordinate coframe 

associated with the coordinates `(x, y)`:: 

 

sage: dx = c_xy.coframe()[0] ; dx 

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

sage: dy = c_xy.coframe()[1] ; dy 

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

sage: ex = c_xy.frame()[0] ; ex 

Vector field d/dx on the 2-dimensional differentiable manifold M 

sage: ey = c_xy.frame()[1] ; ey 

Vector field d/dy on the 2-dimensional differentiable manifold M 

sage: dx(ex).display() 

dx(d/dx): M --> R 

(x, y) |--> 1 

sage: dx(ey).display() 

dx(d/dy): M --> R 

(x, y) |--> 0 

sage: dy(ex).display() 

dy(d/dx): M --> R 

(x, y) |--> 0 

sage: dy(ey).display() 

dy(d/dy): M --> R 

(x, y) |--> 1 

 

""" 

return self._coframe 

 

def restrict(self, subset, restrictions=None): 

r""" 

Return the restriction of ``self`` to some subset. 

 

If the current chart is `(U, \varphi)`, a *restriction* (or 

*subchart*) is a chart `(V, \psi)` such that `V \subset U` 

and `\psi = \varphi |_V`. 

 

If such subchart has not been defined yet, it is constructed here. 

 

The coordinates of the subchart bare the same names as the 

coordinates of the original chart. 

 

INPUT: 

 

- ``subset`` -- open subset `V` of the chart domain `U` 

- ``restrictions`` -- (default: ``None``) list of coordinate 

restrictions defining the subset `V` 

 

A restriction can be any symbolic equality or inequality involving 

the coordinates, such as ``x > y`` or ``x^2 + y^2 != 0``. The items 

of the list ``restrictions`` are combined with the ``and`` operator; 

if some restrictions are to be combined with the ``or`` operator 

instead, they have to be passed as a tuple in some single item 

of the list ``restrictions``. For example:: 

 

restrictions = [x > y, (x != 0, y != 0), z^2 < x] 

 

means ``(x > y) and ((x != 0) or (y != 0)) and (z^2 < x)``. 

If the list ``restrictions`` contains only one item, this 

item can be passed as such, i.e. writing ``x > y`` instead 

of the single element list ``[x > y]``. 

 

OUTPUT: 

 

- a :class:`DiffChart` `(V, \psi)` 

 

EXAMPLES: 

 

Coordinates on the unit open ball of `\CC^2` as a subchart 

of the global coordinates of `\CC^2`:: 

 

sage: M = Manifold(2, 'C^2', field='complex') 

sage: X.<z1, z2> = M.chart() 

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

sage: X_B = X.restrict(B, abs(z1)^2 + abs(z2)^2 < 1); X_B 

Chart (B, (z1, z2)) 

 

""" 

if subset == self._domain: 

return self 

if subset not in self._dom_restrict: 

resu = Chart.restrict(self, subset, restrictions=restrictions) 

# Update of superframes and subframes: 

resu._frame._superframes.update(self._frame._superframes) 

for sframe in self._frame._superframes: 

sframe._subframes.add(resu._frame) 

sframe._restrictions[subset] = resu._frame 

# The subchart frame is not a "top frame" in the supersets 

# (including self._domain): 

for dom in self._domain._supersets: 

if resu._frame in dom._top_frames: 

# it was added by the Chart constructor invoked in 

# Chart.restrict above 

dom._top_frames.remove(resu._frame) 

return self._dom_restrict[subset] 

 

def symbolic_velocities(self, left='D', right=None): 

r""" 

Return a list of symbolic variables ready to be used by the 

user as the derivatives of the coordinate functions with respect 

to a curve parameter (i.e. the velocities along the curve). 

It may actually serve to denote anything else than velocities, 

with a name including the coordinate functions. 

The choice of strings provided as 'left' and 'right' arguments 

is not entirely free since it must comply with Python 

prescriptions. 

 

INPUT: 

 

- ``left`` -- (default: ``D``) string to concatenate to the left 

of each coordinate functions of the chart 

- ``right`` -- (default: ``None``) string to concatenate to the 

right of each coordinate functions of the chart 

 

OUTPUT: 

 

- a list of symbolic expressions with the desired names 

 

EXAMPLES: 

 

Symbolic derivatives of the Cartesian coordinates of the 

3-dimensional Euclidean space:: 

 

sage: R3 = Manifold(3, 'R3', start_index=1) 

sage: cart.<X,Y,Z> = R3.chart() 

sage: D = cart.symbolic_velocities(); D 

[DX, DY, DZ] 

sage: D = cart.symbolic_velocities(left='d', right="/dt"); D 

Traceback (most recent call last): 

... 

ValueError: The name "dX/dt" is not a valid Python 

identifier. 

sage: D = cart.symbolic_velocities(left='d', right="_dt"); D 

[dX_dt, dY_dt, dZ_dt] 

sage: D = cart.symbolic_velocities(left='', right="'"); D 

Traceback (most recent call last): 

... 

ValueError: The name "X'" is not a valid Python 

identifier. 

sage: D = cart.symbolic_velocities(left='', right="_dot"); D 

[X_dot, Y_dot, Z_dot] 

sage: R.<t> = RealLine() 

sage: canon_chart = R.default_chart() 

sage: D = canon_chart.symbolic_velocities() ; D 

[Dt] 

 

""" 

 

from sage.symbolic.ring import var 

 

# The case len(self[:]) = 1 is treated apart due to the 

# following fact. 

# In the case of several coordinates, the argument of 'var' (as 

# implemented below after the case len(self[:]) = 1) is a list 

# of strings of the form ['Dx1', 'Dx2', ...] and not a unique 

# string of the form 'Dx1 Dx2 ...'. 

# Although 'var' is supposed to accept both syntaxes, the first 

# one causes an error when it contains only one argument, due to 

# line 784 of sage/symbolic/ring.pyx : 

# "return self.symbol(name, latex_name=formatted_latex_name, domain=domain)" 

# In this line, the first argument 'name' of 'symbol' is a list 

# and not a string if the argument of 'var' is a list of one 

# string (of the type ['Dt']), which causes error in 'symbol'. 

# This might be corrected. 

if len(self[:]) == 1: 

string_vel = left + format(self[:][0]) # will raise an error 

# in case left is not a string 

if right is not None: 

string_vel += right # will raise an error in case right 

# is not a string 

 

# If the argument of 'var' contains only one word, for 

# instance: 

# sage: var('Dt') 

# then 'var' does not return a tuple containing one symbolic 

# expression, but the symbolic expression itself. 

# This is taken into account below in order to return a list 

# containing one symbolic expression. 

return [var(string_vel)] 

 

list_strings_velocities = [left + format(coord_func) 

for coord_func in self[:]] # will 

# raise an error in case left is not a string 

 

if right is not None: 

list_strings_velocities = [string_vel + right for string_vel 

in list_strings_velocities] # will 

# raise an error in case right is not a string 

 

return list(var(list_strings_velocities)) 

 

 

 

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

 

class RealDiffChart(DiffChart, RealChart): 

r""" 

Chart on a differentiable manifold over `\RR`. 

 

Given a differentiable manifold `M` of dimension `n` over `\RR`, 

a *chart* is a member `(U,\varphi)` of the manifold's 

differentiable atlas; `U` is then an open subset of `M` and 

`\varphi: U \rightarrow V \subset \RR^n` is a homeomorphism from 

`U` to an open subset `V` of `\RR^n`. 

 

The components `(x^1,\ldots,x^n)` of `\varphi`, defined by 

`\varphi(p) = (x^1(p),\ldots,x^n(p))\in \RR^n` for any point `p\in U`, are 

called the *coordinates* of the chart `(U,\varphi)`. 

 

INPUT: 

 

- ``domain`` -- open subset `U` on which the chart is defined 

- ``coordinates`` -- (default: '' (empty string)) single string defining 

the coordinate symbols and ranges, with ' ' (whitespace) as a separator; 

each item has at most three fields, separated by ':': 

 

1. The coordinate symbol (a letter or a few letters) 

2. (optional) The interval `I` defining the coordinate range: if not 

provided, the coordinate is assumed to span all `\RR`; otherwise 

`I` must be provided in the form ``(a,b)`` (or equivalently 

``]a,b[``). The bounds ``a`` and ``b`` can be ``+/-Infinity``, 

``Inf``, ``infinity``, ``inf`` or ``oo``. 

For *singular* coordinates, non-open intervals such as ``[a,b]`` and 

``(a,b]`` (or equivalently ``]a,b]``) are allowed. 

Note that the interval declaration must not contain any whitespace. 

3. (optional) The LaTeX spelling of the coordinate; if not provided the 

coordinate symbol given in the first field will be used. 

 

The order of the fields 2 and 3 does not matter and each of them can be 

omitted. 

If it contains any LaTeX expression, the string ``coordinates`` must be 

declared with the prefix 'r' (for "raw") to allow for a proper treatment 

of LaTeX backslash characters (see examples below). 

If no interval range and no LaTeX spelling is to be set for any 

coordinate, the argument ``coordinates`` can be omitted when the 

shortcut operator ``<,>`` is used via Sage preparser (see examples below) 

- ``names`` -- (default: ``None``) unused argument, except if 

``coordinates`` is not provided; it must then be a tuple containing 

the coordinate symbols (this is guaranteed if the shortcut operator 

``<,>`` is used). 

- ``calc_method`` -- (default: ``None``) string defining the calculus 

method for computations involving coordinates of the chart; must be 

one of 

 

- ``'SR'``: Sage's default symbolic engine (Symbolic Ring) 

- ``'sympy'``: SymPy 

- ``None``: the default of 

:class:`~sage.manifolds.calculus_method.CalculusMethod` will be 

used 

 

EXAMPLES: 

 

Cartesian coordinates on `\RR^3`:: 

 

sage: M = Manifold(3, 'R^3', r'\RR^3', start_index=1) 

sage: c_cart = M.chart('x y z'); c_cart 

Chart (R^3, (x, y, z)) 

sage: type(c_cart) 

<class 'sage.manifolds.differentiable.chart.RealDiffChart'> 

 

To have the coordinates accessible as global variables, one has to set:: 

 

sage: (x,y,z) = c_cart[:] 

 

However, a shortcut is to use the declarator ``<x,y,z>`` in the left-hand 

side of the chart declaration (there is then no need to pass the string 

``'x y z'`` to ``chart()``):: 

 

sage: M = Manifold(3, 'R^3', r'\RR^3', start_index=1) 

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

Chart (R^3, (x, y, z)) 

 

The coordinates are then immediately accessible:: 

 

sage: y 

y 

sage: y is c_cart[2] 

True 

 

The trick is performed by Sage preparser:: 

 

sage: preparse("c_cart.<x,y,z> = M.chart()") 

"c_cart = M.chart(names=('x', 'y', 'z',)); (x, y, z,) = c_cart._first_ngens(3)" 

 

Note that ``x, y, z`` declared in ``<x,y,z>`` are mere Python variable 

names and do not have to coincide with the coordinate symbols; for instance, 

one may write:: 

 

sage: M = Manifold(3, 'R^3', r'\RR^3', start_index=1) 

sage: c_cart.<x1,y1,z1> = M.chart('x y z'); c_cart 

Chart (R^3, (x, y, z)) 

 

Then ``y`` is not known as a global variable and the coordinate `y` 

is accessible only through the global variable ``y1``:: 

 

sage: y1 

y 

sage: y1 is c_cart[2] 

True 

 

However, having the name of the Python variable coincide with the 

coordinate symbol is quite convenient; so it is recommended to declare:: 

 

sage: forget() # for doctests only 

sage: M = Manifold(3, 'R^3', r'\RR^3', start_index=1) 

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

 

Spherical coordinates on the subset `U` of `\RR^3` that is the 

complement of the half-plane `\{y=0, x\geq 0\}`:: 

 

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

sage: c_spher.<r,th,ph> = U.chart(r'r:(0,+oo) th:(0,pi):\theta ph:(0,2*pi):\phi') 

sage: c_spher 

Chart (U, (r, th, ph)) 

 

Note the prefix 'r' for the string defining the coordinates in the 

arguments of ``chart``. 

 

Coordinates are Sage symbolic variables (see 

:mod:`sage.symbolic.expression`):: 

 

sage: type(th) 

<type 'sage.symbolic.expression.Expression'> 

sage: latex(th) 

{\theta} 

sage: assumptions(th) 

[th is real, th > 0, th < pi] 

 

Coordinate are also accessible by their indices:: 

 

sage: x1 = c_spher[1]; x2 = c_spher[2]; x3 = c_spher[3] 

sage: [x1, x2, x3] 

[r, th, ph] 

sage: (x1, x2, x3) == (r, th, ph) 

True 

 

The full set of coordinates is obtained by means of the operator [:]:: 

 

sage: c_cart[:] 

(x, y, z) 

sage: c_spher[:] 

(r, th, ph) 

 

Let us check that the declared coordinate ranges have been taken into 

account:: 

 

sage: c_cart.coord_range() 

x: (-oo, +oo); y: (-oo, +oo); z: (-oo, +oo) 

sage: c_spher.coord_range() 

r: (0, +oo); th: (0, pi); ph: (0, 2*pi) 

sage: bool(th>0 and th<pi) 

True 

sage: assumptions() # list all current symbolic assumptions 

[x is real, y is real, z is real, r is real, r > 0, th is real, 

th > 0, th < pi, ph is real, ph > 0, ph < 2*pi] 

 

The coordinate ranges are used for simplifications:: 

 

sage: simplify(abs(r)) # r has been declared to lie in the interval (0,+oo) 

r 

sage: simplify(abs(x)) # no positive range has been declared for x 

abs(x) 

 

Each constructed chart is automatically added to the manifold's user atlas:: 

 

sage: M.atlas() 

[Chart (R^3, (x, y, z)), Chart (U, (r, th, ph))] 

 

and to the atlas of its domain:: 

 

sage: U.atlas() 

[Chart (U, (r, th, ph))] 

 

 

Manifold subsets have a *default chart*, which, unless changed via the 

method 

:meth:`~sage.manifolds.manifold.TopologicalManifold.set_default_chart`, 

is the first defined chart on the subset (or on a open subset of it):: 

 

sage: M.default_chart() 

Chart (R^3, (x, y, z)) 

sage: U.default_chart() 

Chart (U, (r, th, ph)) 

 

The default charts are not privileged charts on the manifold, but rather 

charts whose name can be skipped in the argument list of functions having 

an optional ``chart=`` argument. 

 

The action of the chart map `\varphi` on a point is obtained by means of 

the call operator, i.e. the operator ``()``:: 

 

sage: p = M.point((1,0,-2)); p 

Point on the 3-dimensional differentiable manifold R^3 

sage: c_cart(p) 

(1, 0, -2) 

sage: c_cart(p) == p.coord(c_cart) 

True 

sage: q = M.point((2,pi/2,pi/3), chart=c_spher) # point defined by its spherical coordinates 

sage: c_spher(q) 

(2, 1/2*pi, 1/3*pi) 

sage: c_spher(q) == q.coord(c_spher) 

True 

sage: a = U.point((1,pi/2,pi)) # the default coordinates on U are the spherical ones 

sage: c_spher(a) 

(1, 1/2*pi, pi) 

sage: c_spher(a) == a.coord(c_spher) 

True 

 

Cartesian coordinates on `U` as an example of chart construction with 

coordinate restrictions: since `U` is the complement of the half-plane 

`\{y=0, x\geq 0\}`, we must have `y\not=0` or `x<0` on U. Accordingly, 

we set:: 

 

sage: c_cartU.<x,y,z> = U.chart() 

sage: c_cartU.add_restrictions((y!=0, x<0)) # the tuple (y!=0, x<0) means y!=0 or x<0 

sage: # c_cartU.add_restrictions([y!=0, x<0]) would have meant y!=0 AND x<0 

sage: U.atlas() 

[Chart (U, (r, th, ph)), Chart (U, (x, y, z))] 

sage: M.atlas() 

[Chart (R^3, (x, y, z)), Chart (U, (r, th, ph)), Chart (U, (x, y, z))] 

sage: c_cartU.valid_coordinates(-1,0,2) 

True 

sage: c_cartU.valid_coordinates(1,0,2) 

False 

sage: c_cart.valid_coordinates(1,0,2) 

True 

 

A vector frame is naturally associated to each chart:: 

 

sage: c_cart.frame() 

Coordinate frame (R^3, (d/dx,d/dy,d/dz)) 

sage: c_spher.frame() 

Coordinate frame (U, (d/dr,d/dth,d/dph)) 

 

as well as a dual frame (basis of 1-forms):: 

 

sage: c_cart.coframe() 

Coordinate coframe (R^3, (dx,dy,dz)) 

sage: c_spher.coframe() 

Coordinate coframe (U, (dr,dth,dph)) 

 

Chart grids can be drawn in 2D or 3D graphics thanks to the method 

:meth:`~sage.manifolds.chart.RealChart.plot`. 

 

""" 

def __init__(self, domain, coordinates='', names=None, calc_method=None): 

r""" 

Construct a chart on a real differentiable manifold. 

 

TESTS:: 

 

sage: forget() # for doctests only 

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

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

sage: X 

Chart (M, (x, y)) 

sage: type(X) 

<class 'sage.manifolds.differentiable.chart.RealDiffChart'> 

sage: assumptions() # assumptions set in X._init_coordinates 

[x is real, y is real] 

sage: TestSuite(X).run() 

 

""" 

RealChart.__init__(self, domain, coordinates=coordinates, names=names, 

calc_method = calc_method) 

# Construction of the coordinate frame associated to the chart: 

self._frame = CoordFrame(self) 

self._coframe = self._frame._coframe 

 

 

def restrict(self, subset, restrictions=None): 

r""" 

Return the restriction of the chart to some subset. 

 

If the current chart is `(U, \varphi)`, a *restriction* (or 

*subchart*) is a chart `(V, \psi)` such that `V \subset U` 

and `\psi = \varphi |_V`. 

 

If such subchart has not been defined yet, it is constructed here. 

 

The coordinates of the subchart bare the same names as the 

coordinates of the original chart. 

 

INPUT: 

 

- ``subset`` -- open subset `V` of the chart domain `U` 

- ``restrictions`` -- (default: ``None``) list of coordinate 

restrictions defining the subset `V` 

 

A restriction can be any symbolic equality or inequality involving 

the coordinates, such as ``x > y`` or ``x^2 + y^2 != 0``. The items 

of the list ``restrictions`` are combined with the ``and`` operator; 

if some restrictions are to be combined with the ``or`` operator 

instead, they have to be passed as a tuple in some single item 

of the list ``restrictions``. For example:: 

 

restrictions = [x > y, (x != 0, y != 0), z^2 < x] 

 

means ``(x > y) and ((x != 0) or (y != 0)) and (z^2 < x)``. 

If the list ``restrictions`` contains only one item, this 

item can be passed as such, i.e. writing ``x > y`` instead 

of the single element list ``[x > y]``. 

 

OUTPUT: 

 

- a :class:`RealDiffChart` `(V, \psi)` 

 

EXAMPLES: 

 

Cartesian coordinates on the unit open disc in `\RR^2` as a subchart 

of the global Cartesian coordinates:: 

 

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

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

sage: D = M.open_subset('D') # the unit open disc 

sage: c_cart_D = c_cart.restrict(D, x^2+y^2<1) 

sage: p = M.point((1/2, 0)) 

sage: p in D 

True 

sage: q = M.point((1, 2)) 

sage: q in D 

False 

 

Cartesian coordinates on the annulus `1 < \sqrt{x^2+y^2} < 2`:: 

 

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

sage: c_cart_A = c_cart.restrict(A, [x^2+y^2>1, x^2+y^2<4]) 

sage: p in A, q in A 

(False, False) 

sage: a = M.point((3/2,0)) 

sage: a in A 

True 

 

""" 

if subset == self._domain: 

return self 

if subset not in self._dom_restrict: 

resu = RealChart.restrict(self, subset, restrictions=restrictions) 

# Update of superframes and subframes: 

resu._frame._superframes.update(self._frame._superframes) 

for sframe in self._frame._superframes: 

sframe._subframes.add(resu._frame) 

sframe._restrictions[subset] = resu._frame 

# The subchart frame is not a "top frame" in the supersets 

# (including self._domain): 

for dom in self._domain._supersets: 

if resu._frame in dom._top_frames: 

# it was added by the Chart constructor invoked in 

# Chart.restrict above 

dom._top_frames.remove(resu._frame) 

return self._dom_restrict[subset] 

 

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

 

class DiffCoordChange(CoordChange): 

r""" 

Transition map between two charts of a differentiable manifold. 

 

Giving two coordinate charts `(U,\varphi)` and `(V,\psi)` on a 

differentiable manifold `M` of dimension `n` over a topological field `K`, 

the *transition map from* `(U,\varphi)` *to* `(V,\psi)` is the map 

 

.. MATH:: 

 

\psi\circ\varphi^{-1}: \varphi(U\cap V) \subset K^n 

\rightarrow \psi(U\cap V) \subset K^n, 

 

In other words, the transition map `\psi\circ\varphi^{-1}` expresses the 

coordinates `(y^1,\ldots,y^n)` of `(V,\psi)` in terms of the coordinates 

`(x^1,\ldots,x^n)` of `(U,\varphi)` on the open subset where the two 

charts intersect, i.e. on `U\cap V`. 

 

By definition, the transition map `\psi\circ\varphi^{-1}` must be 

of classe `C^k`, where `k` is the degree of differentiability of the 

manifold (cf. 

:meth:`~sage.manifolds.differentiable.manifold.DifferentiableManifold.diff_degree`). 

 

INPUT: 

 

- ``chart1`` -- chart `(U,\varphi)` 

- ``chart2`` -- chart `(V,\psi)` 

- ``transformations`` -- tuple (or list) `(Y_1,\ldots,Y_2)`, where 

`Y_i` is the symbolic expression of the coordinate `y^i` in terms 

of the coordinates `(x^1,\ldots,x^n)` 

 

EXAMPLES: 

 

Transition map on a 2-dimensional differentiable manifold:: 

 

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

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

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

sage: X_to_Y = X.transition_map(Y, [x+y, x-y]) 

sage: X_to_Y 

Change of coordinates from Chart (M, (x, y)) to Chart (M, (u, v)) 

sage: type(X_to_Y) 

<class 'sage.manifolds.differentiable.chart.DiffCoordChange'> 

sage: X_to_Y.display() 

u = x + y 

v = x - y 

 

""" 

def __init__(self, chart1, chart2, *transformations): 

r""" 

Construct a transition map. 

 

TESTS:: 

 

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

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

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

sage: X_to_Y = X.transition_map(Y, [x+y, x-y]) 

sage: X_to_Y 

Change of coordinates from Chart (M, (x, y)) to Chart (M, (u, v)) 

sage: type(X_to_Y) 

<class 'sage.manifolds.differentiable.chart.DiffCoordChange'> 

sage: TestSuite(X_to_Y).run(skip='_test_pickling') 

 

.. TODO:: 

 

fix _test_pickling 

 

""" 

CoordChange.__init__(self, chart1, chart2, *transformations) 

# Jacobian matrix: 

self._jacobian = self._transf.jacobian() 

# If the two charts are on the same open subset, the Jacobian matrix is 

# added to the dictionary of changes of frame: 

if chart1._domain == chart2._domain: 

domain = chart1._domain 

frame1 = chart1._frame 

frame2 = chart2._frame 

vf_module = domain.vector_field_module() 

ch_basis = vf_module.automorphism() 

ch_basis.add_comp(frame1)[:, chart1] = self._jacobian 

ch_basis.add_comp(frame2)[:, chart1] = self._jacobian 

vf_module._basis_changes[(frame2, frame1)] = ch_basis 

for sdom in domain._supersets: 

sdom._frame_changes[(frame2, frame1)] = ch_basis 

# The inverse is computed only if it does not exist already 

# (because if it exists it may have a simpler expression than that 

# obtained from the matrix inverse) 

if (frame1, frame2) not in vf_module._basis_changes: 

ch_basis_inv = ch_basis.inverse() 

vf_module._basis_changes[(frame1, frame2)] = ch_basis_inv 

for sdom in domain._supersets: 

sdom._frame_changes[(frame1, frame2)] = ch_basis_inv 

 

def jacobian(self): 

r""" 

Return the Jacobian matrix of ``self``. 

 

If ``self`` corresponds to the change of coordinates 

 

.. MATH:: 

 

y^i = Y^i(x^1,\ldots,x^n)\qquad 1\leq i \leq n 

 

the Jacobian matrix `J` is given by 

 

.. MATH:: 

 

J_{ij} = \frac{\partial Y^i}{\partial x^j} 

 

where `i` is the row index and `j` the column one. 

 

OUTPUT: 

 

- Jacobian matrix `J`, the elements `J_{ij}` of which being 

coordinate functions 

(cf. :class:`~sage.manifolds.chart_func.ChartFunction`) 

 

EXAMPLES: 

 

Jacobian matrix of a 2-dimensional transition map:: 

 

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

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

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

sage: X_to_Y = X.transition_map(Y, [x+y^2, 3*x-y]) 

sage: X_to_Y.jacobian() 

[ 1 2*y] 

[ 3 -1] 

 

Each element of the Jacobian matrix is a coordinate function:: 

 

sage: parent(X_to_Y.jacobian()[0,0]) 

Ring of chart functions on Chart (M, (x, y)) 

 

""" 

return self._jacobian # has been computed in __init__ 

 

@cached_method 

def jacobian_det(self): 

r""" 

Return the Jacobian determinant of ``self``. 

 

The Jacobian determinant is the determinant of the Jacobian 

matrix (see :meth:`jacobian`). 

 

OUTPUT: 

 

- determinant of the Jacobian matrix `J` as a coordinate 

function 

(cf. :class:`~sage.manifolds.chart_func.ChartFunction`) 

 

EXAMPLES: 

 

Jacobian determinant of a 2-dimensional transition map:: 

 

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

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

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

sage: X_to_Y = X.transition_map(Y, [x+y^2, 3*x-y]) 

sage: X_to_Y.jacobian_det() 

-6*y - 1 

sage: X_to_Y.jacobian_det() == det(X_to_Y.jacobian()) 

True 

 

The Jacobian determinant is a coordinate function:: 

 

sage: parent(X_to_Y.jacobian_det()) 

Ring of chart functions on Chart (M, (x, y)) 

 

""" 

return self._transf.jacobian_det()