首页 > > 详细

Help With R Experiment ,R Programming Help,Writing R Homework ,R Programming Help,Help R Programmin

A4: Question 2
In Question 2 you will calculate the matrix associated to a linear
transformation.
In the procedure you will have the following input:
 an integer parameter k;
 two square matrices B and C, both of size n×n (for some integer n),
that will be read in from input files chosen using the parameter k. The
columns of B are the vectors b1,…,bn, and they form. a basis for Rn.
The columns of C are the vectors c1,…,cn.
We assume that T:Rn→Rn is a linear transformation satisfying T(bi)=ci for all
1≤i≤n.
Your task: Calculate the matrix A associated to T; that is, find the matrix A
that satisfies T(x)=Ax for all x∈ Rn.
You must write a procedure that returns the matrix A.
Running your code:
When you press "Run", you will first be prompted to enter the integer
parameter k. To test your program, you should only enter either 1, 2, or 3.
However, please note that when you click submit, your program will be tested
using other values of k, and so your code should cater for any positive integer
k. (In fact, the value of k has nothing to do with the size of the matrices B and
C, so you shouldn't refer to it in the code you write at all.)
After you enter k, two matrices B and C will be generated. In the cases k=1,
k=2, and k=3, the matrices B and C will be uploaded from the files
matrixB1.in and matrixC1.in, matrixB2.in and matrixC2.in, and
matrixB3.in and matrixC3.in, respectively. You may run your code as many
times as you like.
Expected output:
The scaffold code is set up to print the matrix A, with each entry rounded to the
nearest integer.
Please note that you must not write code that displays any output other
than the output produced by the scaffold code. Recall that a semicolon (;)
at the end of a line suppresses any output from that line.
How your code will be marked:
When you press "Submit", your code will be tested on several test inputs,
including some hidden test inputs.
Note that if you fail one of the tests, the testing process will stop and your code
will not be tested on the remaining tests. You have completed the question
when all of the tests have passed.






 

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!