OpenLLM-France/wikimedia huggingface dataset:
# Engineering Analysis/Probability Functions
## Probability Density Function

The probability density function, or pdf of a random variable is the function defined by:
    $f_{X}(x)=P[X=x]$
Remember here that X is the random variable, and x is a related variable (but is not random). The subscript X on $f_{X}$ denotes that this is the pdf for the X variable.
pdf's follow a few simple rules:
* The pdf is always non-negative.
* The area under the pdf curve is 1.
    $\int _{-\infty }^{\infty }f_{X}(x)dx=1$

## Cumulative Distribution Function

The cumulative distribution function, (CDF), is also known as the Probability Distribution Function, (PDF). to reduce confusion with the pdf of a random variable, we will use the acronym CDF to denote this function. The CDF of a random variable is the function defined by:
    $F_{X}(x)=P[X\leq x]$
The CDF and the pdf of a random variable are related:
    $f_{X}(x)={\frac {dF_{X}(x)}{dx}}$
    $F_{X}(x)=\int f_{X}(x)dx$
The CDF is the function corresponding to the probability that a given value x is less than the value of the random variable X. The CDF is a non-decreasing function, and is always non-negative.

### Example: X between two bounds

To determine whether our random variable X lies between two bounds, [a, b], we can take the CDF functions:
    $P[a\leq X\leq b]=F_{X}(b)-F_{X}(a)$
# Engineering Analysis/Projections
## Projection

The projection of a vector $v\in V$ onto the vector space $W\in V$ is the minimum distance between v and the space W. In other words, we need to minimize the distance between vector v, and an arbitrary vector $w\in W$:
    $\|w-v\|^{2}=\|{\hat {W}}{\hat {a}}-v\|^{2}$
    ${\frac {\partial \|{\hat {W}}{\hat {a}}-v\|^{2}}{\partial {\hat {a}}}}={\frac {\partial \langle {\hat {W}}{\hat {a}}-v,{\hat {W}}{\hat {a}}-v\rangle }{\partial {\hat {a}}}}=0$
[Projection onto space W]
    ${\hat {a}}=({\hat {W}}^{T}{\hat {W}})^{-1}{\hat {W}}^{T}v$
For every vector $v\in V$ there exists a vector $w\in W$ called the projection of v onto W such that <v-w, p> = 0, where p is an arbitrary element of W.

### Orthogonal Complement

    $w^{\perp }={x\in V:\langle x,y\rangle =0,\forall y\in W}$

## Distance between v and W

The distance between $v\in V$ and the space W is given as the minimum distance between v and an arbitrary $w\in W$:
    ${\frac {\partial d(v,w)}{\partial {\hat {a}}}}={\frac {\partial \|v-{\hat {W}}{\hat {a}}\|}{\partial {\hat {a}}}}=0$

## Intersections

Given two vector spaces V and W, what is the overlapping area between the two? We define an arbitrary vector z that is a component of both V, and W:
    $z={\hat {V}}{\hat {a}}={\hat {W}}{\hat {b}}$
    ${\hat {V}}{\hat {a}}-{\hat {W}}{\hat {b}}=0$
    ${\begin{bmatrix}{\hat {a}}\\{\hat {b}}\end{bmatrix}}={\mathcal {N}}([{\hat {v}}-{\hat {W}}])$
Where N is the nullspace.
# Engineering Analysis/Matrix Functions

If we have functions, and we use a matrix as the input to those functions, the output values are not always intuitive. For instance, if we have a function f(x), and as the input argument we use matrix A, the output matrix is not necessarily the function f applied to the individual elements of A.

## Diagonal Matrix

In the special case of diagonal matrices, the result of f(A) is the function applied to each element of the diagonal matrix:
    $A={\begin{bmatrix}a_{11}&0&\cdots &0\\0&a_{22}&\cdots &0\\\vdots &\vdots &\ddots &\vdots \\0&0&\cdots &a_{nn}\end{bmatrix}}$
Then the function f(A) is given by:
    $f(A)={\begin{bmatrix}f(a_{11})&0&\cdots &0\\0&f(a_{22})&\cdots &0\\\vdots &\vdots &\ddots &\vdots \\0&0&\cdots &f(a_{nn})\end{bmatrix}}$

## Jordan Cannonical Form

Matrices in Jordan Canonical form also have an easy way to compute the functions of the matrix. However, this method is not nearly as easy as the diagonal matrices described above.
If we have a matrix in Jordan Block form, A, the function f(A) is given by:
    $f(A)={\begin{bmatrix}{\frac {f(a)}{0!}}&{\frac {f'(a)}{1!}}&\cdots &{\frac {f^{(r-1)}(a)}{(r-1)!}}\\0&{\frac {f(a)}{0!}}&\cdots &{\frac {f^{r-2)(a)}{(r-2)!}}\\\vdots &\vdots &\ddots &\vdots \\0&0&\cdots &{\frac {f(a)}{0!}}\end{bmatrix}}$
The matrix indices have been removed, because in Jordan block form, all the diagonal elements must be equal.
If the matrix is in Jordan Block form, the value of the function is given as the function applied to the individual diagonal blocks.
# Cryptography/Playfair cipher

The Playfair Cipher is one of several methods used to foil a simple frequency analysis. Instead of every letter having a substitute, every digraph has a substitute. This tends to level the frequency distribution somewhat.
The classic Playfair tableau consists of four alphabets, usually in a square arrangement, two plaintext and two ciphertext. In this example, keywords have been used to disorder the ciphertext alphabets.
In use, two letters of the plaintext are located in the plaintext alphabets. Then reading across from the first letter to the column of the second letter, the first ciphertext character is found. Next, reading down from the first letter to the row of the second letter, the second ciphertext letter is found.
As an example, using tableau above, the digraph "TE" is enciphered as "uw", whereas the digraph "LE" is enciphered as "mk". This makes a frequency analysis difficult.
A second version of the Playfair cipher uses a single alphabet.
If the letters of a digraph lie at the corners of a rectangle, then they are rotated clockwise round the rectangle, SW to CK, AT to EZ.
If they lie in the same column or row they are moved one down or across, EA to YX, RS to TE.
The square is treated as though it wraps round in both directions, ST to ES, DO to IR
Both versions of the Playfair cipher are of comparable strength.

## Further reading

* Four-square cipher
* Playfair cipher
# Cryptography/Permutation cipher

In classical cryptography, a permutation cipher is a transposition cipher in which the key is a permutation.
To apply a cipher, a random permutation of size e is generated (the larger the value of e the more secure the cipher). The plaintext is then broken into segments of size e and the letters within that segment are permuted according to this key.
In theory, any transposition cipher can be viewed as a permutation cipher where e is equal to the length of the plaintext. This is too cumbersome a generalisation to use in actual practice, however.

### Identifying the cipher

Because the cipher doesn't change any of the characters, the ciphertext will have exactly the same letter frequencies as the underlying plaintext. This means that the cipher can in many cases be identified as a transposition by the close similarity of its letter statistics with the letter frequencies of the underlying language.

### Breaking the cipher

(Move this section to "Cryptography/Breaking Permutation cipher" ?)
Because the cipher operates on blocks of size e, the plaintext and the ciphertext have to have a length which is some multiple of e. This causes two weaknesses in the system: first, the plaintext may have to be padded (if the padding is identifiable then part of the key is revealed) and second, information relating to the length of the key is revealed by the length of the ciphertext. To see this, note that if the ciphertext is of length i then e must be one of the divisors of i. With the different possible key sizes different possible permutations are tried to find the permutation which results in the highest number of frequent bigrams and trigrams as found in the underlying language of the plaintext. Trying to find this permutation is essentially the same problem encountered when analysing a columnar transposition cipher: multiple anagramming..
# Cryptography/Notes

'Cryptography is a Greek word which means "Secret Writing"
Important Uses of Cryptography 1. Protect confidentiality of message (Achieved with Encryption Algorithms) 2. Provide identity for authentication (Achieved with Asymmetric Encryption Algorithms, digital signature algorithms) 3. Verify information to check message integrity (Achieved with hash functions)
To Validate information cryptographic function are used.
Cryptographic functions are called as hash functions
e.g. of Hash Functions 1. MD5 (Message Digest 5) 2. SHA (Secure Hash Algorithm)
Types of Cryptography 1. Secret key cryptography (Both parties know the same secret key. Uses symmetric encryption) 2. Public key cryptography (Both parties have 2 different keys,Public key for encryption and Private key for decryption.
Private key for signing, public key for signature verification.
In Reversible public key algorithms, Data encrypted with private key can be decrypted with public key.Uses asymmetric encryption)
Encryption algorithms are called Ciphers Information in encrypted form is called Ciphertext
2 Types of Ciphers 1. Stream Ciphers (Process data byte at a time) 2. Block Ciphers (Process data in blocks 8 bytes at a time. Pad packets smaller than block)
e.g. of Symmetric Encryption Algorithms
1. DES (Data Encryption Standard - Block) 2. 3DES (Triple strength Data Encryption Standard - Block) 3. RC2 (Rivest Cipher 2 - Block) 4. RC4 (Rivest Cipher 4 - Stream)
e.g. of Asymmetric Encryption Algorithms
1. RSA - Rivest Shamir Adleman 2. DSA - Digital Signature Algorithm - Can only be used for digital signatures.
* ↑ https://security.stackexchange.com/questions/69461/encrypt-with-private-and-decrypt-with-public
* ↑ https://stackoverflow.com/questions/30718174/encrypt-with-private-key-and-decrypt-with-public-key
# Cryptography/MD5

MD5 is a popular Hash Function used by many people around the world. Developed by Professor Ronald L. Rivest of MIT
It has two purposes:
* Verify the integrity of a file after a specified period of time
* Generate Hash values for a certain piece of data ( Ex: file) and store them, for later cross checking if the file has been modified or not (this is in essence the 1st point stated above)
For example, on a system that has a file called "SAMPLE.TXT" the MD5 hash would look like this:
| filename | hash value |
| C:\SAMPLE.TXT | BC8FEFECA210FC0C0F3EBC1614A37889 |
MD5 takes as input a message of arbitrary length and produces as output a 128- bit "fingerprint" or "message digest" of the input. It is conjectured that it is computationally infeasible to produce any message having a given prespecified target message digest. The MD5 algorithm was intended for digital signature applications, where a large file must be "compressed" in a secure manner before being signed with a private (secret) key under a public-key cryptosystem such as RSA. However, practical attacks on the collision resistance of MD5 exist, and it should therefore not be used with digital signatures or any other application requiring collision resistance.
Exact technical information is described in RFC:1321 (as HTML).

## References

* ↑ Alexander Sotirov, Marc Stevens, Jacob Appelbaum, Arjen Lenstra, David Molnar, Dag Arne Osvik, Benne de Weger: MD5 considered harmful today - Creating a rogue CA certificate http://www.win.tue.nl/hashclash/rogue-ca/
# Cryptography/Meet In The Middle Attack

An extremely specialized attack, meet in the middle is a known plaintext attack that only affects a specific class of encryption methods - those which achieve increased security by using one or more "rounds" of an otherwise normal symmetrical encryption algorithm. An example of such a compound system is 3DES.
However, to explain this attack let us begin with a simpler system defined as follows: Two cryptographic systems denoted $encrypt_{\alpha }$ and $encrypt_{\beta }$ (with inverse functions $decrypt_{\alpha }$ and $decrypt_{\beta }$ respectively) are combined simply (by applying one then the other) to give a composite cryptosystem. each accepts a 64 bit key (for values from 0 to 18446744073709551615) which we can call $key_{\alpha }$ or $key_{\beta }$ as appropriate.
So for a given plaintext, we can calculate a cryptotext as
$cryptotext=encrypt_{\beta }(key_{\beta },encrypt_{\alpha }(key_{\alpha },plaintext))$
and correspondingly
$plaintext=decrypt_{\alpha }(key_{\alpha },decrypt_{\beta }(key_{\beta },cryptotext))$
Now, given that each has a 64 bit key, the amount of key needed to encrypt or decrypt is 128 bits, so a simple analysis would assume this is the same as a 128 bit cypher.
However, given sufficient storage, you can reduce the effective key strength of this to a few bits larger than the largest of the two keys employed, as follows.
* Given a plaintext/cyphertext pair, apply $encrypt_{\alpha }$ to the plaintext with each possible key in turn, generating $2^{64}$ intermediate cryptotexts $cryptotext_{1}$$\rightarrow$$cryptotext_{n}$ where $n=2^{64}$
* Store each of the $n$ cryptotexts in a hash table so that each can be referenced by its cryptotext, and give the key used to generate that cryptotext
* Apply $decrypt_{\beta }$ to the ciphertext for each possible key in turn, comparing the intermediate plaintext to the hash table calculated earlier. this gives a pair of keys (one for each of the two algorithms employed, $\alpha$ and $\beta$)
* Taking the two keys from stage 3, test each against a second plaintext/cryptotext pair. if this also matches, odds are extremely high you have a valid keypair for the message - not in $2^{128}$ operations, but a "mere" $2x2^{64}$ operations (which nonetheless are significantly longer due to the hash table operations, but not so much as to add more than a couple of extra bits worth of time to the complexity of the task)
The downside to this approach is storage. Assuming you have a 64 bit key, then you will need at least $2^{64}$ units of storage - where each unit is the amount of space used by a single hash record. Even given a minimal implementation (say, 64 bits for the key plus four bits hash collision overhead), if you implemented such a system using 160GB hard drives, you would need close to one billion of them to store the hash table alone.
# Cryptography/Polyalphabetic substitution

A Polyalphabetic substitution cipher is simply a substitution cipher with an alphabet that changes. For example one could have two alphabets:
Now to encrypt the message ``The quick brown fox jumped over the lazy dogs" we would alternate between the two cipher alphabets, using #1 for every first letter and #2 for every second, to get: ``Msj joxfp dicda ucu tfzkjw ceji msj xzyb hln".
Polyalphabetic substitution ciphers are useful because the are less easily broken by frequency analysis, however if an attacker knows for instance that the message has a period n, then he simply can individually frequency analyze each cipher alphabet.
The number of letters encrypted before a polyalphabetic substitution cipher returns to its first cipher alphabet is called its period. The larger the period, the stronger the cipher. Of course, this method of encryption is certainly not secure by any definition and should not be applied to any real-life scenarios.
# ERP Internals/Data Tables/Accounts Receivable Invoice

This data consists of the following two tables:
* Header
* Line
# ERP Internals/Data Tables/Accounts Receivable Invoice/Line

This table contains one record for every line on every invoice.
Used by: Accounts Receivable, Order Entry/Invoicing, Time Billing, Service Management
Key: Invoice Number, Line Number
Fields:
* Invoice Number
* Line Number (a unique number assigned by the ERP package)
* Item Number
* Description (this can be multi-line)
* Quantity
* Back Order
* UOM
* Price
* Tax Code
* Tax Amount
* Extended Amount (Price x Quantity - Tax)
* General Ledger Account Number (Sales)
# ERP Internals/Data Tables/Bank Deposit

This table contains one record for every deposit made to every bank account.
Used by: Bank Reconciliation, Accounts Receivable
Key: Bank Account Number, Deposit Date
Fields:
* Bank Account Number
* Deposit Date
* Amount
* Currency
* Status (Void/Outstanding/Cleared)
* Date Cleared
# ERP Internals/Data Tables/Accounts Receivable Payment/Header

This table contains one record for every customer payment.
Used By: Accounts Receivable, Order Entry
Key: Customer Number, Payment Number
Fields:
* Customer Number
* Payment Number (a unique number assigned by the ERP package)
* Type (Check/Credit/Debit/Cash)
* Date
* Amount
* Currency
* Check Number
* Credit Card Type
* Credit Card Number
* Credit Card Expiry Date
* Credit Card Name
# ERP Internals/Data Tables/Accounts Receivable Payment/Line

This table contains one record for every invoice paid by a Customer payment. Each payment pays one or more customer invoices. Payments can be a deposit, a regular payment (full or partial) or a holdback payment.
Used by: Accounts Receivable
Key: Bank Account Number, Deposit Date, Customer Number, Payment Number, Invoice Number
Fields:
* Bank Account Number
* Deposit Date
* Customer Number
* Payment Number
* Invoice
* Amount
* Type (Deposit/Regular/Holdback)
# ERP Internals/Data Tables/Bank Transaction

This table contains one record for every bank transaction.
Used by: Bank Reconciliation
Key: Transaction Number
Fields:
* Transaction Number (a unique number assigned by the ERP package)
* Bank Account Number
* Date
* Type (Check/Deposit/Service Charge/DB Adjustment/CR Adjustment)
* Check Number
* Amount
* Posted to General Ledger Date/Time
# ERP Internals/Data Tables/Accounts Receivable Invoice/Header

This table contains one record for each invoice.
Used by: Accounts Receivable, Order Entry/Invoicing, Time Billing, Service Management
Key: Invoice Number
Fields:
* Invoice Number
* Customer Number
* Invoice Type
* Invoice Date
* Sales Order Number
* Terms
* FOB
* Ship Via
* Bill To
* Ship To
* Price List
* Invoice Amount
* Tax Amount
* Freight Amount
* Currency
* Purchase Order
* Batch Number
* Status
* Hold Date
* Hold Authorization (User and Date/Time, encrypted)
* Hold Type
* Holdback Percentage
* Holdback Amount
* Comment (unique to this invoice, prints on invoice)
* General Ledger Account Number (Invoice)
* General Ledger Account Number (Tax)
* General Ledger Account Number (Freight)
* Posted to General Ledger Date/Time
# ERP Internals/Data Tables/Accounts Receivable Payment

This group of tables contains the following tables:
* Header
* Line
# ERP Internals/Data Tables/Bank

This table contains one record for every bank account.
Used by: Bank Reconciliation
Key: Bank Account Number
Fields:
* Bank Account Number
* Institution Name
* Branch Address
* Transit Number
* Type (Checking/Savings)
* Currency
* GL Distribution Group (contains all the postable account numbers)
# ERP Internals/Data Tables/Bank Check

This table contains one record for every check issued for every bank account.
Used by: Bank Reconciliation, Accounts Payable
Key: Bank Account Number, Check Number
Fields:
* Bank Account Number
* Check Number (same as the number that appears on the printed check)
* Date Issued
* Amount
* Currency
* Status (Void/Outstanding/Cleared)
* Date Cleared
# Final Fantasy/Black Mystic

Black Mystics are locations where spells, specifically Black Magic spells, are sold. This is the only way for magicians to learn new spells. Black Mages, Black Wizards, Red Mages, Red Wizards, and Ninja are all able to use the services of the Black Mystics.
The locations of the Black Mystics and the spells that each sells are:
* Coneria
** Fire
** Sleep
** Lock (Focus)
** Lightning (Bolt)
* Pravoka
** Ice
** Dark (Fog)
** Temper (Steel)
** Slow
* Elfland (first store)
** Fire2
** Hold (Bind)
** Lightning2 (Bolt2)
** Lock2 (Focus2)
* Elfland (second store)
** Sleep2
** Fast (Haste)
** Confuse (Muddle)
** Ice2
# Final Fantasy/Characters/Arylon

Arylon is the stage name of a world-famous dancer and entertainer. Her true name has not been ascertained. She is currently on tour, though the term is perhaps misleading. Arylon has been stuck in Coneria since the North Bridge collapsed.
# Final Fantasy/Characters/Light Warriors

The Light Warriors are the heroes of Final Fantasy. They are a group of four warriors who are destined to save the world from destruction. Lukahn, the sage, has foretold that the Light Warriors will begin their quest by traveling from Coneria to the Temple of Fiends and rescuing the kidnapped Princess Sara from the former knight Garland.
The Light Warriors must also liberate Pravoka from Bikke and his gang of Pirates and break the curse that Astos has placed upon the Prince of Elfland.
Completion of the Light Warriors' mission involves the destruction of the four Fiends and the dark force behind them, known only as Chaos.
# Final Fantasy/Characters/Lukahn

Lukahn is a wise and knowledgeable sage. He formerly lived in Coneria, but fearing for his life during the troubles with Garland, Lukahn escaped to the settlement at Crescent Lake. He prophesied that the Light Warriors would return peace and balance to the world, beginning with the rescue of Princess Sara and culminating in the defeat of the four Four Fiends and Chaos itself.
Final Fantasy Origins: Lukin
# Final Fantasy/Black Magic/Sleep2

| Color | Black |
| Level | 4 |
| Location | Elfland |
| Price | 4000 G |
| Battle Use | Yes |
| Field Use | No |
Sleep2 is a Black Magic enchantment that attempts to force a single enemy's consciousnesses to shut down, causing the status effect sleep. Though it has a very useful effect, there are a number of drawbacks to the use of Sleep2. Unlike the lower-powered version, Sleep, Sleep2 is targeted at a single foe rather than the entire group. It is more likely to succeed than the weaker spell, however, the induced sleep is still not a deep one; attacks or a good shaking after a battle often wake up afflicted foes. Sleep2 does not directly damage foes.
Sleep2 may be cast by:
* Ninja
* Red Mage / Red Wizard
* Black Mage / Black Wizard
# Final Fantasy/Black Magic/Slow

| Color | Black |
| Level | 2 |
| Location | Pravoka |
| Price | 400 G |
| Battle Use | Yes |
| Field Use | No |
Slow is a Black Magic spell that attempts to manipulate time itself, slowing down the enemies of the caster. When successful, Slow reduces the number of attacks each enemy is able to make each turn, allowing the caster and his allies to pound upon the foe in relative safety. There is a stronger variant, Slow2. Slow can be countered by its opposite, Haste.
Slow can be cast by:
* Ninja
* Red Mage / Red Wizard
* Black Mage / Black Wizard
# Final Fantasy/Black Magic/Temper

| Color | Black |
| Level | 2 |
| Location | Pravoka |
| Price | 400 G |
| Battle Use | Yes |
| Field Use | No |
The Black Magic spell Temper magically hardens the weapon of one of the caster's allies, increasing the amount of damage that the ally can do. The strengthening effect is not as powerful as that of the spell Saber, but the benefit of Temper is that Temper can be cast upon any ally rather than only upon the caster.
Temper has no actual effect on gameplay.
Temper can be cast by:
* Ninja
* Red Mage / Red Wizard
* Black Mage / Black Wizard
Final Fantasy Origins: Steel
# Final Fantasy/Characters

Characters in Final Fantasy, listed alphabetically.
* Arylon
* Astos
* Bikke
* Chaos
* Four Fiends
** Lich
** Kary
** Kraken
** Tiamat
* Garland
* Jane, Queen of Coneria (Queen Jayne)
* King of Coneria
* Light Warriors
* Lukahn (Lukin)
* Matoya
* Pirates
* Prince of Elfland
* Sara, Princess of Coneria (Princess Sarah)
# Final Fantasy/Characters/King of Coneria

The King of Coneria has ruled over the hereditary monarchy of Coneria for many years. He has a wife, Queen Jane, and two daughters. One of these daughters, Princess Sara has been kidnapped by a former knight named Garland. Following this kidnapping, the King has been unable to focus on his duties as a ruler and effective management of the city has fallen to his other daughter.
The King sent messengers far and wide searching for the Light Warriors, a group of heroes whom Lukahn has prophesied will rescue the Princess and return balance to the world. After the Light Warriors successfully rescued the King's daughter, he commissioned the repair of the North Bridge, allowing the Light Warriors to travel to the continental mainland.
Return to People Return to Final Fantasy