42 Free University Books (PDF/HTML)

πŸ’‘ About this free book collection. Below are some of the highest-quality university textbooks that you can legally read and download for free. Each entry lists the title (in bold), the author(s) in italics, and the available formats with notes on whether a sign-up is required. Links point directly to the free books – I … Read more

Leverage Plays — Growing $10k to $472k using 50% Margin Loans to Buy a 30% CAGR Asset

Problem Formulation In this investment analysis, we explore three scenarios to compare how leveraging impacts the growth of an initial $10,000 investment over a period of 10 years. By visualizing these scenarios, we clearly see the potential gains from leverage and the exponential increase in asset value, particularly in the aggressive re-leveraging approach. πŸ’‘ Note: … Read more

NumPy @ Operator vs np.dot()

Both the @ operator and the dot function are pivotal for matrix multiplication. However, beginners and even some seasoned programmers might find themselves puzzled over which to use and when. What are the @ Operator and dot Function? NumPy, Python’s fundamental package for scientific computing, offers several ways to perform operations on arrays and matrices. … Read more

How to Fit a Curve to Power-law Distributed Data in Python

In this tutorial, you’ll learn how to generate synthetic data that follows a power-law distribution, plot its cumulative distribution function (CDF), and fit a power-law curve to this CDF using Python. This process is useful for analyzing datasets that follow power-law distributions, which are common in natural and social phenomena. Prerequisites Ensure you have Python … Read more

Visualizing Wealth: Plotting the Net Worth of the World’s Richest in Log/Log Space

The distribution of wealth, especially when it comes to the ultra-wealthy, is a subject of immense fascination and study. It can reveal patterns and insights into economic structures, inequality, and financial dynamics at the highest levels. One of the most revealing ways to examine this distribution is through a log/log plot of the net worths … Read more

5 Best Ways to Create NumPy Arrays of Random Numbers in Python

πŸ’‘ Problem Formulation: In scientific computing with Python, it’s a common task to create arrays of random numbers using the NumPy library, whether for initializing parameters in machine learning algorithms, for simulations, or just for data analysis. For instance, a user may need an array of 10 random floats within the range 0 to 1 … Read more

5 Best Ways to Create a NumPy Array of Strings

πŸ’‘ Problem Formulation: How do you create a NumPy array consisting solely of strings? Understanding how to construct a NumPy array of strings is essential for handling textual data in scientific computing. The problem tackled here is the creation of such an array given a sequence of strings, such as [‘apple’, ‘banana’, ‘cherry’], and transforming … Read more

5 Best Ways to Create Numpy Arrays of Tuples in Python

πŸ’‘ Problem Formulation: When working with large datasets in Python, it’s common to need to create Numpy arrays that hold tuples as their elements. This problem revolves around transforming a collection of tuples, representing multidimensional data points, into a structured Numpy array where each tuple becomes an array element. Suppose the input is a list … Read more

5 Best Ways to Create a NumPy Array of Zeros in Python

πŸ’‘ Problem Formulation: When working with numerical data in Python, it’s a common requirement to initialize an array with zeros, either to reserve space or to serve as a starting point for computations. NumPy, a popular library for numerical computing, offers multiple ways to create such arrays. For example, if the input is a desired … Read more

Converting Python Dictionary Keys to Numpy Array

πŸ’‘ Problem Formulation: Python developers often need to convert dictionary keys to a Numpy array for efficient computation and manipulation. This transformation is particularly useful in scenarios involving large datasets and mathematical operations. Suppose you have a dictionary, {‘a’: 1, ‘b’: 2, ‘c’: 3}, and you want to obtain a Numpy array of its keys, … Read more