print(rect in patch.coord_systems) polar.connect_to(rect, [r, theta], [r*cos(theta), r*sin(theta)]) print(polar.coord_tuple_transform_to(rect, [0, 2])) print(polar.coord_tuple_transform_to(rect, [2, pi/2])) print(rect.coord_tuple_transform_to(polar, [1, 1]).applyfunc(simplify)) print(polar.jacobian(rect, [r, theta])) p = polar.point([1, 3*pi/4]) print(rect.point_to_coords(p)) print(rect.coord_function(0)(p)) print(rect.coord_function(1)(p)) v_x = rect.base_vector(0) x = rect.coord_function(0) print(v_x(x)) print(v_x(v_x(x))) v_r = polar.base_vector(0) print(v_r(x)) # ^ ???? dx = rect.base_oneform(0) print(dx(v_x)) # ???? # Skipped some stuff...
patch = Patch('P', m) rect = CoordSystem('rect', patch) polar = CoordSystem('polar', patch) rect in patch.coord_systems polar.connect_to(rect, [r, theta], [r*cos(theta), r*sin(theta)]) polar.coord_tuple_transform_to(rect, [0, 2]) polar.coord_tuple_transform_to(rect, [2, pi/2]) rect.coord_tuple_transform_to(polar, [1, 1]) polar.jacobian(rect, [r, theta]) p = polar.point([1, 3*pi/4]) rect.point_to_coords(p) #Define a basis scalar field (i.e. a coordinate function), that takes a point and returns its coordinates. It is an instance of BaseScalarField. rect.coord_function(0)(p) rect.coord_function(1)(p) #Define a basis vector field (i.e. a unit vector field along the coordinate line). Vectors are also differential operators on scalar fields. It is an instance of BaseVectorField. v_x = rect.base_vector(0) x = rect.coord_function(0) v_x(x) v_x(v_x(x)) #Define a basis oneform field: dx = rect.base_oneform(0) dx(v_x) #If you provide a list of names the fields will print nicely: - without provided names: x, v_x, dx #with provided names rect = CoordSystem('rect', patch, ['x', 'y']) rect.coord_function(0), rect.base_vector(0), rect.base_oneform(0) # Examples from sympy import symbols, sin, cos, pi from sympy.diffgeom import ( Manifold, Patch, CoordSystem, Point)