Ask Your Question
0

Straight line parametrization with diff_map

asked 2018-03-14 18:35:35 +0100

danielvolinski gravatar image

I have the following code:

R2 = Manifold(2, 'R2', latex_name=r'\mathbb{R}^2')
cartesian2d.<x,y> = R2.chart()
R1 = Manifold(1, 'R1', start_index=1, latex_name=r'\mathbb{R}')
cartesian1d.<t> = R1.chart()
A = R2.point((3,2), chart=cartesian2d, name='A')
B = R2.point((-1,2), chart=cartesian2d, name='B')
C_1 = R1.diff_map(R2, t*B.coord()+(1-t)*A.coord())

The last line issues an error TypeError: unable to convert t to an integer.

I want to define a parametrization of a straight line from point A at t=0 to point B at t=1. How to do that?

Daniel

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-03-15 12:04:58 +0100

eric_g gravatar image

That's because B.coord() returns a tuple, so that the multiplication t*B.coord() is interpreted as a tuple multiplication, which has meaning only if t is an integer, with a result different from what you had in mind:

sage: B.coord()
(-1, 2)
sage: 3*B.coord()
(-1, 2, -1, 2, -1, 2)

So a solution is

sage: C_1 = R1.diff_map(R2, [t*B.coord()[i] + (1-t)*A.coord()[i] for i in range(2)])
sage: C_1.display()
R1 --> R2
   t |--> (x, y) = (-4*t + 3, 2)
edit flag offensive delete link more

Comments

Thanks Eric.

I think SageMath should be able to handle tuple arithmetic, like sum and multiplication by a scalar. This could be very useful.

Daniel

danielvolinski gravatar imagedanielvolinski ( 2018-03-15 13:08:46 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-03-14 18:35:35 +0100

Seen: 243 times

Last updated: Mar 15 '18