Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Is there any package to add to MATLAB to make it better at higher order arithmetic?

Tags:
  1. Jul 25, 2012 #1
    Basically I'm writing my MSc dissertation right now, and I've been doing a lot on primes

    I've written all my code in MATLAB, but my supervisor told me today that MATLAB is crap for higher order arithmetic and the primes only go up to something like 10 digits long.

    SO I'm kinda screwed right now, he suggests using Maple but I'm already so far through. Is there any way I can add something to MATLAB to make it store more primes? Or be able to factor an integer 100 digits long?

    Thanks
     
  2. jcsd
  3. Jul 26, 2012 #2
    Re: Is there any package to add to MATLAB to make it better at higher order arithmeti

    See if the Matlab Sybmolic Math Toolbox will let you finish.

    http://www.mathworks.com/products/symbolic/

    It looks like the Matlab folks made a deal with the Mupad folks to incorporate some arbitrary precision stuff into Matlab. That probably means you will have to make some changes to your code and learn some new things, but you might be able to keep and make use of some of what you have done.

    Unless you have a lot of compute power or time or "easy" numbers to factor I am guessing that 100 digit numbers are going to be a very very difficult challenge. 50 digit factors are still considered fairly impressive records.

    http://www.alpertron.com.ar/ECMREC.HTM

    Unfortunately that doesn't mention how many processor megaseconds it took to find each of those.
     
  4. Jul 26, 2012 #3

    chiro

    User Avatar
    Science Advisor

    Re: Is there any package to add to MATLAB to make it better at higher order arithmeti

    If you need to do some serious number theory work, it's probably better to use a C/C++ library (or some other optimized library that can be called from something like the way ScyPy is from Python).

    I say this because you want to factor a 100-digit library and this is going to be computationally intensive to say the least (remember that a lot of high performance libraries have routines that can factor big integers with a variety of algorithms).
     
  5. Jul 27, 2012 #4
    Re: Is there any package to add to MATLAB to make it better at higher order arithmeti

    Apart from the Symbolic Toolbox already mentioned, an add-on package is mentioned in this thread: https://www.physicsforums.com/showpost.php?p=3989820&postcount=3 ( http://www.mathworks.com/matlabcentral/fileexchange/22725-variable-precision-integer-arithmetic ).

    An alternative produce to consider is Mathcad (it handles arbitrary precision arithmetic and has a Matlab interface and its programming is similar enough to Matlab to allow porting of many programs without too much effort). I've attached an image of part of a simple worksheet that factorizes the decades of ten (plus a small constant) and shows the times for each factorization ... some of them are quite lengthy.

    attachment.php?attachmentid=49359&stc=1&d=1343400208.jpg

    Another package to consider is the non-commercial SMath, a Mathcad-like application that also does arbitrary precision arithmetic. I'm not sure whether it has a factor function.
     

    Attached Files:

  6. Jul 27, 2012 #5

    uart

    User Avatar
    Science Advisor

    Re: Is there any package to add to MATLAB to make it better at higher order arithmeti

    Traditionally Matlab has always more for number crunching than number theory.

    You should take a look at python, in particular the mpmath and sympy libraries. They can handle a lot of multi-precision and number system functions.

    BTW. Firepanda, can you tell us the main types of function that your work requires. For example, stuff like integer factorization, prime generation, arbitrary precision maths etc? Can you list the main types of functions you need.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Is there any package to add to MATLAB to make it better at higher order arithmetic?
  1. Any matlab gurus here? (Replies: 13)

Loading...