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

r""" 

Open subset of Euclidian space with coordinates 

 

An open subset of Euclidian space with a specific set of coordinates. This 

is the background on which differential forms can be defined. 

 

AUTHORS: 

 

- Joris Vankerschaver (2010-07-25) 

 

EXAMPLES:: 

 

sage: x, y, z = var('x, y, z') 

sage: S = CoordinatePatch((x, y, z)); S 

doctest:...: DeprecationWarning: Use Manifold instead. 

See http://trac.sagemath.org/24444 for details. 

Open subset of R^3 with coordinates x, y, z 

 

:: 

 

sage: u, v = var('u, v') 

sage: S = CoordinatePatch((u, v)); S 

Open subset of R^2 with coordinates u, v 

 

TODO: 

 

- Add functionality for metric tensors 

 

""" 

 

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

# Copyright (C) 2010 Joris Vankerschaver <joris.vankerschaver@gmail.com> 

# 

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

# 

# This code is distributed in the hope that it will be useful, 

# but WITHOUT ANY WARRANTY; without even the implied warranty of 

# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 

# General Public License for more details. 

# 

# The full text of the GPL is available at: 

# 

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

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

 

 

from sage.structure.parent import Parent 

 

class CoordinatePatch(Parent): 

""" 

Construct a coordinate patch, i.e. an open subset of 

Euclidian space with a given set of coordinates. 

 

EXAMPLES:: 

 

sage: x, y, z = var('x, y, z') 

sage: S = CoordinatePatch((x, y, z)); S 

doctest:...: DeprecationWarning: Use Manifold instead. 

See http://trac.sagemath.org/24444 for details. 

Open subset of R^3 with coordinates x, y, z 

 

sage: u, v = var('u, v') 

sage: T = CoordinatePatch((u, v)); T 

Open subset of R^2 with coordinates u, v 

sage: loads(T.dumps()) == T 

True 

 

In a future release, it will be possible to specify a 

metric tensor on a coordinate patch. For now, providing 

any kind of metric raises an exception:: 

 

sage: x, y, z = var('x, y, z') 

sage: m = matrix(SR, 3) 

sage: S = CoordinatePatch((x, y, z), metric=m) 

Traceback (most recent call last): 

... 

NotImplementedError: Metric geometry not supported yet. 

 

""" 

def __init__(self, coordinates, metric = None): 

""" 

An open subset of Euclidian space with a specific set of 

coordinates. See ``CoordinatePatch`` for details. 

 

INPUT: 

 

- ``coordinates`` -- a set of symbolic variables that serve 

as coordinates on this space. 

 

- ``metric`` (default: ``None``) -- a metric tensor on this 

coordinate patch. Providing anything other than ``None`` 

is currently not defined. 

 

EXAMPLES:: 

 

sage: x, y, z = var('x, y, z') 

sage: S = CoordinatePatch((x, y, z)); S 

doctest:...: DeprecationWarning: Use Manifold instead. 

See http://trac.sagemath.org/24444 for details. 

Open subset of R^3 with coordinates x, y, z 

""" 

from sage.symbolic.ring import is_SymbolicVariable 

from sage.misc.superseded import deprecation 

deprecation(24444, 'Use Manifold instead.') 

 

if not all(is_SymbolicVariable(c) for c in coordinates): 

raise TypeError("%s is not a valid vector of coordinates." % \ 

coordinates) 

 

self._coordinates = tuple(coordinates) 

dim = len(self._coordinates) 

 

if metric is not None: 

raise NotImplementedError("Metric geometry not supported yet.") 

 

def __eq__(self, other): 

""" 

Return equality if and only if other has the same coordinates 

as self, in the same order. 

 

EXAMPLES:: 

 

sage: x, y, z = var('x, y, z') 

sage: S = CoordinatePatch((x, y, z)); S 

doctest:...: DeprecationWarning: Use Manifold instead. 

See http://trac.sagemath.org/24444 for details. 

Open subset of R^3 with coordinates x, y, z 

sage: u, v = var('u, v') 

sage: T = CoordinatePatch((u, v)); T 

Open subset of R^2 with coordinates u, v 

sage: U = CoordinatePatch((x, y, z)); U 

Open subset of R^3 with coordinates x, y, z 

sage: U == S 

True 

sage: U == U 

True 

sage: U == T 

False 

 

Note that the order of the coordinates matters:: 

 

sage: x, y, z = var('x, y, z') 

sage: S = CoordinatePatch((x, y, z)); S 

Open subset of R^3 with coordinates x, y, z 

sage: T = CoordinatePatch((x, z, y)); T 

Open subset of R^3 with coordinates x, z, y 

sage: S == T 

False 

""" 

 

return str(self._coordinates) == str(other._coordinates) 

 

 

def __ne__(self, other): 

""" 

Test whether two coordinate patches are not equal. 

 

EXAMPLES:: 

 

sage: x, y, z = var('x, y, z') 

sage: S = CoordinatePatch((x, y, z)); S 

doctest:...: DeprecationWarning: Use Manifold instead. 

See http://trac.sagemath.org/24444 for details. 

Open subset of R^3 with coordinates x, y, z 

sage: u, v = var('u, v') 

sage: T = CoordinatePatch((u, v)); T 

Open subset of R^2 with coordinates u, v 

sage: S != T 

True 

""" 

return not self == other 

 

def coordinates(self): 

""" 

Return coordinates on this coordinate patch. 

 

OUTPUT: 

 

- list -- a list of coordinates on this space. 

 

EXAMPLES:: 

 

sage: x, y, z = var('x, y, z') 

sage: S = CoordinatePatch((x, y, z)); S 

doctest:...: DeprecationWarning: Use Manifold instead. 

See http://trac.sagemath.org/24444 for details. 

Open subset of R^3 with coordinates x, y, z 

sage: S.coordinates() 

(x, y, z) 

 

""" 

return self._coordinates 

 

 

def coordinate(self, i=0): 

""" 

Return the `i^{th}` coordinate on ``self`` 

 

INPUT: 

 

- ``i`` - integer (optional, default 0) 

 

 

EXAMPLES:: 

 

sage: x, y, z = var('x, y, z') 

sage: S = CoordinatePatch((x, y, z)); S 

doctest:...: DeprecationWarning: Use Manifold instead. 

See http://trac.sagemath.org/24444 for details. 

Open subset of R^3 with coordinates x, y, z 

sage: S.coordinate(0) 

x 

sage: S.coordinate(1) 

y 

sage: S.coordinate(2) 

z 

 

""" 

return self._coordinates[i] 

 

 

def dim(self): 

""" 

Return the dimension of this coordinate patch, i.e. the dimension 

of the Euclidian space of which this coordinate patch is an open 

subset. 

 

EXAMPLES:: 

 

sage: a, b, c, d, e = var('a, b, c, d, e') 

sage: U = CoordinatePatch((a, b, c, d, e)); U 

doctest:...: DeprecationWarning: Use Manifold instead. 

See http://trac.sagemath.org/24444 for details. 

Open subset of R^5 with coordinates a, b, c, d, e 

sage: U.dim() 

5 

""" 

return len(self._coordinates) 

 

 

def _repr_(self): 

r""" 

Return string representation of this coordinate patch. 

 

EXAMPLES:: 

 

sage: x, y, z = var('x, y, z') 

sage: S = CoordinatePatch((x, y, z)); S 

doctest:...: DeprecationWarning: Use Manifold instead. 

See http://trac.sagemath.org/24444 for details. 

Open subset of R^3 with coordinates x, y, z 

sage: S._repr_() 

'Open subset of R^3 with coordinates x, y, z' 

sage: S.rename('coordinate patch'); S 

coordinate patch 

sage: S.rename(); S 

Open subset of R^3 with coordinates x, y, z 

""" 

return r"Open subset of R^%s with coordinates %s" % \ 

(self.dim(), ', '.join([x._latex_() for x in self._coordinates])) 

 

 

def _latex_(self): 

r""" 

Return latex representation of this coordinate patch. 

 

EXAMPLES:: 

 

sage: x, y, z = var('x, y, z') 

sage: S = CoordinatePatch((x, y, z)); S 

doctest:...: DeprecationWarning: Use Manifold instead. 

See http://trac.sagemath.org/24444 for details. 

Open subset of R^3 with coordinates x, y, z 

sage: latex(S) 

\mathbb{\RR}^3 

sage: latex(S) == S._latex_() 

True 

""" 

return "\\mathbb{\RR}^%s" % self.dim()