text:
DifferentialGeometry - Maple Programming Help

Home : Support : Online Help : Mathematics : DifferentialGeometry : DifferentialGeometry/Preferences

DifferentialGeometry

 Preferences

 Calling Sequence Preferences(keyword) Preferences(keyword, value)

Parameters

 keyword - a string, the name of the particular preference value - the value to be assigned to the preference

Description

 • This command allows the user to control various display conventions used by the DifferentialGeometry package; to specify the LaTeX formatting of DifferentialGeometry objects such as vectors, differential forms and tensors; and to specify how commonly used Maple commands are used internally by DifferentialGeometry procedures.
 • The following are the admissible keywords strings:

 • The  paragraphs below describes the use of each of these keywords.
 • This command is part of the DifferentialGeometry package, and so can be used in the form Preferences(...) only after executing the command with(DifferentialGeometry).  It can always be used in the long form DifferentialGeometry:-Preferences.

Details

"DisplayFrameDefinitions"

This preference controls what information is displayed when the command DGsetup is executed. When this preference is false, no display is displayed.  When this preference is true, the names of the coordinate variables and the labels for the frame vectors and coframe 1-forms are displayed.  The default preference is false.

 > with(DifferentialGeometry):
 > Preferences("DisplayFrameDefinitions");
 ${\mathrm{false}}$ (1)
 > DGsetup([x, y, z], E3);
 ${\mathrm{frame name: E3}}$ (2)
 > Preferences("DisplayFrameDefinitions", true);
 ${\mathrm{false}}$ (3)
 > DGsetup([x, y, z], E3);
 ${\mathrm{The following coordinates have been protected:}}$
 $\left[{x}{,}{y}{,}{z}\right]$
 ${\mathrm{The following vector fields have been defined and protected:}}$
 $\left[{\mathrm{D_x}}{,}{\mathrm{D_y}}{,}{\mathrm{D_z}}\right]$
 ${\mathrm{The following differential 1-forms have been defined and protected:}}$
 $\left[{\mathrm{dx}}{,}{\mathrm{dy}}{,}{\mathrm{dz}}\right]$
 ${\mathrm{frame name: E3}}$ (4)
 "ErrorInfoLevel" This preference controls the amount of information provided by an error message from a DifferentialGeometry command.  The default for ErrorInfoLevel is 1.
 "ErrorPrintLength" For many of the error messages returned by the DifferentialGeometry commands, it is not necessary to display all the component information of the vectors, differential forms, and tensors provided as input.  By suppressing the component information, the error messages are generally much easier to read. The ErrorPrintLength preference controls the number of components which will be displayed -- the first k components will be displayed if the sum of their lengths does not exceed the integer specified by the ErrorPrintLength preference.  The length of each component is calculated using the Maple length command.  The default value for this preference is 0 so that no component information is displayed.  To display all component information, set this preference to infinity.

"HistoryDepth"

The Tools command CalculationHistory will store the results of certain critical intermediate computations which the user may wish to view.  The HistoryDepth preference specifies the number of such computations to store.  The default value for this preference is 10.

 > with(DifferentialGeometry):

To illustrate this preference, we create a small procedure called Test and store some values calculated by this program using the CalculationHistory command.

 > Test := proc(n) local i; for i to n do Tools:-CalculationHistory:-Update("Test", [i, i^2]) od; n^2 end:

Run the program Test.

 > Test(25);
 ${625}$ (5)

Retrieve the calculated values.

 > Tools:-CalculationHistory:-Get("Test");
 $\left[\left[{25}{,}{625}\right]{,}\left[{24}{,}{576}\right]{,}\left[{23}{,}{529}\right]{,}\left[{22}{,}{484}\right]{,}\left[{21}{,}{441}\right]{,}\left[{20}{,}{400}\right]{,}\left[{19}{,}{361}\right]{,}\left[{18}{,}{324}\right]{,}\left[{17}{,}{289}\right]{,}\left[{16}{,}{256}\right]\right]$ (6)

Change the HistoryDepth preference to 3.

 > Preferences("HistoryDepth", 3);
 ${10}$ (7)

 • Rerun the program Test and retrieve the calculated values.  This time only 3 values are stored.
 > Test(25);
 ${625}$ (8)
 > Tools:-CalculationHistory:-Get("Test");
 $\left[\left[{25}{,}{625}\right]{,}\left[{24}{,}{576}\right]{,}\left[{23}{,}{529}\right]\right]$ (9)

"JetNotation"

In the mathematical literature, there are two standard index notations for representing derivatives of a function.  For example, if u = u(x, y) then we have:

JetNotation1: u[1] = u_x, u[2] = u_y, u[1, 1] = u_xx, u[1, 2] = u_xy, u[2, 2] = u_yy, u[1, 1, 1] = u_xxx, u[1, 1, 2] = u_xxy, u[1, 2, 2] = u_xyy, u[2, 2, 2] = u_yyy.

JetNotation2: u[1, 0] = u_x, u[0, 1] = u_y, u[2, 0] = u_xx, u[1, 1] = u_xy, u[0, 2] = u_yy, u[3, 0] = u_xxx, u[2, 1] = u_xxy, u[1, 2] = u_xyy, u[0, 3] = u_yyy.

 • The JetNotation preference determines which notation is used by the DifferentialGeometry package (and the JetCalculus subpackage).  The default is JetNotation1.
 > with(DifferentialGeometry):
 > Preferences("JetNotation");
 ${"JetNotation1"}$ (10)
 > DGsetup([x,y], [u], Jet, 3, verbose);
 ${\mathrm{The following coordinates have been protected:}}$
 $\left[{x}{,}{y}{,}{{u}}_{{[}{]}}{,}{{u}}_{{1}}{,}{{u}}_{{2}}{,}{{u}}_{{1}{,}{1}}{,}{{u}}_{{1}{,}{2}}{,}{{u}}_{{2}{,}{2}}{,}{{u}}_{{1}{,}{1}{,}{1}}{,}{{u}}_{{1}{,}{1}{,}{2}}{,}{{u}}_{{1}{,}{2}{,}{2}}{,}{{u}}_{{2}{,}{2}{,}{2}}\right]$
 ${\mathrm{The following vector fields have been defined and protected:}}$
 $\left[{\mathrm{D_x}}{,}{\mathrm{D_y}}{,}{\mathrm{D_u}}\left[\right]{,}{{\mathrm{D_u}}}_{{1}}{,}{{\mathrm{D_u}}}_{{2}}{,}{{\mathrm{D_u}}}_{{1}{,}{1}}{,}{{\mathrm{D_u}}}_{{1}{,}{2}}{,}{{\mathrm{D_u}}}_{{2}{,}{2}}{,}{{\mathrm{D_u}}}_{{1}{,}{1}{,}{1}}{,}{{\mathrm{D_u}}}_{{1}{,}{1}{,}{2}}{,}{{\mathrm{D_u}}}_{{1}{,}{2}{,}{2}}{,}{{\mathrm{D_u}}}_{{2}{,}{2}{,}{2}}\right]$
 ${\mathrm{The following differential 1-forms have been defined and protected:}}$
 $\left[{\mathrm{dx}}{,}{\mathrm{dy}}{,}{\mathrm{du}}\left[\right]{,}{{\mathrm{du}}}_{{1}}{,}{{\mathrm{du}}}_{{2}}{,}{{\mathrm{du}}}_{{1}{,}{1}}{,}{{\mathrm{du}}}_{{1}{,}{2}}{,}{{\mathrm{du}}}_{{2}{,}{2}}{,}{{\mathrm{du}}}_{{1}{,}{1}{,}{1}}{,}{{\mathrm{du}}}_{{1}{,}{1}{,}{2}}{,}{{\mathrm{du}}}_{{1}{,}{2}{,}{2}}{,}{{\mathrm{du}}}_{{2}{,}{2}{,}{2}}\right]$
 ${\mathrm{The following type \left[1,0\right] biforms have been defined and protected::}}$
 $\left[{\mathrm{Dx}}{,}{\mathrm{Dy}}\right]$
 ${\mathrm{The following type \left[0,1\right] biforms \left(contact 1-forms\right) have been defined and protected::}}$
 $\left[{\mathrm{Cu}}\left[\right]{,}{{\mathrm{Cu}}}_{{1}}{,}{{\mathrm{Cu}}}_{{2}}{,}{{\mathrm{Cu}}}_{{1}{,}{1}}{,}{{\mathrm{Cu}}}_{{1}{,}{2}}{,}{{\mathrm{Cu}}}_{{2}{,}{2}}{,}{{\mathrm{Cu}}}_{{1}{,}{1}{,}{1}}{,}{{\mathrm{Cu}}}_{{1}{,}{1}{,}{2}}{,}{{\mathrm{Cu}}}_{{1}{,}{2}{,}{2}}{,}{{\mathrm{Cu}}}_{{2}{,}{2}{,}{2}}\right]$
 ${\mathrm{frame name: Jet}}$ (11)
 > Preferences("JetNotation", "JetNotation2");
 ${"JetNotation1"}$ (12)
 > DGsetup([x, y], [u], Jet, 3, verbose);
 ${\mathrm{The following coordinates have been protected:}}$
 $\left[{x}{,}{y}{,}{{u}}_{{0}{,}{0}}{,}{{u}}_{{1}{,}{0}}{,}{{u}}_{{0}{,}{1}}{,}{{u}}_{{2}{,}{0}}{,}{{u}}_{{1}{,}{1}}{,}{{u}}_{{0}{,}{2}}{,}{{u}}_{{3}{,}{0}}{,}{{u}}_{{2}{,}{1}}{,}{{u}}_{{1}{,}{2}}{,}{{u}}_{{0}{,}{3}}\right]$
 ${\mathrm{The following vector fields have been defined and protected:}}$
 $\left[{\mathrm{D_x}}{,}{\mathrm{D_y}}{,}{{\mathrm{D_u}}}_{{0}{,}{0}}{,}{{\mathrm{D_u}}}_{{1}{,}{0}}{,}{{\mathrm{D_u}}}_{{0}{,}{1}}{,}{{\mathrm{D_u}}}_{{2}{,}{0}}{,}{{\mathrm{D_u}}}_{{1}{,}{1}}{,}{{\mathrm{D_u}}}_{{0}{,}{2}}{,}{{\mathrm{D_u}}}_{{3}{,}{0}}{,}{{\mathrm{D_u}}}_{{2}{,}{1}}{,}{{\mathrm{D_u}}}_{{1}{,}{2}}{,}{{\mathrm{D_u}}}_{{0}{,}{3}}\right]$
 ${\mathrm{The following differential 1-forms have been defined and protected:}}$
 $\left[{\mathrm{dx}}{,}{\mathrm{dy}}{,}{{\mathrm{du}}}_{{0}{,}{0}}{,}{{\mathrm{du}}}_{{1}{,}{0}}{,}{{\mathrm{du}}}_{{0}{,}{1}}{,}{{\mathrm{du}}}_{{2}{,}{0}}{,}{{\mathrm{du}}}_{{1}{,}{1}}{,}{{\mathrm{du}}}_{{0}{,}{2}}{,}{{\mathrm{du}}}_{{3}{,}{0}}{,}{{\mathrm{du}}}_{{2}{,}{1}}{,}{{\mathrm{du}}}_{{1}{,}{2}}{,}{{\mathrm{du}}}_{{0}{,}{3}}\right]$
 ${\mathrm{The following type \left[1,0\right] biforms have been defined and protected::}}$
 $\left[{\mathrm{Dx}}{,}{\mathrm{Dy}}\right]$
 ${\mathrm{The following type \left[0,1\right] biforms \left(contact 1-forms\right) have been defined and protected::}}$
 $\left[{{\mathrm{Cu}}}_{{0}{,}{0}}{,}{{\mathrm{Cu}}}_{{1}{,}{0}}{,}{{\mathrm{Cu}}}_{{0}{,}{1}}{,}{{\mathrm{Cu}}}_{{2}{,}{0}}{,}{{\mathrm{Cu}}}_{{1}{,}{1}}{,}{{\mathrm{Cu}}}_{{0}{,}{2}}{,}{{\mathrm{Cu}}}_{{3}{,}{0}}{,}{{\mathrm{Cu}}}_{{2}{,}{1}}{,}{{\mathrm{Cu}}}_{{1}{,}{2}}{,}{{\mathrm{Cu}}}_{{0}{,}{3}}\right]$
 ${\mathrm{frame name: Jet}}$ (13)

"Keywords"

The option Keywords returns the list of all admissible keywords for the Preferences procedure.

 > with(DifferentialGeometry):
 > Preferences("Keywords");
 $\left[{"DisplayFrameDefinitions"}{,}{"ErrorInfoLevel"}{,}{"ErrorPrintLength"}{,}{"HistoryDepth"}{,}{"JetNotation"}{,}{"Macros"}{,}{"PrettyPrint"}{,}{"PromptLength"}{,}{"SafeMode"}{,}{"ShowFramePrompt"}{,}{"TeXBiformList"}{,}{"TeXFormList"}{,}{"TeXLineBreak"}{,}{"TeXPrintOrder"}{,}{"TeXVectorList"}{,}{"TensorDisplay"}{,}{"VectorDisplay"}{,}{"WedgeDisplay"}{,}{"dsolve"}{,}{"is"}{,}{"nullspace"}{,}{"pdsolve"}{,}{"rref"}{,}{"simplification"}{,}{"solve"}\right]$ (14)

"PrettyPrint"

With the PrettyPrint preference set to true, the components of vectors, differential forms and tensors are always displayed on the main text line -- they will not appear as numerators in fractions.  This is somewhat easier to read but has the disadvantage that the resulting outline (for vectors and 1-forms) cannot be copied and pasted.  The default for the PrettyPrint preference is false.

 > with(DifferentialGeometry):
 > DGsetup([x, y, z], M):
 ${\mathrm{The following coordinates have been protected:}}$
 $\left[{x}{,}{y}{,}{z}\right]$
 ${\mathrm{The following vector fields have been defined and protected:}}$
 $\left[{\mathrm{D_x}}{,}{\mathrm{D_y}}{,}{\mathrm{D_z}}\right]$
 ${\mathrm{The following differential 1-forms have been defined and protected:}}$
 $\left[{\mathrm{dx}}{,}{\mathrm{dy}}{,}{\mathrm{dz}}\right]$ (15)
 > Preferences("PrettyPrint");
 ${\mathrm{false}}$ (16)
 > X := evalDG(1/(x^2 + y^2)*dx &w dy - dx &w dz);
 ${X}{≔}\frac{{\mathrm{dx}}}{{{x}}^{{2}}{+}{{y}}^{{2}}}{}{\bigwedge }{}{\mathrm{dy}}{-}\left({\mathrm{dx}}{}{\bigwedge }{}{\mathrm{dz}}\right)$ (17)
 > Preferences("PrettyPrint", true);
 ${\mathrm{false}}$ (18)
 > X := evalDG(1/(x^2 + y^2)*dx &w dy - dx &w dz);
 ${X}{≔}\left({\left(\frac{{1}}{{{x}}^{{2}}{+}{{y}}^{{2}}}\right)}_{{}}{}{\mathrm{dx}}\right){}{\bigwedge }{}{\mathrm{dy}}{-}\left({\mathrm{dx}}{}{\bigwedge }{}{\mathrm{dz}}\right)$ (19)

"PromptLength"

This preference specifies the maximum number of characters that will be displayed in the frame prompt.

 > with(DifferentialGeometry):
 > DGsetup([x], Newton);
 ${\mathrm{The following coordinates have been protected:}}$
 $\left[{x}\right]$
 ${\mathrm{The following vector fields have been defined and protected:}}$
 $\left[{\mathrm{D_x}}\right]$
 ${\mathrm{The following differential 1-forms have been defined and protected:}}$
 $\left[{\mathrm{dx}}\right]$
 ${\mathrm{frame name: Newton}}$ (20)
 > Preferences("PromptLength", 4);
 ${1000}$ (21)

"SafeMode"

With the SafeMode preference set to false, no global assignments are made for the coordinate vectors and 1-forms when the command DGsetup is called.  Use this preference when writing programs in which temporary manifolds, Lie algebras, etc... need to be constructed.  This will avoid introducing globals into the Maple namespace.

 > with(DifferentialGeometry):
 > Preferences("SafeMode");
 ${\mathrm{false}}$ (22)
 > DGsetup([x], R1):
 ${\mathrm{The following coordinates have been protected:}}$
 $\left[{x}\right]$
 ${\mathrm{The following vector fields have been defined and protected:}}$
 $\left[{\mathrm{D_x}}\right]$
 ${\mathrm{The following differential 1-forms have been defined and protected:}}$
 $\left[{\mathrm{dx}}\right]$ (23)
 > assigned(D_x), assigned(dx);
 ${\mathrm{true}}{,}{\mathrm{true}}$ (24)

Now set the SafeMode preference to true.  The names D_y and dy are not assigned nor are they protected.

 > Preferences("SafeMode", true);
 ${\mathrm{false}}$ (25)
 > DGsetup([y], R2):
 ${\mathrm{The following coordinates have been protected:}}$
 $\left[{y}\right]$
 ${\mathrm{The following vector fields have been defined and protected:}}$
 $\left[\left[\left[{"vector"}{,}{\mathrm{R2}}{,}\left[{}\right]\right]{,}\left[\left[\left[{1}\right]{,}{1}\right]\right]\right]\right]$
 ${\mathrm{The following differential 1-forms have been defined and protected:}}$
 $\left[\left[\left[{"form"}{,}{\mathrm{R2}}{,}{1}\right]{,}\left[\left[\left[{1}\right]{,}{1}\right]\right]\right]\right]$ (26)
 > assigned(D_y), assigned(dy);
 ${\mathrm{true}}{,}{\mathrm{true}}$ (27)
 > D_y := 3;
 ${\mathrm{D_y}}{≔}{3}$ (28)
 • Note that the coordinate vectors and forms for the frame R2 can still be accessed using commands from the Tools subpackage.  In SafeMode, the internal representations of DifferentialGeometry are displayed as output.
 > Tools:-DGvector(y);
 $\left[\left[{"vector"}{,}{\mathrm{R2}}{,}\left[{}\right]\right]{,}\left[\left[\left[{1}\right]{,}{1}\right]\right]\right]$ (29)
 > Tools:-DGinfo("FrameBaseForms");
 $\left[\left[\left[{"form"}{,}{\mathrm{R2}}{,}{1}\right]{,}\left[\left[\left[{1}\right]{,}{1}\right]\right]\right]\right]$ (30)
 > Preferences("SafeMode", false);
 ${\mathrm{true}}$ (31)

"Show"

The option Show returns the list of all the preference values.

 > with(DifferentialGeometry):
 > Preferences("Show");
 ${"DisplayFrameDefinitions"}{=}{\mathrm{true}}{,}{"ErrorInfoLevel"}{=}{0}{,}{"ErrorPrintLength"}{=}{0}{,}{"HistoryDepth"}{=}{3}{,}{"JetNotation"}{=}{"JetNotation2"}{,}{"Macros"}{=}{"off"}{,}{"PrettyPrint"}{=}{\mathrm{true}}{,}{"PromptLength"}{=}{4}{,}{"SafeMode"}{=}{\mathrm{false}}{,}{"ShowFramePrompt"}{=}{\mathrm{true}}{,}{"TeXLineBreak"}{=}\left[{8}\right]{,}{"TeXPrintOrder"}{=}\left[{}\right]{,}{"TensorDisplay"}{=}{0}{,}{"VectorDisplay"}{=}{0}{,}{"WedgeDisplay"}{=}{1}{,}{"dsolve"}{=}{\mathrm{dsolve}}{,}{"is"}{=}{\mathrm{is}}{,}{"nullspace"}{=}{\mathrm{LinearAlgebra:-NullSpace}}{,}{"pdsolve"}{=}{\mathrm{pdsolve}}{,}{"rref"}{=}{\mathrm{LinearAlgebra:-ReducedRowEchelonForm}}{,}{"simplification"}{=}{\mathrm{simplify}}{,}{"solve"}{=}{\mathrm{solve}}$ (32)

"ShowFramePrompt"

With the ShowFramePrompt set to false, the standard Maple prompt will be used.

 > with(DifferentialGeometry):
 > Preferences("ShowFramePrompt", false);
 ${\mathrm{true}}$ (33)
 > DGsetup([x, y], Gauss);
 ${\mathrm{The following coordinates have been protected:}}$
 $\left[{x}{,}{y}\right]$
 ${\mathrm{The following vector fields have been defined and protected:}}$
 $\left[{\mathrm{D_x}}{,}{\mathrm{D_y}}\right]$
 ${\mathrm{The following differential 1-forms have been defined and protected:}}$
 $\left[{\mathrm{dx}}{,}{\mathrm{dy}}\right]$
 ${\mathrm{frame name: Gauss}}$ (34)
 > LieBracket(D_x, x*D_y);
 ${\mathrm{D_y}}$ (35)

Notice that the prompt has remained the standard Maple prompt '>'.

 > Preferences("ShowFramePrompt", true);
 ${\mathrm{false}}$ (36)
 > DGsetup([x, y], Gauss);
 ${\mathrm{The following coordinates have been protected:}}$
 $\left[{x}{,}{y}\right]$
 ${\mathrm{The following vector fields have been defined and protected:}}$
 $\left[{\mathrm{D_x}}{,}{\mathrm{D_y}}\right]$
 ${\mathrm{The following differential 1-forms have been defined and protected:}}$
 $\left[{\mathrm{dx}}{,}{\mathrm{dy}}\right]$
 ${\mathrm{frame name: Gauss}}$ (37)

Now the prompt contains the name of the current frame.

"TensorDisplay"

The preference TensorDisplay controls how the tensor product is displayed in Maple output.  If this preference is 0, no symbol is printed; if this preference is 1, then '&t' is printed.  The default TensorDisplay preference is 0.

 > with(DifferentialGeometry):
 > DGsetup([x, y, z], M):
 ${\mathrm{The following coordinates have been protected:}}$
 $\left[{x}{,}{y}{,}{z}\right]$
 ${\mathrm{The following vector fields have been defined and protected:}}$
 $\left[{\mathrm{D_x}}{,}{\mathrm{D_y}}{,}{\mathrm{D_z}}\right]$
 ${\mathrm{The following differential 1-forms have been defined and protected:}}$
 $\left[{\mathrm{dx}}{,}{\mathrm{dy}}{,}{\mathrm{dz}}\right]$ (38)
 > alpha := evalDG(2*dx &t dy - dy &t dz);
 ${\mathrm{α}}{≔}\left({2}{}{\mathrm{dx}}\right){}{\mathrm{dy}}{-}\left({\mathrm{dy}}{}{\mathrm{dz}}\right)$ (39)
 > Preferences("TensorDisplay", 1);
 ${0}$ (40)
 > alpha;
 $\left({2}{}{\mathrm{dx}}\right){}{\otimes }{}{\mathrm{dy}}{-}\left({\mathrm{dy}}{}{\otimes }{}{\mathrm{dz}}\right)$ (41)
 > Preferences("TensorDisplay", 0);
 ${1}$ (42)

"TeXFormList", "TeXVectorList", "TeXBiformList", "TeXPrintOrder", "TeXLineBreak"

These preferences control how the Maple latex command will TeX the components of a vector, differential form or tensor.  These preferences must be set by the user for each frame.

 > with(DifferentialGeometry):
 > DGsetup([x, y, z], M): DGsetup([x, y, z], N):
 ${\mathrm{The following coordinates have been protected:}}$
 $\left[{x}{,}{y}{,}{z}\right]$
 ${\mathrm{The following vector fields have been defined and protected:}}$
 $\left[{\mathrm{D_x}}{,}{\mathrm{D_y}}{,}{\mathrm{D_z}}\right]$
 ${\mathrm{The following differential 1-forms have been defined and protected:}}$
 $\left[{\mathrm{dx}}{,}{\mathrm{dy}}{,}{\mathrm{dz}}\right]$
 ${\mathrm{The following coordinates have been protected:}}$
 $\left[{x}{,}{y}{,}{z}\right]$
 ${\mathrm{The following vector fields have been defined and protected:}}$
 $\left[{\mathrm{D_x}}{,}{\mathrm{D_y}}{,}{\mathrm{D_z}}\right]$
 ${\mathrm{The following differential 1-forms have been defined and protected:}}$
 $\left[{\mathrm{dx}}{,}{\mathrm{dy}}{,}{\mathrm{dz}}\right]$ (43)

Specify the LaTeX representations for the frame [D_x, D_y, D_z] on M.

 > Preferences("TeXVectorList", M, ["\\partial_x", "\\partial_y", "\\partial_z"]);
 $\left[{"\partial_x"}{,}{"\partial_y"}{,}{"\partial_z"}\right]$ (44)

Specify the LaTeX representations for the coframe [dx, dy, dz] on M.

 > Preferences("TeXFormList", M, ["dx", "dy", "d,z"]);
 $\left[{"dx"}{,}{"dy"}{,}{"d,z"}\right]$ (45)

Specify the LaTeX representations for the frame [D_x, D_y, D_z] on N.

 > Preferences("TeXVectorList", N, ["\\frac{\\partial\\hfill}{\\partial_x}", "\\frac{\\partial\\hfill}{\\partial_y}", "\\frac{\\partial\\hfill}{\\partial_y}"]);
 $\left[{"\frac\left\{\partial\hfill\right\}\left\{\partial_x\right\}"}{,}{"\frac\left\{\partial\hfill\right\}\left\{\partial_y\right\}"}{,}{"\frac\left\{\partial\hfill\right\}\left\{\partial_y\right\}"}\right]$ (46)

Specify the LaTeX representations for the coframe [dx, dy, dz] on N.

 > Preferences("TeXFormList", N, ["\\alpha", "\\beta", "\\gamma"]);
 $\left[{"\alpha"}{,}{"\beta"}{,}{"\gamma"}\right]$ (47)

Define a vector X1 and a form alpha1 on M and convert to LaTeX.

 > ChangeFrame(M);
 ${N}$ (48)
 > X1 := evalDG(3*D_x - D_y + z*D_z);
 ${\mathrm{X1}}{≔}{3}{}{\mathrm{D_x}}{-}{\mathrm{D_y}}{+}{z}{}{\mathrm{D_z}}$ (49)
 > alpha1 := evalDG(y*dx - sin(z)*dy + (1/z)*dz);
 ${\mathrm{α1}}{≔}{y}{}{\mathrm{dx}}{-}\left({\mathrm{sin}}{}\left({z}\right){}{\mathrm{dy}}\right){+}{\left(\frac{{1}}{{z}}\right)}_{{}}{}{\mathrm{dz}}$ (50)
 > latex(X1);
 3\, \partial_x-\, \partial_y+z\, \partial_z
 > latex(alpha1);
 y\, dx-\sin \left( z \right) \, dy+{z}^{-1}\, d,z

Now LaTeX the same vector and form, but viewed as objects on N.

 > ChangeFrame(N);
 ${M}$ (51)
 > X2 := evalDG(3*D_x - D_y + z*D_z);
 ${\mathrm{X2}}{≔}{3}{}{\mathrm{D_x}}{-}{\mathrm{D_y}}{+}{z}{}{\mathrm{D_z}}$ (52)
 > alpha2 := evalDG(y*dx - sin(z)*dy + (1/z)*dz);
 ${\mathrm{α2}}{≔}{y}{}{\mathrm{dx}}{-}\left({\mathrm{sin}}{}\left({z}\right){}{\mathrm{dy}}\right){+}{\left(\frac{{1}}{{z}}\right)}_{{}}{}{\mathrm{dz}}$ (53)
 > latex(X2);
 3\, \frac{\partial\hfill}{\partial_x}-\, \frac{\partial\hfill}{\partial_y}+z\, \frac{\partial\hfill}{\partial_y}
 > latex(alpha2);
 y\, \alpha-\sin \left( z \right) \, \beta+{z}^{-1}\, \gamma

The TeXPrintOrder preference allows the user to specify the ordering of components in the TeX representation of a vector, differential form, or tensor.

 > ChangeFrame(M):
 > Preferences("TeXPrintOrder", [dy, dz, dx]);
 $\left[{}\right]$ (54)
 > latex(alpha1);
 -\sin \left( z \right) \, dy+{z}^{-1}\, d,z+y\, dx
 > TensorOrder := evalDG([dx &t dx, dy &t dy, dz &t dz, dx &t dy, dx &t dz, dy &t dz]);
 ${\mathrm{TensorOrder}}{≔}\left[{\mathrm{dx}}{}{\mathrm{dx}}{,}{\mathrm{dy}}{}{\mathrm{dy}}{,}{\mathrm{dz}}{}{\mathrm{dz}}{,}{\mathrm{dx}}{}{\mathrm{dy}}{,}{\mathrm{dx}}{}{\mathrm{dz}}{,}{\mathrm{dy}}{}{\mathrm{dz}}\right]$ (55)
 > Preferences("TeXPrintOrder", TensorOrder);
 $\left[\left[{2}\right]{,}\left[{3}\right]{,}\left[{1}\right]\right]$ (56)
 > T := evalDG(dx &t dy + dy &t dy);
 ${T}{≔}{\mathrm{dx}}{}{\mathrm{dy}}{+}{\mathrm{dy}}{}{\mathrm{dy}}$ (57)
 > latex(T);
 \,dy\, dy+\,dx\, dy

To LaTeX a vector or a form the TeXPrintOrder preference must now be reset.  Often, the user may wish to insert the latex output into a LaTeX alignment environment.  With the TeXLineBreak preference, a carriage return \' and alignment character & can be automatically placed.after any number of components.

 > Preferences("TeXLineBreak", [1]);
 $\left[{8}\right]$ (58)
 > latex(X1);
 3\, \partial_x\\&-\, \partial_y+z\, \partial_z
 > Preferences("TeXLineBreak", [1, 2]);
 $\left[{1}\right]$ (59)
 > latex(X1);
 3\, \partial_x\\&-\, \partial_y\\&+z\, \partial_z

"WedgeDisplay"

The preference WedgeDisplay controls how the wedge product of differential forms is displayed in Maple output.  If this preference is 0, no symbol is printed; if this preference is 1, a '^' is printed; and if the preference is 2, then '&w' is printed.  The default WedgeDisplay preference is 1.

 > with(DifferentialGeometry):
 > DGsetup([x, y, z], M):
 ${\mathrm{The following coordinates have been protected:}}$
 $\left[{x}{,}{y}{,}{z}\right]$
 ${\mathrm{The following vector fields have been defined and protected:}}$
 $\left[{\mathrm{D_x}}{,}{\mathrm{D_y}}{,}{\mathrm{D_z}}\right]$
 ${\mathrm{The following differential 1-forms have been defined and protected:}}$
 $\left[{\mathrm{dx}}{,}{\mathrm{dy}}{,}{\mathrm{dz}}\right]$ (60)
 > alpha := evalDG(2*dx &w dy - dy &w dz);
 ${\mathrm{α}}{≔}\left({2}{}{\mathrm{dx}}\right){}{\bigwedge }{}{\mathrm{dy}}{-}\left({\mathrm{dy}}{}{\bigwedge }{}{\mathrm{dz}}\right)$ (61)
 > Preferences("WedgeDisplay", 0);
 ${1}$ (62)
 > alpha;
 $\left({2}{}{\mathrm{dx}}\right){}{\mathrm{dy}}{-}\left({\mathrm{dy}}{}{\mathrm{dz}}\right)$ (63)
 > Preferences("WedgeDisplay", 2);
 ${0}$ (64)
 > alpha;
 $\left({2}{}{\mathrm{dx}}\right){}{\mathrm{&w}}{}{\mathrm{dy}}{-}\left({\mathrm{dy}}{}{\mathrm{&w}}{}{\mathrm{dz}}\right)$ (65)

"dsolve", "nullspace","pdsolve", "rref", "simplification", "solve"

These preferences allow the user to customize the procedures which will be used with DifferentialGeometry programs for dsolve, LinearAlgebra:-Nullspace, pdsolve, LinearAlgebra:-ReducedRowEchelonForm, simplify, and solve. Here is a simple example.

 > with(DifferentialGeometry):
 > DGsetup([x], M);
 ${\mathrm{The following coordinates have been protected:}}$
 $\left[{x}\right]$
 ${\mathrm{The following vector fields have been defined and protected:}}$
 $\left[{\mathrm{D_x}}\right]$
 ${\mathrm{The following differential 1-forms have been defined and protected:}}$
 $\left[{\mathrm{dx}}\right]$
 ${\mathrm{frame name: M}}$ (66)
 > ExteriorDerivative(sqrt(x^2));
 ${\mathrm{csgn}}{}\left({x}\right){}{\mathrm{dx}}$ (67)

To obtain the simpler result dx, we can change the simplification command used by the DifferentialGeometry package.  Call the new simplification command MySimplify and pass this procedure name to the Preferences. Then rerun the ExteriorDerivative command.

 > MySimplify := x -> simplify(x, symbolic);
 ${\mathrm{MySimplify}}{≔}{x}{→}{\mathrm{simplify}}{}\left({x}{,}{\mathrm{symbolic}}\right)$ (68)
 > Preferences("simplification", MySimplify);
 ${\mathbf{proc}}\left({s}{,}\left\{{\mathrm{applysimplifysize}}{≔}{\mathrm{evalb}}{}\left({\mathrm{kernelopts}}{}\left({'}{\mathrm{level}}{'}\right){<}{41}\right)\right\}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (69)
 > ExteriorDerivative(sqrt(x^2));
 ${\mathrm{dx}}$ (70)
 M    >


text:
# zbMATH — the first resource for mathematics

Regular elements of the semigroup of all binary relations. (English) Zbl 0355.20058

##### MSC:
 20M05 Free semigroups, generators and relations, word problems 20M99 Semigroups 03E20 Other classical set theory (including functions, relations, and set algebra) 08A05 Structure theory of algebraic structures 05B20 Combinatorial aspects of matrices (incidence, Hadamard, etc.) 05C20 Directed graphs (digraphs), tournaments
Full Text:
##### References:
 [1] ЭapeшклЛ, K. A.,Peгулярныe eмeнтыпoлугрппы {$$\sigma$$}инaрныxoтнoшeний, Спeхи MaтeмaтичeсКих Hayк 17 (1962), 177–179. [2] ЭapeшкиИ, K. A.,Плучруппa {$$\sigma$$}инaрныхoтнoшeний, Maтeмaтичecкий C{$$\sigma$$}oрник 61 (1963), 291–305 [3] Yang, Jaw-Ching,A theorem on the semigroup of binary relations, Proceedings of the American Mathematical Society 22 (1969), 134–135. · Zbl 0206.01403 [4] Wolk, E. S.,A characterization of partial order, Bulletin de l’Academie Polonaise des Sciences, Serie des Sciences Mathématiques, Astronomiques et Physiques 17 (1969), 207–208. · Zbl 0175.01202
This reference list is based on information provided by the publisher or from digital mathematics libraries. Its items are heuristically matched to zbMATH identifiers and may contain data conversion errors. It attempts to reflect the references listed in the original paper as accurately as possible without claiming the completeness or perfect precision of the matching.

format: plain


text:
How do you find the asymptotes for y = (3-4x )/( 6x + sqrt(4x^2-3x-5))?

Dec 6, 2016

Horizontal: $y = - \frac{2}{3}$. The graph is real for $\frac{- \sqrt{89} + 3}{8} \le x \le \frac{\sqrt{89} + 3}{8}$.

Explanation:

To make y real, $\frac{- \sqrt{89} + 3}{8} \le x \le \frac{\sqrt{89} + 3}{8}$.

$y = \frac{- 4 + \frac{3}{x}}{6 + \sqrt{4 - \frac{3}{x} - \frac{1}{x} ^ 2}} \to - \frac{2}{3}$, as $x \to \pm \infty$.

Look at the dead ends $x = \frac{3 \pm \sqrt{89}}{8} = 1.554 \mathmr{and} - 0.804$, nearly.

graph{y(6x+sqrt(4x^2-3x-5))+4x-3=0 [-5, 5, -2.5, 2.5]}


text:
## Using results from one code block in another org-mode

| categories: | tags: | View Comments

One really great feature in org-mode is you have many options to pass data between code-blocks. In this post we look at some of these options using emacs-lisp as the language. This runs in a session where you can keep variables in memory between blocks, and use them in subsequent blocks.

Here we set a variable to a value.

(setq some-variable 42)

42

Then later in another block we can use that variable:

(+ some-variable 1)

43

While you are in the session, some-variable can be used. If you want some mind-bending trouble, the emacs-lisp session is global, and you can access some-variable even in another buffer! Don't do that. When you close emacs this variable will disappear, and all that is left are the results from above.

There is another way to pass information from one block to another using named src blocks and variables in the block header. This allows you to pass data between blocks by name, and you will see later you can even access the results by name from other files.

## 1 :var

First, we give our src block a name like this:

#+name: block-1
#+BEGIN_SRC emacs-lisp
(current-time-string)
#+END_SRC

When we run this, the results will have a name too.

(current-time-string)

Tue Feb 12 08:19:23 2019

Now, we can use the named result as input to a new block using the :var header.

#+BEGIN_SRC emacs-lisp :var input=block-1
(format "We got %S in block-1" input)
#+END_SRC

When we run this block, emacs will run block-1 and put the output in to the variable input which we use inside the code block.

(format "We got %S in block-1" input)

We got "Tue Feb 12 08:20:44 2019" in block-1

Some things to note:

1. Every time you run this, block-1 gets rerun.
2. The results in this block are not the same as in block-1
3. The results in block-1 are not changed when you run the second block.

You may not want to rerun block-1 each time; maybe it is an expensive calculation, or maybe it should not be changed. You can prevent this behavior by using the :cache header.

## 2 :cache

If you specify :cache yes then org-mode should store a hash of the code block with the results, and if the code block hasn't changed then it should not run again.

#+name: block-2
#+BEGIN_SRC emacs-lisp :cache yes
(current-time-string)
#+END_SRC

(current-time-string)

Tue Feb 12 08:06:22 2019

Now, we use block-2 as input to a block, we see the output is the same as the output from block-2.

(format "We got %S in block-2" input)

We got "Tue Feb 12 08:06:22 2019" in block-2

Ok, but what if my results are too large to put in the buffer, or too complex for text? You still have some options.

## 3 :wrap

Suppose we generate some json in one block, and we want to use it in another block. We still want to see the json in the buffer as an intermediate result. We can wrap the output in a json block like this.

(require 'json)
(json-encode (("date" . ,(current-time-string))))

{"date":"Tue Feb 12 08:30:20 2019"}

Then, we can simply input that output into a new block.

(format "We got %S in json" input)

We got "{\"date\":\"Tue Feb 12 08:30:20 2019\"}
" in json

This admittedly still pretty simple, text-based data. It is probably not a good idea to do this with binary data.

Note you can refer to this result even in another org-file:

#+BEGIN_SRC emacs-lisp :var input=./2019-02-12.org:json
input
#+END_SRC

#+RESULTS:
: {"date":"Tue Feb 12 08:30:20 2019"}

## 4 :file

It may be that your data is too large to conveniently put into your org-file, or maybe it is binary data. No problem, just put it into an external file using the :file header. It looks like this:

#+name: block-3
#+BEGIN_SRC emacs-lisp :cache yes :file block-3
(require 'json)
(json-encode (("date" . ,(current-time-string))))
#+END_SRC

#+RESULTS[a14d376653bd8c40a0961ca95f21d8837dddec66]: block-3
[[file:block-3]]

Note that you have to provide a file name for this. Sometimes that is nice if you want a human recognizable file to send to someone, but it would also be nice if there was an automatic naming scheme, e.g. based on an sha-1 hash of the src block.

(require 'json)
(json-encode (("date" . ,(current-time-string))))

Now you can use other tools to check out the file. Here we can still use simple shell tools.

cat block-3

The output of block-3 is a file name:

input

/Users/jkitchin/Box Sync/kitchingroup/jkitchin/journal/2019/02/12/block-3

So you can use it in a new block to read the data in, and then do something new with it.

(with-temp-buffer
(insert-file-contents input)
(format "We got %S in block-3" (json-read-from-string (buffer-string))))

We got ((date . "Tue Feb 12 08:46:55 2019")) in block-3

## 5 "remote" data

The blocks do not have to be in order. If you want, you can put your blocks in an appendix, and then just have analysis blocks here that use them. That way, you can have short blocks here that are more readable, but longer, more complex blocks elsewhere that do not clutter your document.

(with-temp-buffer
(insert-file-contents input)
(format "We got %S in the appendix data" (json-read-from-string (buffer-string))))

We got "{\"date\":\"Tue Feb 12 09:11:12 2019\"}" in the appendix data

## 6 Manually saving data in files

Note you can also manually save data in a file, for example:

(require 'json)
(let ((f "block-4.json"))
(with-temp-file f
(prin1
(json-encode (("date" . ,(current-time-string))))
(current-buffer)))
f)

block-4.json

We put the filename as the last variable which is returned by the block, so that we don't have to manually type it later in the next block. You know, try not to repeat yourself…

This just shows we did write out to our file:

cat block-4.json

And we read the file in here, using the filename from block-4 as an input variable.

(with-temp-buffer
(insert-file-contents input)
(format "We got %S in block-4" (json-read-from-string (buffer-string))))

We got "{\"date\":\"Tue Feb 12 08:51:25 2019\"}" in block-4

## 7 An appendix for data

(require 'json)
(let ((f "appendix.json"))
(with-temp-file f
(prin1
(json-encode (("date" . ,(current-time-string))))
(current-buffer)))
f)

appendix.json

## 8 Caveats

Using org-mode like this is almost always finding the right tradeoffs in what is persistent, and where is it stored. Not all of the intermediate data/calculations are stored; if they are really cheap you can just run the code blocks again. If they are really small, i.e. easy for your to read in a few lines, you can store them in the document. If they are really large, you can store them in a file.

The beauty of having everything in an org-file is you have a single file that is easy to transport. When the files get too large though, it can become impractical, e.g. emacs may slow down if you try to put thousands of lines of xml data into the buffer. Then, you have to make some decisions about what to keep, where to keep it, and in what form to keep it.

For short projects where you only need a single compute session, having everything in memory may be fine. For longer projects, say one that is long enough you will close all the buffers, and possibly restart emacs in between working on it, then you have to make some decisions about what to save from each block so you can continue the work in the next session. Again, you have to decide what to save, where to save, and in what form.

Once you start saving data outside the org-file, it becomes less portable, or more tricky to move the file because you need to also move all the data files to keep it intact. I have explored a concept of making an org-archive in the past, where you get a list of all files linked in the org-file, but this so far has just been worked out for some small proof of concept ideas.

Not all languages are the same in org-mode. They do not all support sessions for example, and they may not all work like the examples here. The scimax iPython modifications do not behave like the examples above. That is probably due to bugs I have inadvertently introduced, and in the future I will try to make it work like emacs-lisp does above.

Overall, org-mode has one of the most flexible and powerful systems for passing and reusing data in documents I have ever seen. It is not perfect, and in such a powerful system there are many unexplored or lightly traveled corners that may have hazards in them. It still seems pretty promising though.

org-mode source

Org-mode version = 9.2.1

## Getting geo-tagged information from photos for blogging

| categories: | tags: | View Comments

I am kind of late to this game, but recently I turned on location services for the camera on my phone. That means the location of the photo is stored in the photo, and we can use that to create urls to the photo location in a map for example. While traveling, I thought this would be a good application for org-mode to add functionality to documents with photos in them, e.g. to be able to click on them to see where they are from, or to automate creation of html pages with links to maps, etc. In this post I explore some ways to achieve those ideas. What I would like is a custom org link that shows me a thumbnail of the image, and which exports to show the image in an html file with a link to a pin on Google maps.

So, let's dig in. Imagemagick provides an identify command that can extract the information stored in the images. Here we consider just the GPS information. I some pictures on a recent vacation, and one is unimaginatively named IMG_1759.JPG. Let's see where it was taken.

identify -verbose IMG_1759.JPG | grep GPS

 exif:GPSAltitude: 14426/387 exif:GPSAltitudeRef: 0 exif:GPSDateStamp: 2018:06:30 exif:GPSDestBearing: 11767/80 exif:GPSDestBearingRef: T exif:GPSImgDirection: 11767/80 exif:GPSImgDirectionRef: T exif:GPSInfo: 1632 exif:GPSLatitude: 22/1, 11/1, 614/100 exif:GPSLatitudeRef: N exif:GPSLongitude: 159/1, 40/1, 4512/100 exif:GPSLongitudeRef: W exif:GPSSpeed: 401/100 exif:GPSSpeedRef: K exif:GPSTimeStamp: 3/1, 44/1, 3900/100

The interpretation here is that I took that photo at latitude 22° 11' 6.14" N, and longitude 159° 40' 45.12" W. Evidently I was moving at 4.01 in some unit; I can confirm that I was at least moving, I was on a ship when I took that picture, and it was moving.

According to this you can make a url to a Google maps pin in satellite picture mode that looks like this: http://maps.google.com/maps?q=22 11 6.14N,159 40 45.12W&t=k. It doesn't seem possible to set the zoom in this url (at least setting the zoom doesn't do anything, and I didn't feel like trying all the other variations that are reported to sometimes work). I guess that is ok for now, it adds some suspense that you have to zoom out to see where the image is in some cases.

We need a little function to take an image file and generate that link. We have to do some algebra on the latitude and longitude which are stored as integers with a division operator. I am going to pipe this through an old unix utility called bc mostly because it is simple, and I won't have to parse it much. bc is a little archaic, you have to set the scale first, which tells it how many decimal places to output. The degrees and minutes are integers, so we will have to deal with that later.

echo "scale=2; 614/100" | bc

6.14

Here is our function. I filter out the lines with GPS in them into an a-list. Then, I grab out the specific quantities I want and construct the url. There is a little hackery since it appears the degrees and minutes should be integers in the url formulation used here, so I convert them to numbers and then take the floor. The function is a little longer than I thought, but it isn't too bad I guess. It is a little repetitious, but not enough to justify refactoring.

(defun iphoto-map-url (fname)
(let* ((gps-lines (-keep (lambda (line)
(when (s-contains? "GPS" line) (s-trim line)))
(process-lines "identify" "-verbose" fname)))
(gps-alist (mapcar (lambda (s) (s-split ": " s t))  gps-lines))
(latitude (mapcar
(lambda (s)
(s-trim (shell-command-to-string
(format "echo \"scale=2;%s\" | bc" s))))
(s-split "," (cadr (assoc "exif:GPSLatitude" gps-alist)))))
(longitude (mapcar
(lambda (s)
(s-trim
(shell-command-to-string
(format "echo \"scale=2;%s\" | bc" s))))
(s-split "," (cadr (assoc "exif:GPSLongitude" gps-alist)))))
(s-format "http://maps.google.com/maps?q=$0$1 $2$3,$4$5 $6$7&t=k"
'elt
(list
(floor (string-to-number (nth 0 latitude)))
(floor (string-to-number (nth 1 latitude)))
(nth 2 latitude)
latitude-ref
(floor (string-to-number (nth 0 longitude)))
(floor (string-to-number (nth 1 longitude)))
(nth 2 longitude)
longitude-ref))))

iphoto-map-url

Here is the function in action, making the url.

(iphoto-map-url "IMG_1759.JPG")

http://maps.google.com/maps?q=22 11 6.14N,159 40 45.12W&t=k

It is kind of slow, but that is because the identify shell command is kind of slow when you run it with the -verbose tag. Now, I would like the following things to happen when I publish it to html:

1. I want the image wrapped in an img tag inside a figure environment.
2. I want the image to by hyperlinked to its location in Google maps.

In the org file, I want a thumbnail overlay on it, so I can see the image while writing, and I want it to toggle like other images. I use an iPhone to take the photos, so we will call it an iphoto link.

Here is the html export function I will use. It is a little hacky that I hard code the width in at 300 pixels, but I didn't feel like figuring out how to get it from an #+attr_html line right now. It probably requires a filter function where you have access to the actual org-elements. I put the url to the image location in a figure caption here.

(defun iphoto-export (path desc backend)
(cond
((eq 'html backend)
(format "

%s

"
path
(format "
%s map
"
(or desc "")
(iphoto-map-url path))))))

iphoto-export

Ok, the last detail I want is to put an image overlay on my new link so I can see it. I want this to work with org-toggle-inline-images so I can turn the images on and off like regular image links with C-c C-x C-v. This function creates overlays as needed, and ties into the org-inline-image-overlays so they get deleted on toggling. We have to advise the display function to redraw these, which we clumsily do by restarting the org font-lock machinery which will redraw the thumbnails from the activate-func property of the links. I also hard code the thumbnail width in this function, when it could be moved out to a variable or attribute.

(defun iphoto-thumbnails (start end imgfile bracketp)
(unless bracketp
(when (and
;; it is an image
(org-string-match-p (image-file-name-regexp) imgfile)
;; and it exists
(f-exists? imgfile)
;; and there is no overlay here.
(not (ov-at start)))
(setq img (create-image (expand-file-name imgfile)
'imagemagick nil :width 300
:background "lightgray"))
(setq ov (make-overlay start end))
(overlay-put ov 'display img)
(overlay-put ov 'face 'default)
(overlay-put ov 'org-image-overlay t)
(overlay-put ov 'modification-hooks
(list
(lambda (&rest args)
(org-display-inline-remove-overlay ,ov t ,start ,end))))
(push ov org-inline-image-overlays))))

(defun iphoto-redraw-thumbnails (&rest args)
(org-restart-font-lock))

;; this redisplays these thumbnails on image toggling

Next, we define the link with a follow, export, tooltip and activate-func (which puts the overlay on).

(org-link-set-parameters
"iphoto"
:follow (lambda (path) (browse-url (iphoto-map-url path)))
:export 'iphoto-export
:help-echo "Click me to see where this photo is on a map."
:activate-func 'iphoto-thumbnails)

So finally, here is the mysterious image.

Now, in org-mode, I see the image in an overlay, and I can toggle it on and off. If I click on the image, it opens a browser to Google maps with a pin at the spot I took it. When I export it, it wraps the image in a
 tag, and puts a url in the caption to the map. If you click on it, and zoom out, you will see this is a picture of the Nāpali Coast on Kauai in Hawaii, and I was in fact out at sea when I took the picture. It was spectacular. Here is another one. This one is a little more obvious with the zoom. Here, I was on land. Since this link is bracketed, it does not show the overlay however in the org-file.

Overall, this was easier than I expected. It might be faster to outsource reading the exif data to some dedicate library, perhaps in python that would return everything you want in an easy to parse json data structure. The speed of computing the url is only annoying when you export or click on the links though.

I didn't build in any error handling, e.g. if you do this on a photo with no GPS data it will probably not handle it gracefully. I also haven't tested this on any other images, e.g. south of the equator, from other cameras, etc. I assume this exif data is pretty standard, but it is a wild world out there… It would still be nice to find a way to get a string representing the nearest known location somehow, that would help the caption be more useful.

There is one little footnote to speak of, and that is I had to do a little hackery to get this to work with my blog machinery. You can see what it is in the org-source, I buried it in a noexport subheading, because it isn't that interesting in the grand scheme of things. It was just necessary because I export these org-files to blogofile, which then builds the html pages, instead of just exporting them. The images have to be copied to a source directory, and paths changed in the html to point to them. See, boring stuff. Otherwise, the code above should be fine for regular org and html files! Now, my vacation is over so it is time to get back to work.

org-mode source

Org-mode version = 9.1.13

## Literate programming with python doctests

| categories: | tags: | View Comments

On the org-mode mailing list we had a nice discussion about using noweb and org-mode in literate programming. The results of that discussion were blogged about here. I thought of a different application of this for making doctests in Python functions. I have to confess I have never liked these because I have always thought they were a pain to write since you basically have to put code and results into a docstring. The ideas developed in the discussion above led me to think of a new way to write these that seems totally reasonable.

The idea is just to put noweb placeholders in the function docstring for the doctests. The placeholders will be expanded when you tangle the file, and they will get their contents from other src-blocks where you have written and run examples to test them.

This video might make the rest of this post easier to follow:

I will illustrate the idea using org-mode and the ob-ipython I have in scimax. The defaults of my ob-ipython setup are not useful for this example because it puts the execution count and mime types of output in the output. These are not observed in a REPL, and so we turn this off by setting these variables.

(setq ob-ipython-suppress-execution-count t
ob-ipython-show-mime-types nil)

Now, we make an example function that takes a single argument and returns one divided by that argument. This block is runnable, and the function is then defined in the jupyter kernel. The docstring contains several noweb references to doctest blocks we define later. For now, they don't do anything. See The noweb doctest block section for the block that is used to expand these. This block also has a tangle header which indicates the file to tangle the results to. When I run this block, it is sent to a Jupyter kernel and saved in memory for use in subsequent blocks.

Here is the block with no noweb expansion. Note that this is easier to read in the original org source than it is to read in the published blog format.

def func(a):
"""A function to divide one by a.

<<doctest("doctest-1")>>

<<doctest("doctest-2")>>

<<doctest("doctest-3")>>

Returns: 1 / a.
"""
return 1 / a

Now, we can write a series of named blocks that define various tests we might want to use as doctests. You can run these blocks here, and verify they are correct. Later, when we tangle the document, these will be incorporated into the tangled file in the docstring we defined above.

func(5) == 0.2

True

This next test will raise an Exception, and we just run it to make sure it does.

func(0)

ZeroDivisionErrorTraceback (most recent call last)
<ipython-input-6-ba0cd5a88f0a> in <module>()
----> 1 func(0)

<ipython-input-1-eafd354a3163> in func(a)
18     Returns: 1 / a.
19     """
---> 20     return 1 / a

ZeroDivisionError: division by zero

This is just a doctest with indentation to show how it is used.

for i in range(1, 4):
print(func(i))

1.0
0.5
0.3333333333333333

That concludes the examples I want incorporated into the doctests. Each one of these blocks has a name, which is used as an argument to the noweb references in the function docstring.

## 1 Add a way to run the tests

This is a common idiom to enable easy running of the doctests. This will get tangled out to the file.

if __name__ == "__main__":
import doctest
doctest.testmod()

## 2 Tangle the file

So far, the Python code we have written only exists in the org-file, and in memory. Tangling is the extraction of the code into a code file.

We run this command, which extracts the code blocks marked for tangling, and expands the noweb references in them.

(org-babel-tangle)

 test.py

Here is what we get:

def func(a):
"""A function to divide one by a.

>>> func(5) == 0.2
True

>>> func(0)
Traceback (most recent call last):
ZeroDivisionError: division by zero

>>> for i in range(1, 4):
...     print(func(i))
1.0
0.5
0.3333333333333333

Returns: 1 / a.
"""
return 1 / a

if __name__ == "__main__":
import doctest
doctest.testmod()

That looks like a reasonable python file. You can see the doctest blocks have been inserted into the docstring, as desired. The proof of course is that we can run these doctests, and use the python module. We show that next.

## 3 Run the tests

Now, we can check if the tests pass in a fresh run (i.e. not using the version stored in the jupyter kernel.) The standard way to run the doctests is like this:

python test.py -v

Well, that's it! It worked fine. Now we have a python file we can import and reuse, with some doctests that show how it works. For example, here it is in a small Python script.

from test import func
print(func(3))

0.3333333333333333

There are surely some caveats to keep in mind here. This was just a simple proof of concept idea that isn't tested beyond this example. I don't know how many complexities would arise from more complex doctests. But, it seems like a good idea to continue pursuing if you like using doctests, and like using org-mode and interactive/literate programming techniques.

It is definitely an interesting way to use noweb to build up better code files in my opinion.

## 4 The noweb doctest block

These blocks are used in the noweb expansions. Each block takes a variable which is the name of a block. This block grabs the body of the named src block and formats it as if it was in a REPL.

We also grab the results of the named block and format it for the doctest. We use a heuristic to detect Tracebacks and modify the output to be consistent with it. In that case we assume the relevant Traceback is on the last line.

Admittedly, this does some fragile feeling things, like trimming whitespace here and there to remove blank lines, and quoting quotes (which was not actually used in this example), and removing the ": " pieces of ob-ipython results. Probably other ways of running the src-blocks would not be that suitable for this.

(org-babel-goto-named-src-block name)
(let* ((src (s-trim-right (org-element-property :value (org-element-context))))
(src-lines (split-string src "\n"))
body result)
(setq body
(s-trim-right
(s-concat ">>> " (car src-lines) "\n"
(s-join "\n" (mapcar (lambda (s)
(concat "... " s))
(cdr src-lines))))))
;; now the results
(org-babel-goto-named-result name)
(let ((result (org-element-context)))
(setq result
(buffer-substring (org-element-property :contents-begin result)
(org-element-property :contents-end result))
(s-trim)
;; remove ": " from beginning of lines
(replace-regexp-in-string "^: *" "")
;; quote quotes
(replace-regexp-in-string "\\\"" "\\\\\"")))
(when (string-match "Traceback" result)
(setq result (format
"Traceback (most recent call last):\n%s"
(car (last (split-string result "\n"))))))
(concat body "\n" result)))

org-mode source

Org-mode version = 9.1.13

## Making it easier to extend the export of org-mode links with generic functions

| categories: | tags: | View Comments

I am a big fan of org-mode links. Lately, I have had a need to modify how some links are exported, e.g. defining new exports for different backends, or fine-tuning a particular backend. This can be difficult, depending on how the link was set up. Here is a typical setup I am used to using, where the different options for the backends are handled in a conditional statement in a single function. I will just use a link that just serves to illustrate the issues here. These links are just sytactic sugar for markup, they don't do anything else. We start with an example that just converts text to italic text for different backends like html or latex.

(defun italic-link-export (path desc backend)
(cond
((eq 'html backend)
(format "%s" path))
((eq 'latex backend)
(format "\\textit{%s}" path))
;; fall-through case for everything else
(t
path)))

(org-export-string-as "italic:text" 'html t)

text

(org-export-string-as "italic:text" 'latex t)

\textit{text}

This falls through though to the default case.

(require 'ox-md)
(org-export-string-as "italic:text" 'md t)

text

The point I want to make here is that this is not easy to extend as a user. You have to either modify the italic-link-export function, advise it, or monkey-patch it. None of these are especially nice.

I could define italic-link-export in a way that it retrieves the function to use from an alist or hash-table using the backend, but then you have to do two things to modify the behavior: define a backend specific function and register it in the lookup variable. It is also possible to just look up a function by a derived symbol, e.g. using fboundp, and then using funcall to execute it. This looks something like this:

;; a user definable function for exporting to latex
(format "\\textit{%s}" path))

;; generic export function that looks up functions or defaults to
"Run italic-link-export-BACKEND' if it exists, or return path."
(let ((func (intern-soft (format "italic-link-export-%s" backend))))
(if (fboundp func)
(funcall func path desc backend)
path)))

This has some indirection, but allows you to just define new functions to add new export backends, or replace single backend exports. It isn't bad, but there is room for improvement.

In this comment in org-ref, I saw a new opportunity to address this issue using generic functions in elisp! The idea is to define a generic function that handles the general export case, and then define additional functions for each specific backend based on the signature of the export function. I will switch to bold markup for this.

(cl-defgeneric bold-link-export (path desc backend)
"Generic function to export a bold link."
path)

;; this one runs when the backend is equal to html
(cl-defmethod bold-link-export ((path t) (desc t) (backend (eql html)))
(format "%s" path))

;; this one runs when the backend is equal to latex
(cl-defmethod bold-link-export ((path t) (desc t) (backend (eql latex)))
(format "\\textit{%s}" path))

Here it is in action:

(org-export-string-as "some bold:text" 'html t)

some text

(org-export-string-as "some bold:text" 'latex t)

This uses the generic function.

(require 'ox-md)
(org-export-string-as "some bold:text" 'md t)

some text

The syntax for defining the generic function is pretty similar to a regular function. The specific methods are a little different since they have to provide the specific "signature" that triggers each method. Here we only differentiate on the type of the backend. It is nice these are all separate functions though. It makes it trivial to add new ones, and less intrusive to replace in my opinion.

Generic functions have many other potential applications to replace functions that use lots of conditions to control flow, with a fall-through option at the end. You can learn more about them here: https://www.gnu.org/software/emacs/manual/html_node/elisp/Generic-Functions.html. There is a lot more to them than I have illustrated here.

org-mode source

Org-mode version = 9.1.13

## Adding keymaps to src blocks via org-font-lock-hook

| categories: | tags: | View Comments

I had an idea to use custom keymaps in src-blocks. For example, you could then use lispy directly in your org-files without entering org-special-edit, or the elpy key-bindings in python blocks. There are other solutions I have seen, e.g. polymode, that claim to do this. You might guess that if they worked, I would not be writing this! There was some nice discussion about this idea on the org-mode mailing list, and Nicolas Goaziou pointed out this might be accomplished with the org-font-lock-hook.

You can check out the video here:

It was relatively easy to figure out how to do this. Keymaps can be added to regions during font-lock, so I just had to hook into the org-mode font lock system with a function to find the src blocks and add the keymap as a text-property. That took three steps:

1. Define the keymaps to use. I use an a-list of (language . map) for this.
2. Define the font-lock function. This will add the keymap properties to src-blocks.
3. Define a minor mode to toggle this feature on and off.

Here is the definition of the keymaps. Generally I just copy the mode-map I want and then add some things to them. For example sometimes it is still a good idea to jump into the org-special-edit mode. For example, if you try to use a command in a Python block to send the buffer to the repl while in org-mode you are sure to get an error! You might also want to add the C-c C-e export command if you use that a lot. An alternative approach, of course, is to copy the org-map and add additional bindings to it. The choice is up to you.

(require 'lispy)
(require 'elpy)

(setq scimax-src-block-keymaps
(("ipython" . ,(let ((map (make-composed-keymap
(,elpy-mode-map ,python-mode-map ,pyvenv-mode-map)
org-mode-map)))
;; In org-mode I define RET so we f
(define-key map (kbd "<return>") 'newline)
(define-key map (kbd "C-c C-c") 'org-ctrl-c-ctrl-c)
map))
("python" . ,(let ((map (make-composed-keymap
(,elpy-mode-map ,python-mode-map ,pyvenv-mode-map)
org-mode-map)))
;; In org-mode I define RET so we f
(define-key map (kbd "<return>") 'newline)
(define-key map (kbd "C-c C-c") 'org-ctrl-c-ctrl-c)
map))
("emacs-lisp" . ,(let ((map (make-composed-keymap (,lispy-mode-map
,emacs-lisp-mode-map
,outline-minor-mode-map)
org-mode-map)))
(define-key map (kbd "C-c C-c") 'org-ctrl-c-ctrl-c)
map))))

Next we define the function that will apply the keymap to each src block. The keymaps are only applied when they are defined in the variable above. This function is derived from org-fontify-meta-lines-and-blocks-1.

(defun scimax-add-keymap-to-src-blocks (limit)
"Add keymaps to src-blocks defined in scimax-src-block-keymaps'."
(let ((case-fold-search t)
lang)
(while (re-search-forward org-babel-src-block-regexp limit t)
(let ((lang (match-string 2))
(beg (match-beginning 0))
(end (match-end 0)))
(if (assoc (org-no-properties lang) scimax-src-block-keymaps)
(progn
beg end (local-map ,(cdr (assoc
(org-no-properties lang)
scimax-src-block-keymaps))))
beg end (cursor-sensor-functions
((lambda (win prev-pos sym)
;; This simulates a mouse click and makes a menu change
(org-mouse-down-mouse nil)))))))))))

Here we create an advice to trick any functions that need to know the major mode. We only apply the spoof if we are in org-mode and in a src block though. Otherwise we call the original function. So far lispy–eval is the only function I have needed it for. This might be a general strategy though to do other things like narrow to the src-block, or even go into special edit mode temporarily if there are commands that require it.

(defun scimax-spoof-mode (orig-func &rest args)
"Advice function to spoof commands in org-mode src blocks.
It is for commands that depend on the major mode. One example is
lispy--eval'."
(if (org-in-src-block-p)
(let ((major-mode (intern (format "%s-mode" (first (org-babel-get-src-block-info))))))
(apply orig-func args))
(apply orig-func args)))

We define a minor mode so we can toggle this on and off. Here we add the function to the org-font-lock-hook and advise the lispy–eval function. I had to add the font-lock-function to the end of the org-font-lock hook for some reason, and also add local-map as an extra-managed property so it would be removed when we toggle it off.

(define-minor-mode scimax-src-keymap-mode
"Minor mode to add mode keymaps to src-blocks."
:init-value nil
(if scimax-src-keymap-mode
(progn
(cursor-sensor-mode +1))
(cursor-sensor-mode -1))
(font-lock-fontify-buffer))

(scimax-src-keymap-mode +1)))

That is it! I am pretty sure this is a good idea. It helps a lot when you are writing a lot of short code blocks and near equal amounts of text (like in this blog post). It also helps write the code since many things like indentation, parentheses, etc. are automatically handled. That is what I used to go into special-edit mode all the time for!

I have not used this long enough to know if it causes any other surprises. If you try it and find any, leave a comment!

## 1 Update

It turns out you can have the best of all the worlds by combining keymaps. The make-composed-keymap creates a new keymap that combines a keymaps and falls through to a parent keymap. So here we use that to combine several keymaps, falling through to org-mode. The only subtlety I have come across is that I remapped <return> in orgmode to scimax/org-return, and not all modes define it, so I redefine it in some places to just be newline. Also to keep C-c C-c for executing the block, I add that back too.

I use a few maps here, and some of them seem to just add menus that are only active when your cursor is in the block. Pretty handy!

(setq scimax-src-block-keymaps
(("ipython" . ,(let ((map (make-composed-keymap
(,elpy-mode-map ,python-mode-map ,pyvenv-mode-map)
org-mode-map)))
;; In org-mode I define RET so we f
(define-key map (kbd "<return>") 'newline)
(define-key map (kbd "C-c C-c") 'org-ctrl-c-ctrl-c)
map))
("python" . ,(let ((map (make-composed-keymap
(,elpy-mode-map ,python-mode-map ,pyvenv-mode-map)
org-mode-map)))
;; In org-mode I define RET so we f
(define-key map (kbd "<return>") 'newline)
(define-key map (kbd "C-c C-c") 'org-ctrl-c-ctrl-c)
map))
("emacs-lisp" . ,(let ((map (make-composed-keymap (,lispy-mode-map
,emacs-lisp-mode-map
,outline-minor-mode-map)
org-mode-map)))
(define-key map (kbd "C-c C-c") 'org-ctrl-c-ctrl-c)
map))))
`

## 2 Update #2

The previous version had some issues where it would only add a keymap to the first block. The code in this post now addresses that and uses cursor-sensor-functions to make sure we change key map on entering and leaving blocks. That might mean you need an emacs of at least version 25 to use this. I guess it will work with an earlier version, but the cursor-sensor-functions might get ignored. You might have to comment out the cursor-sensor-mode line

Thanks to those brave people alpha-testing this and helping refine the idea!


text:
# Can someone explain to me what the plus sign is before the variables in JavaScript?

JavascriptWeb DevelopmentObject Oriented Programming

The plus(+) sign before the variables defines that the variable you are going to use is a number variable.

In the below code, there is brief description about plus sign. Following is the code −

## Example

var firstValue="1000";
console.log("The data type of firstValue ="+typeof firstValues);
var secondValue=1000;
console.log("The data type of secondValue ="+typeof secondValue);
console.log("The data type of firstValue when + sign is used ="+typeof
+firstValue);
var output=+firstValue + secondValue;
console.log("Addition is="+output);

To run the above program, you need to use the following command −

node fileName.js.

## Output

Here, my file name is demo149.js. This will produce the following output −

PS C:\Users\Amit\JavaScript-code> node demo149.js
The data type of firstValue =string
The data type of secondValue =number
The data type of firstValue when + sign is used =number
Addition is=2000
Published on 11-Sep-2020 11:57:46


text:
# LOG#147. Path integral (II).

Are you gaussian? Are you normal?

My second post about the path integral will cover functional calculus, and some basic definitions, properties and formulae.

What is a functional? It is a gadget that produces a number! Numbers are cool! Functions are cool! Functionals mix both worlds.

Let me consider a space of functions, not necessarily a normed or metric space. For instance, you can take the space of continuous functions, the space of derivable (differentiable) functions, the space of integrable functions, more complex spaces like $L^2(R^n)$ (the space of squared integrable functions, and so on!

Definition 1. (Functional). A functional I is a map or correspondence between some (subset of) space and numbers. It is a “machine” that allows you to pick a number when some function is selected in some way. That is:

$I: F\longrightarrow \mathbb{R}(\mathbb{C})$

$f(x)\rightarrow I(f)=I(f(x))$

A functional I(f) can be consider a function with an infinite number of variables, the infinite set of values of the functions at every point. That is, a functional is some kind of $\infty-dim$ vector! Usually, nD vectors have only a finite number of components, i.e., they are nD arrays:

$u=u(x_1,x_2,...,x_n)$

Functionals are functions over $\infty D$ objects/arrays!

$f\sim (f_1,f_2,\ldots,f_n,\ldots)$

Example: a single indefinite integral IS a functional. That is,

$\displaystyle{I(f)=\int dx f(x)=\lim \sum_n f(x_n)\Delta x_n\sim I(f_1,f_2,\ldots)}$

This (quite general) definition bring us some issues. Usually we can NOT identify a space of functions with a countable (even infinite) set. For instance, through the existence of a countable basis as in a separable Hilbert space. However, usually practical advances can be done if we put suitable restrictions in the space of functions, which tame the potentially dangerous infinities. These restrictions can be:

1st. Fourier bounds and Fourier transformations, asking for periodicity in momentum space.

2nd. Fourier coefficients definiteness. That is, we require functions to be periodic to some extent.

3rd. Analytical functions. Taylor or Laurent coefficients. Asking a function to be analytic solves many ill-posed problems.

Most of the functionals of interest in Physics can be expanded in the following way:

$\displaystyle{I(f)=\sum_n\dfrac{1}{n!}\int dx_1dx_2\ldots dx_n F_n(x_1,\ldots,x_n)f(x_1)\cdots f(x_n)}$

where $F_n$ are normal functions of an increasing, finite, number of variables. This decomposition is “cluster-like” and it can be found in Quantum Field Theory (QFT) lots of times!

Exercise (for eager readers). Give additional examples of functionals. Post them here! 🙂

Other main concept we need to discuss is the notion of functional derivative. Mathematicians are weird people. They define and clasify derivatives! LOL Beyond the usual notions of derivatives (classical calculus), you find Gateaux derivatives, Fréchet derivatives, fractional derivatives, and many others. Here, I will not be focused on the features these specific derivatives have, and I am going to be deliberately ambiguous. In general, a derivative is ANY operation (operator) $\delta$ which satisfies the so-called Leibniz rule of product derivation. That is:

$\delta (ab)=(\delta a) b+ a(\delta b)$

Intuitively, the generic definition for the derivative of any map $a(x)$ can be written at formal level as a ratio:

$\dfrac{\delta a}{\delta x}\sim \dfrac{a(x)-a(y)}{x-y}$

whenever $\vert x-y\vert\sim 0$. However, the definition of an (useful) distance $\vert x\vert$ in a general space of functions is a non-trivial task in general.

Definition 2. Directional derivative. The directional derivative of the function I(f) along some function $\lambda (x)$ is defined as:

$\displaystyle{D_\lambda I(f)=\dfrac{\delta_\lambda I(f)}{\delta f}=\lim_{\varepsilon\rightarrow 0}\dfrac{I(f+\varepsilon \lambda)-I(f)}{\varepsilon}}$

The directional derivative in a product of functions, applying the previous formula  becomes

$D_\lambda (f(x_1)f(x_2))=\lambda (x_1)\lambda (x_2)+f(x_1)f(x_2)$

and similarly you can get formulae for the products of n functions. The functional derivative of I(f) is a special case of the directional derivative above: the functional derivative in the direction of the delta function $\lambda (x)=\delta (x-y)$. Please, note that this is “delicate” and “intricate” since delta functions are NOT proper functions but “distributions”. They only are meaningful when they are integrated out, just as functionals theirselves!

Definition 3. Functional derivative. The functional derivative of the functional I(f) with respect to f(y) is defined by the formal expression

$\displaystyle{\boxed{\dfrac{\delta I(f)}{\delta f(y)}=\lim_{\varepsilon\rightarrow 0}\dfrac{I(f+\varepsilon \delta (x-y))-I(f)}{\varepsilon}}}$

Exercise (for eager readers). What are the differences between Gateaux derivatives, Fréchet derivatives and the above functional derivative? Remark: axioms are important here.

Similarly, functional derivatives of higher order can be defined in a straightforward fashion. If the functional is given by an expression

$\displaystyle{I(f)=\sum_n \dfrac{1}{n!}\int dx_1\cdots dx_n F_n(x_1,\ldots,x_n)f(x_1)\cdots f(x_n)}$

$\displaystyle{\dfrac{\delta I(f)}{\delta f(x)}=\sum_{n=0}^\infty \int dx_1\cdots dx_n F_{n+1} (x,x_1,\ldots,x_n)f(x_1)\cdots f(x_n)}$

A list of simple examples about functional derivatives:

1) If $I(f)=\int_{-1}^1f(x)dx$, then

$\dfrac{\delta I(f)}{\delta f(y)}=1$, if $\vert y\vert <1$.

$\dfrac{\delta I(f)}{\delta f(y)}=0$, if $\vert y\vert > 1$.

$\dfrac{\delta I(f^2)}{\delta f(y)}=2f(y)\dfrac{\delta I(f)}{\delta f(y)}$.

2) If $I_z(f)=f(z)$, then

$\dfrac{ \delta I(f)}{\delta f(y)}=\dfrac{\delta f(z)}{\delta f(y)}=\delta (x-y)$

3) If $I(f)=\int dx f(x)g(x)$, with $g(x)$ a fixed function, then

$\dfrac{\delta I(f)}{\delta f(y)}=\int dz \delta (z-x) g(z)=g(y)$

4) If $I(f)=\exp\left[\int dx f(x)g(x)\right]$, then

$\dfrac{\delta I(f)}{\delta f(y)}=\dfrac{\delta\int fg}{\delta g(y)}\exp \int fg)=\int dz \delta (z-x)g(z)I(f)=g(y)I(f)$

Some extra properties:

A) Chain rule: if $I(F(f))$, where I, F are functionals, then

$\displaystyle{\dfrac{\delta I(f)}{\delta f(x)}=\int dy \dfrac{\delta I}{\delta F(y)}\dfrac{\delta F}{\delta f(x)}}$

B) Taylor expansion in functional spaces. We can prove and write, in terms of functional derivatives, that

$\displaystyle{I(f+g)=I(f)+\int dy\dfrac{\delta I}{\delta f(y)}g(y)+\dfrac{1}{2!}\int dy_0dy_1\dfrac{\delta^2I}{\delta f(y_0)\delta f(y_1)}g(y_0)g(y_1)+\ldots}$

Definition 4. Gaussian functionals. Given a linear operator A, strictly positive (or hermitic with inverse operator), and f(x) a real function (complex functions are also possible as “numbers”), a Gaussian functional is a functional with the following form

$\boxed{\displaystyle{G_A(f)=\exp \dfrac{1}{2}\int dx f(x)A^{-1}f(x)}}$

For any gaussian functional, we define the “two point” correlation function $C(x_1,x_2)$ as follows

$C(x_1,x_2)=\dfrac{\delta }{\delta f(x_1)}\dfrac{\delta}{\delta f(x_2)}G_A(f)\vert_{f=0}$

Exercise (for eager minds). For a given gaussian functional $G_A$, compute the 2-point correlation function above $C(x_1,x_2)$ in terms of A.

Gaussian integrals with a finite number of variables $x=(x_1,...,x_n)$ are relatively common and simple to calculate multiple integrals:

$\displaystyle{I(A,a)=\int dx_1\cdots dx_n\exp \left(-\dfrac{1}{2}\sum_{ij}x_iA_{ij}x_j+\sum_i a_ix_i\right)=\int dx \exp \left( -\dfrac{1}{2}xAx+a\cdot x\right)}$

and where A is a complex, symmetric matrix with eigenvalues $\lambda_i$, such as $\lambda_i$ are real with $Re(\lambda_i)\geq 0$ and $\lambda_i\neq 0$. The integral can be performed by usual procedures, and it provides

$I(A,a)=(2\pi)^{n/2}(\det A)^{-1/2}\exp \left(\dfrac{1}{2}aA^{-1}a\right)$

The multivariate gaussian distribution of zero mean, P(x), is defined to be

$P(x)=(2\pi)^{-n/2}(\det A)^{1/2}\exp \left(-\dfrac{1}{2}xAx\right)$

The mean value with respect to the gaussian distribution of any function $H(x)$ is defined as

$\langle H\rangle_P=\int dx P(x)H(x)$

We define the generating function $G_F$ of any multivariate distribution F as the function

$G_F(a)=\langle \exp (a\cdot x)\rangle_F$

where $a$ is any arbitrary constant vector. For the multivariate Gaussian distribution, we have, using its definition,

$\langle \exp (a\cdot x)\rangle=\exp \left(\dfrac{1}{2}aA^{-1}a\right)$

Note we take the normalization to be:

$\langle 1\rangle=\langle \exp (a\cdot x)\rangle\vert_{a=0}=1$

The moments of (any) distribution are defined as the mean values

$\langle x_k^n\rangle$

and, in general, the mean values $\langle x_1,\ldots,x_n\rangle$.

From the generating function of the distribution, we can get the moments of the distribution. We can write the following formulae

$\langle x_k\rangle=\dfrac{\partial}{\partial a_k}\langle \exp (a\cdot x)\rangle \vert_{a=0}=0$

In particular, we have

$C(k_1,k_2)=\langle x_1,x_2\rangle=\dfrac{\partial}{\partial a_k(1)}\dfrac{\partial}{\partial a_k(2)}\langle \exp (a\cdot x)\rangle\vert_{a=0}=(A^{-1})_{k(1)k(2)}$

The last expressions are very important. The covariance of the gaussian distribution $C(x_1,x_2)$ is given by the elements of the inverse matrix $A^{-1}$.

Theorem 1. Wick’s theorem. All the moments of higher order of a gaussian distribution are fully determined by the moments of order 1 and 2 (i.e., by the mean and the covariance!).

A) The moments of odd order are all zero.

B) For the moments of even order:

$\displaystyle{\langle x_k(1)\cdots x_k(n)\rangle=\dfrac{\partial}{\partial a_k(1)}\cdots \dfrac{\partial}{\partial a_k(n)}\langle \exp (a\cdot x)\rangle\vert_{a=0}=\sum_{pairs}\langle x_k(p1)x_k(p2)\rangle\cdots\langle x_k(p(n-1))x_k(p(n-2))\rangle}$

For example, as application of the theorem, for a gaussian distribution (with zero average/mean) we have:

$\langle x_i\rangle=0$

$\langle x_ix_jx_k\rangle=0$

$\langle x_1x_2x_3x_4\rangle=\langle x_1x_2\rangle+\langle x_1x_3\rangle \langle x_2x_4\rangle+\langle x_1x_4\rangle \langle x_2x_4\rangle$

The value of the gaussian integral was written to be

$I(A,a)_n)=(2\pi)^{n/2}(\det A)^{-1/2}\exp \left(\dfrac{1}{2}aA^{-1}a\right)$

In the limit of “infinite variables” (dimensions), we have

$\displaystyle{\lim_{n\rightarrow \infty} I(A,a)_n\sim \lim_{n\rightarrow \infty} (2\pi)^{n/2}(\det A)^{-1/2}\exp \left(\dfrac{1}{2}aA^{-1}a\right)\rightarrow \infty}$

We can consider the following ratios in order to get a finite result (remember that an infinite result has NO physical meaning!):

1) $\dfrac{ I(A,a)_n}{I(A,b)_n}=\exp \left(\dfrac{1}{2}aA^{-1}a-\dfrac{1}{2}bA^{-1}b\right)$

2) $\dfrac{I(A,a)_n}{I(A,0)_n}=\exp\left(\dfrac{1}{2}aA^{-1}a\right)$

3) $\dfrac{ I(A,a)_n}{I(B,a)_n}=\left(\det AB^{-1}\right)^{-1/2}\exp \left(\dfrac{1}{2}a(A^{-1}-B^{-1})a\right)$

A common feature of every “regularization” above is that they do NOT depend explicitly on the dimension “n”.They can be useful considering “limits” of expressions when $n\rightarrow \infty$.

Exercise (1). Define the determinant of an operator in formal way. Hint: consider it as an infinite matrix. The determinant of a matrix is the product of its eigenvalues.

Exercise (2). Define the inverse operator $G=A^{-1}$ of A. Hint: from the inverse of a (infinite) matrix with $AA^{-1}=1$, take $AG(x,y)=\delta (x-y)$ and solve it for G.

Exercise (3). Compute the action S of classical mechanics as a functional of the path $q(t)$ for a free particle and for a particle interacting with a potential V(x,t).

Exercise (4). Compute the action functional for the free particle, the harmonic oscillator potential and the Kepler/Newton-like potential.

See  you in my next Path Integral TSOR post!!!!

View ratings


text:
analogues of Cayley plane as homogenous spaces - MathOverflow most recent 30 from http://mathoverflow.net 2013-05-19T07:45:30Z http://mathoverflow.net/feeds/question/51157 http://www.creativecommons.org/licenses/by-nc/2.5/rdf http://mathoverflow.net/questions/51157/analogues-of-cayley-plane-as-homogenous-spaces analogues of Cayley plane as homogenous spaces robot 2011-01-04T20:40:39Z 2011-01-04T23:46:43Z
The Cayley projective plane $\mathbb{OP}^2$ can be defined as a homogenous space $\mathrm{F_4/Spin(9)}$, where $\mathrm{F_4}$ is the compact exceptional simple Lie group. The other possible approach is to define it as equivalence classes of (special) triples of octonions, define a Riemannian metric on it and prove that the group of isometries is compact Lie group of type $\mathrm{F_4}$. This is done in this article. There the authors study also other spaces similar to $\mathbb{OP}^2$, namely they consider the octionionic hyperbolic plane,the octonionic projective plane with indefinite signature and analogue of projective plane made up from split octonions.

My question is: What are the "homogeneous presentations" of these spaces?
 http://mathoverflow.net/questions/51157/analogues-of-cayley-plane-as-homogenous-spaces/51161#51161 Answer by José Figueroa-O'Farrill for analogues of Cayley plane as homogenous spaces José Figueroa-O'Farrill 2011-01-04T22:19:34Z 2011-01-04T22:19:34Z
Disclaimer: I have not read the paper, but I think that this what's going on.

There are three real forms of the complex simple Lie algebra of type $F_4$. Each such real form will have (real) Lie subalgebras whose complexification is $\mathfrak{so}(9;\mathbb{C})$. Each such pair gives rise to homogeneous 16-dimensional pseudoriemannian manifolds.

This construction certainly accounts for the octonionic projective plane and its noncompact dual, as for the octonionic hyperbolic plane. I have not worked out the other cases mentioned in the question.


text:
Sunday
January 25, 2015

# Homework Help: Chemistry

Posted by Hailey on Friday, September 7, 2012 at 6:47pm.

Suppose you have two 100- graduated cylinders. In each cylinder there is 37.0 of water. You also have two cubes: One is lead, and the other is aluminum. Each cube measures 1.2 on each side.After you carefully lower each cube into the water of its own cylinder, what will the new water level be in each of the cylinders? Assume that cubes are totally emerged in the water.
• Chemistry - DrBob222, Friday, September 7, 2012 at 8:22pm

The numbers need units.

Related Questions

Chemistry - Suppose you have two 100- graduated cylinders. In each cylinder ...
Chemistry - Suppose you have two 100-{\rm mL} graduated cylinders. In each ...
chemistry - Suppose you have two 100-{\rm mL} graduated cylinders. In each ...
Chemistry - Suppose you have two 100-mL graduated cylinders. In each cylinder ...
chem - Suppose you have two 100-mL graduated cylinders. In each cylinder there ...
chemistry - Suppose you have two 100-mL graduated cylinders. In each cylinder ...
Chemistry - Suppose you have two 100mL graduated cylinders. In each cylinder, ...
Chemistry - Suppose you have two 100mL graduated cylinders. In each cylinder, ...
chemistry - Suppose you have two 100mL graduated cylinders. In each cylinder, ...
chem - Suppose you have two 100mL graduated cylinders. In each cylinder, there ...

Members


text:
# MatrixExp[m, v] not always faster than MatrixExp[m].v

For non sparse matrix m, is MatrixExp[m, v] supposed to be faster than MatrixExp[m].v? This seems to be true only if m is purely real or imaginary.

Block[{n = 500},
v = RandomComplex[1. + I, n];
s = RandomReal[{-1., 1.}, {n, n}];
s1 = RandomComplex[1. + I, {n, n}];
]

MatrixExp[s].v; // AbsoluteTiming

{0.12628, Null}

MatrixExp[s, v]; // AbsoluteTiming

{0.0379219, Null}

MatrixExp[s1].v; // AbsoluteTiming

{0.365637, Null}

MatrixExp[s1, v]; // AbsoluteTiming

{5.17002, Null}

MatrixExp[s1, v, Method -> "Krylov"]; // AbsoluteTiming

{4.93712, Null}

MatrixExp[s1, v, Method -> "Pade"]; // AbsoluteTiming

{0.416058, Null}

• I can't reproduce that. Try quitting kernel between calculations. I'm getting MatrixExp[s1, v]; // AbsoluteTiming{5.*10^-6, Null} – Feyre Jul 27 '16 at 21:18
• @Feyre Hi, I tried quitting kernels between calculations and got the same results. What version of Mathematica are you using? – user64620 Jul 27 '16 at 21:35
• Curious, now I'm getting slow results too. – Feyre Jul 27 '16 at 21:49
• I'm voting to close because I cannot reproduce the issue. If others manage to reproduce this reliably then I'm happy to take back that vote. – Daniel Lichtblau Jul 27 '16 at 23:11
• I get very similar results to what the OP shows running his code on V10.4.1 on OS X 10.10.2. – m_goldberg Jul 28 '16 at 0:20

Mr.Wizard

Timing results in Mathematica 10.1.0 under Windows 7 x64:

{0.0660777, Null}

{0.0303608, Null}

{0.190943, Null}

{1.46382, Null}

{1.41635, Null}

{0.183233, Null}

So I confirm MatrixExp[s1, v] and MatrixExp[s1, v, Method -> "Krylov"] as being slower on my system.

Alexey Popkov

Timing results with Mathematica 10.4.1 under Windows 7 x64 (CPU with 2 physical cores):

{1.26094, Null}

{0.638639, Null}

{1.26434, Null}

{19.7368, Null}

{18.708, Null}

{1.89468, Null}

Mariusz Iwaniuk

Timing results with Mathematica 10.2.0 under Windows 8.1 x64 (CPU with 2 physical cores):

{1.03687, Null}

{0.128066, Null}

{3.9396, Null}

{21.1016, Null}

{21.0798, Null}

{3.95479, Null}

### ( Use this Community Wiki to share any other timing results of interest. )

• "Krylov" is really only good for large, sparse matrices, and mostly intended for use with the action form of the exponential on a vector. – J. M. will be back soon Jul 28 '16 at 1:28
• @J.M. One wonders then why MatrixExp[s1, v] seemingly defaults to this method on my system? – Mr.Wizard Jul 28 '16 at 1:32
• My point was that it is not fair to "Krylov" to be using a dense matrix as the argument; of course it will then be slow. Have you also tried Method -> "BlockDecomposition"? – J. M. will be back soon Jul 28 '16 at 1:40
• @J.M. BlockDecomposition is even slower when I tested it. The slowdown is also present for sparse matrix m. – user64620 Jul 28 '16 at 14:28
• @Alexey, can you confirm the OP's observations regarding "BlockDecomposition"? – J. M. will be back soon Aug 1 '16 at 6:48


text:
# Fourier transform of convolution for $L^2$ functions

If $f,g\in L^1(\mathbb{R})$, it is not hard to show by definition that $$(\hat{f\ast g)}(t)=\hat{f}(t)\hat{g}(t).$$ But what about if $f,g\in L^2(\mathbb{R})$? The Fourier transform on $L^2(\mathbb{R})$ is defined in as an extension of the Fourier transform in the Schwartz class. Then it's hard to work with the definition...

• You'll have to work with the Fourier transform on the space of tempered distributions since $f*g$ is an $L^\infty$ function. – Jose27 Dec 13 '13 at 7:40

For $f,g\in L^2$, the convolution $f*g$ belongs to $C_0(\mathbb R)$. Taking the Fourier transform of a $C_0$ function is problematic: such transforms are generally not functions, but merely distributions (as Jose27 points out).

It is better to work from right to left. The product $\hat f \hat g$ is in $L^1$. Apply the inverse Fourier transform to it (essentially same as Fourier transform, but with opposite sign in the exponential, and maybe different normalization). The result is a $C_0$ function. You want to show that this function is $f*g$.

Argue by density. For $f,g\in \mathcal S$ the result is known. The map $(f,g)\mapsto f*g$ is a continuous map from $L^2\times L^2$ into $C_0$. Also, $(f,g)\mapsto \hat f \hat g$ is continuous from $L^2\times L^2$ to $L^1$. The inverse Fourier transform is continuous from $L^1$ to $C_0$. The conclusion follows.

In the preceding paragraph, $C_0$ can be replaced by $L^\infty$ throughout (the norm is the same), saving you the trouble of proving that $f*g$ vanishes at infinity.

One might argue that this is only a partial argument.

I understand the question in the following way: 1) is $f \ast g$ well defined: Yes, certainly, and since an easy application of Cauchy-Schwartz yields $$\| f \ast g\|_\infty \leq \|f\|_2 \|g\|_2$$ we certainly have a bounded function. Since $$\| T_x(f \ast) g \|_\infty = \|(T_xf -f) \ast g\|_\infty \leq \|T_x f -f\|_2 \|g\|_2\to 0 \quad \mbox{for} \,\, |x| \to 0$$ because the shift is continuous in the $L^2$-norm (prove it for compactly supported continuous functions, then by density you get it for every $f \in L^2$) we find that $f \ast g$ is in fact uniformly contiuous. Using the density of compactly supported (continuous) fucntion in $L^2(R)$ once more and the fact that the convolution product of two such function is thus a compactly supported function implies that $f \ast g \in C^0(R)$, i.e. $$\lim_{x \to \infty} f \ast g (x) = 0 .$$

2) is the Fourier transform of $f \ast g$ defined (and there one has to say: only in the distributional setting, AND in this distributional setting there is an inverse to the Fourier transform, in the realm of tempered distributions!). This makes the (good) argument given above a (non-trivial) valid statement.


text:
Hi Guys
I have a problem with Spring integration developing a TeamCity plugin.

I'm using IntelliJ 12 Ultimate (build 123.139) and developing TeamCity plugin. I'm using Spring librabry that comes packed with TeamCity 7.1.3. (the one in TeamCity\webapps\ROOT\WEB-INF\lib). The librabry spring.jar is set as my dependency (in Project Structure -> Modules -> Dependencies) along with spring-webmvc.jar. When I'm trying to build the project I get this error:

java: C:\Dev\Projects\blahblah\src\main\java\foo\bar\FooBarController.java:13: cannot access org.springframework.beans.factory.Aware

The class org.springframework.beans.factory.Aware appears since Spring 3.x. The spring.jar that is bundled in TeamCity is old Spring 2.5.x and the only thing it has is BeanFactoryAware.

Something is not right and I cannot put a finger on it.
My FooBarController.java looks like this:

package foo.bar;

import jetbrains.buildServer.controllers.BaseController;
import jetbrains.buildServer.web.openapi.WebControllerManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.nio.charset.Charset;

public class FooBarController extends BaseController {

public FooBarController (WebControllerManager webControllerManager) {
logger.info("Registering new controller at URL");
webControllerManager.registerController(SYNC_CONTROLLER, this);
}

@Nullable
protected ModelAndView doHandle(@NotNull HttpServletRequest httpServletRequest, @NotNull HttpServletResponse httpServletResponse) throws Exception {
httpServletResponse.setStatus(HttpServletResponse.SC_OK);
httpServletResponse.setContentType("text/plain");
httpServletResponse.setCharacterEncoding("UTF-8");
httpServletResponse.getOutputStream().write("OK".getBytes(Charset.forName("UTF-8")));
return null;
}
}

Any help would be appriciated.

Greg

Could you zip and put online your project some place? This will be the easiest way to diagnose the cause. Thanks.

Hi Yann
I've zipped the project and attached to this post.

You will need Gradle 1.x, Java 1.6 and TeamCity (ideally the same that I have TC 7.1.3) on your machine to be able to set it up.

Instructions on setting it up:

• Unzip the files.
• Edit build.gradle file: set teamCityDistribution and  teamCityDataDir to your local TeamCity location. Setup repository (if you don't have local maven repo use mavenCentral(), like this:

repositories {

mavenCentral()

}

• From the command line run gradle idea . You should see output like this:

:ideaModule
:ideaProject
:ideaWorkspace
:idea

BUILD SUCCESSFUL

Enjoy your *.ipr file with IntelliJ.
It is possible you'll have to setup project level SDK once opened in IntelliJ.

Let me know if that works and how I can fix the issue.

Cheers, Greg

Attachment(s):
teamcity-crowd-integration.zip

I followed your steps but got stuck with some issues yet, so here's a couple of questions first:

- servlet-api.jar should not be in compile, but provided scope
- https://getsatisfaction.com/sonatype/topics/invalid_version_in_xmlschema_1_1_pom_xml XmlSchema 1.1 seems completely broken, for Atlassian stuff have to add Maven repo https://maven.atlassian.com/repository/public
- why do you generate "gradle idea" project files? did you try importing the build.gradle and let JetGradle plugin create/sync IDEA project from there?

Maybe other plugin authors shared their experience/setup with Gradle in TeamCity forum: http://devnet.jetbrains.com/community/teamcity ? Just a suggestion.

Hi Yann
It seems that IntelliJ Spring Integration plugin tries to use Spring 3.x despite the fact that dependency is for 2.5.6.
It also makes no difference if I use JetGradle plugin integration. Same issue.

What I was able to do is this:

• Follow the steps described by me in the previous post.
• Open the project, setup SDK.
• Try to compile, it will fail.
• Add Spring as a library. Point to a file from dependency (same as gradle).
• Try to compile. Still fails.
• Now, in Project Structure -> Libraries -> Spring a Change Version button appeared.
• Choose version 2.5.6 and move the Library on higher on a list of dependencies in Project Structure -> Modules -> Dependencies
• Now, Compile works!

Once the IDEA project and modules files are generated by Gradle when I start IntelliJ it detects Spring files. There is a way to configure which xml files to take, but it never asks about Spring version or which Spring jars to use.

Greg

Spring plugin will use whatever Spring library version is configured in your project, unless you tell it to download and create a new Spring library. Could you please double-check your Libraries in Project Structure and dependencies in your module for such duplicate Spring library?

When you generate with gradle idea, the only spring entries that are there are in *.iml file. Those are pointing to Spring in TeamCity distribution (which is 2.5.x).

<orderEntry type="module-library" exported="">
<library>
<CLASSES>
<root url="jar://$TeamCityDistribution$/webapps/ROOT/WEB-INF/lib/spring.jar!/" />
</CLASSES>
<SOURCES />
</library>
</orderEntry>

Once you open the project in IntelliJ the only new entry that appears is:

<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration>
<fileset id="fileset1" name="XML Application Context" removed="false">
<file>file://$MODULE_DIR$/src/test/resources/test-build-server-plugin-TeamCityCrowdIntegration.xml</file>
<file>file://$MODULE_DIR$/src/main/resources/build-server-plugin-TeamCityCrowdIntegration.xml</file>
<file>file://$MODULE_DIR$/src/spring-config.xml</file>
</fileset>
</configuration>
</facet>
</component>

Nothing else other than MODULE dependency is configured for Spring.

It looks like $TeamCityDistribution$/webapps/ROOT/WEB-INF/lib/spring.jar is ignored and IntelliJ falls into using whatever Spring version is default.
Greg

Ok, both config files look good indeed. Since I can't get your gradle build running here completely I can only second-guess, but is there a chance that from some other jar another Spring library is referenced or even re-packaged? IDEA will never attempt to use some default or create any such library unless told to do so, so it must be configured in your project somehow.

There is no other Spring references or repackeged classes. Also, there is no more traces of Spring config other than the one I posted in previouspost.

Let me know what Gradle stuff is not working for you?

Greg

This might be the underlying cause:
https://maven.atlassian.com/content/groups/public/com/atlassian/crowd/atlassian-crowd/2.5.3/atlassian-crowd-2.5.3.pom

From the POM it looks like Atlassian Crowd has a dependency to Spring Framework 3.1.2

Hm ...
It could be, however, generated *.iml file doesn't reference this version of Spring anywhere :/
Greg

I'm not familiar with gradle:idea target, but I'd guess it does not include/show transitive dependencies. So I guess this issue is now resolved (at least from a what-caused-this perspective)?

Hi Yann
Thanks for still trying to nail it.
I've attached the 3 files generated by gradle idea target.
There is no transitive dependencies for Spring 3.x. Have a look yourself.
Greg

Attachment(s):
intellij-files.zip

What I meant was the transitive dependency on Spring 3 comes from the fact that your code references crowd-classes which in turn need Spring 3.x in classpath to compile.The fact the gradle:idea does not resolve/include those dependencies is another issue.
At least that's what I think happens in your project (still can't get it up and running here).

The error I got when trying to import your project (http://youtrack.jetbrains.com/issue/IDEA-100968) is fixed in 12.1. Please try upcoming EAP.

Hi Yann
Thank you :)
Greg


text:
# Random graphs with few disjoint cycles

Kurauskas, V
McDiarmid, C

## Journal:

Combinatorics, Probability and Computing

## Last Updated:

2021-09-26T07:11:42.35+01:00

20

763-775

## abstract:

The classical Erd\H{o}s-P\'{o}sa theorem states that for each positive
integer k there is an f(k) such that, in each graph G which does not have k+1
disjoint cycles, there is a blocker of size at most f(k); that is, a set B of
at most f(k) vertices such that G-B has no cycles. We show that, amongst all
such graphs on vertex set {1,..,n}, all but an exponentially small proportion
have a blocker of size k. We also give further properties of a random graph
sampled uniformly from this class; concerning uniqueness of the blocker,
connectivity, chromatic number and clique number. A key step in the proof of
the main theorem is to show that there must be a blocker as in the
Erd\H{o}s-P\'{o}sa theorem with the extra `redundancy' property that B-v is
still a blocker for all but at most k vertices v in B.

102316


text:
Learn

Get Up And Start Walking

If you want something you never had, then do something you never did.

Nossrat Peseschkian


text:
###### Waste less time on Facebook — follow Brilliant.
×
Back to all chapters

# Differentiation Rules

These are the rules that explain how to take derivatives of any functions: from polynomials to trigonometric functions to logarithms.

# Differentiation - Quotient Rule

If $$f(x) = \frac{2x + 4}{3x + 7}$$, what is the value of $$f'(3)$$?

If $$f(x)=\frac{-9x}{x^2+5}$$, what is the value of $$f'(5)$$?

Let $$g(x)$$ be a differentiable function such that $$g(0)=2.$$ If $$\displaystyle f(x)=\frac{1}{xg(x)+6},$$ where what is the value of $$f'(0)?$$

Let $$g(x)$$ be a differentiable function such that $$g(x) \neq -7.$$ If $$f(x)=\frac{x}{7+g(x)}$$ and $$f'(0)=\frac{1}{14},$$ what is the value of $$g(0)?$$

If $$a$$ and $$b$$ are constants such that $$f(x)=\frac{ax+b}{x^2+x+1}$$ and $f'(0)=-3, \; f'(-1)=10,$ what is $$2a+b?$$

×