Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Re: Geometric Optimisation and Perl

by tsee (Curate)
on Mar 27, 2004 at 10:02 UTC ( [id://340245]=note: print w/replies, xml ) Need Help??


in reply to Re: Geometric Optimisation and Perl
in thread Geometric Optimisation and Perl

Why not use the existing math-related modules? Pure-Perl calculus is offered in limited style by modules like Math::Symbolic, Math::Integral::Romberg, Math::Algebra::Symbols, etc. Library bindings are pretty common, too: Math::ematica, Math::Pari, etc.

Steffen

Replies are listed 'Best First'.
Re: Re: Re: Geometric Optimisation and Perl
by Vautrin (Hermit) on Mar 27, 2004 at 15:50 UTC

    Have you ever used Mathematica? I'm guessing that you haven't. It is a program that not only allows calculation in symbolic logic, it can do just about any problem you throw at it, well into the graduate level. None of the modules that you have provided do that.

    The question becomes, how hairy is the optimization? If you are talking about something he can solve once on paper -- for instance the shapes that are being cut are the same each time, then he doesn't need the power of Mathematica, or another technical computing platform. If, on the other hand, you are talking about something which you can't solve once for -- for instance if all of the shapes that are being cut change, and they are irregular, there may be a need for Mathematica.

    I don't work for Wolfram, and am in no way affliliated with them, but back when I was getting my degree in Mathematics, Mathematica impressed me more then any of its competitors -- Matlab, Maple, etc. If you need a lot of power, I would recommend trying it. I am pretty sure you can get it on a 30 day trial. If there is a real need, you will be more then able to justify the cost.


    Want to support the EFF and FSF by buying cool stuff? Click here.

      Can't resist to give a quick answer to your question:
      Being a physicist, I have indeed used Mathematica, though I generally prefer Maple for most stuff since I like the interface better. As you said, it is a question of the complexity of the optimization. I don't think you need the full power of Mathematica for this, though I haven't thought it through. If it's an If I recall correctly, the first reply in this thread pointed to a good, scientific discussion of the subject.
      The reason I pointed at those Math:: modules was because before engaging in hairy XS/Inline::C library wrapping, it's probably a better idea to try with what's availlable already. If that's not good enough by a small margin, it's probably a better idea to extend what's on CPAN than to roll one's own. That doesn't mean I consider Mathematica an inadequate tool for the job.

      Steffen

        You're right that if it's possible to solve the problem without using Mathematica, XS / Inline::C library wrapping, it is better to try what's available. However, I figured that I would put it out there, so that OP would know that there are other options if the problem gets complex enough.

        I'm a big fan of Perl, but to be honest, not every problem is right for it. If the OP can get a more elegant solution by using a technical computing platform like Matlab, or Mathematica (and if they can afford to), he or she may want to. However, if the OP has a reason to use Perl -- perhaps to interface with a CGI script or already existing Tk/Perl application? -- the option is there.

        I would also like to point out, that the OP doesn't have to use XS to return the values. If the solution is significantly complex, or the number is to a precision bigger then you can return via XS, or there is another reason to make XS a bad solution, it is possible to send the result over a Unix domain socket or a TCP/IP connection, or through a database, or put it in a file, or any of a number of possible solutions. Sometimes the best way to use a program is via a system() call that invokes a program that sends the data back to the program via a Unix domain socket. Of course, you're still going to have to roll your own protocol, but I figured I would put it out there so that the OP can decide what is best for his/her needs.


        Want to support the EFF and FSF by buying cool stuff? Click here.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://340245]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2024-03-28 08:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found