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

In summary, the person is trying to learn how to program. They are looking for books for beginners, and are using different resources to help learn. They mention that C++ is a difficult language to learn, but that Python is a good option if you're new to programming. They also mention the GMPy library if you need to do floating point calculations.
  • #1
drosser
13
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
  • #2
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
 
  • #3
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:
  • #4
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
 
  • #5
True.

Note that the last link in my post actually linked to the GMP. ;) Great minds think alike...
 
  • #6
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
 
  • #7
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
 

What should I look for in a programming book for beginners?

When searching for a programming book for beginners, it is important to consider the language or technology you want to learn, the level of detail and explanation provided, the author's credentials and teaching style, and the overall organization and structure of the book.

Can I learn programming from a book?

Yes, it is possible to learn programming from a book. However, it is important to supplement your learning with practical application and practice. It may also be helpful to seek out additional resources and support, such as online tutorials or coding communities.

What are some popular programming books for beginners?

Some popular programming books for beginners include "Python Crash Course" by Eric Matthes, "Eloquent JavaScript" by Marijn Haverbeke, and "Head First Java" by Kathy Sierra and Bert Bates. However, the best book for you may depend on your personal learning style and the specific language or technology you want to learn.

Are there any free programming books for beginners?

Yes, there are many free programming books for beginners available online. Some popular resources include "Learn to Code HTML & CSS" by Shay Howe, "Think Python" by Allen Downey, and "JavaScript for Cats" by Max Ogden. These books can be accessed through websites such as GitHub and Codeacademy.

Is it better to learn from a physical book or an e-book?

This may depend on personal preference. Some people prefer the tactile experience of a physical book, while others enjoy the convenience and portability of an e-book. It may also be helpful to consider the features and functionality of the specific e-reader you will be using to determine if it will meet your learning needs.

Similar threads

  • Programming and Computer Science
Replies
1
Views
2K
  • Programming and Computer Science
2
Replies
49
Views
3K
  • Science and Math Textbooks
Replies
7
Views
644
  • Programming and Computer Science
Replies
8
Views
1K
  • Programming and Computer Science
Replies
1
Views
726
  • Programming and Computer Science
Replies
23
Views
1K
  • Programming and Computer Science
Replies
7
Views
681
  • Programming and Computer Science
Replies
8
Views
2K
  • Programming and Computer Science
Replies
1
Views
764
  • Programming and Computer Science
Replies
2
Views
1K
Back
Top