Programming Challenge: a classic trigonometry problem
|
03-18-2023, 03:49 PM
Post: #38
|
|||
|
|||
RE: Programming Challenge: a classic trigonometry problem
(03-12-2023 05:18 AM)Albert Chan Wrote: edge(1/v) = 1/c ± 1/a = (1 ± c/a) / c There are many ways to look at effect at the edges. edge(v/c) = (1 ± c/a)^-1, with -1 power, gives minimum guess for q Here is another way. edge(v/c) = edge(1+1/q) = (1 ± b/a), should gives maximum guess for q (1+q) = ±√((a²-b²)/c² + (v/c)²), with both ways for edge(v/c), we have: lua> S = require2'solver' lua> Q = fn'q: (1+q)^2*(1-q^-2) - k' lua> a, b, c = 40, 30, 15 lua> k = (a+b)*(a-b)/(c*c) lua> eps = -1e-9 -- swap worse point as first lua> S.secant(Q, -1+sqrt(k+(1-c/a)^-2), -1+sqrt(k+(1+b/a)^2), eps, true) 1.3814094799322336 1.4846752526459288 1.4445475888872654 1.4443992821167904 1.4443995665205573 1.4443995665182763 1.4443995665182763 lua> S.secant(Q, -1-sqrt(k+(1+c/a)^-2), -1-sqrt(k+(1-b/a)^2), eps, true) -2.907888028932993 -2.781463193869329 -- points swapped -2.8799914833475135 -2.8807791881861102 -2.8807853504286443 -2.8807853490169144 -2.880785349016917 -2.880785349016917 The 2 guesses are asymptote of extreme cases. Minimum q guess is better when k is huge Maximum q guess is better when k is tiny. For middle ground, we may use geometric mean of 2 edge(v/c): q ≈ -1 ± sqrt(k + (±a+b)/(±a-c)) |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)