@Math Blog
//
Percentages are a fundamental concept in mathematics, representing a fraction with a denominator of 100. The term "percent" comes from the Latin phrase "per centum," meaning "by the hundred". A percentage is denoted by the symbol %, and is used to express a part of a whole. For example, if a student scores 65 percent on a test, it means they obtained 65 marks for every 100 marks. Understanding percentages is crucial as they frequently appear in daily life, from calculating discounts to understanding statistics.
Percentages offer a standardized way to compare different quantities or proportions. To convert a fraction to a percentage, the goal is to express the fraction with a denominator of 100. If David secures 475 marks out of 500, this can be converted to a percentage by dividing both the numerator and the denominator by 5, resulting in 95/100, or 95%. Conversely, 9% is equivalent to 9/100. Visual representations can also aid in understanding percentages, such as imagining a battery made up of 100 small cells, where each cell represents 1%. If all cells are charged then the battery is at 100%. In addition to understanding percentages, other mathematical concepts like linear regression are important in more advanced applications. Linear regression is a fundamental machine learning model used to find correlations between variables and make predictions. For instance, it can be used to predict ice cream sales based on temperature data. The model identifies a relationship between the input feature (temperature) and the target feature (ice cream sales) and uses a general line to make predictions. The equation of this line, f(x) = mx + b, where 'm' is the slope and 'b' is the y-intercept, helps in understanding how changes in the input feature affect the predicted output. References :
Classification:
@exercism.org
//
Modulo arithmetic is being explored as a technique for rotation, inspired by a post from Greg Egan on Mastodon. Jonathan Carroll implemented Egan's formula in various languages. The formula, rot(n, j, k) = (n * 10^k) mod (10^j-1), efficiently rotates a j-digit number n by k digits. Carroll highlighted the importance of understanding fundamental operators across different languages while implementing this seemingly simple mathematical concept.
This exploration is beneficial for fortifying knowledge of basic functionalities in different programming languages. As Carroll wrote in his blog, implementing this simple math "means I’ll be working with some basic functionality and I believe it’s very important to have that locked in comfortably." Carroll demonstrated the implementation in R, utilizing the power operator '^' and the modulo operator '%%'. He also showed how to determine the number of digits in a number using the 'nchar()' function, showcasing practical application of these operators. The R implementation allows for the cyclic rotation of digits within a number. While R doesn't have a built-in function for this specific purpose, Carroll demonstrated the usage of his '{vec}' package for a similar ring-buffer effect on vectors. This involved using modulo on the indices to achieve the desired rotation. The formula subtracts (10^j-1) times the leftmost k digits of n*10^k, removing them from the left and adding them to the right. References :
Classification:
|
Blogs
|