text
stringlengths 105
4.17k
| source
stringclasses 883
values |
---|---|
An earlier standard tested using a portion of the evaluation dataset. It became more common to evaluate a pre-trained model directly through prompting techniques. Researchers vary in how they formulate prompts for particular tasks, particularly with respect to the number of correct examples attached to the prompt (i.e. the value of n in n-shot prompting).
#### Datasets
Typical datasets consist of pairs of questions and correct answers, for example, ("Have the San Jose Sharks won the Stanley Cup? ", "No"). Some examples of commonly used question answering datasets include TruthfulQA, Web Questions, TriviaQA, and SQuAD.
Evaluation datasets may also take the form of text completion, having the model select the most likely word or sentence to complete a prompt, for example: "Alice was friends with Bob. Alice went to visit her friend, ____".
Datasets are of varying quality and may contain questions that are mislabeled, ambiguous, unanswerable, or otherwise of low-quality.
#### Adversarial evaluations
LLMs' rapid improvement regularly obsoletes benchmarks, with the models exceeding the performance of human annotators. In addition, "shortcut learning" allows AIs to "cheat" on multiple-choice tests by using statistical correlations in superficial test question wording to guess the correct responses, without considering the specific question.
|
https://en.wikipedia.org/wiki/Large_language_model
|
#### Adversarial evaluations
LLMs' rapid improvement regularly obsoletes benchmarks, with the models exceeding the performance of human annotators. In addition, "shortcut learning" allows AIs to "cheat" on multiple-choice tests by using statistical correlations in superficial test question wording to guess the correct responses, without considering the specific question.
Some datasets are adversarial, focusing on problems that confound LLMs. One example is the TruthfulQA dataset, a question answering dataset consisting of 817 questions that stump LLMs by mimicking falsehoods to which they were exposed during training. For example, an LLM may answer "No" to the question "Can you teach an old dog new tricks?" because of its exposure to the English idiom you can't teach an old dog new tricks, even though this is not literally true.
Another example of an adversarial evaluation dataset is Swag and its successor, HellaSwag, collections of problems in which one of multiple options must be selected to complete a text passage. The incorrect completions were generated by sampling from a language model. The resulting problems are trivial for humans but defeated LLMs. Sample questions:
We see a fitness center sign. We then see a man talking to the camera and sitting and laying on a exercise ball. The man...
1. demonstrates how to increase efficient exercise work by running up and down balls.
|
https://en.wikipedia.org/wiki/Large_language_model
|
We then see a man talking to the camera and sitting and laying on a exercise ball. The man...
1. demonstrates how to increase efficient exercise work by running up and down balls.
1. moves all his arms and legs and builds up a lot of muscle.
1. then plays the ball and we see a graphics and hedge trimming demonstration.
1. performs sit ups while on the ball and talking.
BERT selects b) as the most likely completion, though the correct answer is d).
## Wider impact
In 2023, Nature Biomedical Engineering wrote that "it is no longer possible to accurately distinguish" human-written text from text created by large language models, and that "It is all but certain that general-purpose large language models will rapidly proliferate... It is a rather safe bet that they will change many industries over time." Goldman Sachs suggested in 2023 that generative language AI could increase global GDP by 7% in the next ten years, and could expose to automation 300 million jobs globally. Brinkmann et al. (2023) also argue that LLMs are transforming processes of cultural evolution by shaping processes of variation, transmission, and selection.
### Memorization and copyright
Memorization is an emergent behavior in LLMs in which long strings of text are occasionally output verbatim from training data, contrary to typical behavior of traditional artificial neural nets.
|
https://en.wikipedia.org/wiki/Large_language_model
|
Brinkmann et al. (2023) also argue that LLMs are transforming processes of cultural evolution by shaping processes of variation, transmission, and selection.
### Memorization and copyright
Memorization is an emergent behavior in LLMs in which long strings of text are occasionally output verbatim from training data, contrary to typical behavior of traditional artificial neural nets. Evaluations of controlled LLM output measure the amount memorized from training data (focused on GPT-2-series models) as variously over 1% for exact duplicates or up to about 7%.
A 2023 study showed that when ChatGPT 3.5 turbo was prompted to repeat the same word indefinitely, after a few hundreds of repetitions, it would start outputting excerpts from its training data.
### Security
Some commenters expressed concern over accidental or deliberate creation of misinformation, or other forms of misuse. For example, the availability of large language models could reduce the skill-level required to commit bioterrorism; biosecurity researcher Kevin Esvelt has suggested that LLM creators should exclude from their training data papers on creating or enhancing pathogens.
The potential presence of "sleeper agents" within LLMs is another emerging security concern. These are hidden functionalities built into the model that remain dormant until triggered by a specific event or condition. Upon activation, the LLM deviates from its expected behavior to make insecure actions.
|
https://en.wikipedia.org/wiki/Large_language_model
|
These are hidden functionalities built into the model that remain dormant until triggered by a specific event or condition. Upon activation, the LLM deviates from its expected behavior to make insecure actions.
LLM applications accessible to the public, like ChatGPT or Claude, typically incorporate safety measures designed to filter out harmful content. However, implementing these controls effectively has proven challenging. For instance, a 2023 study proposed a method for circumventing LLM safety systems. In 2025, The American Sunlight Project, a non-profit, published a study showing evidence that the so-called Pravda network, a pro-Russia propaganda aggregator, was strategically placing web content through mass publication and duplication with the intention of biasing LLM outputs. The American Sunlight Project coined this technique "LLM grooming," and pointed to it as a new tool of weaponizing AI to spread disinformation and harmful content. Similarly, Yongge Wang illustrated in 2024 how a potential criminal could potentially bypass ChatGPT 4o's safety controls to obtain information on establishing a drug trafficking operation. External filters, circuit breakers and overrides have been posed as solutions.
### Algorithmic bias
While LLMs have shown remarkable capabilities in generating human-like text, they are susceptible to inheriting and amplifying biases present in their training data.
|
https://en.wikipedia.org/wiki/Large_language_model
|
External filters, circuit breakers and overrides have been posed as solutions.
### Algorithmic bias
While LLMs have shown remarkable capabilities in generating human-like text, they are susceptible to inheriting and amplifying biases present in their training data. This can manifest in skewed representations or unfair treatment of different demographics, such as those based on race, gender, language, and cultural groups. Since English data is overrepresented in current large language models' training data, it may also downplay non-English views.
#### Stereotyping
AI models can reinforce a wide range of stereotypes, including those based on gender, ethnicity, age, nationality, religion, or occupation. This can lead to outputs that homogenize, or unfairly generalize or caricature groups of people, sometimes in harmful or derogatory ways.
Notably, gender bias refers to the tendency of these models to produce outputs that are unfairly prejudiced towards one gender over another. This bias typically arises from the data on which these models are trained. Large language models often assign roles and characteristics based on traditional gender norms. For example, it might associate nurses or secretaries predominantly with women and engineers or CEOs with men.
|
https://en.wikipedia.org/wiki/Large_language_model
|
Large language models often assign roles and characteristics based on traditional gender norms. For example, it might associate nurses or secretaries predominantly with women and engineers or CEOs with men.
#### Selection bias
Selection bias refers the inherent tendency of large language models to favor certain option identifiers irrespective of the actual content of the options. This bias primarily stems from token bias—that is, the model assigns a higher a priori probability to specific answer tokens (such as “A”) when generating responses. As a result, when the ordering of options is altered (for example, by systematically moving the correct answer to different positions), the model’s performance can fluctuate significantly. This phenomenon undermines the reliability of large language models in multiple-choice settings.
#### Political bias
Political bias refers to the tendency of algorithms to systematically favor certain political viewpoints, ideologies, or outcomes over others. Language models may also exhibit political biases. Since the training data includes a wide range of political opinions and coverage, the models might generate responses that lean towards particular political ideologies or viewpoints, depending on the prevalence of those views in the data.
### Energy demands
The energy demands of LLMs have grown along with their size and capabilities. Data centers that enable LLM training require substantial amounts of electricity.
|
https://en.wikipedia.org/wiki/Large_language_model
|
### Energy demands
The energy demands of LLMs have grown along with their size and capabilities. Data centers that enable LLM training require substantial amounts of electricity. Much of that electricity is generated by non-renewable resources that create greenhouse gases and contribute to climate change. Nuclear power and geothermal energy are two options tech companies are exploring to meet the sizable energy demands of LLM training. The significant expense of investing in geothermal solutions has led to major shale producers like Chevron and Exxon Mobil advocating for tech companies to use electricity produced via natural gas to fuel their large energy demands.
|
https://en.wikipedia.org/wiki/Large_language_model
|
A UML tool is a software application that supports some or all of the notation and semantics associated with the Unified Modeling Language (UML), which is the industry standard general-purpose modeling language for software engineering.
UML tool is used broadly here to include application programs which are not exclusively focused on UML, but which support some functions of the Unified Modeling Language, either as an add-on, as a component or as a part of their overall functionality.
## Kinds of functionality
UML tools support the following kinds of functionality:
### Diagramming
Diagramming in this context means creating and editing UML diagrams; that is diagrams that follow the graphical notation of the Unified Modeling Language.
The use of UML diagrams as a means to draw diagrams of – mostly – object-oriented software is generally agreed upon by software developers. When developers draw diagrams of object-oriented software, they usually follow the UML notation. On the other hand, it is often debated whether those diagrams are needed at all, during what stages of the software development process they should be used, and how (if at all) they should be kept up to date. The primacy of software code often leads to the diagrams being deprecated.
|
https://en.wikipedia.org/wiki/UML_tool
|
On the other hand, it is often debated whether those diagrams are needed at all, during what stages of the software development process they should be used, and how (if at all) they should be kept up to date. The primacy of software code often leads to the diagrams being deprecated.
### Round-trip engineering
Round-trip engineering refers to the ability of a UML tool to perform code generation from models, and model generation from code (a.k.a., reverse engineering), while keeping both the model and the code semantically consistent with each other.
#### Code generation
and reverse engineering are explained in more detail below.
Code generation
Code generation in this context means that the user creates UML diagrams, which have some connected model data, and the UML tool derives from the diagrams part or all of the source code for the software system. In some tools the user can provide a skeleton of the program source code, in the form of a source code template, where predefined tokens are then replaced with program source code parts during the code generation process.
An often cited criticism is that the UML diagrams lack the detail that is needed to contain the same information as is covered with the program source: Jack W. Reeves states that the final embodiment of the design lies in the source code.
|
https://en.wikipedia.org/wiki/UML_tool
|
In some tools the user can provide a skeleton of the program source code, in the form of a source code template, where predefined tokens are then replaced with program source code parts during the code generation process.
An often cited criticism is that the UML diagrams lack the detail that is needed to contain the same information as is covered with the program source: Jack W. Reeves states that the final embodiment of the design lies in the source code. (His often quoted statement that "the Code is the design" has been misinterpreted to mean that there is no need for intermediate- and high-level software-design artifacts, such as UML diagrams or software-requirements documents).
#### Reverse engineering
Reverse engineering in this context means, that the UML tool reads program source code as input and derives model data and corresponding graphical UML diagrams from it (as opposed to the somewhat broader meaning described in the article "Reverse engineering").
Some of the challenges of reverse engineering are:
- The source code often has much more detailed information than one would want to see in design diagrams. This problem is addressed by software architecture reconstruction.
- Diagram data is normally not contained with the program source, such that the UML tool, at least in the initial step, has to create some random layout of the graphical symbols of the UML notation or use some automatic layout algorithm to place the symbols in a way that the user can understand the diagram.
|
https://en.wikipedia.org/wiki/UML_tool
|
This problem is addressed by software architecture reconstruction.
- Diagram data is normally not contained with the program source, such that the UML tool, at least in the initial step, has to create some random layout of the graphical symbols of the UML notation or use some automatic layout algorithm to place the symbols in a way that the user can understand the diagram. For example, the symbols should be placed at such locations on the drawing pane that they don't overlap. Usually, the user of such a functionality of a UML tool has to manually edit those automatically generated diagrams to attain some meaningfulness. It also often doesn't make sense to draw diagrams of the whole program source, as that represents just too much detail to be of interest at the level of the UML diagrams.
- There are language features of some programming languages, like class- or function templates of the C++ programming language, which are notoriously hard to convert automatically to UML diagrams in their full complexity.
### Model and diagram interchange
XML Metadata Interchange (XMI) is the format for UML model interchange. XMI does not support UML Diagram Interchange, which allows the importation of UML diagrams from one model to another.
### Model transformation
A key concept associated with the model-driven architecture initiative is the capacity to transform a model into another model.
|
https://en.wikipedia.org/wiki/UML_tool
|
XMI does not support UML Diagram Interchange, which allows the importation of UML diagrams from one model to another.
### Model transformation
A key concept associated with the model-driven architecture initiative is the capacity to transform a model into another model. For example, one might want to transform a platform-independent domain model into a Java platform-specific model for implementation. It is also possible to refactor UML models to produce more concise and well-formed UML models. It is possible to generate UML models from other modeling notations, such as BPMN, which is itself a UML profile. The standard that supports this is called QVT for Queries/Views/Transformations. One example of an open-source QVT-solution is the ATL language built by INRIA.
|
https://en.wikipedia.org/wiki/UML_tool
|
In computer programming, an enumerated type (also called enumeration, enum, or factor in the R programming language, a status variable in the JOVIAL programming language, and a categorical variable in statistics) is a data type consisting of a set of named values called elements, members, enumeral, or enumerators of the type. The enumerator names are usually identifiers that behave as constants in the language. An enumerated type can be seen as a degenerate tagged union of unit type. A variable that has been declared as having an enumerated type can be assigned any of the enumerators as a value. In other words, an enumerated type has values that are different from each other, and that can be compared and assigned, but are not generally specified by the programmer as having any particular concrete representation in the computer's memory; compilers and interpreters can represent them arbitrarily.
## Description
For example, the four suits in a deck of playing cards may be four enumerators named
#### C
lub, Diamond, Heart, and Spade, belonging to an enumerated type named suit. If a variable V is declared having suit as its data type, one can assign any of those four values to it.
Although the enumerators are usually distinct, some languages may allow the same enumerator to be listed twice in the type's declaration. The names of enumerators need not be semantically complete or compatible in any sense.
|
https://en.wikipedia.org/wiki/Enumerated_type
|
Although the enumerators are usually distinct, some languages may allow the same enumerator to be listed twice in the type's declaration. The names of enumerators need not be semantically complete or compatible in any sense. For example, an enumerated type called color may be defined to consist of the enumerators Red, Green, Zebra, Missing, and Bacon. In some languages, the declaration of an enumerated type also intentionally defines an ordering of its members (High, Medium and Low priorities); in others, the enumerators are unordered (English, French, German and Spanish supported languages); in others still, an implicit ordering arises from the compiler concretely representing enumerators as integers.
Some enumerator types may be built into the language. The Boolean type, for example is often a pre-defined enumeration of the values False and True. A unit type consisting of a single value may also be defined to represent null. Many languages allow users to define new enumerated types.
Values and variables of an enumerated type are usually implemented with some integer type as the underlying representation. Some languages, especially system programming languages, allow the user to specify the bit combination to be used for each enumerator, which can be useful to efficiently represent sets of enumerators as fixed-length bit strings. In type theory, enumerated types are often regarded as tagged unions of unit types.
|
https://en.wikipedia.org/wiki/Enumerated_type
|
Some languages, especially system programming languages, allow the user to specify the bit combination to be used for each enumerator, which can be useful to efficiently represent sets of enumerators as fixed-length bit strings. In type theory, enumerated types are often regarded as tagged unions of unit types. Since such types are of the form
$$
1 + 1 + \cdots + 1
$$
, they may also be written as natural numbers.
## Rationale
Some early programming languages did not originally have enumerated types. If a programmer wanted a variable, for example myColor, to have a value of red, the variable red would be declared and assigned some arbitrary value, usually an integer constant. The variable red would then be assigned to myColor. Other techniques assigned arbitrary values to strings containing the names of the enumerators.
These arbitrary values were sometimes referred to as magic numbers since there often was no explanation as to how the numbers were obtained or whether their actual values were significant. These magic numbers could make the source code harder for others to understand and maintain.
Enumerated types, on the other hand, make the code more self-documenting. Depending on the language, the compiler could automatically assign default values to the enumerators thereby hiding unnecessary detail from the programmer. These values may not even be visible to the programmer (see information hiding).
|
https://en.wikipedia.org/wiki/Enumerated_type
|
Depending on the language, the compiler could automatically assign default values to the enumerators thereby hiding unnecessary detail from the programmer. These values may not even be visible to the programmer (see information hiding). Enumerated types can also prevent a programmer from writing illogical code such as performing mathematical operations on the values of the enumerators. If the value of a variable that was assigned an enumerator were to be printed, some programming languages could also print the name of the enumerator rather than its underlying numerical value. A further advantage is that enumerated types can allow compilers to enforce semantic correctness. For instance:
`myColor = TRIANGLE`
can be forbidden, whilst
`myColor = RED`
is accepted, even if TRIANGLE and RED are both internally represented as 1.
Conceptually, an enumerated type is similar to a list of nominals (numeric codes), since each possible value of the type is assigned a distinctive natural number. A given enumerated type is thus a concrete implementation of this notion. When order is meaningful and/or used for comparison, then an enumerated type becomes an ordinal type.
## Conventions
Programming languages tend to have their own, oftentimes multiple, programming styles and naming conventions. The variable assigned to an enumeration is usually a noun in singular form, and frequently follows either a
|
https://en.wikipedia.org/wiki/Enumerated_type
|
## Conventions
Programming languages tend to have their own, oftentimes multiple, programming styles and naming conventions. The variable assigned to an enumeration is usually a noun in singular form, and frequently follows either a
#### Pascal
Case or uppercase convention, while lowercase and others are seen less frequently.
## Syntax in several programming languages
### Pascal and syntactically similar languages
Pascal
In Pascal, an enumerated type can be implicitly declared by listing the values in a parenthesised list:
```Pascal
var
suit: (clubs, diamonds, hearts, spades);
```
The declaration will often appear in a type synonym declaration, such that it can be used for multiple variables:
```Pascal
type
cardsuit = (clubs, diamonds, hearts, spades);
card = record
suit: cardsuit;
value: 1 .. 13;
end;
var
hand: array [ 1 .. 13 ] of card;
trump: cardsuit;
```
The order in which the enumeration values are given matters. An enumerated type is an ordinal type, and the `pred` and `succ` functions will give the prior or next value of the enumeration, and `ord` can convert enumeration values to their integer representation. Standard Pascal does not offer a conversion from arithmetic types to enumerations, however. Extended Pascal offers this functionality via an extended `succ` function.
|
https://en.wikipedia.org/wiki/Enumerated_type
|
Standard Pascal does not offer a conversion from arithmetic types to enumerations, however. Extended Pascal offers this functionality via an extended `succ` function. Some other Pascal dialects allow it via type-casts. Some modern descendants of Pascal, such as Modula-3, provide a special conversion syntax using a method called `VAL`; Modula-3 also treats `BOOLEAN` and `CHAR` as special pre-defined enumerated types and uses `ORD` and `VAL` for standard ASCII decoding and encoding.
Pascal style languages also allow enumeration to be used as array index:
```Pascal
var
suitcount: array [cardsuit] of integer;
```
#### Ada
In Ada, the use of "=" was replaced with "is" leaving the definition quite similar:
```Ada
type Cardsuit is (clubs, diamonds, hearts, spades);
```
In addition to `Pred`, `Succ`, `Val` and `Pos` Ada also supports simple string conversions via `Image` and `Value`.
|
https://en.wikipedia.org/wiki/Enumerated_type
|
Pascal style languages also allow enumeration to be used as array index:
```Pascal
var
suitcount: array [cardsuit] of integer;
```
#### Ada
In Ada, the use of "=" was replaced with "is" leaving the definition quite similar:
```Ada
type Cardsuit is (clubs, diamonds, hearts, spades);
```
In addition to `Pred`, `Succ`, `Val` and `Pos` Ada also supports simple string conversions via `Image` and `Value`.
Similar to C-style languages Ada allows the internal representation of the enumeration to be specified:
```ada
for Cardsuit use
(clubs => 1, diamonds => 2, hearts => 4, spades => 8);
```
Unlike C-style languages Ada also allows the number of bits of the enumeration to be specified:
```ada
for Cardsuit'Size use 4; -- 4 bits
```
Additionally, one can use enumerations as indexes for arrays, like in Pascal, but there are attributes defined for enumerations
```ada
Shuffle : constant array(Cardsuit) of Cardsuit :=
(Clubs => Cardsuit'Succ(Clubs), -- see attributes of enumerations 'First, 'Last, 'Succ, 'Pred
Diamonds => Hearts, --an explicit value
Hearts => Cardsuit'Last, --first enumeration value of type Cardsuit e.g., clubs
Spades => Cardsuit'First --last enumeration value of type Cardsuit e.g., spades
);
```
Like Modula-3 Ada treats `Boolean` and `Character` as special pre-defined (in package "`Standard`") enumerated types.
|
https://en.wikipedia.org/wiki/Enumerated_type
|
#### Ada
In Ada, the use of "=" was replaced with "is" leaving the definition quite similar:
```Ada
type Cardsuit is (clubs, diamonds, hearts, spades);
```
In addition to `Pred`, `Succ`, `Val` and `Pos` Ada also supports simple string conversions via `Image` and `Value`.
Similar to C-style languages Ada allows the internal representation of the enumeration to be specified:
```ada
for Cardsuit use
(clubs => 1, diamonds => 2, hearts => 4, spades => 8);
```
Unlike C-style languages Ada also allows the number of bits of the enumeration to be specified:
```ada
for Cardsuit'Size use 4; -- 4 bits
```
Additionally, one can use enumerations as indexes for arrays, like in Pascal, but there are attributes defined for enumerations
```ada
Shuffle : constant array(Cardsuit) of Cardsuit :=
(Clubs => Cardsuit'Succ(Clubs), -- see attributes of enumerations 'First, 'Last, 'Succ, 'Pred
Diamonds => Hearts, --an explicit value
Hearts => Cardsuit'Last, --first enumeration value of type Cardsuit e.g., clubs
Spades => Cardsuit'First --last enumeration value of type Cardsuit e.g., spades
);
```
Like Modula-3 Ada treats `Boolean` and `Character` as special pre-defined (in package "`Standard`") enumerated types. Unlike Modula-3 one can also define own character types:
```ada
type Cards is ('7', '8', '9', 'J', 'Q', 'K', 'A');
```
|
https://en.wikipedia.org/wiki/Enumerated_type
|
Similar to C-style languages Ada allows the internal representation of the enumeration to be specified:
```ada
for Cardsuit use
(clubs => 1, diamonds => 2, hearts => 4, spades => 8);
```
Unlike C-style languages Ada also allows the number of bits of the enumeration to be specified:
```ada
for Cardsuit'Size use 4; -- 4 bits
```
Additionally, one can use enumerations as indexes for arrays, like in Pascal, but there are attributes defined for enumerations
```ada
Shuffle : constant array(Cardsuit) of Cardsuit :=
(Clubs => Cardsuit'Succ(Clubs), -- see attributes of enumerations 'First, 'Last, 'Succ, 'Pred
Diamonds => Hearts, --an explicit value
Hearts => Cardsuit'Last, --first enumeration value of type Cardsuit e.g., clubs
Spades => Cardsuit'First --last enumeration value of type Cardsuit e.g., spades
);
```
Like Modula-3 Ada treats `Boolean` and `Character` as special pre-defined (in package "`Standard`") enumerated types. Unlike Modula-3 one can also define own character types:
```ada
type Cards is ('7', '8', '9', 'J', 'Q', 'K', 'A');
```
### C and syntactically similar languages
C
The original K&R dialect of the programming language C had no enumerated types.
|
https://en.wikipedia.org/wiki/Enumerated_type
|
Unlike Modula-3 one can also define own character types:
```ada
type Cards is ('7', '8', '9', 'J', 'Q', 'K', 'A');
```
### C and syntactically similar languages
C
The original K&R dialect of the programming language C had no enumerated types. In C, enumerations are created by explicit definitions (the `enum` keyword by itself does not cause allocation of storage) which use the `enum` keyword and are reminiscent of struct and union definitions:
```c
enum cardsuit {
Clubs,
Diamonds,
Hearts,
Spades
};
struct card {
enum cardsuit suit;
short int value;
} hand[13];
enum cardsuit trump;
```
C exposes the integer representation of enumeration values directly to the programmer. Integers and enum values can be mixed freely, and all arithmetic operations on enum values are permitted. It is even possible for an enum variable to hold an integer that does not represent any of the enumeration values. In fact, according to the language definition, the above code will define `Clubs`, `Diamonds`, `Hearts`, and `Spades` as constants of type `int`, which will only be converted (silently) to `enum cardsuit` if they are stored in a variable of that type.
|
https://en.wikipedia.org/wiki/Enumerated_type
|
It is even possible for an enum variable to hold an integer that does not represent any of the enumeration values. In fact, according to the language definition, the above code will define `Clubs`, `Diamonds`, `Hearts`, and `Spades` as constants of type `int`, which will only be converted (silently) to `enum cardsuit` if they are stored in a variable of that type.
C also allows the programmer to choose the values of the enumeration constants explicitly, even without type. For example,
```c
enum cardsuit {
Clubs = 1,
Diamonds = 2,
Hearts = 4,
Spades = 8
};
```
could be used to define a type that allows mathematical sets of suits to be represented as an `enum cardsuit` by bitwise logic operations.
Since C23, the underlying type of an enumeration can be specified by the programmer:
```c
enum cardsuit : char {
Clubs = 1,
Diamonds = 2,
Hearts = 4,
Spades = 8
};
```
#### C#
Enumerated types in the C# programming language preserve most of the "small integer" semantics of C's enums. Some arithmetic operations are not defined for enums, but an enum value can be explicitly converted to an integer and back again, and an enum variable can have values that were not declared by the enum definition.
|
https://en.wikipedia.org/wiki/Enumerated_type
|
#### C#
Enumerated types in the C# programming language preserve most of the "small integer" semantics of C's enums. Some arithmetic operations are not defined for enums, but an enum value can be explicitly converted to an integer and back again, and an enum variable can have values that were not declared by the enum definition. For example, given
```csharp
enum Cardsuit
{
Clubs,
Diamonds,
Spades,
Hearts
}
```
the expressions `CardSuit. Diamonds + 1` and `CardSuit. Hearts - CardSuit. Clubs` are allowed directly (because it may make sense to step through the sequence of values or ask how many steps there are between two values), but `CardSuit. Hearts * CardSuit. Spades` is deemed to make less sense and is only allowed if the values are first converted to integers.
C# also provides the C-like feature of being able to define specific integer values for enumerations. By doing this it is possible to perform binary operations on enumerations, thus treating enumeration values as sets of flags. These flags can be tested using binary operations or with the enum type's builtin '' method.
|
https://en.wikipedia.org/wiki/Enumerated_type
|
By doing this it is possible to perform binary operations on enumerations, thus treating enumeration values as sets of flags. These flags can be tested using binary operations or with the enum type's builtin '' method.
The enumeration definition defines names for the selected integer values and is syntactic sugar, as it is possible to assign to an enum variable other integer values that are not in the scope of the enum definition. Alt URL
#### C++
C++ has enumeration types that are directly inherited from C's and work mostly like these, except that an enumeration is a real type in C++, giving added compile-time checking. Also (as with structs), the C++ `enum` keyword is combined with a , so that instead of naming the type `enum name`, simply name it `name`. This can be simulated in C using a typedef:
C++11 also provides a second kind of enumeration, called a scoped enumeration. These are type-safe: the enumerators are not implicitly converted to an integer type. Among other things, this allows I/O streaming to be defined for the enumeration type.
|
https://en.wikipedia.org/wiki/Enumerated_type
|
These are type-safe: the enumerators are not implicitly converted to an integer type. Among other things, this allows I/O streaming to be defined for the enumeration type. Another feature of scoped enumerations is that the enumerators do not leak, so usage requires prefixing with the name of the enumeration (e.g., `Color::Red` for the first enumerator in the example below), unless a `using enum` declaration (introduced in C++20) has been used to bring the enumerators into the current scope. A scoped enumeration is specified by the phrase `enum class` (or `enum struct`). For example:
```cpp
enum class Color {Red, Green, Blue};
```
The underlying type of an enumeration is an implementation-defined integral type that is large enough to hold all enumerated values; it does not have to be the smallest possible type. The underlying type can be specified directly, which allows "forward declarations" of enumerations:
```cpp
enum class Color : long {Red, Green, Blue}; // must fit in size and memory layout the type 'long'
enum class Shapes : char; // forward declaration. If later there are values defined that don't fit in 'char' it is an error.
```
|
https://en.wikipedia.org/wiki/Enumerated_type
|
For example:
```cpp
enum class Color {Red, Green, Blue};
```
The underlying type of an enumeration is an implementation-defined integral type that is large enough to hold all enumerated values; it does not have to be the smallest possible type. The underlying type can be specified directly, which allows "forward declarations" of enumerations:
```cpp
enum class Color : long {Red, Green, Blue}; // must fit in size and memory layout the type 'long'
enum class Shapes : char; // forward declaration. If later there are values defined that don't fit in 'char' it is an error.
```
#### Go
Go uses the `iota` keyword to create enumerated constants.
```go
type ByteSize int
const (
_ = iota // ignore first value by assigning to blank identifier; 0
KB ByteSize = 1 << (10 * iota) // 1 << (10 * 1) == 1 << 10 == 1024; in binary 10000000000
MB // 1 << (10 * 2) == 1048576; in binary 100000000000000000000
GB // 1 << (10 * 3) == 1073741824; in binary 1000000000000000000000000000000
)
```
|
https://en.wikipedia.org/wiki/Enumerated_type
|
The underlying type can be specified directly, which allows "forward declarations" of enumerations:
```cpp
enum class Color : long {Red, Green, Blue}; // must fit in size and memory layout the type 'long'
enum class Shapes : char; // forward declaration. If later there are values defined that don't fit in 'char' it is an error.
```
#### Go
Go uses the `iota` keyword to create enumerated constants.
```go
type ByteSize int
const (
_ = iota // ignore first value by assigning to blank identifier; 0
KB ByteSize = 1 << (10 * iota) // 1 << (10 * 1) == 1 << 10 == 1024; in binary 10000000000
MB // 1 << (10 * 2) == 1048576; in binary 100000000000000000000
GB // 1 << (10 * 3) == 1073741824; in binary 1000000000000000000000000000000
)
```
#### Java
The J2SE version 5.0 of the Java programming language added enumerated types whose declaration syntax is
similar to that of C:
```java
enum Cardsuit { CLUBS, DIAMONDS, SPADES, HEARTS };
...
Cardsuit trump;
```
The Java type system, however, treats enumerations as a type separate from integers, and intermixing of enum and integer values is not allowed.
|
https://en.wikipedia.org/wiki/Enumerated_type
|
#### Go
Go uses the `iota` keyword to create enumerated constants.
```go
type ByteSize int
const (
_ = iota // ignore first value by assigning to blank identifier; 0
KB ByteSize = 1 << (10 * iota) // 1 << (10 * 1) == 1 << 10 == 1024; in binary 10000000000
MB // 1 << (10 * 2) == 1048576; in binary 100000000000000000000
GB // 1 << (10 * 3) == 1073741824; in binary 1000000000000000000000000000000
)
```
#### Java
The J2SE version 5.0 of the Java programming language added enumerated types whose declaration syntax is
similar to that of C:
```java
enum Cardsuit { CLUBS, DIAMONDS, SPADES, HEARTS };
...
Cardsuit trump;
```
The Java type system, however, treats enumerations as a type separate from integers, and intermixing of enum and integer values is not allowed. In fact, an enum type in Java is actually a special compiler-generated class rather than an arithmetic type, and enum values behave as global pre-generated instances of that class. Enum types can have instance methods and a constructor (the arguments of which can be specified separately for each enum value). All enum types implicitly extend the abstract class. An enum type cannot be instantiated directly.
|
https://en.wikipedia.org/wiki/Enumerated_type
|
All enum types implicitly extend the abstract class. An enum type cannot be instantiated directly.
Internally, each enum value contains an integer, corresponding to the order in which they are declared in the source code, starting from 0. The programmer cannot set a custom integer for an enum value directly, but one can define overloaded constructors that can then assign arbitrary values to self-defined members of the enum class. Defining getters allows then access to those self-defined members. The internal integer can be obtained from an enum value using the method, and the list of enum values of an enumeration type can be obtained in order using the `values()` method. It is generally discouraged for programmers to convert enums to integers and vice versa. Enumerated types are `Comparable`, using the internal integer; as a result, they can be sorted.
The Java standard library provides utility classes to use with enumerations. The class implements a `Set` of enum values; it is implemented as a bit array, which makes it very compact and as efficient as explicit bit manipulation, but safer. The class implements a `Map` of enum values to object. It is implemented as an array, with the integer value of the enum value serving as the index.
|
https://en.wikipedia.org/wiki/Enumerated_type
|
The class implements a `Map` of enum values to object. It is implemented as an array, with the integer value of the enum value serving as the index.
#### Perl
Dynamically typed languages in the syntactic tradition of C (e.g., Perl or JavaScript) do not, in general, provide enumerations. But in Perl programming the same result can be obtained with the shorthand strings list and hashes (possibly slices):
```perl
my @enum = qw(Clubs Diamonds Hearts Spades);
my( %set1, %set2 );
@set1{@enum} = (); # all cleared
@set2{@enum} = (1) x @enum; # all set to 1
$set1{Clubs} ... # false
$set2{Diamonds} ... # true
```
#### Raku
Raku (formerly known as Perl 6) supports enumerations.
|
https://en.wikipedia.org/wiki/Enumerated_type
|
But in Perl programming the same result can be obtained with the shorthand strings list and hashes (possibly slices):
```perl
my @enum = qw(Clubs Diamonds Hearts Spades);
my( %set1, %set2 );
@set1{@enum} = (); # all cleared
@set2{@enum} = (1) x @enum; # all set to 1
$set1{Clubs} ... # false
$set2{Diamonds} ... # true
```
#### Raku
Raku (formerly known as Perl 6) supports enumerations. There are multiple ways to declare enumerations in Raku, all creating a back-end Map.
```perl6
enum Cat <sphynx siamese bengal shorthair other>; # Using "quote-words"
```
```perl6
enum Cat ('sphynx', 'siamese', 'bengal', 'shorthair', 'other'); # Using a list
```
```perl6
enum Cat (sphynx => 0, siamese => 1, bengal => 2, shorthair => 3, other => 4); # Using Pair constructors
```
```perl6
enum Cat (:sphynx(0), :siamese(1), :bengal(2), shorthair(3), :other(4)); # Another way of using Pairs, you can also use `:0sphynx`
```
|
https://en.wikipedia.org/wiki/Enumerated_type
|
#### Raku
Raku (formerly known as Perl 6) supports enumerations. There are multiple ways to declare enumerations in Raku, all creating a back-end Map.
```perl6
enum Cat <sphynx siamese bengal shorthair other>; # Using "quote-words"
```
```perl6
enum Cat ('sphynx', 'siamese', 'bengal', 'shorthair', 'other'); # Using a list
```
```perl6
enum Cat (sphynx => 0, siamese => 1, bengal => 2, shorthair => 3, other => 4); # Using Pair constructors
```
```perl6
enum Cat (:sphynx(0), :siamese(1), :bengal(2), shorthair(3), :other(4)); # Another way of using Pairs, you can also use `:0sphynx`
```
#### PHP
Enums were added in PHP version 8.1.
```php
enum CardSuit
{
case Hearts;
case Diamonds;
case Clubs;
case Spades;
}
```
Enumerators may be backed by string or integer values to aid serialization:
```php
enum CardSuit: string
{
case Hearts = 'H';
case Diamonds = 'D';
case Clubs = 'C';
case Spades = 'S';
}
```
The Enum's interface exposes a method that gives a collection of its enumerators and their names.
|
https://en.wikipedia.org/wiki/Enumerated_type
|
There are multiple ways to declare enumerations in Raku, all creating a back-end Map.
```perl6
enum Cat <sphynx siamese bengal shorthair other>; # Using "quote-words"
```
```perl6
enum Cat ('sphynx', 'siamese', 'bengal', 'shorthair', 'other'); # Using a list
```
```perl6
enum Cat (sphynx => 0, siamese => 1, bengal => 2, shorthair => 3, other => 4); # Using Pair constructors
```
```perl6
enum Cat (:sphynx(0), :siamese(1), :bengal(2), shorthair(3), :other(4)); # Another way of using Pairs, you can also use `:0sphynx`
```
#### PHP
Enums were added in PHP version 8.1.
```php
enum CardSuit
{
case Hearts;
case Diamonds;
case Clubs;
case Spades;
}
```
Enumerators may be backed by string or integer values to aid serialization:
```php
enum CardSuit: string
{
case Hearts = 'H';
case Diamonds = 'D';
case Clubs = 'C';
case Spades = 'S';
}
```
The Enum's interface exposes a method that gives a collection of its enumerators and their names. String/integer-backed Enums also expose the backing value and methods to (attempt) deserialization.
|
https://en.wikipedia.org/wiki/Enumerated_type
|
#### PHP
Enums were added in PHP version 8.1.
```php
enum CardSuit
{
case Hearts;
case Diamonds;
case Clubs;
case Spades;
}
```
Enumerators may be backed by string or integer values to aid serialization:
```php
enum CardSuit: string
{
case Hearts = 'H';
case Diamonds = 'D';
case Clubs = 'C';
case Spades = 'S';
}
```
The Enum's interface exposes a method that gives a collection of its enumerators and their names. String/integer-backed Enums also expose the backing value and methods to (attempt) deserialization. Users may add further methods.
#### Rust
Though Rust uses the `enum` keyword like C, it uses it to describe tagged unions, which enums can be considered a degenerate form of.
|
https://en.wikipedia.org/wiki/Enumerated_type
|
#### Rust
Though Rust uses the `enum` keyword like C, it uses it to describe tagged unions, which enums can be considered a degenerate form of. Rust's enums are therefore much more flexible and can contain struct and tuple variants.
```rust
enum Message {
Quit,
Move { x: i32, y: i32 }, // struct
Write(String), // single-element tuple
ChangeColor(i32, i32, i32), // three-element tuple
}
```
Like C, Rust also supports specifying the values of each variant,
```rust
1. [allow(dead_code)]
pub enum Weekday {
Sunday = 1,
Monday = 2,
Tuesday = 4,
Wednesday = 8,
Thursday = 16,
Friday = 32,
Saturday = 64,
}
```
#### Swift
In C, enumerations assign related names to a set of integer values. In Swift, enumerations are much more flexible and need not provide a value for each case of the enumeration. If a value (termed a raw value) is provided for each enumeration case, the value can be a string, a character, or a value of any integer or floating-point type.
Alternatively, enumeration cases can specify associated values of any type to be stored along with each different case value, much as unions or variants do in other languages.
|
https://en.wikipedia.org/wiki/Enumerated_type
|
If a value (termed a raw value) is provided for each enumeration case, the value can be a string, a character, or a value of any integer or floating-point type.
Alternatively, enumeration cases can specify associated values of any type to be stored along with each different case value, much as unions or variants do in other languages. One can define a common set of related cases as part of one enumeration, each of which has a different set of values of appropriate types associated with it.
In Swift, enumerations are a first-class type. They adopt many features traditionally supported only by classes, such as computed properties to provide additional information about the enumeration's current value, and instance methods to provide functionality related to the values the enumeration represents. Enumerations can also define initializers to provide an initial case value and can be extended to expand their functionality beyond their original implementation; and can conform to protocols to provide standard functionality.
```swift
enum CardSuit {
case clubs
case diamonds
case hearts
case spades
}
```
Unlike C and Objective-C, Swift enumeration cases are not assigned a default integer value when they are created. In the CardSuit example above, clubs, diamonds, hearts, and spades do not implicitly equal 0, 1, 2 and 3. Instead, the different enumeration cases are fully-fledged values in their own right, with an explicitly-defined type of CardSuit.
|
https://en.wikipedia.org/wiki/Enumerated_type
|
In the CardSuit example above, clubs, diamonds, hearts, and spades do not implicitly equal 0, 1, 2 and 3. Instead, the different enumeration cases are fully-fledged values in their own right, with an explicitly-defined type of CardSuit.
Multiple cases can appear on a single line, separated by commas:
```swift
enum CardSuit {
case clubs, diamonds, hearts, spades
}
```
When working with enumerations that store integer or string raw values, one doesn't need to explicitly assign a raw value for each case because Swift will automatically assign the values.
For instance, when integers are used for raw values, the implicit value for each case is one more than the previous case. If the first case doesn't have a value set, its value is 0. For the CardSuit example, suits can be numbered starting from 1 by writing:
```swift
enum CardSuit {
case clubs = 1, diamonds, hearts, spades
}
```
|
https://en.wikipedia.org/wiki/Enumerated_type
|
If the first case doesn't have a value set, its value is 0. For the CardSuit example, suits can be numbered starting from 1 by writing:
```swift
enum CardSuit {
case clubs = 1, diamonds, hearts, spades
}
```
#### TypeScript
TypeScript adds an 'enum' data type to JavaScript.
```JavaScript
enum Cardsuit {Clubs, Diamonds, Hearts, Spades};
var c: Cardsuit = Cardsuit.Diamonds;
```
By default, enums number members starting at 0; this can be overridden by setting the value of the first:
```JavaScript
enum Cardsuit {Clubs = 1, Diamonds, Hearts, Spades};
var c: Cardsuit = Cardsuit.Diamonds;
```
All the values can be set:
```JavaScript
enum Cardsuit {Clubs = 1, Diamonds = 2, Hearts = 4, Spades = 8};
var c: Cardsuit = Cardsuit.Diamonds;
```
TypeScript supports mapping the numeric value to its name. For example, this finds the name of the value 2:
```JavaScript
enum Cardsuit {Clubs = 1, Diamonds, Hearts, Spades};
var suitName: string = Cardsuit[2];
alert(suitName);
```
|
https://en.wikipedia.org/wiki/Enumerated_type
|
#### TypeScript
TypeScript adds an 'enum' data type to JavaScript.
```JavaScript
enum Cardsuit {Clubs, Diamonds, Hearts, Spades};
var c: Cardsuit = Cardsuit.Diamonds;
```
By default, enums number members starting at 0; this can be overridden by setting the value of the first:
```JavaScript
enum Cardsuit {Clubs = 1, Diamonds, Hearts, Spades};
var c: Cardsuit = Cardsuit.Diamonds;
```
All the values can be set:
```JavaScript
enum Cardsuit {Clubs = 1, Diamonds = 2, Hearts = 4, Spades = 8};
var c: Cardsuit = Cardsuit.Diamonds;
```
TypeScript supports mapping the numeric value to its name. For example, this finds the name of the value 2:
```JavaScript
enum Cardsuit {Clubs = 1, Diamonds, Hearts, Spades};
var suitName: string = Cardsuit[2];
alert(suitName);
```
#### Python
An `enum` module was added to the Python standard library in version 3.4.
```python
from enum import Enum
class Cards(Enum):
CLUBS = 1
DIAMONDS = 2
HEARTS = 3
SPADES = 4
```
There is also a functional API for creating enumerations with automatically generated indices (starting with one):
```python
Cards = Enum("Cards", "CLUBS DIAMONDS HEARTS SPADES")
```
Python enumerations do not enforce semantic correctness (a meaningless comparison to an incompatible enumeration always returns False rather than raising a TypeError):
```pycon
>>> Color = Enum("Color", "RED GREEN BLUE")
>>> Shape = Enum("Shape", ["CIRCLE", "TRIANGLE", "SQUARE", "HEXAGON"])
>>> def has_vertices(shape):
... return shape != Shape.CIRCLE
...
>>> has_vertices(Color.GREEN)
True
```
|
https://en.wikipedia.org/wiki/Enumerated_type
|
For example, this finds the name of the value 2:
```JavaScript
enum Cardsuit {Clubs = 1, Diamonds, Hearts, Spades};
var suitName: string = Cardsuit[2];
alert(suitName);
```
#### Python
An `enum` module was added to the Python standard library in version 3.4.
```python
from enum import Enum
class Cards(Enum):
CLUBS = 1
DIAMONDS = 2
HEARTS = 3
SPADES = 4
```
There is also a functional API for creating enumerations with automatically generated indices (starting with one):
```python
Cards = Enum("Cards", "CLUBS DIAMONDS HEARTS SPADES")
```
Python enumerations do not enforce semantic correctness (a meaningless comparison to an incompatible enumeration always returns False rather than raising a TypeError):
```pycon
>>> Color = Enum("Color", "RED GREEN BLUE")
>>> Shape = Enum("Shape", ["CIRCLE", "TRIANGLE", "SQUARE", "HEXAGON"])
>>> def has_vertices(shape):
... return shape != Shape.CIRCLE
...
>>> has_vertices(Color.GREEN)
True
```
#### Fortran
Fortran only has enumerated types for interoperability with C; hence, the semantics is similar to C and, as in C, the enum values are just integers and no further type check is done.
|
https://en.wikipedia.org/wiki/Enumerated_type
|
#### Python
An `enum` module was added to the Python standard library in version 3.4.
```python
from enum import Enum
class Cards(Enum):
CLUBS = 1
DIAMONDS = 2
HEARTS = 3
SPADES = 4
```
There is also a functional API for creating enumerations with automatically generated indices (starting with one):
```python
Cards = Enum("Cards", "CLUBS DIAMONDS HEARTS SPADES")
```
Python enumerations do not enforce semantic correctness (a meaningless comparison to an incompatible enumeration always returns False rather than raising a TypeError):
```pycon
>>> Color = Enum("Color", "RED GREEN BLUE")
>>> Shape = Enum("Shape", ["CIRCLE", "TRIANGLE", "SQUARE", "HEXAGON"])
>>> def has_vertices(shape):
... return shape != Shape.CIRCLE
...
>>> has_vertices(Color.GREEN)
True
```
#### Fortran
Fortran only has enumerated types for interoperability with C; hence, the semantics is similar to C and, as in C, the enum values are just integers and no further type check is done. The C example from above can be written in Fortran as
```fortran
enum, bind( C )
enumerator :: CLUBS = 1, DIAMONDS = 2, HEARTS = 4, SPADES = 8
end enum
```
|
https://en.wikipedia.org/wiki/Enumerated_type
|
#### Fortran
Fortran only has enumerated types for interoperability with C; hence, the semantics is similar to C and, as in C, the enum values are just integers and no further type check is done. The C example from above can be written in Fortran as
```fortran
enum, bind( C )
enumerator :: CLUBS = 1, DIAMONDS = 2, HEARTS = 4, SPADES = 8
end enum
```
#### Visual Basic/VBA
Enumerated datatypes in Visual Basic (up to version 6) and VBA are automatically assigned the "`Long`" datatype and also become a datatype themselves:
```vbnet
'Zero-based
Enum CardSuit
Clubs
Diamonds
Hearts
Spades
End Enum
Sub EnumExample()
Dim suit As CardSuit
suit = Diamonds
MsgBox suit
End Sub
```
Example Code in VB.NET
```vbNet
Enum CardSuit
Clubs
Diamonds
Hearts
Spades
End Enum
Sub EnumExample()
Dim suit As CardSuit
suit = CardSuit.Diamonds
MessageBox.show(suit)
End Sub
```
|
https://en.wikipedia.org/wiki/Enumerated_type
|
#### Visual Basic/VBA
Enumerated datatypes in Visual Basic (up to version 6) and VBA are automatically assigned the "`Long`" datatype and also become a datatype themselves:
```vbnet
'Zero-based
Enum CardSuit
Clubs
Diamonds
Hearts
Spades
End Enum
Sub EnumExample()
Dim suit As CardSuit
suit = Diamonds
MsgBox suit
End Sub
```
Example Code in VB.NET
```vbNet
Enum CardSuit
Clubs
Diamonds
Hearts
Spades
End Enum
Sub EnumExample()
Dim suit As CardSuit
suit = CardSuit.Diamonds
MessageBox.show(suit)
End Sub
```
#### Lisp
Common Lisp uses the member type specifier, e.g.,
```Lisp
(deftype cardsuit ()
'(member club diamond heart spade))
```
that states that object is of type cardsuit if it is `#'eql` to club, diamond, heart or spade. The member type specifier is not valid as a Common Lisp Object System (CLOS) parameter specializer, however. Instead, `(eql atom)`, which is the equivalent to `(member atom)` may be used (that is, only one member of the set may be specified with an eql type specifier, however, it may be used as a CLOS parameter specializer.)
|
https://en.wikipedia.org/wiki/Enumerated_type
|
The member type specifier is not valid as a Common Lisp Object System (CLOS) parameter specializer, however. Instead, `(eql atom)`, which is the equivalent to `(member atom)` may be used (that is, only one member of the set may be specified with an eql type specifier, however, it may be used as a CLOS parameter specializer.) In other words, to define methods to cover an enumerated type, a method must be defined for each specific element of that type.
Additionally,
```Lisp
(deftype finite-element-set-type (&rest elements)
`(member ,@elements))
```
may be used to define arbitrary enumerated types at runtime. For instance
```Lisp
(finite-element-set-type club diamond heart spade)
```
would refer to a type equivalent to the prior definition of cardsuit, as of course would simply have been using
```Lisp
(member club diamond heart spade)
```
but may be less confusing with the function `#'member` for stylistic reasons.
|
https://en.wikipedia.org/wiki/Enumerated_type
|
Additionally,
```Lisp
(deftype finite-element-set-type (&rest elements)
`(member ,@elements))
```
may be used to define arbitrary enumerated types at runtime. For instance
```Lisp
(finite-element-set-type club diamond heart spade)
```
would refer to a type equivalent to the prior definition of cardsuit, as of course would simply have been using
```Lisp
(member club diamond heart spade)
```
but may be less confusing with the function `#'member` for stylistic reasons.
#### Dart
Dart has a support for the most basic form of enums and has a syntax that is a lot similar with other languages supporting enums.
```dart
enum CardSuite {
Clubs,
Diamonds,
Hearts,
Spades
}
void main() {
CardSuite card = CardSuite.Clubs;
// Dart uses the "switch" operator to match the value of an enum with the desired output.
switch (card) {
case CardSuite.Clubs: {
print("Clubs");
}
break;
case CardSuite.Diamonds: {
print("Diamonds");
}
break;
case CardSuite.Hearts: {
print("Hearts");
}
break;
case CardSuite.Spades: {
print("Spades");
}
break;
default: {
print("Unknown");
}
break;
}
}
```
Note that the switch operator does not guarantee the completeness of the cases.
|
https://en.wikipedia.org/wiki/Enumerated_type
|
For instance
```Lisp
(finite-element-set-type club diamond heart spade)
```
would refer to a type equivalent to the prior definition of cardsuit, as of course would simply have been using
```Lisp
(member club diamond heart spade)
```
but may be less confusing with the function `#'member` for stylistic reasons.
#### Dart
Dart has a support for the most basic form of enums and has a syntax that is a lot similar with other languages supporting enums.
```dart
enum CardSuite {
Clubs,
Diamonds,
Hearts,
Spades
}
void main() {
CardSuite card = CardSuite.Clubs;
// Dart uses the "switch" operator to match the value of an enum with the desired output.
switch (card) {
case CardSuite.Clubs: {
print("Clubs");
}
break;
case CardSuite.Diamonds: {
print("Diamonds");
}
break;
case CardSuite.Hearts: {
print("Hearts");
}
break;
case CardSuite.Spades: {
print("Spades");
}
break;
default: {
print("Unknown");
}
break;
}
}
```
Note that the switch operator does not guarantee the completeness of the cases. This means if you omit one case, the compiler will not raise an error.
|
https://en.wikipedia.org/wiki/Enumerated_type
|
#### Dart
Dart has a support for the most basic form of enums and has a syntax that is a lot similar with other languages supporting enums.
```dart
enum CardSuite {
Clubs,
Diamonds,
Hearts,
Spades
}
void main() {
CardSuite card = CardSuite.Clubs;
// Dart uses the "switch" operator to match the value of an enum with the desired output.
switch (card) {
case CardSuite.Clubs: {
print("Clubs");
}
break;
case CardSuite.Diamonds: {
print("Diamonds");
}
break;
case CardSuite.Hearts: {
print("Hearts");
}
break;
case CardSuite.Spades: {
print("Spades");
}
break;
default: {
print("Unknown");
}
break;
}
}
```
Note that the switch operator does not guarantee the completeness of the cases. This means if you omit one case, the compiler will not raise an error.
## Algebraic data type in functional programming
In functional programming languages in the ML lineage (e.g., Standard ML (SML), OCaml, and Haskell), an algebraic data type with only nullary constructors can be used to implement an enumerated type.
|
https://en.wikipedia.org/wiki/Enumerated_type
|
This means if you omit one case, the compiler will not raise an error.
## Algebraic data type in functional programming
In functional programming languages in the ML lineage (e.g., Standard ML (SML), OCaml, and Haskell), an algebraic data type with only nullary constructors can be used to implement an enumerated type. For example (in the syntax of SML signatures):
```sml
datatype cardsuit = Clubs | Diamonds | Hearts | Spades
type card = { suit: cardsuit; value: int }
val hand : card list
val trump : cardsuit
```
In these languages the small-integer representation is completely hidden from the programmer, if indeed such a representation is employed by the implementation. However, Haskell has the `Enum` type class which a type can derive or implement to get a mapping between the type and `Int`.
## Databases
Some databases support enumerated types directly. MySQL provides an enumerated type `ENUM` with allowable values specified as strings when a table is created. The values are stored as numeric indices with the empty string stored as 0, the first string value stored as 1, the second string value stored as 2, etc. Values can be stored and retrieved as numeric indexes or string values.
|
https://en.wikipedia.org/wiki/Enumerated_type
|
The values are stored as numeric indices with the empty string stored as 0, the first string value stored as 1, the second string value stored as 2, etc. Values can be stored and retrieved as numeric indexes or string values.
Example:
```mysql
CREATE TABLE shirts (
name VARCHAR(40),
size ENUM('x-small', 'small', 'medium', 'large', 'x-large')
);
```
## XML Schema
XML Schema supports enumerated types through the enumeration facet used for constraining most primitive datatypes such as strings.
```XML
<xs:element name="cardsuit">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Clubs"/>
<xs:enumeration value="Diamonds"/>
<xs:enumeration value="Hearts"/>
<xs:enumeration value="Spades"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
```
|
https://en.wikipedia.org/wiki/Enumerated_type
|
In mathematics, the Laplace transform, named after Pierre-Simon Laplace (), is an integral transform that converts a function of a real variable (usually
$$
t
$$
, in the time domain) to a function of a complex variable
$$
s
$$
(in the complex-valued frequency domain, also known as s-domain, or s-plane).
The transform is useful for converting differentiation and integration in the time domain into much easier multiplication and division in the Laplace domain (analogous to how logarithms are useful for simplifying multiplication and division into addition and subtraction). This gives the transform many applications in science and engineering, mostly as a tool for solving linear differential equations and dynamical systems by simplifying ordinary differential equations and integral equations into algebraic polynomial equations, and by simplifying convolution into multiplication. Once solved, the inverse Laplace transform reverts to the original domain.
The Laplace transform is defined (for suitable functions
$$
f
$$
) by the integral
$$
\mathcal{L}\{f\}(s) = \int_0^\infty f(t) e^{-st} \, dt,
$$
where s is a complex number. It is related to many other transforms, most notably the
### Fourier transform
and the
### Mellin transform
.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
### Fourier transform
and the
### Mellin transform
. Formally, the Laplace transform is converted into a Fourier transform by the substitution
$$
s = i\omega
$$
where
$$
\omega
$$
is real. However, unlike the Fourier transform, which gives the decomposition of a function into its components in each frequency, the Laplace transform of a function with suitable decay is an analytic function, and so has a convergent power series, the coefficients of which give the decomposition of a function into its moments. Also unlike the Fourier transform, when regarded in this way as an analytic function, the techniques of complex analysis, and especially contour integrals, can be used for calculations.
## History
The Laplace transform is named after mathematician and astronomer Pierre-Simon, Marquis de Laplace, who used a similar transform in his work on probability theory. Laplace wrote extensively about the use of generating functions (1814), and the integral form of the Laplace transform evolved naturally as a result.
Laplace's use of generating functions was similar to what is now known as the z-transform, and he gave little attention to the continuous variable case which was discussed by Niels Henrik Abel.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
Laplace wrote extensively about the use of generating functions (1814), and the integral form of the Laplace transform evolved naturally as a result.
Laplace's use of generating functions was similar to what is now known as the z-transform, and he gave little attention to the continuous variable case which was discussed by Niels Henrik Abel.
From 1744, Leonhard Euler investigated integrals of the form
$$
z = \int X(x) e^{ax}\, dx \quad\text{ and }\quad z = \int X(x) x^A \, dx
$$
as solutions of differential equations, introducing in particular the gamma function. Joseph-Louis Lagrange was an admirer of Euler and, in his work on integrating probability density functions, investigated expressions of the form
$$
\int X(x) e^{- a x } a^x\, dx,
$$
which resembles a Laplace transform.
These types of integrals seem first to have attracted Laplace's attention in 1782, where he was following in the spirit of Euler in using the integrals themselves as solutions of equations. However, in 1785, Laplace took the critical step forward when, rather than simply looking for a solution in the form of an integral, he started to apply the transforms in the sense that was later to become popular.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
These types of integrals seem first to have attracted Laplace's attention in 1782, where he was following in the spirit of Euler in using the integrals themselves as solutions of equations. However, in 1785, Laplace took the critical step forward when, rather than simply looking for a solution in the form of an integral, he started to apply the transforms in the sense that was later to become popular. He used an integral of the form
$$
\int x^s \varphi (x)\, dx,
$$
akin to a Mellin transform, to transform the whole of a difference equation, in order to look for solutions of the transformed equation. He then went on to apply the Laplace transform in the same way and started to derive some of its properties, beginning to appreciate its potential power.
Laplace also recognised that Joseph Fourier's method of Fourier series for solving the diffusion equation could only apply to a limited region of space, because those solutions were periodic. In 1809, Laplace applied his transform to find solutions that diffused indefinitely in space. In 1821, Cauchy developed an operational calculus for the Laplace transform that could be used to study linear differential equations in much the same way the transform is now used in basic engineering. This method was popularized, and perhaps rediscovered, by Oliver Heaviside around the turn of the century.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
In 1821, Cauchy developed an operational calculus for the Laplace transform that could be used to study linear differential equations in much the same way the transform is now used in basic engineering. This method was popularized, and perhaps rediscovered, by Oliver Heaviside around the turn of the century.
Bernhard Riemann used the Laplace transform in his 1859 paper On the number of primes less than a given magnitude, in which he also developed the inversion theorem. Riemann used the Laplace transform to develop the functional equation of the Riemann zeta function, and this method is still used to relate the modular transformation law of the Jacobi theta function to the functional equation .
Hjalmar Mellin was among the first to study the Laplace transform, rigorously in the Karl Weierstrass school of analysis, and apply it to the study of differential equations and special functions, at the turn of the 20th century. At around the same time, Heaviside was busy with his operational calculus. Thomas Joannes Stieltjes considered a generalization of the Laplace transform connected to his work on moments. Other contributors in this time period included Mathias Lerch, Oliver Heaviside, and Thomas Bromwich.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
Thomas Joannes Stieltjes considered a generalization of the Laplace transform connected to his work on moments. Other contributors in this time period included Mathias Lerch, Oliver Heaviside, and Thomas Bromwich.
In 1929, Vannevar Bush and Norbert Wiener published Operational Circuit Analysis as a text for engineering analysis of electrical circuits, applying both Fourier transforms and operational calculus, and in which they included one of the first predecessors of the modern table of Laplace transforms.
In 1934, Raymond Paley and Norbert Wiener published the important work Fourier transforms in the complex domain, about what is now called the Laplace transform (see below). Also during the 30s, the Laplace transform was instrumental in G H Hardy and John Edensor Littlewood's study of tauberian theorems, and this application was later expounded on by Widder (1941), who developed other aspects of the theory such as a new method for inversion. Edward Charles Titchmarsh wrote the influential Introduction to the theory of the Fourier integral (1937).
The current widespread use of the transform (mainly in engineering) came about during and soon after World War II, replacing the earlier Heaviside operational calculus. The advantages of the Laplace transform had been emphasized by Gustav Doetsch, to whom the name Laplace transform is apparently due.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
The current widespread use of the transform (mainly in engineering) came about during and soon after World War II, replacing the earlier Heaviside operational calculus. The advantages of the Laplace transform had been emphasized by Gustav Doetsch, to whom the name Laplace transform is apparently due.
## Formal definition
The Laplace transform of a function , defined for all real numbers , is the function , which is a unilateral transform defined by
where s is a complex frequency-domain parameter
$$
s = \sigma + i \omega
$$
with real numbers and .
An alternate notation for the Laplace transform is
$$
\mathcal{L}\{f\}
$$
instead of , often written as
$$
F(s) = \mathcal{L}\{f(t)\}
$$
in an abuse of notation.
The meaning of the integral depends on types of functions of interest. A necessary condition for existence of the integral is that must be locally integrable on . For locally integrable functions that decay at infinity or are of exponential type (
$$
|f(t)| \le Ae^{B|t|}
$$
), the integral can be understood to be a (proper) Lebesgue integral. However, for many applications it is necessary to regard it as a conditionally convergent improper integral at .
|
https://en.wikipedia.org/wiki/Laplace_transform
|
For locally integrable functions that decay at infinity or are of exponential type (
$$
|f(t)| \le Ae^{B|t|}
$$
), the integral can be understood to be a (proper) Lebesgue integral. However, for many applications it is necessary to regard it as a conditionally convergent improper integral at . Still more generally, the integral can be understood in a weak sense, and this is dealt with below.
One can define the Laplace transform of a finite Borel measure by the Lebesgue integral
$$
\mathcal{L}\{\mu\}(s) = \int_{[0,\infty)} e^{-st}\, d\mu(t).
$$
An important special case is where is a probability measure, for example, the Dirac delta function. In operational calculus, the Laplace transform of a measure is often treated as though the measure came from a probability density function .
|
https://en.wikipedia.org/wiki/Laplace_transform
|
One can define the Laplace transform of a finite Borel measure by the Lebesgue integral
$$
\mathcal{L}\{\mu\}(s) = \int_{[0,\infty)} e^{-st}\, d\mu(t).
$$
An important special case is where is a probability measure, for example, the Dirac delta function. In operational calculus, the Laplace transform of a measure is often treated as though the measure came from a probability density function . In that case, to avoid potential confusion, one often writes
$$
\mathcal{L}\{f\}(s) = \int_{0^-}^\infty f(t)e^{-st} \, dt,
$$
where the lower limit of is shorthand notation for
$$
\lim_{\varepsilon \to 0^+}\int_{-\varepsilon}^\infty.
$$
This limit emphasizes that any point mass located at is entirely captured by the Laplace transform. Although with the Lebesgue integral, it is not necessary to take such a limit, it does appear more naturally in connection with the
### Laplace–Stieltjes transform
.
### Bilateral Laplace transform
When one says "the Laplace transform" without qualification, the unilateral or one-sided transform is usually intended.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
### Laplace–Stieltjes transform
.
### Bilateral Laplace transform
When one says "the Laplace transform" without qualification, the unilateral or one-sided transform is usually intended. The Laplace transform can be alternatively defined as the bilateral Laplace transform, or two-sided Laplace transform, by extending the limits of integration to be the entire real axis. If that is done, the common unilateral transform simply becomes a special case of the bilateral transform, where the definition of the function being transformed is multiplied by the Heaviside step function.
The bilateral Laplace transform is defined as follows:
An alternate notation for the bilateral Laplace transform is
$$
\mathcal{B}\{f\}
$$
, instead of .
### Inverse Laplace transform
Two integrable functions have the same Laplace transform only if they differ on a set of Lebesgue measure zero. This means that, on the range of the transform, there is an inverse transform. In fact, besides integrable functions, the Laplace transform is a one-to-one mapping from one function space into another in many other function spaces as well, although there is usually no easy characterization of the range.
Typical function spaces in which this is true include the spaces of bounded continuous functions, the space , or more generally tempered distributions on . The Laplace transform is also defined and injective for suitable spaces of tempered distributions.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
Typical function spaces in which this is true include the spaces of bounded continuous functions, the space , or more generally tempered distributions on . The Laplace transform is also defined and injective for suitable spaces of tempered distributions.
In these cases, the image of the Laplace transform lives in a space of analytic functions in the region of convergence. The inverse Laplace transform is given by the following complex integral, which is known by various names (the Bromwich integral, the Fourier–Mellin integral, and Mellin's inverse formula):
where is a real number so that the contour path of integration is in the region of convergence of . In most applications, the contour can be closed, allowing the use of the residue theorem. An alternative formula for the inverse Laplace transform is given by Post's inversion formula. The limit here is interpreted in the weak-* topology.
In practice, it is typically more convenient to decompose a Laplace transform into known transforms of functions obtained from a table and construct the inverse by inspection.
### Probability theory
In pure and applied probability, the Laplace transform is defined as an expected value.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
In practice, it is typically more convenient to decompose a Laplace transform into known transforms of functions obtained from a table and construct the inverse by inspection.
### Probability theory
In pure and applied probability, the Laplace transform is defined as an expected value. If is a random variable with probability density function , then the Laplace transform of is given by the expectation
$$
\mathcal{L}\{f\}(s) = \operatorname{E}\left[e^{-sX}\right],
$$
where
$$
\operatorname{E}[r]
$$
is the expectation of random variable
$$
r
$$
.
By convention, this is referred to as the Laplace transform of the random variable itself. Here, replacing by gives the moment generating function of . The Laplace transform has applications throughout probability theory, including first passage times of stochastic processes such as Markov chains, and renewal theory.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
Here, replacing by gives the moment generating function of . The Laplace transform has applications throughout probability theory, including first passage times of stochastic processes such as Markov chains, and renewal theory.
Of particular use is the ability to recover the cumulative distribution function of a continuous random variable by means of the Laplace transform as follows:
$$
F_X(x) = \mathcal{L}^{-1}\left\{\frac{1}{s} \operatorname{E}\left[e^{-sX}\right]\right\}(x) = \mathcal{L}^{-1}\left\{\frac{1}{s} \mathcal{L}\{f\}(s)\right\}(x).
$$
### Algebraic construction
The Laplace transform can be alternatively defined in a purely algebraic manner by applying a field of fractions construction to the convolution ring of functions on the positive half-line. The resulting space of abstract operators is exactly equivalent to Laplace space, but in this construction the forward and reverse transforms never need to be explicitly defined (avoiding the related difficulties with proving convergence).
## Region of convergence
|
https://en.wikipedia.org/wiki/Laplace_transform
|
The resulting space of abstract operators is exactly equivalent to Laplace space, but in this construction the forward and reverse transforms never need to be explicitly defined (avoiding the related difficulties with proving convergence).
## Region of convergence
If is a locally integrable function (or more generally a Borel measure locally of bounded variation), then the Laplace transform of converges provided that the limit
$$
\lim_{R\to\infty}\int_0^R f(t)e^{-st}\,dt
$$
exists.
The Laplace transform converges absolutely if the integral
$$
\int_0^\infty \left|f(t)e^{-st}\right|\,dt
$$
exists as a proper Lebesgue integral. The Laplace transform is usually understood as conditionally convergent, meaning that it converges in the former but not in the latter sense.
The set of values for which converges absolutely is either of the form or , where is an extended real constant with (a consequence of the dominated convergence theorem). The constant is known as the abscissa of absolute convergence, and depends on the growth behavior of . Analogously, the two-sided transform converges absolutely in a strip of the form , and possibly including the lines or .
|
https://en.wikipedia.org/wiki/Laplace_transform
|
The constant is known as the abscissa of absolute convergence, and depends on the growth behavior of . Analogously, the two-sided transform converges absolutely in a strip of the form , and possibly including the lines or . The subset of values of for which the Laplace transform converges absolutely is called the region of absolute convergence, or the domain of absolute convergence. In the two-sided case, it is sometimes called the strip of absolute convergence. The Laplace transform is analytic in the region of absolute convergence: this is a consequence of Fubini's theorem and Morera's theorem.
Similarly, the set of values for which converges (conditionally or absolutely) is known as the region of conditional convergence, or simply the region of convergence (ROC). If the Laplace transform converges (conditionally) at , then it automatically converges for all with . Therefore, the region of convergence is a half-plane of the form , possibly including some points of the boundary line .
|
https://en.wikipedia.org/wiki/Laplace_transform
|
If the Laplace transform converges (conditionally) at , then it automatically converges for all with . Therefore, the region of convergence is a half-plane of the form , possibly including some points of the boundary line .
In the region of convergence , the Laplace transform of can be expressed by integrating by parts as the integral
$$
F(s) = (s-s_0)\int_0^\infty e^{-(s-s_0)t}\beta(t)\,dt, \quad \beta(u) = \int_0^u e^{-s_0t}f(t)\,dt.
$$
That is, can effectively be expressed, in the region of convergence, as the absolutely convergent Laplace transform of some other function. In particular, it is analytic.
There are several Paley–Wiener theorems concerning the relationship between the decay properties of , and the properties of the Laplace transform within the region of convergence.
In engineering applications, a function corresponding to a linear time-invariant (LTI) system is stable if every bounded input produces a bounded output. This is equivalent to the absolute convergence of the Laplace transform of the impulse response function in the region . As a result, LTI systems are stable, provided that the poles of the Laplace transform of the impulse response function have negative real part.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
This is equivalent to the absolute convergence of the Laplace transform of the impulse response function in the region . As a result, LTI systems are stable, provided that the poles of the Laplace transform of the impulse response function have negative real part.
This ROC is used in knowing about the causality and stability of a system.
## Properties and theorems
The Laplace transform's key property is that it converts differentiation and integration in the time domain into multiplication and division by in the Laplace domain. Thus, the Laplace variable is also known as an operator variable in the Laplace domain: either the derivative operator or (for the integration operator.
Given the functions and , and their respective Laplace transforms and ,
$$
\begin{align}
f(t) &= \mathcal{L}^{-1}\{F(s)\},\\
g(t) &= \mathcal{L}^{-1}\{G(s)\},
\end{align}
$$
the following table is a list of properties of unilateral Laplace transform:
+ Properties of the unilateral Laplace transform Property
Time domain
domain
Comment Linearity
Can be proved using basic rules of integration. Frequency-domain derivative
is the first derivative of with respect to . Frequency-domain general derivative
More general form, th derivative of .
|
https://en.wikipedia.org/wiki/Laplace_transform
|
Frequency-domain derivative
is the first derivative of with respect to . Frequency-domain general derivative
More general form, th derivative of . Derivative
is assumed to be a differentiable function, and its derivative is assumed to be of exponential type. This can then be obtained by integration by parts Second derivative
is assumed twice differentiable and the second derivative to be of exponential type. Follows by applying the Differentiation property to . General derivative
is assumed to be -times differentiable, with th derivative of exponential type. Follows by mathematical induction. Frequency-domain integration
This is deduced using the nature of frequency differentiation and conditional convergence. Time-domain integration
is the Heaviside step function and is the convolution of and . Frequency shifting
Time shifting
, is the Heaviside step function Time scaling
Multiplication
The integration is done along the vertical line that lies entirely within the region of convergence of . Convolution
Circular convolution
For periodic functions with period . Complex conjugation
Periodic function
is a periodic function of period so that , for all . This is the result of the time shifting property and the geometric series.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
Complex conjugation
Periodic function
is a periodic function of period so that , for all . This is the result of the time shifting property and the geometric series. Periodic summation
Initial value theorem
$$
f(0^+)=\lim_{s\to \infty}{sF(s)}.
$$
Final value theorem
$$
f(\infty)=\lim_{s\to 0}{sF(s)}
$$
, if all poles of
$$
sF(s)
$$
are in the left half-plane.
The final value theorem is useful because it gives the long-term behaviour without having to perform partial fraction decompositions (or other difficult algebra). If has a pole in the right-hand plane or poles on the imaginary axis (e.g., if
$$
f(t) = e^t
$$
or
$$
f(t) = \sin(t)
$$
), then the behaviour of this formula is undefined.
### Relation to power series
The Laplace transform can be viewed as a continuous analogue of a power series. If is a discrete function of a positive integer , then the power series associated to is the series
$$
\sum_{n=0}^{\infty} a(n) x^n
$$
where is a real variable (see
### Z-transform
).
|
https://en.wikipedia.org/wiki/Laplace_transform
|
If is a discrete function of a positive integer , then the power series associated to is the series
$$
\sum_{n=0}^{\infty} a(n) x^n
$$
where is a real variable (see
### Z-transform
). Replacing summation over with integration over , a continuous version of the power series becomes
$$
\int_{0}^{\infty} f(t) x^t\, dt
$$
where the discrete function is replaced by the continuous one .
Changing the base of the power from to gives
$$
\int_{0}^{\infty} f(t) \left(e^{\ln{x}}\right)^t\, dt
$$
For this to converge for, say, all bounded functions , it is necessary to require that . Making the substitution gives just the Laplace transform:
$$
\int_{0}^{\infty} f(t) e^{-st}\, dt
$$
In other words, the Laplace transform is a continuous analog of a power series, in which the discrete parameter is replaced by the continuous parameter , and is replaced by .
### Relation to moments
The quantities
$$
\mu_n = \int_0^\infty t^nf(t)\, dt
$$
are the moments of the function .
|
https://en.wikipedia.org/wiki/Laplace_transform
|
### Relation to moments
The quantities
$$
\mu_n = \int_0^\infty t^nf(t)\, dt
$$
are the moments of the function . If the first moments of converge absolutely, then by repeated differentiation under the integral,
$$
(-1)^n(\mathcal L f)^{(n)}(0) = \mu_n .
$$
This is of special significance in probability theory, where the moments of a random variable are given by the expectation values
$$
\mu_n=\operatorname{E}[X^n]
$$
. Then, the relation holds
$$
\mu_n = (-1)^n\frac{d^n}{ds^n}\operatorname{E}\left[e^{-sX}\right](0).
$$
### Transform of a function's derivative
It is often convenient to use the differentiation property of the Laplace transform to find the transform of a function's derivative.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
This can be derived from the basic expression for a Laplace transform as follows:
$$
\begin{align}
\mathcal{L} \left\{f(t)\right\} &= \int_{0^-}^\infty e^{-st} f(t)\, dt \\[6pt]
_BLOCK0_\end{align}
$$
yielding
$$
\mathcal{L} \{ f'(t) \} = s\cdot\mathcal{L} \{ f(t) \}-f(0^-),
$$
and in the bilateral case,
$$
\mathcal{L} \{ f'(t) \} = s \int_{-\infty}^\infty e^{-st} f(t)\,dt = s \cdot \mathcal{L} \{ f(t) \}.
$$
The general result
$$
\mathcal{L} \left\{ f^{(n)}(t) \right\} = s^n \cdot \mathcal{L} \{ f(t) \} - s^{n - 1} f(0^-) - \cdots - f^{(n - 1)}(0^-),
$$
where
$$
f^{(n)}
$$
denotes the th derivative of , can then be established with an inductive argument.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
### Evaluating integrals over the positive real axis
A useful property of the Laplace transform is the following:
$$
\int_0^\infty f(x)g(x)\,dx = \int_0^\infty(\mathcal{L} f)(s)\cdot(\mathcal{L}^{-1}g)(s)\,ds
$$
under suitable assumptions on the behaviour of
$$
f,g
$$
in a right neighbourhood of
$$
0
$$
and on the decay rate of
$$
f,g
$$
in a left neighbourhood of
$$
\infty
$$
. The above formula is a variation of integration by parts, with the operators
$$
\frac{d}{dx}
$$
and
$$
\int \,dx
$$
being replaced by
$$
\mathcal{L}
$$
and
$$
\mathcal{L}^{-1}
$$
. Let us prove the equivalent formulation:
$$
\int_0^\infty(\mathcal{L} f)(x)g(x)\,dx = \int_0^\infty f(s)(\mathcal{L}g)(s)\,ds.
$$
By plugging in
$$
(\mathcal{L}f)(x)=\int_0^\infty f(s)e^{-sx}\,ds
$$
|
https://en.wikipedia.org/wiki/Laplace_transform
|
The above formula is a variation of integration by parts, with the operators
$$
\frac{d}{dx}
$$
and
$$
\int \,dx
$$
being replaced by
$$
\mathcal{L}
$$
and
$$
\mathcal{L}^{-1}
$$
. Let us prove the equivalent formulation:
$$
\int_0^\infty(\mathcal{L} f)(x)g(x)\,dx = \int_0^\infty f(s)(\mathcal{L}g)(s)\,ds.
$$
By plugging in
$$
(\mathcal{L}f)(x)=\int_0^\infty f(s)e^{-sx}\,ds
$$
the left-hand side turns into:
$$
\int_0^\infty\int_0^\infty f(s)g(x) e^{-sx}\,ds\,dx,
$$
but assuming Fubini's theorem holds, by reversing the order of integration we get the wanted right-hand side.
This method can be used to compute integrals that would otherwise be difficult to compute using elementary methods of real calculus.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
the left-hand side turns into:
$$
\int_0^\infty\int_0^\infty f(s)g(x) e^{-sx}\,ds\,dx,
$$
but assuming Fubini's theorem holds, by reversing the order of integration we get the wanted right-hand side.
This method can be used to compute integrals that would otherwise be difficult to compute using elementary methods of real calculus. For example,
$$
\int_0^\infty\frac{\sin x}{x}dx = \int_0^\infty \mathcal{L}(1)(x)\sin x dx = \int_0^\infty 1 \cdot \mathcal{L}(\sin)(x)dx = \int_0^\infty \frac{dx}{x^2 + 1} = \frac{\pi}{2}.
$$
## Relationship to other transforms
Laplace–Stieltjes transform
The (unilateral) Laplace–Stieltjes transform of a function is defined by the Lebesgue–Stieltjes integral
$$
\{ \mathcal{L}^*g \}(s) = \int_0^\infty e^{-st} \, d\,g(t) ~.
$$
The function is assumed to be of bounded variation.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
For example,
$$
\int_0^\infty\frac{\sin x}{x}dx = \int_0^\infty \mathcal{L}(1)(x)\sin x dx = \int_0^\infty 1 \cdot \mathcal{L}(\sin)(x)dx = \int_0^\infty \frac{dx}{x^2 + 1} = \frac{\pi}{2}.
$$
## Relationship to other transforms
Laplace–Stieltjes transform
The (unilateral) Laplace–Stieltjes transform of a function is defined by the Lebesgue–Stieltjes integral
$$
\{ \mathcal{L}^*g \}(s) = \int_0^\infty e^{-st} \, d\,g(t) ~.
$$
The function is assumed to be of bounded variation. If is the antiderivative of :
$$
g(x) = \int_0^x f(t)\,d\,t
$$
then the Laplace–Stieltjes transform of and the Laplace transform of coincide. In general, the Laplace–Stieltjes transform is the Laplace transform of the Stieltjes measure associated to .
|
https://en.wikipedia.org/wiki/Laplace_transform
|
If is the antiderivative of :
$$
g(x) = \int_0^x f(t)\,d\,t
$$
then the Laplace–Stieltjes transform of and the Laplace transform of coincide. In general, the Laplace–Stieltjes transform is the Laplace transform of the Stieltjes measure associated to . So in practice, the only distinction between the two transforms is that the Laplace transform is thought of as operating on the density function of the measure, whereas the Laplace–Stieltjes transform is thought of as operating on its cumulative distribution function.
Fourier transform
Let
$$
f
$$
be a complex-valued Lebesgue integrable function supported on
$$
[0,\infty)
$$
, and let
$$
F(s) = \mathcal Lf(s)
$$
be its Laplace transform. Then, within the region of convergence, we have
$$
F(\sigma + i\tau) = \int_0^\infty f(t)e^{-\sigma t}e^{-i\tau t}\,dt,
$$
which is the Fourier transform of the function
$$
f(t)e^{-\sigma t}
$$
.
Indeed, the Fourier transform is a special case (under certain conditions) of the bilateral Laplace transform.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
Then, within the region of convergence, we have
$$
F(\sigma + i\tau) = \int_0^\infty f(t)e^{-\sigma t}e^{-i\tau t}\,dt,
$$
which is the Fourier transform of the function
$$
f(t)e^{-\sigma t}
$$
.
Indeed, the Fourier transform is a special case (under certain conditions) of the bilateral Laplace transform. The main difference is that the Fourier transform of a function is a complex function of a real variable (frequency), the Laplace transform of a function is a complex function of a complex variable. The Laplace transform is usually restricted to transformation of functions of with . A consequence of this restriction is that the Laplace transform of a function is a holomorphic function of the variable . Unlike the Fourier transform, the Laplace transform of a distribution is generally a well-behaved function. Techniques of complex variables can also be used to directly study Laplace transforms. As a holomorphic function, the Laplace transform has a power series representation. This power series expresses a function as a linear superposition of moments of the function. This perspective has applications in probability theory.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
This power series expresses a function as a linear superposition of moments of the function. This perspective has applications in probability theory.
Formally, the Fourier transform is equivalent to evaluating the bilateral Laplace transform with imaginary argument when the condition explained below is fulfilled,
$$
\begin{align}
\hat{f}(\omega) &= \mathcal{F}\{f(t)\} \\[4pt]
_BLOCK0_\end{align}
$$
This convention of the Fourier transform (
$$
\hat f_3(\omega)
$$
in ) requires a factor of on the inverse Fourier transform. This relationship between the Laplace and Fourier transforms is often used to determine the frequency spectrum of a signal or dynamical system.
The above relation is valid as stated if and only if the region of convergence (ROC) of contains the imaginary axis, .
For example, the function has a Laplace transform whose ROC is . As is a pole of , substituting in does not yield the Fourier transform of , which contains terms proportional to the Dirac delta functions .
However, a relation of the form
$$
\lim_{\sigma\to 0^+} F(\sigma+i\omega) = \hat{f}(\omega)
$$
holds under much weaker conditions.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
As is a pole of , substituting in does not yield the Fourier transform of , which contains terms proportional to the Dirac delta functions .
However, a relation of the form
$$
\lim_{\sigma\to 0^+} F(\sigma+i\omega) = \hat{f}(\omega)
$$
holds under much weaker conditions. For instance, this holds for the above example provided that the limit is understood as a weak limit of measures (see vague topology). General conditions relating the limit of the Laplace transform of a function on the boundary to the Fourier transform take the form of Paley–Wiener theorems.
Mellin transform
The Mellin transform and its inverse are related to the two-sided Laplace transform by a simple change of variables.
If in the Mellin transform
$$
G(s) = \mathcal{M}\{g(\theta)\} = \int_0^\infty \theta^s g(\theta) \, \frac{d\theta} \theta
$$
we set we get a two-sided Laplace transform.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
Mellin transform
The Mellin transform and its inverse are related to the two-sided Laplace transform by a simple change of variables.
If in the Mellin transform
$$
G(s) = \mathcal{M}\{g(\theta)\} = \int_0^\infty \theta^s g(\theta) \, \frac{d\theta} \theta
$$
we set we get a two-sided Laplace transform.
Z-transform
The unilateral or one-sided Z-transform is simply the Laplace transform of an ideally sampled signal with the substitution of
$$
z \stackrel{\mathrm{def} }{ {}={} } e^{sT} ,
$$
where is the sampling interval (in units of time e.g., seconds) and is the sampling rate (in samples per second or hertz).
|
https://en.wikipedia.org/wiki/Laplace_transform
|
If in the Mellin transform
$$
G(s) = \mathcal{M}\{g(\theta)\} = \int_0^\infty \theta^s g(\theta) \, \frac{d\theta} \theta
$$
we set we get a two-sided Laplace transform.
Z-transform
The unilateral or one-sided Z-transform is simply the Laplace transform of an ideally sampled signal with the substitution of
$$
z \stackrel{\mathrm{def} }{ {}={} } e^{sT} ,
$$
where is the sampling interval (in units of time e.g., seconds) and is the sampling rate (in samples per second or hertz).
Let
$$
\Delta_T(t) \ \stackrel{\mathrm{def}}{=}\ \sum_{n=0}^{\infty} \delta(t - n T)
$$
be a sampling impulse train (also called a Dirac comb) and
$$
\begin{align}
x_q(t) &\stackrel{\mathrm{def} }{ {}={} } x(t) \Delta_T(t) = x(t) \sum_{n=0}^{\infty} \delta(t - n T) \\
_BLOCK1_\end{align}
$$
be the sampled representation of the continuous-time
$$
x[n] \stackrel{\mathrm{def} }{ {}={} } x(nT) ~.
$$
The Laplace transform of the sampled signal is
$$
\begin{align}
X_q(s) &= \int_{0^-}^\infty x_q(t) e^{-s t} \,dt \\
_BLOCK2_\end{align}
$$
This is the precise definition of the unilateral Z-transform of the discrete function
$$
X(z) = \sum_{n=0}^{\infty} x[n] z^{-n}
$$
with the substitution of .
|
https://en.wikipedia.org/wiki/Laplace_transform
|
Z-transform
The unilateral or one-sided Z-transform is simply the Laplace transform of an ideally sampled signal with the substitution of
$$
z \stackrel{\mathrm{def} }{ {}={} } e^{sT} ,
$$
where is the sampling interval (in units of time e.g., seconds) and is the sampling rate (in samples per second or hertz).
Let
$$
\Delta_T(t) \ \stackrel{\mathrm{def}}{=}\ \sum_{n=0}^{\infty} \delta(t - n T)
$$
be a sampling impulse train (also called a Dirac comb) and
$$
\begin{align}
x_q(t) &\stackrel{\mathrm{def} }{ {}={} } x(t) \Delta_T(t) = x(t) \sum_{n=0}^{\infty} \delta(t - n T) \\
_BLOCK1_\end{align}
$$
be the sampled representation of the continuous-time
$$
x[n] \stackrel{\mathrm{def} }{ {}={} } x(nT) ~.
$$
The Laplace transform of the sampled signal is
$$
\begin{align}
X_q(s) &= \int_{0^-}^\infty x_q(t) e^{-s t} \,dt \\
_BLOCK2_\end{align}
$$
This is the precise definition of the unilateral Z-transform of the discrete function
$$
X(z) = \sum_{n=0}^{\infty} x[n] z^{-n}
$$
with the substitution of .
Comparing the last two equations, we find the relationship between the unilateral Z-transform and the Laplace transform of the sampled signal,
$$
X_q(s) = X(z) \Big|_{z=e^{sT}}.
$$
The similarity between the Z- and Laplace transforms is expanded upon in the theory of time scale calculus.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
Let
$$
\Delta_T(t) \ \stackrel{\mathrm{def}}{=}\ \sum_{n=0}^{\infty} \delta(t - n T)
$$
be a sampling impulse train (also called a Dirac comb) and
$$
\begin{align}
x_q(t) &\stackrel{\mathrm{def} }{ {}={} } x(t) \Delta_T(t) = x(t) \sum_{n=0}^{\infty} \delta(t - n T) \\
_BLOCK1_\end{align}
$$
be the sampled representation of the continuous-time
$$
x[n] \stackrel{\mathrm{def} }{ {}={} } x(nT) ~.
$$
The Laplace transform of the sampled signal is
$$
\begin{align}
X_q(s) &= \int_{0^-}^\infty x_q(t) e^{-s t} \,dt \\
_BLOCK2_\end{align}
$$
This is the precise definition of the unilateral Z-transform of the discrete function
$$
X(z) = \sum_{n=0}^{\infty} x[n] z^{-n}
$$
with the substitution of .
Comparing the last two equations, we find the relationship between the unilateral Z-transform and the Laplace transform of the sampled signal,
$$
X_q(s) = X(z) \Big|_{z=e^{sT}}.
$$
The similarity between the Z- and Laplace transforms is expanded upon in the theory of time scale calculus.
### Borel transform
The integral form of the Borel transform
$$
F(s) = \int_0^\infty f(z)e^{-sz}\, dz
$$
is a special case of the Laplace transform for an entire function of exponential type, meaning that
$$
|f(z)|\le Ae^{B|z|}
$$
for some constants and .
|
https://en.wikipedia.org/wiki/Laplace_transform
|
Comparing the last two equations, we find the relationship between the unilateral Z-transform and the Laplace transform of the sampled signal,
$$
X_q(s) = X(z) \Big|_{z=e^{sT}}.
$$
The similarity between the Z- and Laplace transforms is expanded upon in the theory of time scale calculus.
### Borel transform
The integral form of the Borel transform
$$
F(s) = \int_0^\infty f(z)e^{-sz}\, dz
$$
is a special case of the Laplace transform for an entire function of exponential type, meaning that
$$
|f(z)|\le Ae^{B|z|}
$$
for some constants and . The generalized Borel transform allows a different weighting function to be used, rather than the exponential function, to transform functions not of exponential type. Nachbin's theorem gives necessary and sufficient conditions for the Borel transform to be well defined.
### Fundamental relationships
Since an ordinary Laplace transform can be written as a special case of a two-sided transform, and since the two-sided transform can be written as the sum of two one-sided transforms, the theory of the Laplace-, Fourier-, Mellin-, and Z-transforms are at bottom the same subject. However, a different point of view and different characteristic problems are associated with each of these four major integral transforms.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
### Fundamental relationships
Since an ordinary Laplace transform can be written as a special case of a two-sided transform, and since the two-sided transform can be written as the sum of two one-sided transforms, the theory of the Laplace-, Fourier-, Mellin-, and Z-transforms are at bottom the same subject. However, a different point of view and different characteristic problems are associated with each of these four major integral transforms.
## Table of selected Laplace transforms
The following table provides Laplace transforms for many common functions of a single variable. For definitions and explanations, see the Explanatory Notes at the end of the table.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
## Table of selected Laplace transforms
The following table provides Laplace transforms for many common functions of a single variable. For definitions and explanations, see the Explanatory Notes at the end of the table.
Because the Laplace transform is a linear operator,
- The Laplace transform of a sum is the sum of Laplace transforms of each term.
$$
\mathcal{L}\{f(t) + g(t)\} = \mathcal{L}\{f(t)\} + \mathcal{L}\{ g(t)\}
$$
- The Laplace transform of a multiple of a function is that multiple times the Laplace transformation of that function.
$$
\mathcal{L}\{a f(t)\} = a \mathcal{L}\{ f(t)\}
$$
Using this linearity, and various trigonometric, hyperbolic, and complex number (etc.) properties and/or identities, some Laplace transforms can be obtained from others more quickly than by using the definition directly.
The unilateral Laplace transform takes as input a function whose time domain is the non-negative reals, which is why all of the time domain functions in the table below are multiples of the Heaviside step function, .
The entries of the table that involve a time delay are required to be causal (meaning that ). A causal system is a system where the impulse response is zero for all time prior to .
|
https://en.wikipedia.org/wiki/Laplace_transform
|
The entries of the table that involve a time delay are required to be causal (meaning that ). A causal system is a system where the impulse response is zero for all time prior to . In general, the region of convergence for causal systems is not the same as that of anticausal systems.
+ Selected Laplace transforms Function
Time domain
Laplace -domain
Region of convergence
Reference unit impulse
all
inspection delayed impulse
all
time shift ofunit impulse unit step
integrate unit impulse delayed unit step
time shift ofunit step product of delayed function and delayed step
u-substitution, rectangular impulse
ramp
integrate unitimpulse twice th power (for integer )
()
integrate unitstep times th power (for complex )
– provides the case for real .http://mathworld.wolfram.com/LaplaceTransform.html – Wolfram Mathword provides case for complex th root
Set above. th power with frequency shift
Integrate unit step,apply frequency shift delayed th power with frequency shift
integrate unit step,apply frequency shift,apply time shift exponential decay
Frequency shift ofunit step two-sided exponential decay (only for bilateral transform)
Frequency shift ofunit step exponential approach
unit step minusexponential decay sine
_
|
https://en.wikipedia.org/wiki/Laplace_transform
|
power with frequency shift
Integrate unit step,apply frequency shift delayed th power with frequency shift
integrate unit step,apply frequency shift,apply time shift exponential decay
Frequency shift ofunit step two-sided exponential decay (only for bilateral transform)
Frequency shift ofunit step exponential approach
unit step minusexponential decay sine
_ BLOCK1_ Explanatory notes:
- represents the Heaviside step function.
- represents the Dirac delta function.
- represents the gamma function.
- is the Euler–Mascheroni constant.
- , a real number, typically represents time, although it can represent any independent dimension.
- is the complex frequency domain parameter, and is its real part.
- are real numbers.
- is an integer.
## s-domain equivalent circuits and impedances
The Laplace transform is often used in circuit analysis, and simple conversions to the -domain of circuit elements can be made. Circuit elements can be transformed into impedances, very similar to phasor impedances.
Here is a summary of equivalents:
Note that the resistor is exactly the same in the time domain and the -domain. The sources are put in if there are initial conditions on the circuit elements. For example, if a capacitor has an initial voltage across it, or if the inductor has an initial current through it, the sources inserted in the -domain account for that.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
The sources are put in if there are initial conditions on the circuit elements. For example, if a capacitor has an initial voltage across it, or if the inductor has an initial current through it, the sources inserted in the -domain account for that.
The equivalents for current and voltage sources are simply derived from the transformations in the table above.
## Examples and applications
The Laplace transform is used frequently in engineering and physics; the output of a linear time-invariant system can be calculated by convolving its unit impulse response with the input signal. Performing this calculation in Laplace space turns the convolution into a multiplication; the latter being easier to solve because of its algebraic form. For more information, see control theory. The Laplace transform is invertible on a large class of functions. Given a simple mathematical or functional description of an input or output to a system, the Laplace transform provides an alternative functional description that often simplifies the process of analyzing the behavior of the system, or in synthesizing a new system based on a set of specifications.
The Laplace transform can also be used to solve differential equations and is used extensively in mechanical engineering and electrical engineering. The Laplace transform reduces a linear differential equation to an algebraic equation, which can then be solved by the formal rules of algebra.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
The Laplace transform can also be used to solve differential equations and is used extensively in mechanical engineering and electrical engineering. The Laplace transform reduces a linear differential equation to an algebraic equation, which can then be solved by the formal rules of algebra. The original differential equation can then be solved by applying the inverse Laplace transform. English electrical engineer Oliver Heaviside first proposed a similar scheme, although without using the Laplace transform; and the resulting operational calculus is credited as the Heaviside calculus.
### Evaluating improper integrals
Let
$$
\mathcal{L}\left\{f(t)\right\} = F(s)
$$
.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
English electrical engineer Oliver Heaviside first proposed a similar scheme, although without using the Laplace transform; and the resulting operational calculus is credited as the Heaviside calculus.
### Evaluating improper integrals
Let
$$
\mathcal{L}\left\{f(t)\right\} = F(s)
$$
. Then (see the table above)
$$
\partial_s\mathcal{L} \left\{\frac{f(t)} t \right\} = \partial_s\int_0^\infty \frac{f(t)}{t}e^{-st}\, dt = -\int_0^\infty f(t)e^{-st}dt = - F(s)
$$
From which one gets:
$$
\mathcal{L} \left\{\frac{f(t)} t \right\} = \int_s^\infty F(p)\, dp.
$$
In the limit
$$
s \rightarrow 0
$$
, one gets
$$
\int_0^\infty \frac{f(t)} t \, dt = \int_0^\infty F(p)\, dp,
$$
provided that the interchange of limits can be justified. This is often possible as a consequence of the final value theorem.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
Then (see the table above)
$$
\partial_s\mathcal{L} \left\{\frac{f(t)} t \right\} = \partial_s\int_0^\infty \frac{f(t)}{t}e^{-st}\, dt = -\int_0^\infty f(t)e^{-st}dt = - F(s)
$$
From which one gets:
$$
\mathcal{L} \left\{\frac{f(t)} t \right\} = \int_s^\infty F(p)\, dp.
$$
In the limit
$$
s \rightarrow 0
$$
, one gets
$$
\int_0^\infty \frac{f(t)} t \, dt = \int_0^\infty F(p)\, dp,
$$
provided that the interchange of limits can be justified. This is often possible as a consequence of the final value theorem. Even when the interchange cannot be justified the calculation can be suggestive.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
This is often possible as a consequence of the final value theorem. Even when the interchange cannot be justified the calculation can be suggestive. For example, with , proceeding formally one has
$$
\begin{align}
\int_0^\infty \frac{ \cos(at) - \cos(bt) }{t} \, dt
&=\int_0^\infty \left(\frac p {p^2 + a^2} - \frac{p}{p^2 + b^2}\right)\, dp \\[6pt]
&=\left[ \frac{1}{2} \ln\frac{p^2 + a^2}{p^2 + b^2} \right]_0^\infty = \frac{1}{2} \ln \frac{b^2}{a^2} = \ln \left| \frac {b}{a} \right|.
\end{align}
$$
The validity of this identity can be proved by other means. It is an example of a Frullani integral.
Another example is Dirichlet integral.
### Complex impedance of a capacitor
In the theory of electrical circuits, the current flow in a capacitor is proportional to the capacitance and rate of change in the electrical potential (with equations as for the SI unit system).
|
https://en.wikipedia.org/wiki/Laplace_transform
|
Another example is Dirichlet integral.
### Complex impedance of a capacitor
In the theory of electrical circuits, the current flow in a capacitor is proportional to the capacitance and rate of change in the electrical potential (with equations as for the SI unit system). Symbolically, this is expressed by the differential equation
$$
i = C { dv \over dt} ,
$$
where is the capacitance of the capacitor, is the electric current through the capacitor as a function of time, and is the voltage across the terminals of the capacitor, also as a function of time.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
### Complex impedance of a capacitor
In the theory of electrical circuits, the current flow in a capacitor is proportional to the capacitance and rate of change in the electrical potential (with equations as for the SI unit system). Symbolically, this is expressed by the differential equation
$$
i = C { dv \over dt} ,
$$
where is the capacitance of the capacitor, is the electric current through the capacitor as a function of time, and is the voltage across the terminals of the capacitor, also as a function of time.
Taking the Laplace transform of this equation, we obtain
$$
I(s) = C(s V(s) - V_0),
$$
where
$$
\begin{align}
I(s) &= \mathcal{L} \{ i(t) \},\\
V(s) &= \mathcal{L} \{ v(t) \},
\end{align}
$$
and
$$
V_0 = v(0).
$$
Solving for we have
$$
V(s) = { I(s) \over sC } + { V_0 \over s }.
$$
The definition of the complex impedance (in ohms) is the ratio of the complex voltage divided by the complex current while holding the initial state at zero:
$$
Z(s) = \left. { V(s) \over I(s) } \right|_{V_0 = 0}.
$$
Using this definition and the previous equation, we find:
$$
Z(s) = \frac{1}{sC},
$$
which is the correct expression for the complex impedance of a capacitor.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
Symbolically, this is expressed by the differential equation
$$
i = C { dv \over dt} ,
$$
where is the capacitance of the capacitor, is the electric current through the capacitor as a function of time, and is the voltage across the terminals of the capacitor, also as a function of time.
Taking the Laplace transform of this equation, we obtain
$$
I(s) = C(s V(s) - V_0),
$$
where
$$
\begin{align}
I(s) &= \mathcal{L} \{ i(t) \},\\
V(s) &= \mathcal{L} \{ v(t) \},
\end{align}
$$
and
$$
V_0 = v(0).
$$
Solving for we have
$$
V(s) = { I(s) \over sC } + { V_0 \over s }.
$$
The definition of the complex impedance (in ohms) is the ratio of the complex voltage divided by the complex current while holding the initial state at zero:
$$
Z(s) = \left. { V(s) \over I(s) } \right|_{V_0 = 0}.
$$
Using this definition and the previous equation, we find:
$$
Z(s) = \frac{1}{sC},
$$
which is the correct expression for the complex impedance of a capacitor. In addition, the Laplace transform has large applications in control theory.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
Taking the Laplace transform of this equation, we obtain
$$
I(s) = C(s V(s) - V_0),
$$
where
$$
\begin{align}
I(s) &= \mathcal{L} \{ i(t) \},\\
V(s) &= \mathcal{L} \{ v(t) \},
\end{align}
$$
and
$$
V_0 = v(0).
$$
Solving for we have
$$
V(s) = { I(s) \over sC } + { V_0 \over s }.
$$
The definition of the complex impedance (in ohms) is the ratio of the complex voltage divided by the complex current while holding the initial state at zero:
$$
Z(s) = \left. { V(s) \over I(s) } \right|_{V_0 = 0}.
$$
Using this definition and the previous equation, we find:
$$
Z(s) = \frac{1}{sC},
$$
which is the correct expression for the complex impedance of a capacitor. In addition, the Laplace transform has large applications in control theory.
### Impulse response
Consider a linear time-invariant system with transfer function
$$
H(s) = \frac{1}{(s + \alpha)(s + \beta)}.
$$
The impulse response is simply the inverse Laplace transform of this transfer function:
$$
h(t) = \mathcal{L}^{-1}\{H(s)\}.
$$
Partial fraction expansion
To evaluate this inverse transform, we begin by expanding using the method of partial fraction expansion,
$$
\frac{1}{(s + \alpha)(s + \beta)} = { P \over s + \alpha } + { R \over s+\beta }.
$$
The unknown constants and are the residues located at the corresponding poles of the transfer function.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
In addition, the Laplace transform has large applications in control theory.
### Impulse response
Consider a linear time-invariant system with transfer function
$$
H(s) = \frac{1}{(s + \alpha)(s + \beta)}.
$$
The impulse response is simply the inverse Laplace transform of this transfer function:
$$
h(t) = \mathcal{L}^{-1}\{H(s)\}.
$$
Partial fraction expansion
To evaluate this inverse transform, we begin by expanding using the method of partial fraction expansion,
$$
\frac{1}{(s + \alpha)(s + \beta)} = { P \over s + \alpha } + { R \over s+\beta }.
$$
The unknown constants and are the residues located at the corresponding poles of the transfer function. Each residue represents the relative contribution of that singularity to the transfer function's overall shape.
By the residue theorem, the inverse Laplace transform depends only upon the poles and their residues.
|
https://en.wikipedia.org/wiki/Laplace_transform
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.