C++ Data Type Usage

The Going Overboard section on page 43 of C++ All-In-One for Dummies, 3rd Edition talks about the problems that can occur when you try to stuff a number that’s too large into a specific data type. The problem with the example shown:

    cout << 8762547892451 * 10 / 2 * 3 + 25 << endl;

is that it doesn’t actually result in an error. C++ accepts the large number by using a data type that can hold it automatically, rather than using a default data type of long as would have happened in the past. It’s nice that C++ automatically fixes ambiguous code for you, but it also means that the example doesn’t work as described in the book. In order to see the example as originally intended, you need to change the code to read:

    long MyLong = 8762547892451 * 10 / 2 * 3 + 25;
    cout << MyLong << endl;

The code will now produce an error, just as described in the book, because the data type isn’t ambiguous any longer. The error message does differ slightly. What you’ll see is an error message of:

warning: overflow in implicit constant conversion [-Woverflow]

Except for having to make the code less ambiguous, the section should continue to work as it did before. Please let me know if you have any questions or concerns about this example at John@JohnMuellerBooks.com.

 

Announcing MATLAB for Dummies

If you’ve ever wondered how to solve certain kinds of advanced mathematics, then MATLAB may fulfill the need for you. Schools are also using MATLAB as a teaching tool now because it provides so many visual aids. MATLAB for Dummies helps these two groups and many others. If you’ve wanted to use a product like MATLAB, but find the learning curve way too high, then you really do need this book. Here’s what you’ll find inside:

  • Part I: Getting Started With MATLAB
    • Chapter 1: Introducing MATLAB and its Many Uses
    • Chapter 2: Starting Your Copy of MATLAB
    • Chapter 3: Interacting with MATLAB
    • Chapter 4: Starting, Storing, and Saving MATLAB Files
  • Part II: Manipulating and Plotting Data in MATLAB
    • Chapter 5: Embracing Vectors, Matrices, and Higher Dimensions
    • Chapter 6: Understanding Plotting Basics
    • Chapter 7: Using Advanced Plotting Features
  • Part III: Streamlining MATLAB
    • Chapter 8: Automating Your Work
    • Chapter 9: Expanding MATLAB’s Power with Functions
    • Chapter 10: Adding Structure to Your Scripts
  • Part IV: Employing Advanced MATLAB Techniques
    • Chapter 11: Importing and Exporting Data
    • Chapter 12: Printing and Publishing Your Work
    • Chapter 13: Recovering from Mistakes
  • Part V: Specific MATLAB Applications
    • Chapter 14: Solving Equations and Finding Roots
    • Chapter 15: Performing Analysis
    • Chapter 16: Creating Super Plots
  • Part VI: Part of Tens
    • Chapter 17: Top Ten Uses of MATLAB
    • Chapter 18: Ten Ways to Make a Living Using MATLAB
  • Appendix A: MATLAB’s Functions
  • Appendix B: MATLAB’s Plotting Routines
  • Appendix C: Geometry, Pre-calculus, and Trigonometry Review

This book starts out simply and gently introduces you to the various tasks that MATLAB can perform. By the time you get done, you can perform many basic and a few complex tasks with MATLAB. The important part is that you’ll be in a position to use the tutorials and other learning aids that MathWorks provides to use with MATLAB. Making the learning process both simple and enjoyable is the main goal of this book. When dealing with a complex product such as MATLAB, you really do need the simpler introduction.

MATLAB is an amazing product. Once you start using it, you’ll wonder how you ever got along without it. Not only does it help you solve complex math problems, but you can also use it for a wide range of plotting needs (many of which are covered in the book). This book also acts as an idea generator to help you better use the capabilities of MATLAB. It’s amazing to discover just how many people use MATLAB and the ways in which they employ it.

I want to be sure you have the best possible learning experience. If you have any questions about this book, please feel free to contact me at John@JohnMuellerBooks.com. Please keep your questions book-specific. If you have questions about MATLAB as a product, please address those questions to MathWorks. I’ll be providing more posts about this book soon, so please come back to my blog to discover more about MATLAB for Dummies.

 

Beta Readers Needed for MATLAB for Dummies

Math is the basis for a good many human endeavors and we often use it without thinking about it. For example, when you go to the store to buy groceries, the clerk who checks you out relies on math to compute how much you owe. Perhaps you also used math as you shopped to ensure that you didn’t go over your budget. In addition, you might have used math to convert one unit of measure to another so that you’d know how much of a particular item to get. In looking at two similar products, you used math to decide which one offered a better deal. You get the idea. It truly isn’t possible to perform even the simplest task without using math in some way.

As the use of math for performing a task becomes more complex, so does the need for precision, accuracy, and an understanding of how math works. MATLAB is a product designed to help people perform complex math tasks more efficiently, accurately, and with less effort. In addition, you obtain a level of precision that only a computer can provide consistently. However, MATLAB itself is somewhat complex, which is why I’m writing MATLAB for Dummies with my coauthor Jim Sizemore (The Fun Physicist who has extensive MATLAB experience). The two of us want to make your MATLAB experience fun and interesting. With this in mind, we’ve put together the following outline:

 

  • Part I: Getting Started With MATLAB
    • Chapter 1: Introducing MATLAB and its Many Uses
    • Chapter 2: Starting Your Copy of MATLAB
    • Chapter 3: Interacting with MATLAB
    • Chapter 4: Starting, Storing, and Saving MATLAB Files
  • Part II: Manipulating and Plotting Data in MATLAB
    • Chapter 5: Embracing Vectors, Matrices, and Higher Dimensions
    • Chapter 6: Understanding Plotting Basics
    • Chapter 7: Using Advanced Plotting Features
  • Part III: Streamlining MATLAB
    • Chapter 8: Automating Your Work
    • Chapter 9: Expanding MATLAB’s Power with Functions
    • Chapter 10: Adding Structure to Your Scripts
  • Part IV: Employing Advanced MATLAB Techniques
    • Chapter 11: Importing and Exporting Data
    • Chapter 12: Printing and Publishing Your Work
    • Chapter 13: Recovering from Mistakes
  • Part V: Specific MATLAB Applications
    • Chapter 14: Solving Equations and Finding Roots
    • Chapter 15: Performing Analysis
    • Chapter 16: Creating Super Plots
  • Part VI: Part of Tens
    • Chapter 17: Top Ten Uses of MATLAB
    • Chapter 18: Ten Ways to Make a Living Using MATLAB
  • Appendix A: MATLAB’s Functions
  • Appendix B: MATLAB’s Plotting Routines
  • Appendix C: Geometry, Pre-calculus, and Trigonometry Review


As you can see, this book is going to give you a good start in using all the functionality that MATLAB has to offer. Because of the subject matter, I really want to avoid making any errors in book, which is where you come into play. I’m looking for beta readers who use math as part of their profession and think they might be able to benefit from the functionality that MATLAB provides. As a beta reader, you get to see the material as Jim and I write it. Your comments will help us improve the text and make it easier to use.

In consideration of your time and effort, your name will appear in the Acknowledgements (unless you specifically request that we not provide it). You also get to read the book free of charge. Being a beta reader is both fun and educational. If you have any interest in reviewing this book, please contact me at John@JohnMuellerBooks.com and will fill in all the details for you.

 

Finding Math Libraries for Your Next JavaScript Project

Finding precisely the JavaScript math library you need can be difficult. In both HTML5 Programming with JavaScript for Dummies and CSS3 for Dummies I define a need to perform math tasks accurately. Both books provide some workarounds for the inaccuracies inherent in performing floating point math. It’s important to remember that some numbers can’t be represented properly in the decimal system used by humans, that there are other numbers the computer can’t represent accurately in decimal, and that there are also error present in converting decimal numbers to binary and vice versa. In short, there are a number of levels at which math errors can occur. Yes, it’s true that the math errors are small, but they become a concern when performing large calculations, some of which can’t suffer any level of error (such as plotting a course to Mars).

The problem is so significant in some cases, that trying to work around the issues becomes an application development task in its own right. It’s for that reason that I started looking for math libraries to perform certain tasks. After all, it’s a lot easier to let someone else do the heavy lifting when it comes to a complex calculation. You can read about the results of some of this research in my article entitled, “Four Serious Math Libraries for JavaScript.” The article not only details the source of many of these errors in great detail, but reviews four libraries you can use to solve them.

The important takeaway I got from the research is that, like many programming tasks, there is no one library that does it all. Each library had something to recommend it. However, each library was sufficiently robust that you shouldn’t need to combine them to create your application. The point is to choose the one library that best meets your needs.

I’m actually looking into a number of library types for use in JavaScript programming. The advantage of JavaScript is that it does provide incredibly strong community support in the form of libraries that you simply use as needed. What sorts of issues do you encounter when writing applications using JavaScript. Let me know what kinds of libraries that you’re having a hard time finding at John@JohnMuellerBooks.com. I’d be more than happy to perform the research for library types that receive enough reader support and report my findings to you.

 

Review of Math for the Zombie Apocalypse

Making learning fun is something every author struggles with and few authors achieve. Math for the Zombie Apocalypse is one of the few books out there that actually make a mundane topic like mathematics fun. The essential content of this book is the same as the content for any beginning math book you have ever read. There is no way to get around the requirement of having to learn addition, subtraction, multiplication, and division. However, this book accomplishes its task with panache.

The reader is instantly engaged in a favorite topic of children today, avoiding zombies. Of course, it’s one thing to say that you want to avoid zombies, but it’s quite another to actually accomplish the task. Throughout the book, the reader is asked how he or she would prove their mettle against hoards of zombies roaming the land. The answer is to use math to figure out how to stay alive while less skilled acquaintances become zombies themselves.

Of course, the book is meant entirely in fun. The humor is grand and of the sort that children will enjoy immensely. However, the result of reading the book is that a child sees a useful purpose in learning math—even though this purpose is quite fictional in nature. Most math books out there are dry, humorless tomes filled with mind numbing repetition that will lull the most stalwart child to sleep. There is no reason that a child can’t learn new skills in a fun-filled environment. Before the reader realizes it, he or she has learned new and useful skills.

Fortunately, this isn’t the only book the author intends to write. You’ll want to wait to see the new additions to the for the Apocalypse series, but for now, make sure you check out Math for the Zombie Apocalypse, especially if you have a child that is having a hard time learning the basics. This is the sort of book that I wish had been available when I was growing up and one that I hope others see as being a valuable way to get kids interested in an essential topic. The press, teachers, parents, and even a few students complain about the low scores children achieve in basic math today, but this book does something about the problem.