MATLAB Add Packages to MATLAB for Higher Order Arithmetic

AI Thread Summary
MATLAB is limited for higher order arithmetic, particularly for prime numbers beyond 10 digits, which poses a challenge for the user's MSc dissertation. The MATLAB Symbolic Math Toolbox offers some solutions for arbitrary precision arithmetic, but significant code adjustments may be necessary. Alternatives like C/C++ libraries or Python's mpmath and sympy are recommended for more efficient number theory computations. Other software options include Maple, Mathcad, and SMath, which support arbitrary precision arithmetic and may facilitate easier code transitions. The discussion emphasizes the need for robust computational tools to handle large integer factorization effectively.
Firepanda
Messages
425
Reaction score
0
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
 
Physics news on Phys.org


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.
 


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).
 


Firepanda said:
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

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.
 

Attachments

  • phys - 12 07 26 factor 01.jpg
    phys - 12 07 26 factor 01.jpg
    38.9 KB · Views: 838


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.
 

Similar threads

Replies
10
Views
3K
Replies
4
Views
2K
Replies
6
Views
5K
Replies
3
Views
3K
Replies
13
Views
7K
Replies
1
Views
2K
Replies
2
Views
3K
Replies
45
Views
5K
Back
Top