text:
# Working with vector-valued functions to solve an ODE

Let's say I have a simple vector-valued ODE given by

$y'(t) = K*y(t)$

where K is a matrix $K_{n_{X}n}$. Let's assume that the matrix is $K_{21_{X}21}$,

$K = \left[\begin{array}{cccc} k_{1_{X}1} & k_{1_{X}2} & \cdots & k_{1_{X}21} \\ k_{2_{X}1} & k_{2_{X}2} & \cdots & k_{2_{X}21} \\ \vdots & \vdots & \ddots & \vdots \\ k_{21_{X}1} & k_{21_{X}2} & \cdots & k_{21_{X}21} \end{array} \right]$

As long as I know (and I don't know much because I've been working with Mathematica for just a couple weeks), I should provide the initial conditions with the same lenght that the matrix K, so $y[0]=\left\{y_{1},...,y_{21}\right\}$, right? So my question is, can I relate a specifc number $k_{n,m}$ of the matrix to a specific number $y_{i}$ of the initial conditions to solve the ODE? So, for example:

$y'[0]=k_{1_{X}1}*y_{1}$; $y'[0]=k_{1_{X}2}*y_{1}$; $... y'[0]=k_{1_{X}21}*y_{1}$;
$y'[1]=k_{2_{X}1}*y_{2}$; $y'[1]=k_{2_{X}2}*y_{2}$; $... y'[1]=k_{2_{X}21}*y_{2}$;
.
.
.
$y'[20]=k_{20_{X}1}*y_{20}$;$y'[20]=k_{20_{X}2}*y_{20}$; $y'[20]=k_{20_{X}20}*y_{20}$

Is that possible to build and solve an ODE like that or is that exactly what MA does? Basically I want to solve the differential equation for each value of $k$. I'm used to program using fortran so I'm still building the code on MA thinking on my background on fortran language, where I'd solve it in a 'do' loop. I hope I made myself clear enough to anyone help me with that. Thank you.

• Related: mathematica.stackexchange.com/q/77922 (DSolve), mathematica.stackexchange.com/q/14407 (NDSolve) ... many others related questions for NDSolve, too – Michael E2 May 12 '15 at 3:54
• I'm a little confused by your notation here. When you say $y'[0] = k_1x1 * y_1$, the left-hand side of the equation looks like a vector of 21 components, while the right-hand side looks like a scalar. But you can't set those equal to each other, so obviously I'm missing something. – Michael Seifert May 12 '15 at 3:56


text:
» » » The mass of one Avogadro number of helium atoms is?

# The mass of one Avogadro number of helium atoms is?

### Question

The mass of one Avogadro number of helium atoms is?

### Options

A)
1.00gram
B)
4.00gram
C)
8.00gram
D)
6.00gram

Avogadro's number is an absolute number: there are 6.022×10$$^23$$ elementary entities in 1 mole.

format: plain


text:
# An electron is released from rest in a uniform electric of magnitude 2.00×104 N/C. Calculate the acceleration of the electron (Ignore gravitation)?

Feb 17, 2016

$a = 3.51 \times {10}^{15} \frac{m}{s} ^ 2$
This would be magnitude of the electron’s acceleration. Since the electron has a negative charge the direction of the force on the electron and of course the acceleration is opposite the direction of the electric ﬁeld.

#### Explanation:

calculate Force first
Force $F = {q}_{e} E$, where ${q}_{e} = 1.602 \times {10}^{-} 19 C$ charge of electron
$E = 2 \times {10}^{4} \frac{N}{C}$ electric field
now divide force by mass of electron to have the acceleration.
$a = \frac{F}{m}$, where $m = 9.11 \times {10}^{-} 31$ mass of electron
$a = {q}_{e} \frac{E}{m} = \frac{1.602 \times {10}^{-} 19 C \times 2.0 \times {10}^{4} \frac{N}{C}}{9.11 \times {10}^{-} 31 k g}$
$a = 3.51 \times {10}^{15} \frac{m}{s} ^ 2$
This would be magnitude of the electron’s acceleration. Since the electron has a negative charge the direction of the force on the electron and of course the acceleration is opposite the direction of the electric ﬁeld.


text:
Most atoms do not have actually eight electrons in your valence electron shell. Some atoms have only a few electrons in their external shell, while some atoms lack only one or 2 electrons to have an octet. In cases where an atom has actually three or fewer valence electrons, the atom may shed those valence electron quite conveniently until what continues to be is a reduced shell that includes an octet. Atoms that lose electrons obtain a positive charge as a resultbecause they room left v fewer negatively fee electrons come balance the hopeful charges of the proton in the nucleus. Positively charged ions are dubbed cations. Many metals become cations once they do ionic compounds.

You are watching: What type of ion forms when an atom loses electrons

## Cations

A neutral salt atom is likely to accomplish an octet in that outermost covering by losing its one valence electron.

\<\ceNa \rightarrow Na^+ + e^-\>

The cation developed in this way, Na+, is called the salt ion to differentiate it indigenous the element. The outermost shell of the salt ion is the second electron shell, which has eight electrons in it. The octet dominion has been satisfied. Number $$\PageIndex1$$ is a graphical depiction of this process.

api/deki/files/114134/3.2B.jpg?revision=1" />Figure $$\PageIndex2$$: The formation of a Chlorine Ion. ~ above the left, the chlorine atom has 17 electrons. ~ above the right, the chloride ion has actually 18 electrons and also has a 1− charge.

The surname for positive and an adverse ions space pronounced CAT-eye-ons and ANN-eye-ons, respectively.

See more: Lyrics From Mary Poppins Chimney Sweep Song Lyrics From Mary Poppins

In plenty of cases, elements that belong to the same team (vertical column) ~ above the regular table type ions with the same charge because they have actually the same number of valence electrons. Thus, the regular table becomes a device for psychic the fees on countless ions. Because that example, all ions made native alkali metals, the an initial column on the regular table, have a 1+ charge. Ions made from alkaline planet metals, the second group on the periodic table, have a 2+ charge. Top top the various other side of the routine table, the next-to-last column, the halogens, form ions having actually a 1− charge. Figure $$\PageIndex3$$ shows how the fee on numerous ions can be guess by the place of an element on the routine table. Keep in mind the convention of very first writing the number and then the authorize on a ion with multiple charges. The barium cation is created Ba2+, not Ba+2.


text:
Epsilon Lexicase Selection

Lexicase selection is a parent selection algorithm that is described here.

Epsilon lexicase selection is a refinement of lexicase selection developed by William La Cava (@williamlacava) for use on problems with floating-point error values.

Epsilon lexicase selection is identical to ordinary lexicase selection except for the way that filtering is done, which is described for ordinary lexicase selection in step 2a here, as:

In the recommended form of epsilon lexicase selection (see below for a discussion of alternatives), we keep not only the candidates with exactly the best performance of any individual currently in the set (on the given case), but also any other candidates with performance that differs from the best performance (on that case) by less than epsilon, where epsilon is the median absolute difference between errors on the case and the median error for the case, computed over the entire population, once per generation.

Different versions of epsilon lexicase selection: The 2016 GECCO paper that introduces epsilon lexicase selection, and other publications including the more comprehensive 2018 ECJ article (arXiv preprint, MIT Press, PubMed), describe multiple formulations of epsilon lexicase selection. These differ primarily in the way that epsilon is calculated and in the way that the “best” performance on a case is determined at each step of filtering. For example, either may be determined relative to the entire population, once per generation (“statically”), or relative to the current set of candidates during filtering (“dynamically”). Some also differ in the ways that errors are processed to produce epsilon (that is, using a formulation other than “the median absolute difference between errors on the case and the median error for the case”). For historical reasons, the terminology used for the multiple versions is not entirely consistent across publications, but the method described above has proven to be both among the simplest and among the most effective across many tests on many problems. We therefore recommend that this version be used in most cases, and that the name “epsilon lexicase selection,” when used without further qualification, be used to refer to this version. In the context of the terminology in the literature, this version might be more fully described as “semi-dynamic $\epsilon_{e\lambda}$ lexicase selection.”

2 Likes

I don’t have edit privileges: “What is epsilon?”

This is based on the phrase “epsilon-optimal” from Optimization Theory, Game Theory and Mathematical Programming. A solution is considered epsilon-optimal if it is within some small $\epsilon$ of the “true optimal” value.

1 Like

For those interested in different versions of epsilon lexicase selection, please see a preprint of our recent paper comparing different definitions of epsilon.

3 Likes

(Bumping topic because of significant updates.)


text:
# A number puzzle

I am getting married and quite a few of my guests are mathematicians. I would like to design an invite with a puzzle. Basically, I would like to pose a short puzzle with the answer 26.

My example (but might be too easy (it can be solved with the knowledge of quadratic equation)).

If

$$a+b = 4$$ and $$a^2 + b^2 = 10$$ then $$a^3 + b^3 -2 = ?$$

However, it need not be a number theory question. Thank you for your time.

• Isn't it the only (natural) number that is neighbors with both a square and a cube? May 2, 2017 at 6:06
• Byron starts at the edge of a circular swimming pool and swims 10 meters before hitting the edge. He then turns exactly 90 degrees to the left and swims 24 meters before hitting the edge once again. He is now exactly opposite the center from where he started. How far is he from his starting point? May 2, 2017 at 6:10
• What is the smallest (natural) number that isn't a prime, nor has one within $2$ of itself? May 2, 2017 at 6:13

1) Tell me the only integer that is one greater than a square $(5^2 + 1)$ and one less than a cube $(3^3 − 1)$.
2) Find the smallest number $(26)$ that is not a palindrome whose square is a palindrome $(26^2 = 676)$.


text:
Lemma 65.40.9. Let $S$ be a scheme. Let $f : X \to Y$ be a morphism of algebraic spaces over $S$. The following are equivalent:

1. $f$ is separated,

2. $\Delta _{X/Y} : X \to X \times _ Y X$ is universally closed, and

3. $\Delta _{X/Y} : X \to X \times _ Y X$ is proper.

Proof. The implication (1) $\Rightarrow$ (3) follows from Lemma 65.40.5. We will use Spaces, Lemma 63.5.8 without further mention in the rest of the proof. Recall that $\Delta _{X/Y}$ is a representable monomorphism which is locally of finite type, see Lemma 65.4.1. Since proper $\Rightarrow$ universally closed for morphisms of schemes we conclude that (3) implies (2). If $\Delta _{X/Y}$ is universally closed then Étale Morphisms, Lemma 41.7.2 implies that it is a closed immersion. Thus (2) $\Rightarrow$ (1) and we win. $\square$

In your comment you can use Markdown and LaTeX style mathematics (enclose it like $\pi$). A preview option is available if you wish to see how it works out (just click on the eye in the toolbar).


text:
# Nancy Kopell Gives the 2016 Arnold Ross Lecture, Followed by Who Wants to Be a Mathematician

About 150 students and teachers from the Forth Worth area learned some of the mathematics involved in understanding brain rhythms during the 2016 Arnold Ross Lecture by Nancy Kopell of Boston University, which took place at the Fort Worth Museum of Science and Industry on October 27. Following the lecture, eight of those students played Who Wants to Be a Mathematician.

Brain Rhythms in Health and Disease, Nancy Kopell, Boston University

Glenn Stevens (above left), chair of the Arnold Ross Lecture Series Committee, gave the audience some background about Arnold Ross and the lecture series, and introduced his Boston University colleague, Nancy Kopell (above right). She gave the audience insight into how the brain works and how math is used to understand the brain, especially its rhythms.

Tests such as electroencephalograms (EEGs) measure brain activity and math helps decipher the test results by eliminating noise and retrieving the important signals from the tests. There is a stong association between brain behavior and brain rhythms, such as alpha and beta, and Kopell said that all known forms of neurological disease are associated with changes in rhythms. In fact, the changes in those rhythms may be responsible for the symptoms. For example, increased beta rhythms are present in people with Parkinson's disease. As a coda, Kopell pointed out a connection between brain rhythms and a Fibonacci sequence.

During the question-and-answer period, which featured many questions, Kopell said that it took a great deal of mathematics to understand the results she presented in her lecture, and those results represented a tremendous amount of work over a very long time. She added that she hoped that some of the students in the audience would eventually join her in the research and help solve some of the unanswered questions about brain health and disease.

Who Wants to Be a Mathematician

Following a break featuring mathematically themed cookies, the eight students below (in t-shirts) participated in Who Wants to Be a Mathematician.

Front (left to right): Eric Tong, Cross Timbers Middle School; Shruti Sahu, Trinity Valley School; Mackenzie Hamilton, Prosper High School; Garrett Wezniak, Colleyville Heritage High School.
Back (l to r): Mike Breen, AMS, Harris To, Trinity Valley High School; Nancy Kopell, Boston University; Lucas Atayde, Lamar High School; Zane Roberts, Harmony School of Innovation; Nicholas Epperson, Martin High School; Glenn Stevens, Boston University

Harris To, a sophomore at Trinity Valley School, was the big winner in the game. Here he is just after his victory. (We'll have more videos soon.)

Recap of the games:

Nicholas and Garrett were tied for much of the game, but Nicholas edged ahead on question six and missed only the last question to win $500 from the AMS and a TI-Nspire CX from Texas Instruments. Mackenzie and Garrett tied for second. Garrett opted for Maple 2016 and Garrett chose Anton's Calculus with Early Transcendentals. Game two: This game featured the youngest student in Who Wants to Be a Mathematician history, Eric Tong, who is a fifth grader. He and Harris were tied after two questions, but Harris answered the next two correctly, which moved him into first place. He maintained that lead until the end, earning him the same prizes that Nicholas won in game one and a spot in the Square-Off Round against Nicholas to see who would win another$500 and a chance at the $2,000 Bonus Question. Nicholas and Harris went head-to-head in the Square-Off Round (below left). Harris signaled in just before Nicholas and was correct, so he won another$500 and a chance at the $2,000 Bonus Question (right). Unfortunately, Harris was not correct on the question, but still won$1,000 and the TI-Nspire CX.

Here is a collection of photos from that day:

Below are the cash and prizes awarded to the contestants.

• TI-Nspire CX graphing caclulator from Texas Instruments and $1,000 from the AMS: Harris To, Trinity Valley School • TI-Nspire CX graphing calculator from Texas Instruments and$500 from the AMS: Nicholas Epperson, Martin High School
• Maple 2016 from Maplesoft: Garrett Wezniak, Colleyville Heritage High School, and Lucas Atayde, Lamar High School
• Calculus with Early Transcendentals by Anton, Bivens and Davis from John Wiley and Sons: Mackenzie Hamilton, Prosper High School, and Eric Tong, Cross Timbers Middle School
• What's Happening in the Mathematical Sciences, Vol. 10 from the AMS: Shruti Sahu, Trinity Valley School, and Zane Roberts, Harmony School of Innovation

The students and teachers were a very enthusiastic audience, and many brought signs to root on their classmates.

Thanks very much to our sponsors: Maplesoft, the Who Wants to Be a Mathematician Technology Sponsor; Art of Problem Solving, our Online Community Sponsor; Texas Instruments; and John Wiley and Sons. Thanks also to the people at the Fort Worth Museum of Science and History who provided a great facility and services for the lecture and game. And thanks to the teachers and students who were very engaged by the lecture and the game.

Breakfast the day of the game. Despite having snarfed waffles on many Who Wants to Be a Mathematician trips, game staffers could not recall eating any breakfast foods intentionally shaped like states they were in, e.g. Rhode Island.

Photos and videos by Robin Hagan Aguiar, AMS Meetings and Professional Services Division, and Mike Breen, AMS Public Awareness Office. Text by Mike Breen.

Find out more about the Arnold Ross Lectures and  Who Wants to Be a Mathematician.


text:
# Lesson 27: Plotting time series and generated data¶

This document was prepared at Caltech with financial support from the Donna and Benjamin M. Rosen Bioengineering Center.

This lesson was generated from a Jupyter notebook. You can download the notebook here.

In [1]:
import numpy as np
import pandas as pd
import scipy.special

import bokeh.io
import bokeh.plotting

bokeh.io.output_notebook()

So far, we have only seen how to plot measured data. We have make plots using Bokeh where each glyph represents a single measurement. We used some glyphs that did not represent singe measurements when we make box plots, histograms, and formal (staircase-like) ECDFs, but the construction of those plots was abstracted away in the Bokeh-catplot package. In this lesson, we will learn how to make plots where the points are related to one another via an ordering so that we can connect the points with lines. It is one extra aspect to think about when constructing a graphic.

## Plotting time series data¶

One class of measured data we have not considered is time series data. Time series data are typically not plotted as points, but rather with joined lines. To get some experience plotting data sets like this, we will use some data from Markus Meister's group, collected by graduate students Dawna Bagherian and Kyu Lee. The file ~/git/bootcamp/data/retina_spikes.csv contains the data set. They put electrodes in the retinal cells of a mouse and measured voltage. From the time trace of voltage, they can detect and characterize spiking events. The first column of the CSV file is the time in milliseconds (ms) that the measurement was taken, and the second column is the voltage in units of microvolts (µV). Let's load in the data.

In [2]:
df = pd.read_csv('data/retina_spikes.csv', comment='#')

Out[2]:
t (ms) V (uV)
0 703.96 4.79
1 704.00 -0.63
2 704.04 5.83
3 704.08 0.31
4 704.12 -4.58

Let's create a figure to hold our plot. We will make it wide and narrow, since it is a long time course of potentials.

In [3]:
p = bokeh.plotting.figure(
height=200,
width=600,
toolbar_location='above',
x_axis_label='t (ms)',
y_axis_label='V (µV)'
)

To make a plot of these data, we use the p.line() method. This makes a line with joints at each measurement. I always use the line_join='bevel' kwarg because the default joining of the line ('mitre') results in sharp corners. I also usually choose line_width=2, giving me a line two pixels in width, since I find the default of one to be a bit thin. You can check out the available line properties in the Bokeh docs.

In [4]:
p.line(
source=df,
x='t (ms)',
y='V (uV)',
line_join='bevel',
line_width=2,
)

bokeh.io.show(p)

We can clearly see several spiking events in the data. When we zoom, we can resolve the finer structure.

## Plotting generated data¶

You're now a pro at plotting measured data. But sometimes, you want to plot smooth functions. To do this, you can use Numpy and/or Scipy to generate arrays of values of smooth functions.

We will plot the Airy disk, which we encounter in biology when doing microscopy as the diffraction pattern of light passing through a pinhole. Here is a picture of the diffraction pattern from a laser (with the main peak overexposed).

The equation for the radial light intensity of an Airy disk is

\begin{align} \frac{I(x)}{I_0} = 4 \left(\frac{J_1(x)}{x}\right)^2, \end{align}

where $I_0$ is the maximum intensity (the intensity at the center of the image) and $x$ is the radial distance from the center. Here, $J_1(x)$ is the first order Bessel function of the first kind. Yeesh. How do we plot that?

Fortunately, SciPy has lots of special functions available. Specifically, scipy.special.j1() computes exactly what we are after! We pass in a NumPy array that has the values of $x$ we want to plot and then compute the $y$-values using the expression for the normalized intensity.

To plot a smooth curve, we use the np.linspace() function with lots of points. We then connect the points with straight lines, which to the eye look like a smooth curve. Let's try it. We'll use 400 points, which I find is a good rule of thumb for not-too-oscillating functions.

In [5]:
# The x-values we want
x = np.linspace(-15, 15, 400)

# The normalized intensity
norm_I = 4 * (scipy.special.j1(x) / x)**2

Now that we have the values we want to plot, we could construct a Pandas DataFrame to pass in as the source to p.line(). We do not need to take this extra step, though. If we instead leave source unspecified, and pass in NumPy arrays for x and y, Bokeh will directly use those in constructing the plot.

In [6]:
p = bokeh.plotting.figure(
height=250,
width=550,
x_axis_label='x',
y_axis_label='I(x)/I₀',
)

p.line(
x=x,
y=norm_I,
line_join='bevel',
line_width=2,
)

bokeh.io.show(p)

We could also plot dots (which doesn't make sense here, but we'll show it just to see who the line joining works to make a plot of a smooth function).

In [7]:
p.circle(
x=x,
y=norm_I,
size=2,
color='orange'
)

bokeh.io.show(p)

There is one detail I swept under the rug here. What happens if we compute the function for $x = 0$?

In [8]:
4 * (scipy.special.j1(0) / 0)**2

/Users/Justin/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:1: RuntimeWarning: invalid value encountered in double_scalars
"""Entry point for launching an IPython kernel.

Out[8]:
nan

We get a RuntimeWarning because we divided by zero. We know that

\begin{align} \lim_{x\to 0} \frac{J_1(x)}{x} = \frac{1}{2}, \end{align}

so we could write a new function that checks if $x = 0$ and returns the appropriate limit for $x = 0$. In the x array I constructed for the plot, we hopped over zero, so it was never evaluated. If we were being careful, we could write our own Airy function that deals with this.

In [9]:
def airy_disk(x):
"""Compute the Airy disk."""
# Set up output array
res = np.empty_like(x)

# Where x is very close to zero (use np.isclose)
near_zero = np.isclose(x, 0)

# Compute values where x is close to zero
res[near_zero] = 1.0

# Everywhere else
x_vals = x[~near_zero]
res[~near_zero] = 4 * (scipy.special.j1(x_vals) / x_vals)**2

return res

## Computing environment¶

In [10]:
%load_ext watermark
%watermark -v -p numpy,scipy,pandas,bokeh,jupyterlab

CPython 3.7.3
IPython 7.1.1

numpy 1.16.4
scipy 1.2.1
pandas 0.24.2
bokeh 1.2.0
jupyterlab 0.35.5


text:
Number Game

Time Limit: 2 Seconds

Memory Limit: 65536 KB

Description

The bored Bob is playing a number game. In the beginning, there are n numbers. For each turn, Bob will take out two numbers from the remaining numbers, and get the product of them. There is a condition that the sum of two numbers must be not larger than k.

Now, Bob is curious to know what the maximum sum of products he can get, if he plays at most m turns. Can you tell him?

Input

The first line of input contains a positive integer T, the number of test cases. For each test case, the first line is three integers n, m(0≤ n, m ≤100000) and k(0≤ k ≤20000). In the second line, there are n numbers ai(0≤ ai ≤10000, 1≤ in).

Output

For each test case, output the maximum sum of products Bob can get.

Sample Input

2
4 2 7
1 3 2 4
3 2 3
2 3 1

Sample Output

14
2

None

None


text:
KillingVectors - Maple Help

Physics[KillingVectors] - computes and solves the Killing equations

 Calling Sequence KillingVectors(V, options = ...)

Parameters

 V - a name to be used for the vector field (rank 1 spacetime tensor) representing the Killing vector integrabilityconditions = ... - optional - can be true (default) or false, to reduce or not the determining PDE output system taking into account its integrability conditions output = ... - optional - the right-hand-side can be equations, solutions (synonym: componentsolutions) or vectorsolutions (default), to return the Killing equations or attempt returning their solutions for each of the Killing vector components, or a vector solution with the Killing vector on the left-hand side and a list with its components on the right-hand side parameters = ... - optional - the right-hand-side can be a set or a list of names or functions, that parameterize the Killing vectors; the system of equations or solutions will be split according to the different cases of these parameters specializeconstants = ... - optional - can be true (default) or false, to specialize or not the integration constants _Cn that appear when solving the Killing differential equations

Description

 • KillingVectors computes and attempts to solve the Killing equations, that is, the PDE system

${▿}_{\mathrm{\nu }}\left({V}_{\mathrm{\alpha }}\right)+{▿}_{\mathrm{\alpha }}\left({V}_{\mathrm{\nu }}\right)={ℒ}_{V}\left({g}_{\mathrm{\alpha },\mathrm{\nu }}\right)=0$

 where $▿$ is the covariant derivative operator D_, and $V$ entering ${V}_{\alpha }$ is the name representing the Killing vectors, provided, with or without a spacetime index, and ${ℒ}_{V}\left({g}_{\mathrm{\alpha },\mathrm{\nu }}\right)$ is the LieDerivative of the spacetime metric with respect to ${V}_{\mathrm{\mu }}$. In a spacetime of dimension $n$ there are at most $\frac{1}{2}n\left(n+1\right)$ independent Killing vectors, where the maximum happens for a Minkowski spacetime. As it is the case of the other commands in Physics, KillingVectors operates in tensorial notation. To perform the same operation using differential forms notation see DifferentialGeometry[Tensor][KillingVectors].
 • When the name $V$ is provided without an index, the equations computed are satisfied by the contravariant components ${V}^{\mathrm{\alpha }}$. To request the equations or solutions for the covariant components $\mathrm{V__alpha}$, pass it with a covariant index, say as in V[alpha]. Note that when the spacetime is non-galilean, while the system may succeed in computing solutions for the covariant components, depending on the metric g_ it may fail in computing solutions for the contravariant ones, or vice-versa.
 • By default, KillingVectors automatically computes the equations and attempts solving them in one step. When successful, KillingVectors returns a list of Killing vectors, obtained after specializing the integration constants that appear when solving the system of differential equations (that you can see using the option output = equations). When no solution is found, KillingVectors returns NULL, the same way the PDE solver pdsolve does.
 • A more compact solution can be obtained by passing the optional argument specializeconstants = false, in which case KillingVectors returns an equation with the Killing vector on the left-hand side and a list with its components, depending on integration constants, on the right-hand side.
 • When passing the optional argument output = solutions, instead of returning a vector equation, the output is a set of solution equations, with each Killing vector component on the left-hand side and the corresponding solution on the right-hand side. This is useful, for instance, for verification purposes: you can test the solutions computed against the output of KillingVectors using the option output = equations by using the pdetest command. -When passing the optional argument output = equations, the Killing equations themselves are returned without attempting solving them. This is useful when KillingVectors fails in finding a solution, or when particular solutions of different forms may be of interest; these solutions can frequently be computed using the symmetry commands of PDEtools like FunctionFieldSolutions and PolynomialSolutions, or mainly InvariantSolutions used together with its various options for particularizing solutions.
 • The PDE system returned by KillingVectors with the option output = equations is by default returned as a list of equations and automatically reduced taking into account its integrability conditions. The order of the equations in the list corresponds to a total degree, obtained with an orderly ranking (see details in casesplit). Simplifying the PDE system taking into account integrability conditions is a frequently desired but in some cases expensive mathematical computation. To avoid it, pass the optional argument integrabilityconditions = false, in which case KillingVectors will return faster, a set of equations, not a list, and with no differential elimination simplifications.
 • When the metric g_ depends on parameters, either symbols or functions of spacetime variables, the Killing vectors computed using KillingVectors are expected to be valid for arbitrary values of these parameters. It is sometimes of interest, however, to investigate the different kinds of solutions that may exist for different particular values of these parameters. To perform such an investigation, use the optional argument parameters = ... where the right-hand-side is a set or a list with the parameters, and the system of equations will be split into cases with respect to these parameters using differential algebra techniques, and the Killing vectors will be expressed as a piecewise function according to the different cases for these parameters. As frequently happens when splitting into cases, the resulting lists of equations may involve inequations as well. Note: passing parameters automatically forces reducing the PDE system using integrability conditions, regardless of the value of the keyword integrabilityconditions.

Examples

 > $\mathrm{with}\left(\mathrm{Physics}\right):$
 > $\mathrm{Setup}\left(\mathrm{mathematicalnotation}=\mathrm{true}\right)$
 $\left[{\mathrm{mathematicalnotation}}{=}{\mathrm{true}}\right]$ (1)

Set a system of Coordinates

 > $\mathrm{Setup}\left(\mathrm{coordinates}=X\right)$
 ${}{}\mathrm{Systems of spacetime coordinates are:}{}{}{}\left\{X=\left(\mathrm{x1}{,}\mathrm{x2}{,}\mathrm{x3}{,}\mathrm{x4}\right)\right\}$
 $\mathrm{_______________________________________________________}$
 $\left[{\mathrm{coordinatesystems}}{=}\left\{{X}\right\}\right]$ (2)

Define a tensor with one index to represent the Killing vector

 > $\mathrm{Define}\left(V\right)$
 $\mathrm{Defined objects with tensor properties}$
 $\left\{{V}{,}{{\mathrm{\gamma }}}_{{\mathrm{\mu }}}{,}{{\mathrm{\sigma }}}_{{\mathrm{\mu }}}{,}{{\partial }}_{{\mathrm{\mu }}}{,}{{g}}_{{\mathrm{\mu }}{,}{\mathrm{\nu }}}{,}{{\mathrm{\epsilon }}}_{{\mathrm{\alpha }}{,}{\mathrm{\beta }}{,}{\mathrm{\mu }}{,}{\mathrm{\nu }}}{,}{{X}}_{{\mathrm{\mu }}}\right\}$ (3)

The contravariant components  ${V}^{\mathrm{\mu }}$

 > $\mathrm{KillingVectors}\left(V\right)$
 $\left[{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{\mathrm{x2}}{,}{-}{\mathrm{x1}}{,}{0}{,}{0}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{0}{,}{0}{,}{1}{,}{0}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{\mathrm{x3}}{,}{0}{,}{-}{\mathrm{x1}}{,}{0}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{\mathrm{x4}}{,}{0}{,}{0}{,}{\mathrm{x1}}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{1}{,}{0}{,}{0}{,}{0}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{0}{,}{\mathrm{x4}}{,}{0}{,}{\mathrm{x2}}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{0}{,}{0}{,}{\mathrm{x4}}{,}{\mathrm{x3}}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{0}{,}{0}{,}{0}{,}{1}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{0}{,}{\mathrm{x3}}{,}{-}{\mathrm{x2}}{,}{0}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{0}{,}{1}{,}{0}{,}{0}\right]\right]$ (4)

The same result but directly for the covariant components and without specializing the integration constants,

 > $\mathrm{KillingVectors}\left(V\left[\mathrm{\mu }\right],\mathrm{specialize}=\mathrm{false}\right)$
 $\mathrm{* Partial match of \text{'}}{}\mathrm{specialize}{}\mathrm{\text{'} against keyword \text{'}}{}\mathrm{specializeconstants}{}\text{'}$
 ${{V}}_{{\mathrm{\mu }}}{=}\left[{\mathrm{_C1}}{}{\mathrm{x2}}{+}{\mathrm{_C2}}{}{\mathrm{x3}}{+}{\mathrm{_C3}}{}{\mathrm{x4}}{+}{\mathrm{_C4}}{,}{-}{\mathrm{_C1}}{}{\mathrm{x1}}{+}{\mathrm{_C5}}{}{\mathrm{x3}}{+}{\mathrm{_C6}}{}{\mathrm{x4}}{+}{\mathrm{_C7}}{,}{-}{\mathrm{_C2}}{}{\mathrm{x1}}{-}{\mathrm{_C5}}{}{\mathrm{x2}}{+}{\mathrm{_C8}}{}{\mathrm{x4}}{+}{\mathrm{_C9}}{,}{-}{\mathrm{_C3}}{}{\mathrm{x1}}{-}{\mathrm{_C6}}{}{\mathrm{x2}}{-}{\mathrm{_C8}}{}{\mathrm{x3}}{+}{\mathrm{_C10}}\right]$ (5)

Note that there are 10 integration constants, according to the fact that the dimension of spacetime is $n=4$ and there are at most $\frac{1}{2}n\left(n+1\right)$ independent Killing vectors, as it is the case of a Minkowski spacetime. To understand this result, recall that the Killing vectors generate transformations that leave the metric g_ invariant in form; these are isometries. In this case, the spacetime loaded with Physics by default is galilean

 > $\mathrm{g_}\left[\right]$
 ${{\mathrm{g_}}}_{{\mathrm{μ}}{,}{\mathrm{ν}}}{=}\left(\left[\begin{array}{rrrr}-1& 0& 0& 0\\ 0& -1& 0& 0\\ 0& 0& -1& 0\\ 0& 0& 0& 1\end{array}\right]\right)$ (6)

The result (4) generates translations along the four axis and rotations that leave invariant the distance between two points and thus invariant in form the metric.

Consider now a non-galilean spacetime, for instance set the Schwarzschild metric as the current metric (see g_):

 > $\mathrm{g_}\left[\mathrm{sc}\right]$
 ${}{}\mathrm{_______________________________________________________}$
 ${}{}\mathrm{Systems of spacetime coordinates are:}{}{}{}\left\{X=\left(r{,}\mathrm{\theta }{,}\mathrm{\phi }{,}t\right)\right\}$
 ${}{}\mathrm{Default differentiation variables for d_, D_ and dAlembertian are:}{}{}{}\left\{X=\left(r{,}\mathrm{\theta }{,}\mathrm{\phi }{,}t\right)\right\}$
 $\mathrm{Setting}{}\mathrm{lowercaselatin_is}{}\mathrm{letters to represent}{}\mathrm{space}{}\mathrm{indices}$
 ${}{}\mathrm{The Schwarzschild metric in coordinates}{}{}{}\left[r{,}\mathrm{\theta }{,}\mathrm{\phi }{,}t\right]$
 $\mathrm{Parameters:}{}\left[m\right]$
 $\mathrm{Signature:}{}\left(\mathrm{- - - +}\right)$
 ${}{}\mathrm{_______________________________________________________}$
 ${{\mathrm{g_}}}_{{\mathrm{μ}}{,}{\mathrm{ν}}}{=}\left(\left[\begin{array}{cccc}\frac{r}{2{}m-r}& 0& 0& 0\\ 0& -{r}^{2}& 0& 0\\ 0& 0& -{r}^{2}{}{\mathrm{sin}{}\left(\mathrm{θ}\right)}^{2}& 0\\ 0& 0& 0& \frac{r-2{}m}{r}\end{array}\right]\right)$ (7)

Compute the Killing vectors again. For illustration purposes, compute the covariant components and compute first only the equations, with and without simplifying using integrability conditions, then compute everything automatically. First using integrability conditions. To avoid displaying $V\left(X\right)$ repeatedly use the compact notation available of the PDEtools package

 > $\mathrm{PDEtools}:-\mathrm{declare}\left(V\left(X\right)\right)$
 ${V}{}\left({X}\right){}{\mathrm{will now be displayed as}}{}{V}$ (8)
 > $\mathrm{KillingVectors}\left(V\left[\mathrm{\alpha }\right],\mathrm{output}=\mathrm{equations}\right)$
 $\left[{\mathrm{diff}}{}\left({{V}}_{{3}}{}\left({X}\right){,}{r}\right){=}\frac{{2}{}{{V}}_{{3}}{}\left({X}\right)}{{r}}{,}{\mathrm{diff}}{}\left({{V}}_{{3}}{}\left({X}\right){,}{\mathrm{θ}}\right){=}\frac{{-}\left({\mathrm{diff}}{}\left({{V}}_{{2}}{}\left({X}\right){,}{\mathrm{φ}}\right)\right){}{\mathrm{sin}}{}\left({\mathrm{θ}}\right){+}{2}{}{\mathrm{cos}}{}\left({\mathrm{θ}}\right){}{{V}}_{{3}}{}\left({X}\right)}{{\mathrm{sin}}{}\left({\mathrm{θ}}\right)}{,}{\mathrm{diff}}{}\left({{V}}_{{3}}{}\left({X}\right){,}{\mathrm{φ}}\right){=}{-}{\mathrm{sin}}{}\left({\mathrm{θ}}\right){}{\mathrm{cos}}{}\left({\mathrm{θ}}\right){}{{V}}_{{2}}{}\left({X}\right){,}{\mathrm{diff}}{}\left({{V}}_{{3}}{}\left({X}\right){,}{t}\right){=}{0}{,}{\mathrm{diff}}{}\left({\mathrm{diff}}{}\left({{V}}_{{2}}{}\left({X}\right){,}{\mathrm{φ}}\right){,}{\mathrm{φ}}\right){=}{-}{{V}}_{{2}}{}\left({X}\right){}\left({{\mathrm{sin}}{}\left({\mathrm{θ}}\right)}^{{2}}{+}{{\mathrm{cos}}{}\left({\mathrm{θ}}\right)}^{{2}}\right){,}{\mathrm{diff}}{}\left({{V}}_{{2}}{}\left({X}\right){,}{r}\right){=}\frac{{2}{}{{V}}_{{2}}{}\left({X}\right)}{{r}}{,}{\mathrm{diff}}{}\left({{V}}_{{2}}{}\left({X}\right){,}{\mathrm{θ}}\right){=}{0}{,}{\mathrm{diff}}{}\left({{V}}_{{2}}{}\left({X}\right){,}{t}\right){=}{0}{,}{\mathrm{diff}}{}\left({{V}}_{{4}}{}\left({X}\right){,}{r}\right){=}{-}\frac{{2}{}{m}{}{{V}}_{{4}}{}\left({X}\right)}{{r}{}\left({2}{}{m}{-}{r}\right)}{,}{\mathrm{diff}}{}\left({{V}}_{{4}}{}\left({X}\right){,}{\mathrm{θ}}\right){=}{0}{,}{\mathrm{diff}}{}\left({{V}}_{{4}}{}\left({X}\right){,}{\mathrm{φ}}\right){=}{0}{,}{\mathrm{diff}}{}\left({{V}}_{{4}}{}\left({X}\right){,}{t}\right){=}{0}{,}{{V}}_{{1}}{}\left({X}\right){=}{0}\right]$ (9)

where derivatives are displayed indexed due to the use of declare. Compare with

 > $\mathrm{KillingVectors}\left(V\left[\mathrm{\alpha }\right],\mathrm{output}=\mathrm{equations},\mathrm{integrabilityconditions}=\mathrm{false}\right)$
 $\left\{{2}{}\left({\mathrm{diff}}{}\left({{V}}_{{4}}{}\left({X}\right){,}{t}\right)\right){}{{r}}^{{3}}{+}{4}{}{m}{}\left({m}{-}\frac{{1}}{{2}}{}{r}\right){}{{V}}_{{1}}{}\left({X}\right){=}{0}{,}{2}{}\left({\mathrm{diff}}{}\left({{V}}_{{2}}{}\left({X}\right){,}{\mathrm{θ}}\right)\right){+}\left({-}{4}{}{m}{+}{2}{}{r}\right){}{{V}}_{{1}}{}\left({X}\right){=}{0}{,}{\mathrm{diff}}{}\left({{V}}_{{4}}{}\left({X}\right){,}{\mathrm{φ}}\right){+}{\mathrm{diff}}{}\left({{V}}_{{3}}{}\left({X}\right){,}{t}\right){=}{0}{,}{\mathrm{diff}}{}\left({{V}}_{{4}}{}\left({X}\right){,}{\mathrm{θ}}\right){+}{\mathrm{diff}}{}\left({{V}}_{{2}}{}\left({X}\right){,}{t}\right){=}{0}{,}\left({2}{}{m}{}{r}{-}{{r}}^{{2}}\right){}\left({\mathrm{diff}}{}\left({{V}}_{{1}}{}\left({X}\right){,}{t}\right)\right){+}\left({2}{}{m}{}{r}{-}{{r}}^{{2}}\right){}\left({\mathrm{diff}}{}\left({{V}}_{{4}}{}\left({X}\right){,}{r}\right)\right){+}{2}{}{m}{}{{V}}_{{4}}{}\left({X}\right){=}{0}{,}\left({\mathrm{diff}}{}\left({{V}}_{{2}}{}\left({X}\right){,}{r}\right)\right){}{r}{+}\left({\mathrm{diff}}{}\left({{V}}_{{1}}{}\left({X}\right){,}{\mathrm{θ}}\right)\right){}{r}{-}{2}{}{{V}}_{{2}}{}\left({X}\right){=}{0}{,}\left({\mathrm{diff}}{}\left({{V}}_{{3}}{}\left({X}\right){,}{r}\right)\right){}{r}{+}\left({\mathrm{diff}}{}\left({{V}}_{{1}}{}\left({X}\right){,}{\mathrm{φ}}\right)\right){}{r}{-}{2}{}{{V}}_{{3}}{}\left({X}\right){=}{0}{,}\left({\mathrm{diff}}{}\left({{V}}_{{3}}{}\left({X}\right){,}{\mathrm{θ}}\right)\right){}{\mathrm{sin}}{}\left({\mathrm{θ}}\right){+}\left({\mathrm{diff}}{}\left({{V}}_{{2}}{}\left({X}\right){,}{\mathrm{φ}}\right)\right){}{\mathrm{sin}}{}\left({\mathrm{θ}}\right){-}{2}{}{\mathrm{cos}}{}\left({\mathrm{θ}}\right){}{{V}}_{{3}}{}\left({X}\right){=}{0}{,}{4}{}\left({\mathrm{diff}}{}\left({{V}}_{{1}}{}\left({X}\right){,}{r}\right)\right){}{r}{}{m}{-}{2}{}\left({\mathrm{diff}}{}\left({{V}}_{{1}}{}\left({X}\right){,}{r}\right)\right){}{{r}}^{{2}}{-}{2}{}{m}{}{{V}}_{{1}}{}\left({X}\right){=}{0}{,}{2}{}\left({\mathrm{diff}}{}\left({{V}}_{{3}}{}\left({X}\right){,}{\mathrm{φ}}\right)\right){+}\left(\left({4}{}{m}{-}{2}{}{r}\right){}{{\mathrm{cos}}{}\left({\mathrm{θ}}\right)}^{{2}}{-}{4}{}{m}{+}{2}{}{r}\right){}{{V}}_{{1}}{}\left({X}\right){+}{2}{}{\mathrm{sin}}{}\left({\mathrm{θ}}\right){}{\mathrm{cos}}{}\left({\mathrm{θ}}\right){}{{V}}_{{2}}{}\left({X}\right){=}{0}\right\}$ (10)

The contravariant components of the Killing vectors all in one step

 > $\mathrm{KillingVectors}\left(V\right)$
 $\left[{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{0}{,}{0}{,}{0}{,}{1}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{0}{,}{\mathrm{sin}}{}\left({\mathrm{\phi }}\right){,}\frac{{\mathrm{cos}}{}\left({\mathrm{\phi }}\right)}{{\mathrm{tan}}{}\left({\mathrm{\theta }}\right)}{,}{0}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{0}{,}{\mathrm{cos}}{}\left({\mathrm{\phi }}\right){,}{-}\frac{{\mathrm{sin}}{}\left({\mathrm{\phi }}\right)}{{\mathrm{tan}}{}\left({\mathrm{\theta }}\right)}{,}{0}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{0}{,}{0}{,}{1}{,}{0}\right]\right]$ (11)

The same solution but with the constants not specialized

 > $\mathrm{KillingVectors}\left(V,\mathrm{specializeconstants}=\mathrm{false}\right)$
 ${{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{0}{,}{\mathrm{_C2}}{}{\mathrm{sin}}{}\left({\mathrm{\phi }}\right){+}{\mathrm{_C3}}{}{\mathrm{cos}}{}\left({\mathrm{\phi }}\right){,}{\mathrm{_C4}}{+}\frac{{\mathrm{_C2}}{}{\mathrm{cos}}{}\left({\mathrm{\phi }}\right){-}{\mathrm{_C3}}{}{\mathrm{sin}}{}\left({\mathrm{\phi }}\right)}{{\mathrm{tan}}{}\left({\mathrm{\theta }}\right)}{,}{\mathrm{_C1}}\right]$ (12)

Taking $m$ as parameter, there is another solution (from the point of view of differential algebra this other solution is a singular solution). These solutions can also be expressed as solution equations with the vector components on the left-hand sides by using the optional argument output = solutions:

 > $\mathrm{KillingVectors}\left(V,\mathrm{parameters}=\left\{m\right\}\right)$
 $\left\{\begin{array}{cc}\left[{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{\mathrm{cos}}{}\left({\mathrm{\theta }}\right){}{t}{,}{-}\frac{{t}{}{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}{{r}}{,}{0}{,}{\mathrm{cos}}{}\left({\mathrm{\theta }}\right){}{r}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{0}{,}{0}{,}{1}{,}{0}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{\mathrm{sin}}{}\left({\mathrm{\phi }}\right){}{t}{}{\mathrm{sin}}{}\left({\mathrm{\theta }}\right){,}\frac{{t}{}\left({\mathrm{sin}}{}\left({\mathrm{\phi }}{+}{\mathrm{\theta }}\right){+}{\mathrm{sin}}{}\left({\mathrm{\phi }}{-}{\mathrm{\theta }}\right)\right)}{{2}{}{r}}{,}\frac{{\mathrm{cos}}{}\left({\mathrm{\phi }}\right){}{t}}{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right){}{r}}{,}{\mathrm{sin}}{}\left({\mathrm{\theta }}\right){}{r}{}{\mathrm{sin}}{}\left({\mathrm{\phi }}\right)\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{\mathrm{cos}}{}\left({\mathrm{\phi }}\right){}{t}{}{\mathrm{sin}}{}\left({\mathrm{\theta }}\right){,}\frac{{t}{}\left({\mathrm{cos}}{}\left({\mathrm{\phi }}{-}{\mathrm{\theta }}\right){+}{\mathrm{cos}}{}\left({\mathrm{\phi }}{+}{\mathrm{\theta }}\right)\right)}{{2}{}{r}}{,}{-}\frac{{\mathrm{sin}}{}\left({\mathrm{\phi }}\right){}{t}}{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right){}{r}}{,}{\mathrm{sin}}{}\left({\mathrm{\theta }}\right){}{r}{}{\mathrm{cos}}{}\left({\mathrm{\phi }}\right)\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{\mathrm{cos}}{}\left({\mathrm{\theta }}\right){,}{-}\frac{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}{{r}}{,}{0}{,}{0}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{\mathrm{sin}}{}\left({\mathrm{\phi }}\right){}{\mathrm{sin}}{}\left({\mathrm{\theta }}\right){,}\frac{{\mathrm{sin}}{}\left({\mathrm{\phi }}\right){}{\mathrm{cos}}{}\left({\mathrm{\theta }}\right)}{{r}}{,}\frac{{\mathrm{cos}}{}\left({\mathrm{\phi }}\right)}{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right){}{r}}{,}{0}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{\mathrm{cos}}{}\left({\mathrm{\phi }}\right){}{\mathrm{sin}}{}\left({\mathrm{\theta }}\right){,}\frac{{\mathrm{cos}}{}\left({\mathrm{\phi }}\right){}{\mathrm{cos}}{}\left({\mathrm{\theta }}\right)}{{r}}{,}{-}\frac{{\mathrm{sin}}{}\left({\mathrm{\phi }}\right)}{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right){}{r}}{,}{0}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{0}{,}{0}{,}{0}{,}{1}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{0}{,}{\mathrm{sin}}{}\left({\mathrm{\phi }}\right){,}\frac{{\mathrm{cos}}{}\left({\mathrm{\phi }}\right)}{{\mathrm{tan}}{}\left({\mathrm{\theta }}\right)}{,}{0}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{0}{,}{\mathrm{cos}}{}\left({\mathrm{\phi }}\right){,}{-}\frac{{\mathrm{sin}}{}\left({\mathrm{\phi }}\right)}{{\mathrm{tan}}{}\left({\mathrm{\theta }}\right)}{,}{0}\right]\right]& {m}{=}{0}\\ \left[{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{0}{,}{0}{,}{0}{,}{1}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{0}{,}{\mathrm{sin}}{}\left({\mathrm{\phi }}\right){,}\frac{{\mathrm{cos}}{}\left({\mathrm{\phi }}\right)}{{\mathrm{tan}}{}\left({\mathrm{\theta }}\right)}{,}{0}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{0}{,}{\mathrm{cos}}{}\left({\mathrm{\phi }}\right){,}{-}\frac{{\mathrm{sin}}{}\left({\mathrm{\phi }}\right)}{{\mathrm{tan}}{}\left({\mathrm{\theta }}\right)}{,}{0}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{0}{,}{0}{,}{1}{,}{0}\right]\right]& {\mathrm{otherwise}}\end{array}\right\$ (13)

When parameters are indicated together with the specializeconstants option, the result is a sequence of piecewise functions, with each conditional on the parameters expressed as a branch of the piecewise solution

 > $\mathrm{KillingVectors}\left(V,\mathrm{parameters}=\left\{m\right\},\mathrm{specializeconstants}\right)$
 $\left\{\begin{array}{cc}\left[{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{\mathrm{cos}}{}\left({\mathrm{\theta }}\right){}{t}{,}{-}\frac{{t}{}{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}{{r}}{,}{0}{,}{\mathrm{cos}}{}\left({\mathrm{\theta }}\right){}{r}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{0}{,}{0}{,}{1}{,}{0}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{\mathrm{sin}}{}\left({\mathrm{\phi }}\right){}{t}{}{\mathrm{sin}}{}\left({\mathrm{\theta }}\right){,}\frac{{t}{}\left({\mathrm{sin}}{}\left({\mathrm{\phi }}{+}{\mathrm{\theta }}\right){+}{\mathrm{sin}}{}\left({\mathrm{\phi }}{-}{\mathrm{\theta }}\right)\right)}{{2}{}{r}}{,}\frac{{\mathrm{cos}}{}\left({\mathrm{\phi }}\right){}{t}}{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right){}{r}}{,}{\mathrm{sin}}{}\left({\mathrm{\theta }}\right){}{r}{}{\mathrm{sin}}{}\left({\mathrm{\phi }}\right)\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{\mathrm{cos}}{}\left({\mathrm{\phi }}\right){}{t}{}{\mathrm{sin}}{}\left({\mathrm{\theta }}\right){,}\frac{{t}{}\left({\mathrm{cos}}{}\left({\mathrm{\phi }}{-}{\mathrm{\theta }}\right){+}{\mathrm{cos}}{}\left({\mathrm{\phi }}{+}{\mathrm{\theta }}\right)\right)}{{2}{}{r}}{,}{-}\frac{{\mathrm{sin}}{}\left({\mathrm{\phi }}\right){}{t}}{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right){}{r}}{,}{\mathrm{sin}}{}\left({\mathrm{\theta }}\right){}{r}{}{\mathrm{cos}}{}\left({\mathrm{\phi }}\right)\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{\mathrm{cos}}{}\left({\mathrm{\theta }}\right){,}{-}\frac{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}{{r}}{,}{0}{,}{0}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{\mathrm{sin}}{}\left({\mathrm{\phi }}\right){}{\mathrm{sin}}{}\left({\mathrm{\theta }}\right){,}\frac{{\mathrm{sin}}{}\left({\mathrm{\phi }}\right){}{\mathrm{cos}}{}\left({\mathrm{\theta }}\right)}{{r}}{,}\frac{{\mathrm{cos}}{}\left({\mathrm{\phi }}\right)}{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right){}{r}}{,}{0}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{\mathrm{cos}}{}\left({\mathrm{\phi }}\right){}{\mathrm{sin}}{}\left({\mathrm{\theta }}\right){,}\frac{{\mathrm{cos}}{}\left({\mathrm{\phi }}\right){}{\mathrm{cos}}{}\left({\mathrm{\theta }}\right)}{{r}}{,}{-}\frac{{\mathrm{sin}}{}\left({\mathrm{\phi }}\right)}{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right){}{r}}{,}{0}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{0}{,}{0}{,}{0}{,}{1}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{0}{,}{\mathrm{sin}}{}\left({\mathrm{\phi }}\right){,}\frac{{\mathrm{cos}}{}\left({\mathrm{\phi }}\right)}{{\mathrm{tan}}{}\left({\mathrm{\theta }}\right)}{,}{0}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{0}{,}{\mathrm{cos}}{}\left({\mathrm{\phi }}\right){,}{-}\frac{{\mathrm{sin}}{}\left({\mathrm{\phi }}\right)}{{\mathrm{tan}}{}\left({\mathrm{\theta }}\right)}{,}{0}\right]\right]& {m}{=}{0}\\ \left[{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{0}{,}{0}{,}{0}{,}{1}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{0}{,}{\mathrm{sin}}{}\left({\mathrm{\phi }}\right){,}\frac{{\mathrm{cos}}{}\left({\mathrm{\phi }}\right)}{{\mathrm{tan}}{}\left({\mathrm{\theta }}\right)}{,}{0}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{0}{,}{\mathrm{cos}}{}\left({\mathrm{\phi }}\right){,}{-}\frac{{\mathrm{sin}}{}\left({\mathrm{\phi }}\right)}{{\mathrm{tan}}{}\left({\mathrm{\theta }}\right)}{,}{0}\right]{,}{{V}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{=}\left[{0}{,}{0}{,}{1}{,}{0}\right]\right]& {\mathrm{otherwise}}\end{array}\right\$ (14)
 >

References

 Landau, L.D., and Lifshitz, E.M. The Classical Theory of Fields, Course of Theoretical Physics Volume 2, fourth revised English edition. Elsevier, 1975.
 Weinberg, S. Gravitation and Cosmology: Principles and Applications of The General Theory of Relativity, John Wiley & Sons, Inc, 1972.

Compatibility

 • The Physics[KillingVectors] command was introduced in Maple 17.


text:
QUESTION

# In a survey of 25 students, it was found that 15 had taken mathematics, 12 had taken physics and 11 had taken chemistry, 5 had taken mathematics and chemistry, 9 had taken mathematics and physics, 4 had taken physics and chemistry and 3 had taken all the three subjects.Find the number of students that have taken none of the subjects.A. 0B. 2C. 3D. 5

Hint: In this question, first draw the Venn diagram with the given data it will give us a clear picture of what we have to find out. The number of students who had taken none of the subjects can be found by subtracting the number of students taken at least one subject from the total number of students in the survey. So, use this concept to reach the solution of the question.

Given,
Total number of students in the survey $n\left( U \right) = 25$

The set of students who have taken mathematics $n\left( M \right) = 15$
The set of students who have taken Physics $n\left( P \right) = 12$
The set of students who have taken chemistry $n\left( C \right) = 11$
The set of students taken mathematics and chemistry $n\left( {M \cap C} \right) = 5$
The set of students taken physics and chemistry $n\left( {P \cap C} \right) = 4$
The set of students taken mathematics and physics $n\left( {M \cap P} \right) = 9$
The set of students taken all the 3 subjects $n\left( {M \cap P \cap C} \right) = 3$
Here number of students taking at least one subject $= n\left( {M \cup P \cup C} \right)$

From the Venn diagram, we have

$\Rightarrow n\left( {M \cup P \cup C} \right) = n\left( M \right) + n\left( P \right) + n\left( C \right) - n\left( {M \cap P} \right) - n\left( {P \cap C} \right) - n\left( {M \cap C} \right) + n\left( {M \cap P \cap C} \right) \\ \Rightarrow n\left( {M \cup P \cup C} \right) = 15 + 12 + 11 - 9 - 4 - 5 + 3 \\ \Rightarrow n\left( {M \cup P \cup C} \right) = 41 - 18 \\ \therefore n\left( {M \cup P \cup C} \right) = 23 \\$

So, the number of students taking none of the subjects $= n\left( U \right) - n\left( {M \cup P \cup C} \right) = 25 - 23 = 2$

Thus, the correct option is B i.e, 2

Note: The intersection of two sets $A$ and $B$, denoted by $A \cap B$, is the set containing all elements of $A$ that also belong to $B$ (or equivalently, all elements of $B$ that also belong to $A$). The union of two sets $A$ and $B$, denoted by $A \cup B$ is the set of all elements that are found in $A$ OR $B$ (or both)


text:
Converting namedtuples to XLSX in Python

This Python snippet allows you to convert an iterable of namedtuple instances to an XLSX file using xlsxwriter.

The header is automatically determined from the first element of the iterable. If the iterable is empty, the resulting XLSX file will also be empty.

import xlsxwriter
import itertools
from collections import namedtuple

def xlsx_write_rows(filename, rows):
"""
Write XLSX rows from an iterable of rows.
Each row must be an iterable of writeable values.

Returns the number of rows written
"""
workbook = xlsxwriter.Workbook(filename)
# Write values
nrows = 0
for i, row in enumerate(rows):
for j, val in enumerate(row):
worksheet.write(i, j, val)
nrows += 1
# Cleanup
workbook.close()
return nrows

def namedtuples_to_xlsx(filename, values):
"""
Convert a list or generator of namedtuples to an XLSX file.
Returns the number of rows written.
"""
try:
# Ensure its a generator (next() not allowed on lists)
values = (v for v in values)
# Use first row to generate header
peek = next(values)
except StopIteration:  # Empty generator
# Write empty xlsx
return xlsx_write_rows(filename, [])

Example Usage:

MyType = namedtuple("MyType", ["ID", "Name", "Value"])
namedtuples_to_xlsx("test.xlsx", [
MyType(1, "a", "b"),
MyType(2, "c", "d"),
MyType(3, "e", "f"),
])

This example will generate this table:

ID	Name	Value
1	a	b
2	c	d
3	e	f

Iterating prime numbers in Python

Problem:

Using Python you want to iterate through consecutive prime numbers

Solution:

You can use gmpy2‘s next_prime() to do this:

import gmpy2

def primes(start=2):
n = start
while True:
n = gmpy2.next_prime(n)
yield n

# Usage example 1
for prime in primes():
print(prime)

# Usage example 2
for i, prime in enumerate(primes()):
print("The {}th prime number is {}".format(i, prime))

Fixing TensorFlow libcublas.so.8.0: cannot open shared object file on Ubuntu

Problem:

When you run import tensorflow in Python, you get one of the following errors:

ImportError: libcublas.so.8.0: cannot open shared object file: No such file or directory
ImportError: libcusolver.so.8.0: cannot open shared object file: No such file or directory
ImportError: libcudart.so.8.0: cannot open shared object file: No such file or directory
ImportError: libcufft.so.8.0: cannot open shared object file: No such file or directory
ImportError: libcurand.so.8.0: cannot open shared object file: No such file or directory

Solution:

Install the required packages using:

apt-get install libcublas8.0 libcusolver8.0 libcudart8.0 libcufft8.0 libcurand8.0

Note that you also need to install cuDNN – see this followup post

Which version on CuDNN should you install for TensorFlow GPU on Ubuntu?

for details on how to do that.

If this method does not work, you can (as a quick workaround) uninstall tensorflow-gpu and install the tensorflow – the version without GPU support:

pip3 uninstall tensorflow-gpu
pip3 install tensorflow

However, this will likely make your applications much slower.

For other solutions see the TensorFlow bugtracker on GitHub.

How to use concurrent.futures map with a tqdm progress bar

Problem:

You have a concurrent.futures executor, e.g.

import concurrent.futures

executor = concurrent.futures.ThreadPoolExecutor(64)

Using this executor, you want to map a function over an iterable in parallel (e.g. parallel download of HTTP pages).

In order to aid interactive execution, you want to use tqdm to provide a progress bar, showing the fraction of futures

Solution:

You can use this function:

from tqdm import tqdm
import concurrent.futures

def tqdm_parallel_map(executor, fn, *iterables, **kwargs):
"""
Equivalent to executor.map(fn, *iterables),
but displays a tqdm-based progress bar.

Does not support timeout or chunksize as executor.submit is used internally

**kwargs is passed to tqdm.
"""
futures_list = []
for iterable in iterables:
futures_list += [executor.submit(fn, i) for i in iterable]
for f in tqdm(concurrent.futures.as_completed(futures_list), total=len(futures_list), **kwargs):
yield f.result()

Note that internally, executor.submit() is used, not executor.map() because there is no way of calling concurrent.futures.as_completed() on the iterator returned by executor.map().

Note: In constract to executor.map() this function does NOT yield the arguments in the same order as the input.

Problem:

You want to download a URL to a file using the requests python library, but you want to skip the download if it doesn’t exist

Solution:

Use the following functions:

import requests
import os.path

"""
"""
with open(filename, 'wb') as fout:
response = requests.get(url, stream=True)
response.raise_for_status()
# Write response data to file
for block in response.iter_content(4096):
fout.write(block)

"""

Returns
-------
"""
if not os.path.exists(filename):
return True
return False

Computing bounding box for a list of coordinates in Python

Problem:

You have a list of X/Y coordinates, for example:

coords = [(6.74219, -53.57835),
(6.74952, -53.57241),
(6.75652, -53.56289),
(6.74756, -53.56598),
(6.73462, -53.57518)]

For these coordinates you want to compute the minimum bounding box.

Removing spans/divs with style attributes from HTML

Occasionally I have to clean up some HTML code – mostly because parts of it were pasted into a CMS like WordPress from rich text editor like Word.

I’ve noticed that the formatting I want to remove is mostly based on span and div elements with a style attribute. Therefore, I’ve written a simple Python script based on BeautifulSoup4 which will replace certain tags with their contents if they have a style attribute. While in some cases some other formatting might be destroyed by such a script, it is very useful for some recurring usecases.

Computing the LP2980 adjust resistor using Python

The LP2980ADJ is a 50 mA LDO that be configured for an output voltage from 1.23V to 15V using a pair of resistors.

The datasheet lists a formula for the output voltage, however no easy-to-use customizable software is provided that can be used to directly compute the correct resistor in a reproducible way. Read more

The following html code can be used to create an html form that allows uploading multiple files at once:

<form enctype="multipart/form-data" method="POST" action="upload.py">

<input type="file" multiple="" id="files" name="files">

</form>

Normalizing electronics engineering value notations using Python

In electronics engineering there is a wide variety of notations for values that need to be recognized by intuitive user interfaces. Examples include:

• 1fA
• 0.1A
• 0.00001
• 1e-6
• 4,5nA
• 4,500.123 A
• 4A5
• 4k0 A

The wide variety of options, including thousands separators, comma-as-decimal-separator and suffix-as-decimal-separator, optional whitespace and scientific notations makes it difficult to normalize values without using specialized libraries. Read more

Calculating the NCP380 Ilim resistor using Python

Problem

You want to calculate the correct value for the Ilim resistor for the NCP380 current limiter IC with a custom current limit. Read more

Finding the nearest E96 resistor value in Python

Problem

You want to find the E24/E48/E96 resistor value that is closest to a given exact value programmatically using python. Read more

Engineering for the super-lazy: Solving equations without activating your brain

Preface

In electronics engineering, from time to time you have to use standard formulas to characterize your circuits. To what extent you need to calculate all parameters most often depends on the requirement.

For example, consider the formula for the -3dB cutoff frequency of a 1st order RC lowpass filter:

$$f_c=\frac{1}{2\pi RC}$$

Although this equation is fairly simple and most people won’t have any problem solving it for any particular variable in a few seconds, it can serve as a basic example on how to solve an equation symbolically.

One of the easiest ways of performing this task is to use SymPy, a Python library for symbolic mathematics.

Parsing the MeSH ASCII format in Python

Similar to our previously published UniPruot parser, MeSH provides an ASCII format that can easily be parsed using Python.

Just like the UniProt parser, this function yields MeSH entries represented by dictionaries. Example code is included at the bottom of the file.

Fixing ImportError: cannot import name ‘urlencode’ in Python3

Problem:

Your python 3.x interpreter prints the error message

ImportError: cannot import name 'urlencode'

Parsing OpenGeoDB PLZ code TSV files using Python

Problem:

You want to parse the OpenGeoDB Postleitzahl (german ZIP code) TSV files available from here.

Using python requests over Tor

Problem:

You want to use the python requests library over a Tor connection using the Tor builtin SOCKS proxy.

Fixing bad blocks on HDDs using fixhdd.py

Problem:

You hard drive or SMART tool reports errors when reading specific blocks similar to this message:

[3142.686141] end_request: I/O error, dev sda, sector 31415926

No matter how often you read the block, the hard drive still returns an error and does not reallocate the block.

Listing files inside a Torrent

Torrent files are essentially containers that store information about a set of files to be downloaded via P2P.

Unfortunately it is not easily possible to simply list the files that are stored in a torrent. Using our python script torrentls.py you can easily accomplish that task.

Reading the UniProt text format in Python

Just like many other databases in computational biology, the downloads for the popular UniProt database are available in a custom text format which is documented on ExPASy.

While it is certainly not difficult writing a generic parser and one can use BioPython, I believe it is often easier to use a tested parser that only uses standard libraries.


text:
# 0.5 Turbo coding

 Page 1 / 1
This module provides a brief extension of Viterbi convolutional decoders to turbo decoding.

## Introduction

A paper was published by Claude Berrou and coauthors at the ICC conference in 1993 that rocked or shook the field of forward error correction coding (FECC). This described a method of creating much more powerful block error correcting coding with only the minimum amount of effort. Its main features were two recursive convolutional encoders (RCE) interconnected via an interleaver. The data is fed into the first encoder directly and into the second encoder after interleaving or reordereing of the input data.

## Turbo encoding

The important features are the use of two recursive convolutional encoders and the design of the interleaver which gives a block code with the block size equal to the interleaver size, [link] . Random interleavers tend to work better than row and column interleavers. Note that recursive convolutional encoders were known about well before their use in turbo codes, but the difficulties in driving them into a known state made them less popular than the non-recursive convolutional encoders described in the previous module.

The name turbo decoder came from the turbo charger in an automobile where the exhaust gasses are used to drive a compressor in a feedback loop to increase the input of fuel and hence the vehicles ultimate performance.

The desired output rate was initially achieved by puncturing (ignoring every second output) from each of the encoders.

## Turbo decoding

Turbo decoding is iterative. The decoding is also soft, the values that flow around the whole decoder are real values and not binary representations (with the exception of the hard decisions taken at the end of the number of iterations you are prepared to perform). They are usually log likelihood ratios (LLRs), the log of the probability that a particular bit was a logic 1 divided by the probability the same bit was a logic 0.

Decoding is accomplished by first demultiplexing the incoming data stream into d, ${y}_{1}$ , ${y}_{2}$ . d and ${y}_{1}$ go into the decoder for the first code, [link] . This gives an estimate of the extrinsic information from the first decoder which is interleaved and past on to the second decoder. The second decoder thus has three inputs, the extrinsic information from the first decoder, the interleaved data d, and the received values for ${y}_{2}$ . It produces its extrinsic information and this is deinterleaved and passed back to the first encoder. This process is then repeated or iterated as required until the final solution is obtained from the second decoder interleaver.

The decoders themselves generally use soft output Viterbi algorithm (SOVA) to decode the received data. However the preferred turbo decoding method is to use the maximum a-priori (MAP) algorithm but this is too mathematical to discuss here!

## Coder performance

[link] shows these ½ rate decoders operating at much lower $\frac{{E}_{b}}{{N}_{0}}$ or SNR values than the convolutional Viterbi decoders of the previous section and, further, as the number of iterations increases to beyond 15, then the performance comes very very close to the theoretical Shannon bound.

This is the attraction that has excited the FECC community, who were unable to achieve this low error rate before 1993! Now that iterative decoding has been introduced for turbo decoders it is also being re-applied in low delay parity check (LDPC) decoders with equal enthusiasm and success.

[link] includes a turbo decoding example (which as an animated power point slide) will show the black dot noise induced errors being corrected on each subsequent iteration with the black dots being progressively reduced in the upper cartoon.

This module has been created from lecture notes originated by P M Grant and D G M Cruickshank which are published in I A Glover and P M Grant, "Digital Communications", Pearson Education, 2009, ISBN 978-0-273-71830-7. Powerpoint slides plus end of chapter problem examples/solutions are available for instructor use via password access at http://www.see.ed.ac.uk/~pmg/DIGICOMMS/

where we get a research paper on Nano chemistry....?
what are the products of Nano chemistry?
There are lots of products of nano chemistry... Like nano coatings.....carbon fiber.. And lots of others..
learn
Even nanotechnology is pretty much all about chemistry... Its the chemistry on quantum or atomic level
learn
da
no nanotechnology is also a part of physics and maths it requires angle formulas and some pressure regarding concepts
Bhagvanji
Preparation and Applications of Nanomaterial for Drug Delivery
revolt
da
Application of nanotechnology in medicine
what is variations in raman spectra for nanomaterials
I only see partial conversation and what's the question here!
what about nanotechnology for water purification
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
Damian
yes that's correct
Professor
I think
Professor
Nasa has use it in the 60's, copper as water purification in the moon travel.
Alexandre
nanocopper obvius
Alexandre
what is the stm
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
Rafiq
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
Damian
How we are making nano material?
what is a peer
What is meant by 'nano scale'?
What is STMs full form?
LITNING
scanning tunneling microscope
Sahil
how nano science is used for hydrophobicity
Santosh
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
Rafiq
what is differents between GO and RGO?
Mahi
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
Rafiq
if virus is killing to make ARTIFICIAL DNA OF GRAPHENE FOR KILLED THE VIRUS .THIS IS OUR ASSUMPTION
Anam
analytical skills graphene is prepared to kill any type viruses .
Anam
Any one who tell me about Preparation and application of Nanomaterial for drug Delivery
Hafiz
what is Nano technology ?
write examples of Nano molecule?
Bob
The nanotechnology is as new science, to scale nanometric
brayan
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Damian
Is there any normative that regulates the use of silver nanoparticles?
what king of growth are you checking .?
Renato
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
why we need to study biomolecules, molecular biology in nanotechnology?
?
Kyle
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
why?
what school?
Kyle
biomolecules are e building blocks of every organics and inorganic materials.
Joe
Got questions? Join the online conversation and get instant answers!


text:
# x86 calling conventions

This article describes, in computing, the calling conventions used on the x86 architecture.

Calling conventions describe the interface of called code:

• The order in which parameters are allocated
• Where parameters are placed (pushed on the stack or placed in registers)
• Which registers may be used by the function
• Whether the caller or the callee is responsible for unwinding the stack on return

This is intimately related with the assignment of sizes and formats to programming-language types. Another closely related topic is name mangling, which determines how symbol names in the code map to symbol names used by the linker. Calling conventions, type representations, and name mangling are all part of what is known as an Application Binary Interface (ABI).

There are often subtle differences in how various compilers implement these conventions, so it is often difficult to interface code which is compiled by different compilers. On the other hand, conventions which are used as an API standard (such as stdcall) are necessarily very uniformly implemented.

[hide]

## Historical background

In the times of minicomputers, the machine manufacturer also used to provide an OS for it and most (if not all) of the software, including compilers for various languages. So there used to be only one calling convention per language: the one implemented by the manufacturer's compilers.

The IBM PC case was totally different. One firm (IBM) provided the hardware, another (Intel) made the processor, the third (Microsoft) was responsible for the OS (MS-DOS), and many others wrote compilers for quite a number of programming languages. Different mutually exclusive calling schemes were thus designed to satisfy their different requirements.

## Caller clean-up

In these conventions the caller cleans the arguments from the stack, which allows for variable argument lists, eg. printf().

### cdecl

The cdecl calling convention is used by many C systems for the x86 architecture. In cdecl, function parameters are pushed on the stack in a right-to-left order. Function return values are returned in the EAX register (except for floating point values, which are returned in the x87 register ST0). Registers EAX, ECX, and EDX are available for use in the function.

On Linux, gcc is the de-facto standard for calling conventions. Since gcc 4.5 the stack must be aligned to a 16-byte boundary when calling a function (previous versions only required a 4-byte alignment).

For instance, the following C code function prototype and function call:

int function_name(int, int, int);
int a, b, c, x;
...
x = function_name(a, b, c);

will produce the following x86 Assembly code (written in MASM syntax, with destination first):

push c
push b
push a
call function_name
mov x, eax

The calling function cleans the stack after the function call returns.

There are some variations in the interpretation of cdecl, particularly in how to return values. As a result, x86 programs compiled for different operating system platforms and/or by different compilers can be incompatible, even if they both use the "cdecl" convention and do not call out to the underlying environment. Some compilers return simple data structures with the length of 2 registers or less in EAX:EDX, and larger structures and class objects requiring special treatment by the exception handler (e.g., a defined constructor, destructor, or assignment) are returned in memory. To pass "in memory", the caller allocates memory and passes a pointer to it as a hidden first parameter; the callee populates the memory and returns the pointer, popping the hidden pointer when returning.

In Linux/gcc double/floating point values should be pushed on the stack via the x87 pseudo-stack. Like so:

sub esp,8;    make room for the double
fld [ebp+x]; load our double onto the floating point stack
fstp [esp];  push our double onto the stack
call func;

Using this method ensures it is pushed on the stack in the correct format.

The cdecl calling convention is usually the default calling convention for x86 C compilers, although many compilers provide options to automatically change the calling conventions used. To manually define a function to be cdecl, some support the following syntax:

void _cdecl function_name(params);

The _cdecl modifier must be included in the function prototype, and in the function declaration to override any other settings that might be in place.

### syscall

This is similar to cdecl in that arguments are pushed right to left. EAX, ECX, and EDX are not preserved. The size of the parameter list in doublewords is passed in AL.

Syscall is the standard calling convention for 32 bit OS/2 API.

Arguments are pushed right to left. The three lexically first (leftmost) arguments are passed in EAX, EDX, and ECX and up to four floating-point arguments are passed in ST(0) through ST(3), although space for them is reserved in the argument list on the stack. Results are returned in EAX or ST(0). Registers EBP, EBX, ESI, and EDI are preserved.

Optlink is used by the IBM VisualAge compilers.

## Callee clean-up

When the callee cleans the arguments from the stack it needs to be known at compile time how many bytes the stack needs to be adjusted. Therefore, these calling conventions are not compatible with variable argument lists, eg. printf(). They may be, however, slightly more space efficient, as the code needed to unwind the stack does not need to be generated by the calling code.

Functions which utilize these conventions are easy to recognize in ASM code because they will unwind the stack prior to returning. The x86 ret instruction allows an optional byte parameter that specifies the number of stack locations to unwind before returning to the caller. Such code looks like this:

 ret 12

### pascal

The parameters are pushed on the stack in left-to-right order (opposite of cdecl), and the callee is responsible for balancing the stack before return.

This calling convention was common in the following 16 bit APIs: OS/2 1.x , Microsoft Windows 3.x, and Borland Delphi version 1.x.

### register

An alias for Borland fastcall.

### stdcall

The stdcall[1] calling convention is a variation on the pascal calling convention in which parameters are passed on the stack, pushed right-to-left. Registers EAX, ECX, and EDX are designated for use within the function. Return values are stored in the EAX register. The callee is responsible for cleanup of the stack.

Stdcall is the standard calling convention for the Microsoft Win32 API and for Open Watcom C++.

### fastcall

Conventions entitled fastcall have not been standardized, and have been implemented differently, depending on the compiler vendor. Typically fastcall calling conventions pass one or more arguments in registers which reduces the number of memory accesses required for the call.

#### Microsoft fastcall

• Microsoft or GCC [2] __fastcall[3] convention (aka __msfastcall) passes the first two arguments (evaluated left to right) that fit into ECX and EDX. Remaining arguments are pushed onto the stack from right to left.

#### Borland fastcall

Evaluating arguments from left to right, it passes three arguments via EAX, EDX, ECX. Remaining arguments are pushed onto the stack, also left to right[4].

It is the default calling convention of Borland Delphi, where it is known as register.

#### Watcom register based calling convention

Watcom does not support the __fastcall keyword except to alias it to null. The register calling convention may be selected by command line switch. (However, IDA uses __fastcall anyway for uniformity)

Up to 4 registers are assigned to arguments in the order eax, edx, ebx, ecx. Arguments are assigned to registers from left to right. If any argument cannot be assigned to a register (say it is too large) it, and all subsequent arguments, are assigned to the stack. Arguments assigned to the stack are pushed from right to left. Names are mangled by adding a suffixed underscore.

Variadic functions fall back to the Watcom stack based calling convention.

The Watcom C/C++ compiler also uses the #pragma aux[5] directive that allows the user to specify his own calling convention. As its manual states, "Very few users are likely to need this method, but if it is needed, it can be a lifesaver".

#### TopSpeed / Clarion / JPI

The first four integer parameters are passed in registers eax, ebx, ecx and edx. Floating point parameters are passed on the floating point stack – registers st0, st1, st2, st3, st4, st5 and st6. Structure parameters are always passed on the stack. Additional parameters are passed on the stack after registers are exhausted. Integer values are returned in eax, pointers in edx and floating point types in st0.

### safecall

In Borland Delphi on Microsoft Windows, the safecall calling convention encapsulates COM (Component Object Model) error handling, so that exceptions aren't leaked out to the caller, but are reported in the HRESULT return value, as required by COM/OLE. When calling a safecall function from Delphi code, Delphi also automatically checks the returned HRESULT and raises an exception if necessary. Together with language-level support for COM interfaces and automatic IUnknown handling (implicit AddRef/Release/QueryInterface calls), the safecall calling convention makes COM/OLE programming in Delphi easy and elegant.

The safecall calling convention is the same as the stdcall calling convention, except that exceptions are passed back to the caller in EAX as a HResult (instead of in FS:[0]), while the function result is passed by reference on the stack as though it were a final "out" parameter. When calling a Delphi function from Delphi this calling convention will appear just like any other calling convention, because although exceptions are passed back in EAX, they are automatically converted back to proper exceptions by the caller. When using COM objects created in other languages, the HResults will be automatically raised as exceptions, and the result for Get functions is in the result rather than a parameter. When creating COM objects in Delphi with safecall, there is no need to worry about HResults, as exceptions can be raised as normal but will be seen as HResults in other languages.

function function_name(a: DWORD): DWORD; safecall;

Returns a result and raises exceptions like a normal Delphi function, but it passes values and exceptions as though it was:

function function_name(a: DWORD; out Result: DWORD): HResult; stdcall;

## Either caller or callee clean-up

### thiscall

This calling convention is used for calling C++ non-static member functions. There are two primary versions of thiscall used depending on the compiler and whether or not the function uses variable arguments.

For the GCC compiler, thiscall is almost identical to cdecl: the calling function cleans the stack, and the parameters are passed in right-to-left order. The difference is the addition of the this pointer, which is pushed onto the stack last, as if it were the first parameter in the function prototype.

On the Microsoft Visual C++ compiler, the this pointer is passed in ECX and it is the callee that cleans the stack, mirroring the stdcall convention used in C for this compiler and in Windows API functions. When functions use a variable number of arguments, it is the caller that cleans the stack (cf. cdecl).

The thiscall calling convention can only be explicitly specified on Microsoft Visual C++ 2005 and later. On any other compiler thiscall is not a keyword. (Disassemblers like IDA, however, have to specify it anyway. So IDA uses keyword __thiscall for this)

## Intel ABI

According to the Intel ABI, the EAX, EDX, and ECX are to be free for use within a procedure or function, and need not be preserved.

## Microsoft x64 calling convention

The x64 calling convention (for long mode on x86-64) takes advantage of additional register space in the AMD64/Intel 64 platform. The registers RCX, RDX, R8, R9 are used for integer and pointer arguments (in that order left to right), and XMM0, XMM1, XMM2, XMM3 are used for floating point arguments. Additional arguments are pushed onto the stack (left to right). Integer return values (similar to x86) are returned in RAX if 64 bits or less. Floating point return values are returned in XMM0. Parameters less than 64 bits long are not zero extended; the high bits contain garbage.

When compiling for the x64 architecture using Microsoft tools, there is only one calling convention — the one described here, so that stdcall, thiscall, cdecl, fastcall, etc., are now all one and the same.

In the Microsoft x64 calling convention, it's the caller's responsibility to allocate 32 bytes of "shadow space" on the stack right before calling the function (regardless of the actual number of parameters used), and to pop the stack after the call. The shadow space is used to spill RCX, RDX, R8, and R9.[1]

For example, a function taking 5 integer arguments will take the first to fourth in registers, and the fifth will be pushed on the top of the shadow space. So the stack will be composed (in ascendant order) by the shadow space (32 bytes) followed by the fifth parameter.

In x86-64, Visual Studio 2008 stores floating point numbers in XMM6 and XMM7 (as well as XMM8 through XMM15); consequently, for x86-64, user-written assembly language routines must preserve XMM6 and XMM7 (as compared to x86 wherein user-written assembly language routines did not need to preserve XMM6 and XMM7). In other words, user-written assembly language routines must be updated to save/restore XMM6 and XMM7 before/after the function when being ported from x86 to x86-64.

On x86, one could create thunks that convert any function call from stdcall to thiscall by placing the 'this' pointer in ECX and jumping to the member function address. In x64 a universal stdcall-to-thiscall thunk cannot be written, except for functions that take no arguments. Putting the implicit 'this' in place requires shifting all the arguments, whose number and sizes are unknown.

## AMD64 ABI convention

The calling convention of the AMD64 application binary interface is followed on Linux and other non-Microsoft operating systems. The registers RDI, RSI, RDX, RCX, R8 and R9 are used for integer and pointer arguments while XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6 and XMM7 are used for floating point arguments. As in the Microsoft x64 calling convention, additional arguments are pushed onto the stack and the return value is stored in RAX.

## Standard exit and entry sequences for C code

Please note that all the following examples apply only to x86 (32-bit) code.

The Standard Entry Sequence to a function is as follows:

_function:
push ebp       ;store the old base pointer
mov ebp, esp   ;make the base pointer point to the current
;stack location – at the top of the stack is the
;old ebp, followed by the return address and then
;the parameters.
sub esp, x     ;x is the size, in bytes, of all
;"automatic variables" in the function

This sequence preserves the original base pointer EBP; points EBP to the current stack pointer (which points at the old EBP, followed by the return address and then the function parameters); and then creates space for automatic variables on the stack. Local variables are created on the stack with each call to the function, and are cleaned up at the end of each function. This behaviour allows for functions to be called recursively. In C and C++, variables declared "automatic" are created in this way.

The Standard Exit Sequence goes as follows:

mov esp, ebp   ;reset the stack to "clean" away the local variables
pop ebp        ;restore the original base pointer
ret            ;return from the function

Recovering the previous frame is an action so common that there's an opcode just to do that, called 'leave'. Thus, the exit sequence can also be written as follows:

leave          ;reset the stack and restore the original base pointer
ret            ;return from the function

While functions tend to have only one entry point, they may have multiple exit points, and thus may well have more than one standard exit sequence, or a jump to the standard exit sequence in the function body.

The following C function:

int _cdecl MyFunction(int i){
int k;
return i + k;
}

would produce the equivalent asm code:

;entry sequence
push ebp
mov ebp, esp
sub esp, 4     ;create function stack frame

;function code
mov eax, [ebp + 8]
;move parameter i to accumulator
;result is returned in eax

;exit sequence
mov esp, ebp
pop ebp
ret

Many compilers can optimize these standard sequences away when not needed, for instance when a function does not use local temporaries (often called "no stackframe generation"). If you require them e.g. for interlanguage interfacing, you probably need to search your compiler manual for a compiler directive (or pragma) to turn this kind of optimization locally off.

• 本文已收录于以下专栏：

举报原因： 您举报文章：x86 calling conventions 色情 政治 抄袭 广告 招聘 骂人 其他 (最多只允许输入30个字)


text:
# PicoCTF 2014 Write-ups

## Substitution - 50 (Cryptography)

Created: 2014-11-07 22:12:02

### Problem

There's an authorization code for some Thyrin Labs information here, along with someone's favorite song. But it's been encrypted! Find the authorization code.

encrypted.txt

### Hint

You may want to look at what the relative frequencies of letters in english text are.

### Overview

This is a simple substitution cipher. It is susceptible to frequency analysis. There are numerous tools online for this. Below, I explain how to write your own in python.

### Details

A simple substitution cipher maps every character plaintext to a different character for the cipher text. You can do a 'frequency analysis' on this kind of cipher. I happen to know that the most common letter in English is 'e'. The most common letter in the ciphertext is 'h'. Therefore 'h' probably maps to 'e'

We can actually do a lot more than this. I will write a script in python that get two lists: the first is a sorted list of n-grams, the secound is a sorted list of n-long words. An n-gram is a string of letters within a word. For example the most common bigram is 'th' then 'he', 'in', 'er', etc. The most common trigram is 'the', 'and', 'tha', 'ent', etc. By extension an n-gram just a string of letters within a word. If I find the most common n-grams in the output, I can compare these to the most common n-grams in english. The list of n-long words is a lot more straightforward. I can guess common one-letter words like 'I', and 'a', then common two-letter words like 'an' or 'it'. We also want to go through the list of words and finding the most common first letter

To find the n-grams, we can loop through i from zero to the length of the string minus n. Then we slice the string from i to i plus n. If it contains a space or newline, ignore it. Otherwise add it to a counter. The pyhton standard library provides a counter class which is very useful for doing these frequency analyses. To find n-long words, we can use regex to split the text into words and add each word the appropriate counter.

import re
from collections import Counter
from data import ctext

ctext_words = filter(bool, re.split('\s', ctext))
max_gram = 15 # up to 15-gram, up to 15-letter words
n_grams = []
n_words = []

for i in range(1, max_gram + 1):
# for i = 2, do bigrams and 2-letter words
# for i = 3, do trigrams and 3-letter words
a = Counter()
for j in range(len(ctext) - i):
gram = ctext[j:j + i]
if ' ' in gram or '\n' in gram:
continue # skip grams seperated by space
a[gram] += 1
n_grams.append(a)

b = Counter()
for word in ctext_words:
if len(word) != i:
continue
b[word] += 1
n_words.append(b)

starting_letters = Counter()
ending_letters = Counter()
for word in ctext_words:
starting_letters[word[0]] += 1
ending_letters[word[-1]] += 1

To use this script, just let ctext be the encrypted text you have and run it. Now we need to display the results in a meaningful way.

code = {} # fill this in along the way
def decrypt(word):
decoded = ''
for letter in word:
try:
decoded += code[letter]
except KeyError:
decoded += letter
return decoded

def table(counter, n=10):
total = sum(counter.values())
for word, freq in counter.most_common(n):
print '{0: <10.1f}{1}'.format(float(freq) / total * 100, decrypt(word))

Now just type table(starting_letters) to get a table of the most common starting letters and their frequency as a percentage, or table(n_words[3]) to get the most common 3 letter long words.

From here, we make multiple passes. Here are the most useful results. I made educated guesses on what the letters should be.

#### First pass

Full text: first_pass.txt

Single letters
12.3      h -> E
9.8       c
9.0       r
8.4       k

We have inconclusive evidence on all of the other letters.

Letter bigrams
6.9       ri -> TH
5.3       ih -> HE

Letter trigrams
6.9       rih -> THE

All letter tetragrams
2.6       hshw -> EVER
2.0       bqri
1.7       khsh -> WERE

One-letter words
70.0      e
30.0      q

I know these map to either 'a' or 'I'.

Four-letter words
8.8       bqri -> WITH (consistent with q -> I)

Therefore, we fill in code with the appropriate letters. I have decided to make the deciphered text uppercase, so I can tell apart what is already deciphered with what is not already deciphered.

code = {'h':'E', 'r':'T', 'i': 'H', 'b':'W', 'e':'A', 'q':'I'}

#### Second pass

Full text: second_pass.txt

Two-letter words
20.5      co -> OF
11.4      Tc -> TO
9.1       WE
9.1       Ia
6.8       ac
6.8       Ik -> IN|IS|IF -> IN?

Three-letter words
31.5      THE
18.5      gcj
9.3       Auu
9.3       Akt -> ANt|ASt|AFt -> AND
6.5       fAk
5.6       AwE
2.8       cWk -> OWN|OWS|OWF -> OWN

You can see how the encrypted and decrypted letters mix together. The decrypted ones are the ones we solved last pass. The decrypted letters are capital and the encrypted letters are lowercase.

Apparently the text qk showed up a lot. We know the q maps to I from the first pass, so it shows up as Ik (I is decrypted, k is encrypted). This could be IN, IS, or IF. This means k decrypts to N or S or F. Trying that out on the three letter words, it becomes obvious that since there is no word AS_ or AF_, but there is a word AND which is quite frequent, k decrypts to D.

Five-letter words
14.6      kEsEw -> NEVER
9.8       gcjuu
9.8       THIkd -> THINK
9.8       EAwTH -> EARTH
9.8       lAIkT
4.9       aTIuu
2.4       uEAwk
2.4       gcjsE
2.4       EsEwg -> EVER

Here I have begun guessing whole words. I have gotten other letters the same way (you can see the full text here). Now we have:

code = {'h':'E', 'r':'T', 'i': 'H', 'b':'W', 'e':'A', 'q':'I', 'k':'N', 'c':'O',
'd':'K', 's':'V', 'w':'R'}

#### Third pass

Full text: third_pass.txt

Thirteen-letter words
100.0     AjTHORIxATION -> AuTHORIzATION

Eight-letter words
12.5      zRINNINz -> GRINNING
12.5      agfAnORE -> S_CA_ORE
12.5      IzNORANT -> IGNORANT
12.5      WHATEVER
12.5      vROTHERa -> BROTHERS
12.5      ajNaWEET -> SUNSWEET
12.5      fREATjRE -> CREATURE
12.5      aTRANzER -> STRANGER

Seven-letter words
20.0      aKINNEt -> SKINNED
20.0      vERRIEa -> BERRIES
20.0      WHETHER
20.0      oRIENta -> _RIEN_S
20.0      zRINNEt -> GRINNED?

Now the whole thing comes tumbling down. I got a lot more letters this way. You can see the full text here. Now our code is:

code = {'h':'E', 'r':'T', 'i': 'H', 'b':'W', 'e':'A', 'q':'I', 'k':'N', 'c':'O',
'd':'K', 's':'V', 'w':'R', 'j':'U', 'x':'Z', 'z':'G', 'v':'B', 'a':'S',
'f':'C', 'u':'L', 'l':'P', 't':'D', 'o':'F',

#### Fourth and fifth pass

I started guessing single letters and bigrams. Then I guessed words. Now I am ready to guess sentences and paragraphs. You can see the fourth_pass.txt and the final decrypted message in fifth_pass.txt. For these, I am using:

print decrypt(ctext)

Now we got it! Lots of people just used an online tool. Those work, but for educational purposes, I want to tell you how to do it by yourself so you will know the online tools work. Here is the full script and all of my work:

### Flag

WITHALLTHECOLORSOFTHEWIND


text:
# Variation of parameters

1. ### flyingpig

1. The problem statement, all variables and given/known data

Solve for general solution with variation of parameter

$$y'''(x) - y'(x) = x$$

3. The attempt at a solution

I initially looked at $$y'''(x) - y'(x) = x$$ only and I foudn my answer to be

$$y(x) = C_1e^{x} + C_2e^{-x} + 1 - x$$

Now i looked through my book and it says it works for ay'' + by' + c = f(t) only (second order).

So I "integrated" $$y'''(x) - y'(x) = x$$

And I got $$y''(x) - y(x) = \frac{x^2}{2} + C$$, solving I got

$$y(x) = C_1e^{x} + C_2e^{-x} + C_3 - \frac{x^2}{2}$$

Using the computer, it gave me

http://www.wolframalpha.com/input/?i=Solve[y%27%27%27+-+y%27+%3D+x]

Why does computer have negative sign??

2. ### HallsofIvy

41,264
Staff Emeritus
I have no idea what you mean when you say you "looked at y'''- y'= x only". That is the entire problem! Do you mean the associated homogeneous equation, y'''- y'= 0? That has characteristic equation $r^3- r= r(r^2- 1)= r(r- 1)(r+ 1)= 0$ so the general solution to the associated homogeneous equation is $y_h(x)= C_1e^x+ C_2e^{-x}+ C_3$

Now, you have title this "variation of parameters". To use that method for this differential equation ("undetermined coefficients" would be simpler but I presume this is for practice of variation of parameters specifically), look for a solution of the form
$$y(x)= u(x)e^x+ v(x)e^{-x}+ w(x)$$
That is, we treat those constants (parameters) as variables- that is the reason for the name "variation of parameters". Differentiating, $y'= u'e^x+ ue^x+ v'e^{-x}- ve^{-x}+ w'$. There will be many different possible functions that will work- we limit our search by requiring that $u'e^x+ v'e^x+ w'= 0$

That means that we have $y'= ue^x- ve^{-x}$. Differentiating again, $y''= u'e^x+ ue^x- v'e^{-x}+ ve^{-x}$. Once again, we "limit our search" (and simplify the equation) by requiring that $u'e^x- v'e^{-x}= 0$.

That gives, now, $y''= ue^{x}+ ve^{-x}$ and, differentiating one more time, that $y'''= u'e^{x}+ ue^{x}+ v'e^{-x}- ve^{-x}$. Putting that and the formula for y' into the equation,
$$u'e^x+ ue^x+ v'e^{-x}- ve^{-x}- (ue^x- ve^{-x})= u'e^x+ v'e^{-x}= x$$

You see what has happened? We have no derivative of u, v, and w higher than first because of our "requirements" and we do not have u, v, and w themselves because they satify the homogenous equation and cancel. We have, instead the three equations
$$u'e^x+ v'e^x+ w'= 0$$
$$u'e^x- v'e^{-x}= 0$$
and
$$u'e^x+ v'e^{-x}= x$$
which we can treat as three linear equations in u', v', and w'. Solve for those and integrate to find u, v, and w.

3. ### vela

12,971
Staff Emeritus
If you're asking about the negative sign in front of c2e-x, it doesn't matter because the sign could be pulled into the arbitrary constant c2.

4. ### flyingpig

HallsofIvy, my book did the same thing, they imposed on the requirement that

$$u'e^x+ v'e^x+ w'= 0$$

Why? Was I right though initially when I 'integrated' $$y''' - y' = x$$

5. ### HallsofIvy

41,264
Staff Emeritus
Yes, because there is no "y" in the original equation you can integrate $y'''- y'= x$ to get $y''- y= (1/2)x^2+ C_1$. It will give you the same result.

However, you titled this "variation of parameters" which will be of about the same difficulty for either equation.

6. ### flyingpig

But why this condition

$$u'e^x+ v'e^x+ w'= 0$$

My book threw this (similar, except they used y_1 and y_2 for general derivation) out of nowhere and I am left blank minded.

How do they know it's going to work out? How did you know (don't say intuition...) the condition u'e^x+ v'e^x+ w'= 0 will enable to you solve the problem?

7. ### flyingpig

Oh okay I see, because if "y" was there, then we can't assume what y really is? Is that why?

Why does it make it equally correct that I "integrated" through $$y''' - y' = x$$ because y wasn't there? Why is it okay then that I don't need to know y', yet I would get the right answer?

By the way, why do you use [/itex]? What does the i do?


text:
# Definition:Point Finite

## Definition

Let $S$ be a set.

Let $\CC$ be a set of subsets of $S$.

Then $\CC$ is point finite if and only if each element of $S$ is an element of finitely many sets in $\CC$:

$\forall s \in S: \card {\set {C \in \CC: s \in C} } < \infty$

## Also defined as

Some sources define point finite only for subsets of topological spaces.

Others define point finite only for covers.

In each case, however, the underlying meaning is identical.