RE: [math-fun] perfect squares
I think DTs formula below isn't quite right; taking each clause as a 50:50 coin flip, the conjunctions are 1/8 true, and the disjunction only 1/4, while I'd expect 50%. Looking at the last couple of lines of MLBs listing of a+bsqrt2 in order, there seem to be 2 steps: add either -7+5sqrt2 or 3-2sqrt2 to the current number. Presumably, the good algorithm will have three or four candidate steps, to be tried in order, and the first step that keeps all the coordinates non-negative is accepted. Messy details to fill in: the rules for using the continued fraction expansion to create the step list, when to introduce new steps and discard old ones, and the appropriate generalization to 3D. Rich -----Original Message----- From: Marc LeBrun [mailto:mlb@fxpt.com] Sent: Monday, July 12, 2004 10:34 AM To: math-fun Subject: Re: [math-fun] perfect squares
=Dylan Thurston What's wrong with (p-r > 0 && q-s > 0 && (p-r)^2 < k*(q-s)^2) || (p-r < 0 && q-s < 0 && (p-r)^2 > k*(q-s)^2) ? [As before, x = sqrt(k)]
Nothing's wrong, but is there any "good" reason for why it's so complicated? By comparison, p/q < r/s is much simpler. The forms p+qx seem in some sense "morally equivalent" to p/q (for example they "induce" the reals similarly). Square testing, simple ordering, whatever: p+qx always seems to get "casey".
=Marc LeBrun Heck, I'd even pay $50 for an easy way to generate a+bx in increasing order for a,b >=0 (if you think you have one contact me to negotiate the definition of "easy"<;-).
=Dylan Thurston Err, it is easy once you have the continued fraction expansion, right? Is the issue getting the continued fraction expansion?
No, getting a CF is of course "solved". For example say k=2 so it's 1,2,2,2,... Maybe I've just been dense on seeing how to use that to nicely generate the a+bx. If you can tell me a truly easy way, then you've made an easy $50! "Easy" would be something like the so-called "BRM" raster line drawing algorithm, where you step directly to the next a,b without maintaining a whole bunch of state. (The best I've got so far maintains a sorted list of all a+bx with the same floor). Even funner would be directly computing the Nth a,b. Or, the number below some C+Dx. Here's the ordered forty-four k=2 pairs for a+bx < 10, then their a and b components: 0,0 1,0 0,1 2,0 1,1 0,2 3,0 2,1 1,2 4,0 0,3 3,1 2,2 5,0 1,3 4,1 0,4 3,2 6,0 2,3 5,1 1,4 4,2 7,0 0,5 3,3 6,1 2,4 5,2 8,0 1,5 4,3 7,1 0,6 3,4 6,2 9,0 2,5 5,3 8,1 1,6 4,4 7,2 0,7 0 1 0 2 1 0 3 2 1 4 0 3 2 5 1 4 0 3 6 2 5 1 4 7 0 3 6 2 5 8 1 4 7 0 3 6 9 2 5 8 1 4 7 0 0 0 1 0 1 2 0 1 2 0 3 1 2 0 3 1 4 2 0 3 1 4 2 0 5 3 1 4 2 0 5 3 1 6 4 2 0 5 3 1 6 4 2 7 _______________________________________________ math-fun mailing list math-fun@mailman.xmission.com http://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun
On Mon, Jul 12, 2004 at 10:46:33AM -0600, Schroeppel, Richard wrote:
I think DTs formula below isn't quite right; taking each clause as a 50:50 coin flip, the conjunctions are 1/8 true, and the disjunction only 1/4, while I'd expect 50%.
Umm, right, it should be (p-r > 0 && q-s < 0) || (p-r > 0 && q-s > 0 && (p-r)^2 < k*(q-s)^2) || (p-r < 0 && q-s < 0 && (p-r)^2 > k*(q-s)^2) Sorry for the missing branch. The reason this is complicated should be related to the fact that we're in a quadratic extension of Q, and the answer is very different if you take the other square root. I can't make that precise at the moment, however. [On writing a+bx in order]
... and the appropriate generalization to 3D.
I'm not sure why you're thinking about this, but it's almost guaranteed to be much harder: there is no really nice notion of 3D continued fractions. I bet there won't be a bounded number of possible successive differences you need to keep track of, for instance. Peace, Dylan
Recently, there was some traffic about the angles of a 3-4-5 triangle. What x-y-z triangles have angles (in degrees) of x-y-z? I have one simple solution, and I have a poor approximation to the triangle where z=90, but I haven't figured out a method for finding the exact solution, yet. --Ed Pegg Jr.
--- Ed Pegg Jr <ed@mathpuzzle.com> wrote:
Recently, there was some traffic about the angles of a 3-4-5 triangle.
What x-y-z triangles have angles (in degrees) of x-y-z?
I have one simple solution, and I have a poor approximation to the triangle where z=90, but I haven't figured out a method for finding the exact solution, yet.
--Ed Pegg Jr.
Are you asking for a triangle whose angles are proportional to the sides? sin A sin B sin C ----- = ----- = -----, a b c so the only solution is an equilateral triangle. Gene __________________________________ Do you Yahoo!? Yahoo! Mail - You care about security. So do we. http://promotions.yahoo.com/new_mail
Who could have foreseen the veterinary consequences? Last week's Mercury News had the headline Balco questions dog shot putters Suppose you want to denest sqrt(2-sqrt(3)), i.e. the roots of (c174) x^2-(2-sqrt(3)) 2 (d174) x + sqrt(3) - 2 . A methodical approach, (modulo a little bird cheeping "sqrt(2)" in your ear): Clear the radicals by multiplying thru by their conjugates. (c175) expand(subst(-sqrt(3),sqrt(3),%)*%); 4 2 (d175) x - 4 x + 1 (Macsyma actually has a MULTIPLY_CONJUGATES.) Factor over the rationals extended by sqrt(2): (c176) algfac(%,sqrt(2)); 2 2 (d176) (x - sqrt(2) x - 1) (x + sqrt(2) x - 1) Now gcd the factors with the original polynomial: (c177) makelist(mygcd(d174,p),p,args(%)); (d177) [sqrt(2) x + sqrt(3) - 1, - sqrt(2) x + sqrt(3) - 1] (c178) map(linsolve,%); sqrt(2) sqrt(3) - sqrt(2) (d178) [[x = - -------------------------], 2 sqrt(2) sqrt(3) - sqrt(2) [x = -------------------------]] 2 These are the two square roots. --rwg
participants (5)
-
dpt@lotus.bostoncoop.net -
Ed Pegg Jr -
Eugene Salamin -
R. William Gosper -
Schroeppel, Richard