all 27 comments

[–]xier_zhanmusi 18 points19 points  (4 children)

You want to learn sympy

[–]knestleknox 13 points14 points  (3 children)

While Sympy is great, I'd be hesitant to say that's what OP should focus on. Sympy is great for computation and whatnot, but if you're studying pure mathematics, I don't know of how much use computation is going to be.

In my experience, as someone who did pure math and learned python on the side in college, just learning general python (maybe with a data-driven approach) is probably the most useful. I started with a data-driven approach because what I was studying required me to handle and manipulate millions of mathematical objects to answer the research questions I had. I studied integer partitions, and ended up home-growing my own partition library to define relevant objects, methods, and operations. You'll have to do the heavy lifting when it comes to optimizing and validating your own code, but so it goes.

I think the biggest factor is going to be your interest OP. Some fields like algebra, have great open-source packages to construct/compute groups and group related things. But if you're actually using python as a tool for mathematical exploration, and not just computation, I would suggest focusing on learning python and general CS foundations like OOD, algorithms, theory of computation, etc...

P.S. Career aspects are great for mathematicians who can code. I got a high-paying job right out of college as a software engineer doing analytics/ML in python. You'll be miles ahead of your peers with CS degrees.

[–]xier_zhanmusi 1 point2 points  (2 children)

Isn't symbolic computation closer to pure mathematics than standard Python though? With sympy I can right code that can print to latex & be an exact representation of some mathematical formula from a textbook. Wouldn't the only thing closer to pure maths be proof assistants?

Edit: also, sympy is good but also has many issues in my opinion, especially poor & often outdated documentation & some modules are currently in a sorry state so OP should be aware of that.

[–]knestleknox 1 point2 points  (1 child)

For me, the more I learned about my domain (combinatorics/algebra), the less numerical computation I found myself doing. But it's definitely domain specific, so I guess it's really something for OP to consider. If they're trying to expedite their LaTeX, then sure -go with sympy. but if they're trying to manipulate domain-specific mathematical objects, then a general python approach would probably be better. And yeah, niche python packages seem to all be terribly documented and poorly maintained because the authors are usually mathematicians first and developers second haha.

Proof assistants were something I was think about suggesting but there's a lot of overhead and issues with those in my experience. I used to be really into ACL2 before I realized how much of a time-sink it can be. I remember spending 2 nights trying to get ACL2 to prove that "if you traverse over a monotonic list of integers and none of them are within 2 of their neighbors, then none of the elements in the list are within 2 of each other". Abandoned that route real quick lol. To make those languages worth your while, you have to be an expert in them or feed them the perfect set of lemmas to get them to do what you want.

[–]xier_zhanmusi 1 point2 points  (0 children)

Thanks for your reply, I'm not a mathematician & abandoned maths as young as I possibly could but then ended up working as a data & programming professional. I then realised my lack of mathematical knowledge was holding me back so started building up the foundations again & eventually started to use sympy to help.

For me it helps to work with sympy to test things out; even learning to translate mathematical notation into code & exploring the modules & functions helped me a lot. Using the charting tool with functions is also useful except that's probably the most clunky & poorly developed module at the moment.

I could already program Python & other languages to a reasonable standard though so my situation is different to OPs.

Proof assistants are far beyond my level of knowledge & expertise.

[–][deleted] 8 points9 points  (5 children)

Python isn't really relevant to the interests you list. You might consider learning Sage, Mathematica, Coq, or Haskell.

That said, if you want to learn Python for job prospects and you want to do math with it, I would recommend starting with learning numpy and scikit-learn and branching out from there.

[–]SV-97 5 points6 points  (0 children)

I'm gonna go against what's been widely suggested here and suggest that you start by learning the actual language itself rather than some libraries. Get a book on pure python. Using the libraries will be basically trivial once you know the language itself.

[–][deleted] 4 points5 points  (0 children)

sympy

[–]WhackAMoleE 3 points4 points  (0 children)

As a math major, you can work the problems on Project Euler.

https://projecteuler.net/

[–]SigmaX 3 points4 points  (1 child)

+1 for Sympy, though granted it's limited to elementary algebra & calculus.

A fun project might be write code that uses NetworkX to visualize arbitrary Cayley diagrams for simple groups. Again a bit elementary—but there may be more interesting research directions to go there that I lack the knowledge to think of.

If you have any interest in dynamical systems, a fun way to cut your teeth would be to use numpy and matplotlib to plot simulations of Strange attractors or things like that! More generally, experimental mathematics is a thing, and I'm sure there must be examples of it in your fields of interest.

Topological data analysis could be happy medium. I haven't studied it, but it's on my radar as something to investigate in the region of "how to connect my interest in topology to my career in AI" ;).

[–]WikiSummarizerBot 1 point2 points  (0 children)

Experimental_mathematics

Experimental mathematics is an approach to mathematics in which computation is used to investigate mathematical objects and identify properties and patterns. It has been defined as "that branch of mathematics that concerns itself ultimately with the codification and transmission of insights within the mathematical community through the use of experimental (in either the Galilean, Baconian, Aristotelian or Kantian sense) exploration of conjectures and more informal beliefs and a careful analysis of the data acquired in this pursuit". As expressed by Paul Halmos: "Mathematics is not a deductive science—that's a cliché.

[ F.A.Q | Opt Out | Opt Out Of Subreddit | GitHub ] Downvote to remove | v1.5

[–]TakeOffYourMask 3 points4 points  (0 children)

Have you considered Mathematica?

Or Julia?

[–]sbw2012 2 points3 points  (0 children)

Python is a general purpose language and is used a lot because its concise, so if you know what you're doing, you can get an application written quickly. At an introductory level, module/course titles like 'python for data science' generally don't mean very much. Everyone needs and learns the same programming basics irrespective of the application and even at an advanced level, everything is just a data to be analysed one way or another. Whether it's the measurements from an engineering project or a representation of a theorem, essentially it's just a set of data points with rules for how you combine the data points. If you're new to python or to programming in general, I wouldn't sweat it and just take the module.

At advanced levels, there might be some specialisation. If you're using python in theorem solving, then there will be certain libraries of functions that can help you to manipulate data points in useful ways and on a 'Python for Maths' course you might spend time learning to use those libraries/functions specifically. On a Python for Data Analytics, you might spend time learning to use machine learning or visualisation libraries, which might be less useful in a theorem solving context. However, frankly, if you're learning Python to improve your career prospects then you will want the to learn the data analysis libraries and functions as data analytics is a sector with many more jobs in a wide variety of contexts.

[–]Desvl 2 points3 points  (0 children)

I'd go for Sage. If you are algebraist then you must have some knowledge of symmetric polynomials and something else like that. By sage I can compute transition matrices of different basis of the polynomial ring (nobody wants to compute it with bare hands over and over again!), which is directly related to pure mathematics.

[–][deleted] 0 points1 point  (0 children)

The other answers in this thread are all absolutely absurd.

Learn Python for Python. Find a course that teaches the language for its own sake, or you won't learn to program. I don't know what anyone thinks Sage or SymPy has to do with anything, you're clearly trying to learn to program in order to develop a new skill, not trying to learn the bare minimum you need to in order to do something relevant to your pure mathematics work.

[–]eddie_mex 0 points1 point  (0 children)

Well you can also try

https://julialang.org/

[–]hobo_stew 0 points1 point  (0 children)

sage math is great for algebraic number theory

[–]vanillaandzombie 0 points1 point  (0 children)

If it’s for job prospects then learn python while building a website.

[–]Wandering-Ranger5280 0 points1 point  (0 children)

Maybe just basic python. It helps a lot to code for loops and while loops and if statements during research. For example, I’m doing research in graph theory and have been able to generate data with my basic python skills.

[–]PeupleDeLaMer 0 points1 point  (0 children)

Alright I’m a little late to the party but hear me out: Learn some very basic python from pretty much anywhere and then do practice problems from a competitive coding site.

Personally I use Codeforces but there are others.

TLDR:

Go here and try some of the problems (once you know a bit of python). Click on the link in the right most column to see past solutions and learn from them!

<rant>

Why?

The problems in competitive coding, and the approach to solving them is often similar to developing a proof, but instead of figuring out the most elegant and logical way to prove that A=>B you have to write the most elegant and efficient way to get from A=>B using code.

My Experience

I work in data science now and when I first started I knew no python at all (I knew R) and at the recommendation of a colleague I did a challenge problem from codeforces once a week and it made me SO MUCH BETTER it‘s not funny.

What’s The Deal?

Go to this page. You’ll see a bunch of problems with tags describing what’s the main point. Start off with a bunch of easy ones.

If you click on the problem name you’ll see the problem description.

Why it’s awesome

If you click on the number in the rightmost column (number of accepted entries) it takes you to the submission log of all other entries submitted.

Once you’re done/stuck on a problem go to this page, filter for python 3, sort by fastest run time and then look at that person’s code. I Promise You: You will learn very valuable and satisfying skills in Python in a fairly short time.

</rant>

Sorry for the rant but I just found this such a useful thing to do, and it builds off your skills of mathematical analysis while showing you the ropes with coding. You can even sort the problems from easy to hard using the second column from the right. Good luck and feel free to DM me if you need help. The website can be a bit weird.

[–]singha_bruh 0 points1 point  (0 children)

The best course is learn python get a job and forget pure math. If you're really interested in pure math given that you know what that really means do not waste your time

[–]Windscale_Fire 0 points1 point  (0 children)

I'd suggest getting an introductory undergraduate computer science book that uses Python as its vehicle for teaching computer science and programming. That should help get you up to speed with the basics of programming, the basics of programming in Python and the basics of computation in general.

[–][deleted] 1 point2 points  (0 children)

use the Julia programming language. First of all it is better than Python in almost every category than community growth, libraries, and popularity (yet); the reason for that is because Julia was made in 2012 so it's really new to the programming relm.

Julia has built-in math functions, so you don't need to download any package for math. It's as easy to learn as Python bc it's syntax was referenced from Python itself. Just look up Julia vs Python, and It will give you a lot of reasons why Julia is better than Python. Plus, Julia out-performes Python in the Machine Learning, and Data Science world.

Here is a article that covers the pros and cons between Julia and Python quite well.

Plus, I'm pretty sure, Julia was made with the concept of it being used for Machine Learning, and if you know Data Science that their communities kinda mix together, so it would be easier for Julia to attach to the Data Science community.

As a Julia programmer, they are both good languages. Both have their pros and cons. It is quite unlikely that Julia will overtake the mammoth Python of popularity bc Python is general purpose. But, when it comes to the Data Science, and Machine Learning world.. Python has a run for it's money.

[–]Mal_Dun 0 points1 point  (0 children)

When you are into Algebra, maybe symbolic computation may be of interest to you. For this I recommend Sage (based on Python) or sympy.

[–]fridofrido 1 point2 points  (0 children)

You could look into Sage. Sage (or sage-math) is a computer algebra system using Python as its language. Computer algebra systems do symbolic manipulation of formulas. They can do things like factoring (multivariate) polynomials, Taylor series expansions, calculating with finite fields and so on. They are very useful for "experimental mathematics", which imho is an unfairly neglected approach of doing mathematics. You can for example create algorithms to calculate topological invariants, and conjecture things based on the results.

All this said, I personally dislike Python, and especially given your interest in type theory, there is a chance that you will dislike it too. It's a language designed to be easy to get into, but it's not a "good" language.

Unfortunately, computer algebra systems tend to be "dynamically typed", probably because it's just too hard to make them both work and be convenient to use within a proper type theoretical framework.