Search:
Type: Posts; User: jemidiah
Search:
Search took 0.05 seconds; generated 29 minute(s) ago.

Your reply confuses me in several ways. (1) I showed you how to find the ADP corner, but you seem to have ignored this. (2) If you could do what I did in my response, why bother asking the question...

I'll assume angles that look like right angles are right angles.
Drop a perpendicular from C to the line AD, and call the point of intersection Y. This line intersects LP at one point, say Q, and...

Since the original topic is likely dead (after having been derailed twice, and having relatively little content to begin with), I'll make a few "meta" comments.
Boy, this was a painful thread to...

The timings you requested, first "GaussLCM", then naive:
In [110]: %timeit sum_quotients5([2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43], 100000)
10 loops, best of 3: 93.9 ms per loop
...

Here's a little speed comparison data using the code in my previous post on my personal machine:
: %timeit sum_quotients5([174, 192, 934, 554, 1234, 4321], 100000)
10000 loops, best of 3: 199...

Since this is "codeitbetter", I thought I'd mention the Python implementation of some of these algorithms, since many of these operations are particularly straightforward in standard Python. The...

That's wonderful, glad to be helpful in sparking some interest in math.

Let D(n) denote the number of divisors of n. Our first goal is to show D is "multiplicative". That is, suppose n and m are relatively prime. We'll show D(nm) = D(n)D(m).
If d divides n and d'...

Yup, that's true. Edit: though to be completely clear, you can also compute the other two angles from that information. The largest angle isn't privileged in any way.
Yeah, it should clarify...

As I understand it, you (at the moment) want to compute the angle with vertex in the middle of the red rectangle, with the black line and one of the pink lines forming the rays. In that case, I don't...

Yup, that's what I mean. Sorry, I totally forgot I used the factorial notation without defining it. For a more thorough example of my formula, if you have R, R, R, R, G, G, G, B, Y, the answer is
...

This is a classic problem with a conveniently straightforward solution. Using R, G, B, Y, R, first replace the second R with R'. There are 5! = 120 ways to permute those five characters, but really...

Heh, glad some of it is clicking.

Roughly speaking, you can define sin and cos to be the correct functions to use in your GetRiseRunFromAngle function, subject to the constraint that the resulting vector has length 1. That is,...

A relatively minor point: it's probably best to use "New PointF(Math.Cos(radians), Math.Sin(radians))" instead of "New PointF(1, tangent)". The direction will be unaffected, but the benefits are: (1)...

Converting a 2D vector to an angle is precisely the job of the atan2 function. There's a lengthy Wikipedia page about it and it's in a large number of libraries. Note there are a couple of common...

After some searching, I found this random Spanishlanguage page that seems to sell it. Failing that, I was going to suggest you contact the author directly, but I didn't find an email address or...

For what it's worth, here's a brief discussion of what Lenggries called "GetX/GetY".
Divide the plane into rectangular strips: the 0th is just (0, 0); the 1st is (0, 1), (1, 1), (1, 0), (1, 1),...

What you're trying to do and what's not working aren't terribly clear to me, but are you sure you wanted
Dim tilesPerHeight As Double = Math.Floor(Me.Height + ToolStrip1.Bottom / 32)
instead...

Multiply x<1 by x. Since 0<x, this does not reverse the inequalities, so we have 0 < x^2 < x. Take the square root of these inequalities to get 0 < sqrt(x^2) = x < sqrt(x).
The first two sentences...

I agree, the question is exactly asking for an efficient algorithm to unrank an index to produce a kcombination. I imagine there's a fair amount of literature on the problem and its generalizations,...

That's beautiful and it seems reasonably intuitive. Glad it worked out. Sorry I never got to debugging your earlier post; life got too busy for me to put in the time and effort.

Sorry for not getting to this. I came down with the flu for the last week and am now playing catchup. Hopefully soon.

I'll try to take a look in the next couple of days.

@Logophobic: Yup. I think bb and I both observed that somewhere above; the working version of the code discussed in post #14 makes it clear empirically. Here's a proof using my formula from post #8....

Whoops, the cross term is more complicated than just a simple completethesquare problem. Noting that
A(xD/(2A))^2 = Ax^2  Dx + D^2/(4A)
A(yE/(2C))^2 = Ay^2  Ey + E^2/(4C)
will get rid of...

Ah, sorry, I should have explained my notation more explicitly. A, B, C, D, E, and F are all parameters to the general quadratic curve equation,
Ax^2 + Bxy + Cy^2 + Dx + Ey + F = 0,
listed on the...

Hmm. I think your problem is still underdetermined. I'll give a system of equations that describe your conditions and then have Mathematica solve them. This shows there is a single free parameter, so...

I don't think the constraint you've said makes complete sense. You want P2 to be as far as possible perpendicularly from line P1P3 (typo), but on "the arc": you're using this constraint to define...

In the "normalized" form of post #6, a configuration with the line from P1 to P3 perpendicular to the axis from P2 corresponds to P2=(0, 0), P1=(u, v), P3=(u, v), i.e. u=r, v=s. Indeed, then us^2 ...

I wrote (0, A) when I meant (A, 0), so "Dim centre As New PointF(0, A)" should be "Dim centre As New PointF(A, 0)". With that change, when the line connecting P2 and m is horizontal, it generally...

After looking through the code, it's a faithful implementation (thanks for correcting the typo) except you've reversed the order of the arguments to atan2. Instead of "Dim t As Double =...

Sorry, you'll have to be clearer if you want people to help you. Three things you can do: use [CODE] tags; post your full code rather than seemingly arbitrary fragments; say *clearly* what you want...

Actually it means exactly the opposite: given u, v, r, s, there is a unique solution A, B^2 to the system of two equations I listed, which can be computed using the formulas I gave. Physically, that...

(The way I remember the conversion is that there are 2pi radians in 360 degrees, so X degrees = X degrees * 2pi radians/360 degrees = X*pi/180 radians.)

Translate the points so P2 is at the origin. Suppose you wish to make an ellipse with center (0, A). The resulting ellipse is
((xA)/A)^2 + (y/B)^2 = 1,
for some B^2>0. Let P1=(u, v), P3=(r, s),...

This isn't really a math question, you just happen to be coding something related to math. I've reported the thread so that it should get moved to the more appropriate VB.NET forum. More people will...

Hah, that... is disgusting. I would never want to run across it without having written it :).

For completeness, a general method for this sort of problem is described here. It's almost certainly way more involved than you're after.

Sure. It was so straightforward to write that line but now that I'm writing an explanation it seems more involved. There must be a better way to say it, but oh well.
Log(x, b) returns the number y...

Click Here to Expand Forum to Full Width
Survey posted by VBForums.
