Search Results - VBForums

Search:

Type: Posts; User: jemidiah

Page 1 of 13 1 2 3 4

Search: Search took 0.06 seconds.

  1. Re: Using a mathematical identity to speed up certain calculations.

    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...
  2. Re: Using a mathematical identity to speed up certain calculations.

    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
    ...
  3. Re: Using a mathematical identity to speed up certain calculations.

    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...
  4. Re: Using a mathematical identity to speed up certain calculations.

    Since this is "code-it-better", 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...
  5. Replies
    13
    Views
    2,354

    Re: [RESOLVED] Rise/Run to Angle

    That's wonderful, glad to be helpful in sparking some interest in math.
  6. Replies
    3
    Views
    288

    Re: The maximum number of divisors

    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'...
  7. Re: [C#] Finding angles based on side lengths

    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...
  8. Re: [C#] Finding angles based on side lengths

    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...
  9. Re: [RESOLVED] calculating maximum distinct char permutations

    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
    ...
  10. Re: calculating maximum distinct char permutations

    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...
  11. Replies
    13
    Views
    2,354

    Re: [RESOLVED] Rise/Run to Angle

    Heh, glad some of it is clicking.
  12. Replies
    13
    Views
    2,354

    Re: [RESOLVED] Rise/Run to Angle

    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,...
  13. Replies
    13
    Views
    2,354

    Re: [RESOLVED] Rise/Run to Angle

    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)...
  14. Replies
    13
    Views
    2,354

    Re: Rise/Run to Angle

    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...
  15. Replies
    2
    Views
    449

    Re: Book about Pattern Recognition

    After some searching, I found this random Spanish-language 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...
  16. Re: Generating rectangles around a centre point in a spiral starting from the centre

    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),...
  17. Replies
    8
    Views
    584

    Re: Get X/Y coordinates

    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...
  18. Thread: Prove this

    by jemidiah
    Replies
    2
    Views
    392

    Re: Prove this

    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...
  19. Replies
    9
    Views
    1,340

    Re: Combination Picker

    I agree, the question is exactly asking for an efficient algorithm to unrank an index to produce a k-combination. I imagine there's a fair amount of literature on the problem and its generalizations,...
  20. Re: drawing the Steiner exellipse

    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.
  21. Re: Plot ellipse through apex and two other points

    Sorry for not getting to this. I came down with the flu for the last week and am now playing catch-up. Hopefully soon.
  22. Re: Plot ellipse through apex and two other points

    I'll try to take a look in the next couple of days.
  23. Re: Plot ellipse through apex and two other points

    @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....
  24. Re: Plot ellipse through apex and two other points

    Whoops, the cross term is more complicated than just a simple complete-the-square problem. Noting that
    A(x-D/(2A))^2 = Ax^2 - Dx + D^2/(4A)
    A(y-E/(2C))^2 = Ay^2 - Ey + E^2/(4C)

    will get rid of...
  25. Re: Plot ellipse through apex and two other points

    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...
  26. Re: Plot ellipse through apex and two other points

    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...
  27. Re: Plot ellipse through apex and two other points

    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...
  28. Re: Plot ellipse through apex and two other points

    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 -...
  29. Re: Plot ellipse through apex and two other points

    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...
  30. Re: Plot ellipse through apex and two other points

    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 =...
  31. Replies
    14
    Views
    806

    Re: Drawing Sine and Cosine Graphs on vb10

    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...
  32. Re: Plot ellipse through apex and two other points

    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...
  33. Replies
    14
    Views
    806

    Re: Drawing Sine and Cosine Graphs on vb10

    (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.)
  34. Re: Plot ellipse through apex and two other points

    Translate the points so P2 is at the origin. Suppose you wish to make an ellipse with center (0, A). The resulting ellipse is
    ((x-A)/A)^2 + (y/B)^2 = 1,

    for some B^2>0. Let P1=(u, v), P3=(r, s),...
  35. Replies
    14
    Views
    806

    Re: Drawing Sine and Cosine Graphs on vb10

    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...
  36. Replies
    10
    Views
    456

    Re: Problem regarding convertion of number...

    Hah, that... is disgusting. I would never want to run across it without having written it :).
  37. Replies
    4
    Views
    749

    Re: Random number question

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

    Re: Problem regarding convertion of number...

    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...
  39. Replies
    10
    Views
    456

    Re: Problem regarding convertion of number...

    There's quite a lot wrong with that code. It didn't compile for me at first (needed .ToString() instead of .ToString? kinda weird), but more importantly it's inefficient, overcomplicated, and doesn't...
  40. Re: What point on the graph of f(x) is closest to the origin?

    I don't think so. I did look at the graph, and +/- sqrt(2) seems very reasonable to me. It's hard to eyeball, unfortunately. Make sure you're looking at it on a graph where the x and y axes have the...
Results 1 to 40 of 500
Page 1 of 13 1 2 3 4



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.