13 Replies - 1666 Views - Last Post: 26 May 2017 - 10:56 AM

#1 Omega Force  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 25
  • Joined: 07-October 15

Best and most popular programming languages for doing number theory?

Posted 18 March 2016 - 10:21 AM

Hello.

What are the best and most popular programming languages for working with all of these things?
- natural numbers
- very large integers
- integer sequences
- modular arithmetic, congruence
- divisors, divisor function
- totient function
- number bases, radix, numeral system
- binary, hexadecimal, senary, duodecimal
- prime numbers, prime factorization

Also, how would you rank C#, Matlab and Python for doing all of the previously mentioned things?

Thanks in advance for your answers.

Is This A Good Question/Topic? 0
  • +

Replies To: Best and most popular programming languages for doing number theory?

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 5078
  • View blog
  • Posts: 13,705
  • Joined: 18-April 07

Re: Best and most popular programming languages for doing number theory?

Posted 18 March 2016 - 10:49 AM

Matlab and Python are the languages of choice for the math/scientific fields and can all do the things you listed there. C# can do them too but not as easily or cleanly I find. What you may find yourself doing is also using a base language like Python and adding in special libraries to give you the functionality you need to handle other scientific calculations.

So look at the types of plugins/packages that can be installed with the given language you choose. Make sure that if you can't do it in the language that there is at least a few choices of packages to help you do what it is you need to do.

:)
Was This Post Helpful? 1
  • +
  • -

#3 macosxnerd101  Icon User is online

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12177
  • View blog
  • Posts: 45,245
  • Joined: 27-December 08

Re: Best and most popular programming languages for doing number theory?

Posted 18 March 2016 - 10:55 AM

As someone who maths, I find MATLAB to be ugly and unwieldy. A lot of engineers and folks in scientific computing tend to be drawn to it. There is a saying- MATLAB is a thin wrapper for FORTRAN while Mathematica is a thin wrapper for Steven Wolfram's ego. I'll gladly take the latter.

To contrast, Python is very popular in the data science community. I think you'll be happy with the numerical libraries like NumPy.
Was This Post Helpful? 1
  • +
  • -

#4 jon.kiparsky  Icon User is offline

  • Chinga la migra
  • member icon


Reputation: 10720
  • View blog
  • Posts: 18,353
  • Joined: 19-March 11

Re: Best and most popular programming languages for doing number theory?

Posted 18 March 2016 - 12:12 PM

Matlab is great for calculations, but not so great for math.

I've always developed my own functions in python for working with those ideas. A quick consultation of the googles produced https://pypi.python....pi/eulerlib/0.2 which might be interesting, but if you're doing recreational mathematics I recommend at least trying to write your own. It's very rewarding.

Quote

Also, how would you rank C#, Matlab and Python for doing all of the previously mentioned things?


I would say Python is likely to be your best bet of the three, but I'm sort of biased in that direction. I wouldn't really want to do this stuff in a heavyweight language like C#, and as I say Matlab/Octave is very strongly real-number oriented.
If you need Matlab-like functions or good matrix libraries, there's always numpy
Was This Post Helpful? 1
  • +
  • -

#5 Omega Force  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 25
  • Joined: 07-October 15

Re: Best and most popular programming languages for doing number theory?

Posted 21 March 2016 - 08:35 AM

Thank you all for your answers so far.

What about C++, Fortran and Java? Are they good for doing all of the things that I mentioned in my first post (number theory)?
Was This Post Helpful? 0
  • +
  • -

#6 macosxnerd101  Icon User is online

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12177
  • View blog
  • Posts: 45,245
  • Joined: 27-December 08

Re: Best and most popular programming languages for doing number theory?

Posted 21 March 2016 - 08:36 AM

I personally wouldn't want to do computational number theory problems in these languages; but in theory, you could.
Was This Post Helpful? 0
  • +
  • -

#7 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 13554
  • View blog
  • Posts: 54,093
  • Joined: 12-June 08

Re: Best and most popular programming languages for doing number theory?

Posted 21 March 2016 - 08:46 AM

There's always R; if you are brave enough.

https://en.wikipedia...ng_language%29q
Was This Post Helpful? 2
  • +
  • -

#8 jon.kiparsky  Icon User is offline

  • Chinga la migra
  • member icon


Reputation: 10720
  • View blog
  • Posts: 18,353
  • Joined: 19-March 11

Re: Best and most popular programming languages for doing number theory?

Posted 21 March 2016 - 09:13 AM

R is really about stats, and it's a little, um, special. I'm not sure I'd want to deal with, say, the totient function in it.

You certainly COULD write this sort of thing in Java, and that might be an interesting exercise. But remember that in Java you have to deal with size restrictions in your primitive number classes, which means you have to deal with big number classes out of the box. I would be interested in seeing what could be done in Scala (or clojure, but I'm not so keen on clojure)
C++ gives you the advantage of maybe better speed, but I prefer a high-level language.

The question is not "can you" write these functions in some language L. You can. The question is whether you want to.
Was This Post Helpful? 0
  • +
  • -

#9 Omega Force  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 25
  • Joined: 07-October 15

Re: Best and most popular programming languages for doing number theory?

Posted 26 May 2017 - 10:08 AM

After thinking for a while, I've come to the conclusion that the best language for doing number theory is either Python or Mathematica, but I don't know which one is better.

Mathematica has not been discussed at all in the thread.
What are its advantages and disadvantages compared to Python?
Does Mathematica have more number theory functions than Python?
Is it faster to write programs (in number theory) in Mathematica than in Python?
Would the calculations be done faster in Mathematica than in Python?
Was This Post Helpful? 0
  • +
  • -

#10 NeoTifa  Icon User is offline

  • NeoTifa Codebreaker, the Scourge of Devtester
  • member icon





Reputation: 4099
  • View blog
  • Posts: 18,184
  • Joined: 24-September 08

Re: Best and most popular programming languages for doing number theory?

Posted 26 May 2017 - 10:11 AM

I personally love MATLAB, as long as you're not doing anything with strings. I hate Mathematica, mainly because they forced us to use it in Calc and it made my life a living hell and was confusing. I'll jump on the python train here too, but I'm a newb with it.
Was This Post Helpful? 0
  • +
  • -

#11 jon.kiparsky  Icon User is offline

  • Chinga la migra
  • member icon


Reputation: 10720
  • View blog
  • Posts: 18,353
  • Joined: 19-March 11

Re: Best and most popular programming languages for doing number theory?

Posted 26 May 2017 - 10:23 AM

View PostOmega Force, on 26 May 2017 - 12:08 PM, said:

Mathematica has not been discussed at all in the thread.


One reason that you don't get a lot of talk about Mathematica is that it's a proprietary language that lots of people don't want to invest in. I'm in that bunch - I don't really see shelling out $300 to use a programming language unless and until I've exhausted all of the reasonable options.

Quote

What are its advantages and disadvantages compared to Python?
Does Mathematica have more number theory functions than Python?
Is it faster to write programs (in number theory) in Mathematica than in Python?
Would the calculations be done faster in Mathematica than in Python?


I can't really say anything about these questions. However, I would ask you what it is you're trying to do here. If you want to learn number theory, it might be worth your while to actually invent this wheel. If you can implement a concept effectively in some language, you can be pretty sure you understand it. If you write solid tests for your implementation, you can be very sure that you understand it.

If you just want to have access to particular functions in order to get on with whatever it is you're doing, then you should contact Wolfram and find out whether those functions are implemented in Mathematica. Then you can decide whether they're worth the investment to you (which is something I certainly can't help you with)
Was This Post Helpful? 0
  • +
  • -

#12 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 5078
  • View blog
  • Posts: 13,705
  • Joined: 18-April 07

Re: Best and most popular programming languages for doing number theory?

Posted 26 May 2017 - 10:25 AM

A lot of science based companies who do complex number crunching and theory use Python. I have seen a ton of jobs looking for data scientists that have Python backgrounds.
Was This Post Helpful? 0
  • +
  • -

#13 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 13554
  • View blog
  • Posts: 54,093
  • Joined: 12-June 08

Re: Best and most popular programming languages for doing number theory?

Posted 26 May 2017 - 10:33 AM

There's R. Ohhhh R.
Was This Post Helpful? 0
  • +
  • -

#14 jon.kiparsky  Icon User is offline

  • Chinga la migra
  • member icon


Reputation: 10720
  • View blog
  • Posts: 18,353
  • Joined: 19-March 11

Re: Best and most popular programming languages for doing number theory?

Posted 26 May 2017 - 10:56 AM

View Postmodi123_1, on 26 May 2017 - 12:33 PM, said:

There's R. Ohhhh R.


Don't remind me....
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1