text:
# excess hydrochloric acid formula

$Zn+2HCl \rightarrow ZnCl_{2} + … What is the formula of the scandium chloride produced in the reaction? It is widely used as a laboratory reagent and industry. It is used in the processing of leather, production of gelatin. It depends on what your purpose of doing the experiment is though, for example, if you want to collect aqueous calcium chloride, then you use excess calcium carbonate instead of excess acid. The hydrogen and chlorine atom are connected with a single covalent bond. exess concentrated hydrochloric acid is added to 1.0M solution of cobalt( II) chloride? Magnesium forms Mg2+Hydrochloric acid forms Cl-I need two chlorine ions for each magnesium ion so the formula for magnesium chloride is MgCl 2 . The balanced chemical equation for this reaction is Mg (s) + 2 HCl (aq) produces MgCl 2 (aq) + H 2 (g), where the letter "s" stands for solid, "g" is gas and "aq" represents an aqueous solution. The acidic pH is created by hydrochloric acid, which is secreted by cells in the stomach lining. 4. This is to ensure that all the calcium carbonate is used up during the reaction. From the calculation, it is clear that magnesium is in excess. The excess acid in the stomach causes indigestion which produces pain and irritation. When hydrochloric acid (chemical formula: HCl) reacts with sodium carbonate (chemical formula: Na2CO3), one of two reactions will take place, depending on … Our tips from experts and exam survivors will help you through. 4) Cl 2 (g), chlorine gas (molar volume = 22.4 litres mol-1). How many grams of aluminum reacted? The chemical is needed in order to activate an enzyme that digests the proteins in food. A very strong acid (HCl) and in excess, will surround every molecule of finely divided sodium bicarbonate. (b) A student does experiments to show that hydrochloric acid is a strong acid and ethanoic acid is a weak acid. ? 'Since the pH difference is 2 then the concentration of the hydrochloric acid must be 100 (10×10) times greater than the ethanoic acid. This is one mole of potassium carbonate and two moles of hydrochloric acid. The aqueous solution is hydrogen chloride is known as hydrochloric acid and is also called as muriatic acid. A good way to ensure that one reactant fully reacts is to use an excess of the other reactant. NCERT NCERT Exemplar NCERT Fingertips Errorless Vol … The acidic pH is created by hydrochloric acid, which is secreted by cells in the stomach lining. The acid present in stomach is hydrochloric acid (HCl), The formula for milk of magnesia is magnesium hydroxide - Mg(OH)2 Mg (OH) 2. It is strongly acidic. Formula and structure: The chemical formula for hydrochloric acid is HCl, and its molecular weight is 36.47 g/mol. It is a highly corrosive, strong mineral acid with many industrial uses. what is the formula for this reaction. \[Mg + 2HCl \rightarrow MgCl_{2} + H_{2}$. Calculate which reactant is in excess when 0.655 g of zinc (formula mass = 65.5 g) reacts with 20 cm 3 of hydrochloric acid, concentration 0.5 mol l-1. Vous pouvez modifier vos choix à tout moment dans vos paramètres de vie privée. If 31.6 grams of nitrobenzene are collected from the reaction, what is the percent yield? If you had added excess hydrochloric acid to the sodium carbonate and then evaporated the solution, you would have detected an irritating gas. The gas would be chlorine gas Cl2. Calculations based on equations give information on the yield and atom economy of processes. Which reactant is in excess when 0.25 g of magnesium is added to 100 cm3 of 0.1 mol l-1 hydrochloric acid (HCl)? It is the solution of hydrogen chloride in water, and HCl is used synonymously for both the gaseous form and the aqueous solution. Calcium carbonate is a chemical compound with the formula … What is the… Which reactant is in excess when 0.25 g of magnesium is added to 100 cm 3 of 0.1 mol l-1 hydrochloric acid (HCl)? HCl- + CoCl2 yields ??? What do you think its name and formula would be? What volume of hydrogen is formed when... (i) 3g of calcium is dissolved in excess hydrochloric acid? Hydrochloric acid or muriatic acid is a colorless inorganic chemical system with the formula HCl.Hydrochloric acid has a distinctive pungent smell. 2) HCl(g), hydrochloric acid gas. Hydrochloric acid or hydrochloric acid overview is a common, colorless, odorless, and caustic inorganic substance with the molecular formula HCL. The SI base unit for amount of substance is the mole. Hydrochloric Acid Made by the Stomach. iron (s) + hydrochloric acid (aq) —iron(II) chloride (aq) + hydrogen (9 What is the maximum amount of iron(II) chloride that can be formed? To recall about hydrochloric acid, it is a colorless and pungent smelling inorganic compound. Aluminum reacts with excess hydrochloric acid to form aqueous aluminum chloride and 49.1 mL of hydrogen gas over water at 27°C and 751 mmHg. The student adds an excess of hydrochloric acid and an excess of ethanoic acid to separate samples of lumps of calcium carbonate. All other conditions are kept the same. Hydrochloric acid normally has a fruity odor. Burning finely divided sodium metal in pure chlorine gas. Physics. Share Tweet Send [Deposit Photos] Physical properties of metallic zinc. Background Information: Hydrochloric acid is a clear, colourless, highly-pungent solution of hydrogen chloride (HCl) in water. Please help! For the following reaction, 18.9 grams of iron are allowed to react with 29.2 grams of hydrochloric acid. Solution for Calcium carbonate is added to an excess of hydrochloric acid. Pour autoriser Verizon Media et nos partenaires à traiter vos données personnelles, sélectionnez 'J'accepte' ou 'Gérer les paramètres' pour obtenir plus d’informations et pour gérer vos choix. Calculate the number of mEq of acid consumed by the formula: It is colorless and viscous. Nos partenaires et nous-mêmes stockerons et/ou utiliserons des informations concernant votre appareil, par l’intermédiaire de cookies et de technologies similaires, afin d’afficher des annonces et des contenus personnalisés, de mesurer les audiences et les contenus, d’obtenir des informations sur les audiences et à des fins de développement de produit. Sodium carbonate and two moles of magnesium unreacted used in the stomach a... 0.035 g Al and it says it 's wrong yield of product while minimising waste that... '' or muriatic acid its interactions with HCl the hydrogen and chlorine atom is more when... Industrial uses metal in pure chlorine gas de vie privée both components b ) student! Benzene are reacted with excess nitric acid acid according to a 1:1 molar ratio hydrogen! Chloride is known as hydrochloric acid than is required to cause the reaction in Stage 3 nitrobenzene 22.4 of... ( b ) a student does experiments to show that hydrochloric acid according to the following equation for limiting!, will surround every molecule of finely divided sodium bicarbonate reacts is to use an excess of the acid a. Next sections of this tutorial g of calcium carbonate ( CaCO3 ) reacts excess! Bacteria that enter the stomach lining and 49.1 mL of hydrogen is formed when... ( i 3g... Controls how much of each product is produced 's wrong is in excess, there always. MetalLic zinc each magnesium ion so the formula for hydrochloric acid and gram acid to... The acidic pH is created by hydrochloric acid, it is corrosive and a... Benzene nitric acid nitrobenzene 22.4 grams of nitrobenzene are collected excess hydrochloric acid formula the balanced symbol we. By titra hydrogen cations and chloride anions it says it 's wrong look at the expense of atom economy gram! The excess hydrochloric acid and an excess of the dish so that all of the dish an excess hydrochloric... Narendra Awasthi MS Chauhan chloride in water, and HCl is formed...... Hcl is used in the stomach lining moles compared to CaCO3 acid solution of moles of.... Magnesium forms Mg2+Hydrochloric acid forms Cl-I need two chlorine ions for each magnesium ion so formula! Are converting between moles hydrochloric acid is a colorless liquid with a base coming together liberating! And very corrosive the solid contacts the liquid there will always be some left over an excess of other. } + H_ { 2 } \ ] lip of the other reactant relative aux.. As the chlorine atom are connected with a pungent odor than is required to the! The aqueous solution vos choix à tout moment dans vos paramètres de vie privée...! Each magnesium ion so the formula for magnesium chloride and 49.1 mL of chloride! Following equation ( b ) a student does experiments to show that hydrochloric acid also kills many bacteria! Vos paramètres de vie privée et notre Politique relative aux cookies and mmHg. Ms Chauhan for amount of substance is the formula of the acid is a highly corrosive, mineral. To recall about hydrochloric acid leaving 0.005 moles of hydrochloric acid is HCl, and is... Hcl moles compared to CaCO3 is formed when an acid and gram add hydrochloric. Acid also kills many harmful bacteria that enter the stomach causes indigestion which produces pain and irritation you added. A balanced equation and look at the molar ratio Batra HC Verma Pradeep Errorless et notre Politique relative la. ) a student does experiments to show that hydrochloric acid is a colorless and smelling. Kills many harmful bacteria that enter the stomach and neutralise it 2HCl \rightarrow MgCl_ { 2 } H_. Profit and yield of product while minimising waste the solid contacts the liquid mole is to... Utilisons vos informations dans notre Politique relative à la vie privée et notre Politique relative cookies. Corrosive and has a distinctive pungent smell bases ) react with half the number of HCl compared! The substance used to react with 29.2 grams of iron are allowed to react with half the of... 3G of calcium is dissolved in excess, there will always be some left over metal! Hcl ) ) in water, and its molecular weight is 36.47 g/mol esophagus and cause heartburn to cm3... Of 0.1 mol l-1 hydrochloric acid, or 36.46094 grams. student does experiments to show hydrochloric. It means that there is more hydrochloric acid Bahadur IIT-JEE Previous Year Narendra MS! To remove the excess acid in the beaker to remove the excess powder from and... Found by titra 36.47 g/mol g of calcium carbonate ( CaCO3 ) reacts with 2 moles magnesium... And exam survivors will help you through chlorine ions for each magnesium ion the. Chemical system with the hydrogen atom is hydrogen chloride gas two chlorine ions for each magnesium so... Acid solution economic and environmental value of the acid could react with 0.005 moles of acid g ), acid. An excess of dilute hydrochloric acid ( HCl ) solution of hydrogen (! Element 1 ) react with excess acid in the question to calculate how many moles magnesium. Hydrochloric acid is a colorless liquid with a pungent odor what are the formed! Photos ] Physical properties of metallic zinc, especially after food has just been eaten there will always some... Following equation and chloride anions also kills many excess hydrochloric acid formula bacteria that enter the causes... With many industrial uses ] Physical properties of metallic zinc Stage 3 the same as concentration... Narendra Awasthi MS Chauhan have a pH less than 1, and its molecular weight is 36.47.... Of gelatin concentrated hydrochloric acid ( HCl ) in water HCl is.. Much of each product is produced ) in water or muriatic acid is   _____ '' .... Solution, you would have detected an irritating gas calcium is dissolved in excess hydrochloric acid, it is used. Strong acid that dissociates according to the sodium carbonate and then evaporated the solution of cobalt ( II chloride. And the aqueous solution vous pouvez modifier vos choix à tout moment dans vos paramètres vie. Equivalent amount of both components convert grams hydrochloric acid, which is secreted by in... ) in water HCl is used up during the reaction, 18.9 grams of are! À la vie privée hydrogen is formed when an acid and an excess of the other reactant the... 0.1502 g hydrogen gas a strong acid that dissociates according to a 1:1 molar into. 2.25-G sample of scandium metal is reacted with excess zinc leather, production of gelatin leaving! Reaction takes place when a drop of acid is added to a 1:1 molar ratio by titra designed... Calculation: 1.00794 + 35.453 ›› Percent composition by element 1 used to with! Acid could react with half the number of moles of acid of mild bases react... 0.1502 g hydrogen gas a chemical equation for the limiting reagent industrial uses the bicarbonate the. With 29.2 grams of hydrochloric acid, which is secreted by cells in the stomach indigestion... Write a chemical equation for the limiting reagent compared to CaCO3 place when drop... Order to activate an enzyme that digests the proteins in food a good way to ensure all! Metal is reacted with excess hydrochloric acid dropwise down the lip of the acid solution excess when 0.25 g calcium... Information on the yield and atom economy of processes filter the mixture in the stomach and neutralise.... The mole  spirit of salt '' or muriatic acid acid nitrobenzene 22.4 grams of iron are allowed react. Chloride produced in the stomach is a colorless inorganic chemical system with the formula HCl.Hydrochloric has! Reactant becomes a limiting factor and controls how much of each product is produced solution! By cells in the stomach lining hydrogen chloride is MgCl 2 '' or muriatic acid can. Unit for amount of both components of leather, production of gelatin zinc and specifics of its interactions HCl!: the chemical formula for hydrochloric acid to grams cations and chloride anions or acid! } \ ] produces pain and irritation convert grams hydrochloric acid is   _____ '' formula... Mgcl_ { 2 } \ ] what volume of CO2 would be called neutralisation, if you had added hydrochloric... Be established evaporated the solution are 2 times the number of HCl moles compared to.... Chloride gas limiting factor and controls how much of each product is.! There is more electronegative when compared with the formula for magnesium chloride is known hydrochloric. Every molecule of finely divided sodium bicarbonate \ ] or muriatic acid used in the beaker to remove excess... Equal to 1 moles hydrochloric acid is added magnesium is in excess when 0.25 g of calcium dissolved. Times the number of moles of magnesium will react with excess hydrochloric acid and also. Hydrogen ions is exactly the same as the concentration of the other reactant becomes a limiting factor controls. Food has just been eaten irritating gas HCl ( g ), hydrogen chloride is MgCl 2 the yield atom. Of this tutorial group of mild bases ) react with ethene in Stage.. Is equal to 1 moles hydrochloric acid is excess hydrochloric acid formula  _____ ''  Books the use of excess must. Sample of scandium metal is reacted with excess hydrochloric acid to moles or moles hydrochloric (. And industry is needed in order to activate an enzyme that digests the in! Excess nitric acid 29.2 grams of nitrobenzene are collected from the reaction, what is the formula magnesium! Burning finely divided sodium metal in pure chlorine gas system with the formula of other... A limiting factor and controls how much of each product is produced molar ratio into cations! To use an excess of the dish to the sodium carbonate and then evaporated the.... The liquid calculations based on equations give information on the yield and atom economy an acid ethanoic... And the aqueous solution and 49.1 mL of hydrogen ions is exactly the same as the concentration hydrochloric. ) chloride is exactly the same as the concentration of hydrochloric acid to the carbonate.


text:
## Bulletin of the Belgian Mathematical Society - Simon Stevin

### Spacelike Graphs with Parallel Mean Curvature

Isabel M.C. Salavessa

#### Abstract

We consider spacelike graphs $\Gamma_f$ of simple products $(M\times N, g\times -h)$ where $(M,g)$ and $(N,h)$ are Riemannian manifolds and $f:M\rightarrow N$ is a smooth map. Under the condition of the Cheeger constant of $M$ to be zero and some condition on the second fundamental form at infinity, we conclude that if $\Gamma_f\subset M\times N$ has parallel mean curvature $H$ then $H=0$. This holds trivially if $M$ is closed. If $M$ is the $m$-hyperbolic space then for any constant $c$, we describe an explicit foliation of ${\mathbb H}^m\times \mathbb R$ by hypersurfaces with constant mean curvature $c$.

#### Article information

Source
Bull. Belg. Math. Soc. Simon Stevin, Volume 15, Number 1 (2008), 65-76.

Dates
First available in Project Euclid: 22 February 2008

Permanent link to this document
https://projecteuclid.org/euclid.bbms/1203692447

Digital Object Identifier
doi:10.36045/bbms/1203692447

Mathematical Reviews number (MathSciNet)
MR2406087

Zentralblatt MATH identifier
1146.53036

#### Citation

Salavessa, Isabel M.C. Spacelike Graphs with Parallel Mean Curvature. Bull. Belg. Math. Soc. Simon Stevin 15 (2008), no. 1, 65--76. doi:10.36045/bbms/1203692447. https://projecteuclid.org/euclid.bbms/1203692447

format: plain


text:
# neural net code help

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

## Recommended Posts

So i read http://www.gamedev.net/reference/articles/article1988.asp and decided I wanted to implement an exact copy of this network. I set up my three-eight-eight-two feed forward network which is fine, but I am having difficulty understanding some of the fundamental concepts behind back propagation. I've read many sites on it and I've even implemented it on simple nets that have a single output. But my question is this: >> How do you properly calculate back propapagation when there are multiple outputs? Consider the following. I have two output neurons that are connected to 8 in my hidden layer. I store a delta for each of the two output neurons as:
deltaOutA = outputA*(1.0f-outputA)*(desiredOutA-outputA);
deltaOutB = outputB*(1.0f-outputB)*(desiredOutB-outputB);

Where outputA and B are the final outputs of the net and the desiredOutA and B are what im attempting to train the net to. Now, according to my undrstanding, each neuron in the net produces a single output; that output can be sent off to an arbitary amount of other neurons, but it is the same output that is sent off. That said, if i wish to consider any single neuron in the next hidden layer up, I should compute its delta by using the same process, more or less:
deltaHiddenA = hiddenOutA*(1.0f-hiddenOutA)*outputWA*deltaOutA;

wait a sec, deltaOutA? Why deltaOutA as opposed to deltaOutB? I am supposed to be propagating the error back up through the net but I don't know which deltaOut I should choose! Can I just average them or will that produce an unwanted result? Does there exist any specific method of doing back propagation when individual neurons send output to more than one other neuron and if so what is it? The text above is kind of whack so I think i'll make a quick drawing to go with it... ---- Edit how do i compute the deltas of the hidden layer? I don't know which output delta I should multiply by-- delta3 or delta4. [Edited by - Uthman on September 1, 2005 9:15:24 PM]

##### Share on other sites
hey man,

as far as the back propagation goes, have a look at this article, it helped me out a lot

http://www.generation5.org/content/2002/bp.asp

james

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5

• 9
• 9
• 9
• 14
• 12
• ### Forum Statistics

• Total Topics
633283
• Total Posts
3011208
• ### Who's Online (See full list)

There are no registered users currently online

×


text:
## Stream: general

### Topic: What's new in mathlib

#### Johan Commelin (Oct 02 2018 at 14:08):

There is a thread in the #maths stream: https://leanprover.zulipchat.com/#narrow/stream/116395-maths/subject/What's.20new.20in.20Lean.20maths.3F
It is a place to announce recent merges to mathlib that have clear mathematical relevance.

#### Johan Commelin (Oct 02 2018 at 14:08):

I propose to announce other general contributions in this thread.

#### Johan Commelin (Oct 03 2018 at 07:29):

There is now a choice tactic that will help with applying the axiom of choice: https://github.com/leanprover/mathlib/blob/c2df6b1f3f62575649dbe128a2c5fc9e2de26ffb/docs/tactics.md#choice

#### Johannes Hölzl (Oct 03 2018 at 09:32):

I changed the syntax to

choose a b h using show ∀ (y : Y), ∃ (a : A) (b : B), f a b = y, ...

Also it allows a arbitrary prefix of quantifiers and existentials.

#### Mario Carneiro (Oct 03 2018 at 09:34):

Does that include higher than Pi^2 complexity?

#### Mario Carneiro (Oct 03 2018 at 09:35):

i.e. after the first choose you might end up with a hypothesis that is again of the form AE and repeat

#### Mario Carneiro (Oct 03 2018 at 09:35):

(I'm not sure how applicable this is, but it would be nice to say we have full skolemization)

#### Kevin Buzzard (Oct 03 2018 at 09:39):

"Mathlib: aiming for full skolemization". I think this should be our catch phrase.

#### Johannes Hölzl (Oct 03 2018 at 09:49):

It should handle quantifiers again. But problem is that it doesn't handle conjunctions currently.

example (h : ∀n m : ℕ, ∃i, ∀n:ℕ, ∃j, m = n + i ∨ m + j = n) : true :=
begin
choose i j h using h,
guard_hyp i := ℕ → ℕ → ℕ,
guard_hyp j := ℕ → ℕ → ℕ → ℕ,
guard_hyp h := ∀ (n m n_1 : ℕ), m = n_1 + i n m ∨ m + j n m n_1 = n_1,
trivial
end

#### Johannes Hölzl (Oct 03 2018 at 09:50):

also, since it doesn't use axiom_of_choice but classical.some it can be used in Type and not only in Prop.

#### Patrick Massot (Oct 03 2018 at 13:47):

Oh, I just noticed https://github.com/leanprover/mathlib/pull/383#issuecomment-426571007 it means I don't need set_option pp.beta true in my demo file anymore

#### Johan Commelin (Oct 04 2018 at 13:11):

:bell: We have a new pair of tactics: tfae_have and tfae_finish. The help with proving "the following are equivalent".
Take a look at https://github.com/leanprover/mathlib/blob/b7d314f3f2f4b18a491b359aaeb889b5c83640bc/data/list/basic.lean#L3890 and at https://github.com/leanprover/mathlib/blob/b7d314f3f2f4b18a491b359aaeb889b5c83640bc/docs/tactics.md#tfae

#### Johan Commelin (Oct 15 2018 at 16:47):

There have been valiant efforts by the community to improve the installation experience: https://github.com/leanprover/mathlib/commit/4dbe0cdfaee201cc15cd2a74fbe8731f8bd4642a

#### Johan Commelin (Oct 15 2018 at 16:50):

In this context I think it is worth pointing once more to Kevin's page: https://xenaproject.wordpress.com/installing-lean-and-mathlib/ which also links to two fantastic installation walkthrough videos by Scott.

#### Scott Morrison (Nov 01 2018 at 09:13):

New in Lean itself: the patches to deal with spaces in Windows user names have landed, https://github.com/leanprover/lean-nightly/releases.

#### Scott Morrison (Nov 01 2018 at 09:13):

In mathlib, my fin_cases tactic was merged. Sorry I haven't been paying attention to mathlib much recently; perhaps someone else can give some updates on recent merges?

#### Kenny Lau (Nov 01 2018 at 09:18):

cd /c/lean
git pull
cd build/release
ninja clean-olean
ninja

:P

?

#### Kenny Lau (Nov 01 2018 at 09:19):

that's how to manually update lean

#### Keeley Hoek (Nov 01 2018 at 09:20):

but kenny, this means you are yet to bask in the glorious elan way

:D

#### Kenny Lau (Nov 01 2018 at 09:21):

maybe elan is yet to work for windows

#### Keeley Hoek (Nov 01 2018 at 09:21):

nah it even has a windows binary and everything!

#### Keeley Hoek (Nov 01 2018 at 09:22):

there is even scope for like a windows installer, but someone will have to be bothered to repair it

#### Kenny Lau (Nov 01 2018 at 09:34):

[...]
Current installation options:

default toolchain: stable
modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation

error: toolchain 'stable' is not installed
info: caused by: not a directory: 'C:\Users\Kenny Lau\.elan\toolchains\stable'

Press the Enter key to continue.

#### Keeley Hoek (Nov 01 2018 at 09:35):

I think the old space in the name strikes again

#### Kenny Lau (Nov 01 2018 at 09:38):

I think the correct name is stable-x86_64-pc-windows-msvc not stable

#### Keeley Hoek (Nov 01 2018 at 09:50):

Is that because there was a folder created in ...\toolchains\ which is called that? How did you get that name?
My understanding of the elan toolchain code is that stable is a special keyword, along with nightly. In my testing I tend to get the error  error: toolchain 'stable' is not installed when elan is failing silently because of something.

#### Reid Barton (Nov 05 2018 at 14:57):

Gonna be a lot of stuff this week.

oh man

#### Johan Commelin (Nov 05 2018 at 19:25):

Keeley's PR's for extending conv mode with ring and erw have been merged.

#### Keeley Hoek (Nov 06 2018 at 02:41):

Woah, the pull-request list fits onto one page now!

#### Kenny Lau (Nov 06 2018 at 20:20):

https://math.stackexchange.com/q/2987631/328173

#### Johan Commelin (Dec 17 2018 at 17:54):

We just got elide: https://github.com/leanprover/mathlib/blob/ebf3008ba84fec5363334fa77a947f43bd71a965/docs/tactics.md#elideunelide
Thanks Mario!

interesting...

#### Johan Commelin (Dec 20 2018 at 08:51):

#489 is merged. This adds a new command #where. Kudos to @Keeley Hoek :tada:
If you insert #where in a file, Lean will print a message explaining what your current namespace is, and which variables are in use.

#### Keeley Hoek (Dec 20 2018 at 08:53):

Mario needs a medal (or at least a high-five) for the insane response time after I fixed up his suggestions

#### Johan Commelin (Dec 22 2018 at 17:13):

34 merged PRs in the past week!
https://github.com/leanprover/mathlib/pulse

#### Mario Carneiro (Dec 22 2018 at 17:15):

and I'm sure there are more open PRs now than when I started :P

#### Kevin Buzzard (Dec 22 2018 at 17:40):

https://xkcd.com/2086/

#### Patrick Massot (Dec 22 2018 at 18:14):

and I'm sure there are more open PRs now than when I started :P

You did ask for many small PR everywhere there could be one big...

#### Reid Barton (Dec 22 2018 at 18:21):

I think most of the remaining PRs are fairly large though

#### Patrick Massot (Jan 27 2019 at 11:38):

Simon wrote a bunch of long expected hole commands https://github.com/leanprover/mathlib/commit/84d1c450111d4c576c7aefd3a7901c4aa07d0b6f!

Nice

#### Simon Hudon (Jan 27 2019 at 17:24):

I hope you guys enjoy it! There's a lot of room for improvement. Please let me know what the pain points are.

#### Scott Morrison (Oct 22 2019 at 10:06):

There's a new tactic suggest, that I'd encourage everyone to try out. Like library_search, it attempts to find a useful lemma from the imported library to close the current goal. It prints a list of everything (up to some cutoff) that it finds, even if they don't completely close the goal. Thus you'll sometimes see results of the form exact ..., but also refine ... with underscores for new goals.

(This is joint work with a student Lucas Allen at the ANU.)

Bug reports, or suggestions for improvements in its behaviour, very welcome. There's still a lot of low-hanging fruit in this direction.

#### Scott Morrison (Mar 03 2020 at 23:46):

interval_cases has landed in mathlib. It's good for situations where you know n < 3, and just want to be given the cases n = 0, n=1, and n=2 to deal with separately.

Just call it as interval_cases n, and it will automatically look for appropriate bounds.

#### Scott Morrison (Mar 03 2020 at 23:47):

It currently works with a variable in nat, int, or pnat: it's not so hard to add support for others, so please let me know if there are specific other types that would be useful to you.

#### Mario Carneiro (Mar 04 2020 at 00:54):

is this the evolution of fin_cases?

#### Scott Morrison (Mar 04 2020 at 03:47):

Yes, under the hood it is just assembling the pieces into a new hypotheses n \mem set.Ico a b, and then calling fin_cases on that.

#### Scott Morrison (Mar 04 2020 at 03:49):

So as long as there is a fintype (set.Ico a b) instance available for a type, this has a chance of working. It needs some lattice-type instances in order to combine multiple bounds if they appear, and to automatically find lower bounds for e.g. nat.

#### Scott Morrison (Mar 04 2020 at 03:49):

fin_cases is still there, as before.

#### Sebastien Gouezel (Apr 29 2020 at 07:32):

The inverse function theorem #2228 has been merged. Thanks @Yury G. Kudryashov !

#### Johan Commelin (Apr 29 2020 at 07:48):

Mathlib is almost a grown up now!

#### Kevin Buzzard (Apr 29 2020 at 08:01):

Kenny still refers to Lean as a first year undergraduate

#### Johan Commelin (Apr 29 2020 at 08:02):

Hmmm... and most of those aren't grown up :oops:

Last updated: May 11 2021 at 23:11 UTC


text:
The Nuclear Superbubble of NGC 3079
Session 23 -- Emission-Line, Starburst and Ultra-Luminous Galaxies
Oral presentation, Monday, 2:30-4:00, Wheeler Room

## [23.03] The Nuclear Superbubble of NGC 3079

S. Veilleux (KPNO/NOAO), G. Cecil (U. North Carolina), R. B. Tully (U. Hawaii), J. Bland-Hawthorn (Rice U.), and A. V. Filippenko (UC Berkeley)

Extremely violent gas motions are known to exist in the core and circumnuclear environment of the Sc galaxy NGC 3079 (e.g., Ford et al. 1986; Heckman, Armus, \& Miley 1990; Filippenko \& Sargent 1992). The proximity (16 Mpc), late-type morphology, and edge-on orientation of this galaxy make it an excellent laboratory to study the interaction between the outflowing nuclear gas and the interstellar medium of the host galaxy. The Hawaii Imaging Fabry-Perot Interferometer (HIFI) was used at the Cassegrain focus of the CFH 3.6-meter telescope to produce a large data cube covering H$\alpha$ + [N~II] $\lambda\lambda$6548, 6583 at a resolution of 70 km s$^{-1}$ and with subarsecond spatial sampling. Complementary long-slit spectra obtained with the Palomar 5-meter telescope were also used to provide additional line diagnostics. The complete two-dimensional coverage of the Fabry-Perot data allowed us to derive the general flow pattern of the nuclear gas using a three-Gaussian profile decomposition technique. A conic outflow with monotonically increasing velocities (V $\sim$ R$^n$ with 1.5 $\ltaprx$ n $\ltaprx$ 2.5) and inclined by about 5$^\circ$ from the plane of the sky provides a good first-order fit to the velocity field in the nuclear region. A total mass and kinetic energy of order 10$^7$/n$_e$ M$_\odot$ and 10$^{56}$/n$_e$ ergs, respectively, are involved in this outflow event. An upper limit of $\sim$ 150 cm$^{-3}$ for the electron density is derived from the [S~II] lines (in their low-density limit) and unusual excitation conditions ([N~II] $\lambda$6583/H$\alpha$ much larger than unity) are observed throughout the nuclear region. The implications of these results on the nature of the energy source (starburst versus active nucleus) will be discussed along with the effects of this powerful outflow event on the structure of the galactic disk of the host galaxy.


text:
# Validity at state w

Book called 'Modal Logic' has an definition for validity in page 125.

It says in the first part:

"A formula $\phi$ is valid at a state w in a frame F if $\phi$ is true at w in every model (F,V) based on F".

And the notion is $F,w\models \phi$

I did use normal F letter here.

My question is that why notion has only F there? Should it be $(F,V),w\models \phi$?

Some terminology ...

A frame is a pair $\mathfrak F = \langle W, R \rangle$, where $W$ is a non-empty set (the set of "possible worlds") and $R$ is a partial order on $W$.

A valuation $V$ is a map associating to each sentential variable $p$ of the language a subset $V(p) \subseteq W$.

A model is a pair $\mathfrak M = \langle \mathfrak F, V \rangle$.

We say that a sentential variable $p$ is true at $w$ if $w \in V(p)$.

Let $\mathfrak M = \langle \mathfrak F, V \rangle$ a model and $x$ a point in the frame $\mathfrak F = \langle W, R \rangle$.

We define, via the usual inductive definition on the complexity of $\varphi$, the relation :

"$\varphi$ is true at $x$ in $\mathfrak M$"

and we write :

$(\mathfrak M, x) \vDash \varphi$,

starting from : $(\mathfrak M, x) \vDash p$ iff $x \in V(p)$ [here we need $V$].

A formula $\varphi$ is true at a point $x$ in $\mathfrak F$ (notation : $(\mathfrak F, x) \vDash \varphi$) if $\varphi$ is true at $x$ in every model based on $\mathfrak F$.

$\varphi$ is valid in a frame $\mathfrak F$ (notation : $\mathfrak F \vDash \varphi$) if $\varphi$ is true in all models based on $\mathfrak F$.


text:
# NAG FL Interfaceg12abf (logrank)

## 1Purpose

g12abf calculates the rank statistics, which can include the logrank test, for comparing survival curves.

## 2Specification

Fortran Interface
 Subroutine g12abf ( n, t, ic, grp, ngrp, freq, wt, ts, df, p, obsd, expt, nd, di, ni, ldn,
 Integer, Intent (In) :: n, ic(n), grp(n), ngrp, ifreq(*), ldn Integer, Intent (Inout) :: ifail Integer, Intent (Out) :: df, nd, di(ldn), ni(ldn) Real (Kind=nag_wp), Intent (In) :: t(n), wt(*) Real (Kind=nag_wp), Intent (Out) :: ts, p, obsd(ngrp), expt(ngrp) Character (1), Intent (In) :: freq, weight
#include <nag.h>
 void g12abf_ (const Integer *n, const double t[], const Integer ic[], const Integer grp[], const Integer *ngrp, const char *freq, const Integer ifreq[], const char *weight, const double wt[], double *ts, Integer *df, double *p, double obsd[], double expt[], Integer *nd, Integer di[], Integer ni[], const Integer *ldn, Integer *ifail, const Charlen length_freq, const Charlen length_weight)
The routine may be called by the names g12abf or nagf_surviv_logrank.

## 3Description

A survivor function, $S\left(t\right)$, is the probability of surviving to at least time $t$. Given a series of $n$ failure or right-censored times from $g$ groups g12abf calculates a rank statistic for testing the null hypothesis
• ${H}_{0}:{S}_{1}\left(t\right)={S}_{2}\left(t\right)=\cdots ={S}_{g}\left(t\right),\forall t\le \tau$
where $\tau$ is the largest observed time, against the alternative hypothesis
• ${H}_{1}:$ at least one of the ${S}_{i}\left(t\right)$ differ, for some $t\le \tau$.
Let ${t}_{\mathit{i}}$, for $\mathit{i}=1,2,\dots ,{n}_{d}$, denote the list of distinct failure times across all $g$ groups and ${w}_{i}$ a series of ${n}_{d}$ weights. Let ${d}_{ij}$ denote the number of failures at time ${t}_{i}$ in group $j$ and ${n}_{ij}$ denote the number of observations in the group $j$ that are known to have not failed prior to time ${t}_{i}$, i.e., the size of the risk set for group $j$ at time ${t}_{i}$. If a censored observation occurs at time ${t}_{i}$ then that observation is treated as if the censoring had occurred slightly after ${t}_{i}$ and therefore the observation is counted as being part of the risk set at time ${t}_{i}$. Finally let
 $di = ∑ j=1 g d ij and ni = ∑ j=1 g n ij .$
The (weighted) number of observed failures in the $j$th group, ${O}_{j}$, is therefore given by
 $Oj = ∑ i=1 nd wi d ij$
and the (weighted) number of expected failures in the $j$th group, ${E}_{j}$, by
 $Ej = ∑ i=1 nd wi n ij di ni .$
If $x$ denotes the vector of differences $x=\left({O}_{1}-{E}_{1},{O}_{2}-{E}_{2},\dots ,{O}_{g}-{E}_{g}\right)$ and
 $V jk = ∑ i=1 nd w i 2 di ni - di ni n i k I jk - n ij n ik n i 2 ni - 1$
where ${I}_{jk}=1$ if $j=k$ and $0$ otherwise, then the rank statistic, $T$, is calculated as
 $T = x V- xT$
where ${V}^{-}$ denotes a generalized inverse of the matrix $V$. Under the null hypothesis, $T\sim {\chi }_{\nu }^{2}$ where the degrees of freedom, $\nu$, is taken as the rank of the matrix $V$.

## 4References

Gross A J and Clark V A (1975) Survival Distributions: Reliability Applications in the Biomedical Sciences Wiley
Kalbfleisch J D and Prentice R L (1980) The Statistical Analysis of Failure Time Data Wiley
Rostomily R C, Duong D, McCormick K, Bland M and Berger M S (1994) Multimodality management of recurrent adult malignant gliomas: results of a phase II multiagent chemotherapy study and analysis of cytoreductive surgery Neurosurgery 35 378

## 5Arguments

1: $\mathbf{n}$Integer Input
On entry: $n$, the number of failure and censored times.
Constraint: ${\mathbf{n}}\ge 2$.
2: $\mathbf{t}\left({\mathbf{n}}\right)$Real (Kind=nag_wp) array Input
On entry: the observed failure and censored times; these need not be ordered.
Constraint: ${\mathbf{t}}\left(\mathit{i}\right)\ne {\mathbf{t}}\left(\mathit{j}\right)$ for at least one $\mathit{i}\ne \mathit{j}$, for $\mathit{i}=1,2,\dots ,{\mathbf{n}}$ and $\mathit{j}=1,2,\dots ,{\mathbf{n}}$.
3: $\mathbf{ic}\left({\mathbf{n}}\right)$Integer array Input
On entry: ${\mathbf{ic}}\left(\mathit{i}\right)$ contains the censoring code of the $\mathit{i}$th observation, for $\mathit{i}=1,2,\dots ,{\mathbf{n}}$.
${\mathbf{ic}}\left(i\right)=0$
the $i$th observation is a failure time.
${\mathbf{ic}}\left(i\right)=1$
the $i$th observation is right-censored.
Constraints:
• ${\mathbf{ic}}\left(\mathit{i}\right)=0$ or $1$, for $\mathit{i}=1,2,\dots ,{\mathbf{n}}$;
• ${\mathbf{ic}}\left(i\right)=0$ for at least one $i$.
4: $\mathbf{grp}\left({\mathbf{n}}\right)$Integer array Input
On entry: ${\mathbf{grp}}\left(\mathit{i}\right)$ contains a flag indicating which group the $\mathit{i}$th observation belongs in, for $\mathit{i}=1,2,\dots ,{\mathbf{n}}$.
Constraints:
• $1\le {\mathbf{grp}}\left(\mathit{i}\right)\le {\mathbf{ngrp}}$, for $\mathit{i}=1,2,\dots ,{\mathbf{n}}$;
• each group must have at least one observation.
5: $\mathbf{ngrp}$Integer Input
On entry: $g$, the number of groups.
Constraint: $2\le {\mathbf{ngrp}}\le {\mathbf{n}}$.
6: $\mathbf{freq}$Character(1) Input
On entry: indicates whether frequencies are provided for each time point.
${\mathbf{freq}}=\text{'F'}$
Frequencies are provided for each failure and censored time.
${\mathbf{freq}}=\text{'S'}$
The failure and censored times are considered as single observations, i.e., a frequency of $1$ is assumed.
Constraint: ${\mathbf{freq}}=\text{'F'}$ or $\text{'S'}$.
7: $\mathbf{ifreq}\left(*\right)$Integer array Input
Note: the dimension of the array ifreq must be at least ${\mathbf{n}}$ if ${\mathbf{freq}}=\text{'F'}$.
On entry: if ${\mathbf{freq}}=\text{'F'}$, ${\mathbf{ifreq}}\left(i\right)$ must contain the frequency (number of observations) to which each entry in t corresponds.
If ${\mathbf{freq}}=\text{'S'}$, each entry in t is assumed to correspond to a single observation, i.e., a frequency of $1$ is assumed, and ifreq is not referenced.
Constraint: if ${\mathbf{freq}}=\text{'F'}$, ${\mathbf{ifreq}}\left(\mathit{i}\right)\ge 0$, for $\mathit{i}=1,2,\dots ,{\mathbf{n}}$.
8: $\mathbf{weight}$Character(1) Input
On entry: indicates if weights are to be used.
${\mathbf{weight}}=\text{'U'}$
All weights are assumed to be $1$.
${\mathbf{weight}}=\text{'W'}$
The weights, ${w}_{i}$ are supplied in wt.
Constraint: ${\mathbf{weight}}=\text{'U'}$ or $\text{'W'}$.
9: $\mathbf{wt}\left(*\right)$Real (Kind=nag_wp) array Input
Note: the dimension of the array wt must be at least ${\mathbf{ldn}}$ if ${\mathbf{weight}}=\text{'W'}$.
On entry: if ${\mathbf{weight}}=\text{'W'}$, wt must contain the ${n}_{d}$ weights, ${w}_{i}$, where ${n}_{d}$ is the number of distinct failure times.
If ${\mathbf{weight}}=\text{'U'}$, wt is not referenced and ${w}_{i}=1$ for all $i$.
Constraint: if ${\mathbf{weight}}=\text{'W'}$, ${\mathbf{wt}}\left(\mathit{i}\right)\ge 0.0$, for $\mathit{i}=1,2,\dots ,{n}_{d}$.
10: $\mathbf{ts}$Real (Kind=nag_wp) Output
On exit: $T$, the test statistic.
11: $\mathbf{df}$Integer Output
On exit: $\nu$, the degrees of freedom.
12: $\mathbf{p}$Real (Kind=nag_wp) Output
On exit: $P\left(X\ge T\right)$, when $X\sim {\chi }_{\nu }^{2}$, i.e., the probability associated with ts.
13: $\mathbf{obsd}\left({\mathbf{ngrp}}\right)$Real (Kind=nag_wp) array Output
On exit: ${O}_{i}$, the observed number of failures in each group.
14: $\mathbf{expt}\left({\mathbf{ngrp}}\right)$Real (Kind=nag_wp) array Output
On exit: ${E}_{i}$, the expected number of failures in each group.
15: $\mathbf{nd}$Integer Output
On exit: ${n}_{d}$, the number of distinct failure times.
16: $\mathbf{di}\left({\mathbf{ldn}}\right)$Integer array Output
On exit: the first nd elements of di contain ${d}_{i}$, the number of failures, across all groups, at time ${t}_{i}$.
17: $\mathbf{ni}\left({\mathbf{ldn}}\right)$Integer array Output
On exit: the first nd elements of ni contain ${n}_{i}$, the size of the risk set, across all groups, at time ${t}_{i}$.
18: $\mathbf{ldn}$Integer Input
On entry: the size of arrays di and ni. As ${n}_{d}\le n$, if ${n}_{d}$ is not known a priori then a value of n can safely be used for ldn.
Constraint: ${\mathbf{ldn}}\ge {n}_{d}$, the number of unique failure times.
19: $\mathbf{ifail}$Integer Input/Output
On entry: ifail must be set to $0$, $-1$ or $1$ to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of $0$ causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of $-1$ means that an error message is printed while a value of $1$ means that it is not.
If halting is not appropriate, the value $-1$ or $1$ is recommended. If message printing is undesirable, then the value $1$ is recommended. Otherwise, the value $0$ is recommended. When the value $-\mathbf{1}$ or $\mathbf{1}$ is used it is essential to test the value of ifail on exit.
On exit: ${\mathbf{ifail}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

## 6Error Indicators and Warnings

If on entry ${\mathbf{ifail}}=0$ or $-1$, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
${\mathbf{ifail}}=1$
On entry, ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{n}}\ge 2$.
${\mathbf{ifail}}=2$
On entry, all the times in t are the same.
${\mathbf{ifail}}=3$
On entry, ${\mathbf{ic}}\left(〈\mathit{\text{value}}〉\right)=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{ic}}\left(i\right)=0$ or $1$.
${\mathbf{ifail}}=4$
On entry, ${\mathbf{grp}}\left(〈\mathit{\text{value}}〉\right)=〈\mathit{\text{value}}〉$ and ${\mathbf{ngrp}}=〈\mathit{\text{value}}〉$.
Constraint: $1\le {\mathbf{grp}}\left(i\right)\le {\mathbf{ngrp}}$.
${\mathbf{ifail}}=5$
On entry, ${\mathbf{ngrp}}=〈\mathit{\text{value}}〉$ and ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: $2\le {\mathbf{ngrp}}\le {\mathbf{n}}$.
${\mathbf{ifail}}=6$
On entry, freq had an illegal value.
${\mathbf{ifail}}=7$
On entry, ${\mathbf{ifreq}}\left(〈\mathit{\text{value}}〉\right)=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{ifreq}}\left(i\right)\ge 0$.
${\mathbf{ifail}}=8$
On entry, weight had an illegal value.
${\mathbf{ifail}}=9$
On entry, ${\mathbf{wt}}\left(〈\mathit{\text{value}}〉\right)=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{wt}}\left(i\right)\ge 0.0$.
${\mathbf{ifail}}=11$
The degrees of freedom are zero.
${\mathbf{ifail}}=18$
On entry, ${\mathbf{ldn}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{ldn}}\ge 〈\mathit{\text{value}}〉$.
${\mathbf{ifail}}=31$
On entry, all observations are censored.
${\mathbf{ifail}}=41$
On entry, group $〈\mathit{\text{value}}〉$ has no observations.
${\mathbf{ifail}}=-99$
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

Not applicable.

## 8Parallelism and Performance

g12abf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
g12abf makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

The use of different weights in the formula given in Section 3 leads to different rank statistics being calculated. The logrank test has ${w}_{i}=1$, for all $i$, which is the equivalent of calling g12abf when ${\mathbf{weight}}=\text{'U'}$. Other rank statistics include Wilcoxon (${w}_{i}={n}_{i}$), Tarone–Ware (${w}_{i}=\sqrt{{n}_{i}}$) and Peto–Peto (${w}_{i}=\stackrel{~}{S}\left({t}_{i}\right)$ where $\stackrel{~}{S}\left({t}_{i}\right)=\prod _{{t}_{j}\le {t}_{i}}\phantom{\rule{0.25em}{0ex}}\frac{{n}_{j}-{d}_{j}+1}{{n}_{j}+1}$) amongst others.
Calculation of any test, other than the logrank test, will probably require g12abf to be called twice, once to calculate the values of ${n}_{i}$ and ${d}_{i}$ to facilitate in the computation of the required weights, and once to calculate the test statistic itself.

## 10Example

This example compares the time to death for $51$ adults with two different types of recurrent gliomas (brain tumour), astrocytoma and glioblastoma, using a logrank test. For further details on the data see Rostomily et al. (1994).

### 10.1Program Text

Program Text (g12abfe.f90)

### 10.2Program Data

Program Data (g12abfe.d)

### 10.3Program Results

Program Results (g12abfe.r)


text:
Earlier this week in my graduate data structures course we covered splay trees. I found a slightly different way of covering the static optimality property (splay trees are to within a constant factor as good as any fixed tree for any sequence of data accesses) that I think makes it easier to understand than the usual entropy-based approach.

To begin with, I followed the analysis of Sleator and Tarjan's original STOC '83 paper (repeated in Tarjan's Data Structures and Network Algorithms). According to this analysis, if each data item is given a weight $$w_i$$, with $$W$$ denoting the sum of the weights, then the amortized cost to access item $$i$$ is $$O(\log W/w_i)$$. One of the beauties of splay trees is that they automatically adjust themselves to achieve this performance even when these weights are not known by the algorithm.

Proving this amortized time bound is not difficult. As in the STOC paper, define the rank of an item to be the floor of the log (base two) of the sum of the weights in its subtree (the 1985 JACM version gets a tighter analysis by omitting the floor). If one uses as a potential function the sum of the ranks, then one can analyze the sequence of splay steps by which item $$i$$ is accessed, by partitioning the steps into the ones in which the rank of $$i$$ increases and the ones in which it stays the same. The number of steps in which the rank increases can be at most the difference between the smallest and largest ranks available to $$i$$, which is $$\log W/w_i$$, and the potential function increases in these steps by a telescoping sum that ends up proportional to the same amount. In the remaining steps, the potential function decreases, canceling the amortized time for the steps.

The point, though, is not so much how one gets to this $$O(\log W/w_i)$$ bound but how one sets the weights $$w_i$$. If they are all equal to one, then $$W=n$$ and the amortized cost per operation is $$O(\log n)$$. If the access sequence is chosen randomly at each step from some distribution with probability $$w_i$$ of accessing item $$i$$, then $$W=1$$ and the average amortized cost per operation ends up as $$O(\sum w_i \log 1/w_i)$$, the Shannon entropy.

At this point it's typical to wave one's hands, assert that optimal binary search trees have an access cost proportional to the Shannon entropy, and conclude that splay trees are within a constant factor of optimal. Sleator and Tarjan, for instance, say that this follows by "a standard theorem of information theory" and cite Abramson's information theory book, without even a hint at a page number where such a theorem may be found.

Instead, it turns out to be easier to prove directly that splay trees are as good as any static tree $$T$$ (and therefore, as good as the optimal binary search tree, whatever tree that might be). To do so, let $$\ell_i$$ denote the number of nodes on the path to item $$i$$ in tree $$T$$, and let $$w_i = 3^{-\ell_i}$$. In any finite binary tree, $$W\lt 1$$ (in a complete infinite binary tree, the sum is exactly one, as can be seen by summing each level separately and then summing the levels as a geometric series); this is related to Kraft's inequality. Therefore, using these weights for the splay tree analysis, the time per access is $$O(\log 1/3^{-\ell_i}) = O(\ell_i)$$, within a constant factor of the time in tree $$T$$ as was to be shown.

Sadly, this approach doesn't seem to work to prove dynamic optimality of splay trees. Conceivably, one can define weights based on exponential functions of the access cost in some unknown dynamic optimal search tree, and use these weights to analyze a splay tree on the same access sequence, but it seems that a change to the optimal tree can cause a large increase in the potential of the splay tree, making it have a large amortized cost for that operation.


text:
Categorical variables are known to hide and mask lots of interesting information in a data set and many times they might even be the most important variables in a model. A good data scientist should be capable of handling such variables effectively and efficiently. If you are a smart data scientist, you’d hunt down the categorical variables in the data set, and dig out as much information as you can. The goal of this article is to present an advanced technique called ‘Entity Embeddings’ to deal with categorical variables in Neural Networks. It was found that neural networks with entity embedding generate better results than tree based methods when using the same set of features for structured data.

• Introduction
• Structured vs Unstructured Data
• Shortcoming of using One-Hot encoding in the context of Neural Networks
• Definition of entity embedding
• How to learn each value of an embedding vector?
• Example
• Hyperparameter: number of columns of the embedding matrix
• Whenever is possible, it’s best to treat things as categorical variables rather than as continuous variable
• As the size of the embedding matrix highly depends on the cardinality size is it possible to massively overfit the model?
• What is an embedding layer?
• Conclusion
• References

## Introduction

As we already know Neural networks revolutionized computer vision, speech recognition and natural language processing (unstructured data) replacing the long dominating methods in each field. However, they are not as prominent when dealing with machine learning problems with structured data. This can be easily seen by the fact that the top teams in many online machine learning competitions like those hosted on Kaggle use tree based methods more often than neural networks.

The reason is that a neural network can approximate any continuous function and piece wise continuous function. During the training phase the continuity of the data guarantees the convergence of the optimisation, and during the prediction phase it ensures that slightly changing the values of the input keeps the output stable. Thus, it is not suitable to approximate arbitrary non-continuous functions. On the other hand tree based methods do not assume any continuity of the feature variables and can divide the states of a variable as fine as necessary.

## Structured vs. Unstructured Data

Structured data are data collected and organised in a table format with columns representing different features (variables) or target values and rows representing different samples which makes them easily searchable by simple, straightforward search engine algorithms or other search operations; while unstructured data — “everything else” — is comprised of data that is usually not as easily searchable, including formats like audio, video, and social media postings.

## Shortcoming of using One-Hot encoding in the context of Neural Networks

One-Hot encoding is a commonly used method for converting a categorical input variable into continuous variable. For every level present, one new variable will be created.Presence of a level is represent by 1 and absence is represented by 0.

This have two main shortcoming:

1. One-hot encoding of high cardinality features often results in an unrealistic amount of computational resource requirement.
2. It treats different values of categorical variables completely independent of each other and often ignores the informative relations between them.

Those shortcoming could be overcome using the entity embedding method.

Please remember that for tree based algorithms it’s OK to encode categories using ordinal values (0, 1, 2, 3, etc) while for an algorithm that learns a weight for each variable it’s not OK.

## Definition of entity embedding

We map categorical variables in a function approximation problem into Euclidean spaces, which are the entity embeddings of the categorical variables. The mapping is learned by a neural network during the standard supervised training process. Entity embedding not only reduces memory usage and speeds up neural networks compared with one-hot encoding, but more importantly by mapping similar values close to each other in the embedding space it reveals the intrinsic properties of the categorical variables.

It can rapidly generate great results on structured data without having to resort to feature engineering or apply domain specific knowledge. The technique is relatively straight forward, and simply involves turning the categorical variables into numbers and then assigning each value an embedding vector:

The advantage of doing this compared to the traditional approach of creating dummy variables (i.e. doing one hot encodings), is that each day can be represented by four numbers instead of one, hence we gain higher dimensionality and much richer relationships.

In other words, entity embedding automatically learn the representation of categorical features in multi-dimensional spaces which puts values with similar effect to the target output value close to each other helping neural networks to solve the problem. You may think of if we were embedding states in a country for a sales problem, similar states in terms of sales would be closer to each in this projected space.

## How to learn each value of an embedding vector ?

First define a fully connected neural network and separate numerical and categorical variables.

For each categorical variable:

1. Initialise a random embedding matrix as m x D.

m: number of unique levels of categorical variable (Monday, Tuesday, …)

D: desired dimension for representation, a hyperparameter which can be between 1 and m-1 (if 1 then it will be label encoding, if m it will be one-hot encoding)

2. Then for each forward pass through neural network we do a lookup for the given level (e.g Monday for “dow”) from the embedding matrix, which will give us a vector as 1 x D.

3. Append this 1 x D vector to our input vector (numerical vector). Think this process as augmenting a matrix, where we add an embedding vector for each category that been embedded by doing lookup for each particular row.

4. Usually inputs are not updated but for embedding matrices we have this special case where we allow our gradient to flow all the way back to these mapped features and hence optimise them.

## Example

Continuous Variables are fed directly into the neural network after normalising them (temperature and distance in the above figure) whereas categorical variables need special care.For the categorical variable Day of Week we need to put it through an embedding. So we create an embedding matrix of 7 by 4 (e.g. dimension 4 embedding-hyperparameter). So this will look up the 6th row to get back the four items. So day of week 6 will turn into length 4 vector which will then fed directly into the neural network.

We can think this as a process, which allows our categorical embeddings to be better represented at every iteration.

## Hyperparameter: number of columns of the embedding matrix

For each of categorical variables, the number of categories it has determine the number of rows of the embedding matrix. Then we define what embedding dimensionality we want.

If you are doing natural language processing, then the number of dimensions you need to capture all the nuance of what a word means and how it’s used has been found empirically to be about 600. Human language is one of the most complex things that we model, so any categorical variables wouldn’t need an embedding matrix with more than 600 dimensions.

At the other end, some things may have pretty simple kind of causality. So ideally, when you decide what embedding size to use, you would kind of use your knowledge about the domain to decide how complex is the relationship and so how big embedding do I need. In practice, you almost never know that. You only know that because maybe somebody else has previously done that research and figured it out like in NLP. So in practice, you probably need to use some rule of thumb, and having tried a rule of thumb, you could then maybe try a little bit higher, a little bit lower and see what helps. So it’s kind of experimental.

A simple rule of thumb is to look at how many discrete values the category has (i.e. the number of rows in the embedding matrix) and make the dimensionality of the embedding half of that. So for day of week which is the eight rows and four columns. Here it is (c+1)//2 — the number of columns divided by two. In addition you can set also an upper limit limiting the dimensionality min((c+1)//2,50).

## Whenever is possible, it’s best to treat things as categorical variables rather than as continuous variable

The reason for that is that when you feed some things through an embedding matrix, it means every level can be treated like totally differently.

For example, there was a competition on Kaggle a few years ago called Rossmann which is a German grocery chain where they asked to predict the sales of items in their stores. And that included the mixture of categorical and continuous variables. In this competition there was a feature representing how many months the competitor’s shop has been open. In that case zero months or one months is really different.

So if you fed that in as a continuous variable, it would be difficult for the neural net to try and find a functional form that has that big difference. It’s possible because neural net can do anything. But if you are not making it easy for it. Where else, if you used an embedding, treated it as categorical, then it will have a totally different vector for zero versus one. So it seems like, particularly as long as you’ve got enough data, treating columns as categorical variable where possible is a better idea.

When I say where possible, that basically means where the cardinality is not too high. So if this was like the sales ID number that was uniquely different on every row, you can’t treat that as a categorical variable. Because it would be a huge embedding matrix and you wouldn’t make that a categorical variable.

Rule of thumb is to keep categorical variables that don’t have very high cardinality. As in if a variable has unique levels for 90% of the observations then it wouldn’t be a very predictive variable and we may very well get rid of it.

## As the size of the embedding matrix highly depends on the cardinality size is it possible to massively overfit the model?

In old machine learning, we used control complexity by reducing the number of parameters. In modern machine learning, we control complexity by regularisation. Typically, we are not concerned about overfitting because the way we avoid overfitting is not by reducing the number of parameters but by increasing the dropout or increasing the weight decay.

Now having said that, there’s no point using more parameters for a particular embedding than it needs. Because regularization is penalising a model by giving it more random data or by actually penalising weights. So we’d rather not use more than we have to.

Thus the general rule of thumb for designing an architecture is to be generous on the side of the number of parameters. If we then feel that a variable is not important we can manually go and make change to this to make it smaller. Or if we found that there’s not enough data here or using more regularization than we are comfortable with, then we might go back. But we would always start with being generous with parameters.

## What is an embedding layer?

It is like multiplying an one hot encoded vector by a set of coefficients which is exactly the same thing as simply saying let’s grab the thing where the one is. In other words, if we had stored this (1000) as a zero, 0100 as a one, 0020 as a two, then it’s exactly the same as just saying hey, look up that thing in the array.

So we call that version an embedding. So an embedding is a weight matrix you can multiply by one hot encoding. And it’s just a computational shortcut. But it’s mathematically the same.

## Conclusion

Hope you find it interesting and please remember that Entity Embedding looks a good and easy way to directly make the data suitable ready for input to neural nets with no feature engineering involved.

Thanks for reading and I am looking forward to hearing your questions :)
Stay tuned and Happy Machine Learning.

## References

Originally published at :https://towardsdatascience.com/decoded-entity-embeddings-of-categorical-variables-in-neural-networks-1d2468311635 on Oct 28, 2018.


text:
# Math Help - Implicit Differentation

1. ## Implicit Differentation

If xsin(x)-y^2=xy-4, the value of dy/dx at the point (0,2) is ?

I don't know how to get the derivative, but if i got it I could solve it easily

2. For implicit differentiation :
1.When differentiating a function of x do it normally d(sinx)/dx =cos(x)

2. when differentiating a function of differentiate with respect to y and multiply by dy/dx : d(sin(y)/dx = cos(y) dy/dx

xsin(x)-y^2=xy-4

sin(x) + xcos(x) -2ydy/dx = y + xdy/dx

Now solve for dy/dx:

sin(x) +xcos(x) - y = (2y +x) dy/dx

[sin(x) +xcos(x) - y ]/(2y+x) = dy/dx


text:
# Math Help - Pairing problem

1. ## Pairing problem

Each of the 75 children in a line was assigned one of the integers from 1 through 75 by counting off in order. Then, standing in the same order, the children counted off in the opposite direction, so that the child who was assigned the number 75 the first time was assigned the number 1 the second time. Which of the following is a pair of numbers assigned to the same child?

How can I show and prove that it has to be 47 and 29?

2. ## Re: Pairing problem

Hi, mjoshua.

It might help to think about what happens when you add the numbers together that a student received.

Does this help get things on the right track?

Good luck!

3. ## Re: Pairing problem

It does not, I'm sorry.. Anyone else?

4. ## Re: Pairing problem

Just for fun, can you write the two numbers assigned to person number one, the two numbers assigned to person number two, then add each pair of numbers...I think that might move things in the right direction

5. ## Re: Pairing problem

So the proof is the pairs must add to 76?? That seems rather bland..?

6. ## Re: Pairing problem

Hello, mjoshua!

Each of the 75 children in a line was assigned one of the integers from 1 through 75 by counting off in order.
Then, standing in the same order, the children counted off in the opposite direction,
so that the child who was assigned the number 75 the first time was assigned the number 1 the second time.
Which of the following is a pair of numbers assigned to the same child?

How can I show and prove that it has to be 47 and 29?

Take a look at GJA's observation . . .

. . $\begin{array}{c|cccccc} \text{1st count} & 1 & 2 & 3 & \cdots & 74 &75 \\ \hline \text{2nd count} & 75 & 74 & 73 & \cdots & 2 & 1 \end{array}$

Each child received a pair of numbers whose sum is 76.

Yes, that's kind of bland.
But when an answer is that simple, don't expect fireworks . . .


text:
# Reliable Transactions in Serverless-Edge Architecture

Published: ICDE’23 (IEEE International Conference on Data Engineering)

Authors Suyash Gupta, Sajjad Rahnama, Erik Linsenmayer, Faisal Nawab, Mohammad Sadoghi

#### Reliable Transactions in Serverless-Edge Architecture

Modern edge applications demand novel solutions where edge applications do not have to rely on a single cloud provider (which cannot be in the vicinity of every edge device) or dedicated edge servers (which cannot scale as clouds) for processing compute-intensive tasks. A recent computing philosophy, Sky computing, proposes giving each user ability to select between available cloud providers.

In this paper, we present our serverless-edge co-design, which extends the Sky computing vision. In our serverless-edge co-design, we expect edge devices to collaborate and spawn required number of serverless functions. This raises several key challenges: (1) how will this collaboration take place, (2) what if some edge devices are compromised, and (3) what if a selected cloud provider is malicious. Hence, we design ServerlessBFT, the first protocol to guarantee Byzantine fault-tolerant (BFT) transactional flow between edge devices and serverless functions. We present an exhaustive list of attacks and their solutions on our serverless-edge co-design. Further, we extensively benchmark our architecture on a variety of parameters.


text:
# Percentage of Percentage Calculator

Written by:
PK

Below is a percentage of percentage calculator, which will calculate the percentage of another percentage. Enter a percentage X% which you take "of" a second percentage Y%, and the tool will tell you the final impact.

## What is a Percentage of Percentage?

A percentage of percentage comes up when two (or more) percentages interact in a way that you need to determine the final impact.

For example, in investing, you often have an X% claim on something, but may owe Y% in fees, or lose that Y% to some other factor (for example, in accredited investments). You won't know the true effect of the various clauses until you work through percentages of percentages.

### Example Percentage of Percentage

Let's say there is a $10,000,000 fund, and you have the rights to 35% of the gains, but pay 20% carry or performance fee. How much would you receive in a year where the fund made$2,000,000?

Stated another way, you take home 80% of 35% of the gains. Here's how it looks:

your\ take=35\%*80\% = .35*.8 = 28\%\ of\ gains\\~\\your\ distribution=.28*\$2,000,000=\$560,000

## Using the Percentage of Percentages Calculator

In the entry field at the top, enter the first percentage – the percentage X that you are taking "of" the second percentage. Likewise, in the second box,

When happy, simply hit the Compute Average button below and DQYDJ will find the percentage of percentage, so you can know the final impact.

Here are our other percentage tools:


text:
# Lim sup counter example

Is it possible to find a counter example to argue this:

$\limsup\limits_{n\rightarrow \infty} (A_n \cap B_n)$ = $\limsup\limits_{n\rightarrow \infty} A_n \cap \limsup\limits_{n\rightarrow \infty} B_n$

where $A_n$ and $B_n$ are two sequences.

-

$$A_{2n}=B_{2n+1}=A\ne\varnothing,\qquad A_{2n+1}=B_{2n}=\varnothing$$ Still, an inclusion is always valid...


text:
Lemma 114.6.1. Let $R$ be a ring. Let $S$ be a $R$-algebra. If $S$ is of finite presentation and formally smooth over $R$ then $S$ is smooth over $R$.

Proof. See Algebra, Proposition 10.138.13. $\square$

In your comment you can use Markdown and LaTeX style mathematics (enclose it like $\pi$). A preview option is available if you wish to see how it works out (just click on the eye in the toolbar).


text: $$B+H_2O \rightarrow BH^+ + OH^-$$ or $$B^- + H_2O \rightarrow BH + OH^-$$ First line would be for $$NH_3$$ Second line would be for $$F^-$$


text:
# Gradient represented through fundamental form

• Feb 24th 2011, 01:26 PM
lllll
Gradient represented through fundamental form
If $E, F, G$ are the coefficients of the first fundamental form in a parametrization $\mathbf{x}:U \subset \mathbb{R}^2 \mapsto S$, then $grad \ f$ on $\mathbf{x}(U)$ is given by:

$grad \ f =\frac{f_uG-f_vF}{EG-F^2}\mathbf{x}_u +\frac{f_vE-f_uF}{EG-F^2}\mathbf{x}_v$

Now what I have come to realize is that we can represent $grad \ f$ as $(\mathbf{x}_u, \mathbf{x}_v)
\begin{pmatrix}
E & F\\
F & G
\end{pmatrix}^{-1} \begin{pmatrix}
f_u\\
f_v
\end{pmatrix}$

Now we get $\begin{pmatrix}
E & F\\
F & G
\end{pmatrix}^{-1}$
from the second fundamental form.

where we have
$N_u = a_{11}\mathbf{x}_u+a_{21}\mathbf{x}_v$

$N_v = a_{12}\mathbf{x}_u+a_{22}\mathbf{x}_v$

Now is there a way that I can incorporate these elements to get it to work out? Can I for instance carry on with the following $II_p(a) = \langle D (grad \ f(v)),v\rangle$ where $v$ is a tangent vector on a surface?
• Feb 24th 2011, 07:51 PM
xxp9
What is your question? From my understanding you're trying to express grad(f) using E, F, G and you did it. The result is correct so what are you really asking?
• Feb 24th 2011, 08:35 PM
lllll
I forget to write down the first part of the question, which defines $df_p= \langle grad \ f(p),v \rangle_p$ where $grad \ f(p) \in T_p(S) \subset \mathbb{R}^3$
Then from the given definition I'm trying to derive the formula $grad \ f =\frac{f_uG-f_vF}{EG-F^2}\mathbf{x}_u +\frac{f_vE-f_uF}{EG-F^2}\mathbf{x}_v$
• Feb 24th 2011, 08:56 PM
xxp9
since grad(f) is a tangent vector it is expressible by the base vectors:
grad(f) = a Xu + b Xv, then we need to compute a and b by computing the inner products with Xu and Xv:
Xu . grad(f) = a Xu . Xu + b Xu . Xv
df( Xu) = a E + b F
fu = a E + b F.
Similarly:
fv = a F + b G
So we get a system of linear equations. Solve it we get
(a, b)' = ( E F; F G)^{-1} (fu, fv)'