text:
Angles between vectors

1. Jul 30, 2008

franky2727

how is this done? say angles between 2i -3j -k and 4i+2k-3j got an exam coming up soon and cant find the formula for it anywhere help please?

2. Jul 30, 2008

franky2727

and also is the cross product just the determinant?

3. Jul 30, 2008

Dick

A.B=|A||B|cos(t) (dot product). And you can USE a determinant to find the cross product. I wouldn't think of it as being primarily a determinant, it's a vector.

4. Jul 30, 2008

franky2727

so angles between is just |A||B|cos(t) and cross product is just using the det so for A=2i-3j-k and B=4i+2k-3j i would have angle between of root 14 root 29 cos(T) would that just be the answer? still confused on that one and for the cross product would the answer be 12i-2j+16k?

5. Jul 30, 2008

Dick

Yes. A.B=sqrt(14)*sqrt(29)*cos(T). So now if you can figure out A.B then you can find cos(T) and then T. I don't get what you get for the cross product. For example for the i component I figure (-3)(2)-(-3)(-1)=(-9).

6. Jul 30, 2008

franky2727

not a clue where that determinants coming from, how do you do the determinant of a 3 by 2 matrix

7. Jul 30, 2008

Dick

There is no such thing as the determinant of a 3x2 matrix. Check out http://en.wikipedia.org/wiki/Cross_product

8. Jul 30, 2008

franky2727

ahah got ya! right now just give me 5 minutes to get stuck on finding A.B and i'l be right back!

9. Jul 30, 2008

franky2727

sorry i still have no clue where your plucking them numbers from for the determinant isnt the determinant AD-BC but on your answer you seen to have done AB-CD

10. Jul 30, 2008

Dick

What are the second and third rows of your determinant? I can guess what you are doing wrong. Notice the components in vector B are written in the order ikj. Not ijk. I was wondering if it's a typo, but you repeated it twice, so I'm guessing that's how it's written in the problem.

11. Jul 30, 2008

franky2727

ye just me being dum thats a typo ment to be ijk so it is AD-BC ye?

12. Jul 30, 2008

Dick

I get [2, - 3, - 1] x [4, 2, - 3]=[11, 2, 16], if that's the problem you are trying to solve...

13. Aug 2, 2008

roam

Well, if the two vectors u and v that are nonzero (in $$R^{2}$$ or $$R^{3}$$) the angle between them is given by the formula;

$$\theta = cos^{-1}\left(\frac{u.v}{\left\|u\right\| \left\|v\right\|}\right)$$

In your question you have u = $$\left(2, - 3, - 1\right)$$ & v = $$\left(4, 2, -3)$$

But you have to put your equation system in the form of an argumented matrix!


text:
Publisher: APAV   (Total: 2 journals)   [Sort alphabetically]

 Showing 1 - 2 of 2 Journals sorted by number of followers Science & Philosophy       (Followers: 2) Ratio Mathematica
Similar Journals
 Ratio MathematicaNumber of Followers: 0     Open Access journal ISSN (Print) 1592-7415 - ISSN (Online) 2282-8214 Published by APAV  [2 journals]
• On the stability of a multiplicative type sum form functional equation

• Authors: Surbhi Madan, Shveta Grover, Dhiraj Kumar Singh
Pages: 7 - 18
Abstract:
In this paper we intend to discuss the stability of a sum form functional equation
\begin{align*}
\sum\limits\limits^n_{i=1}\sum\limits\limits^m_{j=1}f\left(p_iq_j\right)=\sum\limits\limits^n_{i=1}k\left(p_i\right)\sum\limits\limits^m_{j=1}q^{\beta }_j
\end{align*}
where $f, k$ are real valued mappings each having the domain $I$; $(p_1,\ldots,p_n)\in \Gamma_n$, $(q_1,\ldots,q_m)\in\Gamma_m$; $n\ge 3$, $m\ge 3$ are fixed integers and $\beta$ is a fixed positive real power different from 1 satisfying the conventions $0^{\beta }:= 0$ and $1^\beta:=1$.
PubDate: 2021-12-31
DOI: 10.23755/rm.v41i0.690
Issue No: Vol. 41 (2021)

• Encryption using semigroup action

Pages: 19 - 27
Abstract: Anencipheringtransformationisafunctionf thatconvertsanyplaintext message into a ciphertext message and deciphering transformation is a function f−1, which reverse the process. Such a set-up is calledacryptosystem. Inthispaper,weextendageneralizationofthe original Difﬁe-Hellman key exchange and ElGamal cryptosystem in (Z/pZ)∗ by constructing a semigroup action on a ﬁnite dimensional vector space T over F2.
PubDate: 2021-12-31
DOI: 10.23755/rm.v41i0.649
Issue No: Vol. 41 (2021)

• Result on b-metric space using alpha compatible mapping

• Authors: Thota Thirupathi, Veladi Srinivas
Pages: 28 - 44
Abstract: The object of this paper to prove a common fixed point theorem in b-metric space using alpha compatible and alpha continuous mappings. Furthermore our conclusions are supported by appropriate example.
PubDate: 2021-12-31
DOI: 10.23755/rm.v41i0.666
Issue No: Vol. 41 (2021)

• On decomposition of multistars into multistars

• Authors: T Reji, R Ruby
Pages: 45 - 52
Abstract: The multistar $S^{w_1,...,w_n}$ is the multigraph whose underlying graph is an $n$-star and the multiplicities of its $n$ edges are $w_1,..., w_n$. Let $G$ and $H$ be two multigraphs. An $H$-decomposition of $G$ is a set $D$ of $H$-subgraphs of $G$, such that the sum of $\omega(e)$ over all graphs in $D$ which include an edge $e$, equals the multiplicity of $e$ in $G$, for all edges $e$ in $G$. In this paper, we fully characterize $S^{1,2,3}, K_{1,m}$ and $S^{m^{l}}$ decomposable multistars, where $m^l$ is $m$ repeated $l$ times.
PubDate: 2021-12-31
DOI: 10.23755/rm.v41i0.681
Issue No: Vol. 41 (2021)

• An image compression method based on Ramanujan Sums and measures of
central dispersion

• Authors: S Sajikumar, J Dasan, V Hema
Pages: 53 - 63
Abstract: This paper introduces a simple lossy image compression method based on Ramanujan Sums cq(n) and the statistical measures of numerical data such as mean and standard deviation. The Ramanujan Sum cq(n) has been used in digital signal processing for a variety of applications nowadays. Some of them include the recently developed image kernels for edge detection, extraction of periodicity from signals, etc. The presented compression algorithm is an extension of the edge detection algorithm using an integer image kernel based on Ramanujan Sums. We propose a block-based compression algorithm that detects edges in the images using this image kernel and then compresses the image by storing kernel operation values, the mean and standard deviation for each block instead of pixel values. The proposed method has the advantage of low computational complexity and shows its ability in fast reconstruction and high compression that can be achieved for different block sizes.
PubDate: 2021-12-31
DOI: 10.23755/rm.v41i0.683
Issue No: Vol. 41 (2021)

• Estimation of fuzzy metric spaces from ordinary metric spaces

• Authors: P Kumar Senthil, Thiruveni Packirisamy
Pages: 64 - 70
Abstract: In this paper we estimate the new way for analyzing the fuzzy metric spaces from ordinary metric spaces using fuzzy fixed point theorem and vice versa. We derive some definitions and theorems for analyzing the metric spaces with new structure of fuzzy metric space using  fixed point theorems. Also we have given new examples for fuzzy metric spaces using   fixed point theorem.
PubDate: 2021-12-31
DOI: 10.23755/rm.v41i0.670
Issue No: Vol. 41 (2021)

• Blocks within the period of Lucas sequence

• Authors: Rima P. Patel, Dr. Devbhadra V. Shah
Pages: 71 - 78
Abstract: In this paper, we consider the periodic nature of the sequence of  Lucas numbers L_n defined by the recurrence relation L_n= L_(n-1)+L_(n-2); for all n≥2; with initial condition L_0=2 and L_1=1. For any modulo m>1, we introduce the ‘blocks’ within this sequence by observing the distribution of residues within a single period of Lucas sequence. We show that length of any one period of the Lucas sequence contains either 1,2 or 4 blocks.
PubDate: 2021-12-31
DOI: 10.23755/rm.v41i0.664
Issue No: Vol. 41 (2021)

• On extended quasi-MV algebras

• Authors: Mengmeng Liu, Hongxing Liu
Pages: 79 - 100
Abstract: In this paper, we introduce a new algebraic structure called extended quasi-MV algebras, which are generalizations of quasi-MV algebras. The notions of ideals, ideal congruences and filters in Equasi-MV algebras were introduced and their mutual relationships were investigated. There is a bijection between the set of all ideals and the set of all ideal congruences on an Equasi-MV algebra.
PubDate: 2021-12-31
DOI: 10.23755/rm.v41i0.680
Issue No: Vol. 41 (2021)

• Common fixed point theorems in complex valued fuzzy metric spaces

• Authors: Nazimul Islam
Pages: 100 - 118
Abstract: In this paper, we aim to prove some common fixed point theorems for pairs of any mappings, for pairs of occasionally weakly compatible mappings satisfying some conditions in complex valued fuzzy metric spaces.
PubDate: 2021-12-31
DOI: 10.23755/rm.v41i0.645
Issue No: Vol. 41 (2021)

• A Unified Shape Model For Sunspot Number Cycles

• Authors: GP Beena, A Sabarinath, AK Anilkumar
Pages: 119 - 136
Abstract: Modelling and prediction of sunspot number time series is an unavoidable activity in the space object re-entry prediction community. Different mathematical functions have been proposed in the literature as sunspot number cycle model, since the McNish-Lincoln regression fit.  Since many models are available in the literature, a new mathematical function which fits the sunspot number cycle does not add any additional value unless it have a greater predictive power or simplicity in model. Hence, we propose in this paper, a model which unify many models in literature and show that the shape of sunspot number cycle can be described as a product of a polynomial and a negative exponential function. The proposed model has certain free parameters, which need to be estimated from the observed sunspot number data. Since all the models reviewed in this paper are a product of a polynomial and a negative exponential along with a number of parameters, we have seen that all these models can be derived from a modified generalized Gamma probability density function by transforming certain parameters and fixing certain parameters. In this paper, we estimate the parameters of the model from the revised monthly averaged sunspot numbers available in the SIDC website. In addition, an attempt has been made to test the goodness of fit of the model using the coefficient of determination. Finally a preliminary level prediction have also been attempted to forecast the characteristics of sunspot number cycle 25.
PubDate: 2021-12-31
DOI: 10.23755/rm.v41i0.671
Issue No: Vol. 41 (2021)

• A characterization of strong fuzzy diameter zero in intuitionistic fuzzy
metric spaces

• Authors: Yahya Mohamed
Pages: 137 - 145
Abstract: Abstract: The idea of  Intuitionistic Fuzzy Metric Space introduced by Park (2004). In this paper, we introduce the notion of strong Intuitionistic Fuzzy diameter zero for a family of subsets based on the Intuitionistic fuzzy diameter for a subset of A. Then we introduce nested sequence of subsets having strong Intuitionistic fuzzy diameter zero using their Intuitionistic fuzzy diameter.
PubDate: 2021-12-31
DOI: 10.23755/rm.v41i0.661
Issue No: Vol. 41 (2021)

• Study of feedback queueing system with unreliable waiting server under
Multiple Differentiated Vacation Policy

• Authors: Rajni Gupta, Sangeeta Malik
Pages: 146 - 161
Abstract: This manuscript analyses a queueing system with Bernoulli schedule feedback of customers, unreliable waiting server under differentiated vacations. The unsatisfied customer may again join the queue with probability α, following Bernoulli schedule. The stationary solution is obtained for the model with aid of Probability Generating function technique. Some important system performance measures are derived and graphical behaviour of these measures with some parameters is analyzed. Finally to obtain the optimal value of service rate for the model, cost optimization is performed through quadratic fit approach.
PubDate: 2021-12-31
DOI: 10.23755/rm.v41i0.619
Issue No: Vol. 41 (2021)

• Perfect edge domination in vague graphs

• Authors: M Kaliraja, P Kanibose, Abdul Ibrahim
Pages: 162 - 172
Abstract: In this paper, we modified undirected vague graphs and edge domination set based on these two concepts. We study the notions of perfect edge domination, connected perfect edge domination of vague graph. Moreover, we investigate some related properties in these concepts with new results.
PubDate: 2021-12-31
DOI: 10.23755/rm.v41i0.588
Issue No: Vol. 41 (2021)

• Tikhonov type regularization for unbounded operators

• Authors: E Shine Lal, P Ramya
Pages: 173 - 180
Abstract: In this paper, we introduce a Tikhonov type regularization method for an ill-posed operator equation T x = y, where T is a closed densely defined unbounded operator on a Hilbert space H.
PubDate: 2021-12-31
DOI: 10.23755/rm.v41i0.663
Issue No: Vol. 41 (2021)

• The sequence of trifurcating Fibonacci numbers

• Authors: Parimalkumar A. Patel, Dr. Devbhadra V. Shah
Pages: 181 - 196
Abstract: One of the interesting generalizations of Fibonacci sequence is a k-Fibonacci sequence, which is further generalized into the ‘Bifurcating Fibonacci sequence’. In this paper we further generalize it into the sequence of ‘trifurcating Fibonacci numbers’. We obtain the Binet-like formula for these numbers. We also obtain the analogous of Cassini’s identity, Catalan’s identity, d’Ocagne’s identity and some fundamental identities for the terms of this sequence.
PubDate: 2021-12-31
DOI: 10.23755/rm.v41i0.668
Issue No: Vol. 41 (2021)

• On Cesàro's Means of First Order of Wavelet Packet Series

• Authors: Kumar Manoj, Shyam Lal
Pages: 197 - 205
Abstract: A novel theory on (C; 1); Cesàro's summability of order 1 of wavelet
packet series is obtained in this study.
PubDate: 2021-12-31
DOI: 10.23755/rm.v41i0.687
Issue No: Vol. 41 (2021)

• On the solutions of Pellian equation U^2-DV^2=K^2 N

Pages: 206 - 222
Abstract: In this paper we consider a class of Pell’s equation
U^2-DV^2=k^2 N, (1)
where D,N are positive integers, D is non-square and k is any integer. When (u,v) satisfy (1), we define (u+v√D)/k to be the solution of (1). We first introduce the class of solutions of (1) and call (u+v√D)/k to be the fundamental solution of the class, if v is the smallest positive value which occurs in the solutions of that class.
We first derive the necessary and sufficient condition for any two solutions of (1) to belong to the same class and the bounds for the values of u,v occurring in the fundamental solution. We also derive an explicit formula which gives all the solutions of (1). We further present some interesting recurrence relations connecting the values of u,v. Finally, we obtain the results for total number of positive solutions of (1) not exceeding any given positive real number Z.
PubDate: 2021-12-31
DOI: 10.23755/rm.v41i0.628
Issue No: Vol. 41 (2021)

• On the traversability of near common neighborhood graph of a graph

• Authors: Keerthi G Mirajkar, Anuradha V Deshpande
Pages: 207 - 213
Abstract: The near common neighborhood graph of a graph G, denoted by
ncn(G) is defined as the graph on the same vertices of G, two vertices
are adjacent in ncn(G), if there is at least one vertex in G not adjacent
to both the vertices. In this research paper, the conditions for ncn(G)
to be disconnected are discussed and also we present characterization
for graph ncn(G) to be hamiltonian and eulerian.
PubDate: 2021-12-31
DOI: 10.23755/rm.v41i0.626
Issue No: Vol. 41 (2021)

• Properties of an anti vague filter in BL-algebras

• Authors: Yahya Mohamed
Pages: 214 - 226
Abstract: ABSTRACTIn this paper, we introduce the notion of an anti vague filter of a BL-algebra with illustration, and obtain some related properties. Further, we investigate some equivalent conditions of anti vague filter.
PubDate: 2021-12-31
DOI: 10.23755/rm.v41i0.650
Issue No: Vol. 41 (2021)

• Some studies on products of Fuzzy soft graphs

• Authors: S Shashikala, Anil P Narappanavar
Pages: 227 - 254
Abstract: In this paper, alpha, beta and gamma product of two fuzzy soft graphs are defined. The degree of a vertex in these product fuzzy soft graphs are determined and its regular properties are studied.
PubDate: 2021-12-31
DOI: 10.23755/rm.v41i0.644
Issue No: Vol. 41 (2021)

• A dynamic model of typhoid fever with optimal control analysis

• Authors: Chinwendu Emilian Madubueze, Reuben Iortyer Gweryina, Kazeem Austin Tijani
Pages: 255 - 282
Abstract: In this study, a deterministic mathematical model of Typhoid fever dynamics with control strategies; vaccination, hygiene practice, sterilization and screening is studied. The model is first analyzed for stability in terms of the control reproduction number, Rc,  with constant controls. The disease-free equilibrium and endemic equilibrium of the model exist and are shown to be stable whenever Rc<1 and Rc>1  respectively. The model by investigation shows a forward bifurcation and the sensitivity analysis conducted revealed the most biological parameters to be targeted by policy health makers for curtailing the spread of the disease. The optimal control problem is obtained through the application of the Pontryagin maximum principle with respect to the above-mentioned control strategies. Simulations of the optimal control system and sensitivity of the constant control system confirm that hygiene practice with sterilization could be the best strategy in controlling the disease.
PubDate: 2021-12-31
DOI: 10.23755/rm.v41i0.657
Issue No: Vol. 41 (2021)

• Contra Nα -I-Continuity over Nano Ideals

• Authors: S Vijaya, P Santhi, A Yuvarani
Pages: 283 - 290
Abstract: In this paper, the conceptualization of Nα-I-open sets and Nα-I-continuous functions in Nano ideal Topology are used to study Contra-Nα-I-continuity. Also the characteristic and behaviours of Contra-Nα-I-continuity based on Nano-Urysohn space and Nano-Ultra Hausdrorff Space are discussed.
PubDate: 2021-12-31
DOI: 10.23755/rm.v41i0.651
Issue No: Vol. 41 (2021)

• Study of feedback retrial queueing system with working vacation, setup
time, and perfect repair

• Authors: Poonam Gupta
Pages: 291 - 307
Abstract: This manuscript analyses a retrial queueing system with working vacation, interruption, feedback, and setup time with the perfect repair. In the proposed model, the server takes vacation whenever the system gets empty but it still serves the customers at a relatively lower speed. The concept of power saving is included in the model. To save the power the server is turned off immediately on being empty at vacation completion instant. The customer who arrives when the system is turned off activates the server and he has to wait for his turn till the server is turned on. The unreliable server may sometimes fail to activate during setup. It is then sent for repair and repaired server immediately starts serving the waiting customers. Using probability generating function, explicit expressions for system size and different states of server for the model are obtained and results are analyzed graphically using MATLAB software.
PubDate: 2021-12-31
DOI: 10.23755/rm.v41i0.655
Issue No: Vol. 41 (2021)

JournalTOCs
School of Mathematical and Computer Sciences
Heriot-Watt University
Edinburgh, EH14 4AS, UK
Email: journaltocs@hw.ac.uk
Tel: +00 44 (0)131 4513762

format: plain


text:
7.1: Alkene Structure

Learning Objective

• describe the electronic structure of alkenes using Molecular Orbital (MO) Theory and Orbital Hybridization

Alkenes are a class of hydrocarbons (i.e., containing only carbon and hydrogen). They are unsaturated compounds with at least one carbon-to-carbon double bond. The double bond makes alkenes more reactive than alkanes. Olefin is another term used to describe alkenes. The alkene group can also be called a vinyl group and the carbons sharing the double bond can be called vinyl carbons.

Alkenes

Nomenclature of alkenes is covered in chapter 3. Condensed structural formulas for the first eight alkenes are listed in Table $$\PageIndex{1}$$ along with some relevant physical propoerties. Thus, CH2=CH2 stands for

The double bond is shared by the two carbon atoms and does not involve the hydrogen atoms, although the condensed formula does not make this point obvious. Note that the molecular formula for ethene is C2H4, whereas that for ethane is C2H6.

Structure of Ethene - the simplest alkene

Ethene is not a very complicated molecule. It is made up of four 1s1 hydrogen atoms and two 2s2 2$$p_x$$1 2$$p_y$$2 carbon atoms. These carbon atoms already have four electrons, but they each want to get four more so that they have a full eight in the valence shell. Having eight valence electrons around carbon gives the atom itself the same electron configuration as neon, a noble gas. Carbon wants to have the same configuration as Neon because when it has eight valence electrons carbon is at its most stable, lowest energy state, it has all of the electrons that it wants, so it is no longer reactive.

This forms a total of three bonds to each carbon atom, giving them an $$sp^2$$ hybridization. Since the carbon atom is forming three sigma bonds instead of the four that it can, it only needs to hybridize three of its outer orbitals, instead of four. It does this by using the $$2s$$ electron and two of the $$2p$$ electrons, leaving the other unchanged. This new orbital is called an $$sp^2$$ hybrid because that's exactly what it is, it is made from one s orbital and two p orbitals.

When atoms are an $$sp^2$$ hybrid they have a trigonal planar structure. These structures are very similar to a 'peace' sign, there is a central atom with three atoms around it, all on one plane. Trigonal planar molecules have an ideal bond angle of 120° on each side.

The H-C-H bond angle is 117°, which is very close to the ideal 120° of a carbon with $$sp^2$$ hybridization. The other two angles (H-C=C) are both 121.5°.

Rigidity in Ethene

There is rigidity in the ethene molecule due to the double-bonded carbons. A double bond consists of one sigma bond formed by overlap of sp2 hybrid orbitals and one pi bond formed by overlap of parallel 2 p orbitals. In ethene there is no free rotation about the carbon-carbon sigma bond because these two carbons also share a $$\pi$$ bond. A $$\pi$$ bond is only formed when there is adequate overlap between both top and bottom p-orbitals. Free rotation the p-orbitals cause them to be 90° from each other breaking the $$\pi$$ bond because there would be no overlap. Since the $$\pi$$ bond is essential to the structure of ethene it must not break, so there can be not free rotation about the carbon-carbon sigma bond. The two carbon atoms of a double bond and the four atoms attached to them lie in a plane, with bond angles of approximately 120° as shownn in the figure below

(a) The σ-bonded framework is formed by the overlap of two sets of singly occupied carbon sp2 hybrid orbitals and four singly occupied hydrogen 1s orbitals to form electron-pair bonds. This uses 10 of the 12 valence electrons to form a total of five σ bonds (four C–H bonds and one C–C bond).

(b) One singly occupied unhybridized 2pz orbital remains on each carbon atom to form a carbon–carbon π bond. (Note: by convention, in planar molecules the axis perpendicular to the molecular plane is the z-axis.)

The first two alkenes in Table $$\PageIndex{1}$$, ethene and propene, are most often called by their common names—ethylene and propylene, respectively (Figure $$\PageIndex{1}$$). Ethylene is a major commercial chemical. The US chemical industry produces about 25 billion kilograms of ethylene annually, more than any other synthetic organic chemical. More than half of this ethylene goes into the manufacture of polyethylene, one of the most familiar plastics. Propylene is also an important industrial chemical. It is converted to plastics, isopropyl alcohol, and a variety of other products.

Exercise

1. Although there is only one alkene with the formula C2H4 (ethene) and only one with the formula C3H6 (propene), there are several alkenes with the formula C4H8. Draw all of the possible bond line structures for alkenes with the formula C4H8 including all possible structural and stereoisomers.


text:
# Adjusting model output when the target is noisy

Imagine we have a binary classification model: predicting if a person $x$ is F (female) or M (male). However, the target variable that we observe (say, $y$) is noisy. So there is some other variable that we don't observe with the true value (say, $g$)

We don't know $g$, but we know the conditional distribution $P(g \mid y)$:

• $P(g = F \mid y = F) = 0.76$, $P(g = M \mid y = F) = 0.24$
• $P(g = F \mid y = M) = 0.20$, $P(g = M \mid y = M) = 0.80$

Additionally, we know the marginal distribution of $y$:

• $P(y = F) = 1/3$, $P(y = M) = 2/3$

Now we train a model $P(y \mid x)$ on these $y$ (say, logistic regression).

How can we correct the output of the model to account for the noise in the data? That is, how do we get $P(g \mid x)$ from $P(y \mid x)$ using $P(y)$ and $P(g \mid y)$?

• As I understand, $y$ is "observed sex" (noisy measure) and $g$ is actual sex. So what is $x$? – LmnICE Sep 13 '17 at 10:30
• $x$ is the person - i.e. the features that describe them – Alexey Grigorev Sep 13 '17 at 13:53
• So the model predicts $y$ from $x$, only $y$ is a noisy measure of $g$? Why not predict $g$ directly? – LmnICE Sep 13 '17 at 14:05
• Because $g$ is not available, only $P(g|y)$ is – Alexey Grigorev Sep 13 '17 at 14:07

As I understand the problem, the following joint distribution is given: $$p(g,y|x) = p(g|y)\,p(y|x) .$$ The right-hand side embodies the assumption $p(g|x,y) = p(g|y)$. It follows immediately that $$p(g|x) = \int p(g|y)\,p(y|x)\,dy .$$ In the binary case, this integral can be expressed as a sum: $$p(g=F|x) = p(g=F|y=F)\,p(y=F|x) + p(g=F|y=M)\,p(y=M|x) ,$$ with a similar expression for $p(g=M|x)$.

Perhaps I have misunderstood the problem, because I don't see any role for $p(y)$.

• probably the model (like logreg) will account for $p(y)$ – Alexey Grigorev Sep 14 '17 at 7:55

What you describe sounds like a state space model(SSM). Look at Kalman filter, which is the estimation approach for a specific case of SSM with Gaussian errors.

In a (simplified) Kalman filter you have: $$g_k = \mathbf{F}_k g_{k-1} + \mathbf{B}_k x_{k} + w_k$$ $$y_k = \mathbf{H}_k y_k + v_k$$ where $w,v$ - are errors.

Obviously, it's not exactly your problem because your errors are not Gaussian, and the dependent variable is discrete. However, there are discrete state space models, and I'm sure you can figure out how to apply them to your case.

The key here is that there's an observable state equation for $g$ and observable measurement equation for $y$. So the Kalman filter has two passes: filter and smoothing. Roughly, in the filtering pass you predict the next $y$, then in smoothing stage you estimate the $g$ including the information on discrepancy between the prediction and actual.

The problem was nicely described by @mef in another answer. It can be summarised by this graph:

In the graph, the first layer is your model for $P(y | x)$, and the second layer is your model for the relationship between $y$ and $g$, i.e. $P(g|y)$. In the end, you can get a model for the gender of each person:

\begin{align} P(g = M | x) &= \sum _{S = \{ M, F \}} P(g = M|y = S) \, \cdot \, P(y = S | x) \\ P(g = F | x) &= \sum _{S = \{ M, F \}} P(g = F|y = S) \, \cdot \, P(y = S | x) \end{align}

Filling in the model for $g$ given $y$,

\begin{align} P(g = M | x) &= 0.8 - 0.56 \cdot P(y = F | x) \\ P(g = F | x) &= 0.2 + 0.56 \cdot P(y = F | x) \end{align}


text:
# zbMATH — the first resource for mathematics

Approximate likelihood and probability calculations based on transforms. (English) Zbl 0542.62001
From the introduction: Let X be a random variable with distribution $$P_{\theta}$$ specified up to an unknown real parameter $$\theta$$. Likelihood methods, for example, require the evaluation of the density (p(x;$$\theta))$$ based forms $$\ell(x;\theta)=\log p(x;\theta)$$, $$S(x;\theta)=(\partial \log p(x;\theta))/\partial \theta$$, and $${\mathcal I}(\theta)=var\{S(X;\theta)\}.$$
In this paper we shall explore certain transform-based approximations to these forms which facilitate likelihood estimation; and the associated asymptotic methods, when p(x;$$\theta)$$ is unavailable or intractable. Also we shall consider the use of the exponential transformation of the approximation to $$\ell(x;\theta)$$ as an alternative to more familiar density approximations, such as the Edgeworth and Gram-Charlier expansions.
Reviewer: M.M.Rao

##### MSC:
 62A01 Foundations and philosophical topics in statistics 65C99 Probabilistic methods, stochastic differential equations 60E10 Characteristic functions; other transforms 62E99 Statistical distribution theory
Full Text:


text: Velocity must be measured in units of_____ m/s. $F_{x} = -\frac{dU}{dx}$ Graphically, this means that if we have potential energy vs. position, the force is … 1 joule is defined as the amount of energy transferred when a force of 1 Newton moves a 1 kg object a distance of 1 meter. If the potential energy function U(x) is known, then the force at any position can be obtained by taking the derivative of the potential. Potential energy is the energy possessed by an object in virtue of its position As we saw in UNIT 10, negative work done by a force removes kinetic energy from a system.. For example, a ball that is thrown upward, slows down due to the gravitational force. Mass must be measured in units of_____ kg. Learn the difference between kinetic energy and potential energy from the video below: The GPE formula GPE = mgh shows that it depends on the mass of the object, the acceleration due to … Potential energy is the stored energy an object has because of its position or state. a device used to measure voltage, or electrical potential energy difference. potential energy - stored energy that can come in a variety of forms such as spring, gravity, and chemical. Gravitational potential energy is the energy stored in an object due to its location within some gravitational field, most commonly the gravitational field of the Earth. ammeter. Kinetic and Potential Energy. Potential energy is stored energy while kinetic energy is the energy … Gravitational potential energy (GPE) is an important physical concept that describes the energy something possesses due to its position in a gravitational field. unit symbol cgs (abbrev.) Search. electric potential V, statvolt. (ms"2)!m=kg!m2!s"2=Joules Finally, back to gravitational potential energy Recall these units came out naturally from inductance L cm-1 s Answer: MKS. m is the mass in kilograms; g is the acceleration due to gravity; h is the height in meters; Unit. Unit 11 – Potential Energy and Energy Conservation Last Update: 05/122020. While there are several sub-types of potential energy, we will focus on gravitational potential energy. Physics of Energy II - 8 We can check that potential energy indeed has the units of energy É PE =mgh If the mass is measured in kilograms and the height in meters then the units of potential energy work out to be É kg! 17 terms. a device used to measure current in a circuit. What is potential energy? ... A unit of measure for all forms of energy. A bicycle on top of a hill, a book held over your head, and a stretched spring all have potential energy. a complete, unbroken path through which electric charges can flow. Gravitational potential energy has the same units as kinetic energy: kg m 2 / s 2 Note: All energy has the same units – kg m 2 / s 2, and is measured using the unit Joule (J). The SI unit for energy is called the joule (J). The standard unit for measuring potential energy is the joule, which is abbreviated as "J. Potential energy is one of several types of energy that an object can possess. ... the unit for measuring electrical current; the abbreviation is amp. They also talk about stored energy, which is Potential Energy. Another frequently encountered energy is potential energy, a type of energy that is stored in matter and released during a chemical reaction.. Teacher's Guide The Physics in Motion teacher toolkit provides instructions and answer keys for study questions, practice problems, labs for all seven units of study. How to Measure Potential Energy The standard unit for measuring potential energy is the joule, which is abbreviated as "J." energy, work E, W erg. Create. Force and Potential Energy. Joules. force F dyne. quizlette44076. Energy is defined as the capacity to do work or to produce heat. As discussed previously, kinetic energy is one type of energy and is associated with motion. Log in Sign up. electric circuit. Log in Sign up. "How is it different from kinetic energy? Conservative forces and Potential energy.


text:
# Picard groups and birational morphisms

Let $f:X\rightarrow Y$ be a birational morphism of projective varieties. Assume that $Pic(X)$ is a free abelian group generated by $n$ divisors $D_1,...,D_n$.

Under which hypothesis on $X$ and $Y$ is it true that then $Pic(Y)$ is the free abelian group generated by the divisors $D_i$ not contracted by $f$ ?

• What are your hypotheses on the singularities of $X$ and $Y$? You should at least assume that $Y$ is normal. – abx Nov 21 '16 at 15:33
• Sure we may assume that $X$ is smooth and $Y$ is normal. But I guess this is not enough, take for instance Y a quadric cone of dimension two. – Jessica_90 Nov 21 '16 at 15:36
• You should assume that $Y$ is locally factorial if you want this to hold. There are criteria for local factoriality in SGA 2, and there are other criteria that come out of the Minimal Model Program. – Jason Starr Nov 21 '16 at 17:52
• Thanks. If $Y$ is singular just in points and the singularities comes from contractions via $f$ of smooth subvarieties of $X$ of codimension greater or equal than two do we know that $Y$ is locally factorial ? – Jessica_90 Nov 21 '16 at 20:56
• @Jessica_90. "If $Y$ is singular just in points and the singularities come from contractions via $f$ of smooth subvarieties of $X$ of codimension greater or equal than two do we know that $Y$ is locally factorial?" If there is a contracted subvariety $Z$ of codimension greater than or equal to two, then you know that $Y$ is not locally factorial. I believe this result is originally due to Abhyankar (but I cannot find the reference). I learned this in Debarre's wonderful textbook. In the following link, it is Prop. 8.12, p. 85, math.ens.fr/~debarre/M2.pdf – Jason Starr Nov 22 '16 at 10:57

It's actually very easy to prove that if $Y$ is locally $\mathbb Q$-factorial (even a little weaker than locally factorial!), then for any point $y\in Y$ in the image of the exceptional set of any projective birational morphism $f:X\to Y$ that exceptional set has to contain a divisor whose image contains $y$, which is a bit weaker statement than that the exceptional set is of pure codimension $1$ (which I bet is what Debarre says in the reference given by Jason and it is also proved in Shafarevich's book), but it already proves Jason's comment (modulo assuming projective) that small (projective) morphisms produce not locally factorial singularities.
The proof (which is kind of fitting your setup) is as follows: Let $H$ be an effective Cartier divisor on $X$ which is not numerically trivial on a curve contracted to $y\in Y$ and consider $f_*H$; if $Y$ is locally $\mathbb Q$-factorial, then (perhaps after restricting to an open subset) some multiple of $f_*H$ is a Cartier divisor. Replacing $H$ with the same multiple we may assume that $f_*H$ is Cartier. Then $f^*f_*H$ is (numerically) trivial on any curve contracted by $f$ and hence by the choice of $H$, they cannot be equal. Therefore $f^*f_*H-H\neq 0$ is an (effective) exceptional divisor whose image contains $y$.
This proof actually shows that if $f$ is a small projective morphism (small means that the exceptional set has codimension at least $2$), then some of your generators on $X$ will likely not end up in the Picard group of $Y$.


text:
### How to compute the sum of ranks for each related group

Sum of ranks in group $i$
 Arrange your data in an $N \times k$ matrix, where the $N$ rows represent the $N$ blocks (usually the subjects), and the $k$ columns represent the $k$ related groups (usually the repeated measurements) For each row (subject) separately, arrange the observations from smallest to largest. The rank of an observation is its position in this ordered list. If there are ties, assign them the average of the ranks they occupy The sum of ranks in group $i$ is the sum of rank scores in that group. That is, the sum of ranks in group $i$ is the sum of all the rank scores in the column for group $i$


text:
1. ## Linear ODE question

The question:

Solve the following Linear ODE:
$x\frac{dy}{dx} + (1 + x)y = 2$

My attempt:
$x\frac{dy}{dx} + y + xy = 2$
= $x(\frac{dy}{dx} + y) + y = 2$
= $\frac{dy}{dx} + 2y = \frac{2}{x}$

Integrating factor is:
$e^{2x}$

So we get:
$e^{2x}y = 2\int{\frac{1}{x}e^{2x} \ dx}$

Now at this point, Wolfram is giving me a weird solution to that integral. Have I made an error so far? I tried going further, but nothing resembles the answer at all. Any help would be great!

2. $\displaystyle x\,\frac{dy}{dx} + (1+x)\,y = 2$

$\displaystyle \frac{dy}{dx} + \left(\frac{1+x}{x}\right)\,y = \frac{2}{x}$.

So the integrating factor is $\displaystyle e^{\int{\frac{1+x}{x}\,dx}} = e^{\int{\frac{1}{x} + 1\,dx}} = e^{\ln{x} + x} = e^{\ln{x}}e^x = x\,e^x$.

Multiplying through gives

$\displaystyle x\,e^x\,\frac{dy}{dx} + x\,e^{x}\left(\frac{1+x}{x}\right)\,y = \frac{2x\,e^{x}}{x}$

$\displaystyle x\,e^x\,\frac{dy}{dx} + e^x(1+x)\,y = 2e^x$

$\displaystyle \frac{d}{dx}(x\,e^x\,y) = 2e^x$

$\displaystyle x\,e^x\,y = \int{2e^x\,dx}$

$\displaystyle x\,e^x\,y = 2e^x + C$

$\displaystyle y = \frac{2e^x + C}{x\,e^x}$.

3. $\displaystyle y'+\frac{1+x}{x}y=2/x$

$\displaystyle P(x)=\frac{1+x}{x} \ \ e^{\int P(x)dx}=e^{\int\frac{1+x}{x}dx}=e^{\ln{x}+x}=xe^x$

$\displaystyle Q(x)=2/x$

$\displaystyle \int\frac{dy}{dx}\left[e^{P(x)dx}y\right]=\int P(x)Q(x)dx$

4. Whoops, silly algebra mistake.

Thanks!


text:
# Tag Info

### What is the most convenient way to read definitions of in-memory symbols when we don't have the source files? (Spelunking tools)

In version 10.1, I've built something like Spelunk into GeneralUtilities. To use it, run ...
• 10.5k
Accepted

### Where can I get detailed information on how the Plot command works?

I can add to Mr.Wizard's answer that when InputForm is wrapped by any head like List (...
• 56.2k
Accepted

### Why Except is so slow as compared to equivalent RegularExpression?

Using StringPatternPatternConvert we can find the regexp into which Mathematica converts the original string expression: ...
• 56.2k
Accepted

### How was Mathematica built?

In the Mathematica book (5th edition), Stephen Wolfram writes the following (sec. 1.12.4): The Software Engineering of Mathematica Mathematica is one of the more complex software systems ever ...
• 64.5k
Accepted

### What's behind Method -> {"EquationSimplification" -> "Residual"}

This post contains several code blocks, you can copy them easily with the help of importCode. As mentioned in the comment above, the answer is hidden in this ...
• 52.5k
Accepted

### How was Nothing implemented?

Ok, I failed to find a duplicate so here is my comment: I don't know how Nothing is internally implemented but you can do something like this with ...
• 132k
Accepted

### What's the default colormap (or color scheme) used in mathematica?

"DefaultColorFunction" /. (Method/. ChartingResolvePlotTheme[Automatic, ContourPlot]) "M10DefaultDensityGradient" ...
• 349k
Accepted

### How to know the internal algorithms of functions like Predict or Classify?

If you want to have a description of the method used by a given ClassifierFunction you can do: ...

### Mathematica's morphological thinning algorithm

Prologue Some five years ago I have asked exactly this question to the Wolfram support people. Below I have taken their respective answers (one sentence for each ...
• 1,805
Accepted

### What algorithm do the Compress and Uncompress functions use?

It is using the zlib format followed by Base64 coding, and then preceding the resulting string with "1:". So to use it externally, you can strip the "1:", do Base64 decoding, and feed the result of ...
• 4,809

### What algorithm do the Compress and Uncompress functions use?

After a bit of poking around, it looks like the binary format is pretty simple to parse. Mark Adler's answer is correct - the strings Compress[] returns are just ...
• 613
Accepted

The definition used (motivated by exterior calculus) is as follows: Given a rectangular array $a$ of depth $n$, with dimensions $\{d, ..., d\}$ (so there are $n$ $d$'s) and a list $x = \{x_1, ..., ... • 5,635 20 votes Accepted ### Why does setting SyntaxInformation add a definition to DefaultValues In my view, the Mathematica front end would have needed a complete rewrite a long time ago to be in a shape where it can compete with modern UI's. Looking at MATLAB, it's clear that you always find ... • 111k 19 votes Accepted ### What is behind experimental function: FindFormula? The Experimental function FindFormula[] at the moment is using a combination of different methods: it combines non linear regression with Markov chain Monte Carlo ... • 206 19 votes ### NDSolve uses different difference order for different spatial derivative when solving PDE Note: fix is broken since v11.3, a new question has been started aiming at upgrade it. Here's my approach for fixing the difference order. The key idea is ... • 52.5k 18 votes ### Is there a "precedence table" for the canonical Sort ordering? So I think the docs are mostly clear, if hard to visualize. Here's my version of such a table: ... • 45.5k 18 votes ### How to determine BLAS/LAPACK implementation used internally for numerical matrix operations? As indicated in the comments, machine-precision linear algebra operations in Mathematica use the Intel MKL library optimized implementation of BLAS/LAPACK. That is the case for all platforms where ... • 25.1k 17 votes Accepted ### Why is FreeQ so much faster for some specific variable names? TLDR: If you run into performance issues related to symbol names, rename your symbols such that SystemPrivate`GetContentCode returns different values for each ... • 7,666 17 votes ### What's the principle behind the new MoleculeRecognize function? Using ResourceFunction["PrintDefinitions"][MoleculeRecognize], one can determine that the source implementation is MolVec. The specific source code is: ... • 12.6k 17 votes ### How do the functions Reap and Sow actually work behind the scenes? I do not know how Sow and Reap are actually implemented, but to show you that it isn't magic, I can provide the following toy ... • 95.6k 16 votes ### What algorithms does NSolve use? In at least the univariate case, the guess of "Newton-Raphson" is not too far off. Daniel mentions the three possible methods supported by NSolve[]/... 16 votes ### How does Mathematica calculate$\sin(\pi/5)\$?

In the course of answering this question, I ran into a little bit of weirdness that doesn't square with my experience with previous versions of Mathematica. I think writing this answer is as good a ...
Accepted

### How does Mathematica solve a certain differential equation?

@Nasser's method seems to be what Mathematica does internally. The following gives hints of the steps taken, and one can see the elements of Nasser's solution. Some is left to the user to guess. The ...
• 216k
Accepted

### How does Mathematica calculate the Standard error during a non linear fit?

Rather than give formulas here is how to duplicate the results (coefficient estimates and standard errors) from NonlinearModelFit. First show the example from <...
• 34.1k
Accepted

### What stopwords list is the Wolfram language using?

A little spelunking of the code for DeleteStopwords[] yields the internally used stopword list: ...
Accepted

### Evaluated vs. unevaluated Association

Summary The confusion we observe here is largely due to ambiguous use of the symbol Association as an expression head. On the one hand, ...
• 67k

### Where can I get detailed information on how the Plot command works?

As far as I know the specific output format of Plot (and similar commands) is not documented. I believe it has changed between versions therefore any post-...
• 264k
Accepted

### Show how Mathematica defines a function

This isn't necessarily how these functions are implemented, but MathematicalFunctionData gives a way to access definitions that are equivalent to the ones ...
• 33k
Accepted

### How does FunctionDomain work?

Evaluate ((x - 2) (x + 1))/((x - 2) (x + 3)) and see what it gives. It automatically simplifies to (1 + x)/(3 + x). The second ...
• 225k


text:
# Wannier function in tight-binding model

• A

## Summary:

Relation between Wannier function and linear combination of atomic orbitals (LCAO) in tight-binding model
What is the relation between Wannier function and LCAO in tight-binding (TB) model? I know in TB we use LCAO but why we have an alternative approch using Wannier function? For example as said in this lecture note:

An alternative approach to the tight-binding approximation is through Wannier functions. These
are defined as the Fourier transformation of the Bloch wave functions
But I don't understand why we use wannier function? Or in general why we use a Fourier transform of a function?

MathematicalPhysicist
Gold Member
For your general question, usually calculations made on the Fourier transform give indication on how to find the energy levels of the system by using Parseval's theorem.

Rzbs
Thanks

DrDu
Wannier functions are a kind of localized functions which evidently can also be calculated in a LCAO approach. So I don't think this is an alternative method of calculation, but rather representation. Note that the full wavefunction in Hartree Fock is invariant under arbitrary unitary transformations of the occupied orbitals.

Rzbs
Thanks;
I need more explanation; we use both atomic orbitals and Wannier function in Tight-binding model; when we use atomic orbitals and when we use Wannier functions? Is it true to say Wannier functions is a better way because they are Fourier transform of Bloch wave functions?!

MathematicalPhysicist
Gold Member
Thanks;
I need more explanation; we use both atomic orbitals and Wannier function in Tight-binding model; when we use atomic orbitals and when we use Wannier functions? Is it true to say Wannier functions is a better way because they are Fourier transform of Bloch wave functions?!
Have you read Ashcroft and Mermin's discussion of Wannier functions on pages 187-189?

Have you read Ashcroft and Mermin's discussion of Wannier functions on pages 187-189?
Because I'm reading this book I have these questions. I've read these pages but I didn't understand what are Wannier functions is so I searched to find another book or lecture note to explain these functions in more details. But I became more confused:(

MathematicalPhysicist
MathematicalPhysicist
Gold Member
Because I'm reading this book I have these questions. I've read these pages but I didn't understand what are Wannier functions is so I searched to find another book or lecture note to explain these functions in more details. But I became more confused:(
I can sympathize with your efforts.
I also tried doing a thesis based MSc in maths and physics but failed miserably...
2020 miserable year...

MathematicalPhysicist
Gold Member
BTW, is there anyone here who wants to solve the problems in Ashcroft and Mermin that don't have solutions in the web?

At least I didn't find solutions to all the problems in A&M.

Once we have solved the electronic structure problem, we have the Bloch waves, then we are able to Fourier transform the Bloch to Wannier. But how can we solve the electronic structure problem? Using atomic orbitals as basis set for expansion of the Bloch waves is one of the solution.

Rzbs


text:
# Undefined control sequence error with moderncv [closed]

When I use these commands to display a bibliography in a moderncv document I get an Undefined control sequence error.

\nocite{*}
\bibliographystyle{plain}
\bibliography{publications}

This is the error message:

! Undefined control sequence.
\ref@jnl #1->{\jnl@style
#1}
l.17 \newblock {\em \mnras
}, 370:529--558, August 2006.

The \mnras macro is defined in a style file aas_macros.sty that is imported in the preamble. The exactly same commands work well when I use the article document class. What could be going on?

## closed as unclear what you're asking by Mensch, Stefan Pinnow, user31729, Zarko, egregAug 21 '16 at 19:46

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• The code please! – user11232 Jan 17 '14 at 2:12
• It is going to be a bit difficult for people to figure this out unless you give them some relevant information. What's in the macros file, for example? Please give a Minimum (non-)Working Example people can play around with. This will enable people to help you more effectively. – cfr Jan 17 '14 at 2:12


text:
# Thread: f:\mathbb{N}\to S

1. ## f:\mathbb{N}\to S

$f:\mathbb{N}\to S$

Where $S:\{s\in S| \ s=2p+1, \ p\in\mathbb{Z}\}$

I need to define a 1-1 function.

$f(n)=\begin{cases}n, & \text{when n is odd}\\?, & \text{when n is even}\end{cases}$

I haven't been able to think of something that will produce negative odd integers from even natural numbers.

2. ## Re: f:\mathbb{N}\to S

Better, one-to-one and onto function from $\mathbb{N}$ to $S$:

$f(n)=\frac{(-1)^n}{2}(-2n+(-1)^n+1)$

Therefor, $|S|=\aleph_0$


text:
# The probability that A hits a target is $\frac14$ and that of B is $\frac13$. If they fire at once and one hits the target, find $P(\text{A hits})$

The probability that A hits a target is 1/4 and the probability that B hits a target 1/3. They each fire once at the target.

If the target is hit by only one of them, what is the probability that A hits the target?

I know that this is an independent event. If I do P(A hitting) * P(B not hitting) then (1/4)(2/3) = 1/6 But when I look at the back of my book the answer is 2/5? My book is known to give wrong answers because it is quite old; therefore, I am left with self doubt. Can anyone tell me if I have the correct answer or if I am actually making a mistake?

• This is a conditional probability. Letting $A$ be the event that player $A$ hit the target (in a single shot) and $B$ the event that $B$ hit the target (in a single shot), then what you calculated was $Pr(A\cap B^c)$. What you were told to calculate was $Pr(A\mid (A\cap B^c)\cup (A^c\cap B))$, i.e. the probability that $A$ hit the target given that exactly one of them hit the target. – JMoravitz Sep 26 '17 at 4:07
• You might like this explanation of why the formulas being posted here work: arbital.com/p/bayes_rule/?l=1zq – Davislor Sep 26 '17 at 14:51
• Would also add the comment that the book is likely not full of mistakes because it is old, but that because it is old the mistakes have been found. New books are not necessarily more correct, they just haven't been around long enough for the mistakes to be as well known. Old does not imply bad. – Jared Smith Sep 26 '17 at 15:39
• The probability of A hitting and B not hitting is 1/6 when it is also possible that they both hit or both miss. But in this case, it is not possible for them both to hit or both to miss, so the probability must be greater than 1/6. (If you don't see why, imagine rolling a die. The probability of 1 coming up is 1/6, but only because there are 5 other possibilities. If you roll a die and the result is not a 3, 4, 5, or 6, now the probability it's a 1 is 1/2.) – David Schwartz Sep 26 '17 at 18:42

\begin{align} P(\mbox{target is hit once}) &= P(\mbox{A hitting}) \cdot P(\mbox{B not hitting}) + P(\mbox{A not hitting}) \cdot P(\mbox{B hitting}) \\ &= \frac{1}{4}\cdot\frac{2}{3} + \frac{3}{4}\cdot\frac{1}{3} \\ &= \frac{5}{12} \end{align}

So, $$P(\mbox{A hitting | target is hit once}) = \frac{P(\mbox{A hitting}) \cdot P(\mbox{B not hitting})}{P(\mbox{target is hit once})} = \dfrac{\frac{1}{6}}{\frac{5}{12}} = \frac{2}{5}.$$

• I would change the LHS of the last line to "$P(\text{A hitting}|\text{target is hit once})$, to be more explicit that we're using conditional probability here. – JiK Sep 26 '17 at 8:18

Your answer is not correct because you did not account for the case where only B hits, which has probability $\frac13×\frac34=\frac14$. Then the required probability is $$\frac{\frac16}{\frac14+\frac16}=\frac25$$ as the book gives.

The answer is indeed 2/5 I believe.

\begin{align} \mathbb{P}[\text{A hit | only one hit}] &= \frac{\mathbb{P}[\text{A hit} \,\cap\, \text{only one hit}]}{\mathbb{P}[\text{only one hit}]} \\ &= \frac{\mathbb{P}[\text{A hit}\,\cap\,\text{B didn't hit}]}{\mathbb{P}[\text{A hit}\,\cap\, \text{B didn't hit}] + \mathbb{P}[\text{A didn't hit}\,\cap\, \text{B hit}]} \\ &= \frac{1/4 \cdot 2/3}{1/4 \cdot 2/3 + 3/4 \cdot 1/3} \\ &=\frac{2}{5} \end{align}

Without using the conditional probability formula:

There are four cases:

1. Both miss
2. A hits and B misses
3. B hits and A misses
4. Both hit

We're only interested in (2) and (3). (2) has probability $\frac{1}{4}*\frac{2}{3} = \frac{1}{6}$. (3) has probability $\frac{1}{3}*\frac{3}{4}=\frac{1}{4}$. And we need $\frac{(2)}{(2) + (3)}$.

• What's the last formula if not the conditional probability formula? – JiK Sep 26 '17 at 16:48
• @JiK common sense – MattPutnam Sep 26 '17 at 17:42

The probability that only one person hits the target is $$1/4 * 2/3 + 1/3 * 3/4 = 5/12$$ The first event occurs when A hits and B misses, and the second when B hits and A misses. So if only one hit occurs, A hits 2/5 of the time and B 3/5 of the time.

This is an application of Bayes's law. You have a theory: A hit the target. You have data: there's only one hit. What is the probability your theory is true, given the data? 2/5. If you saw two bullet holes, then your theory would be true with probability 1 because A had to hit the target, given those data.

• We don't consider $P(\text{only one hit}|\text{A hit the target})$ or $P(\text{only one hit}|\text{A didn't hit the target})$ explicitly, so I don't see how this is an application of Bayes's law. – JiK Sep 26 '17 at 8:20


text:
Our Discord hit 10K members! 🎉 Meet students and ask top educators your questions.Join Here!

An aerosol can contains 400. mL of compressed gas at 5.20 atm. When all of the gas is sprayed into a large plastic bag, the bag inflates to a volume of 2.14 L. What is the pressure of gas in the plastic bag? Assume a constant temperature.

$$\begin{array}{l}{\text { Here, the temperature is constant and the amount of aerosol used is constant i.e. number of }} \\ {\text { moles of aerosol is constant. }} \\ {\text { As per Boyle's law, at given temperature and number of moles, pressure of the gas is inversely }} \\ {\text { proportional to volume. }} \\ {\text { P } \alpha \frac{1}{V}} \\ {P=\frac{\text { Constant }}{V}} \\ {\text { PV }=\text { Constant }} \\ {P_{1} V_{1}=P_{2} V_{2}=\text { Constant }}\end{array}$$$$\begin{array}{l}{\text { Where, } P_{1}, V_{1} \text { represents initial pressure and volume and } P_{2}, V_{2} \text { represent final pressure and }} \\ {\text { volume. }} \\ {\text { Given that an aerosol can contains } 400 \mathrm{mL}\left(\mathrm{V}_{1}\right) \text { of compressed gas at } 5.20 \mathrm{atm}\left(\mathrm{P}_{1}\right) \text { . It is }} \\ {\text { sprayed into a plastic bag. The bag inflates to a volume of } 2.14 \mathrm{L}\left(\mathrm{V}_{2}\right) . \text { Substitute these values in }} \\ {\text { the above equation. }} \\ {\qquad 2.14 \mathrm{L} \times 5.20 \mathrm{atm}} \\ {=0.97196 \mathrm{atm}} \\ {=0.972 \mathrm{atm}}\end{array}$$$$\text { The final pressure of the gas in the plastic bag is about } 0.972 \text { atm }$$

Kinetics

Gases

Discussion

You must be signed in to discuss.
TD

Carleton College

Stephen P.

Drexel University

Allea C.

University of Maryland - University College

KS

Video Transcript

problem. 47 says that an aerosol can containing 400 milliliters of compressed gas at 5.2 atmospheres is expelled into a large plastic bag with a volume of 2.14 leaders. So this problem asks you what the pressure of the gas is once it leaves, you can into the plastic bag. So the way that you can solve this iss, Um uh, by using properties of gas where, um, the the pressure and the volume, um, scale together and are equivalent across two systems if you're, you know, talking about the same the same gas. So in this case, it's almost exactly like I'm familiar with the c one of you once he to be thio equation. Where if you're making certain chemicals in the lab, um, the ultimately the concentration in the volume from one solution to the other, um have, uh, proportional relationships. So we can use this equation then and the information given to us from the problem thio to solve essentially for, um, uh, P, too. So in the aerosol can we know that the pressure is 5.20 atmospheres and we know that the can has a 400 militar volume. So the first thing that we can do here is convert this Miller leaders two liters by introducing this conversion factor, you know, that we want to solve for, um, Pete to here. And we have a volume of this plastic bag at 2.14 liters. So basically, uh, we can just solve through, um by dividing each side by 2.14 leaders giving us at the pressure of this plastic bag or pee too. ISS 0.972 atmospheres.

University of Pittsburgh - Main Campus

Topics

Kinetics

Gases

TD

Carleton College

Stephen P.

Drexel University

Allea C.

University of Maryland - University College

KS


text:
Convert 4-sat to 3-sat

I want to know in general how can I convert $4-SAT$ to 3-SAT.

And I have a specific case that if you can help me optimize it to 3-SAT it will be greate.

I want to do this so I be able to use sat solvers programs.

$(C \lor A \lor D) \land (C \lor B \lor D) \land (\lnot C \lor A \lor \lnot D) \land (\lnot C \lor B \lor \lnot D) \land (C \lor \lnot A \lor \lnot B \lor \lnot D) \land (\lnot C \lor \lnot A \lor \lnot B \lor D)$

Every clause is of the form $(x_1 \vee x_2 \vee x_3 \vee x_4)$, where $x_i$, $i \in [4]$ is a literal. Replace every such clause with two clauses $(x_1 \vee x_2 \vee z) \wedge (\neg z \vee x_3 \vee x_4)$, where $z$ is a fresh variable. You can then verify that if some setting of $x_i$'s satisfies the original clause, you can find a setting of $z$ such that the two clauses are satisfied.


text:
# Should I always be using Module in functions unless I explicitly want global variables?

I define functions a ton. In the past, I've mostly just defined my functions like:

myFunc[var1_]:=(
var2=var1^2;
Return@var2;
)

And I haven't run into too much trouble. If I wanted to be really careful for some applications, I might use Clear[] to clear a variable I'm about to use.

I'm now starting to use Module like so:

myFunc[var1_]:=Module[{var2},
var2=var1^2;
Return@var2;
]

But it doesn't seem that necessary in this short example, because var2 is immediately being assigned a value anyway.

Is it good practice to always use Module when defining functions?

• The problem is not so much that when not localized, var2 may be in danger inside your function (which may also happen if var2 has a global value and you are not careful), but that you export this variable with its value into global namespace, after you call your function, and thereby pollute that namespace. When the code base grows larger, sooner or later this will cause trouble in some completely unrelated part. So, yes, do use Module or With for cases like that - this is exactly what they are for. – Leonid Shifrin Sep 21 '16 at 20:35
• Whenever possible, use With. Use Block and Module if you know why you need it (Module if you need to modify a variable multiple times, Block if you need to undefine something). – masterxilo Sep 22 '16 at 1:41

The short answer is "yes", we should always use Module to localize any intermediate variables within our functions.

We might get away with using global variables for everything in an ad hoc, interactive session. But as we accumulate function definitions that we wish to re-use repeatedly over time, the chances of this practice causing problems increases dramatically.

To see this, let's consider a small scenario.

We start by defining a function:

myfunc1[x_] :=
( t1 = 3 x
; t2 = 2 x
; {t1, t2}
)

myfunc1[10]
(* {30, 20} *)

Some time later, we define another function:

myfunc2[x_] :=
( t1 = {4 x}
; t2 = {3 x, 2 x}
; Join[t1, t2]
)

myfunc2[10]
(* {40, 30, 20} *)

Later still, we realize that the computation of t2 within myfunc2 is just the same as the computation performed by myfunc1. We decide to change myfunc2 to use myfunc1 to ensure that these functions stay in synch as we make changes:

myfunc2[x_] :=
( t1 = {4 x}
; t2 = myfunc1[x]
; Join[t1, t2]
)

Alas, this will give us a strange and unexpected result:

myfunc2[10]
(* Join[30, {30, 20}] *)

What happened? The problem is that both myfunc1 and myfunc2 use the same global variable t1 for intermediate results. myfunc2 initially sets t1 to the expected value ({40}), but myfunc1 subsequently smashes over that value with its own intermediate result (30). Join expects two lists but gets confused when its first argument is the integer 30.

Bugs likes this are insidious. In tiny examples like this it can be easy to find and fix the conflicting variable (t1), but once the number of functions grows it can become very difficult indeed. Furthermore, we need to come up with an ever-growing list of unique global variable names to hold intermediate results.

Here we were lucky: the answer was manifestly incorrect. But imagine now that the expressions in question were complex numeric computations. What if the answer were just out by a little bit? Would we even spot the problem? And if we did, what if it were only after a large number of iterations of a long chain of function calls? Which function(s) in that chain had variable conflicts?

The remedy, of course, is to use Module so that our intermediate variables do not conflict:

myfunc1[x_] :=
Module[{t1, t2}
, t1 = 3 x
; t2 = 2 x
; {t1, t2}
]

myfunc2[x_] :=
Module[{t1, t2}
, t1 = {4 x}
; t2 = myfunc1[x]
; Join[t1, t2]
]

myfunc2[10]

(* {40, 30, 20} *)

Using Module, we can name our intermediate variables whatever we like without having to keep track of whether we have ever used those names somewhere else.

Even though I said earlier that we might be able to get away without using Module during ad hoc interactive usage, I suggest that we should get into the habit of using Module routinely. An ad hoc session might very well be long and productive, involving the creation of many functions. The chance of conflict, and burden of coming up with unique names, both grow along with the number of functions. And one never knows whether any particular function might turn out to be worth keeping around for a long time (e.g. added to our init.m file, or some package we create).

• Great answer. I feel happy for my decision to not expand my comment, since I probably wouldn't be able to articulate this so well. – Leonid Shifrin Sep 22 '16 at 1:31
• What is the DISadvantage of using Module? Unless your function consists of a single line of code containing a single expression that calculates the single result of the function, Module can only make the purpose and implementation of the function clearer. – Ralph Dratman Sep 28 '16 at 5:38
• @RalphDratman I do not think there are any disadvantages to using Module in the present context which is concerned with a change in imperative coding style away from global variables towards using local variables. A wider discussion might need to consider issues such as the performance impact of Module if used in an application hotspot, or Module's reduced relevance if one transitions to a less imperative and more functional or concatenative coding style. However, I suggest that such wider discussion is out of scope for the present question. – WReach Sep 28 '16 at 16:08

## Disclaimer

The following is non-standard, probably contentious and possibly not apt for scenarios I haven't encountered but I have found the simplification this practice introduces so useful for building large code bases that I thought I'd share it.

I now never use With, Module and only v. occasionally use Block. It's all the way with Let.

myFunc[var1_]:=Let[
var2=var1^2,
var2
]

myFunc[2]
(* 4 *)

For mine, this is cleaner, shorter and more expressive and an idiom that seems to serve all my encapsulation needs (including with Dynamic). It also has the advantage of naturally handling the very common case of both cascading local definitions

 myFuncC[var1_] := Let[
var2 = var1^2,
var3 = var2^2,
{var2, var3}
]

myFuncC[2]
(* 4, 16 *)

as well as simultaneous local definitions

myFuncS[var1_] := Let[
{varA, varB} = {var1^2, var1^3},
foo[varA, varB]]

myFuncS[2]
(* foo[4,8] *)

Well the latter two use-cases were the original motivation behind Let's definition so it is of course really With (and variants) in disguise but even this extra layer on top of With comes in handy for implementing "dynamic debugging" and in unit testing by adding hooks into Let's definition.

I've adopted Let for awhile now without any issues at all but for all responsibility and maintenance take it up with the original author - Leonid :)

Very occasionally I'll use Block when needing to block a previous definition or preserve an old data structure but I shy away from any global idiom not only because of WReach's answer in describing how old values can unexpectedly intrude but also because in basic debugging/refactoring the cognitive overhead quickly mounts by having to follow more convoluted control flows.

The one exception is in building complex dynamical interfaces where the notion of a global variable makes more sense but in this case due to Dynamic/DynamicModule's semantics, IMO, an entirely new idiom using Let is needed.

The supposed use-cases for Module (changing local variables, defining local functions) I don't find persuasive. Nested changing of local variables IMO is better handled with an explicit recursive function while I don't bother with local functions since I find it makes for convoluted, less-maintainable code (not even mentioning the identified leakage, scoping and Dynamic issues). Smaller, helper functions called in Let in my experience can be more conveniently defined outside its scope.

I find these non-local helper definitions perfectly safe in an interactive session for initial experimentation/prototyping (where function-colliding is much less likely than variable-colliding). By the time function-colliding might become an issue, the code has long migrated into a package where the helpers sit safely encapsulated and ready for "public usage" if broader use is subsequently required. RIP Module.

## Aside

Well OK, there is a certain situation where I need to resurrect Module. It is when a local data structure needs to be generated as in the following pseudo(ish) code.

f[a_, b_] = someHelperFunction[a, b];

myFuncP[args___] := Module[
{lds = GenerateLocalDataStructure[args]},
Let[
a = preProcessing1@args,
b = preProcessing2@args,
c = somePosition@args,
\[FilledSquare];
lds = MapAt[f[a, b], c]@lds
]]

Note this involves the only wrinkle with Let that you sometimes have to be aware of - without \[FilledSquare] Let thinks it owns lds. The ; tells Let, that its local defining is over and hence that lds actually belongs to Module. (hence \[FilledSquare] is just a dummy expression - it could be anything followed by a ; - its chosen here for code readability).

Note also, that this wrinkle doesn't arise if there was a way of (mutably) modifying a datastructure that didn't use Set - see these comments. This IMO is another argument for the practice for not overloading Set where reasonable (as suggested by Leonid in that discussion) and another use for the introduction of something like @=. With the latter defined in a .m file no \FilledSquare is needed and in my set up the above looks like:

myFuncS[args___] := Module[
{lds = GenerateLocalDataStructure[args]},
Let[
a = preProcessing1@args,
b = preProcessing1@args,
c = somePositionInlds@args,
lds @= MapAt[f[a, b], c]
]]

WL's functional nature means that local variables tend to arise arise more often that local data structures. Largish data structures typically get passed in as a (held) argument and therefore with scoping that Let can't touch. This is perhaps why, in my experience, this use-case of semi-persistent, local data structures rarely arises. RIPurgatory Module.

• +1... on the topic of scoping macros, I'll throw in a pitch for withSetup from this answer ;) – WReach Sep 22 '16 at 12:18
• @WReach I had wondered what drawbacks their might be to this holus-bolus adoption of Let (hence slightly trolling answer) including perhaps memory management. While your withSetup was designed to enhance Module's memory management I was immediately struck by the potential upside from processing local variables behind the scenes (i.e. not just the debugging mentioned in the my answer but also – Ronald Monson Sep 23 '16 at 1:29
• memory management/profiling etc). I've often thought that the whole process of profiling/regression testing/coverage in Mma could be automated using lexical information that already exists. Having the cleanest, easiest, way to do sequential/multiple assignments encourages a very fine granularity needed in large code bases (as previously discussed by Mr. Wizard/Leonid) which in turn would facilitate this automation by adding such structured information. So yes a broader pitching ... :) – Ronald Monson Sep 23 '16 at 1:36