Question
Python A linear equation of n variables can be represented as a list of n floats. For example 2x+3y+1.4z=6 can be represented as [2, 3,
Python
A linear equation of n variables can be represented as a list of n floats. For example 2x+3y+1.4z=6 can be represented as [2, 3, 1.4, 6] and systems of linear equations like 3x+3y=2, 5x+3y=8 can be represented as lists of lists as [[3,3,2,...],[5,3,8,...]]. Write a function equan(a) that takes a system of linear equations as an input list of lists and modifies the input by multiplying each of its rows by a scalar such that each diagonal entry will be equal to one. For example, the statement: a=[[3,4,5],[6,7,8]] equan(a) print(a) outputs [1, 4/3, 5/3],[6/7, 1 , 8/7] since equan divides the elements in the first list by 3 and the second list by 7 such that a[0][0] and a[1][1] (diagonal entries) are equal to one.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started