Ask Your Question
1

simplify fractions in a matrix

asked 2023-08-11 08:50:57 +0200

tanyanlan gravatar image

Here is the code I used in SageMath computations.

var('a11,a12,a21,a22,b1,b2')

A = matrix([[a11,a12,b1],[a21,a22,b2]])

A.add_multiple_of_row(1,0,-a21/a11)

pretty_print(A)

The output is as follows. image description

Is it possible to simplify the entries in the form a/b?

Thanks for your time.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2023-08-11 11:03:50 +0200

Emmanuel Charpentier gravatar image

You want to factor A's elements :

sage: A.apply_map(factor)
[                     a11                      a12                       b1]
[                       0 -(a12*a21 - a11*a22)/a11   -(a21*b1 - a11*b2)/a11]

(ask.agemath.org's Mathjiax interpreter won't display this matrix correctly...).

HTH,

edit flag offensive delete link more

Comments

Thank you so much! It works.

tanyanlan gravatar imagetanyanlan ( 2023-08-11 15:32:56 +0200 )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: 2023-08-11 08:50:57 +0200

Seen: 122 times

Last updated: Aug 11 '23