
The Statistics and Calculus with Python Workshop
- 740 pages
- English
- ePUB (mobile friendly)
- Available on iOS & Android
The Statistics and Calculus with Python Workshop
About this book
With examples and activities that help you achieve real results, applying calculus and statistical methods relevant to advanced data science has never been so easyKey Features• Discover how most programmers use the main Python libraries when performing statistics with Python• Use descriptive statistics and visualizations to answer business and scientific questions• Solve complicated calculus problems, such as arc length and solids of revolution using derivatives and integralsBook DescriptionAre you looking to start developing artificial intelligence applications? Do you need a refresher on key mathematical concepts? Full of engaging practical exercises, The Statistics and Calculus with Python Workshop will show you how to apply your understanding of advanced mathematics in the context of Python.The book begins by giving you a high-level overview of the libraries you'll use while performing statistics with Python. As you progress, you'll perform various mathematical tasks using the Python programming language, such as solving algebraic functions with Python starting with basic functions, and then working through transformations and solving equations. Later chapters in the book will cover statistics and calculus concepts and how to use them to solve problems and gain useful insights. Finally, you'll study differential equations with an emphasis on numerical methods and learn about algorithms that directly calculate values of functions.By the end of this book, you'll have learned how to apply essential statistics and calculus concepts to develop robust Python applications that solve business challenges.What you will learn• Get to grips with the fundamental mathematical functions in Python• Perform calculations on tabular datasets using pandas• Understand the differences between polynomials, rational functions, exponential functions, and trigonometric functions• Use algebra techniques for solving systems of equations• Solve real-world problems with probability• Solve optimization problems with derivatives and integralsWho this book is forIf you are a Python programmer who wants to develop intelligent solutions that solve challenging business problems, then this book is for you. To better grasp the concepts explained in this book, you must have a thorough understanding of advanced mathematical concepts, such as Markov chains, Euler's formula, and Runge-Kutta methods as the book only explains how these techniques and concepts can be implemented in Python.
Frequently asked questions
- Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
- Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Information
1. Fundamentals of Python
Introduction
Control Flow Methods
if Statements
Exercise 1.01: Divisibility with Conditionals
- Create a new Jupyter notebook and declare a variable named x whose value is any integer, as shown in the following code:x = 130
- After that declaration, write an if statement to check whether x is divisible by 5 or not. The corresponding code block should print out a statement indicating whether the condition has been met:if x % 5 == 0:print('x is divisible by 5')Here, % is the modulo operator in Python; the var % n expression returns the remainder when we divide the var variable by the number, n.
- In the same code cell, write two elif statements to check whether x is divisible by 6 and 7, respectively. Appropriate print statements should be placed under their corresponding conditionals:elif x % 6 == 0:print('x is divisible by 6')elif x % 7 == 0:print('x is divisible by 7')
- Write the final else statement to print out a message stating that x is not divisible by either 5, 6, or 7 (in the same code cell):else:print('x is not divisible by 5, 6, or 7')
- Run the program with a different value assigned to x each time to test the conditional logic we have. The following output is an example of this with x assigned with the value 104832:x is divisible by 6
- Now, instead of printing out a message about the divisibility of x, we would like to write that message to a text file. Specifically, we want to create a file named output.txt that will contain the same message that we printed out previously.To do this, we can use the with keyword together with the open() function to interact with the text file. Note that the open() function takes in two arguments: the name of the file to write to, which is output.txt in our case, and w (for write), which specifies that we would like to write to file, as opposed to reading the content from a file:if x % 5 == 0:with open('output.txt', 'w') as f:f.write('x is divisible by 5')elif x % 6 == 0:with open('output.txt', 'w') as f:f.write('x is divisible by 6')elif x % 7 == 0:with open('output.txt', 'w') as f:f.write('x is divisible by 7')else:with open('output.txt', 'w') as f:f.write('x is not divisible by 5, 6, or 7')
- Check the message in the output text file for its correctness. If the x variable still holds the value of 104832, your text file should have the following contents:x is divisible by 6
Table of contents
- The Statistics and Calculus with Python Workshop
- Preface
- 1. Fundamentals of Python
- 2. Python's Main Tools for Statistics
- 3. Python's Statistical Toolbox
- 4. Functions and Algebra with Python
- 5. More Mathematics with Python
- 6. Matrices and Markov Chains with Python
- 7. Doing Basic Statistics with Python
- 8. Foundational Probability Concepts and Their Applications
- 9. Intermediate Statistics with Python
- 10. Foundational Calculus with Python
- 11. More Calculus with Python
- 12. Intermediate Calculus with Python
- Appendix