text:
# Robustness of Magic and Symmetries of the Stabiliser Polytope

Markus Heinrich and David Gross

Institute for Theoretical Physics, University of Cologne, 50937 Cologne, Germany

### Abstract

We give a new algorithm for computing the $\textit{robustness of magic}$ - a measure of the utility of quantum states as a computational resource. Our work is motivated by the $\textit{magic state model}$ of fault-tolerant quantum computation. In this model, all unitaries belong to the Clifford group. Non-Clifford operations are effected by injecting non-stabiliser states, which are referred to as $\textit{magic states}$ in this context. The $\textit{robustness of magic}$ measures the complexity of simulating such a circuit using a classical Monte Carlo algorithm. It is closely related to the degree negativity that slows down Monte Carlo simulations through the infamous $\textit{sign problem}$. Surprisingly, the robustness of magic is $\textit{sub}$- multiplicative. This implies that the classical simulation overhead scales subexponentially with the number of injected magic states - better than a naive analysis would suggest. However, determining the robustness of $\textit{n}$ copies of a magic state is difficult, as its definition involves a convex optimisation problem in a 4${^n}$-dimensional space. In this paper, we make use of inherent symmetries to reduce the problem to $\textit{n}$ dimensions. The total run-time of our algorithm, while still exponential in $\textit{n}$, is super-polynomially faster than previously published methods. We provide a computer implementation and give the robustness of up to 10 copies of the most commonly used magic states. Guided by the exact results, we find a finite hierarchy of approximate solutions where each level can be evaluated in polynomial time and yields rigorous upper bounds to the robustness. Technically, we use symmetries of the stabiliser polytope to connect the robustness of magic to the geometry of a low-dimensional convex polytope generated by certain $\textit{signed quantum weight enumerators}$. As a by-product, we characterised the automorphism group of the stabiliser polytope, and, more generally, of projections onto complex projective 3-designs.

### ► References

[1] D. M. Appleby, Symmetric informationally completeâpositive operator valued measures and the extended Clifford group'' Journal of Mathematical Physics 46, 052107 (2005).
https://doi.org/10.1063/1.1896384

[2] Christine Bachoc, Dion C. Gijswijt, Alexander Schrijver, and Frank Vallentin, Invariant semidefinite programs'' Springer US (2012).
https://doi.org/10.1007/978-1-4614-0769-0

[3] Stephen Boydand Lieven Vandenberghe, Convex Optimization'' Cambridge University Press (2009).
https://doi.org/10.1017/CBO9780511804441.007

[4] Sergey Bravyi and David Gosset, Improved Classical Simulation of Quantum Circuits Dominated by Clifford Gates'' Physical Review Letters 116, 250501 (2016).
https://doi.org/10.1103/PhysRevLett.116.250501

[5] Sergey Bravyi and Alexei Kitaev, Universal quantum computation with ideal Clifford gates and noisy ancillas'' Physical Review A 71, 022316 (2005).
https://doi.org/10.1103/PhysRevA.71.022316

[6] Sergey Bravyi, Graeme Smith, and John A. Smolin, Trading Classical and Quantum Computational Resources'' Physical Review X 6, 021043 (2016).
https://doi.org/10.1103/PhysRevX.6.021043

[7] Sergey Bravyi, Dan Browne, Padraic Calpin, Earl Campbell, David Gosset, and Mark Howard, Simulation of quantum circuits by low-rank stabilizer decompositions'' (2018).
arXiv:1808.00128

[8] Earl T. Campbell, Barbara M. Terhal, and Christophe Vuillot, Roads towards fault-tolerant universal quantum computation'' Nature 549, 172–179 (2017).
https://doi.org/10.1038/nature23460
https://www.nature.com/articles/nature23460

[9] Cecilia Cormick, Ernesto F. Galvão, Daniel Gottesman, Juan Pablo Paz, and Arthur O. Pittenger, Classicality in discrete Wigner functions'' Physical Review A 73, 012301 (2006).
https://doi.org/10.1103/PhysRevA.73.012301

[10] Lars Eirik Danielsen, Database of Self-Dual Quantum Codes''.
http://www.ii.uib.no/~larsed/vncorbits/

[11] Lars Eirik Danielsen and Matthew G. Parker, On the classification of all self-dual additive codes over GF(4) of length up to 12'' Journal of Combinatorial Theory, Series A 113, 1351–1367 (2006).
https://doi.org/10.1016/j.jcta.2005.12.004
http://www.sciencedirect.com/science/article/pii/S0097316505002347

[12] J. H. Dulá and R. V. Helgason, A new procedure for identifying the frame of the convex hull of a finite collection of points in multidimensional space'' European Journal of Operational Research 92, 352–367 (1996).
https://doi.org/10.1016/0377-2217(94)00366-1
http://www.sciencedirect.com/science/article/pii/0377221794003661

[13] Bryan Eastin and Emanuel Knill, Restrictions on Transversal Encoded Quantum Gate Sets'' Physical Review Letters 102, 110502 (2009).
https://doi.org/10.1103/PhysRevLett.102.110502

[14] Matthew B. Elliott, Bryan Eastin, and Carlton M. Caves, Graphical description of the action of Clifford operators on stabilizer states'' Physical Review A 77, 042307 (2008).
https://doi.org/10.1103/PhysRevA.77.042307

[15] D. Gross, Hudsonâs theorem for finite-dimensional quantum systems'' Journal of Mathematical Physics 47, 122107 (2006).
https://doi.org/10.1063/1.2393152

[16] David Gross, Sepehr Nezami, and Michael Walter, Schur-Weyl Duality for the Clifford Group with Applications: Property Testing, a Robust Hudson Theorem, and de Finetti Representations'' (2017).
arXiv:1712.08628

[17] J. Gubernatis, N. Kawashima, and P. Werner, Quantum Monte Carlo Methods: Algorithms for Lattice Models'' Cambridge University Press (2016).
https://doi.org/10.1017/CBO9780511902581

[18] Matthew B Hastings, Superadditivity of communication capacity using entangled inputs'' Nature Physics 5, 255 (2009).
https://doi.org/10.1038/nphys1224

[19] M. Hein, J. Eisert, and H. J. Briegel, Multiparty entanglement in graph states'' Physical Review A 69 (2004).
https://doi.org/10.1103/PhysRevA.69.062311

[20] M. Hein, W. Dür, J. Eisert, R. Raussendorf, M. Van den M. Van den Nest, and H.-J. Briegel, Entanglement in Graph States and its Applications'' (2006).
http://arxiv.org/abs/quant-ph/0602096

[21] Markus Heinrich and David Gross, Robustness of Magic and Symmetries of the Stabiliser Polytope'' (2018).
arXiv:1807.10296

[22] Israel Nathan Herstein, Jordan Homomorphisms'' Transaction of the American Mathematical Society 81, 331 –341 (1956).
https://doi.org/10.2307/1992920

[23] Mark Howard and Earl Campbell, Application of a Resource Theory for Magic States to Fault-Tolerant Quantum Computing'' Physical Review Letters 118, 090501 (2017).
https://doi.org/10.1103/PhysRevLett.118.090501

[24] Angela Karanjai, Joel J Wallman, and Stephen D Bartlett, Contextuality bounds the efficiency of classical simulation of quantum processes'' (2018).

[25] Richard Kueng and David Gross, Qubit stabilizer states are complex projective 3-designs'' (2015).
arXiv:1510.02767

[26] F. J. MacWilliams and N. J. A. Sloane, The Theory of Error-Correcting Codes'' North Holland (1977).

[27] A. Mari and J. Eisert, Positive Wigner Functions Render Classical Simulation of Quantum Computation Efficient'' Physical Review Letters 109, 230503 (2012).
https://doi.org/10.1103/PhysRevLett.109.230503

[28] Gabriele Nebe, Eric M. Rains, and Neil J.A. Sloane, Self-Dual Codes and Invariant Theory'' Springer Science & Business Media (2006).
https://doi.org/10.1007/3-540-30731-1

[29] Maarten Van den M. Van den Nest, Jeroen Dehaene, and Bart De Moor, Graphical description of the action of local Clifford transformations on graph states'' Physical Review A 69 (2004).
https://doi.org/10.1103/PhysRevA.69.022316
http://arxiv.org/abs/quant-ph/0308151

[30] Michael A. Nielsen and Isaac L. Chuang, Quantum Computation and Quantum Information: 10th Anniversary Edition'' Cambridge University Press (2011).
https://doi.org/10.1017/CBO9780511976667

[31] Hakop Pashayan, Joel J. Wallman, and Stephen D. Bartlett, Estimating Outcome Probabilities of Quantum Circuits Using Quasiprobabilities'' Physical Review Letters 115, 070501 (2015).
https://doi.org/10.1103/PhysRevLett.115.070501

[32] Patrick Rall, Fractal Properties of Magic State Distillation'' (2017).
arXiv:1708.09256

[33] Patrick Rall, Signed quantum weight enumerators characterize qubit magic state distillation'' (2017).

[34] Ben W. Reichardt, Quantum universality by state distillation'' (2006).
http://arxiv.org/abs/quant-ph/0608085

[35] D. Schlingemann, Stabilizer codes can be realized as graph codes'' (2001).
http://arxiv.org/abs/quant-ph/0111080

[36] Victor Veitch, Christopher Ferrie, David Gross, and Joseph Emerson, Negative quasi-probability as a resource for quantum computation'' New Journal of Physics 14, 113011 (2012).
https://doi.org/10.1088/1367-2630/14/11/113011
http://stacks.iop.org/1367-2630/14/i=11/a=113011

[37] Victor Veitch, S. A. Hamed S. A. H. Mousavian, Daniel Gottesman, and Joseph Emerson, The resource theory of stabilizer quantum computation'' New Journal of Physics 16, 013009 (2014).
https://doi.org/10.1088/1367-2630/16/1/013009
http://stacks.iop.org/1367-2630/16/i=1/a=013009

[38] GuifrÃ© Vidal and Rolf Tarrach, Robustness of entanglement'' Physical Review A 59, 141–155 (1999).
https://doi.org/10.1103/PhysRevA.59.141

[39] S. Virmani, Susana F. Huelga, and Martin B. Plenio, Classical simulability, entanglement breaking, and quantum computation thresholds'' Physical Review A 71, 042328 (2005).
https://doi.org/10.1103/PhysRevA.71.042328

[40] Zak Webb, The Clifford Group Forms a Unitary 3-design'' Quantum Info. Comput. 16, 1379–1400 (2016).
https://doi.org/10.26421/QIC16.15-16
http://dl.acm.org/citation.cfm?id=3179439.3179447

[41] Huangjun Zhu, Multiqubit Clifford groups are unitary 3-designs'' Physical Review A 96, 062336 (2017).
https://doi.org/10.1103/PhysRevA.96.062336

[42] Huangjun Zhu, Permutation symmetry determines the discrete Wigner function'' Physical Review Letters 116, 040501 (2016-01-26).
https://doi.org/10.1103/PhysRevLett.116.040501

### Cited by

[1] Zi-Wen Liu, Kaifeng Bu, and Ryuji Takagi, "One-Shot Operational Quantum Resource Theory", Physical Review Letters 123 2, 020401 (2019).

[2] Shigeo Hakkaku and Keisuke Fujii, "Comparative Study of Sampling-Based Simulation Costs of Noisy Quantum Circuits", Physical Review Applied 15 6, 064027 (2021).

[3] James R. Seddon and Earl T. Campbell, "Quantifying magic for multi-qubit operations", Proceedings of the Royal Society A: Mathematical, Physical and Engineering Sciences 475 2227, 20190251 (2019).

[4] Hammam Qassim, Joel J. Wallman, and Joseph Emerson, "Clifford recompilation for faster classical simulation of quantum circuits", arXiv:1902.02359, Quantum 3, 170 (2019).

[5] Hao Dai, Shuangshuang Fu, and Shunlong Luo, "Detecting Magic States via Characteristic Functions", International Journal of Theoretical Physics 61 2, 35 (2022).

[6] Zi-Wen Liu and Andreas Winter, "Many-Body Quantum Magic", PRX Quantum 3 2, 020333 (2022).

[7] Patrick Rall, Daniel Liang, Jeremy Cook, and William Kretschmer, "Simulation of qubit quantum circuits via Pauli propagation", Physical Review A 99 6, 062337 (2019).

[8] M. Lostaglio and A. Ciani, "Error Mitigation and Quantum-Assisted Simulation in the Error Corrected Regime", Physical Review Letters 127 20, 200506 (2021).

[9] Arne Heimendahl, Felipe Montealegre-Mora, Frank Vallentin, and David Gross, "Stabilizer extent is not multiplicative", Quantum 5, 400 (2021).

[10] Oliver Hahn, Alessandro Ferraro, Lina Hultquist, Giulia Ferrini, and Laura García-Álvarez, "Quantifying Qubit Magic Resource with Gottesman-Kitaev-Preskill Encoding", Physical Review Letters 128 21, 210502 (2022).

[11] James R. Seddon, Bartosz Regula, Hakop Pashayan, Yingkai Ouyang, and Earl T. Campbell, "Quantifying Quantum Speedups: Improved Classical Simulation From Tighter Magic Monotones", PRX Quantum 2 1, 010345 (2021).

[12] Michael Zurel, Cihan Okay, and Robert Raussendorf, "Hidden Variable Model for Universal Quantum Computation with Magic States on Qubits", Physical Review Letters 125 26, 260404 (2020).

[13] Robert Raussendorf, Juani Bermejo-Vega, Emily Tyhurst, Cihan Okay, and Michael Zurel, "Phase-space-simulation method for quantum computation with magic states on qubits", Physical Review A 101 1, 012350 (2020).

[14] Markus Heinrich and David Gross, "Robustness of Magic and Symmetries of the Stabiliser Polytope", Quantum 3, 132 (2019).

[15] Xin Wang, Mark M. Wilde, and Yuan Su, "Efficiently Computable Bounds for Magic State Distillation", arXiv:1812.10145, Physical Review Letters 124 9, 090505 (2020).

[16] S Sarkar, C Mukhopadhyay, and A Bayat, "Characterization of an operational quantum resource in a critical many-body system", New Journal of Physics 22 8, 083077 (2020).

[17] Kanato Goto, Tomoki Nosaka, and Masahiro Nozaki, "Chaos by Magic", arXiv:2112.14593.

The above citations are from Crossref's cited-by service (last updated successfully 2022-05-29 06:07:50) and SAO/NASA ADS (last updated successfully 2022-05-29 06:07:51). The list may be incomplete as not all publishers provide suitable and complete citation data.


text:
Editors: Pau Amaro-Seoane & Bernard Schutz
The last GW Note is a Special Issues on eLISA/NGO

## Conservative, gravitational self-force for a particle in circular orbit around a Schwarzschild black hole in a Radiation Gauge

arXiv:1009.4876

by Shah, Abhay and Keidl, Tobias and Friedman, John and Kim, Dong-Hoon and Price, Larry
21 pages, 2 figures

format: plain


text:
# Embed questions filter

Filters ::: filter_embedquestion
Maintained by Tim Hunt, Mahmoud Kassaei, Chris Nelson
A Moodle text filter plugin that displays interactive questions from the question bank embedded in the page.
Latest release:
970 sites
47 fans
Current versions available: 3

This filter allows questions from the question bank to be embedded anywhere that users can input HTML. This can be used in various ways. It can be a way to make learning materials more interactive. For example you may wish to embed an interactive question in a Book, or a Page, or even a Label. Or perhaps a student asks in a forum about some tricky grammar concept, and you have a question that illustrates your reply, well now you can include that question in your reply, so the student can immediately test their understanding.

It is designed to be used with the associated Atto editor plugin which makes it easier to set up the embedding.

Installing the Embedded questions progress report is also recommended. This lets staff and students track what progress has been made at all the embedded questions in a course.

Questions can only be embedded if they have an idnumber set, and where the category the question is in has an idnumber. This is for two reasons: first, to make it harder to accidentally embed questions from your end-of-course exam; and second, because this is how the filter uniquely identifies the question to show.

Note: Essay is not an interactive question.

This plugin was created by the Open University, UK.

### Sets

This plugin is part of set Embed questions.

### Contributors

Mahmoud Kassaei: Developer
Chris Nelson: Product owner
John Beedell: Developer

• Wed, Jul 21, 2021, 8:29 PM
@Laura DiFiore: That is the eventual plan (for the OU, we want to award engagement badges etc.) - it's just getting down to that section of our priority list.

The results are currently posted to the activity and/or course progress report and that can be exported, so the data is there, it's just not hooked in to the Gradebook at the moment.

Of course, if anyone has the knowledge and enthusiasm to contribute that feature, we wouldn't complain! Both of our developers are on leave at the moment, but I will ask if they have any ideas about what you could do once they return.
• Thu, Jul 22, 2021, 4:47 PM
@chris Nelson That's exciting news, I look forward to the eventual plan coming to fruition! It would be so amazing to be able to post questions anywhere *and* have them reflected in the grades, even more awesome if they showed accumulated "points" in an activity from the embedded questions, would work to "gamify" an activity even more :D

I think I found where the embedded question scores are stored in the mdl_question_attempts table, but I just get absolutely lost when I look at the php code of the embedded questions and/or embedded questions progress report plugins. The last time I played around with php coding was way back in the old php 3.0 days (and even back then, I never used php for anything beyond elementary scripting, simple stuff like including text files in html pages or simple contact/email form processing) ... it's pretty much a completely foreign language to me now and everything in Moodle is so interconnected, I feel like every time I made even a small change that should be entirely harmless, I break everything! LOL

It seems like it should be a relatively straightforward thing to take the saved attempts and when a student completes an activity, update their grade to include their embedded question scores but like I said, Moodle is so interconnected ... makes my head spin!

I'll keep reading the code and the even more convoluted (to me lol) developer documentation and maybe it'll eventually start to make sense to me ... hehe, maybe I can come up with some sort of hodgepodge temporary workaround!

Thanks so much for your encouraging response!
• Fri, Sep 3, 2021, 4:05 PM
Hi all,
I wondered if it is alredy possible / will be possible to access the result of the question (was it answered correct or not) to automatically choose the next site in a lesson. Right now my work around is embedding the question in a true/false question page and ask if the item was solved or not. So this is an additional click the student has to do.

So far this is the approach that comes closest to the old goal to make any question type available in lessons I found so far. Great thing!
• Fri, Sep 3, 2021, 4:14 PM
Hi @Simon,

We'd like to make grades available from embedded questions to the Gradebook etc., and it's on the 'to do' list. It's just having the capacity to reach that area of our to-do list!

Of course, we're be super-happy if the community contributed such an enhancement, although it'd worth discussing the technical approach with Tim Hunt first.

In your particular use-case, Lesson would also need an enhancement to work with the embedded question scoring, so that'd be a bit more involved.
• Mon, Sep 6, 2021, 11:01 PM
Well, using this as a work-aroud to the fact that the Lesson activity does not support all the quesiton types in the question bank is a pretty nasty work-around. Really, the lesson activity should be updated to use the question bank - MDL-18954 - but people have been wishing that for decades, and it never happens - but I don't think this should drive changes in the embedded questions filter.
• Sat, Oct 30, 2021, 10:18 AM
Hi Team - fantastic and elegant plugin, but we have hit a snag using it with Wiris questions. Wiris questions by themselves work fine, but not when embedded. They initially display, but after pressing [Check] or Fill with correct an error message is displayed. Other (non-Wiris) question types work when embedded, including in the same place (Moodle Book). I've pasted the debug info below, but are not really sure where to start. Any advice would be appreciated.

Thanks,
Andrew (Massey University, New Zealand)

Your previous attempt at a question here has stopped working. If you click continue, it will be removed and a new attempt created.

×Debug info: moodle_exception: Question ids mismatch in [dirroot]/lib/setuplib.php:498
Stack trace:
#0 [dirroot]/filter/embedquestion/classes/attempt.php(199): print_error('questionidmisma...', 'question')
#1 [dirroot]/filter/embedquestion/classes/attempt.php(153): filter_embedquestion\attempt->setup_usage_info(Object(question_usage_by_activity), 1)
#2 [dirroot]/filter/embedquestion/showquestion.php(74): filter_embedquestion\attempt->find_or_create_attempt()
#3 {main}
Error code: corruptattempt
×Stack trace:
line 498 of /lib/setuplib.php: moodle_exception thrown
line 87 of /filter/embedquestion/showquestion.php: call to print_error()

Wiris:
https://moodle.org/plugins/browse.php?list=set&id=66
• Sun, Oct 31, 2021, 12:04 AM
If other question types are working, this sounds like a but with the WIRIS question types, not with this filter. Have you reported this to them?
• Sun, Oct 31, 2021, 2:14 AM
Hi Tim, Yes I have. I was hoping your insight into the embed plugin might be able to guide the Wiris team to a solution. Regards.
• Mon, Nov 22, 2021, 2:13 PM
Just closing the loop Tim. Our support partner (Catalyst IT) have developed a fix which has been accepted by Wiris. The wiris plugin does not set the "idnumber" value on the questiontype object which resulted in the error.
• Sun, Feb 6, 2022, 6:28 AM
I installed this plugin and have successfully embedded an essay question to the content page of a lesson activity, but from the student view, there is no submit button so the student can submit the text written. I want to use the embed questions filter because essay questions added from the content bank (for quizzes) have the option for general feedback text (whereas the lesson activity's essay question does not). Is the embed questions filter not able to be used properly in the lessons activity?
• Mon, Feb 7, 2022, 4:51 PM
Hi @Sarah Poulin,
Embedded question is designed to be used with interactive questions. Essay is non-interactive, requiring a human marker. We have had "Exclude Essay from being selectable" and "Invent interactive Essay question behaviour" neck-and-neck in our development list for a while now, but have not had the capacity to complete either feature

If you want interactive short-text response, there's ShortAnswer, although we at the OU prefer PatternMatch (https://moodle.org/plugins/qtype_pmatch).
• Fri, May 20, 2022, 8:24 PM
Hello Tim,
first of all thank you so much for developping and maintining this plugin that is making 100% of our 700 exercices work. We are huge fan of your work. We just went through 4.0 update, and our trainee came with a long face and a question that no one here could answer :
Does the wonderfull agregated statistics in the question bank count the attempt made through embeded questions ?
Balthazar.
• Fri, May 20, 2022, 9:50 PM
I am afraid that it does not. The embedded question filter has never computed statistis. The display in the question bank only aggregates what statistics exist - which at the moment means only the quiz.

In future, it might be possible to develop a new feature where the embedded question filter computes statistics, however someone would have to do that an it is not currently on our roadmap. Also, while some statistics could be calculated, such as facility index and standard deviation, others pose a problem. For example Discrimination index etc, depend on comparing the score for this question against the score for all the other questions in the same quiz - and each embedded question stands alone. It is not clear what could stand in the place of that concept to lead to meaningful numbers. There is a challenge for someone.

If anyone wants to try to develop something here, I think it could either be added to the existing report (https://moodle.org/plugins/report_embedquestion) or someone could make a new report_embedequestionstats. I think either option could work. However, given the amount of stuff on our todo list, I fear that waiting for us to develop something is probably not a good idea. However, if someone does try, then I should be able to offer advice and help get it released.
• Wed, May 25, 2022, 5:14 PM
Hello Tim,
thank you for your quick reply, altough we've been going through lots of ups and downs since.
First of all, we thought about quiting embed question and get back to quizz, even though we loved this plugin. But we went to see the report_embed question, and it seems that not only, it is abosolytely enough to roughly see which question are bugging, but it also gives the student the possibility to return to a book, and see their previous attempts <3
We will try, with oiur capacity (none of us is developper), to provide the community a .excel file that allow to treat the datas exported from the embed question filter.

However, going through the language settings of the plugin, i noticed that it was possible to access certain fields of the question with commands such as {$a->name}. My new question is : would it be possible to "hack" embed question to allow unauthentified users to "see" without interacting the question of the quizz ? I tought about modifying the error message "guest are not allowed to see this question" by an "{$a->question}" for instance.

Thanks you so much for everything !
Balthazar
• Wed, May 25, 2022, 5:51 PM
A read-only display fo the questoin for guest users is something that probably could be implemented (you make that suggestion at https://github.com/moodleou/moodle-filter_embedquestion/issues so we don't forget about it). However, I don't think there is any way it could be done just with a quick and dirty hack. It would need to be implemnted properly. (And, I think it is not something we need at the Open University, so I doubt we would have time to work on it ourselves, but this is open source, so if someone else develops in with good code, we will integrate it with thanks.)


text:
# The SI unit for speed is ______

The SI unit for speed is m/s.

### Speed

Speed is measured as the ratio of distance to the time in which the distance was covered. Speed is a scalar quantity as it has only direction and no magnitude.

• Speed is directly proportional to distance when time is constant: v ∝ s (t constant)
• Speed is inversely proportional to time when distance is constant: v ∝ 1/t (s constant)
• There are four types of speed and are uniform speed. Variable speed. Average speed. Instantaneous speed.


text:
# Gaussian Integer Cannot be Ordered

I just started to read Neukirch's Algebraic Number Theory book. On page 5 , the book has the following exercise.

Show that the ring $\mathbb{Z}[i]$ cannot be ordered

I don't quite understand with that question. Since $\mathbb{Z}[i]$ is countable, we can enumerate elements of $\mathbb{Z}[i]$ and call the first element on the list as the smallest element and so on. So what is the question really asking here?

-

What you usually do to show this is to get a contradiction when you try to see what relation the element $i \in \mathbb{Z}[i]$ should have.
For example if you assume that there is an order in the Gaussian integers, then you should have $i > 0$ or $i < 0$. Then in the first case this implies that $-1 = i^2 > 0$ and then in turn $1 = (-1) \cdot (-1) > 0$ which gives you a contradiction because you cannot have both $1 > 0$ and $-1 > 0$.


text:
### Home > CCAA8 > Chapter cca9 > Lesson cca9.4.3 > Problem9-116

9-116.

Solve the following inequalities for the given variable and represent the solutions on a number line. 9-116 HW eTool (CPM). Homework Help ✎

1. $2<2m−8$

Solve as an equation and test a point to decide where to shade.

1. $\frac{1}{3}x−1\le−3$

Remember to multiply by a common denominator to remove the fraction.

1. $5(2x−8)+24>3(4+2x)$

1. $5+2k

Use the eTool below to represent the solutions on number lines.
Click the link at right for the full version of the eTool: CCA 9-116 HW eTool


text:
## Bernoulli

• Bernoulli
• Volume 23, Number 4B (2017), 3744-3771.

### Simulation of hitting times for Bessel processes with non-integer dimension

#### Abstract

In this paper, we complete and improve the study of the simulation of the hitting times of some given boundaries for Bessel processes. These problems are of great interest in many application fields as finance and neurosciences. In a previous work (Ann. Appl. Probab. 23 (2013) 2259–2289), the authors introduced a new method for the simulation of hitting times for Bessel processes with integer dimension. The method, called walk on moving spheres algorithm (WoMS), was based mainly on the explicit formula for the distribution of the hitting time and on the connection between the Bessel process and the Euclidean norm of the Brownian motion. This method does not apply anymore for a non-integer dimension. In this paper we consider the simulation of the hitting time of Bessel processes with non-integer dimension $\delta\geq1$ and provide a new algorithm by using the additivity property of the laws of squared Bessel processes. We split each simulation step of the algorithm in two parts: one is using the integer dimension case and the other one considers hitting time of a Bessel process starting from zero.

#### Article information

Source
Bernoulli, Volume 23, Number 4B (2017), 3744-3771.

Dates
Revised: May 2016
First available in Project Euclid: 23 May 2017

https://projecteuclid.org/euclid.bj/1495505108

Digital Object Identifier
doi:10.3150/16-BEJ866

Mathematical Reviews number (MathSciNet)
MR3654822

Zentralblatt MATH identifier
06778302

#### Citation

Deaconu, Madalina; Herrmann, Samuel. Simulation of hitting times for Bessel processes with non-integer dimension. Bernoulli 23 (2017), no. 4B, 3744--3771. doi:10.3150/16-BEJ866. https://projecteuclid.org/euclid.bj/1495505108

#### References

• [1] Alili, L. and Patie, P. (2010). Boundary-crossing identities for diffusions having the time-inversion property. J. Theoret. Probab. 23 65–84.
• [2] Buonocore, A., Giorno, V., Nobile, A.G. and Ricciardi, L.M. (2002). A neuronal modeling paradigm in the presence of refractoriness. Biosystems 67 35–43.
• [3] Buonocore, A., Nobile, A.G. and Ricciardi, L.M. (1987). A new integral equation for the evaluation of first-passage-time probability densities. Adv. in Appl. Probab. 19 784–800.
• [4] Burkitt, A.N. (2006). A review of the integrate-and-fire neuron model. I. Homogeneous synaptic input. Biol. Cybernet. 95 1–19.
• [5] Byczkowski, T., Małecki, J. and Ryznar, M. (2013). Hitting times of Bessel processes. Potential Anal. 38 753–786.
• [6] Ciesielski, Z. and Taylor, S.J. (1962). First passage times and sojourn times for Brownian motion in space and the exact Hausdorff measure of the sample path. Trans. Amer. Math. Soc. 103 434–450.
• [7] Daniels, H.E. (1969). The minimum of a stationary Markov process superimposed on a $U$-shaped trend. J. Appl. Probab. 6 399–408.
• [8] Daniels, H.E. (1996). Approximating the first crossing-time density for a curved boundary. Bernoulli 2 133–143.
• [9] Deaconu, M. and Herrmann, S. (2013). Hitting time for Bessel processes – walk on moving spheres algorithm (WoMS). Ann. Appl. Probab. 23 2259–2289.
• [10] Devroye, L. (1986). Nonuniform Random Variate Generation. New York: Springer.
• [11] Durbin, J. (1985). The first-passage density of a continuous Gaussian process to a general boundary. J. Appl. Probab. 22 99–122.
• [12] Durbin, J. (1992). The first-passage density of the Brownian motion process to a curved boundary. J. Appl. Probab. 29 291–304.
• [13] Ferebee, B. (1982). The tangent approximation to one-sided Brownian exit densities. Z. Wahrsch. Verw. Gebiete 61 309–326.
• [14] Ferebee, B. (1983). An asymptotic expansion for one-sided Brownian exit densities. Z. Wahrsch. Verw. Gebiete 63 1–15.
• [15] Gerstner, W. and Kistler, W.M. (2002). Spiking Neuron Models: Single Neurons, Populations, Plasticity. Cambridge: Cambridge Univ. Press.
• [16] Giorno, V., Nobile, A.G., Ricciardi, L.M. and Sato, S. (1989). On the evaluation of first-passage-time probability densities via nonsingular integral equations. Adv. in Appl. Probab. 21 20–36.
• [17] Gobet, E. (1998). Schéma d’Euler continu pour des diffusions tuées et options barrière. C. R. Acad. Sci. Paris Sér. I Math. 326 1411–1414.
• [18] Gobet, E. (2000). Weak approximation of killed diffusion using Euler schemes. Stochastic Process. Appl. 87 167–197.
• [19] Gobet, E. (2001). Euler schemes and half-space approximation for the simulation of diffusion in a domain. ESAIM Probab. Stat. 5 261–297 (electronic).
• [20] Gobet, E. and Menozzi, S. (2010). Stopped diffusion processes: Boundary corrections and overshoot. Stochastic Process. Appl. 120 130–162.
• [21] Göing-Jaeschke, A. and Yor, M. (2003). A survey and some generalizations of Bessel processes. Bernoulli 9 313–349.
• [22] Hamana, Y. and Matsumoto, H. (2013). The probability distributions of the first hitting times of Bessel processes. Trans. Amer. Math. Soc. 365 5237–5257.
• [23] Herrmann, S. and Tanré, E. (2016). The first-passage time of the Brownian motion to a curved boundary: An algorithmic approach. SIAM J. Sci. Comput. 38 A196–A215.
• [24] Ichiba, T. and Kardaras, C. (2011). Efficient estimation of one-dimensional diffusion first passage time densities via Monte Carlo simulation. J. Appl. Probab. 48 699–712.
• [25] Jeanblanc, M., Yor, M. and Chesney, M. (2009). Mathematical Methods for Financial Markets. Springer Finance. Springer: London.
• [26] Lánský, P., Sacerdote, L. and Tomassetti, F. (1995). On the comparison of Feller and Ornstein–Uhlenbeck models for neural activity. Biol. Cybernet. 73 457–465.
• [27] Lerche, H.R. (1986). Boundary Crossing of Brownian Motion: Its Relation to the Law of the Iterated Logarithm and to Sequential Analysis. Lecture Notes in Statistics 40. Berlin: Springer.
• [28] Norris, J.R. (1998). Markov Chains. Cambridge Series in Statistical and Probabilistic Mathematics 2. Cambridge: Cambridge Univ. Press.
• [29] Patie, P. and Winter, C. (2008). First exit time probability for multidimensional diffusions: A PDE-based approach. J. Comput. Appl. Math. 222 42–53.
• [30] Pötzelberger, K. and Wang, L. (2001). Boundary crossing probability for Brownian motion. J. Appl. Probab. 38 152–164.
• [31] Revuz, D. and Yor, M. (1999). Continuous Martingales and Brownian Motion, 3rd ed. Grundlehren der Mathematischen Wissenschaften [Fundamental Principles of Mathematical Sciences] 293. Berlin: Springer.
• [32] Ricciardi, L.M., Sacerdote, L. and Sato, S. (1984). On an integral equation for first-passage-time probability densities. J. Appl. Probab. 21 302–314.
• [33] Sacerdote, L. and Giraudo, M.T. (2013). Stochastic integrate and fire models: A review on mathematical methods and their applications. In Stochastic Biomathematical Models. Lecture Notes in Math. 2058 99–148. Heidelberg: Springer.
• [34] Sacerdote, L. and Tomassetti, F. (1996). On evaluations and asymptotic approximations of first-passage-time probabilities. Adv. in Appl. Probab. 28 270–284.
• [35] Salminen, P. and Yor, M. (2011). On hitting times of affine boundaries by reflecting Brownian motion and Bessel processes. Period. Math. Hungar. 62 75–101.
• [36] Shiga, T. and Watanabe, S. (1973). Bessel diffusions as a one-parameter family of diffusion processes. Z. Wahrsch. Verw. Gebiete 27 37–46.
• [37] Strassen, V. (1967). Almost sure behavior of sums of independent random variables and martingales. In Proc. Fifth Berkeley Sympos. Math. Statist. and Probability (Berkeley, Calif., 1965/66) 315–343. Berkeley, CA: Univ. California Press.
• [38] Tuckwell, H.C. (1989). Stochastic Processes in the Neurosciences. CBMS-NSF Regional Conference Series in Applied Mathematics 56. Philadelphia, PA: SIAM.
• [39] Wang, L. and Pötzelberger, K. (2007). Crossing probabilities for diffusion processes with piecewise continuous boundaries. Methodol. Comput. Appl. Probab. 9 21–40.


text:
Thank you for visiting nature.com. You are using a browser version with limited support for CSS. To obtain the best experience, we recommend you use a more up to date browser (or turn off compatibility mode in Internet Explorer). In the meantime, to ensure continued support, we are displaying the site without styles and JavaScript.

# Chelating agent-assisted in situ LDH growth on the surface of magnesium alloy

## Abstract

In situ formation of layered double hydroxides (LDH) on metallic surfaces has recently been considered a promising approach for protective conversion surface treatments for Al and Mg alloys. In the case of Mg-based substrates, the formation of LDH on the metal surface is normally performed in autoclave at high temperature (between 130 and 170 °C) and elevated pressure conditions. This hampers the industrial application of MgAl LDH to magnesium substrates. In this paper, the growth of MgAl LDH conversion coating directly on magnesium alloy AZ91 at ambient conditions (25 °C) or elevated temperatures is reported in carbonate free electrolyte for the first time. The direct LDH synthesis on Mg alloys is enabled by the presence of organic chelating agents (NTA and EDTA), which control the amount of free and/or hydroxyl bound Mg2+ and Al3+ in the solution. The application of the chelating agents help overcoming the typical technological limitations of direct LDH synthesis on Mg alloys. The selection of chelators and the optimization of the LDH treatment process are supported by the analysis of the thermodynamic chemical equilibria.

## Introduction

Magnesium alloys have attracted a lot of attention nowadays, thanks to the low density in combination with reasonable mechanical properties. This attribute makes them promising as structural materials for vehicles and their components as well as for the electronics industry. However, the corrosion resistance of magnesium alloys is not always sufficient, limiting the use of Mg-based materials by different industries, especially when they are supposed to come into contact with aggressive corrosive environments. Different protection technologies are already in use in order to increase the corrosion resistance of magnesium alloys, e.g. conversion treatment1,2,3 polymeric coatings4,5, plasma electrolytic oxidation (PEO) treatment6,7,8,9, and combinations thereof demonstrate the highest protection efficiency10. One central idea is based on a formation of a good barrier coating, which prevents the penetration of moisture and other corrosive agents down to the metal surface. However, even strong passive protection cannot reliably serve for the full expected service life, since service-induced defects lead to the damage of the barrier. This can result in a strong localized corrosion, starting at the defects and propagating under the coating at the layer-metal interface. Therefore, an additional active protection and a stable interface are very important. However, the most effective and well-known chromate-based treatments are strictly banned on account of toxicity for humans and danger to the environment.

Recently, layered double hydroxide (LDH)-based conversional treatments have shown great potential for corrosion protection of aluminium- and magnesium-based alloys11,12,13,14,15,16,17. LDH is a hydrotalcite-like compound, which is typically composed of positively-charged mixed metal MII-MIII hydroxide layers and galleries filled by the charge compensating anions (Ay) and water molecules18,19,20. The main advantage is that corrosion inhibitors can be intercalated into LDH galleries as charge compensating anions, which can be used for active corrosion protection on demand in the presence of corrosion-relevant triggers. Hence, LDH-based conversion layers can be effective in delaying the corrosion reaction by entrapping the corrosive anions, such as chlorides, into their interlayer and working as self-healing protective coatings, releasing the corrosion inhibitors when required21,22,23.

In comparison with aluminium alloys, LDH synthesis on magnesium causes a lot of problems because of the high reactivity of the substrate leading to Mg(OH)2 formation. As a first approach, synthesis of LDHs on Mg alloys was performed from the solutions containing pre-formed LDH particles. For example, Wang et al. firstly synthesized the LDH particles, then transferred the resulting slurry to an autoclave where Mg alloy AZ31 plates were immersed, and left the synthesis at 125 °C for 12 hours. The resultant films were modified with a hydrophobic silane coupling agent24. The coating revealed the presence of both hydrotalcite (LDH) and hydromagnesite phases. The hydrophobization of the coated surface was found to improve the corrosion resistance of such LDH coating. Despite improved corrosion behaviour, the main disadvantage of the LDH growing schemes discussed above is low adhesion between the LDH layer and the substrate when compared to that of the LDH intrinsically grown as a result of conversion reaction. The direct synthesis of LDH on the surface overcomes this problem by using the components from both the substrate and the electrolyte.

A number of different approaches has been used in order to obtain LDH layers directly on magnesium alloys. For example, Nakamura and Kamiyama have used LDH-based coatings for corrosion protection of magnesium alloy (AZCa612 and AZ31 respectively)25,26. In both works, the formation of LDH film was achieved by steam-coating treatment, and improvement in corrosion behaviour was demonstrated. Chen et al. have investigated the MgAl LDHs growth in situ on bare AZ31 Mg alloy via a two-step process (precursor film based on MgAl2(OH)8·xH2O and Mg2Al(OH)7 formation with following recrystallization to MgAl LDH-carbonate in the presence of bubbling CO2) and have suggested a possible mechanism of MgAl LDH formation27,28,29,30 as well as an exchange mechanism in NaCl31. The main limitation of this approach is that LDH was prepared in the form of MgAl LDH-carbonate. The carbonate anions have a high affinity to the LDH layers and hardly exchangeable with functional species (e.g. inhibitors) that are to be used for corrosion protection. Lin et al.32 has demonstrated the possibility of forming MgAl LDH conversion layer on AZ91 alloy also in aqueous $${{\rm{HCO}}}_{3}^{-}{/\mathrm{CO}}_{3}^{2-}$$ media. Moreover, the authors have shown that MgAl LDH-carbonate can be exchanged with LDH-Cl in a corrosive environment, demonstrating the effective protection of Mg alloy against corrosion. More recently, the same authors proposed a modified procedure to grow LDHs, based on the fact that during the reaction of Mg substrate with H2O, the alkalinity of the solution increases with an increase in the immersion time. Therefore, instead of growing LDHs over a long period of time, they have proposed a two-step methodology with an overall reduced processing time, where a first step in the solution enriched with $${{\rm{CO}}}_{3}^{2-}{/\mathrm{HCO}}_{3}^{2-}$$ at pH 6 is followed by a second step where pH was increased to 11.533. Recently, the formation of MgAl LDH-carbonate was also optimized for the treatment of magnesium alloys, covered with PEO (plasma electrolytic oxidation) layer34,35,36,37,38. The main disadvantage of the PEO treatment is that layer properties are strongly compromised by the presence of defects and cracks, formed during the discharges. MgAl LDH, formed on the PEO-treated surfaces, helped overcome this problem (sealing of pores and cracks took place).

Overall, although significant progress is achieved in LDH formation on Mg substrates, two main drawbacks remain:

1. (1)

The low adhesion between substrate and LDH layer in the case of pre-formed LDH use, and

2. (2)

LDH formation occurs under autoclave conditions, which significantly reduces the possibility of industrial applications of the suggested treatment.

The first problem can be solved via the direct synthesis of LDH on the surface, which is achieved in this work. The second drawback originates from the low solubility of magnesium compounds in the pH range, suitable for LDH formation (ca. pH 9–10 for ambient conditions)18. In this work, we extended the pH range of solubility of magnesium compounds using chelating agents and exploited their ability to promote controlled dissolution of AZ91 magnesium alloy via the formation of soluble chelating complexes. Moreover, carbonate free electrolyte was used in order to avoid LDH contamination with these hardly exchangeable anions, limiting LDH application for industrial needs39. Recently, an experimental database listing more than 150 chemical compounds that inhibit or promote the dissolution of pure magnesium and its alloys has been set40. Three chelators (salicylic acid, NTA, and EDTA) were chosen to prove an idea of LDH growth in relatively mild conditions (ambient pressure). As a result, the formation of MgAl LDH was found to be possible at mild temperature and ambient pressure conditions suitable for further industrial upscaling.

## Materials

Aluminium nitrate nonahydrate (Al(NO3)3∙9H2O, ≥98%, CarlRoth GmbH, Germany), sodium nitrate (NaNO3, ≥99%, Merk KGaA, Germany), sodium hydroxide (NaOH, ≥99%, Merk KGaA, Germany), salicylic acid (SA, C7H6O3, ≥99%, Sigma-Aldrich Chemie GmbH, Germany), ethylenediaminetetraacetic acid (EDTA, C10H16N2O8, min 99%, AppliChem GmbH, Germany), and disodium salt of nitrilotriacetic acid (NTA, C6H7NNa2O6, ≥99%, Sigma-Aldrich Chemie GmbH, Germany).

## Methods

LDH was grown on magnesium alloy AZ91 with the following elemental composition [wt. %]: 8.60 Al, 0.64 Zn, 0.22 Mn, 0.027 Nd, 0.0073 Si, 0.0053 Sn, 0.0046 La, 0.0023 Cu, 0.0010 Fe, 0.0003 Ni, 0.00076 Be, 0.0007 Ti, <0.02 Th, <0.0009 Ce, <0.0006 Zr, <0.0004 Pb, <0.0002 Pr, <0.0001 Ag, Mg balance. The size of coupons was equal to 15 × 15 × 4 mm. Prior to LDH treatment, the surface of each sample was ground with SiC paper up to 1,200 grit, rinsed with deionized water, and dried by a stream of cold air.

The chelating agents (salicylic acid, EDTA, and NTA) were separately dissolved in deionized water (different concentrations of chelating agents were prepared, as will be indicated later in the description of each experiment) and pH of the solution was adjusted to 7.0–7.4 using 0.1 M and 1 M NaOH solution, where necessary. Al(NO3)3 (0.05 M) and NaNO3 (0.25 M) were added to individual chelating agent solutions for the LDH formation (following the standard ratio of inorganic compounds previously adopted for LDH synthesis on aluminium alloys)41,42,43,44,45. The pH of the resultant solutions was adjusted to 8.0 ± 0.1, 9.0 ± 0.1, 10.0 ± 0.1, and 11.0 ± 0.1 using NaOH (0.1 M and 1 M).

AZ91 samples were immersed in the treatment bathes with chelating agents at temperature from 25 ± 5 °C to 95 ± 5 °C under continuous stirring. The synthesis was performed during either 15 minutes, or 1, 3, 6 or 48 hours, as indicated in the respective experimental results below.

## Techniques

### Grazing incidence X-ray diffraction (GID)

The coating were examined on a diffractometer from Seifert using an X-ray energy of 8kev (Cu Kα radiation) provided by a copper anode. The measurements were carried out in a 2 theta range from 8° to 24° in steps of 0.01°. The incident angle was set, fixed at 0.2°. The angular range was measured in two steps, employing a one-dimensional detector with an acquisition time of 100 s for each point.

### X-ray diffraction (XRD)

The crystallographic analysis was performed using Bruker D8 Advance diffractometer. The measurements were carried out with Cu Kα radiation in the range of 2 theta from 5 to 30° (exposure time 1 s, step 0.02°) and from 59 to 65° (exposure time 10 seconds, step 0.02°).

### Scanning electron microscope (SEM)

The morphological characterization was performed using TESCAN VEGA3 scanning electron microscope. The following conditions were used for image acquisition: HV 8.0 kV, BI 6.00.

Hydra-Medusa software46 was used to estimate the possibility of LDH formation on the surface of magnesium alloy AZ91 with and without three chelating agents.

## Results and Discussion

The investigation and optimization of LDH formation on the surface of AZ91 was performed in the solutions containing either salicylic acid, EDTA, or NTA. The results were compared with reference synthesis without organic additives. In order to estimate the possibility of LDH formation on the surface of AZ91 in the presence of chelating agents (the availability of soluble Mg containing compounds), the simulation of possible chemical equilibria was performed using the Hydra-Medusa software46. The following concentrations were used for calculations: chelating agents 0.1 М, Al(NO3)3 0.05 М, NaNO3 0.25 М; the estimated concentration of Mg2+ formed in the diffusion layer due to the dissolution of Mg substrate was postulated as 0.1 М based on previous measurements of local concentration of Mg2+ with ion-selective micro-electrodes47. The results of the Hydra-Medusa simulation are shown in Fig. 1(a–d).

The stability constants of complexes formed between salicylic acid, EDTA, and NTA chelating agents and metal cations, Mg2+ and Al3+, were updated or added into the Hydra-Medusa software based on the data provided by the literature48,49,50,51,52. The used values of logKMg and logKAl along with solubility products are given in Table 1. Regrettably, neither up-to-date stability constants nor up-to-date solubility product of MgAl LDH are available; hence, these were not taken into account during the performed simulation. However, from previous works, it is known that the pH range, mostly suitable for MgAl LDH formation in powder form, is between 9 and 10 (highlighted in Fig. 1 in dark grey colour, while light grey indicates the extended pH range of LDH formation in those conditions)18.

Based on the simulation results in Fig. 1a, the formation of aluminium hydroxide Al(OH)3 takes place at pH >4 if no chelating agent is added. In this case, since the values of the stability constants and the solubility product for aluminium hydroxide considerably exceed that for magnesium hydroxide, Mg2+ ions stay in the solution in an unbound state. When pH increases to above 9.5, an excess of hydroxide ions develops in the solution, leading to the formation of Mg(OH)2. Up to pH of about 13, Al3+ is present in the system as insoluble Al(OH)3. Above this value, an excess of OH is present, and aluminium gets dissolved as $${\mathrm{Al}(\mathrm{OH})}_{4}^{-}$$.

When chelating agents are introduced into the system, formation of soluble aluminium-ligand complexes takes place. These complexes are typically stable to at least pH 4.5 to 6.0. The precipitation of Al(OH)3 occurs only at higher pH values. This fact, however, does not prevent the formation of LDH on Al surface neither with Mg2+ nor with Zn2+. Both precipitate at pH above 9, which means that Al(OH)3 is less stable than (Zn/Mg)Al LDH.

Figure 1b shows the thermodynamic possibility of the formation of the magnesium salicylate (MgC7H4O3) in the pH range of 8 to 9.6 and its abrupt transformation to Mg(OH)2 at pH >9.6. The addition of salicylate delays the formation of Mg(OH)2 by only 0.1 pH unit compared to reference electrolyte, from pH 9.5 to pH 9.6. The concentration of free Mg2+ cations in the solution at pH range of 9.6 to 10.3 — favourable for LDH precipitation — is low at these conditions. Therefore, LDH precipitation is not likely to occur in the presence of salicylate ions.

Magnesium complex with EDTA (MgC10H12N2O82−) exists in a wider pH range from 4 to 12 (Fig. 1c). The concentration of the magnesium-EDTA complex increases up to the pH value of 7, and can be associated with the competition between EDTA and hydroxyl. At a pH from 7 to 10.5, the concentration of the complex formed by EDTA and magnesium reaches its maximum. Above these pH values, the chelating ion is exchanged by hydroxyl forming Mg(OH)2. The addition of EDTA delays the formation of Mg(OH)2 by 0.8 pH units, from pH of 9.5 in the reference electrolyte to pH of 10.3 in the presence of EDTA. Importantly, ca. 2% Mg2+ is bound neither in Mg-EDTA nor in Mg(OH)2 complex at pH of 9.6 to 10.3, the range favourable for LDH precipitation. This amount of Mg2+ formed due to Mg substrate dissolution is also available for LDH formation, while in the reference and salicylate cases, most of the Mg2+ is bound in Mg(OH)2 in this pH range (Fig. 1a). The Mg2+ and Mg-EDTA complex co-existing at pH of 9.6 to 10.3 can favour precipitation of LDH.

Disodium salt of nitrilotriacetic acid forms complexes with magnesium $$({\rm{Mg}}{({{\rm{C}}}_{{\rm{6}}}{{\rm{H}}}_{{\rm{6}}}{{\rm{O}}}_{{\rm{6}}}{\rm{N}})}_{2}^{4-})$$ at pH from 4.5 to 13.8, as shown in Fig. 1d. However, at pH above 10, the concentration of $${\text{Mg}}^{2+}$$ decreases, while the formation of magnesium hydroxide starts at pH higher than 10.0. Again, it is important that a considerable amount of unbound Mg2+ is present in the solution at pH 1 to 10.4. Even when Mg-NTA complex is formed, unbound Mg2+ constitutes up to 50% of all magnesium species. Once Mg(OH)2 starts forming, 50% of Mg species are still constituted by Mg-NTA complex (Mg(C6H6O6N)24−) up to pH above 12 when Mg(OH)2 fully binds all magnesium species. The presence of free Mg2+ and magnesium reversibly bound in $$({\rm{Mg}}{({C}_{{\rm{6}}}{{\rm{H}}}_{{\rm{6}}}{{\rm{O}}}_{{\rm{6}}}N)}_{2}^{4-})$$ complex in pH range from 9.6 to 10.3 can promote the formation of LDH.

From the overall analysis of Fig. 1, one can conclude that unlike in the reference and salicylate cases, in EDTA- and NTA-containing solutions, LDH is likely to precipitate because of the availability of free Mg2+ and Mg-Lig complexes at pH above 9.6.

Although informative and visual, thermodynamic simulations presented in Fig. 1 possess only limited predictive power because the equilibrium constants used are only valid at room temperature. Further uncertainties arise as no stability constants and solubility products of MgAl LDH are available. Besides, the thermodynamic diagrams presented are not able to provide any information about the precipitation/complexation kinetics. Nevertheless, the results of the simulations shown in Fig. 1 demonstrate the existence of unbound Mg2+ and reversibly bound in complex magnesium at pH above 9.6. The diagrams also explain the general principle how the chelating agents influence chemical equilibria and compete with OH ions for binding Mg2+ species. The chelating agents considered delay the formation of Mg(OH)2 (in pH scale) and are expected to facilitate the precipitation of MgAl LDH.

In order to verify the thermodynamic calculations for the direct LDH formation on the surface of AZ91, experimental LDH growth in the presence of chelating agents was performed at room temperature (25 °C) during 48 hours. Corresponding grazing incidence X-ray diffraction patterns are shown in Fig. 2.

In order to access the peak positions, a combination of two Gaussian and a polynomial function —accounting for the background — was fitted to the data. The parameters of the polynomial of third order were determined on the bases of an AZ91 reference sample without surface treatment. The result of the fitting is presented in the Inset in Fig. 2. It can be seen that the data show very broad and weak peaks. The 2 theta positions determined by the fitting are 11.25° and 22.26° for the NTA treatment. These peaks can be attributed to LDHs loaded with hydroxide/carbonate in interlayers. In the frame of this work, we assign this peak to MgAl LDH-hydroxide, since no additional carbonates were added to the solution. For the sample treated in EDTA-containing solution, two broad peaks at 11.56° and at 13.66° are also observed. The lower peak can be attributed to LDH loaded with hydroxide/carbonates (similar to the sample obtained in NTA solution, we consider this peak as LDH-hydroxide) whereas the second peak is associated with magnesium hydroxide formation. (006) LDH peak for the sample treated in EDTA solution is not visible from the patterns presented. Overall, these results show that LDH growth on the surface of AZ91 at 25°С is possible; however, the kinetics of this process are very slow. The thickness of LDH flakes, calculated using the Scherrer equation, can respectively be estimated as 4.5 and 4.2 nm for NTA and EDTA. In order to accelerate the LDH growth, the treatment in NTA containing electrolyte was performed at elevated temperatures. The synthesis was performed at 25, 60, 80, 95 °C. It can be clearly seen that with an increase in temperature, the intensity of the diffraction peaks increases, suggesting an extended LDH formation (Fig. 3a). The growth kinetics of LDH are significantly accelerated at temperatures higher than 60 °C.

The detailed investigation of the effects of chelating agent concentrations, pH of the solutions, and the duration of synthesis was also performed for the solutions of NTA disodium salt, and is presented in Fig. 3. Syntheses were carried out using NTA solutions with concentrations equalling 0.001, 0.01, and 0.1 M (Fig. 3d). It can be seen that the highest Bragg reflections are observed for the highest concentration of the chelating agent in the solution. It is also demonstrated that the optimum pH for LDH synthesis is between 9 and 10, while at pH values of 8 and 11, the formation of LDH was not observed (Fig. 3c). This result is in good agreement with previously published MgAl LDH powder synthesis18 and with Medusa thermodynamic predictions. Syntheses were carried out during 15 minutes and 1, 3, and 6 hours (Fig. 3b). The results show that the (003) Bragg reflection from LDH is detectable after 1 hour of treatment.

The optimized parameters, obtained for the LDH synthesis in the NTA-containing solution, were also applied to three other solutions, investigated in the current work (EDTA, salicylic acid, and reference). The LDH formation on the surface of AZ91 was done at pH value of 10, and at 95 °C during six hours under continuous stirring and ambient pressure. Figure 4 shows the XRD pattern of magnesium alloy AZ91 treated in reference, salicylic acid, EDTA, and NTA solutions.

The typical diffraction pattern related to LDH structures intercalated with hydroxide can be observed with peaks at 11.5° and 23.5°, as well as at 61° and 62.5°, for the samples treated in NTA and EDTA solution. These peaks can be associated with (003), (006), (110), and (113) reflections of LDH. A shoulder in the pattern of the EDTA sample, next to the (003) reflection of LDH, can be attributed to the presence of hydroxides. The thickness of LDH crystals, calculated using Scherrer’s equation, is estimated to be 10 and 20 nm for NTA and EDTA respectively.

The SEM results presented in Fig. 5 also confirm the formation of flake-like structures typical for LDH layer morphology on the surface of the magnesium alloy AZ91 treated with the EDTA and NTA solution. The comparison of the XRD patterns and SEM micrographs of the flakes formed on the sample obtained in a reference solution (Fig. 5a,b) shows that the structures formed correspond to hydroxide rather than LDH structure.

Overall, based on the XRD and SEM results obtained, the LDH synthesis is successfully performed in solutions containing NTA and EDTA. This result is in good agreement with a prediction, obtained via thermodynamic calculations, and can be summarized as:

1. (1)

autoclave conditions are not required for LDH growth. It makes this synthesis attractive for further optimization to match the industrial requirements.

2. (2)

no external CO2/CO32− is present in the system. This significantly increases the chances to intercalate functional species (e.g. corrosion inhibitors) within the galleries.

3. (3)

significantly higher adhesion between LDH and substrate can be expected in comparison with electrodeposited LDH coating.

All these factors can potentially decrease the production costs, making LDH a strong competitor as conversion coating with active corrosion protection and improved adhesion. As the next step of this work, we plan to study the corrosion protection properties of the LDH layers developed (including the intercalation of selected corrosion inhibitors) and verify their adhesion to Mg substrate.

## Conclusion

This work shows the principal possibility of direct LDH growth on the surface of magnesium alloy AZ91 at room temperature and ambient pressure in carbonate free electrolyte. The key components for shifting equilibrium towards LDH growth are the chelating agents such as EDTA and — especially — NTA. They prevent separate precipitation of Mg(OH)2 and Al(OH)3 and promote formation of MgAl LDH. This is achieved via the maintenance of free Mg2+ or magnesium reversibly bound in Mg-Lig complexes at pH exceeding typical precipitation range of Mg(OH)2. What is important is that no external Mg2+ ions are added in the electrolyte. Instead, Mg substrate gradually dissolves (assisted by chelating agents), forms complexes Mg-Lig and Al-Lig, and then subsequently forms Mg-Al LDH growing from AZ91 surface. As expected, the formation kinetics significantly increase at elevated temperature. This work shows a major route for further condition optimization of LDH formation, since it sets the way for overcoming all significant drawbacks of LDH formation on magnesium alloys.

## References

1. Pommiers, S., Frayret, J., Castetbon, A. & Potin-Gautier, M. Alternative conversion coatings to chromate for the protection of magnesium alloys. Corrosion Science. 84, 135–146 (2014).

2. Chen, X. -B., Easton, M. A., Birbilis, N., Yang, H. -Y. & Abbott, T. B. Corrosion-resistant coatings for magnesium (Mg) alloys in Corrosion prevention of magnesium alloys (ed. Song, G.-L.) 282–312 (Woodhead Publishing, 2013).

3. Gray, J. E. & Luan, B. Protective coatings on magnesium and its alloys−a critical review. Journal of Alloys and Compounds. 336, 88–113 (2002).

4. Lamaka, S. V., Xue, H. B., Meis, N. N. A. H., Esteves, A. C. C. & Ferreira, M. G. S. Fault-tolerant hybrid epoxy-silane coating for corrosion protection of magnesium alloy AZ31. Progress in Organic Coatings. 80(Supplement C), 98–105 (2015).

5. Hu, R.-G., Zhang, S., Bu, J.-F., Lin, C.-J. & Song, G.-L. Recent progress in corrosion protection of magnesium alloys by organic coatings. Progress in Organic Coatings. 73(2–3), 129–141 (2012).

6. Ono, S. et al. Effect of Electrolyte Concentration on the Structure and Corrosion Resistance of Anodic Films Formed on Magnesium through Plasma Electrolytic Oxidation. Electrochimica Acta. 240, 415–423 (2017).

7. Gawel, L., Nieuzyla, L., Nawrat, G., Darowicki, K. & Slepski, P. Impedance monitoring of corrosion degradation of plasma electrolytic oxidation coatings (PEO) on magnesium alloy. Journal of Alloys and Compounds. 722, 406–413 (2017).

8. Yang, J., Lu, X., Blawert, C., Di, S. & Zheludkevich, M. L. Microstructure and corrosion behavior of Ca/P coatings prepared on magnesium by plasma electrolytic oxidation. Surface & Coatings Technology. 319, 359–369 (2017).

9. White, L., Koo, Y., Neralla, S., Sankar, J. & Yun, Y. Enhanced mechanical properties and increased corrosion resistance of a biodegradable magnesium alloy by plasma electrolytic oxidation (PEO). Materials Science and Engineering B. 208, 39–46 (2016).

10. Ivanou, D. K. et al. Active corrosion protection coating for a ZE41 magnesium alloy created by combining PEO and sol–gel techniques. RSC Advances. 6, 12553–12560 (2016).

11. Buchheit, R. G., Bode, M. D. & Stoner, G. E. Corrosion-Resistant, Chromate-Free Talc Coatings for Aluminum. Corrosion. 50, 205–214 (1994).

12. Zhang, W. & Buchheit, R. G. Hydrotalcite Coating Formation on Al-Cu-Mg Alloys from Oxidizing Bath Chemistries. Corrosion. 58, 591–600 (2002).

13. Tedim, J., Zheludkevich, M. L., Salak, A. N., Lisenkov, A. & Ferreira, M. G. S. Nanostructured LDH-container layer with active protection functionality. J. Mater. Chem. 21, 15464–15470 (2011).

14. Wang, Y., Zhang, D. & Zhou, L. Hydrophobic Mg–Al layered double hydroxide film on aluminum: Fabrication and microbiologically influenced corrosion resistance properties. Colloids and Surfaces A: Physicochemical and Engineering Aspects. 474, 44–51 (2015).

15. Williams, G. & McMurray, H. N. Anion-Exchange Inhibition of Filiform Corrosion on Organic coated AA2024-T3 Aluminum Alloy by Hydrotalcite-Like Pigments. Electrochem. Solid-State Lett. 6, B9–B11 (2003).

16. Zhou, M., Pang, X., Wei, L. & Gao, K. In-situ grown superhydrophobic Zn–Al layered double hydroxides films on magnesium alloy to improve corrosion properties. Applied Surface Science. 337, 172–177 (2015).

17. Visser, P., Lutz, A., Mol, J. M. C. & Terryn, H. Study of the formation of a protective layer in a defect from lithium-leaching organic coatings. Progress in Organic Coatings. 99, 80–90 (2016).

18. Serdechnova, M. et al. Interlayer intercalation and arrangement of 2-mercaptobenzothiazolate and 1,2,3-benzotriazolate anions in layered double hydroxides: in situ x-ray diffraction study. Journal of Solid State Chemistry. 233, 158–165 (2016).

19. Khan, A. I. & O’Hare, D. Intercalation Chemistry of Layered Double Hydroxides: Recent Developments and Applications. J. Mater. Chem. 12, 3191–3198 (2002).

20. Evans, D. E. & Slade, R. C. T. Structural Aspects of Layered Double Hydroxides in Structure & Bonding. 119, 1−87 (Springer-Verlag, 2006).

21. Tedim, J. et al. Zn–Al layered double hydroxides as chloride nanotraps in active protective coatings. Corrosion Science. 55, 1–4 (2012).

22. Hayatdavoudi, H. & Rahsepar, M. Smart inhibition action of layered double hydroxide nanocontainers in zinc-rich epoxy coating for active corrosion protection of carbon steel substrate. Journal of Alloys and Compounds. 711(15), 560–567 (2017).

23. Zheludkevich, M. L. et al. Active protection coatings with layered double hydroxide nanocontainers of corrosion inhibitor. Corrosion Science. 52, 602–611 (2010).

24. Wang, J. et al. Fabrication of hydrophobic surface with hierarchical structure on Mg alloy and its corrosion resistance. Electrochim. Acta 55, 6897–6906 (2010).

25. Nakamura, K., Tsunakawa, M., Shimada, Y., Serizawa, A. & Ishizaki., T. Formation mechanism of Mg-Al layered double hydroxide-containing magnesium hydroxide films prepared on Ca-added flame-resistant magnesium alloy by steam coating. Surface and Coatings Technology. 328(Supplement C), 436–443 (2017).

26. Kamiyama, N. et al. Effect of treatment time in the Mg(OH)2/Mg–Al LDH composite film formed on Mg alloy AZ31 by steam coating on the corrosion resistance. Surface and Coatings Technology. 286(Supplement C), 172–177 (2016).

27. Chen, J., Song, Y., Shan, D. & Han, E.-H. In situ growth of Mg–Al hydrotalcite conversion film on AZ31 magnesium alloy. Corrosion Science. 53(10), 3281–3288 (2011).

28. Chen, J., Song, Y., Shan, D. & Han, E.-H. Modifications of the hydrotalcite film on AZ31 Mg alloy by phytic acid: The effects on morphology, composition and corrosion resistance. Corrosion Science. 74(Supplement C), 130–138 (2013).

29. Chen, J., Song, Y., Shan, D. & Han, E.-H. Study of the in situ growth mechanism of Mg–Al hydrotalcite conversion film on AZ31 magnesium alloy. Corrosion Science. 63, 148–158 (2012).

30. Chen, J., Song, Y., Shan, D. & Han, E.-H. Influence of alloying elements and microstructure on the formation of hydrotalcite film on Mg alloys. Corrosion Science. 93(Supplement C), 90–99 (2015).

31. Chen, J., Song, Y., Shan, D. & Han, E.-H. Study of the corrosion mechanism of the in situ grown Mg–Al–CO3 2− hydrotalcite film on AZ31 alloy. Corrosion Science. 65, 268–277 (2012).

32. Lin, J. K., Hsia, C. L. & Uan, J. Y. Characterization of Mg,Al-hydrotalcite conversion film on Mg alloy and Cl and CO3 2− anion-exchangeability of the film in a corrosive environment. Scripta Materialia. 56, 927–930 (2007).

33. Lin, J. K. & Uan, J. Y. Formation of Mg,Al-hydrotalcite conversion coating on Mg alloy in aqueous HCO3 /CO3 2− and corresponding protection against corrosion by the coating. Corrosion Science. 51, 1181–1188 (2009).

34. Zhang, G. et al. Sealing of anodized magnesium alloy AZ31 with MgAl layered double hydroxides layers. RSC Adv. 8, 2248–2259 (2018).

35. Peng, F. et al. Sealing the Pores of PEO Coating with Mg-Al Layered Double Hydroxide: Enhanced Corrosion Resistance, Cytocompatibility and Drug Delivery Ability. Scientific Reports. 7, 8167–8178 (2017).

36. Wu, L. et al. Fabrication and characterization of Mg-M layered double hydroxide films on anodized magnesium alloy AZ31. Applied Surface Science. 431, 177–186 (2018).

37. Zhang, G. et al. A Novel Approach to Fabricate Protective Layered Double Hydroxide Films on the Surface of Anodized Mg-Al Alloy. Advanced Materials Interfaces. 4(12), 1700163–1700173 (2017).

38. Wu, L. et al. Influence of pH on the growth behaviour of Mg–Al LDH films. Surface Engineering. 34(9), 674–681 (2018).

39. Miyata, S. Anion-exchange properties of hydrotalcite-like compounds. Clays and Clay Minerals. 31(4), 305–311 (1983).

40. Lamaka, S. V. et al. Comprehensive screening of Mg corrosion inhibitors. Corrosion Science. 128, 224–240 (2017).

41. Zheludkevich, M. L., Tedim, J. & Ferreira, M. G. S. “Smart” coatings for active corrosion protection based on multi-functional micro and nanocontainers. Electrochimica Acta. 82, 314–323 (2012).

42. Kuznetsov, B. et al. Sealing of tartaric sulfuric (TSA) anodized AA2024 with nanostructured LDH layers. RSC Adv. 6, 13942–13952 (2016).

43. Serdechnova, M. et al. PEO Coatings with Active Protection Based on In-Situ Formed LDH-Nanocontainers. Journal of The Electrochemical Society. 164(2), C36–C45 (2017).

44. Mohedano, M. et al. Active protective PEO coatings on AA2024: Role of voltage on in-situ LDH growth. Materials & Design. 120, 36–46 (2017).

45. Serdechnova, M. et al. Role of Phase Composition of PEO Coatings on AA2024 for In-Situ LDH Growth. Coatings. 7(11), 190–196 (2017).

46. Puigdomenech, I. Hydra-Medusa software, https://sites.google.com/site/chemdiagr/home (2017).

47. Karavai, O. V. et al. Localized electrochemical study of corrosion inhibition in microdefects on coated AZ31 magnesium alloy. Electrochimica Acta. 55, 5401–5406 (2010).

48. Smith, R. M. & Martell, A. E. Critical stability constants. Volume 4: Inorganic Complexes. 257 p. (Plenum Press, 1976).

49. Martell, A. E. & Smith, R. M. Critical stability constants. Volume 3: Other Organic Ligands. 495 p. (Plenum Press, 1977).

50. Smith, R. M. & Martel, A. E. Critical stability constants. Volume 6: Second Supplement. 643 p. (Plenum Press, 1989).

51. Dean, J. A. Lange’s handbook of chemistry. 1561 p. (McGraw-Hill Inc., 1999).

52. Lurye, Y.Y. Spravochnik po analiticheskoj himii (in Russian). 448 p. (Chemistry, 1989).

## Acknowledgements

This work was financed in part by the European project MULTISURF (Marie Skłodowska-Curie Research Program, grant agreement No. 645676). SVL acknowledges the financial support of the Alexander von Humboldt Foundation via Experienced Researcher Grant.

## Author information

Authors

### Contributions

T.N.S. performed the L.D.H. synthesis in the presence of chelating agents, M.S. performed the SEM and XRD characterization of the obtained surfaces, D.C.F.W. cared about G.I.D. measurements and fitting XRD patterns, S.V.L. selected the chelating agents and interpreted Medusa diagrams, M.Z. suggested the idea, while all authors discussed the results and wrote the paper.

### Corresponding author

Correspondence to M. Serdechnova.

## Ethics declarations

### Competing Interests

The authors declare no competing interests.

Publisher’s note: Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

## Rights and permissions

Reprints and Permissions

Shulha, T.N., Serdechnova, M., Lamaka, S.V. et al. Chelating agent-assisted in situ LDH growth on the surface of magnesium alloy. Sci Rep 8, 16409 (2018). https://doi.org/10.1038/s41598-018-34751-7

• Accepted:

• Published:

• DOI: https://doi.org/10.1038/s41598-018-34751-7

### Keywords

• Layered Double Hydroxides (LDH)
• AZ31 Magnesium Alloy
• Chelating Agents
• Elevated Pressure Conditions
• Plasma Electrolytic Oxidation (PEO)

• ### In situ synergistic strategy of sacrificial intermedium for scalable-manufactured and controllable layered double hydroxide film

• Yi-Xing Zhu
• Guang-Ling Song
• Mikhail L. Zheludkevich

Science China Materials (2022)

• ### Corrosion protection properties of different inhibitors containing PEO/LDHs composite coating on magnesium alloy AZ31

• Gen Zhang
• E Jiang
• Fusheng Pan

Scientific Reports (2021)

• ### Use of synergistic mixture of chelating agents for in situ LDH growth on the surface of PEO-treated AZ91

• E. Petrova
• M. Serdechnova
• M. L. Zheludkevich

Scientific Reports (2020)


text:
### Author Topic: Describing Direction Fields  (Read 2081 times)

#### Nan Choi

• Newbie
• Posts: 3
• Karma: 0
##### Describing Direction Fields
« on: September 20, 2018, 04:26:38 AM »
To what extent are we expected to describe direction fields?

For example, consider the differential equation from the homework question:

Section 1.1 #28

$y' = e^{-t} + y$

I used the online ODE plotter to determine its behaviour.

As $t → ∞$, $y$ diverges from $0$.
$y$ approaches $∞$ when $t > 0$, and $y$ approaches $-∞$ when $t < 0$.
At $t = 0$ and $y = -1$, the value for $y'$ is zero and the slope line is horizontal.

The question asks us to determine the behaviour of $y$ as $t → ∞$, and whether this behaviour depends on the initial value of $y$ at $t = 0$. Is the explanation above enough?

#### Victor Ivrii

• Administrator
• Elder Member
• Posts: 2599
• Karma: 0
##### Re: Describing Direction Fields
« Reply #1 on: September 20, 2018, 04:37:26 AM »
In this case the best would be just to solve this equation analytically.

#### Zhihong Yin

• Newbie
• Posts: 3
• Karma: 0
##### Re: Describing Direction Fields
« Reply #2 on: September 22, 2018, 01:51:48 PM »
For solving this equation analytically, does it mean that we need to analyze the the equation without just based on the calculation? As y approaches to infinite, should we show the limit?
Incomprehensible. V.I.
« Last Edit: September 22, 2018, 02:43:36 PM by Victor Ivrii »

#### Nick Callow

• Jr. Member
• Posts: 9
• Karma: 9
##### Re: Describing Direction Fields
« Reply #3 on: September 23, 2018, 01:18:13 AM »
A possible analytical approach.

1. If we want to describe the behaviour of $y(t)$ as $t \rightarrow \infty$ then we need to actually find out what $y(t)$ is. We can do this through the method of integrating factors.

Given $y'(t) - y(t) = e^{-t}$,  let $\mu(t)$ represent the integrating factor. $\mu(t) = e^{\int a(t)dt}$, where $a(t) = -1$. Therefore,
$$\mu(t) = e^{\int -1dt}, \qquad \mu(t) = e^{-t}, \qquad y'(t) - y(t) = e^{-t}$$
$e^{-t}(y'(t) - y(t)) = e^{-2t}$
$\frac{d}{dt}(e^{-t}y(t)) = e^{-2t}$
$\int \frac{d}{dt}(e^{-t}y(t))dt = \int e^{-2t}dt$
$e^{-t}y(t) + c_1 = -\frac{1}{2}e^{-2t} + c_2$
$e^{-t}y(t) = -\frac{1}{2}e^{-2t} + k$
$$y(t) = \frac{-\frac{1}{2}e^{-2t} + k}{e^{-t}} = -\frac{1}{2}e^{-t} + k e^t$$

Now that we have an equation for $y(t)$, we can describe its behaviour.

2. Zhihong I think this is what you were talking about where we could find the limit:
$$\lim_{t \rightarrow \infty} \frac{-\frac{1}{2}e^{-2t} + k}{e^{-t}}$$
which will depend on what we select $k$ to be. You can then see for what values of $k$ how the function $y(t)$ behaves and this should of course agree with the direction field but be more analytical and accurate.
« Last Edit: September 23, 2018, 03:50:28 AM by Victor Ivrii »

#### Victor Ivrii

• Administrator
• Elder Member
• Posts: 2599
• Karma: 0
##### Re: Describing Direction Fields
« Reply #4 on: September 23, 2018, 03:47:04 AM »
One can write formulae with better (larger) vertical spacing and in more compact form. There are inline formulae (in single dollars) and display formulae (in double dollars, which is the simplest, but  deprecated way).

We will find later that the  behaviour as $t\to \pm \infty$ could be often determined without actually solving equations.


text:
## Which Automatic Differentiation Tool for C/C++?

I’ve been playing with all sorts of fun new toys at the new job at Columbia and learning lots of new algorithms. In particular, I’m coming to grips with Hamiltonian (or hybrid) Monte Carlo, which isn’t as complicated as the physics-based motivations may suggest (see the discussion in David MacKay’s book and then move to the more detailed explanation in Christopher Bishop’s book).

### Why Hamiltonian Monte Carlo?

Hamiltonian MC methods use gradient (derivative) information to guide Metropolis-Hastings proposals. Matt is finding that it works well for the multilevel deep interaction models we’re working on with Andrew. As the theory suggests, it works much better than Gibbs sampling when the variables are highly correlated, as they tend to be with multilevel regression coefficients. The basic idea goes back to the paper:

• Duane, Simon, A. D. Kennedy, Brian J. Pendleton, and Duncan Roweth. 1987. Hybrid Monte Carlo. Physics Letters B 195(2):216–222. doi:10.1016/0370-2693(87)91197-X

Because we want to model general directed graphical models a la BUGS, we need to compute gradients.

If you need general gradients, it sure seems like automatic differentiation (AD) deserves at least some consideration. AD is a technique that operates on arbitrary functions defined by source code, generating new source code that computes the derivative (thus it’s a kind of automatic code generation). At a high level, it does just what you might expect: computes the derivatives of built-in functions and constants then uses the chain rule to put them together. Because it generates code, you can even have a go at tuning the resulting derivative code further.

Here are some basic refs:

### So Which One?

So what I want to know is, if I’m going to be coding in C, which implementation of AD should I be using? (There are implementations in everyting from Fortran to Python to Haskell.)

Update 21 January 2010: So, two problems rear their ugly heads. One: almost all of the tools other than Tapenade require you to seriously modify the code with different data types and flags for the code generator. Two: most of these tools are for non-commercial use only and can’t be redistributed. Not exactly how we’d like to roll together our own academic software. This is especially annoying because they’re almost all government-research funded (Tapenade in France, many of the others in the US, with copyright held tightly by institutions like the University of Chicago and INRIA). Many of the packages require extensive secondary packages to be installed. I miss Java and Apache.

Update 21 January 2010: maybe people coming from the blog killed it, but the Tapenade Online app is no longer up and hasn’t been since an hour or two after this blog post.

You can try it on your own C, C++, or Fortran program using the

For instance, consider the simple (intententionally non-optimal) C code to compute $f(x) = x^2 + 3x$:

```double f(double x) {
double y;
y = x;
y *= x;
y += 3*x;
return y;
}
```

Running Tapenade in forward mode, we get

```double f_d(double x, double xd, double *f) {
double y;
double yd;
yd = xd;
y = x;
yd = yd*x + y*xd;
y *= x;
yd = yd + 3*xd;
y += 3*x;
*f = y;
return yd;
}
```

If you plug in 1.0 for xd (in general, this can be used for chaining functions), you can see that the function returns the derivative $f'(x)$ and also sets the value of argument f (given as a pointer) to $f(x)$.

In backward mode, Tapenade generates the following code:

```void f_b(double x, double *xb, double fb) {
double y;
double yb;
double f;
y = x;
yb = fb;
*xb = *xb + (y+3)*yb;
yb = x*yb;
*xb = *xb + yb;
}
```

If you squint hard enough, you’ll realize this method also computes the derivative $f'(x)$ of $f(x)$. It’s set up to run the chain rule in reverse.

### Citation Stats?

Yes, I know this is totally crass, but nevertheless, I went to autodiff.org and checked out the many systems for C/C++ they cite, and then did a Google Scholar query `[SystemName "automatic differentiation"]`, restricted to results after (including?) 2005. Here’s what I found:

```ADMB      73
AUTODIF   11
COSY INF  52
Rapsodia   9
Treeverse  7
YAO       88
```

This doesn’t seem to be expressing a particularly clear community preference. So I was hoping some of you may have suggestions. I should add that many of the papers are themselves surveys, so don’t actually correspond to someone using the package, which is what I’d really like to know.

### 10 Responses to “Which Automatic Differentiation Tool for C/C++?”

1. Chaz Says:

Is Hamiltonian MC sort of like a multilevel multiple imputations?

2. Bob Carpenter Says:

Hamiltonian MC is an instance of the Metropolis-Hastings algorithm, which is an MCMC algorithm for sampling from distributions. Unlike Gibbs sampling, it samples all the parameters at once. Either could be used to sample from the posterior of a Bayesian model, but Hamiltonian MC tends to work better if there is a lot of correlation among the parameters. You can also mix them, as you tend to do when the parameters or missing data are a mix of categorical and continuous variables.

The term “imputation” is usually used for missing data, such as a non-response in a survey. You can certainly set up a Bayesian model to do multilevel multiple imputation and then use Hamiltonian MC to sample from the posterior. In fact, it’s one of the applications we’re exploring. There’s a nice discussion in Gelman and Hill’s multilevel regression book, with BUGS used for sampling (it’s a general Gibbs sampler).

3. Chaz Says:

that’s awesome, thanks.

4. Mark Says:

Ive started playing around with CppAD, and using Rcpp have been able to rudimentarily (sic) link it with R. Dont yet have any feeling on how well it performs, but intend to try out the ideas of Girolami and Calderhead (JRSSB read paper late last year) using it.

• Bob Carpenter Says:

CppAD’s notion of “taping” seems really clunky. Isn’t it going to be very inefficient? Here’s what it looks like in CppAD:

But then how inefficient is the operator overloading in Sacado and other such packages? I just don’t know C++ that well.

The function is cleanly separated from any of the Sacado bits. Maybe that’s achievable with CppAD with a little encapsulation — I’m still not sure exactly how all these things work.

It makes me wonder if I can just install something like the templated Boost C++ libraries and be done with it.

Or if I can just pass in a vector to forward mode, like you see in the Sacado forward example Fad_demo.

Installing this stuff’s such a pain compared to Java — it’s like the 1980s all over again with path-guessing and scripts to configure scripts to build platform-specific executables.

Linking with R isn’t the problem. We (and by that I mean the people I’m working with) are all over that. We just don’t want to spend our lives hand-coding derivatives.

5. Mark Says:

I’m just about to do some mcmc using cppad, so, then i’ll know the penalties. It was easy enough to install and one of my colleagues had prior experience with it, so it seemed a good place to start, and i could nt face trying to differentiate the likelihood i was constructing by hand. But, always interested in doing better, so would like to keep in touch with how you are progressing

6. Jason Roos Says:

I’m writing to follow up on this post: http://www.stat.columbia.edu/~cook/movabletype/archives/2011/02/handy_matrix_ch.html

eigen is awesome, but linking eigen to AD packages has proved to be very tricky (even their unsupported/AutoDiff package). Do you have any updates about which set of tools you settled on? I’m eager to find something that can play nicely with eigen.

7. Mark Says:

Just thought i would revisit this issue, and see how things have progressed with you in the preceding 9 months. Cppad has done what I wanted, but really only as a test case, i think ineed a more efficient approach than one based on a ‘tape’.

• Jason Roos Says:

I’ve so far had good luck with ADOL-C. eigen is flexible enough that it doesn’t mind working with objects (adoubles) instead of integrals (doubles), and therefore integration between the two (ADOL-C and eigen) has not been an issue. ADOL-C’s major drawback is its large memory footprint (I force it to save the tape in memory rather than on disk), but I recently found a patch at (http://www.sc.rwth-aachen.de/willkomm/) that replaces ADOL-C’s memory manager with something a bit more modern. The site I linked to also has a presentation (PDF) benchmarking a few AD packages which might be of interest.

As for the performance hit that comes with using a tape, I’ve noticed that ADOL-C, and perhaps the operator-overloading / tape method in general (I’m not a computer scientist), has a high fixed cost in terms of speed, but relatively low cost in terms of calculating additional higher-order tensors. For example, I’m using Girolami/Calderhead’s MALA, which relies on the third-derivative of log probability function. G&C’s paper includes an approximation (constant curvature) that only requires the Fisher Information matrix, so I implemented that first. However, there appears to be very little speed difference between stopping at the second derivative and going all the way to full MALA.

Any other success stories out there?

• Bob Carpenter Says:

The tape’s a huge memory sink. I don’t see how else you can do reverse-mode, though.

We’re about ready to release the first version of our HMC sampler with auto-dif. We wound up writing our own auto-dif that’s both faster (not by much) and more flexible (by a fair bit) than either RAD/Sacado or CppAD. We based in on an extensible OO design that overrides operator new to manage the auto-dif variables on a stack.

It’s very special purpose, though. We also didn’t template values out, so there’s not a good way to do second-order difs. But reverse-reverse isn’t ideal, at least the way any of the standard packages go about it. For second-order (i.e., Hessians), it’d be better to do N forward-reverse mode passes.

We went with Eigen, whose developers have been really helpful. For Eigen 3.0.1, they removed explicit namespaces on some of their internals, which allows all of the functions to be used (we use Cholesky, eigenvalues/vectors, determinants and inverses, as well as all the basic arithmetic). It all works very well if all the variables are auto-dif variables.

There’s no way in Eigen to deal with multiplying a vector of doubles by a matrix of auto-dif variables. I’ve put in a request and they’ve sketched a solution for mixed-type operations, but no one’s implemented it and it’s not something that’s a high priority for the developers. (They specially hard-coded the complex-double case.)

For now, we’re just wrapping our double matrices in auto-dif variables operation by operation so we could template everything and easily code generate (we’re generating code from model specs like BUGS). Wrapping is a huge waste of space (and hence time), but it does the right thing in terms of behavior. The real bummer is that the way I wrapped it, it defeats their clever template expressions. But the real speed gain will not be from laziness through templates, but by short-circuiting the auto-dif to make it more efficient (who knew so many matrix ops had analytical derivatives?).

Luckily, we don’t have too many matrix ops. They only show up in multivariate distros. It was a huge pain to get an unconstrained representation of correlation and covariance matrices. We used the Lewandowski, Kurowicka and Joe vines construction, which gives you (k choose 2) parameters for a correlation matrix and another k for a covariance matrix. I’m becoming quite adept at complex Jacobians (we also needed to finesse simplexes to k-1 unconstrained values and ordered scalars for ordinal logit cutpoints).

We also had to implement our own log probability functions. We needed something like normal(y,mu,sigma) to have any or all of y, mu and sigma be auto-dif variables. The standard libs just have a single template variable, which is again wasteful. We also added lots of other useful functions like log_sum_exp, softmax, log gamma, and so on.


text:
How to Multiply Fractions – Step-by-step

To multiply two or more fractions, we simply have to multiply the numerators and denominators separately. However, if we have whole numbers or mixed fractions, we convert them to improper fractions before multiplying. Finally, we simplify the resulting fraction if possible.

Here, we will learn how to multiply fractions step by step. We will look at some examples in which we will apply these steps to solve the multiplication of fractions.

ARITHMETIC

Relevant for

Learning to multiply two or more fractions.

See steps

ARITHMETIC

Relevant for

Learning to multiply two or more fractions.

See steps

Steps to multiply fractions

To multiply fractions, we can follow the following steps:

Step 1: Convert mixed fractions or whole numbers to improper fractions, if any.

If we have whole numbers, we simply write 1 as the denominator. If we have mixed fractions, we multiply the whole number by the denominator and add the result to the numerator.

Step 2: Multiply the numerators.

Step 3: Multiply the denominators.

Step 4: Simplify the final fraction if possible.

Multiplying fractions – Examples with answers

Each of the following examples has its respective solution. We use the steps to solve the multiplication of fractions seen above.

EXAMPLE 1

Solve the multiplication of fractions $latex \frac{2}{3}\times \frac{1}{2}$.

Step 1: We don’t have mixed fractions or whole numbers.

Step 2: Multiplying the numerators, we have:

$$\frac{2}{3}\times \frac{1}{2}$$

$$=\frac{2\times 1}{3\times 2}$$

$$=\frac{2}{3\times 2}$$

Step 3: Multiplying the denominators, we have:

$$=\frac{2}{6}$$

Step 4: We divide by 2 to simplify:

$$=\frac{1}{3}$$

EXAMPLE 2

Find the product of the multiplication $latex \frac{5}{7}\times \frac{3}{5}$.

Step 1: This multiplication doesn’t have whole numbers or mixed fractions.

Step 2: By multiplying the numerators, we have:

$$\frac{5}{7}\times \frac{3}{5}$$

$$=\frac{5\times 3}{7\times 5}$$

$$=\frac{15}{7\times 5}$$

Step 3: By multiplying the denominators, we have:

$$=\frac{15}{35}$$

Step 4: We divide by 5 to simplify:

$$=\frac{3}{7}$$

EXAMPLE 3

Solve the multiplication of fractions $latex 1\frac{2}{3}\times \frac{1}{4}$.

Step 1: Converting the mixed fraction to an improper fraction, we have:

$$1\frac{2}{3}\times \frac{1}{4}$$

$$=\frac{5}{3}\times \frac{1}{4}$$

Step 2: Multiplying the numerators, we have:

$$\frac{5}{3}\times \frac{1}{4}$$

$$=\frac{5\times 1}{3\times 4}$$

$$=\frac{5}{3\times 4}$$

Step 3: Multiplying the denominators, we have:

$$=\frac{5}{12}$$

Step 4: The fraction is now simplified.

EXAMPLE 4

Solve the multiplication of fractions $latex 2\times \frac{3}{4}\times \frac{1}{5}$.

Step 1: We write the integer as follows:

$$2\times \frac{3}{4}\times \frac{1}{5}$$

$$=\frac{2}{1}\times \frac{3}{4}\times \frac{1}{5}$$

Step 2: By multiplying the numerators, we have:

$$=\frac{2\times 3 \times 1}{1\times 4\times 5}$$

$$=\frac{6}{1\times 4\times 5}$$

Step 3: By multiplying the denominators, we have:

$$=\frac{6}{20}$$

Step 4: We divide by 2 to simplify:

$$=\frac{3}{10}$$

EXAMPLE 5

Find the product of multiplication $latex \frac{2}{3}\times \frac{4}{5}\times \frac{1}{2}$.

Step 1: We don’t have mixed fractions or whole numbers.

Step 2: Multiplying the numerators, we have:

$$\frac{2}{3}\times \frac{4}{5} \times \frac{1}{2}$$

$$=\frac{2\times 4 \times 1}{3\times 5 \times 2}$$

$$=\frac{8}{3\times 5 \times 2}$$

Step 3: Multiplying the denominators, we have:

$$=\frac{8}{30}$$

Step 4: We can simplify by dividing by 2:

$$=\frac{4}{15}$$

EXAMPLE 6

Solve the multiplication of fractions $latex 2\frac{3}{4}\times 1\frac{1}{2}\times \frac{4}{5}$.

Step 1: Converting the mixed fractions to improper fractions, we have:

$$2\frac{3}{4}\times 1\frac{1}{2}\times \frac{4}{5}$$

$$=\frac{11}{4}\times \frac{3}{2}\times \frac{4}{5}$$

Step 2: By multiplying the numerators, we have:

$$=\frac{11\times 3 \times 4}{4\times 2 \times 5}$$

$$=\frac{132}{4\times 2 \times 5}$$

Step 3: By multiplying the denominators, we have:

$$=\frac{132}{40}$$

Step 4: We divide by 4 to simplify and convert to a mixed fraction:

$$=\frac{33}{10}$$

$$=3\frac{3}{10}$$

Multiplying fractions – Practice problems

Solve the following multiplication of fractions problems to apply everything learned here.