Why does backslash behave differently when transposition is used in-line?
Hello, in the process of creating a problem for my students in a numerical methods class I found out that the backslash operation produces different results if you solve A^{T}x=b as "x=(A’)b" when compared to first defining "AT=A’" and then solving as "x=ATb". An example is given below. Order of operations suggests that in the first case, A should be transposed and then the backslash operation performed, which is forced in the second case. One would expect the results to then be the same. Why is there a difference at all?
n = 15;
m = 2*n+1;
t = fliplr(cos(pi/(n)*(0:n))).’;
A = [t.^(0:m);
t.^([0,0:m-1])*diag(max(0,0:m))];
b = (1./((0:m)’+1).*((1).^((0:m)’+1)-(-1).^(((0:m)’+1))));
x = (A’)b;
AT = A’;
x2 = ATb;
difference = norm(x-x2)Hello, in the process of creating a problem for my students in a numerical methods class I found out that the backslash operation produces different results if you solve A^{T}x=b as "x=(A’)b" when compared to first defining "AT=A’" and then solving as "x=ATb". An example is given below. Order of operations suggests that in the first case, A should be transposed and then the backslash operation performed, which is forced in the second case. One would expect the results to then be the same. Why is there a difference at all?
n = 15;
m = 2*n+1;
t = fliplr(cos(pi/(n)*(0:n))).’;
A = [t.^(0:m);
t.^([0,0:m-1])*diag(max(0,0:m))];
b = (1./((0:m)’+1).*((1).^((0:m)’+1)-(-1).^(((0:m)’+1))));
x = (A’)b;
AT = A’;
x2 = ATb;
difference = norm(x-x2) Hello, in the process of creating a problem for my students in a numerical methods class I found out that the backslash operation produces different results if you solve A^{T}x=b as "x=(A’)b" when compared to first defining "AT=A’" and then solving as "x=ATb". An example is given below. Order of operations suggests that in the first case, A should be transposed and then the backslash operation performed, which is forced in the second case. One would expect the results to then be the same. Why is there a difference at all?
n = 15;
m = 2*n+1;
t = fliplr(cos(pi/(n)*(0:n))).’;
A = [t.^(0:m);
t.^([0,0:m-1])*diag(max(0,0:m))];
b = (1./((0:m)’+1).*((1).^((0:m)’+1)-(-1).^(((0:m)’+1))));
x = (A’)b;
AT = A’;
x2 = ATb;
difference = norm(x-x2) backslash, transpose MATLAB Answers — New Questions









