Trebuchet calculation/optimization in Perl?

Discussion in 'Perl Misc' started by usenet@DavidFilmer.com, Oct 31, 2005.

  1. Guest

    OK, this is probably about as "misc" as it gets...

    I'm interested in a Perl script to calculate and optimize a trebuchet
    design (the siege engine, not the font).

    As usual, I begin my project with an investigation of prior art (as all
    'lazy' programmers should do). While I can find such programs in other
    languages (such as FORTRAN), I cannot find such a body of work in Perl.
    I half-expected to find a module on CPAN, but alas...

    If anyone if familiar with such a project, I would appreciate a
    reference to it.

    Thanks!

    --
    http://DavidFilmer.com
     
    , Oct 31, 2005
    #1
    1. Advertising

  2. Bob Walton Guest

    wrote:
    > OK, this is probably about as "misc" as it gets...
    >
    > I'm interested in a Perl script to calculate and optimize a trebuchet
    > design (the siege engine, not the font).
    >
    > As usual, I begin my project with an investigation of prior art (as all
    > 'lazy' programmers should do). While I can find such programs in other
    > languages (such as FORTRAN), I cannot find such a body of work in Perl.
    > I half-expected to find a module on CPAN, but alas...
    >
    > If anyone if familiar with such a project, I would appreciate a
    > reference to it.


    Just my 2-cents: Mostly Perl isn't used a lot for numerical
    stuff. It's not because Perl isn't useful for such, it's just
    that Perl's forte is text string manipulation. Each language has
    its place -- Perl is great for string manipulation and general
    "gluing" tasks, whereas FORTRAN, for example, is great for
    numerical computation (FORTRAN will be many times faster than
    Perl at heavy-duty numerical work). So one will be unlikely to
    find a lot of numerical codes for Perl. If you would like an
    optimizer, I have a Nelder-Meade optimizer implemented in Perl.
    It's a bit long, so if you want it, email me via the link below.
    ....
    --
    Bob Walton
    Email: http://bwalton.com/cgi-bin/emailbob.pl
     
    Bob Walton, Nov 2, 2005
    #2
    1. Advertising

  3. Guest

    Bob Walton wrote:
    > Just my 2-cents: Mostly Perl isn't used a lot for numerical
    > stuff. It's not because Perl isn't useful for such, it's just
    > that Perl's forte is text string manipulation.


    Understood and agreed. I was exploring the mathematical and mechanical
    properties of the seige engine as explained in this _excellent_ paper:
    http://www.algobeautytreb.com/trebmath35.pdf

    The author uses Mathematica to do the calculations. I think Mathematica
    is probably the best choice, but it doesn't work well for me because
    it's a commercial license, it's (rather) expensive, and I don't know
    how to use it. I'd much rather use Perl, and I'm not really concerned
    about performance (it's just a hobby interest and an educational
    exercise).

    It does appear that CPAN offers computational modules to do the "heavy
    lifting" of the required differential equations (Math::RungeKutta, for
    example). And the bulk of the computations involves nothing higher than
    basic trig. So I think the numerical tools are available in Perl, but
    stringing them together is (for me) a bit intimidating for an all-out,
    hinged counterweight, constrained & sliding sling trebuchet with a
    cherry on top.

    But I doubt I'm the first guy to think about trebuchet design in Perl.
    I just wonder if anyone else has done more than just _think_ about it
    ;)

    --
    http://DavidFilmer.com
     
    , Nov 2, 2005
    #3
  4. Guest

    wrote:
    > Bob Walton wrote:
    >> Just my 2-cents: Mostly Perl isn't used a lot for numerical
    >> stuff. It's not because Perl isn't useful for such, it's just
    >> that Perl's forte is text string manipulation.


    > properties of the seige engine as explained in this _excellent_ paper:
    > http://www.algobeautytreb.com/trebmath35.pdf


    > is probably the best choice, but it doesn't work well for me because
    > it's a commercial license, it's (rather) expensive, and I don't know
    > how to use it. I'd much rather use Perl, and I'm not really concerned
    > about performance (it's just a hobby interest and an educational
    > exercise).


    > It does appear that CPAN offers computational modules to do the "heavy
    > lifting" of the required differential equations (Math::RungeKutta, for
    > example). And the bulk of the computations involves nothing higher than
    > basic trig. So I think the numerical tools are available in Perl, but
    > stringing them together is (for me) a bit intimidating for an all-out,
    > hinged counterweight, constrained & sliding sling trebuchet with a
    > cherry on top.


    > But I doubt I'm the first guy to think about trebuchet design in Perl.
    > I just wonder if anyone else has done more than just _think_ about it
    > ;)


    Just make sure you get the calculations correct! ;)

    Inquest told of death by catapult

    Story from BBC NEWS:
    http://news.bbc.co.uk/go/pr/fr/-/1/hi/england/oxfordshire/4393524.stm
    Published: 2005/10/31 15:30:20 GMT


    A student died after being hurled by a catapult in an extreme sports
    stunt, an inquest has been told.

    Oxford University student Kostydin Yankov, 19, suffered multiple
    injuries when he missed a net after being flung from a medieval-style
    catapult.

    Mr Yankov was part of the university extreme sports club - the
    Oxford Stunt Factory - which was visiting the site in Middlemoor
    Water Park in Somerset.

    The inquest heard several members were concerned about the catapult's
    safety.

    Mr Yankov, from Bulgaria, known as Dino, was one of five members
    of the Stunt Factory to use the trebuchet catapult on 24 November
    2002.

    Oliver Nelkin, who was due to jump after Mr Yankov said he was
    alarmed that jumpers were landing at the very front of the net
    rather than in the middle as intended.

    Describing Mr Yankov's jump he said: "At some stage I saw Dino as
    a ball in the air.

    "He then missed the safety net but I couldn't say by how much. As
    he hit the ground I heard a thud and then a second thud."

    Paramedics rushed to the scene and Mr Yankov was taken to Bristol's
    Frenchay Hospital where he later died.

    The designers of the catapult - Richard Wicks, 33, from Burnham-on-Sea,
    Somerset, and David Aitkenhead, 46, of Fiddington near Bridgwater
    - were acquitted of Mr Yankov's manslaughter after a trial collapsed
    at Bristol Crown Court last year.

    The inquest, which is expected to last for three days, was adjourned
    until Tuesday.
     
    , Nov 2, 2005
    #4
  5. Guest

    wrote:
    > Just make sure you get the calculations correct! ;)


    It's possible to ride one of these things:
    http://www.trebuchet.com/articles/ron/trebuchet.html

    But it's one of the dumbest things I can think of. I plan to throw
    16-lb bowling balls :)

    Actually, FWIW (and I know this is getting a bit OT for Perl), I'm
    interested in the effects of using a more flexible beam - I want to try
    using 1" diameter oriented-strand fiberglass rod for the long arm. But
    I need to figure the arm accleration to calculate an optimal release
    point (when the rod is snapping back straight as the counterweight
    starts to back-swing and the sling begins to slide off the release
    finger). I also have been thinking about adding steel springs to the
    sling tieback to get a little extra "snapping" effect at release. So
    I've got a couple of extra parameters to consider which are not part of
    traditional treb simulators (WinTreb, a-Treb, etc). A lot of this will
    be trial-and-error in the field (optimal release angle, etc), but I
    need to get "pretty close" before I begin, so I need to do bunch of
    number crunching. And, of course, I prefer Perl because that's what I
    have and what I know.
     
    , Nov 2, 2005
    #5
  6. Bob Walton Guest

    wrote:

    > wrote:
    >
    >>Just make sure you get the calculations correct! ;)

    >
    >
    > It's possible to ride one of these things:
    > http://www.trebuchet.com/articles/ron/trebuchet.html
    >
    > But it's one of the dumbest things I can think of. I plan to throw
    > 16-lb bowling balls :)
    >
    > Actually, FWIW (and I know this is getting a bit OT for Perl), I'm
    > interested in the effects of using a more flexible beam - I want to try
    > using 1" diameter oriented-strand fiberglass rod for the long arm. But
    > I need to figure the arm accleration to calculate an optimal release
    > point (when the rod is snapping back straight as the counterweight
    > starts to back-swing and the sling begins to slide off the release
    > finger). I also have been thinking about adding steel springs to the
    > sling tieback to get a little extra "snapping" effect at release. So
    > I've got a couple of extra parameters to consider which are not part of
    > traditional treb simulators (WinTreb, a-Treb, etc). A lot of this will
    > be trial-and-error in the field (optimal release angle, etc), but I
    > need to get "pretty close" before I begin, so I need to do bunch of
    > number crunching. And, of course, I prefer Perl because that's what I
    > have and what I know.
    >


    Actually, come to think of it, I do also have a translator for an
    ACSL-like simulation language that would be good choice to
    simulate a trebouchet. The translator is written in Perl, but
    the output of the translator is FORTRAN-90 source code, which
    must then be compiled with a FORTRAN-90 compiler to generate an
    executable. Two versions exist: a standalone version that
    creates plottable output as a flat text file of numbers, and a
    Matlab version that interfaces with Matlab as a DLL (or "mex"
    file) to form a rather nice setup in which Matlab does the
    plotting and analysis. The translator works well, but is poorly
    written (being among my first attempts at Perl years ago). It is
    quite lengthy (over 100K of Perl code), so if you have interest,
    email me at the link below.

    --
    Bob Walton
    Email: http://bwalton.com/cgi-bin/emailbob.pl
     
    Bob Walton, Nov 3, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dpackwood
    Replies:
    3
    Views:
    1,829
  2. Animesh K
    Replies:
    2
    Views:
    7,852
    Nik Coughlin
    Aug 7, 2007
  3. Ravikiran

    Zero Optimization and Sign Optimization???

    Ravikiran, Nov 17, 2008, in forum: C Programming
    Replies:
    22
    Views:
    888
    Thad Smith
    Nov 24, 2008
  4. Cab Colino

    perl/c++ calculation

    Cab Colino, Nov 25, 2004, in forum: Perl Misc
    Replies:
    2
    Views:
    127
    Cab Colino
    Nov 26, 2004
  5. Replies:
    2
    Views:
    196
Loading...

Share This Page