Post Reply 
Programming Challenge: a classic trigonometry problem
03-18-2023, 08:15 PM (This post was last modified: 03-19-2023 11:41 PM by Albert Chan.)
Post: #39
RE: Programming Challenge: a classic trigonometry problem
(03-07-2023 06:43 PM)Albert Chan Wrote:  max(c) = max(u*v/(u+v)) = a*b/(a+b)
min(c) = min(u*v/(u+v)) = u*0/(u+0) = 0

When y is small, (|u'|, |v'|) are relatively small, due to dominated constants, (a,b).
When y close to b², |v'| goes infinite, and c goes to 0 like fallen down a cliff.
This explains why f(y) look like a straight line, except when y very close to b²

We expect u*v/(u+v) concave-down, shaped like a quarter ellipse.

c/max(c) ≥ 1 - y/b²      // equality at the edges, y = 0 or b²

y ≥ (lo = b² * (1 - c*(a+b)/(a*b)))

Something magical just happened Smile

From plots, it is obvious w = u*v/(u+v), as a function of y, concave down.
(location where w = c is the y we seek: 1/u + 1/v = 1/c)

Out of curiosity, I tried to plot w^2 vs y.
It look like a striaght line, only noticeably concave down when y close to b².
If true, we have an even better low y:

(c/max(c))² ≥ 1 - y/b²      → y ≥ (lo = b² * (1 - (c/max(c))²))

I tried to prove this, (w^2)'' < 0, but gave up because too many variables to juggle.
We can make length dimensionless, say all as ratio to a, but that still leave b and c.

My previous post, by plain luck, solved this! (all variables combined as ratio, q = u/v)
To make prove robust, we need to fill in inequality sign ... but thats it!

All is needed is to confirm both ways (low y from q, or concave down w²) are equivalent.

CAS> assume(a>=b); assume(b>=c); assume(c>=0)
CAS> k := (a+b)*(a-b)/(c*c)
CAS> cmax := a*b/(a+b)
CAS> u := c*(1+q)
CAS> yq := a*a - u*u

CAS> q := -1 + sqrt(k + (1+b/a)^2)  /* q high guess, from previous post */
CAS> y := b*b * (1 - (c/cmax)^2)      /* lo = b*b - c*c * (1+b/a)^2 */
CAS> simplify(y - yq)                  → 0

These are the y equivalent of previous post other q guesses.

CAS> q := -1 + sqrt(k + (1-c/a)^-2)  /* q low guess, from previous post */
CAS> y := b*b - (a*c/(a-c))^2           /* hi = b*b - c*c * (1-c/a)^-2 */
CAS> simplify(y - yq)                  → 0

CAS> q := -1 + sqrt(k + (a+b)/(a-c)) /* q middle guess, from previous post */
CAS> y := b*b - c*c * (a+b)/(a-c)
CAS> simplify(y - yq)                  → 0

Last y expression is simple, and pretty good rough guess.

CAS> y(a=40., b=30., c=15.)      → 270.0
CAS> sqrt(Ans)                          → 16.4316767252      // true x = 15.9876490086
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Programming Challenge: a classic trigonometry problem - Albert Chan - 03-18-2023 08:15 PM



User(s) browsing this thread: 1 Guest(s)