velsd
New Member
Posts: 5
|
Post by velsd on Dec 6, 2021 19:33:38 GMT
Hello, I have an issue with the suggested exercise on page 77.
I tried to calculate an example with matlab, and came up with
syms n x k n = 49; x = 1.05; k = 0.5; phi = atan(-1 / k); sq = sqrt(1 + (k^2)); bigX = k - x; t = 0; for j=0:n y = vpa((bigX^j) * -sin((j + 1) * phi) / (sq^(j+1))); t = vpa(t + y); end disp('t=') disp(t) disp('r=') disp(1 / (1 + (x^2)))
which results in t= 0.47562425683709879178746666363052 r= 0.4756
so, ok , the series (t) matches the straight calculation (r).
But 1. I have to use a minus sign on the sin; which I can more or less justify in the attached document 2. I have to do bigX = k – x;
instead of
bigX = x - k ;
as in the book
Could you perhaps point out to me where I have misunderstood something?
As the calculation seems to be correct, but does not equal the text in the book... regards, Danny.
|
|
|
Post by Admin on Dec 6, 2021 20:41:25 GMT
Hi Danny Welcome to the forum! I haven't checked this mathematically, but remember that on line 3 on page 77 it says "where $\phi=\text{arg}(i-k)$ is the appropriate value of $\tan^{-1}(-1/k)$" Notice the word "appropriate". This is because given the value of a tangent doesn't uniquely determine the angle. Programming functions like "atan" usually produce what are called the principal values where the angle will lie between $-\pi/2$ and $\pi/2$. All this means that you need to make a decision about which of the infinite possible values of $\phi$ is the "appropriate" one. Try displaying the value of phi in your program to test my idea.
Vasco
|
|
velsd
New Member
Posts: 5
|
Post by velsd on Dec 8, 2021 16:02:09 GMT
ok, got it. I first made a silly calculation error that persuaded me without reason the sin should really have a negative sign. And then a misunderstanding of the atan function confirmed me in my erroneous result, indeed. So , since
phi = arg (i - k)
and the matlab documentation says "P = atan2(Y,X) returns the four-quadrant inverse tangent (tan-1) of Y and X, which must be real. " the correct calculation for the angle phi is phi = atan2(1, -k) so now the following gives a correct result : syms n x k n = 49; x = 1.05; k = 0.5; phi = atan2(1, -k) < - - 2.0344 sq = sqrt(1 + (k^2)); bigX = x - k; t = 0; for j=0:n y = (bigX^j) * sin((j + 1) * phi) / (sq^(j+1)); t = t + y; end disp(t) < - - 0.4756 disp(1 / (1 + (x^2))) < - - 0.4756
thank you for your response and the clues that led to the answer!
|
|
|
Post by Admin on Dec 8, 2021 16:14:19 GMT
Glad I could help and glad you managed to sort it out. It's very easy to forget that the inverse trig functions are multifunctions and inbuilt functions like atan, asin etc need to be used carefully to produce the right results.
Vasco
|
|