url
stringlengths
14
2.42k
text
stringlengths
100
1.02M
date
stringlengths
19
19
metadata
stringlengths
1.06k
1.1k
https://cstheory.stackexchange.com/questions/11302/software-package-for-decomposing-quantum-circuits
# Software package for decomposing quantum circuits Is there any software package allowing decomposition of unitaries from $U(2^n)$ into quantum circuits over a predefined universal gate set? • I wonder whether there is a more efficient algorithm to do it on a quantum computer :) – Vanessa Feb 17 '12 at 7:24 This package (CUGates.m) was announced on the arXiv a couple of days ago which could be useful for you. It uses Mathematica. I haven't tried it out though, and it may or may not do what you need. From the abstract: This paper presents a highly efficient decomposition scheme and its associated Mathematica notebook for the analysis of complicated quantum circuits comprised of single/multiple qubit and qudit quantum gates. In particular, this scheme reduces the evaluation of multiple unitary gate operations with many conditionals to just two matrix additions, regardless of the number of conditionals or gate dimensions. This improves significantly the capability of a quantum circuit analyser implemented in a classical computer. This is also the first efficient quantum circuit analyser to include qudit quantum logic gates. • I did not find free version of that – Alex 'qubeat' Feb 16 '12 at 18:54 • @AlexV: I found it here. But it was unusually difficult to track down! – qubyte Feb 17 '12 at 1:05 • It is not free. "Your IP address is not registered with CPC. ... If your institute is not a current subscriber to CPC you can take out an individual subscription to the Program Library. ..." – Alex 'qubeat' Feb 17 '12 at 14:39 • You could try contacting the authors. I'm certain that they'd be happy to send you a copy. In any case, where in the question does it stipulate that the software be free? – qubyte Feb 17 '12 at 23:43 • Indeed, and after all, it is not clear, if there is a version for free Mathematica Player – Alex 'qubeat' Feb 18 '12 at 17:26 There was a paper up about 6 years ago on implementing and optimising the Barenco decomposition: http://arxiv.org/abs/quant-ph/0607123 I don't know if they've released their software, or if you need to ask them nicely for it. This website - Quantum Compiler.org - has sourcecode for a python library that does this, in two models, Solovay-Kitaev and Kitaev-Shen-Vyalyi. There is a program “Qubiter” by R.R.Tucci that uses CS decomposition, described in http://arxiv.org/abs/quant-ph/9902062 and distributed free via source code (C++). I just have seen – a link in e-print still valid, the last version is 1-11, but I never used the program myself and so may not comment that. [EDIT] There are (at least) two packages for decomposition in list http://www.quantiki.org/wiki/List_of_QC_simulators In addition to the previous answers, there is a package that computes Fourier transforms for solvable non-commutative groups based on this algorithm. The software has a tool to decompose Fourier transforms into simpler matrices. Such decomposition is essentially an efficient quantum circuit to implement a non-abelian quantum Fourier transform. Although it is not a general-purpose package it is a nice tool if you work with this class of (rather complicated) unitaries. In this context there are no alternatives that I know.
2019-11-19 04:39:13
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.3073178827762604, "perplexity": 962.664529149388}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-47/segments/1573496670006.89/warc/CC-MAIN-20191119042928-20191119070928-00038.warc.gz"}
https://docs.birch.sh/libraries/Standard/classes/MultivariateNormalInverseGammaDistribution/
final class MultivariateNormalInverseGammaDistribution<Arg1, Arg2, Arg3, Arg4>(ν:Arg1, Λ:Arg2, α:Arg3, β:Arg4) < Distribution<Real[_]> Multivariate normal-inverse-gamma distribution. This represents the joint distribution: \begin{align*} \sigma^2 & \sim \mathrm{Inverse-Gamma}(\alpha, \beta) \\ x \mid \sigma^2 & \sim \mathrm{N}(\mu, \Sigma\sigma^2), \end{align*} which may be denoted: (x, \sigma^2) \sim \mathrm{Normal-Inverse-Gamma}(\mu, \Sigma, \alpha, \beta), and is a conjugate prior of a Gaussian distribution with both unknown mean and variance. The variance scaling is independent and identical in the sense that all components of $x$ share the same $\sigma^2$. In model code, it is not usual to use this class directlyDistribution. Instead, establish a conjugate relationship via code such as the following: σ2 ~ InverseGamma(α, β); x ~ Gaussian(μ, Σ*σ2); y ~ Gaussian(x, σ2); where the last argument in the distribution of y must appear in the last argument of the distribution of x. The operation of Σ on σ2 may be multiplication on the left (as above) or the right, or division on the right. ### Member Variables Name Description ν:Arg1 Precision times mean. Λ:Arg2 Precision. α:Arg3 Variance shape. β:Arg4 Variance scale.
2021-09-24 19:16:41
{"extraction_info": {"found_math": true, "script_math_tex": 2, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9936776757240295, "perplexity": 4865.303340930431}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-39/segments/1631780057564.48/warc/CC-MAIN-20210924171348-20210924201348-00154.warc.gz"}
https://www.hackmath.net/en/math-problem/16703
# Lunch Lunch is given to seniors from 12:15 to 12:40 during the Coronavirus pandemic. What angle will the minute hand of clock describe during this time? Result A =  150 ° #### Solution: $t=40 - 15=25 \ \text{min} \ \\ \ \\ A=360 \cdot \ \dfrac{ t }{ 60 }=360 \cdot \ \dfrac{ 25 }{ 60 }=150=150 ^\circ$ Our examples were largely sent or created by pupils and students themselves. Therefore, we would be pleased if you could send us any errors you found, spelling mistakes, or rephasing the example. Thank you! Leave us a comment of this math problem and its solution (i.e. if it is still somewhat unclear...): Be the first to comment! Tips to related online calculators Need help calculate sum, simplify or multiply fractions? Try our fraction calculator. Do you want to convert time units like minutes to seconds? ## Next similar math problems: 1. Lunch Jane eats whole lunch for the 30 minutes. Which part of the lunch is eaten in 180 seconds? 2. Zdeněk Zdeněk picked up 15 l of water from a 100-liter full-water barrel. Write a fraction of what part of Zdeněk's water he picked. 3. In fractions An ant climbs 2/5 of the pole on the first hour and climbs 1/4 of the pole on the next hour. What part of the pole does the ant climb in two hours? 4. Withdrawal If I withdrew 2/5 of my total savings and spent 7/10 of that amount. What fraction do I have in left in my savings? 5. Angles 1 It is true neighboring angles have not common arm? 6. Obtuse angle Which obtuse angle is creating clocks at 17:00? 7. Fraction and a decimal Write as a fraction and a decimal. One and two plus three and five hundredths 8. Teacher Teacher Rem bought 360 pieces of cupcakes for the outreach program of their school. 5/9 of the cupcakes were chocolate flavor and 1/4 wete pandan flavor and the rest were a vanilla flavor. How much more pandan flavor cupcakes than vanilla flavor? 9. Write 2 Write 791 thousandths as fraction in expanded form. 10. Cupcakes 2 Susi has 25 cupcakes. She gives 4/5. How much does she have left? 11. Pizza 4 Marcus ate half pizza on monday night. He than ate one third of the remaining pizza on Tuesday. Which of the following expressions show how much pizza marcus ate in total? 12. Fraction to decimal Write the fraction 3/22 as a decimal. 13. Mixed2improper Write the mixed number as an improper fraction. 166 2/3 14. Lengths of the pool Miguel swam 6 lengths of the pool. Mat swam 3 times as far as Miguel. Lionel swam 1/3 as far as Miguel. How many lengths did mat swim? 15. Passenger boat Two-fifths of the passengers in the passenger boat were boys. 1/3 of them were girls and the rest were adult. If there were 60 passengers in the boat, how many more boys than adult were there? 16. Two dogs Izzy's dog is 10 1/2 years old. Paige's dog is 18 months old. How many years older is Izzy's dog? 17. Videotape Viera bought a videotape on which you can record programs with a total length of 240 minutes. She recorded a sci fi movie 1 hour and 28 minutes long, five ten-minute sessions "aerobics at home." Can she fits on the tape even film of Robin Hood who takes
2020-05-25 16:58:23
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 1, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.5789605379104614, "perplexity": 4937.410048482987}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2020-24/segments/1590347389309.17/warc/CC-MAIN-20200525161346-20200525191346-00190.warc.gz"}
http://mathhelpforum.com/differential-geometry/100838-uniform-convergence.html
1. ## Uniform convergence Can someone give me some help on this problem? Let $f_n(x)=\frac{4}{4+x^n}$ on $[0,\infty)$ I think $\{f_n(x)\}$ converges to $f(x)=0$. Now I want to determine if this convergence is uniform or not. I tried to take the derivative to use the Weierstrass-M test, but I am stuck on finding the sup. Also, does this sequence converge uniformly if we change the domain to $(1,\infty)$ 2. Originally Posted by jackie Can someone give me some help on this problem? Let $f_n(x)=\frac{4}{4+x^n}$ on $[0,\infty)$ I think $\{f_n(x)\}$ converges to $f(x)=0$. Now I want to determine if this convergence is uniform or not. I tried to take the derivative to use the Weierstrass-M test, but I am stuck on finding the sup. Also, does this sequence converge uniformly if we change the domain to $(1,\infty)$ The function it converges to is not the zero function. If $0\leq x < 1$ then $x^n \to 0$ so $\frac{4}{4+x^n} \to 1$. If $x=1$ then $x^n \to 1$ so $\frac{4}{4+x^n} \to \frac{4}{5}$. If $x>1$ then $x^n \to \text{me}$ so $\frac{4}{4+x^n} \to 0$. The converges is not uniform because the function it coverges to is not continous. Remember, uniform convergence of continous functions is continous, this is not the case here. Thus, it cannot be uniform. 3. Originally Posted by ThePerfectHacker The function it converges to is not the zero function. If $0\leq x < 1$ then $x^n \to 0$ so $\frac{4}{4+x^n} \to 1$. If $x=1$ then $x^n \to 1$ so $\frac{4}{4+x^n} \to \frac{4}{5}$. If $x>1$ then $x^n \to \text{me}$ so $\frac{4}{4+x^n} \to 0$. The converges is not uniform because the function it coverges to is not continous. Remember, uniform convergence of continous functions is continous, this is not the case here. Thus, it cannot be uniform. Thank you so much, TPH. I forgot to look at cases of x on the given domain. So, if the domain is $(1,\infty)$, then it will be the third case, and the function $f(x)=0$ is a continuous function. Is the converse of the theorem you said true? 4. Originally Posted by jackie Thank you so much, TPH. I forgot to look at cases of x on the given domain. So, if the domain is $(0,\infty)$, then it will be the third case, and the function $f(x)=0$ is a continuous function. Is the converse of the theorem you said true? Think you meant: "if the domain is $(1,\infty)$, ..." 5. Originally Posted by jackie Thank you so much, TPH. I forgot to look at cases of x on the given domain. So, if the domain is $(1,\infty)$, then it will be the third case, and the function $f(x)=0$ is a continuous function. Is the converse of the theorem you said true? The converse of the theorem is not true. Also, even on $(1,\infty)$ the convergence is not uniform. Before we explain why remember that $(1+\tfrac{1}{n})^n < e$ for all $n\geq 1$. Assume that $f_n(x) = \tfrac{4}{4+x^n}$ converged uniformly to the zero function, then it means for any $\varepsilon>0$ there is integer $N>0$ such that if $n\geq N$ then $|f_n(x)| < \varepsilon$ for all $x\in (1,\infty)$. Let us assume that this is true. So for a specific $\varepsilon > 0$ we have $\tfrac{4}{4+x^n} < \varepsilon$ for all $x\in (1,\infty)$ where $n\geq N$. If this inequality is true for all $x$ then it is true for $x=1+\tfrac{1}{n}$. Thus, we must have $\tfrac{4}{4+\left(1+\tfrac{1}{n} \right)^n} < \varepsilon$. However, $\tfrac{4}{4+\left(1+\tfrac{1}{n} \right)^n} \geq \tfrac{4}{4+e}$. This means if we choose $\varepsilon < \tfrac{4}{4+e}$ then we would have a contradition for $x=1+\tfrac{1}{n}$. Therefore, the sequence cannot converge uniformly. 6. Originally Posted by ThePerfectHacker The function it converges to is not the zero function. If $0\leq x < 1$ then $x^n \to 0$ so $\frac{4}{4+x^n} \to 1$. If $x=1$ then $x^n \to 1$ so $\frac{4}{4+x^n} \to \frac{4}{5}$. If $x>1$ then $x^n \to \text{me}$ so $\frac{4}{4+x^n} \to 0$. The converges is not uniform because the function it coverges to is not continous. Remember, uniform convergence of continous functions is continous, this is not the case here. Thus, it cannot be uniform. $x^n$ goes to you? Because you are infinite? 7. Originally Posted by Sampras $x^n$ goes to you? Because you are infinite? Exactly. Now you are understanding me better. Of course, you shall never be able to understand me because I am too great.
2017-03-24 18:09:29
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 65, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9867821335792542, "perplexity": 111.51817207961507}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2017-13/segments/1490218188550.58/warc/CC-MAIN-20170322212948-00559-ip-10-233-31-227.ec2.internal.warc.gz"}
https://byjus.com/question-answer/how-many-terms-of-the-ap-63-60-57-54-must-be-taken-so-that-2/
Question # How many terms of the AP $$63, 60, 57, 54,...$$ must be taken so that their sum is $$693$$? Explain the double answer. Solution ## AP is $$63, 60, 57, 54,....$$Consider$$a =$$ First term$$d =$$ Common difference$$n =$$ number of termsHere, $$a=63, d=60-63=-3$$ and sum $$=S_n=693$$$$S_n=\dfrac{n}{2}[2a+(n-1)d]\\$$$$693=\dfrac{n}{2}[2\times 63+(n-1)(-3)]$$$$693\times 2=n(126-3n+3)$$$$1386=n(129-3n)$$$$1386=129n-3n^2$$$$3n^2-129n+1386=0$$$$n^2-43n+462=0$$Which is a quadratic equation$$n^2-21n-22n+462=0$$$$n(n-21)-22(n-21)=0$$$$(n-21)(n-22)=0$$Either, $$n-21=0$$, then $$n=21$$or $$n-22=0$$, then $$n=22$$Number of terms$$=21$$ or $$22$$$$T_{22}=a+(n-1)d$$$$=63+(22-1)(-3)$$$$=63+21\times (-3)=63-63=0$$Which shows that, $$22$$th term of AP is zero.Number of terms are $$21$$ or $$22$$. So there will be no effect on the sum.MathematicsRS AgarwalStandard X Suggest Corrections 0 Similar questions View More Same exercise questions View More People also searched for View More
2022-01-27 22:54:16
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.8035466074943542, "perplexity": 3164.7838183716744}, "config": {"markdown_headings": true, "markdown_code": false, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2022-05/segments/1642320305317.17/warc/CC-MAIN-20220127223432-20220128013432-00002.warc.gz"}
https://www.semanticscholar.org/paper/Enumerative-geometry-via-the-moduli-space-of-super-Norbury/871cb9f2da7f1bdc03c4339d00ad601ee903b7ea
• Corpus ID: 218581376 # Enumerative geometry via the moduli space of super Riemann surfaces @article{Norbury2020EnumerativeGV, title={Enumerative geometry via the moduli space of super Riemann surfaces}, author={Paul T. Norbury}, journal={arXiv: Algebraic Geometry}, year={2020} } • P. Norbury • Published 9 May 2020 • Mathematics • arXiv: Algebraic Geometry In this paper we relate volumes of moduli spaces of super Riemann surfaces to integrals over the moduli space of stable Riemann surfaces $\overline{\cal M}_{g,n}$. This allows us to use a recursion between the super volumes recently proven by Stanford and Witten to deduce recursion relations of a natural collection of cohomology classes $\Theta_{g,n}\in H^*(\overline{\cal M}_{g,n})$. We give a new proof that a generating function for the intersection numbers of $\Theta_{g,n}$ with tautological… ## Figures from this paper $${\mathcal {N}}=1$$ super topological recursion • Physics Letters in Mathematical Physics • 2021 We introduce the notion of $${\mathcal {N}}=1$$ N = 1 abstract super loop equations and provide two equivalent ways of solving them. The first approach is a recursive formalism that can be Cut-and-join operators for higher Weil-Petersson volumes In this paper, we construct the cut-and-join operator description for the generating functions of all intersection numbers of ψ, κ, and Θ classes on the moduli spaces Mg,n. The cut-and-join operators Polynomial relations among kappa classes on the moduli space of curves • Mathematics • 2021 We construct an infinite collection of universal—independent of (g, n)—polynomials in the Miller-Morita-Mumford classes κm ∈ H(Mg,n,Q), defined over the moduli space of genus g stable curves with n Higher Br\'ezin-Gross-Witten tau-functions and intersection theory of Witten's and Norbury's classes • Mathematics • 2022 . In this paper, we consider the higher Br´ezin–Gross–Witten tau-functions, given by the matrix integrals. For these tau-functions we construct the canonical Kac–Schwarz operators, quantum spectral KP integrability of triple Hodge integrals. III. Cut-and-join description, KdV reduction, and topological recursions In this paper, we continue our investigation of the triple Hodge integrals satisfying the Calabi–Yau condition. For the tau-functions, which generate these integrals, we derive the complete families A Simple Recursion for the Mirzakhani Volume and its Super Extension In this paper, we derived a simple recursion formula for the volumes of moduli spaces of hyperbolic surfaces with boundaries. This formula reflects clearly that the volumes are polynomials. By A Simple Recursion for the Mirzakhani Volume and its Supersymmetric Extension In this paper, we derived a simple recursion formula for the volumes of moduli spaces of hyperbolic surfaces with boundaries. This formula reflects clearly that the volumes are polynomials. By Cut-and-join operators in cohomological field theory and topological recursion We construct a cubic cut-and-join operator description for the partition function of the Chekhov–Eynard–Orantin topological recursion for a local spectral curve with simple ramification points. In Generalized Br\'ezin-Gross-Witten tau-function as a hypergeometric solution of the BKP hierarchy In this paper, we prove that the generalized Brézin–Gross–Witten taufunction is a hypergeometric solution of the BKP hierarchy with simple weight generating function. We claim that it describes a D ec 2 02 0 Intersection numbers on M g , n and BKP hierarchy In their recent inspiring paper Mironov and Morozov claim a surprisingly simple expansion formula for the Kontsevich–Witten tau-function in terms of the Schur Q-functions. Here we provide a similar ## References SHOWING 1-10 OF 66 REFERENCES A new cohomology class on the moduli space of curves We define a collection of cohomology classes $\Theta_{g,n}\in H^{4g-4+2n}(\overline{\cal M}_{g,n})$ for $2g-2+n>0$ that restrict naturally to boundary divisors. We prove that a generating function Gromov-Witten invariants of $\mathbb{P}^1$ coupled to a KdV tau function We consider the pull-back of a natural sequence of cohomology classes $\Theta_{g,n}\in H^{2(2g-2+n)}(\overline{\cal M}_{g,n})$ to the moduli space of stable maps ${\cal M}^g_n(\mathbb{P}^1,d)$. These Invariants of spectral curves and intersection theory of moduli spaces of complex curves To any spectral curve S, we associate a topological class {\Lambda}(S) in a moduli space M^b_{g,n} of "b-colored" stable Riemann surfaces of given topology (genus g, n boundaries), whose integral Decorated super-Teichmüller space • Mathematics Journal of Differential Geometry • 2019 We introduce coordinates for a principal bundle $S\tilde T(F)$ over the super Teichmueller space $ST(F)$ of a surface $F$ with $s\geq 1$ punctures that extend the lambda length coordinates on the Topological recursion on the Bessel curve • Mathematics • 2016 The Witten-Kontsevich theorem states that a certain generating function for intersection numbers on the moduli space of stable curves is a tau-function for the KdV integrable hierarchy. This Towards an Enumerative Geometry of the Moduli Space of Curves The goal of this paper is to formulate and to begin an exploration of the enumerative geometry of the set of all curves of arbitrary genus g. By this we mean setting up a Chow ring for the moduli JT gravity as a matrix integral • Mathematics • 2019 We present exact results for partition functions of Jackiw-Teitelboim (JT) gravity on two-dimensional surfaces of arbitrary genus with an arbitrary number of boundaries. The boundaries are of the Moduli of vector bundles on curves with parabolic structures • Mathematics • 1980 Let H be the upper half plane and T a discrete subgroup of AutH. Suppose that H mod Y is of finite measure. This work stems from the question whether there is an algebraic interpretation for the On the tautological ring of Mg,n In this section, we briefly describe the objects under consideration for the sake of non-experts. A more detailed informal exposition of these well-known ideas is given in [PV]. When studying Riemann
2022-05-25 23:33:25
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.7823616862297058, "perplexity": 904.7058946594243}, "config": {"markdown_headings": true, "markdown_code": false, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2022-21/segments/1652662594414.79/warc/CC-MAIN-20220525213545-20220526003545-00685.warc.gz"}
http://physics.oregonstate.edu/BridgeBook/book:math:msurfaces
### Surfaces There are many ways to describe a surface. How many can you think of? Take a moment to make a list before reading further. Consider the following descriptions of a surface: • the upper half of the unit sphere; • $x^2+y^2+z^2=1$ with $z\ge0$; • the graph of $z=+\sqrt{1-x^2-y^2}$; • $x=\sin\theta\cos\phi$, $y=\sin\theta\sin\phi$, $z=\cos\theta$, with $\theta\in[0,\frac{\pi}{2}]$ and $\phi\in[0,2\pi)$; And there are more, involving spherical coordinates and vectors: • $r=1$ (where $r$ is the spherical radial coordinate); • $\rr = x\,\xhat + y\,\yhat + z\,\zhat$, with $x$, $y$, $z$ given as above; All of these descriptions describe the same surface. Which representation is best for a given problem depends on the circumstances. The simplest surfaces are those given by holding one of the coordinates constant. Thus, the $xy$-plane is given by $z=0$. Just as any line (in the $xy$-plane) can be written in the form $$ax+by = e \label{lineab}$$ for some constants $a,b,e$, any plane can be written as $$ax+by+cz = e \label{planeabc}$$ for some constants $a,b,c,e$. For (nonvertical, i.e. $b\ne0$) lines, one often writes (\ref{lineab}) in slope-intercept form as $$y = Ax + C$$ with $A=-a/b$ and $C=e/b$. Similarly, nonvertical planes ($c\ne0$) are often written in the form $$z = Ax + By + C$$ where now $A=-a/c$, $B=-b/c$, and $C=e/c$. $A$ and $B$ determine the slopes of such planes in the $x$ and $y$ directions, respectively; two planes with the same values of $A$ and $B$ are parallel. Many surfaces, including nonvertical planes, are the graph of some function, typically written $z=f(x,y)$. For example, $z=ax^2+by^2$ describes an elliptic paraboloid; the special case $a=b$ is often simply called a paraboloid. But not all surfaces are expressible as the graph of a function, and even those which are often have simpler representations. For example, the upper half of a sphere was written above as the graph of $z=\sqrt{1-x^2-y^2}$, yet the equation on the previous line, obtained by squaring both sides, is simpler. And the sphere itself can not be written as the graph of a single function, yet the same equation can be used for the entire sphere, namely $x^2+y^2+z^2=1$. More generally, we can graph equations, not merely functions. How can you visualize and graph such surfaces? One way is to consider what the surface looks like if one of the variables is held constant; the resulting curves are called traces of the surface. A better name might be slices, as this method amounts to slicing the surface parallel to some plane, then imagining how to stack the resulting slices.
2019-11-13 22:54:23
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 4, "x-ck12": 0, "texerror": 0, "math_score": 0.8903757929801941, "perplexity": 225.30563194196682}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-47/segments/1573496667442.36/warc/CC-MAIN-20191113215021-20191114003021-00519.warc.gz"}
https://socratic.org/questions/what-is-the-area-of-a-rectangle-with-a-length-of-45cm-and-width-of-30cm
# What is the area of a rectangle with a length of 45cm and width of 30cm? May 3, 2018 $1350 c {m}^{2}$ #### Explanation: To find the area of a rectangle, simply multiply its length by its width: $A = L w$, with $L =$ length and $w =$ width. The length and width of your rectangle has been given! All we have to do is plug them into our area equation: $A = 45 c m \cdot 30 c m = 1350 c {m}^{2}$ $1350 c {m}^{2}$ is your final answer!
2020-02-19 20:38:06
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 6, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.8334978818893433, "perplexity": 504.0179271189231}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2020-10/segments/1581875144167.31/warc/CC-MAIN-20200219184416-20200219214416-00327.warc.gz"}
https://undergroundmathematics.org/introducing-calculus/speed-vs-velocity
### Introducing Calculus Building blocks In Discussing distance we mentioned speed and velocity. Average speed is the rate your distance changes in a set period of time, for example $\quantity{50}{km}$ in $1$ hour. If you walk to school you will speed up, slow down, perhaps even stop. Your speed will not stay the same, but we can talk about your average speed for the trip. Velocity is similar but, like displacement, also depends on direction. If you average $\quantity{3}{km/h}$ on your walk to school, and walk home in the same amount of time, your velocity for the return part of your journey would be $\quantity{-3}{km/h}$.
2021-09-20 06:04:50
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.7671204209327698, "perplexity": 532.8045015709404}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-39/segments/1631780057018.8/warc/CC-MAIN-20210920040604-20210920070604-00357.warc.gz"}
https://puzzling.stackexchange.com/questions/51433/can-you-find-the-missing-number-in-this-grid/51493
Can you find the missing number in this grid? Can you find the missing number? • What is this from? Be sure to credit the source when posting a puzzle not your own. – dcfyj May 1 '17 at 13:21 • It's from new notification application Okay sure. – Ashwin Indianic May 1 '17 at 13:29 The answer is 2. The second and third column in each row, multiplied together, give the first column. Answer is 2. In each Row,column ONE is equal to multiple of rest of two columns. (C1=C2*C3) 9=3*3 6=2*3 8=4*2 (or) (C1/C2 = C3) 9/3=3 6/2=3 8/4=2 • It's probably not a bad idea to 'spoilerize' your answer by prefixing it with >!. – Jeff Zeitlin May 2 '17 at 7:20 Also... The 3rd row = 2*(1st row - 2nd row) + 2. So once again, 2.
2019-11-17 23:26:04
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.5161125063896179, "perplexity": 2265.0019276092075}, "config": {"markdown_headings": false, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-47/segments/1573496669352.5/warc/CC-MAIN-20191117215823-20191118003823-00037.warc.gz"}
http://www.mathworks.com/help/comm/ref/comm.psktcmmodulator.step.html?nocookie=true
Accelerating the pace of engineering and science # step System object: comm.PSKTCMModulator Package: comm Convolutionally encode binary data and map using M-ary PSK constellation Y = step(H,X) Y = step(H,X,R) ## Description Y = step(H,X) convolutionally encodes and modulates the input binary data column vector, X, and returns the encoded and modulated data, Y. X must be of data type numeric, logical, or unsigned fixed point of word length 1 (fi object). When the convolutional encoder represents a rate K/N code, the length of the input vector, X, must be K$×$L, for some positive integer L. The step method outputs a complex column vector, Y, of length L. Y = step(H,X,R) resets the encoder of the PSK TCM modulator object to the all-zeros state when you input a reset signal, R, that is non-zero. R must be a double precision or logical scalar integer. This syntax applies when you set the ResetInputPort property to true. Note:   H specifies the System object™ on which to run this step method.The object performs an initialization the first time the step method is executed. This initialization locks nontunable properties and input specifications, such as dimensions, complexity, and data type of the input data. If you change a nontunable property or an input specification, the System object issues an error. To change nontunable properties or inputs, you must first call the release method to unlock the object.
2014-12-21 18:04:04
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 1, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.297097772359848, "perplexity": 3245.2118934295577}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2014-52/segments/1418802772125.148/warc/CC-MAIN-20141217075252-00088-ip-10-231-17-201.ec2.internal.warc.gz"}
https://www.futurelearn.com/courses/logic-the-philosophical-science-of-truth/0/steps/157674
## Want to keep learning? This content is taken from the University of York's online course, Logic: The Language of Truth. Join the course to learn more. 4.14 ## University of York Skip to 0 minutes and 0 seconds Let’s look at an example of logical equivalence. The example we’ll look at here has a name. It’s called De Morgan’s Law, after a famous logician, Augustus de Morgan. De Morgan’s Law says that ‘(P and Q)’ is logically equivalent to ‘not (not P or not Q)’. If it’s logically equivalent, then it should be that ‘(P and Q)’ entails ‘not (not P or not Q)’ and that ‘not (not P or not Q) entails ‘(P and Q)’. Let’s look at this using a truth table. We start by setting out the four ways things could be with the truth values of ‘P’ and ‘Q’. Skip to 0 minutes and 50 seconds Then we put: ‘(P and Q)’. The truth Skip to 0 minutes and 58 seconds values for that are: true, false, false, false. And now we going to have to do this, [ie. ‘not(not-P or not-Q)] which is a little more complicated. Let’s start with ‘not P’. ‘Not P’ is false, false, true, true. ‘Not Q’ is false, true, false, true. OK. Now, Skip to 1 minute and 22 seconds not-P or not-Q: False and false [gives] false. False and true [gives] true. True and false [gives] true. True and true [gives] true. And now the last operator, the tilde there. If we have false for the plugged-in clause, we’ll get true under the tilde. If we have true for the clause, we’d get false under the tilde. So, that’s the truth table for this compound sentence. And look, ‘(P and Q)’ on the first line of the truth table is true, and so is our complex sentence. On the second row, they are both false. Third row, both false. On the final row, both false. Skip to 1 minute and 56 seconds So you can see the ‘(P and Q)’ is true in exactly the same circumstances as ‘not (not P or not Q)’ and that means they are logically equivalent. Now there are several reforms of the De Morgan’s Law, and you can test some for yourself. One form says ‘(P or Q)’ is equivalent to ‘not (not P and not Q)’. You can see the pattern here. De Morgan’s Law says take a conjunction or a disjunction, change it to the other. Skip to 2 minutes and 24 seconds (If it’s a conjunction change it to a disjunction if it’s a disjunction, change it to a conjunction.) Put a tilde in front of the sentences either side, and then put a tilde in front of the whole clause, and you get something logically equivalent. # Logical equivalence: De Morgan's law This video gives an example of testing for logical equivalence using a truth-table. In this case, we show that ‘(P & Q)’ is logically equivalent to ‘~(~P $$\vee$$ ~Q)’. This equivalence is called De Morgan’s Law.
2020-10-25 19:52:45
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.38375911116600037, "perplexity": 1132.315127969195}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 20, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2020-45/segments/1603107889651.52/warc/CC-MAIN-20201025183844-20201025213844-00500.warc.gz"}
https://www.nature.com/articles/s41699-018-0049-3?error=cookies_not_supported&code=166d3170-fb1b-45c2-8303-e52c9559c007
Introduction Two-dimensional (2D) semiconductors1,2,3,4,5 provide a unique opportunity for the realization of ultrathin and ultralight photovoltaic solar cells,6 owing to their strong optical absorption in the solar spectrum region,3,7 high internal radiative efficiencies,8 and favorable band gaps for both single-junction and tandem cells.9 Theoretical estimates of power conversion efficiencies (PCEs) have predicted efficiency values exceeding 25%,9 indicating that 2D semiconductors may become competitive with conventional photovoltaic technologies. The suitability of 2D materials for photovoltaic applications was first demonstrated in lateral p-n junctions,10,11,12 defined by split-gate electrodes, and in lateral Schottky junctions.13 However, those device architectures do not allow for easy scalability of the photoactive area, for which a vertical junction would be desirable. Vertical van der Waals heterostructures14 can be obtained by manual stacking15,16 or growth17,18,19 of different 2D materials in a layered configuration. It has been shown that MoS2 and WSe2, when placed on top of each other, form a type-II heterojunction,20,21,22,23,24 with the lowest-energy conduction band states spatially located in the MoS2 layer and the highest-energy valence band states in WSe2. Relaxation of photogenerated carriers, driven by the conduction and valence band offsets, then results in a charge transfer across the 2D junction and a sizeable photovoltaic effect.20,21,22 Similar results have been obtained using other material combinations that exhibit type-II band alignment, including MoS2/WS2,25 MoS2/black phosphorus,26,27 MoTe2/MoS2,28,29 GaTe/MoS2,30 MoSe2/WSe2,31,32 MoS2/carbon nanotubes,33 MoS2/pentacene,34 MoS2/silicon,35,36 and many more. In addition, homojunction architectures have been explored, in which chemical doping is applied to form a vertical p–n junction in the same 2D material. Examples include plasma-induced p-doping of the upper layers in an n-type MoS2 multi-layer crystal37 and mechanical stacking of few-layer flakes of n-type MoS2:Fe on top of p-type MoS2:Nb.38 In an optimized ~15 nm thick MoS2/WSe2 heterostructure, an experimental absorbance of >90%, an external quantum efficiency (EQE; the ratio between collected charge carriers and incident photons) exceeding 50%, and a (single-wavelength) PCE of 3.4% have been achieved.39 The PCE, defined as the fraction of incident optical power Popt that is converted into electricity with output power Pel, is the most important parameter describing a photovoltaic device. It is given by the product of open-circuit voltage VOC, short-circuit current ISC, and fill factor FF: $$PCE = \frac{{P_{{\mathrm{el}}}}}{{P_{{\mathrm{opt}}}}} = \frac{{V_{{\mathrm{OC}}}I_{{\mathrm{SC}}}FF}}{{P_{{\mathrm{opt}}}}}.$$ (1) Today, fill factors in 2D heterostructure photovoltaic structures are typically in the range 0.3–0.5, only half as large as in conventional silicon solar cells. Closely connected to low fill factors are excessively high (2) ideality factors and low short-circuit currents, pointing towards substantial carrier recombination losses. Open-circuit voltages are typically less than 0.6 V, implying a band gap-VOC offset larger than 0.8 V.9 For all these reasons, PCEs in 2D photovoltaic devices have as yet remained below 5%, much lower then the Shockley–Queisser limit for their band gaps. Besides technological challenges, the lack of a clear picture of the device physics in 2D heterostructure solar cells hampers further progress. Optimization of device architectures, however, will require an in-depth understanding of exciton dissociation, carrier transport processes, and recombination losses. Here, we address these questions by presenting a systematic experimental study of a MoS2/WSe2 van der Waals heterostructure and, based on the results, a model that reproduces the current–voltage characteristics under optical illumination. While we find the exciton dissociation to be very efficient, we also find a considerable pile-up of photocarriers in the device due to poor electrical transport properties, giving rise to carrier recombination and consequently low FF, ISC, and VOC-values. We finally provide guidelines to optimize future device layouts and increase PCEs. Results Van der Waals heterostructure solar cell Figure 1a shows a schematic illustration of the MoS2/WSe2 heterostructure investigated in this work. Both layers exhibit monolayer thickness, as verified by Raman spectroscopy.40,41 An optical micrograph of the device can be found in Supplementary Fig. S1a and details about the fabrication process in the Methods section. The corresponding band diagram under short-circuit conditions is schematically depicted in Fig. 1b. As demonstrated later, the charge transfer from one layer into the other occurs with high efficiency. For the subsequent carrier transport to the contacts, driven by the lateral built-in field, it is hence justified to consider electron concentrations in MoS2 (with quasi-Fermi level EF,e) and hole concentrations in WSe2 (with quasi-Fermi level EF,h) only, as schematically depicted in Fig. 1d. For this reason, we refer to the MoS2 sheet as electron transport layer (ETL) and the WSe2 as hole transport layer (HTL). From the data reported in ref.42, we estimate an effective band gap of Eg,eff = EETL − EHTL = ECB,M − EVB,W≈1.3 eV. As reported previously,20 the electrical characteristics can be controlled by electrostatic doping via a back-gate voltage VG, applied to the silicon substrate (Fig. 1c). For a large positive VG we find resistive n–n behavior, whereas for an appropriate choice of VG an atomically thin p–n junction is formed and the device current I as a function of external bias voltage V displays diode-like rectification behavior (inset in Fig. 1c, dashed line). All further measurements reported in this article were performed in the p–n regime, indicated by the arrows in Fig. 1c. Under optical illumination (solid line), the curve then passes through the fourth quadrant, meaning that electrical power can be extracted. The EQE is ~1% under low-intensity (~1 kWm-2) illumination at 532 nm wavelength and decreases for higher intensities. Compared to traditional solar cells, the device exhibits some unusual behaviors. For example, the photocurrent (PC), defined as Iph = −(Iillum − Idark), changes sign and becomes negative at VVOC. Iph also does not become fully saturated under reverse bias, which is an indication for insufficient carrier extraction. These characteristics have been consistently observed not only in all devices that we investigated, but also in many other van der Waals heterostructures reported in literature. Transport model The current–voltage I(V) characteristic of a photovoltaic solar cell is usually described by the Shockley diode equation43 $$I\left( V \right) = I_0\left[ {{\mathrm{exp}}\left( {\frac{{qV}}{{n_{{\mathrm{id}}}k_{\mathrm{B}}T}}} \right) - 1} \right] - I_{\mathrm{G}},$$ (2) where I0 is the dark generation current, q the elementary charge, kB Boltzmann’s constant, and T the temperature. IG denotes the photogenerated current and nid is the ideality factor whose value depends on the type of recombination mechanism: nid = 1 for direct bimolecular (Langevin) recombination and nid = 2 for trap-mediated (Shockley–Read–Hall) recombination. Under open-circuit conditions (V = VOC) the current becomes zero and the well-known relation ∂VOC/In(Popt) = nidkBT/q is derived, from which the ideality factor can be determined. Figure 2a shows I(V) characteristics of our device at different optical excitation powers (symbols) from which we can readily extract the open-circuit voltages VOC. Together with the incident optical power Popt, we then determine an ideality factor of nid = 1.6 (see Supplementary Fig. S2), which indicates an involvement of both recombination mechanisms.20,21 However, if we plot Eq. (1) with nid = 1.6 in Fig. 2a (dash-dotted line; Popt = 16 nW) we find very poor agreement with the experimental data. The Shockley equation strongly overestimates short-circuit current, fill factor, and forward current. This is in contrast to lateral 2D semiconductor p–n junctions defined by split-gate electrodes, that can be well described by the Shockley model.10,11 To obtain better modeling of solar cells a series (contact) resistance is often taken into account. However, as shown in Supplementary Fig. S3, an extended Shockley model does not either fit our data. Particularly, the strong illumination dependence of the forward current and the interception of the I(V) curves cannot be explained. Another mechanism that can affect the electrical characteristics of solar cells is the build-up of space charge regions at the contacts or in the bulk, as a result of strongly unbalanced electron and hole transport.44 In order to explore this mechanism, we plot in Fig. 2b the current versus compensation voltage VOC − V on a double-logarithmic scale (symbols). The current shows the usual linear dependence at low compensation voltages, due to the competition between drift and diffusion of photogenerated carriers, and then a smooth transition to the saturation regime for larger voltages. The characteristic fingerprint of space charge-limited transport44—a region with square-root dependence I(VOC − V)1/2—is absent. Hence, we conclude that the carrier transport in our device is balanced. A third mechanism that can affect the I(V) characteristics of diodes are interface inhomogeneities. A prominent example are barrier height variations in Schottky diodes,45 that can result in nid > 2. We rule out this possibility for the following reasons. First, the forward current in atomically thin p–n junctions is of different origin than in conventional diodes; it is governed by tunneling-mediated interlayer recombination, rather than carrier injection over a potential barrier.20,21 Second, sample inhomogeneities cannot explain the illumination dependent device behavior. In the following we will instead argue that the photovoltaic response is transport-limited. It is thus inappropriate to employ Shockley’s model, as it does not account for the impact of charge transport (it assumes infinitely large conductivities for electrons and holes). In order to obtain better modelling of the I(V) characteristics we follow the approach by Würfel et al. initially developed for organic solar cells.46 In brief, carrier accumulation due to poor transport properties leads to a quasi-Fermi level splitting qVint = EF,e − EF,h in the electron and hole transport layers that differs from the externally applied voltage: Vint = V − ξI/σ where σ is the electrical conductivity under optical illumination and ξ is a geometry factor with unit m−1. It is only for open-circuit conditions that Vint = V, and the Shockley equation (2) can be employed. For all other biases, where I ≠ 0, it has been suggested46 to use Vint in (2) instead of V. A closed form approximation of the I(V) curves can then be derived,47 that has been shown to reproduce the results of full drift-diffusion simulations for a wide range of parameters: $$I\left( V \right) = I_{\mathrm{G}}\left\{ {{\mathrm{exp}}\left[ {\frac{{q\left( {V - V_{{\mathrm{OC}}}} \right)}}{{k_{\mathrm{B}}T\left( {1 + \alpha } \right)}}} \right] - 1} \right\},$$ (3) with a dimensionless figure of merit α, that is a direct measure of non-ideal device behavior as a result of insufficient carrier extraction. It is given by $$\alpha = \xi \frac{q}{{k_{\mathrm{B}}T}}\frac{{I_{\mathrm{G}}}}{{\sigma _{\mathrm{i}}}}{\mathrm{exp}}\left( { - \frac{{qV_{{\mathrm{OC}}}}}{{2k_{\mathrm{B}}T}}} \right),$$ (4) where σi denotes the intrinsic electrical conductivity in the dark (see Supplementary Note S1 and ref. 47). If we fit Eq. (3) to the experimental data (solid lines in Figs. 2a, b) we find excellent agreement for all illumination intensities. The photogenerated current IG scales linearly with Popt, as expected (see Supplementary Fig. S4). The ideality parameter α varies over a wide range and reaches values as high as ~78. Insufficient carrier extraction, described by large α values, leads to high carrier densities and consequently to a large quasi-Fermi level splitting Vint, even under short-circuit conditions. As the interlayer recombination is governed by Vint, this results in recombination losses and ISC < IG. Under forward bias, the accumulated charge enhances the conductivity, resulting in the experimentally observed crossing of dark and illuminated I(V) curves. As shown in Supplementary Note S2, expression (4) can be further simplified to yield $$\alpha = K\frac{{\sqrt {P_{{\mathrm{opt}}}k_{{\mathrm{rec}}}} }}{{T\mu }},$$ (5) where μ denotes the effective carrier mobility in the electron and hole transport layers, krec is the interlayer recombination coefficient, and all other physical constants and geometry factors have been lumped into the prefactor K. The expression predicts a square-root dependence of α on the optical power, which is indeed observed experimentally (Fig. 3a). The question that remains to be addressed is why the carrier extraction in our device is inefficient, given the rather high mobility of 2D semiconductors (typically 10–100 cm2/Vs). In high-mobility materials, such as crystalline silicon, α approaches zero and the impact of charge transport is negligible. In organic materials, on the other hand, μ is extremely low and transport-limitations are expected. From the dark I(V)s in Fig. 1c it is apparent that varying the sample temperature provides us with an opportunity to tune σi (Idark) in the p-n regime over almost three orders of magnitude. In Fig. 3b (blue symbols) we depict its temperature variation, and we find that it can be described by a thermally activated transport model,48 σi(T)  exp(−Ea/kBT), with an activation energy Ea≈80 meV (dashed line). Next, we record the temperature dependent photovoltaic properties (Fig. 2c). From that we determine α(T) and then, with Eq. (4), the temperature dependence of σi. If we plot the results as red symbols in Fig. 3b, we find a striking similarity with the dark current measurements. The limitation of the present device architecture becomes clear now. For efficient carrier injection/extraction the heterojunction has to be operated in the p–n regime, in which both layers are strongly depleted (sub-threshold regime). Transport of photogenerated carriers then occurs via thermal activation from the impurity band tails (intrinsic or induced by disorder),49,50,51 which results in low effective carrier mobility and, hence, recombination losses. As the parameter α determines the shape of the I(V) curves, it is a good figure of merit to assess the quality of solar cells. Neher et al. suggested an empirical expression that relates α to the fill factor.47 In Fig. 3c we plot this expression for the range of open-circuit voltages that is relevant in this work. In the same plot we summarize our experimental results as circular symbols, where the fill factor was determined, as usual, from the maximum power point: FF = max(Pel)/(VOCISC). We conclude that higher conductivities and lower illumination intensities result in better device performance. Interlayer charge transfer So far, we have assumed an ultrafast interlayer charge transfer (exciton dissociation), and subsequent charge transport in the ETL and HTL on a longer time scale. We now substantiate this claim by presenting PC autocorrelation measurements, a powerful technique to study the carrier dynamics in 2D materials52,53 and heterostructures.54 It exploits the non-linearity of the photoresponse to infer the underlying dynamics of the system. Using this technique, the device is optically excited with a pair of femtosecond laser pulses (0.2 ps pulse duration), and the integrated PC is recorded as a function of the temporal delay between the pulses. Experimental details are presented in the Methods section and Supplementary Figs. S6 and S7. Figure 4a shows the absorbance of our device, as determined by a Kramers–Kronig analysis55 of the reflectance spectrum. We identify absorption peaks at 1.65, 1.89, and 2.03 eV, that can be associated with the excitonic ground-state transition of WSe2 and the A and B-excitons in MoS2, respectively. We set the excitation energy of our pulsed laser to 1.65 eV (laser spectrum in Fig. 4a) to resonantly excite excitons in the WSe2 layer only. The resulting PC thus originates from the electron transfer from WSe2 into MoS2. Figure 4b depicts the power dependence, where above ~0.5 μW average incident power a clear saturation behavior is observed. The non-linearity might either stem from phase–space filling, that leads to absorption saturation, or from many-body interactions, such as exciton-exciton annihilation or Auger recombination. Figure 4c shows autocorrelation traces taken for different pulse energies (symbols). Below saturation (bottom curve), a symmetric trace is obtained with (undersampled) optical interference fringes around zero time delay. The linear photoresponse corresponds to the interferometric first-order autocorrelation of the incident light and does not provide any insight in dynamical device behavior. However, when the pulse energy is increased to exceed the saturation threshold, the autocorrelation data become increasingly asymmetric. The characteristic time constant of the nonlinear background signal can be associated with the exciton dissociation time (see Supplementary Note S3). This time is shorter than the pulse duration and we conclude that the dissociation occurs within less than 0.2 ps, similar to what has been obtained in all-optical pump/probe experiments.56 The charge transfer on a time scale shorter than characteristic transport times, confirms the validity of the transport model in Fig. 1d. It also suggests an efficient charge separation from bound excitons after absorption, despite the large exciton binding energy in 2D materials. Discussion 2D semiconductors contain a significant amount of electronic band tail states.49,50,51 As shown in the previous section, these defects trap charge and adversely affect the electronic transport and, consequently, the PCE. We conclude that the performance of van der Waals heterojunction solar cells is transport-limited and we suggest that Eq. (3) should be used to describe the photovoltaic response, instead of the commonly used Shockley equation. An investigation of the role of defects in the limitation of the open-circuit voltage is beyond the scope of this article, but we note that it is well understood that defects not only reduce FF and ISC, but also VOC.57 To further test out model, we analyzed some exemplary cases from literature. The symbols in Fig. 5a show data points extracted from ref. 21, along with a fit of Eq. (3) as solid line. This work employed a device structure similar to the one presented in this article, but with more favorable (unintentional) doping of the MoS2 and WSe2 layers. This resulted in a comparably high FF despite the high illumination intensity used in the experiment (diamond-shaped symbol in Fig. 3c). We believe that transport-limitations also occur in device architectures that employ optically transparent (graphene or indium-tin-oxide) electrodes for vertical carrier extraction. There, the charge transport occurs on much shorter length scales, but also with extremely low out-of-plane mobilities (~10−2 cm2/Vs).54 In Fig. 5b and c we present two examples taken from refs. 37,39, respectively. The data can again be well fitted by Eq. (3) and the results are summarized as yellow symbols in Fig. 3c. Interestingly, lateral p–n junctions, based on split-gate electrodes, typically show better photovoltaic properties (VOC > 0.85 V,10 FF > 0.7,58 ideality factor < 211) than van der Waals structures. This is explained by the higher electrical conductivities in these devices, because of independent doping of the p and n-type regions. Based on our results, we finally provide guidelines that might allow to avoid charge pile-up in future device architectures and harness the true potential of 2D materials in photovoltaic applications. We suggest (i) to increase the device conductivity, e.g., by elimination of charge traps or by (chemical) doping, and (ii) to make the active region as thin/short as possible to facilitate more efficient charge extraction before recombination. Methods Device fabrication The van der Waals heterojunction device was fabricated by stacking of mechanically exfoliated MoS2 and WSe2 flakes on a SiO2/silicon substrate, as described in our previous work.20 2D semiconductor monolayer thicknesses were verified beforehand by Raman spectroscopy and photoluminescence (see Supplementary Figs. S1b and S5). Palladium/gold contact electrodes were defined using electron-beam lithography and metal evaporation. Palladium was chosen as trade-off between forming an n-type contact to MoS2 and a p-type contact to WSe2. After fabrication, the samples were annealed in vacuum (~5 × 10−6 mbar) for several hours at a temperature of T = 380 K and mounted on a chip holder. Optical measurements The photovoltaic response was measured using a 532 nm wavelength laser, that was focused to a ~1 μm full-width-at-half-maximum (FWHM) spot on the device. The sample was mounted on a motorized XYZ-stage for precise alignment with the laser spot. A camera allowed us to view the illumination position on the device. The optical excitation power was adjusted using a variable optical attenuator and the electrical characteristics were acquired using a Keithley source-meter. Room-temperature measurements were performed under ambient conditions and low-temperature measurements in a flow-cryostat. Time-resolved measurements In time-resolved photocurrent measurements, a sequence of two ultrashort laser pulses (τ p  = 0.2 ps FWHM pulse duration, f R  = 76 MHz repetition rate) was generated using a wavelength-tunable Ti:Sapphire laser and a Michelson interferometer. The time delay between the two pulses was adjustable via a computer-controlled mechanical translation stage in one of the interferometer arms. The laser pulses were then focused with a microscope objective to a ~0.7 μm diameter (FWHM) spot on the sample. Time-resolved experiments were performed at T = 300 K and under ambient conditions. Data availability The data used in this study are available upon request from the corresponding author.
2023-03-29 20:59:14
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.45747312903404236, "perplexity": 1984.0714018729475}, "config": {"markdown_headings": false, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 20, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2023-14/segments/1679296949025.18/warc/CC-MAIN-20230329182643-20230329212643-00720.warc.gz"}
https://www.tutorialspoint.com/control_systems/control_systems_modelling_mechanical.htm
# Modelling of Mechanical Systems In this chapter, let us discuss the differential equation modeling of mechanical systems. There are two types of mechanical systems based on the type of motion. • Translational mechanical systems • Rotational mechanical systems ## Modeling of Translational Mechanical Systems Translational mechanical systems move along a straight line. These systems mainly consist of three basic elements. Those are mass, spring and dashpot or damper. If a force is applied to a translational mechanical system, then it is opposed by opposing forces due to mass, elasticity and friction of the system. Since the applied force and the opposing forces are in opposite directions, the algebraic sum of the forces acting on the system is zero. Let us now see the force opposed by these three elements individually. ### Mass Mass is the property of a body, which stores kinetic energy. If a force is applied on a body having mass M, then it is opposed by an opposing force due to mass. This opposing force is proportional to the acceleration of the body. Assume elasticity and friction are negligible. $$F_m\propto\: a$$ $$\Rightarrow F_m=Ma=M\frac{\text{d}^2x}{\text{d}t^2}$$ $$F=F_m=M\frac{\text{d}^2x}{\text{d}t^2}$$ Where, • F is the applied force • Fm is the opposing force due to mass • M is mass • a is acceleration • x is displacement ### Spring Spring is an element, which stores potential energy. If a force is applied on spring K, then it is opposed by an opposing force due to elasticity of spring. This opposing force is proportional to the displacement of the spring. Assume mass and friction are negligible. $$F\propto\: x$$ $$\Rightarrow F_k=Kx$$ $$F=F_k=Kx$$ Where, • F is the applied force • Fk is the opposing force due to elasticity of spring • K is spring constant • x is displacement ### Dashpot If a force is applied on dashpot B, then it is opposed by an opposing force due to friction of the dashpot. This opposing force is proportional to the velocity of the body. Assume mass and elasticity are negligible. $$F_b\propto\: \nu$$ $$\Rightarrow F_b=B\nu=B\frac{\text{d}x}{\text{d}t}$$ $$F=F_b=B\frac{\text{d}x}{\text{d}t}$$ Where, • Fb is the opposing force due to friction of dashpot • B is the frictional coefficient • v is velocity • x is displacement ## Modeling of Rotational Mechanical Systems Rotational mechanical systems move about a fixed axis. These systems mainly consist of three basic elements. Those are moment of inertia, torsional spring and dashpot. If a torque is applied to a rotational mechanical system, then it is opposed by opposing torques due to moment of inertia, elasticity and friction of the system. Since the applied torque and the opposing torques are in opposite directions, the algebraic sum of torques acting on the system is zero. Let us now see the torque opposed by these three elements individually. ### Moment of Inertia In translational mechanical system, mass stores kinetic energy. Similarly, in rotational mechanical system, moment of inertia stores kinetic energy. If a torque is applied on a body having moment of inertia J, then it is opposed by an opposing torque due to the moment of inertia. This opposing torque is proportional to angular acceleration of the body. Assume elasticity and friction are negligible. $$T_j\propto\: \alpha$$ $$\Rightarrow T_j=J\alpha=J\frac{\text{d}^2\theta}{\text{d}t^2}$$ $$T=T_j=J\frac{\text{d}^2\theta}{\text{d}t^2}$$ Where, • T is the applied torque • Tj is the opposing torque due to moment of inertia • J is moment of inertia • α is angular acceleration • θ is angular displacement ### Torsional Spring In translational mechanical system, spring stores potential energy. Similarly, in rotational mechanical system, torsional spring stores potential energy. If a torque is applied on torsional spring K, then it is opposed by an opposing torque due to the elasticity of torsional spring. This opposing torque is proportional to the angular displacement of the torsional spring. Assume that the moment of inertia and friction are negligible. $$T_k\propto\: \theta$$ $$\Rightarrow T_k=K\theta$$ $$T=T_k=K\theta$$ Where, • T is the applied torque • Tk is the opposing torque due to elasticity of torsional spring • K is the torsional spring constant • θ is angular displacement ### Dashpot If a torque is applied on dashpot B, then it is opposed by an opposing torque due to the rotational friction of the dashpot. This opposing torque is proportional to the angular velocity of the body. Assume the moment of inertia and elasticity are negligible. $$T_b\propto\: \omega$$ $$\Rightarrow T_b=B\omega=B\frac{\text{d}\theta}{\text{d}t}$$ $$T=T_b=B\frac{\text{d}\theta}{\text{d}t}$$ Where, • Tb is the opposing torque due to the rotational friction of the dashpot • B is the rotational friction coefficient • ω is the angular velocity • θ is the angular displacement
2021-07-30 23:31:15
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9052353501319885, "perplexity": 707.336488659287}, "config": {"markdown_headings": true, "markdown_code": false, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-31/segments/1627046154032.75/warc/CC-MAIN-20210730220317-20210731010317-00134.warc.gz"}
https://socratic.org/questions/58e6b053b72cff4a40b0a736
# Question #0a736 Apr 6, 2017 Method 1 - Making the radical include both the numerator and denominator rather than two separate square roots $\frac{\sqrt{50}}{\sqrt{2}}$ $= \sqrt{\frac{50}{2}}$ $= \sqrt{25}$ $= 5$ Method 2 - Simplifying the radical in the numerator then simplifying the overall fraction $\frac{\sqrt{50}}{\sqrt{2}}$ $= \frac{\sqrt{25 \cdot 2}}{\sqrt{2}}$ $= \frac{5 \textcolor{red}{\sqrt{2}}}{\textcolor{red}{\sqrt{2}}}$ $= 5$
2019-09-17 04:14:59
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 8, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9977190494537354, "perplexity": 1611.4286682534341}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-39/segments/1568514573052.26/warc/CC-MAIN-20190917040727-20190917062727-00521.warc.gz"}
https://alexandervvittig.github.io/2015/10/07/powershell-clipboard-history/
I’m a big fan of TextExpander which is sadly MAC / OSX only. A pretty cool free alternative (but not yet quite as good, at least in the free version) is called PhraseExpress. Making use of a clipboard history is really helpful, especially if you copy and paste a lot and don’t want to spend a lot of time, pressing UP UP UP UP UP just to eventually execute the wrong line. PowerShell has it’s own version: Get-History | Select-Object -ExpandProperty commandline | clip.exe To copy only the last five commands, simply add the -Count parameter to Get-History: (Get-History -Count 5).CommandLine | clip.exe Pretty cool huh? Now that is pretty long. Another way you can do this is like so: Get-History | ogv And you can get it even shorter by using the alias: h | ogv This is handy because you can search using the gridview search functionality and then copy one or more commands by simply highlighted the ones you want and hitting Ctrl-C. If you are only doing this to find a command to re-execute, v3 and later this is handy: h | ogv -p | r
2020-01-21 21:00:11
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.4705043435096741, "perplexity": 2227.035672220272}, "config": {"markdown_headings": false, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": false}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2020-05/segments/1579250605075.24/warc/CC-MAIN-20200121192553-20200121221553-00458.warc.gz"}
https://www.physicsforums.com/threads/voltage-gain-of-an-emitter-follower-bjt-common-collector.718049/
# Voltage gain of an emitter follower (BJT Common-Collector) 1. Oct 21, 2013 ### bznm 1. The problem statement, all variables and given/known data I'm trying to find a relation for the voltage gain of an emitter follower. For an emitter follower the voltage gain is given by \$A_v=\frac{r_o|| R_L}{(r_o|| R_L)+r_e}\$, where \$r_o\$ is the output resistance of the transistor and \$r_e\$ is the intrinsic resistance of the emitter. This result is obtained without considering internal capacitances of the BJT. What should I obtain, if I do a graphic (modulus and phase) with the response of the amplifier to the frequency? 2. Relevant equations 3. The attempt at a solution The formula that I have written on the top gives me only one value... so I think that I have to use one that depends on frequency, (and so in this formula have to "appear" the internal capacitances of the BJT) but I don't know how I can obtain it... If I have correctly understood, the emitter follower needs to the T-model for small signal, but I have seen the internal capacitances only for a hybrid-pi model and for high-frequency. So I don't know how to go on. If you can help me, I'll be so grateful! 2. Oct 21, 2013 ### Staff: Mentor You'll want to investigate Depletion Capacitance and Diffusion Capacitance in conjunction with BJT's. Datasheets will specify Input capacitance (variously CTE or Cib or Cibo)and Output capacitance (Cob, Cobo) . Look up a typical datasheet to see (the 2n2222 is pretty common). Values are generally small, on the order of a few pF for discrete transistors. 3. Oct 22, 2013 ### bznm In the datasheet I have found the values of Input capacitance and Output capacitance. And now what do I have to do? 4. Oct 22, 2013 ### Staff: Mentor You'll want to incorporate them into your small signal model for the transistor and re-analyze the circuit to obtain the transfer function. This presumes that the goal is to see the effects of frequency on a more accurately modeled emitter follower. Is that the case, or do you simply need to recognize that the simple model without capacitances is unaffected by frequency? 5. Oct 22, 2013 ### bznm I've just started to study this argument. The book starts analysing the BJT amplifiers without internal capacitance and, for the emitter follower, gets the formula of voltage gain that I have written on the top. Then it analyses the BJT internal capacitances and the high-frequency model of a BJT common emitter, but it says nothing about the voltage gain. I'd like to obtain the formula of the voltage gain for the emitter follower, considering the internal capacitances... 6. Oct 22, 2013 ### Staff: Mentor If I recall correctly, a hybrid-$\pi$ model is preferred for high frequency work. Apparently its basic parameters are relatively independent of frequency over a wide range. So you'll have to incorporate the given capacitances into the hybrid-$\pi$ model and do the analysis. I think that if you do a web search on "high frequency hybrid-pi" you'll turn up some relevant information to get you going.
2018-01-18 04:37:12
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 2, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.7009625434875488, "perplexity": 1448.7944190080318}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2018-05/segments/1516084887065.16/warc/CC-MAIN-20180118032119-20180118052119-00653.warc.gz"}
https://brilliant.org/problems/a-simple-problem-for-a-simple-day/
# A simple problem for a simple day Geometry Level 4 Angles $$\alpha = a°, \beta = b°$$ and $$\gamma = c°$$ belong to a triangle and satisfy the following: 1. $$\sin{\alpha} \times \sin{\beta} \times \sin{\gamma} = \frac{3 - \sqrt{3}}{8}$$ 2. $$\sin{2\alpha} + \sin{2\beta} = \frac{3}{2}$$ Sumit your solution in form: $$c + R(a, 17) + R(b, 17)$$. Function $$R(x, y)$$ has a value of remainder when $$x$$ is divided by $$y$$. e. g. $$R(13, 4) = 1$$, $$R(45, 5) = 0$$ Inspiration: Solution section. ×
2017-07-26 08:53:22
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.7876265645027161, "perplexity": 1538.3462750794579}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2017-30/segments/1500549426086.44/warc/CC-MAIN-20170726082204-20170726102204-00522.warc.gz"}
http://openwetware.org/index.php?title=User:Marshall_Hampton/ScoringMatrices&diff=prev&oldid=348570
User:Marshall Hampton/ScoringMatrices (Difference between revisions) Revision as of 14:38, 9 September 2009 (view source)← Previous diff Revision as of 14:38, 9 September 2009 (view source)Next diff → Line 9: Line 9: where $p_i$ and $q_i$ are the background frequencies of the amino acids from two sets of proteins.  In the vast majority of current treatments, the evolution of amino acid frequencies is considered symmetric in time and it is assumed that $p_i = q_i$ for each amino acid i.  In this article we will not make that assumption in order to develop scoring matrices for organisms in which the amino acid frequencies seem biased in time. where $p_i$ and $q_i$ are the background frequencies of the amino acids from two sets of proteins.  In the vast majority of current treatments, the evolution of amino acid frequencies is considered symmetric in time and it is assumed that $p_i = q_i$ for each amino acid i.  In this article we will not make that assumption in order to develop scoring matrices for organisms in which the amino acid frequencies seem biased in time. - A good reference for the mathematics and statistics involved here is the article . + A good reference for the mathematics and statistics involved here is the article Amino Acid Substitution Matrices from an Information Theoretic Perspective, J. Mol. Biol. 219, 555-565, 1991 . == References == == References == Revision as of 14:38, 9 September 2009 This will eventually be an article about constructing custom amino-acid scoring matrices using biopython. At the moment it is far from done. Introduction A log-odds scoring matrix is constructed from some empirically found frequencies of single letter alignments fij from the formula $s_{ij} = \lambda log(\frac{f_{ij}}{p_i q_j})$ where pi and qi are the background frequencies of the amino acids from two sets of proteins. In the vast majority of current treatments, the evolution of amino acid frequencies is considered symmetric in time and it is assumed that pi = qi for each amino acid i. In this article we will not make that assumption in order to develop scoring matrices for organisms in which the amino acid frequencies seem biased in time. A good reference for the mathematics and statistics involved here is the article <ref name="Altschul">Amino Acid Substitution Matrices from an Information Theoretic Perspective, J. Mol. Biol. 219, 555-565, 1991 </ref>. <references />
2014-03-17 04:08:03
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 1, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.7501033544540405, "perplexity": 884.6619406725594}, "config": {"markdown_headings": false, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.3, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2014-10/segments/1394678704694/warc/CC-MAIN-20140313024504-00017-ip-10-183-142-35.ec2.internal.warc.gz"}
https://pipelines.lsst.io/py-api/lsst.meas.algorithms.SourceDetectionTask.html
class lsst.meas.algorithms.SourceDetectionTask(schema=None, **kwds) Parameters: schema : lsst.afw.table.Schema Schema object used to create the output lsst.afw.table.SourceCatalog **kwds Keyword arguments passed to lsst.pipe.base.task.Task.__init__ If schema is not None and configured for ‘both’ detections, a ‘flags.negative’ field will be added to label detections made with a negative threshold. Notes This task can add fields to the schema, so any code calling this task must ensure that these columns are indeed present in the input match list. Methods Summary applyTempLocalBackground(exposure, middle, …) Apply a temporary local background subtraction applyThreshold(middle, bbox[, factor]) Apply thresholds to the convolved image calculateKernelSize(sigma) Calculate size of smoothing kernel clearMask(mask) Clear the DETECTED and DETECTED_NEGATIVE mask planes clearUnwantedResults(mask, results) Clear unwanted results from the Struct of results convolveImage(maskedImage, psf[, doSmooth]) Convolve the image with the PSF detectFootprints(exposure[, doSmooth, …]) Detect footprints on an exposure. display(exposure, results[, convolvedImage]) Display detections if so configured emptyMetadata() Empty (clear) the metadata for this Task and all sub-Tasks. finalizeFootprints(mask, results, sigma[, …]) Finalize the detected footprints getAllSchemaCatalogs() Get schema catalogs for all tasks in the hierarchy, combining the results into a single dict. getFullMetadata() Get metadata for all tasks. getFullName() Get the task name as a hierarchical name including parent task names. getName() Get the name of the task. getPsf(exposure[, sigma]) Retrieve the PSF for an exposure getSchemaCatalogs() Get the schemas generated by this task. getTaskDict() Get a dictionary of all tasks as a shallow copy. makeField(doc) Make a lsst.pex.config.ConfigurableField for this task. makeSubtask(name, **keyArgs) Create a subtask as a new instance as the name attribute of this task. makeThreshold(image, thresholdParity[, factor]) Make an afw.detection.Threshold object corresponding to the task’s configuration and the statistics of the given image. reEstimateBackground(maskedImage, backgrounds) Estimate the background after detection run(table, exposure[, doSmooth, sigma, …]) Run source detection and create a SourceCatalog of detections. setEdgeBits(maskedImage, goodBBox, edgeBitmask) Set the edgeBitmask bits for all of maskedImage outside goodBBox tempWideBackgroundContext(exposure) Context manager for removing wide (large-scale) background timer(name[, logLevel]) Context manager to log performance data for an arbitrary block of code. updatePeaks(fpSet, image, threshold) Update the Peaks in a FootprintSet by detecting new Footprints and Peaks in an image and using the new Peaks instead of the old ones. Methods Documentation applyTempLocalBackground(exposure, middle, results) Apply a temporary local background subtraction This temporary local background serves to suppress noise fluctuations in the wings of bright objects. Peaks in the footprints will be updated. Parameters: exposure : lsst.afw.image.Exposure Exposure for which to fit local background. middle : lsst.afw.image.MaskedImage Convolved image on which detection will be performed (typically smaller than exposure because the half-kernel has been removed around the edges). results : lsst.pipe.base.Struct Results of the ‘detectFootprints’ method, containing positive and negative footprints (which contain the peak positions that we will plot). This is a Struct with positive and negative elements that are of type lsst.afw.detection.FootprintSet. applyThreshold(middle, bbox, factor=1.0) Apply thresholds to the convolved image Identifies Footprints, both positive and negative. The threshold can be modified by the provided multiplication factor. Parameters: middle : lsst.afw.image.MaskedImage Convolved image to threshold. bbox : lsst.geom.Box2I Bounding box of unconvolved image. factor : float Multiplier for the configured threshold. calculateKernelSize(sigma) Calculate size of smoothing kernel Uses the nSigmaForKernel configuration parameter. Note that that is the full width of the kernel bounding box (so a value of 7 means 3.5 sigma on either side of center). The value will be rounded up to the nearest odd integer. Parameters: sigma : float Gaussian sigma of smoothing kernel. size : int Size of the smoothing kernel. clearMask(mask) Clear the DETECTED and DETECTED_NEGATIVE mask planes Removes any previous detection mask in preparation for a new detection pass. Parameters: mask : lsst.afw.image.Mask Mask to be cleared. clearUnwantedResults(mask, results) Clear unwanted results from the Struct of results If we specifically want only positive or only negative detections, drop the ones we don’t want, and its associated mask plane. Parameters: mask : lsst.afw.image.Mask Mask image. results : lsst.pipe.base.Struct Detection results, with positive and negative elements; modified. convolveImage(maskedImage, psf, doSmooth=True) Convolve the image with the PSF We convolve the image with a Gaussian approximation to the PSF, because this is separable and therefore fast. It’s technically a correlation rather than a convolution, but since we use a symmetric Gaussian there’s no difference. The convolution can be disabled with doSmooth=False. If we do convolve, we mask the edges as EDGE and return the convolved image with the edges removed. This is because we can’t convolve the edges because the kernel would extend off the image. Parameters: maskedImage : lsst.afw.image.MaskedImage Image to convolve. psf : lsst.afw.detection.Psf PSF to convolve with (actually with a Gaussian approximation to it). doSmooth : bool Actually do the convolution? Set to False when running on e.g. a pre-convolved image, or a mask plane. detectFootprints(exposure, doSmooth=True, sigma=None, clearMask=True, expId=None) Detect footprints on an exposure. Parameters: exposure : lsst.afw.image.Exposure Exposure to process; DETECTED{,_NEGATIVE} mask plane will be set in-place. doSmooth : bool, optional If True, smooth the image before detection using a Gaussian of width sigma, or the measured PSF width of exposure. Set to False when running on e.g. a pre-convolved image, or a mask plane. sigma : float, optional Gaussian Sigma of PSF (pixels); used for smoothing and to grow detections; if None then measure the sigma of the PSF of the exposure. clearMask : bool, optional Clear both DETECTED and DETECTED_NEGATIVE planes before running detection. expId : dict, optional Exposure identifier; unused by this implementation, but used for RNG seed by subclasses. display(exposure, results, convolvedImage=None) Display detections if so configured Displays the exposure in frame 0, overlays the detection peaks. Requires that lsstDebug has been set up correctly, so that lsstDebug.Info("lsst.meas.algorithms.detection") evaluates True. If the convolvedImage is non-None and lsstDebug.Info("lsst.meas.algorithms.detection") > 1, the convolvedImage will be displayed in frame 1. Parameters: exposure : lsst.afw.image.Exposure Exposure to display, on which will be plotted the detections. results : lsst.pipe.base.Struct Results of the ‘detectFootprints’ method, containing positive and negative footprints (which contain the peak positions that we will plot). This is a Struct with positive and negative elements that are of type lsst.afw.detection.FootprintSet. convolvedImage : lsst.afw.image.Image, optional Convolved image used for thresholding. emptyMetadata() finalizeFootprints(mask, results, sigma, factor=1.0) Finalize the detected footprints Grows the footprints, sets the DETECTED and DETECTED_NEGATIVE mask planes, and logs the results. numPos (number of positive footprints), numPosPeaks (number of positive peaks), numNeg (number of negative footprints), numNegPeaks (number of negative peaks) entries are added to the detection results. Parameters: mask : lsst.afw.image.Mask Mask image on which to flag detected pixels. results : lsst.pipe.base.Struct Struct of detection results, including positive and negative entries; modified. sigma : float Gaussian sigma of PSF. factor : float Multiplier for the configured threshold. getAllSchemaCatalogs() Get schema catalogs for all tasks in the hierarchy, combining the results into a single dict. Returns: schemacatalogs : dict Keys are butler dataset type, values are a empty catalog (an instance of the appropriate lsst.afw.table Catalog type) for all tasks in the hierarchy, from the top-level task down through all subtasks. Notes This method may be called on any task in the hierarchy; it will return the same answer, regardless. The default implementation should always suffice. If your subtask uses schemas the override Task.getSchemaCatalogs, not this method. getFullMetadata() Returns: metadata : lsst.daf.base.PropertySet The PropertySet keys are the full task name. Values are metadata for the top-level task and all subtasks, sub-subtasks, etc. Notes The returned metadata includes timing information (if @timer.timeMethod is used) and any metadata set by the task. The name of each item consists of the full task name with . replaced by :, followed by . and the name of the item, e.g.: topLevelTaskName:subtaskName:subsubtaskName.itemName using : in the full task name disambiguates the rare situation that a task has a subtask and a metadata item with the same name. getFullName() Get the task name as a hierarchical name including parent task names. Returns: fullName : str The full name consists of the name of the parent task and each subtask separated by periods. For example: The full name of top-level task “top” is simply “top”. The full name of subtask “sub” of top-level task “top” is “top.sub”. The full name of subtask “sub2” of subtask “sub” of top-level task “top” is “top.sub.sub2”. getName() Get the name of the task. Returns: taskName : str Name of the task. getPsf(exposure, sigma=None) Retrieve the PSF for an exposure If sigma is provided, we make a GaussianPsf with that, otherwise use the one from the exposure. Parameters: exposure : lsst.afw.image.Exposure Exposure from which to retrieve the PSF. sigma : float, optional Gaussian sigma to use if provided. psf : lsst.afw.detection.Psf PSF to use for detection. getSchemaCatalogs() Get the schemas generated by this task. Returns: schemaCatalogs : dict Keys are butler dataset type, values are an empty catalog (an instance of the appropriate lsst.afw.table Catalog type) for this task. Task.getAllSchemaCatalogs Notes Warning Subclasses that use schemas must override this method. The default implementation returns an empty dict. This method may be called at any time after the Task is constructed, which means that all task schemas should be computed at construction time, not when data is actually processed. This reflects the philosophy that the schema should not depend on the data. Returning catalogs rather than just schemas allows us to save e.g. slots for SourceCatalog as well. getTaskDict() Get a dictionary of all tasks as a shallow copy. Returns: taskDict : dict Dictionary containing full task name: task object for the top-level task and all subtasks, sub-subtasks, etc. classmethod makeField(doc) Make a lsst.pex.config.ConfigurableField for this task. Parameters: doc : str Help text for the field. configurableField : lsst.pex.config.ConfigurableField A ConfigurableField for this task. Examples Here is an example of use: class OtherTaskConfig(lsst.pex.config.Config): makeSubtask(name, **keyArgs) Create a subtask as a new instance as the name attribute of this task. Parameters: name : str Brief name of the subtask. keyArgs Extra keyword arguments used to construct the task. The following arguments are automatically provided and cannot be overridden: “config”. “parentTask”. Notes The subtask must be defined by Task.config.name, an instance of ConfigurableField or RegistryField. makeThreshold(image, thresholdParity, factor=1.0) Make an afw.detection.Threshold object corresponding to the task’s configuration and the statistics of the given image. Parameters: image : afw.image.MaskedImage Image to measure noise statistics from if needed. thresholdParity: str One of “positive” or “negative”, to set the kind of fluctuations the Threshold will detect. factor : float Factor by which to multiply the configured detection threshold. This is useful for tweaking the detection threshold slightly. threshold : lsst.afw.detection.Threshold Detection threshold. reEstimateBackground(maskedImage, backgrounds) Estimate the background after detection Parameters: maskedImage : lsst.afw.image.MaskedImage Image on which to estimate the background. backgrounds : lsst.afw.math.BackgroundList List of backgrounds; modified. bg : lsst.afw.math.backgroundMI Empirical background model. run(table, exposure, doSmooth=True, sigma=None, clearMask=True, expId=None) Run source detection and create a SourceCatalog of detections. Parameters: table : lsst.afw.table.SourceTable Table object that will be used to create the SourceCatalog. exposure : lsst.afw.image.Exposure Exposure to process; DETECTED mask plane will be set in-place. doSmooth : bool If True, smooth the image before detection using a Gaussian of width sigma, or the measured PSF width. Set to False when running on e.g. a pre-convolved image, or a mask plane. sigma : float Sigma of PSF (pixels); used for smoothing and to grow detections; if None then measure the sigma of the PSF of the exposure clearMask : bool Clear DETECTED{,_NEGATIVE} planes before running detection. expId : int Exposure identifier; unused by this implementation, but used for RNG seed by subclasses. result : lsst.pipe.base.Struct sources The detected sources (lsst.afw.table.SourceCatalog) fpSets The result resturned by detectFootprints (lsst.pipe.base.Struct). ValueError If flags.negative is needed, but isn’t in table’s schema. lsst.pipe.base.TaskError If sigma=None, doSmooth=True and the exposure has no PSF. Notes If you want to avoid dealing with Sources and Tables, you can use detectFootprints() to just get the lsst.afw.detection.FootprintSets. static setEdgeBits(maskedImage, goodBBox, edgeBitmask) Parameters: maskedImage : lsst.afw.image.MaskedImage Image on which to set edge bits in the mask. goodBBox : lsst.geom.Box2I Bounding box of good pixels, in LOCAL coordinates. edgeBitmask : lsst.afw.image.MaskPixel Bit mask to OR with the existing mask bits in the region outside goodBBox. tempWideBackgroundContext(exposure) Context manager for removing wide (large-scale) background Removing a wide (large-scale) background helps to suppress the detection of large footprints that may overwhelm the deblender. It does, however, set a limit on the maximum scale of objects. The background that we remove will be restored upon exit from the context manager. Parameters: exposure : lsst.afw.image.Exposure Exposure on which to remove large-scale background. context : context manager Context manager that will ensure the temporary wide background is restored. timer(name, logLevel=10) Context manager to log performance data for an arbitrary block of code. Parameters: name : str Name of code being timed; data will be logged using item name: Start and End. logLevel A logging level constant. timer.logInfo Examples Creating a timer context: with self.timer("someCodeToTime"): pass # code to time updatePeaks(fpSet, image, threshold) Update the Peaks in a FootprintSet by detecting new Footprints and Peaks in an image and using the new Peaks instead of the old ones. Parameters: fpSet : afw.detection.FootprintSet Set of Footprints whose Peaks should be updated. image : afw.image.MaskedImage Image to detect new Footprints and Peak in. threshold : afw.detection.Threshold Threshold object for detection. Input Footprints with fewer Peaks than self.config.nPeaksMaxSimple are not modified, and if no new Peaks are detected in an input Footprint, the brightest original Peak in that Footprint is kept.
2022-09-30 23:06:56
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.18746504187583923, "perplexity": 6931.027610922683}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2022-40/segments/1664030335504.37/warc/CC-MAIN-20220930212504-20221001002504-00109.warc.gz"}
https://socratic.org/questions/how-do-you-find-the-derivative-of-f-x-2x-3-e-9x
# How do you find the derivative of f(x) = 2x^3 e^(9x)? ##### 1 Answer May 17, 2015 The answer is : $f ' \left(x\right) = 6 {e}^{9 x} {x}^{2} \left(1 + 3 x\right)$ $f \left(x\right) = 2 {x}^{3} {e}^{9 x} = h \left(x\right) g \left(x\right)$, where $h \left(x\right) = 2 {x}^{3}$ and $g \left(x\right) = {e}^{9 x}$. We will find the derivative with the product rule : $f ' \left(x\right) = h ' \left(x\right) g \left(x\right) + h \left(x\right) g ' \left(x\right) = \left(2 {x}^{3}\right) ' {e}^{9 x} + 2 {x}^{3} \left({e}^{9 x}\right) '$ $f ' \left(x\right) = 2 \cdot 3 {x}^{2} \cdot {e}^{9 x} + 2 {x}^{3} \cdot 9 {e}^{9 x} = 6 {x}^{2} {e}^{9 x} + 18 {x}^{3} {e}^{9 x}$ $f ' \left(x\right) = 6 {e}^{9 x} \left({x}^{2} + 3 {x}^{3}\right) = 6 {e}^{9 x} {x}^{2} \left(1 + 3 x\right)$
2021-11-30 07:17:15
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 7, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.7177973389625549, "perplexity": 387.83797245071526}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": false}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-49/segments/1637964358953.29/warc/CC-MAIN-20211130050047-20211130080047-00364.warc.gz"}
http://accesspediatrics.mhmedical.com/content.aspx?bookid=1303&sectionid=79662137
Chapter 53 ### I. PROBLEM A purulent eye discharge is noted in a 3-day-old infant. Eye discharge in a neonate is usually caused by conjunctivitis or congenital lacrimal duct obstruction. Neonatal conjunctivitis (ophthalmia neonatorum) is an inflammation of the surface or covering of the eye that presents with eye discharge and hyperemia in the first 4 weeks of life. It is the most common ocular disease in neonates. Most infections are acquired during vaginal delivery. In the United States the incidence of infectious conjunctivitis is 1–2%; in the world it is 0.9–21%. Congenital lacrimal duct obstruction (CLDO) (dacryostenosis) is a condition where there is a blockage of the lacrimal drainage system. It occurs in ∽5–6% of infants. The symptoms are persistent tearing and a mucoid discharge in the inner corner of the eye. ### II. IMMEDIATE QUESTIONS 1. How old is the infant? Age may be helpful in determining the cause of eye discharge. For conjunctivitis: in the first 6–24 hours of life, conjunctivitis is often due to ocular prophylaxis (usually silver nitrate drops; it may also be from tetracycline, erythromycin, or gentamicin). After 24–48 hours, a bacterial infection is most likely; the most common neonatal organisms are Neisseria gonorrhoeae (2–7 days but can present later) and Staphylococcus aureus (5–14 days). Chlamydia trachomatis conjunctivitis is usually seen after the first week of life (5–14 days) and often presents as late as the second or third week. Herpes conjunctivitis is seen 6–14 days after birth. Pseudomonas aeruginosa infections are typically seen between 5 and 18 days. Note: Bacterial infections can occur anytime. Lacrimal duct obstruction usually manifests at 2 weeks of age, but can be seen in the first few days to the first few weeks after birth. 2. Is the discharge unilateral or bilateral? Unilateral conjunctivitis is most often seen with S. aureus, P. aeruginosa, and herpes simplex (HSV) and adenovirus. Bilateral conjunctivitis is seen with infection caused by N. gonorrhoeae or by the use of ocular prophylaxis. Chlamydia usually develops in one eye but affects the other after 2–7 days. Lacrimal duct obstruction usually causes unilateral discharge, but up to 20 % of infants have bilateral obstruction. 3. What are the characteristics of the discharge (purulent vs watery)? Purulent discharge is more common with bacterial infection. A serous discharge is more common with a viral infection. Gonorrhea has a profuse purulent discharge. Greenish discharge is more characteristic of P. aeruginosa. Chlamydial infection can be watery early and purulent later, but a blood-stained discharge is typical. Herpes conjunctivitis usually has a nonpurulent and serosanguineous discharge. Lacrimal duct obstruction can cause watery tears in the corner of the eye or tears draining from the eyelid down the cheek. It can also cause a mucus or yellowish discharge in the eye. 4. Did the infant receive eye prophylaxis? Prophylaxis is used to decrease the risk of developing ocular gonorrheal infection (prevent blindness) and it also decreases the risk of nongonococcal and nonchlamydial conjunctivitis ... Sign in to your MyAccess profile while you are actively authenticated on this site via your institution (you will be able to verify this by looking at the top right corner of the screen - if you see your institution's name, you are authenticated). Once logged in to your MyAccess profile, you will be able to access your institution's subscription for 90 days from any location. You must be logged in while authenticated at least once every 90 days to maintain this remote access. Ok ## Subscription Options ### AccessPediatrics Full Site: One-Year Subscription Connect to the full suite of AccessPediatrics content and resources including 20+ textbooks such as Rudolph’s Pediatrics and The Pediatric Practice series, high-quality procedural videos, images, and animations, interactive board review, an integrated pediatric drug database, and more.
2017-01-25 01:16:53
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.2566583454608917, "perplexity": 7641.094546520223}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2017-04/segments/1484560285337.76/warc/CC-MAIN-20170116095125-00439-ip-10-171-10-70.ec2.internal.warc.gz"}
http://www.math.iitb.ac.in/~seminar/colloquium/sudan-october07-2014.html
Date & Time: Tuesday, October 07, 2014, 16:00-17:00. Venue: Ramanujan Hall Title: Limits of local algorithms over sparse random graphs Speaker: Madhu Sudan, MSR-NE Abstract: Local algorithms on graphs are algorithms that run in parallel on the nodes of a graph to compute some global structural feature of the graph. Such algorithms use only local information available at nodes to determine local aspects of the global structure, while also potentially using some randomness. Recent research has shown that such algorithms show significant promise in computing structures like large independent sets in graphs locally. Indeed the promise led to a conjecture by Hatami, Lovasz, and Szegedy, that local algorithms may be able to compute maximum independent sets in (sparse) random $d$-regular graphs. In this talk we refute this conjecture and show that every independent set produced by local algorithms is multiplicative factor $1/2+1/(2\sqrt{2})$ smaller than the largest, asymptotically as $d \rightarrow \infty$. Our result is based on an important clustering phenomena predicted first in the literature on spin glasses, and recently proved rigorously for a variety of constraint satisfaction problems on random graphs. Such properties suggest that the geometry of the solution space can be quite intricate. The specific clustering property, that we prove and apply in this paper shows that typically every two large independent sets in a random graph either have a significant intersection, or have a nearly empty intersection. As a result, large independent sets are clustered according to the proximity to each other. While the clustering property was postulated earlier as an obstruction for the success of local algorithms, such as for example, the Belief Propagation algorithm, our result is the first one where the clustering property is used to formally prove limits on local algorithms. Based on joint work with David Gamarnik.
2017-10-23 20:39:49
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.8336170315742493, "perplexity": 473.45368163935063}, "config": {"markdown_headings": true, "markdown_code": false, "boilerplate_config": {"ratio_threshold": 0.3, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2017-43/segments/1508187826642.70/warc/CC-MAIN-20171023202120-20171023222120-00339.warc.gz"}
https://socratic.org/questions/an-office-equipment-company-rents-copier-a-monthly-fee-plus-a-fee-per-copy-julie
# An office equipment company rents copier a monthly fee plus a fee per copy. Julie Simms rents a copier and was charged $175 for making 1500 copies in March and$223 for making 2300 copies in April. What is the fee per copy? Nov 6, 2016 The cost would be $0.0625 or $6.25$cents per copy #### Explanation: Let $x$be the cost per copy and $y$be the monthly fee. In March the cost was $175 which equals the fee $\left(y\right)$ plus the cost per copy $\left(x\right)$ times the number of copies $\left(1500\right)$. The two equations would be: $175 = 1500x + y" " and " "$225 = 2300x + y Solve each for $y$. You would get y = $175 - 1500x" " and " " y =$225 - 2300x Since $y = y$, you can let the equations equal each other $175 - 1500x =$225 - 2300x Add $2300 x$ to each side and you get $175 + 800x =$225 Subtract $175 from bot sides gives you 800x =$50 Divide both sides by $800$ and the cost per copy x = $0.0625 Putting this back into the equation, y =$81.25 per month.
2019-11-21 13:22:55
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 22, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.2186127007007599, "perplexity": 3249.8062252289924}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-47/segments/1573496670821.55/warc/CC-MAIN-20191121125509-20191121153509-00211.warc.gz"}
http://users.isr.ist.utl.pt/~adb/the-balm/
## The BALM MATLAB code available — Please check the code page. We are presenting the BALM — a general computational framework for optimising various bilinear problems! We hope this algorithm will ease the life of many researchers when optimising several classes of bilinear problems such as rigid and non-rigid structure from motion, photometric stereo, image registration, learning by factorization and many more. The computational core is based on Augmented Lagrange Multipliers method and the main feature is that it can deal with specific manifold constraints on one of the bilinear component. This is the problem we optimise: $\text{minimize } \left\| Y - S M \right\|^2 \\ \\\text{subject to } M_i \in {\mathcal M}, \quad i = 1, \ldots, f,$ where $Y$ is a matrix containing our measured data (e.g. image point trajectories in SfM or image pixels variations for Photometric Stereo). The matrices $M$ and $S$ represents our bilinear components to estimate. The matrix $M$ is formed as: $M = \begin{bmatrix} M_1 & \cdots & M_i & \cdots & M_f \end{bmatrix} \in {\mathbb R}^{r \times m}, \quad M_i \in {\mathbb R}^{r \times p}.$ Each of the sub-matrices $M_i$ lies on a specific manifold ${\mathcal M}$ (i.e. its values are not arbitrary but constrained). When dealing with SfM the manifolds are usually Stiefel while with Photometric Stereo are mostly spherical. Now a video showing the resilience of BALM to missing data in structure from motion and photometric stereo problems: At the moment we have found more than 12 problems that can be explained with bilinear models and thus solved with BALM. Some examples: 2D-3D registration of rigid/articulated/non-rigid models, Structure from Sound, BRDFs factorisation for Computer Graphics, Modelling pose/expression/identity, gait analysis and many more. More details and the code will appear soon in a dedicated research area. • A. Del Bue, J. Xavier, L. Agapito, and M. Paladini, "Bilinear Factorization via Augmented Lagrange Multipliers," in 11th European Conference on Computer Vision (ECCV 2010), Crete, Greece, 2010, pp. 283-296. @inproceedings{DelBue:etal:2010,   author = {A. {Del Bue} and J. Xavier and L. Agapito and M. Paladini},   title = {Bilinear Factorization via Augmented Lagrange Multipliers},   editor = {Kostas Daniilidis and Petros Maragos and Nikos Paragios},   booktitle = {11th European Conference on Computer Vision (ECCV 2010), Crete, Greece},   publisher = {Springer},   location = {Heidelberg},   series = {Lecture Notes in Computer Science},   volume = {6314},   year = {2010},   isbn = {978-3-642-15560-4},   pages = {283--296} } • A. Del Bue, J. Xavier, L. Agapito, and M. Paladini, "Bilinear Modeling via Augmented Lagrange Multipliers (BALM)," Pattern Analysis and Machine Intelligence, IEEE Transactions on, vol. 34, iss. 8, pp. 1496-1508, 2012. @Article{DelBue:etal:PAMI2012,   author = {A. {Del Bue} and J. Xavier and L. Agapito and M. Paladini},   title={Bilinear Modeling via Augmented Lagrange Multipliers (BALM)},   journal={Pattern Analysis and Machine Intelligence, IEEE Transactions on},   year={2012},   month={August},   volume={34},   number={8},   pages={1496 -1508},   doi={10.1109/TPAMI.2011.238},   ISSN={0162-8828},   url = {http://users.isr.ist.utl.pt/~adb/publications/2012_PAMI_Del_Bue.pdf} }
2021-11-27 10:40:20
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 8, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.39714866876602173, "perplexity": 10224.742488373777}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-49/segments/1637964358180.42/warc/CC-MAIN-20211127103444-20211127133444-00206.warc.gz"}
https://gmatclub.com/forum/which-of-the-following-is-true-if-3-x-253952.html
It is currently 14 Dec 2017, 18:50 ### GMAT Club Daily Prep #### Thank you for using the timer - this advanced tool can estimate your performance and suggest more practice questions. We have subscribed you to Daily Prep Questions via email. Customized for You we will pick new questions that match your level based on your Timer History Track every week, we’ll send you an estimated GMAT score based on your performance Practice Pays we will pick new questions that match your level based on your Timer History # Events & Promotions ###### Events & Promotions in June Open Detailed Calendar # Which of the following is true if -3<x<9? new topic post reply Question banks Downloads My Bookmarks Reviews Important topics Author Message Math Revolution GMAT Instructor Joined: 16 Aug 2015 Posts: 4474 Kudos [?]: 3154 [0], given: 0 GPA: 3.82 Which of the following is true if -3<x<9? [#permalink] ### Show Tags 20 Nov 2017, 23:56 00:00 Difficulty: (N/A) Question Stats: 100% (00:06) correct 0% (00:00) wrong based on 2 sessions ### HideShow timer Statistics [GMAT math practice question] Which of the following is true if $$-3<x<9$$? A. $$|x-3|<4$$ B. $$|x-3|<5$$ C. $$|x-3|<6$$ D. $$|x-3|>4$$ E. $$|x-3|>5$$ [Reveal] Spoiler: OA _________________ MathRevolution: Finish GMAT Quant Section with 10 minutes to spare The one-and-only World’s First Variable Approach for DS and IVY Approach for PS with ease, speed and accuracy. Find a 10% off coupon code for GMAT Club members. “Receive 5 Math Questions & Solutions Daily” Unlimited Access to over 120 free video lessons - try it yourself See our Youtube demo Kudos [?]: 3154 [0], given: 0 Math Expert Joined: 02 Sep 2009 Posts: 42607 Kudos [?]: 135666 [0], given: 12705 Re: Which of the following is true if -3<x<9? [#permalink] ### Show Tags 20 Nov 2017, 23:58 MathRevolution wrote: [GMAT math practice question] Which of the following is true if $$-3<x<9$$? A. $$|x-3|<4$$ B. $$|x-3|<5$$ C. $$|x-3|<6$$ D. $$|x-3|>4$$ E. $$|x-3|>5$$ Posted a week ago: https://gmatclub.com/forum/which-of-the ... fl=similar _________________ Kudos [?]: 135666 [0], given: 12705 Re: Which of the following is true if -3<x<9?   [#permalink] 20 Nov 2017, 23:58 Display posts from previous: Sort by # Which of the following is true if -3<x<9? new topic post reply Question banks Downloads My Bookmarks Reviews Important topics Powered by phpBB © phpBB Group | Emoji artwork provided by EmojiOne Kindly note that the GMAT® test is a registered trademark of the Graduate Management Admission Council®, and this site has neither been reviewed nor endorsed by GMAC®.
2017-12-15 02:50:06
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.2460835874080658, "perplexity": 13857.658011964513}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.3, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2017-51/segments/1512948563083.64/warc/CC-MAIN-20171215021156-20171215041156-00451.warc.gz"}
https://zkxb.jsu.edu.cn/EN/10.13438/j.cnki.jdzk.2019.03.004
• Computer • Application of Artificial Neural Network in Information Filtering WU Yifan,ZHU Longjiao,SHI Junping 1. (College of Information Science and Engineering,Jishou University,Jishou 416000,Hunan China) • Online:2019-05-25 Published:2019-06-04 Abstract: By analyzing the characteristics of TextCNN,TextRNN and other models,a text classification model combining convolutional neural network and recurrent neural network is realized.The model is tested on the "SMS Spam Collection v.1" dataset and  evaluated by AUC and Precision.The result shows that the model has good robustness and can accurately identify spam.
2021-10-15 21:18:10
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.24034181237220764, "perplexity": 13429.93860814373}, "config": {"markdown_headings": false, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-43/segments/1634323583083.92/warc/CC-MAIN-20211015192439-20211015222439-00711.warc.gz"}
https://socratic.org/questions/a-radioactive-substance-decays-at-a-rate-of-30-per-year-presently-there-are-400--1
# A radioactive substance decays at a rate of 30% per year. Presently there are 400 grams of the substance. How long before there are 10 grams? May 28, 2016 $\ln \frac{40}{0.3}$ years = 12.296 years = 12 years and 108 days, nearly. #### Explanation: If x gm is present at time t years, $x ' = - 0.3 x$ gm/year. Integrating, $\int \frac{1}{x} \mathrm{dx} = - 0.3 \int \mathrm{dt}$. So, $\ln x = - 0.3 t + A$. Inversely, $x = {c}^{- 0.3 t + A} = {e}^{A} {e}^{- 0.3 t} = C {e}^{- 0.3 t}$ Initially, t = 0 and x = 400. So, C=400, and now, $x = 400 {e}^{- 0.3 t}$ The time t years for decay, from 400 gm to 10 gm, is given by $10 = 400 {e}^{- 0 , 3 t}$. So, ${e}^{0.3 t} = 40$, and inversely, $0.3 t = \ln 40$. So, t=ln 40/0.3=12.296 years= 12 years and 108 days, nearly.
2020-04-10 03:58:21
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 9, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.5873333811759949, "perplexity": 2538.939512984517}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2020-16/segments/1585371883359.91/warc/CC-MAIN-20200410012405-20200410042905-00055.warc.gz"}
http://gatkforums.broadinstitute.org/gatk/discussion/4078/inconsistency-between-the-read-depth-reported-by-hc-and-by-samtools-mpileup
The current GATK version is 3.7-0 Examples: Monday, today, last week, Mar 26, 3/26/04 #### Howdy, Stranger! It looks like you're new here. If you want to get involved, click one of these buttons! #### ☞ Did you remember to? 1. Search using the upper-right search box, e.g. using the error message. 2. Try the latest version of tools. 3. Include tool and Java versions. 4. Tell us whether you are following GATK Best Practices. 5. Include relevant details, e.g. platform, DNA- or RNA-Seq, WES (+capture kit) or WGS (PCR-free or PCR+), paired- or single-end, read length, expected average coverage, somatic data, etc. 6. For tool errors, include the error stacktrace as well as the exact command. 7. For format issues, include the result of running ValidateSamFile for BAMs or ValidateVariants for VCFs. 8. For weird results, include an illustrative example, e.g. attach IGV screenshots according to Article#5484. 9. For a seeming variant that is uncalled, include results of following Article#1235. #### ☞ Did we ask for a bug report? Then follow instructions in Article#1894. #### ☞ Formatting tip! Surround blocks of code, error messages and BAM/VCF snippets--especially content with hashes (#)--with lines with three backticks ( ` ) each to make a code block. Picard 2.9.0 is now available. Download and read release notes here. GATK 3.7 is here! Be sure to read the Version Highlights and optionally the full Release Notes. # inconsistency between the read depth reported by HC and by samtools mpileup United StatesMember Posts: 2 Hi everyone, I'm calling SNPs by using GATK HC. I'm also using samtools mpileup to give specific base type and read depth information for each called SNP position (using the same bam file, of course). However, I found that in about 10% of cases, in the positions where GATK called SNPs, samtools mpileup did not report any read coverages. That confused me, so I put the bam file into igv and tablet to visualize the reads. However, both of them confirmed that there were indeed no reads in those positions at all. Here is the command I used for GATK: java -jar GenomeAnalysisTK.jar -T HaplotypeCaller -R index/genome_mu50.fasta -I wt_rg.bam -o wt_raw.vcf for samtools mpileup: samtools mpileup -f index/genome_mu50.fasta wt_rg.bam > wt.coverage Please see the vcf table: Please notice that a couple of SNPs were called between 1550190 and 1550201, and reasonable allele depths were reported to back up these results. Please see the igv snip shot of this area: There is not a single read in this area! I also tried UnifiedGenotyper, and those SNPs were not called. Is this a bug in HC? or I did something wrong? Any comments will be appreciated. Thanks! Tagged: • United StatesMember Posts: 2 Sorry the pictures didn't show up well, plz see the attachment.
2017-03-27 04:42:17
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.2904585301876068, "perplexity": 11822.83427405739}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.3, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2017-13/segments/1490218189403.13/warc/CC-MAIN-20170322212949-00089-ip-10-233-31-227.ec2.internal.warc.gz"}
https://ai.stackexchange.com/questions/6776/what-do-neural-connection-weights-represent-conceptually?noredirect=1
# What do neural connection weights represent 'conceptually'? I understand how Neural Networks work and have studied its theory well. My question is at the intricacies of Deep Neural networks and perhaps is a bit beyond common understanding (as I have been told (or misled) from discussions). My question is: On the whole, is there a clear understanding of how mutation occurs within a neural network from the input layer to the output layer, for both supervised and unsupervised cases? Any neural network is a set of neurons + the connection weights. With each successive layer, there is a change in the input. Say I have a Neural Network that does movie recommendation on n parameters. Say if X is a parameter that stands for the movie rating on IMDB. In each successive stage, there is a mutation of input X to X' and further X'' and so on. While of course, we know how to mathematically talk about X' and X'', do we at all have a conceptual understanding as to what this variable is in its corresponding neural n-dimension? The neural weights which to the human eye might be set of random numbers but may mean something profound if we could ever understand what the neural weights 'represent'. What is the nature of neural weights such that despite decades worth of research and use, there is no clear understanding of what these connection weights represent? Or rather, why has there been so little effort in understanding the nature of neural weights, in a non-mathematical sense given the huge impetus in going beyond the black box notion of AI. • ai.stackexchange.com/questions/1479/… Check this – user9947 Jun 17 '18 at 10:16 • @DuttaA Hi, Thanks for sharing the post. I did make a reference of that post before I made this post. That post does go into a few tools that might help in seeing 'what' the weights are. The question here is a bit different though. I want to know what the fused neural network connection weight, say 0.7 would mean in some higher neural dimension? Is there any study on this? Jun 17 '18 at 10:26 I don't know if my intuition is correct but I will give it a try. You could see weights as how much important one thing is, the problem is to understand what that thing represents. When I say thing I'm referring to the output of a specific neuron. I don't think that we can say what the output of a neuron represents in the real world unless we directly relate it through an error function or if the function used to compute that particular value have some meaning in the real world. Edit: If you want, you could actually build your neural network such that its neurons represent something. It's also very simple. you have only to write down all the equations relative to that particular topic. You could put them in a big system or, and this is better, you could put them in several systems such that the outputs of system 1 are the input of system 2 and so on. You could convert each system into a layer where each neuron represents an equation. Note that in this case, you would have the classical neuron with z = dot(w.T,x) + b a = g(x) but a more complex equation for z (but still based on weights) and a linear activation function for a. In this case, you could name each neuron and say what they represent in the real world. However, this isn't the purpose of a neural network. A neural network should have neurons with simple equations to be fast thus the linear interpolating function dot(w.T,x) + b is the best choice (the fact that the activation function is almost always non linear and in some cases a non-banal function is due to other thing and could be an interesting question). A neural network should also be as general as possible because usually is build upon a system that you don't know completely. So I modify slightly my answer: is not simply that you don't know what a neuron represent, excluding the ones of the output layer, you don't want that they have a meaning in the real world. • Thanks for your comment! It kinda validates my vague understanding into something more concrete. I would wonder if you know of any papers or citations that go into this topic? Jun 19 '18 at 3:57 • @user248884 Sorry but I don't have any paper on the topic. Also, this is my personal understanding of the topic and could be completely wrong. :) Jun 20 '18 at 10:49 It's a bit of a challenge to answer your question, since you appear to be not really familiar with the basics. You're talking about mutations, and changes to the input. No. The input is a vector of data, which initializes the value of the input nodes. The first layer of weights is then used to calculate the values for the next layer of nodes. This next layer is not a "mutation" of the input layer; that suggest the second layer of nodes is similar but not exactly identical to the first layer. In reality, it's very common that the second layer of nodes does not even have the same shape as the first layer. You are even wondering if certain weights have a certain meaning. That's even easier to answer. We know these networks are quite robust. We can ignore a significant percentage of the weights, and the classifications will change only a little. This shows that no individual weight represents a specific aspect of the network. • Well, even if it's not as one should see it, is correct to say that each layer does a transformation on its input since it's a function that maps (n_i,m) -> (n_{i+1},m). Where m is the number of examples and n_i and n_{i+1} are the input feature and the output features. Jun 20 '18 at 11:12
2021-10-26 05:19:54
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.6129952073097229, "perplexity": 320.45227289183265}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-43/segments/1634323587799.46/warc/CC-MAIN-20211026042101-20211026072101-00548.warc.gz"}
https://mathsgee.com/35467/what-does-controlling-for-a-variable-mean
# arrow_back What does "controlling for a variable" mean? 10 views What does "controlling for a variable" mean? "Controlling for a variable" means measuring extraneous variables and accounting for them statistically to remove their effects on other variables. Researchers often model control variable data along with independent and dependent variable data in regression analyses and ANCOVAs. That way, you can isolate the control variable's effects from the relationship between the variables of interest. by SIlver Status (18,455 points) ## Related questions Notice: Undefined index: avatar in /home/customer/www/mathsgee.com/public_html/qa-theme/AVEN/qa-theme.php on line 993 What do data scientists and statisticians mean by the term, "adjusting or controlling for a variable"? 1 answer 43 views What do data scientists and statisticians mean by the term, "adjusting or controlling for a variable"?What do data scientists and statisticians mean by the term, &quot;adjusting or controlling for a variable&quot;? ... close Notice: Undefined index: avatar in /home/customer/www/mathsgee.com/public_html/qa-theme/AVEN/qa-theme.php on line 993 What do you mean by categorical data? 1 answer 10 views What do you mean by categorical data?What do you mean by categorical data? ... close Notice: Undefined index: avatar in /home/customer/www/mathsgee.com/public_html/qa-theme/AVEN/qa-theme.php on line 993 What do data scientists do? 1 answer 10 views What do data scientists do?What do data scientists do? ... close Notice: Undefined index: avatar in /home/customer/www/mathsgee.com/public_html/qa-theme/AVEN/qa-theme.php on line 993 What is random sampling? 1 answer 73 views What is random sampling?What is random sampling? ... close Notice: Undefined index: avatar in /home/customer/www/mathsgee.com/public_html/qa-theme/AVEN/qa-theme.php on line 993 Besides simple random sampling, what other sampling methods can be used by data scientists and statisticians? 1 answer 109 views Besides simple random sampling, what other sampling methods can be used by data scientists and statisticians?Besides simple random sampling, what other sampling methods can be used by data scientists and statisticians? ... close Notice: Undefined index: avatar in /home/customer/www/mathsgee.com/public_html/qa-theme/AVEN/qa-theme.php on line 993 What are the mean and variance of a binomial random variable? 1 answer 410 views What are the mean and variance of a binomial random variable?What are the mean and variance of a binomial random variable? ... close Notice: Undefined index: avatar in /home/customer/www/mathsgee.com/public_html/qa-theme/AVEN/qa-theme.php on line 993 Prove that if $X$ is a random variable with mean $E X$ and $c \in$ is $a$ real number, then $\operatorname{Var}(X)=E\left(X^{2}\right)-E(X)$ 1 answer 46 views Prove that if $X$ is a random variable with mean $E X$ and $c \in$ is $a$ real number, then $\operatorname{Var}(X)=E\left(X^{2}\right)-E(X)$Prove that if $X$ is a random variable with mean $E X$ and $c \in$ is $a$ real number, then $\operatorname{Var}(X)=E\left(X^{2}\right)-E(X)$ ... close
2022-01-27 02:52:01
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.5901253819465637, "perplexity": 3681.634721059147}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.3, "absolute_threshold": 20, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2022-05/segments/1642320305052.56/warc/CC-MAIN-20220127012750-20220127042750-00133.warc.gz"}
https://math.stackexchange.com/questions/3454870/find-the-determinant-using-co-factoring/3454883
Find the determinant using co-factoring I tried finding the determinant of A using the co-factors technique, yet always get it wrong, This is my approach: A = $$\begin{matrix} 3 & 1 & 0 \\ -2 & -4 & 3 \\ 5 & 4 & -2 \\ \end{matrix}$$ B = $$\begin{matrix} -4 & 3 \\ 4 & -2 \\ \end{matrix}$$ C = $$\begin{matrix} -2 & 3 \\ 5 & -2 \\ \end{matrix}$$ D = $$\begin{matrix} -2 & -4 \\ 5 & 4 \\ \end{matrix}$$ |A|= (3)* |A|+ (1)|B| + (0)|D| |A| = (3)(-4) + (-11) |A| = -21 Which is wrong, I looked up the solution, it is -1 sorry for my bad writing, I am new to the website. • You forgot that the signs alternate. – amd Nov 28 '19 at 19:11 • det(B)=-4 det(C)= -11 det(D)= 12. 3*(-4) -1*(-11) + 0*12 = -1. Remeber the pattern goes like this: + - + - + etc. So you need a “minus-sign” in front of your “1”. – Carl Nov 28 '19 at 19:12 $${\mathrm{det}}(A) = 3 \cdot {\mathrm{det}}(B) + (-1) \cdot 1 \cdot {\mathrm{det}}(C) + 0 \cdot {\mathrm{det}}(D) = -1$$. • My text book says the formula is: |A| = $$\sum_{k=1}^n (a_{kj})*(A_{kj}) =$$ – Anttarm Nov 28 '19 at 19:30 • In that case $j$ is fixed. Which means you may expand through any column. Similar principle work for expansion through rows. Here you are expanding through first row: $$\sum_{k=1}^{n} (a_{1k}) \ast (A_{1k})$$. Also this means $A_{1k}$ include the sign. – Siddhartha Nov 28 '19 at 19:35 • @Anttarm To put it another way, $A_{kj}$ in that formula isn’t simply the determinant of the submatrix with that row and column deleted. It’s the cofactor, which includes a factor of $(-1)^{k+j}$. – amd Nov 28 '19 at 19:49
2020-08-05 02:17:19
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 5, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.6800103783607483, "perplexity": 1114.7179315160247}, "config": {"markdown_headings": false, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2020-34/segments/1596439735906.77/warc/CC-MAIN-20200805010001-20200805040001-00328.warc.gz"}
https://www.physicsforums.com/threads/what-are-the-implications-of-infinity.915588/
# I What are the implications of infinity? 1. May 24, 2017 ### david2 hi, say you have an infinite distance. is half of that distance also infinite? or 1/10000000000000 of that distance. and so on and so on. i suspect it must be because if you say that half of infinity is for example 10000 km then infinty must be 20000 km, which it is not. so, if this proposition (that every part of infinity is infinite) is true then i come to the following conclusion: the universe cannot be infinite because we can move around. if every bit of infinity is infinite then it would not be possible to move lets say 10 cm. it would take forever. am i missing something? 2. May 24, 2017 ### jfizzix For starters, there are an infinite number of non-overlapping length intervals in one meter, but humans have no trouble crossing such distances. 3. May 24, 2017 ### david2 so these intervals in real life (not a moot point) must have a finite lenght. not? 4. May 24, 2017 ### phinds This canard has been around for a couple of thousand years. Google Zeno's Paradox. 5. May 24, 2017 ### david2 thx phinds , will check it out. 6. May 24, 2017 ### Staff: Mentor It is not. Infinity is not a real number. There are extensions of the real numbers where you can work with infinity as numbers. In these extensions, infinity divided by a finite number is (edit: ±) infinity. You cannot cross 10% of an infinite universe. But you don't have to do that to move 10 cm. Infinity divided by infinity is undefined. Last edited: May 24, 2017 7. May 24, 2017 ### david2 interesting 8. May 24, 2017 ### Janosh89 Riemann (misspelt?) used numbers and there correspondence ,gridwise , to quantify and even add infinities together. thus the set of fractions _ 1/2 1/3 etc were not an unbounded infinity but the set of decimal equivalents were... 9. May 24, 2017 ### jbriggs444 The set of fractions 1/2, 1/3, etc is bounded above by 1/2 and below by zero. The set is clearly bounded. It is equally clear that the number of fractions in the set exceeds any finite bound. The same applies for the set of equivalent decimal numerals. (0.5, 0.333..., 0.25, 0.2, ... ) It is not clear what you are trying to say. Perhaps that the set of all rational fractions is countably infinite but that the set of all infinite decimal strings is uncountably infinite? [That's Cantor, not Riemann] Last edited: May 24, 2017 10. May 24, 2017 ### Drakkith Staff Emeritus That's right. When I walk to the store, that distance is finite and it takes me a finite amount of time to cross it. It's important to understand that infinity describes, what I like to call, a process (I'm sure mathematicians have a proper term for it though). If I walk to the store at 1 meter per second, then every second I go a finite distance of 1 meter. That's obvious of course. But, what happens if I start dividing this length into equal finite segments? Well, if I divide it into 2 equal segments, then every second I cross 2 segments of 1/2 meter each. The total distance is still the same, and it still takes the same amount of time to go 1 meter. Also, each segment has a different start and end point. If the start of segment 1 is at $x=10$ then the end of segment 1 is at $x=10.5$. Segment 2 would then go from 10.5 to 11. Now, what happens if we keep increasing the number of segments? The length of each segment decreases and the number of segments per meter increases. So I'd have to cross more and more segments as I divide the total distance up into more and more pieces. Note that each segment still has a start and an end point, each is still finite in size, and the number of segments is still a regular old number. But let's keep going. Let's keep dividing it up, further and further. Am I forced to stop at some point? Is there some number of segments that I suddenly cannot go above? No, there is not. I can divide my 1 meter segment into more and more pieces and the number of segments increases without end. Infinity describes this process. It is the concept that something can continue happening without end. In this case, I can continue to increase the number of segments in my 1 meter length to any arbitrary amount. I don't suddenly have to stop at 1050 segments. I can continue to 1050 + 1 and even beyond. In this case, we say that there are an infinite number of segments and the behavior of these segments is that they get smaller and smaller as their length goes to zero. They become point-like. Another description of these segments is that they become infinitesimal in size. Note that infinitesimal is not zero any more than infinity is a number. It merely describes the behavior of something as it gets smaller and smaller. If there is no minimum size, then the length of any segment can anything. We can make their lengths as small as we want as long as it's non-zero. Be aware that just because we've started with a finite number of line segments and made them smaller and smaller, this doesn't mean that reality is "discrete". As far as we know, things like length and distance are continuums, meaning that there is no inherent minimum length that something can be. In our math, in order to properly go from a discrete number of line segments, where each line segment is non-zero in size, to a continuum, we need concepts like infinity and infinitesimals. That's my understanding at least. 11. May 24, 2017 ### jbriggs444 The modern mathematical notion of infinity does not include the notion of a process. Roughly speaking, the idea of a process is the idea of a "potential infinity". As you suggest, this is the notion that no matter how far you go, you can go farther or no matter how finely you divide, you can divide more finely. Gregor Cantor put a foundation under the notion of a completed infinity. This is the idea of a collection of infinitely many things. For instance the set of all the natural numbers has infinitely many members. We talk about this set as a fixed thing, not as a continuously incrementing process. It can be a difficult thing to wrap one's head around. It took me about a week in my first formal course on real analysis before the idea gelled and I could stop thinking of the Peano axioms as describing an unending process and start thinking of them as defining the properties of a completed whole. 12. May 25, 2017 ### david2 hi again, thank you all for your answers.It got me thinking. I also saw some other threads about the infinity subject. very interesting albeit a bit difficult for me to grasp instantly. btw this is a great site. very informative. 13. May 25, 2017 ### phinds For more fun with infinity, Google "Hilbert's Hotel" 14. May 27, 2017 ### david2 i will, thx again 15. May 28, 2017 ### mustang19 The implications of infinity include: 1. 0.999... Equals 1 2. Infinity equals -1/12 3. The explosion principle applies to mathematics 16. May 28, 2017 ### phinds Why is #3 a result of infinity? Do you contend that it does not exist WITHOUT infinity? 17. May 28, 2017 ### WWGD ...There is a bijection between an infinite set S and a proper/strict subset of S, e.g.., between the natural numbers and the even numbers. 18. May 28, 2017 ### Drakkith Staff Emeritus 19. Jun 1, 2017 ### sumar one question 10cm must be a percent of infinity right? and if so does that mean that every time you move you are moving a percent of infinity? at lest that's my understanding 20. Jun 1, 2017 ### WWGD Not in the standard sense of the word; a is x% of y if (a/y)*100= x, but , in the standard Reals, infinity is not a number, so an expression (a/$\infty$) has no meaning, unless you "massage it" with limits. Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook Have something to add? Draft saved Draft deleted
2018-02-18 09:15:20
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.6978101134300232, "perplexity": 662.0184441252702}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": false}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2018-09/segments/1518891811795.10/warc/CC-MAIN-20180218081112-20180218101112-00608.warc.gz"}
https://bylosingallgenerality.wordpress.com/2010/05/26/the-number-game-2/
## The Number Game (2) My laptop and I haven’t been together for some days now, so I couldn’t update you on my interesting life. But apart from being sleep deprived, cycling the elfstedentocht and (probably) not being able to pass a lineair algebra exam, because of sleep deprivation and pain everywhere, not a lot happened. So, basically, all I have to tell you is: $2^{45} * 3^{13} * 5^6 * 7^2 * 11 * 13 * 17 * 19 * 23 * 31 * 47$ Good luck! Advertisements ### One Response to “The Number Game (2)” 1. My idea Says: I don’t understand video game, I want ask, Now, what is hot game?
2018-06-21 21:58:54
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 1, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.39834314584732056, "perplexity": 2423.581579695679}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.3, "absolute_threshold": 10, "end_threshold": 15, "enable": false}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2018-26/segments/1529267864300.98/warc/CC-MAIN-20180621211603-20180621231603-00256.warc.gz"}
https://floerhomology.wordpress.com/2013/11/01/non-equivariant-contact-homology/
## Non-equivariant contact homology In a previous post, I explained how that the transversality difficulties in defining cylindrical contact homology can be resolved by using $S^1$-dependent almost complex structures, but at the expense of obtaining the wrong theory. The theory that one naturally obtains this way is what one might call “non-$S^1$-equivariant cylindrical contact homology” (which is related to “positive symplectic homology”). It is then a nontrivial matter to extract the desired cylindrical contact homology from this. In the present post I would like to start over and spell this out in greater generality. (The previous post considered a situation where cylindrical contact homology can be defined, but there is a difficulty defining cobordism maps.) I spoke about this recently at the IAS and Columbia; thanks are due to a number of people in the audiences there who helped clear up some of my many confusions on this topic. I claim that the theory I am about to describe can be made completely rigorous by doing the following: (1) write down some details about Morse-Bott theory a la Bourgeois in the transverse case (there may already be a reference for this, I don’t know); (2) check some details about orientations, and (3) fix any conceptual errors I have made. 1. Beginning the definition of the chain complex Let $(Y,\lambda)$ be a nondegenerate contact manifold of any dimension, and assume that there are no contractible Reeb orbits. Assume also that either $Y$ is closed, or we are in some other situation where Gromov compactness is applicable. For example, $Y$ could be a tubular neighborhood of a (possibly degenerate) Reeb orbit in some larger contact manifold $(Y_0,\lambda_0)$, and $\lambda$ could be a nondegenerate perturbation of $\lambda_0$ in this tubular neighborhood. This is the situation of “local contact homology” as in the preprint of Hryniewicz and Macarini. We now define a chain complex over ${\mathbb Z}$ as follows. For each Reeb orbit $\gamma$ (good or bad), there are two generators, which we will denote by $\hat{\gamma}$ and $\check{\gamma}$. (This notation is borrowed from the paper of Bourgeois-Ekholm-Eliashberg. What I am doing is very similar to things that they and Bourgeois-Oancea have done. I make no claim to any originality here, I am just trying to understand what is going on.) The grading of $\hat{\gamma}$ is one greater than the grading of $\check{\gamma}$. To define the differential on the chain complex, choose a generic family $\{J_t\}_{t\in S^1}$ of almost complex structures on ${\mathbb R}\times Y$, each satisfying the usual conditions (derivative of the ${\mathbb R}$ direction is sent to the Reeb vector field, contact hyperplane sent to itself compatibly with $d\lambda$, invariant under ${\mathbb R}$ translation). If $\gamma_+$ and $\gamma_-$ are Reeb orbits, define ${\mathcal M}(\gamma_+,\gamma_-)$ to be the set of maps $u:{\mathbb R}\times S^1\to{\mathbb R}\times Y$ such that $\partial_su + J_t\partial_tu = 0$ and $\lim_{s\to\pm\infty}u(s,\cdot)$ is a reparametrization of $\gamma_\pm$. Here $s$ denotes the $S^1$ coordinate and $t$ denotes the ${\mathbb R}$ coordinate. Also, in the moduli space ${\mathcal M}(\gamma_+,\gamma_-)$, we mod out by ${\mathbb R}$ translation in the domain. Note that we cannot mod out by $S^1$ translation in the domain, because the equation above is not $S^1$-invariant. Consequently, the expected dimension of this moduli space is one greater than usual. That is, we expect that $\dim {\mathcal M}(\gamma_+,\gamma_-) = |\gamma_+| - |\gamma_-| + 1$ where $|\gamma_+| - |\gamma_-|$ denotes the usual grading difference (which in general depends on a choice of relative homology class of cylinders connecting $\gamma_+$ and $\gamma_-)$. I claim that if the family $\{J_t\}_{t\in S^1}$ is generic, then the moduli space ${\mathcal M}(\gamma_+,\gamma_-)$ is cut out transversely in an appropriate sense, and is a manifold of the above dimension. This should follow similarly to the proof of the analogous result for Hamiltonian Floer homology. 2. Morse-Bott moduli spaces To continue, for each Reeb orbit $\gamma$, choose a base point $p_\gamma$ in the image of $\gamma$ in $Y$. If $\alpha$ and $\beta$ are distinct Reeb orbits, we define “Morse-Bott moduli spaces” ${\mathcal M}(\hat{\alpha},\hat{\beta})$, ${\mathcal M}(\hat{\alpha},\check{\beta})$, ${\mathcal M}(\check{\alpha},\hat{\beta})$ and ${\mathcal M}(\check{\alpha},\check{\beta})$ as follows. Each of these spaces is, as a set, a disjoint union of subsets ${\mathcal M}^k(\cdot,\cdot)$ indexed by nonnegative integers $k$, which (at the risk of some confusion) I will call “levels”. The “primary” levels ${\mathcal M}^0(\cdots,\cdots)$ are given as follows: ${\mathcal M}^0(\hat{\alpha},\hat{\beta}) = \{u\in{\mathcal M}(\alpha,\beta) \mid \lim_{s\to -\infty} \pi_Y(u(s,0)) = p_\beta\}/{\mathbb R},$ ${\mathcal M}^0(\hat{\alpha},\check{\beta}) = {\mathcal M}(\alpha,\beta)/{\mathbb R},$ ${\mathcal M}^0(\check{\alpha},\hat{\beta}) = \{u\in{\mathcal M}(\alpha,\beta) \mid \lim_{s\to +\infty} \pi_Y(u(s,0)) = p_\alpha, \lim_{s\to -\infty} \pi_Y(u(s,0)) = p_\beta\}/{\mathbb R},$ ${\mathcal M}^0(\check{\alpha},\check{\beta}) = \{u\in{\mathcal M}(\alpha,\beta) \mid \lim_{s\to +\infty} \pi_Y(u(s,0)) = p_\alpha\}/{\mathbb R}.$ Here $\pi_Y$ denotes the projection ${\mathbb R}\times Y\to Y$, and we are modding out by ${\mathbb R}$ translation in the target. In short, ${\mathcal M}^0(\cdot,\cdot)$ is just the moduli space from Section 1 modulo ${\mathbb R}$ translation in the target, where a check on a Reeb orbit indicates an asymptotic point constraint on the positive end, and a hat on a Reeb orbit indicates an asymptotic point constraint on the negative end. The “higher” levels ${\mathcal M}^k(\cdot,\cdot)$ for $k>0$ consist of tuples $(u_0,\ldots,u_k)$ satisfying the following conditions. First, there are distinct Reeb orbits $\alpha=\gamma_0,\gamma_1,\ldots,\gamma_{k+1}=\beta$ such that $u_i\in {\mathcal M}(\gamma_i,\gamma_{i+1})/{\mathbb R}$. Second, the positive end of $u_0$ has a point constraint if $\alpha$ has a check on it. Third, the negative end of $u_k$ has a point constraint if $\beta$ has a hat on it. Fourth, if $1\le i\le k$, then the three points $p_{\gamma_i}$, $\lim_{s\to-\infty}\pi_Y(u_{i-1}(s,0))$, and $\lim_{s\to+\infty}\pi_Y(u_i(s,0))$ are cyclically ordered around the image of the Reeb orbit $\gamma_i$, with respect to the orientation given by the Reeb flow. In the above we assumed that the Reeb orbits $\alpha$ and $\beta$ are distinct. When they are the same, we define ${\mathcal M}(\hat{\alpha},\hat{\alpha}) = {\mathcal M}(\check{\alpha},\hat{\alpha}) = {\mathcal M}(\check{\alpha},\check{\alpha}) = \emptyset$. Finally, we define ${\mathcal M}(\hat{\alpha},\check{\alpha})$ to be the empty set if $\alpha$ is good, and two (positively oriented) points if $\alpha$ is bad. It follows from the dimension formula in Section 1 (and a bit more transversality which I think is not hard to arrange) that, ignoring for now the points where different levels come together, the Morse-Bott moduli spaces are manifolds of dimensions $\dim{\mathcal M}(\hat{\alpha},\check{\beta}) = |\alpha| - |\beta|$, $\dim{\mathcal M}(\check{\alpha},\check{\beta}) = \dim{\mathcal M}(\hat{\alpha},\hat{\beta}) = |\alpha|-|\beta|-1$, $\dim{\mathcal M}(\check{\alpha},\hat{\beta}) = |\alpha| - |\beta| - 2$. 3. Morse-Bott gluing Let $x,y,z$ denote chain complex generators, i.e. Reeb orbits with hats or checks on them. I claim (and this is where some “Morse-Bott gluing” is required) that if $\dim {\mathcal M}(x,y)=1$, then this entire moduli space is a $1$-manifold, and these $1$-manifolds, as well as the $0$-dimensional moduli spaces, can be oriented so that $\partial{\mathcal M}(x,y) = \coprod_z{\mathcal M}(x,z) \times {\mathcal M}(z,y)$ as oriented manifolds.  (Here by the boundary, I really mean the boundary of a compactification obtained by adding one point for each end.) For example, suppose $x=\hat{\alpha}$ and $y=\check{\beta}$ where $|\alpha|-|\beta|=1$. Consider the primary level ${\mathcal M}^0(x,y) = {\mathcal M}(\alpha,\beta)/{\mathbb R}$. This is a one-dimensional manifold, but it has boundary because curves in this moduli space can break. A curve can break into a pair $(u_0,u_1)$ where $u_0\in {\mathcal M}(\alpha,\gamma)/{\mathbb R}$ and $u_1\in{\mathcal M}(\gamma,\beta)/{\mathbb R}$ for a third Reeb orbit $\gamma$. For dimension reasons we must have either $|\gamma|=|\alpha|$ or $|\gamma|=|\beta|$. Without much loss of generality, suppose $|\gamma|=|\alpha|$. Then $u_1$ lives in the interior of a one-dimensional moduli space ${\mathcal M}(\gamma,\beta)/{\mathbb R}$. Instead of regarding the pair $(u_0,u_1)$ as a boundary point of the moduli space ${\mathcal M}(x,y)$, we extend the moduli space ${\mathcal M}(x,y)$ by including part of $\{u_0\}\times{\mathcal M}(\gamma,\beta)/{\mathbb R}$, namely the “half” in which the cylic ordering constraint is satisfied along $\gamma$. This is why we need to introduce the level ${\mathcal M}^1(x,y)$. We now continue this process. The curve $u_1$ may itself break, leading us to the next level ${\mathcal M}^2(x,y)$, and so forth. Now what happens if the cylic ordering constraint at one of the intermediate levels ceases to hold? There are three ways this can happen. First, it could happen that the points $\lim_{s\to-\infty}\pi_Y(u_{i-1}(s,0))$ and $\lim_{s\to+\infty}\pi_Y(u_i(s,0))$ coincide for some $i\in\{1,\ldots,k\}$. In this case, we can glue $u_{i-1}$ and $u_i$ to jump down to a lower level of the moduli space where $k$ decreases by one. Second, the point $\lim_{s\to+\infty}\pi_Y(u_i(s,0))$ could coincide with $p_{\gamma_i}$ for some $i\ge 1$. Now we are truly stuck and cannot extend the moduli space further. But we are at a point in the product ${\mathcal M}(x,\check{\gamma_i})\times {\mathcal M}(\check{\gamma_i},y)$, so that’s OK. Third, the point $\lim_{s\to-\infty}\pi_Y(u_i(s,0))$ can coincide with $p_{\gamma_{i+1}}$ for some $i\le k$. In this case we see a boundary point in ${\mathcal M}(x,\hat{\gamma}_{i+1})\times {\mathcal M}(\hat{\gamma}_{i+1},y)$. 4. What about the bad Reeb orbits? In studying the boundary of the moduli space ${\mathcal M}(x,y)$, there is one remaining issue. Suppose for example that $x=\check{\alpha}$ and $y=\check{\beta}$ where $\beta$ is bad. The primary level is then ${\mathcal M}^0(\check{\alpha},\check{\beta}) = \{u\in{\mathcal M}(\alpha,\beta) \mid \lim_{u\to +\infty}\pi_Y(u(s,0)) = p_\alpha\}/{\mathbb R}.$ Now, because there is no point constraint on the negative end at the bad orbit, there is a problem orienting this moduli space by the usual method of “coherient orientations” (which is what one needs to get the boundary orientations to come out right). The upshot is that we can coherently orient the part of this moduli space where $\lim_{s\to -\infty}\pi_Y(u(s,0))$ does not equal the base point $p_\beta$. When we hit the base point, we have to stop. We interpret this stopping point as a boundary point in ${\mathcal M}(\check{\alpha},\hat{\beta}) \times {\mathcal M}(\hat{\beta},\check{\beta})$. This is why we want ${\mathcal M}(\hat{\beta},\check{\beta})$ to be nonempty when $\beta$ is bad. And the reason why we want this set to contain two points is that if we start with an element of ${\mathcal M}(\check{\alpha},\hat{\beta})$, then there are two ways to “glue” it to obtain an end of the moduli space ${\mathcal M}(\check{\alpha},\check{\beta})$, because there are two directions in which the point $\lim_{s\to -\infty}\pi_Y(u(s,0))$ can move along the Reeb orbit $\beta$. 5. Non-equivariant contact homology If you believe all of that, we now have a chain complex $SC_*(Y,\lambda)$, which depends on the additional choice of the generic family of almost complex structures $\{J_t\}_{t\in S^1}$ and the base points $p_\gamma$. The differential, which we will denote by $\partial_{SH}$, counts points in the zero-dimensional Morse-Bott moduli spaces with signs given by a coherent orientation. The gluing theory outlined above then implies that $\partial_{SH}^2=0$. We denote the homology of this chain complex $SH_*(Y,\lambda)$ and claim that it does not depend on the additional choices. It is useful to write the differential in block matrix form as $\partial_{SH} = \begin{pmatrix} \check{\partial}_1 & \partial_0 \\ \partial_2 & \hat{\partial}_1 \end{pmatrix}.$ Here $\check{\partial}_1$ denotes the component of the differential going between checked Reeb orbits with usual grading difference one; $\hat{\partial}_1$ denotes the component between hatted orbits with usual grading difference one; $\partial_0$ denotes the component from hatted orbits to checked orbits with usual grading difference zero; and $\partial_2$ denotes the component from checked orbits to hatted orbits with usual grading difference two. 6. Example: S^1-independent J Suppose that we can choose the family of almost complex structures $\{J_t\}_{t\in S^1}$ to all agree with a single almost complex structure $J$ on ${\mathbb R}\times Y$ so that the necessary transversality holds to define cylindrical contact homology. This is rarely possible, but it is possible when $\dim Y = 3$. There are now two combinatorial conventions for defining the cylindrical contact homology differential, which I denote by $\partial_{CH}^+$ and $\partial_{CH}^-$. If $\alpha$ and $\beta$ are good Reeb orbits, then the coefficient of $\partial_{CH}^+$ from $\alpha$ to $\beta$ counts holomorphic cylinders $u$ from $\alpha$ to $\beta$, multiplied by $m(\alpha)/m(u)$, where $m$ denotes the covering multiplicity. With the other convention $\partial_{CH}^-$, one instead multiplies by $m(\beta)/m(u)$. One needs combinatorial factors such as these to account for the fact that there are multiple ways to glue holomorphic cylinders along multiply covered Reeb orbits. The two conventions give rise to isomorphic chain complexes over ${\mathbb Q}$; the isomorphism from the first convention to the second multiplies each Reeb orbit by its covering multiplicity. (On the other hand, cylindrical contact homology is not invariant if one uses ${\mathbb Z}$ coefficients; we will discuss this in another post.) I claim now that for our $S^1$-independent $J$, we have $\partial_{SH} = \begin{pmatrix} \partial_{CH}^+ & \partial_0^{good} \\ \partial_2 & \partial_{CH}^- \end{pmatrix}.$ Here $\partial_0^{good}(\hat{\alpha})$ is $0$ if $\alpha$ is good, and $2\check{\alpha}$ if $\alpha$ is bad. Terms $\check{\beta}$ with $\beta\neq\alpha$ cannot appear in $\partial_0^{good}(\hat{\alpha})$ for dimensional reasons. It is an exercise to check that $\partial_{CH}^+$ and $\partial_{CH}^-$ appear on the diagonal, because of the way the point constraints work. The chain complex is now filtered by the usual grading of Reeb orbits, so we can compute its homology by a spectral sequence. The first term of the spectral sequence is the homology of $\partial_0^{good}$. This kills the bad orbits, if we are using rational coefficients. Let us do this (use rational coefficients), even though the chain complex is defined over the integers. The second term in the spectral sequence is then two copies of cylindrical contact homology. The third term now computes the homology of a map on the second term induced by $\partial_2$, so that we get an exact triangle $CH\stackrel{(\partial_2)_*}{\longrightarrow} CH \longrightarrow SH\otimes{\mathbb R}\longrightarrow \cdots$ as in Bourgeois-Oancea. 7. What about the general case? It is not clear how to generalize the above example to the case where the almost complex structure is $S^1$-dependent. The chain complex $SC_*$ is still filtered by the usual grading of Reeb orbits. However the first term in the spectral sequence no longer has an obvious interpretation in terms of cylindrical contact homology, because $\partial_0$ may include coefficients from $\hat{\alpha}$ to $\check{\beta}$ where the Reeb orbits $\alpha$ and $\beta$ are different. Also, cobordism maps will not respect this filtration, but may shift it up by $1$. In conclusion, I still don’t see how to define cylindrical contact homology in general using $S^1$-dependent almost complex structures. But we haven’t yet squeezed every drop of information out of the above moduli spaces. And maybe the non-equivariant contact homology also has some uses. This entry was posted in Uncategorized. Bookmark the permalink. ### 3 Responses to Non-equivariant contact homology 1. By the way, the definition of non-equivariant contact homology sketched above is extremely similar to what is worked out in detail in the paper by Bourgeois-Oancea, “Symplectic homology, autonomous Hamiltonians, and Morse-Bott moduli spaces”. So my claims above probably follow from minor modifications to their paper.
2016-10-20 19:31:44
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 196, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9367667436599731, "perplexity": 193.2597041373086}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 5, "enable": false}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2016-44/segments/1476988717783.68/warc/CC-MAIN-20161020183837-00123-ip-10-171-6-4.ec2.internal.warc.gz"}
https://forum.allaboutcircuits.com/threads/chargring-supercaps-with-step-down-module-can-charage-caps-in-series.118509/
# Chargring SuperCap's with Step Down Module -Can charage caps in series? #### FubarI33t Joined Dec 14, 2015 2 SuperCap's!!!! Fun little project I am working on that should become a permanent fixture in the trunk of my Wankel powered RX8. Components: 6x 2.5V 700F Cap's, 2x 4-38V to 1.25-36V 5A adjustable step down modules(ebay 5$special) So, here is the purpose, 6x700F Caps in series(116.663F) for engine starting!!. Now I don't want to just feed 14V back into these caps for charging. I bought two(one each for 3 caps) of these 5A adjustable module's(with current limiting) and I hope they can limit the current enough so the caps don't burn them out. But question is- Wiring these up for recharge. I'm by-far no expert in wiring. But what I have so far, Positive of each cap wired to positive output of module(remember 3 caps per module set to 2.1-2.2V) and both NEG output of modules wired to NEG output of last cap(NEG that grounds to car) Now each Cap is in series, with solid copper connectors, will it hurt to have the modules wired in to each POS of caps? I wanted to ask BEFORE I apply power, I am well aware these things can pretty much kill me if they want. Yes these caps have been insulated with extra thick HD rubber tape between the Alloy bars! #### Attachments • 115.1 KB Views: 16 • 113.5 KB Views: 16 Last edited: #### Papabravo Joined Feb 24, 2006 14,885 Capacitors in series are like resistors in parallel. You can't just add them up; it doesn't work that way. Ignoring that detail for a moment are you here to tell us that you can actually do this -- start a rotary engine from this rig? BTW 700 || 700 || 700 ≈ 233.3 F http://farside.ph.utexas.edu/teaching/302l/lectures/node46.html You might want to undertake a basic review of electronics before you do kill yourself. You could proceed on your current path and win a Darwin Award. Last edited: #### DickCappels Joined Aug 21, 2008 6,823 They are used to start diesel engines in locomotives. The perform better than batteries in cold weather. #12 #### GopherT Joined Nov 23, 2012 8,012 Capacitors in series are like resistors in parallel. You can't just add them up; it doesn't work that way. Ignoring that detail for a moment are you here to tell us that you can actually do this -- start a rotary engine from this rig? BTW 700 || 700 || 700 ≈ 233.3 F http://farside.ph.utexas.edu/teaching/302l/lectures/node46.html You might want to undertake a basic review of electronics before you do kill yourself. You could proceed on your current path and win a Darwin Award. That is what he said, hex pet the OP did the math correctly. You did the math correctly if the OP is willing to change his design to your newly specified 3 caps in series instead of 6. Six caps in series at 700F each is 166 F (exactly as OP said) Now, about that Darwin Award.... #### Alec_t Joined Sep 17, 2013 11,817 It is unlikely that all six caps have identical capacities. Therefore, with the series arrangement, one or more may become reverse polarised when the caps discharge into the load. From my limited googling it seems the jury is out on whether that will damage a supercap, and it may be manufacturer-dependent. If damage can occur, then some sort of charge-balancing may be necessary during charging and discharging. #### DickCappels Joined Aug 21, 2008 6,823 Perhaps rather than balancing, placing a very high current Schottky diode across each capacitor to limit the reverse voltage might be enough. Anybody know what half a volt reverse bias for a short time is likely to do to a supercap? #### Denesius Joined Feb 5, 2014 106 Super caps use a carbon coating along with an electrolyte immersion. Reverse polarity (low voltage), short-term will alter the electrolyte distribution, markedly diminishing capacity, and long-term will overheat and burst the casing. They do make balance chargers for supercaps: they are available on ebay, cap specific, and for my Maxwells cost about$1.90 per cell, free shipping. They balance the charge, prevent overvolts, and block reverse charging. They dissipate the excess as heat, so you do need current limits during charge. I have a bank of caps in series (12, for a 24 volt system) that I use to maintain power to an essential gauge (AHRS in an aircraft). The bank charges during power up, and will keep the data valid during interruptions of as long as 10 minutes. During normal power down the bank simply discharges down to around 8 volts, at which point a relay opens. These suckers will easily start a Honda Ridgeline engine at least 3 times on a full charge! I know- I tried it. The starter motor spins faster than internal battery- however, on the 3rd try I burned out the trace on the circuit board, the weak point in the circuit. (and no, it wasn't the 24v setup- I used only 1/2, or 12 volts) Last edited: #### FubarI33t Joined Dec 14, 2015 2 I did find some Cap-Top protection boards for my 2.5V 700F Caps with reverse protection etc... They are on order, i'll just use the step down modules to take the 14V down to 12V since they also have current limit protection(5A each cont,) and let 1 feed 3, so both of my boards will still be used. I will deff keep this post updated with results or more questions. #### Papabravo Joined Feb 24, 2006 14,885 That is what he said, hex pet the OP did the math correctly. You did the math correctly if the OP is willing to change his design to your newly specified 3 caps in series instead of 6. Six caps in series at 700F each is 166 F (exactly as OP said) He actually said 116.663 which is correct, not 166 which is incorrect, but I was misled into thinking he had added them up in some fashion. Closest I've come to a Darwin was pressing on into deteriorating weather conditions in my 7ECA. I was instrument rated, but the plane was not instrument equipped. I had needle-ball & airspeed. #### GopherT Joined Nov 23, 2012 8,012 He actually said 116.663 which was what misled me into thinking he had added them up in some fashion. Closest I've come to a Darwin was pressing on into deteriorating weather conditions in my 7ECA. I was instrument rated, but the plane was not instrument equipped. I had needle-ball & airspeed. If you've already procreated, then you cannot get an award. If you've passed on your genetic material, you are only eligible for an honorable mention. #### Papabravo Joined Feb 24, 2006 14,885 If you've already procreated, then you cannot get an award. If you've passed on your genetic material, you are only eligible for an honorable mention. I guess I'm still here along with three others. #### GopherT Joined Nov 23, 2012 8,012 I guess I'm still here along with three others. Well then, better luck winning in your next life. There are others around here that I prefer to see get an 'award'. #### #12 Joined Nov 30, 2010 18,216 You guys creep me out. Flying into bad weather with a needle-ball? I'm so cautious I won't even get on a boat, and I start my lawn mower with a battery, but the, "yank here" rope is still in place. #### Papabravo Joined Feb 24, 2006 14,885 You guys creep me out. Flying into bad weather with a needle-ball? I'm so cautious I won't even get on a boat, and I start my lawn mower with a battery, but the, "yank here" rope is still in place. Nothing creepy about it, training kicks in, you keep the wings level and the airspeed constant, you're flying straight and level at a constant altitude so you have time to decide what to do next. You call ATC, he asks if you have a VOR, you say yes, he says "tune 115.7 and fly direct". You comply and 10 minutes later you're out of the soup and it's CAVU. This is almost as bad as textspeak. #12 #### ScottWang Joined Aug 23, 2012 6,982 Something you should care about when you using super capacitor: 1. Using voltage -- The rating voltage of cap, if you using 2.5V then you better not to over 2V and the Vcap_total = 2V*6 = 12V, over 2V or 2.5V may be damage the cap, but it is no good for the cap, and it will make the life time shorter. 2. Equal voltage -- Each cap needs to in parallel with a resistor, the current of resistor about 0.12 mA, if you didn't add the resistors may not change anything in the short time, but someday, one of the weakness cap may blow up then its normal life time. 3. More protection -- For each cap in parallel with a 2.5V zener diode, and choosing the watts as more higher. 4. Note : If you have added the resistors and zener diodes and found any parts was damaged then the cap was lost the balance then you should using the ESR meter to measure the caps and change the bad cap. #### BR-549 Joined Sep 22, 2013 4,938 I have no experience with Scaps. Why not charge them like you discharge them? In series. Monitor each cap voltage. Won't this tell you how your stack is preforming?
2021-01-28 09:55:52
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.40453407168388367, "perplexity": 3313.617842478908}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-04/segments/1610704839214.97/warc/CC-MAIN-20210128071759-20210128101759-00235.warc.gz"}
http://mymathforum.com/probability-statistics/11113-probability-4-6-dice-containing-exactly-one-pair.html
My Math Forum Probability of 4 of 6 dice containing exactly one pair Probability and Statistics Basic Probability and Statistics Math Forum February 7th, 2010, 05:18 AM #1 Member   Joined: Jan 2010 Posts: 32 Thanks: 0 Probability of 4 of 6 dice containing exactly one pair I am not good at solving probability problems and would appreciate any help with the below problem... You toss 6 dice. If exactly one die is a 2 and exactly one die is a 5, in how many ways can the remaining 4 dice contain exactly one pair? February 7th, 2010, 05:44 AM #2 Senior Member   Joined: Feb 2009 From: Adelaide, Australia Posts: 1,519 Thanks: 3 Re: Probability of 4 of 6 dice containing exactly one pair The remaining dice may be any of 1, 3, 4, or 6. Pick one of these to represent the pair; then, pick two of the remaining three to be the last two dice. $4{3\choose 2}= 4\cdot 3 = 12$ February 7th, 2010, 05:58 AM #3 Member   Joined: Jan 2010 Posts: 32 Thanks: 0 Re: Probability of 4 of 6 dice containing exactly one pair Thanks a ton. Is it possible to explain little bit more in detail. I did not quite understand it. Appreciate your help. February 7th, 2010, 08:05 AM #4 Senior Member   Joined: Feb 2009 From: Adelaide, Australia Posts: 1,519 Thanks: 3 Re: Probability of 4 of 6 dice containing exactly one pair The remaining dice may be any of 1, 3, 4, or 6. Two of them have to be the same: A A B C So there are four choices for A. Then (depending on your choice for A) there are three choices for B, and two choices for C. 4*3*2 = 24. But if B and C were switched, you couldn't tell the difference, so divide by two to get 12. (You are choosing two items out of three, and order isn't important. This is represented as "three choose two", written ${3\choose 2}$. The general formula for "x choose y" is $\frac{x!}{y!(x-y)!}$.) Tags dice, pair, probability Thread Tools Display Modes Linear Mode Similar Threads Thread Thread Starter Forum Replies Last Post WWRtelescoping Algebra 1 March 6th, 2014 03:31 PM WhiteLabel Probability and Statistics 4 January 25th, 2014 11:21 AM hamburgertime Advanced Statistics 1 April 16th, 2013 03:13 PM pksinghal Probability and Statistics 3 October 23rd, 2010 03:03 PM Brimstone Algebra 10 May 30th, 2008 07:36 PM Contact - Home - Forums - Cryptocurrency Forum - Top
2019-10-23 12:46:21
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 3, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.7171565294265747, "perplexity": 1012.5125490676729}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-43/segments/1570987833766.94/warc/CC-MAIN-20191023122219-20191023145719-00040.warc.gz"}
https://www.physicsforums.com/threads/center-of-cylinder.78986/
Center of cylinder 1. Jun 14, 2005 isabella i am looking for a way to find the coordinate of the center of a circle in a sheared cylinder. the base of the cylinder has a center (x,y,z), the angle of tilt of the cylinder is theta.so i need a formula which allows me to get the center of any circle in the cylinder.however i can't seem to get the right formula.i've attached a file with the drawing of the sheared cylinder.(although the cylinder is sheared, it still have a circular cross-section) Attached Files: • cylinder.doc File size: 20.5 KB Views: 82 2. Jun 14, 2005 HallsofIvy Staff Emeritus Although they are not shown in the picture, can we assume that you are given the radius and height (measured along the axis) of the cylinder? Also, since this is a 3D problem, we would need to know in which direction the cylinder is tilted (over the x-axis, y-axis, or z-axis?). If you know those, this is a simple trig problem. In order not to confuse it with general coordinates, I'm going to call the given point (x0,y0,z0). Assuming that the height of the cylinder, measured along the axis is h and that the axis lies above the x-axis, we get immediately that the coordinates of the "top" of the cylinder (the other end of the axis) are x1= x0+ h sin &theta;, y1= y0, and z1= z0+ h cos &theta;. You can get the coordinates of the center point, a, and point b (1/3 of the way from (x0,y0,z0) to (x1,y1,z1)?) from those.
2017-01-21 20:15:01
{"extraction_info": {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.8105998635292053, "perplexity": 486.41064413402285}, "config": {"markdown_headings": false, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2017-04/segments/1484560281202.94/warc/CC-MAIN-20170116095121-00545-ip-10-171-10-70.ec2.internal.warc.gz"}
https://askdev.io/questions/107968/shortest-range-in-between-a-factor-and-also-a-helix
# Shortest range in between a factor and also a helix I have a helix in parametric formulas that twists around the Z axis and also a factor precede. I intend to establish the fastest range in between this helix and also the factor, just how would certainly i deal with doing that? I've attempted making use of Pythagorean theory to get the range and afterwards taking the by-product of the range function to locate the absolutely nos yet I can not appear to get a specific formula for T and also I'm stuck at that. (I excuse the tags, not exactly sure just how to mark it and also I angle create new ones either) 0 2019-12-02 02:51:47 Source Share Let the helix be offered by $(\cos t, \sin t, ht)$ (after scaling). If $P$ is your factor $(a,b,c)$, and also $Q = (\cos t, \sin t, ht)$ is the local factor on the helix, after that $PQ$ is vertical to the tangent at $Q$, which is simply $(-\sin t, \cos t, h)$ : $-(\cos t - a)\sin t + (\sin t - b)\cos t + (ht - c)h = 0$ This streamlines to $A \sin(t+B) + Ct + D = 0$ for some constants $A,B,C,D,$ as Moron claimed. Yet after that you need to address this numerically. There will certainly be greater than one remedy as a whole, yet (as Jonas Kibelbek mentioned in the remarks) you just require to examine the remedies with $z$ - coordinate in the interval $[c-\pi h, c+\pi h)$.
2022-05-18 07:01:50
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.7596506476402283, "perplexity": 641.0251004160269}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2022-21/segments/1652662521152.22/warc/CC-MAIN-20220518052503-20220518082503-00631.warc.gz"}
https://projecteuclid.org/euclid.ejs/1485939612
## Electronic Journal of Statistics ### Convergence properties of Gibbs samplers for Bayesian probit regression with proper priors #### Abstract The Bayesian probit regression model (Albert and Chib [1]) is popular and widely used for binary regression. While the improper flat prior for the regression coefficients is an appropriate choice in the absence of any prior information, a proper normal prior is desirable when prior information is available or in modern high dimensional settings where the number of coefficients ($p$) is greater than the sample size ($n$). For both choices of priors, the resulting posterior density is intractable and a Data Augmentation (DA) Markov chain is used to generate approximate samples from the posterior distribution. Establishing geometric ergodicity for this DA Markov chain is important as it provides theoretical guarantees for constructing standard errors for Markov chain based estimates of posterior quantities. In this paper, we first show that in case of proper normal priors, the DA Markov chain is geometrically ergodic for all choices of the design matrix $X$, $n$ and $p$ (unlike the improper prior case, where $n\geq p$ and another condition on $X$ are required for posterior propriety itself). We also derive sufficient conditions under which the DA Markov chain is trace-class, i.e., the eigenvalues of the corresponding operator are summable. In particular, this allows us to conclude that the Haar PX-DA sandwich algorithm (obtained by inserting an inexpensive extra step in between the two steps of the DA algorithm) is strictly better than the DA algorithm in an appropriate sense. #### Article information Source Electron. J. Statist., Volume 11, Number 1 (2017), 177-210. Dates Received: March 2016 First available in Project Euclid: 1 February 2017 Permanent link to this document https://projecteuclid.org/euclid.ejs/1485939612 Digital Object Identifier doi:10.1214/16-EJS1219 Mathematical Reviews number (MathSciNet) MR3604022 Zentralblatt MATH identifier 1366.60093 #### Citation Chakraborty, Saptarshi; Khare, Kshitij. Convergence properties of Gibbs samplers for Bayesian probit regression with proper priors. Electron. J. Statist. 11 (2017), no. 1, 177--210. doi:10.1214/16-EJS1219. https://projecteuclid.org/euclid.ejs/1485939612 #### References • [1] Albert, J.H. and Chib, S. (1993). Bayesian analysis of binary and polychotomous response data., J. Amer. Statist. Assoc., 88(422):669–679. • [2] Asmussen, S. and Glynn, P.W. (2011). A new proof of convergence of MCMC via the ergodic theorem., Statistics & Probability Letters, 81(10):1482–1485. • [3] Birnbaum, Z.W. (1942). An inequality for mill’s ratio., Ann. Math. Statist., 13(2):245–246. • [4] Botev, Z.I. (2015)., TruncatedNormal: Truncated Multivariate Normal. R package version 1.0. • [5] Chan, K.S. and Geyer, C.J. (1994). Discussion: Markov chains for exploring posterior distributions., Ann. Statist., 22(4):1747–1758. • [6] Chen, L.H. and Shao, Q.-M. (2000). Propriety of posterior distribution for dichotomous quantal response models., Proceedings of the American Mathematical Society, 129(293-302). • [7] Flegal, J.M. and Jones, G.L. (2010). Batch means and spectral variance estimators in Markov chain Monte Carlo., Ann. Statist., 38(2):1034–1070. • [8] Hobert, J.P. and Marchev, D. (2008). A theoretical comparison of the data ugmentation, marginal augmentation and PX-DA algorithms., Ann. Statist., 36(2):532–554. • [9] Jones, G., Haran, M., Caffo, B., and Neath, R. (2006). Fixed-width output analysis for markov chain monte carlo., J. Amer. Statist. Assoc., 101(1537-1547). • [10] Jörgens, K. (1982)., Linear integral operators. Surveys and reference works in mathematics. Pitman Advanced Pub. Program. • [11] Khare, K. and Hobert, J.P. (2011). A spectral analytic comparison of trace-class Data Augmentation algorithms and their sandwich variants., Ann. Statist., 39(5):2585–2606. • [12] Liu, J.S. and Wu, Y.N. (1999). Parameter expansion for Data Augmentation., J. Amer. Statist. Assoc., 94(448):1264–1274. • [13] Meng, X.-L. and Van Dyk, D.A. (1999). Seeking efficient Data Augmentation schemes via conditional and Marginal Augmentation., Biometrika, 86(2):301–320. • [14] Meyn, S. and Tweedie, R. (1996)., Markov Chains and Stochastic Stability. Communications and Control Engineering. Springer London. • [15] Mykland, P., Tierney, L., and Yu, B. (1995). Regeneration in markov chain samplers., Journal of the American Statistical Association, 90(429):233–241. • [16] Pal, S., Khare, K., and Hobert, J.P. (2015). Improving the Data Augmentation algorithm in the two-block setup., Journal of Computational and Graphical Statistics, 24(4):1114–1133. • [17] R Core Team (2015)., R: A Language and Environment for Statistical Computing. R Foundation for Statistical Computing, Vienna, Austria. • [18] Robert, C.P. (1995). Convergence control methods for Markov chain Monte Carlo algorithms., Statist. Sci., 10(3):231–253. • [19] Roberts, G. and Rosenthal, J. (1997). Geometric ergodicity and hybrid Markov chains., Electron. Commun. Probab., 2:13–25. • [20] Román, J.C. and Hobert, J.P. (2015). Geometric ergodicity of Gibbs samplers for Bayesian general linear mixed models with proper priors., Linear Algebra and its Applications, 473:54 – 77. Special issue on Statistics. • [21] Roy, V. (2012). Convergence rates for MCMC algorithms for a robust Bayesian binary regression model., Electron. J. Statist., 6:2463–2485. • [22] Roy, V. and Hobert, J.P. (2007). Convergence rates and asymptotic standard errors for Markov chain Monte Carlo algorithms for Bayesian probit regression., Journal of the Royal Statistical Society: Series B (Statistical Methodology), 69(4):607–623. • [23] Trautmann, H., Steuer, D., Mersmann, O., and Bornkamp, B. (2014)., truncnorm: Truncated normal distribution. R package version 1.0-7. • [24] van Dyk, D.A. and Meng, X.-L. (2001). The art of Data Augmentation., Journal of Computational and Graphical Statistics, 10(1):1–50. • [25] Venables, W.N. and Ripley, B.D. (2002)., Modern Applied Statistics with S. Springer, New York, fourth edition. ISBN 0-387-95457-0. • [26] Zellner, A. (1983). Applications of Bayesian analysis in Econometrics., Journal of the Royal Statistical Society. Series D (The Statistician), 32(1/2):23–34.
2019-08-17 14:52:03
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.7249153256416321, "perplexity": 6299.9189655572445}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": false}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-35/segments/1566027313428.28/warc/CC-MAIN-20190817143039-20190817165039-00007.warc.gz"}
http://cs.stackexchange.com/questions/7509/data-structures-for-general-non-tetrahedral-cell-complexes
# Data structures for general (non-tetrahedral) cell complexes For 2D polygonal meshes, the QuadEdge and HalfEdge data structure representations are sufficient to store and enable efficient query of all topological and incidence information. Are there compact and efficient data structures for 3D polyhedral meshes? I know there has been some recent work on compact representations for tetrahedral meshes, like, for example SOT. I don't know enough about these to know if they generalize to unstructured non-tetrahedral meshes. I can imagine that half-edges might generalize to half-faces with associated half-edges, but it seems like that is a lot of data to store, and there might be more compact representations. I should add that I really only care about retrieving facet information (like which facets are on the boundary, which facets belong to a certain cell); the edge incidence information is not as useful. - There is an extension of half-edge in any dimension, called darts in combinatorial maps. There are two packages in CGAL allowing to use these combinatorial maps in any dimension (see here for combinatorialMaps and here for LinearCellComplex). You can use this data structure to represent any Quasi manifold orientable subdivided 3D object. Quoting from CGAL webpage(section 2.4 Combinatorial Map Properties): A quasi-manifold object is defined as: A dD quasi-manifold is an object obtained by taking some isolated d-cells, and allowing to glue d-cells along (d-1)-cells. and orientable as: It is orientable if it is possible to embed it in the Euclidean space and to define a global "left" and "right" direction in each point of the embedded object. - How does this compare with Dobkin & Laszlo's FacetEdge representation? That seems to be the only other thing I can find. –  Victor Liu Dec 20 '12 at 21:37 They are equivalent. In FacetEdge representation, there are mainly 3 functions: clock, Enext and Fnext; and in a 3D combinatorial map, there are 3 functions $\beta_1$, $\beta_2$ and $\beta_3$. –  gdamiand Dec 21 '12 at 8:36 Note that this site is about computer science, not library implementations. As such, we appreciate answers who contain ideas and concepts, not just references to implementations. –  Raphael May 28 at 14:13
2014-10-31 19:14:02
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.40538614988327026, "perplexity": 1329.2784020656916}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2014-42/segments/1414637900160.30/warc/CC-MAIN-20141030025820-00015-ip-10-16-133-185.ec2.internal.warc.gz"}
https://bosscha.itb.ac.id/en/publication/siregar-orbit-2010/
# On the Orbit of Visual Binary WDS 01158-6853 I-27CD (SAO248342) ### Abstract WDS 01158-6853 I-27CD=SA0 248342 has the proper motion +404. in right ascension and 105. in declination. Magnitude of each star is 7.84 for primary and 8.44 for secondary, separated by 320. from the quadruple system Kappa Tuc=LDS 42 = HJ 3423 AB. The visual binary star of WDS 01158-6853 I-27CD is historically one of the most important double star in constellation Tucana. We have collected the observational data consisting of separation angular ($\rho$) and position angle ($\theta$) from the observations of 1897 up to 2001 taken at the Bosscha Observatory and other Observatories in the world. This study presents the recent status of orbit binary system WDS 01158-6853 I-27CD. By using Thiele Van den Bos method and empirical formula of Strand’s Mass-Luminosity relation we have determined the orbit and mass of WDS 01158-6853 I-27CD. The results are; $P=85.288$ years, $e=0.053$, $T =1911.23$, $i=27.93$, $\Omega=52.83$, $\omega=10.73$, $M_1=0.7; M\odot$, $M_2=0.5; M\odot$, $p=0”.0589$ Type Publication arXiv e-prints
2021-04-23 11:47:11
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.8677197098731995, "perplexity": 4322.934497828142}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-17/segments/1618039617701.99/warc/CC-MAIN-20210423101141-20210423131141-00182.warc.gz"}
https://openlab.citytech.cuny.edu/-groups-mat-1375-student-video-resources-/the-inverse-of-a-function/
# The inverse of a function 1.  Intro to inverse functions (9:05)  For , Sal finds 2. Inputs and outputs of inverse functions (6:18)  For a function defined by a table, find , , , , . 3.  Graphing the inverse of a  linear function (2:17) 4. *  Practice: Type of problem: Given the graph of a function , find the value of . 5.  Finding inverse functions: quadratic (7:12) Find the inverse of for . 6.  Finding inverse functions: rational (7:01) Find the inverse of  . 7. *  Practice: Type of problem: What is the inverse function of ?
2021-09-26 08:58:54
{"extraction_info": {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9690080285072327, "perplexity": 2305.6809084313622}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 20, "end_threshold": 5, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-39/segments/1631780057857.27/warc/CC-MAIN-20210926083818-20210926113818-00709.warc.gz"}
http://math.stackexchange.com/questions/69578/bijection-between-ideals-of-r-i-and-ideals-containing-i
# Bijection between ideals of $R/I$ and ideals containing $I$ I read that there is a one-one correspondence between the ideals of $R/I$ and the ideals containing $I$. ($R$ is a ring and $I$ is any ideal in $R$) Is this bijection obvious? It's not to me. Can someone tell me what the bijection looks like explicitly? Many thanks for your help! - This is just one of the Isomorphism Theorems. It holds for groups, rings, modules, and in general any algebra (in the sense of universal algebra). The proofs are all the same; in fact, you can take the proof for groups and it will be come a proof for rings mutatis mutandis. Here it is, explicitly, for rings. Let $R$ be a ring, let $I$ be an ideal. The one-to-one correspondence between subrings of $R/I$ and subrings of $R$ that contains I$(which in fact also makes ideals correspond to ideals) is given as follows: Let$\pi\colon R\to R/I$be the canonical projection sending$r$to the class$r+I$. Given a subring$S$of$R$with$I\subseteq S\subseteq R$, we let $$\pi(S) = \{\pi(s)\mid s\in S\} = \{s+I\mid s\in S\}\subseteq R/I.$$ Given a subring$T$of$R/I$, we make it correspond to $$\pi^{-1}(T) = \{r\in R\mid \pi(r)\in T\}.$$ 1.$\pi(S)$is a subring of$R/I$whenever$S$is a subring of$R$that contains$R/I$. If$S$is a (left, right, two-sided) ideal, then$\pi(S)$is a (left, right, two-sided) ideal of$R/I$. Proof.$0\in S$, so$\pi(0) = 0+I \in \pi(S)$, hence$\pi(S)$is not empty. Also, if$(s+I),(t+I)\in \pi(S)$, with$s,t\in S$, then$s-t\in S$, so$(s+I)-(t+I) = (s-t)+I = \pi(s-t)\in \pi(S)$. Thus,$\pi(S)$is a subgroup of$R/I$. And if$s+I,t+I\in\pi(S)$, with$s,t\in S$, then$(s+I)(t+I) = st+I = \pi(st)\in \pi(S)$(since$S$is a subring of$R$), so$\pi(S)$is a subring. If in addition$S$is a (left) ideal of$R$, then given$(s+I)\in \pi(S)$and$(a+I)\in R/I$, with$s\in S$, we have$(a+I)(s+I) = as+I = \pi(as)$; since$S$is a (left) ideal,$s\in S$and$a\in R$, then$as\in S$, so$\pi(as)\in \pi(S)$. Similar arguments establish the right and two-sided cases. 2. If$T$is a subring of$R/I$, then$\pi^{-1}(T)$is a subring of$R$that contains$I$. If$T$is a (left, right, two-sided) ideal, then so is$\pi^{-1}(T)$. Proof.$0+I\in T$, and since for all$a\in I$,$\pi(a)=a+I = 0+I\in T$, then$a\in \pi^{-1}(T)$. Thus,$\pi^{-1}(T)$contains$I$. If$r,s\in \pi^{-1}(T)$, then so are$r-s$and$rs$, since$\pi(r-s) = (r-s)+I = (r+I)-(s+I)\in T$(since$r+I,s+I\in T$and$T$is a subring) and$\pi(rs) = rs+I = (r+I)(s+I)\in T$(since$T$is closed under products and$r+I,s+I\in T$). Thus,$\pi^{-1}(T)$is a subring of$R$. If$T$is a left ideal of$R/I$, and$s\in\pi^{-1}(T)$,$a\in R$, then$\pi(s)\in T$, so$\pi(as) = \pi(a)\pi(s)\in T$(since$T$is a left ideal), so$as\in\pi^{-1}(T)$. Thus,$\pi^{-1}(T)$is a left ideal of$R$. Similar arguments establish the right and two-sided cases. 3. The correspondences are inverses of each other, hence they are bijections. Proof. Let$S$be an ideal of$R$that contains$I$. Then$S\subseteq \pi^{-1}(\pi(S))$holds, because it holds for any subset and any function. Now let$a\in \pi^{-1}(\pi(S))$. then$\pi(a)\in \pi(S)$, so there exists$s\in S$such that$\pi(a)=\pi(s)$; hence$\pi(a-s)\in\mathrm{ker}(\pi) = I$. Thus,$a-s\in I\subseteq S$. Since$a-s,s\in S$, and$S$is a subring of$R$, then$a=(a-s)+s\in S$. Thus,$\pi^{-1}(\pi(S))\subseteq S$, proving equality. Conversely, if$T$is an ideal of$R/I$, then$\pi(\pi^{-1}(T))=T$, because$\pi$is onto and this equality holds for any surjective function.$\Box$4. The correspondences are inclusion-preserving. Proof. For any function$f\colon X\to Y$and subsets$A,B\subseteq X$, if$A\subseteq B$then$f(A)\subseteq f(B)$; and for any subsets$C,D$of$Y$, if$C\subseteq D$then$f^{-1}(C)\subseteq f^{-1}(D)$, so this follows from purely set-theoretic considerations. - Let$J\supseteq I$be an ideal of$R$. Because$I$is closed under negation and$J$is closed under addition, each coset of$I$is either contained in$J$or disjoint from$J$, and thus$J$maps directly to a subset of$R/I$via the canonical projection homomorphism$\pi:R\to R/I$; the image happens to be an ideal. In the other direction, assume$K$is an ideal in$R/I$. Then$\pi^{-1}(K)$is easily seen to be an ideal of$R$(the preimage of an ideal under a surjective homomorphism is always an ideal); it contains$I$because$0_{R/I}\$ must be in every ideal. - By "in the other direction" do you mean that the map defined in the first part is surjective or just a Cantor-Bernstein kind of argument? – Asaf Karagila Oct 3 '11 at 17:12 I mean that the first map is surjective. – Henning Makholm Oct 3 '11 at 17:14
2015-11-28 02:51:16
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9528793692588806, "perplexity": 3757.721972408111}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 5, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2015-48/segments/1448398450745.23/warc/CC-MAIN-20151124205410-00022-ip-10-71-132-137.ec2.internal.warc.gz"}
https://proxieslive.com/tag/average/
## Average Case Running Time of Quicksort Algorithm From this website, it states that the average case of Quicksort algorithm is T(n) = T(n/9) + T(9n/10) + θ(n) Im a bit confused. Is it supposed to be ? T(n) = T(n/10) + T(9n/10) + θ(n) ## What is the average number of draws it takes before you can not draw any more cards from the Deck of Many Things? When thinking about this question regarding an upper limit on the number of draws, I wondered what would be the expected number of draws you can actually pull off if you called for a large number of draws. The limiting factors I see are the cards Donjon and The Void which say: You draw no more cards …and Talons which would destroy the deck: Every magic item you wear or carry disintegrates. The ideal answer would discuss any difference between a 13-card and 22-card deck. ## What is my average burst damage with this character and how do I calculate it? I’m trying to figure out what my average burst damage with this character would be but I’m at a loss for how to calculate all of it. Assume the target has an AC of 15 but with theoretically infinite health (so don’t worry about it dying, I’m only interested in the numbers). My character is a level 7 Warlock 5 / Fighter 2, Hexblade Patron, Pact of the Blade with the Hex spell (we can assume that was cast before we attack). Invocations are Thirsting Blade, Improved Pact Weapon, and Eldritch Smite. Fighter has the two weapon fighting style. I also took the feat Dual Wielder. I have an 18 (+4) Charisma stat. My pact weapon is a rapier and the other weapon is a dagger. Both are receiving the bonus from my patron in this case. So to help consolidate the information here’s this. Warlock/Fighter 5/2 18 (+4) Charisma Rapier pact weapon + dagger hex weapon Two weapon fighting style Dual Wielder feat Target AC 15 Target is Hexed and affected by Hexblade’s Curse ## Why does the average selling price differ in this math equation? A product is sold in 3 sizes small medium and large, at a price of 920,1035 and 1035 giving a an average selling price of 996.76 (920+1035+1035/3=996.76) Total units sold is 2337.41 at a total cost of 2 479 315.45 why does the average selling price equals (2 479 315.45/2337.41=1060.71) and not 996.76? These are actual numbers and should equal the average price? ## How to show average rating in author profile i need your help. I wanted to show the average rating in author profile in wordpress website. Showong average rating of a post is pretty simple, where users post the ratings. And the code calculate the average rating. But how to show the average of average rating of posts in author profile? ## Average formula for Google Sheets with substitution over some figures I have a row of figures from 0 to 2, some cells are empty. I need to count an average for them, but with the rule that would count 2 as 1. Thanks ## Calculating average in SSRS Matrix Table alongside filtered columns to separate out current versus previous years I have a dataset, returned from a SQL query, that has the following data: • TYPE_CODE • YEAR The data set spans the years 2014 through 2019. The TYPE_CODE has 6 different values. How do I setup an SSRS matrix to provide the following layout and data: So far I have a matrix setup (see the pic below) that has a row group (TYPE_CODE1) for the TYPE_CODE data, and two column groups (YEAR_PREV and YEAR_CURRENT) that are filtered as follows: – The second column in the matrix is the YEAR_PREV group, and is filtered to not show 2019 data (YEAR <> 2019) – The 4th column in the matrix is the YEAR_CURRENT group, and is filtered to only show 2019 data (YEAR = 2019) This method correctly splits my data, with the green highlighted columns in the pic below representing what is correct: What is not correct is the average column, as I cannot figure out how to setup that column to only average the columns to the left (the previous years – 2015-2018) and not include the column to the right (2019). I have tried several different expressions to no avail, primarily trying to limit the count function to only the YEAR_PREV group, like so: =count(Fields!TYPE_CODE.Value, "PREV_YEAR")/4 This throws an error telling me that something along the lines of “group cannot be used in aggregate function…”. How do I calculate the average column correctly? ## Is there a regular tree language in which the average height of a tree of size $n$ is neither $\Theta(n)$ nor $\Theta(\sqrt{n})$? We define a regular tree language as in the book TATA: It is the set of trees accepted by a non-deterministic finite tree automaton (Chapter 1) or, equivalently, the set of trees generated by a regular tree grammar (Chapter 2). Both formalisms hold close resemblances to the well-known string analogues. Is there a regular tree language in which the average height of a tree of size $n$ is neither $\Theta(n)$ nor $\Theta(\sqrt{n})$ ? Obviously there are tree languages such that the height of a tree is linear in its size; and in the book Analytic Combinatorics it is shown e.g. that binary trees of size $n$ have average height $2\sqrt{ \pi n}$ . If I understand Proposition VII.16 (p.537) of the mentioned book correctly, then there is a wide subset of regular tree languages that have average height of $\Theta(\sqrt{n})$ , namely those in which the tree language is also a simple variety of trees fulfilling some extra conditions. So I was wondering whether there is a regular tree language showing a different average height or if there is a true dichotomy for regular tree languages. ## Calculation of the average of the values of a column in a matrix I am trying to have a list of values which corresponds to the mean of the values of each column of a matrix. Here I show a quick example (my current matrix has a dimension of 1000 * 1000) If I have matrix like this: matrixExample = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 9, 9, 9}} I would have to obtain a list like this: mean values={5, 5.7, 6.3, 7}. How can I do that?
2019-07-21 05:32:19
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.4954879879951477, "perplexity": 863.7898886598063}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-30/segments/1563195526888.75/warc/CC-MAIN-20190721040545-20190721062545-00411.warc.gz"}
https://clam2021.cmat.edu.uy/sesiones/21
# Large Stochastic systems Organizadores: Claudio Landim (landim@impa.br), Pablo Ferrari (pferrari@dm.uba.ar) • #### Jueves 16 15:00 - 15:45 #### From stochastic dynamics to fractional PDEs with several boundary conditions Patrícia Gonçalves (Instituto Superior Técnico, Portugal) In this seminar I will describe the derivation of certain laws that rule the space-time evolution of the conserved quantities of stochastic processes. The random dynamics conserves a quantity (as the total mass) that has a non-trivial evolution in space and time. The goal is to describe the connection between the macroscopic (continuous) equations and the microscopic (discrete) system of random particles. The former can be either PDEs or stochastic PDEs depending on whether one is looking at the law of large numbers or the central limit theorem scaling; while the latter is a collection of particles that move randomly according to a transition probability and rings of Poisson processes. I will focus on a model for which we can obtain a collection of (fractional) reaction-diffusion equations given in terms of the regional fractional Laplacian with different types of boundary conditions. 15:45 - 16:30 #### Structure recovery for partially observed discrete Markov random fields on graphs Florencia Leonardi (Universidade de São Paulo, Brasil) Discrete Markov random fields on graphs, also known as graphical models in the statistical literature, have become popular in recent years due to their flexibility to capture conditional dependency relationships between variables. They have already been applied to many different problems in different fields such as Biology, Social Science, or Neuroscience. Graphical models are, in a sense, finite versions of general random fields or Gibbs distributions, classical models in stochastic processes. This talk will present the problem of estimating the interaction structure (conditional dependencies) between variables by a penalized pseudo-likelihood criterion. First, I will consider this criterion to estimate the interaction neighborhood of a single node, which will later be combined with the other estimated neighborhoods to obtain an estimator of the underlying graph. I will show some recent consistency results for the estimated neighborhood of a node and any finite sub-graph when the number of candidate nodes grows with the sample size. These results do not assume the usual positivity condition for the conditional probabilities of the model as it is usually assumed in the literature of Markov random fields. These results open new possibilities of extending these models to situations with sparsity, where many parameters of the model are null. I will also present some ongoing extensions of these results to processes satisfying mixing type conditions. This is joint work with Iara Frondana, Rodrigo Carvalho and Magno Severino. 16:45 - 17:30 #### Percolation on Randomly Stretched Lattices Augusto Teixeira (Instituto de Matemática Pura e Aplicada, Brasil) In this talk we will give a new proof for a question that was first posed by Jonasson, Mossel and Peres, concerning percolation on a randomly stretched planar lattice. More specifically, we fix a parameter q in (0, 1) and we slash the lattice Z^2 in the following way. For every vertical line that crosses the x axis along an integer value, we toss an independent coin and with probability q we remove all edges along that line. Then we do the same with the horizontal lines that cross the y axis at integer values. We are then left with a graph G that looks like a randomly stretched version of Z^2 and on top of which we would like to perform i.i.d. Bernoulli percolation. The question at hand is whether this percolation features an non-trivial phase transition, or more precisely, whether p_c(G) < 1. Although this question has been previously solved in a seminal article by Hoffman, we present here an alternative solution that greatly simplifies the exposition. We also explain how the presented techniques can be used to prove the existence of a phase transition for other models with minimal changes to the proof. This talk is based on a joint work with M. Hilário, M. Sá and R. Sanchis. 17:30 - 18:15 #### Branching processes with pairwise interactions Juan Carlos Pardo (Universidad Nacional Autónoma de México, México) In this talk, we are interested in the long-term behaviour of branching processes with pairwise interactions (BPI-processes). A process in this class behaves as a pure branching process with the difference that competition and cooperation events between pairs of individuals are also allowed. BPI-processes form a subclass of branching processes with interactions, which were recently introduced by González Casanova et al. (2021), and includes the so-called logistic branching process which was studied by Lambert (2005). Here, we provide a series of integral tests that fully explains how competition and cooperation regulates the long-term behaviour of BPI-processes. In particular, we give necessary and sufficient conditions for the events of explosion and extinction, as well as conditions under which the process comes down from infinity. Moreover, we also determine whether the process admits, or not, a stationary distribution. Our arguments use the moment dual of BPI-processes which turns out to be a family of diffusions taking values on $$[0,1]$$, that we introduce as generalised Wright-Fisher diffusions together with a complete understanding of the nature of their boundaries. • #### Viernes 17 15:00 - 15:45 #### Persistence phenomena for large biological neural networks Matthieu Jonckheere (Universidad de Buenos Aires, Argentina) We study a biological neural network model driven by inhomogeneous Poisson processes accounting for the intrinsic randomness of biological mechanisms. We focus here on local interactions: upon firing, a given neuron increases the potential of a fixed number of randomly chosen neurons. We show a phase transition in terms of the stationary distribution of the limiting network. Whereas a finite network activity always vanishes in finite time, the infinite network might converge to either a trivial stationary measure or to a nontrivial one. This allows to model the biological phenomena of persistence: we prove that the network may retain neural activity for large times depending on certain global parameters describing the intensity of interconnection. Joint work with: Maximiliano Altamirano, Roberto Cortez, Lasse Leskela. 15:45 - 16:30 #### An algorithm to solve optimal stopping problems for one-dimensional diffusions Ernesto Mordecki (Universidad de la República, Uruguay) Considering a real-valued diffusion, a real-valued reward function and a positive discount rate, we provide an algorithm to solve the optimal stopping problem consisting in finding the optimal expected discounted reward and the optimal stopping time at which it is attained. Our approach is based on Dynkin's characterization of the value function. The combination of Riesz's representation of r-excessive functions and the inversion formula gives the density of the representing measure, being only necessary to determine its support. This last task is accomplished through an algorithm. The proposed method always arrives to the solution, thus no verification is needed, giving, in particular, the shape of the stopping region. Generalizations to diffusions with atoms in the speed measure and to non smooth payoffs are analyzed. 16:45 - 17:30 #### Exact solution of TASEP and generalizations Daniel Remenik (Universidad de Chile, Chile) I will present a general result which allows to express the multipoint distribution of the particle locations in the totally asymmetric exclusion process (TASEP) and several related processes, for general initial conditions, in terms of the Fredholm determinant of certain kernels involving the hitting time of a random walk to a curve defined by the initial data. This scheme generalizes an earlier result for the particular case of continuous time TASEP, which has been used to prove convergence of TASEP to the KPZ fixed point. The result covers processes in continuous and discrete time, with push and block dynamics, as well as some extensions to processes with memory length larger than 1. Based on joint work with Konstantin Matetski. 17:30 - 18:15 #### A martingale approach to lumpability Johel Beltrán (Pontificia Universidad Católica, Perú) The martingale problem introduced by Stroock and Varadhan is an efficient method to prove the convergence of a sequence of stochastic processes which are derived from Markov processes. In this talk we present two examples to illustrate this approach: the density of particles per site of a sequence of condensing zero range processes and the number of sites occupied by a system of coalescing random walks evolving on a transitive finite graph. Both examples exhibit a sort of asymptotic lumpability.
2021-10-26 14:31:57
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.6740400791168213, "perplexity": 448.9386932570181}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-43/segments/1634323587908.20/warc/CC-MAIN-20211026134839-20211026164839-00075.warc.gz"}
https://socratic.org/questions/593ac59511ef6b6c00ebbb64
# An anion-exchange column is lined with "OH"^(-). A solution of "MCl"_2 is passed through the column, and the result titrated to its equivalence point [ . . . ]. If "2.375 g" of "MCl"_2 was originally dissolved, determine [ . . . ] "M"? ## An anion-exchange column is lined with ${\text{OH}}^{-}$. A solution of ${\text{MCl}}_{2}$ is passed through the column, and the result titrated to its equivalence point with $\text{100.00 mL}$ of $\text{0.5 M}$ $\text{HCl}$. If $\text{2.375 g}$ of ${\text{MCl}}_{2}$ was originally dissolved, determine the likely identity of the unknown metal $\text{M}$? Jun 9, 2017 Well, since you have an anion exchange column, presumably it, well, exchanges what anion is in that column. The column is lined with ${\text{OH}}^{-}$. A solution of ${\text{MCl}}_{2}$ is run through the column, so ${\text{Cl}}^{-}$ will displace ALL the ${\text{OH}}^{-}$; the ${\text{OH}}^{-}$ consequently passes through. Since you have used ${\text{0.5 M" xx "0.100 L" = "0.05 mols H}}^{+}$ to neutralize the ${\text{0.05 mols OH}}^{-}$ that passed through, you have: ${\text{0.05 mols OH"^(-) xx "1 mol Cl"^(-)/"1 mol OH"^(-) xx "1 mol MCl"_2/"2 mol Cl"^(-) = "0.025 mols MCl}}_{2}$. The $\text{M}$ metal had reacted to make: ${\text{M"(s) + "Cl"_2(g) -> "MCl}}_{2} \left(s\right)$ Thus, ${\text{0.025 mols MCl}}_{2}$ were made. Therefore, from the mass of the solid dissolved in water: $\text{2.375 g MCl"_2/"0.025 mols}$ $=$ ${\text{95 g/mol MCl}}_{2}$. ${M}_{M C {l}_{2}} - {M}_{2 C l}$ = "95 g/mol" - 2("35.453 g/mol Cl") = color(blue)(M_(M)) = "24.094 g/mol" ~~ color(blue)("24 g/mol")
2020-09-25 23:42:14
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 25, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.6034525632858276, "perplexity": 4833.179276529857}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2020-40/segments/1600400228998.45/warc/CC-MAIN-20200925213517-20200926003517-00072.warc.gz"}
https://proofwiki.org/wiki/Set_Difference_as_Intersection_with_Complement
# Set Difference as Intersection with Complement ## Theorem Set difference can be expressed as the intersection with the set complement: $A \setminus B = A \cap \complement \left({B}\right)$ ## Proof This follows directly from Set Difference as Intersection with Relative Complement: $A \setminus B = A \cap \complement_S \left({B}\right)$. Let $S = \Bbb U$. Since $A, B \in \Bbb U$ by the definition of the universe, the result follows. $\blacksquare$
2019-11-14 10:09:30
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.8900216221809387, "perplexity": 589.6126610092451}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 20, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-47/segments/1573496668334.27/warc/CC-MAIN-20191114081021-20191114105021-00283.warc.gz"}
https://mathoverflow.net/questions/207804/finite-generation-of-a-certain-type-of-subring
finite generation of a certain type of subring Let $k$ be a field, and let $R$ be a finitely generated $k$-algebra. (If it helps, you may assume $R$ is an integral domain.) Let $I$ be an ideal of finite colength. Note that $A:=k+I$ is a subring of $R$. Indeed, it is the pullback of the diagram $k \hookrightarrow R/I \twoheadleftarrow R$. Here's my question: $$\text{Is }A \text{ finitely generated as a } k\text{-algebra?}$$ By the Eakin-Nagata theorem, I know that $A$ is Noetherian, since the Noetherian ring $R$ is module-finite over it (as it is module-generated over $A$ by any lifting of any $k$-basis of $R/I$). Also, without the condition on colength or something like it, this tends to be false (and maybe always is). Witness that when $R=k[x,y]$ and $I=(x)$, $k+I \cong k[x,xy,xy^2,xy^3,\ldots]$ is not even Noetherian. • But notice the silly example where $R=k[x,y]/(xy)$, $I=xR$. Here $I$ is not of finite colength and yet $A$ is finitely generated as a $k$-algebra. – Wilberd van der Kallen Jun 1 '15 at 14:16 Yes. Both $R$ and $A=k+I$ are filtered by powers of $I$ and we may look at the associated graded rings. Now $I/I^2$ is a finitely generated $R/I$ module and $R/I$ is a finitely generated vector space, by Zariski's lemma on finitely generated $k$ algebras that are fields. So $I/I^2$ is a finitely generated vector space and the associated graded of $A=k+I$ is a finitely generated $k$ algebra. But that is not enough. It only shows that the hypotheses are reasonable. Choose $v_1$, $\dots$, $v_m$ in $R$ so that their images together with $1$ form a basis of the vector space $R/I$. Then $R$ is generated as an $A$-module by $1$, $v_1,\dots,v_m$. So $A$ is a finitely generated $k$-algebra by the Artin-Tate lemma in wikipedia. One may argue more directly. Every $r\in R$ may be written as a $k$ linear combination of $1$, $v_1,\dots,v_m$ plus an element, say $f(r)$, in $I$. Now take a generating set $y_1,\dots,y_m$ of the $k$-algebra $R$ and choose $x_1$, $\dots$, $x_n$ in $I$ so that the $f(y_i)$ and the $f(v_iv_j)$ are amongst the $x_j$. We claim that every element of $R$ can be written as a $k$ linear combination of the generators $1$, $v_1$, $\dots$, $v_m$ plus a polynomial in the $x_j$, $v_ix_j$. Indeed it is easy to check that the set of elements that can be written this way is invariant under multiplication by the $v_i$ and the $x_j$, hence also by the $y_j$. If an element of $A$ is written as a $k$ linear combination of the generators $1$, $v_1$, $\dots$, $v_m$ plus a polynomial in the $x_j$, $v_ix_j$, then it must be a polynomial in the $x_j$, $v_ix_j$. So the $x_j$ together with the $v_ix_j$ generate the $k$ algebra $A=1+I$. • I'm confused. If you are claiming that whenever the associated graded ring of a ring $B$ is finitely generated over $k$, so is $B$ itself, this is wrong (e.g. $B=k[\![x]\!]$). – Neil Epstein May 28 '15 at 18:47 • Also, I don't understand the explicit construction you give afterwards. How do you know you can pick $v_i$s and $x_j$s that satisfy the conditions (under the clauses starting with "so that" in the second sentence of the second paragraph) which you specify? – Neil Epstein May 28 '15 at 19:09 • @Neil Epstein. It is not true that $R$ is module-generated over $A$ by any lifting of any $k$-basis of $R/I$. But if 1 is in the lifting then $R$ is indeed module generated by the lifting and the finite generation of $A$ follows from the wikipedia Artin-Tate lemma. – Wilberd van der Kallen May 31 '15 at 17:39 • That's exactly what I was looking for but was not aware of (i.e. the Artin-Tate lemma). Thank you! – Neil Epstein Jun 1 '15 at 18:41
2020-02-28 15:57:33
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9429519772529602, "perplexity": 80.25244948577682}, "config": {"markdown_headings": false, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2020-10/segments/1581875147234.52/warc/CC-MAIN-20200228135132-20200228165132-00187.warc.gz"}
https://www.physicsforums.com/threads/how-safe-is-the-lcdm-model.856193/
# How safe is the LCDM model 1. Feb 8, 2016 ### wolram I noticed this in the arxivs, i thought the LCDM model was irifutable but it seems some are trying to better it. arXiv:1602.02103 [pdf, ps, other] First evidence of running cosmic vacuum: challenging the concordance model Joan Sola, Adria Gomez-Valent, Javier de Cruz Perez Comments: LaTeX, 6 pages, 2 tables and 3 figures Subjects: Cosmology and Nongalactic Astrophysics (astro-ph.CO); General Relativity and Quantum Cosmology (gr-qc); High Energy Physics - Phenomenology (hep-ph); High Energy Physics - Theory (hep-th) Despite the fact that a rigid $\Lambda$-term is a fundamental building block of the concordance $\Lambda$CDM model, we show that a large class of cosmological scenarios with dynamical vacuum energy density $\rho_{\Lambda}$ and/or gravitational coupling $G$, together with a possible non-conservation of matter, are capable of seriously challenging the traditional phenomenological success of the $\Lambda$CDM. In this Letter, we discuss these "running vacuum models" (RVM's), in which $\rho_{\Lambda}=\rho_{\Lambda}(H)$ consists of a nonvanishing constant term and a series of powers of the Hubble rate. Such generic structure is potentially linked to the quantum field theoretical description of the expanding Universe. By performing an overall fit to the cosmological observables $SNIa+BAO+H(z)+LSS+BBN+CMB$ (in which the WMAP9, Planck 2013 and Planck 2015 data are taken into account), we find that the RVM's appear definitely more favored than the $\Lambda$CDM, namely at an unprecedented level of $\sim 4\sigma$, implying that the $\Lambda$CDM is excluded at $\sim 99.99\%$ c.l. Furthermore, the Akaike and Bayesian information criteria confirm that the dynamical RVM's are strongly preferred as compared to the conventional rigid $\Lambda$-picture of the cosmic evolution. 2. Feb 8, 2016 ### Orodruin Staff Emeritus Of course someone is trying to find a better model, this is what science is all about. If a model was irrefutable it would not be a good scientific model. 3. Feb 8, 2016 ### Chalnoth My bet is that this will turn out to be a result of some subtle systematic error. But it would be very exciting if it turned out to be accurate! 4. Feb 8, 2016 ### bcrowell Staff Emeritus From a quick scan of the paper, it appears to have no discussion of possible sources of systematic error. Unless there's some such discussion in there that I'm missing, I would not believe this result at all. We should all have learned our lesson from the bogus BICEP2 result. 5. Feb 8, 2016 ### Chalnoth It looks like they're aggregating data released through other experiments. My bet is that there's some subtle differences between the way the different data sets were calibrated (or some similar systematic effect) that leads to a spurious signal. It'll take a fair amount of work to see where the discrepancy lies, however. 6. Feb 8, 2016 ### ohwilleke LCDM has some pretty meaningful error bars itself, and is based upon some very subtle experimental observations some of which like the cosmic background radiation, have nonetheless been measured to pretty much maximal precision. Indeed, in some sense, we know for a fact that LCDM is not correct as a matter of physics, because it ignores some factors (e.g. radiation) which we know exist and have an impact, because the improvement added by including all known factors is overshadowed by the reduction of statistical power per degree of freedom involved in omitting those factors. Until such time as we have much greater precision measurements (which may be never) we may never be able to distinguish between some of the alternatives that make similar predictions at the cosmological scale observation level. Overall, it is much more fruitful to, for example, look at galactic and cluster level phenomena to better understand dark matter and dark energy and then to insert that insight back into discriminating between LCDM and its competitors, than to try to distinguish between theories that are experimentally indistinguishable given the amount of noise in the existing data. 7. Feb 9, 2016 ### Jorrie How do you mean "radiation is ignored"? It features strongly in the LCDM equations at times earlier than the CMB release. The Planck results give a radiation/matter equality redshift of z~3400, which is not that long before the CMB origin. It is so that in later time observations its effects are negligible, but it is not ignored. 8. Feb 9, 2016 ### Chalnoth The CMB has only been measured at close to maximal precision for temperature anisotropies. There's still quite a long way to go with regard to polarization. Radiation is usually ignored for late-time expansion because its magnitude is so small. The actual energy density of the radiation isn't a free parameter at all, but is extremely accurately-measured through CMB observations (It's of the order of 0.001% of the current energy density). Taking the radiation energy density into account is important for modeling the CMB, but doesn't have much impact for anything after that. The tricky thing there is that galaxy and cluster physics are much, much more complicated, so that it becomes difficult to control for systematic errors for these systems. Not impossible, just tricky.
2017-10-23 16:36:03
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.7272412180900574, "perplexity": 989.0354970836573}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2017-43/segments/1508187826114.69/warc/CC-MAIN-20171023145244-20171023165244-00719.warc.gz"}
https://www.usanewscourt.com/a-complex-electronic-device-contains-three-components-a-b-and-c/
# A complex electronic device contains three components, A, B, and C A complex electronic device contains three components, A, B, and C. The probabilities of failure for each component in any one year are 0.01, 0.03, and 0.04, respectively. If any one component fails, the device will fail. If the components fail independently of one another, what is the probability that the device will not fail in one year? 0.9219 or 92.19% ## Explanation The probability that the device will not fail in one year is given by the joint probability that nine of the three components will fail within the year. The individual probabilities of not failing are: P(A)=1-0.01=0.99 P(B)=1-0.03=0.97 P(C)=1-0.04=0.96 The joint probability is: P(A π B π C)=0.99*0.97*9.96 P(A π B π C)=0.9219=92.19% There is 0.9219 or 92.19% probability that the device will not fail in one year.
2023-04-01 03:54:22
{"extraction_info": {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.8017634153366089, "perplexity": 501.68709564509595}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 20, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2023-14/segments/1679296949701.0/warc/CC-MAIN-20230401032604-20230401062604-00226.warc.gz"}
https://math.stackexchange.com/questions/3880508/complex-trig-function-example-if-cos-z-5-why-does-e2iz-10eiz1-0
# Complex trig function example. If $\cos z=5$, why does $e^{2iz}-10e^{iz}+1=0$? The example in my book says this: equation 1 is: $$\cos{z} = \frac{1}{2} ( e^{iz} + e^{-iz} )$$ Where is $$e^{2iz} - 10e^{iz} + 1 = 0$$ coming from? Can someone show me how they are doing this solution? • Can you multiply with $e^{iz}$? – Fakemistake Oct 25 at 13:08 • Is this some homework? – DavidW Oct 26 at 0:06 • Yes it is david – Jwan622 Oct 27 at 3:57 You have: $$\cos z = \dfrac{1}{2} \left( e^{iz} + e^{-iz} \right) \tag{1}$$ Multiplying both sides by $$e^{iz}$$ as said (and replacing $$\cos z$$ with $$5$$): $$5 e^{iz} = \dfrac{e^{iz}}{2} \left( e^{iz} + e^{-iz} \right) \\ \implies 10 e^{iz} = e^{2iz} + 1$$ $$\frac12(e^{iz}+\frac1{e^{iz}})=5\implies e^{2iz}-10e^{iz}+1=0.$$ • Why the downvote tho – Shubham Johri Oct 28 at 11:38 From $$\cos z = 5$$, we have $$2 \cos z = 10$$, so that $$e^{2iz} + 1 = 10e^{iz}$$, or $$e^{2iz} - 10e^{iz} +1 = 0$$.
2020-11-25 16:10:10
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 12, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.919784665107727, "perplexity": 1121.9172072506599}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 5, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2020-50/segments/1606141183514.25/warc/CC-MAIN-20201125154647-20201125184647-00034.warc.gz"}
https://www.r-bloggers.com/2020/06/the-strange-occurrence-of-the-one-bump/
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't. When answering an X validated question on running an accept-reject algorithm for the Gamma distribution by using a mixture of Beta and drifted (bt 1) Exponential distributions, I came across the above glitch in the fit of my 10⁷ simulated sample to the target, apparently displaying a wrong proportion of simulations above (or below) one. a=.9 g<-function(T){ x=rexp(T) v=rt(T,1)<0 x=c(1+x[v],exp(-x/a)[!v]) x[runif(T)<x^a/x/exp(x)/((x>1)*exp(1-x)+a*(x<1)*x^a/x)*a]} It took me a while to spot the issue, namely that the output of z=g(T) while(sum(!!z)<T)z=c(z,g(T)) z[1:T] was favouring simulations from the drifted exponential by truncating. Permuting the elements of z before returning solved the issue (as shown below for a=½)!
2021-09-22 06:01:28
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.6917266845703125, "perplexity": 1452.0534009261112}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-39/segments/1631780057329.74/warc/CC-MAIN-20210922041825-20210922071825-00656.warc.gz"}
http://specialspuds.co.uk/forum/0p59z.php?f62cf0=ph-value-of-acetic-acid
Calculate the ph of a 2.80 M acetic acid solution. I have to find the approximate pH of 0.1 M solution of ethanoic/acetic acid. Acetic acid ionizes partially, so you need the pka or ka value of acetic acid (in data book), this should be given in the question. The acetic acid is produced by the fermentation of ethanol by acetic acid bacteria. Dr Munir Ahmad Acetic Acid 4 Unusual Fire Hazards: vapors travel along floor to distant ignition. If your book doesn't list the pKa of acetic acid, the accepted value is 4.75. b values from pH measurements is well-known, ... 10-5 (Table 2), and based on pH and solutions consisting of acetic acid and sodium acetate Table 1. For dilute aqueous solutions at 25C: 2 An acid has a pH less than 7 A 0.1 M HCl solution has 0.1 M H3O+ and a pH = 1, whereas a 0.1 M acetic acid solution (CH3COOH) has 0.001 M H3O+ (since it is only 1% dissociated) and a pH = 3. It is given that 10 mL of 1 M acetic acid is diluted to 100 mL in water. ... ACIDS, BASES AND pH. closed containers may explode. For acetic acid, we'll consider the $$x$$ values as it is not dissociated 100% in water. There are millions of chemical substances in the world. For the general acid reaction with water: I tried calculating -LOG[0.1] = 1, which is one of the answers, but I am not sure if that's correct, since acetic acid does not completely ionize. The more diluted the solution is, the more solution pH is dominated not by the presence of acetic acid and its conjugate base, but by the water autodissociation. I also know that pH = -LOG[H+]. Article on the realisation of experiments on acids and bases. For pH calculations, [H+] is expressed in moles per liter. Acetic acid - Download as Word Doc (.doc / .docx), PDF File (.pdf), Text File (.txt) or read online. The Ka value for acetic acid, CH3COOH(aq), is 1.8 105 M. Calculate the pH of a 2.00 M acetic acid solution. Acetic acid is an organic solvent that is used for a variety of industrial, analytical and medical purposes. The pH value at the point of half equivalence also gives you the pK a value of acetic acid. At pH above 4.76 acetate ion is formed, which cannot be permeate through the liquid membrane. I know that acetic acid is a weak acid and has the formula CH3COOH. Thus, the initial acetic acid concentration is. Solutions for the problems about Calculation of pH in the case of monoprotic acids and bases 1. Dr Munir Ahmad Acetic Acid 2 Amines Phosphorus Trichloride Protective Equipment Eyes Safety Goggles or Face Shield should be worn when handling. The greater the value of the pH of the solution, the more basic (or alkaline) the solution is. Acetic acid - Identification, toxicity, use, water pollution potential, ecological toxicity and regulatory information Thus, only in the rare circumstance when the molar concentrations of the conjugate acid and conjugate base in a solution are equal, the pH = pK a. 79 No. Answer to The Ka value for acetic acid, CH3COOH(aq), is 1.8x10^-5. Once the acetic acid is diluted in water, the dissociation reaction begins and continues until it reaches equilibrium. Acetic acid, also known as ethanoic acid, is an organic chemical compound best recognized for giving vinegar its sour taste and pungent smell. The Keq of an acid is a measure of the strength of an acid. Reacts with most metals to form hydrogen gas. Get an example of an acid/base problem to calculate the pH of a weak acid solution ... the value for x ... Quick and Dirty Method to Find Weak Acid pH. the feed phase is lower than the pKa value of acetic acid which is 4.76 (at 25 degC). (0.01 liter)(1 mol/liter) / (0.100 liter total volume) = 0.1 M acetic acid. $$pH=-\log(\frac{10^{-14}}{0,01})=12$$. Calculate the pH of the resulting solution when 2.00 mL of the 2.00 M acetic acid is diluted to make a 250.0 mL solution. What is the pH of a 0.1 M acetic acid solution? pH calculation lectures - calculation of the pH of a weak acid/base solution. Best Answer: VERY GOOD DEDUCTION. I have to find the approximate pH of 0.1 M solution of ethanoic/acetic acid. Chemical Education Today JChemEd.chem.wisc.edu Vol. As pH is the negative logarithm of $$[H^+]$$ or $$\frac{10^{-14}}{[OH^-]}$$, we'll use whichever is suitable. Hydrochloric Acid Calculate pH Values of Hydrochloric ... theoretical pH value? Vinegar is a liquid consisting of about 520% acetic acid (CH 3 COOH), water, and other trace chemicals, which may include flavorings. I know that acetic acid is a weak acid and has the formula CH3COOH.
2018-10-21 10:48:09
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.5220788717269897, "perplexity": 4212.087064490295}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2018-43/segments/1539583513844.48/warc/CC-MAIN-20181021094247-20181021115747-00379.warc.gz"}
https://www.tutorialspoint.com/how-to-avoid-the-points-getting-overlapped-while-using-stripplot-in-categorical-scatter-plot-seaborn-library-in-python
# How to avoid the points getting overlapped while using stripplot in categorical scatter plot Seaborn Library in Python? PythonServer Side ProgrammingProgramming #### Beyond Basic Programming - Intermediate Python Most Popular 36 Lectures 3 hours #### Practical Machine Learning using Python Best Seller 91 Lectures 23.5 hours #### Practical Data Science using Python 22 Lectures 6 hours Visualizing data is an important step since it helps understand what is going on in the data without actually looking at the numbers and performing complicated computations. Seaborn is a library that helps in visualizing data. It comes with customized themes and a high level interface. General scatter plots, histograms, etc can’t be used when the variables that need to be worked with are categorical in nature. This is when categorical scatterplots need to be used. Plots such as ‘stripplot’, ‘swarmplot’ are used to work with categorical variables. The ‘stripplot’ function is used when atleast one of the variables is categorical. The data is represented in a sorted manner along one of the axes. But the disadvantage is that certain points get overlapped. This where the ‘jitter’ parameter has to be used to avoid the overlapping between variables. It adds some random noise to the dataset, and adjusts the positions of the values along the categorical axis. Syntax of stripplot function seaborn.stripplot(x, y,data, jitter = …) Let us see how ‘jitter’ parameter can be used to plot categorical variables in a dataset − ## Example import pandas as pd import seaborn as sb from matplotlib import pyplot as plt sb.stripplot(x = "species", y = "petal_length", data = my_df, jitter = True) plt.show() ## Explanation • The required packages are imported. • The input data is ‘iris_data’ which is loaded from the scikit learn library. • This data is stored in a dataframe.
2022-12-06 05:40:12
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.2896166741847992, "perplexity": 2502.7275698588855}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2022-49/segments/1669446711069.79/warc/CC-MAIN-20221206024911-20221206054911-00299.warc.gz"}
http://crypto.stackexchange.com/questions?page=89&sort=votes
# All Questions 21 views ### Signature verification with only hash (without full data) I am looking for a way to sign a file, such that someone else can verify that I had this file, even if they only know a hash. I want to prove that I have the full file to someone who only has the ... 35 views ### The purpose of the final xor in Davies–Meyer scheme [duplicate] In Davies–Meyer hash construction scheme each block is xor'ed with the previous block cipher text. Why? The only obvious flaw I see in a scheme without this xor is the possibility to reconstruct a ... 64 views ### Attacker in a key exchange I'm having trouble with the following question: $X(A) \rightarrow B:(A,N_X)$ $B \rightarrow X(S):(B,((A,N_X,T_B),K_{BS}),N_B)$ $X(A) \rightarrow B:(((A,N_X,T_B),K_{BS}),(N_B,N_X))$ ... 22 views ### How does SafeNet MobilePASS generate passwords? (TOTP Variant) This question is similar to How does SafeNet MobilePASS generate passwords? The question and answer there is related to the HMAC Variant of SafeNet Mobilepass. I'm looking for details on the TOTP ... 61 views ### Polynomial division hardware implementation I am beginning the implementation of the polynomial binary division algorithm now as I understood i will be checking the MSB bit if 1 to XOR and shift the sum if 0 i will only shift. What I am not ... 76 views ### Is it safe to AES-CBC and AES-CMAC both using the same key? There is a very similar question (Using a derived key for CMAC) but it doesn't quite answer this one (at least for me it does not). I have a situation where I need to transfer some data. My data has ... 55 views ### How does Schnorr signature actually work? I'm trying to get a grip on how Schnorr signature works. Suppose Alice sends Trent a tuple $(P, M)$, which contains a payload and a message to be signed by him. She then passes the certificate to Bob ... 65 views ### Crack RSA with imaginary algorithm [duplicate] I was given a cryptography question during an interview the other day and I couldn't come up with a valid answer. Imagine you are given an efficient algorithm which for a given RSA public key (n,e) is ... 49 views ### RSA or Paillier is good? [closed] I want to implement file storage in cloud using homomorphic encryption. I want to use paillier encryption. Can you suggest the drawback of RSA to store and retrieving the files. Then only i can use ... 66 views ### Fermats Little Theorem, primitive root [closed] So I am studying for finals and I am not able to solve the problem: Let $p = 3 * 2^{11484018}- 1$ be a prime with 3457035 digits. Find a positive integer $x$ so that $2^x\equiv 3\pmod p$ Any ... 77 views ### CBC-R when IV unknown I've read the CBC-R description from Rizzo & Duong but am having trouble understanding the sequence of steps that would be taken when the IV is unknown and is not included with the ciphertext. ... 86 views ### Timelock puzzle improvment I came across this question with this answer about a cryptographic timelock-puzzle that needs approximately 30 years to be solved. There is also an explanation with source code for that puzzle ... 48 views ### Asymmetric encryptions' computational complexity [duplicate] I need to know the computational complexity of the public key encryption (e.g. Paillier), please. (i.e.Paillier in his paper mentions that the computational complexity of most of public key ... 23 views ### Modulo Square Roots [duplicate] Here's my issue and someone can help me understand it so I can program it correctly. I have a point(X,Y) on an Elliptical Curve E(a,b) where a=-3 and B is a large number that is in hexidecimal from ... 67 views ### point decompression on a elliptical curve I'm programming an elliptical curve cryptography system and I'm having difficulty with decompressing points. The following information is from my project specification as to my understanding: Given a ... 44 views 55 views ### Does the transposition cipher have a network application? So I'm reading a chapter in my networking book and it talks about substitution and transposition ciphers (Transposition Cipher Wikipedia). I know that most network security uses public key or ... 78 views ### Is there any existing cipher capable of scaling from a 1 bit key up to a one-time-pad? We have ciphers that handle small amounts of entropy, such as a 256 bit key for AES; and we have one time pads for enciphering 1:1 entropy, such as a 1GB key for a 1GB file if you could ever harvest ... 53 views ### Does NSS fully implement PKCS 11? I am looking towards using NSS in a Linux application that makes use of a TPM (HSM). So, I am checking the support of PKCS 11 in NSS, at least for the management of Elliptic Curve keys, signature with ...
2014-12-20 05:22:22
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.8405285477638245, "perplexity": 1584.6349895671792}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2014-52/segments/1418802769392.53/warc/CC-MAIN-20141217075249-00144-ip-10-231-17-201.ec2.internal.warc.gz"}
https://math.stackexchange.com/questions/3297015/proof-verification-study-continuity-of-f-circ-g-and-g-circ-f-if-fx-1
# Proof verification. Study continuity of $f\circ g$ and $g\circ f$ if $f(x) = 1-|x-1|$ and $g(x) = x$ for $x\in\Bbb Q$, $g(x)=2-x$ for $x\in\Bbb I$ Given two functions: \begin{align} f(x) &= 1 - |x-1|\\ g(x) &= \begin{cases} x,\ \text {if x\in \Bbb Q}\\ 2-x,\ \text {if x\in \Bbb R\setminus\Bbb Q} \end{cases} \end{align} Study continuity of the following compositions: \begin{align*} (f\circ g)(x)\tag 1\\ (g\circ f)(x)\tag 2 \end{align*} $$\Box$$ I've started with case $$(1)$$. Both $$f(x)$$ and $$g(x)$$ are well defined in $$\Bbb R$$. So we might consider their composition: $$(f\circ g)(x) = \begin{cases} 1-|x-1|,\ \text{if x\in\Bbb Q}\\ 1-|2-x-1|,\ \text{if x\in\Bbb R\setminus\Bbb Q} \end{cases}$$ Or simply: $$(f\circ g)(x) = 1-|x-1|,\ \forall x\in \Bbb R$$ By composition of continuous functions $$1-|x-1|$$ is continuous. Conclusion: $$(f\circ g)(x)$$ is continuous in $$\Bbb R$$ $$\blacksquare$$. $$\Box$$ Consider case $$(2)$$. Again both function are well defined in $$\Bbb R$$, so we migh consider their composition: $$(g\circ f)(x) = \begin{cases} 1-|x-1|,\ \text{if x\in\Bbb Q}\\ 2 - (1-|x-1|),\ \text{if x\in\Bbb R\setminus\Bbb Q} \end{cases}$$ Or simplifying: $$(g\circ f)(x) = \begin{cases} 1 - |x-1|,\ \text{if x\in\Bbb Q}\\ 1 + |x-1|),\ \text{if x\in\Bbb R\setminus\Bbb Q} \end{cases}$$ 1) It feels natural to consider a point $$x_0 = 1$$ since it will render the absolute value to $$0$$, by which: $$(g\circ f)(x_0) = 1$$ Take any sequence $$(x_n)_{n\in\Bbb N}$$ of rational or irrational numbers such that: $$\lim_{n\to\infty}x_n = 1$$ For a sequence of rationals: $$\lim_{n\to\infty}(g\circ f)(x_n) = \lim_{n\to\infty}(1-|x_n - 1|) = 1 = (g\circ f)(1)$$ The same is true for any sequence of irrational numbers. 2) Now consider some point $$x_0 \ne 1$$. Suppose $$x_0$$ is irrational. Take any sequence $$(x_n)_{n\in\Bbb N}$$ such that $$\forall n\in\Bbb N: x_n \in \Bbb Q$$ and: $$\lim_{n\to\infty}x_n = x_0$$ For any sequence $$(x_n)_{n\in\Bbb N}$$ and $$\forall n\in\Bbb N: x_n \in\Bbb Q$$: \begin{align} \lim_{n\to\infty}(g\circ f)(x_n) &= \lim_{n\to\infty}(1 - |x_n - 1|) \\ &= 1 - |x_0 - 1| < 1 \end{align} But since $$x_0$$ is irrational: $$(g\circ f)(x_0) = 1 + |x_0 - 1| > 1$$ Which means: $$\lim_{n\to\infty} (g\circ f)(x_n) \ne (g\circ f)(x_0)$$ 3) Suppose $$x_0$$ is rational and $$x_0 \ne 1$$, take any sequence $$(x_n)_{n\in\Bbb N}$$ and $$\forall n\in \Bbb N: x_n \in\Bbb R\setminus \Bbb Q$$: $$\lim_{n\to\infty}x_n = x_0$$ Since $$x_0$$ is rational we have: $$(g\circ f)(x_0) = 1 - |x_0 - 1| < 1$$ But: \begin{align} \lim_{n\to\infty}(g\circ f)(x_n) &= \lim_{n\to\infty}(1 + |x_n - 1|) \\ &= 1 + |x_0 - 1| > 1 \end{align} So: $$\lim_{n\to\infty}(g\circ f)(x_n) \ne (g\circ f)(x_0)$$ And that completes the proof. Conclusion: $$(g\circ f)(x)$$ in continuous at $$x = 1$$ and $$(g\circ f)(x)$$ is discontinuous $$\forall x \in \Bbb R\setminus \{1\}$$ $$\blacksquare$$. I'm still a bit lost while studying such bizarre functions and not fully sure in the correctness of my reasoning behind the proof. I would like to ask for verification of the above. Thank you! • For case 2 and 3, your reasoning seems to be a little bit wrong. If $x_n>y_n$ then we only have that $\lim x_n \geqslant \lim y_n$. – Botond Jul 18 '19 at 17:17 • @Roman: To fix case $(2)$, use the setup of case $(3)$. You want the sequence $(x_n)$ to approach $x_0$. Also, for both case $(2)$ and case $(3)$, you want $x_0\ne 1$, but you only specified that for case $(2)$. Other than that, your proof looks good (+1). – quasi Jul 18 '19 at 17:27 • @roman:$\;$Also, for a more complete conclusion, I suggest:$\;(g\circ f)(x)$ is continuous at $x=1$ and discontinuous at $x=x_0$ for all $x_0\in\Bbb R{\,\setminus\,}\{1\}$. – quasi Jul 18 '19 at 17:48 • "Or simply: $$(f\circ g)(x) = \begin{cases} 1-|x-1|,\ \text{if x\in\Bbb Q}\\ 1-|1-x|,\ \text{if x\in\Bbb R\setminus\Bbb Q} \end{cases}$$" Even *more* simply $f\circ g(x) = 1-|1-x|$ (whether $x$ is rational or not.) – fleablood Jul 18 '19 at 18:19 • "So it follows that for every real number no matter whether it's rational or irrational the value of the function is the same." Well....no. $f(5) \ne f(6)$ and $f(5)\ne f(\sqrt 3)$ and $f(\sqrt 3) \ne f(\pi)$. so the value of the function is very different. You meant say the expression of the function is $f\circ g(x) = 1-|x-1|=1-|1-x|$ is the same for irrationals and rationals and doesnt need a conditional to express it. – fleablood Jul 18 '19 at 18:28 A quicker simpler way to note that $$h(x) = g(x)$$ (where $$g$$ is continuous everywher) if $$x$$ is rational but $$h(x) = f(x)$$(where $$f$$ is continuous everywhere) if $$x$$ is irrational, is continuous at $$x = a$$ if and only if $$f(a) = g(a)$$ is to consider the following. As $$f,g$$ are continuous for any $$\epsilon > 0$$ there are $$\delta_1$$ and $$\delta_2$$ so that $$|x-a|< \delta_1$$ then $$|f(x) -f(a)| < \epsilon$$ and if $$|x-a|< \delta_2$$ then $$|g(x) -g(a)|< \epsilon$$. If $$f(a) = g(a)$$ then then if $$|x - a| < \min(\delta_1, \delta_2)$$ then if $$x$$ is rational then $$|h(x) - h(a)| = |f(x) -f(a)| < \epsilon$$. If $$x$$ is irrational then $$|h(x) -h(a)| =|g(x) - g(a)| < \epsilon$$ and either way $$|h(x) - h(a)| < \epsilon$$. So $$h$$ is continuous at $$a$$. But if $$f(a)\ne g(a)$$ then $$|f(a)-g(a)| = c > 0$$. Lets assume $$h$$ is continuous at $$a$$. That would mean for the same $$\epsilon, \delta_1, \delta_2$$ above we would have a $$\delta_3$$ so that $$|x-a|<\delta_3 \implies |h(x) - h(a)| < \epsilon$$ Now for any interval, there exist a rational $$x$$ and an irrational $$y$$ so that $$|x-a|<\min(\delta_1, \delta_2,\delta_3)$$ and $$|y-a| < \min(\delta_1, \delta_2,\delta_3)$$. But $$c = |f(a) -g(a)| =$$ $$|[f(a)-f(x)] + [f(x) - g(y)] +[g(y)-g(a)]| =$$ $$|[f(a)-f(x)] + [h(x) - h(y)] +[g(y)-g(a)]| \le$$ $$|f(a)-f(x)| + |h(x)-h(y)| + |g(y) - g(a)| <$$ $$\epsilon + |[h(x) -h(a)]+[h(a)-h(y)] + \epsilon \le$$ $$2\epsilon + |h(x)-h(a)| + |h(y)-h(a)|<$$ $$2\epsilon + \epsilon+\epsilon = 4\epsilon$$. So $$\epsilon > \frac c4 > 0$$. Which contradicts that $$\epsilon$$ can be arbitrarily small. So $$h$$ is not continuous at $$a$$ if $$f(a)\ne g(a)$$. ...... You correctly figured that $$f\circ g(x) = 1-|x-1|$$ which is continuous by, as you say, composition of continuous functions. And you correctly figured that $$(g\circ f)(x) = \begin{cases} 1 - |x-1|,\ \text{if x\in\Bbb Q}\\ 1 + |x-1|),\ \text{if x\in\Bbb R\setminus\Bbb Q} \end{cases}$$ So this is continuous at points $$a$$ where $$1-|x-1| = 1 + |x-1|$$ and discontinuous everywhere else. Now $$1-|x-1| = 1 + |x-1|\iff -|x-1|=|x-1|\iff x-1 = 0 \iff x = 1$$. So $$g\circ f$$ is continuous at $$1$$ and discontinuous everywhere else. • That's an interesting approach. Thank you! – roman Jul 19 '19 at 13:41
2021-07-25 10:34:31
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 104, "wp-katex-eq": 0, "align": 3, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9984546303749084, "perplexity": 264.1120274073048}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 20, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-31/segments/1627046151641.83/warc/CC-MAIN-20210725080735-20210725110735-00117.warc.gz"}
http://bme.ee.cuhk.edu.hk/thzgroup/person.php?id=emma
Prof. Emma MACPHERSON (NEE PICKWELL) Nationality British Education History University of Cambridge (United Kingdom) Physics Ph. D. University of Cambridge (United Kingdom) Natural Sciences (Physical) M. Sci., M. A. (Cantab.) Work History Associate Professor (2015-present) The Chinese University of Hong Kong, Hong Kong Department of Electronic Engineering Assistant Professor (2012-2015) The Chinese University of Hong Kong, Hong Kong Department of Electronic Engineering Visiting Assistant Professor (2009-2012) The Hong Kong University of Science and Technology, Hong Kong Electronic and Computer Engineering Department Assistant Professor (2006-2009) The Chinese University of Hong Kong, Hong Kong Department of Electronic Engineering Medical Scientist (2005-2006) Teraview, United Kingdom Research Scientist (2002) Teraview, United Kingdom Research Scientist (2001-2002) BT Labs, United Kingdom Optics Group Research Interests Terahertz biomedical imaging and spectroscopy, terahertz metrology, novel terahertz devices. More details here. Biography Emma MacPherson (nee Pickwell) studied Natural Sciences at Cambridge University followed by an MSci in Physics where she specialised in Semiconductor Physics. After Cambridge, she worked on optical packet switching at BT labs, Martlesham, UK. In February 2002 she started working as a research assistant at TeraView Ltd, a company specialising in terahertz imaging which had spun out of Toshiba in 2001. She started her PhD with the Semiconductor Physics Group at Cambridge University and TeraView Ltd in October 2002. Her PhD thesis was entitled, "Biological applications of terahertz pulsed imaging and spectroscopy" - her PhD work focused on understanding contrast mechanisms in terahertz images of skin cancer. Having completed her thesis in 2005, she worked for TeraView Ltd as a Medical Scientist until moving to Hong Kong in 2006. Emma MacPherson set up a terahertz laboratory at the Department of Electronic Enginering, CUHK during her post between 2006 and 2009 as an assistant professor. She spent 3 years at HKUST as a visiting assistant professor (September 2009 -2012). She returned to the Department of Electronic Enginering, CUHK in September 2012. Prof MacPherson represents Hong Kong on the International Organising Commitee for the Infrared and Milimeter Wave and Terahertz Wave conference series. Publication List Below are listed the publications of Prof. MacPherson, including those published prior to joining the group (if any). Click on the years to show/hide the paper titles and select the paper titles for more information on each paper, including links to the publication websites. 1. Design and fabrication of 3-D printed conductive polymer structures for THz polarization control A. I. Hernandez-Serrano, Qiushuo Sun, Elizabeth G. Bishop, Elliott R. Griffiths, Christopher P. Purssell, Simon J. Leigh, J. Lloyd-Hughes, Emma Pickwell-MacPherson Optics Express 27(8): 11635 (2019) DOI: 10.1364/OE.27.011635 Link to article Abstract In this paper, we numerically and experimentally demonstrate the inverse polarization effect in three-dimensional (3-D) printed polarizers for the frequency range of 0.5 - 2.7 THz. The polarizers simply consist of 3-D printed strip lines of conductive polylactic acid (CPLA, Proto-Pasta) and do not require a substrate or any further metallic deposition. The experimental and numerical results show that the proposed structure acts as a broadband polarizer between the range of 0.3 THz to 2.7 THz, in which the inverse polarization effect is clearly seen for frequencies above 0.5 THz. In the inverse polarization effect, the transmission of the transverse electric (TE) component exceeds that of the TM component, in contrast to the behavior of a typical wire-grid polarizer. We show how the performance of the polarizers depends on the spacing and thickness of the CPLA structure; extinction ratios higher than 20 dB are achieved. This is the first report using CPLA to fabricate THz polarizers, demonstrating the potential of using conductive polymers to design THz components efficiently and robustly. Show Abstract 2. In vivo terahertz imaging to evaluate scar treatment strategies: silicone gel sheeting Jiarui Wang, Qiushuo Sun, Rayko I. Stantchev, Tor-Wo Chiu, Anil T. Ahuja, Emma Pickwell-MacPherson Biomedical Optics Express 10(7): 3584-3590 (2019) DOI: 10.1364/BOE.10.003584 Link to article Abstract Silicone gel sheeting (SGS) is widely used for scar treatment; however, studies showing its interaction with skin and efficacy of scar treatment are still lacking. THz light is non-ionizing and highly sensitive to changes in water content and thus skin hydration. In this work, we use in-vivo THz imaging to monitor how SGS affects the THz response of human skin during occlusion, and the associated THz reflectivity and refractive index changes are presented. We find that SGS effectively hydrates the skin beneath it, with minimal lateral effects beyond the sheeting. Our work demonstrates that THz imaging is able to detect the subtle hydration changes on the surface of human skin caused by SGS, and it has the potential to be used to evaluate different scar treatment strategies. Show Abstract 3. Utilizing multilayer structures to enhance terahertz characterization of thin films ranging from aqueous solutions to histology slides Qiushuo Sun, Kai Liu, Xuequan Chen, Xudong Liu, A. I. Hernandez-Serrano, Emma Pickwell-MacPherson Optics Letters 44(9): 2149 (2019) DOI: 10.1364/OL.44.002149 Link to article Abstract We propose a multilayer geometry to characterize thin-film samples in reflection terahertz time domain spectroscopy. Theory indicates that this geometry has higher sensitivity compared to ordinary transmission or reflection geometries when characterizing both low- and high-absorption samples. Pure water and water{\&}{\#}x2013;ethanol mixtures are measured to verify the characterization accuracy of the proposed geometry and its capability to measure trace liquids. Paraffin-embedded oral cancer tissue is imaged to further show how the proposed geometry enhances the sensitivity for solid low-absorptive films. Show Abstract 4. Terahertz Microfluidic Metamaterial Biosensor for Sensitive Detection of Small-Volume Liquid Samples Rui Zhang, Qingming Chen, Kai Liu, Zefeng Chen, Kaidi Li, Xuming Zhang, Jianbin Xu, Emma Pickwell-MacPherson IEEE Transactions on Terahertz Science and Technology 9(2): 209-214 (2019) DOI: 10.1109/TTHZ.2019.2898390 Link to article Abstract Metamaterial (MM) assisted terahertz (THz) label-free biosensing has promising applications. However, the sensitive THz detection of highly absorptive liquid samples remains challenging. Here, we present a novel multi-microfluidic-channel MM biosensor for highly sensitive THz sensing of small-volume liquid samples. The multichannels are set mostly in the strong electric field enhancement area of the MM, which significantly decreases the liquid's amount and enhances the interaction between the sensing targets and the THz wave (thus increasing the sensitivity). The sensing results of isopropyl-alcohol-water mixtures and bovine serum albumin solutions based on the bow-tie array MM with multichannels demonstrate the effectiveness of the proposed design and the great potential in THz biosensing. This design has the advantages of being highly sensitive, label-free, cost-effective, easy to operate, and only needing a tiny liquid volume. Thus, our device provides a robust route for MM-assisted THz label-free biosensing of liquid-based substances. Show Abstract 5. A Sensitive and Versatile Thickness Determination Method Based on Non-Inflection Terahertz Property Fitting Xuequan Chen, Emma Pickwell-MacPherson Sensors 19: 4118 (2019) DOI: 10.3390/s19194118 Link to article Abstract The accuracy of thin-film characterization in terahertz spectroscopy is mainly set by the thickness uncertainty. Physical thickness measurement has limited accuracy for thin-film samples thinner than a few hundreds of micrometers and is sometimes even impossible. The temporal resolution of time-domain terahertz spectrometers is not sufficient to resolve such thin films. Previously reported numerical methods mainly only work for materials with low dispersion and absorption. Here, we propose a novel method for thickness determination by fitting a non-inflection offset exponential function to the material optical properties. Theoretical analysis predicts the best fitting to only be achieved when the correct thickness is given. Transmission measurements on a thin-film polymer, water, and a lactose pallet verify the theory and show the accurate thickness determination and property characterization on materials which are either achromatic or dispersive, transparent or absorptive, featureless or resonant. The measurements demonstrate the best versatility and sensitivity compared to the state-of-art. The method could be widely adapted to various types of research and industrial applications. Show Abstract 1. In vivo THz imaging of human skin: Accounting for occlusion effects Qiushuo Sun, Edward P.J. Parrott, Yuezhi He, Emma Pickwell-MacPherson Journal of Biophotonics 11(2): e201700111 (2018) DOI: 10.1002/jbio.201700111 Link to article Abstract In vivo terahertz (THz) imaging of human skin needs to be done in reflection geometry due to the high attenuation of THz light by water in the skin. To aid the measurement procedure, there is typically an imaging window onto which the patient places the area of interest. The window enables better pulse alignment and helps keep the patient correctly positioned during the measurement. In this paper, we demonstrate how the occlusion caused by the skin contact with the imaging window during the measurement affects the THz response. By studying both rapid point measurements and imaging over an area of a human volar forearm, we find that even 5 seconds of occlusion affects the THz response. As the occlusion time increases, the skin surface water content increases, resulting in the reduction of the amplitude of the reflected THz pulse, especially in the first 3 minutes. Furthermore, it was found that the refractive index of the volar forearm increased by 10% to 15% after 20 minutes of occlusion. In this work, we examine and propose a model for the occlusion effects due to the quartz window with a view to compensating for its influence. Show Abstract 2. In vivo estimation of water diffusivity in occluded human skin using terahertz reflection spectroscopy Qiushuo Sun, Rayko I. Stantchev, Jiarui Wang, Edward P.J. Parrott, Alan Cottenden, Tor-Wo Chiu, Anil T. Ahuja, Emma Pickwell-MacPherson Journal of Biophotonics : e201800145 (2018) DOI: 10.1002/jbio.201800145 Link to article Abstract Water diffusion and the concentration profile within the skin significantly affect the surrounding chemical absorption and molecular synthesis. Occluding the skin causes water to accumulate in the top layer of the skin (the stratum corneum) and also affects the water diffusivity. Scar treatments such as silicone gel and silicone sheets make use of occlusion to increase skin hydration. However with existing techniques, it is not possible to quantitatively measure the diffusivity of the water during occlusion: current methods determine water diffusivity by measuring the water evaporated through the skin and thus require the skin to breathe. In this work we use the high sensitivity of terahertz light to water to study how the water content in the stratum corneum changes upon occlusion. From our measurements, we can solve the diffusion equations in the stratum corneum to deduce the water concentration profile in occluded skin and subsequently to determine the diffusivity. To our knowledge this is the first work showing how the diffusivity of human skin can be measured during occlusion and we envisage this paper as being used as a guide for non-invasively determining the diffusivity of occluded human skin in vivo. This article is protected by copyright. All rights reserved. Show Abstract 3. Highly Sensitive Terahertz Thin-Film Total Internal Reflection Spectroscopy Reveals in Situ Photoinduced Structural Changes in Methylammonium Lead Halide Perovskites Qiushuo Sun, Xudong Liu, Jie Cao, Rayko I. Stantchev, Yang Zhou, Xuequan Chen, Edward P. J. Parrott, James Lloyd-Hughes, Ni Zhao, Emma Pickwell-MacPherson The Journal of Physical Chemistry C : acs.jpcc.8b05695 (2018) DOI: 10.1021/acs.jpcc.8b05695 Link to article Abstract Terahertz (THz) thin-film total internal reflection (TF-TIR) spectroscopy is shown to have an enhanced sensitivity to the vibrational properties of thin films in comparison with standard THz transmission spectroscopy. This increased sensitivity was used to track photoinduced modifications to the structure of thin films of methylammonium (MA) lead halide, MAPbI3–xBrx (x = 0, 0.5, 1, and 3). Initially, illumination strengthened the phonon modes around 2 THz, associated with Pb–I stretch modes coupled to the MA ions, whereas the 1 THz twist modes of the inorganic octahedra did not alter in strength. Under longer term illumination, the 1 THz phonon modes of encapsulated films slowly reduced in strength, whereas in films exposed to moisture and oxygen, these phonons weaken more rapidly and blue-shift in frequency. The rapid monitoring of environmentally induced changes to the vibrational modes afforded by TF-TIR spectroscopy offers applications in the characterization and quality control of the perovskite thin... Show Abstract 4. Graphene controlled Brewster angle device for ultra broadband terahertz modulation Zefeng Chen, Xuequan Chen, Li Tao, Kun Chen, Mingzhu Long, Xudong Liu, Keyou Yan, Rayko I. Stantchev, Emma Pickwell-MacPherson, Jian-Bin Xu Nature Communications 9(1): 4909 (2018) DOI: 10.1038/s41467-018-07367-8 Link to article Abstract Terahertz modulators with high tunability of both intensity and phase are essential for effective control of electromagnetic properties. Due to the underlying physics behind existing approaches there is still a lack of broadband devices able to achieve deep modulation. Here, we demonstrate the effect of tunable Brewster angle controlled by graphene, and develop a highly-tunable solid-state graphene/quartz modulator based on this mechanism. The Brewster angle of the device can be tuned by varying the conductivity of the graphene through an electrical gate. In this way, we achieve near perfect intensity modulation with spectrally flat modulation depth of 99.3 to 99.9 percent and phase tunability of up to 140 degree in the frequency range from 0.5 to 1.6 THz. Different from using electromagnetic resonance effects (for example, metamaterials), this principle ensures that our device can operate in ultra-broadband. Thus it is an effective principle for terahertz modulation. Show Abstract 5. Graphitic carbon nitride nanosheet wrapped mesoporous titanium dioxide for enhanced photoelectrocatalytic water splitting Lin Jing, Wee Jun Ong, Rui Zhang, Emma Pickwell-MacPherson, Jimmy C. Yu Catalysis Today 315: 103-109 (2018) DOI: 10.1016/j.cattod.2018.04.007 Link to article Abstract We report a new strategy to fabricate a core-shell TiO2@g-C3N4 composite for photoelectrochemical water splitting. The heterojunction structure is prepared by chemically wrapping exfoliated thin layer g-C3N4 nanosheets on the surface of anatase TiO2 particles. The TiO2@g-C3N4 sample demonstrates high visible-light photoactivity towards water splitting, resulting in an increase in photocurrent density by a factor of 2.5 times compared to the bare TiO2. This is ascribed to the inhibition of electron-hole pair recombination due to the synergistic effect between TiO2 and g-C3N4, which enhances the charge transfer and separation. The prolonged lifetime of the charges is confirmed by using the transient absorption spectroscopic measurements. Show Abstract 6. Robust and accurate terahertz time-domain spectroscopic ellipsometry Xuequan Chen, Edward P. J. Parrott, Zhe Huang, Hau-Ping Chan, Emma Pickwell-MacPherson Photonics Research 6(8): 768 (2018) DOI: 10.1364/PRJ.6.000768 Link to article Abstract In this work, we show how fiber-based terahertz systems can be robustly configured for accurate terahertz ellipsometry. To this end, we explain how our algorithms can be successfully applied to achieve accurate spectroscopic ellipsometry with a high tolerance on the imperfect polarizer extinction ratio and pulse shift errors. Highly accurate characterization of transparent, absorptive, and conductive samples comprehensively demonstrates the versatility of our algorithms. The improved accuracy we achieve is a fundamental breakthrough for reflection-based measurements and overcomes the hurdle of phase uncertainty. Show Abstract 7. Towards a Rapid Terahertz Liquid Crystal Phase Shifter: Terahertz In-Plane and Terahertz Out-Plane (TIP-TOP) Switching Benjamin S.-Y. Ung, Xudong Liu, Edward P. J. Parrott, Abhishek Kumar Srivastava, Hongkyu Park, Vladimir G. Chigrinov, Emma Pickwell-MacPherson IEEE Transactions on Terahertz Science and Technology 8(2): 209-214 (2018) DOI: 10.1109/TTHZ.2018.2790708 Link to article Abstract Terahertz (THz) phase shifters are an essential component needed to realize many potential applications. Liquid crystals (LC) are commonly used at optical frequencies, yet to achieve an equivalent phase shift at THz frequencies the LC layer needs to be orders of magnitude thicker. Consequently, the time for the LC to relax back to its initial state is prohibitively slow. In this paper, we show for the first time how a thick, nematic phase LC cell can be switched actively in both directions, thereby achieving fast phase shifting of THz light. We call this THz in-plane and THz out-plane (TIP-TOP) switching. To achieve this, we have designed and fabricated a novel electrode structure, able to switch to and from both in- and out-plane orientations (TIP-TOP). The performance of the fabricated device provides an actively controllable phase delay with an ON-OFF cycle switching time of approximately 0.5 s: almost 100 times faster than the usual cycle time which exceeds 40 s. Furthermore, the analysis of the director distributions allows us to understand the causes of the asymmetric switching times. The TIP-TOP cell presents the capability to work as a low insertion loss, fast THz phase shifter and could be scaled up to realize a phased array device. Show Abstract 8. Invited Article: An active terahertz polarization converter employing vanadium dioxide and a metal wire grating in total internal reflection geometry Xudong Liu, Xuequan Chen, Edward P. J. Parrott, Chunrui Han, Georges Humbert, Aurelian Crunteanu, Emma Pickwell-MacPherson APL Photonics 3(5): 051604 (2018) DOI: 10.1063/1.5010940 Link to article Abstract Active broadband terahertz (THz) polarization manipulation devices are challenging to realize, but also of great demand in broadband terahertz systems. Vanadium dioxide (VO2) shows a promising phase transition for active control of THz waves and provides broadband polarization characteristics when integrated within grating-type structures. We creatively combine a VO2-based grating structure with a total internal reflection (TIR) geometry providing a novel interaction mechanism between the electromagnetic waves and the device, to realize a powerful active broadband THz polarization-controlling device. The device is based on a Si-substrate coated with a VO2 layer and a metal grating structure on top, attached to a prism for generating the TIR condition on the Si-VO2-grating interface. The grating is connected to electrodes for electrically switching the VO2 between its insulating and conducting phases. By properly selecting the incident angle of the THz waves, the grating direction, and the incident polariz... Show Abstract 1. Adaptive Sampling for Terahertz Time-Domain Spectroscopy and Imaging Yuezhi He, Edward P. J. Parrott, Emma Pickwell-MacPherson IEEE Transactions on Terahertz Science and Technology 7(2): 118-123 (2017) DOI: 10.1109/TTHZ.2016.2640663 Link to article Abstract We propose an adaptive sampling algorithm to improve the acquisition efficiency for terahertz time-domain spectroscopy (THz-TDS). Most THz-TDS measurements scan the delay line with constant speed and the data acquired have constant time steps. Our algorithm exploits the fact that the useful information within THz signals tends to cluster at certain positions: efficient sampling can be done by adaptively increasing the sample rate in regions containing more interesting features. The algorithm was implemented by programming a linear optical delay line. Depending on the experiment parameters, the sampling time of a pulse can be reduced by a factor of 2-3 with only slight degradation in accuracy, possible sources of error are discussed. We show how adaptive sampling algorithms can improve the acquisition time in applications where the main pulse is the primary concern. Show Abstract 2. Tailoring Metamaterial Microstructures to Realize Broadband Polarization Modulation of Terahertz Waves Chunrui Han, Edward P. J. Parrott, Emma Pickwell-MacPherson IEEE Journal of Selected Topics in Quantum Electronics 23(4): 1-6 (2017) DOI: 10.1109/JSTQE.2016.2641581 Link to article Abstract We report ultrabroadband, easily tunable, and highly efficient metamaterial-based terahertz wave retarders that are able to convert linear polarization into elliptical and circular polarization states. The functional device consists of a metamaterial microstructure and a grating coupler patterned on each side of fused silica substrates. The dielectric response of the metamaterial microstructure and the angular dependent phase dispersion of the grating coupler allow tuning of the phase differences from -110° to 110° within the range of a few terahertz while keeping the magnitudes of the two orthogonally transmitted waves equal. In particular, a high degree of circular polarization ({\textgreater}0.99) can be achieved from 1.78 to 4.88 THz for a specific dielectric value of spacer material 2.8 and angle of incidence -13°. The experimental results in the accessible frequency range of 0.2-2.3 THz show good agreement with the numerical simulations. Our study opens new opportunities for manipulating the broadband polarization responses of terahertz waves. This facilitates the development of new functional devices based on metamaterials for terahertz imaging and spectroscopy. Show Abstract 3. Determination of terahertz permittivity of dehydrated biological samples Yuezhi He, Kai Liu, Corinna Au, Qiushuo Sun, Edward P.J. Parrott, Emma Pickwell-MacPherson Physics in Medicine and Biology 62(23): 8882-8893 (2017) DOI: 10.1088/1361-6560/aa8ebe Link to article Abstract Abstract A key step to transform terahertz imaging to a practical medical imaging modality lies in the understanding the interactions between terahertz (THz) waves and biological tissues. Most of the models in the literature use the permittivity of liquid water to simulate the THz-tissue interactions but they often neglect the contributions from biological background such as proteins and lipids as dehydrated biological samples are experimentally difficult to prepare. In this work, we present a method to prepare thin and flat dehydrated samples which can be easily handled and measured in a transmission setup. Our results will also provide fundamental parameters for modelling THz-tissue interactions. Show Abstract 4. Composite multiscale entropy analysis of reflective terahertz signals for biological tissues Rui Zhang, Yuezhi He, Kai Liu, Liangliang Zhang, Shijing Zhang, Emma Pickwell-MacPherson, Yuejin Zhao, Cunlin Zhang Optics Express 25(20): 23669 (2017) DOI: 10.1364/OE.25.023669 Link to article Abstract We demonstrate a composite multiscale entropy (CMSE) method of terahertz (THz) signal complexity analysis to distinguish different biological tissues. The THz signals reflected from fresh porcine skin and muscle tissues were measured and analyzed. The statistically significant difference and separation of the two tissues based on several parameters were analyzed and compared for THz spectroscopy and imaging, which verified the better performance of the CMSE method and further enhancement of the contrast among THz signals that interact with different tissues. This process provides a better analysis and discrimination method for THz spectroscopy and imaging in biomedical applications. Show Abstract 5. Graphene Based Terahertz Light Modulator in Total Internal Reflection Geometry Xudong Liu, Zefeng Chen, Edward P J Parrott, Benjamin S Y Ung, Jianbin Xu, Emma Pickwell-MacPherson Abstract Modulation of visible light has been easily achieved for decades, but modulation of terahertz (THz) light still remains a challenge. To address this issue, the Fresnel equations have been developed to describe a conductive interface in a total internal reflection geometry and reveal a new approach for modulation. To demonstrate this new mechanism, a broadband device achieving a modulation depth greater than 90% between 0.15 and 0.4 THz, and reaching a maximum of 99.3% at 0.24 THz has been designed. The modulation is achieved by applying a gate voltage between −0.1 and 2 V to a graphene layer in a total internal reflection geometry. Compared to conventional designs, the high modulation is realized without assistance from metamaterial structures, resonant cavities, or multistacked graphene layers. Thus, the design is efficient and easy-to-fabricate and can be easily retrofitted to most existing THz systems. This work opens up a new avenue of research as the device has verified the theory and demonstrates how it can be used to make practical devices, bringing a promising new paradigm for THz modulation, thin-film sensing, and noninvasive material characterization. Show Abstract 6. Exploiting a metal wire grating in total internal reflection geometry to achieve achromatic polarization conversion Xudong Liu, Xuequan Chen, Edward P. J. Parrott, Emma Pickwell-MacPherson Photonics Research 5(4): 299 (2017) DOI: 10.1364/PRJ.5.000299 Link to article Abstract We demonstrate how a metal wire grating can work as a 45° polarization converter, a quarter-wave retarder, and a half-wave retarder over a broadband terahertz range when set up in total internal reflection geometry. Classical electromagnetic theory is applied to understand the mechanism, and equations to calculate the polarization state of reflected light are derived. We use a metal grating with a period of 20 $\mu$m and width of 10 $\mu$m on a fused silica surface: linearly polarized terahertz light incident from fused silica with a supercritical incident angle of 52° is totally reflected by the metal grating and air. The polarization of the terahertz light is rotated by 45°, 90°, and circularly polarized by simply rotating the wire grating. The performance is achromatic over the measured range of 0.1–0.7 THz and comparable to commercial visible light wave retarders. Show Abstract 7. Recent advances in terahertz technology for biomedical applications Qiushuo Sun, Yuezhi He, Kai Liu, Shuting Fan, Edward P. J. Parrott, Emma Pickwell-MacPherson Quantitative Imaging in Medicine and Surgery 7(3): 345-355 (2017) DOI: 10.21037/qims.2017.06.02 Link to article Abstract Terahertz instrumentation has improved significantly in recent years such that THz imaging systems have become more affordable and easier to use. THz systems can now be operated by non-THz experts greatly facilitating research into many potential applications. Due to the non-ionising nature of THz light and its high sensitivity to soft tissues, there is an increasing interest in biomedical applications including both in vivo and ex vivo studies. Additionally, research continues into understanding the origin of contrast and how to interpret terahertz biomedical images. This short review highlights some of the recent work in these areas and suggests some future research directions. Show Abstract 1. Calibration method to improve the accuracy of THz imaging and spectroscopy in reflection geometry Shuting Fan, Edward P J Parrott, Benjamin S Y Ung, Emma Pickwell-MacPherson Photonics Res. 4(3): A29--A35 (2016) DOI: 10.1364/PRJ.4.000A29 Link to article Abstract We introduce a novel method to accurately extract the optical parameters in terahertz reflection imaging. Our method builds on standard self-referencing methods using the reflected signal from the bottom of the imaging window material to further compensate for time-dependent system fluctuations and position-dependent variation in the window thickness. Our proposed method not only improves the accuracy, but also simplifies the imaging procedure and reduces measurement times. Show Abstract 2. Freeze-thaw hysteresis effects in terahertz imaging of biomedical tissues Yuezhi He, Benjamin S.-Y. Ung, Edward P J Parrott, Anil T Ahuja, Emma Pickwell-MacPherson Biomed. Opt. Express 7(11): 4711 (2016) DOI: 10.1364/BOE.7.004711 Link to article Abstract There have recently been several studies published involving terahertz (THz) imaging of frozen biomedical samples. In this paper, we investigate the effects of the freezethaw cycle on THz properties of porcine muscle and fat samples. For ordinary freezing, there was a significant change in the THz properties after thawing for muscle tissue but not for fat tissue. However, if snap-freezing was combined with fast-thawing instead of ordinary freezing and ordinary thawing, then the freeze thaw hysteresis was removed. Show Abstract 3. In vivo terahertz reflection imaging of human scars during and after the healing process Shuting Fan, Benjamin S Y Ung, Edward P J Parrott, Vincent P Wallace, Emma Pickwell-MacPherson J. Biophotonics 9: 1-9 (2016) DOI: 10.1002/jbio.201600171 Link to article Abstract We use terahertz imaging to measure four human skin scars in vivo. Clear contrast between the refractive index of the scar and surrounding tissue was observed for all of the scars, despite some being difficult to see with the naked eye. Additionally, we monitored the healing process of a hypertrophic scar. We found that the contrast in the absorption coefficient became less prominent after a few months post-injury, but that the contrast in the refractive index, was still significant even months post-injury. Our results demonstrate the capability of terahertz imaging to quantitatively measure subtle changes in skin properties and this may be useful for improving scar treat- ment and management. Show Abstract 4. Vanadium dioxide devices for terahertz wave modulation : a study of wire grid structures Edward P J Parrott, Chunrui Han, Fei Yan, Georges Humbert, Annie Bessaudou, Aurelian Crunteanu, Emma Pickwell-MacPherson Nanotechnology 27(20): 205206 (2016) DOI: 10.1088/0957-4484/27/20/205206 Link to article Abstract Vandium dioxide (VO2) shows promise as the basis for a terahertz wave modulator due to its phase transition properties. Its insulator–metal-transition (IMT) can be induced either through temperature changes, optically or electronically. Recently, a metal-VO2 wire grid structure was proposed which was able to increase the modulation depth (MD) from 0.65 to 0.9, suggesting that these simple metallic structures could greatly increase the difference in terahertz transmission for the insulating and metallic states of VO2 based structures. In this paper, we have found that the increase in MD decreases with increasing VO2 conductivity in the metallic state, resulting in a maximum modulation depth of approximately 0.95 for wire grid structures that preserves a high transmission in the insulating state. Surprisingly, we find that deposition of VO2 on top of metallic structures results in reduced performance. However, we find that devices based upon VO2 alone can achieve unexpectedly high performance. In this work we present a device with a switchable wire-grid polariser effect over a broadband frequency range (from 0.3 to 2 THz). To our knowledge this is the first such broadband metamaterial based solely on VO2. The ability to switch on a metamaterial property like this to produce a polarisation effect is very useful for future terahertz optical devices such as rotators and waveplates. Show Abstract 5. Exploiting total internal reflection geometry for efficient optical modulation of terahertz light Xudong Liu, Edward P. J. Parrott, Benjamin S.-Y. Ung, Emma Pickwell-MacPherson APL Photonics 1(7): 076103 (2016) DOI: 10.1063/1.4963141 Link to article Abstract Efficient methods to modulate terahertz (THz) light are essential for realizing rapid THz imaging and communication applications. Here we report a novel THz modu- lator which utilizes the evanescent wave in a total internal reflection setup coupled with a conductive interface to enhance the attenuation efficiency of THz light. This approach makes it possible to achieve close to 100% modulation with a small interface conductivity of 12 mS. The frequency dependence of this technique is linked to the optical properties of the materials: a material with close to frequency indepen- dent conductivity that is also controllable will result in an achromatic modulation response, and the device performance can be optimized further by tuning the internal reflection angle. In this work, we focus on applying the technique in the terahertz frequency range. Using an LED array with a pump intensity of 475 mW/cm2 to produce carriers in a silicon wafer, we have achieved a modulation depth of up to 99.9% in a broad frequency range of 0.1 THz–0.8 THz. The required pumping power for the generation of the required free carriers is low because the sheet conductivity needed is far less than required for traditional transmission techniques. Consequently, the device can be modulated by an LED making it a very practical, lowcost, and scalable solution for THz modulation. Show Abstract 1. Gelatin embedding: a novel way to preserve biological samples for terahertz imaging and spectroscopy Shuting Fan, Benjamin Ung, Edward P J Parrott, Emma Pickwell-MacPherson Phys. Med. Biol. 60: 2703-2713 (2015) DOI: 10.1088/0031-9155/60/7/2703 Link to article Abstract Sample dehydration has traditionally been a challenging problem in ex vivo terahertz biomedical experiments as water content changes significantly affect the terahertz properties and can diminish important contrast features. In this paper, we propose a novel method to prevent sample dehydration using gelatin embedding. By looking at terahertz image data and calculating the optical properties of the gelatin-embedded sample, we find that our method successfully preserves the sample for at least 35 h, both for imaging and spectroscopy. Our novel preservation method demonstrates for the first time the capability to simultaneously maintain sample structural integrity and prevent dehydration at room temperature. This is particularly relevant for terahertz studies of freshly excised tissues but could be beneficial for other imaging and spectroscopy techniques. Show Abstract 2. Label-free detection and characterization of the binding of hemagglutinin protein and broadly neutralizing monoclonal antibodies using terahertz spectroscopy Yiwen Sun, Junlan Zhong, Cunlin Zhang, Jian Zuo, Emma Pickwell-MacPherson J. Biomed. Opt. 20(3): 37006 (2015) DOI: 10.1117/1.JBO.20.3.037006 Link to article 3. Solvent Doping of PEDOT/PSS: Effect on Terahertz Optoelectronic Properties and Utilization in Terahertz Devices Fei Yan, Edward P J Parrott, Benjamin S.-Y. Ung, Emma Pickwell-MacPherson J. Phys. Chem. C 119(12): 6813-6818 (2015) DOI: 10.1021/acs.jpcc.5b00465 Link to article Abstract Poly(3,4-ethylenedioxythiophene)/poly(4-styrenesulfonate) (PEDOT/PSS) is a conducting polymer and is a promising material for use in optoelectronic devices. Adding dopants to PEDOT/PSS significantly affects its optoelectronic properties: in this article we use terahertz time domain spectroscopy (THz-TDS) to probe the effects of dopants dimethyl sulfoxide (DMSO) and ethylene glycol. The carrier density, mobility, and conductivity are calculated from the THz measurements by fitting the dielectric permittivity to the Drude−Smith model. This gives us an insight into the conductivity enhancement mechanisms, and we find evidence to suggest that both carrier delocalization and charge screening play a role, although the relative importance of these two mechanisms depends upon both dopant polarity and concentration. To demonstrate an application of this finding, we design and fabricate broadband terahertz neutral density filters based upon 6{\{}%{\}} DMSO doped PEDOT/PSS thin films of varying thickness and demonstrate optical densities between 0.14 and 0.53 from 0.5 to 2.2 THz with a comparable frequency variation to commercially available optical frequency ND filters. Show Abstract 4. Low-cost and broadband terahertz antireflection coatings based on DMSO-doped PEDOT / PSS Fei Yan, Edward P J Parrott, Xu Dong Liu, Emma Pickwell-MacPherson Opt. Lett. 40(12): 2886-2889 (2015) DOI: 10.1364/OL.40.002886 Link to article Abstract We report the potential application of 6{\{}%{\}} dimethylsulfoxide (DMSO)-doped poly (3, 4-ethylenedioxythiophene)/poly (4-styrenesulfonate) (PEDOT/PSS) as a low cost and broadband terahertz (THz) antireflection coating based on the impedance matching effect. The reflected pulses from the quartz and silicon substrates are observed to change with the thickness of the PEDOT/PSS layer. Theoretical analysis based on an equivalent transmission line circuit model and FDTD computational simulations have been used to understand the experimental results. Excellent impedance matching is achieved by a ∼39-nm-thick 6{\{}%{\}} DMSO-doped PEDOT/PSS layer on quartz, and a ∼101-nm-thick 6{\{}%{\}} DMSO-doped PEDOT/PSS layer on silicon due to the almost-frequency-independent conductivity of the thin film between 0.3 and 2.5 THz. In the critical conditions, the normalized main pulse transmission remains as high as 74{\{}%{\}} and 64{\{}%{\}}, for the quartz and silicon substrates, respectively, significantly higher than the existing state of the art THz antireflection coatings. Show Abstract 1. Automatic online detection of atrial fibrillation based on symbolic dynamics and Shannon entropy Xiaolin Zhou, Hongxia Ding, Benjamin Ung, Emma Pickwell-MacPherson, Yuanting Zhang Biomed. Eng. Online 13(1): 18 (2014) DOI: 10.1186/1475-925X-13-18 Link to article 2. The growth of biomedical terahertz research Shuting Fan, Yuezhi He, Benjamin S Ung, Emma Pickwell-MacPherson J. Phys. D. Appl. Phys. 47(37): 374009 (2014) DOI: 10.1088/0022-3727/47/37/374009 Link to article 3. Use of Finite Difference Time Domain Simulations and Debye Theory for Modelling the Terahertz Reflection Response of Normal and Tumour Breast Tissue Anthony J Fitzgerald, Emma Pickwell-MacPherson, Vincent P Wallace PLoS One 9(7): e99291 (2014) DOI: 10.1371/journal.pone.0099291 Link to article 4. Direct evidence to support the restriction of intramolecular rotation hypothesis for the mechanism of aggregation-induced emission: temperature resolved terahertz spectra of tetraphenylethene Edward P J Parrott, Nicholas Y Tan, Rongrong Hu, J Axel Zeitler, Ben Zhong Tang, Emma Pickwell-MacPherson Mater. Horiz. 1(2): 251-258 (2014) DOI: 10.1039/c3mh00078h Link to article Abstract In contrast to the traditional fluorescent dyes that exhibit a decrease in fluorescence upon aggregation, Aggregation- Induced Emission (AIE) molecules are a family of fluorophors which exhibit increased fluorescence upon aggregation. Consequently, AIE molecules represent an interesting new material with potential applications in fluorescent chemo/biosensors, light emitting devices and medical diagnostics. Numerous mechanisms have been proposed to explain this phenomenon, including E–Z isomerization, and restriction of intramolecular rotations (RIR). However, there has not been any direct experimental evidence to support either one of these hypotheses. Here we use terahertz time-domain-spectroscopy (THz-TDS) and solid-state computational simulations of an AIE molecule to link the increase in intensity of intramolecular rotation and rocking modes to the measured fluorescence and reveal direct evidence supporting the RIR hypothesis. This is the first time that terahertz spectroscopy has been used to directly probe such molecular motions in AIE materials and in doing so we have found conclusive evidence to fully explain the AIE mechanism. Show Abstract 5. High extinction ratio and low transmission loss thin-film terahertz polarizer with a tunable bilayer metal wire-grid structure Zhe Huang, Edward P J Parrott, Hongkyu Park, Hau Ping Chan, Emma Pickwell-MacPherson Opt. Lett. 39(4): 793-796 (2014) DOI: 10.1364/OL.39.000793 Link to article Abstract A thin-film terahertz polarizer is proposed and realized via a tunable bilayer metal wire-grid structure to achieve high extinction ratios and good transmission. The polarizer is fabricated on top of a thin silica layer by standard micro-fabrication techniques to eliminate the multireflection effects. The tunable alignment of the bilayer alumi- num-wire grid structure enables tailoring of the extinction ratio and transmission characteristics. Using terahertz time-domain spectroscopy (THz-TDS), a fabricated polarizer is characterized, with extinction ratios greater than 50 dB and transmission losses below 1 dB reported in the 0.2–1.1 THz frequency range. These characteristics can be improved by further tuning the polarizer parameters such as the pitch, metal film thickness, and lateral displacement. Show Abstract 1. Advances in Polarizer Technology for Terahertz Frequency Applications Fei Yan, Calvin Yu, Hongkyu Park, Edward P J Parrott, Emma Pickwell-MacPherson J. Infrared Milli. Terahz Waves 34(9): 489-499 (2013) DOI: 10.1007/s10762-013-0005-4 Link to article Abstract As investigations into potential applications of terahertz technology grow, there is an increasing need for improved terahertz optical components such as polarizers. To determine the optical properties of a sample accurately, the polarization properties of the light must also be known accurately. Many terahertz emitters will have both horizontal and vertical polarization components and often assumptions are made about device characteris- tics without measuring them-even the position of excitation beam on the photoconductive emitter can affect the resulting terahertz electric field and so the exact optical properties of a given device will vary depending on how they are configured. Polarizers operating at terahertz frequencies can be used to characterize the electric field accurately or remove unwanted components as long as the polarizer is of sufficiently high performance. In this paper we review the key properties of polarizers and look at recent advances in their design and development at terahertz frequencies. Show Abstract 2. Robust Thin-Film Wire-Grid THz Polarizer Fabricated Via a Low-Cost Approach Zhe Huang, Hongkyu Park, Edward P J Parrott, Hau Ping Chan, Emma Pickwell-MacPherson IEEE Photon. Techn. Lett. 25(1): 81-84 (2013) DOI: 10.1109/LPT.2012.2228184 Link to article Abstract A robust thin-film wire-grid terahertz (THz) polarizer was fabricated via a low-cost, mass-producible man- ufacturing approach. This polarizer is built on a very thin silica layer structurally supported by a silicon substrate. In addition, the metal grating is protected by a polymer thin film, which eliminates the multireflection effect and enhances the robustness of the polarizer for easy packaging. The polarizer can be easily mounted onto a Newport rotation holder for immediate use. A THz time-domain spectrometer is used to characterize its performance, and an excellent agreement is found between the FDTD-simulated results and the experimental results. The polarizer offered 20–40 dB and 0.8 dB of extinction ratio and transmission loss over a frequency range of 0.2–2.0 THz, respectively. Show Abstract 3. Guest Editorial: Terahertz imaging and spectroscopy for biology and biomedicine Emma Pickwell-MacPherson, Gian Piero Gallerano, Gun-Sik Park, Henning Hintzsche, Gerald Joseph Wilmink IEEE J. Biomed. Heal. Informatics 17(4): 765-767 (2013) DOI: 10.1109/JBHI.2013.2257333 Link to article 1. The potential of terahertz imaging for cancer diagnosis: A review of investigations to date Calvin Yu, Shuting Fan, Yiwen Sun, Emma Pickwell-MacPherson Quantitative Imaging in Medicine and Surgery 2(1): 33-45 (2012) DOI: 10.3978/j.issn.2223-4292.2012.01.04 Link to article Abstract The terahertz region lies between the microwave and infrared regions of the electromagnetic spectrum such that it is strongly attenuated by water and very sensitive to water content. Terahertz radiation has very low photon energy and thus it does not pose any ionization hazard for biological tissues. Because of these characteristic properties, there has been an increasing interest in terahertz imaging and spectroscopy for biological applications within the last few years and more and more terahertz spectra are being reported, including spectroscopic studies of cancer. The presence of cancer often causes increased blood supply to affected tissues and a local increase in tissue water content may be observed: this acts as a natural contrast mechanism for terahertz imaging of cancer. Furthermore the structural changes that occur in affected tissues have also been shown to contribute to terahertz image contrast. This paper introduces terahertz technology and provides a short review of recent advances in terahertz imaging and spectroscopy techniques. In particular investigations relating to the potential of terahertz imaging and spectroscopy for cancer diagnosis will be highlighted. Show Abstract 2. Accurate photoconductive antenna characterization using a thin film polarizer H Park, E P J Parrott, Z Huang, H P Chan, E Pickwell-MacPherson Appl. Phys. Lett. 101(12): 121108 (2012) DOI: 10.1063/1.4753795 Link to article 3. Evaluating liquid crystal properties for use in terahertz devices Hongkyu Park, Edward P J Parrott, Fan Fan, Meehyun Lim, Haewook Han, Vladimir G Chigrinov, Emma Pickwell-MacPherson Opt. Express 20(11): 11899-11905 (2012) DOI: 10.1364/OE.20.011899 Link to article 4. Probing biological systems with terahertz spectroscopy Emma Pickwell-MacPherson, Yiwen Sun, Edward P J Parrott Proc. SPIE 8496: 84960R--84960R--5 (2012) DOI: 10.1117/12.928185 Link to article 5. Tailoring liquid crystals to become fast and efficient terahertz devices E Pickwell-MacPherson, E P J Parrott, H Park, F Fan, V G Chigrinov Proc. SPIE 8475: 84750D--84750D--6 (2012) DOI: 10.1117/12.928191 Link to article 1. Terahertz spectroscopy: Its future role in medical diagnoses Edward Philip John Parrott, Yiwen Sun, Emma Pickwell-MacPherson J. Mol. Struct. 1006(1-3): 66-76 (2011) DOI: 10.1016/j.molstruc.2011.05.048 Link to article 2. Total variation deconvolution for terahertz pulsed imaging Yang Chen, Yiwen Sun, Emma Pickwell-MacPherson Inverse Probl. Sci. Eng. 19(2): 223-232 (2011) DOI: 10.1080/17415977.2010.550045 Link to article 3. Terahertz pulsed imaging of freshly excised human colonic tissues Caroline B Reid, Anthony J Fitzgerald, George Reese, Robert Goldin, Emma Pickwell-MacPherson, Adam P Gibson, Vincent P Wallace Phys. Med. Biol. 56: 4333-4353 (2011) DOI: 10.1088/0031-9155/56/14/008 Link to article 4. The effects of pre-ejection period on post-exercise systolic blood pressure estimation using the pulse arrival time technique Mico Yee Man Wong, Emma Pickwell-MacPherson, Yuan Ting Zhang, Jack C Y Cheng Eur. J. Appl. Physiol. 111(1): 135-144 (2011) DOI: 10.1007/s00421-010-1626-0 Link to article 5. Terahertz pulsed imaging in vivo: measurements and processing methods Edward P J Parrott, Stanley M Y Sy, Thierry Blu, Vincent P Wallace, Emma Pickwell-MacPherson J. Biomed. Opt. 16(10): 106010 (2011) DOI: 10.1117/1.3642002 Link to article Abstract This paper presents a number of data processing algorithms developed to improve the accuracy of results derived from datasets acquired by a recently designed terahertz handheld probe. These techniques include a baseline subtraction algorithm and a number of algorithms to extract the sample impulse response: double Gaussian inverse filtering, frequency-wavelet domain deconvolution, and sparse deconvolution. In vivo measurements of human skin are used as examples, and a comparison is made of the terahertz impulse response from a number of different skin positions. The algorithms presented enables both the spectroscopic and time domain properties of samples measured in reflection geometry to be better determined compared to previous calculation methods. Show Abstract 6. A promising diagnostic method: Terahertz pulsed imaging and spectroscopy Yiwen Sun, Stanley M Y Sy, Y X Wang, Anil T Ahuja, Yuanting Zhang, Emma Pickwell-MacPherson 1. Frequency-Wavelet Domain Deconvolution for terahertz reflection imaging and spectroscopy. Yang Chen, Shengyang Huang, Emma Pickwell-MacPherson Opt. Express 18(2): 1177-1190 (2010) Link to article Abstract In terahertz reflection imaging, a deconvolution process is often employed to extract the impulse function of the sample of interest. A band-pass filter such as a double Gaussian filter is typically incorporated into the inverse filtering to suppress the noise, but this can result in over-smoothing due to the loss of useful information. In this paper, with a view to improving the calculation of terahertz impulse response functions for systems with a low signal to noise ratio, we propose a hybrid Frequency-Wavelet Domain Deconvolution (FWDD) for terahertz reflection imaging. Our approach works well; it retrieves more accurate impulse response functions than existing approaches and these impulse functions can then also be used to better extract the terahertz spectroscopic properties of the sample. Show Abstract 2. Practical Considerations for in Vivo THz Imaging Emma Pickwell-MacPherson Terahertz Sci. Technol. 3(4): 163-171 (2010) 3. Improving extraction of impulse response functions using stationary wavelet shrinkage in terahertz reflection imaging Yang Chen, Yiwen Sun, Emma Pickwell-MacPherson Fluct. Noise Lett. (2010) DOI: 10.1142/S0219477510000307 Link to article 4. Contactless and continuous monitoring of heart rate based on photoplethysmography on a mattress M Y M Wong, E Pickwell-MacPherson, Y T Zhang Physiol. Meas. 31(7): 1065-1074 (2010) DOI: 10.1088/0967-3334/31/7/014 Link to article Abstract This paper reports a novel contactless monitoring method to record photoplethysmogram (PPG) on a mattress for the continuous measurement of heart rate (HR). PPGs were obtained from subjects' fingers and backs with and without making a direct contact between the PPG sensor and their skin when they rested in a supine position on the mattress. Electrocardiograms (ECGs) were measured from the subjects' limbs for reference. Clear PPG waveforms were obtained from the subjects' backs. Beat-to-beat HR derived from contactless PPG measurement was comparable to those measured from contact PPG and ECG measurements. Thus we found that contactless PPG could be captured from the subjects' backs and it was sufficient to provide accurate HR measurements. This contactless monitoring of PPG has the potential to reduce obstruction in sleep and provide clinical evaluation in sleep study. Show Abstract 5. Terahertz pulsed imaging of knee cartilage Wai-Chi Kan, Win-Sze Lee, Wing-Hoi Cheung, Vincent P Wallace, Emma Pickwell-MacPherson Biomed. Opt. Express 1(3): 967 (2010) DOI: 10.1364/BOE.1.000967 Link to article 6. Accuracy and resolution of THz reflection spectroscopy for medical imaging. Caroline B Reid, Emma Pickwell-MacPherson, Jan G Laufer, Adam P Gibson, Jeremy C Hebden, Vincent P Wallace Phys. Med. Biol. 55(16): 4825-4838 (2010) DOI: 10.1088/0031-9155/55/16/013 Link to article Abstract The use of THz radiation as a potential tool for medical imaging is of increasing interest. In this paper three methods of analysis of THz spectroscopic information for diagnosis of tissue pathologies at THz frequencies are presented. The frequency-dependent absorption coefficients, refractive indices and Debye relaxation times of pure water and pure lipids were measured and used as prior knowledge in the different theoretical methods for the determination of concentration. Three concentration analysis methods were investigated: (a) linear spectral decomposition, (b) spectrally averaged dielectric coefficient method and (c) the Debye relaxation coefficient method. These methods were validated on water and lipid emulsions by determining the concentrations of phantom chromophores and comparing to the known composition. The accuracy and resolution of each method were determined to assess the potential of each method as a tool for medical diagnosis at THz frequencies. Show Abstract 1. Improved sample characterization in terahertz reflection imaging and spectroscopy. Shengyang Huang, Philip C Ashworth, Kanis W Kan, Yang Chen, Vincent P Wallace, Yuan-Ting Zhang, Emma Pickwell-MacPherson Opt. Express 17(5): 3848-3854 (2009) DOI: 10.1364/OE.17.003848 Link to article Abstract For imaging applications involving biological subjects, the strong attenuation of terahertz radiation by water means that terahertz pulsed imaging is most likely to be successfully implemented in a reflection geometry. Many terahertz reflection geometry systems have a window onto which the sample is placed - this window may introduce unwanted reflections which interfere with the reflection of interest from the sample. In this paper we derive a new approach to account for the effects of these reflections and illustrate its success with improved calculations of sample optical properties. Show Abstract 2. Effects of formalin fixing on the terahertz properties of biological tissues Yiwen Sun, Bernd M Fischer, Emma Pickwell-MacPherson J. Biomed. Opt. 14(6): 64017 (2009) Link to article Abstract Wedemonstrate how the terahertz properties of porcine adipose tissue andskeletal muscle are affected by formalin fixing. Terahertz radiation issensitive to covalently cross-linked proteins and can be used toprobe unique spectroscopic signatures. We study in detail the changesarising from different fixation times and see that formalin fixingreduces the refractive index and the absorption coefficient of thesamples in the terahertz regime. These fundamental properties affect thetime-domain terahertz response of the samples and determine the levelof image contrast that can be achieved. {\{}{\textcopyright}{\}}2009 Society of Photo-Optical Instrumentation Engineers Show Abstract 3. Terahertz pulsed imaging--a potential medical imaging modality? Emma Pickwell-MacPherson, Vincent P Wallace Photodiagn. Photodyn. 6(2): 128-134 (2009) DOI: 10.1016/j.pdpdt.2009.07.002 Link to article Abstract Terahertz imaging has progressed significantly over the last decade and there is now a significant body of research in its application to biomedical problems with the possibility of developing it into viable medical imaging modality in the future. The motivation being to fill some of the shortfalls in existing medical imaging technologies especially in detecting early stage cancers. We review the main developments in terahertz imaging to-date and highlight the most promising current areas of biomedical terahertz research. Additionally, we provide an overview of the principles behind terahertz imaging along with illustrated examples to aid understanding for those new to the technology. Our aim is to increase awareness of the existence and potential of the technology and inspire solutions to the remaining challenges in developing terahertz imaging into a novel medical imaging modality. Show Abstract 4. The acute effects of running on blood pressure estimation using pulse transit time in normotensive subjects Mico Yee-Man Wong, Emma Pickwell-MacPherson, Yuan-Ting Zhang Eur. J. Appl. Physiol. 107(2): 169-175 (2009) DOI: 10.1007/s00421-009-1112-8 Link to article Abstract Pulse transit time (PTT) is a potential parameter for cuffless blood pressure (BP) estimation. Since exercise induces changes in arterial properties that can influence the relationship between BP and PTT, we investigate whether PTT can be used to estimate BP after successive bouts of exercise. PTT-foot, PTT-peak (time intervals from the peak of electrocardiogram R-wave to the foot and peak of photoplethysmogram, respectively) and BP of 41 normotensive subjects (aged 25 +/- 4 years) were measured in the first test. A repeatability test was then conducted on 14 subjects after 6 months. Each test included two periods of running on the treadmill at 10 and 8 km/h (with a rest in between). In both tests, systolic BP (SBP) was closely correlated with PTT-foot and PTT-peak. For each subject, the best fit linear relationships between SBP and PTTs were determined over all phases of each test. The differences between the linear fits and measured data were greater after the second period of running for all subjects in both tests. This implied that the relationships started to change after the second period of running. When SBP in the repeatability test was predicted using the linear regression coefficients from the first test, the linear fit after the first period of exercise was still better than after the second. The repeated observations in both tests suggest that PTT is a potential parameter for cuffless BP estimation after one period of exercise, but would need re-calibration (relationship between BP and PTTs) for measurements after successive phases of exercise. Show Abstract 5. Effects of formalin fixing on the terahertz properties of biological tissues Yiwen Sun, Bernd M. Fischer, Emma Pickwell-MacPherson Journal of Biomedical Optics 14(6): 064017 (2009) DOI: 10.1117/1.3268439 Link to article Abstract We demonstrate how the terahertz properties of porcine adipose tissue and skeletal muscle are affected by formalin fixing. Terahertz radiation is sensitive to covalently cross-linked proteins and can be used to probe unique spectroscopic signatures. We study in detail the changes arising from different fixation times and see that formalin fixing reduces the refractive index and the absorption coefficient of the samples in the terahertz regime. These fundamental properties affect the time-domain terahertz response of the samples and determine the level of image contrast that can be achieved. Show Abstract 6. Terahertz pulsed spectroscopy of freshly excised human breast cancer. Philip C Ashworth, Emma Pickwell-MacPherson, Elena Provenzano, Sarah E Pinder, Anand D Purushotham, Michael Pepper, Vincent P Wallace Opt. Express 17(15): 12444-12454 (2009) DOI: 10.1364/OE.17.012444 Link to article Abstract The complex refractive indices of freshly excised healthy breast tissue and breast cancers collected from 20 patients were measured in the range of 0.15 - 2.0 THz using a portable terahertz pulsed transmission spectrometer. Histology was performed to classify the tissue samples as healthy adipose tissue, healthy fibrous breast tissue, or breast cancers. The average complex refractive index was determined for each group and it was found that samples containing cancer had a higher refractive index and absorption coefficient. The terahertz properties of the tissues were also used to simulate the impulse response functions expected when imaging breast tissue in a reflection geometry as in terahertz pulsed imaging (TPI). Our results indicate that both TPS and TPI can be used to distinguish between healthy adipose breast tissue, healthy fibrous breast tissue and breast cancer due to the differences in the fundamental optical properties. Show Abstract 1. Recent developments of terahertz technology in biomedicine Emma Pickwell-MacPherson, Shengyang Huang, Kanis W Kan, Yiwen Sun, Yuan-Ting Zhang J. Innov. Opt. Health Sci. 1(1): 29-44 (2008) DOI: 10.1142/S1793545808000042 Link to article 2. Three-dimensional imaging of optically opaque materials using nonionizing terahertz radiation. Vincent P Wallace, Emma Macpherson, J Axel Zeitler, Caroline Reid J. Opt. Soc. Am. A 25(12): 3120-3133 (2008) Link to article Abstract Terahertz electromagnetic radiation has already been shown to have a wide number of uses. We consider specific applications of terahertz time-domain imaging that are inherently three-dimensional. This paper highlights the ability of terahertz radiation to reveal subsurface information as we exploit the fact that the radiation can penetrate optically opaque materials such as clothing, cardboard, plastics, and to some extent biological tissue. Using interactive science publishing tools, we concentrate on full three-dimensional terahertz data from three specific areas of application, namely, security, pharmaceutical, and biomedical. Show Abstract 1. A comparison of terahertz pulsed imaging with transmission microradiography for depth measurement of enamel demineralisation in vitro. Emma Pickwell, Vincent P Wallace, Bryan E Cole, Sophia Ali, Christopher Longbottom, Richard J M Lynch, Michael Pepper Caries Res. 41(1): 49-55 (2007) DOI: 10.1159/000096105 Link to article Abstract Terahertz pulsed imaging (TPI) is a relatively new, non-ionising and non-destructive imaging technique for studying hard tissues which does not require tooth section preparation, unlike transmission microradiography (TMR). If TPI can measure the depths of caries/demineralisation lesions accurately the same tooth samples could be reused and remeasured during in vitro and in situ studies on de- and/or re-mineralisation. The aim of this study was to compare TPI and TMR for measuring the depths of a range of artificially induced bovine enamel demineralised lesions in vitro. Bovine slabs with artificial caries, induced to different levels of demineralisation by two different but standard demineralisation techniques ('acid gel' and 'carbopol') were measured by TPI and TMR and the readings compared. The set of TPI/TMR measurements obtained on the gel-demineralised slabs showed an extremely high coefficient of determination (r(2) = 0.995). Detailed analysis of the results and theoretical considerations (involving the relationship between refractive index profiling and mineral loss profile) are used to explain the findings and show that for acid gel lesions TPI is measuring demineralisation in the range of 47{\{}%{\}} of that of TMR depth plus an intercept of 16 microm, with further calculations allowing the TMR depths to be determined to within 5{\{}%{\}} using TPI. Show Abstract 1. Terahertz pulsed spectroscopy of human basal cell carcinoma V P Wallace, A J Fitzgerald, E Pickwell, R J Pye, P F Taday, N Flanagan, T Ha Appl. Spectrosc. 60: 1127-1133 (2006) DOI: 10.1366/000370206778664635 Link to article 2. Biomedical applications of terahertz technology E Pickwell, V P Wallace J. Phys. D Appl. Phys. 39(17): R301--R310 (2006) DOI: 10.1088/0022-3727/39/17/R01 Link to article 1. Simulating the response of terahertz radiation to basal cell carcinoma using ex vivo spectroscopy measurements E Pickwell, A J Fitzgerald, B E Cole, P F Taday, R J Pye, T Ha, M Pepper, V P Wallace J. Biomed. Opt. 10: 64021 (2005) 1. In vivo study of human skin using pulsed terahertz radiation E Pickwell, B E Cole, A J Fitzgerald, M Pepper, V P Wallace Phys. Med. Biol. 49(9): 1595-1607 (2004) DOI: 10.1088/0031-9155/49/9/001 Link to article 2. Simulation of terahertz pulse propagation in biological systems E Pickwell, B E Cole, A J Fitzgerald, V P Wallace, M Pepper Appl. Phys. Lett. 84(12): 2190 (2004) DOI: 10.1063/1.1688448 Link to article
2019-11-21 14:26:13
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.2720913589000702, "perplexity": 3429.012712044382}, "config": {"markdown_headings": false, "markdown_code": false, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-47/segments/1573496670821.55/warc/CC-MAIN-20191121125509-20191121153509-00064.warc.gz"}
http://en.wikipedia.org/wiki/Voronoi_Diagram
# Voronoi diagram (Redirected from Voronoi Diagram) 20 points and their Voronoi cells (larger version below). In mathematics, a Voronoi diagram is a way of dividing space into a number of regions. A set of points (called seeds, sites, or generators) is specified beforehand and for each seed there will be a corresponding region consisting of all points closer to that seed than to any other. The regions are called Voronoi cells. It is dual to the Delaunay triangulation. It is named after Georgy Voronoy, and is also called a Voronoi tessellation, a Voronoi decomposition, a Voronoi partition, or a Dirichlet tessellation (after Peter Gustav Lejeune Dirichlet). Voronoi diagrams can be found in a large number of fields in science and technology, even in art, and they have found numerous practical and theoretical applications.[1][2] ## The simplest case In the simplest and most familiar case (shown in the first picture), we are given a finite set of points {p1, …, pn} in the Euclidean plane. In this case each site pk is simply a point and its corresponding Voronoi cell (also called Voronoi region or Dirichlet cell) Rk consisting of every point whose distance to pk is less than or equal to its distance to any other site. Each such cell is obtained from the intersection of half-spaces, and hence it is a convex polygon. The segments of the Voronoi diagram are all the points in the plane that are equidistant to the two nearest sites. The Voronoi vertices (nodes) are the points equidistant to three (or more) sites. ## Formal definition Let $\scriptstyle X$ be a space (a nonempty set) endowed with a distance function $\scriptstyle d$. Let $\scriptstyle K$ be a set of indices and let $\scriptstyle (P_k)_{k \in K}$ be a tuple (ordered collection) of nonempty subsets (the sites) in the space $\scriptstyle X$. The Voronoi cell, or Voronoi region, $\scriptstyle R_k$, associated with the site $\scriptstyle P_k$ is the set of all points in $\scriptstyle X$ whose distance to $\scriptstyle P_k$ is not greater than their distance to the other sites $\scriptstyle P_j$, where $\scriptstyle j$ is any index different from $\scriptstyle k$. In other words, if $\scriptstyle d(x,\, A) \;=\; \inf\{d(x,\, a) \;|\; a \,\in\, A\}$ denotes the distance between the point $\scriptstyle x$ and the subset $\scriptstyle A$, then $R_k = \{x \in X \;|\; d(x, P_k) \leq d(x, P_j)\; \text{for all}\; j \neq k\}$ The Voronoi diagram is simply the tuple of cells $\scriptstyle (R_k)_{k \in K}$. In principle some of the sites can intersect and even coincide (an application is described below for sites representing shops), but usually they are assumed to be disjoint. In addition, infinitely many sites are allowed in the definition (this setting has applications in geometry of numbers and crystallography), but again, in many cases only finitely many sites are considered. In the particular case where the space is a finite dimensional Euclidean space, each site is a point, there are finitely many points and all of them are different, then the Voronoi cells are convex polytopes and they can be represented in a combinatorial way using their vertices, sides, 2-dimensional faces, etc. Sometimes the induced combinatorial structure is referred to as the Voronoi diagram. However, in general the Voronoi cells may not be convex or even connected. ## Illustration As a simple illustration, consider a group of shops in a flat city. Suppose we want to estimate the number of customers of a given shop. With all else being equal (price, products, quality of service, etc.), it is reasonable to assume that customers choose their preferred shop simply by distance considerations: they will go to the shop located nearest to them. In this case the Voronoi cell $\scriptstyle R_k$ of a given shop $\scriptstyle P_k$ can be used for giving a rough estimate on the number of potential customers going to this shop (which is modeled by a point in our flat city). So far it was assumed that the distance between points in the city is measured using the standard distance, the familiar Euclidean distance: $\ell_2 = d\left[\left(a_1, a_2\right), \left(b_1, b_2\right)\right] = \sqrt{\left(a_1 - b_1\right)^2 + \left(a_2 - b_2\right)^2}$ However, if we consider the case where customers only go to the shops by a vehicle and the traffic paths are parallel to the $x$ and $y$ axes, as in Manhattan, then a more realistic distance function will be the $\ell_1$ distance, namely $d\left[\left(a_1, a_2\right), \left(b_1, b_2\right)\right] = \left|a_1 - b_1\right| + \left|a_2 - b_2\right|$. Voronoi diagrams of 20 points under two different metrics ## Properties • The dual graph for a Voronoi diagram (in the case of a Euclidean space with point sites) corresponds to the Delaunay triangulation for the same set of points. • The closest pair of points corresponds to two adjacent cells in the Voronoi diagram. • Assume the setting is the Euclidean plane and a group of different points are given. Then two points are adjacent on the convex hull if and only if their Voronoi cells share an infinitely long side. • If the space is a normed space and the distance to each site is attained (e.g., when a site is a compact set or a closed ball), then each Voronoi cell can be represented as a union of line segments emanating from the sites.[3] As shown there, this property does not necessarily hold when the distance is not attained. • Under relatively general conditions (the space is a possibly infinite dimensional uniformly convex space, there can be infinitely many sites of a general form, etc.) Voronoi cells enjoy a certain stability property: a small change in the shapes of the sites, e.g., a change caused by some translation or distortion, yields a small change in the shape of the Voronoi cells. This is the geometric stability of Voronoi diagrams.[4] As shown there, this property does not hold in general, even if the space is two-dimensional (but non-uniformly convex, and, in particular, non-Euclidean) and the sites are points. ## History and research Informal use of Voronoi diagrams can be traced back to Descartes in 1644. Peter Gustav Lejeune Dirichlet used 2-dimensional and 3-dimensional Voronoi diagrams in his study of quadratic forms in 1850. British physician John Snow used a Voronoi diagram in 1854 to illustrate how the majority of people who died in the Soho cholera epidemic lived closer to the infected Broad Street pump than to any other water pump. Voronoi diagrams are named after Ukrainian mathematician Georgy Fedosievych Voronyi (or Voronoy) who defined and studied the general n-dimensional case in 1908. Voronoi diagrams that are used in geophysics and meteorology to analyse spatially distributed data (such as rainfall measurements) are called Thiessen polygons after American meteorologist Alfred H. Thiessen. In condensed matter physics, such tessellations are also known as Wigner–Seitz unit cells. Voronoi tessellations of the reciprocal lattice of momenta are called Brillouin zones. For general lattices in Lie groups, the cells are simply called fundamental domains. In the case of general metric spaces, the cells are often called metric fundamental polygons. Other equivalent names for this concept (or particular important cases of it) : Voronoi polyhedra, Voronoi polygons, domain(s) of influence, Voronoi decomposition, Voronoi tessellation(s), Dirichlet tessellation(s). ## Examples This is a slice of the Voronoi diagram of a random set of points in a 3D box. In general a cross section of a 3D Voronoi tessellation is not a 2D Voronoi tessellation itself. (The cells are all convex polyhedra.) Voronoi tessellations of regular lattices of points in two or three dimensions give rise to many familiar tessellations. For the set of points (xy) with x in a discrete set X and y in a discrete set Y, we get rectangular tiles with the points not necessarily at their centers. ## Higher-order Voronoi diagrams Although a normal Voronoi cell is defined as the set of points closest to a single point in S, an nth-order Voronoi cell is defined as the set of points having a particular set of n points in S as its n nearest neighbors. Higher-order Voronoi diagrams also subdivide space. Higher-order Voronoi diagrams can be generated recursively. To generate the nth-order Voronoi diagram from set S, start with the (n − 1)th-order diagram and replace each cell generated by X = {x1x2, ..., xn−1} with a Voronoi diagram generated on the set S − X. ### Farthest-point Voronoi diagram For a set of n points the (n−1)th-order Voronoi diagram is called a farthest-point Voronoi diagram. For a given set of points S = {p1p2, ..., pn} the farthest-point Voronoi diagram divides the plane into cells in which the same point of P is the farthest point. Note that a point of P has a cell in the farthest-point Voronoi diagram if and only if it is a vertex of the convex hull of P. Thus, let H = {h1h2, ..., hk} be the convex hull of P we define the farthest-point Voronoi diagram as the subdivision of the plane into k cells, one for each point in H, with the property that a point q lies in the cell corresponding to a site hi if and only if dist(q, hi) > dist(q, pj) for each pj ∈ S with hipj. Where dist(p, q) is the Euclidean distance between two points p and q.[5] [6] ## Generalizations and variations As implied by the definition, Voronoi cells can be defined for metrics other than Euclidean (such as the Mahalanobis or Manhattan) distances. However in these cases the boundaries of the Voronoi cells may be more complicated than in the Euclidean case, since the equidistant locus for two points may fail to be subspace of codimension 1, even in the 2-dimensional case. A weighted Voronoi diagram is the one in which the function of a pair of points to define a Voronoi cell is a distance function modified by multiplicative or additive weights assigned to generator points. In contrast to the case of Voronoi cells defined using a distance which is a metric, in this case some of the Voronoi cells may be empty. A power diagram is a type of Voronoi diagram defined from a set of circles using the power distance; it can also be thought of as a weighted Voronoi diagram in which a weight defined from the radius of each circle is added to the squared distance from the circle's center.[7] Approximate Voronoi diagram of a set of points. Notice the blended colors in the fuzzy boundary of the Voronoi cells. The Voronoi diagram of n points in d-dimensional space requires $\scriptstyle O\left(n^{\left\lceil \frac{1}{2}d \right\rceil}\right)$ storage space. Therefore, Voronoi diagrams are often not feasible for d > 2. An alternative is to use approximate Voronoi diagrams, where the Voronoi cells have a fuzzy boundary, which can be approximated.[8] Another alternative is when any site is a fuzzy circle and as a result the cells become fuzzy too.[9] Voronoi diagrams are also related to other geometric structures such as the medial axis (which has found applications in image segmentation, optical character recognition, and other computational applications), straight skeleton, and zone diagrams. ## Applications • In epidemiology, Voronoi diagrams can be used to correlate sources of infections in epidemics. One of the early applications of Voronoi diagrams was implemented by John Snow to study the 1854 Broad Street cholera outbreak in Soho, England. He showed the correlation between areas on the map of London using a particular water pump, and the areas with most deaths due to the outbreak. • A point location data structure can be built on top of the Voronoi diagram in order to answer nearest neighbor queries, where one wants to find the object that is closest to a given query point. Nearest neighbor queries have numerous applications. For example, one might want to find the nearest hospital, or the most similar object in a database. A large application is vector quantization, commonly used in data compression. • In geometry, Voronoi diagrams can be used to find the largest empty circle amid a set of points, and in an enclosing polygon; e.g. to build a new supermarket as far as possible from all the existing ones, lying in a certain city. • Voronoi diagrams together with farthest-point Voronoi diagrams are used for efficient algorithms to compute the roundness of a set of points.[5] • The Voronoi approach is also put to good use in the evaluation of circularity/roundness while assessing the dataset from a coordinate-measuring machine. • In networking, Voronoi diagrams can be used in derivations of the capacity of a wireless network. • In climatology, Voronoi diagrams are used to calculate the rainfall of an area, based on a series of point measurements. In this usage, they are generally referred to as Thiessen polygons. • In ecology, Voronoi diagrams are used to study the growth patterns of forests and forest canopies, and may also be helpful in developing predictive models for forest fires. • In computational chemistry, Voronoi cells defined by the positions of the nuclei in a molecule are used to compute atomic charges. This is done using the Voronoi deformation density method. • In polymer physics, Voronoi diagrams can be used to represent free volumes of polymers. • In materials science, polycrystalline microstructures in metallic alloys are commonly represented using Voronoi tessellations. In solid state physics, the Wigner-Seitz cell is the Voronoi tessellation of a solid, and the Brillouin zone is the Voronoi tessellation of reciprocal (wave number) space of crystals which have the symmetry of a space group. • In mining, Voronoi polygons are used to estimate the reserves of valuable materials, minerals, or other resources. Exploratory drillholes are used as the set of points in the Voronoi polygons. • In computer graphics, Voronoi diagrams are used to procedurally generate organic or lava-looking textures. • In autonomous robot navigation, Voronoi diagrams are used to find clear routes. If the points are obstacles, then the edges of the graph will be the routes furthest from obstacles (and theoretically any collisions). • In machine learning, Voronoi diagrams are used to do 1-NN classifications.[10] Algorithms Related subjects ## Notes 1. ^ Franz Aurenhammer (1991). Voronoi Diagrams – A Survey of a Fundamental Geometric Data Structure. ACM Computing Surveys, 23(3):345–405, 1991 2. ^ Atsuyuki Okabe, Barry Boots, Kokichi Sugihara & Sung Nok Chiu (2000). Spatial Tessellations – Concepts and Applications of Voronoi Diagrams. 2nd edition. John Wiley, 2000, 671 pages ISBN 0-471-98635-6 3. ^ Daniel Reem, An algorithm for computing Voronoi diagrams of general generators in general normed spaces, In Proceedings of the sixth International Symposium on Voronoi Diagrams in science and engineering (ISVD 2009), 2009, pp. 144–152 4. ^ Daniel Reem, The geometric stability of Voronoi diagrams with respect to small changes of the sites, Full version: arXiv 1103.4125 (2011), Extended abstract in Proceedings of the 27th Annual ACM Symposium on Computational Geometry (SoCG ‏2011), pp. 254–263 5. ^ a b Mark de Berg, Marc van Kreveld, Mark Overmars, and Otfried Schwarzkopf (2008). Computational Geometry (Third edition ed.). Springer-Verlag. 7.4 Farthest-Point Voronoi Diagrams. Includes a description of the algorithm. 6. ^ Skyum, Sven (1991). "A simple algorithm for computing the smallest enclosing circle". Information Processing Letters 37(1991)121–125., contains a simple algorithm to compute the farthest-point Voronoi diagram. 7. ^ Edelsbrunner, Herbert (1987), "13.6 Power Diagrams", Algorithms in Combinatorial Geometry, EATCS Monographs on Theoretical Computer Science 10, Springer-Verlag, pp. 327–328. 8. ^ S. Arya, T. Malamatos, and D. M. Mount, Space-Efficient Approximate Voronoi Diagrams, Proc. 34th ACM Symp. on Theory of Computing (STOC 2002), pp. 721–730. 9. ^ Jooyandeh, Mohammadreza; Mohades, Ali; Mirzakhah, Maryam (2009). "Uncertain Voronoi Diagram". Information Processing Letters (Elsevier) 109 (13): 709–712. doi:10.1016/j.ipl.2009.03.007. 10. ^ Tom M. Mitchell (1997). Machine Learning (International Edition 1997 ed.). McGraw-Hill. p. 233. ISBN 0-07-042807-7. ## References • G. Lejeune Dirichlet (1850). "Über die Reduktion der positiven quadratischen Formen mit drei unbestimmten ganzen Zahlen". Journal für die Reine und Angewandte Mathematik 40: 209–227. • Voronoi, Georgy (1908). "Nouvelles applications des paramètres continus à la théorie des formes quadratiques". Journal für die Reine und Angewandte Mathematik 133: 97–178. doi:10.1515/crll.1908.133.97. • Atsuyuki Okabe, Barry Boots, Kokichi Sugihara & Sung Nok Chiu (2000). Spatial Tessellations – Concepts and Applications of Voronoi Diagrams. 2nd edition. John Wiley, 2000, 671 pages ISBN 0-471-98635-6 • Aurenhammer, Franz (1991). "Voronoi Diagrams – A Survey of a Fundamental Geometric Data Structure". ACM Computing Surveys 23 (3): 345–405. doi:10.1145/116873.116880. • Bowyer, Adrian (1981). "Computing Dirichlet tessellations". Comput. J. 24 (2): 162–166. doi:10.1093/comjnl/24.2.162. edit • Reem, Daniel (2009). "An algorithm for computing Voronoi diagrams of general generators in general normed spaces". Proceedings of the sixth International Symposium on Voronoi Diagrams in science and engineering (ISVD 2009). pp. 144—152. doi:10.1109/ISVD.2009.23.
2013-12-06 19:27:21
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 25, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.683620810508728, "perplexity": 602.7865145837046}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2013-48/segments/1386163052382/warc/CC-MAIN-20131204131732-00033-ip-10-33-133-15.ec2.internal.warc.gz"}
https://mystylit.com/miscellaneous/how-do-you-escape-square-brackets-in-latex/
# How do you escape square brackets in LaTeX? ## How do you escape square brackets in LaTeX? I realise this may be a stupid question, but the only way to escape things I know of is backslash. You don’t have to escape square brackets in text mode, just write [2007] EWCA Civ 1042 . $and$ start and end a displayed math equation, similar to \begin{equation*} and \end{equation*} . How do you escape characters in LaTeX? Outside \verb , the first seven of them can be typeset by prepending a backslash; for the other three, use the macros \textasciitilde , \textasciicircum , and \textbackslash . Note that the seven “single non-letter” macros don’t gobble the space following them. ### How do I show square brackets in LaTeX? To display the square brackets for an expression in a standard mathematical format of documents, we need to use the \left and \right command in our Latex file code. The \left command will use the “[“ sign after it, and the \right command will use the “]” sign after it. How do you escape curly braces in LaTeX? Braces and parentheses: Brackets and round parentheses can be used as is and shouldn’t be escaped, but curly braces (“{“,”}”) are used for grouping in TeX, and don’t get printed. To get curly braces in the output, you must use the escaped versions, “\{“, and “\}”. #### How do you escape a slash in LaTeX? Slash. LaTeX recognizes the ordinary (forward) slash ( / ), but treats words that contain it as one. For example, read/write isn’t split nor hyphenated. To overcome this problem, use \slash instead. How do you do curly brackets? On U.S. keyboards, the { and } (curly bracket) keys are shared with the [ or ] (square bracket) keys. To create the curly bracket, press and hold the Shift key, and then press the { or } key. ## How do you escape a bracket in Confluence? After entering the curly brace and the macro menu pops up, press the ESC key and the menu will go away leaving the curly brace there. How do you make a curly bracket in LaTeX? ### How does one break a line within a paragraph? There are two forms in which the line breaks in a paragraph while typesetting: 1. The \\ and \newline commands break the line at the point of insertion but do not stretch it. 2. The \linebreak command breaks the line at the point of insertion and stretches the line to make it of the normal width. How do you make a curly bracket in latex? #### How do you make a curly window bracket? There are several ways in which you could type curly braces. If it is a windows keyboard you can do (alt+123) for ‘{‘ and (alt+125) for ‘}’. On a Mac the shortcuts are (shift + alt + 8) for ‘{‘ and (shift + alt + 9) for ‘}’. How do you escape curly braces in Jira? ## How do I escape in Jira? The only way to achieve in-line escaping currently is to use the backslash before each special character. A custom macro, deployed as an atlassian add-on, would give you what you need. What are the {} brackets called? curly brackets The “{}” are referred to as curly brackets or braces while “<>” are often called angle brackets or braces. The term “curly braces” is more favored in the U.S., while “brackets” is more widely used in British English. ### What are <> brackets called? Parentheses Parentheses ( ) Parentheses, sometimes called round brackets or just brackets, are the most common brackets in business writing. How do I control the size and style of brackets in latex? You can easily control the size and style of brackets in LaTeX; this article explains how. Here’s an table of listing some common math braces and parentheses used in LaTeX : The size of brackets and parentheses can be manually set, or they can be resized dynamically in your document, as shown in the next example: #### How do I type math brackets and parentheses in latex? Here’s how to type some common math braces and parentheses in LaTeX : The size of brackets and parentheses can be manually set, or they can be resized dynamically in your document, as shown in the next example: Notice that to insert the parentheses or brackets, the \\left and \\right commands are used. How to escape special characters from a block? Just in case anyone is looking for another way to escape special characters, this can be done with the listings package. Since all characters will be displayed as they are, it is not possible to execute any command inside the block. Update: the inline listing \\lstinline supports the math mode by including the mathescape option.
2023-01-27 14:56:23
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9236267805099487, "perplexity": 2041.1910872505593}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2023-06/segments/1674764494986.94/warc/CC-MAIN-20230127132641-20230127162641-00152.warc.gz"}
https://computergraphics.stackexchange.com/tags/curve/hot
The Stack Overflow podcast is back! Listen to an interview with our new CEO. # Tag Info 9 All conics (including rotated ellipses) can be described by an implicit equation of the form H(x, y) = A x² + B xy + C y² + D x + E y + F = 0 The basic principle of the incremental line tracing algorithms (I wouldn't call them scanline) is to follow the pixels that fulfill the equation as much as possible. Depending on the local slope of the line, you ... 9 The classic book Computer Graphics: Principles and Practice (second edition) by Foley, van Dam, et al. describes such an algorithm in section 19.2. The explanation in the book seems to come from an MSc thesis, Raster Algorithms for 2D Primitives by Dilip Da Silva. See also these papers: Curve-drawing algorithms for raster displays by Van Aken and Novak (... 9 There is really no good way of doing this efficiently analytically for all corner cases. Most or all commercial 2D renderers that attempt to do analytic coverage calculation make predictable errors that multisampling methods do not. A typical problem is two overlapping shapes that share the same edge. The common situation is that alpha channels sum up to a ... 7 What you (probably) want to achieve is something like this: When having a closer look at one of the corners and add a few lines, we see this: The black lines indicate that the center points of the circles along the borders of the red and blue boxes is the same. If the outer radius of the red box, for example, is $50px$, and the distance between the outer ... 6 Ignoring Non-uniform B-splines (rational or not), I have had some experience with rasterisation of Beziers and, since there is a trivial mapping from Uniform B-Splines to Beziers, those too. I have used two different techniques: The first was a scan-line renderer that used Newton-Rhapson to compute the intersection of the current scanline with the curve. ... 6 You have an instance of a problem called curve reconstruction from unorganized points. Now that you know what to search for you'll find several methods, such as the crust, NN-crust, etc. Here are a few links: The Crust Curve Reconstruction Applet Curve Reconstruction by Tamal Dey Curve and Surface Reconstruction: Algorithms with Mathematical Analysis, book ... 5 What you want is linear interpolation like @Tim points out. However he uses a formula that is not so easily understandable form, we can refactor it differently. Basically linear interpolation is a weighted average where the weight of the first term is in range of 0-1 and the weight of the other value is 1-weight. Literature usually uses t for the weight and ... 5 The math you need is linear interpolation. I think of a player sprite which moves from position X to position Y. Pseudocode: playerSprite.x = Y.x + t * (X.x - Y.x) playerSprite.y = Y.y + t * (X.y - Y.y) where t is a value between 0.0 and 1.0 (floating point). Instead of incrementing the position components of Y you increment t till it reaches 1. When it ... 5 One way I can think of is to make a "signed distance transform" of the image where there is information for each pixel about how far the pixel is to the closest surface of the shape. Since it's signed, youll be able to know if the pixel is inside or outside he shape, and by how much. Using this knowledge, you could easily make a new image, where the pixel ... 4 Ok, monotonic interpolation depends on what you are monotonic about. For a simple 1D function interpolation monotonicity is easy to define. But for a 2D and 3D dataset its not so self evident what the situation would be. First you could interpolate along a independent variable t in which case your monotonicity is most probably in relation to t. This is the ... 4 After some clarifications, there is probably a much better approach that doesn't even require knowing the parametric form of the curve, and also avoids the potentially problematic numeric minimisation step. If the curve does not intersect itself and the points are sufficiently densely packed on the curve (and by that I mean they have to be closer than any ... 3 Most software rendering engines dice the parametric primitives to micropolygons, usually on the fly as needed. In essence this reduces the needed complexity to determine intersections. The surface will still look smooth, since each polygon is smaller than a pixel. This allows for Data caching. Discrete geometric derivates. Displacement is easy to ... 3 Since you've only got floating-point representations of the points, there is no guarantee that these still lie exactly on the curve, due to rounding errors. So I think the only generic approach is to approximate where on the curve they were, by finding the closest point on the curve to your sample $(X,Y,Z)$. E.g. if your parametric curve is $(x(t), y(t), z(t)... 3 Subdivision can be used for curves in 2D just as easily as for surfaces in 3D. Usually the subdivision algorithms applied to 2D are called subdivision curves. Subdivision curves do not suffer from the problem that subdivision surfaces have around extraordinary points and therefore all subdivision surfaces can easily be converted to (uniform) B-splines. This ... 3 Quoting the comments above for context: Just to confirm, are you asking, given a set of$N$CatRom control points, $$\{CR_0, CR_1, CR_2, CR_3 ... CR_{n-1}\}$$ forming a piecewise curve, what is the equivalent$N$points, $$\{B_0,B_1,B_2...B_{n-1}\}$$ for a matching piecewise uniform cubic bspline? Exactly. That is what I'm looking for. I think ... 2 No,$B$is constant for given type of cubic spline, e.g. B-spline, Bezier, Hermite or Catmull-Rom cubic splines have different$B$matrix. To make B-spline continuous, you need to copy 3 control points from the previous spline segment$a$to the control points of spline segment$b$and add a new point as the last control point of$b$such that:$Pb_{i-3}=... 2 No, the $B$ matrix (basis coefficient matrix) does not change from one segment to the next. It is a property of the type of spline you're using, in this case cubic B-splines. If you used Bézier splines or Hermite splines instead, you'd have a different $B$ matrix. 2 I have no knowledge of the literature on the topic, but I did something very similar to what you're asking some time ago: I wanted to generate lathe meshes and bend them according to a spline. I think the same technique could be adapted to your case quite easily. First you would need to define what your default axis is: if the input mesh corresponds to the ... 2 In line 15 use the half-open interval, i.e., if u>=t[0][i] and u<t[0][i+1]: Otherwise, at knot values, you evaluate two basis functions at the k=1 basis when you only want one. This causes the wrong evaluation of the basis function at the knot values and therefore the spikes. 1 For a function $y = f(x)$ the (signed) curvature at $x$ is given by: $$\kappa(x) = \frac{f''(x)}{(1+f'^2(x))^{\frac{3}{2}}}$$ If you assume that the slope is very small compared to $1$: $f'^2<\!<1$, then: $$k(x) \approx f''(x)$$ Suppose you are given data points ($x_0<x_1<\cdots<x_N$): $$(x_0,y_0), (x_1,y_1), ..., (x_N, y_N)$$ You ... 1 Splines confuse me which is one reason I asked somebody else to write that chapter. But I like this explanation: https://www.johndcook.com/blog/2009/02/06/the-smoothest-curve-through-a-set-of-points/ 1 What you're looking for is called de Boor's algorithm. It lets you compute a point on a b-spline curve by doing a series of linear interpolation (LERP) calculations. So, it works very much like the de Casteljau algorithm for Bezier curves. In fact, the de Casteljau algorithm is a special case of de Boor's algorithm. A link Another one And another Only top voted, non community-wiki answers of a minimum length are eligible
2019-10-20 18:39:49
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.7225217223167419, "perplexity": 596.4435996703827}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-43/segments/1570986718918.77/warc/CC-MAIN-20191020183709-20191020211209-00128.warc.gz"}
https://gateoverflow.in/313539/gate2019-ec-ga-10
1,093 views Five people $P,Q,R,S$ and $T$ work in a bank. $P$ and $Q$ don't like each other but have to share an office till $T$ gets a promotion and moves to the big office next to the garden. $R,$ who is currently sharing an office with $T$ wants to move to the adjacent office with $S,$ the handsome new intern. Given the floor plan, what is the current location of $Q, R$ and $T?$ (O=Office, WR=Washroom) Migrated from GO Electronics 3 years ago by Arjun "$R,$ who is currently sharing an office with $T$" This is happening only in option C. Correct option C. by
2022-09-29 05:05:56
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.20187057554721832, "perplexity": 1604.5781710928602}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2022-40/segments/1664030335304.71/warc/CC-MAIN-20220929034214-20220929064214-00719.warc.gz"}
https://stacks.math.columbia.edu/tag/09YE
Lemma 5.15.7. Let $X$ be a topological space. Let $Z \subset X$ be a closed subset such that $X \setminus Z$ is quasi-compact. Then for a constructible set $E \subset X$ the intersection $E \cap Z$ is constructible in $Z$. Proof. Suppose that $V \subset X$ is retrocompact open in $X$. It suffices to show that $V \cap Z$ is retrocompact in $Z$ by Lemma 5.15.3. To show this let $W \subset Z$ be open and quasi-compact. The subset $W' = W \cup (X \setminus Z)$ is quasi-compact, open, and $W = Z \cap W'$. Hence $V \cap Z \cap W = V \cap Z \cap W'$ is a closed subset of the quasi-compact open $V \cap W'$ as $V$ is retrocompact in $X$. Thus $V \cap Z \cap W$ is quasi-compact by Lemma 5.12.3. $\square$ In your comment you can use Markdown and LaTeX style mathematics (enclose it like $\pi$). A preview option is available if you wish to see how it works out (just click on the eye in the toolbar).
2023-03-20 09:41:01
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 2, "x-ck12": 0, "texerror": 0, "math_score": 0.9800315499305725, "perplexity": 193.83845664899965}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2023-14/segments/1679296943471.24/warc/CC-MAIN-20230320083513-20230320113513-00028.warc.gz"}
https://www.albert.io/ie/ap-statistics/mean-and-standard-deviation-difference-for-two-random-variables
? Free Version Moderate # Mean and Standard Deviation Difference for Two Random Variables. APSTAT-LZLLJD Random variable A is normally distributed with a mean of 20 and a standard deviation of 5. Random variable B is normally distributed with a mean of 35 and a standard deviati​on of 12. If A and B are independent variables which of the following describes the distribution of A $-$ B? A Normal with a mean of -15 and a standard deviation of -7 B Normal with a mean of -15 and a standard deviation of 13 C Normal with a mean of -15 and a standard deviation of 17 D Normal with a mean of 15 and a standard deviation of -7 E Normal with mean of 15 and a standard deviation of 17
2016-12-09 19:27:16
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.8027558922767639, "perplexity": 128.78545980136965}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2016-50/segments/1480698542765.40/warc/CC-MAIN-20161202170902-00085-ip-10-31-129-80.ec2.internal.warc.gz"}
https://blog.lunit.io/2017/08/07/aspect-augmented-adversarial-networks-for-domain-adaptation/
Paper Review “Aspect-augmented Adversarial Networks for Domain Adaptation” by Yuan Zhang, Regina Barzilay and Tommi Jaakkola (TACL 2017) Overview The goal of this paper is to apply adversarial training to domain transfer. More specifically, the paper addresses a somewhat restricted situation where we have a shared, single task we want to solve on two different domains, with the additional constraint that only one domain has classification labels that can be used for supervision. For instance, we would like to train a classifier on the brain cancer domain but still have it work just as well for the asthma domain, or we could train a classifier on the restaurant reviews domain but still have it work on a book review domain. The key to solving this is to give our classifier model the ability to avoid using domain-specific clues in its prediction. The authors utilize adversarial loss to achieve this goal. However, it is not easy to train models using adversarial loss because the adversarial objective can run counter to the standard supervision objective, providing destructive gradients. To address this issue many architectural modifications are introduced to balance the two objectives. Model A) Document Classification Let’s start with a brief overview of a document classification model. A document classification model takes some document, such as a pathology report, and through one or more mapping functions turns it into an encoded vector (a.k.a encoding/embedding/representation). A classifier then takes this output, and tries to decide which class the vector belongs to. Figure 1 shows a snippet of an example input document used in this paper. What if we don’t have labels for a domain? We can perform domain adaptation. A standard approach in deep learning is to learn domain-independent representations of the data by a shared auto-encoder and then training a classifier on it. The paper proposes a method using adversarial loss to achieve domain adaptation without resorting to a two-stage pipeline involving an auto-encoder. C) Details of the Model Figure 2 illustrates the overall model and its components. 2. Transformation Layer for Domain Invariance 3. Semi-supervised Sentence Level Attention for Aspect Awareness 4. Word Level Reconstruction Loss • Semi-supervised Sentence Level Attention for Aspect Awareness In the pathology dataset used in this paper, a single document contained multiple domains: That is, each domain is an ‘aspect’ of the text of the pathology report. For example, a single report can contain descriptions about both Invasive Ductal Carcinoma (IDC) and Atypical Lobular Hyperplasia (ALH). We need a way to pull apart these aspects when we encode the documents, otherwise the label predictor will try to draw from information about both aspects, when only one aspect is ever relevant to the classification at hand. The proposed solution is to use a sentence relevance module, shown as the middle part of the ‘Document encoder’ (shown in green) in Figure 2. The authors heuristically generated relevance scores of each sentence w.r.t each aspect for every sentence in every document. The score was set to 1 if the sentence included at one or more of that aspect’s keywords, 0 otherwise. The keywords were determined heuristically by human medical experts. These relevance labels were used as targets for the relevance score regression submodule of the document encoder, with a loss defined as: If there are $n$ aspects in the document, this relevance score predictor will output $n$-way classification scores. To produce a document embedding for the $l^{th}$ document in aspect $a$, whose sentences are indexed by $i$, we sum the sentence embeddings weighted by their relevance scores $\hat{r}^{a}_{l,i}$ : • Transformation Layer for Domain Invariance The relevance weighted document embedding is passed through a transformation layer. This additional transformation is there to further erase any domain specific information. The transformation is defined by : with an additional strong regularization term to discourage significant deviation away from identity. This regularizer helps to prevent the adversarial gradient wipe out the document signal : The effectiveness of the regularizer is shown in Table 7: $\lambda^{t}=\infty$ represents the removal of the transformation layer, while $\lambda^{t}=0$ represents a transformation layer without any regularization. As we can see, finding a suitable regularization value for the transformation layer results in the best performance, indicating the importance of balancing the adversarial objective again. • Word Level Reconstruction Loss The ideal training scenario is that the document embeddings stay as informative as possible, and only the aspect specific information that can provide hints to the aspect adversary is erased. However the model could easily fall into the trap of accomplishing the aspect adversarial objective by simply making embeddings less informative overall, for instance by erasing features. The authors propose to address this problem via a word level auto-encoder, shown in Figure 3. The reconstruction objective is stated as the following : where $h_{i,j}$ is the convolution output with $x_{i,j}$ at the center. Table 6 shows that this word level reconstruction loss indeed improves performance. In Figure 4, they also show that their assumption about the destructive effect of adversarial loss was correct. The first matrix shows that without adversarial loss, the document embeddings from the two aspects (top half and bottom half), are relatively easily distinguishable. When we add adversarial loss, we can see, in the second matrix, that the two aspects are now indistinguishable. Unfortunately, the embeddings have also become extremely sparse. Finally, in the third matrix, adding the reconstruction loss makes the embeddings denser again, while still making the two aspects hard to distinguish. • Label classifier The label classifier minimizes a standard cross entropy loss over classes $k$ over documents $l$. Since labels only exist in the source aspect, the label classifier is defined only on the source data. $\hat{p}_{l;k}$ indicates the predicted probability of document $l$  belonging to class $k$, and $[y^{s}_{l;1}...y^{s}_{l;m}]$ are one-hot vectors indicating which class document $l$ belongs to in the source aspect: • Domain classifier The domain classifier attempts to figure out which aspect/domain a document belongs to. It will minimizes the cross entropy loss on the one-hot aspect label $y^{a}_{k}$ . $\hat{q}(x^{tr,a}_{l})$ is the aspect probability predicted from the aspect relevance weighted encoding of the input. • End-to-End training All objectives are jointly optimized, end-to-end. It should be pointed out that the domain adversary network itself always minimizes $L^{dom}$ w.r.t its own parameters. The $-\rho L^{dom}$ term in (8) reflects the fact that the gradients originating from the domain adversary are reversed in sign before being back-propagated to encourage the learning of domain-invariant features. Results The results, shown in Table 4, demonstrate that the combination of semi-supervised aspect separation and aspect adversarial loss was effective in producing domain-independent document representations. • Effect of Relevance Scoring and Adversarial Loss Ours-NR is identical to the full model, except that the relevance scoring module was omitted. We see that without the relevance scoring module making aspect-differentiation possible, the performance of the model drops dramatically. The results of Ours-NA, which is the full model with the adversarial loss module removed, show that the adversarial loss is indeed effective, once the relevance scoring module makes aspect-differentiation possible. Together, the combination of these two modules makes the full model’s performance quite close to In-Domain, which is the model trained with supervision in both domains. Conclusion In this post, we saw how an adversarial objective can be used to learn domain-independent representations of the input. We also saw that it can be beneficial to consider the balance between a supervision objective and an adversarial objective when designing such models.
2022-01-20 23:23:03
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 21, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.6963826417922974, "perplexity": 1367.935010117354}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2022-05/segments/1642320302706.62/warc/CC-MAIN-20220120220649-20220121010649-00221.warc.gz"}
http://www.chegg.com/homework-help/questions-and-answers/i-understand-finding-angle-966-till-youplug-values-969-divided-anumber-i-t-figure-came--iu-q185890
## Finding the angle I understand finding the angle φ till the part where youplug in the values.  In where ω is, it is divided by anumber that I can't figure out where it came from.  Iunderstand that ω needs to put into degrees, but again, Ican't figure out where the value came from in thedenominator.  Please explain. Thanks!
2013-05-25 01:04:31
{"extraction_info": {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9862343072891235, "perplexity": 2462.1519855995266}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.3, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2013-20/segments/1368705305291/warc/CC-MAIN-20130516115505-00062-ip-10-60-113-184.ec2.internal.warc.gz"}
https://mathhelpboards.com/threads/invariant-pde.1898/
# [SOLVED]invariant PDE #### dwsmith ##### Well-known member Show the diffusion equation is invariant to a linear transformation in the temperature field $$\overline{T} = \alpha T + \beta$$ Since $\overline{T} = \alpha T + \beta$, the partial derivatives are \begin{alignat*}{3} \overline{T}_t & = & \alpha T_t\\ \overline{T}_{xx} & = & \alpha T_{xx} \end{alignat*} So $T_t = \frac{1}{\alpha}\overline{T}_t$ and $T_{xx} = \frac{1}{\alpha}\overline{T}_{xx}$. The diffusion equation is $$\frac{1}{\alpha}T_t = T_{xx}.$$ By substitution, we obtain $$\frac{1}{\alpha}\overline{T}_t = \overline{T}_{xx}.$$ Correct? #### girdav ##### Member Yes, as the set of solutions of such an equation is a vector space which contains constant functions. #### dwsmith ##### Well-known member Yes, as the set of solutions of such an equation is a vector space which contains constant functions. So that is all that it was? It seems to simple. #### girdav ##### Member It may be for example the first question of a homework or a test, so it's not necessarily difficult. (maybe maybe the other question can be harder) #### Jester ##### Well-known member MHB Math Helper So that is all that it was? It seems to simple. Yes, it may be simple (in this case) but there's a deeper meaning. It means, given one solution $T_0$, you can construct a second solution $T = \alpha T_0 + \beta$. You might also want to check that this same PDE is invariant under the change of variables $\bar{t} = k^2 t,\;\;\; \bar{x} = k x$ i.e. $T_{\bar{t}}=\alpha T_{\bar{x} \bar{x}} \;\; \implies \;\; T_t = \alpha T_{xx}$. The next question $-$ how is this useful?
2020-09-22 20:46:07
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9299425482749939, "perplexity": 799.8351051284907}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 5, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2020-40/segments/1600400206763.24/warc/CC-MAIN-20200922192512-20200922222512-00355.warc.gz"}
https://stat.ethz.ch/R-manual/R-devel/library/MASS/html/leuk.html
leuk {MASS} R Documentation ## Survival Times and White Blood Counts for Leukaemia Patients ### Description A data frame of data from 33 leukaemia patients. ### Usage leuk ### Format A data frame with columns: wbc white blood count. ag a test result, "present" or "absent". time survival time in weeks. ### Details Survival times are given for 33 patients who died from acute myelogenous leukaemia. Also measured was the patient's white blood cell count at the time of diagnosis. The patients were also factored into 2 groups according to the presence or absence of a morphologic characteristic of white blood cells. Patients termed AG positive were identified by the presence of Auer rods and/or significant granulation of the leukaemic cells in the bone marrow at the time of diagnosis. ### Source Cox, D. R. and Oakes, D. (1984) Analysis of Survival Data. Chapman & Hall, p. 9. Taken from Feigl, P. & Zelen, M. (1965) Estimation of exponential survival probabilities with concomitant information. Biometrics 21, 826–838. ### References Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer. ### Examples library(survival) plot(survfit(Surv(time) ~ ag, data = leuk), lty = 2:3, col = 2:3) # now Cox models leuk.cox <- coxph(Surv(time) ~ ag + log(wbc), leuk) summary(leuk.cox) [Package MASS version 7.3-58.3 Index]
2023-03-23 15:02:29
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.21025656163692474, "perplexity": 14629.318506895608}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": false}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2023-14/segments/1679296945168.36/warc/CC-MAIN-20230323132026-20230323162026-00696.warc.gz"}
https://www.gamedev.net/forums/topic/637170-for-loop-that-will-repeat-the-number-of-times-the-user-wants/
# for loop that will repeat the number of times the user wants. This topic is 1835 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic. ## Recommended Posts How do i write a for loop that will repeat the number of times the user wants it too when asked by the console? ##### Share on other sites It would be nice to know what language you're using. I'll assume C++: #include <iostream> void main() { int repeat; std::cin >> repeat; std::cout << std::endl; for(int i = 0; i < repeat; i++) std::cout << "repeat\n"; } ##### Share on other sites sorry java thanks that helped figured it out Edited by SmallTallGiant ##### Share on other sites The code for the for loop will be the same but here: //imported crap and other code Scanner scan = new Scanner(System.in); int numLoops; System.out.print("How many loops?"); numLoops = scan.nextInt(); for(int i = 0; i < numLoops; ++i){ //do whatever you need to and loop as many times as the user entered for numLoops } you can do the same thing with a while loop (or do while), but the for loop has everything working in one line, where the while loops will take a couple. Hope this helps Edited by Mathew Bergen ##### Share on other sites [quote name='Mathew Bergen' timestamp='1357979039' post='5020618'] where the while loops will take a couple [/quote] Remember C/C++ and as far as I know Java too, don't use line endings a seperators. You can happily write your whole application in one line, as long as the compiler supports it and you don't miss any semicolons. ##### Share on other sites where the while loops will take a couple Remember C/C++ and as far as I know Java too, don't use line endings a seperators. You can happily write your whole application in one line, as long as the compiler supports it and you don't miss any semicolons. I understand his, however i said this because the only time i put more than one  "line" of code on one line, is in simple switch statements,   switch(choice){        case 1: /*goto function*/ break;        ... }   and in the code that other people write, i have never seen more that one "line" of code on a  single line. And if you where to write a whole application on one line, it would be very confusing, unless it was a hello world program.
2018-01-21 23:35:49
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.21707382798194885, "perplexity": 2706.3291450444035}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2018-05/segments/1516084890893.58/warc/CC-MAIN-20180121214857-20180121234857-00353.warc.gz"}
https://www.cheenta.com/number-theory-cyprus-imo-tst-2018-problem-1/
Select Page # Understand the problem Determine all integers $n \geq 2$ for which the number $11111$ in base $n$ is a perfect square. ##### Source of the problem Cyprus IMO TST 2018, Problem 1 Number Theory 7/10 ##### Suggested Book Challenges and Thrills of Pre College Mathematics Do you really need a hint? Try it first! Let us write the problem in Mathematical Language i.e. in the form of equations.  $(11111)_n$ in base n $= 1 + n + n^2 + n^3 + n^4$. So, the problem reduces to finding positive integer solutions to $m^2 = 1 + n + n^2 + n^3 + n^4$. The idea is that we will try to bound the $1 + n + n^2 + n^3 + n^4$ in between some squares and from that we will try to estimate the values of m in terms of n. Observe that$(2m)^2=4n^4+4n^3+4n^2+4n+4.$ Now, can you form squares from the right side?  If not can you bound it by two squares? First of all to form, you take the max terms $4n^4 = (2n)^2$. So, that term must be included in the square. Also, try to find a, b, c such that $(2n^2 + an + b)^2$ can be made greater or lesser the given expression.  Observe that you will get the following. $(2n^2+n)^2<4n^4+4n^3+4n^2+4n+4<(2n^2+n+2)^2$ Now, guess that  $(2n^2+n)^2<(2m)^2<(2n^2+n+2)^2$ So, what we get the relationship of m and n? We get that $(2m) = (2n^2 + n + 1)$. Hence,  $(2m)^2=(2n^2+n+1)^2 \Leftrightarrow 4n^4+4n^3+4n^2+4n+4=(2n^2+n+1)^2.$ Observe that, this results in a lot of cancellation of terms and we are left with:  $n^2-2n-3=0.$This gives the solution (m,n) = (11, 3) # Connected Program at Cheenta Math Olympiad is the greatest and most challenging academic contest for school students. Brilliant school students from over 100 countries participate in it every year. Cheenta works with small groups of gifted students through an intense training program. It is a deeply personalized journey toward intellectual prowess and technical sophistication. # Similar Problems ## Problem on Series | SMO, 2009 | Problem No. 25 Try this beautiful problem from Singapore Mathematics Olympiad, SMO, 2009 based on Problem on Series. You may use sequential hints to solve the problem. ## Area of The Region | AMC-8, 2017 | Problem 25 Try this beautiful problem from Geometry: The area of the region, AMC-8, 2017. You may use sequential hints to solve the problem. ## Area of the figure | AMC-8, 2014 | Problem 20 Try this beautiful problem from Geometry:Area inside the rectangle but outside all three circles.AMC-8, 2014. You may use sequential hints to solve the problem ## Squares and Triangles | AIME I, 2008 | Question 2 Try this beautiful problem from the American Invitational Mathematics Examination I, AIME I, 2008 based on Squares and Triangles. ## Percentage Problem | AIME I, 2008 | Question 1 Try this beautiful problem from the American Invitational Mathematics Examination I, AIME I, 2008 based on Percentage. you may use sequential hints. ## Smallest Positive Integer | PRMO 2019 | Question 14 Try this beautiful problem from the Pre-RMO, 2019 based on Smallest Positive Integer. You may use sequential hints to solve the problem. ## Complex Numbers and Triangles | AIME I, 2012 | Question 14 Try this beautiful problem from the American Invitational Mathematics Examination I, AIME I, 2012 based on Complex Numbers and Triangles. ## Triangles and Internal bisectors | PRMO 2019 | Question 10 Try this beautiful problem from the Pre-RMO, 2019 based on Triangles and Internal bisectors. You may use sequential hints to solve the problem. ## Angles in a circle | PRMO-2018 | Problem 80 Try this beautiful problem from PRMO, 2018 based on Angles in a circle. You may use sequential hints to solve the problem. ## Circles and Triangles | AIME I, 2012 | Question 13 Try this beautiful problem from the American Invitational Mathematics Examination I, AIME I, 2012 based on Circles and triangles.
2020-04-09 23:33:39
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 8, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.4146014451980591, "perplexity": 2000.157043307066}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2020-16/segments/1585371880945.85/warc/CC-MAIN-20200409220932-20200410011432-00132.warc.gz"}
https://thewolfsound.com/sound-synthesis/wavetable-synthesis-algorithm/
How to generate sound in code using the wavetable synthesis technique? • how to generate sound using wave tables, • step-by-step wavetable synthesis algorithm (also known as fixed-waveform synthesis [7]), • what are pros and cons of wavetable synthesis, and • how is wavetable synthesis related to other synthesis methods. In the follow-up articles, an implementation of this technique in the Python programming language, the JUCE framework, and the Rust programming language are presented. ## A Need for a Fast and Efficient Synthesis Method Computer-based sound synthesis is the art of generating sound through software. In the early days of digital sound synthesis, sound was synthesised using specialized digital signal processing hardware. Later on, the community started using software for the same purposes but the underlying principles and algorithms remained the same. To obtain real-time performance capabilities with that technology, there was a great need to generate sound efficiently in terms of memory and processing speed. Thus, the wavetable technique was convceived: it is both fast and memory-inexpensive. ## From Gesture to Sound The process of generating sound begins with a musician’s gesture. Let’s put aside who a musician might be or what kind of gestures they perform. For the purpose of this article, a gesture could be as simple as pressing a key on a MIDI keyboard, clicking on a virtual keybord’s key, or pressing a button on any controller device. Figure 1. In sound synthesis, a gesture of a musician controls the sound generation process. A gesture provides control information. In the case of pressing a key on a MIDI keyboard, control information would incorporate information on which key was pressed and how fast was it pressed (velocity of a keystroke). We can change the note number information into frequency $f$ and the velocity information into amplitude $A$. This information is sufficient to generate sound using most of the popular synthesis algorithms. ## Sine Generator Let’s imagine that given frequency and amplitude information we want to generate a sine wave. The general formula of a sine waveform is $s(t) = A \sin (2 \pi f t + \phi), \quad (1)$ where $f$ is the frequency in Hz, $A$ is the amplitude in range $[0, 1]$, $t$ is time in seconds, and $\phi$ is the initial phase, which we will ignore for now (i.e., assume that $\phi=0$). As we discussed in the digital audio basics article, digital audio operates using samples rather than physical time. The $n$-th sample occurs at time $t$ when $n = f_s t, \quad (2)$ where $f_s$ is the sampling rate, i.e., the number of samples per second that the system (software or hardware) produces. After inserting Equation 2 into Equation 1, we obtain the formula for a digital sine wave $s[n] = A \sin (2 \pi f n / f_s), \quad (3)$ How to compute the $\sin$ in the above formula? In programming languages (and any calculators for that matter), we often have a sin() function, but how does it compute its return value? sin() calls use the Taylor expansion of the sine function [1] $\sin(x) = x - \frac{x^3}{3!} + \frac{x^5}{5!} - \frac{x^7}{7!} \dots \quad (4)$ Above expansion is infinite, so on real-world hardware, it needs to be truncated at some point (after obtaining sufficient accuracy). Its advantage is, that it uses operations realizable in hardware (multiplication, division, addition, subtraction). Its disadvantage is that it involves a lot of these operations. If we need to produce 44100 samples per second and want to play a few hundred sines simultaneously (what is typical of additive synthesis), we need to be able to compute the $\sin$ function more efficiently than with Taylor expansion. ## A Wave Table A wave table is an array in memory in which we store a fragment of a waveform. A waveform is a plot of a signal over time. Thus, one period of a sine wave stored in memory looks as follows: Figure 2. A wave table with 64 samples of the sine waveform. The above wave table uses 64 samples to store one period of the sine wave. These values can be calculated using the Taylor expansion because we compute them only once and store them in memory. $\sin$ period is exactly $2 \pi$. The period of a wave table is its length, let’s denote it by $L$. For each sample index $k \in \{0, \dots, L-1\}$ in the wave table, there exists a corresponding argument $\theta \in [0, 2\pi)$ of the sine function. $\frac{k}{L} = \frac{\theta}{2 \pi}. \quad (5)$ The above equation tells us that there is a mapping between the values in the wave table and the values of the original waveform. ## Computing a Waveform Value from the Wave Table Equation 5 holds for $\theta \in [0, 2\pi)$. If we want to calculate the values of arbitrary $x \in \mathbb{R}$, we need to remove the multiplicity of $2 \pi$ contained in $x$ to bring it to the $[0, 2\pi)$ range. In other words, if $x = 2\pi l + \phi_x, \quad \phi_x \in [0, 2\pi), \quad (6)$ then we want to find $\phi_x$. In software, it can be done by subtracting or adding $2 \pi$ to $x$ until we obtain a value in the desired range. Alternatively, we can use a function called fmod(), which allows us to obtain the remainder of a floating-point division. We can subsequently compute the corresponding index in the wave table from the proportion in Equation 5. $k = \frac{\phi_x L}{2\pi}. \quad (7)$ Now waveTable[k] should return the value of $\sin(x)$, right? There is one more step that we need… ## What If $k$ Is Non-Integer? In most cases, $k$ computed in Equation 7 won’t be an integer. It will rather be a floating-point number between some two integers denoting the wave table indices, i.e., $i <= k < i+1, \quad i \in \{0, \dots, L-1\}, k \in [0, L)$. To make $k$ an integer, we have 3 options: • truncation (0th-order interpolation): removing the non-integer part of $k$, a.k.a. floor(k), • rounding: rounding $k$ to $i$ or $i+1$, whichever is nearest, a.k.a. round(k), • linear interpolation (1st-order interpolation): computing a weighted sum of the wave table values at $i$ and $i+1$. The weights correspond to $k$’s distance to $i+1$ and $i$ respectively, i.e., we return (k-i)*waveTable[i+1] + (i+1 - k)*waveTable[i], • higher-order interpolation: too expensive and unnecessary for wavetable synthesis. Each recall of a wave table value is called a wave table lookup. ## Wave Table Looping We know how to efficiently compute a waveform’s value for an arbitrary argument. In theory, given amplitude $A$, frequency $f$, and sampling rate $f_s$, we are able to evaluate Equation 3 for any integer $n$. Using different wave tables, we can obtain different waveforms. It means we can generate an arbitrary waveform at an arbitrary frequency! Now, how to implement it algorithmically? Thanks to the information on $f$ and $f_s$, we don’t have to calculate the $2 \pi f n / f_s$ argument of $\sin$ in Equation 3 for each $n$ separately. $n$ gets incremented by 1 on a sample-by-sample basis, so as long as $f$ does not change (i.e., we play at a constant pitch), the argument of $\sin$ gets incremented in a predictable manner. Actually, the argument $2 \pi f n / f_s + \phi$ is called the phase of the sine (again, in our considerations $\phi=0$). The difference between the phase of the waveform for neighboring samples is called a phase increment and can be calculated as $\theta_\text{inc}(f) = 2 \pi f (n+1) / f_s - 2 \pi f n / f_s = 2 \pi f / f_s. \quad (8)$ $\theta_\text{inc}(f)$ depends explicitly on $f$ (tone frequency) and implicitly on $f_s$ (which typically remains unchanged during processing so we can treat it as a constant). With $\theta_\text{inc}(f)$ we can initialize a phase variable to 0 and increment it by $\theta_\text{inc}(f)$ after generating each sample. When a key is pressed we reset phase to 0, calculate $\theta_\text{inc}(f)$ according to the pitch of the pressed key, and start producing the samples. ### Index Increment Having the information on phase increment, we can calculate the index increment, i.e., how the index to the wave table changes with each sample. $k_\text{inc} = (k+1) - k = \frac{(\phi_x + \theta_\text{inc})L}{2\pi} - \frac{\phi_x L}{2\pi} \\= \frac{\theta_\text{inc} L}{2\pi} = \frac{fL}{f_s}. \quad (9)$ When a key is pressed, we set an index variable to 0. For each sample, we increase the index variable by $k_\text{inc}$ and do a lookup. As long as the key is pressed, $k_\text{inc}$ is nonzero and we perform the wave table lookup. When index exceeds the wave table size, we need to bring it back to the $[0, L)$ range. In implementation, we can keep subtracting $L$ as long as index is greater or equal to $L$ or we can use the fmod operation. This “index wrap” results from the phase wrap which we discussed below Equation 5; since the signal is periodic, we can shift its phase by the period without changing the resulting signal. ### Phase Increment vs Index Increment Phase increment and index increment are two sides of the same coin. The former has a physical meaning, the latter has an implementational meaning. You can increment the phase and use it to calculate the index or you can increment the index itself. Index increment is more efficient because we don’t need to perform the multiplication by $L$ and the division by $2\pi$ for each sample (Equation 7); we calculate only the increment when the instantaneous frequency changes. We’ll therefore restrict ourselves to the implementations using the index increment. ## Wavetable Synthesis Algorithm Below is a schematic of how wavetable synthesis using index increment works. Figure 3. A diagram of the wavetable synthesis algorithm using index increment. After [2]. $k_\text{inc}[n]$ is the increment of the index into the wave table. It is denoted as a digital signal because in practice it can be changed on a sample-by-sample basis. It is directly dependent on the frequency of the played sound. If no sound is played $k_\text{inc}[n]$ is 0 and the index should be reset to 0. Alternatively, one could specify that if no sound is played this diagram is inactive (no signals are supplied to or taken from it). For each new output sample, index increment is added to the index variable stored in a single-sample buffer (denoted by $z^{-1}$ as explained in the article on delays). This index is then “brought back” into the range of wavetable indices $[0, L)$ using the fmod operation. We still keep the fractional part of the index. Then, we perform the lookup into the wavetable. The lookup can be done using an interpolation strategy of choice. Finally, we multiply the signal by a sample-dependent amplitude $A[n]$. $A[n]$ signal is called the amplitude envelope. It may be, for example, a constant, i.e., $A[n] = 1, \forall n \in \mathbb{Z}$. The output signal $y[n]$ is determined by the wave table used for the lookup and currently generated frequency. We thus created a wavetable synthesizer! ## Oscillator The diagram in Figure 3 presents an oscillator. An oscillator is any unit capable of generating sound. It is typically depicted as a rectangle combined with a half-circle [3, 4] as in Figure 4. That symbol typically has an amplitude input A ($A[n]$ in Figure 3) and a frequency input $f$ (used to calculate $k_\text{inc}[n]$ in Figure 3). Figure 4. The oscillator symbol. Additionally, what is not shown in Figure 4, an oscillator pictogram usually has some indication of what type of waveform it generates. For example, it may have the sine symbol inside to show that it outputs a sine wave. Oscillators are sometimes denoted using the VCO abbreviation, which stands for voltage-controlled oscillator. This term originates from the analog days of sound synthesis, when electric voltage determined oscillators’ amplitude and frequency. Oscillators are the workhorse of sound synthesis. What is presented in Figure 3 is one realization of an oscillator but the oscillator itself is a more general concept. Wavetable synthesis is just one way of implementing an oscillator. ## Sound Example: Sine Let’s use a precomputed wave table with 64 samples of one sine period from Figure 2 to generate 5 seconds of a sine waveform at 440 Hz using 44100 Hz sampling rate. We thus have $L = 64$, $f=440$ Hz, $f_s=44100$ Hz, $k_\text{inc} = 0.6395\dots$. The resulting sound is: The magnitude spectrum of this tone is shown below. Figure 5. Magnitude frequency spectrum of a sine generated with wavetable synthesis. Great! It sounds like a sine and we obtain just one frequency component. Everything as expected! Now, let’s generate sound using a different wavetable, shall we? ## Sound Example: Sawtooth To generate a sawtooth, we use the same parameters as before just a different wave table: Figure 6. A wave table with 64 samples of the sawtooth waveform. Let’s listen to the output: That sounds ok, but we hear some ringing. How does it look in the spectrum? Figure 7. Magnitude frequency spectrum of a sawtooth generated with wavetable synthesis. We can notice that there are some inharmonic frequency components that do not correspond to the typical decay of the sawtooth spectrum. These are aliased partials which occur because the spectrum of the sawtooth crossed the Nyquist frequency. To learn more about why this happens, you can check out my article on aliasing. Aliasing increases if we go 1 octave higher: Ouch, that doesn’t sound nice. The frequency spectrum reveals aliased partials that appear as inharmonicities: Figure 8. Magnitude frequency spectrum of a 880Hz sawtooth generated with wavetable synthesis. We’ve just discovered the main drawback of wavetable synthesis: aliasing at high frequencies. If we went even higher with the pitch, we would obtain a completely distorted signal. How to fix aliasing for harmonic-rich waveforms? We can only increase the sampling rate of the system. Since it is not something we would like to do, pure wavetable synthesis is rarely used nowadays. The type of digital distortion seen in Figure 8 was typical of the early digital synthesizers of the 1980s. A lot of effort was put into the development of alternative algorithms to synthesize sound. The main focus was to obtain an algorithm that would produce partial-rich waveforms at low frequencies and partial-poor waveforms at high frequencies. These algorithms are sometimes called antialiasing oscillators. An example of such an oscillator can be found in “Oscillator and Filter Algorithms for Virtual Analog Synthesis” paper by Vesa Välimäki and Antti Huovilainen [5]. ## Abstract Waveforms With wavetable synthesis we can use arbitrary wavetables. For example, in Figure 9, I summed 5 Gaussians, subtracted the mean and introduced a fade-in and fade-out. Figure 9. An abstract wave table constructed with 5 Gaussians. Here is a sound generated using this wave table at 110 Hz. Sounds like a horn, doesn’t it? Here’s its spectrum: Figure 10. Magnitude frequency spectrum of a 110 Hz sound generated from an abstract wavetable. As we can see, it decays quite nicely, so no audible aliasing is present. ## Sampling: Extended Wavetable Synthesis? Sampling is a technique of recording real-world instruments and playing back these sounds according to user input. We could, for example, record single guitar notes with pitches corresponding to all keys on the piano keyboard. In practice, however, notes for only some of the keys are recorded and the notes in between are interpolated versions of its neighbors. In this way, we store separate samples for high-pitched notes and thus avoid the problem of aliasing because it’s not present in the data in the first place. Wavetable synthesis could be viewed as sampling with the samples truncated to one waveform period [4]. With sampling, a lot more implementation issues come up. Since sampling is not the topic of this article, we won’t discuss it here. ## Single-Cycle, Multi-Cycle, and Multiple Wavetable What we discussed so far is a single-cycle variant of the wavetable synthesis, where we use just 1 period of a waveform stored in memory to generate the sound (Figure 11). There are more options available. Figure 11. Single-cycle wavetable synthesis loops over 1 wave table. In multi-cycle wavetable synthesis, we effectively concatenate different wavetables, whose order can be fixed or random (Figure 12). Figure 12. Multi-cycle wavetable synthesis loops over multiple wave tables, possibly in a cycle. For example, we could concatenate sine, square, and sawtooth wave tables to obtain a more interesting timbre. The resulting wave table would look like this: Figure 13. A wave table from a concatenation of sine, square, and sawtooth wave tables. Here is a sound generated using this wave table at 330 Hz. One can hear the characteristics of all 3 waveforms. Here’s its spectrum: Figure 14. Magnitude frequency spectrum of a 330 Hz sound generated from a concatenation of wave tables. The above spectrum is heavily aliased. Additionally, we got a frequency component at 110 Hz. That is because by concatenating 3 wave tables, we essentially lengthened the base period of the waveform, effectively lowering its fundamental frequency 3 times. Original waveform was at 330 Hz; the fundamental is now at 110 Hz. In multiple wavetable variant, one mixes a few wave tables at the same time (Figure 15). Figure 15. Multiple wavetable synthesis mixes between multiple wave tables while looping over them. The impact of each of the used wave tables may depend on control parameters. For example, if we press a key mildly, we can get a sine-like timbre, but if we press it fast, we may hear more high-frequency partials. That could be realized by mixing the sine and sawtooth wave tables. The ratio of these waveforms would directly depend on the velocity of the key stroke. There could also be some gradual change in the ratio while a key is pressed. ## Summary Wavetable synthesis is an efficient method that allows us to generate arbitrary waveforms at arbitrary frequencies. Its low complexity comes at a cost of high amounts of digital distortion caused by the harmonics crossing the Nyquist frequency at high pitches. Pros of wavetable synthesis: • computational efficiency, • direct frequency-to-parameters mapping, • arbitrary waveform generation. Cons of wavetable synthesis: • aliasing already at moderately high frequencies, • requires further processing and/or extensions to be musically interesting. Software synthesizers typically use more sophisticated algorithms than the one presented in this article. Nevertheless, wavetable synthesis underlies many other synthesis methods. The produced waveform could be further transformed. Therefore, the discussion of wavetable synthesis allows us to understand the basic principles of digital sound synthesis. ## Bibliography These are the references I used for this article. If you are interested in the topic of sound synthesis, each of them is a valuable source of information. Alternatively, subscribe to WolfSound’s newsletter to stay up to date with the newly published articles on sound synthesis! [4] Marek Pluta, Sound Synthesis for Music Reproduction and Performance, monograph, AGH University of Science and Technology Press 2019. Links above may be affiliate links. That means that I may earn a commission if you decide to make a purchase. This does not incur any cost for you. Thank you.
2023-03-22 09:22:37
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 91, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.7283529043197632, "perplexity": 1007.9572299133904}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2023-14/segments/1679296943809.22/warc/CC-MAIN-20230322082826-20230322112826-00138.warc.gz"}
http://math.stackexchange.com/questions/315273/how-should-i-think-about-very-ample-sheaves
# How should I think about very ample sheaves? Definition. [Hartshorne] If $X$ is any scheme over $Y$, an invertible sheaf $\mathcal{L}$ is very ample relative to $Y$, if there is an imersion $i:X \to \mathbb{P}_Y^r$ for some $r$ such that $i^\ast(\mathcal{O}(1)) \simeq \mathcal{L}$. My question is: what is the right way (interpret "right way" as you wish) to think about very ample sheaves? In particular, why is the word "ample" being used? What is it that I have an ample amount of? Degree 1 elements? In the simple case when $Y=\text{Spec}(A)$ is affine then $i^\ast(\mathcal{O}(1))$ is just $\mathcal{O}(1)$ as defined on $\text{Proj} A[x_0,\ldots x_r]$, that is, it's she sheafification of the degree 1 part of the polynomial ring $A[x_0,\ldots,x_n]$. So it seems like the more general definition is just meant to generalize this phenomenon. Is this true? If so, why is it worth generalizing? What's special about degree 1 elements? The only thing I can think of is that the polynomial ring is generated as an $A$-algebra by its degree 1 elements. As you can tell, my question is not very well formed, so feel free to add anything you think is relevant. I am also happy to expand on anything I've written here. - Now an invertible $\O_X$-module $\L$ is called very ample for $q$ if there exists a quasi-coherent $\O_Y$-module $\E$ and an immersion $i : X \to P = \P(\E)$ such that $\L$ is isomorphic to $i^*(\O_P(1))$. One immediately sees that this is equivalent to the condition that there exists a quasi-coherent $\O_Y$-module $\E$ and a surjective homomorphism $\varphi : q^*(\E) \to \L$ such that the corresponding morphism $X \to P = \P(\E)$ is an immersion. As we saw above, in the case $\E = \O_Y^{n+1}$, this means that $\L$ is globally generated by $n+1$ sections. Basically, the term very ample is referring to the global sections: roughly speaking, $\L$ is very ample if there are "enough" global sections to define an immersion into projective space. - Thanks for the answer. In general, is it true that very ample sheaves are generated by global sections? If so, what else is needed for the converse to hold. That is: generated by global sections + X = very ample. What is X? –  Derek Allums Feb 27 '13 at 19:46 Taking Hartshorne's definition ($\E = \O_Y^{n+1}$), $\L$ is very ample iff it is globally generated by global sections $s_0, \ldots, s_n$ such that the corresponding morphism $X \to \P^n_Y$ is an immersion. –  Adeel Feb 27 '13 at 21:35 Awesome, thanks @Adeel. –  Derek Allums Feb 27 '13 at 22:17 Intuitively and for my answer, I am working over an algebraically closed field $k$. I personally think about invertible sheaves as sheaves of functions on a scheme, where $s\in\mathcal L(U)$ can be evaluated at a point $P\in U$ in the sense that $s(P)$ is the image of $s$ under the morphism $\mathcal L(U) \to \mathcal L_P \cong \mathcal O_{X,P} \twoheadrightarrow \mathcal O_{X,P}/\mathfrak m_P=k(P)=k$. Of course, this depends on the local isomorphism we choose, but if I choose the same local isomorphism for $s_0,\ldots,s_n\in\mathcal L(U)$, then $[s_0(P):\ldots:s_n(P)]\in\mathbb P_k^n$ is well-defined as a point in projective space. Hence intuitively, $\mathcal L$ is very ample if these functions can serve as coordinates, i.e. I have enough functions to distinguish points - and, in fact, this is close to an alternative characterization, see Proposition II.7.3 in Hartshorne (page 152): The morphism $\varphi:X\to\mathbb P^n$ corresponding to $\mathcal L$ and a choice of global sections $s_0,\ldots,s_n\in\mathcal L(X)$ is a closed immersion if and only if it separates points and tangent vectors, i.e. 1. For closed points $P,Q\in X$ with $P\ne Q$ there exists $s\in V:=\langle s_0,\ldots,s_n\rangle$ with $s(P)=0$ and $s(Q)\ne 0$, using my above notation. 2. For each closed point $P\in X$, the set $\{ s\in V \mid s(P)=0 \}$ spans the $k$-vector space $\mathfrak m_P\mathcal L_P/\mathfrak m_P^2\mathcal L_P$. The second condition is a bit more subtle, but I found the geometric intuition given at the end of this blog post quite satisfying. - Thanks for the answer. I'll come back to it once I get to section 7 in a few weeks. Until then: your answer sounds (roughly) like "very ample means enough global generators." Would you agree with this? –  Derek Allums Feb 27 '13 at 19:51 Oh I totally agree with that, and even more so, Adeel's answer is beautiful. It carries the modern spirit of algebraic geometry, and it answers your question in perfect generality. Mine comes from a more classical angle, from where it is easier to quickly develop some intuition - but keep in mind the downside; I have forced $Y$ to be of the form $\mathrm{Spec}(k)$ with $k$ algebraically closed. –  Jesko Hüttenhain Feb 27 '13 at 20:53 True, but since I'm a beginning, I do like relating more general constructions and ideas to elementary examples when possible, and your answer definitely helps with that. –  Derek Allums Feb 27 '13 at 22:18
2015-10-07 06:49:19
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9609302878379822, "perplexity": 158.43918227842119}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2015-40/segments/1443736682773.27/warc/CC-MAIN-20151001215802-00004-ip-10-137-6-227.ec2.internal.warc.gz"}
https://www.tutorialspoint.com/What-is-the-difference-between-Declaring-and-Initializing-a-variable-in-JavaScript
# What is the difference between Declaring and Initializing a variable in JavaScript? JavascriptWeb DevelopmentFront End Technology The following is stated about declaration and initialization of a variable in ECMAScript specification − A var statement declares variables that are scoped to the running execution context’s VariableEnvironment. Var variables are created when their containing Lexical Environment is instantiated and are initialized to undefined when created. [...] A variable defined by a VariableDeclaration with an Initializer is assigned the value of its Initializer’s AssignmentExpression when the VariableDeclaration is executed, not when the variable is created. The above defines the difference: • All variables are initialized with the value undefined. • Variables declarations are initialized with undefined upon the initialization of their lexical environment. • This initialization does not work as an assignment. Published on 25-Jan-2018 10:50:14
2021-10-28 09:14:20
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.22079946100711823, "perplexity": 4954.038393563227}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-43/segments/1634323588282.80/warc/CC-MAIN-20211028065732-20211028095732-00431.warc.gz"}
http://math.stackexchange.com/questions/204973/find-a-function-from-a-limit-homework?answertab=votes
# Find a Function from a limit. Homework I don't understand this question, #6. Could someone please explain? Thanks - Find similarity with the following one: $$\lim_{h\to 0} \frac{f(a+h)-f(a)}h =: f'(a)$$ The more general solution: calculate the left hand side limit, and write up any $f$ functions and any $a$ numbers, such that $f'(a)$ is the calculated number.
2015-07-28 13:43:06
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.953256368637085, "perplexity": 512.341253123067}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2015-32/segments/1438042981921.1/warc/CC-MAIN-20150728002301-00161-ip-10-236-191-2.ec2.internal.warc.gz"}
https://codereview.stackexchange.com/questions/38348/boolean-expression-parser
# Boolean expression parser I was trying to write some of the Haskell list functions into Java, and I realized that one of the key strengths for many of the functions was the ability to pass in a boolean expression. I decided to write a parser to facilitate this. It has worked perfectly as far as I have tested it, but I want to know just how [in]efficiently I've done this, and if there's anything key that I missed. A few rules for using this parser: • You cannot use the ! operator in an expression [yet]. • For comparison of strings, use ==, !=, etc... • For exponentiation, use ^. • PEMDAS ("order of operations") is followed for mathematical expressions. Otherwise, expressions can be written almost exactly like a normal if statement. For example: Halo.takeWhile("[x]>=2", someArray); As a direct call to the parser: ExpressionParser.evaluate("2+[x] == [y] && (1==1 && Joe==Joe && 3^2>10)", "x", 5, "y", 7); class ExpressionParser { private static final String[] operators = { "!=", "==", ">=", "<=", ">", "<", "||", "&&", "*", "/", "+", "-", "^" }; private static boolean parseAndEvaluateExpression(String ex) { for (char c : ex.toCharArray()) { if (!Character.isSpaceChar(c)) return parseWithStrings(ex); } System.err.println("ERROR: Expression cannot be empty!"); return false; } @SafeVarargs static <T> boolean evaluate(String or, T... rep) { String[] temp = new String[rep.length]; for (int i = 0; i < rep.length; i++) temp[i] = "" + rep[i]; return evaluate(or, temp); } static boolean evaluate(String or, String... vars) { if ((vars.length % 2 == 1 || vars.length < 2) && vars.length != 0) { System.err.println("ERROR: Invalid arguments!"); return false; } for (int i = 0; i < vars.length; i += 2) or = or.replace("[" + vars[i] + "]", "" + vars[i + 1]); return parseAndEvaluateExpression(or); } private static boolean parseWithStrings(String s) { int[] op = determineOperatorPrecedenceAndLocation(s); int start = op[0]; String left = s.substring(0, start).trim(); String right = s.substring(op[1]).trim(); String oper = s.substring(start, op[1]).trim(); int logType = logicalOperatorType(oper); System.out.println("PARSE: Left: \"" + left + "\" Right: \"" + right + "\" Operator: \"" + oper + "\""); if (logType == 0) // encounters OR- recurse return parseWithStrings(left) || parseWithStrings(right); else if (logType == 1) // encounters AND- recurse return parseWithStrings(left) && parseWithStrings(right); if (containsMathematicalOperator(left)) // evaluate mathematical expression left = "" + parseMathematicalExpression(left); if (containsMathematicalOperator(right))// see above right = "" + parseMathematicalExpression(right); String leftSansParen = removeParens(left); String rightSansParen = removeParens(right); if (isInt(leftSansParen) && isInt(rightSansParen)) return evaluate(Double.parseDouble(leftSansParen), oper, Double.parseDouble(rightSansParen)); else return evaluate(leftSansParen, oper, rightSansParen); // assume they are strings } private static int[] determineOperatorPrecedenceAndLocation(String s) { s = s.trim(); int minParens = Integer.MAX_VALUE; int[] currentMin = null; for (int sampSize = 1; sampSize <= 2; sampSize++) { for (int locInStr = 0; locInStr < (s.length() + 1) - sampSize; locInStr++) { int endIndex = locInStr + sampSize; String sub; if ((endIndex < s.length()) && s.charAt(endIndex) == '=') sub = s.substring(locInStr, ++endIndex).trim(); else sub = s.substring(locInStr, endIndex).trim(); if (isOperator(sub)) { // Idea here is to weight logical operators so that they will still be selected over other operators // when no parens are present int parens = (logicalOperatorType(sub) > -1) ? parens(s, locInStr) - 1 : parens(s, locInStr); if (containsMathematicalOperator(sub)) { // Order of operations weighting switch (sub) { case "^": case "/": case "*": parens++; break; case "+": case "-": break; } } if (parens <= minParens) { minParens = parens; currentMin = new int[] { locInStr, endIndex, parens }; } } } } return currentMin; } private static int logicalOperatorType(String op) { switch (op.trim()) { case "||": return 0; case "&&": return 1; default: return -1; } } private static boolean containsMathematicalOperator(String s) { s = s.trim(); for (char c : s.toCharArray()) if (c == '/' || c == '+' || c == '*' || c == '-' || c == '^') return true; return false; } private static int parens(String s, int loc) { int parens = 0; for (int i = 0; i < s.length(); i++) { if (s.charAt(i) == '(' && i < loc) parens++; if (s.charAt(i) == ')' && i >= loc) parens++; } return parens; } private static String removeParens(String s) { s = s.trim(); String keep = ""; for (char c : s.toCharArray()) { if (!(c == '(') && !(c == ')')) keep += c; } return keep.trim(); } private static boolean isOperator(String op) { op = op.trim(); for (String s : operators) { if (s.equals(op)) return true; } return false; } private static boolean isInt(String s) { for (char c : s.toCharArray()) if (!Character.isDigit(c) && c != '.') return false; return true; } private static boolean evaluate(double left, String op, double right) { switch (op) { case "==": return left == right; case ">": return left > right; case "<": return left < right; case "<=": return left <= right; case ">=": return left >= right; case "!=": return left != right; default: System.err.println("ERROR: Operator type not recognized."); return false; } } private static double parseMathematicalExpression(String s) { int[] op = determineOperatorPrecedenceAndLocation(s); int start = op[0]; String left = s.substring(0, start).trim(); String right = s.substring(op[1]).trim(); String oper = s.substring(start, op[1]).trim(); System.out.println("MATH: Left: \"" + left + "\" Right: \"" + right + "\" Operator: \"" + oper + "\""); if (containsMathematicalOperator(left)) left = "" + parseMathematicalExpression(left); if (containsMathematicalOperator(right)) right = "" + parseMathematicalExpression(right); return evaluateSingleMathematicalExpression(Double.parseDouble(removeParens(left)), oper, Double.parseDouble(removeParens(right))); } private static double evaluateSingleMathematicalExpression(double result1, String oper, double result2) { switch (oper) { case "*": return result1 * result2; case "/": return result1 / result2; case "-": return result1 - result2; case "+": return result1 + result2; case "^": return Math.pow(result1, result2); default: System.err.println("MATH ERROR: Mismatched Input."); return 0; } } private static boolean evaluate(String left, String op, String right) { switch (op) { case "==": return left.equals(right); case "!=": return !left.equals(right); default: System.err.println("ERROR: Operator type not recognized."); return false; } } } • Azar .... have you considered using the Rhino Javascript engine embedded in Java 7? Consider these examples.... – rolfl Dec 31 '13 at 1:29 • @rolfl That is very neat, but I think it might be a little over-powered for my purposes, and possibly even slower as a consequence. – Azar Dec 31 '13 at 2:13 You've written something quite impressive there, but it is an unorthodox approach and some of the code is rather impenetrable. I've laid out a few points of issue and in some cases possible solutions and comments below. ## Method documentation Your methods could stand to have a brief JavaDoc block at the top. Here's how you might annotate what I believe to be your simplest method, isInt: /** * Determines whether a given string consists only of digits. * * @param s The string to test. * @return True if the string consists only of digits; false otherwise. */ private static boolean isInt(String s) { for (char c : s.toCharArray()) if (!Character.isDigit(c) && c != '.') return false; return true; } (By the way, Character.isDigit('.') == false, so you don't need that && c != '.' bit in there.) ## Proper typing of arguments I notice you provide arguments with a sort of “key, value, key, value” style and explicitly check to make sure that format is followed. I suppose that works, but you could be more semantic and get more out of the type system by using a Map from variable names to values. ## Non-usage of exceptions You've got a lot of error cases: System.err.println("ERROR: Expression cannot be empty!"); System.err.println("ERROR: Invalid arguments!"); System.out.println("PARSE: Left: \"" + left + "\" Right: \"" + right + "\" Operator: \"" + oper + "\""); System.err.println("ERROR: Operator type not recognized."); System.out.println("MATH: Left: \"" + left + "\" Right: \"" + right + "\" Operator: \"" + oper + "\""); System.err.println("MATH ERROR: Mismatched Input."); System.err.println("ERROR: Operator type not recognized."); Printing them out to standard error (or standard output, without rhyme or reason) may be suitable for debugging, but it is not appropriate beyond that. Java has a method of dealing with errors: exceptions. Use them; they won't bite. ## Inefficient concatenation In removeParens (and possibly elsewhere), you're repeatedly concatenating strings using +. This is fine for one-offs, or where the number of operands are constant, as Java can optimize it. However, doing it repeatedly in a loop is inefficient. You'd be better off using a StringBuilder: private static String removeParens(String s) { s = s.trim(); StringBuilder keep = new StringBuilder(); for (char c : s.toCharArray()) { if (!(c == '(') && !(c == ')')) keep.append(c); } return keep.toString().trim(); } Also realize you can change that if condition to c != '(' && c != ')'. You may also want to consider initializing the StringBuilder to s and deleting the parentheses. Also keep in mind that the first s = s.trim() is not necessary given the trim at the end. ## parens This could be clarified with more documentation as recommended at the top, but it seems to me like it's supposed to determine (twice?) the nesting level of parentheses at a particular location in the string. I'm worried there's a bug with closing parentheses before the location or opening parentheses after. Consider the following situation, where ^ is the location in question. ( ( ) ( ) ( ) ) ^ At that ^ point, there are two levels of nesting of parentheses. parens will return 6, counting these: ( ( ) ( ) ( ) ) ^ ^ ^ ^ ^ ^ I think you probably want a result of 4 instead, ignoring the paired parentheses. ( ( ) ( ) ( ) ) ~~~ ~~~ <- irrelevant to middle pair, but counted anyway ## determineOperatorPrecedenceAndLocation This method is quite impenetrable to me, and I really suspect there are latent bugs lurking within it, particularly given the behavior of parens above. I think you'll want to comment more heavily what you're doing here or take a different approach. # Overall approach ## Unorthodox method of parsing Your overall approach to parsing expressions is unorthodox. Now, this isn't necessarily a bad thing, but it's more difficult for me to examine, and a more traditional approach may end up being more extensible and easier to maintain. Normally you'd split this up into a few stages: first, you lex the string into a series of tokens, so the input 5 + 6 == 10 + [x] might yield the tokens INT 5 PLUS INT 6 EQUALS INT 10 PLUS VAR x From there, you parse it out. If you're just planning on using the result, you can evaluate it as you parse. You can also build an abstract syntax tree (AST) and evaluate from there, but evaluating immediately should be fine. For the actual parsing, you've got a bunch of possible approaches. If you wanted to go down this route, I might read up on recursive-descent parsers and then Pratt parsers. There are also a variety of parser-generators like ANTLR, but I'd try to first write one manually. ## Extensibility You may want to consider making it easier to extend your expression parser to add more operators and such. For example, say I wanted to use the modulo operator. A good API for this might be something like this: ExpressionParser parser = new ExpressionParser(); @Override public String getSymbol() { return "%"; } @Override public int getPrecedence() { return 20; /* or whatever's appropriate within your system */ } @Override public Associativity getAssociativity() { return Associativity.LEFT; } @Override public double evaluate(double left, double right) { return left % right; } }); System.out.println(parser.evaluate("7 % 3 == 2")); // => false I don't know how I'd fit this in with your approach, but it is trivial with a Pratt parser. ## Appropriateness I admire your effort in this, and while I imagine this would be useful in many cases, I'm not so sure your list library needs this. There is a rather straightforward translation of predicates into Java: that is, an interface and anonymous classes, as we did with the extensibility example. For example: public interface Predicate<T> { public boolean matches(T item); } Then you could filter a list of integers like so: int[] integers = new int[] { 1, 2, 3, 4, 5 }; integers = Halo.filter(integers, new Predicate<Integer>() { @Override public boolean matches(Integer item) { return item % 2 == 0; // even items only } }); Now, I'm not suggesting you completely abandon your approach. I just think you might want to support that use and then provide an ExpressionPredicate or something so I could do this: integers = Halo.filter(integers, new ExpressionPredicate<int>("[item] % 2 == 0")); Then I can pick and choose whether I want to use Java or your mini-language to write my predicate. I can even use ExpressionPredicate from within my Predicate that's otherwise written in Java: I get the best of both worlds. • To address some of what you've pointed out, the parens method will attribute all of the imaginary starred expressions ( (*) (*) (*) ) with equal levels of nesting. It simply counts the parens that are "open" to a given operator. That's what determineOperatorPrecedenceAndLocation() uses as it's main filter. It will return the operator with the least number of parens open to it, indicating it is at the topmost level. In this case, I have also manipulated those vales slightly, as to accomodate order of operations and the selection of logical operators first. – Azar Dec 31 '13 at 16:28 • Also, that concatenation weighed heavily on my mind, but I just wasn't sure if it was more expensive than the cost of creating a StringBuilder object. Come to think of it, s.remove("regex that matches ()",""); might be the best solution there. As far as the rest, those are some very cool suggestions and I will certainly take a look. I should mention that this IS a recursive-descent parser, just perhaps a little strange in it's implementation. – Azar Dec 31 '13 at 16:34 • Concatenating strings with + is definitely more expensive. The StringBuilder can extend the memory used, while + always creates new String objects when used. That means that you allocate more objects and that the garbage collector has more objects to collect. – Bobby Dec 31 '13 at 21:02
2020-02-29 08:18:10
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.3219728171825409, "perplexity": 7608.9550600827915}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 20, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2020-10/segments/1581875148671.99/warc/CC-MAIN-20200229053151-20200229083151-00470.warc.gz"}
https://support.bioconductor.org/u/17423/
## User: mikhael.manurung Reputation: 170 Status: Trusted Location: Netherlands mikhaeldito313 Last seen: 23 hours ago Joined: 12 months ago Email: m***************@gmail.com PhD Student @ LUMC. #### Posts by mikhael.manurung <prev • 69 results • page 1 of 7 • next > 1 77 views 1 ... Then you should refer to this [link][1] for in-depth reading on contrast matrix. [1]: https://stats.stackexchange.com/questions/78354/what-is-a-contrast-matrix ... written 1 day ago by mikhael.manurung170 0 77 views 0 ... Are you sure you want to do THAT many comparisons? Could you elaborate on what are those 'groups' actually correspond to? How was your MDS plot? Do you see any clustering of the samples? I can't imagine the number of pairwise comparisons if you want to do your contrast No. 3 (Well, I actually can. ... written 16 days ago by mikhael.manurung170 1 93 views 1 ... You can do that even when the data came from two different projects? Seems like the batch issue in this case is not simply multiple runs of the same instrument but other things are different as well. ... written 19 days ago by mikhael.manurung170 1 93 views 1 ... If you DO know the batches, then what swbarnes2 recommended is the best option. If you don't know then you could use sva. In your case, however, I don't think that it's wise to just combine the data because it seems that you use different platforms for the sequencing. Could you show us the MDS ... written 19 days ago by mikhael.manurung170 1 71 views 1 ... Have you tried sva? ... written 21 days ago by mikhael.manurung170 1 105 views 1 ... Based on your snippets, you are actually doing it the other way around. Using ~ 0 + in your model matrix will actually give you the non-intercept design. ... written 23 days ago by mikhael.manurung170 1 120 views 1 ... Are you looking for pathways that are regulated differently across the groups after a similar condition change? Then I guess you can test for interaction term. See this [post][1] as an example. Hint: results(dds, type="LRT", full= ~ group + condition + group:condition, reduced= ~ group + condition ... written 23 days ago by mikhael.manurung170 1 120 views 1 ... If you tick the ordered query` button then it will consider the input as a pre-ranked list of genes for GSEA. ... written 23 days ago by mikhael.manurung170 1 120 views 1 ... You can do either an overrepresentation analysis (ORA) or gene-set enrichment analysis (GSEA). Those two are entirely different but many seems to got it wrong. In an overrepresentation analysis, the input is the significant genes after differential expression analysis. You can combine both up/downr ... written 27 days ago by mikhael.manurung170 0 59 views 0 ... Oh please don't worry about that, there's always a moment in our life when we are a beginner in something. If I understand correctly, so you want to compare the module eigengene between host A and host B, right? Perhaps you can get the moduleEigengene and then do a simple t-test to compare the modu ... written 27 days ago by mikhael.manurung170 #### Latest awards to mikhael.manurung No awards yet. Soon to come :-) Content Help Access Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
2019-09-19 09:39:57
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.2376488894224167, "perplexity": 1923.0569592719876}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-39/segments/1568514573465.18/warc/CC-MAIN-20190919081032-20190919103032-00469.warc.gz"}
https://datascience.stackexchange.com/questions/20392/non-mutal-exclusive-classification-task-examples
# Non-mutal exclusive classification task examples I am reading the excellent Hands-on Machine Learning with Scikit-Learn and TensorFlow and in chapter 10, the author says: "For the output layer, the softmax activation function is generally a good choice for classification tasks (when the classes are mutually exclusive). For regression tasks, you can simply use no activation function at all." All classification problems I can think of (binary classification, image classification, etc) generate mutually exclusive classes. Can someone give me a few examples of non-mutual exclusive classification problems? • Think of the task of properly tagging an untagged Stack Overflow question. You can always have some overlap area between any two tags, there's no mutual exclusion. – Mephy Jul 13 '17 at 13:59 For example, due to the complexity of the images in the ImageNet database. Algorithms will often use hundreds or thousands of output nodes to be capable of classifying a large array of different things. Researchers also relax the cost function and allow the $k$ highest outputs to be considered. If one of these is correct then the example is considered to have been correctly classified. Furthermore with the existence of such complex data, often times a certain object might be a subset of another object.
2020-05-26 13:46:50
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.43949955701828003, "perplexity": 573.5047599359507}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2020-24/segments/1590347390758.21/warc/CC-MAIN-20200526112939-20200526142939-00527.warc.gz"}
http://www.ck12.org/algebra/Slope-Intercept-Form-of-Linear-Equations/lesson/Finding-the-Equation-of-a-Line-in-Slope-Intercept-Form-ALG-II/
<img src="https://d5nxst8fruw4z.cloudfront.net/atrk.gif?account=iA1Pi1a8Dy00ym" style="display:none" height="1" width="1" alt="" /> Slope-Intercept Form of Linear Equations Explore equations in y = mx+b form Estimated10 minsto complete % Progress Practice Slope-Intercept Form of Linear Equations MEMORY METER This indicates how strong in your memory this concept is Progress Estimated10 minsto complete % Finding the Equation of a Line in Slope-Intercept Form You decide to buy a laptop for $800. In 3 years, the laptop will be worth$450. How much will the computer be worth after 6 years? Writing a linear equation that relates the two prices will help you determine how much the computer will be worth after 6 years. Finding the Equation of a Line You know how to find the slope between two points. We will now find the entire equation of a line. Recall from Algebra I that the equation of a line in slope-intercept form is \begin{align*}y = mx + b,\end{align*} where \begin{align*}m\end{align*} is the slope and \begin{align*}b\end{align*} is the \begin{align*}y-\end{align*}intercept. You can find the slope either by using slope triangles or the Slope Formula. To find the \begin{align*}y-\end{align*}intercept, or \begin{align*}b,\end{align*} you can either locate where the line crosses the \begin{align*}y-\end{align*}axis (if given the graph) or by using algebra. Let's find the equation for the following lines. 1. Find the equation of the line below. Analyze the line. We are given two points on the line, one of which is the \begin{align*}y-\end{align*}intercept. From the graph, it looks like the line passes through the \begin{align*}y-\end{align*}axis at (0, 4), making \begin{align*}b = 4\end{align*}. Now, we need to find the slope. You can use slope triangles or the Slope Formula. Using slope triangles, we have: From this, we see that the slope is \begin{align*}- \frac{2}{6}\end{align*} or \begin{align*}- \frac{1}{3}\end{align*}. Plugging our found information into the slope-intercept equation, the equation of this line is \begin{align*}y = - \frac{1}{3} x + 4\end{align*}. Alternate Method: If we had used the Slope Formula, we would use (0, 4) and (6, 2), which are the values of the given points. \begin{align*}m = \frac{2-4}{6-0} = \frac{-2}{6} = - \frac{1}{3}\end{align*} The slope of a line is -4 and the \begin{align*}y-\end{align*}intercept is (0, 3). What is the equation of the line? This problem explicitly tells us the slope and \begin{align*}y-\end{align*}intercept. The slope is -4, meaning \begin{align*}m = -4\end{align*}. The \begin{align*}y-\end{align*}intercept is (0, 3), meaning \begin{align*}b = 3\end{align*}. Therefore, the equation of the line is \begin{align*}y = -4x + 3\end{align*}. 1. The slope of a line is \begin{align*}\frac{1}{2}\end{align*} and it passes through the point (4, -7). What is the equation of the line? In this problem, we are given \begin{align*}m\end{align*} and a point on the line. The point, (4, -7) can be substituted in for \begin{align*}x\end{align*} and \begin{align*}y\end{align*} in the equation. We need to solve for the \begin{align*}y-\end{align*}intercept, or \begin{align*}b\end{align*}. Plug in what you know to the slope-intercept equation. \begin{align*}y &= mx + b\\ -7 &=\frac{1}{2}(4) + b\\ -7 &=2 + b\\ -9 &=b\end{align*} From this, the equation of the line is \begin{align*}y = \frac{1}{2}x - 9\end{align*}. We can test if a point is on a line or not by plugging it into the equation. If the equation holds true, the point is on the line. If not, then the point is not on the line. 1. Find the equation of the line that passes through (12, 7) and (10, -1). In this problem, we are not given the slope or the \begin{align*}y-\end{align*}intercept. First, we need to find the slope using the Slope Formula. \begin{align*}m = \frac{-1-7}{10-12} = \frac{-8}{-2} = 4\end{align*} Now, plug in one of the points for \begin{align*}x\end{align*} and \begin{align*}y\end{align*}. It does not matter which point you choose because they are both on the line. \begin{align*}7 &= 4(12) + b\\ 7 &= 48 + b \\ -41 &= b\end{align*} The equation of the line is \begin{align*}y = 4x - 41\end{align*}. Examples Example 1 Earlier, you were asked to find how much the computer will be worth after 6 years. To determine the equation of the line, rewrite the given information as points. The first could be (0, 800) and the second would be (3, 450). We already know that the y-intercept is 800 because the x-value is zero at that point. Find the slope. \begin{align*}\frac{800-450}{0-3}= - \frac{350}{3}\end{align*} Therefore, the equation of the declining value of the laptop is \begin{align*}y= - \frac{350}{3}x + 800\end{align*}. In 6 years, the laptop will be worth \begin{align*}y= - \frac{350}{3}\cdot 6 + 800 = -700+800 = 100\end{align*}. The laptop will be worth \$100. Example 2 What is the equation of the line where the slope is 1 and passes through (5, 3)? We are told that \begin{align*}m = 1, x = 5,\end{align*} and \begin{align*}y = 3\end{align*}. Plug this into the slope-intercept equation and solve for \begin{align*}b\end{align*}. \begin{align*}3 &= 1(5) + b\\ 3 &= 5 + b \\ -2 &= b\end{align*} The equation of the line is \begin{align*}y = x - 2\end{align*} Example 3 Find the equation of the line that passes through (9, -4) and (-1, -8). First, find the slope. \begin{align*}m = \frac{-8-(-4)}{-1-9} = \frac{-4}{-10} = \frac{2}{5}\end{align*} Now, find the \begin{align*}y-\end{align*}intercept. We will use the second point. Remember, it does not matter which point you use. \begin{align*}-8 &= \frac{2}{5}(-1) + b\\ -8 &= - \frac{2}{5} + b \\ -7 \frac{3}{5} &= b\end{align*} The equation of the line is \begin{align*}y = \frac{2}{5}x - 7 \frac{3}{5}\end{align*} or \begin{align*}y = \frac{2}{5}x - \frac{38}{5}\end{align*}. When your \begin{align*}y-\end{align*}intercept is a fraction, make sure it is reduced. Double-check with your teacher on how s/he wants you to leave your answer. Example 4 Find the equation of the line below. We can find the slope one of two ways: using slope triangles or by using the Slope Formula. We are given (by the drawn points in the picture) that (-2, 2) and (4, -2) are on the line. Drawing a slope triangle, we have: We have that the slope is \begin{align*}- \frac{4}{6}\end{align*} or \begin{align*}- \frac{2}{3}\end{align*}. To find the \begin{align*}y-\end{align*}intercept, it looks like it is somewhere between 0 and 1. Take one of the points and plug in what you know to the slope-intercept equation. \begin{align*}2 &= - \frac{2}{3}(-2) + b\\ 2 &= \frac{4}{3} + b \\ \frac{2}{3} &= b\end{align*} The equation of the line is \begin{align*}y = - \frac{2}{3}x + \frac{2}{3}\end{align*}. Review Find the equation of each line with the given information below. 1. slope = 2, \begin{align*}y-\end{align*}intercept = (0, 3) 2. \begin{align*}m = -\frac{1}{4}, \ b = 2.6\end{align*} 3. slope = -1, \begin{align*}y-\end{align*}intercept = (0, 2) 4. \begin{align*}x-\end{align*}intercept = (-2, 0), \begin{align*}y-\end{align*}intercept = (0, -5) 5. slope \begin{align*}= \frac{2}{3}\end{align*} and passes through (6, -4) 6. slope \begin{align*}= - \frac{3}{4}\end{align*} and passes through (-2, 5) 7. slope = -3 and passes through (-1, -7) 8. slope = 1 and passes through (2, 4) 9. passes through (-5, 4) and (1, 1) 10. passes through (5, -1) and (-10, -10) 11. passes through (-3, 8) and (6, 5) 12. passes through (-4, -21) and (2, 9) For problems 13-16, find the equation of the lines in the graph below. 1. Green Line 2. Blue Line 3. Red Line 4. Purple Line 5. Find the equation of the line with zero slope and passes through (8, -3). 6. Find the equation of the line with zero slope and passes through the point (-4, 5). 7. Find the equation of the line with zero slope and passes through the point \begin{align*}(a, b)\end{align*}. 8. Challenge Find the equation of the line with an undefined slope that passes through \begin{align*}(a, b)\end{align*}. To see the Review answers, open this PDF file and look for section 2.2. Notes/Highlights Having trouble? Report an issue. Color Highlighted Text Notes Vocabulary Language: English $x-$intercept An $x-$intercept is a location where a graph crosses the $x-$axis. As a coordinate pair, this point will always have the form $(x, 0)$. $x-$intercepts are also called solutions, roots or zeros. $y-$intercept A $y-$intercept is a location where a graph crosses the $y-$axis. As a coordinate pair, this point will always have the form $(0, y)$. Slope-Intercept Form The slope-intercept form of a line is $y = mx + b,$ where $m$ is the slope and $b$ is the $y-$intercept.
2016-12-08 08:24:22
{"extraction_info": {"found_math": true, "script_math_tex": 62, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 13, "texerror": 0, "math_score": 0.9761766791343689, "perplexity": 903.7768684702353}, "config": {"markdown_headings": false, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2016-50/segments/1480698542455.45/warc/CC-MAIN-20161202170902-00130-ip-10-31-129-80.ec2.internal.warc.gz"}
https://leanpub.com/fpmortals-cats/read
This book is for the typical Scala developer, probably with a Java background, who is both sceptical and curious about the Functional Programming (FP) paradigm. This book justifies every concept with practical examples, including writing a web application. This book uses Typelevel Cats 2.1, the most popular Functional Programming framework for Scala. Typelevel has a wealth of accessible and idiomatic learning resources in a welcoming and safe environment. This book is designed to be read from cover to cover, in the order presented, with a rest between chapters. Earlier chapters encourage coding styles that we will later discredit: similar to how we learn Newton’s theory of gravity as children, and progress to Riemann / Einstein / Maxwell if we become students of physics. A computer is not necessary to follow along, but studying the Cats source code is encouraged. Some of the more complex code snippets are available with the book’s source code and those who want practical exercises are encouraged to (re-)implement Cats (and the example application) using the partial descriptions presented in this book. This book is an updated and revised edition of “Functional Programming for Mortals” by Sam Halliday. Like the original, this book uses the Creative Commons Attribution ShareAlike 4.0 International (CC BY-SA 4.0) license. All original code snippets in this book and the example application drone-dynamic-agents are provided under the Hippocratic License 2.1: an Ethical Source license that specifically prohibits the use of software to violate universal standards of human rights. ## Practicalities To set up a project that uses the libraries presented in this book, use a recent version of Scala with FP-specific features enabled (e.g. in build.sbt): In order to keep our snippets short, we will omit the import section. Unless told otherwise, assume that all snippets have the following imports: ## 1. Introduction It is human instinct to be sceptical of a new paradigm. To put some perspective on how far we have come, and the shifts we have already accepted on the JVM, let’s start with a quick recap of the last 20 years. Java 1.2 introduced the Collections API, allowing us to write methods that abstracted over mutable collections. It was useful for writing general purpose algorithms and was the bedrock of our codebases. But there was a problem, we had to perform runtime casting: In response, developers defined domain objects in their business logic that were effectively CollectionOfThings, and the Collection API became implementation detail. In 2005, Java 5 introduced generics, allowing us to define Collection<Thing>, abstracting over the container and its elements. Generics changed how we wrote Java. The author of the Java generics compiler, Martin Odersky, then created Scala with a stronger type system, immutable data and multiple inheritance. This brought about a fusion of object oriented (OOP) and functional programming (FP). For most developers, FP means using immutable data as much as possible, but mutable state is still a necessary evil that must be isolated and managed, e.g. with Akka actors or synchronized classes. This style of FP results in simpler programs that are easier to parallelise and distribute, an improvement over Java. But it is only scratching the surface of the benefits of FP, as we will discover in this book. Scala also brings Future, making it easy to write asynchronous applications. But when a Future makes it into a return type, everything needs to be rewritten to accomodate it, including the tests, which are now subject to arbitrary timeouts. We have a problem similar to Java 1.0: there is no way of abstracting over execution, much as we had no way of abstracting over collections. ### 1.1 Abstracting over Execution Say we want to interact with the user over the command line interface. We can read what the user types and we can write a message to them. How do we write generic code that does something as simple as echo the user’s input synchronously or asynchronously depending on our runtime implementation? We could write a synchronous version and wrap it with Future but now we have to worry about which thread pool we should be using for the work, or we could Await.result on the Future and introduce thread blocking. In either case, it is a lot of boilerplate and we are fundamentally dealing with different APIs that are not unified. We can solve the problem, like Java 1.2, with a common parent using the higher kinded types (HKT) Scala language feature. We want to define Terminal for a type constructor C[_]. By defining Now to construct to its type parameter (like Id), we can implement a common interface for synchronous and asynchronous terminals: We can think of C as a Context because we say “in the context of executing Now” or “in the Future”. But we know nothing about C and we cannot do anything with a C[String]. What we need is a kind of execution environment that lets us call a method returning C[T] and then be able to do something with the T, including calling another method on Terminal. We also need a way of wrapping a value as a C[_]. This signature works well: letting us write: We can now share the echo implementation between synchronous and asynchronous codepaths. We can write a mock implementation of Terminal[Now] and use it in our tests without any timeouts. Implementations of Execution[Now] and Execution[Future] are reusable by generic methods like echo. But the code for echo is unpleasant. The implicit class Scala language feature gives C some methods. We will call these methods flatMap and map for reasons that will become clearer in a moment. Each method takes an implicit Execution[C], but this is nothing more than the flatMap and map that we’re used to on Seq, Option and Future We can now reveal why we used flatMap as the method name: it lets us use a for comprehension, which is just syntax sugar over nested flatMap and map. Our Execution has the same signature as a trait in Cats called Monad, except chain is flatMap and create is pure. We say that C is monadic when there is an implicit Monad[C] available. In addition, Cats has the Id type alias. The takeaway is: if we write methods that operate on monadic types, then we can write sequential code that abstracts over its execution context. Here, we have shown an abstraction over synchronous and asynchronous execution but it can also be for the purpose of more rigorous error handling (where C[_] is Either[Error, _]), managing access to volatile state, performing I/O, or auditing of the session. ### 1.2 Pure Functional Programming Functional Programming is the act of writing programs with pure functions. Pure functions have three properties: • Total: return a value for every possible input • Deterministic: return the same value for the same input • Inculpable: no (direct) interaction with the world or program state. Together, these properties give us an unprecedented ability to reason about our code. For example, input validation is easier to isolate with totality, caching is possible when functions are deterministic, and interacting with the world is easier to control, and test, when functions are inculpable. The kinds of things that break these properties are side effects: directly accessing or changing mutable state (e.g. maintaining a var in a class or using a legacy API that is impure), communicating with external resources (e.g. files or network lookup), or throwing and catching exceptions. We write pure functions by avoiding exceptions, and interacting with the world only through a safe F[_] execution context. In the previous section, we abstracted over execution and defined echo[Id] and echo[Future]. We might reasonably expect that calling any echo will not perform any side effects, because it is pure. However, if we use Future or Id as the execution context, our application will start listening to stdin: We have broken purity and are no longer writing FP code: futureEcho is the result of running echo once. Future conflates the definition of a program with interpreting it (running it). As a result, applications built with Future are difficult to reason about. We can define a simple safe F[_] execution context which lazily evaluates a thunk. IO is just a data structure that references (potentially) impure code, it isn’t actually running anything. We can implement Terminal[IO] and call echo[IO] to get back a value This val delayed can be reused, it is just the definition of the work to be done. We can map the String and compose additional programs, much as we would map over a Future. IO keeps us honest that we are depending on some interaction with the world, but does not prevent us from accessing the output of that interaction. The impure code inside the IO is only evaluated when we .interpret() the value, which is an impure action An application composed of IO programs is only interpreted once, in the main method, which is also called the end of the world. In this book, we expand on the concepts introduced in this chapter and show how to write maintainable, pure functions, that achieve our business’s objectives. ## 2. For Comprehensions Scala’s for comprehension is the ideal FP abstraction for sequential programs that interact with the world. Since we will be using it a lot, we’re going to relearn the principles of for and how Cats can help us to write cleaner code. This chapter doesn’t try to write pure programs and the techniques are applicable to non-FP codebases. ### 2.1 Syntax Sugar Scala’s for is just a simple rewrite rule, also called syntax sugar, that doesn’t have any contextual information. To see what a for comprehension is doing, we use the show and reify feature in the REPL to print out what code looks like after type inference. There is a lot of noise due to additional sugarings (e.g. + is rewritten plus, etc). We will skip the show and reify for brevity when the REPL line is reify>, and manually clean up the generated code so that it doesn’t become a distraction. The rule of thumb is that every <- (called a generator) is a nested flatMap call, with the final generator a map containing the yield body. #### 2.1.1 Assignment We can assign values inline like ij = i + j (a val keyword is not needed). A map over the b introduces the ij which is flat-mapped along with the j, then the final map for the code in the yield. Unfortunately we cannot assign before any generators. We can workaround the limitation by defining a val outside the for or create an Option out of the initial assignment #### 2.1.2 Filter It is possible to put if statements after a generator to filter values by a predicate Older versions of Scala used filter, but Traversable.filter creates new collections for every predicate, so withFilter was introduced as the more performant alternative. We can accidentally trigger a withFilter by providing type information, interpreted as a pattern match. Like assignment, a generator can use a pattern match on the left hand side. But unlike assignment (which throws MatchError on failure), generators are filtered and will not fail at runtime. However, there is an inefficient double application of the pattern. #### 2.1.3 For Each Finally, if there is no yield, the compiler will use foreach instead of flatMap, which is only useful for side-effects. #### 2.1.4 Summary The full set of methods supported by for comprehensions do not share a common super type; each generated snippet is independently compiled. If there were a trait, it would roughly look like: If the context (C[_]) of a for comprehension doesn’t provide its own map and flatMap, all is not lost. If an implicit cats.FlatMap[T] is available for T, it will provide map and flatMap. ### 2.2 Unhappy path So far we’ve only looked at the rewrite rules, not what is happening in map and flatMap. Consider what happens when the for context decides that it cannot proceed any further. In the Option example, the yield is only called when i,j,k are all defined. If any of a,b,c are None, the comprehension short-circuits with None but it doesn’t tell us what went wrong. If we use Either, then a Left will cause the for comprehension to short circuit with extra information, much better than Option for error reporting: And lastly, let’s see what happens with a Future that fails: The Future that prints to the terminal is never called because, like Option and Either, the for comprehension short circuits. Short circuiting for the unhappy path is a common and important theme. for comprehensions cannot express resource cleanup: there is no way to try / finally. This is good, in FP it puts a clear ownership of responsibility for unexpected error recovery and resource cleanup onto the context (which is usually a Monad as we will see later), not the business logic. ### 2.3 Gymnastics Although it is easy to rewrite simple sequential code as a for comprehension, sometimes we will want to do something that appears to require mental summersaults. This section collects some practical examples and how to deal with them. #### 2.3.1 Fallback Logic Say we are calling out to a method that returns an Option. If it is not successful we want to fallback to another method (and so on and so on), like when we’re using a cache: If we have to do this for an asynchronous version of the same API then we have to be careful not to do extra work because will run both queries. We can pattern match on the first result but the type is wrong We need to create a Future from the cache Future.successful creates a new Future, much like an Option or List constructor. #### 2.3.2 Early Exit Say we have some condition that should exit early with a successful value. If we want to exit early with an error, it is standard practice in OOP to throw an exception which can be rewritten async But if we want to exit early with a successful return value, the simple synchronous code: translates into a nested for comprehension when our dependencies are asynchronous: ### 2.4 Incomprehensible The context we’re comprehending over must stay the same: we cannot mix contexts. Nothing can help us mix arbitrary contexts in a for comprehension because the meaning is not well defined. But when we have nested contexts the intention is usually obvious yet the compiler still doesn’t accept our code. Here we want for to take care of the outer context and let us write our code on the inner Option. Hiding the outer context is exactly what a monad transformer does, and Cats provides implementations for Option and Either named OptionT and EitherT respectively. The outer context can be anything that normally works in a for comprehension, but it needs to stay the same throughout. We create an OptionT from each method call. This changes the context of the for from Future[Option[_]] to OptionT[Future, _]. .value returns us to the original context The monad transformer also allows us to mix Future[Option[_]] calls with methods that just return plain Future via .liftM[OptionT] (provided by Cats): and we can mix with methods that return plain Option by wrapping them in Future.successful (.pure[Future]) followed by OptionT It is messy again, but it is better than writing nested flatMap and map by hand. We can clean it up with a DSL that handles all the required conversions into OptionT[Future, _] To use our DSL we can use the Typelevel Mouse extensions to Cats, add the following to your build.sbt giving us the |> operator, which applies the function on the right to the value on the left, to visually separate the logic from the transformers This approach also works for Either (and others) as the inner context, but their lifting methods are more complex and require parameters. ## 3. Application Design In this chapter we will write the business logic and tests for a purely functional server application. The source code for this application is included under the example directory along with the book’s source, however it is recommended not to read the source code until the final chapter as there will be significant refactors as we learn more about FP. ### 3.1 Specification Our application will manage a just-in-time build farm on a shoestring budget. It will listen to a Drone Continuous Integration server, and spawn worker agents using Google Container Engine (GKE) to meet the demand of the work queue. Drone receives work when a contributor submits a github pull request to a managed project. Drone assigns the work to its agents, each processing one job at a time. The goal of our app is to ensure that there are enough agents to complete the work, with a cap on the number of agents, whilst minimising the total cost. Our app needs to know the number of items in the backlog and the number of available agents. Google can spawn nodes, each can host multiple drone agents. When an agent starts up, it registers itself with drone and drone takes care of the lifecycle (including keep-alive calls to detect removed agents). GKE charges a fee per minute of uptime, rounded up to the nearest hour for each node. One does not simply spawn a new node for each job in the work queue, we must re-use nodes and retain them until their 58th minute to get the most value for money. Our app needs to be able to start and stop nodes, as well as check their status (e.g. uptimes, list of inactive nodes) and to know what time GKE believes it to be. In addition, there is no API to talk directly to an agent so we do not know if any individual agent is performing any work for the drone server. If we accidentally stop an agent whilst it is performing work, it is inconvenient and requires a human to restart the job. Contributors can manually add agents to the farm, so counting agents and nodes is not equivalent. We don’t need to supply any nodes if there are agents available. The failure mode should always be to take the least costly option. Both Drone and GKE have a JSON over REST API with OAuth 2.0 authentication. ### 3.2 Interfaces / Algebras We will now codify the architecture diagram from the previous section. Firstly, we need to define a simple data type to capture a millisecond timestamp because such a simple thing does not exist in either the Java or Scala standard libraries: In FP, an algebra takes the place of an interface in Java, or the set of valid messages for an Actor in Akka. This is the layer where we define all side-effecting interactions of our system. There is tight iteration between writing the business logic and the algebra: it is a good level of abstraction to design a system. We’ve used NonEmptyList, easily created by calling .toNel on the stdlib’s List (returning an Option[NonEmptyList]), otherwise everything should be familiar. ### 3.3 Business Logic Now we write the business logic that defines the application’s behaviour, considering only the happy path. We need a WorldView class to hold a snapshot of our knowledge of the world. If we were designing this application in Akka, WorldView would probably be a var in a stateful Actor. WorldView aggregates the return values of all the methods in the algebras, and adds a pending field to track unfulfilled requests. Now we are ready to write our business logic, but we need to indicate that we depend on Drone and Machines. We can write the interface for the business logic and implement it with a module. A module depends only on other modules, algebras and pure functions, and can be abstracted over F. If an implementation of an algebraic interface is tied to a specific type, e.g. IO, it is called an interpreter. The Monad context bound means that F is monadic, allowing us to use map, pure and, of course, flatMap via for comprehensions. We have access to the algebra of Drone and Machines as D and M, respectively. Using a single capital letter name is a common naming convention for monad and algebra implementations. Our business logic will run in an infinite loop (pseudocode) #### 3.3.1 initial In initial we call all external services and aggregate their results into a WorldView. We default the pending field to an empty Map. Recall from Chapter 1 that flatMap (i.e. when we use the <- generator) allows us to operate on a value that is computed at runtime. When we return an F[_] we are returning another program to be interpreted at runtime, that we can then flatMap. This is how we safely chain together sequential side-effecting code, whilst being able to provide a pure implementation for tests. FP could be described as Extreme Mocking. #### 3.3.2 update update should call initial to refresh our world view, preserving known pending actions. If a node has changed state, we remove it from pending and if a pending action is taking longer than 10 minutes to do anything, we assume that it failed and forget that we asked to do it. Concrete functions like .symdiff don’t need test interpreters, they have explicit inputs and outputs, so we could move all pure code into standalone methods on a stateless object, testable in isolation. We’re happy testing only the public methods, preferring that our business logic is easy to read. #### 3.3.3 act The act method is slightly more complex, so we will split it into two parts for clarity: detection of when an action needs to be taken, followed by taking action. This simplification means that we can only perform one action per invocation, but that is reasonable because we can control the invocations and may choose to re-run act until no further action is taken. We write the scenario detectors as extractors for WorldView, which is nothing more than an expressive way of writing if / else conditions. We need to add agents to the farm if there is a backlog of work, we have no agents, we have no nodes alive, and there are no pending actions. We return a candidate node that we would like to start: If there is no backlog, we should stop all nodes that have become stale (they are not doing any work). However, since Google charge per hour we only shut down machines in their 58th minute to get the most out of our money. We return the non-empty list of nodes to stop. As a financial safety net, all nodes should have a maximum lifetime of 5 hours. Now that we have detected the scenarios that can occur, we can write the act method. When we schedule a node to be started or stopped, we add it to pending noting the time that we scheduled the action. Because NeedsAgent and Stale do not cover all possible situations, we need a catch-all case _ to do nothing. Recall from Chapter 2 that .pure creates the for’s (monadic) context from a value. .foldLeftM is like .foldLeft, but each iteration of the fold may return a monadic value. In our case, each iteration of the fold returns F[WorldView]. The M is for Monadic. We will find more of these lifted methods that behave as one would expect, taking monadic values in place of values. ### 3.4 Unit Tests The FP approach to writing applications is a designer’s dream: delegate writing the implementations of algebras to team members while focusing on making business logic meet the requirements. Our application is highly dependent on timing and third party webservices. If this was a traditional OOP application, we’d create mocks for all the method calls, or test actors for the outgoing mailboxes. FP mocking is equivalent to providing an alternative implementation of dependency algebras. The algebras already isolate the parts of the system that need to be mocked, i.e. interpreted differently in the unit tests. We will start with some test data We implement algebras by extending Drone and Machines with a specific monadic context, Id being the simplest. Our “mock” implementations simply play back a fixed WorldView. We’ve isolated the state of our system, so we can use var to store the state: When we write a unit test (here using FlatSpec from Scalatest), we create an instance of Mutable and then import all of its members. Our implicit drone and machines both use the Id execution context and therefore interpreting this program with them returns an Id[WorldView] that we can assert on. In this trivial case we just check that the initial method returns the same value that we use in the static implementations: We can create more advanced tests of the update and act methods, helping us flush out bugs and refine the requirements: It would be boring to go through the full test suite. The following tests are easy to implement using the same approach: • not request agents when pending • don’t shut down agents if nodes are too young • shut down agents when there is no backlog and nodes will shortly incur new costs • not shut down agents if there are pending actions • shut down agents when there is no backlog if they are too old • shut down agents, even if they are potentially doing work, if they are too old • ignore unresponsive pending actions during update All of these tests are synchronous and isolated to the test runner’s thread (which could be running tests in parallel). If we’d designed our test suite in Akka, our tests would be subject to arbitrary timeouts and failures would be hidden in logfiles. The productivity boost of simple tests for business logic cannot be overstated. Consider that 90% of an application developer’s time interacting with the customer is in refining, updating and fixing these business rules. Everything else is implementation detail. ### 3.5 Parallel The application that we have designed runs each of its algebraic methods sequentially. But there are some obvious places where work can be performed in parallel. #### 3.5.1 initial In our definition of initial we could ask for all the information we need at the same time instead of one query at a time. As opposed to flatMap for sequential operations, Cats uses Semigroupal syntax for parallel operations: If each of the parallel operations returns a value in the same monadic context, we can apply a function to the results when they all return. Rewriting initial to take advantage of this: #### 3.5.2 act In the current logic for act, we are stopping each node sequentially, waiting for the result, and then proceeding. But we could stop all the nodes in parallel and then update our view of the world. A disadvantage of doing it this way is that any failures will cause us to short-circuit before updating the pending field. But that is a reasonable tradeoff since our update will gracefully handle the case where a node is shut down unexpectedly. We need a method that operates on NonEmptyList that allows us to .map each element into an F[MachineNode], returning an F[NonEmptyList[MachineNode]]. The method is called .traverse, and when we .flatMap over it we get a NonEmptyList[MachineNode] that we can deal with in a simple way: Arguably, this is easier to understand than the sequential version. ### 3.6 Summary 1. algebras define the interface between systems. 2. modules are implementations of an algebra in terms of other algebras. 3. interpreters are concrete implementations of an algebra for a fixed F[_]. 4. Test interpreters can replace the side-effecting parts of the system, giving a high amount of test coverage. ## 4. Data and Functionality From OOP we are used to thinking about data and functionality together: class hierarchies carry methods, and traits can demand that data fields exist. Runtime polymorphism of an object is in terms of “is a” relationships, requiring classes to inherit from common interfaces. This can get messy as a codebase grows. Simple data types become obscured by hundreds of lines of methods, trait mixins suffer from initialisation order errors, and testing / mocking of highly coupled components becomes a chore. FP takes a different approach, defining data and functionality separately. In this chapter, we will cover the basics of data types and the advantages of constraining ourselves to a subset of the Scala language. We will also discover typeclasses as a way to achieve compiletime polymorphism: thinking about functionality of a data structure in terms of “has a” rather than “is a” relationships. ### 4.1 Data The fundamental building blocks of data types are • final case class also known as products • sealed abstract class also known as coproducts • case object and Int, Double, String (etc) values with no methods or fields other than the constructor parameters. We prefer abstract class to trait in order to get better binary compatibility and to discourage trait mixing. The collective name for products, coproducts and values is Algebraic Data Type (ADT). We compose data types from the AND and XOR (exclusive OR) Boolean algebra: a product contains every type that it is composed of, but a coproduct can be only one. For example • product: ABC = a AND b AND c • coproduct: XYZ = x XOR y XOR z written in Scala #### 4.1.1 Recursive ADTs When an ADT refers to itself, we call it a Recursive Algebraic Data Type. The standard library List is recursive because :: (the cons cell) contains a reference to List. The following is a simplification of the actual implementation: #### 4.1.2 Functions on ADTs ADTs can contain pure functions But ADTs that contain functions come with some caveats as they don’t translate perfectly onto the JVM. For example, legacy Serializable, .hashCode, .equals and .toString do not behave as one might reasonably expect. Unfortunately, Serializable is used by popular frameworks, despite far superior alternatives. A common pitfall is forgetting that Serializable may attempt to serialise the entire closure of a function, which can crash production servers. A similar caveat applies to legacy Java classes such as Throwable, which can carry references to arbitrary objects. We will explore alternatives to the legacy methods when we discuss the Cats library in the next chapter, at the cost of losing interoperability with some legacy Java and Scala code. #### 4.1.3 Exhaustivity It is important that we use sealed abstract class, not just abstract class, when defining a data type. Sealing a class means that all subtypes must be defined in the same file, allowing the compiler to know about them in pattern match exhaustivity checks and in macros that eliminate boilerplate. e.g. This shows the developer what they have broken when they add a new product to the codebase. We’re using -Xfatal-warnings, otherwise this is just a warning. However, the compiler will not perform exhaustivity checking if the class is not sealed or if there are guards, e.g. To remain safe, don’t use guards on sealed types. The -Xstrict-patmat-analysis flag has been proposed as a language improvement to perform additional pattern matcher checks. #### 4.1.4 Alternative Products and Coproducts Another form of product is a tuple, which is like an unlabelled final case class. (A.type, B, C) is equivalent to ABC in the above example but it is best to use final case class when part of an ADT because the lack of names is awkward to deal with, and case class has much better performance for primitive values. Another form of coproduct is when we nest Either types. e.g. equivalent to the XYZ sealed abstract class. A cleaner syntax to define nested Either types is to create an alias type ending with a colon, allowing infix notation with association from the right: This is useful to create anonymous coproducts when we cannot put all the implementations into the same source file. Yet another alternative coproduct is to create a custom sealed abstract class with final case class definitions that simply wrap the desired type: Pattern matching on these forms of coproduct can be tedious, which is why Union Types are a Scala 3 language feature. #### 4.1.5 Convey Information Besides being a container for necessary business information, data types can be used to encode constraints. For example, can never be empty. This makes cats.data.NonEmptyList a useful data type despite containing the same information as List. Product types often contain types that are far more general than is allowed. In traditional OOP this would be handled with input validation through assertions: Instead, we can use the Either data type to provide Right[Person] for valid instances and protect invalid instances from propagating. Note that the constructor is private: ##### 4.1.5.1 Refined Data Types A clean way to restrict the values of a general type is with the refined library, providing a suite of restrictions to the contents of data. To install refined, add the following to build.sbt and the following imports Refined allows us to define Person using adhoc refined types to capture requirements exactly, written A Refined B. The underlying value can be obtained with .value. We can construct a value at runtime using .refineV, returning an Either If we add the following import we can construct valid values at compiletime and get an error if the provided value does not meet the requirements More complex requirements can be captured, for example we can use the built-in rule MaxSize with the following imports capturing the requirement that the String must be both non-empty and have a maximum size of 10 characters: It is easy to define custom requirements that are not covered by the refined library. For example in drone-dynamaic-agents we will need a way of ensuring that a String contains application/x-www-form-urlencoded content. We can create a Refined rule using the Java regular expression library: #### 4.1.6 Simple to Share By not providing any functionality, ADTs can have a minimal set of dependencies. This makes them easy to publish and share with other developers. By using a simple data modelling language, it makes it possible to interact with cross-discipline teams, such as DBAs, UI developers and business analysts, using the actual code instead of a hand written document as the source of truth. Furthermore, tooling can be more easily written to produce or consume schemas from other programming languages and wire protocols. #### 4.1.7 Counting Complexity The complexity of a data type is the count of values that can exist. A good data type has the least amount of complexity it needs to hold the information it conveys, and no more. Values have a built-in complexity: • Unit has one value (why it is called “unit”) • Boolean has two values • Int has 4,294,967,295 values • String has effectively infinite values To find the complexity of a product, we multiply the complexity of each part. • (Boolean, Boolean) has 4 values (2*2) • (Boolean, Boolean, Boolean) has 8 values (2*2*2) To find the complexity of a coproduct, we add the complexity of each part. • (Boolean |: Boolean) has 4 values (2+2) • (Boolean |: Boolean |: Boolean) has 6 values (2+2+2) To find the complexity of a ADT with a type parameter, multiply each part by the complexity of the type parameter: • Option[Boolean] has 3 values, Some[Boolean] and None (2+1) In FP, functions are total and must return an value for every input, no Exception. Minimising the complexity of inputs and outputs is the best way to achieve totality. As a rule of thumb, it is a sign of a badly designed function when the complexity of a function’s return value is larger than the product of its inputs: it is a source of entropy. The complexity of a total function is the number of possible functions that can satisfy the type signature: the output to the power of the input. • Unit => Boolean has complexity 2 • Boolean => Boolean has complexity 4 • Option[Boolean] => Option[Boolean] has complexity 27 • Boolean => Int is a mere quintillion going on a sextillion. • Int => Boolean is so big that if all implementations were assigned a unique number, each would require 4 gigabytes to represent. In reality, Int => Boolean will be something simple like isOdd, isEven or a sparse BitSet. This function, when used in an ADT, could be better replaced with a coproduct labelling the limited set of functions that are relevant. When our complexity is “infinity in, infinity out” we should introduce restrictive data types and validation closer to the point of input with Refined from the previous section. The ability to count the complexity of a type signature has one other practical application: we can find simpler type signatures with High School algebra! To go from a type signature to its algebra of complexity, simply replace • Either[A, B] with a + b • (A, B) with a * b • A => B with b ^ a do some rearranging, and convert back. For example, say we’ve designed a framework based on callbacks and we’ve managed to work ourselves into the situation where we have created this type signature: We can convert and rearrange then convert back to types and get which is much simpler: we only need to ask the users of our framework to provide a Either[A, B] => C. The same line of reasoning can be used to prove that is equivalent to also known as Currying. #### 4.1.8 Prefer Coproduct over Product An archetypal modelling problem that comes up a lot is when there are mutually exclusive configuration parameters a, b and c. The product (a: Boolean, b: Boolean, c: Boolean) has complexity 8 whereas the coproduct has a complexity of 3. It is better to model these configuration parameters as a coproduct rather than allowing 5 invalid states to exist. The complexity of a data type also has implications on testing. It is practically impossible to test every possible input to a function, but it is easy to test a sample of values with the Scalacheck property testing framework. If a random sample of a data type has a low probability of being valid, it is a sign that the data is modelled incorrectly. #### 4.1.9 Optimisations A big advantage of using a simplified subset of the Scala language to represent data types is that tooling can optimise the JVM bytecode representation. For example, we could pack Boolean and Option fields into an Array[Byte], cache values, memoise hashCode, optimise equals, use @switch statements when pattern matching, and much more. These optimisations are not applicable to OOP class hierarchies that may be managing state, throwing exceptions, or providing adhoc method implementations. #### 4.1.10 Example: Evaluation Java is a strict evaluation language: all the parameters to a method must be evaluated to a value before the method is called. Scala introduces the notion of by-name parameters on methods with a: =>A syntax. These parameters are wrapped up as a zero argument function which is called every time the a is referenced. Scala also has by-need evaluation of values, with the lazy keyword: the computation is evaluated at most once to produce the value. Unfortunately, Scala does not support by-need evaluation of method parameters. Cats formalises the three evaluation strategies with an ADT called Eval. The following is a simplified version of the implementation: The weakest form of evaluation is Always, giving no computational guarantees. Next is Later, guaranteeing at most once evaluation, whereas Now is pre-computed and therefore exactly once evaluation. When we write pure programs, we are free to replace any Always with Later or Now, and vice versa, with no change to the correctness of the program. This is the essence of referential transparency: the ability to replace a computation by its value, or a value by its computation. In functional programming we almost always want Now or Later (also known as strict and lazy): there is little value in Always. ### 4.2 Functionality Pure functions are typically defined as methods on an object. However, it can be clunky to use object methods since it reads inside-out, not left to right. In addition, a function on an object steals the namespace. If we were to define sin(t: T) somewhere else we get ambiguous reference errors. This is the same problem as Java’s static methods vs class methods. With the implicit class language feature (also known as extension methodology or syntax), and a little boilerplate, we can get the familiar style: Often it is best to just skip the object definition and go straight for an implicit class, keeping boilerplate to a minimum: #### 4.2.1 Polymorphic Functions The more common kind of function is a polymorphic function, which lives in a typeclass. A typeclass is a trait that: • holds no state • has a type parameter • has at least one abstract method (primitive combinators) • may contain generalised methods (derived combinators) • may extend other typeclasses There can only be one implementation of a typeclass for any given type parameter, a property known as typeclass coherence. Typeclasses look superficially similar to algebraic interfaces from the previous chapter, but algebras do not have to be coherent. Typeclasses are used in the Scala stdlib. We will explore a simplified version of scala.math.Numeric to demonstrate the principle: We can see all the key features of a typeclass in action: • there is no state • Ordering and Numeric have type parameter T • Ordering has abstract compare and Numeric has abstract plus, times, negate and zero • Ordering defines generalised lt and gt based on compare, Numeric defines abs in terms of lt, negate and zero. • Numeric extends Ordering We can now write functions for types that “have a” Numeric typeclass: We are no longer dependent on the OOP hierarchy of our input types, i.e. we don’t demand that our input “is a” Numeric, which is vitally important if we want to support a third party class that we cannot redefine. Another advantage of typeclasses is that the association of functionality to data is at compiletime, as opposed to OOP runtime dynamic dispatch. For example, whereas the List class can only have one implementation of a method, a typeclass method allows us to have a different implementation depending on the List contents and therefore offload work to compiletime instead of leaving it to runtime. #### 4.2.2 Syntax The syntax for writing signOfTheTimes is clunky, there are some things we can do to clean it up. Downstream users will prefer to see our method use context bounds, since the signature reads cleanly as “takes a T that has a Numeric but now we have to use implicitly[Numeric[T]] everywhere. By defining boilerplate on the companion of the typeclass we can obtain the implicit with less noise But it is still worse for us as the implementors. We have the syntactic problem of inside-out static methods vs class methods. We deal with this by introducing ops on the typeclass companion: Note that -x is expanded into x.unary_- by the compiler’s syntax sugar, which is why we define unary_- as an extension method. We can now write the much cleaner: The good news is that we never need to write this boilerplate because Typelevel Simulacrum provides a @typeclass macro annotation that automatically generates the .apply and .ops. It even allows us to define alternative (usually symbolic) names for common methods. In full: When there is a custom symbolic @op, it can be pronounced like its method name. e.g. < is pronounced “less than”, not “left angle bracket”. #### 4.2.3 Instances Instances of Numeric (which are also instances of Ordering) are defined as an implicit val that extends the typeclass, and can provide optimised implementations for the generalised methods: Although we are using +, *, unary_-, < and > here, which are the ops (and could be an infinite loop!), these methods exist already on Double. Class methods are always used in preference to extension methods. Indeed, the Scala compiler performs special handling of primitives and converts these method calls into raw dadd, dmul, dcmpl and dcmpg bytecode instructions, respectively. We can also implement Numeric for Java’s BigDecimal class. We could create our own data structure for complex numbers: And derive a Numeric[Complex[T]] if Numeric[T] exists. Since these instances depend on the type parameter, it is a def, not a val. The observant reader may notice that abs is not at all what a mathematician would expect. The correct return value for abs should be T, not Complex[T]. scala.math.Numeric tries to do too much and does not generalise beyond real numbers. This is a good lesson that smaller, well defined, typeclasses are often better than a monolithic collection of overly specific features. #### 4.2.4 Implicit Resolution We’ve discussed implicits a lot: this section is to clarify what implicits are and how they work. Implicit parameters are when a method requests that a unique instance of a particular type is in the implicit scope of the caller, with special syntax for typeclass instances. Implicit parameters are a clean way to thread configuration through an application. In this example, foo requires that typeclass instances of Numeric and Typeable are available for A, as well as an implicit Handler object that takes two type parameters Implicit conversion is when an implicit def exists. One such use of implicit conversions is to enable extension methodology. When the compiler is resolving a call to a method, it first checks if the method exists on the type, then its ancestors (Java-like rules). If it fails to find a match, it will search the implicit scope for conversions to other types, then search for methods on those types. Another use for implicit conversions is typeclass derivation. In the previous section we wrote an implicit def that derived a Numeric[Complex[T]] if a Numeric[T] is in the implicit scope. It is possible to chain together many implicit def (including recursively) which is the basis of typeful programming, allowing for computations to be performed at compiletime rather than runtime. The glue that combines implicit parameters (receivers) with implicit conversion (providers) is implicit resolution. First, the normal variable scope is searched for implicits, in order: • local scope, including scoped imports (e.g. the block or method) • outer scope, including scoped imports (e.g. members in the class) • ancestors (e.g. members in the super class) • the current package object • ancestor package objects (when using nested packages) • the file’s imports If that fails to find a match, the special scope is searched, which looks for implicit instances inside a type’s companion, its package object, outer objects (if nested), and then repeated for ancestors. This is performed, in order, for the: • given parameter type • expected parameter type • type parameter (if there is one) If two matching implicits are found in the same phase of implicit resolution, an ambiguous implicit error is raised. Implicits are often defined on a trait, which is then extended by an object. This is to try and control the priority of an implicit relative to another more specific one, to avoid ambiguous implicits. The Scala Language Specification is rather vague for corner cases, and the compiler implementation is the de facto standard. There are some rules of thumb that we will use throughout this book, e.g. prefer implicit val over implicit object despite the temptation of less typing. It is a quirk of implicit resolution that implicit object on companion objects are not treated the same as implicit val. Implicit resolution falls short when there is a hierarchy of typeclasses, like Ordering and Numeric. If we write a function that takes an implicit Ordering, and we call it for a primitive type which has an instance of Numeric defined on the Numeric companion, the compiler will fail to find it. Implicit resolution is particularly hit-or-miss if type aliases are used where the shape of the implicit parameters are changed. For example an implicit parameter using an alias such as type Values[A] = List[Option[A]] will probably fail to find implicits defined as raw List[Option[A]] because the shape is changed from a thing of things of A to a thing of A. ### 4.3 Modelling OAuth2 We will finish this chapter with a practical example of data modelling and typeclass derivation, combined with algebra / module design from the previous chapter. In our drone-dynamic-agents application, we must communicate with Drone and Google Cloud using JSON over REST. Both services use OAuth2 for authentication. There are many ways to interpret OAuth2, but we will focus on the version that works for Google Cloud (the Drone version is even simpler). #### 4.3.1 Description Every Google Cloud application needs to have an OAuth 2.0 Client Key set up at Obtaining a Client ID and a Client secret. The application can then obtain a one time code by making the user perform an Authorization Request in their browser. We need to make this page open in the browser: The code is delivered to the {CALLBACK_URI} in a GET request. To capture it in our application, we need to have a web server listening on localhost. Once we have the code, we can perform an Access Token Request: which gives a JSON response payload Bearer tokens typically expire after an hour, and can be refreshed by sending an HTTP request with any valid refresh token: responding with All userland requests to the server should include the header after substituting the actual BEARER_TOKEN. Google expires all but the most recent 50 bearer tokens, so the expiry times are just guidance. The refresh tokens persist between sessions and can be expired manually by the user. We can therefore have a one-time setup application to obtain the refresh token and then include the refresh token as configuration for the user’s install of the headless server. Drone doesn’t implement the /auth endpoint, or the refresh, and simply provides a BEARER_TOKEN through their user interface. #### 4.3.2 Data The first step is to model the data needed for OAuth2. We create an ADT with fields having exactly the same name as required by the OAuth2 server. We will use String and Long for brevity, but we could use refined types if they leak into our business models. #### 4.3.3 Functionality We need to marshal the data classes we defined in the previous section into JSON, URLs and POST-encoded forms. Since this requires polymorphism, we will need typeclasses. jsonformat is a simple JSON library that we will study in more detail in a later chapter for teaching purposes, we should use Typelevel Circe for production systems. jsonformat consists of a JSON AST and encoder / decoder typeclasses: We need instances of JsDecoder[AccessResponse] and JsDecoder[RefreshResponse]. We can do this by making use of a helper function: We put the instances on the companions of our data types, so that they are always in the implicit scope: We can then parse a string into an AccessResponse or a RefreshResponse We need to write our own typeclasses for URL and POST encoding. The following is a reasonable design: We need to provide typeclass instances for basic types: We use Refined.unsafeApply when we can logically deduce that the contents of the string are already url encoded, bypassing any further checks. .list is an example of simple typeclass derivation, much as we derived Numeric[Complex] from the underlying numeric representation. The .intercalate method is like .mkString but more general. In a dedicated chapter on Typeclass Derivation we will calculate instances of UrlQueryWriter automatically, as well as clean up what we have already written, but for now we will write the boilerplate for the types we wish to convert: #### 4.3.4 Module That concludes the data and functionality modelling required to implement OAuth2. Recall from the previous chapter that we define components that need to interact with the world as algebras, and we define business logic in a module, so it can be thoroughly tested. We define our dependency algebras, and use context bounds to show that our responses must have a JsDecoder and our POST payload must have a UrlEncodedWriter: Note that we only define the happy path in the JsonClient API. We will get around to error handling in a later chapter. Obtaining a CodeToken from the Google OAuth2 server involves 1. starting an HTTP server on the local machine, and obtaining its port number. 2. making the user open a web page in their browser, which allows them to log in with their Google credentials and authorise the application, with a redirect back to the local machine. 3. capturing the code, informing the user of next steps, and closing the HTTP server. We can model this with three methods on a UserInteraction algebra. It almost sounds easy when put like that. We also need an algebra to abstract over the local system time And introduce data types that we will use in the refresh logic Now we can write an OAuth2 client module: ### 4.4 Summary • algebraic data types (ADTs) are defined as products (final case class) and coproducts (sealed abstract class). • Refined types enforce constraints on values. • concrete functions can be defined in an implicit class to maintain left-to-right flow. • polymorphic functions are defined in typeclasses. Functionality is provided via “has a” context bounds, rather than “is a” class hierarchies. • typeclass instances are implementations of a typeclass. • @simulacrum.typeclass generates .ops on the companion, providing convenient syntax for typeclass functions. • typeclass derivation is compiletime composition of typeclass instances. ## 5. Cats Typeclasses In this chapter we will tour most of the typeclasses in Cats. We don’t use everything in drone-dynamic-agents so we will give standalone examples when appropriate. Before we introduce the typeclass hierarchy, we will peek at the four most important methods from a control flow perspective: the methods we will use the most in typical FP applications: Typeclass Method From Given To Functor map F[A] A => B F[B] Applicative pure A F[A] Monad flatMap F[A] A => F[B] F[B] Traverse sequence F[G[A]] G[F[A]] We know that operations which return a F[_] can be run sequentially in a for comprehension by .flatMap, defined on its Monad[F]. The context F[_] can be thought of as a container for an intentional effect with A as the output: .flatMap allows us to generate new effects F[B] at runtime based on the results of evaluating previous effects. Of course, not all type constructors F[_] are effectful, even if they have a Monad[F]. Often they are data structures. By using the least specific abstraction, we can reuse code for List, Either, Future and more. If we only need to transform the output from an F[_], that is just .map, introduced by Functor. In Chapter 3, we ran effects in parallel with .mapN. In Functional Programming, parallelisable computations are considered less powerful than sequential ones. In between Monad and Functor is Applicative, defining .pure that lets us lift a value into an effect, or create a data structure from a single value. .sequence is useful for rearranging type constructors. If we have an F[G[_]] but need a G[F[_]], e.g. List[Future[Int]] but need a Future[List[Int]], that is .sequence. ### 5.1 Agenda This chapter is longer than usual and jam-packed with information: it is perfectly reasonable to read it over several sittings. Remembering everything would require super-human powers, so treat this chapter as a way of knowing where to look for more information. Notably absent are many typeclasses that extend Monad. They get their own chapter later. ### 5.2 Appendable Things A Semigroup can be defined for a type if two values can be combined. The operation must be associative, meaning that the order of nested operations should not matter, i.e. A Monoid is a Semigroup with an empty element. Combining .empty with any other a should give a. This is probably bringing back memories of Numeric from Chapter 4. There are implementations of Monoid for all the primitive numbers, but the concept of appendable things is useful beyond numbers. Band has the law that the .combine operation of the same two elements is idempotent, i.e. gives the same value. Examples are anything that can only be one value, such as Unit, least upper bounds, or a Set. Band provides no further methods yet users can make use of the guarantees for performance optimisation. Semilattice goes one further and adds the additional guarantee that the order of the parameters in .combine does not matter. A Group is a Monoid where every value has an inverse, that when combined gives the .empty element. For example, every Int has an inverse which is its negated value. As a realistic example for Monoid, consider a trading system that has a large database of reusable trade templates. Populating the default values for a new trade involves selecting and combining multiple templates, with a “last rule wins” merge policy if two templates provide a value for the same field. The “selecting” work is already done for us by another system, it is our job to combine the templates in order. We will create a simple template schema to demonstrate the principle, but keep in mind that a realistic system would have a more complicated ADT. If we write a method that takes templates: List[TradeTemplate], we only need to call and our job is done! But to get zero or call |+| we must have an instance of Monoid[TradeTemplate]. We can create an instance on the companion: However, this doesn’t compile because there is no Monoid[Option[Currency]] or Monoid[Option[Boolean]], so we must provide them: Now everything compiles, let’s try it out… All we needed to do was implement one piece of business logic and Monoid took care of everything else for us! Note that the list of payments are concatenated. This is because the default Monoid[List] uses concatenation of elements and happens to be the desired behaviour. If the business requirement was different, it would be a simple case of providing a custom Monoid[List[LocalDate]]. ### 5.3 Objecty Things In the chapter on Data and Functionality we said that the JVM’s notion of equality breaks down for many things that we can put into an ADT. The problem is that the JVM was designed for Java, and .equals is defined on java.lang.Object whether it makes sense or not. There is no way to remove .equals and no way to guarantee that it is implemented. However, in FP we prefer typeclasses for polymorphic functionality and even the concept of equality is captured at compiletime. Indeed === (triple equals) is more typesafe than == (double equals) because it can only be compiled when the types are the same on both sides of the comparison. This catches a lot of bugs. .eqv has the same implementation requirements as Object.equals • commutative f1 === f2 implies f2 === f1 • reflexive f === f • transitive f1 === f2 && f2 === f3 implies f1 === f3 By throwing away the universal concept of Object.equals we don’t take equality for granted when we construct an ADT, stopping us at compiletime from expecting equality when there is none. Continuing the trend of replacing old Java concepts, rather than data being a java.lang.Comparable, they now have an Order or PartialOrder according to: A PartialOrder is for values where there are some corner cases that cannot be compared with other values. Order requires that every value can be compared to every other value. Order implements .eqv in terms of the new primitive .compare. When a typeclass implements a parent’s primitive combinator with a derived combinator, an implied law of substitution for the typeclass is added. If an instance of Order were to override .eqv for performance reasons, it must behave identically the same as the original. Things that have an order may also have an absolute minimum and an absolute maximum value: Similarly to Object.equals, the concept of .toString on every class does not make sense in Java. We would like to enforce stringyness at compiletime and this is exactly what Show achieves: And Hash achieves the same thing for .hashCode ### 5.4 Mappable Things We’re focusing on things that can be mapped over, or traversed, in some sense: #### 5.4.1 Functor The only abstract method is .map, and it must compose, i.e. mapping with f and then again with g is the same as mapping once with the composition of f and g: The .map should also perform a no-op if the provided function is identity (i.e. x => x) Functor defines some convenience methods around .map that can be optimised by specific instances. The documentation has been intentionally omitted in the above definitions to encourage guessing what a method does before looking at the implementation. Please spend a moment studying only the type signature of the following before reading further: 1. .void takes an instance of the F[A] and always returns an F[Unit], it forgets all the values whilst preserving the structure. 2. .fproduct takes the same input as map but returns F[(A, B)], i.e. it tuples the contents with the result of applying the function. This is useful when we wish to retain the input. 3. .as ignores the content of the F[A] and replaces it with the B. 4. .tupleLeft pairs the contents of an F[A] with a constant B on the left. 5. .tupleRight pairs the contents of an F[A] with a constant B on the right. 6. .unzip splits a functor of tuples into a tuple of functors. 7. .lift takes a function A => B and returns a F[A] => F[B]. In other words, it takes a function over the contents of an F[A] and returns a function that operates on the F[A] directly. .as, .tupleLeft and .tupleRight are useful when we wish to retain some information that would otherwise be lost to scope. In our example application, as a nasty hack (which we didn’t even admit to until now), we defined .start and .stop to return their input: This allowed us to write terse business logic such as and But this hack pushes unnecessary complexity into the implementations. It is better if we let our algebras return F[Unit] and use .as: and #### 5.4.2 Foldable Technically, Foldable is for data structures that can be walked to produce a summary value. However, this undersells the fact that it is a one-typeclass army that can provide most of what we would expect to see in a Collections API. There are so many methods we are going to have to split them out, beginning with the abstract methods: We encountered Eval in the previous chapter, as a mechanism to control evaluation. An instance of Foldable need only implement .foldLeft and .foldRight to get all of the functionality in this typeclass, although methods are typically optimised for specific data structures. .foldMap has a marketing buzzword name: MapReduce. Given an F[A], a function from A to B, and a way to combine B (provided by the Monoid, along with a zero B), we can produce a summary value of type B. There is no enforced operation order, allowing for parallel computation. Noeither .foldLeft nor .foldRight require their parameters to have a Monoid, meaning that they need a starting value b and a way to combine each element of the data structure with the summary value. The order for traversing the elements is defined (.foldLeft goes from left to right, .foldRight goes from right to left) and therefore cannot be parallelised. The only law for Foldable is that .foldLeft and .foldRight should each be consistent with .foldMap for monoidal operations. e.g. appending an element to a list for .foldLeft and prepending an element to a list for .foldRight. However, .foldLeft and .foldRight do not need to be consistent with each other: in fact they often produce the reverse of each other. The simplest thing to do with .foldMap is to use the identity function, giving .combineAll (the natural sum of the monoidal elements) Recall that when we learnt about Monoid, we wrote this: We now know we could have written: The strangely named .intercalate inserts a specific A between each element before performing the fold which is a generalised version of the stdlib’s .mkString: The .foldLeft provides the means to obtain any element by traversal index, including a bunch of other related methods: Cats is a pure library of only total functions. Whereas List(0) can throw an exception, Foldable.get returns an Option[A] and would return None on an empty list. .size, .isEmpty and .nonEmpty do as we may expect. These methods really sound like a collections API. And, of course, anything with a Foldable can be converted into a List There are useful predicate checks .count is a way of counting how many elements are true for a predicate, .forall and .exists return true if all (or any, respectively) element meets the predicate, and may exit early. .find returns the first element matching the predicate. We can make use of Order by extracting the minimum or maximum element: For example we can ask which String is maximum (by lexicographical ordering) or By length This concludes the key features of Foldable. The takeaway is that anything we’d expect to find in a collection library is probably on Foldable. #### 5.4.3 Reducible Foldable has a method named .combineAllOption which is like .fold but takes a Semigroup instead of a Monoid, returning an Option if the collection is empty (recall that Semigroup does not have a empty): Taking this concept further, the child typeclass Reducible has more Semigroup variants and makes sense for data structures that are never empty, without requiring a Monoid on the elements. Importantly, there are variants that take monadic calculations. We already used .foldLeftM when we first wrote the business logic of our application, now we know that it is from Foldable: Some of the methods we have seen in this section (.size, .isEmpty, .nonEmpty, .exists, .forall, .count) are defined on UnorderedFoldable, a parent of Foldable, and can be used for niche data structures that do not have an ordering. #### 5.4.4 Traverse Traverse is what happens when we cross a Functor with a Foldable At the beginning of the chapter we showed the importance of .traverse and .sequence for swapping around type constructors to fit a requirement (e.g. List[Future[_]] to Future[List[_]]). We can .zipWithIndex to pair each element with its ordered location, or .mapWithIndex if we wish to do something with the index but do not need to keep it around. .flatTraverse and .flatSequence are useful for cases where we want to flatten the results of the calculation. For example, say we have a List[Future[List[_]]] and we want a Future[List[_]] by concatenating all the lists. Finally NonEmptyTraverse, like Reducible, provides variants of these methods for data structures that cannot be empty, accepting the weaker Semigroup instead of a Monoid, and an Apply instead of an Applicative. #### 5.4.5 Distributive Very closely related to Traverse is Distributive, with .traverse and .sequence highlighted to show the subtle difference in the type signatures The important difference being that .distribute and .cosequence take functions that take another functor G[_] and rearrange them so the F[_] is the outermost context. Contrast to Traverse which does the opposite. Distribute is a good fallback if we need to perform a .traverse but we don’t have the Traverse or Applicative that we need. ### 5.5 More Functors Although not part of the typeclass hierarchy, these are some typeclasses closely related to Functor that are worth knowing #### 5.5.1 Align Align is about merging and padding a Functor. Before looking at Align, meet the Ior data type: i.e. it is a data encoding of inclusive logical OR. A or B or both A and B. Align does not extend Functor but instead must be able to provide one .align constructs an Ior out of two F[_], in the same F[_] context. .alignWith takes a function from either an A or a B (or both) to a C and returns a lifted function from a tuple of F[A] and F[B] to an F[C]. .alignCombine allows us to combine two F[A] when A has a Semigroup. For example, the implementation of Semigroup[Map[K, V]] defers to Semigroup[V], combining two entries results in combining their values, having the consequence that Map[K, List[A]] behaves like a multimap: and a Map[K, Int] simply tally their contents when merging: .padZip and .padZipWith are for partially merging two data structures that might be missing values on one side. For example if we wanted to aggregate independent votes and retain the knowledge of where the votes came from #### 5.5.2 Bifunctor, Bifoldable and Bitraverse Cats provides variations of Functor, Foldable and Traverse for structures that require two functions, not just one. The simplest example of a Bifunctor is Either. Sometimes we want to map over both possible values in a convenient way And whereas we can use the regular .map to map over the Right, sometimes we want to map over just the Left, which often contains the an error message leaving the contents of the Right untouched. Similarly Bifoldable and Bitraverse are the same idea for Foldable and Traverse .bifoldMap is especially useful for the case where both functions return the same value, allowing us to produce a single value and combine the two sides: #### 5.5.3 Filters FunctorFilter adds the ability to discard entries from the functor with its .mapFilter method and related convenience methods. Similarly to Align, FunctorFilter must be able to provide a Functor. And similarly, TraverseFilter can filter the values while traversing or sequencing ### 5.6 Variance We must return to Functor for a moment and discuss an ancestor that we previously ignored: Invariant has a method .imap which says that given a function from A to B, and a function from B to A, then we can convert F[A] to F[B]. Functor is a short name for what should be covariant functor. But since Functor is so popular it gets the nickname. Likewise Contravariant should really be contravariant functor, and Invariant an invariant functor. Functor implements .imap with .map and ignores the function from B to A. Contravariant, on the other hand, implements .imap with .contramap and ignores the function from A to B: It is important to note that, although related at a theoretical level, the words covariant, contravariant and invariant do not directly refer to Scala type variance (i.e. + and - prefixes that may be written in type signatures). Invariance here means that it is possible to map the contents of a structure F[A] into F[B]. Using identity we can see that A can be safely downcast (or upcast) into B depending on the variance of the functor. .map may be understood by its contract “if you give me an F of A and a way to turn an A into a B, then I can give you an F of B”. Likewise, .contramap reads as “if you give me an F of A and a way to turn a B into an A, then I can give you an F of B”. We will consider an example: in our application we introduce domain specific types Alpha, Beta, Gamma, etc, to ensure that we don’t mix up numbers in a financial calculation: but now we’re faced with the problem that we don’t have any typeclasses for these new types. If we use the values in JSON documents, we have to write instances of JsEncoder and JsDecoder. However, JsEncoder has a Contravariant and JsDecoder has a Functor, so we can derive instances. Filling in the contract: • “if you give me a JsDecoder for a Double, and a way to go from a Double to an Alpha, then I can give you a JsDecoder for an Alpha”. • “if you give me a JsEncoder for a Double, and a way to go from an Alpha to a Double, then I can give you a JsEncoder for an Alpha”. Methods on a typeclass can have their type parameters in contravariant position (method parameters) or in covariant position (return type). If a typeclass has a combination of covariant and contravariant positions, it might have an invariant functor. For example, Semigroup and Monoid have an Invariant, but not a Functor or a Contravariant. ### 5.7 Semigroupal, Apply and FlatMap Consider this the warm-up act to Applicative and Monad #### 5.7.1 Semigroupal Semigroupal looks at first sight to be similar to Align because it zips together two values in the same context however this is the Cartesian product, which means that every A is matched up with every B. Compare how Align.align and Semigroupal.product differ in this example #### 5.7.2 Apply Apply extends Functor and Semigroupal by adding a method named .ap which is similar to .map in that it applies a function to values. However, with .ap, the function is in the same context as the values. It is worth taking a moment to consider what that means for a simple data structure like Option[A], having the following implementation of .ap To implement .ap, we must first extract the function f: A => B from ff: Option[A => B], then we can map over fa. The extraction of the function from the context is the important power that Apply brings, allowing multiple function to be combined inside the context. Returning to Apply, we find .mapX boilerplate that allows us to combine parallel functions and then map over their combined output: Read .map2 as a contract promising: “if you give me an F of A and an F of B, with a way of combining A and B into a Z, then I can give you an F of Z”. There are many uses for this contract and the two most important are: • constructing some typeclasses for a product type Z from its constituents A and B • performing effects in parallel, like the drone and google algebras we created in Chapter 3, and then combining their results. Indeed, Apply is so useful that it has special syntax that is worth revisiting from Chapter 3: where the .mapN method will apply .map5 here, because the compiler knows the size of the tuple. We could also write or directly call applyX .productL and .productR offer a way to ignore the output from one of two effects: Despite being more commonly used with effects, Apply works just as well with data structures. Consider rewriting as If we only want the combined output as a tuple, methods exist to do just that: #### 5.7.3 FlatMap FlatMap introduces .flatMap which allows functions over the result of an effect to return a new effect, or for functions over the values of a data structure to return new data structures that are then joined. .flatten takes a nested context and squashes it into one. Derived combinators are introduced for .map2 that require consistency with .flatMap ordering. We will see later that this law has consequences for parallelisation strategies. .mproduct is like Functor.fproduct and pairs the function’s input with its output, inside the F. .ifM is a way to construct a conditional data structure or effect: If we want to ignore the result of the .flatMap effect, we can use .flatTap, analagous to .productL Finally .foreverM repeating an effect without stopping. Instances of FlatMap are guaranteed to be stack safe, in the sense that we will never get a StackOverflowError as a result of calling .foreverM, because the tail recursive step must be implemented If our love of FP is not forever, we can exit the loop Only kidding, our love of FP is forever, we simply return Some love and continue FPing! #### 5.7.4 InvariantSemigroupal, InvariantMonoidal InvariantSemigroupal is a convenient typeclass that combines Semigroupal and Invariant without adding any new methods, simply because it is so common to do this. That leads to InvariantMonoidal which introduces .point as a way to wrap a single value in a context. .unit is a convenience for .point(()) (the Unit type). ### 5.8 Applicative and Monad From an API point of view, Applicative is Apply with a .pure method, and Monad extends Applicative with FlatMap. In many ways, Applicative and Monad are the culmination of everything we’ve seen in this chapter. .pure (aliased to .point) allows us to create effects or data structures from values. Instances of Applicative must meet some laws, effectively asserting that all the methods are consistent: • Identity: fa <*> pure(identity) === fa, (where fa is an F[A]) i.e. applying pure(identity) does nothing. • Homomorphism: pure(a) <*> pure(ab) === pure(ab(a)) (where ab is an A => B), i.e. applying a pure function to a pure value is the same as applying the function to the value and then using pure on the result. • Interchange: pure(a) <*> fab === fab <*> pure(f => f(a)), (where fab is an F[A => B]), i.e. pure is a left and right identity • Mappy: map(fa)(f) === fa <*> pure(f) Monad adds additional laws: • Left Identity: pure(a).flatMap(f) === f(a) • Right Identity: a.flatMap(pure(_)) === a • Associativity: fa.flatMap(f).flatMap(g) === fa.flatMap(a => f(a).flatMap(g)) where fa is an F[A], f is an A => F[B] and g is a B => F[C]. Associativity says that chained flatMap calls must agree with nested flatMap. However, it does not mean that we can rearrange the order, which would be commutativity. For example we cannot rearrange as .start and .stop are non-commutative, because the intended effect of starting then stopping a node is different to stopping then starting it! But .start is commutative with itself, and .stop is commutative with itself, so we can rewrite as which are equivalent for our algebra, but not in general. We’re making a lot of assumptions about the Google Container API here, but this is a reasonable choice to make. A practical consequence is that a Monad must be commutative if its applyX methods can be allowed to run in parallel. We cheated in Chapter 3 when we ran these effects in parallel because we know that they are commutative among themselves. When it comes to interpreting our application, later in the book, we will have to provide evidence that these effects are in fact commutative, or an asynchronous implementation may choose to sequence the operations to be on the safe side. The subtleties of how we deal with (re)-ordering of effects, and what those effects are, deserves a dedicated chapter on Cats Monads. #### 5.8.1 Commutativity Now that we have discussed commutativity in the context of Monad we can understand the entire suite of Commutative* typeclasses in Cats: they add no additional methods but add the constraint that the order of effects does not matter. ### 5.9 ContravariantMonoidal ContravariantMonoidal is the Contravariant analogue of Apply .contramap2 says that if we can break a C into an A and a B, and we’re given an F[A] and an F[B], then we can get an F[C]. This is a great way to generate contravariant typeclass instances for product types by breaking the products into their parts. Cats has an instance of ContravariantMonoidal[Eq], let’s construct an Eq for a new product type Foo Analagously to .mapN, there is a .contramapN that makes it even easier to use Mirroring Apply, ContravariantMonoidal also has terse syntax for tuples. Generally, if a typeclass author provides an instance of ContravariantMonoidal or Apply it makes it a lot easier for users to derive instances for their data. .trivial allows creating implementations where the type parameter is ignored. Such values are called universally quantified. For example, the ContravariantMonoidal[Eq].trivial[Nil] returns an implementation of Eq for an empty list, which is always true. Be careful, because we can create broken instances if we use .trivial for situations that require non-trivial logic. For example we can accidentally create a broken Eq ### 5.10 SemigroupK, MonoidK, Alternative SemigroupK is Semigroup but for type constructors, and MonoidK is the equivalent of Monoid. The K suffix is for Kind, as in the Higher Kinded Types (HKT) language feature described in Chapter 1. The .algebra method gives us a regular Semigroup or Monoid for a concrete type parameter A. Although it may look on the surface as if <+> behaves like |+| it is best to think of it as operating only at the F[_] level, never looking into the contents. SemigroupK has the convention that it should ignore failures and “pick the first winner”. <+> can therefore be used as a mechanism for early exit (losing information) and failure-handling via fallbacks: For example, if we have a NonEmptyList[Option[Int]] and we want to ignore None values (failures) and pick the first winner (Some), we can call .reduceK where .reduceK is defined on Reducible along with other higher-kinded variants of fold and reduce: Now that we know about SemigroupK, we realise that we could have more easily created an instance of Monoid[TradeTemplate] the section on Appendable Things. Our objective was to “pick the last winner”, which is the same as “pick the winner” if the arguments are swapped. Note the use of <+> ccy and otc with arguments swapped, and that we no longer need to define Monoid[Option[Currency]], Monoid[Option[Boolean]] (which was breaking typeclass coherence) or def lastWins[A]: Monoid[Option[A]]. Applicative has a specialised versions of MonoidK called Alternative .unite lets us fold a data structure using the outer container’s MonoidK.algebra rather than the inner content’s Monoid (if it even has one). For List[Either[String, Int]] this means Left[String] values are converted into .empty, then everything is concatenated. A convenient way to discard errors: .separate is very useful if we have a collection of Either and we want to reorganise them into a collection of A and a collection of B and .separateFoldable can be used when we have a Foldable rather than a Monad. In the cases where we can use both, it is common to use .separate. ### 5.11 Co-things A co-thing typically has some opposite type signature to whatever thing does, but is not necessarily its inverse. To highlight the relationship between thing and co-thing, we will include the type signature of thing wherever we can. #### 5.11.1 CoflatMap .coflatMap takes an F[A] => B that acts on an F[A] rather than its elements. But this is not necessarily the full fa, it can be a substructure that has been created by .coflatten. Compelling use-cases for CoflatMap are rare, although when shown in the Functor permutation table (for F[_], A and B) it is difficult to argue why any method should be less important than the others: method parameter map A => B contramap B => A imap (A => B, B => A) ap F[A => B] flatMap A => F[B] coflatMap F[A] => B #### 5.11.2 Comonad .extract unwraps an element from its context. The Id type alias that we encountered in Chapter 1 has an instance of Comonad, so we can reach into an Id and .extract the value it contains. Similarly, Eval has a Comonad with .extract effectively being the Now strategy. Another example of a Comonad is the NonEmptyList, where .extract returns the .head element and .coflatMap operates on all the tails of the list. Effects do not typically have an instance of Comonad since it would break referential transparency to interpret an IO[A] into an A. Comonad allows navigation over elements of a data structure and eventually returning to one view of that data. Consider a neighbourhood (Hood for short) of a list, containing all the elements to the left of an element (.lefts), and all the elements to its right (.rights). The .lefts and .rights should each be ordered with the nearest element to the .focus at the head, such that we can recover the original List via .toList We can write methods that let us move the focus one to the left (.previous) and one to the right (.next) .more repeatedly applies an optional function to Hood such that we calculate all the views that Hood can take on the list We can now implement Comonad[Hood] .coflatten gives us a Hood[Hood[List]] containing all the possible neighbourhoods in our initial List Indeed, .coflatten is just .positions! We can override it with a more direct (and performant) implementation Comonad generalises the concept of Hood to arbitrary data structures. Hood is an example of a zipper (unrelated to Zip). An application of a zipper is for cellular automata, which compute the value of each cell in the next generation by performing a computation based on the neighbourhood of that cell. Finally, Bimonad exists for structures that have both a Monad and a Comonad Examples of Bimonads are Id, Eval, pure functions that have no parameters (thunks), and many non-empty collections. ### 5.12 Summary That was a lot of material! We have just explored a standard library of polymorphic functionality. But to put it into perspective: there are more traits in the Scala stdlib Collections API than typeclasses in Cats. It is normal for an FP application to only touch a small percentage of the typeclass hierarchy, with most functionality coming from domain-specific algebras and typeclasses. Even if the domain-specific typeclasses are just specialised clones of something in Cats, it is OK to refactor it later. To help, we have included a cheat-sheet of the typeclasses and their primary methods in the Appendix. To help further, Valentin Kasas explains how to combine N things: ## 6. Cats Data Types In this chapter we will explore some Cats data types that augment the Scala language with useful semantics and additional type safety. ### 6.1 Natural Transformations A function from one type to another is written as A => B in Scala, which is syntax sugar for a Function1[A, B]. Cats provides similar syntax sugar F ~> G for functions over type constructors F[_] to G[_]. These F ~> G are called natural transformations and are universally quantified because they don’t care about the contents of F[_]. An example of a natural transformation is a function that converts a Vector into a List Or, more concisely, making use of kind-projector’s syntax sugar with either of the following: However, in day-to-day development, it is far more likely that we will use a natural transformation to map between algebras. For example, in drone-dynamic-agents we may want to implement our Google Container Engine Machines algebra with an off-the-shelf algebra, BigMachines. Instead of changing all our business logic and tests to use this new BigMachines interface, we may be able to write a transformation from Machines ~> BigMachines. We will return to this idea in the chapter on Cats Monads. ### 6.2 Containers #### 6.2.1 Validated At first sight, Validated appears to be a clone of Either: With convenient syntax However, the data structure itself is not the complete story. Validated intentionally does not have an instance of any Monad, restricting itself to success-biased versions of Applicative. The big advantage of restricting to Applicative is that Validated is explicitly for situations where we wish to report all failures, whereas Either is used to stop at the first failure. To accommodate failure accumulation, a popular form of Validated is ValidatedNel, having a NonEmptyList[E] in the failure position. Consider performing input validation of data provided by a user using Either and .flatMap: If we use .mapN syntax we still get back the first failure. This is because Either is a Monad, its .mapX methods must be consistent with .flatMap and not assume that any operations can be performed out of order. Compare to: This time, we get back all the failures! Either and Validated are the more performant FP equivalent of a checked exception for input validation, avoiding both a stacktrace and requiring the caller to deal with the failure resulting in more robust systems. #### 6.2.2 Ior We encountered Ior, a data encoding of inclusive logical OR, when we learnt about Align. .flatMap is right-biased (Both and Right), taking a Semigroup of the Left content to combine rather than break early. Although it is tempting to use Ior in return types, overuse is an anti-pattern, because it is more difficult for the caller to consider three scenarios (roughly failure, partial failure, and success) than regular failure and success. #### 6.2.3 Higher Kinded Either The EitherK data type wraps Either for type constructors: Typeclass instances simply delegate to those of the F[_] and G[_]. The most popular use case for Coproduct is when we want to create an anonymous coproduct of multiple ADTs. #### 6.2.4 Const Const, for constant, is a wrapper for a value of type A, along with a spare type parameter B. Const provides an instance of Applicative[Const[A, ?]] if there is a Monoid[A] available: The most important thing about this Applicative is that it ignores the B parameters, continuing on without failing and only combining the constant values that it encounters. Going back to our example application drone-dynamic-agents, we should first refactor our logic.scala file to use Applicative instead of Monad. We wrote logic.scala before we learnt about Applicative and now we know better: Since our business logic only requires an Applicative, we can write mock implementations with F[a] as Const[String, a]. In each case, we return the name of the function that is called: With this interpretation of our program, we can assert on the methods that are called: Alternatively, we could have counted total method calls by using Const[Int, ?] or an Map[String, Int]. With this test, we’ve gone beyond traditional Mock testing with a Const test that asserts on what is called without having to provide implementations. This is useful if our specification demands that we make certain calls for certain input, e.g. for accounting purposes. Furthermore, we’ve achieved this with compiletime safety. Taking this line of thinking a little further, say we want to monitor (in production) the nodes that we are stopping in .act. We can create implementations of Drone and Machines with Const, calling it from our wrapped version of .act We can do this because monitor is pure and running it produces no side effects. This runs the program with ConstImpl, extracting all the calls to Machines.stop, then returning it alongside the WorldView. We can unit test this: We have used Const to do something that looks like Aspect Oriented Programming, once popular in Java. We built on top of our business logic to support a monitoring concern, without having to complicate the business logic. It gets even better. We can run ConstImpl in production to gather what we want to .stop, and then provide an optimised implementation of act that can make use of implementation-specific batched calls. The silent hero of this story is Applicative. Const lets us show off what is possible. If we need to change our program to require a Monad, we can no longer use Const and must write full mocks to be able to assert on what is called under certain inputs. The Rule of Least Power demands that we use Applicative instead of Monad wherever we can. #### 6.2.5 Chain Chain is a catenable sequence that supports O(1) appending, prepending and concatenation. It is especially useful if we need to construct a collection by concatening existing collections (that may be any Seq), adding individual elements (by pre-pending or appending) or concatenating existing Chain values. Chain has a Monad and also has a NonEmptyChain variant. The user of Chain is expected to manually balance it because two Chain may contain the same values but be represented different ways, and therefore have different performance characteristics. For example, if we construct a Chain entirely out of Singleton by using .prepend and .append then our Chain will have more links in it but if we use .concat and Chain.fromSeq where possible then we will have less links per datum. The ability to control the shape of the Chain makes it suitable for cases where it is useful to encode domain knowledge of a hierarchy into the data structure. For example, in artificial intelligence, a Chain can be used in clustering algorithms to organise data into a hierarchy of increasingly similar things. It is possible to represent XML documents with a Chain. When working with hierarchical data, consider using a Chain instead of rolling a custom data structure. Chain is also useful if we wish to build a regular data structure such as Vector but the performance cost of appending Vector at every level is too high. Constructing the Vector by first creating a Chain will cost O(N) and thereafter the lookup cost is O(1). #### 6.2.6 OneAnd Recall that Foldable is the Cats equivalent of a collections API and Reducible is for non-empty collections. We have already seen NonEmptyList and NonEmptyChain which provide Reducible, there is also NonEmptySet, NonEmptyMap and NonEmptyVector which wrap the standard library collections. The simple data structure OneAnd wraps any other collection to turn it into a Reducible: NonEmptyList[A] could be an alias to OneAnd[List, A]. Similarly, we can create non-empty Stream. However it may break ordering and uniqueness characteristics of the underlying structure: a OneAnd[Set, A] is not a non-empty Set, it is a Set with a guaranteed first element that may also be in the Set. ### 6.3 Summary In this chapter we have skimmed over the data types that Cats has to offer. It is not necessary to remember everything from this chapter: think of each section as having planted the kernel of an idea. The world of functional data structures is an active area of research. Academic publications appear regularly with new approaches to old problems. Implementing a functional data structure from the literature is a good contribution to the Cats ecosystem. ## 7. Cats Monads In this chapter we will study some of the most important implementations of Monad and in particular those that are provided by the cats-mtl and cats-effect libraries which can be installed with and the source snippets in this section assume that the following imports are being used ### 7.1 Always in motion is the Future The biggest problem with Future is that it eagerly schedules work during construction. As we discovered in the introduction, Future conflates the definition of a program with interpreting it (i.e. running it). Future is also suboptimal from a performance perspective: every time .flatMap is called, a closure is submitted to an Executor, resulting in unnecessary thread scheduling and context switching. It is not unusual to see 50% of our CPU power dealing with thread scheduling, instead of doing the work. So much so that parallelising work with Future can often make it slower. Combined, eager evaluation and executor submission means that it is impossible to know when a job started, when it finished, or the sub-tasks that were spawned to calculate the final result. Furthermore, Future.flatMap requires an ExecutionContext to be in implicit scope: users are forced to think about business logic and execution semantics at the same time. ### 7.2 Effects and Side Effects If we cannot call side-effecting methods in our business logic, or in Future (or Id, or Either, or Const, etc), when can we write them? The answer is: in a Monad that delays execution until it is interpreted at the application’s entrypoint. We can now refer to I/O and mutation as an effect on the world, captured by the type system, as opposed to having a hidden side-effect. The simplest implementation of such a Monad is IO, formalising the version we wrote in the introduction: The .interpret method is only called once, in the entrypoint of an application: However, there are two big problems with this simple IO: 1. it can stack overflow 2. it doesn’t support parallel computations Both of these problems will be overcome in this chapter. However, no matter how complicated the internal implementation of a Monad, the principles described here remain true: we’re modularising the definition of a program and its execution, such that we can capture effects in type signatures, allowing us to reason about them, and reuse more code. ### 7.3 Stack Safety On the JVM, every method call adds an entry to the call stack of the Thread, like adding to the front of a List. When the method completes, the method at the .head is thrown away. The maximum length of the call stack is determined by the -Xss flag when starting up java. Tail recursive methods are detected by the Scala compiler and do not add an entry. If we hit the limit, by calling too many chained methods, we get a StackOverflowError. Unfortunately, every nested call to our IO’s .flatMap adds another method call to the stack. The easiest way to see this is to repeat an action forever, and see if it survives for longer than a few seconds. We can create a (broken) recursive .forever with and then call it on an action that just prints to the screen A way to achieve stack safety is to convert method calls into references to an ADT, the Free monad: The Free ADT is a natural data type representation of the Monad interface: 1. Pure represents .pure 2. FlatMapped represents .flatMap When an ADT mirrors the arguments of related functions, it is called a Church encoding. Free is named because it can be generated for free for any S[_]. For example, we could set S to be the Drone or Machines algebras from Chapter 3 and generate a data structure representation of our program. We will return to why this is useful at the end of this chapter. #### 7.3.1 Trampoline Free is more general than we need for now. Setting the algebra S[_] to Function0, a deferred calculation or thunk, we get Trampoline and can implement a stack safe Monad Although this is not technically a @tailrec implementation of tailRecM, it uses constant stack space because each call returns a heap object (.flatMap will return a FlatMapped), which delays recursion. Convenient functions are provided to create a Trampoline eagerly (.done) or by-name (.delay). We can also create a Trampoline from a by-name Trampoline (.defer): When we see Trampoline[A] in a codebase we can always mentally substitute it with A, because it is simply adding stack safety to the pure computation. We get the A by interpreting Free, provided by .run. #### 7.3.2 Stack Safe IO Our IO can be made stack safe thanks to Trampoline: The interpreter, .unsafePerformIO(), has an intentionally scary name to discourage using it except in the entrypoint of the application. This time, using FlatMap.foreverM instead of our naive .forever, we don’t get a stack overflow error Using a Trampoline typically introduces a performance regression vs a regular reference. It is Free in the sense of freely generated, not free as in gratis. ### 7.4 Monad Transformer Library Monad transformers are data structures that wrap an underlying value and provide a monadic effect. For example, in Chapter 2 we used OptionT to let us use F[Option[A]] in a for comprehension as if it was just a F[A]. This gave our program the effect of an optional value. Alternatively, we can get the effect of optionality if we have a MonadPlus. This subset of data types and extensions to Monad are often referred to as the Monad Transformer Library (MTL), summarised below. In this section, we will explain each of the transformers, why they are useful, and how they work. Effect Underlying Transformer Typeclass optionality F[Option[A]] OptionT errors F[Either[E, A]] EitherT MonadError a runtime value A => F[B] ReaderT ApplicativeLocal journal / multitask F[(W, A)] WriterT FunctorListen evolving state S => F[(S, A)] StateT MonadState keep calm & carry on F[Ior[E, A]] IorT MonadChronicle #### 7.4.1 .mapK, .liftF and .liftK It is typical that a transformer will implement methods named .mapK and .liftF having the following general pattern: .mapK lets us apply a natural transformation to the context. .liftF lets us create a monad transformer if we have an F[A]. For example, we can create an OptionT[IO, String] by calling OptionT.liftF on an IO[String], which we seen in Chapter 2. .liftK is the same as .liftF but returns a natural transformation. Generally, there are three ways to create a monad transformer: • from the underlying, using the transformer’s constructor • from a single value A, using .pure from the Monad syntax • from an F[A], using .liftF on the companion #### 7.4.2 OptionT providing a MonadPlus This monad looks fiddly, but it is just delegating everything to the Monad[F] and then re-wrapping with an OptionT, with .tailRecM returning a heap object to guarantee stack safety. With this monad we can write logic that handles optionality in the F[_] context, rather than carrying around Option. For example, say we are interfacing with a social media website to count the number of stars a user has, and we start with a String that may or may not correspond to a user. We have this algebra: We need to call .getUser followed by .getStars. If we use Monad as our context, our function is difficult because we have to handle the Empty case: However, we can use OptionT in the return type: An optional value is a special case of a value that may be an error, where we don’t know anything about the error. The next section generalises OptionT. #### 7.4.3 EitherT EitherT allows us to use any type we want as the error value, providing contextual information about what went wrong. EitherT is a wrapper around an F[Either[E, A]] The Monad is a MonadError .raiseError and .handleErrorWith are self-descriptive: the equivalent of throw and catch an exception, respectively. Although EitherT has a MonadError, it is worth noting that most of the functionality sits on ApplicativeError, which does not require a Monad and is therefore more generally applicable. .attempt brings errors into the value, which is useful for exposing errors in subsystems as first class values. .handleError is for turning an error into a value for all cases, as opposed to .handleErrorWith which takes an F[A] and therefore allows partial recovery. We can rewrite our Twitter example to make use of MonadError We can also return the transformer directly, which looks like The decision to require a more powerful Monad vs directly returning a transformer is something that each team can decide for themselves based on the interpreters that they plan on using for their program. Forgetting EitherT for a moment, the simplest instance of MonadError is for Either, perfect for testing business logic that requires a MonadError but does not need an effect. For example, Our unit tests for .stars might cover these cases: As we’ve now seen several times, we can focus on testing the pure business logic without distraction. Finally, if we return to our JsonClient algebra from Chapter 4.3 recall that we only coded the happy path into the API. If our interpreter for this algebra only works for an F having a MonadError we get to define the kinds of errors as a tangential concern. Indeed, we can have two layers of error if we define the interpreter for a EitherT[IO, JsonClient.Error, ?] which cover I/O (network) problems, server status problems, and issues with our modelling of the server’s JSON payloads. ##### 7.4.3.1 Choosing an error type The community is undecided on the best strategy for the error type E in MonadError. One school of thought says that we should pick something general, like a String. The other school says that an application should have an ADT of errors, allowing different errors to be reported or handled differently. There are two problems with an ADT of errors on the application level: • it is very awkward to create a new error. One file becomes a monolithic repository of errors, aggregating the ADTs of individual subsystems. • no matter how granular the errors are, the resolution is often the same: log it and try it again, or give up. We don’t need an ADT for this. An error ADT is of value if every entry allows a different kind of recovery to be performed. A compromise between an error ADT and a String is an intermediary format. JSON is a good choice as it can be understood by most logging and monitoring frameworks. A problem with not having a stacktrace is that it can be hard to localise which piece of code was the source of an error. With sourcecode by Li Haoyi, we can include contextual information as metadata in our errors: We extend Throwable for maximum compatibility. Although Err is referentially transparent, the implicit construction of a Meta does not appear to be referentially transparent from a natural reading: two calls to Meta.gen (invoked implicitly when creating an Err) will produce different values because the location in the source code impacts the returned value: To understand this, we have to appreciate that sourcecode.* methods are macros that are generating source code for us. If we were to write the above explicitly it is clear what is happening: Yes, we’ve made a deal with the macro devil, but we could also write the Meta manually and have it go out of date quicker than our documentation. #### 7.4.4 ReaderT The reader monad wraps A => F[B] allowing a program F[B] to depend on a runtime value A. For those familiar with dependency injection, the reader monad is the FP equivalent of Spring or Guice’s @Inject, without the XML and reflection. ReaderT is just an alias to another more generally useful data type named after the mathematician Heinrich Kleisli. The most common use for ReaderT is to provide environment information to a program. In drone-dynamic-agents we need access to the user’s OAuth 2.0 Refresh Token to be able to contact Google. The obvious thing is to load the RefreshTokens from disk on startup, and make every method take a RefreshToken parameter. In fact, this is such a common requirement that Martin Odersky has proposed implicit functions for Scala 3. Our application could have an algebra that provides the configuration when needed, e.g. We have reinvented ApplicativeAsk, the typeclass associated to ReaderT, where .ask is the same as our .token, and E is RefreshToken: A law of ApplicativeAsk is that the E cannot change between invocations, i.e. ask >> ask === ask. For our usecase, this is to say that the configuration is read once. If we decide later that we want to reload configuration every time we need it, e.g. allowing us to change the token without restarting the application, we can reintroduce ConfigReader which has no such law. In our OAuth 2.0 implementation we could first move the Monad evidence onto the methods: and then refactor the refresh parameter to be part of the Monad Any parameter can be moved into the ApplicativeAsk. This is of most value to immediate callers when they simply want to thread through this information from above. With ReaderT, we can reserve implicit parameter blocks entirely for the use of typeclasses, reducing the mental burden of using Scala. ApplicativeLocal extends ApplicativeAsk with an additional method .local We can change E and run a program fa within that local context, returning to the original E. A use case for .local is to generate a “stack trace” that makes sense to our domain, giving us nested logging! Leaning on the Meta data structure from the previous section, we define a function to checkpoint: and we can use it to wrap functions that operate in this context. automatically passing through anything that is not explicitly traced. If we access .ask we can see the breadcrumb trail of exactly how we were called, without the distraction of bytecode implementation details. A referentially transparent stacktrace! A defensive programmer may wish to truncate the List[Meta] at a certain length to avoid the equivalent of a stack overflow. .local can also be used to keep track of contextual information that is directly relevant to the task at hand, like the number of spaces that must indent a line when pretty printing a human readable file format, bumping it by two spaces when we enter a nested structure. Finally, if we cannot request a ApplicativeLocal because our application does not provide one, we can always return a ReaderT If a caller receives a ReaderT, and they have the token parameter to hand, they can call access.run(token) and get back an F[BearerToken]. Admittedly, since we don’t have many callers, we should just revert to a regular function parameter. ApplicativeAsk is of most use when: 1. we may wish to refactor the code later to reload config 2. the value is not needed by intermediate callers 3. or, we want to locally scope some variable #### 7.4.5 WriterT The opposite to reading is writing. The WriterT monad transformer is typically for writing to a journal L There is not just one associated typeclass, but two! FunctorTell is for writing to the journal and FunctorListen is to recover it. The most obvious example is to use MonadTell for logging, or audit reporting. Reusing Meta from our error reporting we could imagine creating a log structure like and use List[Log] as our journal type. We could change our OAuth2 authenticate method to We could even combine this with the ReaderT traces and get structured logs. However, there is a strong argument that logging deserves its own algebra. The log level is often needed at the point of creation for performance reasons and writing out the logs is typically managed at the application level rather than something each component needs to be concerned about. The L in WriterT has a Monoid, allowing us to journal any kind of monoidic calculation as a secondary value along with our primary program. For example, counting the number of times we do something, building up an explanation of a calculation, or building up a TradeTemplate for a new trade while we price it. A popular specialisation of WriterT is when the monad is Id, meaning the underlying run value is just a simple tuple (L, A). which allows us to let any value carry around a secondary monoidal calculation, without needing a context F[_]. In a nutshell, WriterT / FunctorListen is how to multi-task in FP. #### 7.4.6 StateT StateT lets us .set, .get and .modify a value that is handled by the monadic context. It is the FP replacement of var. If we were to write an impure method that has access to some mutable state, held in a var, it might have the signature () => F[A] and return a different value on every call, breaking referential transparency. With pure FP the function takes the state as input and returns the updated state as output, which is why the underlying type of StateT is S => F[(S, A)]. The associated monad is MonadState A common variant of StateT is when F = Eval, giving the underlying type signature S => (S, A). Cats provides a type alias and convenience functions for interacting with the State monad transformer directly, and mirroring MonadState: For an example we can return to the business logic tests of drone-dynamic-agents. Recall from Chapter 3 that we created Mutable as test interpreters for our application and we stored the number of started and stoped nodes in var. We now know that we can write a much better test simulator with State. We will take the opportunity to upgrade the accuracy of the simulation at the same time. Recall that a core domain object is our application’s view of the world: Since we’re writing a simulation of the world for our tests, we can create a data type that captures the ground truth of everything The key difference being that the started and stopped nodes can be separated out. Our interpreter can be implemented in terms of State[World, a] and we can write our tests to assert on what both the World and WorldView looks like after the business logic has run. The interpreters, which are mocking out contacting external Drone and Google services, may be implemented like this: and we can rewrite our tests to follow a convention where: • world1 is the state of the world before running the program • view1 is the application’s belief about the world • world2 is the state of the world after running the program • view2 is the application’s belief after running the program For example, We would be forgiven for looking back to our business logic loop and use StateT to manage the state. However, our DynAgents business logic requires only Applicative and we would be violating the Rule of Least Power to require the more powerful MonadState. It is therefore entirely reasonable to handle the state manually by passing it in to .update and .act, and let whoever calls us use a StateT if they wish. #### 7.4.7 IndexedStateT The code that we have studied thus far is not how Cats implements StateT. Instead, a type alias points to IndexedStateT IndexedStateT does not have a MonadState when S1 != S2, although it has a Monad. Consider the scenario where we must design an algebraic interface for an Int to String lookup. This may have a networked implementation and the order of calls is essential. Our first attempt at the API may look something like: with runtime errors if .update or .commit is called without a .lock. A more complex design may involve multiple traits and a custom DSL that nobody remembers how to use. Instead, we can use IndexedStateT to require that the caller is in the correct state. First we define our possible states as an ADT and then revisit our algebra which will give a compiletime error if we try to .update without a .lock but allowing us to construct functions that can be composed by explicitly including their state: #### 7.4.8 IndexedReaderWriterStateT Those wanting to have a combination of ReaderT, WriterT and IndexedStateT will not be disappointed. The transformer IndexedReaderWriterStateT wraps (R, S1) => F[(W, A, S2)] with R having Reader semantics, W for monoidic writes, and the S parameters for indexed state updates. Abbreviations are provided for convenience: IRWST is a more efficient implementation than a manually created transformer stack of ReaderT[WriterT[IndexedStateT[F, ...], ...], ...]. #### 7.4.9 IorT IorT allows errors to either abort the calculation or to be accumulated if there is some partial success. Hence keep calm and carry on. The underlying data type is F[Ior[A, B]] with A being the error type, requiring a Semigroup to enable the accumulation of errors. If we wish to abort a calculation we can return a Left value, but we accumulate errors when we return a Both which also contains a successful part of the calculation. The accompanying monad is .chronicle and .confess are ways to construct a fresh MonadChronicle, complementing .pure. .materialize is similar to MonadError.attempt in that it surfaces any underlying errors. .memento has even greater similarity to .attempt in that it returns an Either which will be Left only if the underlying Ior is Left. .absolve erases any error data, using the provided value in the case that the underlying is a Left. .condemn coerces the Both into a Left by erasing the partial success, and .retcon applies a map to the errors. IorT can also be thought of from a different angle: A does not need to be an error. Similarly to WriterT, the A may be a secondary calculation that we are computing along with the primary calculation B. IorT allows early exit when something special about A demands it, like when Charlie Bucket found the last golden ticket (A) he threw away his chocolate bar (B). #### 7.4.10 Transformer Stacks and Ambiguous Implicits This concludes our tour of the monad transformers in Cats. When multiple transformers are combined, we call this a transformer stack and although it is verbose, it is possible to read off the features by reading the transformers. For example if we construct an F[_] context which is a set of composed transformers, such as we know that we are adding error handling with error type E (there is a MonadError[Ctx, E]) and we are managing state S (there is a MonadState[Ctx, S]). But there are unfortunately practical drawbacks to using monad transformers and their companion typeclasses: 1. Monads do not compose in the general case, which means that the order of nesting of the transformers is important. 2. All the interpreters must be lifted into the common context. For example, we might have an implementation of some algebra that uses for IO and now we need to wrap it with StateT and EitherT even though they are unused inside the interpreter. 3. There is a performance cost associated to each layer. And some monad transformers are worse than others. StateT is particularly bad but even EitherT can cause memory allocation problems for high throughput applications. ##### 7.4.10.1 Composing Transformers An EitherT[StateT[...], ...] has a MonadError but does not have a MonadState, whereas StateT[EitherT[...], ...] can provide both. The workaround is to study the implicit derivations on the companion of the transformers and to make sure that the outer most transformer provides everything we need. A rule of thumb is that more complex transformers go on the outside, with this chapter presenting transformers in increasing order of complex. ##### 7.4.10.2 Lifting Interpreters Say we have a Lookup algebra and an IO interpreter and some data types However, rather than IO, we want our context to be to give us a MonadError and a MonadState. This means we need to wrap LookupRandom to operate over Ctx. There are two parts to this. Firstly, we need to implement a .mapK for our algebra, much like we seen for OptionT and EitherT which is a general pattern that we can follow for any algebra. Then we need to implement a natural transformation IO ~> Ctx Ideally we would be able to compose the .liftK provided by the two transformers but unfortunately the compiler is unable to infer the types. A workaround is to introduce an intermediate type to give a hint Now we can create a Lookup[Ctx] by mapping over the lifter Another way to achieve this, in a single step, is to use LiftIO which enables lifting an IO into a transformer stack: LiftIO instances are provided for all the common combinations of transformers. The following helper may be used as the natural transformation instead of the one that we composed manually from composed .liftK calls ##### 7.4.10.3 Performance The biggest problem with Monad Transformers is their performance overhead. EitherT has a reasonably low overhead, with every .flatMap call generating a handful of objects, but this can impact high throughput applications where every object allocation matters. ### 7.5 A Free Lunch Our industry craves safe high-level languages, trading developer efficiency and reliability for reduced runtime performance. The Just In Time (JIT) compiler on the JVM performs so well that simple functions can have comparable performance to their C or C++ equivalents, ignoring the cost of garbage collection. However, the JIT only performs low level optimisations: branch prediction, inlining methods, unrolling loops, and so on. The JIT does not perform optimisations of our business logic, for example batching network calls or parallelising independent tasks. The developer is responsible for writing the business logic and optimisations at the same time, reducing readability and making it harder to maintain. It would be good if optimisation was a tangential concern. If instead, we have a data structure that describes our business logic in terms of high level concepts, not machine instructions, we can perform high level optimisation. Data structures of this nature are typically called Free structures and can be generated for free for the members of the algebraic interfaces of our program. For example, a Free Applicative can be generated that allows us to batch or de-duplicate expensive network I/O. In this section we will learn how to create free structures, and how they can be used. #### 7.5.1 Free (Monad) Fundamentally, a monad describes a sequential program where every step depends on the previous one. We are therefore limited to modifications that only know about things that we’ve already run and the next thing we are going to run. As a refresher, Free is the data structure representation of a Monad and is defined by three members • Suspend represents a program that has not yet been interpreted • Pure is .pure • FlatMapped is .flatMap A Free[S, A] can be freely generated for any algebra S. To make this explicit, consider our application’s Machines algebra We define a freely generated Free for Machines by creating an ADT with a data type for each element of the algebra. Each data type has the same input parameters as its corresponding element, is parameterised over the return type, and has the same name: The ADT defines an Abstract Syntax Tree (AST) because each member is representing a computation in a program. We then define .liftF, an implementation of Machines, with Free[Ast, ?] as the context. Every method simply delegates to Free.liftT to create a Suspend When we construct our program, parameterised over a Free, we run it by providing an interpreter (a natural transformation Ast ~> M) to the .foldMap method. For example, if we could provide an interpreter that maps to IO we can construct an IO[Unit] program via the free AST For completeness, an interpreter that delegates to a direct implementation is easy to write. This might be useful if the rest of the application is using Free as the context and we already have an IO implementation that we want to use: But our business logic needs more than just Machines, we also need access to the Drone algebra, recall defined as What we want is for our AST to be a combination of the Machines and Drone ASTs. We studied EitherK in Chapter 6, a higher kinded Either: We can use the context Free[EitherK[Machines.Ast, Drone.Ast, ?], ?]. The InjectK typeclass helps us to create larger combinations of algebras: implicit rules on the InjectK companion will create the combination of nested EitherK that we need, letting us rewrite our .liftF to work for any combination of ASTs: It is nice that F :<: G reads as if our Ast is a member of the complete F instruction set: this syntax is intentional. Putting it all together, lets say we have a program that we wrote abstracting over Monad and we have some existing implementations of Machines and Drone, we can create interpreters from them: and combine them into the larger instruction set using a convenience method from FunctionK Then use it to produce an IO But we’ve gone in circles! We could have used IO as the context for our program in the first place and avoided Free. So why did we do this? Here are some examples of where Free might be useful. ##### 7.5.1.1 Testing: Mocks and Stubs It might sound hypocritical to propose that Free can be used to reduce boilerplate, given how much code we have written. However, there is a tipping point where the Ast pays for itself when we have many tests that require stub implementations. If the .Ast and .liftF is defined for an algebra, we can create partial interpreters which can be used to test our program By using partial functions, and not total functions, we are exposing ourselves to runtime errors. Many teams are happy to accept this risk in their unit tests since the test would fail if there is a programmer error. Arguably we could also achieve the same thing with implementations of our algebras that implement every method with ???, overriding what we need on a case by case basis. ##### 7.5.1.2 Monitoring It is typical for server applications to be monitored by runtime agents that manipulate bytecode to insert profilers and extract various kinds of usage or performance information. If our application’s context is Free, we do not need to resort to bytecode manipulation, we can instead implement a side-effecting monitor as an interpreter that we have complete control over. For example, consider using this Ast ~> Ast “agent” which records method invocations: we would use a vendor-specific routine in real code. We could also watch for specific messages of interest and log them as a debugging aid. We can attach Monitor to our production Free application with or combine the natural transformations and run with a single ##### 7.5.1.3 Monkey Patching As engineers, we are used to requests for bizarre workarounds to be added to the core logic of the application. We might want to codify such corner cases as exceptions to the rule and handle them tangentially to our core logic. For example, suppose we get a memo from accounting telling us URGENT: Bob is using node #c0ffee to run the year end. DO NOT STOP THIS MACHINE!1! There is no possibility to discuss why Bob shouldn’t be using our machines for his super-important accounts, so we have to hack our business logic and put out a release to production as soon as possible. Our monkey patch can map into a Free structure, allowing us to return a pre-canned result (Free.pure) instead of scheduling the instruction. We special case the instruction in a custom natural transformation with its return value: eyeball that it works, push it to prod, and set an alarm for next week to remind us to remove it, and revoke Bob’s access to our servers. Our unit test could use State as the target context, so we can keep track of all the nodes we stopped: along with a test that “normal” nodes are not affected. An advantage of using Free to avoid stopping the #c0ffee nodes is that we can be sure to catch all the usages instead of having to go through the business logic and look for all usages of .stop. If our application context is just an IO we could, of course, implement this logic in the Machines[IO] implementation but an advantage of using Free is that we don’t need to touch the existing code and can instead isolate and test this (temporary) behaviour, without being tied to the IO implementations. #### 7.5.2 FreeApplicative (Applicative) Despite this chapter being called Cats Monads, the takeaway is: we shouldn’t use monads unless we really really have to. In this section, we will see why FreeApplicative is preferable to Free monads. FreeApplicative is defined as the data structure representation of the ap and pure methods from the Applicative typeclass: The methods .compile and .foldMap are like their Free analogues .mapK and .foldMap. As a convenience, we can generate a Free[S, A] from our FreeApplicative[S, A] with .monad. This is especially useful to optimise smaller Applicative subsystems yet use them as part of a larger Free program. Like Free, we must create a FreeApplicative for our ASTs ##### 7.5.2.1 Batching Network Calls We opened this chapter with grand claims about performance. Time to deliver. Philip Stark’s Humanised version of Peter Norvig’s Latency Numbers serve as motivation for why we should focus on reducing network calls to optimise an application: Computer Human Timescale Human Analogy L1 cache reference 0.5 secs One heart beat Branch mispredict 5 secs Yawn L2 cache reference 7 secs Long yawn Mutex lock/unlock 25 secs Making a cup of tea Main memory reference 100 secs Brushing your teeth Compress 1K bytes with Zippy 50 min Scala compiler CI pipeline Send 2K bytes over 1Gbps network 5.5 hr Train London to Edinburgh SSD random read 1.7 days Weekend Read 1MB sequentially from memory 2.9 days Long weekend Round trip within same datacenter 5.8 days Long US Vacation Read 1MB sequentially from SSD 11.6 days Short EU Holiday Disk seek 16.5 weeks Term of university Read 1MB sequentially from disk 7.8 months Fully paid maternity in Norway Send packet CA->Netherlands->CA 4.8 years Government’s term Although Free and FreeApplicative incur a memory allocation overhead, the equivalent of 100 seconds in the humanised chart, every time we can turn two sequential network calls into one batch call, we save nearly 5 years. When we are in a Applicative context, we can safely optimise our application without breaking any of the expectations of the original program, and without cluttering the business logic. Luckily, our main business logic only requires an Applicative, recall To begin, we create the .lift boilerplate for a new Batch algebra and then we will create an instance of DynAgentsModule with FreeApplicative as the context In Chapter 6, we studied the Const data type, which allows us to analyse a program. It should not be surprising that .analyze is implemented in terms of Const: We provide a natural transformation to record all node starts and .analyze our program to get all the nodes that need to be started: The next step is to extend the instruction set from Orig to Extended, which includes the Batch.Ast and write a FreeApplicative program that starts all our gathered nodes in a single network call We also need to remove all the calls to Machines.Start, which we can do with a natural transformation Now we have two programs, and need to combine them. Recall the productR operator (*>) from Apply Putting it all together under a single method: That Is it! We .optimise every time we call act in our main loop, which is just a matter of plumbing. #### 7.5.3 Coyoneda (Functor) Named after mathematician Nobuo Yoneda, we can freely generate a Functor data structure for any algebra S[_] and there is also a contravariant version The API is somewhat simpler than Free and FreeApplicative, allowing a natural transformation with .mapK and a .run (taking an actual Functor or Contravariant, respectively) to escape the free structure. Coyo and cocoyo can be a useful utility if we want to .map or .contramap over a type, and we know that we can convert into a data type that has a Functor but we don’t want to commit to the final data structure too early. For example, we create a Coyoneda[Set, ?] (note that Set does not have a Functor) to use methods that require a Functor, then convert into List later on. If we want to optimise a program with coyo or cocoyo we have to provide the expected boilerplate for each algebra: An optimisation we get by using Coyoneda is map fusion (and contramap fusion), which allows us to rewrite into avoiding intermediate representations. For example, if xs is a List of a thousand elements, we save two thousand object allocations because we only map over the data structure once. ### 7.6 Parallel There are two effectful operations that we almost always want to run in parallel: 1. .map over a collection of effects, returning a single effect. This is achieved by .traverse. 2. running a fixed number of effects with .mapN and combining their output, delegating to .map2. However, in practice, neither of these operations execute in parallel by default. The reason is that if our F[_] is implemented by a Monad, then the derived combinator laws for .map2 must be satisfied, which say In other words, Monad is explicitly forbidden from running effects in parallel. However, if we have an F[_] that is not monadic, then it may implement .map2 in parallel. However, this is very impractical for most applications, so Cats provides the Parallel typeclass which gives us a way of moving from the current (sequential) context into a parallel one where .traverse and .mapN run effects in parallel: Monadic programs can then request an implicit Parallel in addition to their Monad There are also convenience functions .parTraverse, .parMapN (and more) that can be used as direct replacements for .traverse and .mapN. If the implicit Parallel[IO] is in scope, we can choose between sequential and parallel traversal: Similarly, we can call .parMapN It is worth noting that when we have Applicative programs, such as we can use the F[_] that we obtain from Parallel.parallel as our program’s context and get parallelism as the default on .traverse and .mapN. Converting between the raw and Parallel context must be handled manually in the glue code. #### 7.6.1 Breaking the Law We can take a more daring approach to parallelism: opt-out of the law that .map2 must be sequential for Monad. This is highly controversial, but works well for the majority of real world applications. We must first audit our codebase (including third party dependencies) to ensure that nothing is making use of the .map2 implied law. We wrap IO and provide our own implementation of Monad which runs .map2 to .map22 in parallel by delegating to the Parallel instance We can now use MyIO as our application’s context instead of IO, and get parallelism by default. For completeness: a naive and inefficient implementation of the implementation of .parMap2 for our toy IO could use Future: In the final section of this chapter we will see how Cats’ IO is actually implemented. ### 7.7 IO IO is a free data structure specialised for use as a general effect monad. #### 7.7.1 Creating There are multiple ways to create an IO that cover a variety of eager, lazy, safe and unsafe code blocks: We would typically create one ContextShift and Timer to be shared by the entire application with but specific implementations can be provided during testing to override the behaviour or if a custom thread pool is required in production. The most common constructors, by far, when dealing with legacy code are IO.apply and IO.fromFuture: We cannot pass around raw Future, because it eagerly evaluates, so must always be constructed inside a safe block. #### 7.7.2 Running IO is just a data structure, and is interpreted at the end of the world by extending IOApp and implementing .run If we are integrating with a legacy system and are not in control of the entry point of our application, we can also call a variety of .unsafe* methods depending on our usecase, the most commonly used being: #### 7.7.3 Features IO provides a typeclass instance for MonadError[Throwable, ?] along with new typeclasses that are introduced by cats-effect ##### 7.7.3.1 Bracket Bracket is for safe resource acquisition and release. .bracket is the most powerful part of the interface, allowing us to define how we obtain a resource, what we do with it, and anything we need to do to release it. The release is guaranteed to be called even if the use fails, the convenience .guarantee can be used if we only need a cleanup step without the acquire. In addition to success and failure, a calculation can also be canceled and we may cleanup differently depending on these three scenarios with .bracketCase: The ability to .cancel a calculation is left up to the implementation and is not part of the Bracket interface. ##### 7.7.3.2 Defer Defer is the higher kinded equivalent of Eval.always and is useful when we want to avoid an expensive calculation until it is necessary. ##### 7.7.3.3 Sync Sync refines the Bracket (and MonadError) error type to Throwable and introduces .suspend, which is effectively the same as Defer.defer but explicitly for effects, and .delay as the mechanism for side-effecting blocks of code. Sync.delay is the generalised version of IO { ... } ##### 7.7.3.4 LiftIO We have already been introduced to LiftIO in the context of lifting IO interpreters into an arbitrary context, here we see it in its correct place within the typeclass hierarchy: ##### 7.7.3.5 Async Async is primarily for legacy integration and describes callbacks that perform a side-effect. The k in .async is a function that should be called with a callback for signaling the result once it is ready. For example, we might have a GUI that triggers an event A when the user moves the mouse or presses a key and puts it onto an impure queue. We need to be able to turn that event into an F[A] that we can treat like any other source of data. Be careful of thread usage when dealing with legacy APIs that use blocking I/O, if the eventQueue.nextEvent blocks on a thread then this will too. ##### 7.7.3.6 Effect Effect is the opposite of LiftIO and means that the effect can be converted into the concrete IO implementation. ##### 7.7.3.7 Concurrent Contexts that implement Concurrent may start fibers, a lightweight abstraction over a JVM Thread. When we have a Fiber we can .join back into the IO, or .cancel the underlying work. A CancelToken is just a type alias to aid with readibility. We can use fibers to achieve a form of optimistic concurrency control. Consider the case where we have data that we need to analyse, but we also need to validate it. We can optimistically begin the analysis and cancel the work if the validation fails, which is performed in parallel. For the common case where we have two pieces of work and we only care which one completes first, we can use .race, which will always cancel the one that comes second Finally, Concurrent provides more refined control over parallelism than the Parallel typeclass offering variants of .parTraverse (and more) with a number that caps the maximum level of parallelism to use: ##### 7.7.3.8 ConcurrentEffect ConcurrentEffect is a convenient combination of both Concurrent and Effect that provides most everything that we can want out of IO. It is considered good practice to prefer typeclasses instead of directly using IO because it allows for implementations to be replaced. Effect implementation is a very active area of research for the community, we would not want to miss out on future improvements by limiting ourselves to today’s implementation! There is one caveat to using the typeclasses: Sync sets the error type to Throwable. If a custom error type is required, it is recommended to use the IO type directly instead of the typeclasses, and capture the business domain error with an EitherT, the underlying Throwable errors are still accessible on the IO. #### 7.7.4 Concurrency Cats effect provides several components that are useful for concurrent programming that do not fit into the typeclass hierarchy. ##### 7.7.4.1 Deferred Deferred is a primitive which represents a value that may not yet be available, it is the FP equivalent of a Promise. calling .complete more than once will give an action that throws an IllegalStateException. Deferred is not something that we typically use in application code. It is a building block for high level concurrency frameworks or for integrating with legacy systems. #### 7.7.5 MVar MVar is the FP equivalent of an atomic mutable variable. We can read the variable and we have a variety of ways to write or update it. MVar is another building block and is very useful to provide collections-based mocks for database-like algebras. ### 7.8 Summary 1. The Future is broke, don’t go there. 2. Manage stack safety with a Trampoline. 3. The Monad Transformer Library (MTL) abstracts over common effects with typeclasses. 4. Monad Transformers provide default implementations of the MTL. 5. Free data structures let us analyse, optimise and easily test our programs. 6. IO gives us the ability to implement algebras as effects on the world. 7. IO can perform effects in parallel and is a high performance backbone for any application. 8. Prefer Effect, Parallel, and related typeclasses, to using IO directly. ## 8. Typeclass Derivation Typeclasses provide polymorphic functionality to our applications. But to use a typeclass we need instances for our business domain objects. The creation of a typeclass instance from existing instances is known as typeclass derivation and is the topic of this chapter. There are four approaches to typeclass derivation: 1. Manual instances for every domain object. This is infeasible for real world applications as it results in hundreds of lines of boilerplate for every line of a case class. It is useful only for educational purposes and adhoc performance optimisations. 2. Abstract over the typeclass by an existing Cats typeclass. 3. Macros. However, writing a macro for each typeclass requires an advanced and experienced developer. Fortunately, Jon Pretty’s Magnolia library abstracts over hand-rolled macros with a simple API, centralising the complex interaction with the compiler. 4. Write a generic program using the Shapeless library. The implicit mechanism is a language within the Scala language and can be used to write programs at the type level. In this chapter we will study increasingly complex typeclasses and their derivations. We will begin with typeclasses of typeclasses as the most principled mechanism, repeating some lessons from Chapter 5 “Cats Typeclasses”, then Magnolia (the easiest to use), finishing with Shapeless (the most powerful) for typeclasses with complex derivation logic. ### 8.1 Running Examples This chapter will show how to define derivations for five specific typeclasses. Each example exhibits a feature that can be generalised: ### 8.2 Typeclasses of Typeclasses Before we proceed, here is a quick recap of the core Cats typeclasses, focussed on just the typeclasses that are relevant for this chapter: #### 8.2.1 Don’t Repeat Yourself The simplest way to derive a typeclass is to reuse one that already exists. The Eq typeclass has an instance of Contravariant[Eq], providing .contramap: As users of Eq, we can use .contramap for our single parameter data types. Recall that typeclass instances go on the data type companions to be in their implicit scope: However, not all typeclasses can have an instance of Contravariant. In particular, typeclasses with type parameters in covariant position may have a Functor instead: We can now derive a Default[Foo] If a typeclass has parameters in both covariant and contravariant position, as is the case with Semigroup, it may provide an Invariant and we can call .imap Generally, it is simpler to just use .imap instead of .map or .contramap: #### 8.2.2 MonadError Typically things that write from a polymorphic value have a Contravariant, and things that read into a polymorphic value have a Functor. However, it is very much expected that reading can fail. For example, if we have a default String it does not mean that we can simply derive a default String Refined NonEmpty from it We start by introducing a convenience function that we will use a lot fails to compile with Recall from Chapter 4.1 that refineV returns an Either, as the compiler has reminded us. As the typeclass author of Default, we can do better than Functor and provide a MonadError[Default, String]: If we introduce the general purpose helper function .emap we have access to .emap syntax and can derive our refined type In fact, we can provide a derivation rule for all refined types where Validate is from the refined library and is required by refineV. Similarly we can use .emap to derive an Int decoder from a Long, with protection around the non-total .toInt stdlib method. As authors of the Default typeclass, we might want to reconsider our API design so that it can never fail, e.g. with the following type signature We would not be able to define a MonadError, forcing us to provide instances that always succeed. This will result in more boilerplate but gains compiletime safety. However, we will continue with Either[String, A] as the return type as it is a more general example. #### 8.2.3 ContravariantMonoidal and Applicative To derive the Eq for our case class with two parameters, we reused the instance that Cats provides for tuples. But where did the tuple instance come from? A more specific typeclass than Contravariant is ContravariantMonoidal. Eq has an instance: And from contramap2, ContravariantMonoidal is able to build up derivations all the way to contramap22 (and the .contramapN helper for tuples). We can call these methods directly for our data types: The equivalent for type parameters in covariant position is Applicative: But we must be careful that we do not break the typeclass laws when we implement ContravariantMonoidal or Applicative. In particular, it is easy to break the law of composition which says that the following two codepaths must yield exactly the same output • contramap2(contramap2(a1, a2)(dupe), a3)(dupe) • contramap2(a1, contramap2(a2, a3)(dupe))(dupe) • for any dupe: A => (A, A) with similar laws for Applicative. Consider JsEncoder and a proposed instance of ContravariantMonoidal On one side of the composition laws, for a String input, we get and on the other which are different. We could experiment with variations of the .contramap2 implementation, but it will never satisfy the laws for all inputs. We therefore cannot provide a ContravariantMonoidal[JsEncoder] because it would break the mathematical laws and invalidates all the assumptions that users of ContravariantMonoidal rely upon. On the other hand, a similar JsDecoder test meets the Applicative composition laws so we can be reasonably confident that our MonadError is lawful. One way of generating a wide variety of test data is to use the scalacheck library, which provides an Arbitrary typeclass that integrates with most testing frameworks to repeat a test with randomly generated data. The jsonformat ADT can provide an Arbitrary[JsValue] allowing us to make use of Scalatest’s .forAll feature: This test gives us even more confidence that our typeclass meets the Applicative composition laws. By checking all the laws on ContravariantMonoidal and MonadError we also get a lot of smoke tests for free. ### 8.3 Magnolia The Magnolia macro library provides a clean API for writing typeclass derivations. It is installed with the following build.sbt entry A typeclass author implements the following members: The Magnolia API is: with helpers The Monadic typeclass, used in constructMonadic, is automatically generated if our data type has a .map and .flatMap method when we import mercator._ It does not make sense to use Magnolia for typeclasses that can be abstracted by ContravariantMonoidal, Decidable, Applicative or Alt, since those abstractions provide a lot of extra structure and tests for free. However, Magnolia offers features that Cats cannot provide: access to field names, type names, annotations and default values. #### 8.3.1 Example: JSON We have some design choices to make with regards to JSON serialisation: 1. Should we include fields with null values? 2. Should decoding treat missing vs null differently? 3. How do we encode the name of a coproduct? 4. How do we deal with coproducts that are not JsObject? We choose sensible defaults • do not include fields if the value is a JsNull. • handle missing fields the same as null values. • use a special field "type" to disambiguate coproducts using the type name. • put primitive values into a special field "xvalue". and let the users attach an annotation to coproducts and product fields to customise their formats: For example Start with a JsEncoder that handles only our sensible defaults: We can see how the Magnolia API makes it easy to access field names and typeclasses for each parameter. Now add support for annotations to handle user preferences. To avoid looking up the annotations on every encoding, we will cache them in an array. Although field access to an array is non-total, we are guaranteed that the indices will always align. Performance is usually the victim in the trade-off between specialisation and generalisation. For the decoder we use .constructMonadic which has a type signature similar to .traverse Again, adding support for user preferences and default field values, along with some optimisations: We call the JsMagnoliaEncoder.gen or JsMagnoliaDecoder.gen method from the companion of our data types. For example, the Google Maps API #### 8.3.2 Fully Automatic Derivation Generating implicit instances on the companion of the data type is historically known as semi-auto derivation, in contrast to full-auto which is when the .gen is made implicit Users can import these methods into their scope and get magical derivation at the point of use This may sound tempting, as it involves the least amount of typing, but there are two caveats: 1. the macro is invoked at every use site, i.e. every time we call .toJson. This slows down compilation and also produces more objects at runtime, which will impact runtime performance. 2. unexpected things may be derived. The first caveat is self evident, but unexpected derivations manifests as subtle bugs. Consider what would happen for if we forgot to provide an implicit derivation for Option. We might expect a Foo(Some("hello")) to look like But it would instead be because Magnolia derived an Option encoder for us. This is confusing, we would rather have the compiler tell us if we forgot something. Full auto is therefore not recommended. ### 8.4 Shapeless The Shapeless library is notoriously the most complicated library in Scala. The reason why it has such a reputation is because it takes the implicit language feature to the extreme: creating a kind of generic programming language at the level of the types. To install Shapeless, add the following to build.sbt At the core of Shapeless are the HList and Coproduct data types which are generic representations of products and coproducts, respectively. The sealed trait HNil is for convenience so we never need to type HNil.type. Shapeless has a Generic typeclass, which allows us to move between an ADT and its generic representation: Many of the types in Shapeless have a type member (Repr) and an .Aux type alias on their companion that makes the second type visible. This allows us to request the Generic[Foo] for a type Foo without having to provide the generic representation, which is generated by a macro. There is a complementary LabelledGeneric that includes the field names Note that the value of a LabelledGeneric representation is the same as the Generic representation: field names only exist in the type and are erased at runtime. We never need to type KeyTag manually, we use the type alias: If we want to access the field name from a FieldType[K, A], we ask for implicit evidence Witness.Aux[K], which allows us to access the value of K at runtime. Superficially, this is all we need to know about Shapeless to be able to derive a typeclass. However, things get increasingly complex, so we will proceed with increasingly complex examples. #### 8.4.1 Example: Eq A typical pattern to follow is to extend the typeclass that we wish to derive, and put the Shapeless code on its companion. This gives us an implicit scope that the compiler can search without requiring complex imports The entry point to a Shapeless derivation is a method, gen, requiring two type parameters: the A that we are deriving and the R for its generic representation. We then ask for the Generic.Aux[A, R], relating A to R, and an instance of the Derived typeclass for the R. We begin with this signature and simple implementation: We’ve reduced the problem to providing an implicit Eq[R] for an R that is the Generic representation of A. First consider products, where R <: HList. This is the signature we want to implement: because if we can implement it for a head and a tail, the compiler will be able to recurse on this method until it reaches the end of the list. Where we will need to provide an instance for the empty HNil We implement these methods and for coproducts we want to implement these signatures .cnil will never be called for a typeclass like Eq with type parameters only in contravariant position, but the compiler doesn’t know that so we have to provide a stub: For the coproduct case we can only compare two things if they align, which is when they are both Inl or Inr It is noteworthy that our methods align with the concept of .trivial (hnil) and .contramap2 (hlist)! However, we don’t get any of the advantages of implementing ContravariantMonoidal, as now we must start from scratch when writing tests for this code. So let’s test this thing with a simple ADT We need to provide instances on the companions: But it doesn’t compile The problem, which is not at all evident from the error, is that the compiler is unable to work out what R is. We need to provide the explicit type parameters when calling gen, e.g. or we can use the Generic macro to help us and let the compiler infer the generic representation The reason why this fixes the problem is because the type signature desugars into The Scala compiler solves type constraints left to right, so it finds many different solutions to DerivedEq[R] before constraining it with the Generic.Aux[A, R]. Another way to solve this is to not use context bounds. However, this implementation still has a bug: it fails for recursive types at runtime, e.g. The reason why this happens is because Eq[Tree] depends on the Eq[Branch], which depends on the Eq[Tree]. Recursion and BANG! It must be loaded lazily, not eagerly. The macro types Cached, Strict and Lazy modify the compiler’s type inference behaviour allowing us to achieve the laziness we require. The pattern to follow is to use Cached[Strict[_]] on the entry point and Lazy[_] around the H instances. We can now call without a runtime exception. #### 8.4.2 Example: Default Here we create HList and Coproduct values, and must provide a value for the CNil case as it corresponds to the case where no coproduct is able to provide a value. Much as we could draw an analogy between Eq and ContravariantMonoidal, we can see the relationship to Applicative in .point (hnil) and .map2 (.hcons). There is little to be learned from an example like Semigroup, so we will skip to encoders and decoders. #### 8.4.3 Example: JsEncoder To be able to reproduce our Magnolia JSON encoder, we must be able to access: 1. field names and class names 2. annotations for user preferences 3. default values on a case class We will begin by creating an encoder that handles only the sensible defaults. To get field names, we use LabelledGeneric instead of Generic, and when defining the type of the head element, use FieldType[K, H] instead of just H. A Witness.Aux[K] provides the value of the field name at runtime. All of our methods are going to return JsObject, so rather than returning a JsValue we can specialise and create DerivedJsEncoder that has a different type signature to JsEncoder. Shapeless selects codepaths at compiletime based on the presence of annotations, which can lead to more optimised code, at the expense of code repetition. This means that the number of annotations we are dealing with, and their subtypes, must be manageable or we can find ourselves writing 10x the amount of code. We change our three annotations into one containing all the customisation parameters: All users of the annotation must provide all three values since default values and convenience methods are not available to annotation constructors. We can write custom extractors so we don’t have to change our Magnolia code We can request Annotation[json, A] for a case class or sealed trait to get access to the annotation, but we must write an hcons and a ccons dealing with both cases because the evidence will not be generated if the annotation is not present. We therefore have to introduce a lower priority implicit scope and put the “no annotation” evidence there. We can also request Annotations.Aux[json, A, J] evidence to obtain an HList of the json annotation for type A. Again, we must provide hcons and ccons dealing with the case where there is and is not an annotation. To support this one annotation, we must write four times as much code as before! Lets start by rewriting the JsEncoder, only handling user code that doesn’t have any annotations. Now any code that uses the @json will fail to compile, which is a good safety net. We must add an A and J type to the DerivedJsEncoder and thread through the annotations on its .toJsObject method. Our .hcons and .ccons evidence now provides instances for DerivedJsEncoder with a None.type annotation and we move them to a lower priority so that we can deal with Annotation[json, A] in the higher priority. Note that the evidence for J is listed before R. This is important, since the compiler must first fix the type of J before it can solve for R. Now we can add the type signatures for the six new methods, covering all the possibilities of where the annotation can be. Note that we only support one annotation in each position. If the user provides multiple annotations, anything after the first will be silently ignored. We’re now running out of names for things, so we will arbitrarily call it Annotated when there is an annotation on the A, and Custom when there is an annotation on a field: We don’t actually need .hconsAnnotated or .hconsAnnotatedCustom for anything, since an annotation on a case class does not mean anything to the encoding of that product, it is only used in .cconsAnnotated*. We can therefore delete two methods. .cconsAnnotated and .cconsAnnotatedCustom can be defined as and The use of .head and .get may be concerned but recall that the types here are :: and Some meaning that these methods are total and safe to use. .hconsCustom and .cconsCustom are written and Obviously, there is a lot of boilerplate, but looking closely one can see that each method is implemented as efficiently as possible with the information it has available: codepaths are selected at compiletime rather than runtime. The performance obsessed may be able to refactor this code so all annotation information is available in advance, rather than injected via the .toJsFields method, with another layer of indirection. For absolute performance, we could also treat each customisation as a separate annotation, but that would multiply the amount of code we’ve written yet again, with additional cost to compilation time on downstream users. Such optimisations are beyond the scope of this book, but they are possible and people do them: the ability to shift work from runtime to compiletime is one of the most appealing things about generic programming. #### 8.4.4 JsDecoder The decoding side is much as we can expect based on previous examples. We can construct an instance of a FieldType[K, H] with the helper field[K](h: H). Supporting only the sensible defaults means we write: Adding user preferences via annotations follows the same route as DerivedJsEncoder and is mechanical, so left as an exercise to the reader. One final thing is missing: case class default values. We can request evidence but a big problem is that we can no longer use the same derivation mechanism for products and coproducts: the evidence is never created for coproducts. The solution is quite drastic. We must split our DerivedJsDecoder into DerivedCoproductJsDecoder and DerivedProductJsDecoder. We will focus our attention on the DerivedProductJsDecoder, and while we are at it we will use a Map for faster field lookup: We can request evidence of default values with Default.Aux[A, D] and duplicate all the methods to deal with the case where we do and do not have a default value. However, Shapeless is merciful and provides Default.AsOptions.Aux[A, D] letting us handle defaults at runtime. We must move the .hcons and .hnil methods onto the companion of the new sealed typeclass, which can handle default values #### 8.4.5 Example: UrlQueryWriter Our drone-dynamic-agents application could benefit from a typeclass derivation of the UrlQueryWriter typeclass, which is built out of UrlEncodedWriter instances for each field entry. It does not support coproducts: It is reasonable to ask if these 30 lines are actually an improvement over the 8 lines for the 2 manual instances our application needs: a decision to be taken on a case by case basis. For completeness, the UrlEncodedWriter derivation can be written with Magnolia #### 8.4.6 Drawbacks Not only is fully automatic Shapeless derivation the most common cause of slow compiles, it is also a painful source of typeclass coherence bugs. Fully automatic derivation is when the def gen are implicit such that a call will recurse for all entries in the ADT. Because of the way that implicit scopes work, an imported implicit def will have a higher priority than custom instances on companions, creating a source of typeclass decoherence. For example, consider this code if our .gen were implicit We might expect the full-auto encoded form of Bar("hello") to look like because we have used .contramap for Foo. But it can instead be Worse yet is when implicit methods are added to the companion of the typeclass, meaning that the typeclass is always derived at the point of use and users are unable opt out. Fundamentally, when writing generic programs, implicits can be ignored by the compiler depending on scope, meaning that we lose the compiletime safety that was our motivation for programming at the type level in the first place! Everything is much simpler when implicit is only used for coherent, globally unique, typeclasses. ### 8.5 Performance There is no silver bullet when it comes to typeclass derivation. An axis to consider is performance: both at compiletime and runtime. ##### 8.5.0.1 Compile Times When it comes to compilation times, Shapeless is the outlier. It is not uncommon to see a small project expand from a one second compile to a one minute compile. To investigate compilation issues, we can profile our applications with the scalac-profiling plugin It produces output that can generate a flame graph. For a typical Shapeless derivation, we get a lively chart almost the entire compile time is spent in implicit resolution. Note that this also includes compiling the Magnolia and manual instances, but the Shapeless computations dominate. And this is when it works. If there is a problem with a shapeless derivation, the compiler can get stuck in an infinite loop and must be killed. ##### 8.5.0.2 Runtime Performance If we move to runtime performance, the answer is always it depends. Assuming that the derivation logic has been written in an efficient way, it is only possible to know which is faster through experimentation. The jsonformat library uses the Java Microbenchmark Harness (JMH) on models that map to GeoJSON, Google Maps, and Twitter, contributed by Andriy Plokhotnyuk. There are three tests per model: • encoding the ADT to a JsValue • a successful decoding of the same JsValue back into an ADT • a failure decoding of a JsValue with a data error applied to the following implementations: • Magnolia • Shapeless • manually written with the equivalent optimisations in each. The results are in operations per second (higher is better), on a powerful desktop computer, using a single thread: We see that the manual implementations are in the lead, followed by Magnolia, with Shapeless from 30% to 70% the performance of the manual instances. Now for decoding This is a tighter race for second place, with Shapeless and Magnolia keeping pace. Finally, decoding from a JsValue that contains invalid data (in an intentionally awkward position) Just when we thought we were seeing a pattern, both Magnolia and Shapeless win the race when decoding invalid GeoJSON data, but manual instances win the Google Maps and Twitter challenges. The runtime performance of Magnolia and Shapeless is usually good enough. We should be realistic: we are not writing applications that need to be able to encode more than 130,000 values to JSON, per second, on a single core, on the JVM. If that is a problem, look into C++. It is unlikely that derived instances will be an application’s bottleneck. Even if it is, there is the manually written escape hatch, which is more powerful and therefore more dangerous: it is easy to introduce typos, bugs, and even performance regressions by accident when writing a manual instance. ### 8.6 Summary When deciding on a technology to use for typeclass derivation, this feature chart may help: Feature Cats Magnolia Shapeless Manual Laws yes Fast compiles yes yes yes Field names yes yes Annotations yes partially Default values yes with caveats Complicated yes Performance yes Prefer Cats typeclasses of typeclasses if possible, using Magnolia for encoders / decoders or if performance is a larger concern, escalating to Shapeless for complicated derivations only if compilation times are not a concern. There is no need to write derivation rules for Cats core typeclasses: the Typelevel Kittens project provides Shapeless-based derivation rules and Magnolify has Magnolia based rules. Manual instances are always an escape hatch for special cases and to achieve the ultimate performance. Avoid introducing typo bugs with manual instances by using a code generation tool. ## 9. Wiring up the Application To finish, we will apply what we have learnt to wire up the example application, and implement an HTTP client and server using the http4s pure FP library. The source code to the drone-dynamic-agents application is available along with the book’s source code at https://github.com/turt13/fpmortals-cats under the examples folder. It is not necessary to be at a computer to read this chapter, but many readers may prefer to explore the codebase in addition to this text. Some parts of the application have been left unimplemented, as an exercise to the reader. ### 9.1 Overview Our main application only requires an implementation of the DynAgents algebra. We have an implementation already, DynAgentsModule, which requires implementations of the Drone and Machines algebras, which require a JsonClient, LocalClock and OAuth2 algebras, etc, etc, etc. It is helpful to get a complete picture of all the algebras, modules and interpreters of the application. This is the layout of the source code: The signatures of all the algebras can be summarised as The data types are: and the typeclasses are And without going into the detail of how to implement the algebras, we need to know the dependency graph of our DynAgentsModule. There are two modules implementing OAuth2JsonClient, one that will use the OAuth2 Refresh algebra (for Google) and another that reuses a non-expiring BearerToken (for Drone). So far we have seen requirements for F to have an Applicative[F], Monad[F] and MonadState[F, BearerToken]. All of these requirements can be satisfied by using StateT[IO, BearerToken, ?] as our application’s context. However, some of our algebras only have one interpreter, using IO But recall that our algebras shoud provide a .mapK, see Chapter 7.4 on the Monad Transformer Library, allowing us to lift a LocalClock[IO] into our desired StateT[IO, BearerToken, ?] context, and everything is consistent. Alternatively, we could have written these interpreters to use Effect. Our BlazeJsonClient is abstracted over Effect, using Throwable as the error type. When we defined JsonClient.Error we extended Throwable for this reason. Since the underlying library fs2 is coupled to Effect it is not possible to use a custom error type, because we cannot add another MonadError on top of an Effect. OAuth2JsonClientModule requires a MonadState and BlazeJsonClient requires Effect. Our application’s context will now likely be a StateT[IO, BearerToken, ?]. We must not forget that we need to provide a RefreshToken for GoogleMachinesModule. We could ask the user to do all the legwork, but we are nice and provide a separate one-shot application that uses the Auth and Access algebras. The AuthModule and AccessModule implementations bring in additional dependencies, but thankfully no change to the application’s F[_] context. The interpreter for UserInteraction is the most complex part of our codebase: it starts an HTTP server, sends the user to visit a webpage in their browser, captures a callback in the server, and then returns the result while safely shutting down the web server. Rather than using a StateT to manage this state, we use a Deferred primitive. We should always use Deferred (or MVar) instead of a StateT when we are writing an IO interpreter since it allows us to restrict the mutability to inside the implementation. If we were to use a StateT, not only would it have a performance impact on the entire application, but it would also leak internal state management to the main application, which would become responsible for providing the initial value. We also couldn’t use StateT in this scenario because we need “wait for” semantics that are only provided by Deferred. ### 9.2 Main Making sure that monads are all aligned tends to happen in the Main entrypoint. Our main loop is and the good news is that the actual code will look like where F holds the state of the world in a MonadState[F, WorldView]. We can put this into a method called .step and repeat it forever by calling .step[F].forever[Unit]. Thankfully, the code we want to write for the one-shot authentication mode is all compatible with the same monadic context, IO where .readConfig and .putStrLn are library calls. We can think of them as IO interpreters of algebras that read the application’s runtime configuration and print a string to the screen. However, the monads for the .agents loop do not align. If we perform an analysis we find that the following are needed: • MonadError[F, Throwable] for uses of the JsonClient • MonadState[F, BearerToken] for uses of the OAuth2JsonClient • MonadState[F, WorldView] for our main loop Unfortunately, the two MonadState requirements are in conflict. We could construct a data type that captures all the state of the program, but that is a leaky abstraction. Instead, we nest our for comprehensions and provide state where it is needed. We now need to think about our three layers, which we can refer to as the “outer”, “middle” and “inner” layers: The main application can be written as The two calls to .runA are where we provide the initial state for the StateT parts of our application. We can call these two application entry points from our IOApp and then run it! Yay! ### 9.3 Blaze We implement the HTTP client and server with the third party library http4s. The interpreters for their client and server algebras are called Blaze. We need the following dependencies #### 9.3.1 BlazeJsonClient We will need some imports The Client module can be summarised as where Request and Response are data types: made of The EntityBody type is an alias to Stream from the fs2 library. The Stream data type can be thought of as an effectful, lazy, pull-based stream of data. It is implemented as a Free monad with exception catching and interruption. Stream takes two type parameters: an effect type and a content type, and has an efficient internal representation for batching the data. For example, although we are using Stream[F, Byte], it is actually wrapping the raw Array[Byte] that arrives over the network. We need to convert our header and URL representations into the versions required by http4s: Both our .get and .post methods require a conversion from the http4s Response type into an A. We can factor this out into a single function, .handler The .through(fs2.text.utf8Decode) is to convert a Stream[F, Byte] into a Stream[F, String], with .compile.foldMonoid interpreting it with Effect and combining all the parts using the Monoid[String], giving us a F[String]. We then parse the string as JSON and use the JsDecoder[A] to create the required output. This is our implementation of .get .get is all plumbing: we convert our input types into the http4s.Request, then call .fetch on the Client with our handler. This gives us back a F[Either[Error, A]], but we need to return a F[A]. Therefore we use the MonadError.fromEither to push the error into the F. The implementation of .post is similar but we must also provide an instance of Thankfully, the EntityEncoder typeclass provides conveniences to let us derive one from the existing String encoder The only difference between .get and .post is the way we construct our http4s.Request and the final piece is the constructor, which is a case of calling Http1Client with a configuration object #### 9.3.2 BlazeUserInteraction We need to spin up an HTTP server, which is a lot easier than it sounds. First, the imports We need to create a dsl for our effect type, which we then import Now we can use the http4s dsl to create HTTP endpoints. Rather than describe everything that can be done, we will simply implement the endpoint which is similar to any of other HTTP DSLs The return type of each pattern match is a F[Response[IO]]. In our implementation we want to take the code and put it into the ptoken promise: but the definition of our services routes is not enough, we need to launch a server, which we do with BlazeBuilder Binding to port 0 makes the operating system assign an ephemeral port. We can discover which port it is actually running on by querying the server.address field. Our implementation of the .start, .stop and .open methods is now straightforward The 1.second sleep is necessary to avoid shutting down the server before the response is sent back to the browser. IO doesn’t mess around when it comes to concurrency performance! Finally, to create a BlazeUserInteraction, we just need to ask for an implementation of Sleep[F] and create two uninitialised Deferred promises ### 9.4 Thank You And that is it! Congratulations on reaching the end. If you learnt something from this book, then please tell your friends. This book does not have a marketing department, so word of mouth is the only way that readers find out about it. Get involved with Cats by joining the gitter chat room. From there you can ask for advice, help newcomers (you’re an expert now), and contribute to the next release. ## 10. Typeclass Cheatsheet Typeclass Method From Given To Invariant imap F[A] A => B, B => A F[B] Contravariant contramap F[A] B => A F[B] ContravariantMonoidal contramap2 F[A], F[B] C => (A, B) F[C] trivial F[A] Functor map F[A] A => B F[B] Apply map2 F[A], F[B] (A, B) => C F[C] Semigroupal product F[A], F[B] F[(A, B)] Applicative pure A F[A] FlatMap flatMap / >>= F[A] A => F[B] F[B] flatten F[F[A]] F[A] CoflatMap coflatMap F[A] F[A] => B F[B] coflatten F[A] F[F[A]] Comonad extract F[A] A Semigroup combine A, A A SemigroupK combineK / <+> F[A], F[A] F[A] Alternative unite F[G[A]] F[A] separate F[G[A, B]] F[G[A, B]] Align align F[A], F[B] F[Ior[A, B]] Foldable foldMap F[A] A => B B foldMapM F[A] A => G[B] G[B] Traverse traverse F[A] A => G[B] G[F[B]] sequence F[G[A]] G[F[A]] Eq eqv / === A, A Boolean Show show A String Bifunctor bimap F[A, B] A => C, B => D F[C, D] leftMap F[A, B] A => C F[C, B] Bifoldable bifoldMap F[A, B] A => C, B => C C Bitraverse bitraverse F[A, B] A => G[C], B => G[D] G[F[C, D]] bisequence F[G[A], G[B]] G[F[A, B]] ## 11. Haskell Cats documentation often cites libraries or papers written in the Haskell programming language. In this short chapter, we will learn enough Haskell to be able to understand the source material, and to attend Haskell talks at functional programming conferences. ### 11.1 Data Haskell has a very clean syntax for ADTs. This is a linked list structure: List is a type constructor, a is the type parameter, | separates the data constructors, which are: Nil the empty list and a Cons cell. Cons takes two parameters, which are separated by whitespace: no commas and no parameter brackets. There is no subtyping in Haskell, so there is no such thing as the Nil type or the Cons type: both construct a List. Roughly translated to Scala: i.e. the type constructor is like sealed abstract class, and each data constructor is .apply / .unapply. Note that Scala does not perform exhaustive pattern matches on this encoding, which is why Cats does not use this encoding. We can use infix, a nicer definition might use the symbol :. instead of Cons where we specify a fixity, which can be infix, infixl or infixr for no, left, and right associativity, respectively. A number from 0 (loose) to 9 (tight) specifies precedence. We can now create a list of integers by typing Haskell already comes with a linked list, which is so fundamental to functional programming that it gets language-level square bracket syntax [a] and a convenient multi-argument value constructor: [1, 2, 3] instead of 1 : 2 : 3 : []. Ultimately our ADTs need to hold primitive values. The most common primitive data types are: • Char a unicode character • Text for blocks of unicode text • Int a machine dependent, fixed precision signed integer • Word an unsigned Int, and fixed size Word8 / Word16 / Word32 / Word64 • Float / Double IEEE single and double precision numbers • Integer / Natural arbitrary precision signed / non-negative integers • (,) tuples, from 0 (also known as unit) to 62 fields • IO the inspiration for Cats’ IO, implemented in the runtime. with honorary mentions for Like Scala, Haskell has type aliases: an alias or its expanded form can be used interchangeably. For legacy reasons, String is defined as a linked list of Char which is very inefficient and we always want to use Text instead. Finally we can define field names on ADTs using record syntax, which means we contain the data constructors in curly brackets and use double colon type annotations to indicate the types Note that the Human data constructor and Resource type do not have the same name. Record syntax generates the equivalent of a field accessor and a copy method. A more efficient alternative to single field data definitions is to use a newtype, which has no runtime overhead: equivalent to extends AnyVal but without the caveats. ### 11.2 Functions Although not necessary, it is good practice to explicitly write the type signature of a function: its name followed by its type. For example foldl specialised for a linked list All functions are curried in Haskell, each parameter is separated by a -> and the final type is the return type. This is equivalent to the following Scala signature: Some observations: • there is no keyword • there is no need to declare the types that are introduced • there is no need to name the parameters which makes for terse code. Infix functions are defined in parentheses and need a fixity definition: Regular functions can be called in infix position by surrounding their name with backticks. The following are equivalent: An infix function can be called like a regular function if we keep it surrounded by brackets, and can be curried on either the left or the right, often giving different semantics: Functions are typically written with the most general parameter first, to enable maximum reuse of the curried forms. The definition of a function may use pattern matching, with one line per case. This is where we may name the parameters, using the data constructors to extract parameters much like a Scala case clause: Underscores are a placeholder for ignored parameters and function names can be in infix position: We can define anonymous lambda functions with a backslash, which looks like the Greek letter λ. The following are equivalent: Pattern matched Haskell functions are just syntax sugar for nested lambda functions. Consider a simple function that creates a tuple when given three inputs: The implementation desugars into In the body of a function we can create local value bindings with let or where clauses. The following are equivalent definitions of map for a linked list (an apostrophe is a valid identifier name): if / then / else are keywords for conditional statements: An alternative style is to use case guards Pattern matching on any term is with case ... of Guards can be used within matches. For example, say we want to special case zeros: Finally, two functions that are worth noting are () and (.) Both of these functions are stylistic alternatives to nested parentheses. The following are equivalent: as are There is a tendency to prefer function composition with . instead of multiple $ ### 11.3 Typeclasses To define a typeclass we use the class keyword, followed by the name of the typeclass, its type parameter, then the required members in a where clause. If there are dependencies between typeclasses, i.e. Applicative requires a Functor to exist, we call this a constraint and use => notation: We provide an implementation of a typeclass with the instance keyword. If we wish to repeat the type signature on instance functions, useful for clarity, we must enable the InstanceSigs language extension. If we have a typeclass constraint in a function, we use the same => notation. For example we can define something similar to Cats’ Apply.map2 Since we have introduced Monad, it is a good time to introduce do notation, which was the inspiration for Scala’s for comprehensions: desugars to where >>= is =<< with parameters flipped Unlike Scala, we do not need to bind unit values, or provide a yield if we are returning (). For example translates to Non-monadic values can be bound with the let keyword: Finally, Haskell has typeclass derivation with the deriving keyword. Defining the derivation rules is an advanced topic, but it is easy to derive a typeclass for an ADT: ### 11.4 Records of Functions In Scala, typeclasses and algebras are both defined as a trait interface. Typeclasses are injected by the implicit feature and algebras are passed as explicit parameters. There is no language-level support in Haskell for algebras: they are just data! Consider Console from the introduction. We can rewrite it into Haskell: with business logic using a Monad constraint A production implementation of Console would likely have type Console IO. The Cats .liftIO function is inspired by a Haskell function of the same name and can lift Console IO into any Monad stack. Two additional language extensions make the business logic even cleaner. For example, RecordWildCards allows us to import all the fields of a data type by using {..}: NamedFieldPuns requires each imported field to be listed explicitly, which is more boilerplate but makes the code easier to read: Whereas in Scala this encoding may be called Finally Tagless, in Haskell it is known as MTL style with records of functions. An alternative to MTL style are Extensible Effects, also known as Free Monad style. ### 11.5 Modules Haskell source code is arranged into hierarchical modules with the restriction that all contents of a module must live in a single file. The top of a file declares the module name A convention is to use directories on disk to organise the code, so this file would go into Silly/Tree.hs. By default all symbols in the file are exported but we can choose to export specific members, for example the Tree type and data constructors, and a fringe function, omitting sapling: Interestingly, we can export symbols that are imported into the module, allowing library authors to package up their entire API into a single module, regardless of how it is implemented. In a different file we can import all the exported members from Silly.Tree which is roughly equivalent to Scala’s import silly.tree._ syntax. If we want to restrict the symbols that we import we can provide an explicit list in parentheses after the import Here we only import the Tree type constructor (not the data constructors) and the fringe function. If we want to import all the data constructors (and pattern matchers) we can use Tree(..). If we only want to import the Branch constructor we can list it explicitly: If we have a name collision on a symbol we can use a qualified import, with an optional list of symbols to import and now to call the fringe function we have to type Silly.Tree.fringe instead of just fringe. We can change the name of the module when importing it The fringe function is now accessed by T.fringe. Alternatively, rather than select what we want to import, we can choose what not to import By default the Prelude module is implicitly imported but if we add an explicit import from the Prelude module, only our version is used. We can use this technique to hide unsafe legacy functions or use a custom prelude and disable the default prelude with the NoImplicitPrelude language extension. ### 11.6 Evaluation Haskell compiles to native code, there is no virtual machine, but there is a garbage collector. A fundamental aspect of the runtime is that all parameters are lazily evaluated by default. Haskell treats all terms as a promise to provide a value when needed, called a thunk. Thunks get reduced only as much as necessary to proceed, no more. A huge advantage of lazy evaluation is that it is much harder to trigger a stack overflow! A disadvantage is that there is an overhead compared to strict evaluation, which is why Haskell allows us to opt in to strict evaluation on a per parameter basis. Haskell is also nuanced about what strict evaluation means: a term is said to be in weak head normal-form (WHNF) if the outermost code blocks cannot be reduced further, and normal form if the term is fully evaluated. Scala’s default evaluation strategy roughly corresponds to normal form. For example, these terms are normal form: whereas these are not in normal form (they can be reduced further): The following terms are in WHNF because the outer code cannot be reduced further (even though the inner parts can be): and the following are not in WHNF The default evaluation strategy is to perform no reductions when passing a term as a parameter. Language level support allows us to request WHNF for any term with ($!) We can use an exclamation mark ! on data parameters The StrictData language extension enables strict parameters for all data in the module. Another extension, BangPatterns, allows ! to be used on the arguments of functions. The Strict language extension makes all functions and data parameters in the module strict by default. Going to the extreme we can use (\$!!) and the NFData typeclass for normal form evaluation: which is subject to the availability of an NFData instance. The cost of strictness is that Haskell behaves like any other strict language and may perform unnecessary work. Opting in to strictness must therefore be done with great care, and only for measured performance improvements. If in doubt, be lazy and stick with the defaults. ### 11.7 Next Steps Haskell is a faster, safer and simpler language than Scala and has proven itself in industry. Consider taking the data61 course on functional programming, and ask questions in the #qfpl chat room on freenode.net.
2021-04-21 19:40:23
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.3746303617954254, "perplexity": 1597.6356522469832}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-17/segments/1618039550330.88/warc/CC-MAIN-20210421191857-20210421221857-00064.warc.gz"}
https://gamedev.stackexchange.com/questions/163620/determine-if-ray-hits-an-edge-of-a-model-in-unity-3d/163622#163622
# Determine if ray hits an edge of a model in Unity 3D How can i determine if a ray was hitting an edge of a mesh? The figure below shows what I want to achieve: Any ideas? • Can you define what you mean by "an edge of a mesh" ? Do you mean any edge on any triangle that the mesh contains? What have you tried and why did it fail? Sep 11 '18 at 9:48 • Hey, thanks for your reply! By edge I mean a corner of a building or generally a sharp edge in a 3D Model, not every single edge in a mesh. I think it could be very complicated and I tried nothing so far because I dont have a clue on that. Sep 11 '18 at 10:01 Adjacency information like this isn't needed for most stuff we do with meshes in games, so unfortunately the out-of-the-box representations don't make it easy to access. The simplest way to do this, especially if you have only a few, simple meshes that need this, is to hand-place a narrow capsule collider along each edge you want to detect with raycasts this way, then fire your raycast against the physics layer containing these edge mark-up shapes. If you want to automatically detect these edges, I'd recommend applying a pre-processing step to help accelerate the queries. You can do this at edit time or in-game when you load a mesh that needs this metadata. 1. Iterate over all the mesh's vertices and build a lookup table that associates vertices in the same position with a shared index. 2. Prepare an associative map edges, keyed by the shared indices of the two vertices it joins (always put the lower index first, so you get the same key regardless of order) 3. Iterate over all the mesh's triangles and compute a face normal for each one by averaging its vertex normals. Use the edge map to store a reference to this triangle and its normal associated with each edge of the triangle. 4. When you find two triangles that share an edge, check the angle between their face normals. If it's less than some threshold you choose, we can call this an internal edge and ignore it. If it's greater, then we call this a sharp edge and mark it up for raycast hits as follows. (You could also take into account whether it's a smooth-shaded edge or creased, if you choose) 5. Build an associative map of crease edges. This will be again be keyed by vertex indices, but we'll use their original indices this time, not the shared alias as we used before. And we'll list them in the key in the order in which they appear consecutively when we wind around the triangle, so the two triangles meeting at an edge give opposite orders (assuming manifold geometry). 6. We add our newly-discovered sharp edge to this final map. The value we store with this key is a float tolerance range, computed as the maximum tolerance distance you choose for your raycasts (how far from the edge can we hit and still call it an "edge hit"?) divided by the length of the altitude of the parent triangle measured from this edge to the opposite vertex. Okay, that was exhaustive. But now we can keep this final map structure for each mesh, and throw away the intermediate structures we built along the way. Now when we get a candidate raycast hit, we can get its triangle index property, and use that to check whether any of the three edges of the triangle are in the mesh's sharp edge map. If so, we get the hit's barycentric coordinate property, and check whether the weight for the opposite vertex is less than the tolerance value we stored in our map for that edge. If so, then we have struck within our tolerance distance of a sharp edge! :D Okay, so that was a lot of work. One last strategy we could try is somewhat empirical: When you get a candidate raycast hit, get the triangle normal. Using this, you can predict an expected depth for subsequent raycasts fired from slightly offset positions (as if you were hitting a flat plane). Fire a few such raycasts in the same direction as your original, from positions slightly offset from the first hit. If the depth of any of these raycasts is much larger than the prediction, then you've grazed past an edge, and you can treat the original hit as an edge hit. • Thank you for your answer. The first and last suggestion will not work in my case I think. I Import the meshes at runtime, so I can not manually attach some colliders. The last one is problematic if a ray hits a surface on a very low angle, but for some cases that would work and I thought about that too. The second suggestion is the most pratcial I think and I'll give it a try. Thank you! Sep 11 '18 at 17:43
2021-11-29 14:05:26
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.6514557003974915, "perplexity": 599.2299334906851}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-49/segments/1637964358774.44/warc/CC-MAIN-20211129134323-20211129164323-00478.warc.gz"}
https://socratic.org/questions/not-sure-how-to-appraoch-this-can-someone-help-would-really-appreciate-it#632711
# Not sure how to appraoch this ? can someone help would really appreciate it Jun 20, 2018 ${\int}_{0}^{2} f \left(x\right) \mathrm{dx} = 23$ #### Explanation: ${\int}_{0}^{2} f \left(x\right) \mathrm{dx} = {\int}_{0}^{1} f \left(x\right) \mathrm{dx} + {\int}_{1}^{2} f \left(x\right) \mathrm{dx}$ • ${\int}_{0}^{1} f \left(x\right) \mathrm{dx} = {\int}_{0}^{1} 5 {x}^{9} \mathrm{dx} = 5 {\int}_{0}^{1} \left({x}^{10} / 10\right) ' \mathrm{dx} =$ $5 {\left[{x}^{10} / 10\right]}_{0}^{1} = \frac{5}{10} {\left[{x}^{10}\right]}_{0}^{1} = \frac{1}{2} {\left[{x}^{10}\right]}_{0}^{1} = \frac{1}{2} \left(1 - 0\right) = \frac{1}{2}$ • ${\int}_{1}^{2} f \left(x\right) \mathrm{dx} = {\int}_{1}^{2} 6 {x}^{3} \mathrm{dx} = 6 {\int}_{1}^{2} \left({x}^{4} / 4\right) ' \mathrm{dx} =$ $\frac{6}{4} {\int}_{1}^{2} \left({x}^{4}\right) ' \mathrm{dx} = \frac{3}{2} {\left[{x}^{4}\right]}_{1}^{2} = \frac{3}{2} \left(16 - 1\right) = \frac{3}{2} \cdot 15 = \frac{45}{2}$ Hence, ${\int}_{0}^{2} f \left(x\right) \mathrm{dx} = \frac{1}{2} + \frac{45}{2} = \frac{46}{2} = 23$
2021-10-17 12:01:20
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 7, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9844078421592712, "perplexity": 3115.2365996203675}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-43/segments/1634323585177.11/warc/CC-MAIN-20211017113503-20211017143503-00507.warc.gz"}
https://www.gamedev.net/forums/topic/72553-matrices-and-vertex-buffers-and-/
• ### Popular Now • 12 • 27 • 9 • 9 • 20 #### Archived This topic is now archived and is closed to further replies. # Matrices and Vertex Buffers and ... This topic is 5923 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic. ## Recommended Posts Ok, first let me say any help would be greatly appreciated! What I have as a vertex buffer filled with a TriangleList of Transformed and Lit Vertices in Fullscreen mode. I made all of this work, but now when I try to apply matrices nothing happens. Zip, nada... There are so many things that can go wrong that I am not sure what to tell you, so if you need any more info just tell me. ##### Share on other sites How is it defined? #define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ|D3DFVF_TEX1) ##### Share on other sites G''day! Transformed vertices ignore the world matrix. The world matrix exists to transform the vertices from model space, but TL vertices are already in screen space so it''s not needed. Stay Casual, Ken Drunken Hyena ##### Share on other sites Hey, thanks for the replys so far! Public Const FVF = D3DFVF_XYZRHW Or D3DFVF_DIFFUSE Or D3DFVF_TEX1 VB of course... no flaming me please. About transformed vertices not using the world matrix, what about the view matrix?
2018-03-17 14:44:14
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.1763424277305603, "perplexity": 3799.009974850417}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2018-13/segments/1521257645177.12/warc/CC-MAIN-20180317135816-20180317155816-00785.warc.gz"}
https://math.stackexchange.com/questions/658992/proving-the-geometric-sum-formula-by-induction
# Proving the geometric sum formula by induction $$\sum_{k=0}^nq^k = \frac{1-q^{n+1}}{1-q}$$ I want to prove this by induction. Here's what I have. $$\frac{1-q^{n+1}}{1-q} + q^{n+1} = \frac{1-q^{n+1}+q^{n+1}(1-q)}{1-q}$$ I wanted to factor a $q^{n+1}$ out of the second expression but that 1- is screwing it up... • It's fully correct... just expand the term in the parenthesis and cancel out the two terms in the middle... Jan 31, 2014 at 22:43 • Multiply through. You get on top $1-q^{n+1}+q^{n+1}-q^{n+2}$. Jan 31, 2014 at 22:43 • I can't believe I didn't see that. I'm no good at this sort of thing. Feb 1, 2014 at 2:05 • also: what happens if q= 1 in this sum? obviously the zero denominator causes a problem Feb 1, 2014 at 2:13 $$1 - q^{n+1} + q^{n+1}(1-q) = 1 - q^{n+1}(1 - (1-q)) = 1 - (q^{n+1} \cdot q) = \cdots$$ Did you try expanding the numerator? You have $1-q^{n+1}+q^{n+1}-q^{n+2}$.. • I don't know how to factor it ending up with $\frac{x^{k+1}-1}{x-1}$.
2022-05-26 12:14:04
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.6646327972412109, "perplexity": 610.723188130645}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2022-21/segments/1652662604794.68/warc/CC-MAIN-20220526100301-20220526130301-00573.warc.gz"}
http://crypto.stackexchange.com/questions?page=36&sort=newest
# All Questions 194 views ### What is a q-type assumption? I've seen the term "$q$-type assumption" used in a few papers without a definition. A google search doesn't seem to come up with anything useful either (except the same papers without a definition). ... 65 views ### Client-server communication The base scenario goes as follows: A program stores some user's confidential data encrypted on their disk. The user is most probably clueless and the disk might get stolen, but these are the classical ... 94 views ### Isn't Groth-Sahai proof system applicable beyond Bilinear groups? Classical paper by Groth-Sahai on NIZK proof system is titled as "Efficient Non-interactive Proof Systems for Bilinear Groups". To my understanding, only (Pairing Product Equation) PPE are defined ... 222 views ### Frequency analysis of Vigenere Cipher For Vigenere cipher, I understand Find period first (say we have p = 6) Find highest frequency of letter in each group (from 1 to 6) and assume it is "e" in plaintext What if we have more than ... 154 views ### Monoalphabetic cipher key I'm new to cryptography and have just completed homework on Monoalphabetic cipher. I managed to decrypt the cipher text successfully but I cannot identify the key from my plaintext to ciphertext ... 47 views ### Infer encoding mechanism from $n$-grams distance? I have a series of obfuscated strings which across the set of strings have regions of high variance and regions of low variance – implying some encoding mechanism as opposed to an encryption procedure ... 96 views ### A one way Function provably reversible at N applications with the same seed? I'm looking for a function that is generally one way from some secret $F(s, A) \rightarrow Y$, where $A$ is known, $Y$ is produced (also known), and $s$ is kept secret. But whose repeated application ... 119 views ### Is it safe to salt a MAC? Say that I define a scheme where the salt is public and is MAC-ed with the message: $k = KDF(password, salt)$ $tag = MAC_k(salt || message)$ Is it safe to salt the MAC this way? Assume that the salt ... 301 views ### Use case of RSA CRT I discovered the CRT version of RSA cryptosystem which is used in many crypto libraries (openSSL, Java...). The use of the Chinese Remainder Theorem improves the speed of decryption so why it's not ... 64 views ### Efficiently show/prove knowledge of third party secret without leaking information Say Alice publishes (i.e. all parties in the universe) a key or certificate $x$ and sends a secret $s$ to Bob. Bob then publishes some data $d$ (his identity or a message or smt.) and an ... 157 views ### How secure is a lagged fibonacci sequence for encrypting brief messages? Say I start with a 26-letter keyword and convert the letters into 26 integers (A=0, B=1...Z=25) nr[0] to nr[25]. Then I create a stream, nr[26] onwards, with a lagged fibonacci sequence where nr[n]= ... 497 views ### What do you call one time pad where pseudo-random numbers are used? What is the encryption method called when pseudo-random numbers are used instead of true random numbers? 117 views ### Is there any probabilistic version of RSA? I have now studying the RSA, but I think that is it possible to have some probabilistic version like a random bit string "r" XORed with the key? Is there any probabilistic version of RSA? Thak you ... 151 views ### Large file validation on an embedded system through hash and encryption As a preface, I have to say that I am a noob in this area. Having said that, I will ask the question. I have a situation where I need to validate and protect against tampering a handful of large ... 93 views ### DES-X , computation load and storage The passage said that the computational load to attack DES-X can be reduced to approximately $2^{(56+64)}=2^{120}$ steps,and the storage of data sets should be $2^{64}$. But I can't figure why ... 122 views ### What can be learned from the ciphertext of LibSodium's crypto_box_detached()? LibSodium, (https://github.com/jedisct1/libsodium), has a function crypto_box_detached() which does authenticated encryption using the public key of the recipient ... 149 views ### Does the size of a ECDSA key determine the hash algorithm? I am a bit lost in understanding what I read on authentication, signature, etc. For instance, is the size of the ECDSA keys produced by ssh-keygen -t ecdsa -b 256 ... 97 views ### Is AES's parity key-dependent? Is the parity of the permutation of the set $\{0,1\}^{128}$, defined by AES encryption for a certain fixed key, dependent on this key? DES, and any pure Feistel cipher, has even parity for any key. ... 94 views 110 views ### Protection of Elliptic Curve Implementations against side-channel attacks [closed] Recent fast elliptic curve implementations, for example a presentation at Eurocrypt 2014 (earlier presentation slides, the paper) talks about protection against only timing attacks. Why only timing ... 160 views ### Does a stream cipher require a KDF when it's key is variable length? RC4 has a variable length key. Is it still necessary to use a key derivation function, such as PBKDF2, to initialize it? Would using a single character password weaken it's output when compared to a ... 172 views ### Security of chameleon hash functions With the knowledge of the trapdoor, we are able to compute the same digest for differents messages. I've read that given two messages $m$, $m'$ and two numbers $r$, $r'$ such that ... 596 views ### ZIP 2.0 encryption bruteforce attack I have an old sourcecode backup from my DOS days stored in a ZIP 2.0 encrypted archive, but I lost the password. The password was written on a paper slip, but I remember that it consisted of 30+ ... 76 views ### Can we run a probabilistic function on ciphertext with Functional Encryption (or Attribute Based Encryption)? In the definition of functional encryption ($FE$): $FE.Setup(1^k)$ takes as input the security parameter $1^k$ and outputs a master public key $fmpk$ and a master secret key $fmsk$. \$FE.KeyGen(fmsk, ... 218 views ### problem with “one time pad” [closed] I am a french student and I read the post on the forums (How does one attack a two-time pad (i.e. one time pad with key reuse)?). I need your help if possible. I 'm 11 encrypted messages , all ... 81 views ### Does the transposition cipher have a network application? So I'm reading a chapter in my networking book and it talks about substitution and transposition ciphers (Transposition Cipher Wikipedia). I know that most network security uses public key or ... 90 views ### Why can't garbled circuits be reused? There are a bunch of papers do research on resizable garbled circuits. But I wonder why garbled circuits cannot be reused? For example, the constructor constructs a garbled circuit of "AND" like ... 99 views ### Implementation of garbled circuits using RSA I was just reading these notes on garbled (Yao) circuits and I just stuck trying to figure out how an implementation of Table 1 would work using RSA encryption. In RSA the public key is (n,e). So for ... 118 views ### What does “learnable with oracle queries” mean? I came across the following quotes in reading papers on obfuscation (1, ibid, and 2): The next result follows from the fact that point functions are not exactly learnable (since a uniformly chosen ... 72 views ### MD5 update functions In the hashlib module in python is a function called m.update() where m is a ... 72 views ### initiate the elliptic curve when we consider a curve in a prime field for example Weierstrass form and want to initiate it in Miracl,we should give these inputs for initiate curve: ebrick_init(&binst,x,y,a,b,n,window,nb) ...
2015-07-03 20:26:43
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.839832067489624, "perplexity": 2546.9062689520506}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2015-27/segments/1435375096209.79/warc/CC-MAIN-20150627031816-00251-ip-10-179-60-89.ec2.internal.warc.gz"}
http://tex.stackexchange.com/questions/66537/making-hats-and-other-accents-bold
# Making hats (and other accents) bold I've been typesetting some equations, and I've found that the default behavior accents like \hat, \bar, \tilde, etc. makes a rather small and easily-missed mark. Is there some way to make the accents stand out more? In particular, is there any way to make them appear in bold (without affecting the letter they are over)? - Here is one solution, albeit cumbersome: \documentclass{article} \usepackage{amsmath}% http://ctan.org/pkg/amsmath \newcommand{\thickhat}[1]{\mathbf{\hat{\text{$#1$}}}} \newcommand{\thickbar}[1]{\mathbf{\bar{\text{$#1$}}}} \newcommand{\thicktilde}[1]{\mathbf{\tilde{\text{$#1$}}}} \begin{document} $\hat{a}, \bar{a}, \tilde{a}$ \par $\hat{\mathbf{a}}, \bar{\mathbf{a}}, \tilde{\mathbf{a}}$ \par $\mathbf{\hat{a}}, \mathbf{\bar{a}}, \mathbf{\tilde{a}}$ \par $\thickhat{a}, \thickbar{a}, \thicktilde{a}$ \par \end{document} amsmath provides the easy font-and-size switching capability via \text. This allows you to use the \thick-constructs inside super-/subscripts. - No, this is perfect. Thank you. – yrudoy Aug 9 '12 at 23:11 @yrudoy and Werner: This solution doesn't properly place the bold accent. For example, \thickhat{A} doesn't yield the desired output. – Hendrik Vogt Aug 12 '12 at 20:03 bm package can help here. The first row is normal, the second is normal with bold accents and the third is all bold. \documentclass{article} \usepackage{bm} \begin{document} \showoutput $\hat{a }\bar{a} \tilde{a}$ $\bm\hat{a} \bm\bar{a} \bm\tilde{a}$ $\bm{\hat{a}} \bm{\bar{a}} \bm{\tilde{a}}$ \end{document} - Terrific solution! I didn't know bm could do this. – Hendrik Vogt Aug 12 '12 at 20:01 How to define a new command which can do that ?. I tried \renewcommand\bar{\bm\bar}, but it does not work. – LlavDem May 3 at 6:03 @LlavDem that defines \bar to be an infinite loop. just use \newcommand\boldbar{\bm\bar} (or use \bmdefine) – David Carlisle May 3 at 8:05
2016-06-26 13:38:38
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9238213896751404, "perplexity": 3918.5515405695905}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2016-26/segments/1466783395346.6/warc/CC-MAIN-20160624154955-00020-ip-10-164-35-72.ec2.internal.warc.gz"}
https://www.numa.uni-linz.ac.at/Teaching/PhD/Finished/nakov
Subject: The Poisson-Boltzmann Equation: Analysis, A Posteriori Error Estimates and Applications treated by: Svetoslav Nakov Supervisor: Prof. Dr. Johannes Kraus (University of Duisburg-Essen) Second Supervisor: Univ.-Prof. Dr. Dirk Praetorius (TU Wien) The Poisson-Boltzmann equation (PBE) gives a mean field description of the electrostatic potential in a system of molecules in ionic solution. It is a commonly accepted and widely used approach to the modelling of the electrostatic fields in and around biological macromolecules such as proteins, RNA or DNA. The PBE is a semilinear elliptic equation with a nonlinearity of exponential type, a measure right hand-side, and jump discontinuities of its coefficients across complex surfaces that represent the molecular structures under study. These features of the PBE pose a number of challenges to its rigorous analysis and numerical solution. This thesis is devoted to the existence and uniqueness analysis of the PBE and the derivation of a posteriori error estimates for the distance between its exact solution and any admissible approximation of it, measured either in global energy norms or in terms of a specific goal quantity represented in terms of a linear functional. These error estimates allow for the construction of adaptive finite element methods for the fully reliable and computationally efficient solution of the PBE in large systems with complicated molecular geometries and distribution of charges. One of the main focuses of this work is the rigorous analysis of the Poisson-Boltzmann equation and its linearized version, the LPBE. The starting point is to give a weak formulation which is appropriate for elliptic equations with measure data, such as the delta distributions due to fixed point charges in the molecular regions. For this weak formulation we are able to show existence of a solution by means of 2-term and 3-term splittings, where the full potential is decomposed into a singular Coulomb potential and a more regular part, a particular representative of which can be defined by a weak formulation involving $H^1$ Sobolev spaces. In the case of the LPBE we are also able to show the uniqueness of the full electrostatic potential. Another main goal of this thesis is the derivation of a posteriori error estimates for the linearized and fully nonlinear Poisson-Boltzmann equation. More precisely, we derive two types of a posteriori error estimates: global estimates for the error in the electrostatic potential, measured in the so-called energy norm, and goal-oriented error estimates for the electrostatic interaction between molecules. We apply the first type of error estimates to the study of the electrostatic potential in and around the insulin protein with PDB ID 1RWE, the Alexa 488 and 594 dyes, as well as the membrane protein-conducting channel SecYEG. In all these applications we obtain guaranteed and fully computable bounds on the relative errors in global energy norms. Moreover, we are able to establish a near best approximation result for the regular part of the electrostatic potential which is the basis for deriving a priori error estimates in energy norm for the finite element method. The second type of error estimates, also called goal-oriented a posteriori error estimates, are employed in the computation of the electrostatic interaction between the dyes Alexa 488 and Alexa 594 being either in their ground state or transition state. The latter configuration is related to the calculation of the efficiency of the Fröster resonance energy transfer (FRET) between the two dyes. Download: PhD thesis as PDF file ( 52MB, corrections) PhD thesis as PDF file ( 52MB, original) back to PhD theses
2020-07-14 00:54:21
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.7019408941268921, "perplexity": 373.2305059822799}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.3, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2020-29/segments/1593657147031.78/warc/CC-MAIN-20200713225620-20200714015620-00139.warc.gz"}
http://physics.stackexchange.com/questions/35117/pressure-change-due-to-fan-removing-air-from-a-non-airtight-room/35121
# Pressure change due to fan removing air from a non-airtight room The following problem occurred to me today: Suppose a $100\mathrm{cfm}$ fan is pushing air out of a large room which is airtight except for a $10 \mathrm{cm}^2$ hole. The air pressure outside the room is $101.3\mathrm{kPa}$, and the atmosphere consists of $80\%$ nitrogen and $20\%$ oxygen. All temperatures are $300\mathrm{K}$. What is the equilibrium pressure inside the room? I believe I have given enough information to determine the resulting pressure. My inclination is to take a naïve statistical mechanics approach to the problem. This leads me down the following train of thought: • Particles are distributed evenly inside and outside the room, with a cubic meter containing $N_i=\frac{P_i}{k_BT}$ and $N_o=\frac{P_o}{k_BT}$ molecules respectively, where $P_i$ is the pressure inside and $P_o$ the pressure outside. • Velocities are distributed symmetrically and speeds satisfy a Boltzmann distribution, so for a fixed type of molecule $M$ the distribution of $v_z$, the $z$-coordinate of velocity squared, is $$D_M(v_z)=\int_{S^2}\mathrm{exp}\left(\frac{-m_Mv_z^2}{2k_BT\cos\theta^2}\right)\mathrm{d}\theta\mathrm{d}\phi$$ where $m_M$ is the mass of the molecule $M$. • The number of molecules of $M$ that strike an area $A$ over time $t$ from inside is $$\int_0^\infty Ax_MN_i\int_{d/t}^{\infty} D_M(v_z)\mathrm{d}v_z\mathrm{d}d$$ where $d$ denotes the distance along the $z$-axis of the molecule from the area and $x_M$ denotes the fraction of all molecules which are $M$. Similarly, the number of molecules of $M$ that strike an area $A$ over time $t$ from outside is $$\int_0^\infty Ax_MN_o\int_{d/t}^{\infty} D_M(v_z)\mathrm{d}v_z\mathrm{d}d.$$ • The difference between these two, summed for oxygen and nitrogen, must be equal to the number of molecules of $M$ removed by the fan, which is $.0472\cdot N_it$. Thus we have $$.0472\cdot N_it=A(N_i-N_o)\int_0^\infty \int_{d/t}^{\infty} \left(x_{N^2}D_{N^2}+x_{O^2} D_{O^2}(v_z)\right)\mathrm{d}v_z\mathrm{d}d$$ so solving for $N_i$ we get \begin{align} N_i &=\frac{AN_o\int_0^\infty \int_{d/t}^{\infty} \left(x_{N^2}D_{N^2}+x_{O^2} D_{O^2}(v_z)\right)\mathrm{d}v_z\mathrm{d}d}{A\int_0^\infty \int_{d/t}^{\infty} \left(x_{N^2}D_{N^2}+x_{O^2} D_{O^2}(v_z)\right)\mathrm{d}v_z\mathrm{d}d-.0472t}\\ &=\frac{.1\mathrm{m}^2\cdot\frac{101.3\mathrm{kPa}\cdot \mathrm{m}^3}{1.38e-23 \mathrm{J}/\mathrm{K}\cdot 300\mathrm{K}}\int_0^\infty \int_{d/1\mathrm{s}}^{\infty} \left(.8D_{N^2}+.2 D_{O^2}(v_z)\right)\mathrm{d}v_z\mathrm{d}d}{.1\mathrm{m}^2\int_0^\infty \int_{d/1\mathrm{s}}^{\infty} \left(.8D_{N^2}+.2 D_{O^2}(v_z)\right)\mathrm{d}v_z\mathrm{d}d-.0472\mathrm{s}}\\ &=\frac{2.45e24 \mathrm{m}^{2}\int_0^\infty \int_{d/1\mathrm{s}}^{\infty} \left(.8D_{N^2}+.2 D_{O^2}(v_z)\right)\mathrm{d}v_z\mathrm{d}d}{.1\mathrm{m}^2\int_0^\infty \int_{d/1\mathrm{s}}^{\infty} \left(.8D_{N^2}+.2 D_{O^2}(v_z)\right)\mathrm{d}v_z\mathrm{d}d-.0472\mathrm{s}}\\ \end{align} which I could probably evaluate using Mathematica if my desktop were working, but sadly it is not. From there it would be trivial to calculate $P_i$. My question is whether my reasoning up to this point is correct, and whether there are any factors I have left out. Additionally, is there an easier way to calculate $P_i$? - Wow, I'm just a chemical engineer but statistical mechanics certainly isn't how I would have solved this problem. Where exactly is the fan located? If it is freestanding in the large room then the fan will just recycle the air in circles and the pressure in the room will equilibrate with the outside pressure. If the fan is located in the hole then the equilibrium pressure in the room will depend on the head curve of the fan and will be outside pressure minus the maximum head developed by the fan at zero flow. – Jason Waldrop Aug 29 '12 at 17:06 @JasonWaldrop I guess I was unclear. The fan is blowing air out of another hole, at a rate of 100cfm at 101.3kPa (and the inside pressure should be close enough to this for the difference not to matter). – Alex Becker Aug 29 '12 at 19:21 You're basically assuming an infinite mean free path for the air molecules, whereas people normally would use the Navier-Stokes equations which assume an infinitesimal mean free path. You will therefore underestimate the pressure difference. Further, instead of solving the full fluid flow problem, people normally simply model a hole as "an impedance to flow"; flow rate scales with the hole area and with the square root of the pressure difference. From your problem statement, it seems this scale constant was given separately. - Yes, I assumed infinite MFP, because intuitively I think of the particles travelling through largely empty space and thus colliding rarely. Why is an infinitesimal MFP more accurate? Also, I'm not sure what you mean by "From your problem statement, it seems this scale constant was given separately." Is the information I've given enough to determine the scale constant? If not, what more do I need to specify? – Alex Becker Aug 29 '12 at 5:08 Air's MFP (~68nm according to Wikipedia) is much less than the radius of the hole, so infinitesimal is best. And, yes, you have given enough information, but you would need to solve the Navier-Stokes PDEs. My point was that people have already solved these PDEs for you to find the scale constant and save you the effort. – bobuhito Aug 29 '12 at 6:03 Ah, I hadn't realized air had such a small MFP. Thanks for the answer! – Alex Becker Aug 29 '12 at 8:34
2016-02-08 08:35:25
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 1, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.87967449426651, "perplexity": 554.671468818841}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 5, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2016-07/segments/1454701152982.47/warc/CC-MAIN-20160205193912-00062-ip-10-236-182-209.ec2.internal.warc.gz"}
https://en.wikisource.org/wiki/1911_Encyclop%C3%A6dia_Britannica/Gas
# 1911 Encyclopædia Britannica/Gas GAS, a general term for one of the three states of aggregation of matter; also more specifically applied to coal-gas, the gaseous product formed in the destructive distillation of coal or other carbonaceous matter (see below, section Gas Manufacture; for gas engines see the separate heading Gas Engine). The Gaseous State.—Matter is studied under three physical phases—solids, liquids and gases, the latter two being sometimes grouped as “fluids.” The study of the physical properties of fluids in general constitutes the science of hydromechanics, and their applications in the arts is termed hydraulics; the special science dealing with the physical properties of gases is named pneumatics. The gaseous fluid with which we have chiefly to do is our atmosphere. Though practically invisible, it appeals in its properties to other of our senses, so that the evidences of its presence are manifold. Thus we feel it in its motion as wind, and observe the dynamical effects of this motion in the quiver of the leaf or the motion of a sailing ship. It offers resistance to the passage of bodies through it, destroying their motion and transforming their energy—as is betrayed to our hearing in the whiz of the rifle bullet, to our sight in the flash of the meteor. The practically obvious distinction between solids and fluids may be stated in dynamical language thus:—solids can sustain a longitudinal pressure without being supported by a lateral pressure; fluids cannot. Hence any region of space enclosed by a rigid boundary can be easily filled with a fluid, which then takes the form of the bounding surface at every point of it. But here we distinguish between fluids according as they are gases or liquids. The gas will always completely fill the region, however small the quantity put in. Remove any portion and the remainder will expand so as to fill the whole space again. On the other hand, it requires a definite quantity of liquid to fill the region. Remove any portion and a part of the space will be left unoccupied by liquid. Part of the liquid surface is then otherwise conditioned than by the form of the wall or bounding surface of the region; and if the portion of the wall not in contact with the liquid is removed the form and quantity of the liquid are in no way affected. Hence a liquid can be kept in an open vessel; a gas cannot so be. To quote the differentia of Sir Oliver Lodge: “A solid has volume and shape; a liquid has volume, but no shape; a gas has neither volume nor shape.” It is necessary to distinguish between a gas and a “vapour.” The latter possesses the physical property stated above which distinguishes a gas from a fluid, but it differs from a gas by being readily condensible to a liquid, either by lowering the temperature or moderately increasing the pressure. The study of the effects of pressure and temperature on many gases led to the introduction of the term “permanent gases” to denote gases which were apparently not liquefiable. The list included hydrogen, nitrogen and oxygen; but with improved methods these gases have been liquefied and even solidified, thus rendering the term meaningless (see Liquid Gases). The term “perfect gas” is applied to an imaginary substance in which there is no frictional retardation of molecular motion; or, in other words, the time during which any molecule is influenced by other molecules is infinitesimally small compared with the time during which it traverses its mean free path. It serves as a means of research, more particularly in mathematical investigations, the simple laws thus deduced being subsequently modified by introducing assumptions in order to co-ordinate actual experiences. The gaseous state was well known to the ancients; for instance, in Greek cosmology, “air” (πνεῦμα) was one of the fundamental elements. The alchemists used such terms as spiritus, flatus, halitus, aura, emanatio nubila, &c., words implying a “wind” or “breath.” The word “gas” was invented by J. B. van Helmont in his Ortus medicinae, posthumously published in 1648, in the course of his description of the gas now known as carbon dioxide. He found that charcoal on burning yielded a “spirit,” which he named spiritus sylvestris on account of its supposed untamable nature (“Gas sylvestre sive incoërcibile, quod in corpus cogi non potest visibile”); and he invented the word “gas” in the expression: “... this spirit, hitherto unknown, ... I call by a new name gas” (“hunc spiritum, incognitum hactenus, novo nomine gas voco”). The word was suggested by the Gr. χάος, chaos, for he also writes: “I have called this spirit gas, it being scarcely distinguishable from the Chaos of the ancients” (“halitum illum Gas vocavi, non longe a Chao veterum secretum”). The view that the word was suggested by the Dutch geest, spirit, is consequently erroneous. Until the end of the 18th century the word “air,” qualified by certain adjectives, was in common use for most of the gases known—a custom due in considerable measure to the important part which common air played in chemical and physical investigations. The study of gases may be divided into two main branches: the physical and the chemical. The former investigates essentially general properties, such as the weight and density, the relation between pressure, volume and temperature (piezometric and thermometric properties), calorimetric properties, diffusion, viscosity, electrical and thermal conductivity, &c., and generally properties independent of composition. These subjects are discussed in the articles Density; Thermometry; Calorimetry; Diffusion; Conduction of Heat; and Condensation of Gases. The latter has for its province the preparation, collection and identification of gases, and the volume relations in which they combine; in general it deals with specific properties. The historical development of the chemistry of gases—pneumatic chemistry—is treated in the article Chemistry; the technical analysis of gaseous mixtures is treated below under Gas Analysis. Connecting the experimental study of the physical and chemical properties is the immense theoretical edifice termed the kinetic theory of gases. This subject, which is discussed in the article Molecule, has for its purpose (1) the derivation of a physical structure of a gas which will agree with the experimental observations of the diverse physical properties, and (2) a correlation of the physical properties and chemical composition. Gas Analysis.—The term “gas analysis” is given to that branch of analytical chemistry which has for its object the quantitative determination of the components of a gaseous mixture. The chief applications are found in the analysis of flue gases (in which much information is gained as to the completeness and efficiency of combustion), and of coal gas (where it is necessary to have a product of a definite composition within certain limits). There are, in addition, many other branches of chemical technology in which the methods are employed. In general, volumetric methods are used, i.e. a component is absorbed by a suitable reagent and the diminution in volume noted, or it is absorbed in water and the amount determined by titration with a standard solution. Exact analysis is difficult and tedious, and consequently the laboratory methods are not employed in technology, where time is an important factor and moderate accuracy is all that is necessary. In this article an outline of the technical practice will be given. The apparatus consists of (1) a measuring vessel, and (2) a series of absorption pipettes. A convenient form of measuring vessel is that devised by W. Hempel. It consists of two vertical tubes provided with feet and connected at the bottom by flexible rubber tubing. One tube, called the “measuring tube,” is provided with a capillary stopcock at the top and graduated downwards; the other tube, called the “level tube,” is plain and open. To use the apparatus, the measuring tube is completely filled with water by pouring water into both tubes, raising the level tube until water overflows at the stopcock, which is then turned. The test gas is brought to the stopcock, by means of a fine tube which has been previously filled with water or in which the air has been displaced by running the gas through. By opening the stopcock and lowering the level tube any desired quantity of the gas can be aspirated over. In cases where a large quantity of gas, i.e. sufficient for several tests, is to be collected, the measuring tube is replaced by a large bottle. (By permission of Messrs Baird & Tatlock.) Fig. 1. Fig. 2. The volume of the gas in the measuring tube is determined by bringing the water in both tubes to the same level, and reading the graduation on the tube, avoiding parallax and the other errors associated with recording the coincidence of a graduation with a meniscus. The temperature and atmospheric pressure are simultaneously noted. If the tests be carried out rapidly, the temperature and pressure may be assumed to be constant, and any diminution in volume due to the absorption of a constituent may be readily expressed as a percentage. If, however, the temperature and pressure vary, the volumes are reduced to 0° and 760 mm. by means of the formula V0 = V(P − p)/(1 + .00366t)760, in which V is the observed volume, P the barometric pressure, p the vapour tension of water at the temperature t of the experiment. This reduction is facilitated by the use of tables. Some common forms of absorption pipettes are shown in figs. 1 and 2. The simpler form consists of two bulbs connected at the bottom by a wide tube. The lower bulb is provided with a smaller bulb bearing a capillary through which the gas is led to the apparatus, the higher bulb has a wider outlet tube. The arrangement is mounted vertically on a stand. Sometimes the small bulb on the left is omitted. The form of the pipette varies with the nature of the absorbing material. For solutions which remain permanent in air the two-bulbed form suffices; in other cases a composite pipette (fig. 2) is employed, in which the absorbent is protected by a second pipette containing water. In the case of solid reagents, e.g. phosphorus, the absorbing bulb has a tubulure at the bottom. To use a pipette, the absorbing liquid is brought to the outlet of the capillary by tilting or by squeezing a rubber ball fixed to the wide end, and the liquid is maintained there by closing with a clip. The capillary is connected with the measuring tube by a fine tube previously filled with water. The clip is removed, the stopcock opened, and the level tube of the measuring apparatus raised, so that the gas passes into the first bulb. There it is allowed to remain, the pipette being shaken from time to time. It is then run back into the measuring tube by lowering the level tube, the stopcock is closed, and the volume noted. The operation is repeated until there is no further absorption. The choice of absorbents and the order in which the gases are to be estimated is strictly limited. Confining ourselves to cases where titration methods are not employed, the general order is as follows: carbon dioxide, olefines, oxygen, carbon monoxide, hydrogen, methane and nitrogen (by difference). This scheme is particularly applicable to coal-gas. Carbon dioxide is absorbed by a potash solution containing one part of potash to between two and three of water; the stronger solution absorbs about 40 volumes of the gas. The olefines—ethylene, &c.—are generally absorbed by a very strong sulphuric acid prepared by adding sulphur trioxide to sulphuric acid to form a mixture which solidifies when slightly cooled. Bromine water is also employed. Oxygen is absorbed by stick phosphorus contained in a tubulated pipette filled with water. The temperature must be above 18°; and the absorption is prevented by ammonia, olefines, alcohol, and some other substances. An alkaline solution of pyrogallol is also used; this solution rapidly absorbs oxygen, becoming black in colour, and it is necessary to prepare the solution immediately before use. Carbon monoxide is absorbed by a solution of cuprous chloride in hydrochloric acid or, better, in ammonia. When small in amount, it is better to estimate as carbon dioxide by burning with oxygen and absorbing in potash; when large in amount, the bulk is absorbed in ammoniacal cuprous chloride and the residue burned. Hydrogen may be estimated by absorption by heated palladium contained in a capillary through which the gas is passed, or by exploding (under reduced pressure) with an excess of oxygen, and measuring the diminution in volume, two-thirds of which is the volume of hydrogen. The explosion method is unsatisfactory when the gas is contained over water, and is improved by using mercury. Methane cannot be burnt in this way even when there is much hydrogen present, and several other methods have been proposed, such as mixing with air and aspirating over copper oxide heated to redness, or mixing with oxygen and burning in a platinum tube heated to redness, the carbon dioxide formed being estimated by absorption in potash. Gases soluble in water, such as ammonia, hydrochloric acid, sulphuretted hydrogen, sulphur dioxide, &c., are estimated by passing a known volume of the gas through water and titrating the solution with a standard solution. Many types of absorption vessel are in use, and the standard solutions are generally such that 1 c.c. of the solution corresponds to 1 c.c. of the gas under normal conditions. (By permission of Messrs Baird & Tatlock.) Fig. 3. Many forms of composite gas-apparatus are in use. One of the commonest is the Orsat shown in fig. 3. The gas is measured in the graduated cylinder on the right, which is surrounded by a water jacket and provided with a levelling bottle. At the top it is connected by a capillary tube bent at right angles to a series of absorbing vessels, the connexion being effected by stopcocks. These vessels consist of two vertical cylinders joined at the bottom by a short tube. The cylinder in direct communication with the capillary is filled with glass tubes so as to expose a larger surface of the absorbing solution to the gas. The other cylinder is open to the air and serves to hold the liquid ejected from the absorbing cylinder. Any number of bulbs can be attached to the horizontal capillary; in the form illustrated there are four, the last being a hydrogen pipette in which the palladium is heated in a horizontal tube by a spirit lamp. At the end of the horizontal tube there is a three-way cock connecting with the air or an aspirator. To use the apparatus, the measuring tube is completely filled with water by raising the levelling bottle. The absorbing vessels are then about half filled with the absorbents, and, by opening the cocks and aspirating, the liquid is brought so as completely to fill the bulbs nearer the capillary. The cocks are then closed. By opening the three-way cock to the supply of the test gas and lowering the levelling bottle, any desired amount can be drawn into the measuring tube. The absorption is effected by opening the cock of an absorbing vessel and raising the levelling bottle. The same order of absorption and general directions pertaining to the use of Hempel pipettes have to be adopted. Although the earliest attempts at gas analysis were made by Scheele, Priestley, Cavendish, Lavoisier, Dalton, Gay-Lussac and others, the methods were first systematized by R. Bunsen, who began his researches in 1838. He embodied his results in his classical Gasometrische Methoden (1857, second edition 1877), a work translated into English by H. Roscoe. Clemens Winkler contributed two works, Anleitung zur chemischen Untersuchung der Industriegase (1876–1877) and Lehrbuch der technischen Gasanalyse (2nd ed., 1892), both of which are very valuable for the commercial applications of the methods. W. Hempel’s researches are given in his Neue Methode zur Analyse der Gase (1880) and Gasanalytische Methoden (1890, 3rd ed. 1900). Gas Manufacture 1. Illuminating Gas.—The first practical application of gas distilled from coal as an illuminating agent is generally ascribed to William Murdoch, who between the years of 1792 and 1802 demonstrated the possibility of making gas from coal and using it as a lighting agent on Historical. a large scale. Prior to 1691, however, Dr John Clayton, dean of Kildare, filled bladders with inflammable gas obtained by the distillation of coal, and showed that on pricking the bladders and applying a light to the escaping gas it burnt with a luminous flame, and in 1726 Stephen Hales published the fact that by the distillation of 158 grains of Newcastle coal, 180 cub. in. of inflammable air would be obtained. Jean Pierre Minckelers, professor of natural philosophy in the university of Louvain, and later of chemistry and physics at Maestricht, made experiments on distilling gas from coal with the view of obtaining a permanent gas sufficiently light for filling balloons, and in 1785 experimentally lighted his lecture room with gas so obtained as a demonstration to his students, but no commercial application was made of the fact. Lord Dundonald, in 1787, whilst distilling coal for the production of tar and oil, noticed the formation of inflammable gas, and even used it for lighting the hall of Culross Abbey. It is clear from these facts that, prior to Murdoch’s experiments, it was known that illuminating gas could be obtained by the destructive distillation of coal, but the experiments which he began at Redruth in 1792, and which culminated in the lighting of Messrs Boulton, Watt & Co.’s engine works at Soho, near Birmingham, in 1802, undoubtedly demonstrated the practical possibility of making the gas on a large scale, and burning it in such a way as to make coal-gas the most important of the artificial illuminants. An impression exists in Cornwall, where Murdoch’s early experiments were made, that it was a millwright named Hornblower who first suggested the process of making gas to Murdoch, but, as has been shown, the fact that illuminating gas could be obtained from coal by distillation was known a century before Murdoch made his experiments, and the most that can be claimed for him is that he made the first successful application of it on a practical scale. In 1799 a Frenchman named Philippe Lebon took out a patent in Paris for making an illuminating gas from wood, and gave an exhibition of it in 1802, which excited a considerable amount of attention on the European continent. It was seen by a German, F. A. Winsor, who made Lebon an offer for his secret process for Germany. This offer was, however, declined, and Winsor returned to Frankfort determined to find out how the gas could be made. Having quickly succeeded in discovering this, he in 1803 exhibited before the reigning duke of Brunswick a series of experiments with lighting gas made from wood and from coal. Looking upon London as a promising field for enterprise, he came over to England, and at the commencement of 1804 took the Lyceum theatre, where he gave demonstrations of his process. He then proceeded to float a company, and in 1807 the first public street gas lighting took place in Pall Mall, whilst in 1809 he applied to parliament to incorporate the National Heat and Light Company with a capital of half a million sterling. This application was opposed by Murdoch on the ground of his priority in invention, and the bill was thrown out, but coming to parliament for a second time in 1810, Winsor succeeded in getting it passed in a very much curtailed form, and, a charter being granted later in 1812, the company was called the Chartered Gas Light and Coke Company, and was the direct forerunner of the present London Gas Light and Coke Company. During this period Frederick C. Accum (1769–1838), Dr W. Henry and S. Clegg did so much by their writings and by the improvements they introduced in the manufacture, distribution and burning of coal gas, that their names have become inseparably connected with the subject. In 1813 Westminster Bridge, and in the following year the streets of Westminster, were lighted with gas, and in 1816 it became common in London. After this so rapid was the progress of this new mode of illumination that in the course of a few years it was adopted by all the The growth of gas lighting. principal towns in the United Kingdom for lighting streets as well as shops and public edifices. In private houses it found its way more slowly, partly from an apprehension of danger attending its use, and partly from the discomfort which was experienced in many cases through the gas being distributed without purification, and to the careless and imperfect manner in which the service pipes were first fitted. It was during the last four decades of the 19th century that the greatest advance was made, this period having been marked not only by many improvements in the manufacture of illuminating gas, but by a complete revolution in the methods of utilizing it for the production of light. In 1875 the London Argand, giving a duty of 3.2 candles illuminating power per cubic foot of ordinary 16 candle gas, was looked upon as the most perfect burner of the day, and little hope was entertained that any burner capable of universal adoption would surpass it in its power of developing light from the combustion of coal gas; but the close of the century found the incandescent mantle and the atmospheric burner yielding six times the light that was given by the Argand for the consumption of an equal volume of gas, and to-day, by supplying gas at an increased pressure, a light of ten times the power may be obtained. Since the advent of the incandescent mantle, the efficiency of which is dependent upon the heating power of the gas more than on its illuminating power, the manufacture of coal gas has undergone considerable modifications. Coal, the raw material from which the gas is produced by a process of destructive distillation, varies very widely in composition (see Coal), and it is only the class of coals rich in hydrogen, known as bituminous coal, that can with advantage be Coals used for gas-making. utilized in gas manufacture. Coals of this character are obtained in England from the Newcastle and Durham field, South Yorkshire, Derbyshire and Barnsley districts, and an idea of their ultimate composition may be derived from the following table:— Carbon. Hydrogen Sulphur. Nitrogen Oxygen. Ash. Moisture. Newcastle gas coal 82.16 4.83 1.00 1.23 6.82 3.20 0.76 Durham gas coal 84.34 5.30 0.73 1.73 4.29 2.42 1.14 South Yorkshire silkstone 80.46 5.09 1.66 1.67 6.79 3.30 1.03 Derbyshire silkstone 76.96 5.04 2.39 1.77 6.92 3.28 3.64 Barnsley gas coal 75.64 4.94 2.84 1.65 7.25 4.28 3.40 Our knowledge of the composition of coal is limited to the total amount of carbon, hydrogen, nitrogen, oxygen and foreign materials which it contains; and at present we know practically but little of the way in which these bodies are combined. This being so, the ordinary analysis of a coal affords but little indication of its value for gas-making purposes, which can only be really satisfactorily arrived at by extended use on a practical scale. Bituminous coal, however, may be looked upon as containing carbon and also simple hydrocarbons, such as some of the higher members of the paraffin series, and likewise organic bodies containing carbon, hydrogen, nitrogen, oxygen and sulphur. On submitting a complex substance of this character to destructive distillation, it will be found that the yield and quality of the products will vary very considerably with the temperature existing in the retorts, with the size of the charge of coal used, with its distribution Destructive distillation of coal. in the retort, with the length of time the distillation has been going on, and with an infinity of other factors of a more or less complex nature. If bituminous coal is distilled at a low temperature, the tar is found to contain considerable quantities of light paraffin oils; and there is no doubt that paraffin hydrocarbons are present in the original coal. These paraffins, under the influence of heat, split up into simpler members of the same series and into olefines; and if we imagine the action in its simplest form, we should have the gases, as they were evolved, consisting of (say) ethane and ethylene. These have now to pass down the heated retort on their way to the ascension pipe, and the contact with the heated sides of the retort, and the baking from the radiant heat in the retort, set up an infinity of changes. Ethane, when heated to this degree, splits up into ethylene and hydrogen, whilst ethylene decomposes to methane and acetylene, and the acetylene at once polymerizes to benzene, styrolene, retene, &c. A portion also condenses, and at the same time loses some hydrogen, becoming naphthalene; and the compounds so formed by interactions amongst themselves build up the remainder of the hydrocarbons present in the coal tar, whilst the organic substances containing oxygen in the coal break down, and cause the formation of the phenols in the tar. There is very little doubt that the general course of the decompositions follows these lines; but any such simple explanation of the actions taking place is rendered impossible by the fact that, instead of the breaking-down of the hydrocarbons being completed in the coal, and only secondary reactions taking place in the retort, in practice the hydrocarbons to a great extent leave the coal as the vapours of condensible hydrocarbons, and the breaking down of these to such simple gaseous compounds as ethylene is proceeding in the retort at the same time as the breaking up of the ethylene already formed into acetylene and methane, and the polymerization of the former into higher compounds. Starting with a solid hydrocarbon of definite composition, it would be theoretically possible to decompose it entirely into carbon, hydrogen, ethylene and methane, and, by rapidly removing these from the heating zone before any secondary actions took place, to prevent formation of tar. But any such ideal is hopeless in practice, as the coal is not a definite compound, and it is impossible to subject it to a fixed temperature. If the retorts are at a temperature of 1000° C. when the charge of coal is put in, the temperature of the distillation will vary from about 800° C. close to the walls, to about 400° C. in the centre of the coal; and in the same way, in the space above the coal, the products which come in contact with the sides of the Effect of temperature in the retort. retort are heated to 1000° C., whilst the gas near the coal is probably heated to only 600° C. Moreover, the gases and vapours in the retort are subjected to a period of heating which varies widely with the distance from the mouth of the retort of the coal that is undergoing carbonization. The gas developed by the coal near the mouth of the retort is quickly washed out into the ascension pipe by the push of the gas behind, and the period for which it has been exposed to the radiant heat from the walls of the retort is practically nil; whilst the gas evolved in the portion of the retort farthest from the mouthpiece has only its own rate of evolution to drive it forward, and has to traverse the longest run possible in the retort, exposed during the whole of that period to radiant heat and to contact with the highly heated surface of the retort itself. Hence we find that the tar is formed of two distinct sets of products, the first due to incomplete decomposition and the second to secondary reactions due to the products of the decomposition being kept too long in the zone of heat. Of the first class, the light paraffin oils and pitch may be taken as examples; whilst benzene, naphthalene and retort carbon represent the second. The formation of the second class of bodies is a great loss to the gas manufacturer, as, with the exception of the trace of benzene carried with the gas as vapour, these products are not only useless in the gas, but one of them, naphthalene, is a serious trouble, because any trace carried forward by the gas condenses with sudden changes of temperature, and causes obstructions in the service pipes, whilst their presence in the tar means the loss of a very large proportion of the illuminating constituents of the gas. Moreover, these secondary products cannot be successfully reduced, by further heating, to simpler hydrocarbons of any high illuminating value, and such bodies as naphthalene and anthracene have so great a stability that, when once formed, they resist any efforts again to decompose them by heat, short of the temperature which breaks them up into methane, carbon and hydrogen. The ammonia is derived from the nitrogen present in the coal combining with hydrogen during destructive distillation, the nitrogen becoming distributed amongst all three classes of products. The following table will give an approximate idea of the proportions which go to each:— Per cent. Nitrogen as ammonia 14.50 Nitrogen as cyanogen 1.56 Nitrogen free in gas and combined in tar 35.26 Nitrogen remaining in coke 48.68 ——— 100.00 The effect produced by alteration in the temperature of the retort upon the composition of both gas and tar is very marked. As the temperature is raised, the yield of gas from a given weight of coal increases; but with the increase of volume there is a marked decrease in the illuminating value of the gas evolved. Lewis T. Wright found, in a series of experiments, that, when four portions of the same coal were distilled at temperatures ranging from a dull red heat to the highest temperature attainable in an iron retort, he obtained the following results as to yield and illuminating power:— Temperature. Cubic ft. ofGas per ton. IlluminatingPower,Candles. TotalCandlesper ton. 1. Dull red 8,250 20.5 33.950 2. Hotter 9,693 17.8 34.510 3.  〃 10,821 16.7 36.140 4. Bright orange 12,006 15.6 37.460 Composition of the Gas. 1.Per cent. 2.Per cent. 4.Per cent. Hydrogen 38.09 43.77 48.02 Marsh gas 42.72 34.50 30.70 Olefines 7.55 5.83 4.51 Carbon monoxide 8.72 12.50 13.96 Nitrogen 2.92 3.40 2.81 100.00 100.00 100.00 The gas analysis of No. 3 was lost, but the illuminating power shows that it was intermediate in composition between Nos. 2 and 4. From this it will be seen that, with the increase of temperature, the hydrocarbons—the olefines and marsh gas series—gradually break up, depositing carbon in the crown of the retort, and liberating hydrogen, the percentage of which steadily increases with the rise of temperature. The tar formed is affected to an even greater extent than the gas by alterations in the temperature at which the destructive distillation takes place. The lower the temperature, the smaller will be the volume of gas produced, and the lighter the specific gravity of the tar, whilst with increase of temperature, the volume of gas rapidly rises, and so does the specific gravity of the tar. Working with a caking coal Wright obtained the following results:— Yield of Gasper ton,Cub. ft. Specific Gravityof Tar. 6,600 1.086 7,200 1.120 8,900 1.140 10,162 1.154 11,700 1.206 Analysis of the tar showed that the increase of the specific gravity was due to the increase in the quantity of pitch, which rose from 28.89 to 64.08% in the residuals; whilst the ammonia, naphtha and light oils steadily fell in quantity, the creosote and anthracene oils doing the same, but to a smaller extent. Naphthalene also begins to show in quantity in the tar as soon as the yield of gas reaches 10,000 cub. ft. per ton of coal carbonized. In spite of these variations, however, the products in their main characteristics will remain the same. They may be divided into—(a) Solids, such as the coke and retort carbon; (b) liquids, consisting of the tar and ammoniacal liquor; and (c) gases, consisting of the unpurified coal gas. The proportions in which the products are approximately obtained from a ton of gas coal have been given as follows:— 10,000 cub. ft. of gas = 380 ℔ = 17.0 per cent. 10 gallons of tar = 115 〃 = 5.1 〃 Gas liquor[1] = 177 〃 = 7.9 〃 Coke = 1568 〃 = 70.0 〃 —— —— 2240 100.0 The chief solid residue, coke, is not absolutely pure carbon, as it contains the mineral non-volatile constituents which remain behind as ash when the original coal is burnt, and which, to a great extent, existed in the sap that filled the cells of the plant from which the coal was formed.Solid products. The retort carbon formed as a dense deposit on the crown of the retort by the action of the high temperature on the hydrocarbons is, however, carbon in a very pure form, and, on account of its density, is largely used for electrical purposes. The liquid products of the destructive distillation of coal are tar and ammoniacal liquor. Tar derived from ordinary bituminous coal is a black, somewhat viscid liquid, varying in specific gravity from 1.1 to 1.2. The ultimate composition of Liquid products. tar made in the London Gas Works is approximately as follows:— Carbon 77.53 Hydrogen 6.33 Nitrogen 1.03 Sulphur 0.61 Oxygen 14.50 ——— 100.00 These elements in tar are built up into an enormous number of compounds (see Coal Tar), and its value as a by-product may be gathered from the fact that on fractional distillation it yields—(1) benzene and its homologues, from which aniline, the source of most of the coal-tar colours, can be derived; (2) carbolic acid, from which picric acid, used as a dye, a powerful explosive, and to give the bitter flavour to some kinds of beer, is made, also many most valuable disinfectants; (3) naphthalene, used for disinfecting, and also as the “Albo-carbon” employed in an enriching burner for gas; (4) pitch, extensively used in path-making, from which such bodies as anthracene and saccharin can be extracted. The second liquid product of the destructive distillation of coal is the ammoniacal or gas liquor, which consists of water containing ammonia salts in solution, partly condensed from the hot gas, and partly added to wash the gas in the scrubbers. It contains, as its principal constituents, ammonia, partly combined with carbonic acid and sulphuretted hydrogen to form compounds which are decomposed on boiling, with evolution of ammonia gas, and partly combined with stronger acids to form compounds which require to be acted upon by a strong alkali before the ammonia contained in them can be liberated. The ammonia in the first class of compounds is technically spoken of as “free”; that present in the latter as “fixed.” The following analysis by L. T. Wright will give an idea of the relative quantities in which these compounds exist in the liquor:— Grammes per litre. Free  ${\displaystyle \scriptstyle {\left\{{\begin{matrix}\ \\\\\ \ \end{matrix}}\right.}}$ Ammonium sulphide 3.03 Ammonium carbonate 39.16 Ammonium chloride 14.23 Fixed ${\displaystyle \scriptstyle {\left\{{\begin{matrix}\ \\\\\ \\\ \ \end{matrix}}\right.}}$ Ammonium thiocyanate 1.80 Ammonium sulphate 0.19 Ammonium thiosulphate 2.80 Ammonium ferrocyanide 0.41 From a scientific point of view, the term “free” is absolutely incorrect, and in using it the fact must be clearly borne in mind that in this case it merely stands for ammonia, which can be liberated on simply boiling the liquor. The gas which is obtained by the destructive distillation of coal, and which we employ as our chief illuminant, is not a definite compound, but a mechanical mixture of several gases, some of which are reduced to the lowest limit, in order to develop as fully as possible Gaseous products.the light-giving properties of the most important constituents of the gas. The following analysis gives a fair idea of the composition of an average sample of gas made from coal, purified but without enrichment:— Hydrogen 52.22 Unsaturated hydrocarbons 3.47 Saturated hydrocarbons 34.76 Carbon monoxide 4.23 Carbon dioxide 0.60 Nitrogen 4.23 Oxygen 0.49 ——— 100.00 These constituents may be divided into—(a) light-yielding hydrocarbons, (b) combustible diluents and (c) impurities. The hydrocarbons, upon which the luminosity of the flame entirely depends, are divided in the analysis into two groups, saturated and unsaturated, according to their behaviour with a solution of bromine in potassium bromide, which has the power of absorbing those termed “unsaturated,” but does not affect in diffused daylight the gaseous members of the “saturated” series of hydrocarbons. They may be separated in a similar way by concentrated sulphuric acid, which has the same absorbent effect on the one class, and not on the other. The chief unsaturated hydrocarbons present in coal gas are: ethylene, C2H4, butylene, C4H8, acetylene, C2H2, benzene, C6H6, and naphthalene, C10H8, and the saturated hydrocarbons consist chiefly of methane, CH4, and ethane, C2H6. The light-giving power of coal gas is undoubtedly entirely due to the hydrocarbons. The idea held up to about 1890 was that the illuminating value depended upon the amount of ethylene present. This, however, is manifestly incorrect, as, if it were true, 4% of ethylene mixed with 96% of a combustible diluent such as hydrogen should give 16- to 17-candle gas, whereas a mixture of 10% of ethylene and 90% of hydrogen is devoid of luminosity. In 1876 M. P. E. Berthelot came to the conclusion that the illuminating value of the Paris coal gas was almost entirely due to benzene vapour. But here again another mistaken idea arose, owing to a faulty method of estimating the benzene, and there is no doubt that methane is one of the most important of the hydrocarbons present, when the gas is burnt in such a way as to evolve from it the proper illuminating power, whilst the benzene vapour, small as the quantity is, comes next in importance and the ethylene last. It is the combined action of the hydrocarbons which gives the effect, not any one of them acting alone. The series of operations connected with the manufacture and distribution of coal gas embraces the processes of distillation, condensation, exhaustion, wet purification by washing and scrubbing, dry purification, measuring, storing and distribution to the mains whence the consumer’s supply is drawn. River. Fig. 4.—Plan of Works. The choice of a site for a gas works is necessarily governed by local circumstances; but it is a necessity that there should be a ready means of transport available, and for this reason the works should be built upon the banks of a navigable river or canal, and should have a convenient railway siding. By Site of gas works. this means coal may be delivered direct to the store or retort-house, and in the same way residual products may be removed. The fact that considerable area is required and that the works do not improve the neighbourhood are important conditions, and although economy of space should be considered, arrangements should be such as to allow of extension. In the case of a works whose daily make of gas exceeds four to five million cub. ft., it is usual to divide the works into units, there being an efficiency limit to the size of apparatus employed. Under these conditions the gas is dealt with in separate streams, which mix when the holder is reached. From the accompanying ground plan of a works (fig. 4) it will be possible to gain an idea of the order in which the operations in gas manufacture are carried out and the arrangement of the plant. Fig. 5.—Cross Section of Retorts. The retorts in which the coal is carbonized are almost universally made of fire-clay, and in all but small country works the old single-ended retort, which was about 9 ft. in length, has given way to a more economical construction known as doubles, double-ended, or “through” retorts.Retorts. These are from 18 to 22 ft. long, and as it is found inconvenient to produce this length in one piece, they are manufactured in three sections, the jointing together of which demands great care. The two outer pieces are swelled at one end to take an iron mouthpiece. The cross sections generally employed for retorts are known as “D-shaped,” “oval” and “round” (fig. 5). The “D” form is mostly adopted owing to its power of retaining its shape after long exposure to heat, and the large amount of heating surface it presents at its base. The life of this retort is about thirty working months. A cast iron mouthpiece and lid is bolted to the exterior end of each retort, the mouthpiece carrying a socket end to receive the ascension pipe, through which the gas passes on leaving the retort. The retorts are heated externally and are set in an arch, the construction depending upon the number of retorts, which varies from three to twelve. The arch and its retorts is termed a bed or setting, and a row of beds constitutes a bench. It is usual to have a separate furnace for each setting, the retorts resting upon walls built transversely in the furnace. The heating of the retorts is carried out either by the “direct firing” or by the “regenerative” system, the latter affording marked advantages over the former method, which is now becoming extinct. In the regenerative system of firing, a mixture of carbon monoxide and nitrogen is produced by passing air through incandescent gas coke in a generator placed below the bench of retorts, and the heating value of the gases so produced is increased in most cases by the admixture of a small proportion of steam with the primary air supply, the steam being decomposed by contact with the red-hot coke in the generator into water gas, a mixture of carbon monoxide and hydrogen (see Fuel: Gaseous). The gases so formed vary in proportion with the temperature of the generator and the amount of steam, but generally contain 32 to 38% of combustible gas, the remainder being the residual nitrogen of the air and carbon dioxide. These gases enter the combustion chamber around the retorts at a high temperature, and are there supplied with sufficient air to complete their combustion, this secondary air supply being heated by the hot products of combustion on their way to the exit flue. This method of firing results in the saving of about one-third the weight of coke used in the old form of furnace per ton of coal carbonized, and enables higher temperatures to be obtained, the heat being also more equally distributed. Fig. 6.—Regenerative Setting. There are a great number of methods of applying the regenerative principle which vary only in detail. Fig. 6 gives an idea of the general arrangement. The furnace A is built of fire-brick, coke is charged at the top through the iron door B, and near the bottom are placed fire bars C, upon which the fuel lies. The primary air necessary for the partial combustion of the coke to “producer” gas enters between these bars. The gases are conducted from the furnace to the combustion chamber E through the nostrils D D, and the secondary air is admitted at the inlet F a little above, this air having been already heated by traversing the setting. Complete combustion takes place at this point with the production of intense heat, the gases on rising are baffled in order to circulate them in every direction round the retorts, and upon arriving at the top of the setting they are conducted down a hollow chamber communicating with the main flue and shaft. The amount of draft which is necessary to carry out the circulation of the gases and to draw in the adequate amount of air is regulated by dampers placed in the main flue. By analysis of the “producer” and “spent” gases this amount can be readily gauged. Retorts are set in either the horizontal, inclined or vertical position, and the advantages of the one over the other is a question upon which almost every gas engineer has his own views. The introduction of labour-saving appliances into gas works has rendered the difficult work of charging and discharging horizontal retorts comparatively simple. Formerly it was the practice to carry out such operations entirely by hand, men charging the retorts Charging and drawing.either by means of shovel or hand-scoop, and the coke produced being withdrawn with hand rakes. Now, however, only the smaller gas works adhere to this system, and this work is done by machinery driven by either compressed air, hydraulic or electric power. In the first two cases a scoop, filled with coal from an overhead hopper carried by the travelling machine, is made to enter the retort and is turned over; the operation is then repeated, but this time the scoop is turned over in the opposite direction, the coal thus assuming such a position that as much of its under surface as possible is exposed to the heated side of the retort. With “through” retorts charging machines feed the retorts at both ends, the scoop, which has a capacity of about 112 cwt., entering and discharging its contents twice at each end, so that the total charge is about 6 cwt., which is allowed from four to six hours to distil off according to the quality of the gas required. The machines charge simultaneously at each end, so that the lids of the retorts may be shut immediately the coal enters. The charging machines travel on lines in front of the retort bench, and the power is transmitted by connexions made with flexible hose. A device of more recent introduction is an electrically-driven charging machine, in which the centrifugal force created by a fly-wheel revolving at high speed is applied to drive coal into the retort. If the velocity is sufficiently high the coal may be carried the whole length of a 20-ft. retort, the coal following banking up until an even layer is formed throughout the length of the retort. For the purpose of discharging the coke from the retort either compressed air or hydraulic machinery is employed, a rake being made to enter the retort and withdraw the coke on returning. With this method it is necessary that the rake should enter and discharge several times before the retort is clear, and thus the use of a telescopic ram worked by hydraulic power, which pushes the coke before it and discharges it at the other end, is an advantage. As much as one-third on each ton of coal carbonized is saved by the use of machinery in the retort-house. Taking into account the original cost of such machines, and the unavoidable wear and tear upon the retorts brought about by using labour-saving appliances, and the fact that the coke-dust is very detrimental to the machinery, it is clear that the suggestion of setting the retorts at an incline in order to facilitate the work presented great inducements to the gas manager. The object aimed at in thus setting retorts is to allow gravity to play the part of charging and discharging the coal and coke, the retorts being inclined at an angle to suit the slip of the class of coal used; this angle is between 28° and 34°. The coal, previously elevated to hoppers, is dropped into the feeding chambers, which are so arranged that they can travel from end to end of the retort-house and feed the coal into the retorts. When the retort is to be charged, an iron stop or barrier is placed in the lower mouthpiece, and the door closed. The shoot is placed in the upper mouthpiece, and the stop or door, which retains the coal in the chamber, is released; the coal is then discharged into the retort, and rushing down the incline, is arrested by the barrier, and banks up, forming a continuous backing to the coal following. By experience with the class of coal used and the adjustment of the stops in the shoot, the charge can be run into the retort to form an even layer of any desired depth. For the withdrawal of the residual coke at the end of the carbonization, the lower mouthpiece door is opened, the barrier removed and the coke in the lower part of the retort is “tickled” or gently stirred with an iron rod to overcome a slight adhesion to the retort; the entire mass then readily discharges itself. Guides are placed in front of the retort to direct its course to the coke hoppers or conveyer below, and to prevent scattering of the hot material. This system shows a greater economy in the cost of carbonizing the coal, but the large outlay and the wear and tear of the mechanical appliances involved have so far prevented its very general adoption. The vertical retort was one of the first forms experimented with by Murdoch, but owing to the difficulty of withdrawing the coke, the low illuminating power of the gas made in it, and the damage to the retort itself, due to the swelling of the charge during distillation, it was quickly abandoned. About the beginning of the 20th century, however, the experiments of Messrs Settle and Padfield at Exeter, Messrs Woodall and Duckham at Bournemouth, and Dr Bueb in Germany showed such encouraging results that the idea of the vertical retort again came to the front, and several systems were proposed and tried. The cause of the failure of Murdoch’s original vertical retort was undoubtedly that it was completely filled with coal during charging, with the result that the gas liberated from the lower portions of the retort had to pass through a deep bed of red-hot coke, which, by over-baking the gas, destroyed the illuminating hydrocarbons. There is no doubt that the question of rapidly removing the gas, as soon as it is properly formed, from the influence of the highly-heated walls of the retort and residual coke, is one of the most important in gas manufacture. In the case of horizontal retorts the space between the top of the coal and the retort is of necessity considerable in order to permit the introduction of the scoop and rake; the gas has therefore a free channel to travel along, but has too much contact with the highly heated surface of the retort before it leaves the mouthpiece. In the case of inclined retorts this disadvantage is somewhat reduced, but with vertical retorts the ideal conditions can be more nearly approached. The heating as well as the illuminating value of the gas per unit volume is lowered by over-baking, and Dr Bueb gives the following figures as to the heating value of gas obtained from the same coal but by different methods of carbonization:— Vertical Retorts, 604 British thermal units per cub. ft. Inclined Retorts, 584 British thermal units per cub. ft. Horizontal Retorts, 570 British thermal units per cub. ft. Of the existing forms of vertical retort it remains a matter to be decided whether the coal should be charged in bulk to the retort or whether it should be introduced in small quantities at regular and short intervals; by this latter means (the characteristic feature of the Settle-Padfield process) a continuous layer of coal is in process of carbonization on the top, whilst the gas escapes without contact with the mass of red-hot coke, a considerable increase in volume and value in the gas and a much denser coke being the result. Fig. 7.—Hydraulic Main. From the retort the gas passes by the ascension pipe to the hydraulic main (fig. 7). This is a long reservoir placed in a horizontal position and supported by columns upon the top of the retort stack, and through it is maintained a slow but Hydraulic main. constant flow of water, the level of which is kept uniform. The ascension pipe dips about 2 in. into the liquid, and so makes a seal that allows of any retort being charged singly without the risk of the gas produced from the other retorts in the bench escaping through the open retort. Coal gas, being a mixture of gases and vapours of liquids having very varying boiling points, must necessarily undergo physical changes when the temperature is lowered. Vapours of liquids of high boiling point will be condensed more quickly than those having lower boiling points, but condensation of each vapour will take place in a definite ratio with the decrease of temperature, the rate being dependent upon the boiling point of the liquid from which it is formed. The result is that from the time the gaseous mixture leaves the retort it begins to deposit condensation products owing to the decrease in temperature. Condensation takes place in the ascension pipe, in the arch piece leading to the hydraulic main, and to a still greater extent in the hydraulic main itself where the gas has to pass through water. Ascension pipes give trouble unless they are frequently cleared by an instrument called an “auger,” whilst the arch pipe is fitted with hand holes through which it may be easily cleared in case of stoppage. The most soluble of the constituents of crude coal gas is ammonia, 780 volumes of which are soluble in one volume of water at normal temperature and pressure, and the water in the hydraulic main absorbs a considerable quantity of this compound from the gas and helps to form the ammoniacal liquor, whilst, although the liquor is well agitated by the gas bubbling through it, a partial separation of tar from liquor is effected by gravitation. The liquor is run off at a constant rate from the hydraulic main to the store tank, and the gas passes from the top of the hydraulic main to the foul main. The gas as it leaves the hydraulic main is still at a temperature of from 130° to 150° F., and should now be reduced as nearly as possible to the temperature of the surrounding atmosphere. The operation of efficient condensing is not by any means as simple as might be supposed. Condensa-tion.The tar and liquor when condensed have a dissolving action on various valuable light-giving constituents of the gas, which in the ordinary way would not be deposited by the lowering of temperature, and for this reason the heavy tar, and especially that produced in the hydraulic main, should come in contact with the gas as little as possible, and condensation should take place slowly. The main difficulty which the condenser ought to overcome and upon which its efficiency should depend is the removal of naphthalene: this compound, which is present in the gas, condenses on cooling to a solid which crystallizes out in the form of white flakes, and the trouble caused by pipe stoppages in the works as well as in the district supplied is very considerable. The higher the heat of carbonization the more naphthalene appears to be produced, and gas managers of to-day find the removal of naphthalene from the gas a difficult problem to solve. It was for some time debated as to whether naphthalene added materially to the illuminating value of the gas, and whether an endeavour should be made to carry it to the point of combustion; but it is now acknowledged that it is a troublesome impurity, and that the sooner it is extracted the better. Gas leaves the retorts saturated with naphthalene, and its capacity for holding that impurity seems to be augmented by the presence of water vapour. The condenser, by effecting the condensation of water vapour, also brings about the deposition of solid naphthalene, apart from that which naturally condenses owing to reduction of temperature. Condensers are either air-cooled or water-cooled, or both. In the former case the gas traverses pipes exposed to the atmosphere and so placed that the resulting products of condensation may be collected at the lowest point. Water is a more efficient cooling medium than air, owing to its high specific heat, and the degree of cooling may be more easily regulated by its use. In water-cooled condensers it is usual to arrange that the water passes through a large number of small pipes contained in a larger one through which the gas flows, and as it constantly happened that condenser pipes became choked by naphthalene, the so-called reversible condenser, in which the stream of gas may be altered from time to time and the walls of the pipes cleaned by pumping tar over them, is a decided advance. The solubility of naphthalene by various oils has led some engineers to put in naphthalene washers, in which gas is brought into contact with a heavy tar oil or certain fractions distilled from it, the latter being previously mixed with some volatile hydrocarbon to replace in the gas those illuminating vapours which the oil dissolves out; and by fractional distillation of the washing oil the naphthalene and volatile hydrocarbons are afterwards recovered. The exhauster is practically a rotary gas pump which serves the purpose of drawing the gas from the hydraulic main through the condensers, and then forcing it through the purifying vessels to the holder. Moreover, by putting the retorts under a slight vacuum, the Exhauster.amount of gas produced is increased by about 12%, and is of better quality, owing to its leaving the heated retort more quickly. A horizontal compound steam-engine is usually employed to drive the exhauster. At this point in the manufacturing process the gas has already undergone some important changes in its composition, but there yet remain impurities which must be removed, these being ammonia, sulphuretted hydrogen, carbon disulphide and carbon dioxide. Ammonia is of considerable marketable value, and even in places where the local Gas Act does not prescribe that it shall be removed, it is extracted. Sulphuretted hydrogen is a noxious impurity, and its complete removal from the gas is usually imposed by parliament. As nearly as possible all the carbon dioxide is extracted, but most gas companies are now exempt from having to purify the gas from sulphur compounds other than sulphuretted hydrogen. Cyanogen compounds also are present in the gas, and in large works, where the total quantity is sufficient, their extraction is effected for the production of either prussiate or cyanide of soda. Atkinson Butterfield gives the composition of the gas at this point to be about per cent. by vol. Hydrogen from 42 to 53 Methane 〃 32 〃 39 Carbon monoxide 〃 3 〃 10 Hydrocarbons— Gases 〃 2.5 〃 4.5 Light condensable vapours 〃 0.5 〃 1.2 Carbon dioxide 〃 1.1 〃 1.8 Nitrogen 〃 1.0 〃 5.0 Sulphuretted hydrogen 〃 1.0 〃 2.0 Ammonia 〃 0.5 〃 0.95 Cyanogen 〃 0.05 〃 0.12 Carbon disulphide 〃 0.02 〃 0.035 Naphthalene 〃 0.005 〃 0.015 It happens that ammonia, being a strong base, will effect the extraction of a certain proportion of such compounds as sulphuretted hydrogen, carbon dioxide and hydrocyanic acid, and the gas is now washed with water and ammoniacal liquor. The process is termed washing or Washers.scrubbing, and is carried out in various forms of apparatus, the efficiency of which is dependent upon the amount of contact the apparatus allows between the finely divided gas and water in a unit area and the facility with which it may be cleared out. The “Livesey” washer, a well-known type, is a rectangular cast iron vessel. The gas enters in the centre, and to make its escape again it has to pass into long wrought iron inverted troughs through perforations one-twentieth of an inch in diameter. A constant flow of liquor is regulated through the washer, and the gas, in order to pass through the perforations, drives the liquor up into the troughs. The liquor foams up owing to agitation by the finely divided streams of gas, and is brought into close contact with it. Two or three of these washers are connected in series according to the quantity of gas to be dealt with. The final washing for ammonia is effected in an apparatus termed a “scrubber,” which is a cylindrical tower packed with boards 14 in. thick by 11 in. broad, placed on end and close together; water is caused to flow down over the surface of these boards, the object being to break Scrubbers.up the gas as much as possible and bring it into close contact with the water. In this wet purifying apparatus the gas is almost wholly freed from ammonia and from part of the sulphuretted hydrogen, whilst carbon dioxide and carbon disulphide are also partially extracted. Fig. 8.—Purifier. The final purification is carried out in rectangular vessels, known as “dry purifiers” (fig. 8). Internally, each purifier is filled with ranges of wooden trays or sieves A, made in the form of grids (fig. 9), and covered with the purifying material B to a depth of about 6 in., the Purifiers.number of tiers and size of purifier boxes being proportional to the quantity of gas to be purified. The gas enters at the bottom by the pipe C, the inlet being protected from any falling material by the cover D; it forces its way upwards through all the trays until, reaching the lid or cover E, it descends by the exit tube F, which leads to the next purifier. The edges of the lid dip into an external water seal or lute G, whereby the gas is prevented from escaping. Fig. 9.—Purifier Grid. When the gas had to be purified from carbon disulphide as well as from sulphuretted hydrogen, slaked lime was employed for the removal of carbon dioxide and the greater quantity of the sulphur compounds, whilst a catch box or purifier of oxide of iron served to remove the last traces of sulphuretted hydrogen. Not fewer than four lime purifiers were employed, and as the one which was first in the series became exhausted, i.e. began to show signs of allowing carbon dioxide to pass through it unabsorbed, it was filled with fresh slaked lime and made the last of the series, the one which was second becoming first, and this procedure went on continuously. This operation was necessitated by the fact that carbon dioxide has the power of breaking up the sulphur compounds formed by the lime, so that until all carbon dioxide is absorbed with the formation of calcium carbonate, the withdrawal of sulphuretted hydrogen cannot proceed, whilst since it is calcium sulphide formed by the absorption of sulphuretted hydrogen by the slaked lime that absorbs the vapour of carbon disulphide, purification from the latter can only be accomplished after the necessary calcium sulphide has been formed. The foul gas leaving the scrubbers contains, as a general average, 30 grains of sulphuretted hydrogen, 40 grains of carbon disulphide and 200 grains of carbon dioxide per 100 cub. ft. On entering the first purifier, which contains calcium thiocarbonate and other combinations of calcium and sulphur in small quantity, the sulphuretted hydrogen and disulphide vapour have practically no action upon the material, but the carbon dioxide immediately attacks the calcium thiocarbonate, forming calcium carbonate with the production of carbon disulphide vapour, which is carried over with the gas into the second box. In the connexion between the first and the second box the gas is found to contain 500 grains of sulphuretted hydrogen and 80 grains of carbon disulphide per 100 cub. ft., but no trace of carbon dioxide. In the second box the formation of calcium thiocarbonate takes place by the action of carbon disulphide upon the calcium sulphide with the liberation of sulphuretted hydrogen, which is carried over to the third purifier. The gas in the connecting pipe between the second and third purifier will be found to contain 400 grains of sulphuretted hydrogen and 20 grains of carbon disulphide. The contents of the third box, being mostly composed of slaked lime, take up sulphuretted hydrogen forming calcium sulphide, and practically remove the remaining impurities, the outlet gas showing 20 grains of sulphuretted hydrogen and 8 grains of carbon disulphide per 100 cub. ft., whilst the catch box of oxide of iron then removes all traces of sulphuretted hydrogen. It will be noticed that in the earlier stages the quantity of sulphur impurities is actually increased between the purifiers—in fact, the greater amount of sulphiding procures the ready removal of the carbon disulphide,—but it is the carbon dioxide in the gas that is the disturbing element, inasmuch as it decomposes the combinations of sulphur and calcium; consequently it is a paramount object in this system to prevent this latter impurity finding its way through the first box of the series. The finding of any traces of carbon dioxide in the gas between the first two boxes is generally the signal for a new clean purifier being put into action, and the first one shut off, emptied and recharged with fresh lime, the impregnated material being sometimes sold for dressing certain soils. The action of oxide of iron, which has now partly replaced the lime purification, depends on its power of combining with sulphuretted hydrogen to form sulphide of iron. Such is the affinity of the oxide for this impurity that it may contain from 50 to 60% by weight of free sulphur after revivification and still remain active. Upon removing the material from the vessel and exposing it to the atmosphere the sulphide of iron undergoes a revivifying process, the oxygen of the air displacing the sulphur from the sulphide as free sulphur, and with moisture converting the iron into hydrated oxide of iron. This revivification can be carried on a number of times until the material when dry contains about 50% of free sulphur and even occasionally 60% and over; it is then sold to manufacturers of sulphuric acid to be used in the sulphur kilns instead of pyrites (see Sulphuric Acid). Apart from the by-products coke, coke-breeze, tar and retort carbon, which are sold direct, gas companies are now in many cases preparing from their spent purifying material pure chemical products which are in great demand. The most important of these is sulphate of ammonia, which is used for agricultural purposes as a manure, and is obtained by passing ammonia into sulphuric acid and crystallizing out the ammonium sulphate produced. To do this, saturated ammoniacal liquor is decomposed by lime in the presence of steam, and the freed ammonia is passed into strong sulphuric acid, the saturated solution of ammonium sulphate being carefully crystallized. The market value of the salt varies, but an average figure is £12 per ton, whilst the average yield is about 24 ℔ of salt per ton of coal carbonized. In large works the sulphuric acid is usually manufactured on the spot from the spent oxide, so that the sulphuretted hydrogen, which in the gas is considered an undesirable impurity, plays a valuable part in the manufacture of an important by-product. Cyanogen compounds are extracted either direct from the gas, from the spent oxide or from ammoniacal liquor, and some large gas works now produce sodium cyanide, this being one of the latest developments in the gas chemical industry. Fig. 10.—Gasholder. Fig. 11.—Cup and Grip. The purified gas now passes to a gasholder (sometimes known as a gasometer), which may be either single lift, i.e. a simple bell inverted in a tank of water, or may be constructed on the telescopic principle, in which case much ground space is saved, as a holder of much greater Gasholder.capacity can be contained in the same-sized tank. The tank for the gasholder is usually made by excavating a circular reservoir somewhat larger in diameter than the proposed holder. A banking is allowed to remain in the centre, as shown in fig. 10, which is known as the “dumpling,” this arrangement not only saving work and water, but acting as a support for the king post of a trussed holder when the holder is empty. The tank must be water-tight, and the precaution necessary to be taken in order to ensure this is dependent upon the nature of the soil; it is usual, however, for the tanks to be lined with concrete. Where the conditions of soil are very bad, steel tanks are built above ground, but the cost of these is much greater. The holder is made of sheet iron riveted together, the thickness depending upon the size of the holder. The telescopic form consists of two or more lifts which slide in one another, and may be described as a single lift holder encircled by other cylinders of slightly larger diameter, but of about the same length. Fig. 10 shows the general construction. Gas on entering at A causes the top lift to rise; the bottom of this lift being turned up all round to form a cup, whilst the top of the next lift is turned down to form a so-called grip, the two interlock (see fig. 11), forming what is known as the hydraulic cup. Under these conditions the cup will necessarily be filled with water, and a seal will be formed, preventing the escape of gas. A guide framing is built round the holder, and guide rollers are fixed at various intervals round the grips of each lift, whilst at the bottom of the cup guide rollers are also fixed (fig. 11). In the year 1892 the largest existing gasholder was built at the East Greenwich works of the South Metropolitan Gas Company; it has six lifts, its diameter is 293 ft., and when filled with gas stands 180 ft. high. The capacity for gas is 12 million cub. ft. The governor consists usually of a bell floating in a cast iron tank partially filled with water, and is in fact a small gasholder, from the centre of which is suspended a conical valve controlling the gas inlet and closing it as Governor.the bell fills. Any deviation in pressure will cause the floating bell to be lifted or lowered, and the size of the inlet will be decreased or increased, thus regulating the flow. The fact that coal gas of an illuminating power of from 14 to 16 candles can be made from the ordinary gas coal at a fairly low rate, while every candle power added to the gas increases the cost in an enormous and rapidly growing ratio, has, from the earliest days of the gas industry, caused the attention of inventors to be turned to the enrichment of coal gas. Formerly cannel coal was used for Enrichment. producing a very rich gas which could be mixed with the ordinary gas, thereby enriching it, but as the supply became limited and the price prohibitive, other methods were from time to time advocated to replace its use in the enrichment of illuminating gas. These may be classified as follows:— 1. Enriching the gas by vapours and permanent gases obtained by decomposing the tar formed at the same time as the gas. 2. Mixing with the coal gas oil gas, obtained by decomposing crude oils by heat. 3. The carburetting of low-power gas by impregnating it with the vapours of volatile hydrocarbons. 4. Mixing the coal gas with water gas, which has been highly carburetted by passing it with the vapours of various hydrocarbons through superheaters in order to give permanency to the hydrocarbon gases. Very many attempts have been made to utilize tar for the production and enrichment of gas, and to do this Enrichment by tar. two methods may be adopted:— (a) Condensing the tar in the ordinary way, and afterwards using the whole or portions of it for cracking into a permanent gas. (b) Cracking the tar vapours before condensation by passing the gas and vapours through superheaters. If the first method be adopted, the trouble which presents itself is that the tar contains a high percentage of pitch, which tends rapidly to choke and clog up all the pipes. A partly successful attempt to make use of certain portions of the liquid products of distillation of coal before condensation by the second method was the Dinsmore process, in which the coal gas and vapours which, if allowed to cool, would form tar, were made to pass through a heated chamber, and a certain proportion of otherwise condensible hydrocarbons was thus converted into permanent gases. Even with a poor class of coal it was claimed that 9800 cub. ft. of 20- to 21-candle gas could be made by this process, whereas by the ordinary process 9000 cub. ft. of 15-candle gas would have been produced. This process, although strongly advocated by the gas engineer who experimented with it, was never a commercial success. The final solution of the question of enrichment of gas by hydrocarbons derived from tar may be arrived at by a process which prevents the formation of part of the tar during the carbonization of the coal, or by the process devised by C. B. Tully and now in use at Truro, in which tar is injected into the incandescent fuel in a water-gas generator and enriches the water gas with methane and other hydrocarbons, the resulting pitch and carbon being filtered off by the column of coke through which the gas passes. The earliest attempts at enrichment by oil gas consisted in spraying oil upon the red hot mass in the retort during carbonization; but experience soon showed that this was not an economical method of working, and that it was far better to Enrichment by oil gas. decompose the liquid hydrocarbon in the presence of the diluents which are to mingle with it and act as its carrier, since, if this were done, a higher temperature could be employed and more of the heavier portions of the oil converted into gas, without at the same time breaking down the gaseous hydrocarbons too much. In carburetting poor coal gas with hydrocarbons from mineral oil it must be borne in mind that, as coal is undergoing distillation, a rich gas is given off in the earlier stages, but towards the end of the operation the gas is very poor in illuminants, the methane disappearing with the other hydrocarbons, and the increase in hydrogen being very marked. Lewis T. Wright employed a coal requiring six hours for its distillation, and took samples of the gas at different periods of the time. On analysis these yielded the following results:— Time after beginning Distillation. 10minutes. 1 hour30 minutes. 3 hours25 minutes. 5 hours35 minutes. Sulphuretted hydrogen 1.30 1.42 0.49 0.11 Carbon dioxide 2.21 2.09 1.49 1.50 Hydrogen 20.10 38.33 52.68 67.12 Carbon monoxide 6.19 5.66 6.21 6.12 Saturated hydrocarbons 57.38 44.03 33.54 22.58 Unsaturated   〃 10.62 5.98 3.04 1.79 Nitrogen 2.20 2.47 2.55 0.78 This may be regarded as a fair example of the changes which take place in the quality of the gas during the distillation of the coal. In carburetting such a gas by injecting mineral oil into the retort, many of the products of the decomposition of the oil being vapours, it would be wasteful to do so for the first two hours, as a rich gas is being given off which has not the power of carrying in suspension a much larger quantity of hydrocarbon vapours without being supersaturated with them. Consequently, to make it carry any further quantity in a condition not easily deposited, the oil would have to be completely decomposed into permanent gases, and the temperature necessary to do this would seriously affect the quality of the gas given off by the coal. When, however, the distillation has gone on for three hours, the rich portions of coal have distilled off and the temperature of the retort has reached its highest point, and this is the best time to feed in the oil. Undoubtedly the best process which has been proposed for the production of oil gas to be used in the enrichment of coal gas is the “Young” or “Peebles” process, which depends on the principle of washing the oil gas retorted at a moderate temperature by means of oil which is afterwards to undergo decomposition, because in this way it is freed from all condensible vapours, and only permanent gases are allowed to escape to the purifiers. In the course of this treatment considerable quantities of the ethylenes and other fixed gases are also absorbed, but no loss takes place, as these are again driven out by the heat in the subsequent retorting. The gas obtained by the Young process, when tested by itself in the burners most suited for its combustion, gives on the photometer an illuminating value averaging from 50 to 60 candle-power, but it is claimed, and quite correctly, that the enriching power of the gas is considerably greater. This is accounted for by the fact that it is impossible to construct a burner which will do justice to a gas of such illuminating power. The fundamental objections to oil gas for the enrichment of coal gas are, first, that its manufacture is a slow process, requiring as much plant and space for retorting as coal gas; and, secondly, that although on a small scale it can be made to mix perfectly with coal gas and water gas, great difficulties are found in doing this on the large scale, because in spite of the fact that theoretically gases of such widely different specific gravities ought to form a perfect mixture by diffusion, layering of the gas is very apt to take place in the holder, and thus there is an increased liability to wide variations in the illuminating value of the gas sent out. The wonderful carburetting power of benzol vapour is well known, a large proportion of the total illuminating power of coal gas being due to the presence of a minute trace of its vapour carried in suspension. For many years the price of benzol has Enrichment by volatile hydro-carbons. been falling, owing to the large quantities produced in the coke ovens, and at its present price it is by far the cheapest enriching material that can be obtained. Hence at many gas-works where it is found necessary to do so it is used in various forms of carburettor, in which it is volatilized and its vapour used for enriching coal gas up to the requisite illuminating power. One of the most generally adopted methods of enrichment now is by means of carburetted water gas mixed with poor coal gas. When steam acts upon carbon at a high temperature the resultant action may be looked upon as giving a mixture of equal volumes of hydrogen and carbon monoxide, both Enrichment by carburetted water gas. of which are inflammable but non-luminous gases. This water gas is then carburetted, i.e. rendered luminous by passing it through chambers in which oils are decomposed by heat, the mixture being made so as to give an illuminating value of 22 to 25 candles. This, mixed with the poor coal gas, brings up its illuminating value to the required limit. Coke or anthracite is heated to incandescence by an air blast in a generator lined with fire-brick, and the heated products of combustion as they leave the generator and enter the superheaters are supplied with more air, which causes the combustion of carbon monoxide present in the producer gas and heats up the fire-brick baffles with which the superheater is filled. When the necessary temperature of the fuel and superheater has been reached, the air blast is cut off, and steam is blown through the generator, forming water gas, which meets the enriching oil at the top of the first superheater, called the carburettor, and carries the vapours with it through the main superheaters, where the fixing of the hydrocarbons takes place. The chief advantage of this apparatus is that a low temperature can be used for fixing owing to the enormous surface for superheating, and thus to a great extent the deposition of carbon is avoided. This form of apparatus has been very generally adopted in Great Britain as well as in America, and practically all carburetted water-gas plants are founded upon the same set of actions. Important factors in the use of carburetted water gas for enrichment are that it can be made with enormous rapidity and with a minimum of labour; and not only is the requisite increase in illuminating power secured, but the volume of the enriched gas is increased by the bulk of carburetted water gas added, which in ordinary English practice amounts to from 25 to 50%. The public at first strongly opposed its introduction on the ground of the poisonous properties of the carbon monoxide, which is present in it to the extent of about 28 to 30%. Still when this comes to be diluted with 60 to 75% of ordinary coal gas, containing as a rule only 4 to 6% of carbon monoxide, the percentage of poisonous monoxide in the mixture falls to below 16%, which experience has shown to be a fairly safe limit. 2. Gas for Fuel and Power—The first gas-producers, which were built by Faber du Faur at Wasseralfingen in 1836 and by C. G. C. Bischof at Mägdesprung (both in Germany), consisted of simple perpendicular shafts of masonry contracted at the top and the bottom, with or without a grate for the coal. Such producers, frequently strengthened by a wrought iron casing, are even now used to a great extent. Sometimes the purpose of a gas-producer is attained in a very simple manner by lowering the grate of an ordinary fireplace so much that a layer of coal 4 or 5 ft. deep is maintained in the fire. The effect of this arrangement is that the great body of coal reaches a higher temperature than in an ordinary fireplace, and this, together with the reduction of the carbon dioxide formed immediately above the grate by the red-hot coal in the upper part of the furnace, leads to the formation of carbon monoxide which later on, on the spot where the greatest heat is required, is burned into dioxide by admitting fresh air, preferably pre-heated. This simple and inexpensive arrangement has the further advantage that the producer-gas is utilized immediately after its formation, without being allowed to cool down. But it is not very well adapted to large furnaces, and especially not to those cases where all the space round the furnace is required for manipulating heavy, white-hot masses of iron, or for similar purposes. In these cases the producers are arranged outside the iron-works, glass-works, &c., in an open yard where all the manipulations of feeding them with coal, of stoking, and of removing the ashes are performed without interfering with the work inside. But care must always be taken to place the producers at such a low level that the gas has an upward tendency, in order to facilitate its passage to the furnace where it is to be burned. This purpose can be further promoted by various means. The gas-producers constructed by Messrs Siemens Brothers, from 1856 onwards, were provided with a kind of brick chimney; on the top of this there was a horizontal iron tube, continued into an iron down-draught, and only from this the underground flues were started which sent the gas into the single furnaces. This arrangement, by which the gas was cooled down by the action of the air, acted as a gas-siphon for drawing the gas out of the producer, but it has various drawbacks and has been abandoned in all modern constructions. Where the “natural draught” is not sufficient, it is aided either by blowing air under the grate or else by suction at the other end. We shall now describe a few of the very large number of gas-producers producers constructed, selecting some of the most widely applied in practice. Fig. 12[2]—Siemens Producer (Sectional Elevation). Fig. 13.—Lürmann’s Producer. Figs. 14 and 15.—Liegel’s Producer. The Siemens Producer in its original shape, of which hundreds have been erected and many may be still at work, is shown in fig. 12. A is the charging-hole; B, the inclined front wall, consisting of a cast iron plate with fire-brick lining; C, the equally inclined “step-grate”; D, a damper by which the producer may be isolated in case of repairs; E, a water-pipe, by which the cinders at the bottom may be quenched before taking away; the steam here formed rises into the producer where it forms some “semi-water gas” (see Fuel: Gaseous). Openings like that shown at G serve for introducing a poker in order to clean the brickwork from adhering slags. H is the gas flue; I, the perpendicularly ascending shaft, 10 or 12 ft. high; JJ, the horizontal iron tube; K, the descending branch mentioned above, for producing a certain amount of suction by means of the gas-siphon thus formed. In the horizontal branch JJ much of the tar and flue-dust is also condensed, which is of importance where bituminous coal is employed for firing. Fig. 16.—Taylor’s Producer. Fig. 17.—Dowson Gas Plant. Fig. 18.—Mond Gas Plant. Fig. 19.—Mond Gas Plant. This as well as most other descriptions of gas-producers, is not adapted to being worked with such coal as softens in the heat and forms cakes, impenetrable to the air and impeding the regular sinking of the charge in the producer. The fuel employed should be non-bituminous coal, anthracite or coke, or at least so much of these materials should be mixed with ordinary coal that no semi-solid cakes of the kind just described are formed. Where it is unavoidable to work with coal softening in the fire, Lürmann’s producer may be employed, which is shown in fig. 13. V shows a gas-producer of the ordinary kind, which during regular work is filled with the coke formed in the horizontal retort E. The door b serves for removing the slags and ashes from the bottom of V, as far as they do not fall through the grate. The hot producer-gas formed in V is passed round the retort E in the flues n2 n2, and ultimately goes away through K to the furnace where it is to be used. The retort E is charged with ordinary bituminous coal which is submitted to destructive distillation by the heat communicated through the flues n2 n2 and is thus converted into coke. The gases formed during this process pass into the upper portion of V and get mixed with the producer-gas formed in the lower portion. From time to time, as the level of the coke in V goes down, some of the freshly formed coke in E is pushed into V, whereby the level of the coke in V should assume the shape shown by the dotted line l ... m. If the level became too low, such as is shown by the dotted line x ... y, the working of the producer would be wrong, as in this case the layer of coke at the front side would be too low, and carbon dioxide would be formed in lieu of monoxide. Fig. 20.—Blass’ Gas Plant. Figs. 14 and 15 show Liegel’s producer, the special object of which is to deal with any fuel (coal or coke) giving a tough, pasty slag on combustion. Such slags act very prejudicially by impeding the up-draught of the air and the sinking of the fuel; nor can they be removed by falling through a grate, like ordinary coal-ashes. To obviate these drawbacks the producer A is kept at a greater heat than is otherwise usual, the air required for feeding the producer being pre-heated in the channels e, e. The inside shape of the producer is such that the upper, less hot portion cannot get stopped, as it widens out towards the bottom; the lower, hotter portion, where the ashes are already fluxed, is contracted to a slit a, through which the air ascends. The grate b retains any small pieces of fuel, but allows the liquid cinder to pass through. The lateral flues c, c prevent the brickwork from being melted. One of the best-known gas-producers for working with compressed air from below is Taylor’s, shown in fig. 16. A is the feeding-hopper, on the same principle as is used in blast-furnaces. L is the producer-shaft, with an iron casing B and peep-holes B1 to B4, passing through the brick lining M. F is the contracted part, leading to the closed ash-pit, accessible through the doors D. An injector I, worked by means of the steam-pipe J, forces air through K into F. The circular grate G can be turned round K by means of the crank E from the outside. This is done, without interfering with the blast, in order to keep the fuel at the proper level in L, according to the indications of the burning zone, as shown through the peep-holes B1 to B4. The ashes collecting at the bottom are from time to time removed by the doors D. As the steam, introduced by J, is decomposed in the producer, we here obtain a “semi-water gas,” with about 27% CO and 12% H2. Fig. 17 shows the Dowson gas-producer, together with the arrangements for purifying the gas for the purpose of working a gas engine. a is a vertical steam boiler, heated by a central shaft filled with coke, with superheating tubes b passing through the central shaft. c is the steam-pipe, carrying the dry steam into the air-injector d. This mixture of steam and air enters into the gas-producer e below the fire-grate f. g is the feeding-hopper for the anthracite which is usually employed in this kind of producer. h, h are cooling-pipes for the gas where most of the undecomposed steam (say 10% of the whole employed in d) is condensed. i is a hydraulic box with water seal; j, a coke-scrubber; k, a filter; l, a sawdust-scrubber; m, inlet of gas-holder; n, gas-holder; o, outlet of same; p, a valve with weighted lever to regulate the admission of steam to the gas-producer; q, the weight which actuates the lever automatically by the rise or fall of the bell of the gas-holder. In practical work about 34 ℔ of steam is decomposed for each pound of anthracite consumed, and no more than 5% of carbon dioxide is found in the resulting gas. The latter has an average calorific power of 1732 calories per cubic metre, or 161 B.T.U. per cubic foot, at 0° and 760 mm. The Mond plant is shown in figs. 18 and 19. The gases produced in the generators G are passed through pipes r into washers W, in which water is kept in violent motion by means of paddle-wheels. The spray of water removes the dust and part of the tar and ammonia from the gases, much steam being produced at the same time. This water is withdrawn from time to time and worked for the ammonia it contains. The gases, escaping from W at a temperature of about 100° C., and containing much steam, pass though g and a into a tower, fed with an acid-absorbing liquid, coming from the tank s, which is spread into many drops by the brick filling of the tower. This liquid is a strong solution of ammonium sulphate, containing about 2.5% free sulphuric acid which absorbs nearly all the ammonia from the gases, without dissolving much of the tarry substances. Most of the liquor arriving at the bottom, after mechanically separating the tar, is pumped back into s, but a portion is always withdrawn and worked for ammonium sulphate. When escaping from the acid tower, the gas contains about 0.013% NH3, and has a temperature of about 80° C. and is saturated with aqueous vapour. It is passed through c into a second tower B, filled with blocks of wood, where it meets with a stream of comparatively cold water. At the bottom of this the water runs away, its temperature being 78° C.; at the top the gas passes away through d into the distributing main. The hot water from B, freed from tar, is pumped into a third tower C, through which cold air is forced by means of a Root’s blower by the pipe w. This air, after being heated to 76° C., and saturated with steam in the tower C, passes through l into the generator G. The water in C leaves this tower cold enough to be used in the scrubber B. Thus two-thirds of the steam originally employed in the generator is reintroduced into it, leaving only one-third to be supplied by the exhaust steam of the steam-engine. The gas-generators G have a rectangular section, 6 × 12 ft., several of them being erected in series. The introduction of the air and the removal of the ashes takes place at the narrower ends. The bottom is formed by a water-tank and the ashes are quenched here. The air enters just above the water-level, at a pressure of 4 in. The Mond gas in the dry state contains 15% carbon dioxide, 10% monoxide, 23% hydrogen, 3% hydrocarbons, 49% nitrogen. The yield of ammonium sulphate is 75 ℔ from a ton of coal (slack with 11.5% ashes and 55% fixed carbon). Fig. 21.—Dellwik-Fleischer Producer. One of the best plants for the generation of water-gas is that constructed by E. Blass (fig. 20). Steam enters through the valve V at D into the generator, filled with coke, and passes away at the bottom through A. The pressure of the gas should not be such that it could get into the pipe conveying the air-blast, by which an explosive mixture would be formed. This is prevented by the water-cooled damper S, which always closes the air-blast when the gas-pipe is open and vice versa. Below the entry W of the air-blast there is a throttle valve d which is closed as soon as the damper S opens the gas canal; thus a second security against the production of a mixture of air and gas is afforded. The water-cooled ring channel K protects the bottom outlet of the generator and causes the cinders to solidify, so that they can be easily removed. But sometimes no such cooling is effected, in which case the cinders run away in the liquid form. Below K the fuel is lying in a conical heap, leaving the ring channel A free. During the period of hot-blowing (heating-up) S is turned so that the air-blast communicates with the generator; d and G are open; g (the damper connected with the scrubber) and V are closed. During the period of gas-making G and d are closed, S now closes the air-blast and connects the generator with the scrubber; V is opened, and the gas passes from the scrubber into the gas-holder, the inlet w being under a pressure of 4 in. All these various changes in the opening of the valves and dampers are automatically performed in the proper order by means of a hand-wheel H, the shaft m resting on the standards t and shaft v. This hand-wheel has merely to be turned one way for starting the hot-blowing, and the opposite way for gas-making, to open and shut all the connexions, without any mistake being possible on the part of the attendant. The feeding-hopper E is so arranged that, when the cone e2 opens, e1 is shut, and vice versa, thus no more gas can escape, on feeding fresh coke into the generator, than that which is contained in E. G is the pipe through which the blowing-up gas (Siemens gas) is carried away, either into the open air (where it is at once burned) or into a pre-heater for the blast, or into some place where it can be utilized as fuel. This gas, which is made for 10 or 11 minutes, contains from 23 to 32% carbon monoxide, 7 to 1.5% carbon dioxide, 2 to 3% hydrogen, a little methane, 64 to 66% nitrogen, and has a heating value of 950 calories per cub. metre. The water-gas itself is made for 7 minutes, and has an average composition of 3.3% carbon dioxide, 44% carbon monoxide, 0.4% methane, 48.6% hydrogen, 3.7% nitrogen, and a heating value of 2970 calories per cub. metre. 1 kilogram coke yields 1.13 cub. metre water-gas and 3.13 Siemens gas. 100 parts coke (of 7000 calories) furnish 42% of their heat value as water-gas and 42% as Siemens gas. Lastly we give a section of the Dellwik-Fleischer gas-producer (fig. 21). The feeding-hoppers A are alternately charged every half-hour, so that the layer of fuel in the generator always remains 4 ft. deep. B is the chimney-damper, C the grate, D the door for removing the slags, E the ash-door, F the inlet of the air-blast, G the upper, G1 the lower outlet for the water-gas which is removed alternately at top and bottom by means of an outside valve, steam being always admitted at the opposite end. The blowing-up generally lasts 134 minutes, the gas-making 8 or 10 minutes. The air-blast works under a pressure of 8 or 9 in. below the grate, or 4 to 412 in. above the coke. The blowing-up gas contains 17 or 18% carbon dioxide and 1.5% oxygen, with mere traces of carbon monoxide. The water-gas shows 4 to 5% carbon dioxide, 40% carbon monoxide, 0.8% methane, 48 to 51% hydrogen, 4 or 5% nitrogen. About 2.5 cub. metres is obtained per kilogram of best coke. See Mills and Rowan, Fuel and its Application (London, 1889); Samuel S. Wyer, Producer-Gas and Gas-Producers, published by the Engineering and Mining Journal (New York); F. Fischer, Chemische Technologie der Brennstoffe (1897–1901); Gasförmige Heizstoffe, in Stohmann and Kerl’s Handbuch der technischen Chemie, 4th edition, iii. 642 et seq.  (G. L.) 1. Liquor condensed from gas alone, without wash water. 2. Figs. 12, 13, 14, 15, 16, 18, 19, 20, 21 of this article are from Lunge’s Coal-tar and Ammonia, by permission of Friedr. Vieweg u. Sohn.
2021-03-03 02:08:45
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 2, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.5376281142234802, "perplexity": 1798.967626064483}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-10/segments/1614178365186.46/warc/CC-MAIN-20210303012222-20210303042222-00493.warc.gz"}
https://math.stackexchange.com/questions/1173233/simplifying-finding-the-average-of-two-normalized-angles
# Simplifying finding the average of two normalized angles I am trying to simplify the equation that finds the average of two normalized angles [in degrees] e.g: $$\arctan\left(\frac{\sin(a)+\sin(b)}{\cos(a)+\cos(b)}\right)$$ But the simplified I can get is below $$\arctan\left(\frac{2\sin((a+b)/2)\cos((a-b)/2)}{2\cos((a+b/2))\cos((a-b)/2)}\right)$$ $$\arctan\left(\frac{sin((a+b)/2)}{cos((a+b)/2)}\right)$$ $$\arctan(\tan((a+b)/2))$$ Note: $(a+b)/2$ is simpler but does not work for example with $a=10$ and $b=350$ which should give $0$ but will then give $180.$ As I do not know how to do arctan or tan without calling a method to do it for me then I am stuck. Any help would be appreciated There is a simple way to take the mean of two angles $\alpha$ and $\beta$ with the result as a positive normalized angle: $$\gamma = g \left(\alpha + \frac 12 f(\beta - \alpha)\right),$$ where $f(\theta) = \theta + 2n\pi \in (-\pi,\pi]$ with $n\in \mathbb Z$ is the function that normalizes angles to the smallest magnitude and $g(\theta) = \theta + 2n\pi \in [0,2\pi)$ with$n\in \mathbb Z$ is the function that normalizes angles to the smallest positive value. If you are using degree measure, of course, the functions are $f(\theta) = \theta + 360n \in (-180,180]$ and $g(\theta) = \theta + 360n \in [0,360)$. In these formulas the style of brackets at each end of the specified range of angles tells you whether each endpoint is included (square bracket) or not included (round bracket) in the range; for example, $f(\theta) \in (-180,180]$ means $-180 < f(\theta) \leq 180.$ In any case, the value $n$ is whatever integer value will put the function value in the desired range; working in degrees, $f(370) = 370 + 360(-1) = 10,$ that is, in that case $n = -1$, but $f(20) = 20 + 360(0) = 20,$ that is, $n = 0$ in that case. The "normalization functions" in that formula are discontinuous sawtooth-pattern functions. They're not necessarily suitable for all applications, but when you just need to bisect an angle they can be very handy. If you start with the assumption that both angles $\alpha$ and $\beta$ are already normalized, then the angle values of your intermediate results will never fall outside the range $(-2\pi,2\pi)$ radians or $(-360,360)$ degrees for $f$ and will never be outside $\left(-\frac\pi2,\frac32\pi\right]$ radians or $(-180,540]$ degrees for $g$, and you can use these versions of the functions for radians: $$f(\theta) = \begin{cases} \theta + 2\pi & \mbox{if}\quad \theta \leq -\pi \\ \theta & \mbox{if}\quad {-\pi} < \theta \leq \pi \\ \theta - 2\pi & \mbox{if}\quad \theta > \pi \\ \end{cases}$$ $$g(\theta) = \begin{cases} \theta + 2\pi & \mbox{if}\quad \theta < 0 \\ \theta & \mbox{if}\quad 0 \leq \theta < 2\pi \\ \theta - 2\pi & \mbox{if}\quad \theta \geq 2\pi \\ \end{cases}$$ For angles in degrees, of course, substitute $180$ for $\pi$. The formula $$\gamma = \arctan\left(\frac{\sin\alpha +\sin\beta}{\cos\alpha +\cos\beta}\right)$$ is based on taking the sum of two unit vectors, $(\sin\alpha, \cos\alpha)$ and $(\sin\beta, \cos\beta)$. As observed, it can run into trouble if you do not account for the components of both vectors individually. But it also has another drawback: it gives results only in the range $(-\frac\pi2,\frac\pi2)$ (or $(-180,180)$ in degrees). You cannot use it to "average" the angles $90$ and $100$ because it will give you $-85$ instead of $95$, and you cannot use it to average $80$ and $100$ because it will not give you any answer at all (since you cannot take the tangent of a right angle). A function that actually works for all angles is the atan2 function, which is like arctan except that it requires two input parameters instead of one and gives a result in the range $(-\pi,\pi]$: $$\gamma = \mbox{atan2}(\sin\alpha +\sin\beta, \cos\alpha +\cos\beta).$$ • I think that what you are proposing is correct but I have no idea what "n" is in the formula you are providing. Could you provide a more thorough definition of what "n" is please. Mar 3 '15 at 12:28
2021-09-18 02:42:08
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.8415586352348328, "perplexity": 133.9118152780036}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-39/segments/1631780056120.36/warc/CC-MAIN-20210918002951-20210918032951-00517.warc.gz"}
http://garmasoftware.com/sample-size/sample-size-margin-of-error-formula.php
Home > Sample Size > Sample Size Margin Of Error Formula # Sample Size Margin Of Error Formula ## Contents Thus 186 sample size arrived at ,should be corrected /adjusted for finite population. Step 2: Find the Standard Deviation or the Standard Error. Don’t worry if you are unsure about this number. However, when one reports it, remember to state that the confidence interval is only 90% because otherwise people will assume a 95% confidence. http://garmasoftware.com/sample-size/sample-size-and-margin-of-error-formula.php Say I have the same 100 staff and it is upto them to take the survey, what is the same size I should be looking for? Back to Blog Subscribe for more of the greatest insights that matter most to you. We would like to create a 99% confidence interval with the margin of error being at most 5. To crosscheck my work, plug in our magazine company’s three values into our survey sample size calculator. https://www.qualtrics.com/blog/determining-sample-size/ ## Find Sample Size Given Margin Of Error And Confidence Level Calculator Step 3: Multiply the critical value from Step 1 by the standard deviation or standard error from Step 2. A simple equation will help you put the migraine pills away and sample confidently. is the population standard deviation. If you don't know, use 50%, which gives the largest sample size. In fact, your survey’s confidence level and margin of error almost solely depends on the number of responses you received. You can also use a graphing calculator or standard statistical tables (found in the appendix of most introductory statistics texts). That’s why FluidSurveys designed its very own Survey Sample Size Calculator. How To Determine Sample Size For Quantitative Research I have personally benefited form this posting. Since we haven’t actually administered our survey yet, the safe decision is to use .5 - this is the most forgiving number and ensures that your sample will be large enough. Sample Size Equation Home Tables Binomial Distribution Table F Table PPMC Critical Values T-Distribution Table (One Tail) T-Distribution Table (Two Tails) Chi Squared Table (Right Tail) Z-Table (Left of Curve) Z-table (Right of Curve) In terms of the numbers you selected above, the sample size n and margin of error E are given by x=Z(c/100)2r(100-r) n= N x/((N-1)E2 + x) E=Sqrt[(N - n)x/n(N-1)] where http://www.raosoft.com/samplesize.html The short answer to your question is that your confidence levels and margin of error should not change based on descriptive differences within your sample and population. Industry standard for marketing research is a 95% confidence level with a margin of error of 5%. How To Determine Sample Size In Research Methodology The smaller your population the larger portion of respondents you'll need to reach your desired confidence level. Reply RickPenwarden says: May 25, 2015 at 2:13 pm Hey! This means that your data is becoming less reliable. ## Sample Size Equation Find the degrees of freedom (DF). You can use the Normal Distribution Calculator to find the critical z score, and the t Distribution Calculator to find the critical t statistic. Find Sample Size Given Margin Of Error And Confidence Level Calculator You can still use this formula if you don’t know your population standard deviation and you have a small sample size. Sample Size Table Reply RickPenwarden says: November 3, 2014 at 10:47 am Hi Liz! Hope this information helps! useful reference Use Minitab to obtain the exact interval: The exact interval is (0.4609, 0.5666). Michael Porinchak 9.713 προβολές 20:02 Statistics 101: Confidence Intervals, Population Deviation Known - Διάρκεια: 44:07. Thanks in advance. Sample Size Determination Pdf Stay in the loop: You might also like: Market Research How to Label Response Scale Points in Your Survey to Avoid Misdirecting Respondents Shares Market Research Two More Tips for Here is a link to the article I wrote on this type of bias: http://fluidsurveys.com/university/how-to-avoid-nonresponse-error/ Hope this helps! What if my expected response rate is 10%? my review here This section describes how to find the critical value, when the sampling distribution of the statistic is normal or nearly normal. If I am not wrong, an existing formula implies 100% response rate! Survey Sample Size Formula With Qualtrics Online Sample, we’ll find your target respondents for the best price, and manage it from start to finish. Your confidence level corresponds to a Z-score. ## Reply Jess This is excellent thank you! Reply Rip Stauffer Good stuff on sample size, but you shouldn't need any test of hypothesis to show that your project has improved a process…a pre-requisite for a capability study (before But before you check it out, I wanted to give you a quick look at how your sample size can affect your results. Michael Porinchak 8.156 προβολές 24:33 AP Statistics: Confidence Intervals - Part 1 - Διάρκεια: 20:02. Sample Size Determination In Research If you’ve ever seen a political poll on the news, you’ve seen a confidence interval. For the purpose of this example, let’s say we asked our respondents to rate their satisfaction with our magazine on a scale from 0-10 and it resulted in a final average Note: The larger the sample size, the more closely the t distribution looks like the normal distribution. The central limit theorem states that the sampling distribution of a statistic will be nearly normal, if the sample size is large enough. get redirected here You can change this preference below. Κλείσιμο Ναι, θέλω να τη κρατήσω Αναίρεση Κλείσιμο Αυτό το βίντεο δεν είναι διαθέσιμο. Ουρά παρακολούθησηςΟυράΟυρά παρακολούθησηςΟυρά Κατάργηση όλωνΑποσύνδεση Φόρτωση... Ουρά παρακολούθησης Ουρά __count__/__total__ AP Cautions About Sample Size Calculations 1. Conservative Method $n=\frac {(z_{\alpha/2})^2 \cdot \frac{1}{2} \cdot \frac{1}{2}}{E^2}$ This formula can be obtained from part (a) using the fact that: For 0 ≤ p ≤ 1, p (1 - p) achieves The formula does not cover finite population. Please download and reuse this web page! a 40% response rate) then we would need to sample (\frac{7745}{0.4})=19,362.5 or 19,363. a. But can this formular be used for a two-tailed hypothesis as well? Here are the z-scores for the most common confidence levels: 90% - Z Score = 1.645 95% - Z Score = 1.96 99% - Z Score = 2.576 If you choose BEDMAS is our friend Reply Lisa says: August 1, 2014 at 2:13 pm Very helpful for my work Thanks! Margin of error = Critical value x Standard error of the sample. How many individuals should we sample? (In the last poll his approval rate was 72%). A margin of error tells you how many percentage points your results will differ from the real population value. Reply RickPenwarden says: March 3, 2015 at 10:17 am Hi Nida, Need help with your homework? The most common confidence intervals are 90% confident, 95% confident, and 99% confident. I mean if if have a total of 1000 balls in a box and the 900 of them are white and 100 of them are black (black are the 10%) and About Response distribution: If you ask a random sample of 10 people if they like donuts, and 9 of them say, "Yes", then the prediction that you make about the general Source: Greene Sample Size Estimation This powerpoint breaks down the sample size estimation formula, and gives a short example of how to use it. open player in a new window
2019-01-18 11:12:50
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.6867234706878662, "perplexity": 1159.367215053382}, "config": {"markdown_headings": true, "markdown_code": false, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-04/segments/1547583660070.15/warc/CC-MAIN-20190118110804-20190118132804-00358.warc.gz"}
http://tips.naivist.net/2005/09/
## Calculated fields in CAML So you have a SharePoint list with a calculated field. You want to select items based on the calculated field beginning with some specific substring. You write a CAML query: ``````<Where> <BeginsWith> <FieldRef Name="SortDate" /> <Value Type="Calculated">200509</Value> </BeginsWith> </Where> `````` This won’t work. (At least on my server) you’d always get informed that ” The SQL Server might not be started” + get a useless COM exception number 0x81020024. You can work around the problem by changing the value type to “Text” ``````<Where> <BeginsWith> <FieldRef Name="SortDate" /> <Value Type="Text">200509</Value> </BeginsWith> </Where> `````` This also works on the “Contains” operator. Other operators such as LessThan, GreaterThan, Equals, IsNull allow you to set the real value type – Calculated. Don’t know why. Probably a bug in Sharepoint. ## Month names. i18n, you know Whenever you see something like this you should come to an idea something is wrong (for instance, the guy who wrote this is still alive): ``````'month names in Latvian Dim sMonth() As String = _ {"Janvāris", "Februāris", "Marts", "Aprīlis", _ "Maijs", "Jūnijs", "Jūlijs", "Augusts", _ "Septembris", "Oktobris", "Novembris", "Decembris"} Dim oListItem as ListItem For iMonth as Integer = 1 To 12 oListItem = New ListItem(sMonth(iMonth-1), iMonth.ToString()) Next `````` Explanation – if MS Windows knows quite well how months are named in Latvia, why should you try to be smarter than the big brother? Another explanation – if this is a web project (and in my case it is), you should think of internationalization whenever possible. So a more correct way to add month names to a dropdown menu is: ``````Imports System.Globalization .... Dim oListItem as ListItem For iMonth As Integer = 0 To 11 oEntry = New Web.UI.WebControls.ListItem( _ CultureInfo.CurrentUICulture.DateTimeFormat.MonthNames(iMonth), _ iMonth.ToString) Next `````` And, to be even more precise, you could first check how many months there are in the current culture: ``````For iMonth As Integer = 0 To _ CultureInfo. CurrentUICulture.Calendar. _ GetMonthsInYear(Now.Year) - 1 .... `````` /Just trying to be a good boy and use the facilities provided by the framework/ ## Asm? Kā jums šķiet, vai “objektorientētais asamblers” ir oksimorons? Zinu tikai to, ka “objektorientācija” un “asemblers” vienmēr ir rādīti kā pretstati. Bet varbūt tak tomēr ir kāds gudrinieks, kurš pamanījies to apvienot? ## Parse the Enum! What if we need to save the value of an instance of an enumeration (Enum) as string and then get back the value again? For instance, we have the following code: ``````Dim eDay As System.DayOfWeek = DayOfWeek.Monday `````` So now we can get a textual representation of eDay using the built-in ToString() method: ``````MessageBox.Show(eDay.ToString()) `````` This yields a messagebox saying “Monday”. But how do we do the reverse (i.e., we know only the string representation “Monday”, but we need the enum value)? The trivial approach would be: `````` Dim sStr As String = "Monday" Dim eDay As System.DayOfWeek Select Case sStr Case "Monday" : eDay = DayOfWeek.Monday Case "Tuesday" : eDay = DayOfWeek.Tuesday '... End Select `````` No, this sounds too dumb. We can use the built-in shared function `Parse` of the `System.Enum` class. Method accepts two parameters, the type of enumeration and the actual value being parsed. ``````eDay = System.Enum.Parse(GetType(System.DayOfWeek), "Monday") `````` This only works with option strict set to off, because `Enum.Parse()` returns a `System.Object` value. So when using option strict set to on, the code gets more obfuscated: ``````eDay = CType( _ System.Enum.Parse(GetType(System.DayOfWeek), "Monday"), _ System.DayOfWeek) `````` Anyway, now we have the value! :) We all know that the concatenation operator & is evil when you use it intensively. We know writing like this is no good: ``````Dim s as String = "" s &= "<" s &= spFieldName s &= ">" s &= spFieldValue s &= "</" s &= spFieldName s &= ">" `````` This is no good because a new String object is being created for every line of this code and the value is being copied to the newly created object and no optimizations can be made during compilation. One could avoid this using a StringBuilder object and calling ToString() method to achieve the same result. However the readability wouldn’t be too good. So today I was paging through code of some library not written by me. I used Lutz Roeder’s Reflector. I came accross the following approach of string concatenation: ``````Dim s as String s = String.Concat("<", spFieldName, ">", spFieldValue, "</", spFieldName, ">") `````` They had used the “Dotfuscator” to obfuscate the code of the library. As far as I know, the Reflector also makes some optimizations to the code. That’s why I’m not really sure if this is a coding approach or an effect by Dotfuscator/Reflector. Anyway, I believe it is quite a good solution: it doesn’t use much memory for execution and it’s quite readable!
2023-02-09 06:22:53
{"extraction_info": {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.8243797421455383, "perplexity": 5224.085105715505}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 20, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2023-06/segments/1674764501407.6/warc/CC-MAIN-20230209045525-20230209075525-00533.warc.gz"}
https://mathoverflow.net/questions/150497/positivity-of-the-coulomb-energy-in-two-dimensions
# Positivity of the Coulomb energy in two dimensions In dimensions $d\geq 3$ the Coulomb energy is always non-negative (since the Fourier transform of $\frac{1}{\|\cdot\|^{d-2}}$ is non-negative). What can one say about positivity properties of the Coulomb energy in $d=2$? $$D(f,g):=-\displaystyle\int_{\mathbb{R}^2}\int_{\mathbb{R}^2}\overline{f(x)}g(y)\log{\|x-y\|}~dxdy$$ Is $\int f=0$, $f\in L^1(\mathbb{R}^2)$ sufficient for $D(f,f)\geq 0$? References would be appreciated. - shouldn't the domain of each of the integrals be $\mathbb{R}$? – Suvrit Dec 1 '13 at 18:42 No, $f,g\in L^1(\mathbb{R}^2)$ or $L^1_{\text{loc}}(\mathbb{R}^2)$. – whz Dec 1 '13 at 18:51 Asked 2 days ago on math.stackexchange – Francois Ziegler Dec 1 '13 at 19:20 Didn't receive any answers over there so I figured, I should try here. I'm sorry if this is not allowed. – whz Dec 1 '13 at 19:23 Does the same hold if we replace the Lebesgue measure with a signed measure with compact support?(for $\mathbb{R}^{n\geq 3}$) – S.Zoalroshd Jun 17 at 23:46 This is true when the support of $f$ is contained in the unit disc. If the support is contained in a disc $|z|<R$, then $(f,f)$ is bounded from below by a constant that depends on $R$. This minor nuisance makes the logarithmic potential somewhat different from the Newtonian potential, however most statements of potential theory are similar for these two cases, or can be easily modified. For the details, the standard reference is MR0350027 Landkof, N. S. Foundations of modern potential theory. Springer-Verlag, New York-Heidelberg, 1972. - I copied my answer there. Someone has to vote it up to give me the bounty:-) – Alexandre Eremenko Dec 1 '13 at 20:49 Thank you very much for the reference. One more question: Does Theorem 1.16 from your reference not also imply that $\inf f=0$ is sufficient for $D(f,f)\geq 0$? I mean if $\nu$ is the measure with density $f$, we have $\nu(1)=\int 1\times f(x)~dx=0$ and 1.16 implies that in this case the mutual energy is non-negative. I'm not entirely sure what the notation $\nu(g)$ for a function $g$ is supposed to mean, I guess $\nu(g)=\int g(x) \nu(dx)$. – whz Dec 2 '13 at 7:28 @whz: Your guess about $\nu(g)$ is correct, but your conjecture is not: let the support of $f$ consist of two small pieces very far away from each other. Then the energy is negative. – Alexandre Eremenko Apr 8 at 3:11 To deal with this singular integral is rather subtle. If you think about it, it may be possible that your integral is actually not well-defined under the only assumptions you suggest. One way to deal properly with it, is to assume your function $f$ integrates the $\log$ at infinity, and that $D(|f|,|f|)<+\infty$. Then, your statement has been proved in "Two problems on potential theory for unbounded sets", by Cegrell, Kolodziej and Levenberg (Math. Scand. 83 (1998), 265-276), cf. Theorem 2.5. Here $f$ is actually allowed to be a signed measure. You may also want to restate everything in terms of the energy over the Riemann sphere (i.e. the one point compactification of $\mathbb R^2$). This is a strategy I used in "http://ecp.ejpecp.org/article/view/1818" and "http://www.sciencedirect.com/science/article/pii/S0021904512000573". Sorry for the self-advertising ;) - $$\nabla^{2}\Phi\pars{\vec{r}} =\int_{{\mathbb R}^{2}}\fermi\pars{\vec{r}'} \overbrace{\braces{\nabla^{2}\ln\pars{\verts{\vec{r} -\vec{r}'}}}}^{\ds{=\ 2\pi\,\delta\pars{\vec{r} - \vec{r}'}}}\,\dd^{2}\vec{r}' =2\pi\,\fermi\pars{\vec{r}}$$ $\pars{1}$ is reduced to \begin{align} \varepsilon&= -\,{1 \over 2\pi} \int_{{\mathbb R}^{2}}\Phi\pars{\vec{r}}\nabla^{2}\Phi\pars{\vec{r}}\,\dd^{2}\vec{r} = -\,{1 \over 2\pi} \int_{{\mathbb R}^{2}}\braces{% \nabla\cdot\bracks{\Phi\pars{\vec{r}}\nabla\Phi\pars{\vec{r}}}\,\dd^{2}\vec{r} - \verts{\nabla\Phi\pars{\vec{r}}}^{2}}\,\dd^{2}\vec{r} \\[3mm]&= -\,{1 \over 2\pi} \int_{{\mathbb R}^{2}} \nabla\cdot\bracks{\Phi\pars{\vec{r}}\nabla\Phi\pars{\vec{r}}}\,\dd^{2}\vec{r} + {1 \over 2\pi}\int_{{\mathbb R}^{2}} \verts{\nabla\Phi\pars{\vec{r}}}^{2}\,\dd^{2}\vec{r} \end{align} The first integral is reduced to a 'line integration', with boundaries with goes '$\to \infty$', via Stokes Theorem and it goes to zero. Then, $$\color{#00f}{\large% \varepsilon = {1 \over 2\pi}\int_{{\mathbb R}^{2}} \verts{\nabla\Phi\pars{\vec{r}}}^{2}\,\dd^{2}\vec{r}\ \geq\ 0}$$ -
2015-11-30 21:05:18
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 2, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9640757441520691, "perplexity": 433.1302898808774}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.3, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2015-48/segments/1448398463315.2/warc/CC-MAIN-20151124205423-00177-ip-10-71-132-137.ec2.internal.warc.gz"}
https://campusflava.com/mth101-tma1-questions-and-solutions-find-the-limiting-value-of-frac-7n-5-2n-3-as-n-rightarrow-infity/
# MTH101 TMA1 Questions and Solutions : Find the limiting value of $\frac { 7n + 5} { 2n – 3}$ as n \rightarrow {\infIty} Find the limiting value of $\frac { 7n + 5} { 2n – 3}$ as n \rightarrow {\infIty} a) $\frac{3} {5}$ b) $\frac{7} {2n}$ c) $\frac{7n} {2}$ d) $\frac{7} {2}$ You can purchase MTH101 TMA Solutions at the rate of #1000 only  and all of your required Courses from us kindly send us a msg on whatsapp 08039407882 SNAPSHOTS FROM HAPPY CUSTOMERS
2018-01-16 07:28:48
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.8060411810874939, "perplexity": 3786.5439439300844}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 5, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2018-05/segments/1516084886237.6/warc/CC-MAIN-20180116070444-20180116090444-00046.warc.gz"}
https://atompublishing.info/age-of-empires-2-no-cd-crack-conquerors-link/
# Age Of Empires 2 No Cd Crack Conquerors !!LINK!! Age Of Empires 2 No Cd Crack Conquerors 4/17/2015 . Wenn man die Update von AoE 2 auf 1.0d einschaltet, wird ein Crack für AoE 2: Conquerors vom mod-Team genommen. AE2:AoE2, aa_injection, Capture, 18F. Changelog for version 1.0a of the Age of Empires 2: The Conquerors patch. Change log for version 1.0 of the Age of Empires 2: The Conquerors patch. Conquerors no-cd crack fix for Age of Empires 2 The Conquerors released, no more CD required to run. Age of Empires 2 The Conquerors. Click Here to Download the Downloadable No-CD Patches for Age of Empires 2. No CD patch allows you to play Age of Empires 2 without the need to have a preloaded disc. AOE2:TC:Some1 said if you get the original title it won’t patch to the new title.. Other people said it might patch but some people said it didn’t. AOE II: The Conquerors no cd patch available. Age of Empires II: The Conquerors – Download Full Version. Alles in unseren Servern, alles unbedingt downloaden! If you successfully install Age of Empires 2: The Conquerors 1.0a Patch without a disc, your game settings will remain the same as before. However, the gamerscore will be 1344. Aoe 2.tc. NoCD Patch For Ages of Empires 2 (All DLC) (NOLODEX) – PC Games – Free Download. AOE2:TC:Some1 said if you get the original title it won’t patch to the new title.. Other people said it might patch but some people said it didn’t. age of empires 2 no cd patch conquerors 1.0a Download age of empires 2 conquerors game from mirror game – Age of Empires 2: The Conquerors (AOE2:TC:Some1) – Gamezone. Conquerors no cd patch. Age of Empires 2: The Conquerors no cd patch available. Age of Empires II: The Conquerors – Download Full Version. Alles in unseren Servern, alles unbedingt downloaden! 2014 · INSTALAR CRACK AGE OF EMPIRE 2 CONQUERORS(2019) aun funciona Como solucionar age of empires 2 conquerors no cd crack age of empires 2 no cd crack age of empires 2 no cd crack (mac) age of empires 2 no cd crack (windows) no cd patch age of empires 2 How to get the Key Codes in Age of Empires 2? This script is working 100% but this is the only way I’ve ever been able to get any kind of key codes. I’ve.. No CD Crack or Patch? (Age2C) I installed the game ages ago (for windows) on two computers and one of them had the No CD cracked. age of empires 2 no cd crack conquerors age of empires 2 conquerors no cd crack age of empires 2 conquerors no cd crack age of empires 2 no cd crack age of empires 2 conquerors no cd crack Subscribe to NoCDCracked: No CD Crack or Patch? (Age2C) I installed the game ages ago (for windows) on two computers and one of them had the No CD cracked. age of empires 2 no cd crack conquerors age of empires 2 conquerors no cd crack age of empires 2 conquerors no cd crack age of empires 2 no cd crack age of empires 2 conquerors no cd crack age of empires 2 no cd crack age of empires 2 conquerors no cd crack age of empires 2 no cd crack age of empires 2 conquerors no cd crack age of empires 2 no cd crack age of empires 2 conquerors no cd crack Age of Empires II: The Conquerors was, in my mind, the ideal.. Download No-CD Patch for Age of Empires II: The Conquerors for Windows. The NoCDCracked AOE II: The Conquerors Patch is a small,. Age of Empires 2: The Conquerors Expansion (v1.0c) . Age of Empires 2 – NoCDCracked – People that require the no cd cracks.. Windows 7 Ultimate x64, Ultimate x86, 7/Win7 Starter x64, x64 Win7 Home Basic / Home Premium. age of empires 2 no cd crack conquerors age of empires 2 conquerors no cd crack age of empires 2 no cd crack age of empires 2 no cd crack age of empires 2 conquerors no cd crack Age of Empires 2: The Conquerors is a (cancelled) sequel d0c515b9f4 Next Generation of Strategy Game An online strategy game developed by Microsoft Studios for the Xbox One. The game is a remake of the original Xbox classic Ages of Empires, which is itself a remake of the game released in 1996. The game takes place in the Old West era where the player must manage a military to expand their empire, which can be further enhanced with new units and technologies. Gameplay The player assumes the role of one of the three major nations during the American Civil War; the United States, which is America’s leading power, the Confederate States of America, which rebels from the Union, and the Kingdom of Mexico, a monarchy based on the city of Mexico. During gameplay, the player must build a city in the game world, gather resources, and manage their military forces. The military can be used in several ways, including combat, or placed under the control of a Governor, who uses their military in order to govern the land, on occasion joining together in alliance with other allies to help defeat the opposing armies. The game world consists of a number of provinces, where the player must perform objectives that include conqueror the province, build factories, and research new technologies. The game features one of the largest multiplayer communities on the Xbox Live, with millions of players per month. The game supports up to four players online and split-screen play for up to four players. The game also supports up to four AI-controlled players for quick games. Reception Awards References Category:2004 video games Category:Age of Empires Category:Video games developed in the United States Category:Video game remakes Category:Video games set in the 19th century Category:Windows games Category:Windows-only games Category:Xbox gamesQ: What is the difference between empty set and a set of false values? I was practicing Boolean algebra in haskell and I came across the following question : If $S_{1}=\emptyset$ and $S_{2}=\{false\}$, then what is the difference between $\{false\}\cup\emptyset$ and $\{false\}$? There are three possible cases: 1) The first case would be: \begin{align*} \{false\}\cup\emptyset &=\{false\} \q The updated patch includes 5 new maps: Space Station, Exhibition, Museum, Death Valley and Wagon. The final version of Age of Empires III patch 1.10 is available for free here. Download and install it. Make sure you have the right ISO for your PC, x86, or x64 bit version. Copy it to your hard drive and play. All your Custom and Save Games will be transferred, and you’ll get the game’s The Conquerors Expansion absolutely for free! You will need to own a PlayStation 3, PlayStation 2, or Xbox 360 copy of the original The Age Of Empires 3. There’s a patch here with.
2022-08-07 21:39:09
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.2606700658798218, "perplexity": 11655.412231302927}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.3, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2022-33/segments/1659882570730.59/warc/CC-MAIN-20220807211157-20220808001157-00706.warc.gz"}
https://www.physicsforums.com/threads/double-bond.63301/
# Double bond 1. Feb 9, 2005 ### Cheman Double bond.... We always talk about the double bond in an alkene being an area of particularly high electron density, which induces charges on other molecules, which is what usually causes it to react. But why is this only the case for double not single? I mean, single bonds are not overly attractive since the electrons attract as much as the nuclei repel. Is the double bond different because the pi bond is that little bit further from the nucleus, due to the p orbitals orientation, and thus attract more than the nuclei repel in-coming molecule's electrons? 2. Feb 9, 2005 ### Sirus Although single bonds polarize compounds such as bromine when in close proximity, I believe that the electron density is not high enough to polarize to the point of breaking. Therefore, the single bonds will not prompt a reaction while the double bonds will. An example of this would be benzene and bromine, which yields dibromobenzene. 3. Feb 10, 2005 ### The Bob A double bond is made of three orbital bonds, known as Pi (two fo them) and Sigma ($$\pi$$ and $$\sigma$$ respectively). You probably know how these are formed so I will get to the point. The electrons that can be used to form other compounds will be in the two $$\pi$$ orbitals as these are were the free electrons are. A $$\pi$$ and a $$\sigma$$ are, together, not as strong as one $$\sigma$$ bond. Why?? I don't know yet but I intent to find out. I think the best way to explain why single bonds are stronger is that, because of the position the orbitals are, a $$\sigma$$ bond is more direct in attraction than a $$\pi$$ bond. This means that the attraction through the orbitals is stronger. It is the old saying: 'The shortest point to A and B is a stright line'. This is the same for a $$\sigma$$ bond. If any of this is wrong then I ask someone to correct it but this is my understand of it after reading on the subject for 10 minutes in my chemistry lesson today.
2018-09-20 03:40:33
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.4530055522918701, "perplexity": 934.5644977947186}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2018-39/segments/1537267156376.8/warc/CC-MAIN-20180920020606-20180920040606-00007.warc.gz"}
http://mathoverflow.net/questions/136086/a-closed-extension-of-the-laplace-operator-with-respect-to-the-supremum-norm
A closed extension of the Laplace operator with respect to the supremum norm Let $X$ be a bounded connected open subset of the $n$-dimensional real euclidean space. Consider the Laplace operator defined on the space of infinitely differentiable functions with compact support in $X$. What is the closure of this operator in the space $C_0(X)$ endowed with the supremum norm? Does its closure generate a strongly continuous semigroup on $C_0(X)$? - It is good to mention that you have already asked this at MSE, did not get reaction, and reposted here, see math.stackexchange.com/questions/438166/… –  András Bátkai Jul 9 '13 at 20:16 If $X$ has the so-called Wiener-regularity, then it generates an analytic semigroup, see the paper by Arendt and Bénilan.
2014-08-20 16:33:12
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9635149240493774, "perplexity": 118.72428948564905}, "config": {"markdown_headings": false, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2014-35/segments/1408500811391.43/warc/CC-MAIN-20140820021331-00080-ip-10-180-136-8.ec2.internal.warc.gz"}
http://www.mzan.com/article/47653029-redirect-part-of-url-if-query-var-exists.shtml
Home redirect part of url if query-var exists I have relaunched a TYPO3 Website and have a problem with the redirects of old links listed by google. I want to redirect this: https://www.mydomain.ac/index.php?id=88&itemID=123 to https://www.mydomain.ac/item/item-detail/?itemID=123 The id 88 is fix. It still does not exists in the new site, but maybe can be added later. So I just want to redirect if the id=88 AND an itemID (any number) is in the URL. I tried this: RewriteRule ^index\.php\?id=88&itemID= /item/item-detail/?itemID= [L] but this didn't work ... obviously ;-) Any idea how to solve this? Thanx in advance!
2018-07-16 02:47:21
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.27921444177627563, "perplexity": 2789.4555629212036}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.3, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2018-30/segments/1531676589172.41/warc/CC-MAIN-20180716021858-20180716041858-00080.warc.gz"}
http://mathoverflow.net/feeds/question/27010
Sum of digits iterated - MathOverflow most recent 30 from http://mathoverflow.net 2013-05-24T11:10:59Z http://mathoverflow.net/feeds/question/27010 http://www.creativecommons.org/licenses/by-nc/2.5/rdf http://mathoverflow.net/questions/27010/sum-of-digits-iterated Sum of digits iterated Wadim Zudilin 2010-06-04T04:36:31Z 2010-06-04T05:58:45Z <p><strong>Original version.</strong> I believe that it is an elementary question, already discussed somewhere. But I just have no idea of how to start it properly. Take a positive integer $n=n_1$ and compute its sum of digits $n_2=S(n)=S_{10}(n)$ in the decimal system. If the newer number $n_2$ is greater than $10$, then compute the sum $n_3=S(n_2)$ of its digits, and continue this iteration $n_k=S(n_{k-1})$ unless you get a number $n^* =n_\infty$ in the range $1\le n^* \le 9$. Is $n^*$ uniformly distributed in the set $\lbrace 1,2,\dots,9\rbrace$? If this is not true in the decimal systems, what can be said in the other systems?</p> <p>I just learned yesterday about the Feng shui system of determining what kind of problems/advantages one can get according to the house number, say $n$, of his/her home. This depends on the above $n^*$. I do not seriously count on the conclusions but I am curious whether $n^*$ is sufficiently democratic.</p> <p><strong>Edit.</strong> The question was immediately realized as obvious, because $n^*$ is the residue modulo $9$ (with 0 replaced by 9), and this works in any base as well. So the Feng shui function is really trivial, but one can deal with less trivial ones.</p> <p>Let me fix $m$ and define $Q_m(n)$ as the sum of $m$th powers of decimal digits of a positive integer $n$. What can be said about the sequence of iterations $n_k=Q_m(n_{k-1})$ for a given integer $n_0$? How long can the (minimal) period be for a fixed $m$? And what can be said about the distribution of the purely periodic tails?</p> <p>I hope that the question is still elementary.</p> http://mathoverflow.net/questions/27010/sum-of-digits-iterated/27017#27017 Answer by Gerry Myerson for Sum of digits iterated Gerry Myerson 2010-06-04T05:52:01Z 2010-06-04T05:52:01Z <p>A starting place might be <a href="http://www.research.att.com/~njas/sequences/A005188" rel="nofollow">http://www.research.att.com/~njas/sequences/A005188</a> which lists $n$-digit numbers $r$ with $Q_n(r)=r$, and has references to related oddities. </p> http://mathoverflow.net/questions/27010/sum-of-digits-iterated/27018#27018 Answer by Nurdin Takenov for Sum of digits iterated Nurdin Takenov 2010-06-04T05:58:45Z 2010-06-04T05:58:45Z <p>The case $m=2$ appears in Hugo Steinhaus's "One Hundred Problems In Elementary Mathematics", problem 2(at least in Russian edition of 1986). Either sequence will come to 1 and stay here, or will enter to the cycle (145,42,20,4,16,37,58,89) </p>
2013-05-24 11:11:05
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.8353383541107178, "perplexity": 537.6344957463275}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2013-20/segments/1368704590423/warc/CC-MAIN-20130516114310-00064-ip-10-60-113-184.ec2.internal.warc.gz"}
https://www.ias.ac.in/listing/bibliography/pmsc/M._A._Navarro
• M A Navarro Articles written in Proceedings – Mathematical Sciences • Hölder Seminorm Preserving Linear Bijections and Isometries Let $(X, d)$ be a compact metric and $0 &lt; \alpha &lt; 1$. The space $\mathrm{Lip}^\alpha(X)$ of Hölder functions of order 𝛼 is the Banach space of all functions 𝑓 from 𝑋 into $\mathbb{K}$ such that $\| f\|=\max \{\| f\|_\infty,L(f)\} &lt;\infty$, where $$L(f)=\sup\{|f(x)-f(y)|/d^\alpha(x,y):x,y\in X, x\neq y\}$$ is the Hölder seminorm of 𝑓. The closed subspace of functions 𝑓 such that $$\lim\limits_{d(x,y)\to 0}|f(x)-f(y)|/d^\alpha(x,y)=0$$ is denoted by $\mathrm{lip}^\alpha(X)$. We determine the form of all bijective linear maps from $\mathrm{lip}^\alpha(X)$ onto $\mathrm{lip}^\alpha(Y)$ that preserve the Hölder seminorm. • # Proceedings – Mathematical Sciences Current Issue Volume 129 | Issue 5 November 2019 • # Editorial Note on Continuous Article Publication Posted on July 25, 2019
2019-12-11 09:41:49
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.7487941384315491, "perplexity": 1586.142081840898}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-51/segments/1575540530452.95/warc/CC-MAIN-20191211074417-20191211102417-00197.warc.gz"}
http://pst.hfcas.ac.cn/CN/Y2018/V20/I2/25404
[an error occurred while processing this directive] Plasma Sci. Technol. ›› 2018, Vol. 20 ›› Issue (2): 25404-025404. • 低温等离子体 • ### Feedback model of secondary electron emission in DC gas discharge plasmas • 收稿日期:2017-08-06 出版日期:2018-01-11 发布日期:2017-09-21 ### Feedback model of secondary electron emission in DC gas discharge plasmas Saravanan ARUMUGAM1, Prince ALEX and Suraj Kumar SINHA 1. Department of Physics, Pondicherrry University, Puducherry, 605 014, India • Received:2017-08-06 Online:2018-01-11 Published:2017-09-21 Abstract: Feedback is said to exist in any amplifier when the fraction of output power in fed back as an input. Similarly, in gaseous discharge ions that incident on the cathode act as a natural feedback element to stabilize and self sustain the discharge. The present investigation is intended to emphasize the feedback nature of ions that emits secondary electrons (SEs) from the cathode surface in DC gas discharges. The average number of SEs emitted per incident ion and non ionic species (energetic neutrals, metastables and photons) which results from ion is defined as effective secondary electron emission coefficient (ESEEC,gE). In this study, we derive an analytic expression that corroborates the relation between gE and power influx by ion to the cathode based on the feedback theory of an amplifier. In addition, experimentally, we confirmed the typical positive feedback nature of SEE from the cathode in argon DC glow discharges. The experiment is done for three different cathode material of same dimension (tungsten (W),copper (Cu) and brass) under identical discharge conditions (pressure: 0.45 mbar, cathode bias: -600 V, discharge gab: 15 cm and operating gas: argon). Further, we found that the ?E value of these cathode material controls the amount of feedback power given by ions. The difference in feedback leads different final output i.e the power carried by ion at cathode (P'i∣C). The experimentally obtained value of P'i∣C is 4.28 W, 6.87 W and 9.26 W respectively for W, Cu and brass. In addition, the present investigation reveals that the amount of feedback power in a DC gas discharges not only affect the fraction of power fed back to the cathode but also the entire characteristics of the discharge. [an error occurred while processing this directive]
2020-12-03 16:44:06
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.2828942537307739, "perplexity": 3853.7574745064885}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2020-50/segments/1606141729522.82/warc/CC-MAIN-20201203155433-20201203185433-00338.warc.gz"}