What is a function – its history, programming and machine learning

Machine Learning Artificial Intelligence Digital Transformation Natural Language Processing Deep Learning Information Geometric Approach to Data Mathematics Navigation of this blog
About Functions

A function will generally be mathematically defined as a rule that assigns to each element in one set the only element in another set. The first set is called the “domain” and represents the range of values to which the function applies. The second set is called the “value range” and represents the range of values obtained by the function.

For example, consider the following function

\[f(x) = x^2\]

This function has the set of real numbers as its domain and the set of positive real numbers as its value domain. In other words, the function accepts any real number as input and outputs the only corresponding positive real number.

Thus, mathematically, a function is defined as a rule that has two sets, a domain and a value domain, with each element in the domain corresponding to only one element in the value domain. Also, if there are multiple definitions for a single value, it is not a function.

These mathematical definitions are important concepts because functions are widely used outside of mathematics to clarify what a function represents.

For more information on set theory, which is the basis for discussion of functions, please refer to “Outline of Set Theory and Reference Books. If necessary, please refer to the reference books.

History of Functions – How the concept of function was born and developed

The current definition of a function is as follows: “Let X and Y be non-empty sets, and for any x ∈ X, we say that a function f:X→Y has been determined when there is a correspondence y ∈ Y. We write y=f(x)” This approach is based on the notion of correspondence (that is, the mapping concept). This concept of function was invented by mathematicians Gottfried Leibniz and Isaac Newton in the 17th century.

Prior to this, mathematics dealt only with numerical values, and although the concept of “proportion” had existed since Greek times, the concept of variables did not exist. In the 16th century, the mathematician Giordano Bruno introduced the concept of “amount of change” to express changes in numerical values, and in the 17th century, the French mathematician René Descartes proposed a method to express functions using a coordinate system, which became the basis of modern functions.

Taking over these concepts, Leibniz in the 17th century defined a function as a rule that returns a different quantity (function value) when given a certain quantity (argument) in terms of calculus. Newton also used the concept of functions to solve algebraic equations. Leibniz and Newton each introduced new notations and concepts to express a relationship that returns another value depending on the value of one variable, and to express this relationship, they used the symbols for functions as we use them today (e.g., f(x)) and studied the properties of functions.

Later, in the 18th century, mathematicians such as Leonhard Euler and Joseph Louis Lagrange studied the properties of functions in more detail, developing fields such as functional analysis and calculus. They viewed functions as geometric curves and surfaces rather than algebraic expressions and applied the idea of functions to calculus and differential equation solving.

In the 19th century, the theory of functions continued to develop, and mathematicians such as Abel, Galois, Weierstrass, and Riemann studied the properties and theory of functions. They considered diverse types of functions, including analytic, algebraic, and topological functions, and applied the theory of functions in many areas of mathematics.

In the 20th century, the concept of functions was further developed, and the idea of functions began to play an important role in computer science. In modern mathematics and computer science, the theory of functions plays a very important role, and research on functions is still ongoing.

The study of using these “functions” or infinite series to solve mathematical problems in many fields, such as the natural sciences, engineering, and economics, will be known as analysis.

Analysis is divided into the fields of calculus, real analysis, complex analysis, and functional analysis. Calculus is the study of the differentiation and integration of functions and plays an important role in applied fields such as physics and engineering. Real analysis is the study of analysis on real numbers and deals with convergence, continuity, differentiability, etc. of functions. Complex analysis studies the analysis of complex numbers, especially the derivatives and integrals of complex functions. Functional analysis deals with the analysis of infinite dimensional function spaces and operators, and is applied to the study of quantum mechanics and partial differential equations.

Functions and Programming

As described in “Functional Languages (1)” and other articles, functions are reusable code blocks in a program that are called to perform a specific process. Functions divide the structure of a program, and by combining multiple functions, complex processing can be achieved.

Different programming languages define and use functions in different ways, but in general they have the following characteristics

  • Name and arguments: A function has a name and performs a process by specifying arguments when called. Arguments are input values given to the function and processed within the function.
  • Definition of processing: A function has a code block for executing the processing. This code block is executed when the function is called.
    Return value: A function can return a result to the caller. This return value can be used by the caller.

The way a function is defined varies from programming language to programming language, but the following examples are used to illustrate.

Example of defining a function in Python:

def add_numbers(a, b):
    return a + b

This function has the name “add_numbers” and takes “a” and “b” as arguments. Within the function, it returns the result of adding a and b. To call this, do the following.

result = add_numbers(2, 3)
print(result)

In this case, the function receives “2” and “3” as arguments and returns “5”, the result of adding them. This result is assigned to result, and the final output is “5.

Using functions has the advantage of improving program maintainability by eliminating the need to write the same process repeatedly. Another advantage is that by dividing complex processing into functions, program readability is improved.

A function is an operation or process in mathematics, programming, or other fields that returns one output for one input. A function takes an input value, performs a calculation or processing based on that input value, and outputs the final result.

In mathematics, a function is generally represented as f(x) where x is the input value to the function and f(x) is the corresponding output value. For example, the function f(x) = x^2 is a function that squares the input value x and outputs the result.

In programming, functions are defined in a similar way. In a program, a function is like a block of processing that is called as needed. Functions can be passed input values, called arguments, and the result of processing with them in the function is returned as the return value. For example, consider the following Python function

def square(x):
    return x * x

This function takes x as an argument, computes the square of x, and returns the result. Using this function, a call to square(3) would return the value 9.

There are many different types of functions. For example, there are functions that take no arguments, functions that take multiple arguments, functions that do not return a return value, functions that do not return a value, functions that are recursive, and so on. You can also call other functions within a function. By making good use of functions, you can keep program processing concise and reduce duplication of effort.

About Functions and Artificial Intelligence

Functions play an important role in machine learning optimization as described in “The Mathematics of Optimization” in Machine Learning. Below is a description of how functions are used in artificial intelligence techniques.

Activation Functions

In artificial neural networks, activation functions are used to convert input values into nonlinear output values. For example, sigmoidal and ReLU functions are often used. Activation functions are used to determine the output of a neuron, and in multilayer neural networks, multiple activation functions are combined to achieve complex processing.

  • Loss Function

In machine learning, loss functions are used to calculate the error between the predicted and correct values. The loss function is used as the objective function to be minimized during learning. Typical loss functions include mean squared error and cross-entropy error.

  • Optimization Function

In machine learning, the optimization function is used to update the parameters of the model. The optimization function achieves model learning by updating the parameters so as to minimize the loss function. Typical optimization functions include stochastic gradient descent and Adam.

  • Feature Engineering

In machine learning, feature engineering is the process of extracting useful features from data. Various functions are used for this process. For example, for text data, functions such as word frequencies and tf-idf are used.

  • Classifier

In machine learning, classifiers are used to classify data into multiple classes. Examples of such classifiers include logistic regression and SVM. These classifiers are realized as functions that combine input values and parameters.

As described above, functions are used in artificial intelligence techniques to

Reference books on functions

First, an elementary reference book on functions is “What is a Function – From Trigonometric Functions to Complex Functions and Superfunctions.

This will be an introduction to mathematics with topics on various functions such as trigonometric functions, logarithmic functions, complex functions, functional functions, and superfunctions. The contents are as follows.

Chapter 1: Understanding Trigonometric Functions 
Chapter 2: Understanding Exponential Functions 
Chapter 3: Understanding Logarithmic Functions 
Chapter 4: Understanding Complex Functions 
Chapter 5: Understanding Functions 
Chapter 6: Understanding Superfunctions 
Chapter 7: Understanding Infinity 
Related Books

The next reference book on functions that is a bit more specialized is “What is a Function?

This book is an attempt to describe the historical development of the concept of functions as faithfully as possible, and to respond to the interests of modern students and researchers of analysis, while taking into account modern mathematical perspectives.

What is a Function Hisashi Okamoto and Ryosuke Nagaoka
	Part I. Outline
		Chapter 1: On the Difficulties in the History of Mathematics
			1.1 Difficulties in exploring historical origins
			1.2 Importance and difficulty of evaluating history
			1.3 On the problem of the first discoverer
			1.4 The dialectic of historical evaluation
			Exercises
		Chapter 2 Functions
			2.1 The Beginning of the Function Concept
			2.2 The Birth of Full-Scale Analysis Euler's Arrival
			2.3 The oscillating string controversy
			2.4 Euler's New Concept of Function
			2.5 Fourier's Revolution
			2.6 Dirichlet's Contribution to and Influence on Analysis
		Chapter 3: Rationalization of Calculus and the Concept of Limits
			3.1 A Calculus Method Lacking a Foundation?
			3.2 Continuity
			3.3 Analysis Without Derivative Definitions
			3.4 Rationalization of the Calculus Method
			Exercises
	Part II: Each Section
		Chapter 4: Euler, the Founder of Analysis
			4.1 Euler's position
			4.2 Euler's achievements
			4.3 Euler's complete works
			Exercises
		Chapter 5 Densification of Analysis
			5.1 Foundations of Analysis
			5.2 Contributions of Lagrange
			5.3 Bolzano's contribution
			5.4 Cauchy's contribution
			5.5 Contribution of Abel
			5.6 Others
			Exercises
		Chapter 6 Fourier Series New Developments in Analysis
			6.1 What is a Fourier series?
			6.2 Origin of the Fourier series
			Exercises
		Chapter 7 Convergence of Fourier series
			7.1 Convergence of Fourier series : Dirichlet
			7.2 Convergence of Fourier series : various sufficient conditions
			7.3 Significance of Fourier series theory
			7.4 Uniqueness of Fourier expansion
			Exercises
		Chapter 8 Continuous but everywhere non-differentiable continuous functions and their
			8.1 Continuity and differentiability
			8.2 Riemann's discontinuous functions
			8.3 Non-differentiable functions of Weierstrass
			8.4 Takagi functions and their surroundings
			8.5 Peczkowicz-type nondifferentiable functions
			8.6 Other Topics
			8.7 Primitive functions
			8.8 Analytic functions
			Exercises
		Chapter 9 Another Stream of Analysis
			9.1 Linear interpolation (linear interpolation)
			9.2 Logarithms and interpolation
			9.3 What is interpolation?
			9.4 Newtonian Interpolation
			9.5 Lagrange interpolation and Runge phenomenon
			9.6 Interpolation and Extrapolation
			9.7 Perscalar i
			9.8 Ninth Chapter Arithmetic
			9.9 Circular arcs
			9.10 Weierstrass' polynomial approximation theorem, Bernstein polynomial
			9.11 Refinement of Weierstrass' theorem, etc., Kaketani's theorem
			Exercises
		Appendix
			A History of Complex Function Theory
				A.1 From imaginary to complex numbers
				A.2 Calculus and imaginary numbers
				A.3 Cauchy's theory of complex integrals
				A.4 Later Developments in Cauchy's Complex Integral Theory
			B Ordinary Differential Equations
				B.1 Early differential equations
				B.2 Cauchy and Peano
				B.3 Michio Nagumo's theorem
			C Gibbs phenomenon
				C.1 A Short History of Gibbs Phenomenon
				C.2 How to avoid the Gibbs phenomenon
			D Various theorems
				D.1 Around Weierstrauss' theorem
				D.2 Menchov's Theorem
				D.3 Proof of Mazurkiewicz's Theorem
				D.4 On term integrals
				D.5 Fundamental Theorems of Calculus
				D.6 Circle Length of an Ellipse
			E Changes in the Definition of Functions
			F Lives of the main protagonists in this book
			G Solutions to Exercises at the End of the Book

Next, as a reference book from the perspective of programming and functions, a reference book on LISP, the original functional language, “Lisp Functional Programming for Beginners

This is a summary of functional programming using LISP, the original functional language, and its contents are as follows

Lisp Function Programming for the First Time
	Chapter 1 What is Functional Programming - and Why is it Hard?
		1.1 What is Functional Programming?
			1.1.1 Pure Functions and Referential Transparency
			1.1.2 Side Effects
			1.1.3 Overview of Functional Programming
		1.2 History of Functional Programming
			1.2.1 The Dawn of Functional Programming (1930s-1960s) -From the Birth of Lambda Calculus to Lisp
			1.2.2 Functional Programming in the 1970s - Lisp v.s. ML War
			1.2.3 Functional Programming Development Period (1980s) - The Golden Age of AI
			1.2.4 Functional Programming in the 1990s - Lisp's Silence and the Birth of Haskell
			1.2.5 Functional Programming Revival (2000s) - A New Era with F# and Scala
			1.2.6 Second Growth Period of Functional Programming Languages (2010s) - Toward Functional Programming in the IoT Era
		1.3 What makes you happy with functional programming?
			1.3.1 Easy to reuse
			1.3.2 Suitable for Parallel Processing
			1.3.3 Fewer bugs
			1.3.4 Easy to test
			1.3.5 Good for code optimization/applying formal methods/automating code
			1.3.6 Can do dynamic programming - abstract programming
			1.3.7 Other Pleasing Features
		1.4 Why is Functional Programming Difficult?
			1.4.1 Variables cannot be used → destructive assignment → programs without side effects
			1.4.2 Assignment statements cannot be used → destructive assignment statements → programs without side effects
			1.4.3 Cannot use arrays → mutable data structures → program without side effects
			1.4.4 Recursive programming is difficult → Programs without side effects
			1.4.5 Continuous function application is difficult → Programs without side effects
			1.4.6 Higher-order functions are difficult → Useful and difficult features of functional programming
			1.4.7 Evaluation strategies are troublesome → Useful and difficult features of functional programming
			1.4.8 Other functions are difficult → Convenient and difficult functions of functional programming
			1.4.9 I don't know how to design functional types
			1.4.10 Paradigm shift is difficult
			1.4.11 Functional programming is not difficult
		1.5 How to Use Functional Programming
			1.5.1 For Side-Effect-Free Programming
			1.5.2 For Convenience Features of Functional Programming
			1.5.3 Recommendations for Impure Functional Programming
			1.5.4 Recommendations for Functional Programming in Day Functional Programming Languages
		1.6 Conclusion
	Chapter 2: A Superintroduction to Lisp for Learning Functional Programming
	Chapter 3: Basics of Functional Programming
	Chapter 4 Comparison of Program Paradigms
	Chapter 6 Exercises in Functional Programming
	LISP

In addition, “Javascript Functional Programming” is a reference book for functional programming in Javascript, which is at the heart of web technology.

This book describes functional programming based on Javascript. The contents are as follows

Part 1: Conventional Thinking and Key Concepts

Chapter 1 Thinking with Functional Programming
1.1 Is Learning Functional Programming Useful?
1.2 What is Functional Programming?
1.3 Advantages of Functional Programming
1.4 Summary

Chapter 2 JavaScript as a Functional Language
2.1 Why JavaScript?
2.2 Functional Programming vs. Object-Oriented Programming
2.3 Functions
2.4 Closures and scopes
2.5 Summary

Part 2 Functional Design and Coding

Chapter 3 Reducing the Number of Data Structures and Increasing the Number of Operations
3.1 Understand the control flow of your application
3.2 Method Chain
3.3 Function Chain
3.4 Understanding the code
3.5 Learn to think recursively
3.6 Summary

Chapter 4 Code Reuse through Modularization
4.1 Method Chains and Function Pipelines
4.2 Requirements for Compatible Functions
4.3 Curried Function Evaluation
4.4 Partial Application and Parameter Binding
4.5 Composing Function Pipelines
4.6 Using Function Combinators to Manage Flow Control
4.7 Conclusion

Chapter 5 Design Patterns to Reduce Complexity
5.1 Disadvantages of imperative error handling
5.2 A Better Solution: Functor
5.3 Functional Error Handling with Monads
5.4 Monad Chaining and Composition
5.5 Summary

■Part 3 Developing Functional Type Skills

Chapter 6 Testing Functional Code
6.1 The Impact of Functional Programming on Unit Testing
6.2 Challenges in testing imperative programs
6.3 Testing Functional Code
6.4 Using Property-Based Testing to Capture Specifications
6.5 Measuring Effectiveness with Code Coverage
6.6 Summary

Chapter 7 Optimizing Functional Code
7.1 Examine the contents of function execution
7.2 Use lazy evaluation to delay execution
7.3 Implement an "as-needed" strategy
7.4 Recursion and Tail-Call Optimization (TCO)
7.5 Summary

Chapter 8 Functional Methods for Asynchronous Events/Data
8.1 Challenges of Asynchronous Code
8.2 First-class Asynchronous Processing with Promise
8.3 Lazy Data Generation
8.4 Functional and Reactive Programming with RxJS
8.5 Summary

Appendix A JavaScript libraries used in this manual
A.1 Functional JavaScript library
A.2 Other libraries used in this manual

Finally, a reference book on the mathematics of optimization is “Optimization for the First Time.”

The contents are as follows

Chapter 1: Mathematical Preparation
Chapter 2 Convex Functions
Chapter 3 Optimization Problems
Chapter 4 Constrained Optimization Problems
Chapter 5 Linear Programming Problems
Chapter 6 Variational Problems
Chapter 7: Constrained Variational Problems
Chapter 8 Computer Applications
Chapter 9 Solutions to Exercises

コメント

Exit mobile version
タイトルとURLをコピーしました