r/AskProgramming • u/[deleted] • Apr 24 '21
I like Math, will I enjoy programming too?
I know this is something I just have to try out and see for myself, and I will. But I wonder how you guys view the topic. If someone likes mathematics, will they like programming aswell?
At first I was like "no way I want to sit infront of a computer all day, looking at numbers and letters", then I realised "wait that's exactly what Math is", and I really do enjoy math! So is math and programming actually comparable? What are the similarities?
Thank you!
11
u/amasterblaster Apr 24 '21
I've done about 4 years of full time theoretical work (math, paper, latex) in a research lab and about 21 years of programming (many languages).
Hard to say. There is an intersection. I miss math for my ability to go on long walks thinking, and for that to be work. Possibly because I am better at programming now, most of the problems are easy to solve, so it feels like grunt work, chasing bugs.
But, I do remember about 15 years ago in programming, feeling the same way about it as I do now math.
Programming has a lot more bugs, but way more interaction / simulation. Math has a lot more tedious paper work and formatting, but way more puzzles.
3
u/skellious Apr 24 '21
I still do my best programming while out for a walk or driving. I suddenly think of how to do something better or a refactor I could make.
This is because I constantly push myself to try new uncomfortable programming challenges like I've recently stepped into web APIs and I'd never really touched that before.
11
u/WeakMetatheories Apr 24 '21 edited Apr 24 '21
At some formal level, math has a lot of similarities with programming languages.
They both have a syntax and a semantics. The semantics of choice in mathematics is usually Tarski's inductive definition of truth, with models involved. In programming, the semantics are specified by the "language specs".
What a Java source file does is ultimately up to whatever program you feed it to, but if that program is actually a Java compiler, it must do what it's told by the Java spec. In other words, you can't just write any program that takes valid Java code, spits back out bytecode for a JVM, and call it a Java compiler. It must preserve the intended semantics of the spec. Similarly, you cannot just write your own semantics for mathematics and expect other mathematicians to understand you.
In mathematics, statements have to adhere to a usually implicit grammar that you pick up as you go from other mathematicians, but a formal one exists. You can usually find such a grammar in any good introductory book to mathematical logic.
Every programming language has a formal grammar, just like well formed formulae in mathematical logic are generated by a formal grammar, and you can google it. Try looking up the C grammar.
If you feed a C compiler an invalid C program (does not adhere to the C grammar) then it will reject it. If you feed a mathematician a proof attempt with undefined words and unclear reasoning, they'll probably reject it.
The C compiler would try to parse your code into lexemes and eventually an abstract syntax tree and fail, while the mathematician would try to check whether your steps are correct and (hopefully) find a mistake.
Now, will you enjoy programming? Depends on the language, your available resources, your patience, and whether or not it's for a job. I suggest if you want to learn, you start with finding a very heavily recommended book for the language you end up picking. In my opinion, YouTube does not cut it. I would not start with languages that have a lot of keywords involved to write even the simplest of programs, as it will confuse you. However, with a good reference any language is ok really. Just be ready to make programs that crash every five seconds for the first few months, especially if you're using low level languages. Find a good debugger if you pick low level languages, most IDEs support debugger integration.
10
u/givemeagoodun Apr 24 '21
Programming is more involved with logic than math, if you like logical thinking (like me) you'd love programming.
However compression algorithms involve a lot of math, so you might like that kinda stuff.
2
u/AzurasTsar Apr 24 '21
Not just that, there are fields of programming - game engines, computer graphics, machine learning, etc that are heavily math based
3
u/jackietwice Apr 24 '21
My personal story on this is decades ago when my friends were getting into programming I was very much a math person, and they thought I should get into programming, too. I gave it a shot ... and hated it. I thought the exercises we were doing were dumb. There weren't many numbers, and there was way too much punctuation. I was miserable, and avoided it like the plague after that.
Fast forward 25 years and I finally ran into a situation where I was genuinely curious about something to the point of being willing to learn how to code. I started with Java. Again ... I was miserable. It was nothing like math in my mind. They call them programming languages for a reason. It is like learning how to speak a foreign language. Once I figured that out and once I finally got to the point where I was making things that I thought were functional happen ... I loved it. I truly enjoy programming. And I had to remember what it was that made me love math so much in the first place -- the problem solving process. I like them both for that reason, but my brain processes programming and mathematics differently, so I personally don't consider them to be the same. The concepts of logic and algorithms are the big cross over points as far as I see it.
But if you like to solve a good problem :) or want to do a cool thing ... it doesn't hurt to give it a shot.
Aside, I plowed through a full semester of Java completely overwhelmed and mostly miserable, but I really wanted to complete a course study, so I stuck it out. Technical stuff doesn't always come easily to me. I am a stubborn learner, not a savant learner. But at the end of a calendar year, I finished my program and realized how much I enjoyed the coding process by that point. So if it doesn't just click. That's cool. But also sometimes it's not going to immediately. I have a high pain threshold for frustration if I really want to do something, so like I said, once I found a functional reason to need to know how to code, I was at it until I got it.
So the question might be, why do you like math? :)
2
u/MyPythonDontWantNone Apr 24 '21
I work as a data analyst. It combines math and programming. Some days are mindless data cleaning. Others are solving technical problems affecting the work of hundreds of employees.
2
u/jibbit Apr 24 '21
Maybe! Programming as a 'thing' is very broad, and applicable to lots of things. Scientists at CERN and NASA are programming. Traders on Wall Street are programming. People making games and websites are programming. People solving logic proofs and curing cancer and making lovable robot dogs are programming. If you have any aptitude for it you should learn it. It's a general, transferable skill. Then you can find the kind of programming that you enjoy (or just find useful).
2
u/gcross Apr 24 '21 edited Apr 24 '21
Boy are you in luck, because according to the Curry-Howard correspondence there is a sense in which programming and doing math are fundamentally the same thing on a deeper level than the mere fact that both involve manipulating symbols and numbers! Now, this only really comes through with programming languages with a sufficiently powerful type system, but lucky for you there are multiple such dependently typed languages to play with!
One of the oldest and most famous ones I am aware of is Coq (for Chicken, if you were wondering; it's a French thing to name programming languages after animals). In particular I recommend this free online book as an introduction to using Coq to blend programming and proofs.
While Coq was designed to be proof language which you can also use for programming, Agda was built from the ground up to be a programming language that is powerful enough that you can express mathematics in it. It isn't so much that it is completely different from Coq so much as it attacks the same design space from a different angle, and it is really cool because it blurs the line between proofs and programming even more than Coq does so I recommend checking it out!
Finally, if you are interested in actually writing code to do things, then you may want to check out Idris (and possibly the next generation built from lessons learned from it but still very much in development, Idris 2) because this language was designed from the ground up to be a practical tool in which to write programs while still being based fundamentally on dependent types and thus being very proof-centric, unlike Coq and Agda which are more specialized in being programming languages in which to express mathematics.
Oh... I guess if you actually wanted to get things done you might want to check out Haskell, which is a lazy functional programming language with a very powerful but not quite dependently typed type system (though it is getting there bit by bit as they add more and more new features to the type system), which makes it incredibly boring by comparison but features things like a ton of available libraries online in case you want to dirty your hands by writing something practical like a web app or something. It's also literally orders of magnitude more popular so there is a ton of resources on how to learn it and larger communities and some jobs and other such trivialities, if you care about such things. (I kid, of course; I enjoy programming in Haskell more than most other languages so for personal projects it is the language I keep coming back to.)
Of course, if you just want a programming language that is easy to learn and even more widely used but doesn't have a powerful type system because when push come to shove you don't actually care that much whether the code you've just written is correct or not, and in particular you won't mind if half-way through completing some long task your code crashes because you misspelled a variable name when making a change that you hadn't tested carefully enough because it seemed to be obviously fine at the time, there is always Python...
4
u/bsenftner Apr 24 '21
Programming and math are pretty much the same thing, programming is applied math. However, programming and being a software developer as a career are extremely different. If you enjoy math, stick to the math and pursue math or engineering as a career. Software development is, frankly, too easy to learn and therefore the industry is filled with mediocre developers that drag the entire industry down into assembly line like "code frameworks" which implement all the interesting parts, package that up, and the jobs are barely more than complicated puzzles you're pressured to complete in less time than is ethically wise for the nature of the work.
1
u/Tularion Apr 24 '21
I think they can elicit similar feelings at times, when doing something "elegantly" in either. It's obviously different, though. If you don't expect it, you might be frustrated by all the configuration and debugging things that look like they should work. But sure, if you feel like getting into programming, you should!
1
u/bigbirdtoejam Apr 24 '21
That depends on the type of programming. Machine Learning involves a lot of discrete math and advanced statistics. Functional languages might be fun. Shy away from UI design and things labeled "front end" unless you want to challenge yourself with graphic design, usability, and worrying as much about peoe as machines.
1
u/VirtualLife76 Apr 24 '21
I've basically never used math in my 30 years of coding. Programming is more logic/puzzles, fortunately for me, because I suck at math.
That being said, there are fields in programming that require complex math such as some medical, low level graphics or seismographic programming. Also as op said, functional programming is closely tied to how math works.
The nice thing for you, if you are good at math and programming, it's a fairly niche skillset. There may not be many jobs available, but there won't be many applicants either.
1
u/StrangePractice Apr 24 '21
If you get into Software Engineering it’s pretty technical with UML, Designs pattens and architectural patterns.
The best way I can compare that to is: writing a full on Essay in one format vs another. As others have mentioned, look at some languages like Clojure and you might enjoy that more!
1
u/Ikkepop Apr 24 '21
Most likely you will. I remember when I was but a wee boy and I got into coding , it kinda made me lot better at math as a bonus. While its not the same, it triggers same brain centers
1
u/KingofGamesYami Apr 24 '21
A lot of computer science is math. Take a look at graph theory or machine learning for examples.
Day-to-day programming is much less math, and far more problem solving. Math also involves problem solving, so you might enjoy it - it'd hard to say.
1
u/CatKungFu Apr 24 '21
I’ve had two fun jobs in my life so far, one was tree surgery and the other was programming.
If you like algorithms and solving problems then you will LOVE programming.
Programming is about logic and creating procedures that flow through step by step, making decisions based on logic. Math comes into programming heavily depending on what you’re trying to accomplish.
It’s not difficult once you understand and gain some familiarity but recommend you choose a project, something you decide to create in order to learn but nothing too complicated to start with or you may fail and give up. You can raise the bar as you gain more experience (which won’t take long).
Give it a try.. maybe python would be fun and useful.
1
Apr 24 '21
I hate math, but I love programming. Thankfully, your code will do all the math for you, the hard part really becomes properly applying the formulas in your code to get the desired result. I still have to Google even the most basic formulas.
1
u/justingolden21 Apr 24 '21
I'd say you're more likely to like programming than the average person, but it's no guarantee. Programming is a large field, there will likely be some parts you like and others you don't. That being said, it doesn't hurt to try. Try it out and see what you like. Start with either python or web dev (html, css, js) and watch videos from the net ninja and use sololearn (mobile app) and w3 schools (website)
1
u/myearwood Apr 24 '21
Programming can be solving a problem as elegantly as possible. There are a lot of mediocre programmers out there. A simple thing like return the number of weekdays (MTWTF) excluding Sat and Sun between any two dates can be done like an 8 year old by looping through the range and counting all the weekdays. That's the usual answer.
A much faster way would be 5/7ths of the number of days adjusting for start and end.
1
u/WhipsAndMarkovChains Apr 25 '21
Well it's certainly fun solving math puzzles with code. For example, you can solve this flip to freedom puzzle easily enough with pen and paper, but I enjoyed writing code to solve it instead.
1
1
Apr 24 '21
Depends on what type of math. If you love calculus, be an engineer not a programmer. If you love logic, proofs, base-2 math, and statistics then yeah you will probably like programming.
Keep in mind that most people hate being bad at programming. It's hard to truly enjoy it before you know what you're doing. If you dont like it at first but really want to, try a variety of learning resources to find one that best matches your learning style.
1
u/hugthemachines Apr 24 '21
You will not automatically like programming just because you like math.
If I were to make a general statement... People who like programming often felt very eager to try it out. So judging by that over simplified evaluation I would say there is a risk you will not like programing. If you had an urge to explore it, you would already have done that a little bit instead of asking others if you will like it.
like I said, that is an oversimplification and no random strangers on the internet can tell you what you will like.
0
Apr 24 '21
[deleted]
1
Apr 24 '21
A few weeks ago my sister and father had a disscussion about how "I like math because it gives you defined answer, while programming gives you so many different ones"
I can't completley translate what she said, but what did she actually mean? That programmaring had many different answers?
39
u/wsppan Apr 24 '21
Look at functional programming languages as they are very closely mapped to mathematical constructs. You might enjoy writing code using pure functions, recursion, closures, and lambda calculus.