#### Overview of this book

Python, one of the world's most popular programming languages, has a number of powerful packages to help you tackle complex mathematical problems in a simple and efficient way. These core capabilities help programmers pave the way for building exciting applications in various domains, such as machine learning and data science, using knowledge in the computational mathematics domain. The book teaches you how to solve problems faced in a wide variety of mathematical fields, including calculus, probability, statistics and data science, graph theory, optimization, and geometry. You'll start by developing core skills and learning about packages covered in Python’s scientific stack, including NumPy, SciPy, and Matplotlib. As you advance, you'll get to grips with more advanced topics of calculus, probability, and networks (graph theory). After you gain a solid understanding of these topics, you'll discover Python's applications in data science and statistics, forecasting, geometry, and optimization. The final chapters will take you through a collection of miscellaneous problems, including working with specific data formats and accelerating code. By the end of this book, you'll have an arsenal of practical coding solutions that can be used and modified to solve a wide range of practical problems in computational mathematics and data science.
Preface
Basic Packages, Functions, and Concepts
Free Chapter
Mathematical Plotting with Matplotlib
Working with Randomness and Probability
Geometric Problems
Finding Optimal Solutions
Miscellaneous Topics
Other Books You May Enjoy

# How to do it...

Follow these steps to create a Faust app that will read (and write) data to a Kafka server and do some simple processing:

1. First, we need to create a Faust App instance that will act as the interface between Python and the Kafka server:
`app = faust.App("sample", broker="kafka://localhost")`
1. Next, we will create a record type that mimics the data we expect from the server:
`class Record(faust.Record):    id_string: str    value: float`
1. Now, we'll add a topic to the Faust App object that sets the value type to the Record class that we just defined:
`topic = app.topic("sample-topic", value_type=Record)`
1. Now, we define an agent, which is an asynchronous function wrapped in the agent decorator on the App object:
`@app.agent(topic)async def process_record(records):    async for record in records: ...`