text:
# Solving a system of partial differential equations consist of 6 equations on 9 variables by using Mathematica

I have a system of partial differential equations consist of 6 equations on 9 variables.

p = D[f[x1, x2, x3, y1, y2, y3, z1, z2, z3], x1];

q = D[f[x1, x2, x3, y1, y2, y3, z1, z2, z3], x2];

r = D[f[x1, x2, x3, y1, y2, y3, z1, z2, z3], x3];

o = D[f[x1, x2, x3, y1, y2, y3, z1, z2, z3], y1];

x = D[f[x1, x2, x3, y1, y2, y3, z1, z2, z3], y2];

a = D[f[x1, x2, x3, y1, y2, y3, z1, z2, z3], y3];

b = D[f[x1, x2, x3, y1, y2, y3, z1, z2, z3], z1];

c = D[f[x1, x2, x3, y1, y2, y3, z1, z2, z3], z2];

d = D[f[x1, x2, x3, y1, y2, y3, z1, z2, z3], z3];

equ1 = 2 x1 p + 2 x2 q + 2 x3 r - y1 o - y2 x - y3 a;

equ2 = -x1 p - x2 q - x3 r - z1 b - z2 c - z3 d + 2 y1 o + 2 y2 x + 2 y3 a;

equ3 = 2 z1 b + 2 z2 c + 2 z3 d - y1 o - y2 x - y3 a;

equ4 = (x1 (x1 + 2 x2 + 2 x3)) p + (x2 (x2 +
2 x3)) q + (x3^2) r - (y1 (x2 + x3)) o - y2 x3 x;

equ5 = (y1 (y1 + 2 y2 + 2 y3)) o + (y2 (y2 + 2 y3)) x + (y3^2) a - (x1 (y1 + y2 + y3)) p
- x2 (y2 + y3) q - x3 y3 r  - z1 (y2 + y3) b - z2 y3 c;

equ6 = (z1 (z1 + 2 z2 + 2 z3)) b + (z2 (z2 + 2 z3)) c + (z3^2) d - (y1 (z1 + z2 + z3)) o
- y2 ( z2 + z3) x - y3 z3 a;

The first three equations are degree equations and show that the solution has degree zero. so somehow by changing the variables to

v1=x2 /x1, v2=x3 /x1, w1=y2/y1, w2=y3/y1, k1=z2/z1, k2=z3/z1,

we will have 3 equations with 6 variables.

Can someone give me a more clever idea than using Dsolve for such kind of systems? because Dsolve returns un-evaluated.

DSolve[{equ1 == 0, equ2 == 0, equ3 == 0, equ4 == 0, equ5 == 0, equ6 == 0},
f[x1, x2, x3, y1, y2, y3, z1, z2, z3], {x1, x2, x3, y1, y2, y3, z1, z2, z3}]

Thanks!

• Why do you think you can find nine variables from six equations, or six variables from three equations? What about two variables from one equation (e.g., $x + y = 7$)? – David G. Stork Dec 16 '15 at 16:55
• In principle being underdetermined there could be many solutions. There is really no chance you will find an analytic solutions to such a system however. – george2079 Dec 16 '15 at 18:15
• @george2079 , yes we are expecting almost 10 solutions. But not all of them are suitable for us. We already have found common solution for "$equ4$ and $equ5$""equ5 and equ6". So if we can find a common solution for "equ4 and equ6" then somehow by combining these invariants we will be able to find the solution for whole system. – Farrokh Dec 16 '15 at 18:23
• on further though, you can trivially find infinitely many solutions. Just assume f a linear combination of the coefficients ( f=c1 x1 + c2 x2 .. ) You can arbitrarily specify three of the coefficients and algebraically solve. (If that's not satisfactory it indicates you have additional requirements you need to specify mathematically ) – george2079 Dec 16 '15 at 18:44
• If this set of equations has a solution, it seems likely that it will be an arbitrary function of three functions (probably polynomials) of the six variables, v1=x2 /x1, v2=x3 /x1, w1=y2/y1, w2=y3/y1, k1=z2/z1, k2=z3/z1. The challenge, then, is to find those three function. – bbgodfrey Dec 17 '15 at 23:41

## 1 Answer

As noted in the question, this computation can be simplified by the substitution,

f[x1, x2, x3, y1, y2, y3, z1, z2, z3] := g[x2/x1, x3/x1, y2/y1, y3/y1, z2/z1, z3/z1]

in which case the six equations become

Simplify[{equ1, equ2, equ3}]
(* {0, 0, 0} *)

equ4 = Simplify[Simplify[equ4]/x1 /. {x2 -> x1 v2, x3 -> x1 v3, y2 -> y1 w2,
y3 -> y1 w3, z2 -> z1 k2, z3 -> z1 k3}]
(* (v2 + v3)*w3*Derivative[0, 0, 0, 1, 0, 0][g][v2, v3, w2, w3, k2, k3] +
v2*w2*Derivative[0, 0, 1, 0, 0, 0][g][v2, v3, w2, w3, k2, k3] -
v3*(1 + 2*v2 + v3)*Derivative[0, 1, 0, 0, 0, 0][g][v2, v3, w2, w3, k2, k3] -
v2*(1 + v2)*Derivative[1, 0, 0, 0, 0, 0][g][v2, v3, w2, w3, k2, k3] *)

equ5 = Simplify[Simplify[equ5]/y1 /. {x2 -> x1 v2, x3 -> x1 v3, y2 -> y1 w2,
y3 -> y1 w3, z2 -> z1 k2, z3 -> z1 k3}]
(* k3*(w2 + w3)*Derivative[0, 0, 0, 0, 0, 1][g][v2, v3, w2, w3, k2, k3] +
k2*w2*Derivative[0, 0, 0, 0, 1, 0][g][v2, v3, w2, w3, k2, k3] -
w3*(1 + 2*w2 + w3)*Derivative[0, 0, 0, 1, 0, 0][g][v2, v3, w2, w3, k2, k3] -
w2*(1 + w2)*Derivative[0, 0, 1, 0, 0, 0][g][v2, v3, w2, w3, k2, k3] +
v3*(1 + w2)*Derivative[0, 1, 0, 0, 0, 0][g][v2, v3, w2, w3, k2, k3] +
v2*Derivative[1, 0, 0, 0, 0, 0][g][v2, v3, w2, w3, k2, k3] *)

equ6 = Simplify[Simplify[ equ6]/z1 /. {x2 -> x1 v2, x3 -> x1 v3, y2 -> y1 w2,
y3 -> y1 w3, z2 -> z1 k2, z3 -> z1 k3}]
(* -(k3*(1 + 2*k2 + k3)*Derivative[0, 0, 0, 0, 0, 1][g][v2, v3, w2, w3, k2, k3]) -
k2*(1 + k2)*Derivative[0, 0, 0, 0, 1, 0][g][v2, v3, w2, w3, k2, k3] +
(1 + k2)*w3*Derivative[0, 0, 0, 1, 0, 0][g][v2, v3, w2, w3, k2, k3] +
w2*Derivative[0, 0, 1, 0, 0, 0][g][v2, v3, w2, w3, k2, k3] *)

This system of first-order PDEs can be solved using the procedure described in Chapter V, Sec IV of Goursat's Differential Equations. The first step is to find the complete, non-commutative group of differential operators that includes equ4, equ5, and equ6. To do so, use the function comm, generalized from the related but simpler question, 99523.

drv = {Derivative[1, 0, 0, 0, 0, 0][g][v2, v3, w2, w3, k2, k3],
Derivative[0, 1, 0, 0, 0, 0][g][v2, v3, w2, w3, k2, k3],
Derivative[0, 0, 1, 0, 0, 0][g][v2, v3, w2, w3, k2, k3],
Derivative[0, 0, 0, 1, 0, 0][g][v2, v3, w2, w3, k2, k3],
Derivative[0, 0, 0, 0, 1, 0][g][v2, v3, w2, w3, k2, k3],
Derivative[0, 0, 0, 0, 0, 1][g][v2, v3, w2, w3, k2, k3]};
comm[equa_, equb_] := Collect[
(equa /. {Derivative[1, 0, 0, 0, 0, 0][g][v2, v3, w2, w3, k2, k3] -> D[equb, v2],
Derivative[0, 1, 0, 0, 0, 0][g][v2, v3, w2, w3, k2, k3] -> D[equb, v3],
Derivative[0, 0, 1, 0, 0, 0][g][v2, v3, w2, w3, k2, k3] -> D[equb, w2],
Derivative[0, 0, 0, 1, 0, 0][g][v2, v3, w2, w3, k2, k3] -> D[equb, w3],
Derivative[0, 0, 0, 0, 1, 0][g][v2, v3, w2, w3, k2, k3] -> D[equb, k2],
Derivative[0, 0, 0, 0, 0, 1][g][v2, v3, w2, w3, k2, k3] -> D[equb, k3]}) -
(equb /. {Derivative[1, 0, 0, 0, 0, 0][g][v2, v3, w2, w3, k2, k3] -> D[equa, v2],
Derivative[0, 1, 0, 0, 0, 0][g][v2, v3, w2, w3, k2, k3] -> D[equa, v3],
Derivative[0, 0, 1, 0, 0, 0][g][v2, v3, w2, w3, k2, k3] -> D[equa, w2],
Derivative[0, 0, 0, 1, 0, 0][g][v2, v3, w2, w3, k2, k3] -> D[equa, w3],
Derivative[0, 0, 0, 0, 1, 0][g][v2, v3, w2, w3, k2, k3] -> D[equa, k2],
Derivative[0, 0, 0, 0, 0, 1][g][v2, v3, w2, w3, k2, k3] -> D[equa, k3]}),
drv, Simplify]

equ7 = comm[equ4, equ5]
(* (k3*v2*w2 + k3*(v2 + v3)*w3)*Derivative[0, 0, 0, 0, 0, 1][g][v2, v3, w2, w3, k2, k3] +
k2*v2*w2*Derivative[0, 0, 0, 0, 1, 0][g][v2, v3, w2, w3, k2, k3] -
w3*(v3*(1 + w2 + w3) + v2*(1 + 2*w2 + w3))*
Derivative[0, 0, 0, 1, 0, 0][g][v2, v3, w2, w3, k2, k3] -
v2*w2*(1 + w2)*Derivative[0, 0, 1, 0, 0, 0][g][v2, v3, w2, w3, k2, k3] +
v3*(v3*(1 + w2) + v2*(2 + w2))*Derivative[0, 1, 0, 0, 0, 0][g][v2, v3, w2, w3, k2, k3] +
v2^2*Derivative[1, 0, 0, 0, 0, 0][g][v2, v3, w2, w3, k2, k3] *)

equ8 = comm[equ5, equ6]
(* -(k3*((1 + 2*k2 + k3)*w2 + (1 + k2 + k3)*w3)*
Derivative[0, 0, 0, 0, 0, 1][g][v2, v3, w2, w3, k2, k3]) -
k2*(1 + k2)*w2*Derivative[0, 0, 0, 0, 1, 0][g][v2, v3, w2, w3, k2, k3] +
w3*((2 + k2)*w2 + (1 + k2)*w3)*Derivative[0, 0, 0, 1, 0, 0][g][v2, v3, w2, w3, k2, k3] +
w2^2*Derivative[0, 0, 1, 0, 0, 0][g][v2, v3, w2, w3, k2, k3] -
v3*w2*Derivative[0, 1, 0, 0, 0, 0][g][v2, v3, w2, w3, k2, k3] *)

which are independent of the first three operators, increasing the size of the group to five. comm[equ4, equ6] vanishes identically and so does not add an operator. On the other hand, the seven additional commutators involving equ7 and equ8 yield expressions that are linear combinations of {equ4, equ5, equ6, equ7, equ8}. Thus, these five operators comprise the entire group.

From this information alone, we know that g is an arbitrary function of precisely one first integral. This first integral can be obtained by systematically eliminating variables and equations, one pair at a time, until a single equation of two variable remains. Start by solving any one of the equations. Because this process is presented in detail in 99523, here we merely list the required code without comment.

DSolve[equ4 == 0, g[v2, v3, w2, w3, k2, k3], {v2, v3, w2, w3, k2, k3}];
g[v2_, v3_, w2_, w3_, k2_, k3_] :=
h[w2, (v2 (1 + v2 + v3))/v3, (1 + v2) w2, (v3 w3)/v2, k2, k3];
tr1 = {equ4, equ5, equ6, equ7, equ8} // Simplify;
solw2 = First@tr1/(v2 w2) // Simplify;
newvar = Solve[Thread[{b1, b2, b3, b4, b5, b6} == List @@ solw2],
{v2, v3, w2, w3, k2, k3}] // Flatten;
tr1p = Collect[FullSimplify[Rest[tr1] /. solw2 -> 0 /. newvar], b1, FullSimplify]
/. b1*(z__) -> 0 /. Derivative[0, n1_, n2_, n3_, n4_, n5_][h][b1, b2, b3, b4, b5, b6]
-> Derivative[n1, n2, n3, n4, n5][h][b2, b3, b4, b5, b6];

DSolve[First@tr1p == 0, h[b2, b3, b4, b5, b6], {b2, b3, b4, b5, b6}] /. Log[z_] -> z;
h[b2_, b3_, b4_, b5_, b6_] := j[b4, b3, b5, (1 + b2 + b3) b4 b6, b6 (1 - b4)];
tr2 = tr1p // Simplify;
solb4 = First@tr2/(b4 (b4 - 1)) // Simplify;
newvar = Solve[Thread[{c1, c2, c3, c4, c5} == List @@ solb4], {b2, b3, b4, b5, b6}]
// Flatten;
tr2p = Collect[(Cancel[(c1 - 1) Rest@tr2] /. solb4 -> 0 /. newvar) //
FullSimplify, c1, FullSimplify];
tr2p[[3]] = tr2p[[3]]/c1;
tr2p = tr2p /. c1 z__ -> 0 /. Derivative[0, n1_, n2_, n3_, n4_][j][c1, c2, c3, c4, c5]
-> Derivative[n1, n2, n3, n4][j][c2, c3, c4, c5];

DSolve[Last@tr2p == 0, j[c2, c3, c4, c5], {c2, c3, c4, c5}];
j[c2_, c3_, c4_, c5_] := l[c5, c2, c3, (c2 - c4)/(1 + c3 + c5)];
tr3 = -tr2p // Simplify // RotateRight;
solc5 = First@tr3/(c5 (1 + c3 + c5)) // Simplify;
newvar = Solve[Thread[{d1, d2, d3, d4} == List @@ solc5], {c2, c3, c4, c5}] // Flatten;
tr3p = Collect[(Rest@tr3 /. solc5 -> 0 /. newvar) // FullSimplify, d1,
FullSimplify] /. d1 z__ -> 0 /. Derivative[0, n1_, n2_, n3_][l][d1, d2, d3, d4]
-> Derivative[n1, n2, n3][l][d2, d3, d4];

DSolve[Last@tr3p == 0, l[d2, d3, d4], {d2, d3, d4}] // Simplify;
l[d2_, d3_, d4_] := m[d3, (1 + d2) d3, (d2 (1 + d2 - d4))/d4];
tr4 = tr3p // Simplify // RotateRight;
sold3 = First@tr4/(d2 d3);
newvar = Solve[Thread[{e1, e2, e3} == List @@ sold3], {d2, d3, d4}] //  Flatten;
tr4p = Collect[(-(e2/e1) Rest@tr4 /. sold3 -> 0 /. newvar) //
FullSimplify, e1, FullSimplify] /. e1 z__ -> 0
/. Derivative[0, n1_, n2_][m][e1, e2, e3] -> Derivative[n1, n2][m][e2, e3];

(DSolve[Last@tr4p == 0, m[e2, e3], {e2, e3}] // Simplify) /. Log[z_] -> z;
(((((((%[[1, 1, 2]] /. Thread[{e1, e2, e3} -> List @@ sold3]) // Simplify)
/. Thread[{d1, d2, d3, d4} -> List @@ solc5]) // Simplify)
/. Thread[{c1, c2, c3, c4, c5} -> List @@ solb4]) // Simplify)
/. Thread[{b1, b2, b3, b4, b5, b6} -> List @@ solw2] // Simplify)
/. {v2 -> x2/x1, v3 -> x3/x1, w2 -> y2/y1, w3 -> y3/y1, k2 -> z2/z1, k3 -> z3/z1})
// Simplify

(* C[1][(((x2 y2 z2 + x1 (y2 z2 + y1 (z1 + z2))) (x3 y3 z3 + x2 (y3 z3 + y2 (z2 + z3))))/
(x2 y2 z2 (x3 y3 z3 + x2 (y3 z3 + y2 (z2 + z3)) +
x1 (y3 z3 + y2 (z2 + z3) + y1 (z1 + z2 + z3)))))] *)

• Oh! my friend. You found the solution!! I checked it! it satisfied! I am very very happy :) Thank you very much! :) Can you please let me know how did you found it? – Farrokh Dec 26 '15 at 12:18
• @farrokh I shall provide the derivation within a few hours. For now, see your earlier question, which I also solved. – bbgodfrey Dec 26 '15 at 12:19
• Oh! I am very happy :) Thanks a lot! :) – Farrokh Dec 26 '15 at 12:19


text:
# 16.5 Telescopes  (Page 2/4)

 Page 2 / 4

The image in most telescopes is inverted, which is unimportant for observing the stars but a real problem for other applications, such as telescopes on ships or telescopic gun sights. If an upright image is needed, Galileo’s arrangement in [link] (a) can be used. But a more common arrangement is to use a third convex lens as an eyepiece, increasing the distance between the first two and inverting the image once again as seen in [link] .

A telescope can also be made with a concave mirror as its first element or objective, since a concave mirror acts like a convex lens as seen in [link] . Flat mirrors are often employed in optical instruments to make them more compact or to send light to cameras and other sensing devices. There are many advantages to using mirrors rather than lenses for telescope objectives. Mirrors can be constructed much larger than lenses and can, thus, gather large amounts of light, as needed to view distant galaxies, for example. Large and relatively flat mirrors have very long focal lengths, so that great angular magnification is possible.

Telescopes, like microscopes, can utilize a range of frequencies from the electromagnetic spectrum. [link] (a) shows the Australia Telescope Compact Array, which uses six 22-m antennas for mapping the southern skies using radio waves. [link] (b) shows the focusing of x rays on the Chandra X-ray Observatory—a satellite orbiting earth since 1999 and looking at high temperature events as exploding stars, quasars, and black holes. X rays, with much more energy and shorter wavelengths than RF and light, are mainly absorbed and not reflected when incident perpendicular to the medium. But they can be reflected when incident at small glancing angles, much like a rock will skip on a lake if thrown at a small angle. The mirrors for the Chandra consist of a long barrelled pathway and 4 pairs of mirrors to focus the rays at a point 10 meters away from the entrance. The mirrors are extremely smooth and consist of a glass ceramic base with a thin coating of metal (iridium). Four pairs of precision manufactured mirrors are exquisitely shaped and aligned so that x rays ricochet off the mirrors like bullets off a wall, focusing on a spot.

A current exciting development is a collaborative effort involving 17 countries to construct a Square Kilometre Array (SKA) of telescopes capable of covering from 80 MHz to 2 GHz. The initial stage of the project is the construction of the Australian Square Kilometre Array Pathfinder in Western Australia (see [link] ). The project will use cutting-edge technologies such as adaptive optics    in which the lens or mirror is constructed from lots of carefully aligned tiny lenses and mirrors that can be manipulated using computers. A range of rapidly changing distortions can be minimized by deforming or tilting the tiny lenses and mirrors. The use of adaptive optics in vision correction is a current area of research.

## Section summary

• Simple telescopes can be made with two lenses. They are used for viewing objects at large distances and utilize the entire range of the electromagnetic spectrum.
• The angular magnification M for a telescope is given by
$M=\frac{\theta \prime }{\theta }=-\frac{{f}_{\text{o}}}{{f}_{\text{e}}}\text{,}$
where $\theta$ is the angle subtended by an object viewed by the unaided eye, $\theta \prime$ is the angle subtended by a magnified image, and ${f}_{\text{o}}$ and ${f}_{\text{e}}$ are the focal lengths of the objective and the eyepiece.

## Conceptual questions

If you want your microscope or telescope to project a real image onto a screen, how would you change the placement of the eyepiece relative to the objective?

## Problem exercises

Unless otherwise stated, the lens-to-retina distance is 2.00 cm.

What is the angular magnification of a telescope that has a 100 cm focal length objective and a 2.50 cm focal length eyepiece?

$-\text{40}\text{.}0$

Find the distance between the objective and eyepiece lenses in the telescope in the above problem needed to produce a final image very far from the observer, where vision is most relaxed. Note that a telescope is normally used to view very distant objects.

A large reflecting telescope has an objective mirror with a $\text{10}\text{.}0 m$ radius of curvature. What angular magnification does it produce when a $3\text{.}\text{00 m}$ focal length eyepiece is used?

$-1\text{.}\text{67}$

A small telescope has a concave mirror with a 2.00 m radius of curvature for its objective. Its eyepiece is a 4.00 cm focal length lens. (a) What is the telescope’s angular magnification? (b) What angle is subtended by a 25,000 km diameter sunspot? (c) What is the angle of its telescopic image?

A $7.5×$ binocular produces an angular magnification of $-7\text{.}\text{50}$ , acting like a telescope. (Mirrors are used to make the image upright.) If the binoculars have objective lenses with a 75.0 cm focal length, what is the focal length of the eyepiece lenses?

$+\text{10.0 cm}$

Consider a telescope of the type used by Galileo, having a convex objective and a concave eyepiece as illustrated in [link] (a). Construct a problem in which you calculate the location and size of the image produced. Among the things to be considered are the focal lengths of the lenses and their relative placements as well as the size and location of the object. Verify that the angular magnification is greater than one. That is, the angle subtended at the eye by the image is greater than the angle subtended by the object.

what is the stm
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
Rafiq
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
Damian
How we are making nano material?
what is a peer
What is meant by 'nano scale'?
What is STMs full form?
LITNING
scanning tunneling microscope
Sahil
how nano science is used for hydrophobicity
Santosh
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
Rafiq
what is differents between GO and RGO?
Mahi
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
Rafiq
what is Nano technology ?
write examples of Nano molecule?
Bob
The nanotechnology is as new science, to scale nanometric
brayan
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Damian
Is there any normative that regulates the use of silver nanoparticles?
what king of growth are you checking .?
Renato
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
why we need to study biomolecules, molecular biology in nanotechnology?
?
Kyle
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
why?
what school?
Kyle
biomolecules are e building blocks of every organics and inorganic materials.
Joe
anyone know any internet site where one can find nanotechnology papers?
research.net
kanaga
sciencedirect big data base
Ernesto
Introduction about quantum dots in nanotechnology
what does nano mean?
nano basically means 10^(-9). nanometer is a unit to measure length.
Bharti
do you think it's worthwhile in the long term to study the effects and possibilities of nanotechnology on viral treatment?
absolutely yes
Daniel
how to know photocatalytic properties of tio2 nanoparticles...what to do now
it is a goid question and i want to know the answer as well
Maciej
Abigail
for teaching engĺish at school how nano technology help us
Anassong
How can I make nanorobot?
Lily
Do somebody tell me a best nano engineering book for beginners?
there is no specific books for beginners but there is book called principle of nanotechnology
NANO
how can I make nanorobot?
Lily
what is fullerene does it is used to make bukky balls
are you nano engineer ?
s.
fullerene is a bucky ball aka Carbon 60 molecule. It was name by the architect Fuller. He design the geodesic dome. it resembles a soccer ball.
Tarell
what is the actual application of fullerenes nowadays?
Damian
That is a great question Damian. best way to answer that question is to Google it. there are hundreds of applications for buck minister fullerenes, from medical to aerospace. you can also find plenty of research papers that will give you great detail on the potential applications of fullerenes.
Tarell
how did you get the value of 2000N.What calculations are needed to arrive at it
Privacy Information Security Software Version 1.1a
Good
Got questions? Join the online conversation and get instant answers!

format: plain


text:
# Can the empirical formula of a compound be experimentally found?

Jun 23, 2014

The empirical formula of a compound can be experimentally found.

For example, you can do an experiment to determine the empirical formula of magnesium oxide. You heat a known mass of magnesium in a crucible and determine the mass of oxide formed.

Example

Assume that you heated 0.297 g of magnesium and obtained 0.493 g of the oxide. What is the empirical formula of magnesium oxide?

Solution

The empirical formula is the simplest whole-number ratio of atoms in a compound.

The ratio of atoms is the same as the ratio of moles. So our job is to calculate the molar ratio of Mg to O.

Mass of Mg = 0.297 g

Mass of oxide = mass of Mg + mass of O

0.493 g = 0.297 g + mass of O

Mass of O = (0.493 – 0.297) g = 0.196 g

Moles of Mg = 0.297 g × $\left(1 \text{mol Mg")/(24.30"g Mg}\right)$ = 0.012 22 mol Mg

Moles of O = 0.196 g O × $\left(1 \text{mol O")/(16.00"g O}\right)$ = 0.012 25 mol O

Ratio = "Moles of Mg"/"Moles of O" = (0.012 22"mol")/(0.012 25"mol") = 1/1.002 ≈ 1/1.

There is 1 mol of Mg for 1 mol of O. So

There is 1 atom of Mg for 1 mol of O.

The empirical formula of magnesium oxide is MgO.


text:
# XVector-class

0th

Percentile

##### XVector objects

The XVector virtual class is a general container for storing an "external vector". It inherits from the Vector class, which has a rich interface.

The following classes derive directly from the XVector class:

The XRaw class is a container for storing an "external raw vector" i.e. an external sequence of bytes (stored as char values at the C level).

The XInteger class is a container for storing an "external integer vector" i.e. an external sequence of integer values (stored as int values at the C level).

The XDouble class is a container for storing an "external double vector" i.e. an external sequence of numeric values (stored as double values at the C level).

Also the XString class defined in the Biostrings package.

The purpose of the X* containers is to provide a "pass by address" semantic and also to avoid the overhead of copying the sequence data when a linear subsequence needs to be extracted.

Keywords
classes, methods
##### Additional Subsetting operations on XVector objects

In the code snippets below, x is an XVector object.

subseq(x, start=NA, end=NA, width=NA): Extract the subsequence from x specified by start, end and width. The supplied start/end/width values are solved by a call to solveUserSEW(length(x), start=start, end=end, width=width) and therefore must be compliant with the rules of the SEW (Start/End/Width) interface (see ?solveUserSEW for the details). A note about performance: subseq does NOT copy the sequence data of an XVector object. Hence it's very efficient and is therefore the recommended way to extract a linear subsequence (i.e. a set of consecutive elements) from an XVector object. For example, extracting a 100Mb subsequence from Human chromosome 1 (a 250Mb DNAString object) with subseq is (almost) instantaneous and has (almost) no memory footprint (the cost in time and memory does not depend on the length of the original sequence or on the length of the subsequence to extract).
subseq(x, start=NA, end=NA, width=NA) <- value: Replace the subsequence specified on the left (i.e. the subsequence in x specified by start, end and width) by value. value must belong to the same class as x, or to one of its subclasses, or must be NULL. This replacement method can modify the length of x, depending on how the length of the left subsequence compares to the length of value. It can be used for inserting elements in x (specify an empty left subsequence for this) or deleting elements from x (use a NULL right value for this). Unlike the extraction method above, this replacement method always copies the sequence data of x (even for XVector objects). NOTE: Only works for XRaw (and derived) objects for now.

Vector-class, DNAString-class, XVectorList-class, Views-class, solveUserSEW, compact

##### Aliases
• class:XVector
• XVector-class
• XVector
• length,XVector-method
• c,XVector-method
• [,XVector-method
• subseq
• subseq<-
• subseq,XVector-method
• subseq<-,XVector-method
• as.numeric,XVector-method
• show,XVector-method
• ==,XVector,XVector-method
• class:XRaw
• XRaw-class
• XRaw
• coerce,raw,XRaw-method
• coerce,raw,XVector-method
• coerce,numeric,XRaw-method
• as.raw,XRaw-method
• as.integer,XRaw-method
• as.vector,XRaw-method
• class:XInteger
• XInteger-class
• XInteger
• coerce,numeric,XInteger-method
• coerce,integer,XVector-method
• as.integer,XInteger-method
• as.vector,XInteger-method
• class:XDouble
• XDouble-class
• XDouble
• XNumeric
• coerce,numeric,XDouble-method
• coerce,numeric,XVector-method
• as.numeric,XDouble-method
• as.vector,XDouble-method
• show,XDouble-method
##### Examples
  ## ---------------------------------------------------------------------
## A. XRaw OBJECTS
## ---------------------------------------------------------------------

x1 <- XRaw(4)  # values are not initialized
x1
x2 <- as(c(255, 255, 199), "XRaw")
x2
y <- c(x1, x2, NULL, x1)  # NULLs are ignored
y
subseq(y, start=-4)
subseq(y, start=-4) <- x2
y

## ---------------------------------------------------------------------
## B. XInteger OBJECTS
## ---------------------------------------------------------------------

x3 <- XInteger(12, val=c(-1:10))
x3
length(x3)

## Subsetting
x4 <- XInteger(99999, val=sample(99, 99999, replace=TRUE) - 50)
x4
subseq(x4, start=10)
subseq(x4, start=-10)
subseq(x4, start=-20, end=-10)
subseq(x4, start=10, width=5)
subseq(x4, end=10, width=5)
subseq(x4, end=10, width=0)

x3[length(x3):1]
x3[length(x3):1, drop=FALSE]

Documentation reproduced from package XVector, version 0.10.0, License: Artistic-2.0

### Community examples

Looks like there are no examples yet.


text:
# How much work would it take to push a  12 kg  weight up a  6 m  plane that is at an incline of  pi / 3 ?

Apr 13, 2017

The work done is $= 611.1 J$

#### Explanation:

The component of the force parallel to the plane is

$F = m g \sin \theta$

The work done is

$W = F \cdot d$

$W = m g \sin \theta \cdot d$

$= 12 \cdot 9.8 \cdot \sin \left(\frac{\pi}{3}\right) \cdot 6$

$= 611.1 J$


text:
# Real Number Operations and PEMDAS Practice Test 1

In the previous post, you have learned the PEMDAS rules or the rules in performing arithmetic operations namely addition, subtraction, multiplication and division. In this post, you will practice to see if you have mastered these rules. I have mixed the notations so that you will be familiarized with all of them. For example, $4 \times 8 + 3 \times -2$ can also be written as $4(8) + 3(-2)$ or $(4)(8) + (3)(-2)$.

You should also be familiar with division where in the expression

$\displaystyle \frac{(3 + 2) \times 3}{3 + 5}$

the operation in both the numerator and numerator are simplified first before dividing the expressions. This is equivalent to $(3 + 2)(3) \div (3 + 5)$. Do not worry though regarding the use of parentheses, we will discuss them in the next topic. For now, answer the questions to the best of your abilities.

##### PEMDAS Practice Test 1

1. $2 \times 3 + 4 \times 6$

2. $(-3)(2) + 18 \div 3$

3. $4 + (6 - 2)^2 + 1$

4. $8(6 - 2) \div 2(5 - 3)$

5. $(-12)(-3) + 8^2$

6. $4 \div 5 \times 25 + 2$

7. $\displaystyle \frac{-9(2 + 1)}{-2(-2-1)}$

8. $4( 3 + 1) - 2(5 -2)$

9. $\displaystyle \frac{14}{-3-4}$

10. $\displaystyle \frac{2^2 - 4^2}{-3 - 1}$

11. $-(-3) + 8 \div 4$

12. $9^2 - 8 - 2^3$

13. $(-7 - 9) (8 - 4) + 4^3 \div 8$

14. $6 + 3 \times 2 - 12 \div 4$

15. $7 \times (3 + 2 ) - 5$

In the next post, I will give the solutions to the practice test above. After that, I will also discuss on how to calculate expressions with nested parentheses.


text:
# Parametric Equation of a Surface

If $\left\{P_{k,l}^{0}\right\}_{k,l=0}^{n}$ is a set of $\left(n+1\right)^2$ three-dimensional points, and

$$P_{k,l}^{r+1}\left(t,s\right)=\left(P_{k+1,l+1}^{r}+P_{k+1,l}^{r}+P_{k,l+1}^{r}+P_{k,l}^{r}\right)ts,\tag{*}$$

then, is $P_{0,0}^{n}(t,s)$ the parametric equation of a surface?

I tried plotting this with a set of test points and obtained a spatial, straight line, when I was instead aiming to obtain a surface (since I am making use of the two parameters $t$ and $s$).

What is the problem with $(*)$? I am just interested in knowing whether this is a surface or not. Thanks in advance!

-
The notation is very confusing (I assume this is some special case of something more general, or I am completely misunderstanding). I assume "three-dimensional point" means vector in $\mathbb{R}^3$. In which case, I don't understand the summation. Effectively, you are asking, "Given $v\in\mathbb{R}^3$, does $vts$ define a surface as $t$ and $s$ vary?" Well, you are only getting the linear span of $v$ no matter what $t$ and $s$ are, so you actually always get a straight line! (Unless that sum is $0$, in which case you only get a point). –  Matt Nov 13 '12 at 22:42
@Matt, the way I read it, the sum itself depends on $t$ and $s$. The superscript $r$ is the key: the 0th generation is constant, the 1st linear in them, and the $r$th generation has degree $r$ of both. So in the end, you will probably have something curved. –  MvG Nov 14 '12 at 0:07
Thank you, @Matt. Yes! You're completely right; this is a very special case of something way more general on which I'm currently working on. Indeed, the points are best thought of as vectors in $\mathbb{R}^3$, and now that you broke it down like that for me, I see how this is just either a point or a straight line regardless of the values of $t$ and $s$ (I could even merge them into one variable). I will have a talk with my adviser about this and post any clarifications promptly. –  Josué Molina Nov 14 '12 at 0:11

As far as I read your notation, the formulka does not describe a surface. You work with two parameters, but only ever use the product of these. So the set of points $P_{0,0}^n(t,s)$ can be described using a single parameter, e.g. $P_{0,0}^n(u,1)$. You can see that by taking $u=ts$, there is a one-to-one correspondence between your two-parameter form any my one-parameter version. Therefore, the best you can hope for is a curved line, not a surface.

-


text:
# Calculate the percentile from a T-score

Is it possible to calculate the percentile from a T-score?

If yes, what formula can be used for it, and what other variables (e.g. standard deviation, degrees of freedom, etc.) are needed for it?

• Welcome to stats.SE! Please take a moment to view our tour. Are you seeking to calculate the percentile of the T-score relative to other T-scores or are you hoping to calculate a percentile for your distribution based upon the T-score? – Tavrock Feb 28 '17 at 1:54

The formula for this is as follows, where $\nu$ is the degrees of freedom, $t^{2} < \nu$, and $_{2}F_{1}$ is a hypergeometric function.
$\int^{t}_{-\inf} f(u) du = \frac{1}{2} + t [ \frac{\Gamma(\frac{\nu + 1}{2})}{\sqrt{\pi\nu}\Gamma(\frac{\nu}{2})}] [ _{2}F_{1}(\frac{1}{2}, \frac{\nu + 1}{2}; \frac{3}{2}; -\frac{t^2}{\nu})]$
This can be easily done in R using pt().


text:
Followers 0

# C++ Inheritance confusion

## 11 posts in this topic

This has got to be a simple mistake, but I've stared at it for too long now and I just don't see it.  (Excuse the canned example; it's pretty close to the real thing though.)

class Foo {

public:
Foo(vector<string> things, string place) : m_thingList(things)
{
log("in Foo ctor");
validatePlacePriorToAssignment(place);
}

virtual ~Foo() {}

private:

vector<string> m_thingList;
string m_validatedPlace;

validatePlacePriorToAssignment(string p)
{
// do stuff to validate place; if not valid, throw exception
// else
m_validatedPlace = p;
}
...
};

class Bar : public Foo {
public:
const string defaultPlace = "Validville";
Bar(vector<string> stuff) : Foo(stuff, defaultPlace)
{
log("in Bar ctor");
}
...
};

someFunctionSomewhere(vector<string> allTheThings) {
try { Bar barbar(allTheThings); }
}

Okay, here's the weirdness I'm seeing: there is a log entry for the Foo ctor but not the Bar ctor. I'm stack-allocating a member of a derived class; my understanding is that the base ctor is called THEN the derived ctor is called...but in this case that doesn't seem to be happening!

I'm worried that I'm doing inheritance wrong, or using initializer lists wrong, or I'm  using them wrong in the context of inheritance, or for some reason it's wrong (not allowed) to validate prior to assigning in a constructor. I think I'm doing this all correctly, but obviously I'm not so here I am.

I've read through a bunch of tutorials and stackoverflow examples this afternoon, and - for the life of me - I can't figure out why this isn't working; it looks like all the sample code. If you can catch it, I'd be especially grateful.

1

##### Share on other sites

Removing the init lists entirely results in the kind of behavior I'd expect, i.e. I see log entries from both ctors and in the order I'd expect (Foo then Bar).

0

##### Share on other sites

It looks correct. Is the exception being triggered? Maybe "validatePlacePriorToAssignment(place);" is crashing and you aren't realizing it.

2

##### Share on other sites

That's got to be it! I commented out the validate() call and just set the member in the init list. So...good. Thank you for being a sanity check for me, haha. :)

A little odd; I thought for sure I was catching there, but I am demonstrably incorrect. I was looking in the very wrong place.

Thank you!

2

##### Share on other sites

That (const string bug) was actually a second bug, well shielded by the first one. :)

I fixed it with stackoverflow: http://stackoverflow.com/questions/1563897/c-static-constant-string-class-member

In short, it's now declared (static const) in the class decl, then defined in the cpp file, but still scoped to the class (which is what I wanted).

Second set of eyes for the win. :) Nice to see it running again.

0

##### Share on other sites

This is the reason I usually stick with trivial, or even empty, constructors, and then call an explicit init() function after instantiation.  Constructos, exceptions, and manual memory management are a really bad combination :-) .  The problem is even worse for destructors.

0

##### Share on other sites

That's true. Another reason for an init()-type function is to reuse the memory of same class instance rather than deleting and then allocating a new object, or to intentionally delay some heavy operation until a more convenient time.

I meant that avoiding constructors and destructors because they can cause bugs if misused doesn't mean your code will be safe - you'll just be looking at a different set of bugs. Constructors and destructors go hand in hand with memory management.

Using an init() function when it is part of the class's desired interface makes sense. Using an init() function solely because you don't like constructors doesn't make sense. Doubly sole for destructors.

0

##### Share on other sites

So, while we're on the topic, what are the direct thoughts on my design there? I.E. using a validator (and potentially throwing) from the constructor (the latter an idea I got from Scott Meyer, iirc) vs. constructing empty then compelling the user to fill in the blanks prior to calling run().

The reason I wanted to have the constructor do the validation and bomb gracefully upon a fail is that I want the interface here to be very difficult to use incorrectly, and there's (at least) two parts to that, which I see: fewer calls need to be made (less internals exposed) and it still prevents you from doing something bonkers (in my example there, you can't do any object-supported operations on your list of things if the place isn't valid).

think that, were I to allow empty construction then push init responsibility to the user, there's not much of a difference: init() could throw instead of the constructor, and you'd still have an object in an empty/usable state. (That has some appeal.) I'm honestly not clear on what the right answer to this is.

0

##### Share on other sites

RAII says to initialize your data, and to this I agree.

It is in contrast to other languages (such as C) where a structure can be created but initially contains unspecified garbage, just whatever happened to be in memory at the time. Empty is initialized, random unspecified garbage is uninitialized.

People who come from a more modern language background (C#/Java/Python) are used to members being automatically initialized for you, so when they see RAII they interpret it differently than it was meant. Back in the day when the alternative meant having unspecified values, including invalid values that looked like valid values, RAII meant creating an allocation function that allocated memory and then immediately called something like bzero() or memset() or otherwise immediately assigning valid values if zero is not appropriate, then returned the initialized resource.

In my experience it is fine to allow a convenience non-default constructor if you want, but beware of error conditions.

It is generally best to have a default constructor that only creates and empty object. This way when someone allocates an array or temporaries or other quick-to-do things, they immediately get back the objects without any fuss.

If you want to provide an additional constructor that builds up an object based on additional data you can do so but it adds complexity. Now you have a constructor that is likely to have error conditions (so you may need to throw based on all possible error conditions, in turn forcing you to catch all the exceptions that might be thrown at construction time). Such a constructor takes more time and blocks execution. Such a constructor generally makes some things a little more complicated in exchange for convenience in another area. Yes, for some things there is no additional cost and the difference is that the values are assigned to only once rather than twice; for other objects, however, the cost to the application can be quite large. When such a constructor requires trips to disk, trips to the network, or any other long-running or blocking behavior, I generally question its necessity.

Edited by frob
2

## Create an account

Register a new account


text:
Other Open Access

# ATLAS Deliverable 5.5: Ocean monetary values to support adaptive marine spatial planning

Tinch, R; Foley, N; Armstrong, C

### DataCite XML Export

<?xml version='1.0' encoding='utf-8'?>
<identifier identifierType="DOI">10.5281/zenodo.4658968</identifier>
<creators>
<creator>
<creatorName>Tinch, R</creatorName>
<givenName>R</givenName>
<familyName>Tinch</familyName>
</creator>
<creator>
<creatorName>Foley, N</creatorName>
<givenName>N</givenName>
<familyName>Foley</familyName>
</creator>
<creator>
<creatorName>Armstrong, C</creatorName>
<givenName>C</givenName>
<familyName>Armstrong</familyName>
</creator>
</creators>
<titles>
<title>ATLAS Deliverable 5.5: Ocean monetary values to support adaptive marine spatial planning</title>
</titles>
<publisher>Zenodo</publisher>
<publicationYear>2021</publicationYear>
<dates>
<date dateType="Issued">2021-04-01</date>
</dates>
<resourceType resourceTypeGeneral="Other"/>
<alternateIdentifiers>
<alternateIdentifier alternateIdentifierType="url">https://zenodo.org/record/4658968</alternateIdentifier>
</alternateIdentifiers>
<relatedIdentifiers>
<relatedIdentifier relatedIdentifierType="DOI" relationType="IsVersionOf">10.5281/zenodo.4658967</relatedIdentifier>
<relatedIdentifier relatedIdentifierType="URL" relationType="IsPartOf">https://zenodo.org/communities/atlas</relatedIdentifier>
</relatedIdentifiers>
<rightsList>
<rights rightsURI="info:eu-repo/semantics/openAccess">Open Access</rights>
</rightsList>
<descriptions>
<description descriptionType="Abstract">
Marine spatial planning (MSP) is a planning process that uses Ecosystem Based Management (EBM) principles and focuses on the spatially explicit nature of many ocean activities and resources (TEEB 2012, p23). EBM differs from traditional approaches focused on single sectors, activities or species, by taking account of interactions, synergies and cumulative effects. MSP needs to take account of the services provided and potentially provided from different areas, the activities involved in accessing them, and the resulting cumulative effects on marine ecosystems. The planning approach should be ecosystem based and spatially explicit, and should consider human benefits and impacts, address cumulative impacts, and take account of future activities and changes, with the aim of ensuring that the collective pressure of activities remains compatible with a healthy and sustainable marine environment (Nordic Council of Ministers 2017).

Services from the deep sea are in increasing demand, and pressure to utilize more fully deep-sea products such as seafood, energy resources and minerals are on the rise (Thurber, Sweetman et al. 2014). The deep North Atlantic Ocean is now known to harbour ecosystems that support a biologically rich variety of life that perform key functions within global biogeochemical cycles (Armstrong et al, 2019a). The deep-sea ecosystems, including cold water corals, sponges, seamounts and hydrothermal vents, also provide many other ecosystem goods and services, which contribute to maritime economic activities that underpin the socio-economic well-being of Atlantic nations and their citizens (Galparsoro et al, 2014; Armstrong et al, 2019a). These services include nutrient cycling, waste absorption and detoxification, fisheries, bioprospecting and a number of cultural services related to education and science, aesthetic and inspirational contributions (Armstrong et al, 2012).&nbsp;However, marine ecosystems and resources are subject to significant pressures. Human activities, but also climate change effects, and natural hazards and dynamics such as erosion and accretion, can have severe impacts on marine ecosystems, leading to deterioration of environmental status, loss of biodiversity and degradation of ecosystem services (COM 2014). These pressures and impacts in turn have potentially significant consequences for marine economic development and growth. The dual recognition that human pressures directly impact on ecosystem services and that ecosystem services directly benefit human well-being has led to increasing efforts to integrate ecosystem services in policy and management (Galparsoro, Borja et al. 2014).

Achieving sustainable exploitation of marine resources in the deep sea is particularly challenging, due to the huge uncertainty around the many risks posed by human activities on these remote and relatively poorly understood ecosystems (Armstrong et al, 2019a), for which management regimes are often poorly defined, in particular in the areas beyond national jurisdiction (ABNJ). There are often difficult trade-offs to make between different possible services and the immediate and longer-term impacts of marine activities (Armstrong et al 2019a).

It is essential to consider the various pressures and their impacts in the establishment of marine spatial plans (COM 2014). So in order to evaluate the effectiveness and sustainability of a plan for simultaneously benefiting from and conserving marine resources, a range of ecological, socio-economic and institutional indicators need to be developed and monitored (Douvere and Ehler, 2011). These indicators must include the identification of services, their values and conflict areas, and their incorporation as important inputs to policy making, and in particular marine spatial planning (Armstrong et al, 2014).&nbsp;

To date, however, there is a lack of environmental baselines and assessments in relation to human interactions with the deep sea (Armstrong et al, 2019a). Consequently MSP is not well developed for the deep sea, and most existing MSP focuses on coastal waters or shelf areas. With growing anthropogenic pressures in deep-sea environments, developing sustainable plans is a priority. Better knowledge of the values provided by habitat-based sea-floor ecosystem services could help to justify further policy action, development of Marine Protected Areas, conservation, and resource use. This information could also help design responses to global change that will inevitably impact on deep-sea&nbsp;ecosystems and biodiversity, and the services they provide.2 The ATLAS project has started to put in place the information required for economic baselines in the North Atlantic, considering areas both inside and outside EEZs. The research includes:

Identification of ecosystem goods and services (Deliverable 5.1)

Assessment of risks to ecosystem services from diverse human drivers (Deliverable 5.2):

Ecosystem goods and services and environmental risk assessment (Deliverable 6.2):

Original stated-preference valuation surveys for two ATLAS case-study areas (Deliverable 5.4)

A Q study of decision-maker and stakeholder views on the legitimacy, validity and acceptability of monetary valuation methods and the use of values in decision support (Deliverable 5.3)

Together, the results of this work can be considered as a first step towards establishing an economic baseline for adaptive MSP in the deep North Atlantic Ocean.&nbsp;
</description>
</descriptions>
<fundingReferences>
<fundingReference>
<funderName>European Commission</funderName>
<funderIdentifier funderIdentifierType="Crossref Funder ID">10.13039/501100000780</funderIdentifier>
<awardNumber awardURI="info:eu-repo/grantAgreement/EC/H2020/678760/">678760</awardNumber>
<awardTitle>A Trans-AtLantic Assessment and deep-water ecosystem-based Spatial management plan for Europe</awardTitle>
</fundingReference>
</fundingReferences>
</resource>

13
9
views


text:
## The polyhedral Gauss-Bonnet Theorem

The Gauss-Bonnet Theorem states that for any smooth surface S the integral of the Gaussian curvature is equal to 2 times the Euler characteristic of S. (This theorem is an elementary consequence of Gauss's local integral formula.)

For example, the sphere of radius R has constant Gaussian curvature 1/R2 and area 4 R2; the integral of the Gaussian curvature is 4 ,which is 2 times the Euler characteristic 2.

This theorem has a polyhedral version: For any polyhedral surface, the sum of the polyhedral curvatures is equal to 2 times the Euler characteristic.

For a convex polyhedron with Euler characteristic 2, this is just another statement of Descartes's Lost Theorem, but it can be applied more generally, for example, to a toroidal surface:

  _____________________ / / /| / _____/_____ / | / / / / / / / |________/ / / / / / / / / / / / / / / / /__________/ / / / / / / /__________/_________/ / | | / |____________________|/ This polyhedral torus has 8 vertices where the curvature is /2, 8 vertices where the curvature is 0, and 8 vertices where the curvature is -/2, Total = 0. At each of the vertices around the outside there are three planar right angles, giving a polyhedral curvature of /2. At each of the vertices in the center of the top or bottom, the sum of the face angles is 2 , giving a polyhedral curvature of 0. At each of the eight vertices surrounding the hole, the sum of the face angles is 5 /2, giving polyhedral curvature -/2. The total curvature is 0.

It is not clear what appeal such a calculation would have had for Descartes. Even though tesselated tori were well known as mazzochi in Italian art of the fifteenth century, the classical subjects of interest to geometers remained convex polygons and convex polyhedra. Moreover, negative curvature would not have seemed a natural concept, since at the beginning of his career (he was twenty-four in 1620) he was reluctant to consider negative numbers at all. Finally, for Descartes the distinction between a vertex and the measure of the (planar or solid) angle at that vertex was not explicit; the lack of this distinction probably kept him from the combinatorial version of his theorem that Euler derived. Nevertheless, his Lost Theorem, now recovered, remains as indelible evidence of the geometrical power of this intellectual giant.

Back to previous Descartes page.

Back to first Descartes page.

Welcome to the
Feature Column!

These web essays are designed for those who have already discovered the joys of mathematics as well as for those who may be uncomfortable with mathematics.


text:
# Set theory bootstrapping

Let $\mathcal{L}$ be the first order language of ZFC set theory, and let $\mathcal{L}_{\infty,\infty}$ be the usual infinitary extension of the language allowing arbitrary long disjunctions/conjunctions and quantifications.

What happens if one replaces the usual axiom schema of replacement for ZFC by a new schema over (the class of) formulas from $\mathcal{L}_{\infty,\infty}$ instead of from the first-order theory? Does one get a "standard" model of set theory?

Do set theorists believe that this improved version of replacement is true? If so, why still work over the less expressive language $\mathcal{L}$? If not, why not?

Does the connection between replacement and transfinite induction completely disappear under this extension?

Motivation: I was thinking about Skolem's paradox, and thought that working in $\mathcal{L}_{\infty,\infty}$ might resolve part of the problem---namely that first order language just wasn't expressive enough to talk about important aspects of big sets. This seemed to be backed up by other things I read. But then, it struck me that if we are working with a more expressive language, why limit our axioms to the simpler language?

• You get a language which is not quite first order, is more expressive, and may get you into trouble. It may be possible to do something like Russell's paradox, where for each sub formula in a conjunct you get another formula in a different conjunct which contradicts the sub formula except for one small piece, and you end up with a mess in which each initial segment is consistent and has a model, but the sentence in its full glory does not. My guess is that Replacement on this scale is scary if not downright contradictory. Gerhard "How Would A Proof Look?" Paseman, 2018.07.30. – Gerhard Paseman Jul 30 at 7:07
• "Why still work over the less expressive language $\mathcal L$?" Because we have a complete axiomatization of the logic of $\mathcal L$. We can dream in more expressive systems, and I think we can "see" that replacement should still be true in that context, but we can't prove things without knowing what the correct logical axioms are (nor could we actually write down infinitary statements). – Andreas Blass Jul 30 at 12:57
• @AndreasBlass I'm not sure I understand your comment. Why would I need a complete axiomatization of the logic? Wouldn't a partial axiomatization (which would, naturally, include those methods from first order logic as applied to first order statements) suffice to get me started? In fact, this seems to match what I actually do in mathematics, as a ring theorist. I prove first order statements all the time, but I also prove all sorts of things which cannot be stated in the first order language of rings. – Pace Nielsen Jul 31 at 2:39
• I think one can show that for every cardinal $\kappa$, $M$ is a model of $\mathcal L_{\kappa,\kappa}$-ZFC iff $M \cong V_\kappa$ and $\kappa$ is inaccessible. – Monroe Eskew Aug 2 at 18:07
• What I said isn’t right— we can only say that an initial segment of $M$ is isomorphic to $V_\kappa$. – Monroe Eskew Aug 4 at 12:18

Let me describe how I understand the question. You want to consider assertions in the infinitary language $\newcommand\L{\mathcal{L}}\L_{\infty,\infty}$, and assert instances of replacement for formulas in this language.

Thus, our meta-theoretic context should have considerable set-theoretic resources, in order to handle the manipulations of these infinitary assertions, even if we interpret those assertions only in the object theory.

So basically, we have the realm of objects, a universe $V$ of the sets that the theory is about, and then we have a meta-theoretic or background set-theoretic context, let me call it $V^*$, which is a set-theoretic world of its own in which the formulas live and in which we undertake the truth analysis of those formulas. Let me assume ZFC in the meta-theory.

Does one get a 'standard' model of set theory?

The answer is yes. I claim that $V$ must be well-founded with respect to $V^*$, and the reason is that with your replacement axiom, we can easily derive the $\L_{\infty,\infty}$-separation axiom, and with this, we can proceed to define the class of all sets $a$ that have no actual $\in$-descending $\omega$-sequence below them. This is expressible by an $\L_{\infty,\infty}$ formula of $V^*$, using the standard $\omega$ as $V^*$ sees it, and it would define the well-founded part of $V$, as $V^*$ sees it. In particular, by separation, using this definable property, the collection of nonstandard sets inside any given set would itself be a set. But this cannot happen unless every set is standard, for otherwise by the foundation axiom there would have to be an $\in$-minimal nonstandard set, which is impossible. Therefore, all the $V$-sets are standard with respect to $V^*$.

It follows now that every element $a\in V$ is definable an $\L_{\infty,\infty}$ formula. Namely, $a$ will be the unique satisfying instance of the formula $\phi_a$, defined as follows: $$\phi_a(x)=\forall y\left[ y\in x\leftrightarrow\bigvee_{b\in a} \phi_b(y)\right].$$ That is, $a$ is the unique set $x$ whose elements are the objects that satisfy the definitions of the various elements of $a$. This idea is used all over admissible set theory.

From this, it follows from your theory that $V$ must have the actual power set operation, since for any set $A\in V$, and any subset $B\subseteq A$ in $V^*$, we can write down the formula $\phi(x)=\bigvee_{b\in B}\phi_b(x)$, which asserts that $x$ is one of the objects in $B$. By separation, we will have deduced that $B$ is in $V$.

It follows in turn that $V=V^*_\kappa$ for some cardinal. One can show furthermore that $\kappa$ must be a strong limit, as well as regular. So $\kappa$ is an inaccessible cardinal, and these models $V_\kappa$ are also known as Zermelo-Grothendieck universes.

Conversely, I claim that if $\kappa$ is inaccessible, then $V_\kappa$ satisfies your theory. The reason is that $V_\kappa$ satisfies every instance of replacement using any means whatsoever in $V^*$, not just $\L_{\infty,\infty}$ assertions, because every set $A\in V_\kappa$ has size less than $\kappa$, and every subset of $V_\kappa$ of size less than $\kappa$ is bounded in some $V_\alpha$ for $\alpha<\kappa$, by the inaccessibility of $\kappa$. From this, it follows that we can define exactly that range using only a $\L_{\kappa,\kappa}$ formula.

So the models of your theory are exactly the $V_\kappa$ for $\kappa$ inaccessible, in the meta-theory.

All the preceding analysis is essentially similar to the result of Zermelo proved a century ago, when he proved that second-order ZFC set theory is true exactly in the $V_\kappa$ when $\kappa$ is inaccessible.

What I take the analysis to show, is that questions of these infinitary assertions amount to first-order assertions of set theory in the meta-theory. The subject becomes in a sense the same as the model theory of set theory undertaken in the meta-theory. In this sense, the infinitary theory amounts to a change in the level of analysis, moving from infinitary assertions in the object theory to first-order assertions about formulas in the meta-theory.

• Is this exactly right? Suppose $\kappa$ is inaccessible-- can't we define $\kappa$ using an $\mathcal L_{\kappa^+,\kappa^+}$ formula? Furthermore, if $M \subseteq V$ is $<\kappa$-closed, doesn't $M$ satisfy $\mathcal L_{\kappa,\kappa}$-ZFC? – Monroe Eskew Aug 6 at 16:59
• I'm not sure what part of my answer you are objecting to. (Your $M$ is my $V$ and your $V$ is my $V^*$.) My argument is that if $\kappa$ is inaccessible, then $V_\kappa$ satisfies all instances of replacement using any $\mathcal{L}_{\infty,\infty}$ formula, even far beyond $\kappa$, because $\kappa$ is really regular: witnesses for any property over a set in $V_\kappa$ will still be bounded in $V_\kappa$ and hence an element. It doesn't matter that $\kappa$ itself is definable in the meta-theory, you cannot use that to make a failing instance of replacement in $V_\kappa$. – Joel David Hamkins Aug 6 at 17:13
• Oh yes, if you cut off the logic at $\mathcal{L}_{\kappa,\kappa}$, then you can get more models that reach beyond $\kappa$, I agree. – Joel David Hamkins Aug 6 at 17:38
• @JoelDavidHamkins Perhaps this will make my question clearer. Run through your argument when $V^{\ast}$ has no inaccessibles and do not necessarily assume that the model $V$ must be set sized according to $V^{\ast}$. Don't we get $V=V^{\ast}$? Or am I missing something more? – Pace Nielsen Aug 7 at 2:48
• Yes, I agree with that. But another way to describe that case is that $V^*$ thinks that there are no set models of the theory. $V^*$ isn't necessarily able to evaluate the truth of the formulas on itself, but only on a set model, unless you assume a stronger theory in $V^*$ than I have. – Joel David Hamkins Aug 7 at 10:34

The idea of studying ZF and its subsystems formulated in infinitary languages, to my knowledge, seems to have begun and ended with the work of Klaus Gloede, in the 1970s.

The following paper of Gloede provides a useful synopsis of his work, which began with his doctoral dissertation (it is available here behind a paywall, the first two pages are freely visible, they consist of the table of contents and the first page of the paper).

K. Gloede, Set theory in infinitary languages. ⊨ISILC Logic Conference (Proc. Internat. Summer Inst. and Logic Colloq., Kiel, 1974), pp. 311–362. Lecture Notes in Math., Vol. 499, Springer, Berlin, 1975.


text:
# 2.1.10: Exercises

## Analysis

1. For the circuit of Figure 3.10.1 , determine the circulating current.

Figure 3.10.1

• 120mA

2. For the circuit of Figure 3.10.2 , determine the circulating current.

Figure 3.10.2

3. For the circuit of Figure 3.10.1 , determine the power dissipated in the resistor.

• 1.44W

4. For the circuit of Figure 3.10.2 , determine the power dissipated in the resistor.

5. Determine the voltage at the open terminals of Figure 3.10.3 .

Figure 3.10.3

• 15 V

6. Determine the voltage at the open terminals of Figure 3.10.4 .

Figure 3.10.4

7. Determine the voltage at the open terminals of Figure 3.10.5 .

Figure 3.10.5

• 33 V

8. Determine the equivalent resistance of circuit shown in Figure 3.10.6 .

Figure 3.10.6

9. Determine the equivalent resistance of circuit shown in Figure 3.10.7 .

Figure 3.10.7

• $$2.6k\Omega$$

10. Determine the equivalent resistance of circuit shown in Figure 3.10.8 .

Figure 3.10.8

11. For the circuit of Figure 3.10.9 , determine the circulating current.

Figure 3.10.9

• 40 mA

12. For the circuit of Figure 3.10.9 , determine the voltages across each resistor and find $$V_{ab}$$.

13. Given the circuit of Figure 3.10.9 , determine the power dissipated by each resistor and the power delivered by the source.

• 320mW (200$$\Omega$$)
• 160mW (100$$\Omega$$)
• 480mW (source)

14. For the circuit of Figure 3.10.10 , determine the circulating current.

Figure 3.10.10

15. Given the circuit of Figure 3.10.10 , determine the voltages across each resistor and find $$V_{ba}$$.

• 6V(2$$k\Omega$$)
• 12V(4$$k\Omega$$)
• -6V ($$V_{ba}$$)

16. For the circuit of Figure 3.10.10 , determine the power dissipated by each resistor and the power delivered by the source.

17. For the circuit of Figure 3.10.11 , determine the circulating current.

Figure 3.10.11

• 0.25 A

18. For the circuit of Figure 3.10.11 , determine the voltages across each resistor and find $$V_a$$.

19. For the circuit of Figure 3.10.12 , determine the circulating current and indicate all voltage polarities.

Figure 3.10.12

• I = 15mA
• $$V_{ab}$$: + on left, - on right
• $$V_{bc}$$: + on top, - on bottom
• $$V_{c}$$: + on right, - on left
• $$V_{src}$$: + on top, - on bottom

20. Given the circuit of Figure 3.10.12 , determine the voltages across each resistor and find $$V_b$$, $$V_{bc}$$, and $$V_{ca}$$.

21. For the circuit of Figure 3.10.12 , determine the power delivered by the source.

• P = 180mW

22. For the circuit of Figure 3.10.13 , determine the circulating current and indicate all voltage polarities.

Figure 3.10.13

23. Given the circuit of Figure 3.10.13 , determine the voltages across each resistor and find $$V_c$$, $$V_{ac}$$, and $$V_a$$.

• $$V_{50}=2.5V$$
• $$V_{10}=0.5V$$
• $$V_{60}=3V$$
• $$V_{c}=3V$$
• $$V_{ac}=3V$$
• $$V_{a}=6V$$

24. For the circuit of Figure 3.10.13 , determine the power dissipated by the 10 $$\Omega$$ resistor.

25. For the circuit of Figure 3.10.14 , determine the circulating current and indicate all voltage polarities.

Figure 3.10.14

• I = 200mA
• $$V_{5}$$: + on right, - on left
• $$V_{10}$$: + on top, - on bottom
• $$V_{25}$$: + on left, - on right
• $$V_{src}$$: + on top, - on bottom

26. For the circuit of Figure 3.10.14 , determine the voltages across each resistor and find $$V_b$$, $$V_c$$, and $$V_{ca}$$.

27. Referring to the circuit of 3.10.15 , determine the voltages across each resistor and find $$V_b$$, $$V_c$$, and $$V_{ac}$$.

Figure 3.10.15

• $$V_{400}=2V$$
• $$V_{200}=1V$$
• $$V_{b}=10V$$
• $$V_{c}=1V$$
• $$V_{ac}=11V$$

28. Referring to the circuit of Figure 3.10.15 , determine the circulating current and indicate all voltage polarities.

29. Given the circuit of 3.10.16 , determine the voltages across each resistor and find $$V_b$$, $$V_c$$, and $$V_{ac}$$.

Figure 3.10.16

• $$V_{2k}=3.6V$$
• $$V_{8k}=14.4V$$
• $$V_{b}=9.6V$$
• $$V_{c}=-14.4V$$
• $$V_{ac}=20.4V$$

30. Referring to the circuit of Figure 3.10.16 , determine the circulating current and indicate all voltage polarities.

31. Given the circuit of 3.10.17 , determine the circulating current and indicate all voltage polarities.

Figure 3.10.17

• I = 35mA
• $$V_{400}$$: + on left, - on right
• $$V_{200}$$: + on right, - on left
• $$V_{12Vsrc}$$: + on top, - on bottom
• $$V_{9Vsrc}$$: + on bottom, - on top

32. Referring to the circuit of Figure 3.10.17 , determine the voltages across each resistor and find $$V_b$$, $$V_c$$, and $$V_{ac}$$.

33. Given the circuit of 3.10.18 , determine the circulating current and indicate all voltage polarities.

Figure 3.10.18

• I = 1.89mA
• $$V_{2k}$$: + on left, - on right
• $$V_{8k}$$: + on right, - on left
• $$V_{6Vsrc}$$: + on top, - on bottom
• $$V_{24Vsrc}$$: + on top, - on bottom

34. Referring to the circuit of Figure 3.10.18 , determine the voltages across each resistor and find $$V_b$$, $$V_c$$, and $$V_{ac}$$.

35. Using the voltage divider rule, determine the voltages $$V_b$$, $$V_c$$ and $$V_{ac}$$ for the circuit shown in Figure 3.10.19 .

Figure 3.10.19

• $$V_{b} = 14.4V$$
• $$V_{c} = 9V$$
• $$V_{ac} = 6V$$

36. Using the voltage divider rule, determine the voltages $$V_b$$, $$V_c$$ and $$V_{bd}$$ for the circuit shown in Figure 3.10.20 .

Figure 3.10.20

37. For the circuit of Figure 3.10.20 , determine $$V_b$$ if the 4 k$$\Omega$$ resistor is accidentally shorted. How does this compare to the original circuit?

• $$V_{b} = 1V$$. The 2V is now split across the three remaining resistors

38. For the circuit of Figure 3.10.20 , determine $$V_b$$ if the 4 k$$\Omega$$ resistor is accidentally opened. How does this compare to the original circuit?

39. Given the circuit shown in Figure 3.10.21 , find the voltage drop across the resistor.

Figure 3.10.21

• 20V

40. Given the circuit shown in Figure 3.10.22 , find the voltage drops across the resistor.

Figure 3.10.22

41. Find the voltage drops across the resistors in the circuit of Figure 3.10.23 .

Figure 3.10.23

• $$V_{20} = 40V$$
• $$V_{20} = 100V$$

42. Find the voltage drops across the resistors in the circuit of Figure 3.10.24 .

Figure 3.10.24

43. Find the voltage drops across the resistors in the circuit of Figure 3.10.25 .

Figure 3.10.25

• $$V_{4} = 12V$$
• $$V_{10} = 30V$$
• $$V_{5} = 15V$$

44. Find the voltage drops across the resistors in the circuit of Figure 3.10.26 .

Figure 3.10.26

45. The circuit of Figure 3.10.27 uses a linear taper potentiometer. Determine $$V_b$$ when the wiper arm is at position $$a$$, position $$b$$, and at the halfway point.

Figure 3.10.27

• $$V_{b} = 0V$$. This is true no matter where the wiper arm of the potentiometer is

46. What is the maximum current flowing through the potentiometer of Figure 3.10.27 ? At what position(s) does this occur?

## Design

47. Redesign the circuit of Figure 3.10.1 using a new resistor such that the current from the 12 volt battery is 0.1 A.

• Change the 100 $$\Omega$$ resistor to 120 $$\Omega$$

48. Redesign the circuit of Figure 3.10.2 using a new resistor such that the current from the 9 volt battery is 2 mA.

49. For the circuit of Figure 3.10.6 , find the value of a series voltage source that would generate 1 mA of current if it was connected across the terminals.

• 5.5V

50. For the circuit of Figure 3.10.8 , find the value of a series voltage source that would generate 1 mA of current if it was connected across the terminals.

51. Determine values for the resistors in Figure 3.10.28 such that $$R_1$$ is four times the size of $$R_2$$ and $$R_2$$ is three times the size of R3, with the total resistance equaling 8 k$$\Omega$$.

Figure 3.10.28

• $$R_{1} = 6k\Omega$$
• $$R_{2} = 1.5k\Omega$$
• $$R_{3} = 500\Omega$$

52. For the circuit shown in Figure 3.10.29 , determine values for $$R_1$$ and $$R_2$$ such that $$V_{ab}$$ is 6 volts if $$E$$ is a 9 volt battery and the total current draw is 20 mA.

Figure 3.10.29

53. Consider the circuit shown in Figure 3.10.30 . If all resistors have the same value, determine that value if $$E$$, a 24 volt source, generates a total power of 10 watts.

Figure 3.10.30

• 19.2$$\Omega$$

54. For the circuit shown in Figure 3.10.31 , determine values for $$R_1$$ and $$R_2$$ such that $$V_{ab}$$ is 6 volts if $$I$$ is a 2 mA source and the total voltage drop is 24 volts.

Figure 3.10.31

55. Consider the circuit of Figure 3.10.20 . Is it possible to add a fifth resistor such that the circulating current is 0.1 mA? If so, what is that resistor value?

• Yes, 10 $$k\Omega$$

56. Consider the circuit of Figure 3.10.20 . Is it possible to add a fifth resistor such that the circulating current is 2 mA? If so, what is that resistor value?

## Challenge

57. Assume that two AA cells, $$E_1$$ and $$E_2$$, rated at 900 mAh each are used to drive a 2 watt lamp as shown in Figure 3.10.32 . Determine the expected life of the batteries.

Figure 3.10.32

58. Given the circuit of Figure 3.10.33 , determine the required values of $$E$$, $$R_1$$, $$R_2$$ and $$R_3$$ if there is one volt across $$R_3$$, the total current draw is 10 mA, the voltage across $$R_1$$ is twice the size of voltage across $$R_2$$ and the power dissipation in $$R_2$$ is 100 mW.

Figure 3.10.33

59. Given the circuit of Figure 3.10.33 , determine the required source voltage if $$R_1$$ is 1 k$$\Omega$$, $$R_2$$ is 1 k$$\Omega$$, the power dissipation in $$R_1$$ is 4 mW and the power dissipation in $$R_3$$ is 2 mW.

60. Given the circuit of Figure 3.10.34 , determine $$V_c$$, $$V_{db}$$ and $$V_{ce}$$.

Figure 3.10.34

61. Given the circuit of Figure 3.10.34 , determine $$V_{ac}$$, $$V_{eb}$$ and $$V_d$$.

62. Refer to the circuit of Figure 3.10.20 . Assuming each resistor has a 10% tolerance, determine the maximum and minimum values for $$V_c$$.

## Simulation

63. Simulate the solution of design problem 43 and determine if the values produce the required results.

64. Perform a DC simulation on the circuit of Figure 3.10.13 and find all of the node voltages along with the circulating current.

65. Perform a DC simulation on the circuit of Figure 3.10.14 and find all of the node voltages along with the circulating current.

66. Perform a DC simulation on the circuit of Figure 3.10.26 and find all of the node voltages.

67. Perform a DC simulation on the circuit of Problem 34 and find all of the node voltages.

68. Perform a DC simulation on the circuit of Problem 36 and find all of the node voltages.

69. Simulate the solution of Challenge problem 58 and determine if the values produce the required results.

70. Simulate the circuit of Figure 3.10.34 (Challenge problems 60 and 61) and determine if the node voltages produced match the expected results.

71. Perform a Monte Carlo simulation on the circuit of Figure 3.10.19 . Set each resistor to 5% tolerance and run at least ten variations for $$V_b$$ to determine a typical spread of values.

Source: www.xkcd.com

This page titled 2.1.10: Exercises is shared under a CC BY-NC-SA license and was authored, remixed, and/or curated by James M. Fiore.


text:
# Revision history [back]

### possible bug in: _cmp_ function

Hello, on a 2019-release of sage, the following behaviour was observed: After defining: R = Zp(5) a = R(5, 6) b = R(10)

an inconsistent output was given for aa : aa True

Is this a bug, or should the output not be consistent here for some reason? P.S: The comparison function is implemented in the file: padic_generic_element.pyx Thank you.

 2 None Iguananaut 1698 ●7 ●33 ●54

### possible bug in: _cmp_ function

Hello, on a 2019-release of sage, the following behaviour was observed: After defining: defining:

R = Zp(5)
a = R(5, 6)
b = R(10)R(10)

an inconsistent output was given for aa : aa Truea<b and b>a:

a<b
False
b>a
True

Is this a bug, or should the output not be consistent here for some reason? P.S: The comparison function is implemented in the file: padic_generic_element.pyx padic_generic_element.pyx Thank you.

 3 retagged tmonteil 24258 ●27 ●176 ●447 http://wiki.sagemath.o...

### possible bug in: _cmp_ function

Hello, on a 2019-release of sage, the following behaviour was observed: After defining:

R = Zp(5)
a = R(5, 6)
b = R(10)

an inconsistent output was given for a<b and b>a:

a<b
False
b>a
True

Is this a bug, or should the output not be consistent here for some reason? P.S: The comparison function is implemented in the file: padic_generic_element.pyx Thank you.


text:
# Mandelbrot Streams

A recent Mandelbrot question (Hi @EBrown) in C# inspired me to build my own using the Java 8 parallel streams to implement the parallelism that's useful for computing each pixel value.

The intention is to incorporate this in to a graphical interface that allows you to navigate and zoom in on the Mandelbrot set.

To do this, I separated the functionality in to three components:

1. a GUI for presenting the results
2. an engine for computing the limits for each pixel's computation
3. a tool that applies color to the results and produces an Image that the GUI can present.

In this question I have only part 2 and part 3 for review.

Note that the limit is used to limit both the number of iterations per pixel, and also to determine the number of colours used for the presentation.

When computing a view in to the set, the code works at a given zoom level, and then maps that zoomed information in to a matrix that represents the pixels in the display that show the zoomed data. This mapping is performed using a "window" that has a center, and a zoom degree. The entire Mandelbrot set is contained in the rectangle bounded by -2.5 and 1.0 on the x axis, and between -1.0 and 1.0 on the y axis.

A parallel stream is used to compute one row of pixels in each thread.

I am looking for ways to optimize this further, and identify other ways it can be improved, styled, or conform better to industry best practices.

import java.awt.Color;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.stream.IntStream;

import javax.imageio.ImageIO;

public class Mandelbrot {

public static final class Window {
private final double centerX, centerY, zoom;

/**
* Create a window centered at the given logical location and zoom
* level.
*
* @param centerX
*            The X location
* @param centerY
*            The Y location
* @param zoom
*            The zoom degree (1.0 to 1.79e308 or so)
*/
public Window(double centerX, double centerY, double zoom) {
if (zoom < 1.0) {
throw new IllegalArgumentException("Illegal zoom " + zoom);
}
this.centerX = centerX;
this.centerY = centerY;
this.zoom = zoom;
}

public double getCenterX() {
return centerX;
}

public double getCenterY() {
return centerY;
}

public double getZoom() {
return zoom;
}

}

/**
* Compute a matrix of iterations representing a window in to the Mandelbrot set.
*
* @param pixWidth The width of the matrix to compute
* @param pixHeight The height of the matrix to compute
* @param limit The limit at which computations assume the coordinate is included in the set.
* @param window The definition of the location and zoom degree in to the set.
* @return A matrix containing the computational iterations
*/
public static final int[][] mandelbrot(final int pixWidth, final int pixHeight,
final int limit, final Window window) {

final double mandWidth = 3.5 / window.getZoom();
final double mandHeight = 2.0 / window.getZoom();
final double xStep = mandWidth / pixWidth;
final double yStep = mandHeight / pixHeight;

final double left = window.getCenterX() - mandWidth / 2.0;
final double bottom = window.getCenterY() - mandHeight / 2.0;

final double[] scaleX = IntStream.range(0, pixWidth)
.mapToDouble(x -> left + x * xStep).toArray();
final double[] scaleY = IntStream.range(0, pixHeight)
.mapToDouble(y -> bottom + y * yStep).toArray();

return IntStream
.range(0, pixHeight)
.parallel()
.mapToObj(
y -> IntStream.range(0, pixWidth)
.map(x -> countIterations(limit, scaleX[x], scaleY[y]))
.toArray()).toArray(s -> new int[s][]);

}

private static int countIterations(final int limit, final double x0, final double y0) {
double x = 0.0;
double y = 0.0;
int iterations = 0;
while (x * x + y * y < 4.0 && iterations < limit) {
double xt = x * x - y * y + x0;
y = 2 * x * y + y0;
x = xt;
iterations++;
}
return iterations;
}

/**
* Create a buffered image mapping the iterations of the mandelbrot to the color palette
* @param mand The matrics to map.
* @param color The color to map for the matrix.
* @return A BufferedImage containing the mapped mandelbrot.
*/
public static BufferedImage mapMandelbrot(int[][] mand, final int[] color) {
final int width = mand[0].length;
final int height = mand.length;
final BufferedImage image = new BufferedImage(width, height,
BufferedImage.TYPE_INT_ARGB);
int[] pixels = IntStream.range(0, width * height)
.map(p -> color[mand[p / width][p % width] % color.length]).toArray();

image.setRGB(0, 0, width, height, pixels, 0, width);
return image;
}

/**
* Produce an increasingly bright sequence of colors that spiral out through the colour wheel.
*
* @param maxIndex the number of colors to produce (inclusive)
* @return an array of aRGB values that represent the unique colors.
*/
public static final int[] buildColors(final int maxIndex) {
final float root = (float) Math.sqrt(maxIndex);
return IntStream
.rangeClosed(0, maxIndex)
.map(c -> maxIndex - c)
.mapToObj(
c -> Color
.getHSBColor((c % root) / root, 1.0f, (c / root) / root))
.mapToInt(c -> c.getRGB()).toArray();
}

/**
* For a given width, return a height that matches the ratio of a Mandelbrot
* image. A complete Mandelbrot is contained within -2.5 to 1.0 and -1.0 to
* 1.0 which gives a useful ratio of height to width of 3.5/2.0.
*

* The returned height will always be odd which allows the center of the
* image to be on an exact row.
*
* @param width
*            the width to compute a height for.
* @return the corresponding height.
*/
public static final int getAppropriateHeight(final int width) {
int height = (int) ((width / 3.5) * 2.0);
// an odd-numbered height is useful for presentation - especially at
// zoom 1.0
return height % 2 == 0 ? height + 1 : height;
}

/**
* Convenience method for testing the mandelbrot function.
*

* This method coordinates a complete computation for a mandelbrot of given dimensions.
*
* @param width The resulting image width
* @param height The resulting image height
* @param limit The limit of iteration testing for the mandelbrot inclusion
* @param window The position and scale within the mandelbrot set to compute.
* @param outdir The location in which to store the resulting image.
* @throws IOException if the image could not be stored.
*/
public static final void buildBrot(int width, int height, int limit, Window window,
File outdir) throws IOException {
int[] colormap = buildColors(limit);

long start = System.nanoTime();
final int[][] mand = mandelbrot(width, height, limit, window);

long built = System.nanoTime();
BufferedImage image = mapMandelbrot(mand, colormap);

long rendered = System.nanoTime();

File outfile = new File(outdir, String.format(
"mandelbrot_w%d_x%d_c%.3fms_r%.3fms.png", width, limit,
(built - start) / 1000000.0, (rendered - built) / 1000000.0));
ImageIO.write(image, "png", outfile);
System.out.println("Created " + outfile);
}

public static void main(String[] args) throws IOException {
File outdir = new File("output");
outdir.mkdirs();

// simple window centered on the basic set, and at basic zoom
Window window = new Window(-2.5 + 3.5 / 2, 0.0, 1.0);

buildBrot(2048, getAppropriateHeight(2048), 1000, window, outdir);
}

}

A run of the above code will produce an image like:

### Say what you mean and mean what you say

You named your class "Window" when it should really be something more like "Viewport". There are no "Windows" (in the GUI sense) in your code. If you decide to incorporate this into an application that does contain Windows in the GUI sense, this will be hopelessly confusing.

### Don't omit essential documentation from the code

Above the code, you've posted an explanation, but that isn't present in the code. If you felt the need to write it in order to explain the code to us, shouldn't it also be part of the code?

### Use more descriptive comments

The algorithm for computing a point in the Mandelbrot set is ubitiquous and easily comprehensible to anybody skimming the Wikipedia page, but once you get into hard stuff (like zooming) better comments are required. Compare Ebrown's comments with yours:

// Next, consider xCenter and yCenter which represent what pixel
// is (0,0) in the specified image size.
Point center = new Point(imageSize.Width / 2, imageSize.Height / 2);

// And we'll scale the size so the brot sits within [-2,2],
SizeF scaleSize = new SizeF(center.X / 2, center.Y);

Yours:

/**
* Create a window centered at the given logical location and zoom
* level.
*
* @param centerX
*            The X location
* @param centerY
*            The Y location
* @param zoom
*            The zoom degree (1.0 to 1.79e308 or so)
*/

Which do you think is more indicative of what the code is actually doing?

Here's another example, you describe "limit" as the following:

Note that the limit is used to limit both the number of iterations per pixel, and also to determine the number of colours used for the presentation.

Then in the code:

/**
* Compute a matrix of iterations representing a window in to the Mandelbrot set.
*
* @param pixWidth The width of the matrix to compute
* @param pixHeight The height of the matrix to compute
* @param limit The limit at which computations assume the coordinate is included in the set.
* @param window The definition of the location and zoom degree in to the set.
* @return A matrix containing the computational iterations
*/

Limits, computations, Mandelbrot... we're doing something math related so you're going to confuse people into thinking you mean limit in the mathematical sense. Maybe MaxIterations is a better name.

### Magic numbers

What is 1.79e308, why does it matter?

Why -2.5 + 3.5 / 2?

Why getAppropriateHeight() etc. (similarly you use 3.5 and 2.0 in mandelbrot without explanation)

Are these pixels? Complex numbers?

All Mandelbrot viewers handle zooming a different way. Don't assume yours is intuitive just because you start off with a nice number (1.0).


text:
# Elliptic curve group over a prime finite field $F_p$

If $p$ is a big prime, and the elliptic curve $E$ is defined over $F_p$ by the equation $y^2=x^3+ax+b$ where $a,b\in F_p$. The point on $E/F_p$ together with the infinite point $\mathcal{O}$ form a group $G=\{(x,y):x,y\in F_p;(x,y)\in E/F_p\}\cup\{\mathcal{O}\}$. Then is $G$ a cyclic group? what's the order of $G$?

-
In my definition, is $G$ a cyclic group? And if it's true , supposing $P$ is a generator of $G$, then is it OK to do this: $a \in Z_p^*,Q=aP$ ? –  T.B Jul 25 '14 at 7:11
If you want the ECDLP to be hard, you have to take a large subgroup of prime order (which is always cyclic). What do you mean by "OK to do this"? –  DrLecter Jul 25 '14 at 7:16
I mean that if $G$ is cyclic, $P$ is a generator of which, is there some problem if I take $a$ from $Z_p^*$ and compute $aP$. By the way, whether the order of $G$ can be $p$ if I understand it as a large subgroup of prime order? –  T.B Jul 25 '14 at 7:44

The cyclic group over the ECDLP problem is posed is a subset of the set of point of the elliptic curve. That is to say, not all the points in the referred curve will be in the cyclic group. What you've called as $G$ confuses with another notation of the generator of a cyclic group $<G>=\{G,[2]G,\cdots,[n]G=\mathcal{O}\}$.

This is the meaning of what you've may heard as the cofactor ($h$). There is a relation between the number of points in the elliptic curve (the cardinal $|E(\mathbb{F}_p)|$) and the order of the mention cyclic group ($org(G)=n$). Following the P1363, the cardinal of a cryptographically good curve should be prime or "almost" prime.

What this almost mean is to factorize in one big number and another very small. $|E(\mathbb{F}_p)|=n\cdot h$, where $n >>> h$. Back to P1363, $h$ shall not be other than $1$, $2$ or $4$. In a $h=1$ your cyclic group fits with the complete set of points in the elliptic curve. On bigger cofactors, smaller the cyclic group; but don't panic, a $192$ bit curve with a cofactor $2$ can be like a $191$ curve with a cofactor $1$ (despite other issues that suggest to avoid cofactor $1$).

-

A classical resut is that over a finite field $\mathbb{F}_p$ the group $E(\mathbb{F}_p)$ is either cyclic or isomorphic to the product of two cyclic groups. For the order of the group see this question.

For cryptographic purposes, i.e., when you require that the ECDLP is hard, you will firstly have to rule out some weak curves (supersingular or anomalous curves) and work in a large prime order $q$ subgroup of $E(\mathbb{F}_p)$. A prime order group is always cyclic (which straightforwardly follows from Lagranges' theorem).

So if you have a generator $P$ of this $q$ order subgroup, then the ECDLP is defined as for given point $Q=k\cdot P$ with $k\in \mathbb{Z}_q$, to determine $k$.

-