text:
Transfer Functions with PyTF¶

Abstraction is about concentrating on the essential parts of a system. To explain what we see as essential in the connection between a robot and a spiking neuronal network, we begin with the explanation of the domain-specific language (DSL) that captures these essential parts.

Fig. 15 A Closed Loop between Neuronal Networks and Robots

Our main way of connecting spiking neuronal networks with robots are transfer functions which you can see in Fig. 15. Transfer functions consist of connections between the simulators and some code which details how the data of one simulator should be transmitted to the other. The code is mainly trivial as the purpose of most transfer functions is limited to transmission, simple arithmetic adjustments and multiplexing the data from different parts of the simulators. The role of the simulators is to some extent interchangeable, in that they take information from other simulators and output information into other simulators, but the way how this is implemented differs for spiking neuronal networks and robots.

Abstract Syntax¶

The basic idea behind PyTF is that the specification of a transfer function (that is how the input from a transfer function is converted to a robot control signal) can be written as a regular Python function. The role of PyTF is to wrap Python functions into transfer functions, map their parameters to parts of either a neuronal network or a robot simulation and manage the execution of this function.

Fig. 16 The abstract syntax of PyTF

The abstract syntax of PyTF to achieve this functionality is depicted in Fig. 16. A transfer function consists of an underlying Python function and parameter mapping specifications. Multiple types of parameter mappings exist in order to connect to either a neuronal simulation or a robotics simulation. In principle, we differentiate between mappings to the neuronal network (SpikeMapping), to the robotics simulation (RobotMapping) and to internal variables. The mapping specifications for the simulators each have subclasses to specify whether the parameter is an input or an output to/from the simulation.

As the parameter mapping specifications are contained in the transfer functions, a transfer function does not have external references. In particular, the deployment of transfer functions could be distributed to multiple nodes which is useful if the transfer functions contain some computational expensive logic.

All parameter mappings share an attribute specifying which parameter they belong to and a method to create a device from the mapping specification. This creates an adapter component instance in the case of a mapping to a simulation or just yields a reference to a local or global variable. For this, a reference to the surrounding TF Manager is passed into the mapping specification that contains references to the communication adapters for both neuronal and robotics simulation. The mapping specifications can then create the device independently of the concrete simulator used at either side.

PyTF has two subtypes of transfer functions, Robot2Neuron and Neuron2Robot, represented by the upper and lower transfer functions in Fig. 15. The rationale behind this decision is simply to order transfer functions in the unlikely case that a control topic is both read from and written to. Thus, Robot2Neuron transfer functions are executed first. On the other hand, Neuron2Robot transfer functions often result in sending a message to a particular robot control topic. For this rather common case, the class contains a reference to a publisher so that the transfer function may simply use the return value of the function to publish on this topic. Other than that, the type of transfer functions has no implications on the allowed parameter mappings. In particular, a Robot2Neuron transfer function may for example also contain a publisher or a spike sink.

Neuron Access Patterns¶

Whereas robot control signals or sensory inputs from the robot can be bundled in arbitrary data structures sent over ROS, the interface of a neuron is determined through its underlying neuron model. In many cases this interface is limited to a few parameters such as the membrane potential or a history of spikes. As a consequence, a single control signal for a robot is often multiplexed to a multitude of neurons and vice versa sensory inputs such as a camera image are fed into a multitude of neurons. Therefore, transfer functions are often required to connect multiple neurons at once.

Spikes (the usual interface of a neuron in a spiking neural network) are discrete in time whereas control commands for robots usually consist of continuous data sent to the robot in short intervals. Likewise, sensory inputs from the robot that will be transmitted to the neural network need to be discretized to spikes. To perform these conversions, there are multiple approaches. This includes integration of spikes to obtain continuous data from spikes and generating a current of spikes either constantly or according to some probability distribution, most notably Poisson distributions.

In PyTF users can choose between a set of predefined access patterns. Each connection to a particular set of neurons and according to a given access pattern is realized by an object we call a device (as this terminology is also partially used in the neural simulators) where the access pattern is called the device type. Depending on whether the device is an input into the network (spike source) or an output (spike sink), different device types apply. Each device can be connected to arbitrary many neurons that can be selected by navigating through the populations of the neuronal network model.

We support the following spike source device types:

1. Current Generators: The current generators for direct current, alternating current or noisy current do not generate spikes but inject currents of the specified type into all of the connected neurons. These devices receive the amplitude of the generated current as inputs. Here, the noisy current generator is rather a tool to test whether the neuronal network currently simulated is robust with regard to noise rather than being a good choice to encode sensory inputs.

2. Poisson Generator: A Poisson generator issues spikes according to a Poisson distribution. Here, the inverse of the $$\lambda$$ parameter can be set in accordance to sensory inputs. This inverse reflects the rate in which spikes are generated by this device.

3. Fixed Frequency Generator: A fixed frequency generator deterministically generates spikes at a given frequency. Here, the frequency is set as a parameter and can be adjusted to sensory inputs. Unlike the other spike generators, this device type is not directly implemented in neuronal simulators but can be implemented by connecting a current generator with an integrate-and-fire neuron.

This selection is based on the observation that neural simulators (in particular Nest) let simulated neurons communicate through the delivery of spikes and currents. Based on the experiments we have performed so far using the platform, we believe that this list is sufficient for most applications. However, we plan to support new device types should they be demanded by users of the NRP.

The following spike sinks are supported:

1. Leaky Integrators: The concept of leaky integrators is to simply integrate spikes coming from a neuron under observation and add a leak term to it. The rationale behind this is that in spiking neuronal networks, the membrane potential is highly fragile. Shortly after a spike has been issued, the membrane potential is reset and therefore, it has a high importance whether any measurement is taken before or after a neuron spikes. Therefore, we augment the neuronal network with an additional leaky integrate-and-fire neuron with an infinite threshold potential (so that it never spikes) and measure the membrane potential of this neuron. The result is much less fragile and therefore appropriate to be used for robot control signals.

2. Population Rate: Another very common pattern is to simply take the average incoming spike rate of a neuron or a range of neurons. This is again relatively stable and can be used for translation into robot control signals.

3. Spike Recorder: The simplest thing a spike sink can do is to simply record all spikes issued to a neuron under observation. However, this has two major drawbacks. At first, the communication overhead is increased since all spikes are transmitted between the neuronal simulation and the transfer function but more importantly the transfer function has to make sense of this series of spikes. This allows great flexibility as this approach is extensible, but it is not suited for general use.

Again, this list contains the device types that we think are suitable for a range of applications and we do not claim that this list is sufficient for all experiments. This list is subject to change. Rarely used device types may be removed whereas device types frequently asked for may be added.

The implementation on how exactly a given device type is created is up to the communication adapter that will create the appropriate communication objects. For example, the leaky integrator device can be implemented in Nest by simply inserting a new integrate-and-fire neuron with adequately set parameters and an infinite spiking threshold so that the result is directly available as the membrane potential of the additionally inserted neuron. This is possible since the Nest simulator runs in main memory and therefore allows different modes of communication. Other simulators such as SpiNNaker are only based on spike-based communication. Here, the implementation of the leaky integrator would be to record the spikes and to do the integration manually.

Each of these device types have their own additional configuration such as weights and delays in which the spikes are issued to spike generators or from existing neurons into leaky integrators. On the other hand, all devices share the connection specification towards the neuronal simulator, that we call NeuronSelector (cf. Fig. 16). This is a function that given a model of the neuronal network selects the neuron a device should be connected to. This includes entire populations but also views and assemblies.

While a single device is sufficient to transmit simple sensory data to the network or issue command control signals to the robot, the transmission of complex sensory inputs such as camera images requires multiple devices connected to different neurons each. This is the reason that a device mapping can specify not only a single but multiple neuron selectors. In the case that multiple neuron selectors are present, the framework won’t create just a single device but one for each neuron selector.

The advantage of these device groups is that they aggregate the values from individual devices to arrays, making this a suitable choice when the data in the robotics simulator is available as an array. This is the case for camera inputs that can then transmitted to an array of Poisson generators. Furthermore, device groups can be configured comfortably as in these scenarios devices usually share large proportions of their configuration.

Mapping to Python¶

Applying a typical query-and-command programming interface for managing transfer functions would presumably result in verbose schematic code. Thus, we use techniques from the area of domain-specific languages to raise the abstraction level of the target platform by means of an internal DSL, PyTF. With PyTF, we obtain a more concise representation of transfer functions. Users can specify transfer functions as regular Python functions decorated with their connections to neuronal and world simulators. The coordination regarding data synchronization and simulation orchestration is hidden in the platform abstractions.

We chose an internal DSL and Python as a host language because Python is popular both among robotics and neuroscience users. Given the research results from Meyerovich that suggest that developers do not like to change their primary language, we wanted to make the barrier for neuroscientists as low as possible. There is a Python API for both the neuronal simulations and the robotics side. Large parts of the framework are implemented in Python and this allows an easy implementation of the DSL as a Python API.

To implement transfer functions in PyTF, we have decided on using the Python decorator syntax. A first set of decorators turn a regular Python function into a transfer function and a second set specifies parameter mappings. Everything else, including the neuron access patterns and device types is specified as parameters for these decorators.

A consequence of this design is the name of the classes in the abstract syntax. They are named to be as understandable as possible.

In particular, the classes Neuron2Robot and Robot2Neuron create a new transfer function object with no reference to any regular Python function. When used as a decorator and applied to a Python function, the underlying Python function of the transfer function is set and placeholders for the parameter mappings are created (Python allows to retrieve the parameter names of a method using the inspect module).

The mapping specification classes MapSpikeSource, MapSpikeSink, MapVariable, MapRobotPublisher and MapRobotSubscriber then create a parameter mapping specification object that when called with a transfer function replaces the according placeholder with themselves and returns the transfer function to allow other parameters to be mapped. If no appropriate placeholder exists, an error message is thrown.

The configuration for mapping specifications is passed as arguments to the decorator representing the parameter mapping. Here, the device mappings are interesting as they allow the most detailed configuration. In particular, they contain a specification to which neurons a device should be connected as a function selecting the neurons for a given model of the neuronal network. However, as we do not want our users to bother with the details of lambda functions, we created a small API to allow them to write such functions as if they were operating on an assumed neuronal network model directly.

To specify multiple neuron selectors, a list of neuron selectors must be passed into the neuronal network constructor. In PyTF, we support a mapping operator that construct such lists of neuron selectors based on a lambda function and a concatenation operator to express more complex patterns. These operators make use of the knowledge that neuron selectors must not be nested deeper than in one list (i.e. it is not permitted to specify a list of a list of neuron selectors for a device) and flatten these lists when required.


text:
# scatterplotMatrix

0th

Percentile

##### Scatterplot Matrices

This function provides a convenient interface to the pairs function to produce enhanced scatterplot matrices, including univariate displays on the diagonal and a variety of fitted lines, smoothers, variance functions, and concentration ellipsoids. spm is an abbreviation for scatterplotMatrix.

Keywords
hplot
##### Usage
scatterplotMatrix(x, ...)# S3 method for formula
scatterplotMatrix(formula, data=NULL, subset, ...)# S3 method for default
scatterplotMatrix(x, smooth = TRUE,
id = FALSE, legend = TRUE, regLine = TRUE,
ellipse = FALSE, var.labels = colnames(x), diagonal = TRUE,
plot.points = TRUE, groups = NULL, by.groups = TRUE,
use = c("complete.obs", "pairwise.complete.obs"), col =
carPalette()[-1], pch = 1:n.groups, cex = par("cex"),
cex.axis = par("cex.axis"), cex.labels = NULL,
cex.main = par("cex.main"), row1attop = TRUE, ...)spm(x, ...)
##### Arguments
x

a data matrix or a numeric data frame.

formula

a one-sided “model” formula, of the form  ~ x1 + x2 + ... + xk or  ~ x1 + x2 + ... + xk | z where z evaluates to a factor or other variable to divide the data into groups.

data

for scatterplotMatrix.formula, a data frame within which to evaluate the formula.

subset

expression defining a subset of observations.

smooth

specifies a nonparametric estimate of the mean or median function of the vertical axis variable given the horizontal axis variable and optionally a nonparametric estimate of the spread or variance function. If smooth=FALSE neither function is drawn. If smooth=TRUE, then both the mean function and variance funtions are drawn for ungrouped data, and the mean function only is drawn for grouped data. The default smoother is loessLine, which uses the loess function from the stats package. This smoother is fast and reliable. See the details below for changing the smoother, line type, width and color, of the added lines, and adding arguments for the smoother.

id

controls point identification; if FALSE (the default), no points are identified; can be a list of named arguments to the showLabels function; TRUE is equivalent to list(method="mahal", n=2, cex=1, location="lr"), which identifies the 2 points (in each group, if by.groups=TRUE) with the largest Mahalanobis distances from the center of the data; list(method="identify") for interactive point identification is not allowed.

legend

controls placement of a legend if the plot is drawn by groups; if FALSE, the legend is suppressed. Can be a list with the named elementcoords specifying the position of the legend in any form acceptable to the legend function; TRUE (the default) is equivalent to list(coords=NULL), for which placement will vary by the the value of the diagonal argument---e.g., "topright" for diagonal=TRUE.

regLine

controls adding a fitted regression line to each plot, or to each group of points if by.groups=TRUE. If regLine=FALSE, no line is drawn. This argument can also be a list with named list, with default regLine=TRUE equivalent to regLine = list(method=lm, lty=1, lwd=2, col=col[1]) specifying the name of the function that computes the line, with line type 1 (solid) of relative line width 2 and the color equal to the first value in the argument col. Setting method=MASS::rlm would fit using a robust regression.

ellipse

controls plotting data-concentration ellipses. If FALSE (the default), no ellipses are plotted. Can be a list of named values giving levels, a vector of one or more bivariate-normal probability-contour levels at which to plot the ellipses; robust, a logical value determing whether to use the cov.trob function in the MASS package to calculate the center and covariance matrix for the data ellipses; and fill and fill.alpha, which control whether the ellipse is filled and the transparency of the fill. TRUE is equivalent to list(levels=c(.5, .95), robust=TRUE, fill=TRUE, fill.alpha=0.2).

var.labels

variable labels (for the diagonal of the plot).

diagonal

contents of the diagonal panels of the plot. If diagonal=TRUE adaptive kernel density estimates are plotted, separately for each group if grouping is present. diagonal=FALSE suppresses the diagonal entries. See details below for other choices for the diagonal.

plot.points

if TRUE the points are plotted in each off-diagonal panel.

groups

a factor or other variable dividing the data into groups; groups are plotted with different colors and plotting characters.

by.groups

if TRUE, the default, regression lines and smooths are fit by groups.

use

if "complete.obs" (the default), cases with missing data are omitted; if "pairwise.complete.obs"), all valid cases are used in each panel of the plot.

pch

plotting characters for points; default is the plotting characters in order (see par).

col

colors for points; the default is carPalette starting at the second color. The color of the regLine and smooth are the same as for points but can be changed using the the regLine and smooth arguments.

cex

relative size of plotted points

cex.axis

relative size of axis labels

cex.labels

relative size of labels on the diagonal

cex.main

relative size of the main title, if any

row1attop

If TRUE (the default) the first row is at the top, as in a matrix, as opposed to at the bottom, as in graph (argument suggested by Richard Heiberger).

...

arguments to pass down.

##### Details

Many arguments to scatterplotMatrix were changed in version 3 of car, to simplify use of this function.

The smooth argument is usually either set to TRUE or FALSE to draw, or omit, the smoother. Alternatively smooth can be set to a list of arguments. The default behavior of smooth=TRUE is equivalent to smooth=list(smoother=loessLine, spread=TRUE, lty.smooth=1, lwd.smooth=1.5, lty.spread=3, lwd.spread=1), specifying the smoother to be used, including the spread or variance smooth, and the line widths and types for the curves. You can also specify the colors you want to use for the mean and variance smooths with the arguments col.smooth and col.spread. Alternative smoothers are gamline which uses the gam function from the mgcv package, and quantregLine which uses quantile regression to estimate the median and quartile functions using rqss from the quantreg package. All of these smoothers have one or more arguments described on their help pages, and these arguments can be added to the smooth argument; for example, smooth = list(span=1/2) would use the default loessLine smoother, include the variance smooth, and change the value of the smoothing parameter to 1/2. For loessLine and gamLine the variance smooth is estimated by separately smoothing the squared positive and negative residuals from the mean smooth, using the same type of smoother. The displayed curves are equal to the mean smooth plus the square root of the fit to the positive squared residuals, and the mean fit minus the square root of the smooth of the negative squared residuals. The lines therefore represent the comnditional variabiliity at each value on the horizontal axis. Because smoothing is done separately for positive and negative residuals, the variation shown will generally not be symmetric about the fitted mean function. For the quantregLine method, the center estimates the median for each value on the horizontal axis, and the spread estimates the lower and upper quartiles of the estimated conditional distribution for each value of the horizontal axis.

The sub-arguments spread, lty.spread and col.spread of the smooth argument are equivalent to the newer var, col.var and lty.var, respectively, recognizing that the spread is a measuure of conditional variability.

By default the diagonal argument is used to draw kernel density estimates of the variables by setting diagonal=TRUE, which is equivalent to setting diagonal = list(method="adaptiveDensity", bw=bw.nrd0, adjust=1, kernel=dnorm, na.rm=TRUE). The additional arguments shown are descibed at adaptiveKernel. The other methods avaliable, with their default arguments, are diagonal=list(method="density", bw="nrd0", adjust=1, kernel="gaussian", na.rm=TRUE) which uses density for nonadaptive kernel density estimation; diagonal=list(method ="histogram", breaks="FD") which uses hist for drawing a histogram that ignores grouping, if present; diagonal=list(method="boxplot") with no additional arguments which draws (parallel) boxplots; diagonal=list(method="qqplot") with no additional arguments which draws a normal QQ plot; and diagonal=list(method="oned") with no additional arguments which draws a rug plot tilted to the diagonal, as suggested by Richard Heiberger.

Earlier versions of scatterplotMatrix included arguments transform and family to estimate power transformations using the powerTransform function before drawing the plot. The same functionality can be achieved by calling powerTransform directly to estimate a transformation, saving the transformed variables, and then plotting.

##### Value

NULL, returned invisibly. This function is used for its side effect: producing a plot. If point identification is used, a vector of identified points is returned.

##### References

Fox, J. and Weisberg, S. (2019) An R Companion to Applied Regression, Third Edition, Sage.

pairs, scatterplot, dataEllipse, powerTransform, bcPower, yjPower, cov.trob, showLabels, ScatterplotSmoothers.

##### Aliases
• scatterplotMatrix
• scatterplotMatrix.formula
• scatterplotMatrix.default
• spm
##### Examples
# NOT RUN {
scatterplotMatrix(~ income + education + prestige | type, data=Duncan)
scatterplotMatrix(~ income + education + prestige | type, data=Duncan,

format: plain


text:
# zbMATH — the first resource for mathematics

Candidate weak pseudorandom functions in $$\mathrm{AC}^0\circ\mathrm{MOD}_2$$. (English) Zbl 1364.94519
Proceedings of the 5th conference on innovations in theoretical computer science, ITCS’14, Princeton, NJ, USA, January 11–14, 2014. New York, NY: Association for Computing Machinery (ACM) (ISBN 978-1-4503-2243-0). 251-259 (2014).

##### MSC:
 94A60 Cryptography 68Q25 Analysis of algorithms and problem complexity
Full Text:
##### References:
 [1] M. Ajtai and C. Dwork. A public-key cryptosystem with worst-case/average-case equivalence. In F. T. Leighton and P. W. Shor, editors, STOC, pages 284 293. ACM, 1997. · Zbl 0962.68055 [2] D. A. M. Barrington. Bounded-width polynomial-size branching programs recognize exactly those languages in nc1 . J. Comput. Syst. Sci., 38(1):150 164, 1989. · Zbl 0667.68059 [3] A. Borodin, D. Dolev, F. E. Fich, and W. J. Paul. Bounds for width two branching programs. SIAM J. Comput., 15(2):549 560, 1986. · Zbl 0589.68034 [4] Z. Brakerski. Fully homomorphic encryption without modulus switching from classical GapSVP. In R. Safavi-Naini and R. Canetti, editors, CRYPTO, volume 7417 of Lecture Notes in Computer Science, pages 868 886. Springer, 2012. · Zbl 1296.94091 [5] Z. Brakerski, C. Gentry, and V. Vaikuntanathan. (Leveled) fully homomorphic encryption without bootstrapping. In S. Goldwasser, editor, ITCS, pages 309 325. ACM, 2012. Invited to ACM Transactions on Computation Theory. · Zbl 1347.68120 [6] Z. Brakerski, A. Langlois, C. Peikert, O. Regev, and D. Stehl´e. Classical hardness of learning with errors. CoRR, abs/1306.0281, 2013. Preliminary version in STOC 2013. [7] Z. Brakerski and V. Vaikuntanathan. E.cient fully homomorphic encryption from (standard) LWE. In R. Ostrovsky, editor, FOCS, pages 97 106. IEEE, 2011. Invited to SIAM Journal on Computing. · Zbl 1292.94038 [8] C. Gentry. A fully homomorphic encryption scheme. PhD thesis, Stanford University, 2009. · Zbl 1304.94059 [9] C. Gentry. Fully homomorphic encryption using ideal lattices. In STOC, pages 169 178, 2009. · Zbl 1304.94059 [10] C. Gentry. Toward basing fully homomorphic encryption on worst-case hardness. In CRYPTO, pages 116 137, 2010. · Zbl 1280.94059 [11] C. Gentry, C. Peikert, and V. Vaikuntanathan. Trapdoors for hard lattices and new cryptographic constructions. In C. Dwork, editor, STOC, pages 197 206. ACM, 2008. · Zbl 1231.68124 [12] C. Gentry, A. Sahai, and B. Waters. Homomorphic encryption from learning with errors: Conceptually-simpler, asymptotically-faster, attribute-based. IACR Cryptology ePrint Archive, 2013:340, 2013. Preliminary version in CRYPTO 2013. · Zbl 1310.94148 [13] Y. Ishai and A. Paskin. Evaluating branching programs on encrypted data. In S. P. Vadhan, editor, TCC, volume 4392 of Lecture Notes in Computer Science, pages 575 594. Springer, 2007. · Zbl 1156.94354 [14] D. Micciancio and P. Mol. Pseudorandom knapsacks and the sample complexity of lwe search-to-decision reductions. In P. Rogaway, editor, CRYPTO, volume 6841 of Lecture Notes in Computer Science, pages 465 484. Springer, 2011. · Zbl 1287.94085 [15] D. Micciancio and C. Peikert. Trapdoors for lattices: Simpler, tighter, faster, smaller. IACR Cryptology ePrint Archive, 2011:501, 2011. Extended abstract in Eurocrypt 2012. · Zbl 1297.94090 [16] C. Peikert. Public-key cryptosystems from the worst-case shortest vector problem: extended abstract. In M. Mitzenmacher, editor, STOC, pages 333 342. ACM, 2009. · Zbl 1304.94079 [17] O. Regev. New lattice-based cryptographic constructions. J. ACM, 51(6):899 942, 2004. · Zbl 1125.94026 [18] O. Regev. On lattices, learning with errors, random linear codes, and cryptography. In H. N. Gabow and R. Fagin, editors, STOC, pages 84 93. ACM, 2005. Full version in · Zbl 1192.94106 [19] [19]. [20] O. Regev. On lattices, learning with errors, random linear codes, and cryptography. J. ACM, 56(6), 2009. · Zbl 1325.68101 [21] C.-P. Schnorr. A hierarchy of polynomial time lattice basis reduction algorithms. Theor. Comput. Sci., 53:201 224, 1987. · Zbl 0642.10030
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:
# Who broke Mrs. Smith's kitchen window?

you are a detective in the local neighborhood. Four windows have been broken: the school's window, Mrs. Smith's kitchen window, Mr. Brown's car window, and the police officer's window. The four suspects are Alex, Collin, Josie and Raymond, and we know that each one of them broke a single window

Alex said:

I did not break Mrs. Smith's kitchen window, and I did not break Mr. Brown's car window.

Collin said:

Alex did not break the school's windows.

Josie said:

I know what happened. Collin broke Mrs. Smith's kitchen window and Alex broke the police office's window.

Raymond said:

I broke Mr. Brown's car window or the school's window and I am sorry.

You know that one of the suspects is a liar and three of them are telling the truth. Who broke Mrs. Smith's kitchen window?

• Can you clarify: if someone says "A and B" and is a liar, is it possible that one of A,B is true and the other false, or should we make the assumption common in this sort of puzzle that a liar will lie about everything they say? – Gareth McCaughan Jan 13 '18 at 22:53
• @GarethMcCaughan Following usual logic, a AND b is false iff either a is false OR b is false. – Mr. Xcoder Jan 13 '18 at 22:54
• @Mr.Xcoder I know what usual logic says, but I have seen puzzles of this sort in which a different convention is used, hence the question. – Gareth McCaughan Jan 13 '18 at 22:54
• Collin said: "Alex did not break the school's windows." Is the s a typo or is it the basis of the lateral-thinking tag. – ibrahim mahrir Jan 13 '18 at 23:24
• The last bit by Raymond "and I am sorry" introduces ambiguity to the puzzle. He could be lying about that, which would lead to a different answer. – user3294068 Jan 31 '18 at 16:21

First:

Collin is not the liar. Because if he is, there will be two liars: If Collin is a liar, then Alex must've broken the school's window, thus Josie is a liar too.

Second:

Alex is not a liar. Because if he is, then his statement is a lie, thus Alex must've broken either Mrs. Smith's kitchen window or Mr. Brown's car window. So Josie is a liar too. We can't have two liars, thus Alex is telling the truth.

Furthermore:

If Raymond is a liar, then he must've broken Mrs. Smith's kitchen window or the police office's window (the only other two possibilities), thus making Josie a liar too (he couldn't possibly broke one of those because Josie has confirmed that both windows were broken by different people). So Raymond is telling the truth.

And

Josie is the liar.

Let's recap:

Alex broke the police office's window (using his and Collin's statements).

And:

Collin did not break Mrs. Smith's kitchen window. (using the falsy half of Josie's statement, the half about Collin).

And:

Raymond did not break Mrs. Smith's kitchen window. (using his statement which we proved to be true).

So:

It was Josie who broke Mrs. Smith's kitchen window.

• If Josie is the liar it means Alex didn't broke Police officers car. Alex is saying truth so he didn't break Mrs Smith and Mr. Brown's windows. But also according to Collin Alex didn't even break the school window. This mean Alex didn't break any windows? – prog_SAHIL Jan 14 '18 at 15:21
• @prog_SAHIL Josie said "A and B". If she is a liar then either "A is false and B is true", "A is true and B is false" or "both A and B are false". We know that "B is true" (based on Alex's and Collin's statements), so if Josie is a liar then "A is surely false". Hope that makes sense. :D – ibrahim mahrir Jan 14 '18 at 21:35
• Josie also said "I know what happened". If this was false, then everything else Josie says is a guess and we have no way of assigning truth or lie value to it. – theonetruepath Jan 15 '18 at 3:37
• @theonetruepath I think that and the "I am sorry" part of Raymond's statement are not as important as the rest of the statements. If not, then this will be beyond the scope of logical deductions. – ibrahim mahrir Jan 15 '18 at 12:19
• It is also possible that Raymond broke the school's window and is not sorry about it, and is therefore lying. That means Josie told the truth, and Colin broke Smith's window. – user3294068 Jan 31 '18 at 16:20

If Alex lies then

he broke either Smith's or Brown's window. If Josie tells the truth then Alex broke the police window. Both can't be true, but if Alex is the liar then they must be. So Alex is telling the truth, and broke either the school or the police window.

Similarly, if Collin lies

and Josie tells the truth then we have a contradiction; but if Collin is the liar then that must be the case. So Collin is telling the truth, and Alex broke not the school window but the police window.

If Josie is lying

(and hence Raymond telling the truth) then -- since we know Josie is right about Alex -- Collin must not have broken Smith's window. Neither did Collin break the police window, since Alex did; so he broke either Brown's or the school's. Since Raymond is telling the truth, he broke the other one of those. Then Alex broke the police window and hence Josie broke Smith's window. This all seems consistent.

The other possibility is that Josie is telling the truth and Raymond is lying.

In that case (from Josie's testimony) Collin broke Smith's window. So Josie and Raymond, between them, broke Brown's and the school's windows, which means that Raymond is telling the truth, contradiction.

So the only possibility is

the one in the third paragraph, and it's Josie who broke Smith's window.

Note: this assumes

it isn't possible that Raymond did break Brown's or the school's window but isn't sorry and is therefore lying. That seems like a bit of a weak point, but without that assumption the question doesn't have a unique answer.

If the liar is Alex, then: Alex must have broken Mrs. Smith's kitchen window or Mr. Brown's car window. In this case Josie must lie too (Alex broke the police office's window). So this scenario yields a contradiction.

If the liar is Collin, then: Alex must have broken the school's window, and Josie would lie too (Alex broke the police office's window.). Again, contradiction.

If the liar is Josie, then, assuming the false statement is Collin broke Mrs. Smith's kitchen window: Collin did not break Mrs. Smith kitchen window, but neither did Alex. That leaves us with two choices for Mrs. Smith's window: either Josie or Raymond. But Raymond said that he did break Mr. Brown's car window or the school's window, so Josie must have broken Mrs. Smith's window.

Josie broke Smith's window. Because if Josie lies, the scenario is logically consistent (assuming the statement we picked earlier is false).

Using more "formal" logic (well, not quite :P):

We know that:

• (1) $\exists!\text{ liar}$
• (2) $\forall \text{ windows }\exists!\text{ suspect}$
If Alex is not telling the truth, then the statement $$S_1=\text{(Alex didn't break Mrs. Smith's window) }\land\text{ (Alex didn't break Mr. Brown's car window)}$$ must be false. But that cannot be the case, since Josie also states $$S_2 = \text{(Alex broke the police office's window)}$$but $(1), (2)\implies\lnot\:S_1\land S_2$ cannot be true. Contradiction!

If Collin is lying, then $$S_1\land ¬ \text{ (Alex did not break the school's window)}$$implies that $S_3=\text{Alex broke the police office's window}$ must be true. But then we have a problem with$$S_4=\text{(Collin broke Mrs. Smith's window)} \land \text{(Alex broke the police office's window)}$$That is, $(1), (2)\implies S_4\land S_3$ cannot be true. Contradiction!

If the liar is Josie, then $S_4$ is false. Therefore either of its sub-statements must be false. I'll call them $S_{41}$ and $S_{42}$. Considering the first case, $S_{41}$ is false, then Collin didn't break Mrs. Smith. But from $(1)\land S_1$ we know that neither did Alex, and from $$(1)\land S_5 \:\text{(Raymond broke Mr. Brown's car window or the school's window)}$$we know that neither did Raymond. In this case, we can imply from $(2)$ that Josie did break Mrs. Smith's kitchen window. Great!

Now, for completeness' sake, if $S_{42}$ would have been false, $$\lnot S_{42}\land\text{(Alex did not break the school's window)}\land S_1$$must be false, since we know $(2)$ is true, and in this case Alex wouldn't break any window.

### Assumptions

• The puzzle has a unique solution, and therefore there is no need to analyse the fourth case, Raymond is lying.
• The s in school’s windows is just a typographical error
• A AND B” is false has its natural meaning, that either A is false OR B is false (or both)

• Consider rechecking: "Assume the false is Alex broke the police office's, then: Alex must have broken the police office's window". – ibrahim mahrir Jan 13 '18 at 23:41
• @ibrahimmahrir Ugh, thanks for spotting that! Fixed – Mr. Xcoder Jan 13 '18 at 23:42

Alex:

If Alex is lying then Josie must also be lying, which is a contradiction. Therefore Alex is telling the truth.

Collin:

If Collin is lying then Josie must also be lying, which is a contradiction. Therefore Collin is telling the truth.

Now we are left with two situations:

Either Josie is lying or Raymond is lying. Both have given compound statements so we are left with a choice.

If Josie is lying it must be about who broke Mrs. Smiths window, as we know that Alex must have broken the police officers window if Alex and Collin are telling the truth. If we assume that Raymond is telling the truth then he didn't break Mrs. Smiths window, and neither did Alex or Collin, so it must have been Josie herself.

The other option is that Raymond is lying. But if Raymond is lying about which window he broke then Josie must be lying as well, which is a contradiction. So Raymond is not lying about which window he broke, but rather about him being sorry.

Both of these solutions are logically valid, so we must find another basis on which to decide. Raymond gave a relatively unhelpful answer, lacking in specificity, leading me to doubt his intentions are genuine. This suggests that he is not really sorry for what he has done. I conclude that Raymond is the liar, leaving Collin as the person who broke Mrs. Smiths window.

I would like to answer this, in terms of interpretation, and not using the heavy logic implied above, though they have better credentials and are absolutely correct in applying the logic necessary and then deducing.

Let's assume:

All of them are speaking are speaking the truth. If that is the case, and one of them is lying(Alex being considered the liar here) then Alex is breaking two or probably more windows, which defies the given constraints. So Alex is telling the truth about him not breaking the two windows.

Next up:

If what Collin says is a lie, then Alex must have broken the school's windows and let's keep that in mind. But this still doesn't necessarily have to be correct.

Now when:

Josie says, that Collin broke the kitchen window and Alex broke the police office's window, making Collin the alleged guy who broke the window. We'll come to him lying later in the answer.

But:

When Raymond says that he broke either of the two windows, if he is lying, then he either broke the police office's window or the Kitchen's window, which makes Josie a liar as well. This results in two liars which cannot be.

Now let's retrace our paths from here:

If Raymond is lying, then Josie is lying as well. If Collin is lying then Alex is lying as well. And if Alex is lying then Raymond is lying as well. This leads to us having two liars which cannot be the case. So it's definitely Josie lying, since him lying would mean, that all the others are necessarily telling the truth, making JOSIE THE LIAR AND THE ONE BREAKING MRS. SMITH'S KITCHEN WINDOW


text:
First time implementing a adjacency list. Is the use of exceptions correct? If anyone could test/read the code and give some advice on improvments I would appreciate it.

#include <iostream>
#include <vector>
#include <exception>
#include <list>

class VertexInvalidArg : public std::invalid_argument
{
public:
VertexInvalidArg(const std::string &msg)
:invalid_argument(msg)
{}
};

class VertexUnderFlow : public std::underflow_error
{
public:
VertexUnderFlow(const std::string &msg)
:underflow_error(msg)
{}
};

class Graph
{
public:
Graph(int defaultVertices = 0);

size_t noOfVertices() const;
bool isEdge(int v1, int v2) const;
bool isVertex(int v1) const;
void clear();

private:
friend std::ostream& operator<<(std::ostream& os, const Graph& g);

size_t vertexCount;
};

Graph::Graph(int defaultVertices)
{
if (defaultVertices <= 0)
{
defaultVertices = 0;
}
vertexCount = defaultVertices;

for (int i = 0; i < vertexCount; i++)
{
std::list<int> vertex;
}
}

{
std::list<int> vertex;
++vertexCount;
}

size_t Graph::noOfVertices() const
{
return vertexCount;
}

{
if (v1 == v2)
{
throw VertexInvalidArg("Vertex Cannot Connect To Itself");
}
else if (v1 > vertexCount - 1 || v2 > vertexCount - 1)
{
throw VertexInvalidArg("Vertex Does Not Exist");
}
else
{
{
if (*itr == v2)
{
}
++itr;
}

}
}

std::ostream& operator<<(std::ostream& os, const Graph& g)
{
if (g.vertexCount == 0)
{
throw VertexUnderFlow("No Vertices to Display");
}

std::cout << std::endl;
for (int i = 0; i < g.vertexCount; i++)
{
os << "Vertex " << i << " Connects To Vertex: ";
{
os << *itr << " ";
++itr;
}
os << std::endl;
}
return os;
}

bool Graph::isEdge(int v1, int v2) const
{
if (vertexCount == 0)
{
throw VertexUnderFlow("Graph is empty");
}
else if (v1 == v2)
{
throw VertexInvalidArg("Vertex Cannot Connect To Itself");
}
else if (v1 > vertexCount - 1 || v2 > vertexCount - 1)
{
throw VertexInvalidArg("Vertex Does Not Exist");
}

bool found = false;
{
if (*itr == v2)
{
found = true;
}
++itr;
}
return found;
}

bool Graph::isVertex(int v1) const
{
bool found = false;
if (v1 < vertexCount)
{
found = true;
}
return found;
}

void Graph::clear()
{
vertexCount = 0;
}

int main()
{
using std::cout;
using std::cin;
using std::endl;

Graph myG;
int loop = 0;
int V1 = 0, V2 = 0;

while (loop != -1)
{
cout << "Please select operation: " << endl << endl;
cout << "1: Add Vertex" << endl;
cout << "2: Add Edge" << endl;
cout << "3: Display Graph" << endl;
cout << "4: Number of Vertices" << endl;
cout << "5: Is Edge" << endl;
cout << "6: Is Vertex" << endl;
cout << "7: Clear" << endl;
cout << "-1: Terminate Program" << endl << endl;

{
case 1:
cout << endl << "Vertex " << myG.noOfVertices() - 1 << " Added" << endl << endl;
break;
case 2:
cout << endl << "Enter First Vertex: ";
cin >> V1;
cout << "Enter Second Vertex: ";
cin >> V2;
try
{
}
catch (const VertexInvalidArg& e)
{
std::cerr << "Error: Invalid Argument: " << e.what();
}
cout << endl << "Edge between " << V1 << " and " << V2 << " Added";
cout << endl << "Edge between " << V2 << " and " << V1 << " Added" << endl << endl;
break;
case 3:
cout << endl;
try
{
cout << myG;
}
catch (const VertexUnderFlow& e)
{
std::cerr << "Error: Under Flow: " << e.what();
}
cout << endl << endl;
break;
case 4:
cout << endl << "Number of Vertices: ";
cout << myG.noOfVertices();
cout << endl << endl;
break;
case 5:
cout << endl << "Enter First Vertex: ";
cin >> V1;
cout << "Enter Second Vertex: ";
cin >> V2;
cout << endl;
try
{
cout << "Is Edge: " << myG.isEdge(V1, V2);
}
catch (const VertexInvalidArg& e)
{
std::cerr << "Error: Invalid Argument: " << e.what();
}
catch (const VertexUnderFlow& e)
{
std::cerr << "Error: Under Flow: " << e.what();
}
cout << endl << endl;
break;
case 6:
cout << endl << "Enter Vertex: ";
cin >> V1;
cout << endl;
cout << "Is Vertex: " << myG.isVertex(V1);
cout << endl << endl;
break;
case 7:
cout << endl << "Graph Cleared" << endl << endl;
myG.clear();
break;
case -1:
cout << endl << "Operation Terminated";
loop = -1;
break;
default: cout << endl << "Invalid Input" << endl << endl;
}
}

cout << endl << endl;
system("pause"); // TESTING
return 0;
}

Data Members

You currently have two members:

std::vector<std::list<int> > adjList;
size_t vertexCount;

But vertexCount is always the size of adjList. That's just extra stuff you have to keep track of. The best thing you can say about it is that it's error prone. You can drop vertexCount and rewrite size() to simply be:

size_t Graph::noOfVertices() const
{
}

Secondly, you implemented adjList as a vector of lists. That may be canonically correct, but list is actually not a good data structure for this since lists are very inefficient at iteration you do in several places. vector would be strictly better, due to its cache friendliness.

Constructor

The whole point of your constructor is to make defaultVertices empty lists. There is a constructor on vector which takes a size. Use it:

Graph::Graph(int defaultVertices)
{ }

Quite a bit cleaner!

If you can use C++11, you can rewrite this function as a one-liner as well:

adjList.emplace_back();

That will default-construct a new container in place as the new last element: exactly what you want. And note that we're not keeping track of vertexCount manually anymore - so don't have to do that either!

Is there a reason you're not supporting self-edges?

Your check against the max is correct, but weird. Better to do:

v1 >= adjList.size() || v2 >= adjList.size()

Any extra operations you add on your code make it harder to understand. The -1s here are just unnecessary.

Now for the main part of the function. You are looking for v2 in adjList[v1]. There's an algorithm for that, it's called std::find and it's a lot easier to use:

auto it = std::find(adjList[v1].begin(), adjList[v1].end(), v2);
}
else {
// throw
}

isEdge()

Similarly, use find(). Here it's especially useful as it'll be much more efficient. Once you find your edge, you don't have to keep going - but you still do! The end could just be:

return std::find(adjList[v1].begin(), adjList[v1].end(), v2)

isVertex()

What you wrote is an antipattern. Anytime you want to check if an expression is true or false, you want to simply do:

return v1 < vertexCount;

Not:

return (v1 < vertexCount) ? true : false;

Not:

if (v1 < vertexCount) return true;
else return false;

Not what you did with the extra member variable. It's unnecessarily verbose and just looks funny.

Redundancy

You are keeping track of twice as much information as you need to. You have an edge from 2 to 5 and 5 to 2. If you are just keeping an adjacency list in an undirected graph, you can just keep the upper triangle. Add a helper to put the vertices in the correct order:

void sort(int& v1, int& v2) {
if (v1 > v2) {
std::swap(v1, v2);
}
}

And then start each of your methods with a call to sort(), and only add and check the edges against v1.

Hope that helps!

• Fantastic. Thanks! I've made all the changes and changed it to a vector of vectors! I had to change the sort functions return type to void and v1 < v2 so I could check against v1, now all working like clockwork! Appreciate it! I gather the exceptions are ok? – user3392999 Jul 23 '15 at 10:07


text:
# Foucault Pendulum vector diagrams

Several vector diagrams are often used to demonstrate the physics underlying the Foucault pendulum.

Diagrams are provided to illustrate a pendulum located at the North Pole, equator, and 45 degrees N to show how the rotation of Earth in relation to the pendulum is observed, or not, at these locations. This is not a rigorous evaluation but is intended to convey information regarding the interaction of the two moving objects, the swinging pendulum and the rotating Earth. One of the great insights by Leon Foucault is that the time to observe a full rotation of the Earth increased by the inverse of the sine of the latitude.

In the examples, the pendulums are of great size to aid in the visualization of the pendulum swing in relation to the Earth (shown as blue circles). The pendulum is drawn so that 90 degrees of pendulum arc sweeps out 90 degrees of arc on the surface of the Earth. Views from the side, the front, and above (right, center, left) are provided to aid in the interpretation of the diagrams and arrows are provided to show the direction of the Earth's rotation. The schematic at the bottom of the each figure represents the range of swing of the pendulum as viewed from above and normalized to a standard orientation. The smaller arrows depict the magnitude of the relative velocity vector for the point on the Earth's surface in-line with the pendulum bob projected to the center of the Earth (the magnitude is shown since the scematic is two-dimensional, not three-dimensional). The pendulum bob is always affected by the force of gravity directed towards the center of the Earth. The force associated with the connection of the pendulum to a support structure directs the pendulum bob along the swing of the arc.

The support structure is dependent on the velocity of the surface of the Earth where it is located. The point of connection of the pendulum moves with the surface velocity vectors of the Earth at that latitude. At the equator the support-point moves with the equatorial rotation of the Earth and moves the pendulum swing along with this rotation. At the poles the support-point is located on the axis of the Earth so the support-point rotates but does not have a horizontal velocity component as it does at the equator (and a progressively less horizontal velocity component with increasing latitude). The plane of the pendulum swing, however, is independent of the surface velocity vectors underneath the swing since there is only one point of connection. The point of connection is configured such that the plane of pendulum swing is free to swing in any direction in relation to the structure of the connection point. The pendulum swing at the poles remains aligned toward a star if not forced to rotate with the support. As a result, it is observable that the Earth turns underneath the plane of swing of the pendulum.

Coriolis effect

The reason the rotation of the Earth in relation to the pendulum swing increases in time (decreases in effect) with decreasing latitude is related to the Coriolis Effect. As summarized in the Coriolis effect article, the effect is greatest in polar regions where the surface of the Earth is at right angles to the axis of rotation (the central axis of the pendulum aligns with the Earth's axis of rotation). The Coriolis effect decreases nearer the equator because the surface of the Earth is parallel to the axis of rotation (the central axis of the pendulum is perpendicular with the Earth's axis of rotation). Refer to the article discussing the Coriolis Effect for further details.

The motion of ballistics with changing latitude is not helpful to understanding the change with latitude of the observed rotation time of the pendulum. (This discussion point is different than what is stated in the reference book.) There is only one point of connection to the Earth for the swinging pendulum and that point of connection doesn't move in relation to the Earth. Because the plane of the pendulum swing is free to swing in relation to the rotation of the structure of the connection point, the rotation of the Earth is observable as directly related to the magnitude of the Coriolis effect. The examples show that the Earth turns underneath the plane of the pendulum swing and how this change in relationship can be interpreted at different latitudes by evaluating the surface velocity components underneath the swing of the pendulum.

Polar pendulum

For a pendulum swing at the North Pole it is shown that the surface velocity vectors of the Earth underneath one side of the pendulum swing are directed in opposition to the velocity vectors underneath the other side of the swing (see Figure 1). The Earth's rotation can then be observed in relation to the pendulum swing. At the North Pole the support-point of the pendulum swing is located on the axis of rotation of the Earth. No matter what vertical orientation is established by the plane of the swing, the relative velocity vectors of the Earth's surface on opposite sides and equidistant from the center point of the swing will be in opposition. The Earth turns underneath the plane of the pendulum swing that is established.

The support-point of the connection turns with the Earth and is depicted as freely suspended above the Earth. The plane of the pendulum swing does not turn with the support point and is not affected by the turning of the support point. The bob is free to swing in any direction in relation to the support (refer to a Charron chuck). For a pendulum at the pole, the plane of swing remains aligned with a star that the bob is swinging toward. A spot on the bob, however, turns with the support since the bob is not independent of the support point. The spot on the bob does not remain aligned with a star that the bob is swinging toward. This occurs whether the pendulum is swinging or not. If the bob is not allowed to turn with the support-point one twist of the connecting wire will occur in one day at the pole. If the connection apparatus of the pendulum to the bob and to the support were in a fixed relationship (and the connection not allowed to twist, for example, using a rigid rod pinned into place between two sides of the support), then once the plane of the pendulum swing is established in one direction, that plane would be forced to turn with the support and connection. The Earth's rotation would not be observable in relation to the pendulum swing with this type of connection.

Equatorial pendulum

At the equator the rotation of the Earth is not observable in relation to the pendulum swing because the plane of the pendulum swing is moving along with the rotation of the Earth and no net change in relationship occurs. It is shown by the diagrams that the surface velocity vectors of the Earth underneath the swing of the pendulum are either balanced in the same direction or included within the same plane as the pendulum swing.

For the equatorial pendulum with a swing in the longitudinal (north-south) direction the surface velocity vectors on either side of the swing are balanced in the same direction and the center-point of the pendulum swing is moving along with the direction of rotation (see Figure 2A).

For the equatorial pendulum with a swing in the latitudinal direction (along the equator) the surface velocity vectors on either side of the swing are not balanced in the same direction but are acting within the same "x"-"y" plane as the pendulum swing (see Figure 2B). These vectors are all of the same magnitude, that of the equatorial velocity. On one side of the pendulum swing the surface velocity vectors are angled upwards but on the opposite side the vectors are angled downwards. Since these vectors are all in the same plane as the pendulum swing there is no change of the surface in relationship to the plane of the pendulum swing.

Information and the pendulum sine law

The surface velocity due to the Earth's rotation is a maximum at the Equator and is equal to the circumference (pi × the diameter of the Earth) per 24 hours (or 3.14159 × 12,756 ÷ 24 = 1670 km/h = 1 equatorial velocity unit, EVU). The time of an Earth's rotation is inversely related to the angular velocity and the surface velocity (T = 1 day for 2 pi radians, or at the equator, 1 circumferential unit per 1 EVU = 40,075 km ÷ 1670 km/h ÷ 24 h/day = 1 day).

At a given latitude the surface velocity is equal to pi times the chord length parallel to the equator per 24 hours. This is equivalent to the cosine of the latitude × 1 EVU. At the poles the surface velocity is zero since zero distance is traveled. For a given longitude the surface velocity varies from 1 EVU at the equator to zero at the pole even though the angular velocities are all the same.

= =

The ratio of the surface velocity at two given latitudes is equal to the ratio of the cosine for the two given latitudes.

= =

The time to observe one full rotation of the Earth in relation to the plane of a swinging pendulum is one day at the poles (the minimum time) and cannot be observed (infinitely long, the maximum time) at the equator. One of the great insights by Leon Foucault is to deduce that the time to observe a full rotation of the Earth increased by the inverse of the sine of the latitude.

(ORTRP = observed rotation time in relation to the plane of the pendulum)

= =

The Pendulum Sine Law also defines that the ratio of the observed Earth's rotation time at two separate latitudes in relation to a pendulum swing is equal to the inverse ratio of the sine of the two latitudes.

= =

The sine of the latitude also indicates the degree of alignment of the pendulum central axis to the Earth's axis of rotation. At the poles the pendulum axis is parallel or aligned to the Earth's axis and the sine of 90° = 1. At the equator the pendulum axis is perpendicular to the Earth's axis and the sine of 0° = 0.

At intermediate latitudes the rotation of the Earth is observable in relation to the plane of the pendulum swing but the time to observe a full rotation depends on the latitude of the location. The time to observe a full rotation is equal to one day at the North Pole with the time increasing with decreasing latitude and not observable at the Equator (infinite length of time). The time increases because the central axis of the pendulum is aligned with the axis of rotation of the Earth at the North Pole and then the angle of misalignment increases as the latitude decreases to the point of perpendicularity at the Equator. The angular velocity in relation to the rotation of the Earth's axis that is imparted to the pendulum bob decreases with the cosine of the degree of misalignment of the central axis of the pendulum in comparison to the axis of rotation of the Earth. There are zero degrees of misalignment at the North Pole and the cosine of zero degrees equals 1. There are 90 degrees of misalignment at the Equator and the cosine of 90 degrees equals 0.

= =

This equation is very similar to the equation for the reduction in surface velocity with longitude stated above.This is equivalent to stating that the angular velocity that is imparted to the pendulum bob decreases with the sine of the latitude of the location (the sine of 90 degrees latitude equals 1; the sine of zero degrees latitude equals 0). The time to observe a complete rotation is inversely proportional to the angular velocity that is imparted to the pendulum bob in comparison to the angular velocity of the Earth. The statements above are thus equivalent to the inverse sine law for the observed time for a full rotation of the pendulum in relation to the rotation of the Earth.

There is only one point of connection to the Earth for the swinging pendulum and that point of connection doesn't move in relation to the Earth.

To approach the Pendulum Sine Law in basic steps::*The Earth's surface velocity decreases with increasing latitude directly proportional with the cosine of the latitude.:*The degree of alignment of the pendulum axis in comparison to the Earth's axis increases with increasing latitude directly proportional with the sine of the latitude.:*The angular velocity for the Earth is related to the circumferential surface velocity (2 × pi radians per day = 40,075 km per day at the equator).:**The observed apparent rotation of the pendulum has an angular velocity (e.g., for the set of points at the end of the pendulum swing). This angular velocity is related to the apparent circumferential surface velocity of the pendulum.:*The time of an Earth's rotation is inversely related to the angular velocity ("T" = 1 day per 2 × pi radians; or as calculated at the equator, 1 circumferential unit per 1 EVU), and inversely related to the circumferential surface velocity of 1 EVU.:**The time to observe a full rotation of the Earth in relation to the plane of the pendulum is inversely related to the angular velocity and inversely related to the apparent circumferential surface velocity.If it is proposed that;:*The angular velocity that is observed for an Earth's rotation in relation to the plane of the pendulum is directly related to the degree of alignment of the pendulum axis to the Earth's axis (Coriolis effect).Then it follows that,:*The angular velocity that is observed for an Earth's rotation in relation to the plane of the pendulum increases with increasing latitude directly proportional with the sine of the latitude.:*The time required to observe an Earth's rotation in relation to the plane of a pendulum decreases with increasing latitude inversely proportional with the sine of the latitude (the Pendulum Sine Law).

Forty-five-degrees north pendulum

For the 45° North pendulum with longitudinal swing (Figure 3A) the support point of the pendulum swing is moving along with the direction of rotation and the surface velocity vectors on either side of the swing are not balanced. The rotation of the Earth is observable in relation to the pendulum swing because a change in relationship to the surface occurs. At the south end of the pendulum swing the surface velocity vector (as projected to the center of the Earth) is that of the Equator, equal to 1 EVU. At the north end of the swing the velocity (as projected to the center of the Earth is that of the North Pole, equal to zero since zero distance is traveled in relation to the spinning Earth. Even though the surface velocities are different the angular velocities underneath the pendulum swing are all the same for this orientation.

For the 45° North pendulum with latitudinal swing (Figure 3B) the support point of the pendulum swing is moving along with the direction of rotation and the surface velocity vectors on either side of the swing are not balanced. The rotation of the Earth is observable in relation to the pendulum swing because a change in relationship to the surface occurs. On one side of the pendulum swing the surface velocity vectors are angled upwards and to the side but on the other side the vectors are angled downwards and to the opposite side. Since these vectors are not all in the same plane as the pendulum swing and are not balanced in the same direction there is a change in relationship between the surface and the plane of the pendulum swing.

:"Note: The schematic directly underneath the front view of the pendulum diagram is for velocity vectors projected towards the center of the Earth rather than straight down. It is much easier to interpret the magnitude of the vectors using the straight down projection that is shown on the right side of the diagram (the view from the top)."

Evaluation of surface velocity vectors

The surface velocity vectors underneath the swing of the pendulum can be separated into three components ("x", "y", and "z") for the 3-dimensional system in order to evaluate the vectors on opposite sides of the pendulum. The evaluation is to identify whether the vectors on each side of the pendulum swing are 1) balanced in the same direction, 2) acting in the same plane, or 3) unbalanced or in opposing directions. If the vector components on opposite sides of the pendulum swing are balanced in the same direction or act in the same plane of the pendulum then the rotation of the Earth will not be observable in relation to the swing of the pendulum. If the plane of the pendulum swing establishes the "x"-"y" plane then the z-component determines when the Earth's rotation will be observable and only if the "z"-component is not balanced in the same direction on each side. The magnitude of the opposing component is proportional to how long it takes for one full turn of the Earth to be observed in relation to the plane of the pendulum. The length of time is a minimum of one day at the poles, increases from the pole to the equator, and is not visible at the equator (infinitely long).

For any two points in the pendulum swing that are equidistant from the center of the swing there are two related points projected onto the surface of the Earth. These points can be used to determine the corresponding surface velocity components that are in opposition and not acting in the same plane of the swing. The magnitude of the difference between these two points (for a given latitude of the center-point) is a relative measure of the time to observe one full rotation. The ratio of the velocity vector difference to the corresponding points at the North Pole with the same equidistance from the center of the swing and the same projection to the surface can then be determined. The inverse ratio will determine the time observed for one full rotation of the pendulum swing in comparison to the duration at the pole of one day.

From the diagrams two points of the pendulum swing can be chosen to project straight down to two points on opposite sides of the Earth (180° apart). This makes it easy to obtain the velocity vector difference and then the time observed for a full rotation from the inverse ratio.

The examples show that the Earth turns underneath the plane of the pendulum swing and how this change in relationship can be interpreted at different latitudes.

:*For the North Pole pendulum (Figure 1) the velocity vector by inspection is 1 EVU on one side of the swing (as projected to the equator) and 1 EVU in the opposite direction on the other side of the swing. The difference between these two points is 2 EVU for the North Pole pendulum.

:*Using the same projection for the equatorial pendulum with longitudinal swing (Figure 2A) the velocity vector is 0 EVU on one side of the swing (for the North Pole) and 0 EVU on the other side of the swing (for the South Pole). The difference between these two points is 0 EVU for this arrangement. The time to observe a full rotation is infinitely long since the ratio divides by zero. For any two equidistant points the difference between the two vectors is zero, meaning the vectors are balanced in the same direction on each side of the pendulum swing.

:*Using the same projection for the equatorial pendulum with latitudinal swing (Figure 2B) the velocity vector is 1 EVU on each side of the swing and are in opposite directions. Even though the difference in the velocity vectors is 2 EVU, these vectors are acting in the same plane as the pendulum, therefore, cannot be observed by the pendulum swing. The "z"-component determines when the Earth's rotation will be observable and these are both zero.

:*Using the same projection for the 45° North pendulum with longitudinal swing (Figure 3A) the velocity vector is 0.707 EVU on one side of the (corresponding to 45° North on the opposite side of the world from the center point) and 0.707 EVU in the opposite direction on the other side of the swing (corresponding to 45° South). The difference between these two vectors is 1.414 EVU.

:*Using the same projection for the 45° North pendulum with longitudinal swing (Figure 3B) the velocity vector is 1 EVU but the "z"-component is only 0.707 EVU since the "x"-"y" plane is at 45°on one side of the swing (corresponding to the equator). On the other side of the swing the velocity vector is 0.707 EVU in the opposite direction (corresponding to the equator with a tilt of 45° to the "x"-"y" plane). The difference between these two vectors is 1.414 EVU.

::*The ratio of the velocity vectors for 45° to that of the pole is 1.414 ÷ 2.0 which equals 0.707. The time to observe the full rotation is then the inverse, or 1.414 days for a pendulum at 45° on the Earth.

Relative motion of the plane of the pendulum swing to the surface of the Earth

In order to observe the rotation of the Earth in relation to the plane of the pendulum swing there must be a basic difference in the two types of motion that are being compared. This basic difference is then manifested as (1) being able to 'observe' the change in position of the Earth in relation to the pendulum swing and (2) the time to observe a complete 'relative rotation' decreases with the sine of the latitude (decreases with an increase in the angle of alignment with the Earth's axis of rotation).

At the North Pole:

The central axis of the pendulum aligns with the axis of rotation of the Earth.The central axis of the pendulum is always determined by the force of gravity directed towards the center of the Earth.

A pendulum bob at rest at the North Pole still has spin on the bob.::If a pendulum bob is hanging vertically at the North Pole and held in place, the bob is stationary but is rotating (spinning) with the Earth. Once the bob is released (but not swinging) it will continue to rotate (spin) unless one stops the rotation (spin) by forcing a spot on the side of the bob to always line up or point to one star. If the rotation of the bob is stopped then the connection wire will twist one turn every day unless there is a connection that is free to rotate (spin) (at either end of the wire or the support structure). If the bob at the North Pole is allowed to continue to rotate (spin) then it will and the wire won't twist one turn in one day.

The Foucault pendulum connection is constructed such that the pendulum is free to swing in any direction.::This is not the same thing as the support connection being free to rotate (spin). The swing of the pendulum is different then the rotation (spin) of the bob.::If a pendulum is hanging at the North Pole, before the bob is released, the bob is stationary but is rotating (spinning) with the Earth. Once the bob is released it will continue to rotate (spin) unless one stops the rotation (spinning) by forcing a spot on the side of the bob to always line up or point to one star.

If the bob is displaced from the central axis of the pendulum in preparation for swinging and held in place, then the bob will revolve about the central axis of the pendulum along with the rotation of the Earth and has an angular velocity equal to that of the Earth's angular velocity.::Before the bob is released there is a force that is exerted through the holding point of the bob that causes the bob to revolve about the pendulum axis and rotate (turn) with the Earth. This is because the holding point is attached to the surface of the Earth just like the structure of the pendulum is attached to the Earth.

Once the bob is displaced from the central axis of the pendulum and then released there no longer is a force acting on the bob that causes it to revolve about the central axis of the pendulum and rotate (turn) with the Earth.::As observed from an end-view of the swinging bob, the swing of the bob will always line up or swing towards one star (just like the axis of the Earth points at one star for the time periods considered) as the bob swings through the central axis of the pendulum. There can be a slight ellipsoid swing if the initial conditions of angular motion are not cancelled but there is no longer a force acting on the bob causing it to have an angular velocity after the bob is released. The plane of the swing of the pendulum bob is now independent of the surface of the earth which was imparting a force to the bob before it was released (through the holding point). As noted previously, the bob is still spinning with the Earth (a spot of the bob will spin with the Earth), even though the bob is no longer turning with the Earth. Thus the Earth continues to turn underneath the swing of the pendulum while the swing of the pendulum remains in a fixed plane that doesn't rotate (turn).

The point of significance is that the force imparting an angular velocity to the pre-released bob is no longer acting on the swinging bob. At the North Pole, this force takes one day for the direction of the force to complete a full circle since it takes one day for the Earth to rotate.

At the equator:

The central axis of the pendulum is perpendicular with the axis of rotation of the Earth.The central axis of the pendulum is always determined by the force of gravity directed towards the center of the Earth.

A pendulum bob at rest at the Equator is still rotating with the Earth and there is no spin on the bob.::The pendulum is moving with the rotation of the Earth when located at the equator, as is the support structure, so one can't see the rotation of the Earth in relation to the pendulum. The observation of the relative motion of the Earth in relation to the pendulum depends on the location of the surface of the Earth where the initial conditions are established.

::If a pendulum bob is hanging vertically at the Equator and held in place, the bob is stationary relative to the Earth and is rotating (turning) with the Earth. Once the bob is released (but not swinging) it continues to rotate (turn) with the Earth.

If the bob is displaced from the central axis of the pendulum in preparation for swinging and held in place, then the bob is still rotating (turning) with the Earth with the same angular velocity equal to that of the Earth's angular velocity. This is the same angular velocity when at rest. Since the central axis of the pendulum is perpendicular with the axis of rotation of the Earth this is not the same as the North Pole where the central axis is aligned with the axis of the Earth. The bob is not revolving about the axis of the pendulum when held in place.::Before the bob is released there is a force that is exerted through the holding point of the bob that causes the bob to rotate (turn) with the Earth. This is because the holding point is attached to the surface of the Earth just like the structure of the pendulum is attached to the Earth.

Once the bob is displaced from the central axis of the pendulum and then released there is still the same force acting on the bob that causes it to rotate (turn) with the Earth.::As observed from an end-view of the swinging bob, the swing of the bob will not line up or swing towards one star as the bob swings through the central axis of the pendulum. There will not be a slight ellipsoid swing in relation to the Earth since the initial conditions of angular motion are not changed and there is still a force acting on the bob (transmitted through the support structure, pendulum wire, and gravity) causing it to have an angular velocity after the bob is released. The plane of the swing of the pendulum bob is independent of the surface of the earth but is not independent of the pendulum system which is still imparting the same force to the bob as before it was released through the single support point of the pendulum. As noted previously, there is no spin on the bob (a spot of the bob does not change with respect to the Earth) and the bob is not revolving about the axis of the pendulum. Thus the Earth continues to turn underneath the swing of the pendulum and the swing of the pendulum continues to turn with the Earth since there is still a force acting on the bob of the pendulum swing.

The point of significance is that the same forces imparting an angular velocity to the pre-released bob are still acting on the swinging bob. At the Equator, the relative motion of the Earth is not observable because there is no change in the force imparting an angular velocity to the bob. This is because the central axis of the pendulum is perpendicular with the axis of rotation of the Earth.

::For a separate, imaginative arrangement, if one could imagine a large pendulum structure that is mounted at the North Pole and free to not rotate with Earth (e.g., mounted on a platform that is free of the rotation (spin) of the Earth) but has long arms that allows the pendulum to swing at the Equator then the Earth's surface would move underneath the pendulum. The Earth doesn't rotate (turn) under the pendulum swing like at the North Pole but the equatorial plane rotates perpendicular to the pendulum swing. This is a very large pendulum and an idealized situation.

At intermediate latitudes:

The rotation of the Earth is observable in relation to the plane of the pendulum swing but the time to observe a full rotation depends on the latitude of the location. The time to observe a full rotation is equal to one day at the North Pole with the time increasing with decreasing latitude and not observable at the Equator (infinite length of time).

::The time increases because the central axis of the pendulum is aligned with the axis of rotation of the Earth at the North Pole and then the angle of misalignment increases as the latitude decreases to the point of perpendicularity at the Equator.

::The angular velocity that is imparted to the pendulum bob about the axis of the pendulum prior to release decreases with the cosine of the degree of misalignment of the central axis of the pendulum in comparison to the axis of rotation of the Earth (zero degrees of misalignment at the North Pole, cosine of zero degrees equals 1; 90 degrees of misalignment at the Equator, cosine of 90 degrees equals 0).

::This is equivalent to stating that the angular velocity that is imparted to the pendulum bob prior to release decreases with the sine of the latitude of the location (the sine of 90 degrees latitude equals 1; the sine of zero degrees latitude equals 0).

::When the bob is released there is no longer a force acting on the bob causing it to revolve about the central axis of the pendulum. That force that is no longer applied is less than that applied at the North Pole where axis are fully aligned.

::The time to observe a complete rotation of the Earth is inversely proportional to the angular velocity that is not imparted to the pendulum bob.

The statements above are thus equivalent to the inverse sine law for the observed time for a full rotation of the pendulum in relation to the rotation of the Earth.

Final Note: There is only one point of connection to the Earth for the swinging pendulum and that point of connection doesn't move in relation to the Earth.

ee also

*Foucault pendulum
*Coriolis effect

References

*Aczel, Amir. (2002). "Pendulum: Leon Foucault and the Triumph of Science". New York City: Atria Books. ISBN 0-7434-6479-6.

Wikimedia Foundation. 2010.

### Look at other dictionaries:

• Foucault pendulum vector diagrams — Several vector diagrams are often used to demonstrate the physics underlying the Foucault pendulum. Diagrams are provided to illustrate a pendulum located at the North Pole, equator, and 45 degrees N to show how the rotation of Earth in relation… …   Wikipedia

• Fictitious force — Classical mechanics Newton s Second Law History of classical mechanics  …   Wikipedia