text:
### Which major figure in the civil rights movement wrote "The Negro as an American"? A. Thurgood Marshall B. Robert C. Weaver C. Martin Luther King Jr. D. James Baldwin

Which major figure in the civil rights movement wrote "The Negro as an American"? A. Thurgood Marshall B. Robert C. Weaver C. Martin Luther King Jr. D. James Baldwin...

### 2x+1<9 I need help with this question

2x+1<9 I need help with this question...

### Select the correct answer from the drop-down menu. One of the fundamental ideas of the Constitution is _____ , which says that the power of the government is held by the people. Options Limited government Popular sovereignty Federalism Republicanism

Select the correct answer from the drop-down menu. One of the fundamental ideas of the Constitution is _____ , which says that the power of the government is held by the people. Options Limited government Popular sovereignty Federalism Republicanism...

### How has Switzerland's geography affected them during past wars?

How has Switzerland's geography affected them during past wars?...

### Barbie used to be considered a very sexist toy brand, so it started to make Barbie dolls that had jobs like astronaut, scientist, and businesswoman. Barbie was addressing changes associated with A. Demographics B. The economic situation C. Health and wellness D. The political environment

Barbie used to be considered a very sexist toy brand, so it started to make Barbie dolls that had jobs like astronaut, scientist, and businesswoman. Barbie was addressing changes associated with A. Demographics B. The economic situation C. Health and wellness D. The political environment...

### Megabrics Inc., a truck manufacturing company, installed windmills to generate power for its manufacturing plant. Almost 45% of the power used by the plant is generated by the windmills. In the given scenario, the step taken by Megabrics Inc. most likely exemplifies a(n) _____.

Megabrics Inc., a truck manufacturing company, installed windmills to generate power for its manufacturing plant. Almost 45% of the power used by the plant is generated by the windmills. In the given scenario, the step taken by Megabrics Inc. most likely exemplifies a(n) _____....

### 7 45° x y y= √ help needed ?

7 45° x y y= √ help needed ?...

### All of the organisms in the domain Archaea are A. prokaryotes B. eukaryotes C. autotrophs D. multicellular

All of the organisms in the domain Archaea are A. prokaryotes B. eukaryotes C. autotrophs D. multicellular...

### Factor the following equations to find the zeros of the equation. j=(p−4)(p+5)(p−3) -4, 5, -3 -4, -5, -3 4, -5, 3 -4, -5, 3

Factor the following equations to find the zeros of the equation. j=(p−4)(p+5)(p−3) -4, 5, -3 -4, -5, -3 4, -5, 3 -4, -5, 3...

### Name the image of C after a rotation of 180° about the origin.

Name the image of C after a rotation of 180° about the origin....

### Graph a system of two equations that has a single solution of -2,-3

Graph a system of two equations that has a single solution of -2,-3...

### Right the equation of the line in Slope-intercept form that passes the given points: (0,3),(4,6)

Right the equation of the line in Slope-intercept form that passes the given points: (0,3),(4,6)...

### WILL MARK BRAINLIEST!! PLEASE HELP ASAP. 1. If a scooter travels 36 miles on just 3 gallons of gas, how far will it travel on 16 gallons of gas? 2. A babysitter earns $28.50 for 2 hours of work. If she gets paid$99.75, then how many hours did she work? 3. A moose travels 4.5 kilometers in 5 hours. How far will it travel in 60 hours? 4. If 3 cm. of silver chain costs $9.60, then how much chain will$22.40 buy? 5. If a train ticket costs $145.50 to travel 50 miles, how far will$552.90 allow you

WILL MARK BRAINLIEST!! PLEASE HELP ASAP. 1. If a scooter travels 36 miles on just 3 gallons of gas, how far will it travel on 16 gallons of gas? 2. A babysitter earns $28.50 for 2 hours of work. If she gets paid$99.75, then how many hours did she work? 3. A moose travels 4.5 kilometers in 5 hours. ...

### Find the prime factor of 2525

Find the prime factor of 2525...

### Use distributive property to write each expression as an equivalent expression. 3/4 (s + 8)

Use distributive property to write each expression as an equivalent expression. 3/4 (s + 8)...

### How can the two independent clauses below be combined to form a correct complete sentence? Check all that apply. Jonas has homework. It isn’t finished Jonas has homework, but it isn’t finished. Jonas has homework that isn’t finished. Jonas has homework, it isn’t finished. Jonas has homework; isn’t finished.

How can the two independent clauses below be combined to form a correct complete sentence? Check all that apply. Jonas has homework. It isn’t finished Jonas has homework, but it isn’t finished. Jonas has homework that isn’t finished. Jonas has homework, it isn’t finished. Jonas has homework;...

### What would w be equal to?

What would w be equal to?...

### To solve a system of inequalities you need to graph each inequality and see which points are in the overlap of the graph. TRUE OR FALSE

To solve a system of inequalities you need to graph each inequality and see which points are in the overlap of the graph. TRUE OR FALSE...


text:
# Basic electric force/field question I can't get

1. May 14, 2016

### Kuzon

1. The problem statement, all variables and given/known data
A particle has a charge of +1.7 μC and moves from point A to point B, a distance of 0.26 m. The particle experiences a constant electric force, and its motion is along the line of action of the force. The difference between the particle's electric potential energy at A and B is EPEA - EPEB = +8.1 x 10-4 J. (a) Find the magnitude of the electric force that acts on the particle. (b) Find the magnitude of the electric field that the particle experiences.

2. Relevant equations
F= qV/d

3. The attempt at a solution
What's wrong with this reasoning:
F = V/d and V=Ed so E=F/q=V/d
Therefore F=qV/d
substitute all those values into that formula to get the electrostatic force and it's wrong?

I also tried b) using E=kq/d^2 and that didn't work either! (I got 226331.3609 as the answer)

By the way, there are no rounding requirements or anything, only a 2% margin of error so it's not that.

2. May 14, 2016

### blue_leaf77

What you are given is $\Delta E_p$ which is equal to $q\Delta V$. By the way, what's the correct answer?

3. May 14, 2016

### Kuzon

Right so I tried going:
deltaE/q = deltaV
Then using F=(q*deltaV)/d to get the electrostatic force and I got the wrong answer again

4. May 14, 2016

### blue_leaf77

5. May 14, 2016

### Kuzon

I don't know sorry

6. May 14, 2016

### blue_leaf77

Then how did you know that your answer was wrong? Is it a homework given to you?

7. May 14, 2016

### Kuzon

It's this homework website and you get 5 attempts at getting the correct answer, it tells you when it is wrong but doesn't give you hints or the correct answer.

8. May 14, 2016

### Kuzon

9. May 14, 2016

### blue_leaf77

10. May 14, 2016

### Kuzon

I did it's in the OP. Do you know how to solve the question?

11. May 14, 2016

They give you the change in potential energy $\Delta W=F \cdot d=q V$. The change in voltage is often also referred to as the change in potential, but here they were quite specific that the particle experienced a change in its "potential energy", so that $\Delta W=q V$. (using $W$ here for energy to save the letter $E$ for the electric field. Notice also that $V$ stands for voltage in electrical problems, and only becomes energy when multiplied by the charge $q$.)

Last edited: May 14, 2016
12. May 14, 2016

### Staff: Mentor

You start with F=V/d and show that F=qV/d? Something is wrong there. The units on each side of F=V/d don't match, so it can't be right.

What value did you use for V?

13. May 14, 2016

format: plain


text:
# Math Help - expansion question

1. ## expansion question

How would this expression be expanded... 12+q(3p-5)

Since 12+q must happen before the multiplication of the expression in parenthisis, i don't see how it can be expanded

thanks

2. Originally Posted by hurley485
Since 12+q must happen before the multiplication of the expression in parenthisis....
Actually, the order of operations specifies that the multiplication by the q must happen before the addition to the 12.

3. remember BODMAS for precedence

brackets
p(o)wers
division and multiplication


text:
# Number of circles within a circle

There are an infinite number of radii within any given circle, are there also an infinite number of circles within a circle as shown in the attached image ?

#### Attachments

• 2.1 KB Views: 270

Homework Helper
There are an infinite number of radii within any given circle, are there also an infinite number of circles within a circle as shown in the attached image ?
Given a radius R, there is an infinite number of 0 < r < R, so the answer is yes. I can't see the attachment though, but there is no way to display that. Non-formally speaking, you could be talking about a shaded disk of radius R, I guess.

#### berkeman

Mentor
There are an infinite number of radii within any given circle, are there also an infinite number of circles within a circle as shown in the attached image ?
Seems like an analogous question to "Are there an infinite number of discrete points between 0 and 1 on the number line?" Is there something special about the circle aspect of this question?

Given a radius R, there is an infinite number of 0 < r < R, so the answer is yes. I can't see the attachment though, but there is no way to display that. Non-formally speaking, you could be talking about a shaded disk of radius R, I guess.
I can see the attachment fine--are you still having problem ?

Seems like an analogous question to "Are there an infinite number of discrete points between 0 and 1 on the number line?" Is there something special about the circle aspect of this question?
Don't know, that is why I ask. Consider that 0 and 1 that serve as limits in your example are similar limits in that they are both integers, but in the circle example it is not clear to me that both limits are similar.

#### berkeman

Mentor
I can see the attachment fine--are you still having problem ?
It takes an average of a few minutes for the Staff and Mentors to see that there is an attachment awaiting approval. Once I saw it and approved it, everybody can see it. radou just viewed your post before I approved it.

And about the number line thing -- are you familiar with how limits work in a finite section of the number line? A related topic would be Zeno's (sp?) paradox, for example.

BTW, is this a homework problem? We should move it to the homework forums if it is.

#### Gib Z

Homework Helper
There are an infinite number of circles if the perimeter has "no" width and the distances between the radii are zero. ie A Shaded Disk.

There are an infinite number of circles if the perimeter has "no" width and the distances between the radii are zero. ie A Shaded Disk.
Neither of these constraints apply--see the figure in post #1--perimeter has width, not a shaded disk.

#### CRGreathouse

Homework Helper
Neither of these constraints apply--see the figure in post #1--perimeter has width, not a shaded disk.
I'm not entirely sure what you're saying, but if each of the 'circles' is actually an object with nonzero area (say, the set of all points within 0.001 units of a circle) then only finitely many can fit into the (large) circle without overlapping, since the area of a circle is finite.

#### Gib Z

Homework Helper
Neither of these constraints apply--see the figure in post #1--perimeter has width, not a shaded disk.
Well yes, thats why there isn't an infinite number of circles...

CRGreatHouse- The circles I specify for an infinite amount are not existent, just mathematical with the area between the circles zero.

I'm not entirely sure what you're saying, but if each of the 'circles' is actually an object with nonzero area (say, the set of all points within 0.001 units of a circle) then only finitely many can fit into the (large) circle without overlapping, since the area of a circle is finite.
OK, but there would be an infinite number if the perimeter of added circles "has no width"--in the same way that there are an infinite number of radii (without width) in a circle--correct ?

#### CRGreathouse

Homework Helper
OK, but there would be an infinite number if the perimeter of added circles "has no width"--in the same way that there are an infinite number of radii (without width) in a circle--correct ?
Yes, certainly. There's a circle for every real number between 0 and the outer radius.

#### bomba923

OK, but there would be an infinite number if the perimeter of added circles "has no width"--in the same way that there are an infinite number of radii (without width) in a circle--correct ?
A disk of some radius R≥0 can be thought of as {(x,y) : 0≤x2+y2≤R2}

A circle with a radius r≥0 can be thought of as {(x,y) : x2+y2=r2}

As you can see,
$$\left\{ {\left( {x,y} \right):x^2 + y^2 = r^2 } \right\} \subset \left\{ {\left( {x,y} \right):0 \leqslant x^2 + y^2 \leqslant R^2 } \right\}{\text{ if }}0 \leqslant r \leqslant R$$

If R>0, there is an infinite quantity of distinct r that satisfy 0≤r≤R;
thus, there is an infinite quantity of distinct circles within a disk of radius R>0.

Last edited:


text:
# Getting Started With RAJA¶

This section should help get you up and running with RAJA quickly.

## Requirements¶

The primary requirement for using RAJA is a C++14 standard compliant compiler. Certain features, such as various programming model back-ends like CUDA or HIP, msut be supported by the compiler you chose to use them. Available RAJA configuration options and how to enable or disable features are described in Build Configuration Options.

To build RAJA and use its most basic features, you will need:

• C++ compiler with C++14 support
• CMake version 3.23 or greater when building the HIP back-end, and version 3.20 or greater otherwise.

## Get the Code¶

The RAJA project is hosted on GitHub: GitHub RAJA project. To get the code, clone the repository into a local working space using the command:

$git clone --recursive https://github.com/LLNL/RAJA.git  The --recursive option above is used to pull RAJA Git submodules, on which RAJA depends, into your local copy of the RAJA repository. After running the clone command, a copy of the RAJA repository will reside in the RAJA subdirectory where you ran the clone command. You will be on the develop branch, which is the default RAJA branch. If you do not pass the --recursive argument to the git clone command, you can also type the following commands after cloning: $ cd RAJA
$git submodule update --init --recursive  Either way, the end result is the same and you should be good to configure the code and build it. Note • If you switch branches in a RAJA repo (e.g., you are on a branch, with everything up-to-date, and you run the command git checkout <different branch name>, you may need to run the command git submodule update to set the Git submodule versions to what is used by the new branch. • If the set of submodules in a new branch is different than the previous branch you were on, you may need to run the command git submodule update --init --recursive to pull in the correct set of submodule and versions. ## Dependencies¶ RAJA has several dependencies that are required based on how you want to build and use it. The RAJA Git repository has submodules that contain most of these dependencies. RAJA includes other submodule dependencies, which are used to support our Gitlab CI testing. These are described in the RAJA Developer Guide. Dependencies that are required to build the RAJA code are: Other dependencies that users should be aware of that support certain features are: • CUB CUDA utilities library, which is required for using the RAJA CUDA back-end. • rocPRIM HIP parallel primitives library, which is required for using the RAJA HIP back-end. • Desul, which is required if you want to use Desul atomics in RAJA instead of our current default atomics. Note that we plan to switch over to Desul atomics exclusively at some point. Note You may want or need to use external versions of camp, CUB, or rocPRIM instead of the RAJA submodules. This is usually the case when you are using RAJA along with some other library that also needs one of these. To do so, you need to use CMake variables to pass a path to a valid installation of each library. Specifically: • External camp: cmake \ ... \ -Dcamp_DIR=path/to/camp/install \ ...  • External CUB: cmake \ ... \ -DRAJA_ENABLE_EXTERNAL_CUB=On \ -DCUB_DIR=path/to/cub \ ...  • External rocPRIM: cmake \ ... \ -DRAJA_ENABLE_EXTERNAL_ROCPRIM=On \ -DROCPRIM_DIR=path/to/rocPRIM \ ...  More information about configuring GPU builds with CUDA or HIP is provided in Additional RAJA Back-end Build Information Additional discussion of these dependencies, with respect to building RAJA, is provided in Build and Install. Other than that, you probably don’t need to know much about them. If you are curious and want to know more, please click on the link to the library you want to know about in the above list. ## Build and Install¶ The complexity of building and installing RAJA depends on which features you want to use and how easy it is to do this on your system. Note RAJA builds must be out-of-source. In particular, RAJA does not allow building in its source directory. You must create a build directory and run CMake in it. RAJA uses CMake to configure a build. To create a “bare bones” configuration, build, and install it, you can do the following: $ mkdir build-dir && cd build-dir
$cmake -DCMAKE_INSTALL_PREFIX=/path/to/install ../$ make  (or make -j <N> for a parallel build)
$make install  Running cmake generates the RAJA build configuration. Running make compiles the code. Running make install copies RAJA header files to an include directory and installs the RAJA library in a lib directory, both in the directory location specified with the -DCMAKE_INSTALL_PREFIX CMake option. Other build configurations are accomplished by passing other options to CMake. For example, if you want to use a C++ compiler other than the default on your system, you would pass a path to the compiler using the standard CMake option -DCMAKE_CXX_COMPILER=path/to/compiler. When you run CMake, it will generate output about the build configuration (compiler and version, options, etc.), which is helpful to make sure CMake is doing what you want. For a summary of RAJA configuration options, please see Build Configuration Options. Note RAJA is configured to build its tests, examples, and tutorial exercises by default. If you do not disable them with the appropriate CMake option (see Build Configuration Options), you can run them after the build completes to check if everything is built properly. The easiest way to run the full set of RAJA tests is to type: $ make test

in the build directory after the build completes.

You can also run individual tests by invoking the corresponding test executables directly. They will be located in the test subdirectory in your build space. RAJA tests use the Google Test framework, so you can also run and filter tests via Google Test commands.

The source files for RAJA examples and exercises are located in the RAJA/examples and RAJA/exercises directories, respectively. When built, the executables for the examples and exercises will be located in the bin subdirectory in your build space.

### Additional RAJA Back-end Build Information¶

Configuring a RAJA build to support a GPU back-end, such as CUDA, HIP, or OpenMP target offload, typically requires additional CMake options, which we describe next.

#### CUDA¶

To run RAJA code on NVIDIA GPUs, one typically must have a CUDA compiler installed on the system, in addition to a host code compiler. You may need to specify both when you run CMake. The host compiler is specified using the CMAKE_CXX_COMPILER CMake variable as described earlier. The CUDA software stack and compiler are specified using the following CMake options:

• -DCUDA_TOOLKIT_ROOT_DIR=path/to/cuda/toolkit
• -DCMAKE_CUDA_COMPILER=path/to/nvcc

When using the NVIDIA nvcc compiler for RAJA CUDA functionality, the variables:

• CMAKE_CUDA_FLAGS_RELEASE
• CMAKE_CUDA_FLAGS_DEBUG
• CMAKE_CUDA_FLAGS_RELWITHDEBINFO

correspond to the standard CMake build types and are used to pass additional compiler options to nvcc.

Note

Often, nvcc must pass options to the host compiler, the arguments can be included using the CMAKE_CUDA_FLAGS... CMake variables listed above. Host compiler options must be prepended with the -Xcompiler directive to properly propagate.

To set the CUDA compute architecture, which should be chosen based on the NVIDIA GPU hardware you are using, you can use the CMAKE_CUDA_ARCHITECTURES CMake variable. For example, the CMake option -DCMAKE_CUDA_ARCHITECTURES=70 will tell the compiler to use the sm_70 SASS architecture in its second stage of compilation. The compiler will pick the PTX architecture to use in the first stage of compilation that is suitable for the SASS architecture you specify.

Alternatively, you may specify the PTX and SASS architectures, using appropriate nvcc options in the CMAKE_CUDA_FLAGS_* variables.

Note

RAJA requires a minimum CUDA architecture level of sm_35 to use all supported CUDA features. Mostly, the architecture level affects which RAJA CUDA atomic operations are available and how they are implemented inside RAJA. This is described in Atomic Operations.

• If you do not specify a value for CMAKE_CUDA_ARCHITECTURES, it will be set to 35 by default and CMake will emit a status message indicating this choice was made.
• If you give a CMAKE_CUDA_ARCHITECTURES value less than 35 (e.g., 30), CMake will report this as an error and stop processing.

Also, RAJA relies on the CUB CUDA utilities library, mentioned earlier, for some CUDA back-end functionality. The CUB version included in the CUDA toolkit installation is used by default when available. This is the case for CUDA version 11 and later. RAJA includes a CUB submodule that is used by default with older versions of CUDA. To use an external CUB installation, provide the following options to CMake:

cmake \
... \
-DRAJA_ENABLE_EXTERNAL_CUB=On \
-DCUB_DIR=<path/to/cub> \
...

Note

The CUDA toolkit version of CUB is required for compatibility with the CUDA toolkit version of thrust starting with CUDA version 11.0.0. So, if you build RAJA with CUDA version 11 or higher, you should use the version of CUB contained in the CUDA toolkit version you are using to use Thrust and to be compatible with libraries that use Thrust.

Note

The version of Googletest that is used in RAJA version v0.11.0 or newer requires CUDA version 9.2.x or newer when compiling with nvcc. Thus, if you build RAJA with CUDA enabled and want to also enable RAJA tests, you must use CUDA version 9.2.x or newer.

#### HIP¶

To run RAJA code on AMD GPUs, one typically uses a ROCm compiler and tool chain (which can also be used to compile code for NVIDIA GPUs, which is not covered in detail in RAJA user documentation).

Note

RAJA requires version 3.5 or newer of the ROCm software stack to use the RAJA HIP back-end.

Unlike CUDA, you do not specify a host compiler and a device compiler when using the AMD ROCm software stack. Typical CMake options to use when building with a ROCm stack are:

• -DROCM_ROOT_DIR=path/to/rocm
• -DHIP_ROOT_DIR=path/to/hip
• -DHIP_PATH=path/to/hip/binaries
• -DCMAKE_CXX_COMPILER=path/to/rocm/compiler

Additionally, you use the CMake variable CMAKE_HIP_ARCHITECTURES to set the target compute architecture. For example:

-DCMAKE_HIP_ARCHITECTURES=gfx908

RAJA relies on the rocPRIM HIP utilities library for some HIP functionality. The rocPRIM included in the ROCm install is used by default if available. RAJA includes a rocPRIM submodule that is used if it is not available. To use an external rocPRIM install provide the following options to CMake:

cmake \
... \
-DRAJA_ENABLE_EXTERNAL_ROCPRIM=On \
-DROCPRIM_DIR=<pat/to/rocPRIM> \
...

Note

When using HIP and targeting NVIDIA GPUs, RAJA uses CUB instead of rocPRIM. In this case, you must configure with an external CUB install using the CMake variables described in the CUDA section above.

#### OpenMP¶

To use OpenMP target offload GPU execution, additional options may need to be passed to the compiler. BLT variables are used for this. Option syntax follows the CMake list pattern. For example, to specify OpenMP target options for NVIDIA GPUs using a clang-based compiler, one may do something like:

cmake \
... \
-DBLT_OPENMP_COMPILE_FLAGS="-fopenmp;-fopenmp-targets=nvptx64-nvidia-cuda" \
...

Compiler flags are passed to other compilers similarly, using flags specific to the compiler. Typically, the compile and link flags are the same as shown here.

### RAJA Example Build Configuration Files¶

The RAJA repository has subdirectories RAJA/scripts/*-builds that contain a variety of build scripts we use to build and test RAJA on various platforms with various compilers. These scripts pass files (CMake cache files) located in the RAJA/host-configs directory to CMake using the ‘-C’ option. These files serve as useful examples of how to configure RAJA prior to compilation.

## Learning to Use RAJA¶

The RAJA repository contains a variety of example source codes that you are encouraged to view and run to learn about how to use RAJA:

• The RAJA/examples directory contains various examples that illustrate algorithm patterns.
• The RAJA/exercises directory contains exercises for users to work through along with complete solutions. These are described in detail in the RAJA Tutorial and Examples section.
• Other examples can also be found in the RAJA/test directories.

We mentioned earlier that RAJA examples, exercises, and tests are built by default when RAJA is compiled. So, unless you explicitly disable them when you run CMake to configure a RAJA build, you can run them after compiling RAJA. Executables for the examples and exercises will be located in the <build-dir>/bin directory in your build space. Test executables will be located in the <build-dir>/test directory.

For an overview of all the main RAJA features, see RAJA Features. A full tutorial with a variety of examples showing how to use RAJA features can be found in RAJA Tutorial and Examples.


text:
# Legendre transformation

The function $f(x)$ is defined on the interval $[a,b]$. The difference $px-f(x)$ takes a maximum at $x'$. The value of $f^*(p)$ is $px'-f(x')$.

In mathematics, the Legendre transformation or Legendre transform, named after Adrien-Marie Legendre, is an involutive transformation on the real-valued convex functions of one real variable. Its generalisation to convex functions of affine spaces is sometimes called the Legendre-Fenchel transformation. It is commonly used in thermodynamics and to derive the Hamiltonian formalism of classical mechanics out of the Lagrangian formulation.

## Definition

Specifically, let $I\subset\mathbb R$ be an interval, and $f:I\rightarrow \mathbb R$ a convex function; then its Legendre transform is the function

$f^*:I^*\rightarrow \mathbb R$

with domain of definition

$I^*=\{x^*:\sup_{x\in I}(x^*x-f(x))<\infty\}$

and action

$f^*(x^*) = \sup_{x\in I}\bigl(x^*x-f(x)\bigr),\quad x^*\in I^*$.

Here "sup" represents the supremum. $f^*$ is sometimes called the convex conjugate function of $f$.

The Legendre transformation is involutive, namely $I^*$ is an interval, $f^*$ is convex on it, so that its Legendre transform is well defined, and fulfils $f^{**}=f$ on $I\subset I^{**}$. Note that $I,I^{**}$ may differ at most on their boundaries.

For historical reasons (rooted in analytic mechanics), the conjugate variable is often denoted $p$, instead of $x^*$. If the convex function $f$ is defined on the whole line and is everywhere differentiable, then $f^*(p)=\sup_x(px-f(x))$ can be interpreted as the negative of the y-intercept of the tangent line to the graph of f that has slope p. In particular, the value of x that attains the maximum has the property that

$f^\prime(x) = p.$

That is, the derivative of the function f becomes the argument to the function f. In other words, f satisfies the functional equation

$f^*(f'(x)) = x f'(x) - f(x).$

The Legendre transformation is an application of the duality relationship between points and lines. The functional relationship specified by $x$ can be represented equally well as a set of $(x,y)$ points, or as a set of tangent lines specified by their slope and intercept values.

The generalization to convex functions $f:X\rightarrow \mathbb R$ of convex sets $X\subset\mathbb R^n$ is straightforward: $f^*:X^*\rightarrow \mathbb R$ has domain

$X^*=\{x^*:\sup_{x\in X}(\langle x^*,x\rangle-f(x)\}<\infty$

and action

$f^*(x^*) = \sup_{x\in X}\bigl(\langle x^*,x\rangle-f(x)\bigr),\quad x^*\in X^*$,

where $\langle x,y\rangle=\sum_jx_jy_j$ is the canonical inner product (scalar product) of $\mathbb R^n$.

## Examples

### Example N.1

Let $f(x)=cx^2$ defined on the whole $\mathbb R$, where $c>0$ is a fixed constant. For $x^*$ fixed, the function $x^*x-f(x)=x^*x-cx^2$ of $x$ has first derivative $x^*-2cx$ and second derivative$-2c$; there is one stationary point at $x=x^*/2c$, which is always a maximum. So $I^*=\mathbb R$ and $f^*(x^*)=c^*{x^*}^2,$ where $c^*=\frac{1}{4c}$. Clearly, $f^{**}(x)=\frac{1}{4c^*}x^2=cx^2$, namely $f^{**}=f$.

### Example N.2

Let $f(x)=x^2$ for $x\in I=[2,3]$. For $x^*$ fixed, $x^*x-f(x)$ is continuous on $I$ compact, hence it always takes a finite maximum on it; it follows that $I^*=\mathbb R$. The stationary point at $x=x^*/2$ is in the domain $[2,3]$ if and only if $4\leqslant x^*\leqslant 6$, otherwise the maximum is taken either at $x=2$ or $x=3$. We find $f^*(x^*)=\begin{cases}2x^*-4,\quad&x^*<4\\ \frac{{x^*}^2}{4},&4\leqslant x^*\leqslant 6,\\3x^*-9,&x^*>6\end{cases}$

### Example N.3

The function $f(x)=cx$ is convex, for every $x$ (strict convexity is not required for the Legendre transformation to be well defined). Clearly $x^*x-f(x)=(x^*-c)x$ is never upper-bounded as a function of $x$, unless $x^*-c=0$. Hence $f^*$ is defined on $I^*=\{c\}$ and $f^*(c)=0$. We may check involutivity: of course $xx^*-f^*(x^*)$ is always bounded as a "function" of $x^*\in\{c\}$, hence $I^{**}=\mathbb R$; then for every $x$ we have $\sup_{x^*\in\{c\}}(xx^*-f^*(x^*)=xc$ and thus $f^{**}(x)=cx=f(x)$.

### Example N.4 (many variables)

Let $f(x)=\langle x,Ax\rangle+c$ be defined on $X=\mathbb R^n$, where $A$ is a real, positive definite matrix. Then $f$ is convex. $\langle p,x\rangle-f(x)=\langle p,x \rangle-\langle x,Ax\rangle-c$ has gradient $p-2Ax$ and Hessian $-2A$ which is negative; hence the stationary point $x=A^{-1}p/2$ is a maximum. We have $X^*=\mathbb R^n$ and $f^*(p)=\frac14\langle p,A^{-1}p\rangle-c$

## An equivalent definition in the differentiable case

Equivalently two convex functions $f\,$ and $g$ defined on the whole line are said to be Legendre transforms of each other if their first derivatives are inverse functions of each other:

$Df = \left( Dg \right)^{-1},$

in which case one writes equivalently $f^*=g$ and $g^*=f$ We can see this by first taking the derivative of $f^\star$:

${df^\star(p) \over dp} = {d \over dp}(xp-f(x)) = x + p {dx \over dp} - {df \over dx} {dx \over dp} = x.$

Then this equation taken together with the previous equation resulting from the maximization condition results in the following pair of reciprocal equations:

$p = {df \over dx}(x),$
$x = {df^\star \over dp}(p).$

From these we see that $Df$ and $Df^\star$ are inverses, as promised. They are unique up to an additive constant which is fixed by the additional requirement that

$f(x) + f^\star(p) = x\,p.$

Although in some cases (e.g. thermodynamic potentials) a non-standard requirement is used:

$f(x) - f^\star(p) = x\,p.$

The standard constraint will be considered in this article unless otherwise noted. The Legendre transformation is its own inverse, and is related to integration by parts.

## Behaviour of differentials under Legendre transforms

Let $f$ be a function of two independent variables $x$ and $y$ with the differential $df = {\partial f \over \partial x}dx + {\partial f \over \partial y}dy = udx + vdy$. Assume that it is convex in $x$ for every $y$, then one may perform the Legendre transform in $x$. Let $u$ be the variable conjugate to $x$. If we want to change the differentials $dx$ and $dy$ to $du$ and $dy$ (i.e. we want to build another function with its differential expressed in terms of $du$ and $dy$), we simply consider the function $g(u, y) = f - ux$ and calculate:

$dg = df - udx - xdu = udx + vdy - udx - xdu = -xdu + vdy$
$x = -{\partial g \over \partial u}$
$v = {\partial g \over \partial y}$

The function $g(u, y)$ is the result of Legendre transformation of $f(x,y)$ in which only the independent variable $x$ has been replaced by $u$. This is widely used in thermodynamics.

## Applications

### Hamilton-Lagrange mechanics

A Legendre transform is used in classical mechanics to derive the Hamiltonian formulation from the Lagrangian formulation, and conversely. A typical Lagrangian has the form $L(v,q)=\frac{1}2\langle v,Mv\rangle-V(q)$, where $(v,q)$ are coordinates on $\mathbb R^n\times\mathbb R^n$, $M$ is a positive real matrix, and $\langle x,y\rangle=\sum_jx_jy_j$. For every $q$ fixed, $L(v,q)$ is a convex function of $v$, while $-V(q)$ plays the role of constant. Hence the Legendre transform of $L(v,q)$ as a function of $v$ is the Hamiltonian function $H(p,q)=\frac 12\langle p,M^{-1}p\rangle+V(q)$.

In a more general setting $(v,q)$ are local coordinates on the tangent bundle $T\mathcal M$ of a manifold $\mathcal M$. For each $q$, $L(v,q)$ is a convex function of the tangent space $V_q$. The Legendre transform gives the Hamiltonian $H(p,q)$ as a function of the coordinates $(p,q)$ of the cotangent bundle $T^*\mathcal M$; the inner product used to define the Legendre transform is inherited from the canonical symplectic structure.

### Thermodynamics

The strategy behind the use of Legendre transforms is to shift, from a function with one of its parameters an independent variable, to a new function with its dependence on a new variable (the partial derivative of the original function with respect to the independent variable). The new function is the difference between the original function and the product of the old and new variables. For example, while the internal energy is an explicit function of the extensive variables entropy, volume (and chemical composition)

$U = U(S,V,\{N_i\})\,$

with the differential

$dU = TdS - PdV + \sum \mu _i dN _i$

the Helmholtz free energy is obtained in the following way using the Legendre transform:

$A = U - TS$
$dA = -SdT - PdV + \sum \mu _i dN _i$

It is seen that the independent variable $S$ (entropy) has been replaced with its thermodynamic conjugate $T$ (temperature).

Likewise, the enthalpy, the (non standard) Legendre transform of U with respect to V:

$H = U + PV \, = H(S,P,\{N_i\})\,$
$P=\, -\left( \frac{\partial U}{\partial V}\right)_S\,$

becomes a function of the entropy and the intensive quantity, $P$ (pressure), as natural variables, and is useful when the (external) pressure is constant. The free energies (Helmholtz and Gibbs), are obtained through further Legendre transforms, by subtracting TS (from U and H respectively), shift dependence from the entropy S to its conjugate intensive variable temperature T, and are useful when it is constant.

### An example – variable capacitor

As another example from physics, consider a parallel-plate capacitor in which the plates can move relative to one another. Such a capacitor would allow us to transfer the electric energy which is stored in the capacitor into external mechanical work done by the forces acting on the plates. You can think of the electric charge as analogous to the "charge" of a gas in a cylinder, and the resulting mechanical force being exerted on a piston.

Suppose we wanted to compute the force on the plates as a function of x, the distance which separates them. To find the force we will compute the potential energy and then use the definition of force as the gradient of the potential energy function.

The energy stored in a capacitor of capacitance C(x) and charge Q is

$U (Q, \mathbf{x} ) = \begin{matrix} \frac{1}{2} \end{matrix} QV = \begin{matrix} \frac{1}{2} \end{matrix} \frac{Q^2}{C(\mathbf{x})},$

where we have abstracted away the dependence on the area of the plates, the dielectric constant of the material between the plates, and the separation x as the capacitance C(x).

The force F between the plates due to the electric field is

$\mathbf{F}(\mathbf{x}) = -\frac{dU}{d\mathbf{x}},$

If the capacitor is not connected to any circuit, then the charges on the plates remain constant as they move, the force is the negative gradient of the electrostatic energy

$\mathbf{F}(\mathbf{x}) = \begin{matrix} \frac{1}{2} \end{matrix} \frac{dC}{d\mathbf{x}} \frac{Q^2}{C^2}.$

However, suppose the voltage between the plates V is maintained constant by connection to a battery, which is a reservoir for charge at constant potential difference. To find the force we first compute the non-standard Legendre transform

$U^* = U - QV = \begin{matrix} \frac{1}{2} \end{matrix}QV - QV = -\begin{matrix} \frac{1}{2} \end{matrix} QV\,.$

The force now becomes the negative gradient of the Legendre transform

$\mathbf{F}(\mathbf{x}) = -\frac{dU^*}{d\mathbf{x}}.$

The two functions happen to be negatives only because of the linearity of the capacitance except now Q is no longer a constant.

### Probability theory

In large deviations theory, the rate function is defined as the Legendre transformation of the logarithm of the moment generating function of a random variable. An important application of the rate function is in the calculation of tail probabilities of sums of i.i.d. random variables.

## Geometric interpretation

For a strictly convex function the Legendre transformation can be interpreted as a mapping between the graph of the function and the family of tangents of the graph. (For a function of one variable, the tangents are well-defined at all but at most countably many points since a convex function is differentiable at all but at most countably many points.)

The equation of a line with slope m and y-intercept b is given by

$y = mx + b.\,$

For this line to be tangent to the graph of a function f at the point (x0, f(x0)) requires

$f\left(x_0\right) = m x_0 + b$

and

$m = \dot{f}\left(x_0\right)$

f' is strictly monotone as the derivative of a strictly convex function, and the second equation can be solved for x0, allowing to eliminate x0 from the first giving the y-intercept b of the tangent as a function of its slope m:

$b = f\left(\dot{f}^{-1}\left(m\right)\right) - m \cdot \dot{f}^{-1}\left(m\right) = -f^\star(m).$

Here f* denotes the Legendre transform of f.

The family of tangents of the graph of f parameterized by m is therefore given by

$y = mx - f^\star(m)$

or, written implicitly, by the solutions of the equation

$F(x,y,m) = y + f^\star(m) - mx = 0.$

The graph of the original function can be reconstructed from this family of lines as the envelope of this family by demanding

${\partial F(x,y,m)\over\partial m} = \dot{f}^\star(m) - x = 0.$

Eliminating m from these two equations gives

$y = x \cdot \dot{f}^{\star-1}(x) - f^\star\left(\dot{f}^{\star-1}(x)\right).$

Identifying y with f(x) and recognizing the right side of the preceding equation as the Legendre transform of f* we find

$f(x) = f^{\star\star}(x).$

## Legendre transformation in more than one dimension

For a differentiable real-valued function on an open subset U of Rn the Legendre conjugate of the pair (U, f) is defined to be the pair (V, g), where V is the image of U under the gradient mapping Df, and g is the function on V given by the formula

$g(y) = \left\langle y, x \right\rangle - f\left(x\right), \, x = \left(Df\right)^{-1}(y)$

where

$\left\langle u,v\right\rangle = \sum_{k=1}^{n}u_{k} \cdot v_{k}$

is the scalar product on Rn. The multidimensional transform can be interpreted as an encoding of the convex hull of the function's epigraph in terms of its supporting hyperplanes.[1]

Alternatively, if X is a real vector space and Y is its dual vector space, then for each point x of X and y of Y, there is a natural identification of the cotangent spaces T*Xx with Y and T*Yy with X. If f is a real differentiable function over X, then ∇f is a section of the cotangent bundle T*X and as such, we can construct a map from X to Y. Similarly, if g is a real differentiable function over Y, ∇g defines a map from Y to X. If both maps happen to be inverses of each other, we say we have a Legendre transform.

When the function is not differentiable, the Legendre transform can still be extended, and is known as the Legendre-Fenchel transformation. In this more general setting, a few properties are lost: for example, the Legendre transform is no longer its own inverse (unless there are extra assumptions, like convexity).

## Further properties

In the following the Legendre transform of a function f is denoted as f*.

### Scaling properties

The Legendre transformation has the following scaling properties: For a>0,

$f(x) = a \cdot g(x) \Rightarrow f^\star(p) = a \cdot g^\star\left(\frac{p}{a}\right)$
$f(x) = g(a \cdot x) \Rightarrow f^\star(p) = g^\star\left(\frac{p}{a}\right).$

It follows that if a function is homogeneous of degree r then its image under the Legendre transformation is a homogeneous function of degree s, where 1/r + 1/s = 1. Thus, the only monomial whose degree is invariant under Legendre transform is the quadratic.

### Behavior under translation

$f(x) = g(x) + b \Rightarrow f^\star(p) = g^\star(p) - b$
$f(x) = g(x + y) \Rightarrow f^\star(p) = g^\star(p) - p \cdot y$

### Behavior under inversion

$f(x) = g^{-1}(x) \Rightarrow f^\star(p) = - p \cdot g^\star\left(\frac{1}{p}\right)$

### Behavior under linear transformations

Let A be a linear transformation from Rn to Rm. For any convex function f on Rn, one has

$\left(A f\right)^\star = f^\star A^\star$

where A* is the adjoint operator of A defined by

$\left \langle Ax, y^\star \right \rangle = \left \langle x, A^\star y^\star \right \rangle.$

A closed convex function f is symmetric with respect to a given set G of orthogonal linear transformations,

$f\left(A x\right) = f(x), \; \forall x, \; \forall A \in G$

if and only if f* is symmetric with respect to G.

### Infimal convolution

The infimal convolution of two functions f and g is defined as

$\left(f \star_\inf g\right)(x) = \inf \left \{ f(x-y) + g(y) \, | \, y \in \mathbb{R}^n \right \}.$

Let f1, …, fm be proper convex functions on Rn. Then

$\left( f_1 \star_\inf \cdots \star_\inf f_m \right)^\star = f_1^\star + \cdots + f_m^\star.$


text:
# How do I find the Z score for a statistic without standard deviation given Pop mean=.05%, n=100, Sample mean of .11%?

Jun 6, 2015

By definition, Z score is:
$z = \frac{x - \mu}{\sigma}$
where $x$ is your datum, $\mu$ is the mean of your population and $\sigma$ is its standard deviation. Basically, it's a measure of deviation from the mean in units of standard deviation.

Unless I misunderstood your problem, I see no way you can calculate this number without knowing a standard deviation.

Dec 7, 2016


text:
# When is it harmful to add percent character at end of lines in a \newcommand, or similar

Since egreg has graciously agreed to not comment at least for a day to When not to use \ensuremath for math macro? :-), I thought I would take advantage of that and post a question about another (non-offical) campaign of egreg: additional % at the end of \newcommand and similar macros.

## Background:

After starting out with LaTeX and defining numerous macros I ran into TeX Capacity exceeded problems. After considerable time, I was able to come up with an example small enough that reproduced the problem and posted it here:

That and the following provide a good explanation of what is going on:

So, I got into the habit of adding a % at the end of every line within the preamble, even after \usepackage{} and following the last } of a \newcommand, where is it strictly not necessary. My logic being that I did not see any harm and was easier to just add it rather than try to think about whether it was needed or not.

## Problem:

However, a comment was made in Defining command containing pagebreak, and boxes:

Actually four of your % are redundant. ... In some cases a % can even be wrong. :) - egreg

Sometimes, I even added trailing % within the document body, but noticed an answer was edited to remove the %. For example this answer for Producing different versions of a document originally had a trailing % after every line. Now, in this case this is not part of the preamble, but again I thought there was no harm in including them.

The only situation I am aware of where there is an issue with a trailing % is mentioned at What is the use of percent signs (%) at the end of lines?:

\show\
\show\ %

## Question:

I prefer solutions that require less thought, so I tend to include a trailing % even though it may not be absolutely necessary. So, I would like to know when is it harmful to add a trailing % in the definitions of \newcommand and similar macros? Are there other cases besides the above \show.

Here is the MWE: The two macros \mymacroA and \mymacroB are identical, except for the trailing %:

\documentclass{article}
\newcommand\mymacroA[1]{
#1
}
\newcommand\mymacroB[1]{% <-- This percent is important
#1% <-- This percent is important
}% This does not appear to be necessary

\begin{document}
\mymacroA{foo}bar \mymacroA{foo} bar

\mymacroB{foo}bar \mymacroB{foo} bar
\end{document}

• Your editing of the title has substantially changed the meaning of the question. – Yiannis Lazarides Nov 14 '11 at 20:33
• Yeah I realized that there was an inconsistency in the title and the question in the text after reading the initial responses. – Peter Grill Nov 14 '11 at 20:53

## Tokenization stage

The general rule is that spaces after control words (\par, for instance) are ignored, while after control symbols (\!, for instance) are retained; spaces at the beginning of a line are ignored altogether. Consecutive spaces are transformed into one space token but two consecutive end-of-lines become a \par (this statement is not fully correct, but not too incorrect for the purposes of this answer).

## After the tokenization stage

There is an obvious intermix between tokenization stage and subsequent processing. In what follows "space" will mean "space token" and I won't care about spaces that have already disappeared, such as those after a control word).

It's now important to know that spaces in the input don't always produce spacing in the output. To understand why, it's necessary to learn some theory.

TeX is always in one of three modes: horizontal, vertical or math.

(The above paragraph tells a lie, strictly speaking: there is a circumstance in which it's not in one of these modes, but it's irrelevant for the discussion.)

Under normal circumstances spaces do not produce output in vertical and math mode (let's not discuss the very special settings that make them appear).

It's quite easy to tell when TeX enters math mode: as soon as it sees \$ or  (which, in LaTeX parlance, are, respectively \( and all the display math environments, initiated by \[, , \begin{align} and so on). It exits math mode, returning to the previous mode when it sees the closing  or  (with similar remarks as before for LaTeX).

Roughly speaking, TeX is in vertical mode at the start of a job or after a \par or when it's beginning a \vbox or \vtop or \vcenter; these are started, in LaTeX, by \parbox and \begin{minipage}. However, spaces in vertical and math mode are not suppressed: they are there, but produce no output. This is a cause for some misunderstandings. TeX starts horizontal mode when it sees a character to be typeset, \noindent, \indent or some other commands, notably \leavevmode (this is not an exhaustive list) or when it's starting an \hbox (for LaTeX it's \mbox, \makebox, \fbox, \colorbox, ... or the lrbox environment). In horizontal mode every space that's not absorbed by other rules (see later) produces output.

• When TeX is absorbing the preamble of a LaTeX document it is in vertical mode. But a definition such as

\newcommand{\foo}{
bar
}

will produce spaces in the output: the above is equivalent to

\newcommand{\foo}{ bar }

If \foo is seen at the beginning of a paragraph, the first space will not produce output (TeX is still in vertical mode), but the second will, as the b will trigger horizontal mode. Conversely

\newcommand{\baz}[1]{\parbox{10cm}{
#1
}}

won't show spurious spaces. The first one, before #1 does nothing because it's seen in vertical mode; the final one, after #1 is suppressed because of the final implicit \par that ends the \parbox.

• A definition such as

\newcommand{\myop}{
\overset{t }{=}
}

will not need % to protect end-of-lines (translated into spaces), because it will be used in math mode (or will give an error anyway).

The most important (but easy) rule that should be considered is that tokens in the body of a definition are simply stored and not executed (they can be expanded in a \edef or \xdef, but still not executed). The execution is performed (after expansion) when the defined macro is used. The execution of a space token in vertical or math mode does nothing, in horizontal mode it produces a spacing in the output.

## Numbers and dimensions

There is a place where space tokens have a peculiar behavior. When TeX is looking for a number or a dimension in order to perform an assignment or when expanding \number and \romannumeral, it expands tokens until an unexpandable token appears or a space token is found. In this case, the space is swallowed as part of the process.

This is one aspect to be kept in mind when writing macros. Let's see an example: we want to make a "monthly to-do list". Just a \parbox with twelve lines labelled by year and month; a loop seems the best approach, with the year given as argument:

\documentclass{article}
\newcount\monthlycount
\newcommand{\monthlytodo}[1]{\par%
\fbox{%
\parbox{10cm}{%
\monthlycount=1%
\loop\ifnum\monthlycount<13%
#1--\number\monthlycount\hrulefill\par%
\repeat%
}%
}%
}
\begin{document}
\monthlytodo{2013}
\end{document}

Try it; this will surprise you with

! TeX capacity exceeded, sorry [main memory size=3000000].

Oh, boy! We've made sure that no spurious spaces were inserted by our macro! Why is TeX betraying us? Simple: the input can be written equivalently as

\loop\ifnum\monthlycount<13#1--\number\monthlycount

and #1 is replaced by 2013. So our loop checks whether the current value of \monthlycount is less than 132013 and stores tokens for the \parbox until TeX runs out of memory.

Let's try an amended version:

\newcommand{\monthlytodo}[1]{\par
\fbox{%
\parbox{10cm}{
\monthlycount=1
\loop\ifnum\monthlycount<13
#1--\number\monthlycount\hrulefill\par
\repeat
}%
}%
}

Look, ma! No spurious spaces!

Exercise 1 Why some lines end with % and other lines don't? We now know that % is harmful after 13 (and also after the 1 in the preceding line).

Technicality: space tokens are looked for but then swallowed also after keywords (such as by in the example and the unit names mm, pt and so on). There are also a few other places, but this answer is already too long. I'll show only how some of the problems can arise also when using LaTeX functions in this context:

\newcounter{monthlycount}
\newcommand{\monthlytodo}[1]{\par
\fbox{%
\parbox{10cm}{
\setcounter{monthlycount}{1}
\loop\ifnum\value{monthlycount}<13
#1--\arabic{monthlycount}\hrulefill\par
\stepcounter{monthlycount}
\repeat
}%
}%
}

Exercise 2 Why isn't % necessary in lines 4–9 of the code above?

• So is TeX in vertical mode at the end of each of lines 4-9? At the end of line 4, you've just started a \parbox but not yet fed TeX a character or similar. The same is true at the end of lines 5 and 6? At the end of line 7, you've been in horizontal mode but the \par puts TeX back in vertical mode. It is still in vertical mode at the end of lines 8 and 9? – cfr Jan 21 '14 at 23:56
• @cfr TeX will be in vertical mode after executing \parbox{, so it will ignore the space token; the instruction in line 5 doesn't start horizontal mode; line 6 ends with a constant required by the syntax, so a trailing space is ignored; there is no space at the end of lines 7 and 9; TeX will be in vertical mode when processing the space at the end of line 8, because of the preceding \par. ;-) – egreg Jan 22 '14 at 0:00
• @egreg Exercise 1 ... We now know that % is harmful after 13 (and also after the 1 in the preceding line)... The % after the 1 in this line isn't harmful, it is only improper. The \loop macro begins with \def, this token ends the number scanning. – wipet Jun 18 '14 at 20:16
• @wipet I would avoid expanding \loop before the constant has been determined. But the question is why some lines that don't end with a number have no %. ;-) – egreg Jun 18 '14 at 20:23

You should first understand the rules applied to spaces (except inside verbatim of course):

• Multiple spaces including other whitespaces (tab, newline) are taken as one single space token.
With the exception of two newlines, which form a \par instead.
• Spaces after control words (normal macros) are ignored.
This is because you might need to add a space to separate the macro name from trailing text: e.g. \relax abc, because \relaxabc would be a different control word.
• Spaces after control characters (macros with a single non-letter, like \_, \, etc., but not \a which is a control word) are not ignored.
This is because they are only one character long (besides the backslash) and therefore the end of the name is already known.
• Spaces at the beginning of a line are always ignored.
• Spaces in the direct preamble including package and class files are ignored.
This is a LaTeX specific thing and simply configured so.
• However, spaces inside a macro definition occurring in a preamble are stored as normal into the macro.
That is the reason why you need to use % inside macros but not outside of them, e.g. after the closing }.
• Spaces terminate the number collecting process of TeX when it assigns a count register or with \ifnum or any other number context. That space is then consumed.
So if you write something like \mycount=123 you want to have a space or \relax after it, otherwise the next macro will be expanded, because TeX is searching for the potential rest of the number.

Note that in your \show example the % is simply there to protect the editor to remove the space as a trailing space turning \<space> into \<newline>. You don't need to have it there as long the space stays there, but it is just saver.

Then there are really some advances situations where TeX allows for an optional space, where you want to add a space so a space which follows is not taken as that optional space. I know this from \let\dummy=<space>, which is used to remove a space from the input stream. Often such code is used in a parser loop and removing that space would cause issues, because now the next token is removed, not the space which is taken as the optional space. I encountered situations where a loop can be turned into an endless one just by removing that space. There was an answer which had this included, maybe I find it again.

• Good summary of the rules of spaces. But, if I understand fully, there is no harm in adding the % except for the \mycount=123 where I would need to either have a space before the trailing percent as in \mycount=123 % or use \mycount=123\relax% – Peter Grill Nov 14 '11 at 20:37
• @PeterGrill: \mycount=123 % is fine, but simply \mycount=123 followed by a newline is fine, too, because it is taken as a space. You don't need a % after \relax. – Martin Scharrer Nov 14 '11 at 20:41
• "Note that in your \show example the % is simply there to protect the editor to remove the space as a trailing space turning \<space> into \<newline>." doesn't make sense to me, are you missing a word somewhere? Specifically "to protect the editor to remove" doesn't scan. – Canageek Nov 20 '11 at 20:12
• There is a difference between \<space><endline> and \<space>%<endline>. In the first case one gets \^^M (whose usual definition is to expand to \<space>). This is because TeX strips final spaces before appending ^^M, and this happens before % does its job of making TeX ignore it and everything to the end of the line. So in the second case one has really \<space>. Note: this assumes the usual value of \endlinechar. – egreg Sep 28 '12 at 10:31

When not to add percent character at end of lines in a \newcommand, or similar

You don't need to add percentage signs when you use a convenience environment from the good people of LaTeX3:

\ExplSyntaxOn

• Note that here both _ and : are 'letters', which may be important if you use, for example, LaTeX2e's \@for or want math subscripts. – Joseph Wright Nov 14 '11 at 20:30
• I adjusted the title of the question: I am interested in when it is harmful to add the %. So is there a problem in adding a trailing % in the above? – Peter Grill Nov 14 '11 at 20:35


text:
# Article

Full entry | PDF   (0.3 MB)
Keywords:
real symmetric matrix; graph; multiplicity of eigenvalues; P-set; P-vertices
Summary:
Suppose that $A$ is a real symmetric matrix of order $n$. Denote by $m_A(0)$ the nullity of $A$. For a nonempty subset $\alpha$ of $\{1,2,\ldots ,n\}$, let $A(\alpha )$ be the principal submatrix of $A$ obtained from $A$ by deleting the rows and columns indexed by $\alpha$. When $m_{A(\alpha )}(0)=m_{A}(0)+|\alpha |$, we call $\alpha$ a P-set of $A$. It is known that every P-set of $A$ contains at most $\lfloor {n}/{2} \rfloor$ elements. The graphs of even order for which one can find a matrix attaining this bound are now completely characterized. However, the odd case turned out to be more difficult to tackle. As a first step to the full characterization of these graphs of odd order, we establish some conditions for such graphs $G$ under which there is a real symmetric matrix $A$ whose graph is $G$ and contains a P-set of size ${(n-1)}/{2}$.
References:
[1] An{\dj}elić, M., Erić, A., Fonseca, C. M. da: Nonsingular acyclic matrices with full number of P-vertices. Linear Multilinear Algebra 61 (2013), 49-57; erratum ibid. 61 (2013), 1159-1160. DOI 10.1080/03081087.2013.794619 | MR 3003041 | Zbl 1315.15006
[2] An{\dj}elić, M., Fonseca, C. M. da, Mamede, R.: On the number of P-vertices of some graphs. Linear Algebra Appl. 434 (2011), 514-525. DOI 10.1016/j.laa.2010.09.017 | MR 2741238 | Zbl 1225.05078
[3] Cvetković, D., Rowlinson, P., Simić, S.: A study of eigenspaces of graphs. Linear Algebra Appl. 182 (1993), 45-66. DOI 10.1016/0024-3795(93)90491-6 | MR 1207074 | Zbl 0778.05057
[4] Du, Z.: The real symmetric matrices with a P-set of maximum size and their associated graphs. J. South China Norm. Univ., Nat. Sci. Ed. 48 (2016), 119-122. MR 3469083 | Zbl 1363.05159
[5] Du, Z., Fonseca, C. M. da: The singular acyclic matrices of even order with a P-set of maximum size. (to appear) in Filomat.
[6] Du, Z., Fonseca, C. M. da: The acyclic matrices with a P-set of maximum size. Linear Algebra Appl. 468 (2015), 27-37. MR 3293238 | Zbl 1307.15012
[7] Du, Z., Fonseca, C. M. da: The singular acyclic matrices with the second largest number of P-vertices. Linear Multilinear Algebra 63 (2015), 2103-2120. DOI 10.1080/03081087.2014.975225 | MR 3378019 | Zbl 1334.15026
[8] Du, Z., Fonseca, C. M. da: Nonsingular acyclic matrices with an extremal number of P-vertices. Linear Algebra Appl. 442 (2014), 2-19. MR 3134347 | Zbl 1282.15028
[9] Du, Z., Fonseca, C. M. da: The singular acyclic matrices with maximal number of P-vertices. Linear Algebra Appl. 438 (2013), 2274-2279. MR 3005289 | Zbl 1258.05024
[10] Erić, A., Fonseca, C. M. da: The maximum number of P-vertices of some nonsingular double star matrices. Discrete Math. 313 (2013), 2192-2194. DOI 10.1016/j.disc.2013.05.018 | MR 3084262 | Zbl 1281.05091
[11] Fernandes, R., Cruz, H. F. da: Sets of Parter vertices which are Parter sets. Linear Algebra Appl. 448 (2014), 37-54. MR 3182972 | Zbl 1286.15008
[12] Horn, R. A., Johnson, C. R.: Matrix Analysis. Cambridge University Press, Cambridge (2013). MR 2978290 | Zbl 1267.15001
[13] Johnson, C. R., Duarte, A. Leal, Saiago, C. M.: The Parter-Wiener theorem: Refinement and generalization. SIAM J. Matrix Anal. Appl. 25 (2003), 352-361. DOI 10.1137/S0895479801393320 | MR 2047422
[14] Johnson, C. R., Sutton, B. D.: Hermitian matrices, eigenvalue multiplicities, and eigenvector components. SIAM J. Matrix Anal. Appl. 26 (2004), 390-399. DOI 10.1137/S0895479802413649 | MR 2124154 | Zbl 1083.15015
[15] Kim, I.-J., Shader, B. L.: Non-singular acyclic matrices. Linear Multilinear Algebra 57 (2009), 399-407. DOI 10.1080/03081080701823286 | MR 2522851 | Zbl 1168.15021
[16] Kim, I.-J., Shader, B. L.: On Fiedler- and Parter-vertices of acyclic matrices. Linear Algebra Appl. 428 (2008), 2601-2613. DOI 10.1016/j.laa.2007.12.022 | MR 2416575 | Zbl 1145.15011
[17] Nelson, C., Shader, B.: All pairs suffice for a P-set. Linear Algebra Appl. 475 (2015), 114-118. MR 3325221 | Zbl 1312.15012
[18] Nelson, C., Shader, B.: Maximal P-sets of matrices whose graph is a tree. Linear Algebra Appl. 485 (2015), 485-502. MR 3394160 | Zbl 1322.05092
[19] Sciriha, I.: A characterization of singular graphs. Electron. J. Linear Algebra (electronic only) 16 (2007), 451-462. MR 2365899 | Zbl 1142.05344
[20] Sciriha, I.: On the construction of graphs of nullity one. Discrete Math. 181 (1998), 193-211. DOI 10.1016/S0012-365X(97)00036-8 | MR 1600771 | Zbl 0901.05069

Partner of


text:
# Measure Diameter of Given Wire Using Screw Gauge

View Notes

## What is a Screw Gauge?

A screw gauge is an instrument that measures the diameter of thin objects like a wire. The name screw gauge is provided because it is most commonly used to measure the diameters of wire which in turn are governed by the standard numbers that are called the standard wire gauge.

A screw gauge also measures the thickness of small sheets such as glass and plastic.

Since a screw gauge works on the principle of a micrometer, that’s why we call it the principle of a micrometer screw.

### Screw Gauge

When accurately cut, a single threaded screw is placed inside a closely fitted nut and rotated. The two types of motions occur, one is circular and the other is a linear motion of the screw along its axis.

The distance moved by the screw in one complete rotation of the screw equals the distance between the two consecutive threads of the screw gauge. This distance is called ‘Pitch’ and it is always a constant value.

Since the linear motion (the small distances) made by the screw gauge is hard to be measured so these linear distances are amplified into larger distances by the rotational motion of the screw. These rotations are easily measurable. The screw gauge is constructed in a way that follows the principle of ‘micrometer screw.’

Now, to measure the diameter of a given wire using a screw gauge, we need to know its structure.

### Structure of a Screw Gauge

In the above figure, we can see a U-shaped frame.

On the right side of this frame, we have a net that is called a sleeve. The readings on the sleeve measure the linear distance moved by the screw; this scale is called the ‘linear scale’ or the ‘pitch scale’.

If 15 mm is written on the U-frame, it means there are 15 divisions on the sleeve.

On the left side of the U-shape, there is a metal projection called ‘stud’. When this screw is moved forward, the stud and the screw together hold the wire or a sheet firmly.

The screw is attached to a milled head with a sloping edge that rotates over the sleeve; the sloping edge is called the circular or a head scale.

Now, let’s study the two terms used to find diameter of wire using screw gauge:

### Determine the Diameter of Wire Using Screw Gauge

• Determine the Linear scale division (number of visible and undiscovered divisions).

• Find and record the pitch and L.C. of the screw gauge.

• Record the zero error, if there’s any, otherwise, keep it nill.

• Let ‘m’ = number of divisions of the circular scale lying on the reference line.

• Firstly, we will find the direction of the wire in a perpendicular direction, we rotate the wire to 90°.

• Now, we will rotate the wire in different directions. We will repeat the above steps 6 times and note the total reading and the zero error.

• We will take the average of different values of diameters.

• Now, we will take a half-length ruler to ascertain the length of the wire. Repeat this step four times and record our observations.

### Pitch

$\text{Pitch } - \frac{\text{linear distance moved by the screw}}{\text{One rotation of the screw}}$

We can determine the pitch by rotating the circular scale to reach the zero mark on the reference line. In this way, we note down the pitch scale reading.

To Determine the Diameter of A Wire By Screw Gauge

Firstly, we count the number of divisions on the linear scale on a place completely uncovered by the cap. Let’s suppose that we got the reading as 4.0 mm as a linear scale reading.

Now, we rotate the screw 3 times till the zero mark of the head scale reaches the reference line, it means one rotation is complete.

After four rotations, we note the reading and it comes out 6.0 mm. We got the linear distance mode as:   7.0 mm -  4.0 mm  = 3.0 mm.

So, the pitch can be calculated as:

$= \frac{\text{linear distance moved by the screw}}{\text{One rotation of the screw}} = \frac{3mm}{3}$ = 1 mm

So, the pitch of the screw is 1 mm or 0.1 cm.

So, the distance moved by the screw in one complete rotation of the circular cap is 1 mm.

Least Count of the Screw Gauge

A circular cap has 100 divisions, if the cap moves one division, then the distance moved is 1/100 of the pitch, which is the least count of the screw gauge.

So, the formula for the least count is:

$L.C. = \frac{\text{Pitch}}{\text{No. of divisions in a circular/head scale}} = \frac{1}{100}$ = 0.01 mm or 0.001 cm.

1.  …… mm

2. ……..mm

3. ……..mm

Mean zero error…….mm.

Table for the diameter of wire using screw gauge:

 S.No. LSR (N) in mm Circular Scale Reading Total Reading No. of circular scale divisions on the reference line  (n) n * L.C. Observed readingG = N + n * L.C. (mm) CorrectedD = G + c

Question 1: How do Errors Occur?

Answer: Because of the manufacturing defect of the screw gauge, the wear and tear of the screw threads lead to increasing gaps; these irregular gaps may lead to zero and backlash errors.

Question 2: What are the Zero Errors?

Answer: Due to the manufacturing defect in the screw gauge, when the screw completely touches the fixed dead and zero of the circular scale doesn’t coincide with the reference line. The type of error that occurs is the zero error.

Question 3: What is a Backlash Error?

Answer: When we rotate the ratchet, we find a certain lag in the linear movement of this screw that is indicated by the jerky movement of the screw.

In certain cases, on rotating the ratchet, the screw doesn’t move immediately in the opposite direction, instead, it rotates in the reverse direction which happens due to improper alignment in threads (rise in gaps in threads) so the type of error that occurs is the backlash error.

Question 4: State the Sources of Error in a Screw Gauge.


text: set and query the computational environment for the Physics package commands - Maple Programming Help


text:
## CCO '08 P5 - Candy

View as PDF

Points: 7 (partial)
Time limit: 2.75s
Memory limit: 512M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
##### Canadian Computing Competition: 2008 Stage 2, Day 2, Problem 2

You and a friend have a big bag of candy. You want to keep slim and trim, and so you would like to equalize the candy which you are sharing with your friend in terms of calorie count. That is, your task is to divide the candies into two groups such that the number of calories in each group is as close together as possible.

#### Input Specification

The first line of input contains the number of different kinds of candy you have in your bag of candy . On the following lines, there are pairs of numbers describing each type of candy. The candy description is of the form where is the number of that particular type of candy contained in the bag and is the calorie count for each piece of that type of candy. You may assume that and .

#### Output Specification

Your output is one integer which is the minimum difference of calories between friends.

#### Sample Input

4
3 5
3 3
1 2
3 100

#### Sample Output

74

#### Explanation for Sample Output

Your friend takes two of the -calorie candies, for a total of calories. You keep the remaining candies, which have calories.


text:
# Frequentist vs Bayesian by Tianxu Jia

## 1. The Problem Formulation

In a marketing campaign, a retailer sends a coupon to the customer. How likely is it that the customer will buy the product? Maybe we should give it a shot since it won’t cost us a lot. Statistically, we can make some experiments, estimate the probability, and then decide how to mark targets based on the results. Global warming is a big topic that is relevant to all people on the planet. As we are an independent thinker, not the ones who follow the crowd, we would like to ask: Is it possible to still do some random experiments for the conclusion? Maybe it is absolutely impossible.

We need impeccable logic and support from data!

Generally speaking, there are two schools of thought in the field of data science and machine learning: the Bayesian and the frequentist. By analysing their basic assumptions, this blog will explain the theoretical foundations and backgrounds of these two schools.

Suppose there is system $$f_\theta$$, $$\theta$$ is a vector. The random variable $$X$$ is generated from the system.

$$X \sim p(x|\theta)$$

How to estate the parameter $$\theta$$ from the observation $$x$$ from frequentist and Bayesian?

## 2. Frequentist

A frequentist believes that the world is determinstic. There is an ontology, and its true value is constant. Our goal is to determine this value or the range in which it lies. However, the true values are unknown. The only way to estimate true values are through the random phenomena that result from them.

In a jar with seven red balls and three blue balls, for example, if we randomly take out one ball and record it before putting it back in the jar. The probability that we will take out the red ball each time is $$70\%$$ The probability, no matter how the experiment is performed, is objective and unique. It is this objective fact that underpins the series of observations. Let us assume the unknown probability is $$\theta$$ and we can estimate it. If we perform $$100$$ experiments and get a red ball $$72$$ times, we can intuitively estimate that it is $$72\%$$ red, and since there are only $$10$$ balls in the jar, we can determine that the most plausable estimation is that there are $$7$$ red balls. This is in fact an optimisation problem with a maximum likelihood function. Suppose the probability of getting out red ball is $$\theta$$, which is the Bernolli distribution:

$$p(x_i, \theta) = \theta^{x_i}(1-\theta)^{(1-x_i)}$$

$$x_i = 1$$ indicates that we get read ball, and $$x_i = 0$$ for blue ball.

Suppose we perform $$n$$ experiments. In theory$$\theta$$can take any value between $$0$$ and $$1$$ including $$0$$ and $$1$$. This is $$\theta\in[0, 1]$$. The $$n$$ experiments can produce arbitrary permutations of length $$n$$ sequence with elements of $$0$$s and $$1$$s. The total number of sequences is the permutations is $$2^n$$. But, after one round of our experiments, we only get one of $$2^n$$ possibility in the sequence $$0$$,$$1$$.

Why did we get this sequence and not any other in one experiment? It is the physical reality that there are $$10$$ balls in the jar, $$7$$ of which are red balls which makes the observation happened. This objective reality determines $$0$$, and $$0$$ in turn determines which sequence is most likely to be observed. That is, $$0$$ makes the most likely sequence to occur. Represent this idea using mathematical formulation:

$$\theta = argmax_\theta\prod_{i=1}^N\theta^{x_i}(1-\theta)^{1-x_i}$$

For ease of calculation, take the logarithm of the above equation:

$$\theta = \underset{\theta}{argmax}\sum_{i=1}^Nlog(\theta^{x_i}(1-\theta)^{1-x_i}) = \underset{\theta}{argmax}(-\sum_{i=1}^Nlog(\theta^{x_i}(1-\theta)^{1-x_i}))$$

We get:

$$\hat \theta = \frac{\sum_i^N x_i}{N}$$

## 3. Bayesian

The Bayesian does not attempt to say that ‘events themselves are random’, or that ‘the world is somehow random in its ontology’. It starts from the point of ‘imperfect knowledge of the observer’ and constructs a framework for making inferences based on uncertain of the knowledge.

The random event in the eyes of frequentist is not random any more in the view of Bayesian, but is only unknown to the observer. So, the observer makes inferring from the observed evidence. The randomness is not arising from whether the event itself occurred or not, but merely describes the state of the observer’s knowledge of the event.

Bayesian probabilities are based on limited knowledge, while frequentists describe the ontology. An observer’s knowledge is updated when a new observation is made according to a Bayesian theorem. In Bayesian probability theory, it is assumed that the observer has limited knowledge of the event (for instance, Tom believes a priori that a coin is even based on his daily observations and feelings). Once the observer gets new observations (Tom tosses the coin over and over again and discovers that out of 100 tosses, only 20 come up heads), that will affect the observer’s original beliefs in the form of logical uncertainty (Tom doubts the coin is even and even begins to conclude it is not even). Because incomplete information prevents the observer from relying on simple logic to form inferences, he must turn to plausible reasoning, which assigns plausibility to a range of possible outcomes.

By way of example, Bayesian analysis describes the above process as the observer holding a particular prior belief, gaining new evidence through observation, and combining the new observed evidence and prior knowledge to arrive at a posterior belief, which reflects an updated state of knowledge. Bayesian probabilistic inference is concerned with building a logical system from incomplete knowledge and an assertion as a measure of plausibility. An observer’s beliefs or knowledge about a variable is called a probability distribution by a frequentist. In a Bayesian approach, representations of human knowledge are constructed rather than representations of the objective world. Bayesian probabilistic inference is, therefore, in many cases a better approach to solving the problem of observer inference in machine learning and bypasses the discussion about ontology.

The mathematical representation of the above discussion is:

$$p(\theta|x) = \frac{p(x|\theta)p(\theta)}{p(x)}$$

where: $$p(x) = \int p(x|\theta)p(\theta)d\theta$$

By using the likelihood function, Bayes’ theorem relates the prior probability to the posterior probability. We can get the maximum posterior probability：

$$\hat \theta = \theta_{max} = \underset{\theta}{argmax} p(\theta|x) = \underset{\theta}{argmax}\frac{p(x|\theta)p(\theta)}{p(x)} = \underset{\theta}{argmax} p(x|\theta)p(\theta)$$

The powerful and fascinating part of Bayesian reasoning is that we start with subjective a priori beliefs and acquire an objective knowledge of the world by objective iterative observation. For example, we can obtain the posterior probabilities by combining evidence and prior probabilities. However, if we receive new evidence again, we can update our posterior probabilities by combining the previously obtained posterior probabilities with the new evidence. It can be is an iterative process.

Below I will use one simple example to show the process is iterative.

Incidence of breast cancer $$0.1\%$$ in the same place. If a woman has breast cancer, the test positive is $$90\%$$ and if she doesn’t, the test negative is $$90\%$$. Suppose, there is a women, whose first time test is positive. What is the possibility she has breast cancer? How about if the second time her test is still positive? How do you make decisions if you were the doctor?

If we have no information, we randomly take one person, who has the probability of $$0.001$$ to have breast cancer. This is the prior probability. $$p(c)=0.001$$. The woman has cancer and the test is positive, which means $$p(+|c) = 0.9$$. If a woman has no cancer, the $$p(-|\bar c) = 0.9$$.

So, after the first test is positive.

$$p(c|+) = \frac{p(c)p(+|c)}{p(c)p(+|c) + p(\bar c)p(+|\bar c)} = \frac{0.001×0.9}{0.001×0.9 + 0.999×0.1} \approx 0.9\%$$

So, the first test as positive only means that she has 0.9% probability to have cancer. Maybe at this time the doctor can’t confirm the lady has cancer.

How about if the second time is still positive?

We take posterior probability $$p(c|+) \approx 0.009$$ as the prior probability of second time test. So, $$p(c) = 0.009$$ now.

$$p(c|+) = \frac{p(c)p(+|c)}{p(c)p(+|c) + p(\bar c)p(+|\bar c)} = \frac{0.009×0.9}{0.009×0.9 + 0.991×0.1} \approx 7.6\%$$

Maybe now the doctor still can’t confirm the lady has cancer. She will need further tests.

This example shows the process of how to update our beliefs with new evidence using Bayesian reasoning.


text:
# Complexity of k-clique for hypergraphs

Classic Problem:

Let a number $k$ be given. The $k$-clique problem is as follows.

Given a graph $G$, does there exist a subset $S$ of $k$ vertices so that any two vertices of $S$ are adjacent?

Hypergraph Problem:

Let numbers $c$ and $k$ be given. The $(c,k)$-hyperclique problem is as follows.

Given a $c$-uniform hypergraph $H$, does there exist a set $S$ of $k$ vertices so that any subset of $c$ vertices from $S$ forms a hyperedge.

Questions:

(1) What is the best known algorithm for solving $(c,k)$-hyperclique?

(2) What is its time complexity?

(3) Is there any connection between $(c,k)$-hyperclique and matrix multiplication?

For all I know, this might be a well studied problem. Any references that investigate this problem are greatly appreciated.

• May be worth pointing out the obvious: Since we understand the case $c=2$, the problem is NP-complete and not FPT in terms of $c$ (but is FPT in terms of $k$). Further (still obvious), you could rephrase the problem as the selection of $k$ rows of the incidence matrix such that in the submatrix on these rows, $k\choose c$ columns have sum $c$. – Andrew D. King Aug 9 '15 at 23:26
• This is usually phrased in terms of finding a $k$-independent set in a $c$-uniform hypergraph. See Yuster's 2006 paper research.haifa.ac.il/~raphy/papers/counthyper.pdf for some useful pointers (including links with matrix multiplication). – András Salamon Aug 10 '15 at 0:15
• @AndrewD.King, I don't understand what do you mean by "but is FPT in terms of k", k-clique is W[1]-hard in terms of k. And OP: K-Clique is already w[1]hard, but your question is not well research level question, as compares it with polynomial problems. – Saeed Aug 10 '15 at 7:12
• Thanks for the information. I'm most interested in whether or not there is some $c>2$ and $k>2$ such that $(c,k)$-hyperclique is in $\mathrm{DTIME}(n^{k-\epsilon})$. We know that for $k>2$, $k$-clique can be solved in $\mathrm{DTIME}(n^{k-\epsilon})$. – Michael Wehar Aug 10 '15 at 11:41
• So you know there is no n^o(k) for clique and by relation to matrix multipulation you don't mean a p reduction but only reducing running time, now it's more clear for me, I have no idea about it but maybe you need to include c into the exponent as well. – Saeed Aug 10 '15 at 18:26

It is not known if there is an $$\varepsilon > 0$$, $$c > 2$$, and $$k > c$$ such that $$(c,k)$$ hyperclique is in $$n^{k-\varepsilon}$$ time. Note that the case of $$k \leq c$$ is trivial. For years I have communicated this problem to many people, and taught it in cs266 at Stanford, due to its connection to solving $$k$$-Sat. (Several open problem sessions at workshops probably recorded this.) Here are a few things I know:

I proved several years ago that solving $$4-cycle$$ on $$n$$ node graphs in $$n^{2-\varepsilon}$$ time implies $$(3,4)$$ hyperclique in $$n^{4-\varepsilon}$$ time. Haven't published it.

UPDATE (Aug 2019) the aforementioned result and some generalizations now appear in the paper

Andrea Lincoln, Virginia Vassilevska Williams, R. Ryan Williams: Tight Hardness for Shortest Cycles and Paths in Sparse Graphs. SODA 2018: 1236-1252

If you can solve $$(3,4)$$ hyperclique as indicated above, then Max-3-Sat can be solved in strictly less than $$2^n$$ time. Similarly, solving $$(k,k+1)$$ hyperclique would yield a faster $$k$$-Sat algorithm. So if you believe Strong ETH then there is an obvious limit here. The reduction is a natural generalization of the reduction from Max-2-Sat to triangle finding ($$(2,3)$$ clique) from ICALP'04 and my PhD thesis.

You can solve $$(c,k)$$ hyperclique in $$n^k/(\log n)^{\Omega(k)}$$ time by generalizing the paper Efficient Algorithms for Clique Problems.

• Thanks Ryan! I appreciate your answer and sharing the paper on the clique problem. :) – Michael Wehar Aug 12 '15 at 8:04
• Is 5-cycle any harder than 4-cycle? – Michael Wehar Sep 1 '15 at 4:22
• As far as we know, 3-cycle is harder. The odd case in general takes about O(n^{2.373}) time, the even case takes O(n^2) for fixed length cycles. See for example, Yuster and Zwick, Finding even cycles even faster. – Ryan Williams Sep 1 '15 at 5:40
• Oh, wow! That's quite interesting. Ok, thank you. :) – Michael Wehar Sep 6 '15 at 15:02
• Cool! Thanks for the updated reference. – Michael Wehar Aug 28 '19 at 23:54


text:
# Two similar-sized planets in the solar system are such that the escape velocity on one planet equals the orbital velocity of the other planet. Then the ratio of acceleration due to gravity on these planets is -

1. 4 ∶ 3
2. 1 ∶ 3
3. 2 ∶ 5
4. 1 ∶ 2

Option 4 : 1 ∶ 2
Free
Noun & Pronoun: Fill In The Blanks (Most Important Rules)
84.1 K Users
15 Questions 15 Marks 12 Mins

## Detailed Solution

The correct answer is option 4) i.e. 1 ∶ 2

CONCEPT:

• Escape velocity is the minimum velocity with which a body is projected from the surface of the planet so as to reach infinity, by overcoming the pull by gravity.

Escape velocity at the surface of a planet is given by:

$$⇒ V_e=\sqrt{\frac{2GM}{R}}$$

Where G = gravitational constant (6.67 × 10-11 Nm2/kg2), M = mass of the planet and R = radius of the planet.

• The time period of a satellite: It is the time taken by the satellite to complete one revolution around the Earth.

Consider a satellite orbiting the earth at a height h from the surface of the earth of radius R.

The circumference of orbit of satellite = 2πR

The orbital velocity of the satellite is given by:

$$⇒ v_0 =\sqrt{\frac{GM}{R}}$$

EXPLANATION:

• Given that the planets are similarly sized i.e. they have the same radii (R).
• Let the mass of the two planets be M1 and Mand the acceleration due to gravity be g1 and g2 respectively.
• The escape velocity = orbital velocity

⇒ Ve = vo

$$⇒ \sqrt{\frac{2GM_1}{R}}=\sqrt{\frac{GM_2}{R}}$$      ---(1)

• Acceleration due to gravity g is obtained from balancing the equation of force with the equation of gravitational force.

$$mg =\frac{GMm}{R^2}⇒ g =\frac{GM}{R^2}$$      ---(2)

Where M is the mass of the earth, m is the mass of an object, R is the radius of the earth, and G is the gravitational constant.

Substituting (2) in (1),

$$⇒ \sqrt{\frac{2g_1R^2}{R}}=\sqrt{\frac{g_2R^2}{R}}$$

$$\Rightarrow \frac{g_1}{g_2} = \frac{1}{2}$$

Latest Indian Coast Guard Navik GD Updates

Last updated on Nov 11, 2022

The Indian Coast Guard Navik GD new notification released. A total number of 225 vacancies had been released. The online application started on 6th February 2023 to 23rd February 2023. The application fees to apply for the position is Rs. 300. The candidates should go through the ICG Navik GD Syllabus and Exam Pattern to prepare for the exam in the right direction. The exam dates are expected to be released soon.


text:
# Math Help - understanding a step in proving that limit as x->0 of sinx/x =1

1. ## understanding a step in proving that limit as x->0 of sinx/x =1

as part of the proof that sinx/x=1 or x/sinx=1 we have this picture ->

I don't understand how they got from part 1 to part 2 of that.

2. ## Re: understanding a step in proving that limit as x->0 of sinx/x =1

Originally Posted by kingsolomonsgrave
as part of the proof that sinx/x=1 or x/sinx=1 we have this picture ->

I don't understand how they got from part 1 to part 2 of that.
Assuming that you are working with \displaystyle \begin{align*} \theta > 0, \cos{\theta} > 0 \end{align*}, then we have

\displaystyle \begin{align*} \theta &< \frac{\sin{\theta}}{\cos{\theta}} \\ \theta \cos{\theta} &< \sin{\theta} \\ \cos{\theta} &< \frac{\sin{\theta}}{\theta} \end{align*}

3. ## Re: understanding a step in proving that limit as x->0 of sinx/x =1

thanks! I get it now


text:
$$\require{cancel}$$

# 3.7: Heisenberg's Uncertainty Principle

Consider a real-space Hermitian operator, $$O(x)$$. A straightforward generalization of Equation ([e3.55a]) yields $\label{e3.84} \int_{-\infty}^\infty \psi_1^{\ast}\,(O\,\psi_2)\,dx = \int_{-\infty}^\infty (O\,\psi_1)^\ast\,\psi_2\,dx,$ where $$\psi_1(x)$$ and $$\psi_2(x)$$ are general functions.

Let $$f=(A-\langle A\rangle)\,\psi$$, where $$A(x)$$ is an Hermitian operator, and $$\psi(x)$$ a general wavefunction. We have $\int_{-\infty}^\infty |f|^{\,2}\,dx= \int_{-\infty}^\infty f^\ast\,f\,dx = \int_{-\infty}^\infty[(A-\langle A\rangle)\,\psi]^{\,\ast}\,[(A-\langle A\rangle)\,\psi]\,dx.$ Making use of Equation ([e3.84]), we obtain $\label{e3.86} \int_{-\infty}^\infty |f|^{\,2}\,dx=\int_{-\infty}^\infty \psi^\ast\,(A-\langle A \rangle)^{\,2}\,\psi\,dx = \sigma_A^{\,2},$ where $$\sigma_A^{\,2}$$ is the variance of $$A$$. [See Equation ([e3.24a]).] q4 Similarly, if $$g=(B-\langle B\rangle)\,\psi$$, where $$B$$ is a second Hermitian operator, then $\int_{-\infty}^\infty |g|^{\,2}\,dx = \sigma_B^{\,2},$

Now, there is a standard result in mathematics, known as the Schwartz inequality , which states that $\left|\int_a^b\,f^\ast(x)\,g(x)\,dx\right|^{\,2}\leq \int_a^b|f(x)|^{\,2}\,dx\,\int_a^b |g(x)|^{\,2}\,dx,$ where $$f$$ and $$g$$ are two general functions. Furthermore, if $$z$$ is a complex number then $\label{e3.89} |z|^{\,2} = [{\rm Re}(z)]^{\,2} + [{\rm Im}(z)]^{\,2} \geq [{\rm Im}(z)]^{\,2} = \left[\frac{1}{2\,{\rm i}}\,(z-z^\ast)\right]^{\,2}.$ Hence, if $$z=\int_{-\infty}^\infty f^\ast\,g\,dx$$ then Equations ([e3.86])–([e3.89]) yield $\label{e3.90} \sigma_A^{\,2}\,\sigma_B^{\,2} \geq \left[\frac{1}{2\,{\rm i}}\,(z-z^\ast)\right]^{\,2}.$ However, $z = \int_{-\infty}^{\infty} [(A-\langle A\rangle)\,\psi]^{\,\ast}\,[(B-\langle B\rangle)\,\psi]\,dx = \int_{-\infty}^{\infty} \psi^\ast\,(A-\langle A\rangle)\,(B-\langle B\rangle)\,\psi\,dx,$ where use has been made of Equation ([e3.84]). The previous equation reduces to $z =\int_{-\infty}^\infty \psi^\ast\,A\,B\,\psi\,dx -\langle A\rangle\,\langle B\rangle.$ Furthermore, it is easily demonstrated that $z ^\ast=\int_{-\infty}^\infty \psi^\ast\,B\,A\,\psi\,dx -\langle A\rangle\,\langle B\rangle.$ Hence, Equation ([e3.90]) gives $\label{e3.94} \sigma_A^{\,2}\,\sigma_B^{\,2} \geq \left(\frac{1}{2\,{\rm i}}\langle[A,B]\rangle\right)^{\,2},$ where $[A,B] \equiv A\,B-B\,A.$

Equation ([e3.94]) is the general form of Heisenberg’s uncertainty principle in quantum mechanics. It states that if two dynamical variables are represented by the two Hermitian operators $$A$$ and $$B$$, and these operators do not commute (i.e., $$A\,B\neq B\,A$$), then it is impossible to simultaneously (exactly) measure the two variables. Instead, the product of the variances in the measurements is always greater than some critical value, which depends on the extent to which the two operators do not commute.

For instance, displacement and momentum are represented (in real-space) by the operators $$x$$ and $$p\equiv-{\rm i}\,\hbar\,\partial/\partial x$$, respectively. Now, it is easily demonstrated that $[x,p] = {\rm i}\,\hbar.$ Thus, $\sigma_x\,\sigma_p\geq \frac{\hbar}{2},$ which can be recognized as the standard displacement-momentum uncertainty principle (see Section [sun]). It turns out that the minimum uncertainty (i.e., $$\sigma_x\,\sigma_p=\hbar/2$$) is only achieved by Gaussian wave-packets (see Section [s2.9]): that is, \begin{aligned} \psi(x) &= \frac ParseError: invalid DekiScript (click for details) Callstack: at (Bookshelves/Quantum_Mechanics/Book:_Introductory_Quantum_Mechanics_(Fitzpatrick)/03:_Fundamentals_of_Quantum_Mechanics/3.07:_Heisenberg's_Uncertainty_Principle), /content/body/p[5]/span[4]/span[1], line 1, column 1  {(2\pi\,\sigma_x^{\,2})^{1/4}}\,{\rm e}^{-(x-x_0)^{\,2}/4\,\sigma_x^{\,2}},\\[0.5ex] \phi(p) &=\frac ParseError: invalid DekiScript (click for details) Callstack: at (Bookshelves/Quantum_Mechanics/Book:_Introductory_Quantum_Mechanics_(Fitzpatrick)/03:_Fundamentals_of_Quantum_Mechanics/3.07:_Heisenberg's_Uncertainty_Principle), /content/body/p[5]/span[4]/span[2], line 1, column 1  {(2\pi\,\sigma_p^{\,2})^{1/4}}\,{\rm e}^{-(p-p_0)^{\,2}/4\,\sigma_p^{\,2}},\end{aligned} where $$\phi(p)$$ is the momentum-space equivalent of $$\psi(x)$$.

Energy and time are represented by the operators $$H\equiv{\rm i}\,\hbar\,\partial/\partial t$$ and $$t$$, respectively. These operators do not commute, indicating that energy and time cannot be measured simultaneously. In fact, $[H,t] = {\rm i}\,\hbar,$ so $\sigma_E\,\sigma_t\geq \frac{\hbar}{2}.$ This can be written, somewhat less exactly, as ${\mit\Delta}E\,{\mit\Delta} t\gtapp \hbar,$ where $${\mit\Delta}E$$ and $${\mit\Delta} t$$ are the uncertainties in energy and time, respectively. The previous expression is generally known as the energy-time uncertainty principle.

For instance, suppose that a particle passes some fixed point on the $$x$$-axis. Because the particle is, in reality, an extended wave-packet, it takes a certain amount of time, $${\mit\Delta}t$$, for the particle to pass. Thus, there is an uncertainty, $${\mit\Delta}t$$, in the arrival time of the particle. Moreover, because $$E=\hbar\,\omega$$, the only wavefunctions that have unique energies are those with unique frequencies: that is, plane-waves. Because a wave-packet of finite extent is made up of a combination of plane-waves of different wavenumbers, and, hence, different frequencies, there will be an uncertainty $${\mit\Delta}E$$ in the particle’s energy that is proportional to the range of frequencies of the plane-waves making up the wave-packet. The more compact the wave-packet (and, hence, the smaller $${\mit\Delta}t$$), the larger the range of frequencies of the constituent plane-waves (and, hence, the large $${\mit\Delta}E$$), and vice versa. To be more exact, if $$\psi(t)$$ is the wavefunction measured at the fixed point as a function of time then we can write $\psi(t)= \frac{1}{\sqrt{2\pi\,\hbar}}\int_{-\infty}^{\infty}\chi(E)\,{\rm e}^{-{\rm i}\,E\,t/\hbar}\,dE.$ In other words, we can express $$\psi(t)$$ as a linear combination of plane-waves of definite energy $$E$$. Here, $$\chi(E)$$ is the complex amplitude of plane-waves of energy $$E$$ in this combination. By Fourier’s theorem, we also have $\chi(E) = \frac{1}{\sqrt{2\pi\,\hbar}}\int_{-\infty}^{\infty}\psi(t)\,{\rm e}^{+{\rm i}\,E\,t/\hbar}\,dt.$ For instance, if $$\psi(t)$$ is a Gaussian then it is easily shown that $$\chi(E)$$ is also a Gaussian: that is, \begin{aligned} \psi(t) &= \frac ParseError: invalid DekiScript (click for details) Callstack: at (Bookshelves/Quantum_Mechanics/Book:_Introductory_Quantum_Mechanics_(Fitzpatrick)/03:_Fundamentals_of_Quantum_Mechanics/3.07:_Heisenberg's_Uncertainty_Principle), /content/body/p[7]/span[3]/span[1], line 1, column 1  {(2\pi\,\sigma_t^{\,2})^{1/4}}\,{\rm e}^{-(t-t_0)^{\,2}/4\,\sigma_t^{\,2}},\\[0.5ex] \chi(E) &=\frac ParseError: invalid DekiScript (click for details) Callstack: at (Bookshelves/Quantum_Mechanics/Book:_Introductory_Quantum_Mechanics_(Fitzpatrick)/03:_Fundamentals_of_Quantum_Mechanics/3.07:_Heisenberg's_Uncertainty_Principle), /content/body/p[7]/span[3]/span[2], line 1, column 1  {(2\pi\,\sigma_E^{\,2})^{1/4}}\,{\rm e}^{-(E-E_0)^{\,2}/4\,\sigma_E^{\,2}},\end{aligned} where $$\sigma_E\,\sigma_t=\hbar/2$$. As before, Gaussian wave-packets satisfy the minimum uncertainty principle $$\sigma_E\,\sigma_t=\hbar/2$$. Conversely, non-Gaussian wave-packets are characterized by $$\sigma_E\,\sigma_t>\hbar/2$$.

# Contributors

• Richard Fitzpatrick (Professor of Physics, The University of Texas at Austin)


text:
#### Problem 18E

Express the limit as a definite integral on the given interval. limni=1nxi1+xi3x,[2,5]