FastPrepFastPrep
Problem Brief

Solve Matrix Equations (Also for AI/ML Interns :)

INTERNOA

Write a Python Program using SciPy that solves the equation X = A*B*C, given X, B, and C, as input. In the equation, X is a scalar, A is the unknown 1x2 vector, B is a 2x2 matrix, and C is a 2x1 vector. The two elements of A have the relationship A[1] = 1 - A[0]. Find the value of vector A.

Function Description

Complete the function findA in the editor below.

findA has the following parameter(s):

  1. float X: the value of X.
  2. float B[2][2]: the matrix B.
  3. float C[2][1]: the vector C.

Returns

float[2]: an array containing the two values A[0] and A[1].

1Example 1

Input
X = 0.35, B = [[3, -1], [-2, 3]], C = [0.2, 0.8]
Output
[0.75, 0.25]
Explanation
After solving the equation X = A*B*C under the constraints A[1] = 1 - A[0], the value of the vector A = [[0.75, 0.25]]. The values of A should be rounded to two decimal places.

Constraints

Limits and guarantees your solution can rely on.

🌺🌺
public float[] findA(float X, float[][] B, float[][] C) {
 // Write your code here 
}
    
Input

X

0.35

B

[[3, -1], [-2, 3]]

C

[0.2, 0.8]

Output

[0.75, 0.25]

Sign in to submit your solution.