If i have a 22 by 25 table of values which depend on n and r, and a list of values that depends on r that is a 22 by 1 matrix, how can I find the percent difference between each element, by row in the matrix.
For instances, finding the percent difference for each element in the top row of the 22 by 25 matrix with respect to the first value from the 22 element vector.
here is the code:
ClearAll["Global`*"]
ω = 50;
c = 299792458;
λ = 400;
t1 := (2*Pi*r)/(c + ω*r);
t2 := (2*Pi*r)/(c - ω *r);
t21 = t2/t1;
δtc = N[Table[t2 - t1, {r, 1, 22, 1}], 10];
invδtc = Reverse[N[Table[t2 - t1, {r, 1, 22, 1}], 10]];
A := (n r^2*Sin[(2*Pi)/n])/2;
δtp = N[Table[(4*ω*A)/c^2, {r, 1, 22}, {n, 3, 26}],10];
diff = N[Table[((δtc - δtp)/δtc)*100, {r, 1, 22}, {n, 3,26}], 10];
Here is my results, as u can see every row has the same answer, which obviously does not make sense:
Set Delayed
(i..e,:=
) instead of Set (=
) when defining t1, t2, and A. $\endgroup$