Computer Science Lounge - [Too Many Idea Men Edition]

Thats kind of what I thought, I ran this before using just doubles and it would reach max precision of a double but I wanted to extend that precision and It wasnt clear to me how to use mpf very well.

Sorry, got nothing at this point. As a C++ guy, this is about where I would give up and just use C++ and Boost.Multiprecision.

Ahh, nevermind. Got it.

Use mpf_init2(op, precision) instead of mpf_init(op) and set precision to something high to prevent rounding. I.E. 333 bits should be enough for 100 decimal digits. Source: http://stackoverflow.com/questions/12804362/gmp-division-precision-or-printing-issue

1 Like

do you know why it is not getting 3.14....?

Nope. If you try inputs in steps of 1000 starting at 1000 you'll find that this just goes all over the place. I don't have a full understanding of any of the standard ways to approximate pi via infinite series so I would suggest Wikipedia and a careful study of your code on this one.

I have a feeling that it may be mpf. I will take a closer look.

I think I got it to work.

Actively in the more advanced theory parts of it. What do you need to know?

just curious of who was taking it.

Rational numbers of in the quotient domain of numbers while irrational are in the real domain of numbers.

I never, ever, want to ever think of using racket ever again. I grew to resent that language.

I enjoyed racket actually.

1 Like

It's nice to see programmers coming from the mathematical domains in this thread. Personally, I think a mathematics degree is both more practical and more useful than a computer science degree for obtaining a job and working in software. That said, don't forget to practice good code hygiene, I've seen a lot of mathematicians who write completely unreadable code. It is more important to write easy to read & debug code than it is to write high performing code in most situations.

If you aren't familiar with the software development life cycle then I would suggest the following pattern:

  1. Break your problem down into small bits.
  2. Define your problem in pieces (write tests, formula, or architecture specifying your intended input/output).
  3. Implement each bit, accepting modifications to your design or tests as needed.
  4. Get everything to work.
  5. Measure its performance.
  6. Optimise where it matters.

You would be surprised how effective the above steps are for solving anything from small to big problems. There are many alternatives and options when doing this, but personally, I use test-driven development for almost everything, and I never optimise first.

One important exception to the above personal rules; I will optimise first if the only point in doing the project was to learn about a particular optimisation strategy. Learning is about breaking the rules and finding out what happens.

1 Like

I would disagree heavily on this. I have a roommate that is going for a math degree and he is going for a computer science minor because he said job outlook for pure math majors was not good. Sometimes the only way to get better as programming is to program a lot and to keep doing it. Math majors dont do this, they may understand the theory part but they haven't cut their teeth on trying to program with lots of code.

1 Like

In the UK at least, the numbers are relatively close. However, according to www.prospects.ac.uk, 10.1% of comp.sci degrees lead to unemployment, while 7.2% is the number for a degree in mathematics. Granted, more of the comp.sci majors actually go onto employment than the math majors, but that's because many more of the math majors go onto further study.

Despite that and despite numbers from this page (http://www.savethestudent.org/student-jobs/whats-the-expected-salary-for-your-degree.html#table) indicating that mathematics degrees earn slightly higher than comp.sci degrees, I will admit that the numbers are very close.

Maybe I should have phrased my post as "I would rather work with a math major who's bad at C than someone who's good at C and can't do math.", because that's what I really mean. It seems a lot easier to me for someone to learn a programming language than to learn calculus without a professor. My goal of writing that, however, was to indicate that I want people to focus on good code when writing it, rather than 'whatever works'. Bad code is worse than useless.

What I wanted to write was a post addressed to people who made that choice, to better themselves in code hygiene. An underrated skill that needs to be developed. I probably should have simply omitted anything about getting a job and stuck to my point.

Computer science education is still a joke in the UK. No idea what it's like in the US.

Maby this is where the difference of opinion comes from. In the US as far as I can tell for an entry level position for a math degree you need a masters degree which is possibly why it says they earn more. Computer science majors can begin work after their BS. You should look up the wages for a masters in computer science vs the masters in Math.

Also a computer science education includes software engineering concepts and mathematics. Math majors wont know what design patterns are, software requirements, design.We also have to take a math proofs course, calc 1, calc 2, linear algebra, theory of computation and 2 algorithm courses. Those are the most mathematical of the courses we have to take.

In the UK only about 30,000 US dollars

In the US I place I will be working at shortly

I think I should expand on what skills I really care about in a software engineer, but first some more direct responses to you:

Design patterns, software requirements, design, and the software lifecycle are relatively low skill engineering problems. Implementing a known solution is the easiest bit of the job in my opinion.

Yea this is hugely different to the degree I took. You wouldn't find mathematical proofs in my classes.


The problem we are talking about here to me boils down to the problem with the term "Computer Scientist". For the longest time, computer science has been a engineering degree. Adding the word 'science' there to me is a misleading marketing tactic, given the education that I've seen in the field. I'd prefer it to be called a 'computing' degree, which I would find more accurate.

By the sounds of it maybe universities (and maybe even some high schools) are changing this by providing the correct education for it to be called 'science' rather than changing the name, which in my eyes is the best solution.

If this is the case, ignore my points on education altogether as my information is old.


The underlying problem: Learning a programming language is easy, just about anyone can do it. If the most mathematics you know only goes as far as basic calculus and you wouldn't know how to (E.G.) construct a mathematical proof or a meaningful empirical proof, then you are not a scientist, and you would probably be a pretty mediocre engineer.

Mathematics, logical deduction, good empirical reasoning. These skills are more to the essence of programming than code. The code is just marble to our chisel, the gaps mean more than what remains. With no knowledge of software development, you wouldn't have a chisel. With only knowledge of software development, you don't know where to strike.

I can teach someone not to write shit code. Heck, a linter can teach someone that over time. But it's much harder for me to teach a new software engineer why the performance metric they just produced is completely meaningless, and that their statistics are garbage. Or to teach them how to solve a problem in the first place.

I agree but all that is included in my computer science curriculum thats why its not called a programming degree. We have essentially 3 types of classes, with overlap. We start with 3 programming classes that teach us enough to expand from there. They require programming every week of the semester and even more the further along you go. The company I will be working for this summer highly values programming practice. You can learn to shoot a bow in a day but it takes years to become a master at it. Secondly we have math based courses, we cover stats, discrete mathematics so we have to look at algorithms at a proof level, theory of computation which is more math mathematical proofs with alphabets, grammars and other things. We have a into to algorithms course that uses Java and the second one is more advanced and looks at it with a proof level,we have a functional programming course that I am not sure too much about, Then we have our basic math like calculus and linear. Our third type of classes are software engineering classes that look at everything from software requirements to software design.

The reason I went for computer science over software engineering is what you are saying. I think it would be better to learn the theory in college and learn the gaps of software engineering we dont get in college during internships. The math majors dont have to take any courses like theory of computation so we actually do learn a field of mathematics that the math majors dont cover.

Send me a flow chart of the course you took I am curious of the difference.

Sorry, still not that interested in doxing my self ;)

doxing yourself by sending a flow chart from your university or college?