OpenLLM-France/wikimedia huggingface dataset:
# Sage/Printable version

The current, editable version of this book is available in Wikibooks, the open-content textbooks collection, at
https://en.wikibooks.org/wiki/Sage

# First Steps
## Run
### Commandline Interface

In Ubuntu terminal:

### Notebook Interface

Inside Sage type "notebook" for the browser-based notebook interface.

## Introduction

Sage is based on Python. With some exceptions, all commands are regular Python syntax.

### Very simple calculation

* Numbers
* Symbolic expression
* Evaluate a symbolic expression

### Arrays
# Crash Course
## Understanding Objects

To work with Sage you have to know a little bit of Python, because it is the underlying language Sage is written in and it is the language Sage understands!
* Objects: An object is a data structure with methods that operate on the data inside an object. In Python - and Sage - everything is an object, even the number "1".
* You can store objects in variables. That is a string of characters where only a-z, A-Z, digits (digits must not be at the first position) and the sign "_" is allowed (e.g. "abs_1"). To accomplish this, enter "x=1" and indicate with "Shift-Return/Enter" that you have ended your input.
* To access the data (the object's value) behind the variable, you have to enter it and probably write "print" in front of it.
* The methods of an object can be accessed via the "." sign and then comes the name and parenthesis "(...)", where they can be empty or have arguments.
* The data stored inside an object is accessed similarly just by the "." and the name but with no parenthesis.
* Functions are objects that do not need an object.
Example:
* Objects can be combined with others:
** using an operator sign like "+", "*", ...
** inserting them into the argument list of a method or function
Example:
# Sage/Crash Course
## Understanding Objects

To work with Sage you have to know a little bit of Python, because it is the underlying language Sage is written in and it is the language Sage understands!
* Objects: An object is a data structure with methods that operate on the data inside an object. In Python - and Sage - everything is an object, even the number "1".
* You can store objects in variables. That is a string of characters where only a-z, A-Z, digits (digits must not be at the first position) and the sign "_" is allowed (e.g. "abs_1"). To accomplish this, enter "x=1" and indicate with "Shift-Return/Enter" that you have ended your input.
* To access the data (the object's value) behind the variable, you have to enter it and probably write "print" in front of it.
* The methods of an object can be accessed via the "." sign and then comes the name and parenthesis "(...)", where they can be empty or have arguments.
* The data stored inside an object is accessed similarly just by the "." and the name but with no parenthesis.
* Functions are objects that do not need an object.
Example:
* Objects can be combined with others:
** using an operator sign like "+", "*", ...
** inserting them into the argument list of a method or function
Example:
# Shell Programming/Condition types

Condition types are used inside '[ ]' in order to test for a condition. Condition types are divided into three categories - String comparison, Arithmetic comparison and File conditional.
# Shell Programming/Arrays

To assign a value to an element of an array simply do
To expand the value of an index of an array do
The arrays don't need to be full or compact (i.e. there can be null values between some interval of indexes).
# Shell Programming/Concept Index

This is the concept index for the Shell Programming book.

## A

* actions
* anonymous subroutines
* argc
* argv
* arithmetic
* arrays
* ascii
* assignment

## B

* backslash
* bare blocks
* bareword strings
* begin blocks
* bit manipulation
* bitwise operators
* blocks
* boolean truth
* brackets
* branches

## C

* case conversion
* case sensitivity
* case switching
* caveats
* CGI Common Gateway Interface Programming
* child
* cmp
* combination assignment operators
* comma
* commands
* command line parameters
* comments
* comparative operators
* concatenation
* conditional branches
* conditional loops
* conversion qualifiers
* conversion specifiers
* constants
* constructors
* context
* control statements
* control structures
* conversion
* converting statements into expressions
* crypt

## D

    Data Types
* date functions
* declaration
* decrement
* default variable
* delimiters
* destructors
* doublemint operator
* doublequotes

## E

* empty statement
* empty string
* encryption
* environment
* error_handling
* equivalence
* error handling
* escape sequences
* event handling
* expressions
* external functions

## F

* fields
* field separator
* file handling
    Filehandles
* floating point numbers
* for loops
* foreach loops
* formatting functions
* functions

## G

* given
* goto
* grouping arguments

## H

* hashbang
* hashes
    First Programs
* here_documents

## I

* identifiers
    If conditionals
* inbuilt functions
* infinite loops
* input
* instructions
* internals
    Interpolation
* iterator
* iterative loops
* inverted syntax
* invocation

## K

* keywords

## L

* labels
* libraries
* lists
* literal characters
* local
* locale
* logical operators
    Flow_control
* loops
* loop modifiers
* limitations

## M

* main block
* mathematical functions
* metacharacters
* mistakes
* modules
* multiple branch conditionals

## N

* nested loops
* nudge operators
    Numbers

## O

    Operators

## P

* patterns
* precedence
* print
* printf

## Q

* quotationmarks

## R

* records
* record_separator
* regular expressions

## S

* search_patterns
* special variables
* statements
    Strings
* strings
* symbols

## T

* truth
* typecasting

## V

* values
    Basic Variables
* variable assignment
* variable_names

## W

* while loops
* whitespace
# Shell Programming

This book has an unclear focus but seems to be about Unix shell programming, prossibly of sh shell.

## Contents

    Introduction
    What is shell
    Features
    What is portable shell syntax?
    Structure of a shell program
    Expansions
    Control statements
    Condition types
    String comparison
    Arithmetic comparison
    File conditional
    If
    while
    until
    for
    example code using control statements
    expr command
    eval command
    Regular expressions
    I/O Redirection
    Arrays
    Text processing
    Optimization
    See also
    Concept Index

## Related books

* Bourne Shell Scripting
* Bash Shell Scripting
* C Shell Scripting
# Python Imaging Library/Editing Pixels

With PIL you can easily access and change the data stored in the pixels of an image. To get the pixel map, call load on an image. The pixel data can then be retrieved by indexing the pixel map as an array.
When you change the pixel data, it is changed in the image it came from (since the pixel map is just a reference to the data rather than a copy).

### Example

The following snippet shows how to change the pixel values in an image based on the index of the pixel:
# Python Imaging Library/File IO

File operations in PIL are very simple, and reflect normal Python methods.

## show

Displays a copy of the specified image in a window.
# Python Beginner to Expert/DebuggingWithIdle

There's more to IDLE than just a editor and command shell. IDLE features a advanced built-in debugger with most features you would expect from any interactive.
Problem the most important features in any debugger are the trace, breakpoint, and watch features. Additionally, a good debugger should allow you to examine variables and objects.
Let's see if IDLE offers all these features.
Here is code to copy and paste into the IDLE editor for this exercise.
# Python Imaging Library/Drop Shadows

Drop shadows are a common way to emphasise an image.

## Creating the shadow

The shadow can be created by taking a simple solid rectangle (usually black or grey, but you can also have coloured shadows) and applying the ImageFilter BLUR filter to it repeatedly. This filter uses a 5×5 kernel, so a single iteration will not be smoothly blurred. You can experiment to find the optimum number of iterations for your purpose.
First, let us ignore the last step and concentrate on the shadow. Let's see what we get for various numbers of iterations. The border was set to 8, the background was white and the shadow is 0x444444 grey. The initial image was 30×30pixels.
| 1 iteration | 2 iterations | 3 iterations | 5 iterations | 10 iterations |
Notice that the shadow is always contained in the image boundary - this is caused by the blue filter "hitting" the image boundaries. If the border were to be made larger, you would see the blur spreading out at large numbers of iterations.
Now, we can add the last section and try it. The result is below. This image used an offset of [3,3] with 3 iterations and the same colours as before.
| Original image (the SVG was made into a rectangular PNG) | Resulting image with drop shadow |

### Efficiency

The calculations needed to produce the blurred shadow is computationally expensive, especially for large images or many iterations, but the same shadow can be reused for any image of the same size. So, if you are going to creare lot of identically-sized image tiles, it will be beneficial to compute the shadow just once, and reuse it for each image.
You can also speed up the calculation of the shadow by recognising that the centre of the shadow will be flat fill of the shadow colour - only the edges need to be computed. How far in the lighter border extends depends on the number of iterations. Making this change reduces the problem from quadratic in the size of the image (i.e. doubling the width quadruples the time taken) to linear (doubling the width doubles the time) for large images, but will be unlikely to have a large effect for icons.
# Python Imaging Library/Getting PIL

Python is obviously a prerequisite for using PIL. The current version of PIL is 1.1.7, and this supports Python up to v.2.6.
PIL is available from PythonWare at this page. Source code can be built for any platform, and Windows binaries are available.

## Installing PIL
### Windows

To install on Windows machines, go to the page given above and download the appropriate binary executable for the version of Python that you have. Run this executable and follow the instructions given by the installer.

### Linux

On Linux, you can either compile the source yourself, or install using your package manager. For Debian-based systems, apt-get can be used:
In Gentoo:

### Mac OS X

To install on a Mac OS X system , visit http://pythonmac.org and download the relevant .dmg file and install as any other application.

## Using PIL

Once install you need to import the PIL modules you want to use. Basic functions are found in the Image module, so the following will work:
    import Image
You can then access functions as usual, e.g. Image.load(filename). Uses of the other modules available are given in the overview section, and these are imported in exactly the same way.
# Python Beginner to Expert/Introduction

Python is an open source, general purpose multi platform computer language.
Python is available for a variety of platforms including Windows, macOS, and a variety of Unix-likess including Linux.
Python comes preinstalled on Macs and often preinstalled on Linux. Although it is not preinstalled with Windows, it can be easily installed by downloading any version freely available at the Python.org website.
One of the characteristics of Python is that it can be embedded or linked to another application to create macros or extensions. Blender, Maya, ArcGIS are among the applications that use an embedded or linked version of Python.
Python was conceived as a cross between a shell scripting language and a full blown general purpose computer language. Like most shell scripting languages, it's interpreted. However, unlike shell scripting languages such as BASH, it has many features and extensions that give it nearly as much power as C and Java.
Syntactically, Python is similar to C with one notable difference: Code blocks are grouped by indentation rather than by surrounding the block with markers such as curly braces, making Python code clear and easy to read.
Python was originally created by Dutch programmer Guido van Rossum around 1990. Van Rossum's choice of names for the language was inspired by his taste for the British TV comedy series Monty Python.
Python has been steadily enhanced and improved over the years. Due to its open source nature, enhancements have been provided by a large number of contributors from all over the globe.
The two major revisions in common use today are the 2.X series and the 3.X series. This book will focus on the 3.X series.
# Python Imaging Library

The Python Imaging Library, or PIL, is an external library for the Python 2x programming language that allows images to be easily manipulated using high-level commands.

## Introduction

* Overview
* Getting PIL

## Basic Operations

* File IO
* Editing Pixels

## Applications of PIL

* Drop Shadows
* Image Tiling

## External links

* PIL home page. Includes documentation for all functions.
# Quantum Mechanics/X-Ray Diffraction Techniques
### X-Ray Diffraction Techniques
#### Techniques

* SAXS

#### Common software

* FIT2D

### X-Ray Spectrographic Techniques

Current X-Ray spectrographic techniques are called XAS, or X-Ray Absorption Spectroscopy. XAS is composed of two different techniques: XANES and EXAFS. The two techniques differ in what part of the spectra they analyize: XANES looks at the energies close to the edge and EXAFS looks at the energies past the edge.

#### Techniques

* XANES
* EXAFS
# Quantum theory of observation/About this book

There are two versions of this book, the present one and a french one: Théorie quantique de l'observation.
The book is complete as it stands but may evolve, both in french and in english.
# Quantum Mechanics/X-Ray Diffraction Techniques/FIT2D

FIT2D is a computer program for the processing of 2D X-ray diffraction images as obtained at synchrotron sources.

## Background

Many beamlines of synchrotron sources are fit with two-dimensional detectors and produce data in the form of two-dimensional diffraction patterns. These patterns can have various forms. There is a need for processing this type of information and the most common software used in the synchrotron community is FIT2D. It is available for free and an online manual is available. This wikibook is intended to provide an easy entry for new users as well as an opportunity for current users to pool their experiences and make them more readily available to the community.

## References

FIT2D home page
# Quantum Mechanics/X-Ray Diffraction Techniques/XANES

XANES or X-Ray Absoption Near Edge Structure is an X-Ray abosorption technique. The tehchnique allows for the study of the chemical species in the sample and the concentration. The use of high energy X-Rays is available at syncrotron sources around the world. The older 2nd generation light sources are strong enough to provide for excellent analysis. However, EXAFS is demanding of the newer 3rd generation light sources such as APS.

### Edge energy range

In the absorption edge region of metals the photoelectron is excited to the first unoccupied level above the Fermi level. Therefore its w:mean free path in a pure single crystal at zero temperature is as large as infinite, and it remains very large increasing the energy of the final state up to about 5 eV above the Fermi level. Beyond the role of the unoccupied density of states and matrix elements in single electron excitations, many-body effects appear as an "infrared singularity" at the absorption threshold in metals.
In the absorption edge region of insulators the photoelectron is excited to the first unoccupied level above the chemical potential but the unscreened core hole forms a localized bound state called core exciton.
# Quantum chemistry/Integration by parts

Write a brief summary of how to perform integration by parts.
Example Question:
Use integration by parts to evaluate the expectation value of position ⟨x⟩ for a particle described by the wavefunction
$\psi (x)=x\exp(-\alpha x^{2})$
# Structural Biochemistry/Nucleic Acid/RNA/RNA Extraction
## RNA Extraction

RNA extraction is a technique of isolating and purifying RNA from in-vivo tissues and samples. There are several ways of extracting RNA. The presence of ribonucleases enzymes within the tissue cells complicates the extraction and purification process by quickly degrading the isolated RNA. Isolated and purified RNA can be used to detect gene expression, biomarkers, drug efficacy, and much more.

### Trizol RNA extraction

File:RNA extraction.jpg First, homogenize the sample tissue in Trizol solution using a vortex mixer. The speed of mixing is very important because the tissue can only be homogenized when mixing at high speed, however, friction may cause heat, which may accelerate RNA degradation. Add chloroform to the finely grinded mixture to perform a liquid phase separation. For every milliliter of Trizol reagent, add 0.2 mL of chloroform. Cap and shake the mixtures vigorous for 15 seconds and incubate them at room temperature. Centrifuge the mixtures at no more than 14,000 rpm for 15 minutes at 2-80C. After centrifugation, the mixture separates into three distinct layers, the lower red chloroform layer, an interphase layer of remaining tissues and fat, and a clear upper aqueous layer. RNA remains in the aqueous layer exclusively. Transfer the aqueous layer to another container. Wash and precipitate the RNA by using isopropyl alcohol. Add 0.5mL of isopropyl alcohol to every mL of Trizol reagent. Incubate at room temperature for 10 minutes and centrifuge again for 4 minutes in RNA elution plates. Remove all supernatant and wash the RNA again with ethanol. Wash the RNA subsequently with buffers. Make sure to dry off any remaining alcohol because they lower the quality of RNA and promote RNA degradation. The last wash should contain RNase free water to elude out the isolated and purified RNA.

## Reference

1. Gottshall, Susan L., Saban Tekin, and Peter J. Hansen. "EXTRACTION AND PURIFICATION OF TOTAL RNA USING TRIzol OR TRI REAGENT." (n.d.): n. pag. Web. 15 Nov. 2012. <http://www.animal.ufl.edu/hansen/protocols/RNA_extraction.htm>.
# Structural Biochemistry/Nucleic Acid/RNA/RNA Secondary Structure
## Basis of RNA

    -RNA bases: A,G,C,U
    -Base Pairs: A-U, G-C
    -non-canonical pairs: G-U
    -Stability: G-C > A-U > G-U
    -Single Stranded: strand folds upon it to form base pairs; can have a diverse form of secondary structure

## Secondary Structure
### Structure Rules

* Base pairing stabilize the structure
* Unpaired sections-loops destabilize the structure
* When a base in one position changes, the base it pairs to must also change to maintain the same structure-covariation

### Representations

    -Most base pairs are non-crossing base pairs: -any two pairs (i, j) and (i’, j’) -> i < i’ <j’ < j or i’ < i < j < j’

### Circular Representation

    -Base pairs of a secondary structure represented by a circle
    -Arc drawn for each base pairing in the structure

### Combinatorics

    -The number of RNA secondary structures for the sequence: (Recurrence Relation)
       S(0)=S(1)=S(2)=1
       S(n+1)=S(n)+ƩS(j-1)S(n-j), (n≥2)
    -There are approximately 1.3 billion RNA structures of length n is 27

### Types of regions

    1) Hairpin Loop - 4 or more bases long for each loop
    2) Bulge Loop - bases on one side cannot form base pairs
    3) Interior Loop - bases on both sides cannot form base pairs
    4) Multi Loop (Junctions) – 2 or more double stranded regions converge to form a closed structure

### Structure Prediction Methods

    1) Maximize Base Pairs
       -Determine set of maximal base pairs
       -Align bases based on ability to pair up to determine the optical structure
       -Nussinov Algorithm: 4 ways to get the optimal structure between i and j
       -Find strucuter with the most base pairs: A-U and G-C
    2) Minimize Energy
       -Determine maximum of scores for 4 structures at a particular position
       -Stacks are the dominant stabilizing force
       -Energy minimization algorithm predicts the secondary structure by minimizing the free energy
       -Require estimation of energy terms contributing to secondary structure
       -Dynamic programming approach:
          1) Initialization
          2) Recursion
          3) Traceback
       -Does not require prior sequence alighnment
       -Energy associated with any position is only influenced by local sequence and structure

## References

* How Do RNA Folding Algorithms Work? S.R. Eddy. Nature Biotechnology, 22:1457-1458, 2004.
* <http://en.wikipedia.org/wiki/Biomolecular_structure>
# Question Writer Manual/About Questions/Multiple Response
## Multiple Response

As with the multiple choice question, you enter a range of answers for the quiz taker to choose from. This time there can be more than one correct answer. Remember to tick all the answers that are correct. The quiz-taker only receives points if he selects all the answers that are correct - otherwise he gets no points. If you want to award points for a partially correct answer, use the Partial Credit question.
# Question Writer Manual/About Questions/Partial Credit
## Partial Credit

* The Partial Credit question type is a powerful multiple choice question that allows you to specify the number of points awarded for each option and also the number of answer options that the quiz taker can choose. This allows you to award partial credit for partially correct answers and implement negative marking schemes to discourage quiz-takers from guessing answers.
* For more information see Scoring Questions and Question Scoring Options in Quiz Set Up.