Programming Books for Beginners | Find the Right Book for Your Project

  • Thread starter Thread starter drosser
  • Start date Start date
  • Tags Tags
    Books Programming
Click For Summary
SUMMARY

This discussion focuses on programming book recommendations for beginners, specifically for those interested in Python and C++. Python is highlighted as an ideal language for arbitrary-precision integer math due to its native long data type. Recommended resources include "Learning Python" and "Programming Python" from O'Reilly. For C++ learners, the latest Nightly Build of Code::Blocks or Dev-C++ is suggested, along with the GNU Multiple-Precision Library (GMP) for arbitrary-precision arithmetic.

PREREQUISITES
  • Basic understanding of programming concepts such as variables, loops, and functions.
  • Familiarity with Python 3.x and its data types, particularly the long type.
  • Knowledge of C++ syntax and compilation processes.
  • Experience with command line operations for running scripts.
NEXT STEPS
  • Explore Python tutorials on python.org to solidify foundational skills.
  • Read "Learning Python" and "Programming Python" from O'Reilly for in-depth knowledge.
  • Investigate the GNU Multiple-Precision Library (GMP) for advanced arithmetic in C++.
  • Learn how to use the GMPy module in Python for arbitrary-precision floating-point calculations.
USEFUL FOR

Beginner programmers, students in computer science, and anyone looking to develop skills in Python or C++ for mathematical programming projects.

drosser
Messages
13
Reaction score
0
I want to get into programming. Does anyone have any suggestions for books for beginners?

My goal is to make a program to finish my project at https://www.physicsforums.com/showthread.php?t=172789

Is there already a program that can do this?
 
Technology news on Phys.org
Mathematica can do it.

Or you can write your own program. If you're looking for a language that can easily do arbitrary-precision integer math, I'd look into Python. Python includes a native data type called long, which is an arbitrary-precision integer type that you can use just like any other number. Furthermore, Python is pretty easy to pick up.

Look on python.org for some tutorials, or pick up a copy of Learning Python from O'Reilly if you're completely new to programming. If you already have some programming experience in other languages, pick up Programming Python, also from O'Reilly.

- Warren
 
Python is a good language. I also recommend C++. If you search Google for something like "Beginner C++ Tutorials," you can probably find many good tutorials to help you with your problem, such as this one. C++ needs to be compiled (into native code so that your computer can understand it), so you'll need a compiler. I would recommend the latest Nightly Build of Code::Blocks, but I think that for what you seem to be doing, something that may be easier to install such as http://www.bloodshed.net/dev/devcpp.htm might be better (I'm assuming you're using Windows). Once you've downloaded and installed a compiler and feel comfortable with C++ (variables, loops, functions, object-oriented programming, etc.), I suggest checking out this.
 
Last edited by a moderator:
bfr,

C++ is fine, but it provides no built-in arbitrary-precision arithmetic and is syntactically and semantically much more difficult to learn than Python. However, if you choose to use C++, you might find GMP (the GNU Multiple-Precision Library) useful.

- Warren
 
True.

Note that the last link in my post actually linked to the GMP. ;) Great minds think alike...
 
I've been looking into the Python.

The python.org interpreter didn't work but I do have a command line interpreter.

How to you run a script file from the command prompt?
I've tried "read" and "write" functions but I'm pretty sure those aren't the right ones to use.

Also, I can't figure out how to turn on the precision numbers. When I make a calculation the interpreter just rounds the nearest integer. I tried to use the "if" command to escape when the program found an integer value, but the number is already rounded, so the number entered for x is outputted.

x = int(raw_input("Enter an integer: ")
if ((x*x)-R)/(P-(2*x)) == round(((x*x)-R)/(P-(2*x)))
print x
else:
x = x+1

The enter integer is for a starting number
 
drosser said:
How to you run a script file from the command prompt?
I've tried "read" and "write" functions but I'm pretty sure those aren't the right ones to use.

You type a command like python myscript.py where myscript.py is the name of your program.

Also, I can't figure out how to turn on the precision numbers. When I make a calculation the interpreter just rounds the nearest integer. I tried to use the "if" command to escape when the program found an integer value, but the number is already rounded, so the number entered for x is outputted.

If you're doing integer division, then just use the long datatype (rather than int), and carry on. If you need to do arbitrary-precision floating point division, then you need to install the GMPy module and use that. (You can check to see if GMPy is already installed by typing "import gmpy" in the Python interpreter.) Once GMPy is installed, just use code like this:

Code:
import gmpy, math

m = gmpy.mpf(math.pi)
print m ** 300

where gmpy.mpf is a multiple-precision floating point number.

- Warren
 

Similar threads

  • · Replies 49 ·
2
Replies
49
Views
4K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 23 ·
Replies
23
Views
2K
  • · Replies 9 ·
Replies
9
Views
11K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 7 ·
Replies
7
Views
1K
  • · Replies 8 ·
Replies
8
Views
3K
Replies
8
Views
3K
  • · Replies 16 ·
Replies
16
Views
2K
  • · Replies 58 ·
2
Replies
58
Views
5K