text:
# 16.3: Path Independence, Conservative Fields, and Potential Functions

We are searching data for your request:

Forums and discussions:
Manuals and reference books:
Data from registers:
Wait the end of the search in all databases.
Upon completion, a link will appear to access the found materials.

For certain vector fields, the amount of work required to move a particle from one point to another is dependent only on its initial and final positions, not on the path it takes. This section will discuss the properties of these vector fields.

Definition: Path Independent and Conservative

Let (mathbf{F}) be a vector field defined on an open region D in space, and suppose that for any two points A and B in D the line integral

[int_{C}^{ }mathbf{F}cdot mathit{d}mathbf{r}]

along a path C from A to B in D is the same over all paths from A to B. Then the integral [int_{C}^{ }mathbf{F}cdot mathit{d}mathbf{r}] is path independent in D and the field F is conservative on D.

## Potential Function

Definition: If F is a vector field defined on D and [mathbf{F}= riangledown f] for some scalar function f on D, then f is called a potential function for F. You can calculate all the line integrals in the domain F over any path between A and B after finding the potential function f

[int_{A}^{B}mathbf{F}cdot mathit{d}mathbf{r}=int_{A}^{B} riangledown fmathit{d}mathbf{r}=mathit{f(B)}-mathit{f(A)}]

This can be related back to the Fundamental Theorem of Calculus, since the gradient can be thought of as similar to the derivative. Another important property of conservative vector fields is that the integral of F around any closed path D is always 0.

## Assumptions on Curves, Vector Fields, and Domains

For computational sake, we have to assume the following properties regarding the curves, surfaces, domains, and vector fields:

1. The curves we consider are piecewise smooth, meaning they are composed of many infinitesimally small, smooth pieces connected end to end.
2. We assume that the domain D is a simply connected open region, meaning that any two points in D can be joined by a smooth curve within the region and that every loop in D can be contracted to a point in D without ever leaving D.

Theorem 1: Fundamental Theorem of Line Integrals

Let C be a smooth curve joining the point A to point B in the plane ore in space and parametrized by (mathbf{r}(t)). Let f be a differentiable function with a continuous gradient vector (mathbf{F}=igtriangledown{f}) on a domain D containing C. Then (int_{C}mathbf{F}cdot dmathbf{r}=f(B)-f(A)).

Proof

Suppose that A and B are two points in region D and that the curve C is given by [mathbf{r}(t)=xmathbf{i}+ymathbf{j}+zmathbf{k}] is a smooth curve in D that joins points A and B. Along C, f is a differentiable function of t and

[egin{align*} dfrac{partial f }{partial t}&=dfrac{partial f }{partial x}dfrac{partial x }{partial t}+dfrac{partial f }{partial y}dfrac{partial y }{partial t}+dfrac{partial f }{partial z}dfrac{partial z }{partial t} &=igtriangledown fcdot left ( dfrac{mathrm{d} x}{mathrm{d} t}mathbf{i}+dfrac{mathrm{d} y}{mathrm{d} t}mathbf{j}dfrac{mathrm{d} z}{mathrm{d} t}mathbf{k} ight ) &=igtriangledown fcdot dfrac{mathrm{d} mathbf{r}}{mathrm{d} t} &=mathbf{F}cdot dfrac{mathrm{d} mathbf{r}}{mathrm{d} t} end{align*}]

Therefore,

[int_{C}mathbf{F}cdot dmathbf{r}=int_{t=a}^{t=b}mathbf{F}cdot dfrac{mathrm{d} mathbf{r}}{mathrm{d} t}dt=int_a^bdfrac{mathrm{d} f}{mathrm{d} t}dt onumber]

*Note:

[mathbf{r}(a)=A, ; mathbf{r}(b)=B onumber]

Which means:

[left. f(g(t),h(t),k(t)) ight|_a^b=f(B)-f(A) onumber]

Thus proving Theorem 1. This shows us that the integral of a gradient field is easy to compute, provided we know the function (f).

(square)

As mentioned earlier, this is very similar to the Fundamental Theorem of Calculus both in theory and importance. Like the FTC, it provides us with a way to evaluate line integrals without limits of Riemann sums.

Theorem 2: Conservative Fields are Gradient Fields

Let (mathbf{F}=Mhat{mathbf{i}}+Nhat{mathbf{j}}+Phat{mathbf{k}}) be a vector field whose components are continuous throughout an open connected region D in space. Then F is conservative if and only it F is a gradient field (igtriangledown f) for a differentiable function f.

Proof

If F is a gradient field, then (mathbf{F}=igtriangledown f) for a differentiable function f. By Theorem 1, we know that [int_Cmathbf{F}cdot dmathbf{r}=f(B)-f(A)] and that the value of the line integral depends only on the two endpoints, not on the path. The line integral is said to be independent and F is a conservative field.

However, suppose F is a conservative vector field and we want to find some function f on D such that (igtriangledown f=mathbf{F}). First, we must pick a point A in the domain D such that (f(A)=0). For any other point B, we must define (f(B)) as equal to [int_Cmathbf{F}cdot dmathbf{r},] where the curve C is any smooth path in D from A to B. Because F is conservative, we know that (f(B)) is not dependant on C and vice versa. In order to show that (igtriangledown f=mathbf{F},) we need to show that

[dfrac{partial f}{partial x}=M, dfrac{partial f}{partial y}=N, dfrac{partial f}{partial z}=P. onumber]

Suppose B has coordinates ((x,y,z)) and a nearby point (B_0=(x_0,y,z).) By definition, then, the value of function f at the nearby point is [int_{C_0}mathbf{F}cdot dmathbf{r},] where (C_0) is any path from A to (B_0.) We can take path C to be the union between path (C_0) and line segment L from B to (B_0). Therefore,

[f(x,y,z)=int_{C_0}mathbf{F}cdot dmathbf{r}+int_Lmathbf{F}cdot dmathbf{r} onumber]

We can differentiate this integral, arriving at:

[dfrac{partial }{partial x}f(x,y,z)=dfrac{partial}{partial x}left ( int_{C_0}mathbf{F}cdot dmathbf{r}+int_Lmathbf{F}cdot dmathbf{r} ight ) onumber]

Only the last term of the above equation is dependent on x, so

[dfrac{partial }{partial x}f(x,y,z)=dfrac{partial }{partial x}int_Lmathbf{F}cdot dmathbf{r} onumber]

Now, if we parametrize (L) such that

[mathbf{r}(t)=tmathbf{i}+ymathbf{j}+zmathbf{k} onumber]

where (x_0leq t leq x) Then,

[dfrac{mathrm{d} r}{mathrm{d} t}=mathbf{i}] [mathbf{F}cdot dfrac{mathrm{d} r}{mathrm{d} t}=M onumber]

and

[int_Lmathbf{f}cdot dmathbf{r}=int_{x_0}^xM(t,y,z)dt] onumber]

Substitution gives us

[dfrac{partial }{partial x}f(x,y,z)=dfrac{partial }{partial x}int_{x_0}^xM(t,y,z)dt=M(x,y,z) onumber]

by the FTC. The partial derivatives

[dfrac{partial f}{partial y}=N onumber]

and

[dfrac{partial f}{partial z}=P onumber]

[mathbf{F}=igtriangledown f onumber]

(square)

In other words, (mathbf{F}=igtriangledown f) is only true when, for any two point A and B in the region D, (int_Cmathbf{F}cdot dmathbf{r}) is independent of the path C that joins the two points in D.

Theorem 3: Looper Property of Conservative Fields

The following statements are equivalent:

• (oint_{C}mathbf{F}cdot dmathbf{r}=0) around every loop (closed curve C) in D.
• The field F is conservative on D.

Proof

Part 1

We want to show that for any two points A and B in D, the ingtegral of

[mathbf{F}cdot dmathbf{r} onumber]

has the same value over any two paths (C_1) & (C_2) from A to B.

We reverse the direction of (C_2) to make the path (-C_2) from B to A.

Together, the two curves (C_1) & (-C_2) make a closed loop, which we will call C.

If you recall from earlier in this section, the integral over a closed loop for a conservative field is always 0:

[egin{align*} int_{C_1}mathbf{F}cdot dmathbf{r}-int_{C_2}mathbf{F}cdot dmathbf{r}&=int_{C_1}mathbf{F}cdot dmathbf{r}+int_{-C_2}mathbf{F}cdot dmathbf{r} &=int_Cmathbf{F}cdot dmathbf{r} &=0 end{align*}]

Therefore, the integrals over (C_1) & (C_2) must be equal.

Part 2

We want to show that the integral over (mathbf{F}cdot dmathbf{r}) is zero for any closed loop C. We pick two points A & B on C and use them to break C into 2 pieces: (C_1) from A to B and (C_2) from B back to A.

Therefore:

[egin{align*} oint _Cmathbf{F}cdot dmathbf{r}&=int_{C_1}mathbf{F}cdot dmathbf{r}+int_{C_2}mathbf{F}cdot dmathbf{r} &=int_A^Bmathbf{F}cdot dmathbf{r}-int_A^Bmathbf{F}cdot dmathbf{r} &=0 end{align*}]

(square)

## Finding Potentials for Conservative Fields

Component Test for Conservative Fields: Let (mathbf{F}=M(x,y,z)hat{ extbf{i}} + N(x,y,z) hat{ extbf{j}}+ P(x,y,z) hat{ extbf{k}} ) be a field on a connected and simply connected domain whose component functions have continuous first partial derivatives. Then, F is conservative if and only if

[dfrac{partial P }{partial x}=dfrac{partial M}{partial z}]

[dfrac{partial P }{partial y}=dfrac{partial N}{partial z}]

and

[dfrac{partial N }{partial x}=dfrac{partial M}{partial y}.]

*Note: See Example 2

Definition: Exact Differential Forms

Any expression

[M(x,y,z)dx+N(x,y,z)dy+P(x,y,z)dz]

is a differential form. A differential form is exact on a domain D in space if

[M,dx+N,dy+P,dz=dfrac{partial f}{partial x}dx+dfrac{partial f}{partial y}dy+dfrac{partial f}{partial z}dz=df]

for some scalar function f throughout D.

Component Test for Exactness of (Mdx+Ndy+Pdz): The differential form (Mdx+Ndy+Pdz) is exact on a connected and simply connected domain if and only if

[dfrac{partial P }{partial x}=dfrac{partial M}{partial z}]

[dfrac{partial P }{partial y}=dfrac{partial N}{partial z}]

and

[dfrac{partial N }{partial x}=dfrac{partial M}{partial y}]

Notice, this is the same as saying the field (mathbf{F}=Mhat{mathbf{i}}+Nhat{mathbf{j}}+Phat{mathbf{k}}) is conservative.

Example (PageIndex{1})

Suppose the force field (mathbf{F}=igtriangledown f) is the gradient of the function (f(x,y,z)=-dfrac{1}{x^2+y^2+z^2}). Find the work done by F in moving an object along a smooth curve C joining ((1,0,0)) to ((0,0,2)) that does not pass through the origin.

Solution

Since we know that this is a conservative field, we can apply Theorem 1, which shows that regardless of the curve C, the work done by F will be as follows:

[egin{align(} int_{C}mathbf{F}cdot dmathbf{r}&=f(0,0,2)-f(1,0,0) &=-dfrac{1}{4}-(-1) &=dfrac{3}{4} end{align(}]

Example (PageIndex{2})

Show that

[mathbf{F}=(e^x cos y+yz)hat{mathbf{i}}+(xz-e^xsin y)hat{mathbf{j}}+(xy+z)hat{mathbf{k}} onumber]

is conservative over its natural domain and find a potential function for it.

Solution

The natural domain of F is all of space, which is connected and simply connected. Let's define the following:

[M=e^xcos y+yz onumber]

[N=xz-e^xsin y onumber]

[P=xy+z onumber]

and calculate

[dfrac{partial P }{partial x}=y=dfrac{partial M}{partial z} onumber]

[dfrac{partial P }{partial y}=x=dfrac{partial N}{partial z} onumber]

[dfrac{partial N }{partial x}=-e^xsin y=dfrac{partial M}{partial y}. onumber]

Because the partial derivatives are continuous, F is conservative. Now that we know there exists a function f where the gradient is equal to F, let's find f.

[dfrac{partial f }{partial x}=e^xcos y+yz onumber]

[dfrac{partial f }{partial y}=xz-e^xsin y onumber]

[dfrac{partial f }{partial z}=xy+z onumber ]

If we integrate the first of the three equations with respect to x, we find that

[f(x,y,z)=int(e^x/cos y+yz)dx=e^xcos y+xyz+g(y,z)]

where (g(y,z)) is a constant dependent on (y) and (z) variables. We then calculate the partial derivative with respect to (y) from this equation and match it with the equation of above.

[dfrac{partial }{partial y}(f(x,y,z))=-e^x/sin y+xz+dfrac{partial g}{partial y}=xz-e^xsin y onumber]

This means that the partial derivative of (g) with respect to (y) is 0, thus eliminating (y) from (g) entirely and leaving it as a function of (z) alone.

[f(x,y,z)=e^xcos y+xyz+h(z) onumber]

We then repeat the process with the partial derivative with respect to (z).

[dfrac{partial }{partial z}(f(x,y,z))=xy+dfrac{mathrm{d} h}{mathrm{d} z}=xy+z onumber]

which means that

[dfrac{mathrm{d} h}{mathrm{d} z}= z onumber]

so we can find (h(z)) by integrating:

[h(z)=dfrac{z^2}{2}+C. onumber]

Therefore,

[f(x,y,z)=e^xcos y+xyz+dfrac{z^2}{2}+C. onumber]

We still have infinitely many potential functions for F-one at each value of C.

Example (PageIndex{3})

Show that ( ydx+xdy+4dz) is exact and evaluate the integral

[int_{(1,1,1)}^{(2,3,-1)}ydx+xdy+4dz onumber]

over any path from ((1,1,1)) to ((2,3,-1)).

Solution

We let (M=y), (N=x), and (P=4). Apply the Test for Exactness:

[dfrac{partial N}{partial x}=1=dfrac{partial M}{partial y} onumber]

[dfrac{partial N}{partial z}=0=dfrac{partial P}{partial y} onumber]

and

[dfrac{partial N}{partial z}=0=dfrac{partial P}{partial y}. onumber]

This proves that (ydx+xdy+4dz) is exact, so

[ydx+xdy+4dz=df onumber]

for some function f, and the integral's value is (f(2,3,-1)-f(1,1,1)).

We find fo up to a constant by integrating the following equations:

[dfrac{partial f}{partial x}=y, dfrac{partial f}{partial y}=x, dfrac{partial f}{partial z}=4 onumber]

From the first equation, we get that (f(x,y,z)=xy+g(y,z))

The second equation tells us that (dfrac{partial f}{partial y}=x+dfrac{partial g}{partial y}=x)

Therefore,

[dfrac{partial g}{partial y}=0 onumber]

Hence,

[f(x,y,z)=xy+h(z) onumber]

The third equation tells us that (dfrac{partial f}{partial z}=0+dfrac{d h}{d z}=4) so (h(z)=4z+C)

Therefore,

[f(x,y,z)=xy+4z+C onumber]

By substitution, we find that:

[f(2,3,-1)-f(1,1,1)=2+C-(5+C)=-3 onumber]

## References

1. Weir, Maurice D., Joel Hass, and George B. Thomas. Thomas' Calculus: Early Transcendentals. Boston: Addison-Wesley, 2010. Print.

## Math Insight

The process of finding a potential function of a conservative vector field is a multi-step procedure that involves both integration and differentiation, while paying close attention to the variables you are integrating or differentiating with respect to. For this reason, given a vector field $dlvf$, we recommend that you first determine that that $dlvf$ is indeed conservative before beginning this procedure. That way you know a potential function exists so the procedure should work out in the end.

In this page, we focus on finding a potential function of a two-dimensional conservative vector field. We address three-dimensional fields in another page.

We introduce the procedure for finding a potential function via an example. Let's use the vector field egin dlvf(x,y) = (y cos x+y^2, sin x+2xy-2y). end

The first step is to check if $dlvf$ is conservative. Since egin pdiff &= pdiff<>(sin x+2xy-2y) = cos x+2y pdiff &= pdiff<>(y cos x+y^2) = cos x+2y, end we conclude that the scalar curl of $dlvf$ is zero, as egin pdiff - pdiff = 0. end Next, we observe that $dlvf$ is defined on all of $R^2$, so there are no tricks to worry about. The vector field $dlvf$ is indeed conservative.

Since $dlvf$ is conservative, we know there exists some potential function $f$ so that $abla f = dlvf$. As a first step toward finding $f$, we observe that the condition $abla f = dlvf$ means that egin left(pdiff,pdiff ight) &= (dlvfc_1, dlvfc_2) &= (y cos x+y^2, sin x+2xy-2y). end This vector equation is two scalar equations, one for each component. We need to find a function $f(x,y)$ that satisfies the two conditions egin pdiff(x,y) = y cos x+y^2 label end and egin pdiff(x,y) = sin x+2xy -2y. label end Let's take these conditions one by one and see if we can find an $f(x,y)$ that satisfies both of them. (We know this is possible since $dlvf$ is conservative. If $dlvf$ were path-dependent, the procedure that follows would hit a snag somewhere.)

Let's start with condition eqref. We can take the equation egin pdiff(x,y) = y cos x+y^2, end and treat $y$ as though it were a number. In other words, we pretend that the equation is egin diff(x) = a cos x + a^2 end for some number $a$. We can integrate the equation with respect to $x$ and obtain that egin f(x)= a sin x + a^2x +C. end But, then we have to remember that $a$ really was the variable $y$ so that egin f(x,y) = y sin x + y^2x +C. end But actually, that's not right yet either. Since we were viewing $y$ as a constant, the integration &ldquoconstant&rdquo $C$ could be a function of $y$ and it wouldn't make a difference. The partial derivative of any function of $y$ with respect to $x$ is zero. We can replace $C$ with any function of $y$, say $g(y)$, and condition eqref will be satisfied. A new expression for the potential function is egin f(x,y) = y sin x + y^2x +g(y). label end If you are still skeptical, try taking the partial derivative with respect to $x$ of $f(x,y)$ defined by equation eqref. Since $g(y)$ does not depend on $x$, we can conclude that $displaystyle pdiff<> g(y) = 0$. Indeed, condition eqref is satisfied for the $f(x,y)$ of equation eqref.

Now, we need to satisfy condition eqref. We can take the $f(x,y)$ of equation eqref (so we know that condition eqref will be satisfied) and take its partial derivative with respect to $y$, obtaining egin pdiff(x,y) &= pdiff<> left( y sin x + y^2x +g(y) ight) &= sin x + 2yx + diff(y). end Comparing this to condition eqref, we are in luck. We can easily make this $f(x,y)$ satisfy condition eqref as long as egin diff(y)=-2y. end If the vector field $dlvf$ had been path-dependent, we would have found it impossible to satisfy both condition eqref and condition eqref. We would have run into trouble at this point, as we would have found that $diff$ would have to be a function of $x$ as well as $y$. Since $diff$ is a function of $y$ alone, our calculation verifies that $dlvf$ is conservative.

If we let egin g(y) = -y^2 +k end for some constant $k$, then egin pdiff(x,y) = sin x + 2yx -2y, end and we have satisfied both conditions.

Combining this definition of $g(y)$ with equation eqref, we conclude that the function egin f(x,y) = ysin x + y^2x -y^2 +k end is a potential function for $dlvf.$ You can verify that indeed egin abla f = (ycos x + y^2, sin x + 2xy -2y) = dlvf(x,y). end

With this in hand, calculating the integral egin dlint end is simple, no matter what path $dlc$ is. We can apply the gradient theorem to conclude that the integral is simply $f(vc)-f(vc )$, where $vc$ is the beginning point and $vc$ is the ending point of $dlc$. (For this reason, if $dlc$ is a closed curve, the integral is zero.)

We might like to give a problem such as find egin dlint end where $dlc$ is the curve given by the following graph.

The answer is simply egin dlint &= f(pi/2,-1) - f(-pi,2) &=-sin pi/2 + frac<2>-1 + k - (2 sin (-pi) - 4pi -4 + k) &=- sin pi/2 + frac<9pi> <2>+3= frac<9pi> <2>+2 end (The constant $k$ is always guaranteed to cancel, so you could just set $k=0$.)

If the curve $dlc$ is complicated, one hopes that $dlvf$ is conservative. It's always a good idea to check if $dlvf$ is conservative before computing its line integral egin dlint. end You might save yourself a lot of work.

1.1 Functions and Their Graphs

1.2 Combining Functions Shifting and Scaling Graphs

1.3 Trigonometric Functions

1.4 Graphing with Software

1.6 Inverse Functions and Logarithms

2.1 Rates of Change and Tangents to Curves

2.2 Limit of a Function and Limit Laws

2.3 The Precise Definition of a Limit

2.6 Limits Involving Infinity Asymptotes of Graphs

3.1 Tangents and the Derivative at a Point

3.2 The Derivative as a Function

3.4 The Derivative as a Rate of Change

3.5 Derivatives of Trigonometric Functions

3.7 Implicit Differentiation

3.8 Derivatives of Inverse Functions and Logarithms

3.9 Inverse Trigonometric Functions

3.11 Linearization and Differentials

4 Applications of Derivatives

4.1 Extreme Values of Functions

4.2 The Mean Value Theorem

4.3 Monotonic Functions and the First Derivative Test

4.4 Concavity and Curve Sketching

4.5 Indeterminate Forms and L’Hôpital’s Rule

5.1 Area and Estimating with Finite Sums

5.2 Sigma Notation and Limits of Finite Sums

5.4 The Fundamental Theorem of Calculus

5.5 Indefinite Integrals and the Substitution Method

5.6 Definite Integral Substitutions and the Area Between Curves

6 Applications of Definite Integrals

6.1 Volumes Using Cross-Sections

6.2 Volumes Using Cylindrical Shells

6.4 Areas of Surfaces of Revolution

6.6 Moments and Centers of Mass

7 Integrals and Transcendental Functions

7.1 The Logarithm Defined as an Integral

7.2 Exponential Change and Separable Differential Equations

7.4 Relative Rates of Growth

8 Techniques of Integration

8.1 Using Basic Integration Formulas

8.3 Trigonometric Integrals

8.4 Trigonometric Substitutions

8.5 Integration of Rational Functions by Partial Fractions

8.6 Integral Tables and Computer Algebra Systems

9 First-Order Differential Equations

9.1 Solutions, Slope Fields, and Euler’s Method

9.2 First-Order Linear Equations

9.4 Graphical Solutions of Autonomous Equations

9.5 Systems of Equations and Phase Planes

10 Infinite Sequences and Series

10.5 Absolute Convergence The Ratio and Root Tests

10.6 Alternating Series and Conditional Convergence

10.8 Taylor and Maclaurin Series

10.9 Convergence of Taylor Series

10.10 The Binomial Series and Applications of Taylor Series

11 Parametric Equations and Polar Coordinates

11.1 Parametrizations of Plane Curves

11.2 Calculus with Parametric Curves

11.4 Graphing Polar Coordinate Equations

11.5 Areas and Lengths in Polar Coordinates

11.7 Conics in Polar Coordinates

12 Vectors and the Geometry of Space

12.1 Three-Dimensional Coordinate Systems

12.5 Lines and Planes in Space

13 Vector-Valued Functions and Motion in Space

13.1 Curves in Space and Their Tangents

13.2 Integrals of Vector Functions Projectile Motion

13.4 Curvature and Normal Vectors of a Curve

13.5 Tangential and Normal Components of Acceleration

13.6 Velocity and Acceleration in Polar Coordinates

14.1 Functions of Several Variables

14.2 Limits and Continuity in Higher Dimensions

14.5 Directional Derivatives and Gradient Vectors

14.6 Tangent Planes and Differentials

14.7 Extreme Values and Saddle Points

14.9 Taylor’s Formula for Two Variables

14.10 Partial Derivatives with Constrained Variables

15.1 Double and Iterated Integrals over Rectangles

15.2 Double Integrals over General Regions

15.3 Area by Double Integration

15.4 Double Integrals in Polar Form

15.5 Triple Integrals in Rectangular Coordinates
15.6 Moments and Centers of Mass

## 16.3: Path Independence, Conservative Fields, and Potential Functions

In the previous section we saw that if we knew that the vector field (vec F) was conservative then (intlimits_<>) was independent of path. This in turn means that we can easily evaluate this line integral provided we can find a potential function for (vec F).

In this section we want to look at two questions. First, given a vector field (vec F) is there any way of determining if it is a conservative vector field? Secondly, if we know that (vec F) is a conservative vector field how do we go about finding a potential function for the vector field?

The first question is easy to answer at this point if we have a two-dimensional vector field. For higher dimensional vector fields we’ll need to wait until the final section in this chapter to answer this question. With that being said let’s see how we do it for two-dimensional vector fields.

#### Theorem

Let (vec F = P,vec i + Q,vec j) be a vector field on an open and simply-connected region (D). Then if (P) and (Q) have continuous first order partial derivatives in (D) and

the vector field (vec F) is conservative.

Let’s take a look at a couple of examples.

1. (vec Fleft( ight) = left( <- yx> ight)vec i + left( <- xy> ight)vec j)
2. (vec Fleft( ight) = left( <2x<<f>^> + y<<f>^>> ight)vec i + left( <<<f>^> + 2y> ight)vec j)

Okay, there really isn’t too much to these. All we do is identify (P) and (Q) then take a couple of derivatives and compare the results.

In this case here is (P) and (Q) and the appropriate partial derivatives.

So, since the two partial derivatives are not the same this vector field is NOT conservative.

Here is (P) and (Q) as well as the appropriate derivatives.

The two partial derivatives are equal and so this is a conservative vector field.

Now that we know how to identify if a two-dimensional vector field is conservative we need to address how to find a potential function for the vector field. This is actually a fairly simple process. First, let’s assume that the vector field is conservative and so we know that a potential function, (fleft( ight)) exists. We can then say that,

Or by setting components equal we have,

By integrating each of these with respect to the appropriate variable we can arrive at the following two equations.

We saw this kind of integral briefly at the end of the section on iterated integrals in the previous chapter.

It is usually best to see how we use these two facts to find a potential function in an example or two.

1. (vec F = left( <2+ x> ight)vec i + left( <2+ y> ight)vec j)
2. (vec Fleft( ight) = left( <2x<<f>^> + y<<f>^>> ight)vec i + left( <<<f>^> + 2y> ight)vec j)

Let’s first identify (P) and (Q) and then check that the vector field is conservative.

So, the vector field is conservative. Now let’s find the potential function. From the first fact above we know that,

From these we can see that

We can use either of these to get the process started. Recall that we are going to have to be careful with the “constant of integration” which ever integral we choose to use. For this example let’s work with the first integral and so that means that we are asking what function did we differentiate with respect to (x) to get the integrand. This means that the “constant of integration” is going to have to be a function of (y) since any function consisting only of (y) and/or constants will differentiate to zero when taking the partial derivative with respect to (x).

Here is the first integral.

where (hleft( y ight)) is the “constant of integration”.

We now need to determine (hleft( y ight)). This is easier than it might at first appear to be. To get to this point we’ve used the fact that we knew (P), but we will also need to use the fact that we know (Q) to complete the problem. Recall that (Q) is really the derivative of (f) with respect to (y). So, if we differentiate our function with respect to (y) we know what it should be.

So, let’s differentiate (f) (including the (hleft( y ight))) with respect to (y) and set it equal to (Q) since that is what the derivative is supposed to be.

From this we can see that,

Notice that since (h'left( y ight)) is a function only of (y) so if there are any (x)’s in the equation at this point we will know that we’ve made a mistake. At this point finding (hleft( y ight)) is simple.

So, putting this all together we can see that a potential function for the vector field is,

Note that we can always check our work by verifying that ( abla f = vec F). Also note that because the (c) can be anything there are an infinite number of possible potential functions, although they will only vary by an additive constant.

Okay, this one will go a lot faster since we don’t need to go through as much explanation. We’ve already verified that this vector field is conservative in the first set of examples so we won’t bother redoing that.

This means that we can do either of the following integrals,

While we can do either of these the first integral would be somewhat unpleasant as we would need to do integration by parts on each portion. On the other hand, the second integral is fairly simple since the second term only involves (y)’s and the first term can be done with the substitution (u = xy). So, from the second integral we get,

Notice that this time the “constant of integration” will be a function of (x). If we differentiate this with respect to (x) and set equal to (P) we get,

So, in this case it looks like,

[h'left( x ight) = 0hspace <0.25in>Rightarrow hspace<0.25in>hleft( x ight) = c]

So, in this case the “constant of integration” really was a constant. Sometimes this will happen and sometimes it won’t.

Here is the potential function for this vector field.

Now, as noted above we don’t have a way (yet) of determining if a three-dimensional vector field is conservative or not. However, if we are given that a three-dimensional vector field is conservative finding a potential function is similar to the above process, although the work will be a little more involved.

In this case we will use the fact that,

Let’s take a quick look at an example.

Okay, we’ll start off with the following equalities.

To get started we can integrate the first one with respect to (x), the second one with respect to (y), or the third one with respect to (z). Let’s integrate the first one with respect to (x).

Note that this time the “constant of integration” will be a function of both (y) and (z) since differentiating anything of that form with respect to (x) will differentiate to zero.

Now, we can differentiate this with respect to (y) and set it equal to (Q). Doing this gives,

Of course we’ll need to take the partial derivative of the constant of integration since it is a function of two variables. It looks like we’ve now got the following,

[left( ight) = 0hspace <0.5in>Rightarrow hspace<0.5in>gleft( ight) = hleft( z ight)]

Since differentiating (gleft( ight)) with respect to (y) gives zero then (gleft( ight)) could at most be a function of (z). This means that we now know the potential function must be in the following form.

To finish this out all we need to do is differentiate with respect to (z) and set the result equal to (R).

[h'left( z ight) = 0hspace <0.25in>Rightarrow hspace<0.25in>,,,hleft( z ight) = c]

The potential function for this vector field is then,

Note that to keep the work to a minimum we used a fairly simple potential function for this example. It might have been possible to guess what the potential function was based simply on the vector field. However, we should be careful to remember that this usually won’t be the case and often this process is required.

Also, there were several other paths that we could have taken to find the potential function. Each would have gotten us the same result.

Let’s work one more slightly (and only slightly) more complicated example.

Here are the equalities for this vector field.

For this example let’s integrate the third one with respect to (z).

The “constant of integration” for this integration will be a function of both (x) and (y).

Now, we can differentiate this with respect to (x) and set it equal to (P). Doing this gives,

So, it looks like we’ve now got the following,

[left( ight) = 2xcos left( y ight)hspace <0.5in>Rightarrow hspace<0.5in>gleft( ight) = cos left( y ight) + hleft( y ight)]

The potential function for this problem is then,

To finish this out all we need to do is differentiate with respect to (y) and set the result equal to (Q).

[h'left( y ight) = 3hspace <0.25in>Rightarrow hspace<0.25in>,,,hleft( y ight) = 3y + c]

The potential function for this vector field is then,

So, a little more complicated than the others and there are again many different paths that we could have taken to get the answer.

We need to work one final example in this section.

Now, we could use the techniques we discussed when we first looked at line integrals of vector fields however that would be particularly unpleasant solution.

Instead, let’s take advantage of the fact that we know from Example 2a above this vector field is conservative and that a potential function for the vector field is,

Using this we know that integral must be independent of path and so all we need to do is use the theorem from the previous section to do the evaluation.

[vec rleft( 1 ight) = leftlangle < - 2,1> ight angle hspace<0.5in>vec rleft( 0 ight) = leftlangle < - 1,0> ight angle ]

## Solved Problems

Click or tap a problem to see the solution.

### Example 1

1. (AB) is the line segment from (Aleft( <0,0> ight)) to (Bleft( <1,1> ight))
2. (AB) is the parabola (y = ) from (Aleft( <0,0> ight)) to (Bleft( <1,1> ight)).

### Example 1.

1. (AB) is the line segment from (Aleft( <0,0> ight)) to (Bleft( <1,1> ight))
2. (AB) is the parabola (y = ) from (Aleft( <0,0> ight)) to (Bleft( <1,1> ight)).

Consider the first case. Obviously, the equation of the line is (y = x.) Then using the formula

If the curve (AB) is parabola (y = ,) we have

that is we have obtained the same answer.

Apply the test (><> ormalsize> = ><> ormalsize>) to determine if the vector field is conservative.

As it can be seen, the vector field (mathbf = left( ight)) is conservative. This explains the result that the line integral is path independent.

## Conservative Vector Fields

Theorem. If is a vector field in the plane, and P and Q have continuous partial derivatives on a region. the following four statements are equivalent:

1. for some function .

2. .

3. If is a closed curve lying in the region --- i.e. a path which starts and ends at the same point --- then

4. ( Path independence) If and are paths in the region which start at the same point and end at the same point, then

To say that these statements are equivalent means that if one of them is true, then all of them are true (and if one of them is false, all of them are false). A field that satisfies any one of these conditions is a conservative field --- or sometimes a gradient field, or sometimes path independent.

Before I show that these statements are equivalent, I'll give a couple of examples.

Example. Show that is a gradient field.

I want a function f such that , i.e.

Integrate the first equation with respect to x:

Since the integral is with respect to x, y is constant, and must be included in the arbitrary constant --- hence . Differentiate with respect to y and set the result equal to above:

I get , so . This time, D is a numerical constant. Since the derivative of a number is 0, and since I just want some potential function (see the previous example), I might as well take . Then , so

Thus, if , then

Definition. A function f such that is called a potential function for .

Example. Let and

Theorem. Suppose is a gradient field, and let for be a path. Then

In other words, to evaluate the integral of a gradient field, just plug the endpoints of the path ( and ) into the potential function (f).

The antiderivative of the derivative of is just , so

Example. Compute , where

To compute this directly, you would need to do the integral

Instead, notice that if , then , which is the field in the integral. Hence, I can compute the integral by plugging the endpoints of the path into f.

(The fact that it comes out to 0, as opposed to a nonzero number, is a coincidence.) The important thing to notice is how easy it was to do the computation!

Now I will go back and prove that the four statements which define a conservative field are equivalent. To prove that they're equivalent, I must show that any one of them follows from any other. I will do it this way:

Proof. First, assume statement 1 is true, so for some f. Since , this means that

But the two second derivatives are equal by equality of mixed partials, so . This is statement 2.

Next, assume statement 2 is true, so . Take a closed curve . I want to show that the integral around is 0. This follows from Green's theorem, which I'll discuss in more detail later. For now, note that the closed curve encloses a region R.

But the double integral on the right is 0, because . Therefore, the integral around a closed curve is 0, and that is statement 3.

Before I do the next step, here is some notation. If is a curve, will denote the same curve traversed in the opposite direction.

If I traverse a curve backward, the line integral flips its sign:

Now assume statement 3 is true: The line integral around a closed curve is 0. Take curves and , both of which start at P and both of which end at Q. I need to show that

Note that is a closed curve. So the integral around is 0:

The second integral is the negative of the integral along :

Finally, move the second integral to the other side:

This is what I wanted to prove, so statement 4 follows from statement 3.

Finally, suppose statement 4 is true: The field is path independent. I want to show that is a gradient field. I need to find a function f such that . To do this, take any path from to and define

By path independence, it does not matter what path I choose. Now I have to show that and .

Consider the path from to made up of segments as shown below:

The horizontal part is for . The velocity vector is , and . So

Therefore, the integral for the horizontal segment is

The vertical part is for . The velocity vector is and . So

Therefore, the integral for the vertical segment is

The line integral along the whole path --- which by definition is f --- is

Remember that I was trying to show that and . Differentiate the last equation with respect to y.

The first integral only involves x, so its derivative with respect to y is 0. For the second integral, apply the Fundamental Theorem of Calculus: The y in the top limit replaces the t in the integrand and I get . So

That is, f has the right y derivative.

If you take a path made up of segments going from to the "other way" --- along the y-axis, then horizontally --- you can show in similar fashion that . This proves that , which is statement 1.

And that finishes the proof that the four statements are equivalent.

The last part of the proof gives a way of constructing a potential function for a gradient field. It's perhaps not the best way for a human being to do this, but would be a reasonable approach if you were doing this on a computer.

Example. Find a potential function for using the line integrals in the proof of the theorem.

I can find f using the formula

Here , so . Likewise, , so . So

By the way, notice that is also a potential function for this field, since and . There are infinitely many potential functions for a gradient field they differ by a numerical constant.

So far, I've discussed vector fields in , 2 dimensions. There are few surprises when you move up to 3 dimensions.

Theorem. Let be a 3-dimensional vector field, and assume its components have continuous partial derivatives. Then the following four statements are equivalent:

1. for some function .

2. .

3. If is a closed curve --- i.e. a path which starts and ends at the same point --- then

4. ( Path independence) If and are paths which start at the same point and end at the same point, then

Once again, a field that satisfies any one of these conditions is a conservative field --- or sometimes a gradient field, or sometimes path independent.

The only change in moving from 2 dimensions to 3 dimensions is in statement 2. To see how this is related to the for a 2-dimensional field, take a field and regard it as a 3-dimensional field by making the third component 0, so

(Notice that, e.g., , because P does not contain any z's.) The condition is, in this case, the same as .

In fact, the components of should have continuous first partials, except perhaps at finitely many points. Here's the reason I can allow finitely many "bad points" in this case but none in the 2-dimensional case.

Think of a closed curve as a piece of string. In a rough sense, the reason why the integral of a conservative field around a closed curve is 0 is that the string can be "reeled in" to the basepoint without changing the integral.

When the curve has been reeled in to a single point, the integral over the curve is obviously 0.

In 2 dimensions, a curve can "get stuck" on a single bad point as you reel it in.

However, in 3 dimensions, you have enough room to move the curve around finitely many bad points as you reel it in.

Example. Show that is conservative, and find a potential function for .

Therefore, is conservative. A potential function f must satisfy

Integrate the first equation with respect to x:

Since the integral is with respect to x, y and z are constant, and must be included in the arbitrary constant . Now differentiate with respect to y and set the result equal to above:

I find that , so integrating with respect to y,

This time, z is constant and must be included in the arbitrary constant . Plug this back into f it is

Finally, differentiate with respect to z and set the result equal to above:

I find that , so , where E is a numerical constant. As in an earlier example, I may take . This gives , so

Example. Compute , where

You could compute the integral directly --- would you want to? There must be an easier way .

Since , the field is conservative. If I can find a potential function, I can compute the integral by simply plugging the endpoints of the path into the potential function.

A potential function f must satisfy

Integrate the first equation with respect to x:

Since the integral is with respect to x, y and z are constant, and must be included in the arbitrary constant . Now differentiate with respect to y and set the result equal to above:

I find that , so integrating with respect to y,

This time, z is constant and must be included in the arbitrary constant . Plug this back into f it is

Finally, differentiate with respect to z and set the result equal to above:

I find that , so , where E is a numerical constant. As in an earlier example, I may take . This gives , so

The endpoints of the path are

Example. is a path with positive components from a point P on to a point Q on . Compute , where

The path isn't given --- in fact, its endpoints aren't given. Therefore, the path must not matter, i.e. the integral is probably path independent. In fact, , for . Therefore,

Now Q is on , so for this point . Likewise, P is on , so for this point . Hence,

## Conservative Vector Fields

• Misc
• Section 16.3
• Confusing, connections between pieces?
• Intuitively, connected means you can draw a possibly curved line between any 2 points in the set without leaving the set
• Simply connected means any circle in the set can be pulled tight into a point without leaving the set
• Path independence ?
• You saw an example when we integrated work over 2 flights of stairs that reached the same height&mdashthe integrals were the same, independent of the path of the stairs
• Integral of F same over all paths
• Equivalent to field being conservative
• Main new thing here is name &ldquopotential function,&rdquo a label that&rsquos useful for talking about integrals of conservative fields
• f is potential function for F
• This basically just states a useful connection between 2 kinds of vector fields
• That the integral is 0 follows from the fundamental theorem
• But other direction also interesting, i.e., if you find that integrals around closed loops are always 0 then you know your field is conservative
• Unintuitive now, but we may be able to see where this comes from in a week or so
• M(x,y,z) dx + N(x,y,z) dy + P(x,y,z) dz
• Exactness captures the differential form of those line integrals that happen to be of vector fields
• Let f(x,y,z) = x(y-sin(z 2 )) / (z 2 + e xy ), let F = grad f, and let C be the curve x = sint cost, y = t 2 (&pi/2-t), z = &pi, 0 &le t &le &pi/2
• Find the integral of F around C
• 0, by closed loop theorem and because F is conservative&mdashit&rsquos a gradient field
• By fundamental theorem, integral = f(1, 0, &radic(&pi/2) ) - f( 0, 0, 0 )
• = 1 ( 0-sin(&pi/2) ) / ( &pi/2 + e 0 ) - f(0,0,0) = -1 / (&pi/2 + 1) - 0
• Component test says it is
• So also find potential function
• Green&rsquos Theorem

## Math Insight

Many physical force fields (vector fields) that you are familiar with are conservative vector fields. The term comes from the fact that some kind of energy is conserved by these force fields. The important consequence for us, though, is that as you move an object from point $vc$ to point $vc$, the work performed by a conservative force field does not depend on the path taken from point $vc$ to point $vc$. For this reason, we often refer to such vector fields as path-independent vector fields. Path-independent and conservative are just two terms that mean the same thing.

For example, imagine you have to carry a heavy box from your front door to your bedroom upstairs. Because of the gravity (which can be viewed as a force field), you have to do work to carry the box up.

Here we mean the scientific definition of work, which is force times distance. Although it may feel like work to move the box from one room to another on the same floor, the actual work done against gravity is zero.

Next, imagine that you have two stairways in your house: a gently sloping front staircase, and a steep back staircase. Since the gravitational field is a conservative vector field, the work you must do against gravity is exactly the same if you take the front or the back staircase. As long as the box starts in the same position and ends in the same position, the total work is the same. (In fact, if you decided to first carry the box to your neighbor's house, then carry it up and down your backyard tree, and then in your back door before taking it upstairs, it wouldn't make a difference for this scientific definition of work. The net work you performed against gravity would be the same.)

The line integral of a vector field can be viewed as the total work performed by the force field on an object moving along the path. For the above gravity example, we discussed the work you performed against the gravity field, which is exactly opposite the work performed by the gravity field. We'd need to multiply the line integral by $-1$ to get the work you performed against the gravity field, but that's a technical point we don't need to worry much about.

The vector field $dlvf(x,y)=(x,y)$ is a conservative vector field. (You can read how to test for path-independence later. For now, take it on faith.) It is illustrated by the black arrows in the below figure. We want to compute the integral egin dlint end where $dlc$ is a path from the point $vc=(3,-3)$ (shown by the cyan square) to the point $vc=(2,4)$ (shown by the magenta square). Since $dlvf$ is path-independent, we don't need to know anything else about the path $dlc$ to compute the line integral. Later, you'll learn to compute that the value of the integral is 1, as shown by the magenta line on the slider below the figure.

The below applet demonstrate the path-independence of $dlvf$, as one can see that the integrals along three different paths give the same value. The vector field appears to be path-independent, as promised. (You'd have to check all the infinite number of possible paths from all points $vc$ to all points $vc$ to determine that $dlvf$ was really path-independent. Fortunately, you'll learn some simpler methods.)

## 16.3: Path Independence, Conservative Fields, and Potential Functions

Math 2321 (Multivariable Calculus), Spring 2021

Course Information
Instructor Class Times Office Hours
Evan Dummit
edummit at northeastern dot edu
(Sec 04) MWR, 1:35pm-2:40pm
(Sec 12) MWR, 4:35pm-5:40pm
Online, via Zoom
W 3:00pm-4:15pm
R 12:15pm-1:15pm
Online, via Zoom
I am teaching two sections of Math 2321, corresponding to the two lecture times listed. You are requested to attend your assigned lecture, but in the event you are not able, you are allowed to attend the other one (the lectures will cover the same content at the same pace). All lectures will be recorded and made available for on-demand viewing at any time.
Math 2321 uses a Piazza page for course discussion. Links to all of the live lectures, office hours, problem sessions, and lecture recordings are hosted there.
Teaching Assistant Recitation Time Office Hours
Anupam Kumar
kumar.anupa at northeastern dot edu
M, 2:50pm-4:30pm
Online, via Zoom
TBA
Online, via Zoom
For detailed information about the course, please consult the 2321 Course Syllabus. (Note: any information given in class or on this webpage supersedes the written syllabus.)
All homework assignments are available on the 2321 WeBWorK page.

Lecture Slides
These are the slides used during the lectures. They will usually be posted ahead of the lecture time.
Date Material
Wed, Jan 20th
Thu, Jan 21st
Lecture 1: Welcome + 3D Graphing (Notes 1.1)
Lecture 2: Vectors + Dot Products (Notes 1.2.1-1.2.2)
Mon, Jan 25th
Wed, Jan 27th
Thu, Jan 28th
Lecture 3: Cross Products, Lines and Planes (Notes 1.2.3-1.2.4)
Lecture 4: Lines and Planes, Vector-Valued Functions (Notes 1.2.4-1.3.1)
Lecture 5: Parametric Curves, Motion in 3-Space (Notes 1.3.1-1.3.2)
Mon, Feb 1st
Wed, Feb 3rd
Thu, Feb 4th
Lecture 6: Limits and Partial Derivatives (Notes 2.1)
Lecture 7: Directional Derivatives and Gradients (Notes 2.2.1)
Lecture 8: Tangent Lines and Planes, Linearization (Notes 2.2.2 + 2.4.1)
Mon, Feb 8th
Wed, Feb 10th
Thu, Feb 11th
Lecture 9: The Chain Rule + Implicit Differentiation (Notes 2.3)
Lecture 10: Critical Points, Minima + Maxima (Notes 2.5.1)
Lecture 11: Optimization on a Region (Notes 2.5.2)
Mon, Feb 15th
Wed, Feb 17th
Thu, Feb 18th
No class university holiday.
Lecture 12: Midterm 1 Review, part 1
Lecture 13: Midterm 1 Review, part 2
Mon, Feb 22nd
Wed, Feb 24th
Thu, Feb 25th
Lecture 14: Lagrange Multipliers (Notes 2.6) [Typos fixed]
Lecture 15: Double Integrals (Notes 3.1.1-3.1.2)
Lecture 16: Computing Double Integrals (Notes 3.1.2-3.1.3)
Mon, Mar 1st
Wed, Mar 3rd
Thu, Mar 4th
Lecture 17: Double Integrals in Polar Coordinates (Notes 3.3.2)
Lecture 18: Triple Integrals in Rectangular Coordinates (Notes 3.2)
Lecture 19: Change of Coordinates, Cylindrical Coordinates (Notes 3.3.1 + 3.3.3)
Mon, Mar 8th
Wed, Mar 10th
Thu, Mar 11th
Lecture 20: Triple Integrals in Cylindrical and Spherical (Notes 3.3.3-3.3.4)
Lecture 21: More Cylindrical and Spherical + Areas, Volumes (Notes 3.3.3-3.4.1)
Lecture 22: Areas, Volumes, Masses, and Moments (Notes 3.4.1-3.4.2)
Mon, Mar 15th
Wed, Mar 17th
Thu, Mar 18th
Lecture 23: Line Integrals (Notes 4.1)
Lecture 24: Midterm 2 Review, part 1
Lecture 25: Midterm 2 Review, part 2
Mon, Mar 22nd
Wed, Mar 24th
Thu, Mar 25th
Lecture 26: Parametric Surfaces (Notes 4.2.1)
Classes cancelled ("CARE Day")
Lecture 27: Surface Integrals (Notes 4.2.2)
Mon, Mar 29th
Wed, Mar 31st
Thu, Apr 1st
Lecture 28: Vector Fields, Work, Circulation, and Flux (Notes 4.3.1-4.3.2)
Lecture 29: Flux Across Surfaces (Notes 4.3.3)
Lecture 30: Conservative Fields and Potential Functions (Notes 4.4)
Mon, Apr 5th
Wed, Apr 7th
Thu, Apr 8th
Lecture 31: Green's Theorem (Notes 4.5)
Lecture 32: Midterm 3 Review, part 1
Lecture 33: Midterm 3 Review, part 2
Mon, Apr 12th
Wed, Apr 14th
Thu, Apr 15th
Classes cancelled ("CARE Day")
Lecture 34: Stokes's Theorem and the Divergence Theorem (Notes 4.6)
Lecture 35: Applications of Vector Calculus, part 1 (Notes 4.7.1)
Mon, Apr 19th
Wed, Apr 21st
Lecture 36: Applications of Vector Calculus, part 2 (Notes 4.7.2-4.7.4)
Lecture 37: Final Exam Review, part 1
Tue, Apr 27th Review: Final Exam Review, part 2

Functions of Several Variables and 3-Space
1.2

Vectors, Dot and Cross Products, Lines and Planes
1.3

Limits and Partial Derivatives
2.2

2.3

Local Extreme Points and Optimization
2.6

Double Integrals in Rectangular Coordinates
3.2

Triple Integrals in Rectangular Coordinates
3.3

Alternative Coordinate Systems and Changes of Variable
3.4

Surfaces and Surface Integrals
4.3

Vector Fields, Work, Circulation, Flux
4.4

Conservative Vector Fields, Path-Independence, and Potential Functions
4.5


text:
# What is the default Lighting in 3D graphics? [duplicate]

The default value of Lighting in 3D graphics typically uses "Standard", with several coloured lights, or "Neutral", depending on the type of plot.

What is the explicit lighting specification for "Standard" and "Neutral", in terms of actual light positions, directions, colours and types?

• How about the second answer here: mathematica.stackexchange.com/questions/27616/… – Feyre Jul 1 '16 at 12:02
• @Feyre Yes, that's the answer. Thank you. I would rather you post it as an answer here because that question seems to ask something different (by the title) and I really couldn't find the answer after searching both here and the documentation ... – Szabolcs Jul 1 '16 at 12:09
• I'm surprised you didn't find an answer in the docs. I searched on "lighting default" and found the answer in the third hit. – m_goldberg Jul 1 '16 at 12:17
• For your perusal: SystemPlotThemeDumpresolvePlotTheme["DefaultLights", Graphics3D] and SystemPlotThemeDumpresolvePlotTheme["ClassicLights", Graphics3D]. – J. M.'s ennui Jul 1 '16 at 12:26
• @m_goldberg Well, I didn't search for those specific words as I was concentrating on figuring out what "Standard" is. Of course that seems silly now that I chose those words for the title of the post ... Also, the relevant page doesn't contain the word "Standard". – Szabolcs Jul 1 '16 at 12:55

The answer can be found here: Change The Lighting Of Plots in the official How Tos.

For "Standard"/Automatic:

Graphics3D[Sphere[],
Lighting -> {{"Ambient", RGBColor[0.4, 0.2, 0.2]},
{"Directional", RGBColor[0, 0.18, 0.5], ImageScaled[{2, 0, 2}]},
{"Directional", RGBColor[0.18, 0.5, 0.18], ImageScaled[{2, 2, 3}]},
{"Directional", RGBColor[0.5, 0.18, 0], ImageScaled[{0, 2, 2}]},
{"Directional", RGBColor[0, 0, 0.18], ImageScaled[{0, 0, 2}]}}]

For "Classic":

Graphics3D[Sphere[],
Lighting -> {{"Ambient", RGBColor[0.312, 0.188, 0.4]},
{"Directional", RGBColor[0.8, 0., 0.], ImageScaled[{2, 0, 2}]},
{"Directional", RGBColor[0., 0.8, 0.], ImageScaled[{2, 2, 2}]},
{"Directional", RGBColor[0., 0., 0.8], ImageScaled[{0, 2, 2}]}}]

For "Neutral":

Graphics3D[Sphere[],
Lighting -> {{"Ambient", RGBColor[0.35, 0.35, 0.35]},
{"Directional", RGBColor[0.37, 0.37, 0.37], ImageScaled[{2, 0, 2}]},
{"Directional", RGBColor[0.37, 0.37, 0.37], ImageScaled[{2, 2, 2}]},
{"Directional", RGBColor[0.37, 0.37, 0.37], ImageScaled[{0, 2, 2}]}}]

• I added the one for Neutral too, hope you don't mind :-) Thanks! Also, I just learned about ImageScaled. – Szabolcs Jul 1 '16 at 12:13
• No, I should have immediately added it, you did ask about both. – Feyre Jul 1 '16 at 12:17

format: plain


text:
MathOverflow will be down for maintenance for approximately 3 hours, starting Monday evening (06/24/2013) at approximately 9:00 PM Eastern time (UTC-4).

4 added 6 characters in body

It is not true : for instance, $X$ and $X'$ might be two non-isomorphic $G$-torsors on the same $S$-scheme. S$-scheme$T$. Here is a precise example. Consider$S=Spec(\mathbb{R})$S=T=Spec(\mathbb{R})$ and $G=\mathbb{Z}/2\mathbb{Z}$, let $X=Spec(\mathbb{C})$ and $X'=Spec(\mathbb{R})\cup Spec(\mathbb{R})$ viewed as $S$-schemes, and let $G$ act on $X$ and $X'$ respectively by complex conjugation and by exchanging the connected components. Both actions admit $Spec(\mathbb{R})$ as a geometric quotient. But an isomorphism between these quotients obviously doesn't lift to an equivariant morphism between $X$ and $X'$.

Here is another example : take $S=Spec(\mathbb{C})$, $G=\mathbb{G}_m$, $T=\mathbb{P}^1_{\mathbb{C}}$. Let $X$ (resp. $X'$) be the total space of the line bundle $\mathcal{O}$ (resp. $\mathcal{O}(1)$) on $T$ minus the zero-section, with the natural $G$-action. Both actions admit $T$ as a geometric quotient, but there is no equivariant morphism between $X$ and $X'$ lifting identity.

3 added 404 characters in body

It is not true : for instance, $X$ and $X'$ might be two non-isomorphic $G$-torsors on the same $S$. S$-scheme. Here is a precise example. Consider$S=Spec(\mathbb{R})$and$G=\mathbb{Z}/2\mathbb{Z}$, let$X=Spec(\mathbb{C})$and$X'=Spec(\mathbb{R})\cup Spec(\mathbb{R})$viewed as$S$-schemes, and let$G$act on$X$and$X'$respectively by complex conjugation and by exchanging the connected components. Both actions admit$Spec(\mathbb{R})$as a geometric quotient. But an isomorphism between these quotients obviously doesn't lift to an equivariant morphism between$X$and$X'$. Here is another example : take$S=Spec(\mathbb{C})$,$G=\mathbb{G}_m$, $T=\mathbb{P}^1_{\mathbb{C}}$. Let$X$(resp.$X'$) be the total space of the line bundle$\mathcal{O}$(resp.$\mathcal{O}(1)$) on$T$minus the zero-section, with the natural$G$-action. Both actions admit$T$as a geometric quotient, but there is no equivariant morphism between$X$and$X'$lifting identity. 2 added 98 characters in body It is not true . For : for instance, consider$S=Spec(\mathbb{R})$,$G=\mathbb{Z}/2\mathbb{Z}$, and let$X$and$X'$might be two non-isomorphic$Spec(\mathbb{C})$G$-torsors on $S$.

Here is a precise example. Consider $S=Spec(\mathbb{R})$ and $Spec(\mathbb{R})\cup G=\mathbb{Z}/2\mathbb{Z}$, let $X=Spec(\mathbb{C})$ and $X'=Spec(\mathbb{R})\cup Spec(\mathbb{R})$ viewed as $S$-schemes, and let $G$ act on $X$ and $X'$ respectively by complex conjugation and by exchanging the factorsconnected components. Both actions admit $Spec(\mathbb{R})$ as a geometric quotient. But an isomorphism between these quotients obviously doesn't lift to an equivariant morphism between $X$ and $X'$.

1


text:
# zbMATH — the first resource for mathematics

Algorithms for long paths in graphs. (English) Zbl 1117.68057
Summary: We obtain a polynomial algorithm in $$O(nm)$$ time to find a long path in any graph with $$n$$ vertices and $$m$$ edges. The length of the path is bounded by a parameter defined on a neighborhood condition of any three independent vertices of the path. An example is given to show that this bound is better than several classic results.

##### MSC:
 68R10 Graph theory (including graph drawing) in computer science 05C85 Graph algorithms (graph-theoretic aspects) 05C38 Paths and cycles
##### Keywords:
Hamiltonian; long path; neighborhood condition
Full Text:
##### References:
 [1] Albertson, M., Finding Hamiltonian cycles in ore graphs, Congr. numer., 58, 25-27, (1987) [2] N. Alon, R. Yuster, U. Zwick, Color-coding: A new method for finding simple paths, cycles and other small subgraphs within large graphs, in: Proceedings of STOC, 1994, pp. 326-335 · Zbl 1344.68092 [3] C. Bazgan, M. Santha, Z. Tuza, On the approximability of finding a(nother) Hamiltonian cycles in cubic Hamiltonian graphs, in: Proceedings of STACS, 1998 · Zbl 0919.05039 [4] Bermond, J.-C., On Hamiltonian walks, Proc. fifth british combinatorial conference, Aberdeen, 1975, Util. math., 41-51, (1975) [5] Björklund, A.; Husfeldt, T., Finding a path of superlogarithmic length, SIAM J. comput., 32, 1395-1402, (2003) · Zbl 1041.68066 [6] Bodlaender, H.L., On linear time minor tests with depth-first search, J. algorithms, 14, 1-23, (1993) · Zbl 0764.68107 [7] Bondy, J.A.; Murty, U.S.R., Graph theory with applications, (1976), Macmillan Press · Zbl 1134.05001 [8] Dirac, G.A., Some theorems on abstract graphs, Proc. London math. soc. (3), 2, 69-81, (1952) · Zbl 0047.17001 [9] T. Feder, R. Motwani, C.S. Subi, Finding long paths and cycles in sparse Hamiltonian graphs, in: Proceedings 32th STOC, 2000, pp. 524-529 · Zbl 1296.05114 [10] Flandrin, E.; Jung, H.A.; Li, H., Degree sum, neighbourhood intersections and hamiltonism, Discrete math., 90, 41-52, (1991) · Zbl 0746.05038 [11] Kocay, W.; Li, P.C., An algorithm for finding a long path in a graph, Util. math., 45, 169-185, (1994) · Zbl 0823.05052 [12] Korte, B.; Vygen, J., Combinatorial optimization: theory and algorithms, (2000), Springer-Verlag Berlin · Zbl 0953.90052 [13] Karger, D.; Motwani, R.; Ramkumar, G.D.S., On approximating the longest path in a graph, Algorithmica, 18, 82-98, (1997) · Zbl 0876.68083 [14] Monien, B., How to find long paths efficiently, Ann. discrete math., 239-254, (1985) · Zbl 0603.68069 [15] Ore, O., Note on Hamilton circuits, Amer. math. monthly, 67, 55, (1960) · Zbl 0089.39505 [16] S. Vishwanathan, An approximation algorithm for finding a long path in Hamiltonian graphs, in: Proceedings 11th SODA, 2000, pp. 680-685 · Zbl 0956.68111 [17] Wei, B., Longest cycles in 3-connected graphs, Discrete math., 170, 1-3, 195-201, (1997) · Zbl 0905.05042
This reference list is based on information provided by the publisher or from digital mathematics libraries. Its items are heuristically matched to zbMATH identifiers and may contain data conversion errors. It attempts to reflect the references listed in the original paper as accurately as possible without claiming the completeness or perfect precision of the matching.


text:
# A finite sum involving the binomial coefficients and the harmonic numbers

Wikipedia has a proof of the identity $$H_{n} =\sum_{k=1}^{n} (-1)^{k-1} \binom{n}{k} \frac{1}{k}$$

http://en.wikipedia.org/wiki/Harmonic_number#Calculation

Curiously, there is also the identity

$$\frac{1}{n} = \sum_{k=1}^{n} (-1)^{k-1} \binom{n}{k} H_{k}$$

Can the second identity be derived from the first one?

This is a consequence of binomial inversion. In general, if $f_{n}$ and $g_{n}$ are sequences such that $$f_{n} = \sum_{k=0}^{n}g_{k}{n \choose k}$$
$$g_{n} = \sum_{k=0}^{n}(-1)^{n+k}f_{k}{n\choose k}$$
Here I take sequences to be functions from $\mathbb{N} \rightarrow \mathbb{R}$ where I am using the convention that the natural numbers start at $0$.
The second of your identities can be proved from the first using binomial inversion by taking $$f_n = \left\{ \begin{array}{lr} 0 & : n = 0\\ H_{n} & : n > 0 \end{array} \right.$$ and $$g_n = \left\{ \begin{array}{lr} 0 & : n = 0\\ (-1)^{n-1}\frac{1}{n} & : n > 0 \end{array} \right.$$


text:
#### Archived

This topic is now archived and is closed to further replies.

# What are the advans/disadvans of using class member functions vs normal functions?

This topic is 6512 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I just learned how to use classes and their member functions, and I was just wondering if they are slower or faster then normal functions and if they have other advantages, and what about class arrays? for example: class TIME{ public: ..... private: ..... } time[5]; are the member functions in there gonna be just as fast as if I were to use a struct and just write my own normal functions? Possibility

##### Share on other sites
There might be a slight performance difference due to implementation details, but there is no reason why a member function should be any faster/slower than a normal function.

Certainly if there is a difference, it will not be very significant, at most the cost of pushing a few more things onto the stack in the function call.

#pragma DWIM // Do What I Mean!
**I use Software Mode**

##### Share on other sites
As long as you don''t use virtual member methods and/or virtual inheritance, member methods are as fast as normal C functions.

The only difference is that member methods internally have one (implicit) parameter: the this pointer. The value of the this pointer is pushed to the stack prior to calling the member function.

int A::b() { /* ... */; return 0; }
is roughly implemented as
int A__b(const A *this) { /* ... */; return 0; }

However, if you''d try to achieve encapsulation in C, you''d probably end up doing it the same way.

Erik

##### Share on other sites
Don''t let this performance hit discourage you.. Lots of games use OO techniques (Half-Life, etc.) and I, for one, think this is one of the waves of the future in game design.

Just my opinion, though I know others share it.

------------------------------
Jonathan Little
http://www.crosswinds.net/~uselessknowledge

##### Share on other sites
I agree - OO is the way to go. Many good things have caused slight performance hits but resulted in massive productivity improvements and algorithmic improvements.

#pragma DWIM // Do What I Mean!
**I use Software Mode**

##### Share on other sites
What is OO? is that object oriented?

Possibility

##### Share on other sites
Yup,
OO is shorthand for Object Oriented. (and OOP is Object Oriented Programming).

-Brian

##### Share on other sites
So what does Object oriented programming actually mean. I am fairly certain I already do that, but what is it precisely and why is SO good?

Possibility

##### Share on other sites
I have programmed in C++ for about 4 months now, and have pondered the exact same thing... anyone?

GO LEAFS GO!

##### Share on other sites
I have been programming in C++ for a few months now, and, although I have learnt and can understand Classes and OOP, I have never actually used them in a project, as I''ve never really seen the need. I never did understand what the advantages/disadvantages were.

##### Share on other sites
Object oriented design-Uh.Good god-WHAT ARE YOU GOOD FOR!

Object oriented design is good for large, long lived, supported software by companies who take their software seriously. It is not so good for small, quick, ''I just threw this together in 20 minutes and it compresses all data'' (heh heh) programs written by Joe Programmer.

It helps large software by taking all the good things in C one step farther with inheritance, virtual functions, etc.

It helps long lived programs because of a higher degree of safe reuse possbile in tools and later versions that are major rewrites.

It helps support because when done correctly you can change just about anything that is internal to a class with no effect (other than resource use) on anything external to the class. This is very powerful.

It is for companies who are serious about software because it requires more initial development time (when done correctly) that pays off later in time and cost savings. Problem is most management is thinking short term 99% of the time and taking longer at the beginning is unacceptable.

Many of these can be accomplished in C, but with greater reliance on the programmers not to mess up since you don''t have data hiding, dynamic binding, inheritance, and the other several doo-hickeys having to do with code reuse. Having written linked list code several hundred times for different structs it is damn nice to write it my way once as a template class and never do it again.

What are some other problems with object oriented design (and C++)?
-IMHO, most programmers can''t handle it. It''s just over their heads. So is alot of C actually.
-More abstract so knowing exactly what your code is doing (at the assembler level) is a bit harder. You conquer this by experience and by writing small examples and examining the assembler listing generated by the compiler. Study the effect of the optimization options this way, too.

If your going to be a professional programmer doing serious stuff (like games ) I think you''ll want to use OO as much as you can so that it becomes second nature. Just keep thinking about how can I make this section of processing code easily reusable if I was going to use it in another program. Even if you never intend to.

Mike Roberts
aka milo
mlbobs@telocity.com

##### Share on other sites
OOP - It forces a deeper organization that pays off in reusability, clearer code and
just better thinking about the game design and code design.
You''ll see the difference when you''ve got about 200 functions on a big list. It keeps you focused. Sometimes you DO have to do ticky-tacky details; OOP tends to weed out anything that''s no relevant to the job at hand

ZoomBoy
Developing a 2D RPG with skills, weapons, and adventure.
See my character editor, Tile editor, diary, 3D Art resources at
Check out my web-site

##### Share on other sites
milo:
I just want to point out that your example of saving time by using a templated linked list class really doesn't attest to the power of OO. That's a benefit of generic programming. Indeed STL itself isn't really an OO library, but a generic programming one. People often make the mistake of thinking "C++ is an OO language". It is not. It is a language with a variety of features for supporting many different programming paradigms.

I also think that much of what you said about the benefits of OO sounds like traditional, unsubstantiated marketing hype. I'm not saying I disgaree, but I think you're stretching the limits of hyperbole there. Even Stroustrup would cringe (I believe) to see you prescribing inheritance, run-time polymorphism, and other OO features as a cure-all for software engineering ills. "Paradigms don't write good code, people write good code." Sorry to sound all cliched about this, but personal experience, and the opinions of many people whom I respect, all indicate that it's true.

-Brian

Edited by - osmanb on 4/21/00 12:24:24 AM

##### Share on other sites
Osman - I sort of agree.

I would describe the benefits of Object Oriented Programming something like this:

Objects are a part of life, they are intuitive. Using objects in code makes it look more intuitive ( not necessarily faster, better, or anything ), and if you do your design intuitively you''ll also have objects in it. So it just makes ends meet!

#pragma DWIM // Do What I Mean!
**I use Software Mode**

##### Share on other sites
OOP is just a lot closer to how the human brain actually thinks than structured programming. With structured programming, all you are doing is a (very) poor emulation of OOP. It requires your brain to work that much harder to "decode" your code into what humans understand (your native language). It''s like writing your 5-page research paper in morse code (well, close to it ). People naturally think in objects.

The people who claim OOP is just a bunch of hype (not referring to you, osmanb) have no idea what they are talking about. They code in OOP thinking all the time, but they emulate it in structured code. Those people may be able to write a game in C but they are doing it in a much harder way. If you could take good structured code (in C++) and good OOP code (also in C++), the OOP code will be slightly faster. Why do I say this? People all across the globe spend countless hours coding up their own versions of things that are already part of the language, such as polymorphism, templates, RTTI (yes, they emulate this), and others. Only to arrive at a (worse) implementation of exactly the thing they tried to avoid using. And somehow (and I don''t quite understand this), they are convinced that their "new" approach is both faster and uses less memory. They don''t realize that they things they work around (provide code for) are already coded for them, so they have two copies in memory. Worse yet, because most people don''t study machine code and microprocessor design and live on assembly (like the compiler writers do), their implementation is actually worse than the one already in memory.

But, for the newbies, what in the world is this OOP we''ve been talking about? The term Object-Oriented Programming doesn''t do much for the newbie''s understanding. It is basically a way of analyzing and describing how the code works. In other words, it is a way of designing code. It doesn''t refer to the actual code used, but, rather, the way in which it works together. Let''s take an example problem and see how easily OOP actually works.

Let''s say we want to be able to do file-handling in our project. (functions for this are already provided, but we are using this as an example) First, let''s describe what we know about the object. We need to be able to read and write raw data to the file. We also need to be able to open and close the file.

Note the use of the word: file. That is the object in the phrases in those sentences. In other words, that is what all those actions are being done to. Therefore, we make that our class. We have an awful lot of verbs in those sentences, too. They describe what the file object must do, so we''ll make them member functions. Let''s look at what we have so far:

class file{public:read(void* pData, int nSize);write(void* pData, int nSize);open();close();};file::read(void* pData, int nSize){}file::write(void* pData, int nSize){}file::open(){}file::close(){}

My example was a little simplistic, but that''s basically the bulk of what OOP does for you. It generates a code design that is both logical and is 100% sure to work properly. It does take some practice, though. IMHO, the benefits FAR outweigh the time it takes to learn.

This is where OOP leaves us. Now, all you have to do is write the implementations of those functions, and you have a perfectly-working file class. The methods that I used were a slight variation on what is called CRC, but basically all methods of OOP turn english into code. Structured coding requires an extra conversion, because it converts code into english, so it can be processed, whereby it is turned into code again.

Structured programming is a poor man''s OOP.

Never forget: a good game programmer is first a good programmer. Poor game programmers can turn out good games, but it is harder and much less possible. Anything that makes you a better coder will increase the chances of your success in the industry.

better_design = less_frustration / better_product / less_development_time;OOP = better_design;

- null_pointer
Sabre Multimedia

##### Share on other sites
brian - Ok. I''ll agree generaly with your first paragraph. After all I can use Visual C++ and never write a line of cod e that isn''t fully C.

I didn''t say OO was a cure all, though. I said it is more powerful due to those features for controlling the developement process. Programmers can, and will, screw things up (they are 90% human after all!). Many of the object oriented features of C++ can allow the team leaders and designers more control on what a programmer can screw up. Of course, if you don''t do code reviews lazy programmers can always get around some things without you knowing.

I also never said that OO replaces the skills of the developers (or their responsibilities). It does modify it. I can do most of these things in C, too, but it is more difficult (since I have to control a lot more), the solution is less general, and when I hand it over to another programmer he usually has access to all of it.

I did state that OO was not for everybody or for every company. But then neither is C. Like any sophisticated tool it gives the user the power to do things in a new way or that can''t be accomplished with other tools, but it also just creates more ways to stub you toe. That is why C is a problem for alot of programmers. Things like pointers, pointer to functions, unions, etc., are great, but only if you understand them and are rigorous about using them correctly and consistently.

Mad Keith wrote:-Objects are a part of life, they are intuitive.-

Now that sounds like rhetoric! Simple objects are intuitive. Complex ones (especially those that are candidates for several layers of inheritance or multiple inheritance) are not so intuitive. Plus, intuition is a very subjective thing.

My point in all this being that OO is the right tool, but only for the right job. Same for C, Java, FORTRAN (when there was no C), COBOL (eww!) (when there was nothing else but assembler), Assembler, FORTH, LISP, Ada, a hammer, a saw, ad infinitum. Someday a manager might just be able to ask his computer to create a massive, multiplayer, persistent world program and it will, but until then software will rely on the skill of the programmers/designers, the power of the tools they use, and the intersection of the two. IMHO!

Mike Roberts
aka milo
mlbobs@telocity.com

##### Share on other sites
Wow, this thread is so much more productive than the previous one I was posting in (compression, ugh...)

Anyways, you''re right null_pointer: I don''t consider OOP to be pure hype. I have used UML in the past, and I very often use OO solutions to problems I have. However, I try to make OO just one tool in a large toolbox of solutions. And of course (as you can probably guess) generic proramming (e.g. templates) is another tool in the toolbox of mine. You also stated that:

[People that don''t use certain features] don''t realize that they things they work around (provide code for) are already coded for them, so they have two copies in memory.

I don''t completely agree with this statement. Stroustrup has stressed repeatedly (as have other people involved in the creation of C++), that it should be a zero-overhead language. If I don''t want to use a specific feature, I should not pay for that feature in any way. This point became the absolute, fundamental decision maker in rejecting many new features from the language. And other features were only accepted when it was determined that implementations and programs which didn''t make use of them would not require any overhead due to their inclusion in the language. In many ways, the people that do this (rewrite C++ features in C are taking a (often misguided) lesson from network programming:

If I want to write a protocol to handle communication in (for example) a game, I know that I need (or don''t need) certain features: retransmission, in-order guarantees, etc... Almost every feature you could want is included in TCP, so some people choose to use TCP. Unfortunately, TCP includes too many features for this application, and ends up being slow as a result. On the other hand, people (who end up being successful) are forced to use UDP, and add all of the functionality they need from TCP by themselves. This ends up working, and doesn''t add the often horrible overhead of TCP. Of course, it ends up being a lot of work, but there aren''t many options...

People that see this and apply the same reasoning to C/C++ (as n_p pointed out) just don''t know that they''re talking about, and don''t realize that the analogy doesn''t work in this case. Unlike TCP, you aren''t forced to pay for the extra C++ features...

Okay, I am on such a tangent right now, that I think I may have ended up making a point against myself, but I still think I''ve provided at least some useful information... (I hope?)

-Brian

##### Share on other sites
osmanb: Wow! never knew about that...I thought that was just with RTTI and a few other options people don''t like. That''s what makes C++ such a good language. It is extremely logical! No unnecessary code! I have never run into any person more logical than Mr. Stroustrop (though SiCrane would be runner up on that list ). I was kind of talking about OOP design in general, but I drift into C++ all the time...I think that (if it''s possible) I think in C++ more than English. Anyway, it''s interesting to note that other languages are adopting the features that many people "think" make C++ a slow language. Check out the latest on Visual Basic.

I definitely agree that there can''t be too much discussion about programming design. I wish there were more discussions about it...

- null_pointer
Sabre Multimedia

##### Share on other sites

Back to the topic of the day - OOP.

In college we had a GREAT course on OOP. Not because it told you what it was, not because it told you how to use it, but because it told you how it was DONE.
It explained plainly and clearly what the performance hits of certain features were - in both Java, Smalltalk and C++. I loved that course, because it dispelled a lot of the fears I had. One dereference per layer of inheritance, and a memory hit from the vtable. That''s only a few clock ticks and a few bytes, for something I find quite useful.

I stopped being a performance nitpicker a while ago I guess - I can build reasonably fast things that look really great and do marvellous things, or REALLY fast things that take too much effort. I chose the slow way, it''s more rewarding to me. I''ll do the algorithm in a nice, neat, legible way so the people that know MORE about performance can take it apart, understand it and optimise it.

I think that''s a valuable part of development too;

#pragma DWIM // Do What I Mean!
**I use Software Mode**

##### Share on other sites
This is in response to MadKeithV''s last response.

RIGHT ON DUDE!

Mike Roberts
aka milo
mlbobs@telocity.com

##### Share on other sites
I think a lot of people worry about the ''hidden'' costs of inheritance, so instead they make a single class with a type variable saying which subtype it is, and use switch statements all over the place. I can understand why - it''s difficult to trust code you can''t see. However, apart from the extra time it takes to code all those switch statements, you also introduce more potential places for bugs. But the main thing is that almost no switch-based subtype implementation is gonna be significantly faster than vtable lookups anyway. So you don''t gain much Sensible use of objects cuts development time and source code size, leaving you more time to work on gameplay!

##### Share on other sites
I have to thank null_pointer for telling me what OOP actually is, and the cool thing is, I have already been doing that, and alot. It just seemed like a natural thing to do my coding that way.

Possibility


text:
※ 온라인 세미나: https://snu-ac-kr.zoom.us/j/8156716391

In this talk, we investigate the consumption and portfolio selection problem of a finitely-lived agent who faces drawdown constraint on consumption: the agent does not accept falling in her consumption below a fixed proportion of the historically highest level. We utilize the dual martingale method and study the dual problem, which can be transformed into an infinite series of optimal stopping problems. Based on a theory of partial differential equation(PDE), we analytically characterize a variational inequality arising from the optimal stopping problem. We provide a verification theorem that the value function for the original agent's problem is the Legendre-Fenchel transform of the integral of the value functions for the optimal stopping problems. Moreover, we derive integral equation representations for the optimal strategies and provide some numerical implications for the optimal strategies. This is joint work with Jehan Oh (Kyungpook National University).


text:
# Wheelbarrow in Static equilibrium

sheepcountme

## Homework Statement

A wheelbarrow has a mass of 35.0 kg without the wheel. When empty, the center of mass is 0.400 m from the axle. A load with a mass of 55.0 kg is put in the wheelbarrow, 0.600 m from the axle. Ophelia holds the handles of the wheelbarrow, 1.20 m from the axle. She lifts the handles so that they make a 25.0° angle with the ground. What is the upward force that Ophelia applies to the handles in order to hold the wheelbarrow in that position?

## Homework Equations

$$\Sigma$$Fx=0
$$\Sigma$$Fy=0
Torque=rFsin$$\vartheta$$

## The Attempt at a Solution

$$\Sigma$$Fx=0 I figure there's nothing to find out here because it's fairly obvious...I think.

$$\Sigma$$Fy=0

Here, I figure it's mg=Fnormal + Fophelia
and since Ophelia is applying a torque force around the wheel:
mg=Fnormal + rFosin$$\theta$$

Some problems: I don't know how to solve for Fo since Fnormal is in there too and is unknown, and I don't know how the difference in xcm should come in other than choosing axis of origin (of which I chose the wheel)


text:
4 continued

[continued...]

There is a standard way of constructing non-Borel sets, which is mentioned in, e.g., Cohn, Measure Theory (Corollary 8.2.17) and, even without countable choice, the argument still works to give you a non-codable-Borel set. It is a diagonalization kind of argument. This constructs a subset of Baire space $\mathcal{N}=\mathbb{N}^\mathbb{N}$ (under the product topology). This is a Polish space homeomorphic to the irrational numbers in [0,1] by the continued fraction representation (I'm taking $\mathbb{N}=\{1,2,\ldots\}$ for convenience).

If X,Y are Polish spaces, then say a subset $S\subseteq X\times Y$ is universal if every closed subset of X is of the form $S_y=\{x\in X\colon(x,y)\in S\}$. It is always possible to construct a closed universal subset of $X\times\mathcal{N}$. If $U_1,U_2,\ldots$ is an enumeration of a base for the topology on X, then

$$S=\left\{(x,y)\in X\times\mathcal{N}\colon x\in\bigcap_{n=1}^\infty U_{y(n)}^c\right\}$$

is closed and universal.

Now, take S to be a closed universal subset of $X\times\mathcal{N}$ where $X=\mathcal{N}\times\mathcal{N}$.

The set $A=\{x\in\mathcal{N}\colon \exists y\in\mathcal{N}{\rm\ s.t.\ } (x,y,x)\in S\}$ is an analytic but non-codable-Borel subset of $\mathcal{N}$.

A subset of a Polish space X is analytic if it is the projection of a closed subset of $X\times\mathcal{N}$ onto X. The set A above is the projection of the set $\{(x,y)\in\mathcal{N}^2\colon(x,y,x)\in S\}$, so is analytic. If it was codable Borel, then its complement would be the projection of some closed set $B\subseteq\mathcal{N}^2$. By universality, $B=S_x$ for some $x\in\mathcal{N}$. However,$$x\in A^c\iff \exists y{\rm\ s.t.\ } (x,y)\in S_x \iff \exists y{\rm\ s.t.\ }(x,y,x)\in S\iff x\in A$$would give a contradiction.

In fact, I think I can show that the set you linked to by Lusin is not codable Borel, without using choice. By continued fraction representation, it is the same as saying that the following is not codable Borel.

S = the set of $x\in\mathcal{N}$ for which there is an increasing sequence $0\lt i_1\lt i_2\lt\cdots$ such that each $x(i_k)$ divides $x(i_{k+1})$.

In the presence of choice, this is standard (Kechris, Classical Descriptive Set Theory has a proof, but I don't have a copy). I expect that the proof can be adapted in the absence of countable choice but, as I don't know the standard proof of this, I can give a very very rough sketch of my own. The idea is to consider the set of trees $\mathcal{T}$, where each node has a countable set of children corresponding elements of $\mathbb{N}$. Any such tree is defined by the set of finite paths $(i_1,\ldots,i_n)\in\mathbb{N}^*=\bigcup_{n=1}^\infty\mathbb{N}^n$ it contains, and $\mathcal{T}$ forms a Polish space (using the product topology on $\{0,1\}^{\mathbb{N}^*}$). Let $\mathcal{T}_0\subseteq\mathcal{T}$ be the trees containing no infinite paths. These correspond to the Borel codes. Then, $\mathcal{T}_0$ is itself not codable Borel (*). Next, each tree can be represented uniquely by an element $x\in\mathcal{N}$ in such a way that passing from a node to one of its children corresponds to going from i to $j\gt i$ where $x(i)$ divides $x(j)$. Then, $\mathcal{T}_0$ correponds precisely to the set S above which, therefore, is not codable Borel.

(*) That $\mathcal{T}_0$ is not Borel is standard (in the presence of AoC). I don't know the proof of this, maybe it can be shown using a similar argument to the one above for non-analytic sets. However, I can put together an alternative rough argument of my own that it is not codable Borel. The idea is that each tree corresponds to a program for some super-Turing machine which can perform countable Boolean operations at once, and those without infinite paths are guaranteed to halt. If $\mathcal{T}_0$ was codable, then there would be a Borel code $T\in\mathcal{T}_0$ which generates $\mathcal{T}_0$. This is similar to having a Turing program which solves the halting problem, and we could derive a contradiction in a similar way. There are some messy details in getting this analogy to go through properly, but it seems like it should work.

3 added 390 characters in body

Measure theory without the Axiom of Choice (not even countable choice) is discussed in Fremlin, Measure Theory, Volume 5, Chapter 56. This is freely available online. Thanks to MO and ex-falso-quodlibet for making me aware of this extensive text in this answer.

He mentions Feferman & Levy's result that it is consistent that the reals are a countable union of countable sets, as per Andres' answer. This makes the standard definition of Borel sets unhelpful, as everything is Borel. However, it is still possible to do analysis and measure theory without choice. You just need the right definitions. Fremlin discusses codable Borel sets. Unions and intersections of 'codable sequences' of codable Borel sets are themselves codable Borel sets. The basic idea is to represent exactly how a set is built up in terms of successive sequences of unions and set-complements, starting from an enumeration of a base for the topology. This done via countable tree structures, which define a construction of subsets of R (or any Polish space) by applying countable unions of complements as you step along the tree. This definition uses a countable transfinite induction to construct the map from trees to codable Borel sets. An important point being:

In the presence of countable choice, codable Borel sets = Borel sets.

I see that Andres & Joel mention this as a theorem in their answers. However, it is not true without countable choice. The union of a sequence of codable Borel sets does not have to be Borel, so even if the reals could be written as a countable union of countable sets it does not follow that all subsets are codable Borel. However, given a sequence of codable Borel sets with a specified choice of codings, their union is codable Borel. Without countable choice, it makes sense to work with codable Borel sets instead of the standard Borel sets. Then, many standard results carry across to the situation without countable choice. E.g., a set is codable Borel if and only both it and its complement are analytic sets (continuous images of closed subsets of $\mathbb{N}^\mathbb{N}$).

There are certainly explicitly constructable subsets of the reals which are not codable Borel. I think Joel's arguments should carry through to the situation without countable choice.

One way to construct explicit examples of non codable Borel sets is to construct an analytic set whose complement is not analytic. Lusin's example (linked to in the question) fits into this method, although I'm not sure if it still works without choice. There are other more difficult to describe examples which do though. (I ran out of time on this answer, so will return to it later).

2 added 187 characters in body

Measure theory without the Axiom of Choice (not even countable choice) is discussed in Fremlin, Measure Theory, Volume 5, Chapter 56. This is freely available online. Thanks to MO and ex-falso-quodlibet for making me aware of this extensive text in this answer.

He mentions Feferman & Levy's result that it is consistent that the reals are a countable union of countable sets, as per Andres' answer. This makes the standard definition of Borel sets unhelpful, as everything is Borel. However, it is still possible to do analysis and measure theory without choice. You just need the right definitions. Fremlin discusses codable Borel sets. Unions and intersections of 'codable sequences' of codable Borel sets are themselves codable Borel sets. The basic idea is to represent exactly how a set is built up in terms of successive sequences of unions and set-complements, starting from an enumeration of a base for the topology. This done via countable tree structures, which define a construction of subsets of R (or any Polish space) by applying countable unions of complements as you step along the tree. This definition uses a countable transfinite induction to construct the map from trees to codable Borel sets. An important point being:

In the presence of countable choice, codable Borel sets = Borel sets.

I see that Andres & Joel mention this as a theorem in their answers. However, it is not true without countable choice. The union of a sequence of codable Borel sets does not have to be Borel, so even if the reals could be written as a countable union of countable sets it does not follow that all subsets are codable Borel. However, given a sequence of codable Borel sets with a specified choice of codings, their union is codable Borel. Without countable choice, it makes sense to work with codable Borel sets instead of the standard Borel sets. Then, many standard results carry across to the situation without countable choice. E.g., a set is codable Borel if and only both it and its complement are analytic sets (continuous images of closed subsets of $\mathbb{N}^\mathbb{N}$).

There are certainly explicitly constructable subsets of the reals which are not codable Borel. I think Joel's arguments should carry through to the situation without countable choice.

1


text:
# Abstract Nonsense

## The Construction of the Tensor Product of Modules (Pt. III)

Point of Post: This is a continuation of this post.

$\text{ }$

Once again, this concretely means that if $M$ is an $(A,R)$-bimodule and $N$ a $(R,B)$-bimodule then an $(A,B)$ tensor product of $M$ by $N$ over $R$ is an $(A,B)$ module $L$ and an $R$-biadditive $(A,B)$-map $f:M\times N\to L$ which has the property such that given any other $(A,B)$-bimodule $K$ and an $R$-biadditive $(A,B)$-map $g:M\times N\to K$ there exists a unique $(A,B)$-map $\phi:L\to K$ such that $\phi\circ f=g$.

$\text{ }$

For example, the previous construction of a tensor product as an abelian group corresponded to $(\mathbb{Z},\mathbb{Z})$-tensor products over $R$.

$\text{ }$

Once again, we have by mere definition the following important theorem:

$\text{ }$

Theorem: Let $M$ be a $(A,R)$-bimodule and $N$ a $(R,B)$-bimodule. Then, if $f:M\times N\to L$ and $g:M\times N\to K$ are two $(A,B)$-tensor products over $R$, of $M$ by $N$ then there exists a unique $(A,B)$-isomorphism $\phi:L\to K$ such that $\phi\circ f=g$.

$\text{ }$

Unfortunately, similar to before there is absolutely no indication that $(A,B)$-tensor products over a ring should exist in general. Strangely enough, we have the following theorem that brings together all of the theory:

$\text{ }$

Theorem: Let $M$ be an $(A,R)$-bimodule and $N$ an $(R,B)$-bimodule. Then, the multiplications $a(m\otimes n)=(am)\otimes n$ and $(m\otimes n)b=m\otimes (nb)$ extend to give a $(A,B)$-bimodule structure on $M\otimes_R N$, and moreover $\otimes:M\times N\to M\otimes_R N$ is then a $(A,B)$-tensor product of $M$ by $N$ over $R$.

$\text{ }$

Proof: We begin by showing that there really is a (necessarily unique) $A$-multiplication on $M\otimes_R N$ for which $a(m\otimes n)=(am)\otimes n$. Indeed, consider the map $f_a:M\times N\to M\otimes_R N$ given by $f_a(m,n)=(am,n)$. We note then that for any  $r\in R$, $m,m'\in M$ and $n,n'\in N$ we have that

$\text{ }$

\begin{aligned}f_a(mr+m',n+n') &=(a(mr+m'))\otimes(n+n')\\ &=(amr+am')\otimes(n+n')\\ &=(amr)\otimes n+(amr)\otimes n'+(am')\otimes n+(am')\otimes n'\\ &=(am)\otimes (rn)+(am)\otimes(rn')+(am')\otimes n+(am')\otimes n'\\ &= f_a(m,rn)+f_a(m,rn')+f_a(m',n)+f_a(m',n')\end{aligned}

$\text{ }$

so that $f_a$ is $R$-biadditive. Thus, by the universal property of tensor products we get a group homomorphism $\widetilde{f}_a:M\otimes_R N\to M\otimes_R N$ such that $\widetilde{f}_a(m\otimes n)=(am)\otimes n$. We then define the multiplication map $\mu:A\times(M\otimes_R N)\to M\otimes_R N$ by $\mu(a,x)=\widetilde{f}_a(x)$ and denote, as per usual, $\mu(a,x)$ as just $ax$. We note though that since

$\text{ }$

\begin{aligned}\widetilde{f}_{a+a'}(m\otimes n) &=((a+a')m)\otimes n\ \&=(am+a'm)\otimes n\\ &=(am)\otimes n+(a'm)\otimes n\\ &=\widetilde{f}_a(m)+\widetilde{f}_{a'}(m)\end{aligned}

$\text{ }$

and maps on $M\otimes_R N$ are determined by their values on elements of the form $m\otimes n$ we may conclude that $\widetilde{f}_{a+a'}=\widetilde{f}_a+\widetilde{f}_{a'}$. Similarly, one can check that on elements of the form $\widetilde{f}_{aa'}=\widetilde{f}_{a}\circ\widetilde{f}_{a'}$ and $\widetilde{f}_1=\text{id}_{M\otimes_R N}$ and so they are equal on all of $M\otimes_R N$. We then proceed to verify the desired axioms

$\text{ }$

\begin{aligned}&(a+a')x=\widetilde{f}_{a+a'}(x)=\widetilde{f}_a(x)+\widetilde{f}_{a'}(x)=ax+a'x\\ & a(m+m')=\widetilde{f}_a(x+x')=\widetilde{f}_a(x)+\widetilde{f}_{a'}(x)=ax+ax'\\ & (aa')x=\widetilde{f}_{aa'}(x)=\widetilde{f}_a(\widetilde{f}_{a'}(x))=a(a'x)\\ &1x=\widetilde{f}_1(x)=\text{id}_{M\otimes_R N}(x)=x\end{aligned}

$\text{ }$

Thus, we see that we have defined a left $A$-multiplication $(a,x)\mapsto ax$ on $M\otimes_R N$ such that $a(m\otimes n)=(am)\otimes n$ as desired. The exact same process shows that we have a right $B$-multiplication $(x,b)\mapsto xb$ on $M\otimes_R N$ such that $(m\otimes n)b=m\otimes (nb)$. To prove that everything defines a $(A,B)$-bimodule structure on $M\otimes_R N$ it suffices to show that $a(xb)=(ax)b$ for all $a\in A$, $b\in B$, and $x\in X$. It of course suffices to do this on simple tensors:

$\text{ }$

$a((m\otimes n)b)=a(m\otimes (nb))=(am)\otimes(nb)=((am)\otimes n)b=(a(m\otimes n))b$

$\text{ }$

thus this really is a $(A,B)$-bimodule structure on $M\otimes_R N$.

$\text{ }$

Let’s now verify that $\otimes:M\times N\to M\otimes_R N$ really is an $(A,B)$-tensor product of $M$ by $N$ over $R$. To do this let’s first check that $\otimes$ is an $R$-biadditive $(A,B)$-map. The fact that it’s $R$-biadditive follows from previous note, and so it suffices to show that it is $(A,B)$-biadditive. To do this we merely note that

$\text{ }$

$\otimes (am,nb)=(am)\otimes (nb)=a(m\otimes n)b=a\otimes(m,n)b$

$\text{ }$

and so the fact that it’s an $(A,B)$-map follows.

$\text{ }$

Let’s now show that it’s initial in the desired category. To this end suppose that we have some  $(A,B)$-bimodule $L$ and an $R$-biadditive $(A,B)$-map $f:M\times N\to L$. Since $f$ is $R$-biadditive we are guaranteed, by construction, a group homomorphism $\phi:M\otimes_R N\to L$ such that $\phi\circ \otimes=f$, it thus remains to show that $\phi$ is an $(A,B)$-map. To do this let $\displaystyle \sum_i m_i\otimes n_i\in M\otimes_R N$ be arbitrary and $a\in A, b\in B$ we see then that

$\text{ }$

\displaystyle \begin{aligned}\phi\left(a\left(\sum_i m_i\otimes n_i\right)b\right) &=\phi\left(\sum_i (am_i)\otimes (n_ib)\right)\\ &=\sum_i \phi((am_i)\otimes (n_ib))=\sum_i f((am_i,n_ib))\\ &=\sum_i f(a(m_i,n_i)b))=\sum_i af(m_i,n_i)b\\ &=\sum_i a \phi(m_i\otimes n_i)b\\ &=a\left(\sum_i \phi(m_i\otimes n_i)\right)b\\ &=a\phi\left(\sum_i m_i\otimes n_i\right)b\end{aligned}

$\text{ }$

Thus, $\phi$ is an $(A,B)$-map $M\otimes_R N\to L$ such that $\phi\circ \otimes=f$. Since the uniqueness is guaranteed by the construction of $M\otimes_R N$ the fact that $\otimes:M\times N\to M\otimes_R N$ is an $(A,B)$-tensor product over $R$ follows. $\blacksquare$

$\text{ }$

$\text{ }$

References:

[1] Dummit, David Steven., and Richard M. Foote. Abstract Algebra. Hoboken, NJ: Wiley, 2004. Print.

[2] Rotman, Joseph J. Advanced Modern Algebra. Providence, RI: American Mathematical Society, 2010. Print.

[3] Blyth, T. S. Module Theory. Clarendon, 1990. Print.

[4] Lang, Serge. Algebra. Reading, MA: Addison-Wesley Pub., 1965. Print.

[5] Grillet, Pierre A. Abstract Algebra. New York: Springer, 2007. Print.