url
stringlengths
14
2.42k
text
stringlengths
100
1.02M
date
stringlengths
19
19
metadata
stringlengths
1.06k
1.1k
https://mathoverflow.net/questions/211122/k%C3%BCnneth-formula-for-bredon-cohomology-theory
# Künneth formula for Bredon cohomology theory Let $G$ be a finite group. Let $X$ and $Y$ be two $G$-CW complexes with known integer graded $G$-equivariant Bredon cohomology with constant coefficient systems. Is there any Künneth formula for this cohomology theory to calculate the cohomology of the $G$-complex $X \times Y$ with constant coefficient systems? In my case, $X$ is a free $G$-space. Any reference will be appreciated. Thank you. • Repeating my comment made in another question, before I saw this one: I don't think I've seen it written out (or done so myself), and it's been a while since I thought about it, but I think it goes like this: If you view Bredon cohomology as Mackey-functor valued, then there's a Kunneth spectral sequence whose $E_2$ term involves Tor groups taken in the category of Mackey functors, i.e., derived functors of the box product. It converges to the cohomology of the product, with appropriate finiteness conditions to get convergence. – Steve Costenoble Jul 10 '15 at 19:39 • Also, this should work when the coefficient system is the Burnside ring Mackey functor; I'm not sure how it needs to be modified for other coefficient systems. – Steve Costenoble Jul 10 '15 at 19:40 • @SteveCostenoble : Thank you for your valuable comments. But it'll be great if you can produce some formula of Kunneth type for constant coefficient sysmtem. – Surojit Ghosh Jul 11 '15 at 9:54 • @SteveCostenoble: Can you please give a proof or reference for RO(G)-graded and Z-graded Kunneth formula with the Burnside ring Mackey functor? – Surojit Ghosh Jul 12 '15 at 7:19 Since $X$ is free, the Bredon cohomology of $X\times Y$ agrees with the usual cohomology of the orbit space. There is a homotopy pullback square $$\begin{array}{ccc} (X\times Y)/G & \rightarrow & Y_{hG} \\ \downarrow & & \downarrow \\ X/G & \rightarrow & BG \end{array}$$ where $Y_{hG}$ denotes the Borel construction, or homotopy orbits. The Eilenberg-Moore spectral sequence of this homotopy pullback square is a Kunneth spectral sequence abutting to what you want, but it starts from the Bredon cohomology of $X$ (which is the same as the usual cohomology of $X/G$) and the cohomology of the Borel construction on $Y$, regarded as modules over $H^*(BG)$. As far as I understand, convergence is not guaranteed either... So this is probably not what you want, but I thought it might be worth mentioning. • :What can you say about the convergence when $X$-is $S(\xi)$? Where $\xi$ is the irreducible representation of $Z/n$ given by multiplication by $e^{2i \pi /n}$ – Surojit Ghosh Jul 13 '15 at 2:54 • Assuming I understand correctly that $G=Z/n$ is acting on the circle $X$ in the standard way, the EMSS seems overkill. In that case $(X\times Y)/G$ is just the mapping torus (see Hatcher Ex. 1.2.11) of the map given by the action of a generator of $G$ on $Y$. The Mayer-Vietoris sequence expresses the cohomology of $(X\times Y)/G$ in terms of the cohomology of $Y$ and the action of a generator of $Z/n$ on $H^*Y$. – Gustavo Granja Jul 13 '15 at 20:55 • There is a natural map $f : S(\xi)_+ \wedge S^V \rightarrow S(\xi^j)_+ \wedge S^V$. Then for what $n$, $\tilde{H}^n_{Z/n}(f)$ is nonzero?Where $V$ is a representation of $Z/n$ and $f(z,v) = (z^j ,v) , z \in S(\xi) , v \in S^V$. – Surojit Ghosh Jul 13 '15 at 23:56 • Your question in the comment above is not addressed by my answer as the domain and range of $f$ are not free $G$-spaces. If this is the question you are interested in, I suggest you rephrase your original question. – Gustavo Granja Jul 14 '15 at 0:06
2019-12-09 03:18:37
{"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.9547814130783081, "perplexity": 196.30107294111318}, "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/1575540517156.63/warc/CC-MAIN-20191209013904-20191209041904-00140.warc.gz"}
http://quant.stackexchange.com/questions?page=52&sort=newest
# All Questions 65 views ### Long-term proportion of convex and concave strategies in artificial financial markets In their classic paper "Dynamic Strategies for Asset Allocation" Perold and Sharpe state: "That convex and concave strategies are mirror images of one another tells us that the more demand there ... 193 views ### European call down and out option (geometric Brownian motion, Monte Carlo, Euler) I need to estimate the expected value and the Greeks of an European call down and out option, assuming geometrical Brownian motion of the asset, with Monte Carlo simulation employing Euler ... 138 views 125 views ### Why is Indian rupee is stable against the USD even though most other currencies weakening? The Indian Rupee (INR) seems fairly stable against the USD (1 USD = 62-64 INR) in the recent times even though most other currencies have weakened against USD, some by 20-30%. Apparently, INR is ... 67 views
2016-07-27 01:55: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": 1, "x-ck12": 0, "texerror": 0, "math_score": 0.8621227741241455, "perplexity": 4988.7385021615855}, "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-2016-30/segments/1469257825358.53/warc/CC-MAIN-20160723071025-00115-ip-10-185-27-174.ec2.internal.warc.gz"}
https://www.physicsforums.com/threads/reducible-polynomials-over-zp.102485/
# Reducible polynomials over Zp. #### math-chick_41 find a formula that depends on p that determines the number of reducible monic degree 2 polynomials over Zp. so the polynomials look like x^2+ax+b with a,b in Zp. I examined the case for Z3 and Z5 to try and see what was going on. in Z3 we had 9 monic degree 2 polynomials, 6 of them were reducible and 3 were not. in Z5 we had 25 monic degree 2's 15 were reducible and 10 were not. it appears that (p(p+1))/2 is the formula but just showing two cases is obviously not enough work. Is my guess right and how on earth would I prove it. thanks! Last edited: Related Calculus and Beyond Homework Help News on Phys.org #### Hurkyl Staff Emeritus Gold Member Well, if you can't figure out how many are irreducible, maybe you can get it indirectly by figuring out how many are reducible? #### math-chick_41 I need to figure out how many are reducible. I only know how to find out how many are irreducible and reducible by plugging and chugging and that is not good enough for proof. #### BerkMath Your formula is not quite correct. The best way to solve this is to find the number of reducible polynomials of the form x^2+ax+b, where a,b are in Z_p, then the number of reducible quadratics, and subtract this from the total number of quadratics. #### Hurkyl Staff Emeritus Gold Member I only know how to find out how many are irreducible and reducible by plugging and chugging and that is not good enough for proof. Then that's what we need to work on. What does it mean for a quadratic polynomial to be reducible? I know of at least two good ways of answering this question, one of which leads to a very easy counting problem, and the other leads to a fairly easy counting problem if you know a little number theory. #### math-chick_41 it can be factored into two one degree polynomials (x-a)(x-b) #### matt grime Homework Helper That'd be the harder one, perhaps. Do you for instance know of a simple transformation of variables that in a degree n polynomial allows you to assume that the coefficient of x^{n-1} is zero? You might not in general, but you certainly know how to do it for degree 2 things, so think back to when you had to try and find roots of quadratics over C and didn't use the quadratic forumla b^2-4ac (or also think how you proved that the quadratic formula is true). #### math-chick_41 to prove the quadratic formula I would just complete the square. should I be looking at the quadratic formula, the b^2-4ac term? #### matt grime Homework Helper ah, the magic words: complete the square... we after all know exactly when we can square root a number.... #### Hurkyl Staff Emeritus Gold Member math-chick_41 said: it can be factored into two one degree polynomials (x-a)(x-b) mattgrime said: That'd be the harder one, perhaps. Actually, I thought otherwise! Counting things of the form (x-a)(x-b) seemed the easiest! #### matt grime Homework Helper Guess I just like legendre symbols which are positive half of the time exactly (ignore the 0 case) #### HallsofIvy Homework Helper You guys are probably confusing the poor girl now- I know you are confusing me! math-chick-41, What matt grime meant (I think!) when he asked "Do you for instance know of a simple transformation of variables that in a degree n polynomial allows you to assume that the coefficient of x^{n-1} is zero? " is that we can always substitute, say, $x= y- \alpha$ and then choose $\alpha$ so that the coefficient of x is 0. That is, x2+ ax+ b can always be written in the form y2- c which is reducible if and only is c is a "perfect square". What percentage of numbers in Zp are squares (including 0 and 1)? (Although if I'm right about this, I'm puzzled by BerkMath's "your formula is not quite correct".) #### math-chick_41 here is what I have, x^2+ax+b over Zp is reducible if we can factor it into (x-s)(x-t) where s,t are in Zp. if s=t then there are p choices for s,t so there are p reducible polynomial. if s is not t then there are p choices for s and p-1 for t and when you switch s and t you get the same polynomial. after that I dont know #### matt grime Homework Helper if you count correctly, then you have counted the number of reducibles, and you know the total number of polys, hence you can work out the number of irreds. of course that is implicitly assuming factorization behaves properly in Z_p, which it does, fortunately. That is probably the best way to count the irreds. Mine complete the sqaure method is the way to actually tell if a given quadratic is reducibly. Last edited: #### BerkMath HallsofIvy said: Carrying out the method I described earlier, you get (p(p-1)^2)/2. ### Physics Forums Values We Value Quality • Topics based on mainstream science • Proper English grammar and spelling We Value Civility • Positive and compassionate attitudes • Patience while debating We Value Productivity • Disciplined to remain on-topic • Recognition of own weaknesses • Solo and co-op problem solving
2019-09-16 02:11: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": 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.7024599313735962, "perplexity": 994.5189182411127}, "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/1568514572471.35/warc/CC-MAIN-20190916015552-20190916041552-00104.warc.gz"}
https://www.physicsforums.com/threads/kinematics-equations-basic.343174/
# Kinematics Equations (Basic) 1. Oct 5, 2009 ### yoyo2112 1. The problem statement, all variables and given/known data Pelicans tuck their winds and free fall straight down when diving for fish. Suppose a pelican starts its dive form a height of 20.0 m and cannot change its path once commited (uniform motion). If it takes a fish 0.1 s to perform evasive action, at what min height must it spot the pelican in order to escape 2. Relevant equations No Clue 3. The attempt at a solution Stumped I have tried in numerous times but was away for a lesson and dont have a clue to what is going on Last edited: Oct 5, 2009 2. Oct 5, 2009 ### rl.bhat Find the time t taken by the pelican to reach the water from 20 m. Then find the distance covered by the pelican in (t - 0.1) seconds. And proceed. 3. Oct 5, 2009 ### 206PiruBlood You will need $$s=y_{i}+v_{i}t+\frac{1}{2}at^{2}$$ How long does it take the pelican to free fall to the water? How much time before that must the fish react? 4. Oct 5, 2009 ### yoyo2112 OO thanks for the reply guys. Do you know where i can get a list of all these equations (kinematics) 5. Oct 5, 2009 ### 206PiruBlood Do you have a textbook?
2018-01-19 23:42: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": 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.5236815214157104, "perplexity": 3626.2870932620453}, "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/1516084888302.37/warc/CC-MAIN-20180119224212-20180120004212-00318.warc.gz"}
http://www.theinfolist.com/html/ALL/s/Complex_number.html
TheInfoList In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and their changes (cal ... , a complex number is an element of a number system A number is a mathematical object A mathematical object is an abstract concept arising in mathematics. In the usual language of mathematics, an ''object'' is anything that has been (or could be) formally defined, and with which one may do deduc ... that contains the real number In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no g ... s and a specific element denoted , called the imaginary unit The imaginary unit or unit imaginary number () is a solution to the quadratic equation In algebra Algebra (from ar, الجبر, lit=reunion of broken parts, bonesetting, translit=al-jabr) is one of the areas of mathematics, broad area ... , and satisfying the equation In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no ge ... . Moreover, every complex number can be expressed in the form , where and are real numbers. Because no real number satisfies the above equation, was called an imaginary number An imaginary number is a complex number In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus ... by René Descartes René Descartes ( or ; ; Latinisation of names, Latinized: Renatus Cartesius; 31 March 1596 – 11 February 1650) was a French philosopher, Mathematics, mathematician, and scientist who invented analytic geometry, linking the previously sep ... . For the complex number , is called the and is called the . The set of complex numbers is denoted by either of the symbols $\mathbb C$ or . Despite the historical nomenclature "imaginary", complex numbers are regarded in the mathematical sciences The mathematical sciences are a group of areas of study that includes, in addition to mathematics, those academic disciplines that are primarily mathematical in nature but may not be universally considered subfields of mathematics proper. Statistic ... as just as "real" as the real numbers and are fundamental in many aspects of the scientific description of the natural world. Complex numbers allow solutions to all polynomial equation In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It h ... s, even those that have no solutions in real numbers. More precisely, the fundamental theorem of algebra The fundamental theorem of algebra states that every non- constant single-variable polynomial In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, s ... asserts that every non-constant polynomial equation with real or complex coefficients has a solution which is a complex number. For example, the equation $\left(x+1\right)^2 = -9$ has no real solution, since the square of a real number cannot be negative, but has the two nonreal complex solutions and . Addition, subtraction and multiplication of complex numbers can be naturally defined by using the rule combined with the associative In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). ... , commutative In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no ge ... and distributive laws. Every nonzero complex number has a multiplicative inverse Image:Hyperbola one over x.svg, thumbnail, 300px, alt=Graph showing the diagrammatic representation of limits approaching infinity, The reciprocal function: . For every ''x'' except 0, ''y'' represents its multiplicative inverse. The graph forms a r ... . This makes the complex numbers a field Field may refer to: Expanses of open ground * Field (agriculture), an area of land used for agricultural purposes * Airfield, an aerodrome that lacks the infrastructure of an airport * Battlefield * Lawn, an area of mowed grass * Meadow, a grassl ... that has the real numbers as a subfield. The complex numbers form also a real vector space Real may refer to: * Reality, the state of things as they exist, rather than as they may appear or may be thought to be Currencies * Brazilian real (R$) * Central American Republic real * Mexican real * Portuguese real * Spanish real * Spanish col ... of dimension two, with as a standard basis In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). ... . This standard basis makes the complex numbers a Cartesian plane A Cartesian coordinate system (, ) in a plane Plane or planes may refer to: * Airplane or aeroplane or informally plane, a powered, fixed-wing aircraft Arts, entertainment and media *Plane (Dungeons & Dragons), Plane (''Dungeons & Dragons'') ... , called the complex plane In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no ge ... . This allows a geometric interpretation of the complex numbers and their operations, and conversely expressing in terms of complex numbers some geometric properties and constructions. For example, the real numbers form the real line In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and ... which is identified to the horizontal axis of the complex plane. The complex numbers of absolute value In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities an ... one form the unit circle In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities a ... . The addition of a complex number is a translation Translation is the communication of the meaning Meaning most commonly refers to: * Meaning (linguistics), meaning which is communicated through the use of language * Meaning (philosophy), definition, elements, and types of meaning discusse ... in the complex plane, and the multiplication by a complex number is a similarity centered at the origin. The complex conjugation In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ... is the reflection symmetry In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities an ... with respect to the real axis. The complex absolute value is a Euclidean norm Euclidean space is the fundamental space of classical geometry. Originally it was the three-dimensional space Three-dimensional space (also: 3-space or, rarely, tri-dimensional space) is a geometric setting in which three values (called pa ... . In summary, the complex numbers form a rich structure that is simultaneously an algebraically closed field In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ... , a commutative algebra Commutative algebra is the branch of algebra Algebra (from ar, الجبر, lit=reunion of broken parts, bonesetting, translit=al-jabr) is one of the areas of mathematics, broad areas of mathematics, together with number theory, geometry ... over the reals, and a Euclidean vector space Euclidean space is the fundamental space of classical geometry. Originally, it was the three-dimensional space Three-dimensional space (also: 3-space or, rarely, tri-dimensional space) is a geometric setting in which three values (called ... of dimension two. Definition A complex number is a number of the form , where and are real numbers Real may refer to: * Reality, the state of things as they exist, rather than as they may appear or may be thought to be Currencies * Brazilian real (R$) * Central American Republic real * Mexican real * Portuguese real * Spanish real * Spanish col ... , and is an indeterminate satisfying . For example, is a complex number. This way, a complex number is defined as a polynomial In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). I ... with real coefficients in the single indeterminate , for which the relation is imposed. Based on this definition, complex numbers can be added and multiplied, using the addition and multiplication for polynomials. The relation induces the equalities and which hold for all integers ; these allow the reduction of any polynomial that results from the addition and multiplication of complex numbers to a linear polynomial in , again of the form with real coefficients The real number is called the ''real part'' of the complex number ; the real number is called its ''imaginary part''. To emphasize, the imaginary part does not include a factor ; that is, the imaginary part is , not . Formally, the complex numbers are defined as the quotient ring In ring theory In algebra, ring theory is the study of ring (mathematics), rings—algebraic structures in which addition and multiplication are defined and have similar properties to those operations defined for the integers. Ring theory studie ... of the polynomial ring In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). ... in the indeterminate , by the ideal Ideal may refer to: Philosophy * Ideal (ethics) An ideal is a principle A principle is a proposition or value that is a guide for behavior or evaluation. In law Law is a system A system is a group of Interaction, interacting ... generated by the polynomial (see below Below may refer to: *Earth *Ground (disambiguation) *Soil *Floor *Bottom (disambiguation) *Less than *Temperatures below freezing *Hell or underworld People with the surname *Fred Below (1926–1988), American blues drummer *Fritz von Below (1853 ... ). Notation A real number can be regarded as a complex number , whose imaginary part is 0. A purely imaginary number An imaginary number is a complex number In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus ... is a complex number , whose real part is zero. As with polynomials, it is common to write for and for . Moreover, when the imaginary part is negative, that is, , it is common to write instead of ; for example, for , can be written instead of . Since the multiplication of the indeterminate and a real is commutative in polynomials with real coefficients, the polynomial may be written as This is often expedient for imaginary parts denoted by expressions, for example, when is a radical. The real part of a complex number is denoted by , $\mathcal\left(z\right)$, or $\mathfrak\left(z\right)$; the imaginary part of a complex number is denoted by , $\mathcal\left(z\right)$, or $\mathfrak\left(z\right).$ For example, $\operatorname(2 + 3i) = 2 \quad \text \quad \operatorname(2 + 3i) = 3~.$ The set of all complex numbers is denoted by $\Complex$ ( blackboard bold Image:Blackboard bold.svg, 250px, An example of blackboard bold letters Blackboard bold is a typeface style that is often used for certain symbols in mathematics, mathematical texts, in which certain lines of the symbol (usually vertical or near-v ... ) or (upright bold). In some disciplines, particularly in electromagnetism Electromagnetism is a branch of physics Physics is the that studies , its , its and behavior through , and the related entities of and . "Physical science is that department of knowledge which relates to the order of nature, or, in ... and electrical engineering Electrical engineering is an engineering discipline concerned with the study, design, and application of equipment, devices, and systems which use electricity, electronics The field of electronics is a branch of physics and electrical enginee ... , is used instead of as is frequently used to represent electric current An electric current is a stream of charged particle In physics Physics (from grc, φυσική (ἐπιστήμη), physikḗ (epistḗmē), knowledge of nature, from ''phýsis'' 'nature'), , is the natural science that studies matter, ... . In these cases, complex numbers are written as , or . Visualization A complex number can thus be identified with an ordered pair In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It h ... $\left(\Re \left(z\right),\Im \left(z\right)\right)$ of real numbers, which in turn may be interpreted as coordinates of a point in a two-dimensional space. The most immediate space is the Euclidean plane with suitable coordinates, which is then called ''complex plane'' or '' Argand diagram,'' named after Jean-Robert ArgandJean-Robert Argand (, , ; July 18, 1768 – August 13, 1822) was an amateur mathematician. In 1806, while managing a bookstore Image:Libraria Carturesti Carusel - Interior ziua.jpg, 250px, Cărturești Carusel, a bookshop in a historical building ... . Another prominent space on which the coordinates may be projected is the two-dimensional surface of a sphere, which is then called Riemann sphere In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ... . Cartesian complex plane The definition of the complex numbers involving two arbitrary real values immediately suggests the use of Cartesian coordinates in the complex plane. The horizontal (''real'') axis is generally used to display the real part, with increasing values to the right, and the imaginary part marks the vertical (''imaginary'') axis, with increasing values upwards. A charted number may be viewed either as the coordinatized point or as a position vector In geometry Geometry (from the grc, γεωμετρία; ''wikt:γῆ, geo-'' "earth", ''wikt:μέτρον, -metron'' "measurement") is, with arithmetic, one of the oldest branches of mathematics. It is concerned with properties of space tha ... from the origin to this point. The coordinate values of a complex number can hence be expressed in its ''Cartesian'', ''rectangular'', or ''algebraic'' form. Notably, the operations of addition and multiplication take on a very natural geometric character, when complex numbers are viewed as position vectors: addition corresponds to vector addition In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). I ... , while multiplication (see below Below may refer to: *Earth *Ground (disambiguation) *Soil *Floor *Bottom (disambiguation) *Less than *Temperatures below freezing *Hell or underworld People with the surname *Fred Below (1926–1988), American blues drummer *Fritz von Below (1853 ... ) corresponds to multiplying their magnitudes and adding the angles they make with the real axis. Viewed in this way, the multiplication of a complex number by corresponds to rotating the position vector counterclockwise Two-dimensional rotation can occur in two possible directions. Clockwise motion (abbreviated CW) proceeds in the same direction as a clock's hands: from the top to the right, then down and then to the left, and back up to the top. The opposite sen ... by a quarter turn Turn may refer to: Arts and entertainment Dance and sports * Turn (dance and gymnastics), rotation of the body * Turn (swimming), reversing direction at the end of a pool * Turn (professional wrestling), a transition between face and heel * Turn, ... () about the origin—a fact which can be expressed algebraically as follows: $(a + bi)\cdot i = ai + b(i)^2 = -b + ai .$ Polar complex plane Modulus and argument An alternative option for coordinates in the complex plane is the polar coordinate system In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and the ... that uses the distance of the point from the origin Origin(s) or The Origin may refer to: Arts, entertainment, and media Comics and manga * Origin (comics), ''Origin'' (comics), a Wolverine comic book mini-series published by Marvel Comics in 2002 * The Origin (Buffy comic), ''The Origin'' (Bu ... (), and the angle subtended between the positive real axisIn mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ha ... and the line segment in a counterclockwise sense. This leads to the polar form :$z=re^=r\left(\cos\varphi +i\sin\varphi\right)$ of a complex numbers, where is the absolute value In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities an ... of , and $\varphi$is the argument In logic Logic is an interdisciplinary field which studies truth and reasoning Reason is the capacity of consciously making sense of things, applying logic Logic (from Ancient Greek, Greek: grc, wikt:λογική, λογική, lab ... . The ''absolute value'' (or ''modulus'' or ''magnitude'') of a complex number is $r=, z, =\sqrt.$ If is a real number (that is, if ), then . That is, the absolute value of a real number equals its absolute value as a complex number. By Pythagoras' theorem In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis) ... , the absolute value of a complex number is the distance to the origin of the point representing the complex number in the complex plane In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no ge ... . The ''argument'' of (in many applications referred to as the "phase" ) is the angle of the radius In classical geometry Geometry (from the grc, γεωμετρία; ' "earth", ' "measurement") is, with , one of the oldest branches of . It is concerned with properties of space that are related with distance, shape, size, and relative ... with the positive real axis, and is written as . As with the modulus, the argument can be found from the rectangular form —by applying the inverse tangent to the quotient of imaginary-by-real parts. By using a half-angle identity, a single branch of the arctan suffices to cover the range of the -function, and avoids a more subtle case-by-case analysis $\varphi = \arg (x+yi) = \begin 2 \arctan\left(\dfrac\right) &\text y \neq 0 \text x > 0, \\ \pi &\text x < 0 \text y = 0, \\ \text &\text x = 0 \text y = 0. \end$ Normally, as given above, the principal value In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and ... in the interval is chosen. If the arg value is negative, values in the range or can be obtained by adding . The value of is expressed in radian The radian, denoted by the symbol \text, is the SI unit The International System of Units, known by the international abbreviation SI in all languages and sometimes pleonastically as the SI system, is the modern form of the metric sy ... s in this article. It can increase by any integer multiple of and still give the same angle, viewed as subtended by the rays of the positive real axis and from the origin through . Hence, the arg function is sometimes considered as . The polar angle for the complex number 0 is indeterminate, but arbitrary choice of the polar angle 0 is common. The value of equals the result of atan2 The function Function or functionality may refer to: Computing * Function key A function key is a key on a computer A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automati ... : $\varphi = \operatorname\left(\operatorname(z),\operatorname(z) \right).$ Together, and give another way of representing complex numbers, the ''polar form'', as the combination of modulus and argument fully specify the position of a point on the plane. Recovering the original rectangular co-ordinates from the polar form is done by the formula called ''trigonometric form'' $z = r(\cos \varphi + i\sin \varphi ).$ Using Euler's formula Euler's formula, named after Leonhard Euler, is a mathematics, mathematical formula in complex analysis that establishes the fundamental relationship between the trigonometric functions and the complex number, complex exponential function. Euler's ... this can be written as $z = r e^ \text z = r \exp i \varphi.$ Using the function, this is sometimes abbreviated to $z = r \operatorname\mathrm \varphi.$ In angle notation, often used in electronics The field of electronics is a branch of physics and electrical engineering that deals with the emission, behaviour and effects of electrons The electron is a subatomic particle In physical sciences, subatomic particles are smaller than ... to represent a phasor In and , a phasor (a of phase vector), is a representing a whose (''A''), (''ω''), and (''θ'') are . It is related to a more general concept called ,Bracewell, Ron. ''The Fourier Transform and Its Applications''. McGraw-Hill, 1965. p2 ... with amplitude and phase , it is written as $z = r \angle \varphi .$ Complex graphs When visualizing complex functions, both a complex input and output are needed. Because each complex number is represented in two dimensions, visually graphing a complex function would require the perception of a four dimensional space A four-dimensional space (4D) is a mathematical extension of the concept of three-dimensional or 3D space. Three-dimensional space is the simplest possible abstraction of the observation that one only needs three numbers, called ''dimensions'', t ... , which is possible only in projections. Because of this, other ways of visualizing complex functions have been designed. In domain coloring In complex analysis of the function . Hue represents the argument, brightness the magnitude. Complex analysis, traditionally known as the theory of functions of a complex variable, is the branch of mathematical analysis that investiga ... the output dimensions are represented by color and brightness, respectively. Each point in the complex plane as domain is ''ornated'', typically with ''color'' representing the argument of the complex number, and ''brightness'' representing the magnitude. Dark spots mark moduli near zero, brighter spots are farther away from the origin, the gradation may be discontinuous, but is assumed as monotonous. The colors often vary in steps of for to from red, yellow, green, cyan, blue, to magenta. These plots are called . This provides a simple way to visualize the functions without losing information. The picture shows zeros for and poles at Riemann surface In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no ge ... s are another way to visualize complex functions. Riemann surfaces can be thought of as deformations of the complex plane; while the horizontal axes represent the real and imaginary inputs, the single vertical axis only represents either the real or imaginary output. However, Riemann surfaces are built in such a way that rotating them 180 degrees shows the imaginary output, and vice versa. Unlike domain coloring, Riemann surfaces can represent multivalued function In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities an ... s like . History trigonometric functions In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and ... ) of a general cubic equation roots A root is the part of a plant that most often lies below the surface of the soil but can also be aerial or aerating, that is, growing up above the ground or especially above water. Root or roots may also refer to: Art, entertainment, a ... , when all three of its roots are real numbers, contains the square roots of negative numbers In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). I ... , a situation that cannot be rectified by factoring aided by the rational root test In algebra Algebra (from ar, الجبر, lit=reunion of broken parts, bonesetting, translit=al-jabr) is one of the areas of mathematics, broad areas of mathematics, together with number theory, geometry and mathematical analysis, analysis. In ... , if the cubic is irreducible; this is the so-called '' casus irreducibilis In algebra Algebra (from ar, الجبر, lit=reunion of broken parts, bonesetting, translit=al-jabr) is one of the areas of mathematics, broad areas of mathematics, together with number theory, geometry and mathematical analysis, analysis. In ... '' ("irreducible case"). This conundrum led Italian mathematician Gerolamo Cardano Gerolamo (also Girolamo or Geronimo) Cardano (; french: link=no, Jérôme Cardan; la, Hieronymus Cardanus; 24 September 1501 (O. S.)– 21 September 1576 (O. S.)) was an Italian polymath A polymath ( el, πολυμαθής, ', "having learn ... to conceive of complex numbers in around 1545 in his ''Ars Magna'', though his understanding was rudimentary; moreover he later dismissed complex numbers as "subtle as they are useless". Work on the problem of general polynomials ultimately led to the fundamental theorem of algebra The fundamental theorem of algebra states that every non- constant single-variable polynomial In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, s ... , which shows that with complex numbers, a solution exists to every polynomial equation In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It h ... of degree one or higher. Complex numbers thus form an algebraically closed field In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ... , where any polynomial equation has a root In vascular plant Vascular plants (from Latin ''vasculum'': duct), also known as Tracheophyta (the tracheophytes , from Greek τραχεῖα ἀρτηρία ''trācheia artēria'' 'windpipe' + φυτά ''phutá'' 'plants'), form a large grou ... . Many mathematicians contributed to the development of complex numbers. The rules for addition, subtraction, multiplication, and root extraction of complex numbers were developed by the Italian mathematician Rafael Bombelli. A more abstract formalism for the complex numbers was further developed by the Irish mathematician William Rowan Hamilton Sir William Rowan Hamilton LL.D, DCL, MRIA (4 August 1805 – 2 September 1865) was an Irish mathematician, Andrews Professor of Astronomy at Trinity College Dublin, Trinity College Dublin, and Dunsink Observatory#Directors, Royal Astronomer ... , who extended this abstraction to the theory of quaternions In mathematics, the quaternion number system extends the complex numbers. Quaternions were first described by Irish mathematician William Rowan Hamilton in 1843 and applied to mechanics in three-dimensional space. Hamilton defined a quaternion a ... . The earliest fleeting reference to square root In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities ... s of negative number In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and ... s can perhaps be said to occur in the work of the Greek mathematician Hero of Alexandria Hero of Alexandria (; grc-gre, Ἥρων ὁ Ἀλεξανδρεύς, ''Heron ho Alexandreus'', also known as Heron of Alexandria ; c. 10 AD – c. 70 AD), was a Greek mathematician and engineer who was active in his native city of Alexandria, R ... in the 1st century , where in his '' Stereometrica'' he considered, apparently in error, the volume of an impossible frustum In geometry Geometry (from the grc, γεωμετρία; ''wikt:γῆ, geo-'' "earth", ''wikt:μέτρον, -metron'' "measurement") is, with arithmetic, one of the oldest branches of mathematics. It is concerned with properties of space th ... of a pyramid A pyramid (from el, πυραμίς ') is a structure A structure is an arrangement and organization of interrelated elements in a material object or system A system is a group of Interaction, interacting or interrelated elements that act ... to arrive at the term $\sqrt = 3i\sqrt$ in his calculations, although negative quantities were not conceived of in Hellenistic mathematics Greek mathematics refers to mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical ... and Hero merely replaced it by its positive $\sqrt = 3\sqrt.$ The impetus to study complex numbers as a topic in itself first arose in the 16th century when algebraic solution An algebraic solution or solution in radicals is a closed-form expression In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra ... s for the roots of cubic Cubic may refer to: Science and mathematics * Cube (algebra) In arithmetic and algebra Algebra (from ar, الجبر, lit=reunion of broken parts, bonesetting, translit=al-jabr) is one of the areas of mathematics, broad areas of mathema ... and quartic polynomial In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). I ... s were discovered by Italian mathematicians (see Niccolò Fontana Tartaglia Niccolò Fontana Tartaglia (; 1499/1500 – 13 December 1557) was an Italian mathematician A mathematician is someone who uses an extensive knowledge of mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such ... , Gerolamo Cardano Gerolamo (also Girolamo or Geronimo) Cardano (; french: link=no, Jérôme Cardan; la, Hieronymus Cardanus; 24 September 1501 (O. S.)– 21 September 1576 (O. S.)) was an Italian polymath A polymath ( el, πολυμαθής, ', "having learn ... ). It was soon realized (but proved much later) that these formulas, even if one was interested only in real solutions, sometimes required the manipulation of square roots of negative numbers. As an example, Tartaglia's formula for a cubic equation of the form gives the solution to the equation as $\tfrac\left(\left(\sqrt\right)^+\left(\sqrt\right)^\right).$ At first glance this looks like nonsense. However, formal calculations with complex numbers show that the equation has three solutions: $-i, \frac, \frac.$ Substituting these in turn for $\sqrt^$ in Tartaglia's cubic formula and simplifying, one gets 0, 1 and −1 as the solutions of . Of course this particular equation can be solved at sight but it does illustrate that when general formulas are used to solve cubic equations with real roots then, as later mathematicians showed rigorously, the use of complex numbers is unavoidable. Rafael Bombelli was the first to address explicitly these seemingly paradoxical solutions of cubic equations and developed the rules for complex arithmetic trying to resolve these issues. The term "imaginary" for these quantities was coined by René Descartes René Descartes ( or ; ; Latinisation of names, Latinized: Renatus Cartesius; 31 March 1596 – 11 February 1650) was a French philosopher, Mathematics, mathematician, and scientist who invented analytic geometry, linking the previously sep ... in 1637, who was at pains to stress their unreal nature A further source of confusion was that the equation $\sqrt^2 = \sqrt\sqrt = -1$ seemed to be capriciously inconsistent with the algebraic identity $\sqrt\sqrt = \sqrt$, which is valid for non-negative real numbers and , and which was also used in complex number calculations with one of , positive and the other negative. The incorrect use of this identity (and the related identity $\frac = \sqrt$) in the case when both and are negative even bedeviled Euler. This difficulty eventually led to the convention of using the special symbol in place of $\sqrt$ to guard against this mistake. Even so, Euler considered it natural to introduce students to complex numbers much earlier than we do today. In his elementary algebra text book, Elements of Algebra ''Elements of Algebra'' is an elementary mathematics 300px, Both groups are equal to 5. Apples are frequently used to explain arithmetic in textbooks for children. Elementary mathematics consists of mathematics Mathematics (from Ancient ... , he introduces these numbers almost at once and then uses them in a natural way throughout. In the 18th century complex numbers gained wider use, as it was noticed that formal manipulation of complex expressions could be used to simplify calculations involving trigonometric functions. For instance, in 1730 Abraham de Moivre Abraham de Moivre (; 26 May 166727 November 1754) was a French mathematician known for de Moivre's formula, a formula that links complex number In mathematics, a complex number is a number that can be expressed in the form , where and are r ... noted that the complicated identities relating trigonometric functions of an integer multiple of an angle to powers of trigonometric functions of that angle could be simply re-expressed by the following well-known formula which bears his name, de Moivre's formula In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ... : $(\cos \theta + i\sin \theta)^ = \cos n \theta + i\sin n \theta.$ In 1748 Leonhard Euler Leonhard Euler ( ; ; 15 April 170718 September 1783) was a Swiss mathematician A mathematician is someone who uses an extensive knowledge of mathematics Mathematics (from Greek: ) includes the study of such topics as numbers ( and ) ... went further and obtained Euler's formula Euler's formula, named after Leonhard Euler, is a mathematics, mathematical formula in complex analysis that establishes the fundamental relationship between the trigonometric functions and the complex number, complex exponential function. Euler's ... of complex analysis Complex analysis, traditionally known as the theory of functions of a complex variable, is the branch of mathematical analysis Analysis is the branch of mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such ... : $\cos \theta + i\sin \theta = e ^$ by formally manipulating complex power series In mathematics, a power series (in one variable) is an infinite series of the form \sum_^\infty a_n \left(x - c\right)^n = a_0 + a_1 (x - c) + a_2 (x - c)^2 + \cdots where ''an'' represents the coefficient of the ''n''th term and ''c'' is a const ... and observed that this formula could be used to reduce any trigonometric identity to much simpler exponential identities. The idea of a complex number as a point in the complex plane ( above) was first described by Denmark, Danish–Norway, Norwegian mathematician Caspar Wessel in 1799, although it had been anticipated as early as 1685 in John Wallis, Wallis's ''A Treatise of Algebra''. Wessel's memoir appeared in the Proceedings of the Copenhagen Academy but went largely unnoticed. In 1806 Jean-Robert ArgandJean-Robert Argand (, , ; July 18, 1768 – August 13, 1822) was an amateur mathematician. In 1806, while managing a bookstore Image:Libraria Carturesti Carusel - Interior ziua.jpg, 250px, Cărturești Carusel, a bookshop in a historical building ... independently issued a pamphlet on complex numbers and provided a rigorous proof of the Fundamental theorem of algebra#History, fundamental theorem of algebra. Carl Friedrich Gauss had earlier published an essentially topology, topological proof of the theorem in 1797 but expressed his doubts at the time about "the true metaphysics of the square root of −1". It was not until 1831 that he overcame these doubts and published his treatise on complex numbers as points in the plane, largely establishing modern notation and terminology. If one formerly contemplated this subject from a false point of view and therefore found a mysterious darkness, this is in large part attributable to clumsy terminology. Had one not called +1, -1, $\sqrt$ positive, negative, or imaginary (or even impossible) units, but instead, say, direct, inverse, or lateral units, then there could scarcely have been talk of such darkness. — Gauss (1831) In the beginning of the 19th century, other mathematicians discovered independently the geometrical representation of the complex numbers: Buée, C. V. Mourey, Mourey, John Warren (mathematician), Warren, Jacques Frédéric Français, Français and his brother, Giusto Bellavitis, Bellavitis. The English mathematician G.H. Hardy remarked that Gauss was the first mathematician to use complex numbers in 'a really confident and scientific way' although mathematicians such as Norway, Norwegian Niels Henrik Abel and Carl Gustav Jacob Jacobi were necessarily using them routinely before Gauss published his 1831 treatise. Augustin Louis Cauchy and Bernhard Riemann together brought the fundamental ideas of #Complex analysis, complex analysis to a high state of completion, commencing around 1825 in Cauchy's case. The common terms used in the theory are chiefly due to the founders. Argand called the ''direction factor'', and $r = \sqrt$ the ''modulus''; Cauchy (1821) called the ''reduced form'' (l'expression réduite) and apparently introduced the term ''argument''; Gauss used for $\sqrt$, introduced the term ''complex number'' for , and called the ''norm''. The expression ''direction coefficient'', often used for , is due to Hankel (1867), and ''absolute value,'' for ''modulus,'' is due to Weierstrass. Later classical writers on the general theory include Richard Dedekind, Otto Hölder, Felix Klein, Henri Poincaré, Hermann Schwarz, Karl Weierstrass and many others. Important work (including a systematization) in complex multivariate calculus has been started at beginning of the 20th century. Important results have been achieved by Wilhelm Wirtinger in 1927. Relations and operations Equality Complex numbers have a similar definition of equality to real numbers; two complex numbers and are equal if and only if both their real and imaginary parts are equal, that is, if and . Nonzero complex numbers written in polar form are equal if and only if they have the same magnitude and their arguments differ by an integer multiple of . Ordering Unlike the real numbers, there is no natural ordering of the complex numbers. In particular, there is no linear ordering on the complex numbers that is compatible with addition and multiplication. Hence, the complex numbers do not have the structure of an ordered field. One explanation for this is that every non-trivial sum of squares in an ordered field#nontrivialSquareSum, ordered field is nonzero, and is a non-trivial sum of squares. Thus, complex numbers are naturally thought of as existing on a two-dimensional plane. Conjugate The ''complex conjugate'' of the complex number is given by . It is denoted by either or . This unary operation on complex numbers cannot be expressed by applying only their basic operations addition, subtraction, multiplication and division. Geometrically, is the reflection symmetry, "reflection" of about the real axis. Conjugating twice gives the original complex number $\overline=z,$ which makes this operation an involution (mathematics), involution. The reflection leaves both the real part and the magnitude of unchanged, that is $\operatorname(\overline) = \operatorname(z)\quad$ and $\quad , \overline, = , z, .$ The imaginary part and the argument of a complex number change their sign under conjugation $\operatorname(\overline) = -\operatorname(z)\quad \text \quad \operatorname \overline \equiv -\operatorname z \pmod .$ For details on argument and magnitude, see the section on #Polar form, Polar form. The product of a complex number and its conjugate is known as the ''absolute square''. It is always a non-negative real number and equals the square of the magnitude of each: $z\cdot \overline = x^2 + y^2 = , z, ^2 = , \overline, ^2.$ This property can be used to convert a fraction with a complex denominator to an equivalent fraction with a real denominator by expanding both numerator and denominator of the fraction by the conjugate of the given denominator. This process is sometimes called "rationalisation (mathematics), rationalization" of the denominator (although the denominator in the final expression might be an irrational real number), because it resembles the method to remove roots from simple expressions in a denominator. The real and imaginary parts of a complex number can be extracted using the conjugation: $\operatorname(z) = \dfrac,\quad \text \quad \operatorname(z) = \dfrac.$ Moreover, a complex number is real if and only if it equals its own conjugate. Conjugation distributes over the basic complex arithmetic operations: $\overline = \overline \pm \overline,$ $\overline = \overline \cdot\overline,\quad \overline = \overline/\overline.$ Conjugation is also employed in inversive geometry, a branch of geometry studying reflections more general than ones about a line. In the Network analysis (electrical circuits), network analysis of electrical circuits, the complex conjugate is used in finding the equivalent impedance when the maximum power transfer theorem is looked for. Two complex numbers and are most easily addition, added by separately adding their real and imaginary parts of the summands. That is to say: $a + b =(x+yi) + (u+vi) = (x+u) + (y+v)i.$ Similarly, subtraction can be performed as $a - b =(x+yi) - (u+vi) = (x-u) + (y-v)i.$ Using the visualization of complex numbers in the complex plane, the addition has the following geometric interpretation: the sum of two complex numbers and , interpreted as points in the complex plane, is the point obtained by building a parallelogram from the three vertices , and the points of the arrows labeled and (provided that they are not on a line). Equivalently, calling these points , , respectively and the fourth point of the parallelogram the triangles and are Congruence (geometry), congruent. A visualization of the subtraction can be achieved by considering addition of the negative subtrahend. Multiplication and square The rules of the distributive property, the commutative property, commutative properties (of addition and multiplication), and the defining property apply to complex numbers. It follows that $(x+yi)\, (u+vi)= (xu - yv) + (xv + yu)i.$ In particular, $(x+yi)^2=x^2-y^2 + 2xyi.$ Reciprocal and division Using the conjugation, the Multiplicative inverse, reciprocal of a nonzero complex number can always be broken down to $\frac=\frac = \frac=\frac=\frac -\fraci,$ since ''non-zero'' implies that is greater than zero. This can be used to express a division of an arbitrary complex number by a non-zero complex number as $\frac = w\cdot \frac = (u+vi)\cdot \left(\frac -\fraci\right)= \frac .$ Multiplication and division in polar form Formulas for multiplication, division and exponentiation are simpler in polar form than the corresponding formulas in Cartesian coordinates. Given two complex numbers and , because of the trigonometric identities $\begin \cos a \cos b & - \sin a \sin b \,& = \,& \cos(a + b) \\ \cos a \sin b & + \sin a \cos b \,& = \,& \sin(a + b) . \end$ we may derive $z_1 z_2 = r_1 r_2 (\cos(\varphi_1 + \varphi_2) + i \sin(\varphi_1 + \varphi_2)).$ In other words, the absolute values are multiplied and the arguments are added to yield the polar form of the product. For example, multiplying by corresponds to a quarter- turn Turn may refer to: Arts and entertainment Dance and sports * Turn (dance and gymnastics), rotation of the body * Turn (swimming), reversing direction at the end of a pool * Turn (professional wrestling), a transition between face and heel * Turn, ... counter-clockwise, which gives back . The picture at the right illustrates the multiplication of $(2+i)(3+i)=5+5i.$ Since the real and imaginary part of are equal, the argument of that number is 45 degrees, or (in radian The radian, denoted by the symbol \text, is the SI unit The International System of Units, known by the international abbreviation SI in all languages and sometimes pleonastically as the SI system, is the modern form of the metric sy ... ). On the other hand, it is also the sum of the angles at the origin of the red and blue triangles are arctan(1/3) and arctan(1/2), respectively. Thus, the formula $\frac = \arctan\left(\frac\right) + \arctan\left(\frac\right)$ holds. As the arctan function can be approximated highly efficiently, formulas like this – known as Machin-like formulas – are used for high-precision approximations of pi, . Similarly, division is given by $\frac = \frac \left(\cos(\varphi_1 - \varphi_2) + i \sin(\varphi_1 - \varphi_2)\right).$ Square root The square roots of (with ) are $\pm \left(\gamma + \delta i\right)$, where $\gamma = \sqrt$ and $\delta = (\sgn b)\sqrt,$ where is the sign function, signum function. This can be seen by squaring $\pm \left(\gamma + \delta i\right)$ to obtain . Here $\sqrt$ is called the absolute value, modulus of , and the square root sign indicates the square root with non-negative real part, called the principal square root; also $\sqrt= \sqrt,$ where . Exponential function The exponential function $\exp \colon \Complex \to \Complex ; z \mapsto \exp z$ can be defined for every complex number by the power series In mathematics, a power series (in one variable) is an infinite series of the form \sum_^\infty a_n \left(x - c\right)^n = a_0 + a_1 (x - c) + a_2 (x - c)^2 + \cdots where ''an'' represents the coefficient of the ''n''th term and ''c'' is a const ... $\exp z= \sum_^\infty \frac ,$ which has an infinite radius of convergence. The value at of the exponential function is Euler's number $e = \exp 1 = \sum_^\infty \frac1\approx 2.71828.$ If is real, one has $\exp z=e^z.$ Analytic continuation allows extending this equality for every complex value of , and thus to define the complex exponentiation with base as $e^z=\exp z.$ Functional equation The exponential function satisfies the functional equation $e^=e^ze^t.$ This can be proved either by comparing the power series expansion of both members or by applying analytic continuation from the restriction of the equation to real arguments. Euler's formula Euler's formula Euler's formula, named after Leonhard Euler, is a mathematics, mathematical formula in complex analysis that establishes the fundamental relationship between the trigonometric functions and the complex number, complex exponential function. Euler's ... states that, for any real number , $e^ = \cos y + i\sin y .$ The functional equation implies thus that, if and are real, one has $e^ = e^x(\cos y + i\sin y) = e^x \cos y + i e^x \sin y ,$ which is the decomposition of the exponential function into its real and imaginary parts. Complex logarithm In the real case, the natural logarithm can be defined as the inverse function, inverse $\ln \colon \R^+ \to \R ; x \mapsto \ln x$ of the exponential function. For extending this to the complex domain, one can start from Euler's formula. It implies that, if a complex number $z\in \Complex^\times$ is written in polar form $z = r(\cos \varphi + i\sin \varphi )$ with $r, \varphi \in \R ,$ then with $\ln z = \ln r + i \varphi$ as complex logarithm one has a proper inverse: $\exp \ln z = \exp(\ln r + i \varphi ) = r \exp i \varphi = r(\cos \varphi + i\sin \varphi ) = z .$ However, because cosine and sine are periodic functions, the addition of an integer multiple of to does not change . For example, , so both and are possible values for the natural logarithm of . Therefore, if the complex logarithm is not to be defined as a multivalued function In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities an ... $\ln z = \left\,$ one has to use a branch cut and to restrict the codomain, resulting in the bijective function $\ln \colon \; \Complex^\times \; \to \; \; \; \R^+ + \; i \, \left(-\pi, \pi\right] .$ If $z \in \Complex \setminus \left\left( -\R_ \right\right)$ is not a non-positive real number (a positive or a non-real number), the resulting principal value In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and ... of the complex logarithm is obtained with . It is an analytic function outside the negative real numbers, but it cannot be prolongated to a function that is continuous at any negative real number $z \in -\R^+$, where the principal value is . Exponentiation If is real and complex, the exponentiation is defined as $x^z=e^,$ where denotes the natural logarithm. It seems natural to extend this formula to complex values of , but there are some difficulties resulting from the fact that the complex logarithm is not really a function, but a multivalued function In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities an ... . It follows that if is as above, and if is another complex number, then the ''exponentiation'' is the multivalued function $z^t=\left\\mid k\in \mathbb Z\right\}$ Integer and fractional exponents If, in the preceding formula, is an integer, then the sine and the cosine are independent of . Thus, if the exponent is an integer, then is well defined, and the exponentiation formula simplifies to de Moivre's formula In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ... : $z^=(r(\cos \varphi + i\sin \varphi ))^n = r^n \, (\cos n\varphi + i \sin n \varphi).$ The nth root, th roots of a complex number are given by $z^ = \sqrt[n]r \left( \cos \left(\frac\right) + i \sin \left(\frac\right)\right)$ for . (Here $\sqrt\left[n\right]r$ is the usual (positive) th root of the positive real number .) Because sine and cosine are periodic, other integer values of do not give other values. While the th root of a positive real number is chosen to be the ''positive'' real number satisfying , there is no natural way of distinguishing one particular complex th root of a complex number. Therefore, the th root is a multivalued function, -valued function of . This implies that, contrary to the case of positive real numbers, one has $(z^n)^ \ne z,$ since the left-hand side consists of values, and the right-hand side is a single value. Properties Field structure The set $\Complex$ of complex numbers is a field Field may refer to: Expanses of open ground * Field (agriculture), an area of land used for agricultural purposes * Airfield, an aerodrome that lacks the infrastructure of an airport * Battlefield * Lawn, an area of mowed grass * Meadow, a grassl ... .See , pages 15–16. Briefly, this means that the following facts hold: first, any two complex numbers can be added and multiplied to yield another complex number. Second, for any complex number , its additive inverse is also a complex number; and third, every nonzero complex number has a Multiplicative inverse, reciprocal complex number. Moreover, these operations satisfy a number of laws, for example the law of commutativity of addition and multiplication for any two complex numbers and : $\begin z_1 + z_2 & = z_2 + z_1 ,\\ z_1 z_2 & = z_2 z_1 . \end$ These two laws and the other requirements on a field can be proven by the formulas given above, using the fact that the real numbers themselves form a field. Unlike the reals, $\Complex$ is not an ordered field, that is to say, it is not possible to define a relation that is compatible with the addition and multiplication. In fact, in any ordered field, the square of any element is necessarily positive, so precludes the existence of an total order, ordering on $\Complex.$ When the underlying field for a mathematical topic or construct is the field of complex numbers, the topic's name is usually modified to reflect that fact. For example: complex analysis Complex analysis, traditionally known as the theory of functions of a complex variable, is the branch of mathematical analysis Analysis is the branch of mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such ... , complex matrix (mathematics), matrix, complex polynomial In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). I ... , and complex Lie algebra. Solutions of polynomial equations Given any complex numbers (called coefficients) , the equation $a_n z^n + \dotsb + a_1 z + a_0 = 0$ has at least one complex solution ''z'', provided that at least one of the higher coefficients is nonzero. This is the statement of the '' fundamental theorem of algebra The fundamental theorem of algebra states that every non- constant single-variable polynomial In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, s ... '', of Carl Friedrich Gauss and Jean le Rond d'Alembert. Because of this fact, $\Complex$ is called an algebraically closed field In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ... . This property does not hold for the rational number, field of rational numbers $\Q$ (the polynomial does not have a rational root, since square root of 2, √2 is not a rational number) nor the real numbers $\R$ (the polynomial does not have a real root for , since the square of is positive for any real number ). There are various proofs of this theorem, by either analytic methods such as Liouville's theorem (complex analysis), Liouville's theorem, or topology, topological ones such as the winding number, or a proof combining Galois theory and the fact that any real polynomial of ''odd'' degree has at least one real root. Because of this fact, theorems that hold ''for any algebraically closed field'' apply to $\Complex.$ For example, any non-empty complex square matrix has at least one (complex) eigenvalue. Algebraic characterization The field $\Complex$ has the following three properties: * First, it has characteristic (algebra), characteristic 0. This means that for any number of summands (all of which equal one). * Second, its transcendence degree over $\Q$, the prime field of $\Complex,$ is the cardinality of the continuum. * Third, it is algebraically closed (see above). It can be shown that any field having these properties is isomorphic (as a field) to $\Complex.$ For example, the algebraic closure of the field $\Q_p$ of the p-adic number, -adic number also satisfies these three properties, so these two fields are isomorphic (as fields, but not as topological fields). Also, $\Complex$ is isomorphic to the field of complex Puiseux series. However, specifying an isomorphism requires the axiom of choice. Another consequence of this algebraic characterization is that $\Complex$ contains many proper subfields that are isomorphic to $\Complex$. Characterization as a topological field The preceding characterization of $\Complex$ describes only the algebraic aspects of $\Complex.$ That is to say, the properties of neighborhood (topology), nearness and continuity (topology), continuity, which matter in areas such as Mathematical analysis, analysis and topology, are not dealt with. The following description of $\Complex$ as a topological ring, topological field (that is, a field that is equipped with a topological space, topology, which allows the notion of convergence) does take into account the topological properties. $\Complex$ contains a subset (namely the set of positive real numbers) of nonzero elements satisfying the following three conditions: * is closed under addition, multiplication and taking inverses. * If and are distinct elements of , then either or is in . * If is any nonempty subset of , then for some in $\Complex.$ Moreover, $\Complex$ has a nontrivial involution (mathematics), involutive automorphism (namely the complex conjugation), such that is in for any nonzero in $\Complex.$ Any field with these properties can be endowed with a topology by taking the sets as a base (topology), base, where ranges over the field and ranges over . With this topology is isomorphic as a ''topological'' field to $\Complex.$ The only connected space, connected locally compact topological ring, topological fields are $\R$ and $\Complex.$ This gives another characterization of $\Complex$ as a topological field, since $\Complex$ can be distinguished from $\R$ because the nonzero complex numbers are connected space, connected, while the nonzero real numbers are not. Formal construction Construction as ordered pairs William Rowan Hamilton Sir William Rowan Hamilton LL.D, DCL, MRIA (4 August 1805 – 2 September 1865) was an Irish mathematician, Andrews Professor of Astronomy at Trinity College Dublin, Trinity College Dublin, and Dunsink Observatory#Directors, Royal Astronomer ... introduced the approach to define the set $\Complex$ of complex numbers as the set $\mathbb^2$ of of real numbers, in which the following rules for addition and multiplication are imposed: $\begin (a, b) + (c, d) &= (a + c, b + d)\\ (a, b) \cdot (c, d) &= (ac - bd, bc + ad). \end$ It is then just a matter of notation to express as . Construction as a quotient field Though this low-level construction does accurately describe the structure of the complex numbers, the following equivalent definition reveals the algebraic nature of $\Complex$ more immediately. This characterization relies on the notion of fields and polynomials. A field is a set endowed with addition, subtraction, multiplication and division operations that behave as is familiar from, say, rational numbers. For example, the distributive law $(x+y) z = xz + yz$ must hold for any three elements , and of a field. The set $\R$ of real numbers does form a field. A polynomial with real coefficients is an expression of the form $a_nX^n+\dotsb+a_1X+a_0,$ where the are real numbers. The usual addition and multiplication of polynomials endows the set $\R\left[X\right]$ of all such polynomials with a ring (mathematics), ring structure. This ring is called the polynomial ring In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). ... over the real numbers. The set of complex numbers is defined as the quotient ring In ring theory In algebra, ring theory is the study of ring (mathematics), rings—algebraic structures in which addition and multiplication are defined and have similar properties to those operations defined for the integers. Ring theory studie ... $\R\left[X\right]/\left(X^2+1\right).$ This extension field contains two square roots of , namely (the cosets of) and , respectively. (The cosets of) and form a basis of as a real vector space, which means that each element of the extension field can be uniquely written as a linear combination in these two elements. Equivalently, elements of the extension field can be written as ordered pairs of real numbers. The quotient ring is a field, because is Irreducible polynomial, irreducible over $\R,$ so the ideal it generates is Maximal ideal, maximal. The formulas for addition and multiplication in the ring $\R\left[X\right],$ modulo the relation , correspond to the formulas for addition and multiplication of complex numbers defined as ordered pairs. So the two definitions of the field $\Complex$ are isomorphism, isomorphic (as fields). Accepting that $\Complex$ is algebraically closed, since it is an algebraic extension of $\mathbb$ in this approach, $\Complex$ is therefore the algebraic closure of $\R.$ Matrix representation of complex numbers Complex numbers can also be represented by matrix (mathematics), matrices that have the form: $\begin a & -b \\ b & \;\; a \end$ Here the entries and are real numbers. As the sum and product of two such matrices is again of this form, these matrices form a subring of the ring matrices. A simple computation shows that the map: $a+ib\mapsto \begin a & -b \\ b & \;\; a \end$ is a ring isomorphism from the field of complex numbers to the ring of these matrices. This isomorphism associates the square of the absolute value of a complex number with the determinant of the corresponding matrix, and the conjugate of a complex number with the transpose of the matrix. The geometric description of the multiplication of complex numbers can also be expressed in terms of rotation matrix, rotation matrices by using this correspondence between complex numbers and such matrices. The action of the matrix on a vector corresponds to the multiplication of by . In particular, if the determinant is , there is a real number such that the matrix has the form: $\begin r\cos t & - r\sin t \\ r\sin t & \;\; r\cos t \end$ In this case, the action of the matrix on vectors and the multiplication by the complex number $\cos t+i\sin t$ are both the rotation (mathematics), rotation of the angle . Complex analysis The study of functions of a complex variable is known as complex analysis Complex analysis, traditionally known as the theory of functions of a complex variable, is the branch of mathematical analysis Analysis is the branch of mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such ... and has enormous practical use in applied mathematics as well as in other branches of mathematics. Often, the most natural proofs for statements in real analysis or even number theory employ techniques from complex analysis (see prime number theorem for an example). Unlike real functions, which are commonly represented as two-dimensional graphs, complex functions have four-dimensional graphs and may usefully be illustrated by color-coding a graph of a function of two variables, three-dimensional graph to suggest four dimensions, or by animating the complex function's dynamic transformation of the complex plane. Complex exponential and related functions The notions of convergent series and continuous functions in (real) analysis have natural analogs in complex analysis. A sequence of complex numbers is said to convergent sequence, converge if and only if its real and imaginary parts do. This is equivalent to the (ε, δ)-definition of limits, where the absolute value of real numbers is replaced by the one of complex numbers. From a more abstract point of view, $\mathbb$, endowed with the metric (mathematics), metric $\operatorname(z_1, z_2) = , z_1 - z_2,$ is a complete metric space, which notably includes the triangle inequality $, z_1 + z_2, \le , z_1, + , z_2,$ for any two complex numbers and . Like in real analysis, this notion of convergence is used to construct a number of elementary functions: the ''exponential function'' , also written , is defined as the infinite series $\exp z:= 1+z+\frac+\frac+\cdots = \sum_^ \frac.$ The series defining the real trigonometric functions sine and cosine, as well as the hyperbolic functions sinh and cosh, also carry over to complex arguments without change. For the other trigonometric and hyperbolic functions, such as tangent (function), tangent, things are slightly more complicated, as the defining series do not converge for all complex values. Therefore, one must define them either in terms of sine, cosine and exponential, or, equivalently, by using the method of analytic continuation. '' Euler's formula Euler's formula, named after Leonhard Euler, is a mathematics, mathematical formula in complex analysis that establishes the fundamental relationship between the trigonometric functions and the complex number, complex exponential function. Euler's ... '' states: $\exp(i\varphi) = \cos \varphi + i\sin \varphi$ for any real number , in particular $\exp(i \pi) = -1$, which is Euler's identity. Unlike in the situation of real numbers, there is an infinite set, infinitude of complex solutions of the equation $\exp z = w$ for any complex number . It can be shown that any such solution – called complex logarithm of – satisfies $\log w = \ln, w, + i\arg w,$ where arg is the arg (mathematics), argument defined #Polar form, above, and ln the (real) natural logarithm. As arg is a multivalued function In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities an ... , unique only up to a multiple of , log is also multivalued. The principal value In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and ... of log is often taken by restricting the imaginary part to the interval (mathematics), interval . Complex exponentiation is defined as $z^\omega = \exp(\omega \log z),$ and is multi-valued, except when is an integer. For , for some natural number , this recovers the non-uniqueness of th roots mentioned above. Complex numbers, unlike real numbers, do not in general satisfy the unmodified power and logarithm identities, particularly when naïvely treated as single-valued functions; see Exponentiation#Failure of power and logarithm identities, failure of power and logarithm identities. For example, they do not satisfy $a^ = \left(a^b\right)^c.$ Both sides of the equation are multivalued by the definition of complex exponentiation given here, and the values on the left are a subset of those on the right. Holomorphic functions A function ''f'': $\mathbb$$\mathbb$ is called Holomorphic function, holomorphic if it satisfies the Cauchy–Riemann equations. For example, any Linear transformation#Definition and first consequences, $\mathbb$-linear map $\mathbb$$\mathbb$ can be written in the form $f(z)=az+b\overline$ with complex coefficients and . This map is holomorphic if and only if . The second summand $b \overline z$ is real-differentiable, but does not satisfy the Cauchy–Riemann equations. Complex analysis shows some features not apparent in real analysis. For example, any two holomorphic functions and that agree on an arbitrarily small open subset of $\mathbb$ necessarily agree everywhere. Meromorphic functions, functions that can locally be written as with a holomorphic function , still share some of the features of holomorphic functions. Other functions have essential singularity, essential singularities, such as at . Applications Complex numbers have applications in many scientific areas, including signal processing, control theory, electromagnetism Electromagnetism is a branch of physics Physics is the that studies , its , its and behavior through , and the related entities of and . "Physical science is that department of knowledge which relates to the order of nature, or, in ... , fluid dynamics, quantum mechanics, cartography, and Vibration#Vibration analysis, vibration analysis. Some of these applications are described below. Geometry Shapes Three collinearity, non-collinear points $u, v, w$ in the plane determine the Shape#Similarity classes, shape of the triangle $\$. Locating the points in the complex plane, this shape of a triangle may be expressed by complex arithmetic as $S(u, v, w) = \frac .$ The shape $S$ of a triangle will remain the same, when the complex plane is transformed by translation or dilation (by an affine transformation), corresponding to the intuitive notion of shape, and describing similarity. Thus each triangle $\$ is in a shape#Similarity classes, similarity class of triangles with the same shape. Fractal geometry The Mandelbrot set is a popular example of a fractal formed on the complex plane. It is defined by plotting every location $c$ where iterating the sequence $f_c\left(z\right)=z^2+c$ does not diverge (stability theory), diverge when Iteration, iterated infinitely. Similarly, Julia sets have the same rules, except where $c$ remains constant. Triangles Every triangle has a unique Steiner inellipse – an ellipse inside the triangle and tangent to the midpoints of the three sides of the triangle. The Focus (geometry), foci of a triangle's Steiner inellipse can be found as follows, according to Marden's theorem: Denote the triangle's vertices in the complex plane as , , and . Write the cubic equation roots A root is the part of a plant that most often lies below the surface of the soil but can also be aerial or aerating, that is, growing up above the ground or especially above water. Root or roots may also refer to: Art, entertainment, a ... $\left(x-a\right)\left(x-b\right)\left(x-c\right)=0$, take its derivative, and equate the (quadratic) derivative to zero. Marden's Theorem says that the solutions of this equation are the complex numbers denoting the locations of the two foci of the Steiner inellipse. Algebraic number theory As mentioned above, any nonconstant polynomial equation (in complex coefficients) has a solution in $\mathbb$. ''Argumentum a fortiori, A fortiori'', the same is true if the equation has rational coefficients. The roots of such equations are called algebraic numbers – they are a principal object of study in algebraic number theory. Compared to $\overline$, the algebraic closure of $\mathbb$, which also contains all algebraic numbers, $\mathbb$ has the advantage of being easily understandable in geometric terms. In this way, algebraic methods can be used to study geometric questions and vice versa. With algebraic methods, more specifically applying the machinery of field theory (mathematics), field theory to the number field containing root of unity, roots of unity, it can be shown that it is not possible to construct a regular nonagon compass and straightedge constructions, using only compass and straightedge – a purely geometric problem. Another example is the Gaussian integers; that is, numbers of the form , where and are integers, which can be used to classify Fermat's theorem on sums of two squares, sums of squares. Analytic number theory Analytic number theory studies numbers, often integers or rationals, by taking advantage of the fact that they can be regarded as complex numbers, in which analytic methods can be used. This is done by encoding number-theoretic information in complex-valued functions. For example, the Riemann zeta function is related to the distribution of prime numbers. Improper integrals In applied fields, complex numbers are often used to compute certain real-valued improper integrals, by means of complex-valued functions. Several methods exist to do this; see methods of contour integration. Dynamic equations In differential equations, it is common to first find all complex roots of the Linear differential equation#Homogeneous equations with constant coefficients, characteristic equation of a linear differential equation or equation system and then attempt to solve the system in terms of base functions of the form . Likewise, in difference equations, the complex roots of the characteristic equation of the difference equation system are used, to attempt to solve the system in terms of base functions of the form . Linear Algebra Eigendecomposition of a matrix, Eigendecomposition is a useful tool for computing matrix powers and Matrix exponential, matrix exponentials. However, it often requires the use of complex numbers, even if the matrix is real (for example, a rotation matrix). Complex numbers often generalize concepts originally conceived in the real numbers. For example, the conjugate transpose generalizes the transpose, Hermitian matrix, hermitian matrices generalize Symmetric matrix, symmetric matrices, and Unitary matrix, unitary matrices generalize Orthogonal matrix, orthogonal matrices. In applied mathematics Control theory In control theory, systems are often transformed from the time domain to the frequency domain using the Laplace transform. The system's zeros and poles are then analyzed in the ''complex plane''. The root locus, Nyquist plot, and Nichols plot techniques all make use of the complex plane. In the root locus method, it is important whether zeros and poles are in the left or right half planes, that is, have real part greater than or less than zero. If a linear, time-invariant (LTI) system has poles that are * in the right half plane, it will be unstable, * all in the left half plane, it will be BIBO stability, stable, * on the imaginary axis, it will have marginal stability. If a system has zeros in the right half plane, it is a nonminimum phase system. Signal analysis Complex numbers are used in signal analysis and other fields for a convenient description for periodically varying signals. For given real functions representing actual physical quantities, often in terms of sines and cosines, corresponding complex functions are considered of which the real parts are the original quantities. For a sine wave of a given frequency, the absolute value of the corresponding is the amplitude and the Argument (complex analysis), argument is the phase (waves), phase. If Fourier analysis is employed to write a given real-valued signal as a sum of periodic functions, these periodic functions are often written as complex-valued functions of the form $x(t) = \operatorname \$ and $X( t ) = A e^ = a e^ e^ = a e^$ where ω represents the angular frequency and the complex number ''A'' encodes the phase and amplitude as explained above. This use is also extended into digital signal processing and digital image processing, which utilize digital versions of Fourier analysis (and wavelet analysis) to transmit, Data compression, compress, restore, and otherwise process Digital data, digital Sound, audio signals, still images, and video signals. Another example, relevant to the two side bands of amplitude modulation of AM radio, is: $\begin \cos((\omega + \alpha)t) + \cos\left((\omega - \alpha)t\right) & = \operatorname\left(e^ + e^\right) \\ & = \operatorname\left(\left(e^ + e^\right) \cdot e^\right) \\ & = \operatorname\left(2\cos(\alpha t) \cdot e^\right) \\ & = 2 \cos(\alpha t) \cdot \operatorname\left(e^\right) \\ & = 2 \cos(\alpha t) \cdot \cos\left(\omega t\right). \end$ In physics Electromagnetism and electrical engineering In electrical engineering Electrical engineering is an engineering discipline concerned with the study, design, and application of equipment, devices, and systems which use electricity, electronics The field of electronics is a branch of physics and electrical enginee ... , the Fourier transform is used to analyze varying voltages and Electric current, currents. The treatment of resistors, capacitors, and inductors can then be unified by introducing imaginary, frequency-dependent resistances for the latter two and combining all three in a single complex number called the Electrical impedance, impedance. This approach is called phasor calculus. In electrical engineering, the imaginary unit is denoted by , to avoid confusion with , which is generally in use to denote electric current An electric current is a stream of charged particle In physics Physics (from grc, φυσική (ἐπιστήμη), physikḗ (epistḗmē), knowledge of nature, from ''phýsis'' 'nature'), , is the natural science that studies matter, ... , or, more particularly, , which is generally in use to denote instantaneous electric current. Since the voltage in an AC electric circuit, circuit is oscillating, it can be represented as $V(t) = V_0 e^ = V_0 \left (\cos\omega t + j \sin\omega t \right ),$ To obtain the measurable quantity, the real part is taken: $v(t) = \operatorname(V) = \operatorname\left [ V_0 e^ \right ] = V_0 \cos \omega t.$ The complex-valued signal is called the analytic signal, analytic representation of the real-valued, measurable signal . Fluid dynamics In fluid dynamics, complex functions are used to describe potential flow in two dimensions. Quantum mechanics The complex number field is intrinsic to the mathematical formulations of quantum mechanics, where complex Hilbert spaces provide the context for one such formulation that is convenient and perhaps most standard. The original foundation formulas of quantum mechanics – the Schrödinger equation and Heisenberg's matrix mechanics – make use of complex numbers. Relativity In special relativity, special and general relativity, some formulas for the metric on spacetime become simpler if one takes the time component of the spacetime continuum to be imaginary. (This approach is no longer standard in classical relativity, but is Wick rotation, used in an essential way in quantum field theory.) Complex numbers are essential to spinors, which are a generalization of the tensors used in relativity. Generalizations and related notions The process of extending the field $\mathbb R$ of reals to $\mathbb C$ is known as the Cayley–Dickson construction. It can be carried further to higher dimensions, yielding the quaternions $\mathbb H$ and octonions $\mathbb$ which (as a real vector space) are of dimension 4 and 8, respectively. In this context the complex numbers have been called the binarions. Just as by applying the construction to reals the property of ordered field, ordering is lost, properties familiar from real and complex numbers vanish with each extension. The quaternions lose commutativity, that is, for some quaternions , and the multiplication of octonions, additionally to not being commutative, fails to be associative: for some octonions . Reals, complex numbers, quaternions and octonions are all normed division algebras over $\mathbb R$. By Hurwitz's theorem (normed division algebras), Hurwitz's theorem they are the only ones; the sedenions, the next step in the Cayley–Dickson construction, fail to have this structure. The Cayley–Dickson construction is closely related to the regular representation of $\mathbb C,$ thought of as an $\mathbb R$-Algebra (ring theory), algebra (an -vector space with a multiplication), with respect to the basis . This means the following: the $\mathbb R$-linear map $\begin \mathbb &\rightarrow \mathbb \\ z &\mapsto wz \end$ for some fixed complex number can be represented by a matrix (once a basis has been chosen). With respect to the basis , this matrix is $\begin \operatorname(w) & -\operatorname(w) \\ \operatorname(w) & \operatorname(w) \end,$ that is, the one mentioned in the section on matrix representation of complex numbers above. While this is a linear representation of $\mathbb C$ in the 2 × 2 real matrices, it is not the only one. Any matrix $J = \beginp & q \\ r & -p \end, \quad p^2 + qr + 1 = 0$ has the property that its square is the negative of the identity matrix: . Then $\$ is also isomorphic to the field $\mathbb C,$ and gives an alternative complex structure on $\mathbb R^2.$ This is generalized by the notion of a linear complex structure. Hypercomplex numbers also generalize $\mathbb R,$ $\mathbb C,$ $\mathbb H,$ and $\mathbb.$ For example, this notion contains the split-complex numbers, which are elements of the ring $\mathbb R\left[x\right]/\left(x^2-1\right)$ (as opposed to $\mathbb R\left[x\right]/\left(x^2+1\right)$ for complex numbers). In this ring, the equation has four solutions. The field $\mathbb R$ is the completion of $\mathbb Q,$ the field of rational numbers, with respect to the usual absolute value In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities an ... metric (mathematics), metric. Other choices of metric (mathematics), metrics on $\mathbb Q$ lead to the fields $\mathbb Q_p$ of p-adic number, -adic numbers (for any prime number ), which are thereby analogous to . There are no other nontrivial ways of completing $\mathbb Q$ than $\mathbb R$ and $\mathbb Q_p,$ by Ostrowski's theorem. The algebraic closures $\overline$ of $\mathbb Q_p$ still carry a norm, but (unlike $\mathbb C$) are not complete with respect to it. The completion $\mathbb_p$ of $\overline$ turns out to be algebraically closed. By analogy, the field is called -adic complex numbers. The fields $\mathbb R,$ $\mathbb Q_p,$ and their finite field extensions, including $\mathbb C,$ are called local fields. * Algebraic surface * Circular motion#Using complex numbers, Circular motion using complex numbers * Complex-base system * Complex geometry * Dual-complex number * Eisenstein integer * Euler's identity * Geometric algebra#Unit pseudoscalars, Geometric algebra (which includes the complex plane as the 2-dimensional Spinor#Two dimensions, spinor subspace $\mathcal_2^+$) * Unit complex number * * *
2022-05-27 14:54:39
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 205, "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.8740392923355103, "perplexity": 710.9336243189454}, "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-2022-21/segments/1652662658761.95/warc/CC-MAIN-20220527142854-20220527172854-00314.warc.gz"}
http://clay6.com/qa/26958/find-the-centroid-of-the-triangle-formed-by-the-feet-of-the-three-normal-li
Browse Questions # Find the centroid of the triangle formed by the feet of the three normal lies on the axis of parabola? $\begin{array}{1 1}(a)\;(\large\frac{2h-4a}{3},\normalsize 0)\\(b)\;(\large\frac{2h-2a}{3},\normalsize 1)\\(c)\;(\large\frac{3h-4a}{3},\normalsize 3)\\(d)\;(\large\frac{2h+4a}{3},\normalsize 1)\end{array}$ If $A(x_1,y_1),B(x_2,y_2)$ and $C(x_3,y_3)$ be vertices of $\Delta ABC$ then its centroid is $\big(\large\frac{x_1+x_2+x_3}{3},\frac{y_1+y_2+y_3}{3})$ Here $y_1+y_2+y_3=0$ $y_1=-2am_1,y_2=-2am_2,y_3=-2am_3$ $y_1+y_2+y_3=-2a(m_1+m_2+m_3)$ $m_1+m_2+m_3=0$ So centroid of $\Delta ABC\Rightarrow (\large\frac{x_1+x_2+x_3}{3},$$0) Now \large\frac{x_1+x_2+x_3}{3}=\frac{a}{3}$$(m_1^2+m_2^2+m_3^2)$ $\Rightarrow \large\frac{a}{3}$$[(m_1+m_2+m_3)^2-2(m_1m_2+m_2m_3+m_3m_1)] \Rightarrow \large\frac{a}{3}$$[0-2\times \big(\large\frac{2a-h}{a}\big)]$ $\Rightarrow \large\frac{2h-4a}{3}$ Hence centroid of $\Delta ABC$ is $\big(\large\frac{2h-4a}{3}$$,0)$ Hence (a) is the correct answer.
2016-10-22 16:08: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": 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.9855607748031616, "perplexity": 707.2181960092784}, "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-44/segments/1476988719027.25/warc/CC-MAIN-20161020183839-00056-ip-10-171-6-4.ec2.internal.warc.gz"}
https://www.tutorialspoint.com/What-are-the-most-significant-differences-between-MySQL-functions-and-procedures
# What are the most significant differences between MySQL functions and procedures? MySQLMySQLi Database The most significant difference between procedures and functions is that they are invoked differently and for different purposes. Other than that following are the differences between procedure and functions − • A procedure does not return a value. Instead, it is invoked with a CALL statement to perform an operation such as modifying a table or processing retrieved records. On the other hand, a function is invoked within an expression and returns a single value directly to the caller to be used in the expression. That is, a function is used in expressions the same way as a constant, a built-in function, or a reference to a table column. • We cannot invoke a function with a CALL statement. We cannot invoke a procedure in an expression. • The syntax for routine creation differs somewhat from procedures and functions as follows − CREATE [DEFINER = { user | CURRENT_USER }] PROCEDURE sp_name ([proc_parameter[,...]]) [characteristic ...] routine_body CREATE [DEFINER = { user | CURRENT_USER }] FUNCTION sp_name ([func_parameter[,...]]) RETURNS type [characteristic ...] routine_body proc_parameter: [ IN | OUT | INOUT ] param_name type func_parameter: param_name type type: Any valid MySQL data type characteristic: COMMENT 'string' | LANGUAGE SQL | [NOT] DETERMINISTIC | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA } | SQL SECURITY { DEFINER | INVOKER } routine_body: Valid SQL routine statement • Procedure parameters can be defined as input-only, output-only, or for both input and output. This means that a procedure can pass values back to the caller by using output parameters. These values can be accessed in statements that follow the CALL statement. On the other hand, functions have only input parameters. As a result, although both procedures and functions can have parameters, procedure parameter declaration syntax differs from that for functions. • Functions return a value, so there must be a RETURNS clause in a function definition to indicate the data type of the return value. Also, there must be at least one RETURN statement within the function body to return a value to the caller. On the other hand, RETURNS and RETURN do not appear in procedure definitions. Published on 21-Feb-2018 16:02:00
2020-12-05 14:22: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.20606783032417297, "perplexity": 2173.4767563760624}, "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/1606141747887.95/warc/CC-MAIN-20201205135106-20201205165106-00463.warc.gz"}
http://assert.pub/arxiv/math/math.ct/
### Top 1 Arxiv Papers Today in Category Theory ##### #1. Enriched pro-categories and shapes ###### Nikica Uglešić Given a category $\mathcal C$ and a directed partially ordered set $J$, a certain category $pro^J -\mathcal C$ on inverse systems in $\mathcal C$ is constructed such that the ordinary pro-category $pro-\mathcal C$ is the most special case of a singleton $J \equiv \{1\}$. Further, the known $pro^*$-category $pro ^*-\mathcal C$ becomes $pro ^{\mathbb N }-\mathcal C$. Moreover, given a pro-reflective category pair $(\mathcal C, \mathcal D)$, the $J$-shape category $Sh^J_{(C,\mathcal D)}$ and the corresponding $J$-shape functor $S^J$ are constructed which, in mentioned special cases, become the well known ones. Among several important properties, the continuity theorem for a J-shape category is established. It implies the "$J$-shape theory" is a genuine one such that the shape and the coarse shape theory are its very special examples. more | pdf | html None. ###### Tweets mathCTbot: Nikica Uglešić : Enriched pro-categories and shapes https://t.co/gtN9kpPmFw https://t.co/niDI9ZxSMq None. None. ###### Other stats Sample Sizes : None. Authors: 1 Total Words: 0 Unqiue Words: 0 Assert is a website where the best academic papers on arXiv (computer science, math, physics), bioRxiv (biology), BITSS (reproducibility), EarthArXiv (earth science), engrXiv (engineering), LawArXiv (law), PsyArXiv (psychology), SocArXiv (social science), and SportRxiv (sport research) bubble to the top each day. Papers are scored (in real-time) based on how verifiable they are (as determined by their Github repos) and how interesting they are (based on Twitter). To see top papers, follow us on twitter @assertpub_ (arXiv), @assert_pub (bioRxiv), and @assertpub_dev (everything else). To see beautiful figures extracted from papers, follow us on Instagram. Tracking 128,327 papers. ###### Search Sort results based on if they are interesting or reproducible. Interesting Reproducible Online ###### Stats Tracking 128,327 papers.
2019-05-20 07:20: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.6902400851249695, "perplexity": 9687.508794218958}, "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-22/segments/1558232255773.51/warc/CC-MAIN-20190520061847-20190520083847-00155.warc.gz"}
https://electronics.stackexchange.com/questions/269866/implementing-a-derived-clock-in-a-fpga
# Implementing a derived clock in a FPGA Preparing a lab excercise, where we are tasked to generate a 1 Hz clock out of the 50 Mhz system clock of a FPGA. This should be achieved without using any libraries besides ieee.std_logic_1164 and ieee.numeric_std. The obvious possibility would be, to run a counter. When it hits 25*10^6 ticks, a edge can be transmitted (alternating between rising and falling edged). Then reset the timer. This would require a 25 Bit timer and a 25 bit comparison. As our overall excercise is not that complex, we should not run into limitations of the FPGA ressources. However I wondered how this could be implemented more efficiently. E.g. one could compare only the first couple of bits thereby loosing accuracy of the clock frequency. The excercise documentation notes, that such timers are usually only loocking at one bit within the counter. So one possibility would be to count faster, so that after half a second one specific bit would swap. This could be done by counting to 2^n and increasing the counter steps. However this would create an error due to the truncated remainder in the step size. E.g. counting to 2^30 with a step size of 43 would result in an error of 0.1% , whereas counting to 2^27 has an error of 6.9% with a step size of 5. Are there more ressource efficient concepts to generate such a clock? Preferably using a counter and loocking at a single bit for clock generation. • How about a cascaded counter? Like 50 Mhz --> 25 Mhz ------> 1Hz – ammar.cma Nov 17 '16 at 10:29 • I guess you are using VHDL or Verilog to program the function of the FPGA. You don't have to worry about optimizing this counter, nowadays synthesis tools are intelligent and know how to optimize a given function in a way the FPGA's hardware is used most efficiently. Aside of that it is not possible to realize a counter that "looks" only at 1 bit for numbers that are not a power of two, as far as I know. – Longbow_iic Nov 17 '16 at 13:16 • @Longbow_iic: We work with VHDL. I was aware that the tools can and do optimize a lot. However unlike writing compiler optimization friendly C++ or similar, I lack in experience writing optimization friendly VHDL. – Grebu Nov 18 '16 at 19:26 • @ammar.cma: I think a cascaded counter would make the single counter smaller and maybe improve place and route, while enabling code sharing. However we went for the ressource hungry solution as we had not much time. – Grebu Nov 18 '16 at 19:48 You would not do something like this in a real design. See this for an example design rule you would be violating. Sometimes, you cannot avoid this, but you should only violate the design rule, if you know what you are doing. Instead, you should use an enable signal to enable the 1 Hz logic for 1 clock cycle every second. All the logic still runs at 50 MHz. Now that's out of the way, there are many ways to implement what you have specified. You cannot avoid the comparator really, because even if you are counting down you still need to reset the counter. The comparator will not use much logic anyway. It is just a large AND gate. You could have problems when using fast clocks, resulting in long counter chains. The way to avoid this is to use linear feedback shift registers (LFSRs). The way they work is like a shift registers, but with XOR gates inserted in between some DFFs. By choosing where to place the XOR gates you can control the number of cycles it takes for the LFSR to return to its original state. The LFSR is like a counter, but it counts in a random order. Since you do not care about the order, it will work in your application. The advantage of the LFSR is that the next state of a DFF depends only on the previous DFF. There is no carry to propagate. The other advantage is that you are using the carry chain in an FPGA. All LUTs have a fast connection to the next LUT called the carry chain. The LFSR uses the carry chain to connect to the next LUT instead of using the routing multiplexers. This is what your standard counter also uses, but the carry needs to propagate through the entire chain. The problem with LFSRs is that you need to know where to place the XOR gates, i.e. which characteristic polynomial to use. This can be difficult to find. However, there are other things you can do. When you implement a counter in the naive way, $A = A + 1$, the synthesizer will implement it as a ripple adder. There are other adder topologies you can use. The Kogge-Stone adder for example becomes faster as the width becomes large. My own experiments on the Cyclone IV suggest that happens at around 16. However, you sacrifice area, because, unlike with LFSRs, you need more logic to implement it. It also does not use the carry chain, making it slower for low widths. If you really need to gate a clock, see this as an example, or check your manufacturer's guidelines. Notice the presence of a falling edge DFF. This is to prevent glitches on the clock line from race conditions in the logic gate. • I learned a lot from your answer. During the lab the result actually was an enable signal as described in your first paragraph. The counter used two 26 bit std_logic_vectors to count to 50*10^6. – Grebu Nov 18 '16 at 19:18 If your counters have a load function, load the counter to (full scale - desired period - 1) and use the ripple carry to perform a load. This has the advantage that there is no extra timing penalty for a comparator.
2020-01-22 10:38: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": 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.4787794053554535, "perplexity": 819.5594689231935}, "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-05/segments/1579250606975.49/warc/CC-MAIN-20200122101729-20200122130729-00481.warc.gz"}
http://stats.stackexchange.com/questions/10117/beginner-to-prediction-statistics-where-do-i-start
# Beginner to prediction/statistics: Where do I start? I sincerely apologize if there is another thread already that will answer this question. I'm so incredibly out of my league here that I don't even know what keywords to search for :-). I'm a computer programmer by trade, and while I have a basic background in math, statistics was never really my cup of tea. I currently work at a school and just finished developing a basic set of tools to help automatically collect and analyze data on our student's behaviors (this is a school for children with autism and other disabilities). So, we have a couple of year's worth of data for things like: given Billy, how frequently did he have Aggressions, Self-Injurious Behaviors, Drop, etc. Probably 6 - 10 "inputs" (I think that's the correct term) per student. We'll be adding more as well in the future. What I'm curious about is this: Are there any beginning tutorials out there that might show me some interesting things to do with this data (besides just graphing it?) For example, it would be interesting to be able to predict when Billy is likely to have a long string of aggressions given that these x other factors have been increasing lately. Or, there is an increasing trend of this behavior which is way out of whack with its previous values, that should raise a big red flag. I've been doing some basic Googling and this seems to be in the realm of "Statistical Data Mining"—some brief tutorials were found on Andrew Moore's site, but these just aren't detailed enough for me to really learn anything. I realize that this is akin to someone walking into Stack Overflow and saying "Hey, tell me how to write the next Facebook." So, if these are the sorts of things that I can only do with years and years of statistical experience, just let me know and I'll be on my way. However, I also know that while someone couldn't walk into SO and write the next Facebook in a few weeks, we could probably point them in the right direction to create a basic site for their dad's business, even if it would be a pretty basic site. Likewise, I'm not looking to create a genius AI capable of predicting student behavior down to the millisecond; rather, I'm just curious if there's any low-hanging fruit that a guy like me could pick up in a few weeks or months of diligent reading that might make for some interesting uses of this new data we've unlocked. I'm open to online tutorials, books, textbooks, videos, open source programs and libraries, etc. - You seem to want to do forecasting using time-series or longitudinal data; presumably modelling, not data mining. You have data for each student at multiple time points. Are these data collected at regular time intervals? What are your predictors like (the "inputs")? Are the outcome variables aggressions, self-injurious behaviours counts? Do they account for a given time period? Is drop binary (yes/no)? – GaBorgulya Apr 28 '11 at 20:49 Well, I believe that doing forecasting is probably the more advanced of the two things I'd like to do. I'd be happy to start with just some basica anomaly detection outside of just doing standard deviation. To answer your questions, the data is collected at various time intervals although it is usually aggregated into uniform intervals (e.g. hourly, daily, etc.) Right now the predictors are the behaviors being tracked (aggression, self-injurious behaviors, etc.), although we will be adding more in the future along the lines of sleep, meals eaten, special incidents, medical information... – Riley Dutton Apr 28 '11 at 21:00 I guess in theory I was wondering if the inputs and the outputs can be similar (e.g. can more aggressions predict more self injurious behaviors)? Drop is actually duration, but could be simplified down to frequency as well for these purposes. Again, I'm not at this point as concerned with our specific situation, I Just wanted to give a basic example to make sure I'm on the right track. I'd rather learn how to do this in general with some basic examples then hopefully become more proficient and apply it to our exact circumstances. – Riley Dutton Apr 28 '11 at 21:02 You may want to take a look at a somewhat similar question: stats.stackexchange.com/questions/242/… – GaBorgulya Apr 28 '11 at 22:43 "anomaly detection" -- This is usually called detection of outliers. You can find many references via googling. "can more aggressions predict more self injurious behaviors" -- You can try one of the basic things: correlation between different variables or features (you called them "inputs"). The data will be easier to analyze if they will be in the format, say, "number of xxx incidents per week", i.e., if your variables will be measured on the same timescale. - It sounds like you have some really wonderful data to work with! One person suggested trying analyses in R, and that's definitely a powerful option. With your background in programming, it may be well-suited for you. I personally prefer a program like SPSS, which is built specifically user-friendly(ish) analysis of social science data. If you're new to the program, I'd suggest Julie Pallant's "SPSS Survival Manual," which has basic how-to instructions for most common analyses. Regardless of the software, it sounds like using correlations, regressions, and some time-series work could help you investigate your variables. If it seems overwhelming to learn all the stats in a short period of time, I might suggest advertising the fact that you have data to work with. I'm certain that psychology undergrads or grad students at a nearby university would jump at the chance to help you do analysis and possibly publish any useful results. Best of luck! - Thanks for the great answer. Definitely gives me some specific terms to start Googling to hopefully start making heads and tails of all of this. – Riley Dutton Apr 29 '11 at 13:25 One of my colleagues at StatSoft put this series of videos together. http://www.statsoft.com/textbook/data-mining-techniques/
2013-05-24 13:29: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.41926512122154236, "perplexity": 809.1761261647316}, "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/1368704662229/warc/CC-MAIN-20130516114422-00095-ip-10-60-113-184.ec2.internal.warc.gz"}
https://wiki.seeedstudio.com/Wio-Terminal-TinyML-EI-1/
edit # Wio Terminal Edge Impulse Getting Started¶ Edge Impulse enables developers to create the next generation of intelligent device solutions with embedded Machine Learning. Machine Learning at the very edge will enable valuable use of the 99% of sensor data that is discarded today due to cost, bandwidth or power constraints. Now, Wio Terminal is officially supported by the Edge Impulse. Let's see how to get Wio Terminal started with the Machine learning at the very edge! ## Installing dependencies¶ To set Wio Terminal up in Edge Impulse, you will need to install the following software: 1. Node.js v12 or higher. 2. Arduino CLI 3. The Edge Impulse CLI and a serial monitor. Install by opening command prompt or terminal and run: npm install -g edge-impulse-cli Note Problems with installing the CLI? Please check Installation and troubleshooting for more reference. ## Connecting to Edge Impulse¶ With all the software in place it's time to connect the development board to Edge Impulse. ### 1. Connect the development board to your computer¶ Connect Wio Terminal to your computer. Entering the bootloader mode by sliding the power switch twice quickly. For more reference, please also see here. An external drive named Arduino should appear in your PC. Drag the the downloaded Edge Impulse uf2 firmware files to the Arduino drive. Now, Edge Impulse is loaded on Seeeduino Wio Terminal! NOTE: Here is the Wio Terminal Edge Impulse source code, you can also build the firmware from here. ### 2. Setting Keys¶ From a command prompt or terminal run: \$ edge-impulse-daemon NOTE: When connecting to a new device, run edge-impulse-daemon --clean to remove previous cached. ### 3. Verifying that the device is connected¶ That's all! Your device is now connected to Edge Impulse. To verify this, go to your Edge Impulse project, and click Devices. The device will be listed here. For your first project, let’s quickly train and deploy a simple neural network for classifying rock-paper-scissors gestures with just a single light sensor. For more details and video tutorial, watch the corresponding video! ## Training data acquisition¶ Go to Data acquisition tab. Set sample length to about 10000 ms or 10 seconds and create 10 samples for each gesture, waving the hand in vicinity of Wio terminal. This is a small dataset, but we also have a tiny neural network, so underfitting is more likely than overfitting in this particular case. Underfitting: A statistical model or a machine learning algorithm is said to have underfitting when it cannot capture the underlying trend of the data, that happens (among other cases) when model size is too small to develop a general rule for data that has large variety and amount of noise. Overfitting: A statistical model is said to be overfitted, when it starts learning from the noise and inaccurate data entries in our data set. That happens when you have large model and relatively small dataset - the model can just learn "by heart" all the data points without generalizing. When collecting samples it is important to provide diversity for model to be able to generalize better, for example have samples with different direction, speed and distance from sensor. In general, the network only can learn from data present in the dataset – so if the only samples you have are gestures being moved from left to right above the sensor, you shouldn’t expect trained model to be able to recognize gestures being moved right to left or up and down. ## Building a machine learning model¶ After you collected the samples it is time to design an “impulse”. Impulse here is the word Edge Impulse used to denote data processing – training pipeline. Press on Create Impulse and set Window length to 1000 ms. and Window length increase to 50 ms. These settings mean that each time an inference is performed we're going to take sensor measurements for 1000 ms. - how many measurements your device is going to take depends on the frequency. During data collection you set sampling frequency to 40 Hz, or 40 times per 1 second. So, to sum it up, your device is going to gather 40 data samples within 1000 ms. time window and then take these values, preprocess them and feed them to neural network to get inference result. Of course we use the same window size during the training. For this proof-of-concept project, we are going to try three different prepossessing blocks with default parameters(except for adding scaling) – Flatten block, which takes computes Average, Min, Max and other functions of raw data within time window. Spectral Features block, which extracts the frequency and power characteristics of a signal over time. and Raw data block, which as you might have guessed just feeds raw data to NN learning block (optionally normalizing the data). We'll start with Flatten block. Add this block and then add Neural Network (Keras) as learning block, check Flatten as input features and click on Save Impulse. Go to the next tab, which has a name of the processing block you have chosen - Flatten. There enter 0.001 in scaling and leave other parameters the same. Press on Save parameters and then Generate features. Feature visualization is particularity useful tool in Edge Impulse web interface, as it allows users to get graphical insights into how the data looks after prepossessing. For example this is data after Flatten processing block: We can see that the data points for different classes are roughly divided, but there is a lot of overlap between rock and other classes, which will cause issues and low accuracy for these two classes. After you generated and inspected the features, go to NN CLassifier tab. Train a simple fully-connected network with 2 hidden layers, 20 and 10 neurons in each hidden layer for 500 epochs with 1e-4 learning rate. After the training is done you're going to see test results in confusion matrix, similar to this: Go back to Create Impulse tab, delete Flatten block and choose Spectral Features block, generate the features (remember to set scaling to 0.001!) and train Neural network on Spectral features data. You should see slight improvement. Both Flatten and Spectral Features blocks are actually not the best processing methods for rock-paper-scissors gesture recognition task. If we think about it, for classifying rock-paper-scissors gestures we just need to count how many times and for how long the light sensor has received “lower-than-normal” values. If it is one relatively long time – then it is rock (fist passing above the sensors). If it is two times, then it is scissors. Anything more than that is paper. Sounds easy, but preserving time series data is really important for neural network to be able to learn this relationship in data points. Both Flatten and Spectral Features processing blocks remove the time relationship within each window – Flatten block simply turns the raw values, that are initially in sequence to Average, Min, Max, etc. values calculated on all values in time window, irrespective of their order. Spectral Features block extracts the frequency and power characteristics and the reason it didn’t work that well for this particular task is probably, that the duration of each gesture is too short. So, the way to achieve best performance is to use Raw data block, which will preserve the time series data. Have a look at sample project where we used Raw data and Convolutional 1D network, a more specialized type of network, compared to fully-connected. We were able to achieve 92.4% accuracy on the same data! The final results after training were • Flatten FC 69.9 % accuracy • Spectral Features FC 70.4 % accuracy • Raw Data Conv1D 92.4 % accuracy After the training you can test the model using Live classification tab, which will gather a data sample from device and classify it with model hosted on Edge Impulse. We test with three different gestures and see the accuracy is satisfactory as far as proof of concept goes. ## Deploying to Wio Terminal¶ The next step is deployment on device. After clicking on Deployment tab, choose Arduino library and download it. Extract the archive and place it in your Arduino libraries folder. Open Arduino IDE and choose static buffer sketch (located in File -> Examples -> name of your project -> static_buffer) , which already has all the boilerplate code for classification with your model in place. Neat! The only thing for use to fill in is the data acquisition on-device. We’ll use a simple for loop with delay to account for frequency (if you remember we had 25 ms delay when gathering data for training dataset). int raw_feature_get_data(size_t offset, size_t length, float *out_ptr) { float features[40]; for (byte i = 0; i < 40; i = i + 1) {
2021-12-03 18:50:41
{"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.26776841282844543, "perplexity": 1994.0460337562329}, "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/1637964362918.89/warc/CC-MAIN-20211203182358-20211203212358-00248.warc.gz"}
https://gamedev.stackexchange.com/questions/152293/how-do-i-find-out-if-this-particular-puzzle-can-still-be-solved
# How do I find out if this particular puzzle can still be solved? A while ago, I made a simple game that involved swapping birds to combine them and release them to create points. The idea is that eventually, the birds would get stuck and your game is over, but I found it tremendously hard to think of a way to detect a game-over, so I published it without such an algorithm and just hoped people would see it for themselves. However, I'm still very interested in a solution and hoped someone could help me. The game works as follows: • 6 different kinds of birds are distributed over an n x n (usually 4 x 4) grid. • For every two birds of the same type, if they would form a perfect rectangle together, they merge into one bigger bird of the same type. This means you can have birds that are, for example, 4 x 1 or 3 x 2. • Birds that are big enough can be removed from the grid, generating points. What's 'big enough' depends on the type of bird, some only need to cover 1 square on the grid, others 2 or 3. • Empty squares on the grid will get filled up with new, random birds falling from above. That is, of course, as long as other birds don't block the way. All birds always fall down when they can, and moving a bird upwards is therefore impossible (though, swapping upwards is allowed). • Two birds can swap places if they are of the same width when swapping vertically, or of the same height when swapping horizontally, but only when they are aligned perfectly. A bird can always move to an empty spot, given that its new position would be large enough to contain it and that the new spot wouldn't deny gravity. • Eventually, groups of 2 tall/wide birds will prevent anymore progress. Some birds can still be swapped, and maybe some would even become big enough to be removed when combined with certain others, but they will never get near each other, resulting in a game over. I'm not too sure whether this is clear enough. I don't really want to post a link to the game here because I'm really only interested in the algorithm, not new downloads. Also I'm not too sure if I'm allowed to, as it could be seen as an advertisement. But please request more clarity where needed! I think starting from a brute force solution is fine here, as the search space is relatively small. At the start of every turn, recursively look at all the moves that can be made, storing the layouts that you've looked at already to avoid repeating yourself. If you can find a series of moves that lead to merging birds, in a reasonable time, stop; the puzzle isn't stuck yet. For example, given this example grid: +-+---+ |A| B | +-+---+ |B|A|B| +-+-+-+ We could swap the birds on the top row: v v +-+---+ +---+-+ |A| B | | B |A| +-+---+ --> +-+-+-+ |B|A|B| |B|A|B| +-+-+-+ +-+-+-+ Next, we don't swap the top row again because that would repeat the first grid. Instead, we could swap the last column: v v +-+---+ +---+-+ +---+-+ |A| B | | B |A| | B |B|< +-+---+ --> +-+-+-+ --> +-+-+-+ |B|A|B| |B|A|B| |B|A|A|< +-+-+-+ +-+-+-+ +-+-+-+ ...which results in pairs of birds that can be merged: v v v +-+---+ +---+-+ +---+-+ +-----+ |A| B | | B |A| | B |B|< | B | +-+---+ --> +-+-+-+ --> +-+-+-+ --> +-+---+ |B|A|B| |B|A|B| |B|A|A|< |B| A | +-+-+-+ +-+-+-+ +-+-+-+ +-+---+ ^ And we're done. If we've exhausted the search space without finding pairs that can be merged, the game is stuck. It's also possible that we can't find a result in a reasonable amount of time, but this is very unlikely given the limited bird types (6) and grid size (4x4 and larger). You could add a heuristic to improve your search strategy, favouring moves that bring similar bird types closer together, if the search is too slow. This is not a perfect solution, as it's possible that despite there being merges available, the game will eventually get stuck anyway. I don't think you'll need such a good solver though; most puzzle games make do with a simple no-moves-available-now simple solver like this one. • Sounds good! I'll try this out as soon as I can and let you know if I find any problems. Also, props to you for deciphering my explanation on the game. :P – Rick9399 Dec 19 '17 at 12:32
2021-03-04 22:46: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.3522932529449463, "perplexity": 896.2052109002719}, "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/1614178369523.73/warc/CC-MAIN-20210304205238-20210304235238-00394.warc.gz"}
http://mathoverflow.net/revisions/73683/list
## Return to Answer 3 deleted 224 characters in body you are right, upgrade the indices 3->4 and 4->5 and by geometric i meant fully covariant $g D_i D_j$ with D the covariant drivative and i thought of 3+1 dimensions. i cannot edit thé original -> question since i have changed for another computer.reedited 2 added 83 characters in body you are right, upgrade the indices 3->4 and 4->5 and by geometric i meant fully covariant $g D_i D_j$ with D the covariant drivative and i thought of 3+1 dimensions. i cannot edit thé original question since i have changed for another computer. 1 you are right, upgrade the indices 3->4 and 4->5 and by geometric i meant fully covariant $g D_i D_j$ with D the covariant drivative and i thought of 3+1 dimensions
2013-05-23 08:16:59
{"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.9582207798957825, "perplexity": 2463.154186700672}, "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-2013-20/segments/1368703035278/warc/CC-MAIN-20130516111715-00040-ip-10-60-113-184.ec2.internal.warc.gz"}
https://dmoj.ca/problem/bts19p2
## Back To School '19: Parkour View as PDF Points: 5 (partial) Time limit: 2.0s Memory limit: 128M Author: Problem type Wesley is running late to school! The neighbourhood is modelled as a coordinate plane, and Wesley's house is currently sitting at . The school is a rectangle of dimensions metres horizontally and metres vertically. Its bottom left corner is situated at , but there are entrances located at any point of the school. Formally, there are entrances located at all points such that and . Being the cool kid that he is, Wesley does a lot of parkour and will use his abilities to move faster than most people. In one second, he can move in one of two ways: • Move metres up, then metre right • Move metre up, then metres right Hurry, the bell rings in seconds! Can Wesley make it to class strictly before seconds pass and the teachers get angry at him? Note that Wesley can only enter the school if he touches an entrance to the school after performing a move. Python users are recommended to use PYPY over CPython. There is a significant performance increase. #### Input Specification The first line of the input will contain four integers , the coordinates of the bottom left corner of the school and its dimensions. The second line of the input will contain one integer , the number of seconds Wesley has before the school bell rings. It is guaranteed that the school will not be located directly at Wesley's house and that it will be reachable using the moves described. #### Output Specification If Wesley can parkour in time to school (in strictly less than seconds), output YES. Otherwise, output NO. No further constraints. #### Sample Input 1 2 3 3 3 2 #### Sample Output 1 NO #### Explanation For Sample 1 While it is possible for Wesley to reach the school in seconds: 1. Move metre up, move metres right to 2. Move metres up, move metre right to The bell would ring by the time he gets there, making it impossible. #### Sample Input 2 2 3 3 3 3 #### Sample Output 2 YES #### Explanation For Sample 2 This time, Wesley has enough time to make it before the bell rings, making the trip now possible. • commented on Feb. 5, 2020, 7:07 p.m. Damn, this problem is very difficult. I think it should be 7 points instead of 5. • commented on Oct. 16, 2019, 10:11 p.m. What's test case #28? • commented on Jan. 1, 2021, 6:50 p.m. My issue with case 28 is that I was counting a negative number of moves as valid, which obviously isn't possible. • commented on Oct. 15, 2019, 5:06 p.m. Anyone know why my code doesn't work? • commented on Oct. 15, 2019, 7:08 p.m. Not enough corner case testing. 10 10 1 1 8 If you do it by hand you can see it is in fact possible to get to school in this case by simply using 4 of one move and 3 of the other move. • commented on Sept. 10, 2019, 11:20 p.m. edited This is my favourite problem! Thanks Zeyu! • commented on Sept. 11, 2019, 6:10 a.m. Happy to hear that, thanks :)
2021-04-17 05:04:24
{"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.4526812434196472, "perplexity": 2762.4807040108035}, "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/1618038101485.44/warc/CC-MAIN-20210417041730-20210417071730-00356.warc.gz"}
https://mathematica.stackexchange.com/questions/250849/find-the-ratio-of-two-volumes-of-6-x-6-positive-definite-symmetric-matrices
Find the ratio of two volumes of 6 x 6 positive-definite symmetric matrices Consider the class $$A$$ of $$6 \times 6$$ positive definite matrices with real entries and unit trace (that is, the sum of the six diagonal entries is 1). (In quantum information-theoretic parlance, this is the class of "rebit-retrit density matrices".) What is the twenty-dimensional Euclidean volume comprised by such matrices? This is the denominator of the ratio in which we are interested. As to the numerator of the ratio, we want the twenty-dimensional Euclidean volume comprised by a certain subset $$B$$ of $$A$$. In addition to satisfying the conditions for membership in $$A$$, the "partial transposes" of such matrices must also be positive definite. To construct the partial transposes, one transposes in place the four $$3 \times 3$$ blocks of the rebit-retrit density matrices. If one analogously considers the (9-dimensional) set of $$4 \times 4$$ "two-rebit density matrices" and the partial transposes of their $$2 \times 2$$ blocks, the desired ratio has been shown to equal $$$$\frac{29}{64} =\frac{29}{2^6} \approx 0.453125.$$$$ As to the presently-desired ratio in the $$6 \times 6$$ instance, the conjecture--based on numerical computations (RebitRetritConjecture)--of $$$$\frac{860}{6561} = \frac{2^2 \cdot 5 \cdot 43}{3^8} \approx 0.131078$$$$ has been given. These several ratios comprise what is termed "Hilbert-Schmidt separability probabilities". As to the particular use of Mathematica in approaching this problem, I have considered the use of the GenericCylindricalDecomposition command (so far, with no successful outcomes). I have also considered the use of the positivity of the leading minors as a test for positive-definiteness. Perhaps the transformation of variables to such leading minors might be helpful. Also, certain "simplified" forms of this daunting problem can be of interest--such as the 14-dimensional scenario in which the off-diagonal entries of the two diagonal (or two off-diagonal) $$3 \times 3$$ blocks are set to 0. If one allows the off-diagonal entries of the matrices in question to be complex-valued, one moves to the realm of "two-qubit" and "qubit-qutrit" density matrices. In the 15-dimensional two-qubit case, the ratio (though not yet formally demonstrated to be such) is $$\frac{8}{33}$$. In the qubit-qutrit scenario, a conjecture of $$\frac{27}{1000}$$ has been stated. According to eq. (7.7) $$$$V^{(1)}_N = \frac{2^{\frac{1}{4} (N-1) N+N} \sqrt{N} \pi ^{\frac{1}{4} (N-1) N-\frac{1}{2}} \Gamma \left(\frac{N+1}{2}\right) \prod _{k=1}^N \Gamma \left(\frac{k}{2}+1\right)}{N! \Gamma \left(\frac{1}{2} N (N+1)\right)}.$$$$ in Hilbert–Schmidt volume, with $$N= 6$$, the (Hilbert-Schmidt-valued) denominator of the ratio we seek should be $$$$\frac{\pi ^9}{2252687044608000 \sqrt{3}} \approx \text{7.63989457197784\grave{ }*{}^{\wedge}-12}.$$$$ Alternatively, based on Lebesgue measure, the volume of the denominator should be (Theorem 1 in LebesgueVolume) V[k_] := Pi^(k^2) (2 k)! Product[(2 i)!, {i, 1, k - 1}]/(2^(k^2 + k) k! (2 k^2 + k - 1)!) with $$k=3$$, that is, $$$$\frac{\pi ^9}{1730063650258944000} \approx \text{1.7230059326999088\grave{ }*{}^{\wedge}-14}.$$$$ The ratio of the latter (Lebesgue) volume to the former (Hilbert-Schmidt) one is $$$$\frac{1}{256 \sqrt{3}}.$$$$ • Is it true that each volume individually is diverging? Jul 11 at 14:55 • No, yarchik, the volumes are not diverging arxiv.org/abs/math-ph/0604032 Jul 11 at 15:00 • yarchik--The "Hilbert-Schmidt metric" is defined by the line element squared--$\mbox{d}s^2_{HS}=(1/2) \mbox{Tr[}(d \rho)^2]$, where $\rho$ is a density matrix. This formula is (14.29) in the 2006 edition of "Geometry of Quantum States" by Zyczkowski and Bengtsson. I'm not sure if it is equivalently a "Haar measure". I just treat the problem in question as one in Euclidean/flat (Frobenius?) space. Jul 11 at 15:17 • There are other possible measures of strong interest--in particular, the "Bures" (see the "Geometry of Quantum States" book--or the literature, in general). These are still more challenging to compute, it would seem. Jul 11 at 15:26
2021-09-21 16:18: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": 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": 20, "wp-katex-eq": 0, "align": 0, "equation": 6, "x-ck12": 0, "texerror": 0, "math_score": 0.9284247756004333, "perplexity": 1715.3158431311251}, "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-39/segments/1631780057225.57/warc/CC-MAIN-20210921161350-20210921191350-00503.warc.gz"}
http://www.ck12.org/book/CK-12-Trigonometry-Second-Edition/r3/section/1.8/
<meta http-equiv="refresh" content="1; url=/nojavascript/"> You are reading an older version of this FlexBook® textbook: CK-12 Trigonometry - Second Edition Go to the latest version. # 1.8: Relating Trigonometric Functions Difficulty Level: At Grade Created by: CK-12 ## Learning Objectives • State the reciprocal relationships between trig functions, and use these identities to find values of trig functions. • State quotient relationships between trig functions, and use quotient identities to find values of trig functions. • State the domain and range of each trig function. • State the sign of a trig function, given the quadrant in which an angle lies. • State the Pythagorean identities and use these identities to find values of trig functions. ## Reciprocal identities The first set of identities we will establish are the reciprocal identities. A reciprocal of a fraction $\frac{a}{b}$ is the fraction $\frac{b}{a}$. That is, we find the reciprocal of a fraction by interchanging the numerator and the denominator, or flipping the fraction. The six trig functions can be grouped in pairs as reciprocals. First, consider the definition of the sine function for angles of rotation: $\sin \theta = \frac{y}{r}$. Now consider the cosecant function: $\csc \theta = \frac{r}{y}$. In the unit circle, these values are $\sin \theta = \frac{y}{1} = y$ and $\csc \theta = \frac{1}{y}$. These two functions, by definition, are reciprocals. Therefore the sine value of an angle is always the reciprocal of the cosecant value, and vice versa. For example, if $\sin \theta = \frac{1}{2}$, then $\csc \theta = \frac{2}{1} = 2$. Analogously, the cosine function and the secant function are reciprocals, and the tangent and cotangent function are reciprocals: $\sec \theta = \frac{1}{\cos \theta} && \text{or} && \cos \theta = \frac{1}{\sec \theta}\\\cot \theta = \frac{1}{\tan \theta} && \text{or} && \tan \theta = \frac{1}{\cot \theta}$ Example 1: Find the value of each expression using a reciprocal identity. a. $\cos \theta = .3, \sec \theta = ?$ b. $\cot \theta = \frac{4}{3}, \tan \theta = ?$ Solution: a. $\sec \theta = \frac{10}{3}$ These functions are reciprocals, so if $\cos \theta = .3$, then $\sec \theta = \frac{1}{.3}$. It is easier to find the reciprocal if we express the values as fractions: $\cos \theta = .3 = \frac{3}{10} \Rightarrow \sec \theta = \frac{10}{3}$. b. $\tan \theta = \frac{3}{4}$ These functions are reciprocals, and the reciprocal of $\frac{4}{3}$ is $\frac{3}{4}$. We can also use the reciprocal relationships to determine the domain and range of functions. ## Domain, Range, and Signs of Trig Functions While the trigonometric functions may seem quite different from other functions you have worked with, they are in fact just like any other function. We can think of a trig function in terms of “input” and “output.” The input is always an angle. The output is a ratio of sides of a triangle. If you think about the trig functions in this way, you can define the domain and range of each function. Let’s first consider the sine and cosine functions. The input of each of these functions is always an angle, and as you learned in the previous sections, these angles can take on any real number value. Therefore the sine and cosine function have the same domain, the set of all real numbers, $R$. We can determine the range of the functions if we think about the fact that the sine of an angle is the $y-$coordinate of the point where the terminal side of the angle intersects the unit circle. The cosine is the $x-$coordinate of that point. Now recall that in the unit circle, we defined the trig functions in terms of a triangle with hypotenuse 1. In this right triangle, $x$ and $y$ are the lengths of the legs of the triangle, which must have lengths less than 1, the length of the hypotenuse. Therefore the ranges of the sine and cosine function do not include values greater than one. The ranges do, however, contain negative values. Any angle whose terminal side is in the third or fourth quadrant will have a negative $y-$coordinate, and any angle whose terminal side is in the second or third quadrant will have a negative $x-$coordinate. In either case, the minimum value is -1. For example, $\cos 180^\circ = -1$ and $\sin 270^\circ = -1$. Therefore the sine and cosine function both have range from -1 to 1. The table below summarizes the domains and ranges of these functions: Domain Range Sine $\theta = R$ $-1 \le y \le 1$ Cosine $\theta = R$ $-1 \le y \le 1$ Knowing the domain and range of the cosine and sine function can help us determine the domain and range of the secant and cosecant function. First consider the sine and cosecant functions, which as we showed above, are reciprocals. The cosecant function will be defined as long as the sine value is not 0. Therefore the domain of the cosecant function excludes all angles with sine value 0, which are $0^\circ$, $180^\circ$, $360^\circ$, etc. In Chapter 2 you will analyze the graphs of these functions, which will help you see why the reciprocal relationship results in a particular range for the cosecant function. Here we will state this range, and in the review questions you will explore values of the sine and cosecant function in order to begin to verify this range, as well as the domain and range of the secant function. Domain Range Cosecant $\theta \epsilon R, \theta \ne 0, 180, 360 \ldots$ $\csc \theta \le -1$ or $\csc \theta \ge 1$ Secant $\theta \epsilon R, \theta \ne 90, 270, 450 \ldots$ $\sec \theta \le -1$ or $\sec \theta \ge 1$ Now let’s consider the tangent and cotangent functions. The tangent function is defined as $\tan \theta = \frac{y}{x}$. Therefore the domain of this function excludes angles for which the ordered pair has an $x-$coordinate of $0: 90^\circ, 270^\circ$, etc. The cotangent function is defined as $\cot \theta = \frac{x}{y}$, so this function’s domain will exclude angles for which the ordered pair has a $y-$coordinate of $0: 0^\circ$, $180^\circ$, $360^\circ$, etc. Function Domain Range Tangent $\theta \epsilon R, \theta \ne 90, 270, 450 \ldots$ All reals Cotangent $\theta \epsilon R, \theta \ne 0, 180, 360 \ldots$ All reals Knowing the ranges of these functions tells you the values you should expect when you determine the value of a trig function of an angle. However, for many problems you will need to identify the sign of the function of an angle: Is it positive or negative? In determining the ranges of the sine and cosine functions above, we began to categorize the signs of these functions in terms of the quadrants in which angles lie. The figure below summarizes the signs for angles in all 4 quadrants. An easy way to remember this is “All Students Take Calculus.” Quadrant I: All values are positive, Quadrant II: Sine is positive, Quadrant III: Tangent is positive, and Quadrant IV: Cosine is positive. This simple memory device will help you remember which trig functions are positive and where. Example 2: State the sign of each expression. a. $\cos 100^\circ$ b. $\csc 220^\circ$ c. $\tan 370^\circ$ Solution: a. The angle $100^\circ$ is in the second quadrant. Therefore the $x-$coordinate is negative and so $\cos 100^\circ$ is negative. b. The angle $220^\circ$ is in the third quadrant. Therefore the $y-$coordinate is negative. So the sine, and the cosecant are negative. c. The angle $370^\circ$ is in the first quadrant. Therefore the tangent value is positive. So far we have considered relationships between pairs of functions: the six trig functions can be grouped in pairs as reciprocals. Now we will consider relationships among three trig functions. ## Quotient Identities The definitions of the trig functions led us to the reciprocal identities above. They also lead us to another set of identities, the quotient identities. Consider first the sine, cosine, and tangent functions. For angles of rotation (not necessarily in the unit circle) these functions are defined as follows: $\sin \theta & = \frac{y}{r}\\\cos \theta & = \frac{x}{r}\\\tan \theta & = \frac{y}{x}$ Given these definitions, we can show that $\tan \theta = \frac{\sin \theta}{\cos \theta}$, as long as $\cos \theta \ne 0$: $\frac{\sin \theta}{\cos \theta} = \frac{\frac{y}{r}}{\frac{x}{r}} = \frac{y}{r} \times \frac{r}{x} = \frac{y}{x} = \tan \theta.$ The equation $\tan \theta = \frac{\sin \theta}{\cos \theta}$ is therefore an identity that we can use to find the value of the tangent function, given the value of the sine and cosine. Example 3: If $\cos \theta = \frac{5}{13}$ and $\sin \theta = \frac{12}{13}$, what is the value of $\tan \theta$? Solution: $\tan \theta = \frac{12}{5}$ $\tan \theta = \frac{\sin \theta}{\cos \theta} = \frac{\frac{12}{13}}{\frac{5}{13}} = \frac{12}{13} \times \frac{13}{5} = \frac{12}{5}$ Example 4: Show that $\cot \theta = \frac{\cos \theta}{\sin \theta}$ Solution: $\frac{\cos \theta}{\sin \theta} = \frac{\frac{x}{r}}{\frac{y}{r}} = \frac{x}{r} \times \frac{r}{y} = \frac{x}{y} = \cot \theta$ This is also an identity that you can use to find the value of the cotangent function, given values of sine and cosine. Both of the quotient identities will also be useful in chapter 3, in which you will prove other identities. ## Cofunction Identities and Reflection These identities relate to the problems you did in section 1.3. Recall, #3 and #4 from the review questions, where $\sin X = \cos Z$ and $\cos X = \sin Z$, where $X$ and $Z$ were complementary angles. These are called cofunction identities because the functions have common values. These identities are summarized below. $\sin \theta = \cos(90^\circ-\theta) && \cos \theta = \sin (90^\circ-\theta)\\\tan \theta = \cot(90^\circ-\theta) && \cot \theta = \tan (90^\circ-\theta)$ Example 5: Find the value of each trig function. a. $\cos 120^\circ$ b. $\cos (-120^\circ)$ c. $\sin 135^\circ$ d. $\sin (-135^\circ)$ Solution: Because these angles have reference angles of $60^\circ$ and $45^\circ$, the values are: a. $\cos 120^\circ = -\frac{1}{2}$ b. $\cos (-120^\circ) = \cos 240^\circ = -\frac{1}{2}$ c. $\sin 135^\circ = \frac{\sqrt{2}}{2}$ d. $\sin (-135^\circ) = \sin 225^\circ = -\frac{\sqrt{2}}{2}$ These values show us that sine and cosine also reflect over the $x$ axis. This allows us to generate three more identities. $\sin (-\theta) = -\sin \theta && \cos (-\theta) = \cos \theta && \tan (-\theta) = -\tan \theta$ ## Pythagorean Identities The final set of identities are called the Pythagorean Identities because they rely on the Pythagorean Theorem. In previous lessons we used the Pythagorean Theorem to find the sides of right triangles. Consider once again the way that we defined the trig functions in 1.3. Let’s look at the unit circle: The legs of the right triangle are $x$, and $y$. The hypotenuse is 1. Therefore the following equation is true for all $x$ and $y$ on the unit circle: $x^2 + y^2 = 1$ Now remember that on the unit circle, $\cos \theta = x$ and $\sin \theta = y$. Therefore the following equation is an identity: $\cos^2 \theta + \sin^2 \theta = 1$ Note: Writing the exponent 2 after the $cos$ and $sin$ is the standard way of writing exponents. Just keeping mind that $\cos^2 \theta$ means $(\cos \theta)^2$ and $\sin ^2 \theta$ means $(\sin \theta)^2$. We can use this identity to find the value of the sine function, given the value of the cosine, and vice versa. We can also use it to find other identities. Example 6: If $\cos \theta = \frac{1}{4}$ what is the value of $\sin \theta$? Assume that $\theta$ is an angle in the first quadrant. Solution: $\sin \theta = \frac{\sqrt{15}}{4}$ $\cos^2 \theta + \sin^2 \theta & = 1\\\left ( \frac{1}{4} \right )^2 + \sin ^2 \theta & = 1\\\frac{1}{16} + \sin^2 \theta & = 1\\\sin^2 \theta & = 1 -\frac{1}{16}\\\sin^2 \theta & = \frac{15}{16}\\\sin \theta & = \pm \sqrt{\frac{15}{16}}\\\sin \theta & = \pm \frac{\sqrt{15}}{4}$ Remember that it was given that $\theta$ is an angle in the first quadrant. Therefore the sine value is positive, so $\sin \theta = \frac{\sqrt{15}}{4}$. Example 7: Use the identity $\cos^2\theta + \sin^2\theta = 1$ to show that $\cot^2 \theta + 1 = \csc^2 \theta$ Solution: $\cos^2\theta + \sin^2\theta & = 1 && \text{Divide both sides by} \sin^2 \theta.\\\frac{\cos^2\theta + \sin^2\theta}{\sin^2\theta} & = \frac{1}{\sin^2 \theta}\\\frac{\cos^2\theta}{\sin^2\theta} + \frac{\sin^2\theta}{\sin^2\theta} & = \frac{1}{\sin^2\theta} && \frac{\sin^2\theta}{\sin^2\theta} = 1\\\frac{\cos^2\theta}{\sin^2\theta} + 1 & = \frac{1}{\sin^2\theta}\\\frac{\cos \theta}{\sin \theta} \times \frac{\cos \theta}{\sin \theta} + 1 & = \frac{1}{\sin \theta} \times \frac{1}{\sin \theta} && \text{Write the squared functions in terms}\\&&& \text{of their factors.}\\\cot \theta \times \cot \theta + 1 & = \csc \theta \times \csc \theta && \text{Use the quotient and reciprocal}\\&&& \text{identities.}\\\cot^2\theta + 1 & = \csc^2 \theta && \text{Write the functions as squared}\\&&& \text{functions.}$ ## Points to Consider 1. How do you know if an equation is an identity? HINT: you could consider using a the calculator and graphing a related function, or you could try to prove it mathematically. 2. How can you verify the domain or range of a function? ## Review Questions 1. Use reciprocal identities to give the value of each expression. 1. $\sec \theta = 4, \cos \theta = ?$ 2. $\sin \theta = \frac{1}{3}, \csc \theta = ?$ 2. In the lesson, the range of the cosecant function was given as: $\csc \theta \le -1$ or $\csc \theta \ge 1$. 1. Use a calculator to fill in the table below. Round values to 4 decimal places. 2. Use the values in the table to explain in your own words what happens to the values of the cosecant function as the measure of the angle approaches 0 degrees. 3. Explain what this tells you about the range of the cosecant function. 4. Discuss how you might further explore values of the sine and cosecant to better understand the range of the cosecant function. Angle Sin Csc 10 5 1 0.5 0.1 0 -.1 -.5 -1 -5 -10 1. In the lesson the domain of the secant function were given: Domain: $\theta \epsilon^\circ, \theta \ne 90, 270, 450 \ldots$ Explain why certain values are excluded from the domain. 2. State the quadrant in which each angle lies, and state the sign of each expression 1. $\sin 80^\circ$ 2. $\cos 200^\circ$ 3. $\cot 325^\circ$ 4. $\tan 110^\circ$ 3. If $\cos \theta = \frac{6}{10}$ and $\sin \theta = \frac{8}{10}$, what is the value of $\tan \theta$? 4. Use quotient identities to explain why the tangent and cotangent function have positive values for angles in the third quadrant. 5. If $\sin \theta = 0.4$, what is the value of $\cos \theta$? Assume that $\theta$ is an angle in the first quadrant. 6. If $\cot \theta = 2$, what is the value of $\csc \theta$? Assume that $\theta$ is an angle in the first quadrant. 7. Show that $1 + \tan^2\theta = \sec^2\theta$. 8. Explain why it is necessary to state the quadrant in which the angle lies for problems such as #7. 1. $\frac{1}{4}$ 2. $\frac{3}{1} = 3$ 1. (a) Angle Sin Csc 10 .1737 5.759 5 .0872 11.4737 1 .0175 57.2987 0.5 .0087 114.5930 0.1 .0018 572.9581 0 0 undefined -.1 -.0018 -572.9581 -.5 -.0087 -114.5930 -1 -.0175 -57.2987 -5 -.0872 -11.4737 -10 -.1737 -5.759 (b) As the angle gets smaller and smaller, the cosecant values get larger and larger. (c) The range of the cosecant function does not have a maximum, like the sine function. The values get larger and larger. (d) Answers will vary. For example, if we looked at values near 90 degrees, we would see the cosecant values get smaller and smaller, approaching 1. 1. The values 90, 270, 450, etc, are excluded because they make the function undefined. 2. $\frac{8}{6} = \frac{4}{3}$ 3. The ratio of sine and cosine will be positive in the third quadrant because sine and cosine are both negative in the third quadrant. 4. $\cos \theta \approx .92$ 5. $\csc \theta = \sqrt{5}$ 6. $\cos^2\theta + \sin^2\theta & = 1\\\frac{\cos^2\theta + \sin^2\theta}{\cos^2\theta} & = \frac{1}{\cos^2\theta}\\1+ \frac{\sin^2\theta}{\cos^2\theta} & = \frac{1}{\cos^2\theta}\\1+ \tan^2\theta & = \sec^2\theta$ 7. Using the Pythagorean identities results in a quadratic equation and will have two solutions. Stating that the angle lies in a particular quadrant tells you which solution is the actual value of the expression. In #7, the angle is in the first quadrant, so both sine and cosine must be positive. Sep 14, 2012
2015-05-27 13:24: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": 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": 137, "texerror": 0, "math_score": 0.9016156196594238, "perplexity": 257.9569936503544}, "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-22/segments/1432207928965.67/warc/CC-MAIN-20150521113208-00164-ip-10-180-206-219.ec2.internal.warc.gz"}
https://www.numerade.com/questions/the-non-relativistic-expression-for-the-momentum-of-a-particle-pm-v-can-be-used-if-v-c-for-what-spee/
Gravitation ### Discussion You must be signed in to discuss. ##### Christina K. Rutgers, The State University of New Jersey ##### Andy C. University of Michigan - Ann Arbor LB Lectures Join Bootcamp ### Video Transcript well, Delta P divided by B. Well, don't be Exchange momentum and peas. Just momentum. So the racial is equal to gum. A minus one times. Mm. We divided by well, these gamma times, m we And this whole trump is equal to 1% and 1% is equal to 0.1 And the Sim Ply State gamma is equal to one divided by 0.9 mine Xeno. And since come is equal to one divided by ah screen route off one minus. Police were divided by C Square and the high is equal to 0.990 and solving. For we, we is equal to 0.1 for one times the speed of light. And also we have Don't be demanding it be, uh is equal to gamma minus one times and we divided by, uh, gonna times and we gonna times and we And it's equal to 10%. These done and 10% 10.0% is equal to unseat a 0.10 And gunmen is equal to one divided by zero point mind 00 Then gonna use one divided by a squared who does one minus we squinty body by C Square, we screened your mindedly cease creator and it's equal to one divided by zero point times zero and solving from B, we is equal to 0.436 times the speed of light. #### Topics Gravitation ##### Christina K. Rutgers, The State University of New Jersey ##### Andy C. University of Michigan - Ann Arbor LB Lectures Join Bootcamp
2021-04-14 11:09: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.5454437732696533, "perplexity": 3278.9087261683144}, "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/1618038077810.20/warc/CC-MAIN-20210414095300-20210414125300-00247.warc.gz"}
https://www.snapxam.com/problems/62083794/tanx-cosx-1-sinx-secx
# Step-by-step Solution Go! 1 2 3 4 5 6 7 8 9 0 a b c d f g m n u v w x y z . (◻) + - × ◻/◻ / ÷ 2 e π ln log log lim d/dx Dx |◻| = > < >= <= sin cos tan cot sec csc asin acos atan acot asec acsc sinh cosh tanh coth sech csch asinh acosh atanh acoth asech acsch ## Step-by-step explanation Problem to solve: $\tan\left(x\right)+\frac{\cos\left(x\right)}{1+\sin\left(x\right)}=\sec\left(x\right)$ Learn how to solve trigonometric identities problems step by step online. $\frac{\sin\left(x\right)}{\cos\left(x\right)}+\frac{\cos\left(x\right)}{1+\sin\left(x\right)}=\sec\left(x\right)$ Learn how to solve trigonometric identities problems step by step online. Prove the trigonometric identity tan(x)+(cos(x)/(1+sin(x))=sec(x). Applying the tangent identity: \displaystyle\tan\left(\theta\right)=\frac{\sin\left(\theta\right)}{\cos\left(\theta\right)}. Combine fractions with different denominator using the formula: \displaystyle\frac{a}{b}+\frac{c}{d}=\frac{a\cdot d + b\cdot c}{b\cdot d}. When multiplying two powers that have the same base (\cos\left(x\right)), you can add the exponents. Multiplying polynomials \sin\left(x\right) and 1+\sin\left(x\right). true $\tan\left(x\right)+\frac{\cos\left(x\right)}{1+\sin\left(x\right)}=\sec\left(x\right)$ ### Main topic: Trigonometric Identities 9 ### Time to solve it: ~ 0.05 s (SnapXam)
2020-09-20 00:08: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.9594270586967468, "perplexity": 6889.53878523954}, "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/1600400193087.0/warc/CC-MAIN-20200920000137-20200920030137-00248.warc.gz"}
https://socratic.org/questions/a-cylinder-has-inner-and-outer-radii-of-8-cm-and-12-cm-respectively-and-a-mass-o-4
# A cylinder has inner and outer radii of 8 cm and 12 cm, respectively, and a mass of 8 kg. If the cylinder's frequency of rotation about its center changes from 3 Hz to 2 Hz, by how much does its angular momentum change? Jan 26, 2017 The answer is $= 0.523 k g m {s}^{- 1}$ #### Explanation: The angular momentum is $L = I \omega$ and $\Delta L = I \Delta \omega$ where $I$ is the moment of inertia For a cylinder, $I = \frac{m}{2} \left({r}_{1}^{2} + {r}_{2}^{2}\right)$ So, $I = \frac{8}{2} \cdot \left({0.08}^{2} + {0.12}^{2}\right) = 4 \cdot 0.0208 = 0.0832 k g {m}^{2}$ $\Delta \omega = \left(3 - 2\right) \cdot 2 \pi = 2 \pi r a {\mathrm{ds}}^{-} 1$ $\Delta L = 0.0832 \cdot 2 \pi = 0.523 k g m {s}^{- 1}$
2020-06-06 18:38: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": 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.826049268245697, "perplexity": 350.17856608061425}, "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-24/segments/1590348517506.81/warc/CC-MAIN-20200606155701-20200606185701-00446.warc.gz"}
https://en.wikipedia.org/wiki/Talk:NaN
# Talk:NaN WikiProject Computing (Rated Start-class, Mid-importance) This article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks. Start  This article has been rated as Start-Class on the project's quality scale. Mid  This article has been rated as Mid-importance on the project's importance scale. WikiProject Numbers This article is within the scope of WikiProject Numbers, a collaborative effort to improve the coverage of Numbers on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks. ## IEEE How much of the modern NaN (ie the IEEE standard one) was innovation by the standard committee? I would expect at least the spelling "NaN" and the distinction between singalling and quiet NaN to be from the IEEE standard... ## Pronunciation Is NaN an acronym or an initialism? jnestorius(talk) 20:52, 21 September 2006 (UTC) • Yes. Uncle G 12:10, 14 December 2006 (UTC) • Dunno, but she sure is getting old. • NaN = Not a Number. Anthony Appleyard (talk) 15:04, 2 August 2009 (UTC) ## Nullity/Transreal numbers Since AfD went through on the Transreal number article to redirect to here, should we add a mention of it? Someone looking up transreal numbers and just getting this article would be confused, since there's no way they know how they relate. fintler 23:06, 14 December 2006 (UTC) ## Number vs Numeral In the paragraph dealing with the NaN Toolbox, the word numeral is used several times. Should this read number instead? 67.168.55.79 16:31, 19 April 2007 (UTC) ## Canonical NaNs I've had a lot of cross-platform experience with NaNs back in the 1990's. As the current article suggests, all the big h/w vendors fell into one of the two possible camps regarding the representation of signalling and quiet NaNs (basically a difference in interpretation of one bit). This affected data portability but worse still was the situation with private NaN values. The product I worked on then used several private encodings to represent special numeric cases, e.g. uninitialised, error, not-available, etc. Some were quiet and some were signalling. All architectures should have one special quiet NaN representing arithmetic calculations with no valid (real) answer, e.g. 0/0, sqrt(-1), log(0), etc., when trapping is suppressed. In the Intel architecture, this is called 'Indefinite'. A better description is the 'Canonical NaN' -- I cannot give a reference for this term but I believe I first saw it in some old DEC internal documentation. Unfortunately, different vendors used different encodings for this special value and so trying to make your own private encodings distinct from it was like trying to hit a moving target. Even more unfortunate was the fact that some vendors used a different value in their h/w to in their mathematics library, and at least one vendor used a different encoding in different versions of their h/w chipset. Another issue was the way in which NaNs (and Infinities) were generated on some machines. Rather than being generated by h/w, or even f/w, some generated a microtrap that then dispatched to a piece of s/w to determine the correct value to return from the floating-point instruction. This could result in a calculation that generated a special value taking 50-100 times longer than one that generated a normal value. This affected several database products of that era, and especially OLAP products, since it was more efficient to just ignore IEEE special values altogether and select some arbitrary 'large real values' to represent the special cases instead (e.g. 1E38). --TonyP (talk) 19:58, 8 April 2009 (UTC) ## Zero divided by Zero In some cases, NaN is used where numbers may be results. For example, zero divided by zero is ambiguous -- any number multiplied by zero is zero, so zero divided by zero may be any number. In this context, "Not a Number" is an inaccurate description of the result. A more accurate description of this case would be "Not Any Specific Number" or, more simply "Any Number". —Preceding unsigned comment added by 159.54.131.7 (talk) 17:08, 9 September 2009 (UTC) ## Bubbles on beach Mere coincidence that Patrick Mc in The Prisoner: "I am not a number" —Preceding unsigned comment added by 82.19.170.119 (talk) 17:27, 3 October 2009 (UTC) In the original script, he was going to say "I am an arithmetic overflow," but the director liked "not a number" better. Jmdeur (talk) 18:02, 9 November 2009 (UTC) ## Unicode symbol? I'm looking for the unicode symbol if any that is NaN in a single codepoint. Help? 168.251.194.25 (talk) 19:50, 16 December 2009 (UTC) ## 1/0 is NaN? The article says that "For example, 1/0 is undefined as a real number, and so represented by NaN". However, at least in Java, 1/0.0=POSITIVE_INFINITY, not NaN (and 1/-0.0=NEGATIVE_INFINITY, but 0/0.0 is NaN). —Preceding unsigned comment added by 81.20.159.197 (talk) 14:11, 29 January 2010 (UTC) Yes that's very silly, I've gone and replaced it with 0/0. Dmcq (talk) 17:28, 29 January 2010 (UTC) ## ∞^0 omitted? ${\displaystyle \infty ^{0}}$ is listed in Indeterminate form#List of indeterminate forms. Why is it not listed in the list of operations that return an NaN, while ${\displaystyle 1^{\infty }}$ is listed? --71.141.115.178 (talk) 20:26, 18 June 2010 (UTC) I better check the article through for the power function. In fact IEEE 754-2008 has 3 different power operations. The usual one is pow() which tries returning a value rather than a NaN, pow(1,∞) is 1 but powr(1,∞) is an invalid operation and so return NaN. Dmcq (talk) 22:47, 18 June 2010 (UTC) ## Tan(pi/2) Uh... tan(pi/2) is not complex. Should this bullet point be moved into the second of the three categories (in the Creation section)? I haven't the foggiest what whoever put that inmust have been thinking of. I think the line should just be completely removed. tan never returns NaN except for infinity or NaN arguments so it is pretty well behaved. In fact I'll just go and remove it now thanks. 19:45, 17 July 2010 (UTC) ## Indeterminate According to IEEE-754 References, there is a special value *Indeterminate*. It's hard to find any useful information on it. From what little I can tell, it might be a subset of NaN, used specifically for "indeterminate forms". It would be good to properly explain that special value, and how it is the same/differs from NaN. Cmcqueen1975 (talk) 03:18, 12 October 2010 (UTC) The missing reference there is [1]. There is no special 'indeterminate' value but he gives a useful way of thinking about sNaN and qNaN. Dmcq (talk) 09:32, 12 October 2010 (UTC) ## trigonometric and inverse trigonometric functions Worth remembering: 1. Trigonometric functions tan (2x+1)π/2, csc (2x+1)π/2, cot 2πx, and sec 2πx in which x is an integer imply division by zero and thus give only infinite results. 2. Some trigonometric functions have limited ranges for their values: -1 ≤ sin x ≤ 1 -1 ≤ cos x ≤ 1 |sec x| ≥ 1 |csc x| ≥ 1 Inverse trigonometric functions that have x inappropriate for those ranges, including arcsin x > 1, arccos x > 1, -1 < arcsec x < 1, and -1 < arccsc x < 1 can have no values. Calculators obviously give non-numbers for prohibited values for those functions. Pbrower2a (talk) 14:22, 1 February 2013 (UTC) ## Languages that use NaN Would it be relevant to include a list of languages that use NaNs? This section could also include the representation used, which could give more context to the Display section. Paul2520 (talk) 15:43, 7 November 2013 (UTC) ## Hardware and in practice are raised as hardware-level exceptions by the CPU.[1] Seems to me that most hardware generates an exception for fixed point divide by zero, but the exception for fixed point overflow is rare. Converting floating point to integer for out of range values might be considered fixed point overflow. Unless all hardware generates an exception, the statement is wrong. Gah4 (talk) 20:56, 2 October 2015 (UTC) I removed the sentence earlier today. There are no signals for overflow either, so that the GNU libc manual is wrong. On x86, I get -2147483648 even for positive overflow. But I have results of tests done by Bill Allombert in 2004, which show that each processor had its own behavior (never a signal, but different values). Hence the choice of a undefined behavior in C. Vincent Lefèvre (talk) 21:14, 2 October 2015 (UTC) For x86, I believe for x>=0, you need an INTO instruction after any instruction you want to trap for overflow. This does an INT 4 if the OF flag is set. I believe, though, that divide by zero interrupt happens without a special instruction. (In the MS-DOS days, there were some interrupts used by MSDOS and/or the BIOS that conflicted with some processor hardware interrupts. Intel reserved the first 32, but people used them anyway. Gah4 (talk) 23:41, 2 October 2015 (UTC) ## What uses or generates sNaNs? On the topic of signaling NaN, article says "There have been several ideas for how these might be used:" ... "In practice this approach is faced with many complications". As far as I can tell, nobody has ever successfully used signaling NaNs for anything (and most environments disable them by default). If this is true, perhaps the article should say more a little clearly that almost nobody ever uses or encounters signaling NaNs? Or, if it's false, the article could mention an example of a product/project/technology which uses them. 50.197.188.73 (talk) 06:05, 1 December 2015 (UTC)
2017-03-23 12:05:25
{"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.5225814580917358, "perplexity": 2814.4644511856554}, "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/1490218186891.75/warc/CC-MAIN-20170322212946-00371-ip-10-233-31-227.ec2.internal.warc.gz"}
https://math.stackexchange.com/questions/3465332/computing-legendre-symbol-of-a-p-prime-number-raised-to-prime-number-mod-p
Computing Legendre symbol of a (p = prime number raised to prime number) mod p? Example: What is the Legendre Symbol $$(\frac{3^{24671}}{105953})$$? Since ($$\frac{3}{105953}$$) $$= -1$$ and the exponent p = prime = $$24671$$ is odd, would this mean the answer would be -1? By quadratic reciprocity we have $$\left(\frac{3}{105953}\right)=\left(\frac{105953}{3}\right)=\left(\frac{2}{3}\right)=-1$$, since $$105953\equiv 1\bmod 4$$, and therefore $$\left(\frac{3^p}{105953}\right)=\left(\frac{3}{105953}\right)^p=\left(\frac{2}{3}\right)^p=(-1)^p=-1.$$
2020-01-28 23:57: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": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 7, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9265387058258057, "perplexity": 294.5274816422886}, "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-2020-05/segments/1579251783342.96/warc/CC-MAIN-20200128215526-20200129005526-00314.warc.gz"}
https://docs.aptech.com/gauss/dstatmt.html
# dstatmt¶ ## Purpose¶ Compute descriptive statistics. ## Format¶ dout = dstatmt(data[, vars[, ctl]]) Parameters • data (string or dataframe) – A dataframe or the name of dataset. If data is an empty string or 0, vars will be assumed to be a matrix containing the data. • vars (string or string array) – the variables. If data contains a dataframe or the name of a dataset, vars will be interpreted as either: • A Kx1 character vector containing the names of variables. • A Kx1 numeric vector containing indices of variables. • A formula string. e.g. "PAY + WT" or ". - sex" These can be any size subset of the variables in the dataset and can be in any order. If a scalar 0 is passed, all columns of the dataset will be used. If data is an empty string or 0, vars will be interpreted as an NxK matrix, the data on which to compute the descriptive statistics. • ctl (Optional input) – instance of a dstatmtControl structure containing the following members: ctl.altnames Kx1 string array of alternate variable names to be used if a matrix in memory is analyzed (i.e., dataset is a null string or 0). Default = “”. ctl.maxbytes scalar, the maximum number of bytes to be read per iteration of the read loop. Default = 1e9. ctl.vartype scalar, unused in dstatmt. ctl.miss scalar, default 0. 0 there are no missing values (fastest). 1 listwise deletion, drop a row if any missings occur in it. 2 pairwise deletion. ctl.row scalar, the number of rows to read per iteration of the read loop.If 0, (default) the number of rows will be calculated using ctl.maxbytes and maxvec. ctl.output scalar, controls output, default 1. 1 print output table. 0 do not print output. Returns dout (struct) – instance of dstatmtOut struct structure containing the following members: dout.vnames Kx1 string array, the names of the variables used in the statistics. dout.mean Kx1 vector, means. dout.var Kx1 vector, variance. dout.std Kx1 vector, standard deviation. dout.min Kx1 vector, minima. dout.max Kx1 vector, maxima. dout.valid Kx1 vector, the number of valid cases. dout.missing Kx1 vector, the number of missing cases. dout.errcode scalar, error code, 0 if successful; otherwise, one of the following: 2 Can’t open file. 7 Too many missings - no data left after packing. 9 altnames member of dstatmtControl structure wrong size. 10 vartype member of dstatmtControl structure wrong size. ## Examples¶ ### Computing statistics on a GAUSS dataset¶ // Create file name with full path file_name = getGAUSSHome() $+ "examples/fueleconomy.dat"; /* ** Compute statistics for all variables in the dataset ** The 'call' keyword disregards return values from the function */ call dstatmt(file_name); The above example will print the following report to the Command window: ---------------------------------------------------------------------------------------- Variable Mean Std Dev Variance Minimum Maximum Valid Missing ---------------------------------------------------------------------------------------- annual_fuel_cost 2.537 0.6533 0.4267 1.05 5.70 978 0 engine_displacement 3.233 1.376 1.892 1.00 8.40 978 0 The code below uses the second input, vars, to compute only the descriptive statistics for the second variable. // Create file name with full path file_name = getGAUSSHome()$+ "examples/fueleconomy.dat"; // Only calculate statistics on the second variable vars = 2; // Compute statistics for only the second variable in the dataset call dstatmt(file_name, vars); The following report is printed to the Command window. ---------------------------------------------------------------------------------------- Variable Mean Std Dev Variance Minimum Maximum Valid Missing ---------------------------------------------------------------------------------------- engine_displacement 3.233 1.376 1.892 1 8.4 978 0 ### Computing statistics on a csv dataset with formula string¶ // Create file name with full path file_name = getGAUSSHome() $+ "examples/binary.csv"; // Set up a formula string with variables "gre" and "gpa" vars = "gre + gpa"; /* ** Compute statistics for all variables in the dataset ** The 'call' keyword disregards return values from the function */ call dstatmt(file_name, vars); The above example will print the following report to the Command window: -------------------------------------------------------------------------------- Variable Mean Std Dev Variance Minimum Maximum Valid Missing -------------------------------------------------------------------------------- gre 587.7 115.5 1334e+04 220 800 400 0 gpa 3.39 0.3806 0.1448 2.26 4 400 0 ### Using control and out structures¶ // Create file name with full path file_name = getGAUSSHome()$+ "examples/credit.dat"; // Declare control structure and fill in with defaults struct dstatmtControl dctl; dctl = dstatmtControlCreate(); // Do not print output to the screen dctl.output = 0; // Declare output structure struct dstatmtOut dout; // Calculate statistics on the 1st, 3rd and 6th variables vars = { 1, 3, 6 }; // Calculate statistics, and place output in 'dout' dout = dstatmt(file_name, vars, dctl); // Print calculated means and variable names print dout.mean; print dout.vnames; The code above should print the following output: 45.218885 354.94000 13.450000 Income Rating Education ### Computing statistics on a matrix¶ // Set random number seed for repeatable random numbers rndseed 32452; // Create a random matrix on which to compute statistics X = rndn(10, 3); /* ** The empty string as the second input tells GAUSS to ** compute statistics on a matrix rather than a dataset */ call dstatmt("", X); The code above will print out the following report: ------------------------------------------------------------------------------- Variable Mean Std Dev Variance Minimum Maximum Valid Missing ------------------------------------------------------------------------------- X1 0.2348 0.8164 0.6664 -1.0736 1.46 10 0 X2 -0.5062 1.126 1.267 -2.223 1.269 10 0 X3 0.5011 0.7758 0.6018 -0.6119 1.823 10 0 ### Computing statistics on a matrix, using structures¶ // Set random number seed for repeatable random numbers rndseed 32452; // Declare control structure and fill with default values struct dstatmtControl dctl; dctl = dstatmtControlCreate(); // Variable names for printed output dctl.altnames = "Alpha"$|"Beta"$|"Gamma"; // Declare structure to hold output values struct dstatmtOut dout; // Create a random matrix on which to compute statistics X = rndn(10, 3); /* ** The empty string as the second input tells GAUSS to ** compute statistics on a matrix rather than a dataset */ dout = dstatmt("", X, dctl); This time, the following output will be printed to the screen: ------------------------------------------------------------------------------ Variable Mean Std Dev Variance Minimum Maximum Valid Missing ------------------------------------------------------------------------------ Alpha 0.2348 0.8164 0.6664 -1.074 1.46 10 0 Beta -0.5062 1.1256 1.267 -2.223 1.269 10 0 Gamma 0.5011 0.7758 0.6018 -0.6119 1.823 10 0 ## Remarks¶ 1. If pairwise deletion is used, the minima and maxima will be the true values for the valid data. The means and standard deviations will be computed using the correct number of valid observations for each variable. 2. For backwards compatiblitity, the following format is still supported: dout = dstatmt(dctl, dataset, vars); However, all new code should use one of the formats listed at the top of this document. 3. The supported dataset types are CSV, XLS, XLSX, HDF5, FMT, DAT, DTA 4. For HDF5 files, the dataset must include a file schema and both file name and dataset name must be provided, e.g. dstatmt("h5://testdata.h5/mydata"). ## Source¶ dstatmt.src Functions dstatmtControlCreate(), formula string
2022-10-06 04:26: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": 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.2648436725139618, "perplexity": 7787.873635579761}, "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/1664030337723.23/warc/CC-MAIN-20221006025949-20221006055949-00546.warc.gz"}
https://blender.stackexchange.com/questions/130463/add-hot-key-for-align-to-axis
# Add hot key for align to axis? Is there any way to map the sequence of commands "s, x, 0", "s, y, 0", and "s, z, 0" to keys? I use these a lot while modeling, and was hoping to map them to a single button, but can't seem to find any way to do it. I was able to achieve this in the UV editor using the align commands. I tried copying the python output of these commands to a custom hot-key, but it didn't work. I'm a programmer, but I don't know much about python. It seemed like the script was too complex for a hot key. Save this to a .py file and install it as an addon import bpy bl_info = { "name": "Scale 0 Operators", "version": (1, 0), "blender": (2, 7, 0), "location": "", "description": "", "category": "User", } class scale_x_0(bpy.types.Operator): bl_idname = "view3d.scale_x_0" bl_label = "Scale X 0" def execute(self, context): bpy.ops.transform.resize(value=(0, 1, 1)) return {"FINISHED"} class scale_y_0(bpy.types.Operator): bl_idname = "view3d.scale_y_0" bl_label = "Scale Y 0" def execute(self, context): bpy.ops.transform.resize(value=(1, 0, 1)) return {"FINISHED"} class scale_z_0(bpy.types.Operator): bl_idname = "view3d.scale_z_0" bl_label = "Scale Z 0" def execute(self, context): bpy.ops.transform.resize(value=(1, 1, 0)) return {"FINISHED"} def register(): bpy.utils.register_class(scale_x_0) bpy.utils.register_class(scale_y_0) bpy.utils.register_class(scale_z_0) def unregister(): bpy.utils.unregister_class(scale_x_0) bpy.utils.unregister_class(scale_y_0) bpy.utils.unregister_class(scale_z_0) This will allow you to set a shortcut for each "scale 0" action. So after enabling the addon, navigate to User Preferences -> Input -> 3D View -> 3D View (Global) and add shorcuts by inserting corresponding operators, i.e. for scale X = 0, enter view3d.scale_x_0: It should work for UV editor too, just assign the shortcuts again in Input -> Image -> UV Editor.
2019-11-20 11:44:47
{"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.3971084952354431, "perplexity": 7866.983744589502}, "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/1573496670558.91/warc/CC-MAIN-20191120111249-20191120135249-00148.warc.gz"}
http://www.algorithm.uni-bayreuth.de/en/research/qdiscreta/systematic_construction/node4.html
´ The q-analog of the Kramer-Mesner matrix The next step in the construction is the evaluation of the entries of the Kramer-Mesner matrices. We achieve this goal by using the information obtained during the ladder game. We can restrict attention to Kramer-Mesner matrices , because of (The analogous equation -- with binomial coefficients instead of the Gaussian numbers -- holds for designs on sets, the proof of it is easily generalized to the -analog. The matrix can be obtained as follows: We assume the representatives of the double cosets of and , representatives of the double cosets of and and the corresponding orbit graph. Now the entry of indexed by the orbits is where the sum is over all double cosets which are connected with the double coset and which are connected with the double coset at the same time. If we take our last example then we get the Kramer-Mesner matrix: (3,0,4) (3,1,2,) (3,2,6) (3,3,6) (3,4,8) (3,5,4) (5,0,6) 6/2 6/2 0 6/6 0 0 (5,1,4) 4/4 4/2 4/2 0 4/4 4/4 (5,2,6) 0 6/2 0 6/6 0 6/2 (5,3,24) 0 0 0 24/6 24/8 0 , and thus the -analog of the Kramer-Mesner matrix turns out to be Back to the title page University of Bayreuth -
2017-09-19 22:36:48
{"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.9785566926002502, "perplexity": 435.6900027948089}, "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-39/segments/1505818686043.16/warc/CC-MAIN-20170919221032-20170920001032-00105.warc.gz"}
https://www.shaalaa.com/question-bank-solutions/long-answer-question-what-is-blood-pressure-how-is-it-measured-explain-factors-affecting-blood-pressure-blood-pressure-bp_161187
# Long answer question: What is blood pressure? How is it measured? Explain factors affecting blood pressure. - Biology What is blood pressure? How is it measured? Explain the factors affecting blood pressure. #### Solution The pressure exerted by blood on the wall of the blood vessels is called blood pressure. It is measured by the sphygmomanometer. It is usually measured from the arteries. The factors affecting blood pressure are: 1. Cardiac output: The normal cardiac output is 5 litres/min. An increase in cardiac output increases systolic pressure. 2. Peripheral resistance: It depends upon the diameter of blood vessels. A decrease in the diameter of arterioles and capillaries under the effect of vasoconstrictors like vasopressin or ADH causes an increase in peripheral resistance and thereby increase in blood pressure. 3. Blood volume: Blood loss in accidents decreases blood volume, and thus the blood pressure. 4. Viscosity of blood: Blood pressure is directly proportional to the viscosity of blood. 5. Age: Blood pressure increases with age due to an increase in the inelasticity of blood vessels. 6. Venous return: The amount of blood brought to the heart via the veins per unit time is called the venous return. It is directly proportional to blood pressure. 7. Length of blood vessel: Blood pressure is also directly proportional to the total length of the blood vessel. Blood pressure can also be affected by vasoconstriction or vasodilation. 8. Gender: Females have slightly lower BP than males before the age of menopause. However, the risk of high B. P. increases in the females after menopause sets in. Concept: Blood Pressure (B.P.) Is there an error in this question or solution? #### APPEARS IN Balbharati Biology 12th Standard HSC for Maharashtra State Board Chapter 8 Respiration and Circulation Exercises | Q 7.09 | Page 181
2022-09-30 17:10:10
{"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.8206101059913635, "perplexity": 4718.075061037378}, "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-2022-40/segments/1664030335491.4/warc/CC-MAIN-20220930145518-20220930175518-00648.warc.gz"}
https://people.eng.unimelb.edu.au/ammoffat/conferences96/abstracts/acsc.8a.1.html
### A practical orthogonal memory processor for the 2D wavelet transform Robert Lang Department of Electrical and Computer Engineering, The University of Newcastle, Callaghan 2308, Australia. rlang@ascod.newcastle.edu.au Andrew Spray Department of Electrical and Computer Engineering, The University of Newcastle, Callaghan 2308, Australia. aspray@faceng.newcastle.edu.au #### Abstract In this paper we show how the Orthogonal Memory Processor (OMP) is suited to the implementation of the two-dimensional wavelet transform (2DWT) due to its ability to transpose a data-set in negligible time. The OMP architecture is a shared memory machine in which the processing elements can alternately (together) access either rows or columns of the two-dimensional data-set. Since the 2DWT involves alternate accesses of row and column data, it is an application well-suited to this machine. As a further contribution, this paper extends the work of the general OMP architecture to include consideration of a hybrid'' configuration with $n$ processors and a $m \times m$ memory network for some practical value of $m < n$. Pipelined memory accesses allow an architecture with an optimal processor count compared to the problem size and a more practical memory structure. Tradeoffs are presented in terms of number of processors and memory unit size to determine how complex (in terms of area) the architecture needs to be to produce a desired performance (in terms of time).
2022-08-13 15:32: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": 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.17457035183906555, "perplexity": 854.3476155765067}, "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/1659882571959.66/warc/CC-MAIN-20220813142020-20220813172020-00004.warc.gz"}
https://physics.stackexchange.com/questions/480043/claim-that-debroglie-relation-doesnt-work-in-crystal
# Claim that DeBroglie relation doesn't work in crystal In this Wikipedia article on Position and Momentum Space, https://en.wikipedia.org/wiki/Position_and_momentum_space there is a claim that "the de Broglie relation is not true in a crystal" in the sentence before the content box. Is this claim valid? If so, why? What is the implications for quasi-particles (e.g. plasmons and polaritons) in materials? • Since particles and quasi-particles are not "free" in a periodic crystal potential, the de Broglie relation does not apply. You need to use Bloch functions to describe the particles. – Jon Custer May 14 at 17:04 In a crystal, $$\vec p$$ does not necessarily have the same direction than $$\vec k$$. So, I suppose that it's indeed true that the de Broglie relation ($$\vec p = \hbar \vec k$$) does not always hold in a crystal. If we take a perfect crystal, then the wavefunction of an electron can be written as the Bloch electron wavefunction $$\Psi = u(\vec r) e^{i\vec k \cdot \vec r}$$ where $$u(\vec r)$$ is a periodic function whose periodicity matches the lattice's. By applying the momentum operator $$\hat p =-i\hbar \nabla_\vec r$$ to that wavefunction, one finds that it's equal to $$\hbar \vec k \Psi + \text{something not proportional to } \Psi$$ (nor to $$\vec k$$ for that matter.). Here, $$\hbar \vec k$$ is called the crystal momentum and does not match the electron's momentum. See Ashcroft and Mermin pages 139 and 219 for a detailed discussion about that. • Then what is the tensor in units of $\hbar$ that gives you a different momentum direction from the wavevector? – wcc May 14 at 22:54
2019-08-19 02:29:35
{"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": 9, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.8323976397514343, "perplexity": 377.77595269145706}, "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-35/segments/1566027314638.49/warc/CC-MAIN-20190819011034-20190819033034-00076.warc.gz"}
https://artofproblemsolving.com/wiki/index.php?title=2019_AMC_8_Problems/Problem_5&diff=prev&oldid=122286
# Difference between revisions of "2019 AMC 8 Problems/Problem 5" ## Problem 5 A tortoise challenges a hare to a race. The hare eagerly agrees and quickly runs ahead, leaving the slow-moving tortoise behind. Confident that he will win, the hare stops to take a nap. Meanwhile, the tortoise walks at a slow steady pace for the entire race. The hare awakes and runs to the finish line, only to find the tortoise already there. Which of the following graphs matches the description of the race, showing the distance $d$ traveled by the two animals over time $t$ from start to finish? ## Solution 1 (we shouldn't be able to edit) First, the tortoise walks at a constant rate, ruling out $(D)$ Second, when the hare is resting, the distance will stay the same, ruling out $(E)$ and $(C)$. Third, the tortoise wins the race, meaning that the non-constant one should go off the graph last, ruling out $(A)$. Therefore, the answer $\boxed{\textbf{(B)}}$ is the only one left. ## Solution 2 First, we know that the rabbit beats the tortoise in the first half of the race. So he is going to be ahead of the tortoise. We also know, while he rested, he didn't move. The only graph portraying that is going to be $\boxed{\textbf{(B)}}$. This is our answer. ~bobthefam ## also see 2019 AMC 8 (Problems • Answer Key • Resources) Preceded byProblem 4 Followed byProblem 6 1 • 2 • 3 • 4 • 5 • 6 • 7 • 8 • 9 • 10 • 11 • 12 • 13 • 14 • 15 • 16 • 17 • 18 • 19 • 20 • 21 • 22 • 23 • 24 • 25 All AJHSME/AMC 8 Problems and Solutions
2021-09-20 06:32: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": 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.4947907328605652, "perplexity": 2309.5982896460105}, "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-00107.warc.gz"}
https://www.aimsciences.org/article/doi/10.3934/dcdsb.2015.20.811
# American Institute of Mathematical Sciences • Previous Article Stochastic dynamics in a fluid--plate interaction model with the only longitudinal deformations of the plate • DCDS-B Home • This Issue • Next Article Strong uniform attractors for non-autonomous dissipative PDEs with non translation-compact external forces May  2015, 20(3): 811-832. doi: 10.3934/dcdsb.2015.20.811 ## Trajectory attractors for non-autonomous dissipative 2d Euler equations 1 Institute for Information Transmission Problems, Russian Academy of Sciences, Bolshoy Karetniy 19, Moscow 127994, GSP-4, Russian Federation Received  November 2013 Revised  May 2014 Published  January 2015 We construct the trajectory attractor $\mathfrak{A}_{\Sigma }$ for the non-autonomous dissipative 2d Euler systems with periodic boundary conditions that contain time dependent dissipation terms $-r(t)u$ such that $0<\alpha \le r(t)\le \beta$, for $t\ge 0$. External forces $g(x,t),x\in \mathbb{T}^{2},t\ge 0,$ also depend on time. The corresponding non-autonomous dissipative 2d Navier--Stokes systems with the same terms $-r(t)u$ and $g(x,t)$ and with viscosity $\nu >0$ also have the trajectory attractor $\mathfrak{A}_{\Sigma }^{\nu }.$ Such systems model large-scale geophysical processes in atmosphere and ocean. We prove that $\mathfrak{A}_{\Sigma }^{\nu }\rightarrow \mathfrak{A}_{\Sigma }$ as viscosity $\nu \rightarrow 0+$ in the corresponding metric space. Moreover, we establish the existence of the minimal limit $\mathfrak{A}_{\Sigma }^{\min }\subseteq \mathfrak{A}_{\Sigma }$ of the trajectory attractors $\mathfrak{A}_{\Sigma }^{\nu }$ as $\nu \rightarrow 0+.$ Every set $\mathfrak{A}_{\Sigma }^{\nu }$ is connected. We prove that $\mathfrak{A}_{\Sigma }^{\min }$ is a connected invariant subset of $\mathfrak{A}_{\Sigma }.$ The problem of the connectedness of the trajectory attractor $\mathfrak{A}_{\Sigma }$ itself remains open. Citation: Vladimir V. Chepyzhov. Trajectory attractors for non-autonomous dissipative 2d Euler equations. Discrete & Continuous Dynamical Systems - B, 2015, 20 (3) : 811-832. doi: 10.3934/dcdsb.2015.20.811 ##### References: show all references ##### References: [1] Gianluca Crippa, Elizaveta Semenova, Stefano Spirito. Strong continuity for the 2D Euler equations. Kinetic & Related Models, 2015, 8 (4) : 685-689. doi: 10.3934/krm.2015.8.685 [2] Igor Kukavica, Amjad Tuffaha. On the 2D free boundary Euler equation. Evolution Equations & Control Theory, 2012, 1 (2) : 297-314. doi: 10.3934/eect.2012.1.297 [3] Gabriel Deugoue. Approximation of the trajectory attractor of the 3D MHD System. Communications on Pure & Applied Analysis, 2013, 12 (5) : 2119-2144. doi: 10.3934/cpaa.2013.12.2119 [4] A. Rousseau, Roger Temam, J. Tribbia. Boundary conditions for the 2D linearized PEs of the ocean in the absence of viscosity. Discrete & Continuous Dynamical Systems - A, 2005, 13 (5) : 1257-1276. doi: 10.3934/dcds.2005.13.1257 [5] Boling Guo, Yongqian Han, Guoli Zhou. Random attractor for the 2D stochastic nematic liquid crystals flows. Communications on Pure & Applied Analysis, 2019, 18 (5) : 2349-2376. doi: 10.3934/cpaa.2019106 [6] María J. Martín, Jukka Tuomela. 2D incompressible Euler equations: New explicit solutions. Discrete & Continuous Dynamical Systems - A, 2019, 39 (8) : 4547-4563. doi: 10.3934/dcds.2019187 [7] Holger Dullin, Yuri Latushkin, Robert Marangell, Shibi Vasudevan, Joachim Worthington. Instability of unidirectional flows for the 2D α-Euler equations. Communications on Pure & Applied Analysis, 2020, 19 (4) : 2051-2079. doi: 10.3934/cpaa.2020091 [8] Vladimir V. Chepyzhov, E. S. Titi, Mark I. Vishik. On the convergence of solutions of the Leray-$\alpha$ model to the trajectory attractor of the 3D Navier-Stokes system. Discrete & Continuous Dynamical Systems - A, 2007, 17 (3) : 481-500. doi: 10.3934/dcds.2007.17.481 [9] Fucai Li, Zhipeng Zhang. Zero viscosity-resistivity limit for the 3D incompressible magnetohydrodynamic equations in Gevrey class. Discrete & Continuous Dynamical Systems - A, 2018, 38 (9) : 4279-4304. doi: 10.3934/dcds.2018187 [10] J. Huang, Marius Paicu. Decay estimates of global solution to 2D incompressible Navier-Stokes equations with variable viscosity. Discrete & Continuous Dynamical Systems - A, 2014, 34 (11) : 4647-4669. doi: 10.3934/dcds.2014.34.4647 [11] Jitao Liu. On the initial boundary value problem for certain 2D MHD-$\alpha$ equations without velocity viscosity. Communications on Pure & Applied Analysis, 2016, 15 (4) : 1179-1191. doi: 10.3934/cpaa.2016.15.1179 [12] Igor Kukavica. Interior gradient bounds for the 2D Navier-Stokes system. Discrete & Continuous Dynamical Systems - A, 2001, 7 (4) : 873-882. doi: 10.3934/dcds.2001.7.873 [13] Chunhua Li. Decay of solutions for a system of nonlinear Schrödinger equations in 2D. Discrete & Continuous Dynamical Systems - A, 2012, 32 (12) : 4265-4285. doi: 10.3934/dcds.2012.32.4265 [14] Wenru Huo, Aimin Huang. The global attractor of the 2d Boussinesq equations with fractional Laplacian in subcritical case. Discrete & Continuous Dynamical Systems - B, 2016, 21 (8) : 2531-2550. doi: 10.3934/dcdsb.2016059 [15] P. Kaplický, Dalibor Pražák. Lyapunov exponents and the dimension of the attractor for 2d shear-thinning incompressible flow. Discrete & Continuous Dynamical Systems - A, 2008, 20 (4) : 961-974. doi: 10.3934/dcds.2008.20.961 [16] Aslihan Demirkaya. The existence of a global attractor for a Kuramoto-Sivashinsky type equation in 2D. Conference Publications, 2009, 2009 (Special) : 198-207. doi: 10.3934/proc.2009.2009.198 [17] Tamara Fastovska. Upper semicontinuous attractor for 2D Mindlin-Timoshenko thermoelastic model with memory. Communications on Pure & Applied Analysis, 2007, 6 (1) : 83-101. doi: 10.3934/cpaa.2007.6.83 [18] Jishan Fan, Tohru Ozawa. A regularity criterion for 3D density-dependent MHD system with zero viscosity. Conference Publications, 2015, 2015 (special) : 395-399. doi: 10.3934/proc.2015.0395 [19] Elaine Cozzi, James P. Kelliher. Well-posedness of the 2D Euler equations when velocity grows at infinity. Discrete & Continuous Dynamical Systems - A, 2019, 39 (5) : 2361-2392. doi: 10.3934/dcds.2019100 [20] Fei Hou, Huicheng Yin. On global axisymmetric solutions to 2D compressible full Euler equations of Chaplygin gases. Discrete & Continuous Dynamical Systems - A, 2020, 40 (3) : 1435-1492. doi: 10.3934/dcds.2020083 2019 Impact Factor: 1.27
2020-08-15 04:59: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": 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.5624001026153564, "perplexity": 3747.2286782753467}, "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-34/segments/1596439740679.96/warc/CC-MAIN-20200815035250-20200815065250-00515.warc.gz"}
https://walkccc.me/LeetCode/problems/0997/
# 997. Find the Town Judge • Time: $O(|\texttt{trust}| + n)$ • Space: $O(n)$ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 class Solution { public: int findJudge(int n, vector>& trust) { vector count(n + 1); for (vector& t : trust) { --count[t[0]]; ++count[t[1]]; } for (int i = 1; i < n + 1; ++i) if (count[i] == n - 1) return i; return -1; } }; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 class Solution { public int findJudge(int n, int[][] trust) { int[] count = new int[n + 1]; for (int[] t : trust) { --count[t[0]]; ++count[t[1]]; } for (int i = 1; i < n + 1; ++i) if (count[i] == n - 1) return i; return -1; } } 1 2 3 4 5 6 7 8 9 10 11 12 13 class Solution: def findJudge(self, n: int, trust: List[List[int]]) -> int: count = [0] * (n + 1) for a, b in trust: count[a] -= 1 count[b] += 1 for i in range(1, n + 1): if count[i] == n - 1: return i return -1
2023-03-24 21:43:24
{"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.18417565524578094, "perplexity": 841.5114676271538}, "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/1679296945289.9/warc/CC-MAIN-20230324211121-20230325001121-00212.warc.gz"}
https://math.stackexchange.com/questions/2440397/in-how-many-ways-3-couples-can-be-arranged-in-a-line-such-that-each-husband-is-a
# In how many ways 3 couples can be arranged in a line such that each husband is ahead of his wife? In how many ways 3 couples can be arranged in a line such that each husband is ahead of his wife? a) $81$ b) $90$ c) $110$ d) $125$ e) $132$ I tried to solve this, as 3 couples are there and they should be together, number of permutations are $3!$ and as it is fixed that each husband will be ahead of his wife, no further permutation is required for husband and wife. Thus, my answer is $3! = 6$, but it is nowhere close to any of the option. • You are only considering the case where the husband is directly in front of the wife. The husband may be 2 people behind or even further and the condition in the question is still satisfied – Harry Alli Sep 22 '17 at 13:11 • @HarryAlli I assume you mean "2 people ahead" but yes, I think your comment is correct – Gregory J. Puleo Sep 22 '17 at 13:12 • @HarryAlli Thanks, I interpreted it wrongly. – AMAN Sep 22 '17 at 17:26 $${6\choose2}{4\choose2}{2\choose2}=15\times6\times1=\mathbf{90}$$
2019-08-24 13:57: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": 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.8089509010314941, "perplexity": 378.25455371440074}, "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-35/segments/1566027321140.82/warc/CC-MAIN-20190824130424-20190824152424-00224.warc.gz"}
https://vandrona.xwiki.org/xwiki/bin/view/ReleaseNotes/ReleaseNotesXWikiEnterprise11RC1?viewer=changes&rev1=1.2&rev2=1.4
# Changes for page ReleaseNotesXWikiEnterprise11RC1 < From version edited by Sergiu Dumitriu on 2007/08/30 To version edited by Jeremie Bousquet on 2007/08/30 > Change comment: There is no comment for this version ## Details Page properties Author ... ... @@ -1,1 +1,1 @@ 1 -XWiki.sdumitriu 1 +XWiki.jbousque Content ... ... @@ -1,5 +1,7 @@ 1 1 1 Release Notes for XWiki 1.1 Enterprise Release Candidate 1 2 2 3 +#error("We've just discovered a bug in 1.1RC1 with the Code macro. See http://jira.xwiki.org/jira/browse/XWIKI-1679"). 4 + 3 3 Version 1.1 RC 1 is mostly a bug fix release. 4 4 5 5 #toc("" "" "") ... ... @@ -26,6 +26,8 @@ 26 26 27 27 * [Bugs we know about>http://jira.xwiki.org/jira/secure/IssueNavigator.jspa?reset=true&&type=1&pid=10010&resolution=-1&sorter/field=updated&sorter/order=DESC] 28 28 31 +#error("We've just discovered a bug in 1.1RC1 with the Code macro. See http://jira.xwiki.org/jira/browse/XWIKI-1679.") 32 + 29 29 1.1 Upgrading from any version 30 30 31 31 Upgrading from 1.1 Milestone 4 doesn't require any special steps, as there weren't any changes in the core structure.
2023-03-26 08:12: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.8922515511512756, "perplexity": 10640.224988440317}, "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/1679296945440.67/warc/CC-MAIN-20230326075911-20230326105911-00401.warc.gz"}
https://math.stackexchange.com/questions/3151348/first-order-logic-proving-an-argument-is-invalid
# First order logic - proving an argument is invalid The question asks to construct a derivation of the argument if it's valid, and otherwise to provide an arithmetical interpretation which shows it's invalid. Am I doing this correctly? Argument: "All good critics like every poet mentioned in the lecture. No good critic likes Edgar Guest, although Edgar Guest is a poet. Therefore, Edgar Guest was not mentioned in the lecture." Let $$C(x)\leftrightarrow x\ is\ a\ good\ critic$$ $$L(x,y) \leftrightarrow x\ likes\ y$$ $$P(x) \leftrightarrow x\ is\ a\ poet$$ $$M(x) \leftrightarrow x\ was\ mentioned\ in\ the\ lecture$$ $$g = Edgar\ Guest$$ I symbolise the premises of the argument as: Premise 1: $$\forall x(C(x)\rightarrow \forall y(M(y)\wedge P(y) \rightarrow L(x,y)))$$ Premise 2: $$P(g)\wedge\forall x(C(x) \rightarrow \neg L(x,g))$$ The conclusion is $$\neg M(g)$$ In my first attempt, I tried to prove that the argument is true by assuming the negation of the desired conclusion, $$M(g)$$, and finding a contradiction. However, it only led me to conclude from the premises that $$\forall x(M(g) \rightarrow \neg C(x))$$ So I tried to find an interpretation which makes the argument invalid and found the following: Domain: $$\mathbb{Z}^+$$ $$C(x) \leftrightarrow x < 1$$ $$P(x) \leftrightarrow x\ is\ prime$$ $$M(x) \leftrightarrow x=2$$ $$L(x,y) \leftrightarrow x $$g=2$$ Essentially I chose an interpretation of $$C(x)$$ so that implications in which $$C(x)$$ is an antecedent are always true because $$C(x)$$ is always false. This allows the first premise to be true. Note that this also makes the second term of the second premise true. I then choose an interpretation of $$P(x)$$ and $$M(x)$$ so that $$P(g)$$ ("2 is prime") is true while $$\neg M(g)$$ ("2$$\neq$$2") is false. Is this solution fine? Indeed, in your first attempt you only managed to show that $$\forall x (M(g)\to\neg C(x))$$, which is equivalent to $$\forall x(C(x)\to\neg M(g))$$ (by contraposition). This indicates already that to conclude that $$g$$ was not mentioned in the lecture, the universe must contain at least one $$x$$ that is a good critic. In other words, "there is still the possibility that $$g$$ was mentioned and that is in case no one is a good critic".
2019-08-21 22:54: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": 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": 29, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9445287585258484, "perplexity": 336.28657660252105}, "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-35/segments/1566027316549.78/warc/CC-MAIN-20190821220456-20190822002456-00062.warc.gz"}
https://mathoverflow.net/questions/333127/errata-for-bott-and-tus-book-differential-forms-in-algebraic-topology
Errata for Bott and Tu's book “Differential Forms in Algebraic Topology” My book is Differential Forms in Algebraic Topology by Loring W. Tu and Raoul Bott of which An Introduction to Manifolds by Tu is a prequel. Is there a good list of errata for Bott and Tu available? A cursory Google search reveals not much except this: Some possible mistakes in Bott and Tu, and possibly more here though uncompiled. Is there any source available online which lists inaccuracies and gaps? • The question might be reasonable, but regarding "I'm hoping something off topic on stackexchange would be on topic on overflow." <-- anything on-topic at MathOverflow is on-topic at math.SE, though the attention it might receive is different. If it's legitimately off-topic there, then it's off-topic here. And note that old questions from almost 9 years ago are not necessarily a good guide to what is now accepted. – David Roberts Jun 3 at 5:45 • I will just mention that this book has an entry in Math Book Notes Wiki: Bott and Tu - Differential Forms in Algebraic Topology. – Martin Sleziak Jun 3 at 5:50 • @DavidRoberts "anything on-topic at MathOverflow is on-topic at math.SE": well, almost. For instance math.stackexchange.com/questions/3135015 (now open) has been closed 3 times in MathSE (by 15 users) while probably nobody here would have the idea of closing it. – YCor Jun 3 at 7:17 • I thought M.SE was for mathematics questions at all levels? Or is that a euphemism? – David Roberts Jun 3 at 8:02 • As differences between (closures of posts on) MO and MSE seem to be a tangential topic to the question at hand, I have posted some comments on this in chat rather than continuing the discussion here. – Martin Sleziak Jun 3 at 8:29 In section 5, the closed Poincaré dual should be characterized with $$\int_M \eta_S \wedge \omega$$ and not $$\int_M \omega \wedge \eta_S$$. As for the implications on the compact Poincaré dual, I'm waiting for answers or comments here: Closed Poincaré dual is $\int_M \eta_S \wedge \omega$ and not $\int_M \omega \wedge \eta_S$. What about the compact Poincaré dual?
2019-08-25 21:03:40
{"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": 2, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.37374964356422424, "perplexity": 1161.5542507434527}, "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-35/segments/1566027330800.17/warc/CC-MAIN-20190825194252-20190825220252-00345.warc.gz"}
https://www.mail-archive.com/types-list@lists.seas.upenn.edu/msg00215.html
# Re: [TYPES] decidability vs completeness [ The Types Forum, http://lists.seas.upenn.edu/mailman/listinfo/types-list ] hi paul, this sort of example well exemplifies the fundamental conceptual difference between nuprl and coq. the core of coq is martin-lof's itt. the system ett is, by definition, itt extended with equality reflection and uniqueness of identity proofs. it is often misrepresented that nuprl is ett, usually on passage to a "critique" of nuprl on the grounds that the typing judgment in nuprl is not decidable, and supposedly this is a cardinal principle that ought to hold for all type theories. but nuprl is not ett. say what you want about ett, but it has no bearing on nuprl. the reason is that the nuprl typing relation (written "in" in ascii, written "\in" in print) is not at all intended to be, and never was intended to be, the coq typing relation (written ":" in both ascii and in print). comparing the two to each other is not really sensible; each is trying to express a different thing. in nuprl it would be the case that t_m in (nat->bool), but as you mention it would not be the case that in coq t_m : (nat->bool). the reason is that the typing judgment in nuprl represents a statement about the a priori given execution behavior of a program, whereas in coq the analogous statement is about the grammar of programs themselves, before they ever get to be thought of as having execution behavior. put in other terms, nuprl is a theory of TRUTH, and is based on the semantic propositions-as-types principle; it can be seen as an attempt to formulate brouwer's notion of truth in intuitionistic mathematics. coq, on the other hand, is a theory of FORMAL PROOF, and is based on the syntactic propositions-as-types principle; it is an account of proof, not an account of truth. it can be seen as a full development of heyting's formalization of intuitionistic mathematics, which brouwer in fact rejected, but that's neither here nor there. you are saying, if i understood correctly, that certain facts are true, and these facts can be independent of a particular proof theory. eg, the goedel sentence is true, but is not provable in HA. (all the axioms of HA are true, and that fact cannot be doubted without simply doubting everything in mathematics.) if one starts with a partial structural (syntactic) type theory with general recursive types, then one can consider nuprl's types as relations over the terms of a particular recursive type, essentially mu t.(t->t) or elaborations thereof. but the syntactic type theory cannot be construed as a logic, or rather only as an inconsistent logic. in nuprl partiality is handled using "bar types", which predate the lifting monad, but which are essentially that concept phrased in an operational setting. there is a type of unevaluated computations of a type, so that partial functions A - B are total functions A -> [B] (written \overline{B} in nuprl). hope this helps, and i hope i haven't misconstrued your question. bob ----------------------------- Prof Robert Harper Carnegie Mellon CSD r...@cs.cmu.edu ----------------------------- On Aug 23, 2014, at 12:01, Paul Levy <p.b.l...@cs.bham.ac.uk> wrote: > [ The Types Forum, http://lists.seas.upenn.edu/mailman/listinfo/types-list ] > > > On 23 Aug 2014, at 00:42, Paul Levy wrote: > >> [ The Types Forum, http://lists.seas.upenn.edu/mailman/listinfo/types-list ] >> >> Dear colleagues, >> >> I would like to present a polemic for your consideration. >> >> Let T : (nat * nat) -> bool be the primitive recursive predicate where >> T(m,n) means that Turing machine number m (with no arguments) executes for >> at least n steps. >> >> Say that a number m is "terminating" if for some n, not T(m,n), and >> "HA-divergent" if it is provable in Heyting arithmetic that for all n, >> T(m,n). >> >> (This happens to coincide with provability in Peano arithmetic but I am >> using a constructive system for the sake of the argument.) >> >> In a dependent type system with boolean type and natural number type, for >> every number m let t_m be the term >> >> lambda x:nat. if T(m,x) then true else 7 >> >> Say that a system is "typing HA-complete" if |- t_m : nat -> bool is >> provable for all HA-divergent m. >> >> Say that a system is "typing decidable" if the judgement |- t : A, where t >> is a closed term and A a closed term > > Sorry, that should be "where t is a closed term and A a closed type" > >> , is decidable. >> >> A system cannot be both typing decidable and typing HA-complete, because >> termination and HA-divergence are recursively inseparable properties. >> Martin-Löf's intensional type theory is typing decidable by design and >> therefore not typing HA-complete. >> >> Now the polemic: >> >> In my opinion typing HA-completeness is a very minimal completeness property >> to require of a dependently typed system (with nat), and I cannot see the >> interest of a system that lacks it. Advocates of typing decidability will >> of course disagree. A curious feature of this disagreement is the contrast >> with traditional arguments over the acceptability of individual judgements. >> (Is the Axiom of Choice valid? Is excluded middle valid? Is this large >> cardinal hypothesis valid? etc.) Here, typing decidability advocates are >> apparently comfortable with the judgement |- t_m : nat -> bool for any >> *particular* HA-divergent m, but object to including it for *all* >> HA-divergent m. >> >> If I am wrong, please enlighten me by providing a particular HA-divergent m >> and a philosophical or mathematical case why t_m should not have type nat -> >> bool. >> >> Best regards, >> Paul `
2017-07-21 09:54:42
{"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.7503145933151245, "perplexity": 4193.295101967629}, "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/1500549423764.11/warc/CC-MAIN-20170721082219-20170721102219-00363.warc.gz"}
https://fasterthanli.me/articles/game-distrib
# Cross-platform game distribution ooc makes it easy to compile your application on all major platforms (Windows, OSX, Linux) - the compiler itself runs there, and the SDK supports all these platforms with basic functionality: data structures, file handling, time handling, networking, etc. But between getting your application running on your dev environment with all the libraries installed, and getting it into a neat package for your users to run without having to install any dependencies by hand, there's a bag of tricks. Fortunately, I have found the time to figure most of them out. I'll try to explain these in detail here as clearly as possible, here in this article. ### The basics All your .ooc files are compiled by rock (and gcc/clang) into a single executable file. Let's pretend we're working on a game project named 'foobar'. On Windows, the resulting executable will be named 'foobar.exe', and on Linux/OSX, it'll be named 'foobar'. But wait, that's not all! Chances are, your game is loading assets (music, graphics, levels). That's a dependency. For those to load correctly, the CWD (current working directory) should be set correctly when running your executable. We'll see how to do that correctly on all platforms. And even when the CWD is correct, we're not done yet: your game also probably depends on external libraries, such as SDL, freeimage, and so on. If you compile it naively on your dev environment, they'll be dynamically linked. When running the application, your OS is looking for the libraries in the default path, such as /usr/lib, /usr/lib64, /Library/Frameworks and so on. However, you can't assume that your target user will have all dependencies installed like you did, especially if he's on a distribution or version other than the one you compiled the game on. For this too, we have OS-specific tricks that I'll expose here. ### Windows I'll be handling Windows first, since it seems to be the easiest case - however it is also the hardest to automate (from my current workflow at least). #### Setting up your dev environment The best way to build C (and thus ooc) programs from the command line on Windows is to use MinGW and MSYS. MinGW is a version of the GCC compiler collection for Windows, with a runtime based on msvcrt, ie. native to Windows. You'll find that some functions are missing from your comfy unix-y environment, unlike cygwin - but do not be afraid! The ooc sdk is versioned specifically to use the Win32 API when needed (for file handling and time routines, for example). MSYS is a port of some command-line utilities, such as the bash shell, and a cmd.exe-based command line. It also handles path translation, so that in your shell, /usr/ refers to an actual location on your Windows drive, for example C:\MinGW\MSYS\1.0\usr\ and so on. Installing MinGW However, the MinGW shell is less than convenient for every-day use. My biggest gripes with it are the way it handles resizing windows (spoiler: cmd.exe style, where you have a separate "buffer size" that you can adjust in the options, and a "window size" that cannot be bigger than the buffer size), and the way it handles copy/paste (spoiler: cmd.exe style, where you have to go: window contextual menu, Edit -> Mark, then draw a rectange in your window by click-dragging with your mouse, then Edit -> Copy, and it's finally in your clipboard). A much neater alternative is Console, an acceptable command-line for Windows. You might want to install that, and take a look at the preferences to make it as comfy as possible. I made it gnome-terminal like (Ctrl-Page Up/Down to navigate tabs, Ctrl-Shift-T to open a new tab, Ctrl-Shift-W to close one, Ctrl-Shift-C/V to copy/paste, the only difference is that Console2 requires shift to be pressed while highlighting text for copy - but I can live with that). You need to set the startup command to C:\MinGW\MSYS\1.0\bin\sh.exe -login (or wherever sh.exe lives) to get an MSYS environment in there. Then, you'll want to grab msysgit so you get the full git goodness in your unix-like environment. You'll want to add the path to msysgit's bin directory to your PATH environment variable in your ~/.bashrc on MSYS. Here's what mine looks like: bashexport OOC_LIBS="/c/Dev" export PATH="/usr/local/bin:/c/Dev/rock/bin:/c/Program Files (x86)/Git/bin:$PATH" If you don't do that, git will only be accessible from the 'Git Bash' terminal that msysgit installs. But I don't recommend using this, you should have all you need in a single place so that you can use as many terminals as you want in Console2 without worrying if it's a "git" terminal or an "everything else" terminal. Once you've done all that, you can go ahead and install rock to compile ooc code. The basic process goes like this: I suggest you decide on a single directory where to put all your ooc development files - for this example, I'm going to go with /c/Dev/. Note: if you don't have wget on your system, grab it with mingw-get install msys-wget bashcd /c/Dev/ git clone https://github.com/fasterthanlime/rock.git cd rock make quick-rescue If everything goes well, you should have a bin/rock.exe that works. And if you followed my .bashrc advice earlier, it's even already in your path! #### Building/installing dependencies Most cross-platform libraries have MinGW 'dev packages' that you can get if you look around, or they have MSVC dev packages that you can turn into MinGW-compatible dev packages with a bit of fiddling. However, that's not satisfactory for me - I want to build everything from source, and get/install any package with a single command instead of having to search for it online. For that purpose, I've ported homebrew to run in an MSYS environment, on Windows. To grab it, simply follow these instructions in your bash shell: bashcd /usr git clone https://github.com/nddrylliog/homebrew-mingw.git local Note: homebrew-mingw is still very much experimental, it assumes a few things (that you have msysgit in your path, that MinGW is installed to C:\MinGW, etc.). You can work with it and it built over 40 packages flawlessly for me, but there's work to do. Contributions, bugfixes, and package upgrades are welcome! Perhaps one of the first packages to install with homebrew is pkg-config. It'll allow you to work with most C libraries, setting the correct paths for your C compilers so that it finds headers and libraries. To install it, simply do: bashbrew install pkg-config Optionally, you can pass -v or --verbose to brew, so that it shows which commands it is running. I find that it helps time pass by faster, otherwise staring at a "Compiling" line for a few minutes is unsettling. One thing you'll notice is that the same packages will take a lot longer (I'm talking 3-4x longer) to compile with MinGW (ie. GCC for Windows) than they did with Clang on OSX. I have no idea why MinGW is so slow (even on an SSD). If someone finds out, please, please tell me. The executables produced by MinGW seem to be running speedily, though! #### Building your program Building your program in ooc is as simple as running: bashrock (Optionally, pass -v or --verbose to see the commands rock runs) In your program's directory, as long as you follow our conventions. The conventions for a program named 'foobar' and that uses ooc-sdl, should be as follows: the directory should be named 'foobar' and have a file named 'foobar.use' in it. The contents of the file would look like this: Name: foobar Description: Foobar is a game of some sort SourcePath: source Main: foobar.ooc Requires: sdl That way, rock can find your .ooc source files (all shoved in source/, possibly neatly organized in packages), and knows which one is the main executable. The Requires clause specifies which ooc libraries are need, and in turn, the .use files of those libraries give instructions to the C compiler on where to find the headers and link to the right libraries. If everything went fine, you should have a foobar.exe in your foobar directory. You can run it either in bash with ./foobar or by simply double clicking it in the Windows explorer! However, that .exe depends on .dll files (dynamic libraries) that are scattered across your system. That's fine when developing, but not when you package your application! Hence the next section. #### Packaging your program Windows has a few dangerous but convenient conventions in place. For example, when launching an executable when double-clicking on it, or from a shortcut, it will look for .dll files first in the directory of the executable. We'll use that to our advantage to package our application. The first step to package your application for Windows is to find out on which .dll files your application relies to launch. Steve P. Miller released a convenient application called depends.exe. Opening it on your application will let you know the .dlls it's loading at runtime. Then, you can just distribute them along (in the same folder as) your .exe file, and you're good to go! For minimal distribution, just releasing a .zip of your assets, .exe and .dll files is enough. For a full installer, you might be interested in NSIS ### OSX #### Building your program You can pretty much follow the instructions from the Windows section, except everything is much simpler: you basically have to install Homebrew, and then you can install rock with brew install rock, and compile your ooc program as usual. #### Packaging your program On OSX, the common way to distribute a game is to have an "App". Apps are just folders, in our example named foobar.app, with a standard directory structure. Here's an example directory structure for the foobar application bundle: foobar.app Contents Info.pList MacOS assets foobar wrapper Resources libs somelib.dylib The pList file should look something like this: xml<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleGetInfoString</key> <string>Foobar</string> <key>CFBundleExecutable</key> <string>wrapper</string> <key>CFBundleIdentifier</key> <string>com.yourdomain.www</string> <key>CFBundleName</key> <string>legithief</string> <key>CFBundleIconFile</key> <string>legithief.icns</string> <key>CFBundleShortVersionString</key> <string>1.0</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>IFMajorVersion</key> <integer>0</integer> <key>IFMinorVersion</key> <integer>1</integer> </dict> </plist> There's still two tricks up our sleeve, though. First off, although we have created an app bundle, our dynamic libraries are still not in there. We've made a directory for it, but we're not going to copy them by hand: there's a much better solution in our case. Enter dylibbundler, a utility that will: 1. Identify the libraries your program uses 2. Copy these libraries to a libs directory within your app bundle (as seen above in the directory structure) 3. Modify your executable so that the runtime library search path points to the libs directory inside your app bundle. Before messing with dylibbundler, we need to compile our ooc program with an additional flag passed to the C compiler, to reserve enough room to set the library search path. That flag is -headerpad_max_install_names. As you may or may not know, you can pass options to the C compiler by prefixing them with + in the rock command line. So our build command becomes: bashrock +-headerpad_max_install_names And we can copy that executable to Foobar.app/Contents/MacOS. Then, we can use dylibbundler to copy the libs and alter the executable. That command should look like: bashdylibbundler -od -b -x ./Foobar.app/Contents/MacOS/helloworld \ -d ./Foobar.app/Contents/libs/ If everything went right, you should have a bunch of .dylib files in the libs directory. Finally, we have one additional trick that we need to apply: we're all set on dynamic libraries (.dylib files) when your application is launching, but what about the CWD (current working directory)? As-is, it won't be the Contents/MacOS directory inside your app bundle, but it needs to be. For that purpose, we use a wrapper shell script that will cd to the right directory and then launch the actual executable. Here's an example wrapper file: bash#!/bin/bash cd "${0%/*}" ./foobar Don't forget to make it executable (chmod +x ./wrapper) and put it into Contents/MacOS. Also, keep in mind your Info.pList's CFBundleExecutable should be set to wrapper and not to foobar. When all that is done, your .app should launch on double-click from Finder. Time to package it into a zip (zip -r Foobar.zip Foobar.app) and upload it somewhere! For more advanced install methods on OSX, you might want to take a look at how to create a .dmg, or how to use PackageMaker. A final note for OSX: when people encounter errors running your application, ask them to run it from the console with open Foobar.app to see error messages. And before blaming your app, run plutil Info.pList to check your info file for syntax errors. ### Linux On Linux, we face the same challenges as on Windows and OSX: 1) making sure your application can find dynamic libraries, and 2) making sure it can find its assets. In my case, I had an additional challenge: I'm building from a 64-bit version of Ubuntu 12.10, but to be as universal as possible, I want to produce a 32-bit executable. #### Building your program Getting and building rock is as simple as cloning it, building it with make quick-rescue, and adding it to your path. (For more detailed instructions, see the Windows section above). Once we've done that, we can compile our application with the same commands as on other platforms. However, if you're on 64-bit and want to compile for 32-bit, you have a few modifications to make. First, you want to install gcc-multilib and ia32-libs on Ubuntu. Then, you want to pass -m32 to rock, which will then pass it to the C compiler. And finally, since we'll use the same trick as on OSX to distribute dynamic libraries along the executable, we'll need to pass -Wl,-R,libs to the compiler (-Wl is a trick to pass options from the C compiler to the linker... it's layers upon layers). So, our final ooc build command becomes: bashrock -m32 +-Wl,-R,libs Note that there are some peculiarities depending on the libs. For example, for SDL, the 32-bit dev libs on Ubuntu expose not -lSDL, but -lSDL1.2. And what's more, even with the correct path, it wouldn't link. So in my case, I had to tweak ooc-sdl/sdl.use to have this Libs line: bashLibs: /usr/lib/i386-linux-gnu/libSDL-1.2.so.0 And then it compiled and ran fine. Note that you wouldn't have this problem if instead of relying on Ubuntu's dev packages, you compiled your own SDL version. Perhaps it is time to port homebrew to Linux? I know I'm fed up with the discrepancies between distributions and the whims of packagers. #### Packaging your program And then we have one task left: actually copying dynamic libraries (that happen to be .so files on linux - so much for consistency) to our newly-created libs directory. For that, we don't have a tool like dylibbundler for OSX, at least not that I know of. So we'll have to do with a few basic tools. Don't be afraid though, it's easier than it looks! The first thing we want to do is to know which libraries our program depends on. Thanks to ldd, that's dead easy. Running ldd foobar should output something like: linux-gate.so.1 => (0xf76df000) libSDL-1.2.so.0 => /usr/lib/i386-linux-gnu/libSDL-1.2.so.0 (0xf761a000) libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf7470000) libasound.so.2 => /usr/lib/i386-linux-gnu/libasound.so.2 (0xf737d000) libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf7351000) libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf734c000) libpulse.so.0 => /usr/lib/i386-linux-gnu/libpulse.so.0 (0xf72f9000) libX11.so.6 => /usr/lib/i386-linux-gnu/libX11.so.6 (0xf71c2000) *snip* Thanks to a wee bit of command-line trickery, we can copy all these libraries into our libs folder: bashcp $(ldd foobar | cut -d ' ' -f 3) libs/ What are we doing here? We're breaking down the output of ldd by fields separated by spaces, using the cut command. Then we're passing all these paths to cp, and telling it where to copy them. If it went fine, you should have a bunch of .so files in libs/. Since we compiled our executable with the -R linker option, running ldd foobar again from the directory of our executable should know display this kind of output instead: linux-gate.so.1 => (0xf77ab000) libSDL-1.2.so.0 => libs/libSDL-1.2.so.0 (0xf770f000) libc.so.6 => libs/libc.so.6 (0xf7565000) libasound.so.2 => libs/libasound.so.2 (0xf7472000) libm.so.6 => libs/libm.so.6 (0xf7446000) libdl.so.2 => libs/libdl.so.2 (0xf7441000) libpulse.so.0 => libs/libpulse.so.0 (0xf73ee000) libX11.so.6 => libs/libX11.so.6 (0xf72b7000) *snip* One last thing: you want to make sure that whatever happens, your executable is ran from the right directory. In order to do that, we can create a launcher script, just like we did for OSX. Our wrapper file might look like this: bash#!/usr/bin/env bash SCRIPTPATH=$(cd $(dirname$0); pwd -P) cd \$SCRIPTPATH && ./foobar Don't forget to chmod +x wrapper, and voila! Portable linux app, cross-distribution, and runs on 32-bit and 64-bit, normally. If you want to provide both a 32-bit and a 64-bit version of your app, nothing prevents you from making two separate builds. A word of warning though: it's easy to cross- compile from 64-bit to 32-bit, but I'm almost certain the inverse is not. For starters (demos, etc.) I'd slap that binary, libs, and assets directory in a 'foobar' directory, itself in a .tar.bz2 archive (tar cjvf foobar.tar.bz2 foobar) and it'd be enough. For more advanced installation means... well, stay tuned. I have explored it a little bit but between Loki installer (obsolete), 0install (requires a client), autopackage (website down), and listaller (requires a client), I don't know where to turn. You might want to take a look at makeself to make self-extracting archives, but anything that requires using the command-line is probably a bad idea. I'd suggest publishing on Desura and Steam, but I must admit I still have no experience there! And on a final note, I would recommend against having anything to do with the Ubuntu Store, seeing as they seem to have dishonest business practices ### A note on static linking Astute readers might have noticed the visible absence of static linking anywhere in this article. Here's the short version: static linking is unsupported on all the platforms we talked above. And here's the long version: most libraries and platforms have given up on static linking. For OSX, applications have been for a long while depending on Frameworks, which are just a bunch of headers and dynamic libraries shoved in a folder. For Windows, everybody's using DLLs because they've never been a big issue since you can just put them alongside your executable (trust me, DLL "hell" is nothing compared to its OSX and Linux variants...) So, you might succeed statically linking your application, but it's almost guaranteed that you will run into strange issues and in general, you'll be swimming against the current: the methods outlined above just work, without hassle. ### Summary Distributing games mean making sure it can find assets and the dynamic libraries it needs. Often, it means distributing dynamic libraries (.dll on Windows, .dylib on OSX, .so on Linux) in your application's folder or a subfolder. On Windows, the OS will look for .dlls alongside your executable. On Mac, the best thing to do is to create an app bundle, put the libs in there and use dylibbundler to adjust your executable's runtime library search path. On Linux, you can simulate an app bundle with a directory, and directly pass -Wl,-R,libs to the C compiler when building your app, using ldd, cut and cp to copy the relevant libraries to your libs subfolder. If you're building on a 64-bit OS, you should produce at least 32-bit binaries. On Ubuntu, it requires installing additional packages. On other distributions, your mileage may vary. You may end up having to work in a 32-bit chroot. Often, a .zip or .tar.bz2 with your application it will be enough, especially if the executable runs on a double-click in the most used file manager on the target OS. More advanced options exists, and digital publishing platforms each have their own requirements. All in all, I hope you learned something today and that this article will be a point of reference from now on for people in need. As a reminder, there's a small, but growing, community around making games with the ooc programming language, hosted at oocgaming.org. The folks there will be happy to discuss packaging - and other issues - with you at length. If you liked this article, please support my work on Patreon! Looking for the homepage? Another article: Image decay as a service
2021-06-12 14:53: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": 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.42897817492485046, "perplexity": 3848.633097769259}, "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-2021-25/segments/1623487584018.1/warc/CC-MAIN-20210612132637-20210612162637-00060.warc.gz"}
https://www.gnu.org/software/src-highlite/source-highlight.html
# GNU Source-highlight 3.1.8 ## Table of Contents Next: , Previous: , Up: (dir)   [Contents][Index] # GNU Source-highlight GNU Source-highlight, given a source file, produces a document with syntax highlighting. This is Edition 3.1.8 of the Source-highlight manual. This file documents GNU Source-highlight version 3.1.8. This manual is for GNU Source-highlight (version 3.1.8, 30 March 2015), which given a source file, produces a document with syntax highlighting. Copyright © 2005-2008 Lorenzo Bettini, http://www.lorenzobettini.it. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License.” Next: , Previous: , Up: Top   [Contents][Index] ## 1 Introduction GNU Source-highlight, given a source file, produces a document with syntax highlighting. The colors and the styles can be specified (bold, italics, underline) by means of a configuration file, and some other options can be specified at the command line. The program already recognizes many programming languages (e.g., C++, Java, Perl, etc.) and file formats (e.g., log files, ChangeLog, etc.), and some output formats (e.g., HTML, ANSI color escape sequences, LaTeX, etc.). Since version 2.0, it allows you to specify your own input source language via a simple syntax described later in this manual (Language Definitions). Since version 2.1, it allows you to specify your own output format language via a simple syntax described later in this manual (Output Language Definitions). Since version 2.2, it is able to generate cross references (e.g., to variable names, field names, etc.) by relying on the program ctags, http://ctags.sourceforge.net (Generating References). Since version 3.0, GNU Source-highlight also provides a C++ library (which is used by the main program itself), that can be used by C++ programmers to add highlighting functionalities to their programs. See (source-highlight-info)Introduction. Next: , Previous: , Up: Introduction   [Contents][Index] ### 1.1 Supported languages The complete list of languages (indeed, file extensions) natively supported by this version of Source-highlight (3.1.8), as reported by --lang-list, is the following: C = cpp.lang F77 = fortran.lang F90 = fortran.lang H = cpp.lang ac = m4.lang ada = ada.lang adb = ada.lang am = makefile.lang applescript = applescript.lang asm = asm.lang autoconf = m4.lang awk = awk.lang bash = sh.lang bat = bat.lang batch = bat.lang bib = bib.lang bison = bison.lang c = c.lang caml = caml.lang cbl = cobol.lang cc = cpp.lang changelog = changelog.lang clipper = clipper.lang cls = latex.lang cobol = cobol.lang coffee = coffeescript.lang coffeescript = coffeescript.lang conf = conf.lang cpp = cpp.lang cs = csharp.lang csh = sh.lang csharp = csharp.lang css = css.lang ctp = php.lang cxx = cpp.lang d = d.lang desktop = desktop.lang diff = diff.lang dmd = d.lang docbook = xml.lang dtx = latex.lang el = lisp.lang eps = postscript.lang erl = erlang.lang erlang = erlang.lang errors = errors.lang f = fortran.lang f77 = fortran.lang f90 = fortran.lang feature = feature.lang fixed-fortran = fixed-fortran.lang flex = flex.lang fortran = fortran.lang free-fortran = fortran.lang glsl = glsl.lang go = go.lang groovy = groovy.lang h = cpp.lang haskell = haskell.lang haxe = haxe.lang hh = cpp.lang hpp = cpp.lang hs = haskell.lang htm = html.lang html = html.lang hx = haxe.lang hxx = cpp.lang in = makefile.lang ini = desktop.lang islisp = islisp.lang java = java.lang javalog = javalog.lang javascript = javascript.lang js = javascript.lang json = json.lang kcfg = xml.lang kdevelop = xml.lang kidl = xml.lang ksh = sh.lang l = flex.lang lang = langdef.lang langdef = langdef.lang latex = latex.lang ldap = ldap.lang ldif = ldap.lang lex = flex.lang lgt = logtalk.lang lhs = haskell_literate.lang lilypond = lilypond.lang lisp = lisp.lang ll = flex.lang log = log.lang logtalk = logtalk.lang lsm = lsm.lang lua = lua.lang ly = lilypond.lang m4 = m4.lang makefile = makefile.lang manifest = manifest.lang mf = manifest.lang ml = caml.lang mli = caml.lang moc = cpp.lang opa = opa.lang outlang = outlang.lang oz = oz.lang pas = pascal.lang pascal = pascal.lang patch = diff.lang pc = pc.lang perl = perl.lang php = php.lang php3 = php.lang php4 = php.lang php5 = php.lang pkgconfig = pc.lang pl = prolog.lang pm = perl.lang po = po.lang postscript = postscript.lang pot = po.lang prg = clipper.lang prolog = prolog.lang properties = properties.lang proto = proto.lang protobuf = proto.lang ps = postscript.lang py = python.lang python = python.lang r = r.lang rb = ruby.lang rc = xml.lang ruby = ruby.lang s = s.lang scala = scala.lang scheme = scheme.lang scm = scheme.lang scpt = applescript.lang sh = sh.lang shell = sh.lang sig = sml.lang sl = slang.lang slang = slang.lang slsh = slang.lang sml = sml.lang spec = spec.lang sql = sql.lang sty = latex.lang style = style.lang syslog = log.lang tcl = tcl.lang tcsh = sh.lang tex = latex.lang texi = texinfo.lang texinfo = texinfo.lang tk = tcl.lang tml = tml.lang txt = nohilite.lang ui = xml.lang upc = upc.lang vala = vala.lang vbs = vbscript.lang vbscript = vbscript.lang xhtml = xml.lang xml = xml.lang xorg = xorg.lang y = bison.lang yacc = bison.lang yy = bison.lang zsh = zsh.lang The complete list of output formats natively supported by this version of Source-highlight (3.1.8), as reported by --outlang-list, is the following: docbook = docbook.outlang esc = esc.outlang esc256 = esc256.outlang groff_man = groff_man.outlang groff_mm = groff_mm.outlang groff_mm_color = groff_mm_color.outlang html = html.outlang html-css = htmlcss.outlang html5 = html5.outlang htmltable = htmltable.outlang javadoc = javadoc.outlang latex = latex.outlang latexcolor = latexcolor.outlang mediawiki = mediawiki.outlang odf = odf.outlang sexp = sexp.outlang texinfo = texinfo.outlang xhtml = xhtml.outlang xhtml-css = xhtmlcss.outlang xhtmltable = xhtmltable.outlang The meaning of the suffix -css is explained in Output Language map1. Please, keep in mind, that I haven’t tested personally all these language definitions: I actually checked that the definition files are syntactically correct (with the command line option --check-lang and --check-outlang, Invoking source-highlight), but I’m not sure their definition actually respects that language syntax (e.g., I’ve put up together some language definitions by searching for information in the Internet, but I’ve never programmed in that language). So, if you find that a language definition is not precise, please let me know. Moreover, if you have a program example in a language that’s not included in the tests directory, please send it to me so that I can include it in the test suite. Next: , Previous: , Up: Introduction   [Contents][Index] ### 1.2 The program source-highlight-settings Since version 3.0, GNU Source-highlight includes also the program source-highlight-settings, which can be used to check whether source-highlight will be able find its language definition files, and other configuration files, and in case, to store the correct settings in a configuration file, in the user home directory. In particular, the stored configuration file will be called source-highlight.conf and stored in $HOME/.source-highlight/. For the moment, this file only stores the default value for the --data-dir option. The user can always override the contents of this configuration file, and the default hardcoded value, by using the environment variable SOURCE_HIGHLIGHT_DATADIR. ### 1.3 Notes on some languages In this section I’d like to go into details on the highlighting of some specific programming languages. These notes might be useful when the highlighted language has some “dialects” that might require some further specification at the command line (e.g., to select a specific dialect). Next: , Previous: , Up: Notes on some languages [Contents][Index] #### 1.3.1 Fortran As Toby White explained to me, Fortran comes into different “flavors”: a fixed-format, where some characters have a different semantics depending on their column position in the source file, and a free-format where this is not true. For instance, in the former, * and c start a command line, but only if they are specified in the first column (while this is not true in the free-format). By default, the free-format is assumed for Fortran files; if you want to use the fixed-format, you need to specify fortran-fixed at the --src-lang command line option. Previous: , Up: Notes on some languages [Contents][Index] #### 1.3.2 Perl Perl syntax forms, especially its regular expression specifications, are quite a nightmare ;-) I tried to specify as much as possible in the perl.lang but some particular regular expressions might not be highlighted correctly. Actually, I never programmed in Perl, so, if you see that some parts of your Perl programs are not highlighted correctly, please do not hesitate to contact me, so that I can improve Perl highlighting. Moreover, although the standard extension for Perl files is .pl, since the Prolog language definition was implemented in source-highlight before Perl, this extension is assigned, by default, to Prolog files. However, you can use --infer-lang command line option, so that source-highlight can try to detect the language by inspecting the first lines of the input file (How the input language is discovered); you can also use --src-lang=perl command line specification to explicitly require Perl highlighting. Next: , Previous: , Up: Introduction [Contents][Index] ### 1.4 Using source-highlight as a simple formatter You can also use source-highlight as a simple formatter of input file, i.e., without performing any highlighting2. You can achieve this by using, as the language definition file for input sources the file nohilite.lang, using the command line option --lang-def (Invoking source-highlight). Since that language definition is empty, no highlighting will be performed; however, source-highlight will transform the input file in the output format. Note, in the input language associations in Supported languages, that nohilite.lang is also associated to txt files. This, for instance, makes source-highlight useful in cases you want to transform a text file into HTML or LaTeX. During the output, in fact, source-highlight will correctly generate characters that have a specific meanings in the output format. For instance, in this Texinfo manual, if I want to insert a @ or a { I have to “escape” them to make them appear literally since they have a special meaning in Texinfo. The same holds, e.g., for <, > or & in HTML. If you use source-highlight, it will take care of this, automatically for you. This is the Texinfo source of the above sentence: For instance, in this Texinfo manual, if I want to insert a @@ or a @{ I have to escape'' them to make them appear literally since they have a special meaning in Texinfo. The same holds, e.g., for @code{<}, @code{>} or @code{&} in HTML. If you use source-highlight, it will take care of this, automatically for you. This was processed by source-highlight as a simple text file, without no highlighting; however since it was formatted in Texinfo, all the necessary escaping was automatically performed. This way, it is very easy to insert, in the same document, a code, and its result (as in this example). This is actually the formatting performed by source-highlight; except for the comment, this is basically what you should have written yourself to do all the escaping stuff manually: @c Generator: GNU source-highlight, by Lorenzo Bettini, http://www.gnu.org/software/src-highlite @example For instance, in this Texinfo manual, if I want to insert a @@@@ or a @@@{ I have to escape'' them to make them appear literally since they have a special meaning in Texinfo. The same holds, e.g., for @@code@{<@}, @@code@{>@} or @@code@{&@} in HTML. If you use source-highlight, it will take care of this, automatically for you. @end example In case source-highlight does not handle a specific input language, you can still use the option --failsafe (Invoking source-highlight) and also in that case no highlighting will be performed, but source-highlight will transform the input file in the output format. Note, however, that if the input language cannot be established, the default.lang will be used: an empty language definition file which you might want to customize. Previous: , Up: Introduction [Contents][Index] ### 1.5 Related Software and Links Here we list some software related to source-highlight in the sense that it uses it as a backend (i.e., provides an interface to source-highlight) or it uses some of its features (e.g., definition files): • Source-highlight-qt is a library for performing syntax highlighting in Qt documents by relying on GNU Source-Highlight library. This library provides an implementation of the qt abstract class QSyntaxHighlighter class, and it deals both with Qt3 and Qt4. • QSource-Highlight is a Qt4 front-end for GNU Source-Highlight (it relies on the library Source-Highlight-Qt). You can highlight your code on the fly, and have the highlighted output in all the formats supported by source-highlight (e.g., HTML, LaTeX, Texinfo, etc.). You can then copy the formatted output and paste it (e.g., in your blog), or save it to a file. A preview of the highlighted output is available for some output formats (e.g., HTML, XHTML, etc.). • SourceHighlightIDE is a small IDE (based on Qt4 and Source-highlight-qt) I wrote for developing and debugging new language definitions for source-highlight: • Martin Gebert implemented a KDE interface to source-highlight programs (and he did a wonderful job!), and it is called Ksrc2highlight; if you want to test it: • There’s also a Java version of java2html, you can find it at • This web site provides a web interface to source-highlight so that you can highlight your code on-line: • SHJS is a JavaScript program that highlights source code passages in HTML documents. Documents using SHJS are highlighted on the client side by the web browser. SHJS uses language definitions from Source-highlight. • Code2blog is a pyGTK front-end to source-highlight for easy conversion from source code to HTML. • Andy Buckley wrote a wrapper around source-highlight, which can be used as an Apache filter to highlight source code in Web pages on the fly. • Roger Nilsson wrote a frontend for source-highlight that is used in a popular webdesign app for OSX called RapidWeaver. The frontend is called High-Light and allows users to easily add syntax-colored code inside RapidWeaver. • Mauricio Zepeda published in his blog an article with a script to automatically highlight a file and show it in Firefox: • Jason Blevins made a plugin for Ikiwiki that enables syntax highlighting of source code fragments and whole files via source-highlight. • Pascal Bleser created a PHP extension that uses the GNU source-highlight library directly from PHP, instead of relying on spawning a process or using the source-highlight CGI. • Roberto Alsina made a partial python binding using SIP so that you can use Source-Highlight-Qt in PyQt programs. • A perl binding for source-highlight is available at CPAN: • Danijel Tasov wrote a pastebin service based on perl source-highlight binding: Next: , Previous: , Up: Top [Contents][Index] ## 2 Installation See the file INSTALL for detailed building and installation instructions; anyway if you’re used to compiling Linux software that comes with sources you may simply follow the usual procedure, i.e., untar the file you downloaded in a directory and then: cd <source code main directory> ./configure make make install We strongly suggest to use shadow builds, thus, create a build directory, say build and run configuration and make in that directory: cd <source code main directory> mkdir build cd build ../configure make make install However, before you do this, please check that you have everything that is needed to build source-highlight, What you need to build source-highlight. Note: unless you specify a different install directory by --prefix option of configure (e.g. ./configure --prefix=<your home>), you must be root to run make install. You may want to run ./configure --help to see all the possible options that can be passed to the configuration script. Files will be installed in the following directories: Executables prefix/bin docs and output examples prefix/share/doc/source-highlight library examples prefix/share/doc/source-highlight/examples library API documentation prefix/share/doc/source-highlight/api conf files prefix/share/source-highlight Default value for prefix is /usr/local but you may change it with --prefix option to configure. For further configure options, you can run configure --help. Tiziano Muller wrote a bash completion configuration file for source-highlight; this will be installed by default in the directory sysconfdir/bash_completion.d, where sysconfdir defaults to prefix/etc; however, typically, the directory where the bash completion script searches for configuration file is /etc/bash_completion.d. Thus, we suggest you explicitly specify this directory with the configuration script command line option --with-bash-completion. If you want to build and install the API documentation of Source-highlight library, you need to run configure with the option --with-doxygen, but you need the program Doxygen, http://www.doxygen.org, to build the documentation. The documentation will be installed in the following directory: Library API documentation prefix/share/doc/source-highlight/api NOTE: Originally, instead of Source-highlight, there were two separate programs, namely GNU java2html and GNU cpp2html. There are two shell scripts with the same name that will be installed together with Source-highlight in order to facilitate the migration (however their use is not advised and it is deprecated). Next: , Previous: , Up: Installation [Contents][Index] ### 2.1 Building with qmake Since version 3.1.2, Source-highlight can be built also using qmake, the build tool from Qt libraries (http://qt.nokia.com). This was made available to build Source-highlight on Windows based systems without using a Unix shell, and in particular to build Source-highlight with Microsoft MSVC compiler. You should use this method only if you don’t have a Unix shell or if you really need to use the MSVC compiler (e.g., if you want to build Source-highlight library to be used in MSVC based programs). You still need the boost regex library, and if you use MSVC, you can find installation packages for this library at http://www.boostpro.com. This build mechanism is still experimental, and, when using MSVC, only a static version of Source-highlight library can be built (not a .dll). You can also use this method if you have the MinGW compiler, http://www.mingw.org, (e.g., the one that comes with Qt Windows distribution) and you don’t have Msys (http://www.mingw.org/wiki/MSYS). Otherwise, you should still use the configure based mechanims. Using qmake, only a few options can be specified during the building (besides the ones you usually use with qmake), and these options can be specified only using environment variables: BOOST_REGEX By default, boost_regex will be used to link the boost library (i.e., -lboost_regex); if your boost regex library has a different name you must specify this name using this environment variable; e.g., if the library file is called libboost_regex-mt.lib or boost_regex-mt.dll you must set this variable to boost_regex-mt. INCPATH Specify the path of the boost header files. LIBS Specify the path of the boost lib files. Please, take into consideration that specifying the boost library include and library paths is completely up to you, using INCPATH and LIBS, if they’re not in the system path directories. Also remember to always use the option -recursive when running qmake. If you then want to run make install, you can use the variable INSTALL_ROOT to prefix the installation path, which, otherwise, is the root directory. Next: , Previous: , Up: Installation [Contents][Index] ### 2.2 Download You can download it from GNU’s ftp site: ftp://ftp.gnu.org/gnu/src-highlite or from one of its mirrors (see http://www.gnu.org/prep/ftp.html). I do not distribute Windows binaries anymore; since, they can be built by using Cygnus C/C++ compiler, available at http://www.cygwin.com. However, if you don’t feel like downloading such compiler or you experience problems with the Boost Regex library (see also Tips on installing Boost Regex library; please also keep in mind that if you don’t have these libraries installed, and your C/C++ compiler distribution does not provide a prebuilt package, it might take some time, even hours, to build the Boost libraries from sources), you can request such binaries directly to me, by e-mail (find my e-mail at my home page) and I’ll be happy to send them to you. An MS-Windows port of Source-highlight is available from http://gnuwin32.sourceforge.net; however, I don’t maintain those binaries personally, and they might be out of date. Archives are digitally signed by me (Lorenzo Bettini) with GNU gpg (http://www.gnupg.org). My GPG public key can be found at my home page (http://www.lorenzobettini.it). You can also get the patches, if they are available for a particular release (see below for patching from a previous version). Next: , Previous: , Up: Installation [Contents][Index] ### 2.3 Anonymous Git Checkout This project’s git repository can be checked out through the following clone instruction3: git clone git://git.savannah.gnu.org/src-highlite.git Further instructions can be found at the address: And the git repository can also browsed on-line at Please note that this way you will get the latest development sources of Source-highlight, which may also be unstable. This solution is the best if you intend to correct/extend this program: you should send me patches against the latest git repository sources. If, on the contrary, you want to get the sources of a given release, through git, say, e.g., version X.Y.Z, you must specify the tag rel_X_Y_Z. When you compile the sources that you get from the git repository, before running the configure and make commands, for the first time, you must run the command: autoreconf -i This will run the autotools commands in the correct order, and also copy possibly missing files. You should have installed recent versions of automake, autoconf and libtool in order for this to succeed. We strongly suggest to use shadow builds, thus, create a build directory, say build and run configuration and make in that directory: cd <source code main directory> mkdir build cd build ../configure make make install To summarize, the steps to get the sources from git and make the first build are: git clone git://git.savannah.gnu.org/src-highlite.git cd src-highlite autoreconf -i mkdir build cd build ../configure make Next: , Previous: , Up: Installation [Contents][Index] ### 2.4 What you need to build source-highlight Since version 2.0 Source-highlight relies on regular expressions as provided by boost (http://www.boost.org), so you need to install at least the regex library from boost. Most GNU/Linux distributions provide this library already in a compiled form. If you use your distribution packages, please be sure to install also the development package of the boost libraries. If you experience problems in installing Boost Regex library, or in compiling source-highlight because of this library, please take a look at Tips on installing Boost Regex library. If you want to use a specific version of the Boost regex library (because you have many versions of it), you can use the configure option --with-boost-regex to specify a particular suffix. For instance, ./configure --with-boost-regex=boost_regex-gcc-1_31 Source-highlight has been developed under GNU/Linux, using gcc (C++), and bison (yacc) and flex (lex), and ported under Win32 with Cygwin C/C++compiler, available at http://www.cygwin.com. I use the excellent GNU Autoconf4, GNU Automake5 and GNU Libtool6. Since version 2.6 I also started to use Gnulib - The GNU Portability Library7, “a central location for common GNU code, intended to be shared among GNU packages” (for instance, I rely on Gnulib for checking for the presence and correctness of getopt_long function). Finally I used GNU gengetopt (http://www.gnu.org/software/gengetopt), for command line parsing. I started to use also doublecpp (http://doublecpp.sourceforge.net) that permits achieving dynamic overloading. Actually, apart from the boost regex library, you don’t need the other tools above to build source-highlight (indeed I provide the output sources generated by the above mentioned tools), unless you want to develop source-highlight. However, if you obtained sources through Git, you need some other tools, see Anonymous Git Checkout. Next: , Previous: , Up: Installation [Contents][Index] ### 2.5 Tips on installing Boost Regex library If you experience no problem in compiling source-highlight, you can happily skip this section8 :-) I created this section because many users reported some problems after installing Boost Regex library from sources; other users had problems in compiling source-highlight even if this library was already correctly installed (especially windows users, using cygwin). I hope this section sheds some light in installing/using the Boost Regex library. Please, note that this section does not explain how to compile the Boost libraries (the documentation you’ll find on http://www.boost.org is well done); it explains how to tweak things if you have problems in compiling source-highlight even after a successful installation of Boost libraries. First of all, if your distribution provides packages for the Boost regex library, please be sure to install also the development package of the boost libraries, i.e., those providing also the header files needed to compile a program using these libraries. For instance, on my Debian system I had to install the package libboost-regex-dev, besides the package libboost-regex. If your distribution does not provide these packages then you have to download the sources of Boost libraries from http://www.boost.org and follow the instructions for compilation and installation. However, I suggest you specify /usr as prefix for installation, instead of relying on the default prefix /usr/local (unless /usr/local/include is already in the inclusion path of your C++ compiler), since this will make things easier when compiling source-highlight. I suggest this, since /usr/include is usually the place where C++ searches for header files during compilation. If you successfully compiled and installed the Boost Regex library, or you installed the package from your distribution, but you STILL experience problems in compiling source-highlight, then you simply have to adjust some things as described in the following. If the ./configure command of source-highlight reports this error: ERROR! Boost::regex library not installed. then, the compiler cannot find the header files for this library. In this case, check that the directory /usr/include/boost actually exists; if it does not, then probably you’ll find a similar directory, e.g., /usr/include/boost-1_33/boost, depending on the version of the library you have installed. Then, all you have to do is to create a symbolic link as follows: ln -s /usr/include/boost-1_33/boost /usr/include/boost Alternatively, you might run source-highlight’s configure as follows: ./configure CXXFLAGS=-I/usr/include/boost-1_33/ If you install (or build) the Boost Regex library in a non standard path, e.g., somewhere in your home directory, say /home/myhome/boost-1_33, you’ll have to update the CXXFLAGS variable accordingly on the configure command line; in this particular case, you might also have to specify the path of actual library files (CXXFLAGS will only specify the path of header files). In particular, you’ll have to know where the lib files are within the boost installation (or build directory); for instance, if they are in /home/myhome/boost-1_33/stage/lib, while the header files (i.e., the boost header files directory) are in /home/myhome/boost-1_33, the complete configure command should be ./configure CXXFLAGS=-I/home/myhome/boost-1_33 \ LDFLAGS=-L/home/myhome/boost-1_33/stage/lib If then ./configure command of source-highlight reports this other error: ERROR! Boost::regex library is installed, but you must specify the suffix with --with-boost-regex at configure for instance, --with-boost-regex=boost_regex-gcc-1_31 then, there’s still another thing to fix: you must find out the exact names of the files of your installed Boost Regex libraries; you can do this by using the command:$ ls -l /usr/lib/libboost_regex* that, for instance, on one of my cygwin installation reports: -rwxr-x---+ Nov 9 23:29 /usr/lib/libboost_regex-gcc-mt-s-1_33.a -rwxr-x---+ Nov 22 09:22 /usr/lib/libboost_regex-gcc-mt-s.a -rwxr-x---+ Nov 9 23:29 /usr/lib/libboost_regex-gcc-mt-s-1_33.so -rwxr-x---+ Nov 22 09:22 /usr/lib/libboost_regex-gcc-mt-s.so Now, you have all the information to correctly run the source-highlight’s configure command: ./configure --with-boost-regex=boost_regex-gcc-mt-s-1_33 or, if you solved the first problem in the second way9, ./configure CXXFLAGS=-I/usr/include/boost-1_33/ \ --with-boost-regex=boost_regex-gcc-mt-s-1_33 Of course, you have to modify this command according to the names of your Boost Regex library installed files. These instructions managed to let many users, who were experiencing problems, to compile source-highlight If you still have problems, please send me an e-mail. Next: , Previous: , Up: Installation   [Contents][Index] ### 2.6 Patching from a previous version If you downloaded a patch, say source-highlight-1.3-1.3.1-patch.gz (i.e., the patch to go from version 1.3 to version 1.3.1), cd to the directory with sources from the previous version (source-highlight-1.3) and type: gunzip -cd ../source-highlight-1.3-1.3.1.patch.gz | patch -p1 and restart the compilation process (if you had already run configure a simple make should do). Next: , Previous: , Up: Installation   [Contents][Index] ### 2.7 Using source-highlight with less This was suggested by Konstantine Serebriany. The script src-hilite-lesspipe.sh will be installed together with source-highlight. You can use the following environment variables: export LESSOPEN="| /path/to/src-hilite-lesspipe.sh %s" export LESS=' -R ' This way, when you use less to browse a file, if it is a source file handled by source-highlight, it will be automatically highlighted. Xavier-Emmanuel Vincent recently provided an alternative version of ANSI color scheme, esc256.style: some terminals can handle 256 colors. Xavier also provided a script which checks how many colors your terminal can handle, and in case, uses the 256 variant. The script is called source-highlight-esc.sh and it will be installed together with the other binaries. Next: , Previous: , Up: Installation   [Contents][Index] ### 2.8 Using source-highlight as a CGI CGI support was enabled thanks to Robert Wetzel; I haven’t tested it personally. If you want to use source-highlight as a CGI program, you have to use the executable source-highlight-cgi. You can build such executable by issuing make source-highlight-cgi in the src directory. Previous: , Up: Installation   [Contents][Index] ### 2.9 Building .rpm Christian W. Zuckschwerdt added support for building an .rpm and an .rpm.src. You can issue the following command rpmbuild -tb source-highlight-3.1.8.tar.gz for building an .rpm with binaries and rpmbuild -ts source-highlight-3.1.8.tar.gz for building an .rpm.src with sources. Next: , Previous: , Up: Top   [Contents][Index] ## 3 Copying Conditions GNU Source-highlight is free software; you are free to use, share and modify it under the terms of the GNU General Public License that accompanies this software (see COPYING). GNU source-highlight was written and maintained by Lorenzo Bettini http://www.lorenzobettini.it. Next: , Previous: , Up: Top   [Contents][Index] ## 4 Simple Usage Here are some realistic examples of running source-highlight10. Source-highlight only does a lexical analysis of the source code, so the program source is assumed to be correct! Here’s how to run source-highlight (for this example we will use C/C++ input files, but this is valid also for other source-highlight input languages): source-highlight --src-lang cpp --out-format html \ --input <C++ file> \ --output <html file> \ --style-file <style file> \ options For input files, apart from the -i (--input) option and the standard input redirection, you can simply specify some files at the command line and also use regular expressions (for instance *.java). In this case the name for the output files will be formed using the name of the source file with a .<ext> appended, where <ext> is the extension chosen according to the output format specified (in this example it would be .html). The style file (Output format style) contains information on how to format specific language parts (e.g., keywords in blue and boldface, etc.). IMPORTANT: you must choose one of the above two invocation modes: either you use -i (--input), -o (--output) (possibly replacing them with standard input/output redirection), or you specify one or many files without -i (--input); if you try to mix them you’ll get an error: source-highlight -o main.html main.cpp Please, use one of the two syntaxes for invocation: source-highlight [OPTIONS]... -i input_file -o output_file source-highlight [OPTIONS]... [FILES]... If STDOUT string is passed as -o (--output) option, then the output is forced to the standard output anyway. If -s (--src-lang) is not specified, the source language is inferred by the extension of the input file or from the file name itself (possibly using also lower case versions); this, of course, does not work with standard input redirection. For further details, see How the input language is discovered. If -f (--out-format) is not specified, the output will be produced in HTML. If --style-file is not specified, the default.style, which is included in the distribution, will be used (see Output format style for further information). Next: , Previous: , Up: Simple Usage   [Contents][Index] ### 4.1 HTML and XHTML output The default output format for HTML and XHTML uses fixed width fonts by inserting all the formatted output between <tt> and </tt>. Thus, for instance, specification for fixed width and not fixed width (see Output format style) will have no effect: every character will have fixed width. If you don’t like this default behavior and would like to have not fixed fonts by default (as it happens, e.g., with LaTeX output) you can use the file html_notfixed.outlang with the command line argument --outlang-def. For XHTML output, the corresponding file is xhtml_notfixed.outlang Furthermore, the file htmltable.outlang can be used to generate HTML output enclosed in an HTML table (which will use also a background color if specified in the style file). The file xhtmltable.outlang does the same but for XHTML output. Next: , Previous: , Up: Simple Usage   [Contents][Index] ### 4.2 LaTeX output When using LaTeX output format you can choose between monochromatic output (by using -f latex) or colored output (by using -f latexcolor). When using colored output, you need the color package (again this should be present in your system). Of course, you are free to define your own LaTeX output format, see Output Language Definitions. Next: , Previous: , Up: Simple Usage   [Contents][Index] ### 4.3 Texinfo output When using the Texinfo output format, you may want to use a dedicated style file, texinfo.style, which comes with the source-highlight distribution, with the option --style-file. For instance, the example in Examples is formatted with this style file. Next: , Previous: , Up: Simple Usage   [Contents][Index] ### 4.4 DocBook output DocBook output is generated using the <programlisting> tag. If the --doc command line option is given, an <article> document is generated. Next: , Previous: , Up: Simple Usage   [Contents][Index] ### 4.5 ANSI color escape sequences If you’re using this output format, for instance together with less (see Using source-highlight with less), you may want to use the esc.style (or esc256.style if your terminal can handle 256 colors), which comes with the source-highlight distribution, with the option --style-file. This should result in a more pleasant coloring output. Next: , Previous: , Up: Simple Usage   [Contents][Index] ### 4.6 Odf output The ODF language output for GNU source-highlight enables the user to generate color-highlighted ODF output of source code files. Or to generate ODF color-highlighted snippets to be used by ODF back-ends (like asciidoc-odf). We create an .fodt file, which is a Text document that newer versions of LibreOffice can open. Previous: , Up: Simple Usage   [Contents][Index] ### 4.7 Groff output The Groff language output for GNU source-highlight enables the user to generate black and white or color-highlighted Groff output using using groff’s Memorandum Macros (the output formats to specify on the command line are groff_mm and groff_mm_color, respectively) or for Man pages (output format to specify on the command line: groff_man). Such formats have been contributed by this project https://github.com/papoanaya/emacs_utils. Next: , Previous: , Up: Top   [Contents][Index] ## 5 Configuration files During execution, source-highlight needs some files where it finds directives on how to recognize the source language (if not specified explicitly with --src-lang or --lang-def), on which output format to use (if not specified explicitly with --out-format or --outlang-def), on how to format specific source elements (e.g., keywords, comments, etc.), and source and output language definitions. These files will be explained in the next sections. If the directory for such files is not explicitly specified with the command line option --data-dir, these files are searched for in the following order: • the current directory; • the installation directory for conf files, see Installation (please keep in mind that this directory is hard-coded into source-highlight during compilation). • if the source-highlight command is specified with an explicit path name, the installation directory name is still used, but relative to the explicit path name. In particular, the user can set the value also with the environment variable SOURCE_HIGHLIGHT_DATADIR (see also The program source-highlight-settings). If you want to be sure about which file is used during the execution, you can use the command line option --verbose. Next: , Previous: , Up: Configuration files   [Contents][Index] ### 5.1 Output format style You must specify your options for syntax highlighting in the file default.style11. You can specify formatting options for each element defined by a language definition file (you can get the list of such elements, by using --show-lang-elements, see Listing Language Elements). Since version 2.6, you can also specify the background color for the output document, using the keyword bgcolor (this might be visible only when the --doc command line option is used). If many elements share the same formatting options, you can specify these elements in the same line, separated by a comma12. Here’s the default.style that comes with this distribution (this is formatted by using the style.lang that is shown in Tutorials on Language Definitions): bgcolor "white"; // the background color for documents context gray; // the color for context lines (when specified with line ranges) keyword blue b ; // for language keywords type darkgreen ; // for basic types usertype teal ; // for user defined types string red f ; // for strings and chars regexp orange f ; // for strings and chars specialchar pink f ; // for special chars, e.g., \n, \t, \\ comment brown i, noref; // for comments number purple ; // for literal numbers preproc darkblue b ; // for preproc directives (e.g. #include, import) symbol darkred ; // for simbols (e.g. <, >, +) function black b; // for function calls and declarations cbracket red; // for block brackets (e.g. {, }) todo bg:cyan b; // for TODO and FIXME code bg:brightgreen b; // for code snippets //Predefined variables and functions (for instance glsl) predef_var darkblue ; predef_func darkblue b ; // for OOP classname teal ; // for class names, e.g., in Java and C++ // line numbers linenum black f; // Internet related url blue u, f; // other elements for ChangeLog and Log files date blue b ; time, file darkblue b ; ip, name darkgreen ; // for Prolog, Perl... variable darkgreen ; // explicit for Latex italics darkgreen i; bold darkgreen b; underline darkgreen u; fixed green f; argument darkgreen; optionalargument purple; math orange; bibtex blue; // for diffs oldfile orange; newfile darkgreen; difflines blue; // for css selector purple; property blue; value darkgreen i; // for oz atom orange; meta i; // for file system path orange; // for C (or other language) labels label teal b; // for errors error purple; warning darkgreen; // for feature (Cucumber) files cuketag green ; gherken blue ; given red ; when cyan ; then yellow ; and_but pink ; table gray ; This file tries to define a style for most elements defined in the language definition files that comes with Source-highlight distribution. You can specify your own file (it doesn’t have to be named default.style) with the command line option --style-file13, see Invoking source-highlight. You can also specify the color of normal text by adding this line normal darkblue ; As you might see the syntax of this file is quite straightforward: after the element (or elements, separated by commas) you can specify the color, and the background color14 by using the prefix bg: (for instance, in the default.style above the background color is specified for the todo element). Note that the background color might not be available for all output formats: it is available for XHTML and LaTeX but not for HTML15. Then, you can specify further formatting options such as bold, italics, etc.; these are the keywords that can be used: b = bold i = italics u = underline f = fixed nf = not fixed noref = no reference information is generated for these elements Since version 2.2, the color specification is not required. For instance, the texinfo.style is as follows (we avoid colors for Texinfo outputs): keyword, type b ; variable f, i ; string f ; regexp f ; comment nf, i, noref ; preproc b ; // line numbers linenum f; // Internet related url f; // for diffs oldfile, newfile i; difflines b; // for css selector, property b; value i; You may also specify more than on of these options separated by commas, e.g. keyword blue u, b ; Please keep in mind that in this case the order of these specified options is kept during the generation of the output; for instance, depending on the specific output format, the sequences u, b and b, u may lead to different results. In particular, the style that comes first is used after the ones that follow. For instance, in the case of HTML, the sequence u, b will lead to the following formatting: <u><b>...</b></u>. The noref option specifies that for this element reference information are not generated (see Generating References). For instance, this is used for the comment element, since we do not want that elements in a comment are searched for cross-references. These are all possible color logical names handled by source-highlight16: black red darkred brown yellow cyan blue pink purple orange brightorange green brightgreen darkgreen teal gray darkblue white You can also use the direct color scheme for the specific output format, by using double quotes, such as, e.g., "#00FF00" in HTML17 or even string colors in double quotes18, such as "lightblue". Of course, the double quotes will be discarded during the generation. For instance, this is the syslog.style used in the tests directory. This uses direct color schemes. date, keyword yellow b ; time "#9999FF" ; ip "lightblue" b ; type cyan b ; string "brown" b ; comment teal ; number red ; preproc cyan ; symbol green ; function "#CC66CC" b ; cbracket green b ; twonumbers green b ; port green b ; webmethod teal ; // foo option foo red b ; // foo entry Note that, if you use direct color schemes, source-highlight will perform no transformation, and will output exactly the color scheme you specified. For instance, the specification "brown" is different from brown: the former will be output as it is, while the latter will be translated in the corresponding color of the output format (for HTML the visible result is likely to be the same). It is up to you to specify a color scheme string that is handled by the specific output format. Thus, direct color schemes might not be portable in different output formats; for instance, "#00FF00" is valid in HTML but not in LaTeX. Next: , Previous: , Up: Configuration files   [Contents][Index] ### 5.2 Output format style using CSS Since version 2.6 you can specify the output format style also using a limited CSS syntax. Please, note that this has nothing to do with output produced by source-highlight using the --css option. By using a CSS file as the style file (i.e., passing it to the --style-css-file command line option) you will only specify the output format style using the same syntax of CSS. This means that you can use a css syntax for specifying the output format style independently from the actual output (this is what the output format style is for). Thus, you can use a css file as the output format style also for LaTeX output (just like you would do with a source-highlight output format style, Output format style). This feature is provided basically for code re-use: you can specify the output format style using a css file, and then re-use the same css file as the actual style sheet of other HTML pages (or even output files produced by source-highlight using the --css option). Note that this feature is quite primordial, so only a limited subset of CSS syntax is recognized. In particular, selectors are always intended as CSS class selectors, so they must start with a dot. /* */ comments are handled. Properties (and their values) not handled by source-highlight are simply (and silently) discarded). This is an example of CSS specification handled correctly by source-highlight as a style format specification: body { background-color: <color specification>; } .selector { color: <color specification>; background-color: <color specification>; font-weight: bold; /* this is a comment */ font-family: monospace; font-style: italic; text-decoration: underline; } Finally, this is the default.css that corresponds to default.style presented in Output format style: body { background-color: white; } /* the color for context lines (when specified with line ranges) */ .context { color: gray; } .keyword { color: blue; font-weight: bold; } .type { color: darkgreen; } .usertype, .classname { color: teal; } .string { color: red; font-family: monospace; } .regexp { color: orange; } .specialchar { color: pink; font-family: monospace; } .comment { color: brown; font-style: italic; } .number { color: purple; } .preproc { color: darkblue; font-weight: bold; } .symbol { color: darkred; } .function { color: black; font-weight: bold; } .cbracket { color: red; } .todo { font-weight: bold; background-color: cyan; } /* line numbers */ .linenum { color: black; font-family: monospace; } /* Internet related */ .url { color: blue; text-decoration: underline; font-family: monospace; } /* other elements for ChangeLog and Log files */ .date { color: blue; font-weight: bold; } .time, .file { color: darkblue; font-weight: bold; } .ip, .name { color: darkgreen; } /* for Prolog, Perl */ .variable { color: darkgreen; } .italics { color: darkgreen; font-style: italic; } .bold { color: darkgreen; font-weight: bold; } /* for LaTeX */ .underline { color: darkgreen; text-decoration: underline; } .fixed { color: green; font-family: monospace; } .argument, .optionalargument { color: darkgreen; } .math { color: orange; } .bibtex { color: blue; } /* for diffs */ .oldfile { color: orange; } .newfile { color: darkgreen; } .difflines { color: blue; } /* for css */ .selector { color: purple; } .property { color: blue; } .value { color: darkgreen; font-style: italic; } /* for Oz */ .atom { color: orange; } .meta { font-style: italic; } /* for feature/cucumber files */ .cuketag { color: green; } .gherken { color: blue; } .given { color: red; } .when { color: cyan; } .then { color: yellow; } .and_but { color: pink; } .table { color: gray; } If you pass this file to the --style-css-file command line option and you produce an output file, you will get the same result of using default.style. Source-highlight comes with a lot of CSS files that can be used either as standard CSS files for HTML documents, or as style files to pass to --style-css-file. In the documentation installation directory (see Installation) you will find the file style_examples.html which shows many output examples, each one with a different CSS style. Next: , Previous: , Up: Configuration files   [Contents][Index] ### 5.3 Default Styles This file19 (the default file is style.defaults) lists the default style for a language element whose output style is not specified in the style file; in particular the following line (comment lines start with #): elem1 = elem2 tells that, if the style for an element, say elem1, is not specified in the style file, then elem1 will have the same style of elem2. For instance, this is the style.defaults that comes with Source-highlight: # defaults for styles # the format is: # elem1 = elem2 # meaning that if the style for elem1 is not specified, # then it will have the same style as elem2 classname = normal usertype = normal preproc = keyword section = function paren = cbracket attribute = type value = string predef_var = type predef_func = function atom = regexp meta = function path = regexp label = preproc error = string warning = type code = preproc In this case the style for the element preproc will default to the style of the element keyword. This file is useful when you want to create your own style file and you don’t want to specify styles for all the elements that will have the same output style in your style (e.g., the default style formats preproc elements differently from keywords, but if in your style you don’t specify a style for it, a preproc element will still be formatted as a keyword). Next: , Previous: , Up: Configuration files   [Contents][Index] ### 5.4 Language map This configuration file associates a file extension to a specific language definition file. You can also use such file extension to specify the --src-lang option (see Simple Usage). Source-highlight comes with such a file, called lang.map. Of course, you can override the settings of this file by writing your own language map file and specify such file with the command line option --lang-map). Moreover, as explained above, if a file lang.map is present in the current directory, such version will be used. The format of such file is quite simple (comment lines start with #): extension = language definition file The default language definition file is shown in Introduction. Next: , Previous: , Up: Configuration files   [Contents][Index] ### 5.5 Language definition files These files are crucial for source-highlight since they specify the source elements that have to be highlighted. These files also allow to specify your own language definitions in order to deal with a language that is not handled by source-highlight20. The syntax for these files is explained in Language Definitions. Next: , Previous: , Up: Configuration files   [Contents][Index] ### 5.6 Output Language map This configuration file associates an output format to a specific output language definition file. You can use the name of that output format to specify the --out-format option (see Simple Usage). Source-highlight comes with such a file, called outlang.map. Of course, you can override the settings of this file by writing your own output language map file and specify such file with the command line option --outlang-map). Moreover, as explained above, if a file outlang.map is present in the current directory, such version will be used. The format of such file is quite simple: output format name = language definition file The default language definition file is shown in Introduction. In particular, there is a convention for the output format name in the output language map: the one with -css suffix is the one used when --css command line option is given Next: , Previous: , Up: Configuration files   [Contents][Index] ### 5.7 Output Language definition files These files are crucial for source-highlight since they specify how the source elements are highlighted. These files also allow to specify your own output format definitions in order to deal with an output format that is not handled by source-highlight21. The syntax for these files is explained in Output Language Definitions. These files are part of source-highlight distribution, but they can also be downloaded, independently, from here: Previous: , Up: Configuration files   [Contents][Index] ### 5.8 Developing your own definition files I encourage those who write new language definitions or correct/modify existing language definitions to send them to me so that they can be added to the source-highlight distribution! Since these files require more explanations (that, however, are not necessary to the standard usage of source-highlight), they are carefully explained in separate parts: Language Definitions and Output Language Definitions. These files are part of source-highlight distribution, but they can also be downloaded, independently, from here: Next: , Previous: , Up: Top   [Contents][Index] ## 6 Invoking source-highlight The format for running the source-highlight program is: source-highlight option source-highlight supports the following options, shown by the output of source-highlight --detailed-help: source-highlight Highlight the syntax of a source file (e.g. Java) into a specific format (e.g. HTML) Usage: [OPTIONS]... < input_file > output_file source-highlight [OPTIONS]... -i input_file -o output_file source-highlight [OPTIONS]... [FILES]... -h, --help Print help and exit --detailed-help Print help, including all details and hidden options, and exit -V, --version Print version and exit -i, --input=filename input file. default std input -o, --output=filename output file. default std output (when the third invocation form is used). If STDOUT is specified, the output is directed to standard output you can simply specify some files at the command line and also use regular expressions (for instance *.java). In this case the name for the output files will be formed using the name of the source file with a .<ext> appended, where <ext> is the extension chosen according to the output format specified (for instance .html). -s, --src-lang=STRING source language (use --lang-list to get the complete list). If not specified, the source language will be guessed from the file extension. --lang-list list all the supported language and associated language definition file --outlang-list list all the supported output language and associated language definition file -f, --out-format=STRING output format (use --outlang-list to get the complete list) (default=html') -d, --doc create an output file that can be used as a stand alone document (e.g., not to be included in another one) --no-doc cancel the --doc option even if it is implied (e.g., when css is given) -c, --css=filename the external style sheet filename. Implies --doc -T, --title=STRING give a title to the output document. Implies --doc -t, --tab=INT specify tab length. (default=8') -H, --header=filename file to insert as header -F, --footer=filename file to insert as footer --style-file=filename specify the file containing format options (default=default.style') --style-css-file=filename specify the file containing format options (in css syntax) --style-defaults=filename specify the file containing defaults for format options (default=style.defaults') --outlang-def=filename output language definition file --outlang-map=filename output language map file (default=outlang.map') --data-dir=path directory where language definition files and language maps are searched for. If not specified these files are searched for in the current directory and in the data dir installation directory --output-dir=path output directory --lang-def=filename language definition file --lang-map=filename language map file (default=lang.map') --show-lang-elements=filename prints the language elements that are defined in the language definition file --infer-lang force to infer source script language (overriding given language specification) Lines: -n, --line-number[=padding] number all output lines, using the specified padding character (default=0') --line-number-ref[=prefix] number all output lines and generate an anchor, made of the specified prefix + the line number (default=line') Filtering output: Mode: linerange specifying line ranges --line-range=STRING generate only the lines in the specified range(s) each range can be of the shape: single line (e.g., --line-range=50) full range (e.g., --line-range=2-10) partial range (e.g., --line-range=-30, first 30 lines, --line-range=40- from line 40 to the end --range-separator=STRING the optional separator to be printed among ranges (e.g., "...") --range-context=INT number of (context) lines generated even if not in range The optional --range-context specifies the number of lines that are not in range that will be printed anyway (before and after the lines in range); These lines will be formatted according to the "context" style. Mode: regexrange specifying regular expression delimited ranges --regex-range=STRING generate only the lines within the specified regular expressions when a line containing the specified regular expression is found, then the lines after this one are actually generated, until another line, containing the same regular expression is found (this last line is not generated). More than one regular expression can be specified. reference generation: --gen-references=STRING generate references (possible values="inline", "postline", "postdoc" default=inline') --ctags-file=filename specify the file generated by ctags that will be used to generate references (default=tags') --ctags=cmd how to run the ctags command. If this option is not specified, ctags will be executed with the default value. If it is specified with an empty string, ctags will not be executed at all (default=ctags --excmd=n --tag-relative=yes') testing: -v, --verbose verbose mode on -q, --quiet print no progress information --binary-output write output files in binary mode This is useful for testing purposes, since you may want to make sure that output files are always generated with a final newline character only --statistics print some statistics (i.e., elapsed time) --gen-version put source-highlight version in the generated file (default=on) --check-lang=filename only check the correctness of a language definition file --check-outlang=filename only check the correctness of an output language definition file --failsafe if no language definition is found for the input, it is simply copied to the output -g, --debug-langdef[=type] debug a language definition. In dump mode just dumps all the steps; in interactive, at each step, waits for some input (press ENTER to step) (possible values="interactive", "dump" default=dump') --show-regex=filename show the regular expression automaton corresponding to a language definition file Let us explain some options in details (apart from those that should be clear from the --help output itself, and those already explained in Simple Usage). --data-dir Source-highlight, during the execution, will need some files, such as, e.g., language definition files, output format definition files, etc. These files are installed in prefix/share/source-highlight where prefix is chosen at compilation time (see See Installation). Thus, source-highlight should be able to find all the files it needs independently. However, if you want to override this setting, e.g., because you have your own language definition files, or simply because you installed a possible source-highlight binary in a different directory from the one used during the compilation, you can use the command line option --data-dir. --doc -d If you want a stand alone output document (i.e., an output file that is not thought to be included in another document), specify this option (otherwise you just get some text that you can paste into another document). If you choose this option and do not provide a --title, the your source file name will be used as the title. --no-doc The --doc option above is actually implied by other command line options (e.g., --css). If you do not want this (e.g., you want to include the output in an existing document containing the global style sheet), you can disable this by using --no-doc. --css -c Specify the style sheet file (e.g., a .css for HTML22) for the output document. Note that source-highlight will not use this file: it will simply use this file name when generating the output file, so to specify that the output file uses this file as the style sheet (e.g., if the generated HTML relies on this file as the CSS file). --tab -t With this options, tab characters will be converted into specified number of space characters (tabulation points will be preserved). This option is automatically selected when generating line numbers. --style-file --style-css-file Specify the file that source-highlight will use to produce (i.e., format) the output (e.g., colors and other styles for each language element). The formats of these files are detailed in Output format style and in Output format style using CSS, respectively. --style-defaults Specify the file that contains the default styles for elements whose styles are not found in the style file (see Default Styles for further details). --output-dir You can pass to source-highlight more than one input file (see Simple Usage). In this case you cannot specify the output file name. In such cases the output files will be automatically generated into the directory where you invoked the command from; if you want the output files to be generated into a different directory you can use this option. --infer-lang Force the inference mechanism for detecting the input language. This is detailed in How the input language is discovered. --line-number Line numbers will be generated in the output, using the (optional) specified padding character23 (the default padding character is 0). --line-number-ref As --line-number, this option numbers all the output lines, and, additionally, generates an anchor for each line. The anchor consists of the specified prefix (default is line) and the line number (e.g., line25). For instance, as prefix, if you deal with many files, you can use the file name. Note that some output languages might not support this feature (e.g., esc, since it makes no sense in such case). See Anchors and References for defining how to generate an anchor in a specific output language. --line-range --range-context --range-separator Since version 2.11, you can specify multiple line ranges: only the lines in the source that are in these ranges will be output. For instance, by specifying --line-range="-5","10","20-25","50-" Only the following lines will be output: the first 5 lines, line 10, lines 20 to 25 and from line 50 to the end of input. (See also the examples in Line ranges). Together with --line-range, you can also specify --range-context: this is the number of lines that will be printed before and after the lines of a range (i.e., the surrounding “context”). These lines will not be highlighted: they will be printed according to the style context. For instance, extending the previous example, --line-range="-5","10","20-25","50-" --range-context=1 Also the following lines will be output: 6, 9, 11, 19, 26, 49. (See also the examples in Line ranges (with context)). Finally, you can specify a range separator line string with --range-separator that will be printed between ranges (See also the examples in Line ranges (with context)). The separator string is preformatted automatically, so, e.g., you don’t have to escape special output characters, such as the { } in texinfo output. --regex-range Ranges can be expressed also using regular expressions, with the command line option --regex-range. In this case the beginning of the range will be detected by a line containing (in any point) a string matching the specified regular expression; the end will be detected by a line containing a string matching the same regular expression that started the range. This feature is very useful when we want to document some code (e.g., in this very manual) by showing only specific parts, that are delimited in a ad-hoc way in the source code (e.g., with specific comment patterns). You can see some usage examples in See Regex ranges. The specified strings (this option accepts multiple occurrences) must be valid regular expressions (thus you must escape special characters accordingly), otherwise you will get an error. Furthermore, --line-range and --regex-range cannot coexist in the same command line. --failsafe If no language specification is found, an error will be printed and the program exits. With this option, instead, in such situations, the input is simply formatted in the output format. This is useful when source-highlight is used with many input files, and it is also used in the src-hilite-lesspipe.sh script. Actually I failed to find a good reason why one should not always use this option. So my suggestion is to always use it when you run source-highlight (and indeed, in the future, this option might become the default one). See also Using source-highlight with less, Using source-highlight as a simple formatter. When using --failsafe, if no input language can be established, source-highlight will use the input language definition file default.lang, which is an empty file. You might want to customize such file, though. --debug-lang --show-regex Allows to debug a language definition file, Debugging. The other command line options dealing with references are explained in more details in Generating References. Previous: , Up: Invoking source-highlight   [Contents][Index] ### 6.1 How the input language is discovered As already explained, Simple Usage, source-highlight uses a language definition file according the language specified with the option --src-lang, or --lang-def, or by using the input file extension. Since version 2.5, source-highlight can use an inference mechanism to deduce the input language. For the moment, it can detect script languages based on the “sha-bang” mechanism, i.e., when the first line of a script contains a line such as, e.g., #!/bin/sh It detects script languages specified by using the env program24: #!/usr/bin/env perl It recognizes the Emacs convention, of declaring the Emacs major mode using the format -*- lang -*-. For instance, a script starting as the following one: #!/bin/bash # -*- Tcl -*- will be interpreted as a Tcl script, and not as bash script. Finally, it recognizes <? specifications (e.g., <?php and <?xml) and <!doctype (in that case, it infers it is an xml file)25. This inference mechanism is performed, by default, in case the input language is neither explicitly specified nor found in the language map file by using the input file extension or the filename itself, possibly also the lowercase version (the input file may also have no extension at all, but, for instance, a ChangeLog input file will be highlighted using changelog.lang). Furthermore, this mechanism can be given priority with the command line option --infer-lang. For instance, this is used in the script src-hilite-lesspipe.sh (Using source-highlight with less) when running source-highlight, in order to avoid the problem of formatting a Perl script as a Prolog program (since the extension .pl is associated to Prolog programs in the language map file, Perl). Next: , Previous: , Up: Top   [Contents][Index] ## 7 Language Definitions Since version 2.0 source-highlight uses a specific syntax to specify source language elements (e.g., keywords, strings, comments, etc.). Before version 2.0, language elements were scanned through Flex. This had the drawback of writing a new flex file to deal with a new language; even worse, a new language could not be added “dynamically”: you had to recompile the whole source-highlight program. Instead, now, language elements are specified in a file, loaded dynamically, through a (hopefully) simple syntax. Then, these definitions are used internally to create, on-the-fly, regular expressions that are used to highlight the elements (see also How source-highlight works). In particular, we use the regular expressions provided by the Boost library (see Installation). Thus, when writing a language definition file you will surely have to deal with regular expressions. Don’t be scared: for most of the languages you may never have to deal with difficult regular expressions, and you can also specify language keywords (such as, e.g., “if”, “while”, etc., see Simple definitions); moreover, for defining delimited language elements you will not have to write a regular expression, but just the delimiters (see Delimited definitions). However, there might be some language definitions that may require heavy use of more involved regular expressions (e.g., Perl, just to mention one). Of course, we use the Boost regex library regular expression syntax. We refer to Boost documentation for such syntax, http://www.boost.org/libs/regex/doc/syntax.html, however, in Notes on regular expressions, we provide some notes on regular expressions that might be helpful for those who never dealt with them. By default, Boost regex library uses Perl regular expression syntax, and, at the moment, this is the only syntax supported by source-highlight. Here, we see such syntax in details, by relying on many examples. This allows a user to easily modify an existing language definition and create a new one. These files have, typically, extension .lang. Each definition basically associates a regular expression to a language element and defines a name for the language element. Such name will be used to associate a particular style (e.g., bold face, color, etc.) when highlighting such elements. You cannot use names that are the same of keywords used in the language definition syntax (e.g., start, as shown later, is a reserved word). Comments can be given by using #; the rest of the line is considered as a comment. Source-highlight will scan each line of the input file separately. So a regular expression that tries to match new line characters is destined to fail. However, the language definition syntax provides means to deal with multiple lines (see Delimited definitions and State/Environment Definitions). Next: , Previous: , Up: Language Definitions   [Contents][Index] ### 7.1 Ways of specifying regular expressions Before getting into details of language definition syntax, it is crucial to describe the 3 possible ways of specifying a regular expression string. These 3 different ways, basically differ in the way they handle regular expression special characters, such, e.g., parenthesis. For this reason, one mechanism can be more powerful than another one, but it could also require more attention; furthermore, there can be situations where you’re forced to use only one mechanism, since the other ones cannot accomplish the required goal. "expression" If you use double quotes (note, " and not or '') to specify a regular expression, then basically all the characters, but the alternation symbol, i.e., the pipe symbol |, are considered literally, and thus will be automatically escaped (e.g., a dot . is interpreted as the character . not as the regular expression wild card). Thus, for instance, if you specify "my(regular)ex.preion{*}" source-highlight will automatically transform it into my$$regular$$ex\.pre\$\$ion\{\*\} The special character |, unless it is meant to separate two alternatives (Simple definitions), must be escaped with the character \, e.g., \|. Also the character \, if it is intended literally, must be escaped, e.g., \\. 'expression' If you want to enjoy (almost) the full power of regular expressions, you need to use single quoted strings ('), instead of double quoted strings. This way, you can specify special characters with their intended meaning. However, marked subexpressions are automatically transformed in non marked subexpressions, i.e., the parts in the expression of the shape (...) will be transformed into (?:...) (as explained in Notes on regular expressions, (?:...) lexically groups part of a regular expression, without generating a marked sub-expression). Thus, for instance, if you specify 'my(regular)ex.pre$ion*' source-highlight will automatically transform it into my(?:regular)ex.pre$ion* Since marked subexpressions cannot be specified with this syntax, then backreferences (see Notes on regular expressions) are not allowed. expression This syntax26 (note the difference, this one uses the backtick while the previous one uses ') for specifying a regular expression was introduced to overcome the limitations of the other two syntaxes. With this syntax, the marked subexpressions are not transformed, and so you can use regular expressions mechanisms that rely on marked subexpressions, such as backreferences and conditionals (see Notes on regular expressions). This syntax is also crucial for highlighting specific program parts of some programming languages, such as, e.g., Perl regular expressions (e.g., in substitution expressions) that can be expressed in many forms, in particular, separators for the part to be replaced and the part to replace which can be any non alphanumerical characters27, for instance, s/foo/bar/g s|foo|bar|g s#foo#bar#g s@foo@bar@g Using this syntax, and backreferences, we can easily define a single language element to deal with these expressions (without specifying all the cases for each possible non alphanumerical character): regexp = s([^[:alnum:][:blank:]]).*\1.*\1[ixsmogce]* Since version 2.11, in all kinds of regular expression specification, you can insert newline characters, which will simply be ignored. Thus, e.g., the file: # test_newlines.lang # test that newlines in expressions are simply discarded keyword = "foo | lang" (keyword,normal,classname) = (\<struct) ([[:blank:]]+) ([[:alnum:]_]+) preproc = '^[[:blank:]]* #([[:blank:]]* [[:word:]]*)' and the file: # test_nonewlines.lang # test that newlines in expressions are simply discarded # see the corresponding test_newlines.lang keyword = "foo|lang" (keyword,normal,classname) = (\<struct)([[:blank:]]+)([[:alnum:]_]+) preproc = '^[[:blank:]]*#([[:blank:]]*[[:word:]]*)' are equivalent. However, the former is surely more readable. Note however, that space characters are NOT ignored in regular expression definitions. Next: , Previous: , Up: Language Definitions   [Contents][Index] ### 7.2 Simple definitions The simplest way to specify language elements is to list the possible alternatives. This is the case, for instance, for keywords. For instance, in java.lang you have: keyword = "abstract|assert|break|case|catch|class|const", "continue|default|do|else|extends|false|final", "finally|for|goto|if|implements|instanceof|interface" keyword = "native|new|null|private|protected|public|return", "static|strictfp|super|switch|synchronized|throw", "throws|true|this|transient|try|volatile|while" You can separate quoted definitions with commas. Alternatively, within a quoted definition, alternatives can be separated with the pipe symbol |. The above definition defines the language element keyword. Each time an element is found in the source file, it is highlighted with the style for the element with the same name in the output format style file (note that all elements shown in the example are taken from the language definition files that come with source-highlight and there is a style for each of such elements, see Configuration files). If such an element is not specified in the output format style file, it is simply not highlighted (actually, it is highlighted with style normal, Configuration files) (so pay attention to typos :-). From the above example you may have noted that language element definitions are cumulative, so the second keyword definition does not replace the first one. (Indeed, in some cases you may want to actually redefine a language element; this is possible as explained in Redefinitions and Substitutions). Note that words specified in double quotes have to match exactly in a source file, and they must be isolated (not surrounded by anything but spaces). Thus for instance class is matched as a keyword, but in my_class the substring class is not matched as keyword. From the point of view of regular expressions a string such as class in a double quote simple definition is intended as \<(class)\>. Special characters have to be escaped with the character \. So for instance if you want to specify the character |, which is normally used to separate alternatives in double quoted strings, you have to specify \|. As explained in Ways of specifying regular expressions, definitions in double quotes are interpreted literally (thus, e.g., a dot . is interpreted as the character . not as the regular expression wild card). If you want to enjoy the full power of regular expressions to specify a language alternative, you have to use single quoted strings ('), instead of double quoted strings, or strings quoted with backticks (). For instance, the following is the definition for a preprocessor directive in C/C++: preproc = '^[[:blank:]]*#([[:blank:]]*[[:word:]]*)' Note that the definition 'class' is different from "class", as explained above. Thus, for instance 'class' matches also the sub-expression class inside my_class. Furthermore, you are not allowed to specify, in the same list, double quoted strings and single quoted strings: you need to split such list definitions. Thus, for instance, the following definition is wrong: preproc = "#define",'^[[:blank:]]*#([[:blank:]]*[[:word:]]*)' while the following one is correct: preproc = "#define" preproc = '^[[:blank:]]*#([[:blank:]]*[[:word:]]*)' Finally, at the end of a list of definitions, one can specify the keyword nonsensitive; in that case, the specified strings will be interpreted in a non case sensitive way. For instance, we use this feature in Pascal language definition, pascal.lang where keywords are parsed in a non sensitive way: keyword = "alfa|and|array|begin|case|const|div", "do|downto|else|end|false|file|for|function|get|goto|if|in", "label|mod|new|not|of|or|pack|packed|page|program", "put|procedure|read|readln|record|repeat|reset|rewrite|set", "text|then|to|true|type|unpack|until|var|while|with|writeln|write" nonsensitive Next: , Previous: , Up: Language Definitions   [Contents][Index] ### 7.3 Line wide definitions It is often useful to define a language element that affects all the remaining characters up to the end of the line. For such definitions, instead of the = you must use the keyword start. For instance, the following is the definition of a single line comment in C++: comment start "//" This means that when the two characters // are encountered in the source file, everything from these characters on, up to the end of the line, will be highlighted according to the style comment. Next: , Previous: , Up: Language Definitions   [Contents][Index] ### 7.4 Order of definitions It is important to observe that the order of language definitions is important since it will be used during regular expression matching (this will be detailed in How source-highlight works). You then have to make sure that, if there are definitions that start with same characters, the longest expression is specified first in the file. For instance if you write symbol = "/" comment start "//" The first expression will always be matched first, and the second expression will never be matched. The right order is comment start "//" symbol = "/" Next: , Previous: , Up: Language Definitions   [Contents][Index] ### 7.5 Delimited definitions Many elements are delimited by specific character sequences. For instance, strings and multiline comments. The syntax for such an element definition is <name> delim <left delimited> <right delimiter> \ {escape <escape character>} \ {multiline} {nested} The escape statement specifies the escape character that may precede one of the delimiters inside the element. This is optional. For instance, this is the definition of C-like strings: string delim "\"" "\"" escape "\\" Note that \ is a special characters in definitions so it has to be escaped. If the escape specification was omitted, the C string "write \"hello\" string" would have been highlight incorrectly (it would have been highlighted as the string "write \", the normal character sequence hello\ and the string " string"). The option multiline specifies that the element can spawn multiple lines. For instance, PHP strings are defined as follows: string delim "\"" "\"" escape "\\" multiline The option nested instructs to count possible multiple occurrences of delimited characters and to match relative multiple occurrences (using a stack). For instance, if we wanted to highlight C-like multiline comments in a nested way28, we could use the following definition: comment delim "/*" "*/" multiline nested If nested was not used, then the closing */ of the following nested comment would conclude the comment (and the second */ would not be highlighted as a comment): /* This is a /* nested comment */ */ Note that, in order for a delimited language element to be nested, its starting and ending elements must be different; thus, for instance, the following definition is not correct: string delim "\"" "\"" nested # WRONG! As said above, definitions are cumulative, and they are also cumulative even when using different syntactic forms. Thus, for instance, the complete definition for C++-style comments are the following (actually, the definition of C-style comment is more involved, see the file c_comment.lang): comment start "//" comment delim "/*" "*/" multiline Next: , Previous: , Up: Language Definitions   [Contents][Index] ### 7.6 Variable definitions It is possible to define variables to be re-used in many parts in a language definition file. A variable is defined by using vardef <name of the variable> = <list of definitions> Once defined, a variable can be used by prepending the symbol $to its name. For instance, vardef FUNCTION = '(?:[[:alpha:]]|_)[[:word:]]*(?=[[:blank:]]*$$)' function = FUNCTION The capital letters are used only for readability. It is also possible to concatenate variables and expressions, and reuse variables inside further variable definitions: vardef basic_time = '[[:digit:]]{2}:[[:digit:]]{2}:[[:digit:]]{2}' vardef time = '\<' + basic_time + '\>' Next: , Previous: , Up: Language Definitions [Contents][Index] ### 7.7 Dynamic Backreferences With dynamic backreferences you can refer to a string matched by the regular expression of the first element of a delim specification29. I called these backreferences dynamic in order to distinguish them by the backreferences of regular expression syntax, Ways of specifying regular expressions. This is crucial in cases when the right delimiter depends on a subexpression matched by the left delimiter; for instance, Lua comments can be of the shape --[[ comment ]] or --[=[ comment ]=], but not --[=[ comment ]] neither --[[ comment ]=] (furthermore, they can be nested)30. Thus, the regular expression of the right element depends on the one of the left element. A dynamic backreference is similar to a variable (Variable definitions), but there’s no declaration, and have the shape of @{number} where number is the number of the marked subexpression in the left delimiter (source-highlight will actually check that such a marked subexpression exists in the left delimiter). For instance, this is the definition of Lua comments (see also lua.lang): environment comment delim --$(=*)\[ "]" + @{1} + "]" multiline nested begin include "url.lang" ... end Note how the left delimiter can match an optional =, as a marked subexpression, and the right delimiter refers to that with @{1}. Source-highlight will take care of escaping possible special characters during dynamic backreference substitutions. For instance, suppose that you must substitute | for @{1}, because we matched | with the subexpression [^[:alnum:]] in a delim element like the following one: comment delim ([^[:alnum:]]) @{1} Since | is a special character in regular expression syntax source-highlight will actually replace @{1} with \|. IMPORTANT: the right delimiter can only refer to subexpressions of its left delimiter; thus, in case of nested delim element definitions (e.g., in states or environment, State/Environment Definitions), the left delimiter acts as a binder and hides possible subexpressions defined in outer delim elements. This is crucial to correctly match nested delimited elements with backreferences: source-highlight will correctly recognize this nested (and syntactically correct) Lua comment: --[[ first level comment --[=[ second level --[[ third level ]] ]=] ]] Next: , Previous: , Up: Language Definitions [Contents][Index] ### 7.8 File inclusion It is possible to include other language definition files into another file. This is inclusion actually physically includes the contents of the included file into the current file during parsing, at the exact point of inclusion (just like the #include in C/C++). This is useful for re-using definitions in many files. For instance, C++ comment definitions are given in a file c_comment.lang, and this file is included in the Java and C++ definition files. The same happens for number and functions. For instance, the file java.lang contains the following include instructions: include "c_comment.lang" include "number.lang" keywords ... include "function.lang" Note that the order of inclusion is crucial since the order of definition is crucial. If function definition was included before keyword definitions, then the sentence if (exp) would be highlighted as a function invocation (see Order of definitions and How source-highlight works). Next: , Previous: , Up: Language Definitions [Contents][Index] ### 7.9 State/Environment Definitions Sometimes you want some source element to be highlighted only if they are surrounded by other elements. Source-highlight language definitions provides also this feature. state|environment <standard definition> begin <other definitions> end This structure is recursive (so other state/environment definitions can be given within a state/environment). The meaning of a state/environment is that the definitions within the begin ... end are matched only if the definitions that define the state/environment have been matched. When entering a state/environment, however, the definitions given outside the state/environment are not matched. The difference between state and environment is that in the latter, normal parts of the source language (i.e., those that do not match any definition) are highlighted according to the style of the definition that defines the environment. As an example, the following defines the multiline nested C comment, and highlights URL and e-mail addresses only when they appear inside a comment (note that this uses file inclusion): environment comment delim "/*" "*/" multiline nested begin include "url.lang" end Note that we used environment because everything else inside a comment has to be formatted according to the comment style. While for programming language definitions states/environments can be avoided (although they allow to highlight some parts only if inside a specific environment, e.g., URLs inside comments, or documentation tags in Javadoc comments), they are pretty important for highlighting files such as logs and ChangeLog files, since elements have to be highlighted when they appear in a specific position. For instance, for ChangeLog (see changelog.lang), we use a state for highlighting the date, name, e-mail or URL (taken from url.lang): state date start '[[:digit:]]{2,4}-?[[:digit:]]{2}-?[[:digit:]]{2}' begin include "url.lang" name = '([[:word:]]|[[:punct:]])+' end Note that definitions that appear inside a state/environment have the same scope of the expressions that define the environment. While this makes sense for start and delim definitions, it may make less sense for simple definitions (i.e., those that simply lists all possible expressions): in fact, in this case, such expressions do not define a scope. For such definitions, the semantics of state/environment is that the state/environment starts after matching one of the alternatives. And where will it end? In this case you must explicitly exit the environment. For instance, you can say that, when inside a state/environment, a specific language definition, when encountered also exits the environment, with the keyword exit (you can also specify the number of states to exit). You can even exit all the environments with exitall. For instance, the following definition, highlights a non empty string following a web method: vardef non_empty = '[^[:blank:]]+' state webmethod = "OPTIONS|GET|HEAD|POST|PUT|DELETE", "TRACE|CONNECT|PROPFIND|MKCOL|COPY|MOVE|LOCK|UNLOCK" begin string = non_empty exit end If you ever need such advanced features, you may want to take a look at the log.lang definition file that defines highlighting for several log files (access logs, Apache logs, etc.). Moreover, there might be cases, and the above one is one of such cases, explicit subexpressions with names will be enough (see Explicit subexpressions with names). We conclude this section with an interesting example: comments in M4 files can start with the dnl keyword (up to the end of line), e.g., dnl @synopsis AC_CTAGS_FLAGS Now if we want to highlight the dnl as a keyword, and the rest of line as a comment, we cannot simply rely on an environment, since this would highlight all the line with the same style. Moreover, we want to highlight elements starting with @ differently, so we actually need a state (this would allow us also to highlight urls inside a comment just like in C++ comments in the example above). Thus, we need to simulate an environment with a state, and we do this for M4 as follows (see the file m4.lang): state keyword start "dnl" begin # avoid spaces in front of urls or @[[:alpha:]]+ be captured as prefixes comment = '[[:blank:]]+' include "url.lang" include "html.lang" type = '@[[:alpha:]]+' # everything else is a comment comment = '.+' end Once entered the state, every isolated space character is highlighted as a comment; then we have rules for URLs and @ elements; then everything else (.+) is highlighted as a comment. One might think that a smarter way would be to have simply the following definition (after all, why bothering highlighting spaces as comments): state keyword start "dnl" begin include "url.lang" include "html.lang" type = '@[[:alpha:]]+' comment = '.+' end Well, with this definition spaces in front of matched URLs or @ elements would be highlighted as normal, being considered as prefixes. This is due to how source-highlight searches for matching rules; we refer to How source-highlight works for further details. Next: , Previous: , Up: Language Definitions [Contents][Index] ### 7.10 Explicit subexpressions with names Often, you need to specify two program elements in the same regular expressions, because they are tightly related, but you also need to highlight them differently. For instance, you might want to highlight the name of a class (or interface) in a class (or interface) definition (e.g., in Java). Thus, you can rely on the preceding class keyword which will then be followed by an identifier. A definition such as keyword = '(\<(?:class|interface))([[:blank:]]+)([[:alnum:]]+)' will not produce a good final result, since the name of the class will be highlighted as a keyword, which is not what you might have wanted: for instance, the class name should be highlighted as a type. Up to version 2.6, the only way to do this was to use state or environments (State/Environment Definitions) but this tended to be quite difficult to write. Since version 2.7, you can specify a regular expression with marked subexpressions and bind each of them to a specific language element (the regular expression must be enclosed in , see Ways of specifying regular expressions): (elem1,...,elemn) = (subexp1)(...)(subexpn) Now, with this syntax, we can accomplish our previous goal: (keyword,normal,type) = (\<(?:class|interface))([[:blank:]]+)([[:alnum:]]+) This way, the class (or interface) will be highlighted as a keyword, the separating blank characters are formatted as normal, and the name of the class as a type. Note that the number of element names must be equal to the number of subexpressions in the expression; furthermore, at least in the current version, the expression can contain only marked subexpressions (no character outside is allowed) and no nested subexpressions are allowed. Thus, the following specifications are NOT correct: (keyword,symbol) = (...)(...)(...) # number of elements doesn't match (keyword,symbol) = (...(...)...)(...) # contains nested subexpressions (keyword,symbol) = ...(...)...(...) # outside characters This mechanism permits expressing regular expressions for some situation in a much more compact and probably more readable way. For instance, for highlighting ChangeLog parts (the optional * as a symbol, the optional file name and the element specified in parenthesis as a file element, and the rest as normal) such as * src/Makefile.am (source_highlight_SOURCES): correctly include changelog_scanner.ll * this is a comment without a file name before version 2.6, we used to use these two language definitions: state symbol start '^(?:[[:blank:]]+)\*[[:blank:]]+' begin state file start '[^:]+\:' begin normal start '.' end end state normal start '^(?:[[:blank:]]+)' begin state file start '[^:]+\:' begin normal start '.' end end which can be hard to read after having written them. Now, we can write them more easily (see changelog.lang): (normal,symbol,normal,file)= (^[[:blank:]]+)(\*)([[:blank:]]+)((?:[^:]+\:)?) (normal,file)= (^[[:blank:]]+)((?:[^:]+\:)?) Since a language element definition using explicit subexpressions with names consists of more than one element, and thus of more than one formatting style, it cannot be used to start an environment (what would the default element be?); while, as seen above, they can be used to start a state. Next: , Previous: , Up: Language Definitions [Contents][Index] ### 7.11 Redefinitions and Substitutions These two features are useful when you want to define a language by re-using an existing language definition with some changes. Typically you include another language definition file and you redefine/substitute some elements. When you use redef you erase all the previous definitions of that language elements with the new one. The new language element definition will be placed exactly in the point of the new definition. We use this feature, for instance, when we define the sml language by re-using the caml one: they differ only for the keywords31. In fact, the contents of sml.lang is summarized as follows: include "caml.lang" redef keyword = "abstraction|abstype|and|andalso..." redef type = "int|byte|boolean|char|long|float|double|short|void" Since the new language element definition appears in the exact point of the redefinition, this means that such a regular expression will be matched only if all the previous ones (the ones of the included file) cannot be matched. This may lead to unwanted results in some cases (not in the sml case though). In other words the following code keyword = "foo" keyword = "bar" type = "int" redef keyword = "myfoo" is equivalent to the following one type = "int" keyword = "myfoo" If this is not what you want, you can use subst, which is similar to redef apart from that it replaces the previous first definition of that language element in the exact point of that first definition (all other possible definitions are simply erased). That is to say that the following code keyword = "foo" keyword = "bar" type = "int" subst keyword = "myfoo" is equivalent to the following one keyword = "myfoo" type = "int" It is up to you to decide which one fits best your needs. We could use this feature to define javascript in terms of java, e.g.: include "java.lang" subst keyword = "abstract|break|case|catch|class|if..." Here using redef would have led to the unwanted behavior that if (exp) would have been highlighted as a function call, since the function element definition would have come first (and then matched first) than the redefinition of if as a keyword. Another example is the language definition for C# by reusing the one for C/C++, Highlighting C/C++ and C#. Next: , Previous: , Up: Language Definitions [Contents][Index] ### 7.12 How source-highlight works As hinted at the beginning of Language Definitions, source-highlight uses the definitions in the language definition file to internally create, on-the-fly, regular expressions that are used to highlight the tokens of an input file. Here we provide some internal details that are crucial to understand how to write language definition files correctly32. First of all, for each element definition an highlighting rule is created by source-highlight (even if they correspond to the same language element); thus, each language definition file will correspond to a list of highlighting rules. For each line of the input file, source-highlight will try to match all these rules against the whole line (more formally, against the part of the line that has not been highlighted yet). It will not stop as soon as an highlighting rule matched, since there might be another rule that matches “better”. Now, everything basically reduces to the semantics of that better match. The strategy used by source-highlight is to select the first matching rule • with empty prefix (or prefix containing only space characters, i.e., spaces or tabs) or • with the smallest prefix, where the prefix of a matched rule is the part of the examined string that did not match33. Thus, for instance, if we try to match the simple regular expression = against the string i = 10; then the prefix is i , including the space. Following the terminology of regular expression, the remaining part that did not match, i.e., 10;, is the suffix. When source-highlight finds a matching rule, according to the above strategy, it formats the matched part (and the prefix as normal), and then it starts again searching for a matching rule on the suffix, until it processed the whole line. Let us explain this strategy a little bit further with an example. Consider the following language definition file: # an example for explaining the strategy of source-highlight type = "int" keyword = "null" symbol = "=" and the following line to be highlighted: int i = null Then source-highlight performs these steps: 1. The first matching rule is the one for type; since it has an empty prefix, there’s no need to look any further: it highlights int as type; the remaining part to be processed is now i = null; 2. the first matching rule is the one for keyword, with the prefix i = ; since the prefix is not empty (nor it contain only spaces), we inspect other rules; 3. the next matching rule is the one for symbol, with prefix i , which is smaller than the one for keyword, and since there are no other matching rules, the one for symbol is better, and we highlight = as symbol; the remaining part to be processed is now null; 4. the first matching rule is the one for keyword, and, since it has a prefix with only spaces, we look no further, and we highlight null as keyword. We conclude this section by showing the following language definition, which summarizes what we said about the highlighting strategy: keyword = "if|class" type = 'int' comment delim "/*" "*/" # thus this won’t catch "/* */ /" as a regexp, # since comment elem definition comes first regexp = '/.*/.*/' # this won’t match if ( ) as a function, # since keyword elem definition comes first function = '([[:alpha:]]|_)[[:word:]]*[[:blank:]]*\(*[[:blank:]]*$$' # the following order is conceptually wrong, # since "//" won’t be highlighted as a comment, but as two symbols symbol = "/" comment start "//" Next: , Previous: , Up: Language Definitions [Contents][Index] ### 7.13 Notes on regular expressions Although we refer to Boost documentation for such syntax34, we want to provide here some explanations of some forms of regular expressions that might be unknown but that are pretty useful in language definitions. Typically, when you need to group sub-expressions with parenthesis, but you don’t want the parenthesis to spit out another marked sub-expression, you can use a non-marking parenthesis (?:expression). This is not necessary in the language definition syntax: even though you use standard parenthesis, source-highlight will transform it into a non-marking parenthesis. Source-highlight translates possible marked subexpressions, i.e., those enclosed in ( and ), into non-marked subexpressions (i.e., those explained above). Since version 2.7, if you specify the expression inside the marked subexpressions are left as such (see also Ways of specifying regular expressions). This is useful for backreferences and conditionals. An escape character followed by a digit n, where n is in the range 1-9, is a backreference matches the same string that was matched by sub-expression n. For example the expression ^(a*).*\1 will match the string: aaabbaaa but not the string aaabba. Backreferences are useful to write compact language elements, such as in the case of Perl’s substitution modifiers; thus regexp = s([^[:alnum:][:blank:]]).*\1.*\1[ixsmogce]* will match all these forms s/foo/bar/g s|foo|bar|g s#foo#bar#g s@foo@bar@g A useful regular expression form is the Forward Lookahead Asserts that come in two forms, one for positive forward lookahead asserts, and one for negative lookahead asserts: (?=abc) matches zero characters only if they are followed by the expression “abc”. (?!abc) matches zero characters only if they are not followed by the expression “abc”. For instance, in the definition of a function (function.lang) we use the following regular expression: ([[:alpha:]]|_)[[:word:]]*(?=[[:blank:]]*$$) Thus after the name of a function we test, with the regular expression (?=\() whether an open parenthesis ( can be matched. If it can be matched, however, we leave that part in the input, so that the parenthesis will not be formatted the same way of a function name (see also How source-highlight works to understand better this language element definition). Please, be careful when using such regular expression forms: since part of the input is not actually removed you may end up always scanning the same input part (thus looping) if you do not write the regular expressions well. For instance, consider this language definition state foo = '(?=foo)' begin foo = '(?=foo)' end and the following input file: hello foo bar As soon as we match the word foo we leave it in the input and we enter a state where we try to match the word foo still leaving it in the input. As you might have guess this will make source-highlight loop forever. Probably one might have wanted to write this language definition: state foo = '(?=foo)' begin foo = 'foo' end but a cut-and-paste error had its way ;-) You can also use Lookbehind Asserts: (?<=pattern) consumes zero characters, only if pattern could be matched against the characters preceding the current position (pattern must be of fixed length). (?<!pattern) consumes zero characters, only if pattern could not be matched against the characters preceding the current position (pattern must be of fixed length). Another advanced regular expression mechanism is the one of conditional expressions (?(condition)yes-pattern|no-pattern) attempts to match yes-pattern if the condition is true, otherwise attempts to match no-pattern. (?(condition)yes-pattern) attempts to match yes-pattern if the condition is true, otherwise fails. Condition may be either a forward lookahead assert, or the index35 of a marked sub-expression (the condition becomes true if the sub-expression has been matched). For instance, the following expression36, that we wrote on more lines to try to make it more readable (?: (\() |(\[) |(\{) ) [[:alpha:]]* (?: (?(1)$$ |(?:(?(2)$ |(?:\} ))))) will match (foo), [foo] and {foo} but not (foo], {foo] or {foo). Next: , Previous: , Up: Language Definitions [Contents][Index] ### 7.14 The program check-regexp Since version 2.7, the source-highlight package comes with a small additional program, check-regexp, that permits testing regular expressions on the command line. You simply pass as the first command line argument the regular expression and then the strings you want to try to match (actually, the program searches the string for the given regular expression, so it is not required to match the whole string). It is crucial, in order to avoid shell substitutions, to enclose both the expression and the strings in single quotes. The program then prints some information about the (possibly successful matching). The what[0] part represents the whole match, and what[i] part represents the i-th marked subexpression that matched. The program also prints possible prefix and suffix. Here’s an example of output of the program: check-regexp '(a+)(.*)\1' 'aabcdaa' 'babbbacc' searching : aabcdaa for the regexp : (a+)(.*)\1 what[0]: aabcdaa what[1]: aa length: 2 what[2]: bcd length: 3 total number of matches: 1 searching : babbbacc for the regexp : (a+)(.*)\1 prefix: b what[0]: abbba what[1]: a length: 1 what[2]: bbb length: 3 suffix: cc total number of matches: 1 And here’s the example of matching parenthesis we saw in Notes on regular expressions: check-regexp \ '(?:($$)|($)|(\{))[[:alnum:]]*(?:(?(1)$$|(?:(?(2)$|(?:\})))))' \ '{ciao}' '(foo]' '[hithere]' searching : {ciao} for the regexp : (?:($$)|($)|(\{))[[:alnum:]]*(?:(?(1)$$|(?:(?(2)$|(?:\}))))) what[0]: {ciao} what[3]: { length: 1 total number of matches: 1 searching : (foo] for the regexp : (?:($$)|($)|(\{))[[:alnum:]]*(?:(?(1)$$|(?:(?(2)$|(?:\}))))) total number of matches: 0 searching : [hithere] for the regexp : (?:($$)|($)|(\{))[[:alnum:]]*(?:(?(1)$$|(?:(?(2)$|(?:\}))))) what[0]: [hithere] what[2]: [ length: 1 total number of matches: 1 Next: , Previous: , Up: Language Definitions [Contents][Index] ### 7.15 Listing Language Elements In order for language definitions to be really useful they must be used in proper combination with formatting styles (see Output format style). However, these different files might not be developed by the same person, or simply some one may want to customize one of these. In order to define good output formatting style files you should be aware of each language element defined by a language definition file. Instead of having to look inside the language definition file itself (and recursively in each included file) you can use the command line option --show-lang-elements37, that simply prints to the standard output all the language elements that can be highlighted with a specific language definition file. For instance, for cpp.lang you get: cbracket classname comment function keyword label normal number preproc specialchar string symbol todo type url usertype while for log.lang you get: cbracket comment date function ip normal number port string symbol time twonumbers webmethod Next: , Previous: , Up: Language Definitions [Contents][Index] ### 7.16 Concluding Remarks By mixing all these features you can unleash your imagination and define highlighting for complex source languages such as Flex and Bison by writing few lines of code and re-use existing ones. For instance, Flex and Bison have their own syntax and lets you write C/C++ code in specific parts of the source language, e.g., the code between the outmost brackets, in the following example, is C++ code, and should be highlighted following C++ language definitions (apart from variables that are prefixed with$): globaltags : options { if (...) { setTags( $1 ); } } This is easy to do (taken from flex.lang): state cbracket delim "{" "}" multiline nested begin variable = '\$.' include "cpp.lang" end Note that, since we used nested we can be sure that the C++ language definitions are not considered anymore when we matched the last closing }. Next: , Previous: , Up: Language Definitions   [Contents][Index] ### 7.17 Debugging When writing a language definition file, it is quite useful to be able to debug it (by using complex regular expressions one may experience unwanted behaviors). Since version 2.1 the command line option --debug-lang is available. When using this option, some additional information are printed to the standard output. Since version 2.5 this option also accepts the a sub specification (see Invoking source-highlight). When using dump (the default) all the additional information explained below will be dumped without interaction with the user. When using interactive, for each formatted string the program will stop waiting for a command from the user. In this very primordial version of interactive debug, the user will only have to press ENTER to make the program continue until the next formatted string. This way, the programmer will have the chance to step the highlighting of each part of the input file. Moreover, when debugging is enabled, no buffering will be performed by the program, thus each formatted element will be immediately available in the output. For instance, you can use the command tail -f to see the modifications on the output file on-the-fly. When using this command line option the additional information produced has the following format: <.lang filename>:<line number> expression: <matched subexpression> formatting: <source file string to be formatted> entering: <next state's id> exiting state, level: <number of states> The lines starting with entering, exiting and exitingall are related to entering a new state/environment and exiting one and all states/environments (current state, if shown, comes after entering and prints the same state’s regular expression but after the substitution of dynamic backreferences, Dynamic Backreferences). The first line shows a link to the .lang definition file and the line number, i.e., and the sub-expression that matched and the line starting with formatting shows the source file string that matched with that expression. If a line starting with formatting is not preceded by a line with the link to the sub-expression, it means that no particular regular expression has matched, and thus the style normal will be used to format that string. Consider the following (simplified) Java source file: 01: /* 02: This is to demonstrate –debug-lang 03: http://www.lorenzobettini.it 04: */ 05: 06: package hello; 07: 08: public class Hello { 09: // just some greetings ;-) /* 10: int i = 10; 11: System.out.println("Hello World!"); 12: } 13: Now you can debug the java.lang file by using the --debug-lang command line option. And the output is as follows: c_comment.lang:24 expression: "/\*" formatting "/*" as comment entering state: 23 formatting " This is to demonstrate --debug-lang" as default formatting " " as default url.lang:3 expression: "(?:(?:<?)[[:word:]]+://[[:word:]\./\-_]+(?:>?))" formatting "http://www.lorenzobettini.it" as url c_comment.lang:24 expression: "\*/" formatting "*/" as comment exiting state, level: 1 java.lang:1 expression: "\<(?:import|package)\>" formatting "package" as preproc formatting " hello" as default symbols.lang:1 expression: "(?:~|!|%|\^|\*|$$|$$|-|\+|=|$|$|\\|:|;|,|\.|/|\?|&|<|>|\|)" formatting ";" as symbol ... omissis ... c_comment.lang:13 expression: "//" formatting "//" as comment entering state: 12 formatting " just some greetings ;-) /*" as default c_comment.lang:13 expression: "\z" formatting "" as comment exiting state, level: 1 ... omissis ... This should provide enough information to understand how the regular expressions are used and how the states/environments are entered and exited. Please note that the sub-expressions that are shown may differ from the original ones specified in the .lang file. This is due to the preprocessing that is performed by Source-highlight. Moreover, some sub-expressions are not defined at all in the .lang file: for instance, this is the case for line wide definitions, i.e., those that are defined with the keyword start, Line wide definitions. The last lines above, showing expression: "\z", means that we matched the end of a line. Another useful feature in debugging is the option --show-regex that shows, on the standard output, the regular expression automaton that source-highlight creates. For instance, consider this language definition (comment-show.lang): vardef TODO = '(TODO|FIXME)([:]?)' environment comment delim "/**" "*/" multiline begin type = '@[[:alpha:]]+' todo = $TODO end state cbracket delim "{" "}" escape "\\" multiline nested begin keyword = "if|then|else|endif" end string delim "<" ">" string2 delim "<<" ">>" multiline If you now execute the following command: source-highlight --show-regex=comment-show.lang you will get, on the standard output, the following output38: STATE 1 default: normal rule (comment) "/\*\*" (exit level: 0, next: 2) STATE 2 default: comment rule (comment) "\*/" (exit level: 1, next: 0) rule (type) "(?:\@[[:alpha:]]+)" (exit level: 0, next: 0) rule (todo) "(?:(?:TODO|FIXME)(?:[:]?))" (exit level: 0, next: 0) rule (cbracket) "\{" (exit level: 0, next: 3) STATE 3 default: normal rule (cbracket) "\}" (exit level: 1, next: 0) rule (cbracket) "\\." (exit level: 0, next: 0) rule (cbracket) "\{" (exit level: 0, next: 0, nested) rule (keyword) "\<(?:if|then|else|endif)\>" (exit level: 0, next: 0) rule (string) "<(?:[^<>])*>" (exit level: 0, next: 0) rule (string2) "<<" (exit level: 0, next: 4) STATE 4 default: string2 rule (string2) ">>" (exit level: 1, next: 0) This shows the states and highlight rules of the regular expression automaton that source-highlight creates and will use to format an input source. Each state is associated a unique number in order to identify it; moreover, the default element of the state is shown (i.e., if none of the state’s rule match, then that part is highlighted with the default element style). For instance, in the initial state the default style is normal. Then for each state it shows the rules for that state. For each rule you can see the corresponding element of the rule, the regular expression for the rule and some other information, that we explain in the following. We can see that if we match a /** (it is shown as a string with escaped special characters, /\*\*) we enter a new state, in this case the state 2 (next: 2). This corresponds to the delimited element defining a new environment (State/Environment Definitions). The fact that it is actually an environment and not a state39 can be seen by the fact that the default element is the same of the environment itself. If we match a */, i.e., the end of the delimited element, we exit one level (exit level: 1) meaning that we go back to state 1. Then we have the state for cbracket, which is not an environment, in fact its default state is normal. The second rule of this state, \\. represents the escape string of the state definition. Since the delimited element is defined as nested, we have a third rule { which has the nested information; thus, if we match it, we simply enter a new instance of state 3 itself. The string and string2 show the difference implied by the multiline option: since source-highlight handles a line of input separately, the first delimited definition can be handled with a single regular expression while the multiline version cannot. Note that the states/environments are indented so that it’s easier to understand the outer and the inner states. Let us now consider a variation of the previous example: vardef TODO = '(TODO|FIXME)([:]?)' environment comment delim "/**" "*/" multiline nested begin type = '@[[:alpha:]]+' todo =$TODO end regexp = ([^[:alnum:]]).*(\1) string delim "<" ">" string2 delim "<<" ">>" multiline (paren,normal,paren) = ($)(.*)($) and let us see the output of --show-regex STATE 1 default: normal rule (comment) "/\*\*" (exit level: 0, next: 2) STATE 2 default: comment rule (comment) "\*/" (exit level: 1, next: 0) rule (comment) "/\*\*" (exit level: 0, next: 0, nested) rule (type) "(?:\@[[:alpha:]]+)" (exit level: 0, next: 0) rule (todo) "(?:(?:TODO|FIXME)(?:[:]?))" (exit level: 0, next: 0) rule (regexp) "(?:([^[:alnum:]]).*(\1))" (exit level: 0, next: 0) rule (string) "<(?:[^<>])*>" (exit level: 0, next: 0) rule (string2) "<<" (exit level: 0, next: 3) STATE 3 default: string2 rule (string2) ">>" (exit level: 1, next: 0) rule (paren normal paren) "($)(.*)($)" (exit level: 0, next: 0) Since in the rule regexp we used the regular expression (see Ways of specifying regular expressions), then, the marked subexpressions are not translated in order to make backreferences work correctly. The last rule uses explicit subexpressions with names (see Explicit subexpressions with names); although that expression is made up of different elements, the expression is matched as a whole. Previous: , Up: Language Definitions   [Contents][Index] ### 7.18 Tutorials on Language Definitions Now we provide some examples of language definitions. In the previous sections we have already provided some code snippets, while here we provide complete examples of language definitions that are included in the source-highlight distribution itself. In particular we will first show the language definition for the language definition syntax itself (file langdef.lang). This will be used to highlight the examples of language definitions that we will show in this section (the highlighting will not be visible if you are viewing this manual with the info command). Of course, this example is highlighted itself. # this is the language definition for the # language definition syntax itself comment start "#" preproc = "include" string delim "\"" "\"" escape "\\" multiline regexp delim "'" "'" escape "\\" multiline regexp delim "" "" escape "\\" multiline keyword = "state|environment|begin|end|delim|escape|start", "multiline|nested|vardef|exitall|exit", "redef|subst|nonsensitive" symbol = "=|+|,|(|)" vardef ID = '[[:word:]]+' variable = '\$' +$ID variable = $ID The style that is used to highlight these examples in Texinfo is texinfo.style that is shown in Output format style. The language definition for the style syntax (file style.lang) is even simpler: # this is the language definition for the # style definition syntax comment start "//" string delim "\"" "\"" escape "\\" keyword = "bgcolor|purple|orange|brightorange|brightgreen|darkgreen", "green|darkred|red|brown|pink|yellow|cyan", "black|teal|gray|darkblue|blue", "normal|linenum", "noref|nf|f|u|i|b" keyword = 'bg\:' symbol = ",|;" variable = '[[:word:]]+' Note that this definition is pretty simple since the language definition syntax is simple. In the next examples we will see how to use more complex features to highlight more complex language syntaxes. #### 7.18.1 Highlighting C/C++ and C# This is the language definition for C, included in the file c.lang: # definitions for C include "c_comment.lang" label = '^[[:blank:]]*[[:alnum:]]+:[[:blank:]]*\z' (keyword,normal,classname) = (\<struct)([[:blank:]]+)([[:alnum:]_]+) state preproc start '^[[:blank:]]*#(?:[[:blank:]]*include)' begin string delim "<" ">" string delim "\"" "\"" escape "\\" include "c_comment.lang" end preproc = '^[[:blank:]]*#([[:blank:]]*[[:word:]]*)' include "number.lang" include "c_string.lang" keyword = "__asm|__cdecl|__declspec|__export|__far16", "__fastcall|__fortran|__import", "__pascal|__rtti|__stdcall|_asm|_cdecl", "__except|_export|_far16|_fastcall", "__finally|_fortran|_import|_pascal|_stdcall|__thread|__try|asm|auto", "break|case|catch|cdecl|const|continue|default", "do|else|enum|extern|for|goto", "if|pascal", "register|return|sizeof|static", "struct|switch", "typedef|union", "volatile|while" type = "bool|char|double|float|int|long", "short|signed|unsigned|void|wchar_t" include "symbols.lang" cbracket = "{|}" include "function.lang" include "clike_vardeclaration.lang" Note that this makes use of lots of includes since these parts are reused in other language definitions (e.g., Java has lots of parts that are in common with C/C++ so we wrote these parts in separate files). In particular the comments definitions: # c_comment.lang # comments with documentation tags environment comment start "///" begin include "url.lang" include "html_simple.lang" type = '@[[:alpha:]]+' include "todo.lang" end comment start "//" # comments with documentation tags environment comment delim "/**" "*/" multiline begin include "url.lang" include "html_simple.lang" type = '@[[:alpha:]]+' include "todo.lang" end # standard comments environment comment delim "/*" "*/" multiline begin include "url.lang" include "todo.lang" end Here we have the definitions for line-wide comments (//) and for multi line comments where we highlight also URL addresses and e-mail addresses (defined in the file url.lang not shown here). Moreover, for comments that are used in automatic documentation generation tools (such as Doxygen or Javadoc), i.e., those that start with /** or ///) we also highlight the complete HTML syntax (defined in the file html.lang not shown here). Going back to c.lang we see that we use subexpressions with names (see Explicit subexpressions with names) for highlighting the struct name (when preceded by struct, highlighted as a keyword). For preprocessor directives #include we use a state definition since in this case the file included with the <file> syntax must be formatted as strings (and only in this context the <> must be considered as strings, anywhere else they are operators). Since a state erases definitions defined outside the state we must include c_comment.lang again in order to highlight comments also in this context40. Then we have a definition of preproc that catches all the other preprocessor directives. The included file number.lang defines the regular expression that catches number constants (not shown here), then we include the file c_string.lang that define strings (again shared by Java): vardef SPECIALCHAR = '\\.' environment string delim "\"" "\"" begin specialchar =$SPECIALCHAR end environment string delim "'" "'" begin specialchar = SPECIALCHAR end inside a string we want to highlight in a different way the special characters (such as, e.g., \n, \t, etc.) and in general escaped characters, matched by the regular expression ‘\\.’. The included file symbols.lang defines all the symbols (shared also by other languages): symbol = "~","!","%","^","*","(",")","-","+","=","[", "]","\\",":",";",",",".","/","?","&","<",">","\|" This has nothing interesting but the fact that it shows that the character \ and | have to be escaped. The included file function.lang defines the regular expression to match a function definition or invocation: vardef FUNCTION = '([[:alpha:]]|_)[[:word:]]*(?=[[:blank:]]*)' function = FUNCTION that shows an example of forward lookahead assert for the opening parenthesis (see Notes on regular expressions). As noted in File inclusion, it is crucial that this file is included after the keyword definition. Finally, c.lang includes the file clike_vardeclaration.lang: (usertype,usertype,normal) = ([[:alpha:]_](?:[^[:punct:][:space:]]|[_])*) ((?:<.*>)?) (\s+(?=[*&]*[[:alpha:]_][^[:punct:][:space:]]*\s*[[:punct:]]+)) This definition, using subexpressions with names (see Explicit subexpressions with names), tries41 to match user types (e.g., struct names) in function parameter and variable declarations. It basically tries to match a type identifier, then a possible template specification42 and then we have a complete lookahead assert (Notes on regular expressions) that tries to match the variable identifier, possibly with & and * reference and pointer specification, followed by an assignment = or a ;, more generally a [:punct:] or [] (for array specifications). This should catch the user types in the correct contexts, as in the following (where we intentionally highlighted usertype in italics): Integer i = 10; Boolean b; String args[]; const MyType args[]; const My_Type args[]; List<Integer> mylist; List<List<Integer> > mylist; myspace::InputStream iStream ; MyType *t; MyType **t; const MyType &t; if (argc > 0) { } __mytype _i; typedef _mytype __i; Note that since for the third group we use a lookahead assert, what is matched is not actually formatted but it is put back in the input stream so that it can be formatted using other rules (e.g., symbol for * and =). Since, at least syntactically, C++ is an extension of C, the language definition for C++, included in the file cpp.lang, relies on c.lang43: # definitions for C++ # most of it is shared with c.lang (keyword,normal,classname) = (\<(?:class|struct|typename))([[:blank:]]+)([[:alnum:]_]+) keyword = "class|const_cast|delete", "dynamic_cast|explicit|false|friend", "inline|mutable|namespace|new|operator|private|protected", "public|reinterpret_cast|static_cast", "template|this|throw|true", "try|typeid|typename", "using|virtual" include "c.lang" In particular, it extends the set of keywords. Moreover, note that we use subexpressions with names (see Explicit subexpressions with names) for highlighting the class (or struct) name (when preceded by class, struct or typename, highlighted as a keyword). A similar rule was also present in c.lang, but it concerned only struct. Now that we wrote the language definition for C/C++, writing the one for C# is straightforward, since we only need to add the keyword using as a preprocessor element, and redefine (or better, “substitute”, Redefinitions and Substitutions) the keywords and types: # definitions for C-sharp # by S. HEMMI, updated by L. Bettini. preproc = "using" number = '\<[+-]?((0x[[:xdigit:]]+)|(([[:digit:]]*\.)? [[:digit:]]+([eE][+-]?[[:digit:]]+)?))([FfDdMmUulL]+)?\>' include "cpp.lang" subst keyword = "abstract|event|new|struct", "as|explicit|null|switch", "base|extern|this", "false|operator|throw", "break|finally|out|true", "fixed|override|try", "case|params|typeof", "catch|for|private", "foreach|protected", "checked|goto|public|unchecked", "class|if|readonly|unsafe", "const|implicit|ref", "continue|in|return", "virtual", "default|interface|sealed|volatile", "delegate|internal", "do|is|sizeof|while", "lock|stackalloc", "else|static", "enum|namespace", "get|partial|set", "value|where|yield" subst type = "bool|byte|sbyte|char|decimal|double", "float|int|uint|long|ulong|object", "short|ushort|string|void" Next: , Previous: , Up: Tutorials on Language Definitions [Contents][Index] #### 7.18.2 Highlighting Diff files Now we want to highlight files that are generated by diff (typically used to create patches). This program can generate outputs in three different formats (at least at best of my knowledge). With the option -u|--unified the differences among files are shown in the same context, for instance (the examples of the diff files shown here are manually modified so that they can fit in the page width): diff -ruP source-highlight-2.1.1/source-highlight.spec ... — source-highlight-2.1.1/source-highlight.spec ... +++ source-highlight-2.1.2/source-highlight.spec ... @@ -6,8 +6,8 @@ Summary: syntax highlighting for source documents Name: source-highlight -Version: 2.1.1 -Release: 2.1.1 +Version: 2.1.2 +Release: 2.1.2 License: GPL Group: Utilities/Console Source: ftp://ftp.gnu.org/gnu/source-highlight/%{name}-%{version}.tar.gz With the option -c--context the differences are shown into two different parts: diff -rc2P source-highlight-2.1.1/source-highlight.spec ... *** source-highlight-2.1.1/source-highlight.spec ... — source-highlight-2.1.2/source-highlight.spec ... *************** *** 7,12 **** Summary: syntax highlighting for source documents Name: source-highlight ! Version: 2.1.1 ! Release: 2.1.1 License: GPL Group: Utilities/Console — 7,12 —- Summary: syntax highlighting for source documents Name: source-highlight ! Version: 2.1.2 ! Release: 2.1.2 License: GPL Group: Utilities/Console diff -rc2P source-highlight-2.1.1/src/latex.outlang ... *** source-highlight-2.1.1/src/latex.outlang ... — source-highlight-2.1.2/src/latex.outlang ... *************** *** 35,37 **** — 35,38 —- "--" "-\\/-" "---" "-\\/-\\/-" + "\"" "\"{}" # avoids problems with some inputenc end Without options it generates only the essential difference information without any addition context lines: diff -rP source-highlight-2.1.1/source-highlight.spec ... 9,10c9,10 < Version: 2.1.1 < Release: 2.1.1 --- > Version: 2.1.2 > Release: 2.1.2 Summarizing, we would like to be able to handle all these three different syntaxes; note that the first format and the second format have something conflicting: the first one uses the --- to indicate the new version of a file while the second format uses it to indicate the old version of a file. Since we want to highlight differently the old parts and the new parts (this is not visible in the Texinfo highlighting due to the lack of enhanced formatting features, but it is visible for instance in HTML output where we use two different colors), this behavior adds some difficulties. Of course, we could define three different language definitions, one for each diff output format. However, we prefer to handle them all in the same file! This is the language definition for diff files: # language definition for files created with ’diff’ # diff created with -u option state oldfile = '(?=^[-]{3})' begin oldfile start '^[-]{3}' oldfile start '^[-]' newfile start '^[+]' difflines start '^@@' end # diff created with -c option state oldfile = '(?=^[*]{3})' begin environment oldfile = '^[*]{3}[[:blank:]]+[[:digit:]]' begin normal start '^[[:space:]]' newfile = '(?=^[-]{3})' exit end oldfile start '^[*]{3}' environment newfile = '^[-]{3}[[:blank:]]+[[:digit:]]' begin normal start '^[[:space:]]' newfile = '(?=^[*]{3})' exit normal start '^diff' exit end newfile start '^[-]{3}' end # otherwise, created without options state difflines = '(?=^[[:digit:]])' begin difflines start '^[[:digit:]]' oldfile start '^[<]' newfile start '^[>]' end Since we can safely assume that when we process a diff file it contains only information created with the same diff command line switch, we define three different states that correspond to the three diff output formats. Note that these states are entered with a simple definition; as noted in State/Environment Definitions, this means that no automatic exit means are provided, and since no explicit exit condition is specified, this means that once one of this state is entered it will never be exited. This is consistent with our goal. Of course, the expression that makes us enter a state must be defined correctly, and in particular we first search for an initial --- sequence since this is used as the first difference specification by the -u|--unified option, so this is a distinguishing feature to be used to infer which diff format file we are processing. Another interesting thing, is that we use the forward lookahead assert for the opening parenthesis (see Notes on regular expressions), since we only want to see which file format we are processing. Once we entered the right state we can define the regular expressions for the elements of the specific diff file format. For the files created with the option -c|--context we define two inner environments, one for the new file part and one for the old file part (these are delimited by a --- or *** and line number information). Note that these are environments, so anything that is not matched by any expression is formatted according to the style of the element that defines the environment. Thus, we provide an expression for text that must be formatted as normal. For diff files this corresponds to a line that start with a space or with diff (take a look at the examples above). In particular the latter case can take place only during the new file part. In both environments we must define the exit conditions. In both cases these correspond to the beginning of the complementary part; also in this case we use forward lookahead assertions, since we use it only to exit the environment. The outer definitions for oldfile and newfile are used to match the lines with source file information information. The third state, corresponding to the normal diff output format, should be straightforward by now. Previous: , Up: Tutorials on Language Definitions [Contents][Index] #### 7.18.3 Pseudo semantic analysis Source-highlight, by means of regular expressions can only perform lexical analysis of the input source. In particular, it is based on the assumption that the input source is syntactically correct with respect to the input language. However, by using the language definition syntax and by writing the right regular expression it is possible to simulate some sort of semantic analysis of the input source. For instance, consider the following C (or C++) source file: // test special #if 0 treatment int main() { #if 0 // equivalent to a comment int i = 10; printf("this should never be executed\n"); return 1; #else printf("Hello world!\n"); return 0; #endif printf("never reach here!\n"); } It is easy to verify that the code between #if 0 and #else will be never executed (indeed it will not even be compiled). Thus, we might want to format it as a comment. We then write another language definition file, based on the file cpp.lang: environment comment start '^[[:blank:]]*#if[[:blank:]]+0' begin comment start '^[[:blank:]]*#(else|endif)' exit end include "cpp.lang" We intentionally included an error in this first version: we used the start element to start the environment, but such element has the scope of a single line, thus, it does not have the desired behavior: // test special #if 0 treatment int main() { #if 0 // equivalent to a comment int i = 10; printf("this should never be executed\n"); return 1; #else printf("Hello world!\n"); return 0; #endif printf("never reach here!\n"); } A better solution is the following one: environment comment = '^[[:blank:]]*#[[:blank:]]*if[[:blank:]]+0' begin comment start '^[[:blank:]]*#[[:blank:]]*(else|endif)' exit end include "cpp.lang" here we enter the comment environment by not using a delimited element, but simply the regular expression to match #ifdef 0. Then we exit the environment either when we match an #else or a #endif. This seems to work: // test special #if 0 treatment int main() { #if 0 // equivalent to a comment int i = 10; printf("this should never be executed\n"); return 1; #else printf("Hello world!\n"); return 0; #endif printf("never reach here!\n"); } However, it does not work if we consider nested #if...#else; for instance consider the following code, formatted with the previous language definition: // test special #if 0 treatment int main() { #if 0 // equivalent to a comment int i = 10; printf("this should never be executed\n"); # ifdef FOO printf("foo\n"); # ifndef BAR printf("no bar\n"); # else # endif # else printf("no foo\n"); # endif // FOO return 1; #else printf("Hello world!\n"); return 0; #endif printf("never reach here!\n"); } The problem is that the previous language definition does not consider nested #if and thus, the first time it matches a #else or an #endif it exits the comment environment. We must then take into account possible nested occurrences. This can be done by using a delimited element with the nested option (Delimited definitions): # treat the preprocess statement # #if 0 # ... # #else # as a comment environment comment = '^[[:blank:]]*#[[:blank:]]*if[[:blank:]]+0' begin comment start '^[[:blank:]]*#[[:blank:]]*else' exit comment delim '^[[:blank:]]*#[[:blank:]]*if' '^[[:blank:]]*#[[:blank:]]*endif' multiline nested end include "cpp.lang" This time the right block of code is correctly formatted as a comment: // test special #if 0 treatment int main() { #if 0 // equivalent to a comment int i = 10; printf("this should never be executed\n"); # ifdef FOO printf("foo\n"); # ifndef BAR printf("no bar\n"); # else # endif # else printf("no foo\n"); # endif // FOO return 1; #else printf("Hello world!\n"); return 0; #endif printf("never reach here!\n"); } Note that it is crucial to exit the environment even when we match an #else (not only an #endif, since, this way, we can match again another #ifdef 0; consider, for instance, the following code: // test special #if 0 treatment int main() { #if 0 // equivalent to a comment int i = 10; printf("this should never be executed\n"); return 1; #else printf("Hello world!\n"); # if 0 // another one return 1; # else return 0; # endif #endif printf("never reach here!\n"); } Next: , Previous: , Up: Top [Contents][Index] ## 8 Output Language Definitions Since version 2.1 source-highlight uses a specific syntax to specify output formats (e.g., how to format in HTML, LaTeX, etc.). Before version 2.1, in order to add a new output format, many C++ classes had to be written. This had the drawback that a new output format could not be added “dynamically”: you had to recompile the whole source-highlight program. Instead, now, an output format is specified in a file, loaded dynamically, through a (hopefully) simple syntax. Then, these definitions are used internally to create, on-the-fly, text formatters. Here, we see such syntax in details, by relying on many examples. This allows a user to easily modify an existing output format definition and create a new one. These files have, typically, extension .outlang. Each definition basically associates a text style (such as, e.g., bold, italics, colors, etc.) to the representation of that style into the output format (such as, e.g., <b>text</b> in HTML). The representation is given in " and you can use the classic escape character \ to use the " inside the definition. If you want to specify the ASCII code for a character you can do so by specifying the numeric code in hexadecimal notation preceded by \x, for an example, see Style template. If no definition is given for a specific style, e.g., bold, then when that style is requested during formatting, the text will be formatted as it is, i.e., the style without the definition is simply ignored. Comments can be given by using #; the rest of the line is considered as a comment. Files can be included in the same way as for language definitions, File inclusion. In any case, if a definition for a style is given more than once, the last definition replaces all the others. Next: , Previous: , Up: Output Language Definitions [Contents][Index] ### 8.1 File extension With the line: extension "<file extension>" you define the default file extension (without the .) used to generate files formatted according to this output format. This is used when no output file name is specified; if the file extension is not included in the .outlang is not defined, and no output file name is specified, an error will occur. For instance, this is used in html_common.outlang: extension "html" Next: , Previous: , Up: Output Language Definitions [Contents][Index] ### 8.2 Text styles These are the text styles that one can define: bold italics underline notfixed fixed These, of course, correspond to the ones used to specify the output format style, Output format style. These definitions, for instance, are from the HTML format definition: bold "<b>text</b>" italics "<i>text</i>" underline "<u>text</u>" Inside a definition you use the special variable text to specify where the actual text to be formatted has to be inserted. For instance, the definition of bold above says that if you need to format the keyword class in bold in HTML, the following text will be generated: <b>class</b>. This variable is used also when mixing more than one styles recursively, in particular if you want to format in bold and italics (i.e, first bold and then italics, or, in other words, the sequence i, b is used in the the output format style file, see Output format style), then first the text class is substituted for text into <b>text</b> and then the text <b>class</b> will be substituted for text into <i>text</i>, thus obtaining <i><b>class</b></i>. Next: , Previous: , Up: Output Language Definitions [Contents][Index] ### 8.3 Colors The definition for using colors during formatting requires the definition for the color style color "..." and for the bgcolor style44: bgcolor "..." This definition concerns only the background color for a specific highlighted element, i.e., the color specified in the style file with the prefix bg: (see Output format style) or the property background-color specified in a CSS file passed to --style-css-file (see Output format style using CSS). Thus it should not be confused with the background color of the entire output (i.e., the one specified using bgcolor in a style file or the property background-color of the body selector in a CSS). The background color for the entire document is explained in Document template. Note that the background color might not be available for all output formats. For instance, for HTML we only have: color "<font color=\"style\">text</font>" while for XHTML we have: color "<span style=\"color: style\">text</span>" bgcolor "<span style=\"background-color: style\">text</span>" Apart from the variable text that we already saw, we have also the variable style, that will be replaced with the actual color. Source-highlight recognizes a number of color constants, see Output format style. You then must associate a color constant to the color definition in the output format, through the colormap definition: colormap "color constant" "color representation" "color constant" "color representation" ... default "default color representation" end The default row (note the absence of ") defines the color to be used in case a color constant is used during formatting, but it is not defined in the output format. For instance, for HTML we have: colormap "green" "#33CC00" "red" "#FF0000" "darkred" "#990000" "blue" "#0000FF" "brown" "#9A1900" "pink" "#CC33CC" "yellow" "#FFCC00" "cyan" "#66FFFF" "purple" "#993399" "orange" "#FF6600" "brightorange" "#FF9900" "brightgreen" "#33FF33" "darkgreen" "#009900" "black" "#000000" "teal" "#008080" "gray" "#808080" "darkblue" "#000080" default "#000000" end If your output format does not handle colors you can simply avoid the definitions of color and colormap and Source-highlight will simply ignore colors. The color is applied after applying the other styles, e.g., bold, italics, etc. Thus, by continuing the example of the previous section, suppose you defined the following output style for keywords: keyword blue i, b; then the class text will be replaced to text variable and the value #0000FF to style inside the color definition <font color="style">text</font> obtaining <font color="#0000FF">class</font> which will then be replaced to text in <b>text</b> and so on for italics, finally obtaining <i><b><font color="#0000FF">class</font></b></i>. Next: , Previous: , Up: Output Language Definitions [Contents][Index] ### 8.4 Anchors and References When using the command line option --line-number-ref (Invoking source-highlight) an anchor is generated in the output file for each line numbering. The style of the anchor is defined by the definition anchor. If this is not defined, the option --line-number-ref has no effect. The linenum variable will be replaced with the line number, and the text variable with the actual text. For instance, for HTML we have anchor "<a name=\"linenum\">text</a>" Since version 2.2 source-highlight can also generate references to several elements (e.g., variables, class definitions, etc.), Generating References. Also in this case the definition anchor is used; furthermore, the definition of reference is required. In the definition of anchor and reference, apart from the variable linenum, we also have the variables infile (the name of the original input file) and infilename (the name of the original input file without the path) and in the definition of reference we also have the variable outfile (the name of the file where the anchor is). One can decide how to define an anchor and a reference by using these two variables. For instance, for HTML we have reference "<a href=\"outfile#linenum\">text</a>" Note, that in this case we use the outfile since we actually generate a link to another (or possibly the same) output file. On the contrary, for LaTeX, since we do not generate a “clickable” reference, we refer to the original input file (we use both infilename and linenum in both definitions of anchor and reference): anchor "\label{infilename:linenum}text" reference "{\hfill text \rightarrow infile:linenum, \ page~\pageref{infilename:linenum}}" In particular, we use infilename for generating the \label and not infile because the path symbol would “disturb” LaTeX (while we use the complete file path in the textual information of the reference). This will generate a right aligned reference. Note that it is assumed that when generating references in LaTeX one uses --gen-references=postline or --gen-references=postdoc and not --gen-references=inline (Generating References), since it makes no sense to generate an inline reference (or at least I would not know how to generate a nice looking one :-). Furthermore, for Texinfo: anchor "@anchor{infilename:linenum}text" reference "@flushright @xref{infilename:linenum,text,text infile:linenum}. @end flushright" Note that using both infilename (and not infile for the same reasons) and linenum also in the definition of anchor somehow ensures that there are no duplicate anchors; this is done for LaTeX and Texinfo but not for HTML because it is assumed that the generated .tex and .texinfo file is included directly in a master file, as it is done in this manual (while, for instance, it is assumed that a separate HTML file is generated for each source and kept separate). If this is not your case you can change the definitions of anchor and reference as you see fit. Some examples of outputs with references in Texinfo are shown in Examples. Indeed, one can use three more definitions for reference that corresponds to the three arguments that can be passed to --gen-references command line option (Generating References): inline_reference, postline_reference and postdoc_reference. If one of this not defined, then the same definition of reference is used. Having the possibility of specifying different definitions is useful for instance in the case of HTML: the same style for an inline reference is pretty ugly when used also for a postline or postdoc reference: postline_reference "<a href=\"outfile#linenum\">text -> infile:linenum</a>" postdoc_reference "<a href=\"outfile#linenum\">text -> infile:linenum</a>" reference "<a href=\"outfile#linenum\">text</a>" Next: , Previous: , Up: Output Language Definitions [Contents][Index] ### 8.5 One style If the output format you are defining does not have a specific style for bold, italics, ... and for colors you can simply use the definition onestyle, where you can use both style and text. This will be used for any style (indeed any other definition such as bold, italics, color will be ignored). Indeed, in this case, it is assumed that the style of each source element is defined in a file with its own syntax, i.e., not with a syntax defined by Source-highlight. (This is the case, for instance, of HTML using CSS style sheets.) Moreover, since the output format style is not used, during formatting the variable style will be replaced with the name of the element to highlight (e.g., keyword, comment, etc.). For instance, for HTML CSS, we simply have: onestyle "<span class=\"style\">text</span>" In fact, HTML CSS relies on style definitions provided in a separate file (the .css file indeed). Thus, when formatting a keyword, e.g., abstract, we will obtain: <span class="keyword">abstract</span> Of course, the style for keyword must be defined in the .css file. Next: , Previous: , Up: Output Language Definitions [Contents][Index] ### 8.6 Style template Some output formats are based on a unique template that where the other styles are composed; during composition the styles can be separated with a specific separator: styletemplate "..." styleseparator "..." This is used, for instance, for the ANSI color escape sequence output format (esc.outlang): styletemplate "\x1b[stylemtext\x1b[m" styleseparator ";" bold "01style" underline "04style" italics "style" color "style" Note that, since more than one style can be mixed into the style template, bold, underline, ... explicitly use the variable style. Next: , Previous: , Up: Output Language Definitions [Contents][Index] ### 8.7 Line prefix This feature allows you to generate a string as the prefix of each generated line that corresponds to an input line (i.e., this prefix is not generated for other generated output elements, e.g., the lines in the header, footer, etc.). We use this feature in the LaTeX output (LaTeX output): lineprefix "\mbox{}" This way each line in the LaTeX output is prefixed with \mbox{}45. Another interesting example that uses lineprefix is the javadoc output, see Generating HTML output. Next: , Previous: , Up: Output Language Definitions [Contents][Index] ### 8.8 String translation Some character sequences that are in the source file may have a special meaning in an output format, so they need some preprocessing (e.g., escaping them). You can specify the translation table with: translations "original sequence" "transformed sequence" 'regex' "transformed sequence" ... end The difference between "original sequence" and 'regex'46 is that with the former you specify a character sequence that will be matched literally, apart from special characters such as \ (which, if needed to be inserted, must be escaped), \n (new line) and \t (tab character). Instead, with the latter, you can specify a regular expression (this is basically the same difference between " and ' in language definitions, see Simple definitions). For instance, for HTML, we have the following translation table: translations "&" "&amp;" "<" "&lt;" ">" "&gt;" end For LaTeX, the translation table is a little bit bigger; here we show only a little part, that shows how to escape special characters (such as, to translate a new line character and tab character: translations "<" "<$" ">" "$>$" "&" "\\&" "\\" "\\textbackslash{}" "\n" " \\\\\n" " " "\\ " "\t" "\\ \\ \\ \\ \\ \\ \\ \\ " end Note that, since a new character must be translated in LaTeX with \\, we have to escape two \ (i.e., \\\\) and then we want to actually insert a new line in the output file \n. For HTML with not fixed font by default, html_notfixed.outlang (see HTML and XHTML output), we need two translate two space sequence (i.e., two adjacent spaces, since in HTML more adjacent spaces are rendered as only one space47, while we want them as they are), and we also need to translate a space starting a new line in the source (thus we use the regular expression ^ , enclosed in '); thus we have: translations "\n" "<br>\n" " " "&nbsp; " '^ ' "&nbsp;" # a space at the beginning of a line "\t" "&nbsp; &nbsp; &nbsp; &nbsp; " end Next: , Previous: , Up: Output Language Definitions [Contents][Index] ### 8.9 Document template You can define the beginning and the end of an output file, with doctemplate "...beginning..." "...end..." end nodoctemplate "...beginning..." "...end..." end The first one is used when the --doc command line option is specified, while the second one is used in the other case48. For instance, for HTML we have nodoctemplate "<!-- Generator:$additional --> $header<pre><tt>" "</tt></pre>$footer " end Note that in the end part there is an explicit new line. In the definition of the doctemplate and nodoctemplate the following variables can be used and will be replaced during the output generation: $title the value of the title for the output file (e.g., the one passed with the --title command line option;$header the contents of the file specified with the command line option --header; $footer the contents of the file specified with the command line option --footer;$css the value passed with the command line option --css; $additional other additional information. Source-highlight replaces this with its name and its version.$docbgcolor49 the background color for the output document. Source-highlight replaces this with the value specified in the bgcolor of the .style file (see Output format style) or in the body selector of the CSS file passed with --style-css-file (see Output format style using CSS). For instance, for an HTML document with css, (file htmlcss.outlang) we have: doctemplate "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\"> <html> <head> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"> <meta name=\"GENERATOR\" content=\"$additional\"> <title>$title</title> <link rel=\"stylesheet\" href=\"$css\" type=\"text/css\"> </head> <body>$header<pre><tt>" "</tt></pre> $footer</body> </html> " end For an HTML document with header and footer, (file html.outlang) we have (note the use of$docbgcolor): doctemplate "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\"> <html> <head> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"> <meta name=\"GENERATOR\" content=\"$additional\"> <title>$title</title> </head> <body bgcolor=\"$docbgcolor\">$header<pre><tt>" "</tt></pre> $footer</body> </html> " end And for an HTML table output (file htmltable.outlang): doctemplate "<table BGCOLOR=\"$docbgcolor\" NOSAVE > <tr NOSAVE> <td NOSAVE> <pre><tt>" "</tt></pre> </td> </tr> </table> " end Previous: , Up: Output Language Definitions   [Contents][Index] ### 8.10 Generating HTML output As a complete example we show the file html_common.outlang which contains the common definitions for the various HTML output formats (html.outlang, htmltable.outlang, etc.): include "html_ref.outlang" extension "html" bold "<b>$text</b>" italics "<i>$text</i>" underline "<u>$text</u>" color "<font color=\"$style\">$text</font>" colormap "green" "#33CC00" "red" "#FF0000" "darkred" "#990000" "blue" "#0000FF" "brown" "#9A1900" "pink" "#CC33CC" "yellow" "#FFCC00" "cyan" "#66FFFF" "purple" "#993399" "orange" "#FF6600" "brightorange" "#FF9900" "brightgreen" "#33FF33" "darkgreen" "#009900" "black" "#000000" "teal" "#008080" "gray" "#808080" "darkblue" "#000080" "white" "#FFFFFF" default "#000000" end translations "&" "&amp;" "<" "&lt;" ">" "&gt;" end Moreover, this file is also used for generating javadoc output: include "html_common.outlang" doctemplate " * <!-- Generated by Source-highlight --> * <pre><tt> " " * </tt></pre> " end nodoctemplate " * <!-- Generated by Source-highlight --> * <pre><tt> " " * </tt></pre> " end lineprefix " * " translations "*/" "&#42;/" # this avoids the */ to be interpreted as # the end of a comment inside a javadoc comment end The javadoc output format is useful to format code snippets that have to be included inside a javadoc comment of another Java file50. Apart from being formatted nicely in the generated HTML documentation, this also releases the programmer from escaping specific characters in the code snippet (i.e., &, < and >). Note also that it also avoids the sequence */ to be interpreted as the closing of the (javadoc) comment. For instance, if you write this code: /** * This is an example of usage * * <pre><tt> * System.out.println("*/"); * </tt></pre> */ The resulting Java code contains a syntax error. If you use source-highlight to format the code to insert in a javadoc comment you will avoid these problems. An example of a javadoc generated HTML page containing a code snippet formatted with source-highlight can be found in the file SimpleClass-doc.html in the documentation directory. Next: , Previous: , Up: Top [Contents][Index] ## 9 Generating References Since version 2.2 Source-highlight also produces references to fields, variables, etc. In order to do this it relies on the program Exuberant Ctags, by Darren Hiebert, available at http://ctags.sourceforge.net. Thus, you must install this program if you want Source-highlight to provide this feature. The ctags program generates an index (or “tag”) file for a variety of language objects found in file(s). This allows these items to be quickly and easily located by a text editor or other utility (as in this case for Source-highlight). A “tag” signifies a language object for which an index entry is available (or, alternatively, the index entry created for that object)51. This means that Source-highlight is able to generate references for a specific source language if and only if ctags handles such language. We refer to the command line options of ctags: --list-maps and --list-languages to find out the associations of file extensions and supported languages. Reference generation is enable by using the command line option --gen-references (Invoking source-highlight). This option takes an argument that rules how references will be generated: inline a reference pointer will be generated exactly in the same place of the specific element. This is useful in output formats that naturally supports links, such as HTML, while it is useless for output formats that do not support inline links, such as LaTeX. postline if a line of the input source contains elements for which we found references, the list of references will be generated right after the line (see the examples, Examples). postdoc All the references will be generated after the whole input file has been generated. There is an exception: when an element has more than one reference (because a variable is defined in many sources or because a method is overloaded) then if inline is specified, the generation switches to postline for that occurrence. When --gen-references is specified, Source-highlight first invokes ctags. The use can customize this call by using the command line option --ctags (Invoking source-highlight). In particular, if one does not want ctags to be invoked by Source-highlight (e.g., because the tags file has already been generated) then --ctags must be passed an empty string, "". In this case or when the specified ctags command line generates an alternative output tag file (the default generated file is tags), one must specify the exact tag file with the command line option --ctags-file. Once the tag file is generated, Source-highlight relies on the library readtags provided by the ctags distribution, and included in the Source-highlight sources. Note that if a program element is formatted according to a style that has the option noref (see Output format style) then this element is not considered a tag, and no reference is generated. This is the case, for instance, for a comment element: each string that is generated with the comment style, since this is declared with the option noref, it is not considered a tag (see Examples). Next: , Previous: , Up: Top [Contents][Index] ## 10 Examples Here we provide some examples of sources formatted with Source-highlight using the -f texinfo command line option. Please keep in mind that the highlighting will not be visible in the Info file, but only in the printed manual and in the HTML output (well, at least line numbers are visible everywhere :-). Next: , Previous: , Up: Examples [Contents][Index] ### 10.1 Simple example The first example is produced by using the command: source-highlight -f texinfo -i test.java -o test.java.texinfo -n and here’s the result 01: /* 02: This is a classical Hello program 03: to test source-highlight with Java programs. 04: 05: to have an html translation type 06: 07: source-highlight -s java -f html –input Hello.java –output Hello.html 08: source-highlight -s java -f html < Hello.java > Hello.html 09: 10: or type source-highlight –help for the list of options 11: 12: written by 13: Lorenzo Bettini 14: http://www.lorenzobettini.it 15: http://www.gnu.org/software/src-highlite 16: */ 17: 18: package hello; 19: 20: import java.io.* ; 21: 22: /** 23: * <p> 24: * A simple Hello World class, used to demonstrate some 25: * features of Java source highlighting. 26: * </p> 27: * TODO: nothing, just to show an highlighted TODO or FIXME 28: * 29: * @author Lorenzo Bettini 30: * @version 2.0 31: */ /// class 32: public class Hello { 33: int foo = 1998 ; 34: int hex_foo = 0xCAFEBABE; 35: boolean b = false; 36: Integer i = null ; 37: char c = '\'', d = 'n', e = '\\' ; 38: String xml = "<tag attr=\"value\">&auml;</tag>", foo2 = "\\" ; 39: 40: /* mymethod */ 41: public void mymethod(int i) { 42: // just a foo method 43: } 44: /* mymethod */ 45: 46: /* main */ 47: public static void main( String args[] ) { 48: // just some greetings ;-) /* 49: System.out.println( "Hello from java2html :-)" ) ; 50: System.out.println( "\tby Lorenzo Bettini" ) ; 51: System.out.println( "\thttp://www.lorenzobettini.it" ) ; 52: if (argc > 0) 53: String param = argc[0]; 54: //System.out.println( "bye bye... :-D" ) ; // see you soon 55: } 56: /* main */ 57: } 58: /// class 59: 60: // end of file test.java Next: , Previous: , Up: Examples [Contents][Index] ### 10.2 References This example shows the use of --gen-references functionality. In particular, the following output is generated with the command: source-highlight -f texinfo -i test.h -o test_ref.h.texinfo -n \ --gen-references=postline and here’s the result (note how the comment line containing the string mysum does not contain references, since it is a comment element, and this element has the option noref in the texinfo.style, see Output format style. The same holds for the _TEXTGEN_H comment in the last comment line). 01: /** 02: ** Copyright (C) 1999-2007 Lorenzo Bettini 03: ** 04: http://www.lorenzobettini.it 05: 06: r2 = r2 XOR (1<<10); 07: cout << "hello world" << endl; 08: ** 09: */ 10: 11: // this file also contains the definition of mysum as a #define 12: 13: // textgenerator.h : Text Generator class && 14: 15: #ifndef _TEXTGEN_H See _TEXTGEN_H ../../tests/test.h:16. 16: #define _TEXTGEN_H 17: 18: #define foo(x) (x + 1) 19: 20: #define mysum myfunbody 21: 22: #include <iostream.h> // for cerr 23: 24: #include "genfun.h" /* for generating functions */ 25: 26: class TextGenerator { 27: public : 28: virtual void generate( const char *s ) const { (*sout) << s ; } 29: virtual void generate( const char *s, int start, int end ) const 30: { 31: for ( int i = start ; i <= end ; ++i ) 32: (*sout) << s[i] ; 33: return a<p->b ? a : 3; 34: } 35: virtual void generateln( const char *s ) const 36: { 37: generate( s ) ; See generate ../../tests/test.h:28. See generate ../../tests/test.h:29. 38: (*sout) << endl ; 39: } 40: virtual void generateEntire( const char *s ) const 41: { 42: startTextGeneration() ; See startTextGeneration ../../tests/test.h:46. See startTextGeneration ../../tests/test.h:70. 43: generate(s) ; See generate ../../tests/test.h:28. See generate ../../tests/test.h:29. 44: endTextGeneration() ; See endTextGeneration ../../tests/test.h:47. See endTextGeneration ../../tests/test.h:76. 45: } 46: virtual void startTextGeneration() const {} 47: virtual void endTextGeneration() const {} 48: virtual void beginText( const char *s ) const 49: { 50: startTextGeneration() ; See startTextGeneration ../../tests/test.h:46. See startTextGeneration ../../tests/test.h:70. 51: if ( s ) 52: generate( s ) ; See generate ../../tests/test.h:28. See generate ../../tests/test.h:29. 53: } 54: virtual void endText( const char *s ) const 55: { 56: if ( s ) 57: generate( s ) ; See generate ../../tests/test.h:28. See generate ../../tests/test.h:29. 58: endTextGeneration() ; See endTextGeneration ../../tests/test.h:47. See endTextGeneration ../../tests/test.h:76. 59: } 60: } ; 61: 62: // Decorator 63: class TextDecorator : public TextGenerator { See TextGenerator ../../tests/test.h:26. 64: protected : 65: TextGenerator *decorated ; See TextGenerator ../../tests/test.h:26. 66: 67: public : 68: TextDecorator( TextGenerator *t ) : decorated( t ) {} See TextGenerator ../../tests/test.h:26. See decorated ../../tests/test.h:65. 69: 70: virtual void startTextGeneration() const 71: { 72: startDecorate() ; 73: if ( decorated ) See decorated ../../tests/test.h:65. 74: decorated->startTextGeneration() ; See startTextGeneration ../../tests/test.h:46. See decorated ../../tests/test.h:65. See startTextGeneration ../../tests/test.h:70. 75: } 76: virtual void endTextGeneration() const 77: { 78: if ( decorated ) See decorated ../../tests/test.h:65. 79: decorated->endTextGeneration() ; See endTextGeneration ../../tests/test.h:47. See decorated ../../tests/test.h:65. See endTextGeneration ../../tests/test.h:76. 80: endDecorate() ; 81: mysum; See mysum ../../tests/test.h:20. 82: } 83: 84: // pure virtual functions 85: virtual void startDecorate() const = 0 ; 86: virtual void endDecorate() const = 0 ; 87: } ; 88: 89: #endif // _TEXTGEN_H 90: Next: , Previous: , Up: Examples [Contents][Index] ### 10.3 Line ranges This is an example that uses --line-range command line option on the input file shown in See Simple example: source-highlight -f texinfo -i test.java -n \ --line-range="12-18","29-34" This generates the following output 12: written by 13: Lorenzo Bettini 14: http://www.lorenzobettini.it 15: http://www.gnu.org/software/src-highlite 16: */ 17: 18: package hello; 29: * @author Lorenzo Bettini 30: * @version 2.0 31: */ /// class 32: public class Hello { 33: int foo = 1998 ; 34: int hex_foo = 0xCAFEBABE; Note that, although the specified line ranges span comment environments, the highlighting is respected: the starting of the comment is not printed, but the remaining parts of the comment are correctly highlighted as comment. Next: , Previous: , Up: Examples [Contents][Index] ### 10.4 Line ranges (with context) This is an example that uses the command line option --line-range together with the --range-context and --range-separator: source-highlight -f texinfo -i test.java -n \ --line-range="12-18","29-34" \ --range-context=2 \ --range-separator="{... not in range ...}" This generates the following output {... not in range ...} 10: or type source-highlight --help for the list of options 11: 12: written by 13: Lorenzo Bettini 14: http://www.lorenzobettini.it 15: http://www.gnu.org/software/src-highlite 16: */ 17: 18: package hello; 19: 20: import java.io.* ; {... not in range ...} 27: * TODO: nothing, just to show an highlighted TODO or FIXME 28: * 29: * @author Lorenzo Bettini 30: * @version 2.0 31: */ /// class 32: public class Hello { 33: int foo = 1998 ; 34: int hex_foo = 0xCAFEBABE; 35: boolean b = false; 36: Integer i = null ; {... not in range ...} Note the two additional 2 lines before and after the ranges (compare it with the output in Line ranges). Note that the (elements of the) context lines are not highlighted. Moreover, the range separator line "{... not in range ...}" is printed between ranges (the separator string is preformatted automatically, so, e.g., you don’t have to escape special output characters, such as the { } in texinfo output). Previous: , Up: Examples [Contents][Index] ### 10.5 Regex ranges Ranges can be expressed also using regular expressions, with the command line option --regex-range. In this case the beginning of the range will be detected by a line containing (in any point) a string matching the specified regular expression; the end will be detected by a line containing a string matching the same regular expression that started the range. This feature is very useful when we want to document some code (e.g., in this very manual) by showing only specific parts, that are delimited in a ad-hoc way in the source code (e.g., with specific comment patterns). For instance, the following output was produced, starting from the source file shown in See Simple example, by specifying: --regex-range="/// [[:alpha:]]+" Note that the lines containing /// class, which determine the range, are not shown in the output: 32: public class Hello { 33: int foo = 1998 ; 34: int hex_foo = 0xCAFEBABE; 35: boolean b = false; 36: Integer i = null ; 37: char c = '\'', d = 'n', e = '\\' ; 38: String xml = "<tag attr=\"value\">&auml;</tag>", foo2 = "\\" ; 39: 40: /* mymethod */ 41: public void mymethod(int i) { 42: // just a foo method 43: } 44: /* mymethod */ 45: 46: /* main */ 47: public static void main( String args[] ) { 48: // just some greetings ;-) /* 49: System.out.println( "Hello from java2html :-)" ) ; 50: System.out.println( "\tby Lorenzo Bettini" ) ; 51: System.out.println( "\thttp://www.lorenzobettini.it" ) ; 52: if (argc > 0) 53: String param = argc[0]; 54: //System.out.println( "bye bye... :-D" ) ; // see you soon 55: } 56: /* main */ 57: } Furthermore, the line numbers are consistent with the lines of the original file. If we want to output only what is included between /* main */, we specify (note that we must escape the special regular expression character *): --regex-range="/\* main \*/" and we get: 47: public static void main( String args[] ) { 48: // just some greetings ;-) /* 49: System.out.println( "Hello from java2html :-)" ) ; 50: System.out.println( "\tby Lorenzo Bettini" ) ; 51: System.out.println( "\thttp://www.lorenzobettini.it" ) ; 52: if (argc > 0) 53: String param = argc[0]; 54: //System.out.println( "bye bye... :-D" ) ; // see you soon 55: } If we want to show only the methods, which in the source file are delimited by comment lines containing the method’s name, we can specify: --regex-range="/\* [[:alpha:]]+ \*/" 41: public void mymethod(int i) { 42: // just a foo method 43: } 47: public static void main( String args[] ) { 48: // just some greetings ;-) /* 49: System.out.println( "Hello from java2html :-)" ) ; 50: System.out.println( "\tby Lorenzo Bettini" ) ; 51: System.out.println( "\thttp://www.lorenzobettini.it" ) ; 52: if (argc > 0) 53: String param = argc[0]; 54: //System.out.println( "bye bye... :-D" ) ; // see you soon 55: } In this case, we might have also specified: --regex-range="/\* main \*/","/\* mymethod \*/" since --regex-range accepts multiple regular expressions. IMPORTANT: the order of regular expression specification is crucial, since they are tested in the same order they are specified at the command line. Next: , Previous: , Up: Top [Contents][Index] ## 11 Reporting Bugs If you find a bug in source-highlight, please send electronic mail to bug-source-highlight at gnu dot org Include the version number, which you can find by running ‘source-highlight --version. Also include in your message the output that the program produced and the output you expected. Even better, please file a bug report at Savannah site: If you have other questions, comments or suggestions about source-highlight, contact the author via electronic mail (find the address at http://www.lorenzobettini.it). The author will try to help you out, although he may not have time to fix your problems. Next: , Previous: , Up: Top [Contents][Index] ## 12 Mailing Lists The following mailing lists are available: help-source-highlight at gnu dot org for generic discussions about the program and for asking for help about it (open mailing list), http://mail.gnu.org/mailman/listinfo/help-source-highlight info-source-highlight at gnu dot org for receiving information about new releases and features (read-only mailing list), http://mail.gnu.org/mailman/listinfo/info-source-highlight. If you want to subscribe to a mailing list just go to the URL and follow the instructions, or send me an e-mail and I’ll subscribe you. I’ll describe new features in new releases also in my blog, at this URL: Previous: , Up: Top [Contents][Index] ## Concept Index Jump to: "$   '   -     A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X Jump to: "   \$   '   -   `   A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X ## Short Table of Contents ### (1) Up to version 2.9, there were also the suffixes -doc and -css-doc, but this mechanism was quite confusing and complex; hopefully, this new one should be better. ### (2) Although this might have been achieved with previous version, it is an official supported feature since version 2.5. ### (3) Since version 3.1.2 of Source-highlight the CVS repository was dismissed in favor of Git (http://git-scm.com/). ### (4) http://www.gnu.org/software/autoconf ### (5) http://www.gnu.org/software/automake ### (6) http://www.gnu.org/software/libtool ### (7) http://www.gnu.org/software/gnulib ### (8) Since version 2.11, the configure script should be able to correctly find the boost regex library if it is in the compiler default path. ### (9) Command lines that are too long are split into multiple indented lines separated by a \. Of course these commands are to be given in one line only, anyway. ### (10) Command lines that are too long are split into multiple indented lines separated by a \. Of course these commands are to be given in one line only, anyway. ### (11) Before version 2.1, this file was called tags.j2h which used to be a very obscure name. I hope this name convention is a better one :-). ### (12) Since version 2.6. ### (13) Before version 2.1, this command line option was called --tags-file which used to be a very obscure name. I hope this name convention is a better one :-). ### (14) Since version 2.6. ### (15) Of course, if you use HTML and an external CSS file you will achieve the same result. ### (16) You can see these colors in HTML in the file colors.html. ### (17) Note that, since version 2.2, you must use double quotes. ### (18) Since version 2.6. ### (19) Since version 2.9. ### (20) This is the main difference introduced in version 2.0 with respect the previous version. ### (21) This is the main difference introduced in version 2.1 with respect the the previous version. ### (22) As explained before, originally Source-highlight was thought mainly for generating HTML output, this is why the term css is used for style sheets. ### (23) Padding character can be specified since version 2.8. ### (24) Since version 2.7. ### (25) Since version 3.1.2. ### (26) Since version 2.7. ### (27) This issue concerning Perl regular expression syntax was raised by Elias Pipping, and this also pushed me to deal with this more powerful syntax that permits using backreferences, for instance. Although we’re still far from highlighting Perl syntax completely (Perl), I definitely must thank Elias for his precious information about this matter :-) ### (28) As Ed Kelly correctly pointed out, C-style comments are NOT nested; it’s a big shame I’ve been using C++ and Java for years and have always thought they were nested :-)... Thus, in previous versions of source-highlight distributions, C-style comments were (uncorrectly) defined as nested. Thank you Ed, for your feedback! ### (29) Since version 2.8 ### (30) I’m grateful to Jurgen Hotzel for rising this issue about Lua comments; this led me to introduce dynamic backreferences. ### (31) At least, to the best of my knowledge :-) ### (32) The strategy used by source-highlight for matching regular expressions changed since version 2.11 (and in version 2.10 the strategy used was not completely conceptually correct and it had a lot of overhead). ### (33) according to the terminology of regular expressions. ### (34) http://www.boost.org/libs/regex/doc/syntax.html ### (35) the index only, without the escape character. ### (36) This expression was provided by John Maddock, the author of the Boost regex library, as a solution of a problem I posted on the boost list, http://thread.gmane.org/gmane.comp.lib.boost.devel/158237/focus=158276 ### (37) Since version 2.4. ### (38) Up to version 2.9 the output of --show-regex was a little bit more complex to read; hopefully this output is better. ### (39) Please note that this concept of state is different from the concept of “state” of an automaton. ### (40) As a future extension we might think of providing a way, in the language definition syntax, to define a state/environment that extends the outer contexts instead of overriding them. ### (41) This was not tested extensively and might not catch all the correct situations. ### (42) OK, there are no templates in C, and they are only in C++, but we think it should no harm when highlighting C files. ### (43) Before version 2.9, there was only cpp.lang which was used both for C and C++; however, this way, if you had a C program where you were using a C++ keyword as a variable name—which of course is correct in C—that variable was actually highlighted as a keyword and this was not correct. ### (44) Since version 2.6. ### (45) This is a sort of trick to insert spaces at the beginning of a line without using a tabular environment; without the leading \mbox{} these spaces would be ignored. This is the only way I found to achieve this, if you have suggestions, please let me know! ### (46) Since version 2.4. ### (47) Unless they are inside a <tt>...</tt>. ### (48) Up to version 2.9, there was only doctemplate and for --doc there was a separate .outlang file; I think the present solution is better and reduces the number of files. ### (49) Since version 2.6. ### (50) Although I haven’t tested it, I think this will work also for Doxygen comments. ### (51) This description is taken from the ctags man page
2015-07-28 22:04: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": 2, "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.43552443385124207, "perplexity": 6401.216786309081}, "config": {"markdown_headings": true, "markdown_code": false, "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-2015-32/segments/1438042982745.46/warc/CC-MAIN-20150728002302-00321-ip-10-236-191-2.ec2.internal.warc.gz"}
https://physics.stackexchange.com/questions/95355/commutator-not-transitive?noredirect=1
# Commutator not transitive I noticed the following: $$[L_{+},L^2]=0,\qquad [L_{+},L_3]\neq 0,\qquad [L^2,L_3]=0.$$ This would suggest, that $L^2,L_+$ have a common system of eigenfunctions, and so do $L^2,L_3$, but $L_+,L_3$ don't. How is that possible? Commutativity is not a transitive relation: If operator $A$ commutes with $B$ and $C$, $$AB=BA \quad\text{and}\quad AC=CA,$$ then there is no reason that $B$ and $C$ should commute. Example: Take $A=y$, $B=x$, and $C=p_x$. In particular, if commuting selfadjoint operators $A$ and $B$ have a common basis of orthonormal eigenvectors, and if commuting selfadjoint operators $A$ and $C$ have a common basis of orthonormal eigenvectors, then these two bases need not be the same if the spectrum of $A$ is degenerate. • Yes, that's what I noticed above. But the question is the following: There is the interpretation that they commute iff they have a common system of eigenfunctions. If you look at it from that perspective, then this should hold. So where does this reasoning lack? – Xin Wang Jan 26 '14 at 13:50 • The answer is that (in the mentioned examples) the set $\{A,B,C\}$ of all three operators don't have a common basis of orthonormal eigenvectors. Only a subset of two operators have in certain cases a common basis of orthonormal eigenvectors. – Qmechanic Jan 26 '14 at 13:53 • Another problem (in the mentioned example) is that $L_{+}$ is not a normal operator, so there doesn't exist an orthonormal basis of eigenvectors for $L_{+}$. – Qmechanic Jan 26 '14 at 14:17 • Yes, but the eigenvectors are not orthogonal. See also this and this Phys.SE posts. – Qmechanic Jan 26 '14 at 14:30 • Since (i) $L_{\pm}= L_x\pm i L_y$ and (ii) $L^2$, $L_x$, $L_y$ are all Hermitian, one may view the statement $[L^2,L_{+}]=0$ as equivalent to $[L^2,L_{-}]=0$, and, in turn, equivalent to the pair of statements about Hermitian operators: $[L^2,L_x]=0$ and $[L^2,L_y]=0$. The only caveat is that $L_x$ and $L_y$ do not commute! – Qmechanic Jan 26 '14 at 16:21 NOTE. Since $L_+$ is not normal (normal means $A^\dagger A = AA^\dagger$) it does not admit a basis of orthonormal eigenvectors. However your question can be safely restated replacing $L_+$ for $L_2$ and I will assume it henceforth. The most elementary case of this phenomenon is given by a triple of normal matrices in $\mathbb C^n$: $$cI,A,B$$ with $[A,B]\neq 0$ and where $c\in \mathbb C$ is an arbitrarily fixed number. $A$ has a common basis of eigenvectors with $cI$: Every basis of eigenvectors of $A$ is such basis. Similarly, every basis of eigenvectors of $B$ is also a basis of eigenvectors of $cI$. However, though it could happen for some vector, there cannot exist a whole basis of eigenvectors in common with $A$ and $B$, otherwise referring to that basis $A$ and $B$ would be in diagonal form and thus $[A,B]=0$, which is forbidden by hypotheses. All that is possible thanks to the fact that the eigenspaces of $cI$ are (maximally) degenerate. Two vectors $u$ and $v$ with the same eigenvalue ($c$) of respect to $cI$ remain eigenvectors of $cI$ with the same eigenvalue even if linearly composed: $au+bv$. Nevertheless if $u$ and $v$ are eigenvectors of $A$, in general $au+bu$ is not, but it could be an eigenvector of $B$ (remaining, as said, an eigenvector of $cI$) The situation is essentially the same when dealing with $L^2$ and $L_2,L_3$. The eigenspaces $\cal H_l$ of $L^2$ are degenerate and, in each eigenspace, $L^2$ is represented by $l(l+1)I$. Moreover, as $[L^2,L_i]=0$, each eigenspace $\cal H_l$ is invariant under the action of $L_i$. I mean $L_i({\cal H}_l)\subset \cal H_l$. Restricting to $\cal H_l$, we find the situation I outlined above: $L$ is represented by $cI$ and $L_2, L_3$ are represented by non commuting operators $A$ and $B$. • Nice answer. A few questions if you don't mind. You state that since the operator is not normal it can'tt have orthononormal basis of eigenvectors. One of the postulates of QM assumes that the observables are Hermitian and then from this we have a theorem which states that every Hermitian operator has a basis of orthonormal eigenvectors. But you are saying that the this is not enough? So does the postulate actually state that every observable operator is in fact normal (hence also Hermitian)? – Alex Sep 9 '16 at 10:44 • Also, why is it important in your answer to note that each eigenspace $\mathcal{H_l}$ is invariant under the action of $L_i$ as you stated "$L_i(\mathcal{H}) \subset \mathcal{H}$"? Thanks a lot. – Alex Sep 9 '16 at 10:44 • QM assumes that every observable is self-adjoint (not simply Hermitian) and thus it is also normal. In general, in non-finite dimensions, even normal operators may have no orthonormal basis of (proper) eigenvectors. What is true is that a normal operator has a spectral decomposition. However, at the beginning of my answer the point was another. If an operator is not normal, then it cannot have an orthonormal basis of eigenvectors just because otherwise it would be normal! Since $L_+$ is not normal, it cannot have an orthonormal basis of eigenvectors. – Valter Moretti Sep 9 '16 at 11:21 • Regarding your second question, the answer appears in my last sentence: Restricting to $\cal H_l$, we find the situation I outlined above: $L$ is represented by $cI$ and $L_2, L_3$ are represented by non commuting operators $A$ and $B$. If $\cal H_l$ were not invariant I would not be allowed to restrict the discussion to $\cal H_l$ and use the already discussed theory. – Valter Moretti Sep 9 '16 at 11:24 • Okay I see. You state " Moreover, as $[L_2,L_i]=0$, each eigenspace $\mathcal{H}_l$ is invariant under the action of Li". As I understand it, the commutativity $[L^2,L_i]=0$ implies there exists a common basis of orthonormal eigenvectors, not that every eigenbasis is shared. You assume that $\mathcal{H}_{l}$ is an eigenspace of operator $L^2$, why does it follow then that $\mathcal{H}_{l}$ is invariant under $L_{i}$, what if $\mathcal{H}_{l}$ is some eigenbasis which is not shared. – Alex Sep 9 '16 at 15:09
2019-08-20 01:57: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": 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.9401621222496033, "perplexity": 179.51771306242497}, "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-35/segments/1566027315174.57/warc/CC-MAIN-20190820003509-20190820025509-00199.warc.gz"}
https://optimization-online.org/2009/03/2246/
Asymptotic expansions for interior penalty solutions of control constrained linear-quadratic problems We consider a quadratic optimal control problem governed by a nonautonomous affine differential equation subject to nonnegativity control constraints. For a general class of interior penalty functions, we show how to compute the principal term of the pointwise expansion of the state and the adjoint state. Our main argument relies on the following fact: If the control of the initial problem satisfies strict complementarity conditions for its Hamiltonian except for a finite number of times, the estimates for the penalized optimal control problem can be derived from the estimations of a related stationary problem. Our results provide several types of efficiency measures of the penalization technique: error estimations of the control for $L^s$ norms ($s$ in $[1,+\infty]$), error estimations of the state and the adjoint state in Sobolev spaces $W^{1,s}$ ($s$ in $[1,+\infty)$) and also error estimates for the value function. For the $L^1$ norm and the logarithmic penalty, the optimal results are given. In this case we indeed establish that the penalized control and the value function errors are of order $O(\eps|\log\eps|)$. Citation Published as Rapport de Recherche INRIA RR 6863, March 2009.
2022-08-11 00:26:51
{"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.8656867742538452, "perplexity": 270.7979179324933}, "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-2022-33/segments/1659882571222.74/warc/CC-MAIN-20220810222056-20220811012056-00115.warc.gz"}
https://gabormakesgames.com/blog_vectors_interpolate.html
# Interpolating vectors Given two values $$x$$ and $$y$$, how can we interpolate between the two smoothly? That is, given $$0$$, we want to be at $$x$$, given $$1$$ we want to be at $$y$$ and given $$0.5$$ we want to be half-way between the two. This is the basic problem interpolation solves. Let's solve for the case of $$1$$, to get from $$x$$ to $$y$$, we need to add the difference between the two to $$x$$. That is, $$x + 1 * (y - x) = y$$. If we change the $$1$$ to a $$0$$, we get the original value, $$x$$. This means we can substitute the number for an interpolation value and get the final interpolation formula: $$f(x, y, t) = x + t * (y - x)$$ This works with real numbers, vectors, etc... ## Lerp The formula described above is the formula for linear interpolation. This formula can be used to interpolate between two vectors along the shortest line between the two. The formula remains unchanged: $$lerp(\vec{A}, \vec{B}, t) = \vec{A} + t * (\vec{B} - \vec{A})$$ Implementing this in code is trivial vec Lerp(vec from, vec to ,float t) { // return from + (to - from) * t; } ## Slerp Spherical Linear Interpolation or slerp interpolates between two vectors along the shortest arc between them, it goes from $$\vec{A}$$ to $$\vec{B}$$ on the path of a circle instead of a line. Like lerp, slerp takes two vectors plus some normalized interpolation value. Unlike lerp, the inputs to slerp should be normalized. To explore how a slerp works, assume we have three vectors $$\hat{A}$$, $$\hat{B}$$ and $$\hat{C}$$ where $$\hat{C} = slerp(\hat{A}, \hat{B}, 0.5)$$. The angle between $$\hat{A}$$ and $$\hat{B}$$ is $$\theta$$, the angle between $$\hat{A}$$ and $$\hat{C}$$ is $$t\theta$$, the angle between $$\hat{B}$$ and $$\hat{C}$$ is $$(1-t)\theta$$. This can be seen on the left side of the image below. If we draw $$\hat{A}$$ and $$\hat{B}$$ at an offset so they intersect $$\hat{C}$$, you will notice that $$\hat{C} = a\hat{A} + b\hat{B}$$ where $$a$$ and $$b$$ are currently unknown scalar values. This is shown on the right side of the image below. If we can find the values of $$a$$ and $$b$$ we can find $$\hat{C}$$ and wirte a formula for slerp. Let's focus on finding $$b$$ first. If we draw a line perpendicular to $$vec{A}$$ that touches $$\hat{B}$$, that gives us a right triangle. Using the Law of sines we know the length of this line is $$sin(\theta)$$. This is shown on the left side of the image below. We can draw a similar line from $$\hat{C}$$ to $$\hat{A}$$, who's length will be $$sin(t\theta)$$. This is shown in the middle of the image below, for conveniance, the line is also drawn closer to the left so it intercepts $$\hat{B}$$. These two triangles are similar, the similar triangles are drawn on the right side of the image below. Because $$\hat{B}$$ is a normal vector, we know that the hypothenuse of the larger triangle is $$1$$. This means we can set up the following equation: $$\frac{b}{sin(t\theta)} = \frac{1}{sin(\theta)}$$. Multiply both sides by $$sin(t\theta)$$ to find the final equation for $$b$$: $$b = \frac{sin(t\theta)}{sin(\theta)}$$ Finding the value of $$a$$ is done the same way, except we need to look at vectors perpendicular to $$\hat{B}$$ instead of $$\hat{A}$$. The left side of the image below shows a perpendicular line from $$\hat{B}$$ to $$\hat{A}$$, the length of this line is again $$sin(\theta)$$. The middle shows a perpendicular line from $$\hat{B}$$ to $$\hat{C}$$, the length of this line is $$sin((1-t)\theta)$$. The right side of the image below shows how these two lines make similar triangles. Similar to before, since $$\hat{A}$$ is a normal vector, we know the hypothenuse of the larger triangle is $$1$$. This means we can set up the following equation: $$\frac{a}{sin((1-t)\theta)} = \frac{1}{sin(\theta)}$$. Multiply both sides by $$sin((1-t)\theta)$$ to find the final equation of $$a$$: $$a = \frac{sin((1-t)\theta)}{sin(\theta)}$$ Knowing the formula for $$a$$ and $$b$$, we can now write the formula for $$slerp$$ as: $$slerp(\hat{A}, \hat{B}, t) = \frac{sin((1-t)\theta)}{sin(\theta)}\hat{A} + \frac{sin(t\theta)}{sin(\theta)}\hat{B}$$ Where $$\theta$$ is the angle between $$\hat{A}$$ and $$\hat{B}$$. Since both $$\hat{A}$$ and $$\hat{B}$$ are normal vectors, $$\theta$$ is defined as: $$\theta = cos^{-1}(\hat{A} \cdot \hat{B})$$ This slerp function can start giving strange results when trying to slerp with a very small t value. It's a good idea to fall back to nlerp when the value of t is small. Implementing this in code is trivial: vec Slerp(vec from, vec to, float t) { from = Normalized(from); to = Normalized(to); float theta = Angle(from, to); float sin_theta = sin(theta); float a = sin((1 - t) * theta) / sin_theta float b = sin(t * theta) / sin_theta; // return from * a + to * b; Scale(from, a), Scale(to, b) ); } ## Nlerp Slerp is desierable because it interpolates on an arc, which is a very natural looking interpolation. Operations like sin and acos make slerp a bit expensive. If both input vectors are normalized, a clever workaround is to normalize the result of a lerp. This method is called nlerp. The result of nlerp is still on an arc, but unlike slerp it does not have a constant velocity. The formula for nlerp is pretty simple, just normalizes the result of a lerp $$nlerp(\vec{A}, \vec{B}, t) = \frac{\vec{A} + t * (\vec{B} - \vec{A})}{\|\vec{A} + t * (\vec{B} - \vec{A})\|}$$ Implementing this in code is trivial vec Nlerp(vec from, vec to, float t) { vec lerp = Lerp(from, to, t); return Normalized(lerp); } In most cases, the lack of constant velocity will not be a problem. The interactive sample below demonstrates the difference between lerp, slerp and nlerp. Use the slider to interpolate between the two gray vectors. The gray vectors can be moved. Lerp is shown in red, Slerp is showed in green and Nlerp is showed in blue. Canvas support required
2022-09-27 03:47: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": 2, "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.7916591763496399, "perplexity": 265.03722443998714}, "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/1664030334987.39/warc/CC-MAIN-20220927033539-20220927063539-00095.warc.gz"}
https://tex.stackexchange.com/questions/491462/dif-command-doesnt-work-as-intended
# \dif command doesn't work as intended I've defined the command: \newcommand{\dif}[1][]{\mathrm{d} {#1}\,} since I use the notation: \int \dif{x} f(x) so that there's a space after every differential. However, it doesn't work as intended, since the space "\," is after the argument in the output, i.e. it works as if: \newcommand{\dif}[1][]{\mathrm{d} \,{#1}} Why is that? Is there any way to fix it? Thanks for any help. • Welcome to TeX.SX! Are you really using the dreaded notation with the differential before the function? Oh, no! ;-) Anyway, just remove the [] in the definition: you don't want an optional argument, but a mandatory one. – egreg May 18 at 11:43 • It worked perfectly! Thank you, so much! Unfortunately, the course I'm taking uses this notation so I've been using it too so as not to cause any confusions with my notes. – Roberto Gargiulo May 18 at 11:57 ## 1 Answer With \newcommand{\dif}[1][]{\mathrm{d} {#1}\,} LaTeX expects a call such as \dif[x] rather than \dif{x}, because of the second optional argument to \newcommand. However, you want a mandatory argument, so you should do \newcommand{\dif}[1]{\mathrm{d}{#1}\,} I suggest to define an auxiliary command, so you can define other commands in terms of it and get a uniform appearance. \documentclass{article} \usepackage{amsmath} \newcommand{\differentiald}{\mathrm{d}} % or just d \newcommand{\dif}[1]{\differentiald #1\,} \newcommand{\tder}[2]{\frac{\differentiald #1}{\differentiald #2}} \begin{document} $\int\dif{x} f(x) \qquad \int \dif{x}\dif{y} g(x,y) \qquad \tder{f}{x}$ \end{document} By changing the definition of \differentiald to \newcommand{\differentiald}{d}, you'd change all of your integrals and total derivatives to have an italic “d”. • Thank you for your answer! Your solution is even more complete than what I was initially looking for, since I can now use it even for differentials of functions by having auxiliary commands. – Roberto Gargiulo May 18 at 18:19
2019-07-22 21:22: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": 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.9392401576042175, "perplexity": 1809.6392880830272}, "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-30/segments/1563195528220.95/warc/CC-MAIN-20190722201122-20190722223122-00409.warc.gz"}
https://www.nature.com/articles/s41598-021-97532-9?error=cookies_not_supported&code=39b6024e-4245-4cbd-83d6-5cf5b0d9b9f1
Skip to main content Thank you for visiting nature.com. You are using a browser version with limited support for CSS. To obtain the best experience, we recommend you use a more up to date browser (or turn off compatibility mode in Internet Explorer). In the meantime, to ensure continued support, we are displaying the site without styles and JavaScript. # Sensitive detection of Plasmodium vivax malaria by the rotating-crystal magneto-optical method in Thailand ## Abstract The rotating-crystal magneto-optical detection (RMOD) method has been developed for the rapid and quantitative diagnosis of malaria and tested systematically on various malaria infection models. Very recently, an extended field trial in a high-transmission region of Papua New Guinea demonstrated its great potential for detecting malaria infections, in particular Plasmodium vivax. In the present small-scale field test, carried out in a low-transmission area of Thailand, RMOD confirmed malaria in all samples found to be infected with Plasmodium vivax by microscopy, our reference method. Moreover, the magneto-optical signal for this sample set was typically 1–3 orders of magnitude higher than the cut-off value of RMOD determined on uninfected samples. Based on the serial dilution of the original patient samples, we expect that the method can detect Plasmodium vivax malaria in blood samples with parasite densities as low as $$\sim$$5–10 parasites per microliter, a limit around the pyrogenic threshold of the infection. In addition, by investigating the correlation between the magnitude of the magneto-optical signal, the parasite density and the erythrocytic stage distribution, we estimate the relative hemozoin production rates of the ring and the trophozoite stages of in vivo Plasmodium vivax infections. ## Introduction Although humanity is continuously facing novel medical challenges, the management of preventable infectious diseases, which place heavy burden on tropical countries, has been a long-sought goal of the WHO1. One such disease is malaria, and by virtue of increased global and local efforts significant progress has been made towards its control worldwide. Since many countries are working towards the substantial reduction of disease burden, the development of sensitive, rapid, high-throughput and low-cost malaria diagnostic methods applicable for mass-screening is a pressing issue in tropical diseases research2. One promising diagnostic approach is the utilisation of the magnetic properties of Plasmodium-infected red blood cells, as it may enable the rapid and quantitative detection of the infection at low cost3,4,5,6,7. During the intraerythrocytic cycle the parasites break down the hemoglobin of their host cell and sequester its iron content into the inert, submicron-sized paramagnetic hemozoin crystals, which are distinguishing features of all blood-stage Plasmodium infections8,9. In the recent years, our research group has developed a new technique, the rotating-crystal magneto-optical diagnostic detection (RMOD) method, which is capable of the quantitative detection of malaria by measuring the amount of hemozoin produced during the course of the infection. The diagnostic capability of RMOD was tested in several steps using synthetic $$\beta$$-hematin crystals, P. falciparum cell cultures and mouse infections10,11,12,13. Furthermore, it proved to be an efficient tool for conducting rapid, yet sensitive drug susceptibility assays14. Recently, a detailed evaluation of RMOD has been carried out in an extended field trial in Papua New Guinea (PNG) involving almost one thousand malaria-suspected patients and multiple reference methods15. One important—and anticipated—observation of the study was that infections with different species led to different average blood hemozoin levels, resulting in a more sensitive detection of P. vivax than P. falciparum. However, the presence of stage V P. falciparum gametocytes increased the likelihood of identifying P. falciparum infections due to their high hemozoin content. As another key finding, the mean value and the standard deviation of the magneto-optical (MO) signal for samples which tested negative with all reference methods was significantly higher than expected from previous RMOD measurements on malaria-naïve blood samples11,12. Accordingly, we concluded that in high-transmission settings, such as the study site in PNG, elevated hemozoin levels are likely to be maintained in the peripheral blood of a large proportion of the general population, either from concurrent low-level infections that are otherwise undetectable, or from previously resolved infections16,17. In order to further investigate these observations and to assess the sensitivity of RMOD for diagnosing P. vivax infections in low-transmission settings, here we use the technique to detect malaria in samples confirmed to be P. vivax-positive by microscopy from Thailand, a country with overall low malaria endemicity18,19. In addition to testing the sensitivity of the method, we evaluate the correlation between the magnitude of the MO signal and the parasite stage distributions of the samples. The potential of the magneto-optical approach for diagnosing malaria has also been demonstrated in a recent field test by another hemozoin-based tool, Gazelle, which showed a sensitivity of $$96.2\%$$ for the detection of P.vivax infections20. The main difference between RMOD and Gazelle is that the former detects the periodic modulation of light transmission induced by the hemozoin crystals co-rotating with a rotating magnetic field, while the latter measures light transmission in stationary states with and without a static magnetic field. In spite of this technical difference, the physical principle of detection is common. Thus, the magneto-optical quantification of hemozoin should support not only a qualitative, but a quantitative diagnosis in both cases. While this capability has not been investigated for Gazelle, it is an important objective of the present study. ## Results ### The sensitivity of RMOD in detecting P. vivax infections The parasite densities of the original 35 patient samples ranged from $$\rm{34\, {\mu l}^{-1}}$$ to $$\rm {{5142}\,{{\mu l}^{-1}}}$$ with a median of $$\rm{{875}\,{{\mu l}^{-1}}}$$. As seen in Fig. 1A, this range was well covered by the samples, though their parasite density distribution was not uniform. Besides the overall parasite density, the erythrocytic stage distribution was also determined by an expert microscopist, and the parasites were classified as rings, trophozoites, schizonts, male and female gametocytes. The latter three forms contributed less than 10% to the overall parasite density in all samples with one exception, in which their proportion reached 35%. The sequestration of schizonts is a well-known phenomenon in P. falciparum infections, but the statistics of our P. vivax samples suggests that it also occurs for P. vivax21. Accordingly, the blood smears exhibited mostly rings and trophozoites, but their relative ratios varied in the sample population. A large fraction of samples (n=27) showed a relatively synchronous character and contained either predominantly $$(\ge 70\%)$$ rings or trophozoites as seen in Fig. 1B. In contrast to the dominance of ring-stage parasites in the peripheral circulation of P. falciparum infections, in the case of these P. vivax-positive samples more than 30% of the samples showed no ring forms, and 88% contained trophozoites in more than 10%. As a first step, the level of the weak residual MO signal, that is present even in samples of malaria-naïve individuals, was measured on a pool of uninfected samples in order to establish a threshold that separates malaria-positive and negative RMOD incidences. Measurements on fourteen uninfected samples obtained from malaria-naïve individuals in Thailand, each measured in duplicates, yielded an average residual MO value of $$\rm{(0.50 \pm 0.22) \, {mV/V}}$$ as presented in Fig. 2A. The MO signal level that separates malaria-positive and -negative incidences, i.e., the cut-off level, was determined as the mean plus two times the standard deviation of these residual values, assuming that the MO values of uninfected samples are normally distributed random variables. This led to a cut-off level of 0.94 mV/V as indicated by the horizontal black dotted line in Fig. 2B and C. As displayed in Fig. 2B, all the P. vivax-infected blood samples tested above the cut-off, yielding a 100% sensitivity on this sample set. Moreover, for more than 90% of the samples the MO values are at least one order of magnitude larger than the cut-off, implying that the method can detect lower parasite densities. To model such cases, we chose ten of the original blood samples and prepared dilution series from them using uninfected whole blood as dilution medium. The parasite densities of the original ten samples change between $$\rm{{34}\,{{\mu l}^{-1}}}$$ and $$\rm{{4980}\,{{\mu l}^{-1}}}$$, while the parasite densities of the most diluted samples cover the range of $$0.0003-\rm{{9}\,{{\mu l}^{-1}}}$$. The MO values of the diluted samples prepared from the same infected specimen (identically coloured circles in Fig. 2B) decrease linearly with increasing dilution over several orders of magnitude as their parasite densities decrease proportionally with the dilution. However, the MO values of highly diluted samples with very low parasite densities $$\rm{(<{1}\,{{\mu l}^{-1}})}$$ are independent of the nominal parasite load. These residual MO values are scattered around the mean residual value obtained for the uninfected controls, below the cut-off level defined previously. This further supports that this residual MO signal is unrelated to parasites. Accordingly, the limit of detection in terms of parasite density is defined as the average parasite density for samples with MO values near the cut-off, i.e., in the range of $$\rm{0.94 \pm {0.08}\,{mV/V}}$$. This estimate leads to a detection limit of approx. $$\rm{{5}\,{{\mu l}^{-1}} \text { (range: } 0.2- {12 \ }{{\mu l}^{-1}})}$$ as indicated by the black arrow (line segment) in Fig. 2B. For comparison, this sensitivity threshold is somewhat better than the threshold reported in the recent field test of the Gazelle device, where the parasite density of false negative cases was reported to range from 18 to $$\rm{{174}\,{{\mu l}^{-1}}}$$, when optical microscopy was used as a reference20. ### The correlation between the MO values, the parasite density and the stage distribution As observed in Fig. 2, the relationship between the parasite densities and the corresponding MO values is linear (Spearman Rank: $$R \ge 0.95, p<0.0001$$) for samples obtained by serial dilution as long as their MO values are above the cut-off level. However, the correlation between the MO values and parasite densities for the original (undiluted) samples is $$R=0.66 \text{ (Spearman rank, } \rm{95\%\text{-}CI: 0.40 \, to \, 0.81)}$$ indicating only a moderate correlation. This scattering of the MO values for samples with nearly the same parasitemia naturally arises, at least in part, from the fact that RMOD quantifies the amount of hemozoin in blood, which depends not only on the overall parasite density, but also on the stage distribution of the circulating parasites and the clearance rate of hemozoin from the circulation. This scattering of the MO values due to the listed factors also explains the relatively large error of the detection limit specified above. While the MO signal shows only a moderate correlation with the parasite density, it correlates better with the estimated hemozoin content (HZ), which is a parameter calculated by assuming different hemozoin production rates of the different erythrocytic stages. When we use a subset of samples with clear dominance of rings and trophozoites, i.e., that contain schizonts and gametocytes in less than $$3\%$$, the hemozoin content is well approximated by $$HZ = 1 \cdot Ri + \alpha \cdot T$$, where $$Ri \text { and } T$$ denote the density of rings and trophozoites, respectively, and $$\alpha$$ is the relative hemozoin contribution of trophozoites compared to rings. (Please note that HZ parameter is a weighted parasite density, which is not equal to the actual hemozoin concentration, but is linearly proportional to it.) As shown in Fig. 3A, the Spearman correlation coefficient between the MO values and the corresponding HZ values reaches its maximum, $$R=0.9$$, at $$\alpha = 4.5\pm 0.3$$. Although the assessment of the relative production rate for schizonts and gametocytes is less accurate due to their rare occurrence and the limited statistical sample size, their contribution is estimated to be approx. 12–20 times higher than the hemozoin content of rings. As presented in Fig. 3B, for the full sample set the best Spearman correlation, $$\rm{R=0.75 \ {(95\%\text{-}CI: 0.55 \, to \, 0.87})}$$, was achieved with the following relative hemozoin contributions of the different stages: $$HZ = 1 \cdot Ri + 4.5 \cdot T + 17 \cdot (S+G)$$, where S and G denote the density of schizonts and gametocytes in the samples, respectively. ## Discussion The RMOD was able to classify all P. vivax-infected samples as malaria-positive with MO values typically 1–3 orders of magnitude higher than the cut-off level determined using samples of malaria-naïve volunteers. Furthermore, by preparing serial dilutions from the original patient samples, we found that parasite densities as low as a few parasites per a microliter of blood are still detectable by RMOD. These results indicate that the estimated limit of detection of RMOD is poorer than that of the most sensitive molecular diagnostic tools such as real-time PCR, PCR and loop mediated isothermal amplification—all of which show a detection limit in the range of $$\rm{\le 1-{10}\,{{\mu l}}^{-1}}$$, but dependent on the blood volume subjected to the assay22. However, the limit of detection for P. vivax found in this study for RMOD competes with that of the current clinical diagnostic tools, i.e., light microscopy with a limit of detection of $$\rm{\sim 50-{500}\,{{\mu l}}^{-1}}$$ and antigen-based rapid diagnostic tests with a limit of detection of $$\rm{\sim {200}\,{{\mu l}}^{-1}}$$22. It has to be noted, however, that the limit of detection for RMOD could only be determined on serial dilutions of certain infected samples in lack of original samples with very low parasitemias, and the number of samples used in the current study was limited. In our previously conducted large-scale field trial in Papua New Guinea, where expert light microscopy was used as the main reference method, the median MO value of the samples obtained from suspected patients whose light microscopy results were negative, was found to be $$\rm{{1.68}\,{mV/V} \text { (IQR: }1.06-2.89 \, mV/V)}$$)15. This value is significantly higher than the mean MO value of the control samples in the current Thai study: $$\rm{{0.55}\,{mV/V} \text { (IQR: }0.36-0.89 \, mV/V)}$$). The most plausible hypothesis to explain this observation is that a considerable portion of the patients at PNG, a high-transmission location, has residual hemozoin in the peripheral blood either due to low-density asymptomatic infections, or due to hemozoin crystals remaining in the circulation after recently treated or cleared infections. This factor increased the MO cut-off level in the PNG study and, thus, seemingly compromised the diagnostic performance. To further elaborate on this, we make a direct comparison between the field samples from Thailand and PNG in Fig. 2C where we present the MO values for all light microscopy-positive P. vivax samples collected in PNG (data reproduced from15). This comparison reveals that the Thai and PNG data sets follow the same trend and the magnitude of the MO values in the two studies spans the same range. Most importantly, for 98% of the samples found P. vivax-positive in the PNG study the MO values are located above 0.94 mV/V, the cut-off level determined in the current study. This supports the assumption that a considerable fraction of false-positive MO detections in the PNG study are due to the high residual hemozoin level present in the population at high transmission settings. Whether these are ongoing asymptomatic infections or recently resolved ones is yet unclear. In a recent study Kho and co-workers found large biomass of intact asexual-stage malaria parasites in the spleen of asymptomatic and microscopy-negative malaria patients23. If some of the hemozoin produced by these otherwise undetected parasites can re-enter the peripheral circulation, it could be the source of the unexpectedly high MO signals in some of the microscopy-negative cases in our PNG study. However, to confirm this hypothesis further large-scale studies are crucial both in high- and low-transmission and/or elimination settings. Accordingly, for RMOD or any other hemozoin-based malaria detection method, the final field of application, e.g., as an in-field diagnostic device, epidemiological surveillance tool, can only be determined after elucidating the former issue. From a technological point of view, they have the benefits of requiring only minimal sample preparation, practically no expertise for operation and have the potential to be realised in a cost-efficient, field-applicable format. On the other hand, whether RMOD operation can be extended to facilitate species-specific diagnosis at least on the level of the current rapid diagnostic tests, is still the subject of our investigations. Furthermore, for its applicability in epidemiological surveillance studies, as a pre-screening tool for example, an increase in throughput of the current design is needed. RMOD quantifies the concentration of hemozoin in the peripheral blood which can be present within the parasites, erythrocytes or leukocytes at the time of sampling. Since a coarse categorisation of the erythrocytic stages was carried out and the densities of the different stages were determined by expert microscopy, the hemozoin production rates of the different stages could be estimated based on the MO values of the samples. We found that trophozoites in these in vivo P. vivax samples contain approx. 4.5 times more hemozoin than rings, while older stages (schizonts and gametocytes) contain 12–20 times larger amounts than rings. These values are comparable to the relative hemozoin production rates of rings, trophozoites and schizonts reported previously for P. falciparum cell cultures14,24,25. From this we conclude that the actual hemozoin content in peripheral blood primarily reflects the momentary hemozoin production rate, i.e., a dynamic equilibrium is maintained between hemozoin production and clearance, as also observed in rodent infections12,13. However, since RMOD could also confirm the infection in samples containing exclusively ring stages, whose hemozoin content is much lower than the hemozoin content of trophozoites and schizonts, a non-negligible hemozoin accumulation also has to occur in the peripheral blood during acute infections. Likely this is the reason why P. falciparum infections—which exhibit primarily very young stages in the circulation—could be diagnosed by RMOD in PNG as well, however with a lower sensitivity than P. vivax15. The most important requirements towards a novel method for in-field malaria diagnostics are the ease of use and high sensitivity – ideally even the detection of asymptomatic infections. However, besides the highly reliable differentiation between positive and negative cases, the quantitative assessment of disease severity might provide crucial information in certain clinical situations. In clinical practice today the parasite density is used as the primary characteristics of acute malaria infections, however, the proportion of hemozoin-containing white blood cells has also been investigated as a potential indicator of prognosis17,26,27,28. The relation between the intraleukocytic hemozoin content and disease severity reported in former studies implies that the overall hemozoin concentration in the peripheral circulation may also serve as a useful clinical indicator17,26. The quantitative nature of RMOD, realising a hemozoin-based diagnosis, can also be highly advantageous in this respect. ## Materials and methods ### Sample collection and characterisation in Thailand Sample collection was carried out in two field-clinics in the Kanchanaburi and Ratchaburi provinces of western Thailand from May 2014 to June 2015 (n =33), while two additional infected samples were obtained in July, 2016. Patients attending to the clinics exhibiting symptoms consistent with malaria were tested for the infection using an SD Bioline Malaria Ag P.f/Pan rapid diagnosis test kit (Standard Diagnostics Inc.) and/or via light microscopic (LM) examination of thick blood smears. Once a positive diagnosis was established, a blood sample of approximately 250 $$\rm{{\mu l}}$$ was collected into an EDTA-containing Microtainer $$\circledR$$(Becton Dickinson and Company) via venipuncture from consented volunteers. The blood aliquots were subsequently frozen and transported over dry ice to the Mahidol Vivax Research Unit (MVRU) of Mahidol University, Bangkok, where they were stored at $$-70{^\circ }$$ until the completion of the RMOD measurements. Approximately 40 uninfected blood samples were collected from two consented, malaria-naïve colleagues on-site at various time points over the study period for protocol optimisation and for the establishment of an uninfected baseline signal for the RMOD. These control samples were collected, frozen and stored the same way as the infected samples. Seven samples from both individuals were utilised to determine the uninfected baseline signal and the cut-off level of the study (see Fig. 2A) while the rest of the samples were used to prepare dilution series from ten infected samples (see Fig. 2B). As a reference method for the RMOD study, a good-quality, Giemsa-stained thick blood smear was prepared from all P. vivax-infected samples on site, and analysed later by an expert microscopist at the central laboratory of MVRU, Bangkok. The morphological analysis of the parasites confirmed that all samples were infected exclusively with P. vivax. The thick blood smears were prepared using exactly one microliter of blood, thus by counting all the parasites in the total area of the smears ($$\times 1000$$ magnification) the parasite density was therefore determined directly. Furthermore, the parasites detected in the smears were assigned to stage groups (rings, trophozoites, schizonts, male gametocytes and female gametocytes) according to their morphology. ### Sample collection and characterisation in PNG The sample collection was carried out at two health facilities in Madang, located on the north coast of Papua New Guinea where P. falciparum and P. vivax are highly endemic29. During the period of November, 2017-July, 2018 n = 945 blood samples were collected from suspected malaria patients and analysed by RMOD and multiple control methods, out of which n = 104 were found to be P. vivax monoinfections using LM as reference. Two blood slides for LM were prepared at enrolment and the LM analysis was carried out by the PNG Institute of Medical Research microscopy unit consisting of experienced, WHO-certified microscopists. Thick blood smears were examined independently by two microscopists, for 200 thick-film fields ($$\times 1000$$ magnification) before being declared Plasmodium-negative. Parasite density was calculated from the number of parasites per 200-500 leukocytes (depending on parasite density) and an assumed leukocyte density of $$\rm{{8000}\,{{\mu l}}^{-1}}$$30. Slides were scored as LM-positive for an individual Plasmodium species if the species was detected independently by at least two microscopists. ### Ethics statements The study conducted in Thailand received ethical clearance from the Ethics Committee at the Faculty of Tropical Medicine, Mahidol University (MUTM 2013-027-01). The study was clearly explained to all volunteers and informed consent was obtained from all participants in the study. The study conducted in Papua New Guinea received ethical clearance by the PNG Institute of Medical Research (PNGIMR) Institutional Review Board and the PNG Medical Research Advisory Committee (MRAC, #16.45). All methods were carried out in accordance with the relevant guidelines and regulations of the named institutes. ### Magneto-optical measurements The concept of the rotating-crystal magneto-optical setup and the underlying physical principles of hemozoin detection are described in detail in our former studies10,15,31. Briefly, the liquid sample containing the elongated paramagnetic hemozoin crystals is inserted into the centre of a ring-shaped assembly of permanent magnets, which creates a strong uniform magnetic field at the sample position. When the magnetic ring is rotated, the crystals follow this rotation which modulates the intensity of the light passing through the sample. The modulated intensity divided by the average intensity, which has been shown to be linearly proportional to the crystal concentration, corresponds to the measure MO values’ displayed in the corresponding figures in mV/V units10. For the RMOD analysis in Thailand, the frozen blood samples were thawed on room temperature, mixed thoroughly and $$\rm{{35}\,{{\mu l}}}$$ of the partially lysed blood was mixed with $$\rm{{315}\,{{\mu l}}}$$ of lysis solution (13 mM of NaOH and 0.03% (v/v) of Triton X-100 in distilled water) and allowed to stand for approximately 5 minutes to ensure complete lysis and homogenisation. Thereafter, $$\rm{{280}\,{{\mu l}}}$$ of the lysate, hereinafter referred to as optical sample, was transferred into the optical sample holders and the RMOD measurements were performed without further delay. Optical samples for RMOD measurements were prepared in duplicate per blood sample. For the estimation of the RMOD sensitivity threshold two- or four-fold dilution series were prepared from ten infected samples. The infected samples were thawed and diluted with thawed aliquots of malaria-naïve blood samples frozen and stored together with the infected specimens. After the thorough mixing of the two components the final optical samples for the RMOD measurements were prepared as described above. The magneto-optical measurements in Thailand and PNG were carried out with two RMOD devices that were technical replicates using the same measurement protocols. The only differences between the two RMOD experiment series were that in PNG the samples were freshly hemolysed and measured in triplicates per blood sample, while in Thailand the whole blood samples were frozen and stored until the completion of the RMOD measurements and they were measured in duplicates per blood sample. ## References 1. 1. World Health Organization. Global Technical Strategy for Malaria 2016–2030 (World Health Organization, 2015). 2. 2. Feachem, R. G., Phillips, A. A., Targett, G. A. & Snow, R. W. Call to action: priorities for malaria elimination. Lancet 376, 1517–1521 (2010). 3. 3. Nalbandian, R. M. et al. A molecularbased magnet test for malaria. Am. J. Clin. Pathol. 103, 57–64 (1995). 4. 4. Zimmerman, P. A., Thomson, J. M., Fujioka, H., Collins, W. E. & Zborowski, M. Diagnosis of malaria by magnetic deposition microscopy. Am. J. Trop. Med. Hyg. 74, 568–572 (2006). 5. 5. Newman, D. M. et al. A magnetooptic route toward the in vivo diagnosis of malaria: preliminary results and preclinical trial data. Biophys. J . 95, 994–1000 (2008). 6. 6. Newman, D. M., Matelon, R. J., Wears, M. L. & Savage, L. B. The in vivo diagnosis of malaria: feasibility study into a magneto-optic fingertip probe. IEEE J. Sel. Top. Quantum Electron. 16, 573–580 (2010). 7. 7. Yuen, C. & Liu, Q. Magnetic field enriched surface enhanced resonance Raman spectroscopy for early malaria diagnosis. J. Biomed. Opt. 17, 017005 (2012). 8. 8. Egan, T. J. Physico-chemical aspects of hemozoin (malaria pigment) structure and formation. J. Inorg. Biochem. 91, 19–26 (2002). 9. 9. Bohle, D. S., Dinnebier, R. E., Madsen, S. K. & Stephens, P. W. Characterization of the products of the heme detoxification pathway in malarial late trophozoites by X-ray diffraction. J. Biol. Chem. 272, 713–6 (1997). 10. 10. Butykai, A. et al. Malaria pigment crystals as magnetic micro-rotors: key for high-sensitivity diagnosis. Sci. Rep. 3, 1431 (2013). 11. 11. Orban, A. et al. Evaluation of a novel magneto-optical method for the detection of malaria parasites. PLoS ONE 9, e96981 (2014). 12. 12. Orban, A. et al. Efficient monitoring of the blood-stage infection in a malaria rodent model by the rotating-crystal magneto-optical method. Sci. Rep. 6, 23218 (2016). 13. 13. Pukancsik, M. et al. Highly sensitive and rapid characterization of the development of synchronized blood stage malaria parasites via magneto-optical hemozoin quantification. Biomolecules9, (2019). 14. 14. Molnár, P. et al. Rapid and quantitative antimalarial drug efficacy testing via the magneto-optical detection of hemozoin. Sci. Rep. 10, 14025 (2020). 15. 15. Arndt, L., Koleala, T., Orbán, Á., Ibam, C., et al. Magneto-optical diagnosis of symptomatic malaria in Papua New Guinea. Nature Communications 12, 969. ISSN: 2041-1723 (2021). 16. 16. Day, N. P. et al. Clearance kinetics of parasites and pigment-containing leukocytes in severe malaria. Blood 88, 4694–4700 (1996). 17. 17. Phu, N. H., Day, N., Diep, P. T., Ferguson, D. J. & White, N. J. Intraleucocytic malaria pigment and prognosis in severe malaria. Trans. R. Soc. Trop. Med. Hyg. 89, 200–204 (1995). 18. 18. Sriwichai, P. et al. Imported Plasmodium falciparum and locally transmitted Plasmodium vivax: cross-border malaria transmission scenario in northwestern Thailand. Malar. J. 16, 258 (2017). 19. 19. Nguitragool, W. et al. Highly heterogeneous residual malaria risk in western Thailand. Int. J. Parasitol. 49, 455–462 (2019). 20. 20. De Melo, G. C., Netto, R. L. A., Mwangi, V. I., Salazar, Y. E. A. R., et al. Performance of a sensitive haemozoin-based malaria diagnostic test validated for vivax malaria diagnosis in Brazilian Amazon. Malaria Journal 20, 146. ISSN: 1475-2875 (2021). 21. 21. Lopes, S. C. P., Albrecht, L., Carvalho, B. O., Siqueira, A. M., et al. Paucity of plasmodium vivax mature schizonts in peripheral blood is associated with their increased cytoadhesive potential. https://doi.org/10.1093/infdis/jiu018. https://academic.oup.com/jid/article/209/9/1403/886874 (2014). 22. 22. Britton, S., Cheng, Q., McCarthy, J. S. Novel molecular diagnostic tools for malaria elimination: A review of options from the point of view of highthroughput and applicability in resource limited settings. Malaria Journal 15, 1–8. ISSN: 14752875 (2016). 23. 23. Kho, S., Qotrunnada, L., Leonardo, L., Andries, B., et al. Evaluation of splenic accumulation and colocalization of immature reticulocytes and Plasmodium vivax in asymptomatic malaria: a prospective human splenectomy study. PLoS Medicine 18, e1003632. ISSN: 15491676 (2021). 24. 24. Moore, L. R. et al. Hemoglobin degradation in malaria-infected erythrocytes determined from live cell magnetophoresis. FASEB J. 20, 747–749 (2006). 25. 25. Hanssen, E. et al. Soft X-ray microscopy analysis of cell volume and hemoglobin content in erythrocytes infected with asexual and sexual stages of Plasmodium falciparum. J. Struct. Biol. 177, 224–232 (2012). 26. 26. Lyke, K. E. et al. Association of intraleukocytic Plasmodium falciparum malaria pigment with disease severity, clinical manifestations, and prognosis in severe malaria. Am. J. Trop. Med. Hyg. 69, 253–259 (2003). 27. 27. Hänscheid, T. et al. Full blood count and haemozoin-containing leukocytes in children with malaria: diagnostic value and association with disease severity. Malar. J. 7, 109 (2008). 28. 28. Kremsner, P. G. et al. Prognostic value of circulating pigmented cells in African children with malaria. J. Infect. Dis. 199, 142–150 (2009). 29. 29. Müller, I., Bockarie, M., Alpers, M., Smith, T. The epidemiology of malaria in Papua New Guinea. Trends Parasitol. 19, 253-259. ISSN: 1471-4922 (2003). 30. 30. Laman, M. et al. Comparison of an assumed versus measured leucocyte count in parasite density calculations in Papua New Guinean children with uncomplicated malaria. Malar. J. 13, 145 (2014). 31. 31. Orban, A. The development of a novel magneto-optical device for the diagnosis of malaria PhD thesis (Budapesti Mûszaki és Gazdaságtudományi Egyetem, 2020). Download references ## Acknowledgements The authors would like to sincerely thank all study participants. We thank all involved health facility staff for their collaboration in these research studies. R.J.L is the recipient of an Australian National Health and Medical Research Council (NHMRC) Emerging Leadership Fellowship (GNT1173210). S.K. is a recipients of an NHMRC Career Development Fellowship (GNT1141441). A.B. and A.O. were supported by the BME-Nanotechnology and Materials Science FIKP grant of EMMI (BME FIKP-NAT) and NRDI Fund (TKP2020 IES, Grant No. BME-IE-NAT), Hungary. ## Author information Authors ### Contributions A.B., I. K. and A.O. developed the RMOD setup. R.J.L. and P.S. collected the patient samples in Thailand. N.M. carried out the light microscopy analysis of the Thai samples. S.K., W.N., I.M. and J.S coordinated the field studies in Thailand and PNG. A.O. carried out the RMOD measurements in Thailand. I.K., S.K. and A.O. analysed the data and wrote the manuscript. I.K. designed and supervised the project. All authors contributed to the discussion of the results. ### Corresponding author Correspondence to Ágnes Orbán. ## Ethics declarations ### Competing interests The authors declare no competing interests. ### Dual publication statement A portion of data originating from one of our former studies is included in the current manuscript for comparison with our new, previously unpublished results. Specifically, parasite density and magneto-optical values of Plasmodium vivax-infected samples collected in Papua New Guinea, which have been presented previously in Ref.15. The origin of the data is clearly indicated in the legend of Fig. 3 and throughout the manuscript. ## Additional information ### Publisher's note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations. ## Rights and permissions Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/. Reprints and Permissions ## About this article ### Cite this article Orbán, Á., Longley, R.J., Sripoorote, P. et al. Sensitive detection of Plasmodium vivax malaria by the rotating-crystal magneto-optical method in Thailand. Sci Rep 11, 18547 (2021). https://doi.org/10.1038/s41598-021-97532-9 Download citation • Received: • Accepted: • Published: ## Comments By submitting a comment you agree to abide by our Terms and Community Guidelines. If you find something abusive or that does not comply with our terms or guidelines please flag it as inappropriate. ## Search ### Quick links Sign up for the Nature Briefing newsletter — what matters in science, free to your inbox daily. Get the most important science stories of the day, free in your inbox. Sign up for Nature Briefing
2021-10-28 03:16: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": 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.5667198300361633, "perplexity": 4959.812495227822}, "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-43/segments/1634323588246.79/warc/CC-MAIN-20211028003812-20211028033812-00363.warc.gz"}
https://rafraichisso.ir/2020/08/26/pwc-75
# Rafraîchissoir By Shahed Nooshmand # The Weekly Challenge: week 75 Challenge, indeed. You are given a set of coins @C, assuming you have infinite amount of each coin in the set. Write a script to find how many ways you make sum $S using the coins from the set @C. This is a popular counting problem and has a recursive solution: #!/usr/bin/env raku my$S = 6; my @C = 1, 2, 4; say (@C Zxx @$_).map: |* for change$S, @C; sub change($total, @coins is copy) { my$coin = @coins.shift; my $max-count =$total ÷ $coin; return$total %% $coin ??$max-count !! [] if @coins == 0; my @solutions = []; for 0..$max-count ->$count { @solutions.push: [$count, |$_] for change $total −$count × $coin, @coins } return @solutions; } The change subroutine tries all probable counts associated with the first coin, and in each iteration calls itself with the remaining coins and the remaining total. The recursion goes on until only one coin remains, in which case that coin either has one solution for the given total, or it doesn’t have a solution at all. The solutions are actually lists of the number of each coin, in order. So if one solution is (2 0 1), it means there are two of the first coin and one of the third coin. Since we want to show each and every coin, for each solution, we multiply each kind of coin by its count to show it in volume. Running the script we get: (2 4) (2 2 2) (1 1 4) (1 1 2 2) (1 1 1 1 2) (1 1 1 1 1 1) Which is correct. ## Task #2 You are given an array of positive numbers @A. Write a script to find the largest rectangle histogram created by the given array. BONUS: Try to print the histogram as shown in the example, if possible. I won’t paste the example here, because this already is very long: #!/usr/bin/env raku my @A = 2, 1, 4, 5, 3, 7; my$max-area = 0; my @rect-indices; my $rect-height; exit if @A == 0; for 1..@A ->$length { my @indices = |(0..(@A − $length) Z.. ($length − 1)..^@A).max: { @A[|$_].min } my$height = @A[@indices].min; my $area =$length × $height; if$area > $max-area {$max-area = $area;$rect-height = $height; @rect-indices = @indices; } } print “$max-area\n\n”; ## Bonus ## for @A.max...1 -> $height { print$height; for ^@A -> $index { print “\t”; my$number = @A[$index]; if$number ≥ $height { ## Extra bonus ## if$index ∈ @rect-indices and $height ≤$rect-height { print “●” } else { print “○” } } } print “\n”; } print “\t” ~ @A.join(“\t”); Let’s break it down. We check @A == 1 in case some wiseass sets @A to an empty array. Then, we change the length — or width, depending on your point of view — of the rectangle we’re trying to make. For each length, we want that many consecutive elements of @A, such that the smallest value among these elements is still large enough to make a rectangle of the given length with maximum area. After we’re done checking each length, we have $max-area which is the answer, @rect-indices which is the list of consecutive indices chosen from @A and $rect-height which is the height of the rectangle (obviously). For the bonus, we just have to go through all height from the largest element in @A down to 1, and print something if we must. I took the liberty of giving myself Extra Bonus for using black and white circles to make the rectangle stand out. In the end we print the numbers in @A and the histogram is complete. Here’s what the script prints: 12 7 ○ 6 ○ 5 ○ ○ 4 ○ ○ ○ 3 ● ● ● ● 2 ○ ● ● ● ● 1 ○ ○ ● ● ● ● 2 1 4 5 3 7 That’s it.
2020-09-24 01:16: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": 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.5538302063941956, "perplexity": 8907.575961921424}, "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/1600400213006.47/warc/CC-MAIN-20200924002749-20200924032749-00208.warc.gz"}
https://tex.stackexchange.com/questions/391759/can-i-have-some-help-setting-up-my-document-to-meet-the-requirements-of-my-assig/391760
# Can I have some help setting up my document to meet the requirements of my Assignment? • use font type Arial, font size 10 (minimum) • line spacing should be single or no greater than 1.25cm • margins should be set at 2.3cm • all pages should be numbered (bottom footer right hand side) and include your student number (top header, right hand side) • include a title page. This should include your name, student number and tutor’s name. The assignment was clearly intended to be written in word, but I've written so much LaTeX at this point, that I feel more comfortable writing it. Does LaTeX even support Arial as a font? lol • Welcome! What have you tried? If you are so familiar with LaTeX, you don't want to use Word, you presumably know enough to make a start and provide a minimal example. Is the title page meant to be numbered? – cfr Sep 17 '17 at 3:07 • Please read the notes when adding tags. format-files are surely not relevant here. – cfr Sep 17 '17 at 3:08 • "... but I've written so much LaTeX at this point, that I feel more comfortable writing it." And you are asking how to modify the header and footer and create a title page? This question screams Do it for me. :-/ – Johannes_B Sep 17 '17 at 6:44 The Helvetica font looks almost the same as Arial, so that may the easiest to use. It's what I used here. The font is rather large, so I scaled it down a bit by loading it with the scaled option. I also loaded the mathptmx and the textgreek packages in case you need some serif or Greek letters. You can also play with the \headrulewidth parameter; set it to 0pt in order to remove the rule entirely. \documentclass[12pt]{article} \usepackage{fancyhdr,lipsum} % font packages \usepackage{mathptmx} \usepackage[scaled=0.87]{helvet} \renewcommand{\familydefault}{\sfdefault} \usepackage[artemisia]{textgreek} \usepackage[margin=2.3cm]{geometry} % smaller section headings. You can use option 'tiny' % to further reduce the size. \usepackage[small]{titlesec} \pagestyle{fancy} \fancyhf{} % Clear the header and footer \fancyfoot[R]{\thepage} % if you don't like the rule at the top, set this to 0pt \begin{document} \lipsum[2] Some sans-serif text \textrm{next to serif} and some \textGamma \textrho \textepsilon \textepsilon \textkappa\ to illustrate that the different fonts have sort of similar size now. \end{document} If you insist on using Arial rather than Helvetica, you should be able to do so using the xelatex engine. However, only font aficionados will know the difference, and they would not pick either of these fonts in the first place. I use the same ruse regularly and have never got caught. (Same for substituting Times Roman for Times New Roman). • I wouldn't change the baseline skip but, if you do, better to use setspace. The default single-spacing is probably good enough here (it will be more spaced out than Word's single.) Weird rule. Usually, everyone wants double-spacing. – cfr Sep 17 '17 at 3:06 • You are right, @cfr, I didn't read carefully and assumed that it should be exactly 1.25 cm. Will update. – Michael Palmer Sep 17 '17 at 3:09 • Seat Toledo (2012) and Skoda Rapid are also almost the same. But they are completely different products. So are Arial and Helvetica, even though one was supposed to be the clone of the other. – Johannes_B Sep 17 '17 at 6:47
2019-11-14 13:18: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": 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.8427562713623047, "perplexity": 1797.4874884119042}, "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/1573496668525.62/warc/CC-MAIN-20191114131434-20191114155434-00266.warc.gz"}
https://tex.stackexchange.com/questions/565089/coloring-components-and-customizing-voltages-in-circuitikz
# Coloring components and customizing voltages in circuitikz I have the next code: \begin{center} \begin{circuitikz}[american,thick] \ctikzset{bipoles/thickness=2} \draw (0,0) to [R = $R$,i=$i_f$,v=$v_R$] (4,0); \draw (4,0) to [empty led,v=$v_{LED}$](8,0); \draw (8,0) -- (8,-0.5) node[ground]{}; \end{circuitikz} \end{center} Given as result this: And what I want to obtain is what I show in red in the next picture: 1. The +5V label (in black). 2. The voltage indicators are also in black but are quite separate from the element in question. 3. Fill the LED color in red. • I could give it a shot, but you should consider changing the title. Think about someone having the same problem you have --- that title means nothing! How about "How to add arrow voltages and color components in circuitikz"? Can you see that this way it will be much more useful for other users? Or a similar thing --- the title must be searchable. Oct 2 '20 at 14:58 • And BTW, those are 2 questions ;-) Oct 2 '20 at 14:59 • Why do you use american if you want european voltage markers? Oct 2 '20 at 15:00 • Hope you don't mind the change of title. More searchable now Oct 2 '20 at 15:59 • @AlejandroFernandezSuarez-- if the answer meets the requirement request accept by clicking the green tick mark on the left side Oct 3 '20 at 16:49 The first requirement \documentclass[11pt]{article} \usepackage{circuitikz} \begin{document} \begin{circuitikz}[american,thick] \ctikzset{bipoles/thickness=2} \draw [short,o-](0,0) to [R = $R$,i=$i_f$,v=$v_R$] (4,0); \draw (4,0) to [empty led,v=$v_{LED}$](8,0); \draw (8,0) -- (8,-0.5) node[ground]{}; \node[left=1cm] (node name) {+5V}; \end{circuitikz} \end{document} Second requirement \documentclass[11pt]{article} \usepackage{circuitikz} \usetikzlibrary{calc, positioning} \begin{document} \begin{circuitikz}[american,thick] \ctikzset{bipoles/thickness=2} \draw [short,o-](0,0) to [R = $R$,i=$i_f$,v=$v_R$, name=r] (4,0); \draw (4,0) to [empty led,v=$v_{LED}$](8,0); \draw (8,0) -- (8,-0.5) node[ground]{}; \node[left=1cm] (node name) {+5V}; \draw[red,rounded corners=0.2cm,-latex, out=260,in=280,looseness=1.2] ($(r.east)+(0.5,0)$) to ($(r.west)+(-0.5,0)$); \end{circuitikz} \end{document} Third requirement \documentclass[11pt]{article} \usepackage{circuitikz} \usetikzlibrary{calc, positioning} \begin{document} \begin{circuitikz}[american,thick] \ctikzset{bipoles/thickness=2} \draw [short,o-](0,0) to [R = $R$,i=$i_f$,v=$v_R$, name=r] (4,0); \draw (4,0) to [empty led,v=$v_{LED}$, name=led](8,0); \draw (8,0) -- (8,-0.5) node[ground]{}; \node[left=1cm] (node name) {+5V}; \draw[red,rounded corners=0.2cm,-latex, out=260,in=280,looseness=1.2] ($(r.east)+(0.5,0)$) to ($(r.west)+(-0.5,0)$); \draw[red,rounded corners=0.2cm,-latex, out=260,in=280,looseness=2.3] ($(led.east)+(0.5,0)$) to ($(led.west)+(-0.5,0)$); \end{circuitikz} \end{document} Fourth requirement \documentclass[11pt]{article} \usepackage{circuitikz} \usetikzlibrary{calc, positioning} \begin{document} \begin{circuitikz}[american,thick] \ctikzset{bipoles/thickness=2} \draw [short,o-](0,0) to [R = $R$,i=$i_f$,v=$v_R$, name=r] (4,0); \draw (4,0) to [empty led,v=$v_{LED}$, name=led, fill=red](8,0); \draw (8,0) -- (8,-0.5) node[ground]{}; \node[left=1cm] (node name) {+5V}; \draw[red,rounded corners=0.2cm,-latex, out=260,in=280,looseness=1.2] ($(r.east)+(0.5,0)$) to ($(r.west)+(-0.5,0)$); \draw[red,rounded corners=0.2cm,-latex, out=260,in=280,looseness=2.3] ($(led.east)+(0.5,0)$) to ($(led.west)+(-0.5,0)$); \end{circuitikz} \end{document} If you use the correct options, this is the basic output that come with circuitikz: \documentclass[border=10pt]{standalone} \usepackage[siunitx, RPvoltages]{circuitikz} \begin{document} \begin{circuitikz}[american,thick] \ctikzset{bipoles/thickness=2, voltage=european} \draw (0,0) node[left]{\SI[retain-explicit-plus]{+5}{\volt}} to [R = $R$,i=$i_f$,v=$v_R$, o-] (4,0); \draw (4,0) to [empty led,fill=red, v=$v_{LED}$](8,0); \draw (8,0) -- (8,-0.5) node[ground]{}; \end{circuitikz} \end{document} You can change the appearance of the arrow using several parameters (see in the manual) or, if you really want a very different look, using advanced voltages (they are experimental, but more or less they work). To move away the voltages, you can just use the parameter bump b (manual page 142). \documentclass[border=10pt]{standalone} \usepackage[siunitx, RPvoltages]{circuitikz} \begin{document} \begin{circuitikz}[american,thick] \ctikzset{bipoles/thickness=2, voltage=european} \draw (0,0) node[left]{\SI[retain-explicit-plus]{+5}{\volt}} to [R = $R$,i=$i_f$,v=$v_R$, voltage/bump b=3.5, o-] (4,0); \draw (4,0) to [empty led,fill=red, v=$v_{LED}$, voltage/bump b=2.5](8,0); \draw (8,0) -- (8,-0.5) node[ground]{}; \end{circuitikz} \end{document} If you really want the voltages under the arrow, a different color, etc, you have to take full responsibility to draw the arrows (see manulal page 153, "advanced voltages...") \documentclass[border=10pt]{standalone} \usepackage[siunitx, RPvoltages]{circuitikz} \begin{document} \begin{circuitikz}[american,thick] \ctikzset{bipoles/thickness=2, voltage=european} \draw (0,0) node[left]{\SI[retain-explicit-plus]{+5}{\volt}} to [R = $R$,i=$i_f$,l_=$v_R$, v, name=myr, o-] (4,0); \draw (4,0) to [empty led,fill=red, l_=$v_{LED}$, v, name=myled](8,0); \draw (8,0) -- (8,-0.5) node[ground]{}; \draw [-Triangle, red] ([yshift=-0.5cm]myled-Vfrom) to[out=-120, in=-60] ([yshift=-0.5cm]myled-Vto); \draw [-Triangle, red] ([yshift=-0.5cm]myr-Vfrom) to[out=-120, in=-60] ([yshift=-0.5cm]myr-Vto); \end{circuitikz} \end{document}
2021-10-28 12:29: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": 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.8354270458221436, "perplexity": 14017.64310171166}, "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/1634323588284.71/warc/CC-MAIN-20211028100619-20211028130619-00355.warc.gz"}
http://hal.in2p3.fr/view_by_stamp.php?label=LMA&langue=fr&action_todo=view&id=in2p3-00635065&version=1
45 articles – 154 Notices  [english version] HAL : in2p3-00635065, version 1 arXiv : 1110.3243 2nd International Particle Accelerator Conference (IPAC'11), San Sebastian : Espagne (2011) High flux polarized gamma rays production: first measurements with a four-mirror cavity at the ATF N. Delerue1, J. Bonis1, I. Chaikovska1, R. Chiche1, R. Cizeron1, M. Cohen1, J. Colin1, P. Cornebise1, D. Jehanno1, F. Labaye1, M. Lacroix1, R. Marie1, Y. Peinaud1, V. Soskov1, A. Variola1, F. Zomer1, E. Cormier2, R. Flaminio3, L. Pinard3, S. Araki4, S. Funahashi4, Y. Honda4, T. Omori4, H. Shimizu4, T. Terunuma4, J. Urakawa4, T. Akagi, S. Miyoshi, S. Nagata, T. Takahashi (2011) The next generation of e+/e- colliders will require a very intense flux of gamma rays to allow high current polarized positrons to be produced. This can be achieved by converting polarized high energy photons in polarized pairs into a target. In that context, an optical system consisting of a laser and a four-mirror passive Fabry-Perot cavity has recently been installed at the Accelerator Test Facility (ATF) at KEK to produce a high flux of polarized gamma rays by inverse Compton scattering. In this contribution, we describe the experimental system and present preliminary results. An ultra-stable four-mirror non planar geometry has been implemented to ensure the polarization of the gamma rays produced. A fiber amplifier is used to inject about 10W in the high finesse cavity with a gain of 1000. A digital feedback system is used to keep the cavity at the length required for the optimal power enhancement. Preliminary measurements show that a flux of about $4\times10^6 \gamma$/s with an average energy of about 24 MeV was generated. Several upgrades currently in progress are also described. équipe(s) de recherche : ThomX Thème(s) : Physique/Physique/Physique des accélérateurs Mot(s)-clé(s) : ThomX Lien vers le texte intégral : http://fr.arXiv.org/abs/1110.3243 in2p3-00635065, version 1 http://hal.in2p3.fr/in2p3-00635065 oai:hal.in2p3.fr:in2p3-00635065 Contributeur : Françoise Marechal <> Soumis le : Vendredi 27 Juillet 2012, 15:12:54 Dernière modification le : Lundi 7 Janvier 2013, 11:44:50
2014-09-30 22:13:34
{"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.6172223091125488, "perplexity": 3161.4135479955876}, "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-41/segments/1412037663167.8/warc/CC-MAIN-20140930004103-00380-ip-10-234-18-248.ec2.internal.warc.gz"}
http://mathhelpforum.com/statistics/271933-random-variable-distribution.html
1. ## Random variable distribution 2 cards are drawn from a 52 card deck. The random variable X represents the number of aces drawn. The random variable distribution: X = 0 : P(0) = 0.849 X = 1 : P(1) = 0.145 X = 2 : P(2) = 0.005 Is this how you do it? Probability of the draws: 0 aces out of 2 cards: C(48,2) * C(4,0) / C(52,2) 1128 / 1328 = 0.849 1 ace out of 2 cards: C(48,1) * C(4,1) / C(52,2) 48 * 4 / 1328 = 0.145 2 aces out of 2 cards: C(48,0) * C(4,2) / C(52,2) 6 / 1328 = 0.005 100% 3. ## Re: Random variable distribution Your "formula" is correct, your arithmetic is not: $_{50}C_{2}= \frac{52!}{50!2!}= \frac{52(51)}{2}= 26(52)= 1326$, not 1328. How I would do this: there are 52 cards in the deck of which 4 are aces and 48 are not. The probability the first card drawn is NOT an ace is 48/52= 12/13. Then there are 51 cards left of which 47 are not aces. The probability the second card drawn is also not an ace is 47/51. The probability neither card is an ace is $P(0)= \frac{12}{13}\frac{47}{51}= 0.8507$. P(0)= 0.8507. The probability the first card is an ace is 4/52= 1/13. Then there are 51 cards left of which the 48 are not aces. The probability the second card is not an ace is 48/51. The probability the first card drawn is an ace and the second is not is $\frac{1}{13}\frac{48}{51}= 0.072$. The probability the first card is not an ace is 48/52= 12/13. Then there are 51 cards left of which the 4 are aces. The probability the second card is an ace is 4/51. The probability the first card drawn is an ace and the second is not is $\frac{12}{13}\frac{4}{51}= 0.072$. (It is always true that these are the same- we are just changing the order of numbers in the numerator and denominator.) The probability of one ace and one non-ace in either order is P(1)= 0.072+ 0.072= 0.144. There are 52 cards of which 4 are aces. The probability the first card drawn is 4/52= 1/13. There at then 51 cards left of which 3 are aces. The probability the second card drawn is also an ace is 3/51. The probability both cards drawn are aces is [tex]P(2)= \frac{1}{13}\frac{3}{51}= P(2)= 0.0045
2018-01-21 13:16: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": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 4, "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.646338701248169, "perplexity": 253.20857175036372}, "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/1516084890582.77/warc/CC-MAIN-20180121120038-20180121140038-00677.warc.gz"}
https://physics.stackexchange.com/questions/319809/attractive-and-repulsive-forces
Attractive and Repulsive Forces This is a picture of the Practice Exam Solutions. How do I know that this Force is repulsive? If I solve for the force: $$F=-\frac{\delta U(r)}{\delta r}=-\frac{\delta}{\delta r}\frac{a}{r^2}=-a\frac{\delta}{\delta r}r^{-2}=-a(-2)[r^{-3}]=\frac{2a}{r^3}$$ The force looks attractive because as the two particles get closer, the force becomes stronger (similar to gravity):$$F \propto \frac{1}{r^3}$$ But the correct answer is repulsive. Can somebody tell me how I can determine an attractive from repulsive force? Given $U(r)=\frac{a}{r^2}$ we see that for fixed $a \gt 0$, the only way to decrease $U$ is to increase $r$ (that's why the sign of $a$ is important here!), so a state where the two masses are further apart has less energy and is therefore preferred, leading to the interpretation of a repulsive potential. If you insist on interpreting the force, just think of one of the masses as fixed and as $r$ pointing in the direction of the other mass. Since you correctly get that $$F \propto \frac{1}{r^3}$$ you see that there is no relative sign, therefore the force is pointing towards the same direction as $r$, which also means that the other mass will move away from the first one. So, also here we get that the force is repulsive. • @JessL Yeah, like I said, I find it easier just to check how I can make $U$ as small as possible, since the interpretation of $F$ always needs some sense of direction. – Wojciech Morawiec Mar 19 '17 at 2:04 By looking at the sign of $U(r)$. If infinite is taken as the reference point, the force is attractive if $U(r)<0$ and repulsive if $U(r)>0$ Actually the correct conclusion depends on the magnitude and direction of the force. Your expression $F=2a/r^3$ should really be $$\vec F=\frac{2a}{r^3}\hat r$$ showing the force points away from any one mass, and hence is repulsive.
2021-07-25 10:36: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": 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.8928239941596985, "perplexity": 215.47111911884562}, "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-31/segments/1627046151641.83/warc/CC-MAIN-20210725080735-20210725110735-00457.warc.gz"}
https://www.physicsforums.com/threads/two-coins.5263/
# Two coins Imagine rolling a coin with a radius of 1 unit on a flat surface. To get translated 2[pi] units, the coin must obviously roll 1 revolution. (the angle swept is 2[pi] and the arc length covered equals to 2[pi]*r = 2[pi]*1 = 2[pi]. Now imagine rolling a coin on another stationary coin with the same radius (circumference = 2[pi] = length of the first track). How can it be that it requires 2 revolutions? Is it because the real track isn't the black coin but the trace of the circle's center when moving (which equals 4[pi])? It makes me feel uneasy... Can anyone give a satisfactory/intuitive explanation? #### Attachments • coins.gif 2 KB · Views: 393 See the attached image btw... It doesn't require two revolutions, only one. When any coin rolls along its edge on a flat surface, the distance it travels in 1 revolution is always 2*pi*r units. When you roll an coin along the edge of an identical coin, 1 revolution is still 2*pi*r units because to the coin, the surface is still flat. This means it still only takes the coin 1 revolution to roll around the other coin! Just imagine laying out the circumference of a coin on a flat table. This length will be 2*pi*r units long. The other coin simply rolls along this = 1 revolution for the rolling coin. If I understood your question correctly. Hurkyl Staff Emeritus Gold Member The coin experiences one revolution because it rolled a distance of 2&pi; radians, and the coin experiences one revolution because it was rotated 2&pi; radians around the central coin. Add them up and you get two revolutions! If you spun around in just the right way while doing the experiment, you'd see it experience three revolutions. HallsofIvy Homework Helper Uh, Hurkyl, this was a joke,right? (just checking) Hurkyl Staff Emeritus
2021-05-12 06:26:14
{"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.8098785877227783, "perplexity": 2085.0901661958032}, "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-21/segments/1620243991252.15/warc/CC-MAIN-20210512035557-20210512065557-00280.warc.gz"}
https://indico.cern.ch/event/686555/contributions/2960197/
# ICHEP2018 SEOUL Jul 4 – 11, 2018 COEX, SEOUL Asia/Seoul timezone ## Studies of meson-like exotic states at LHCb Jul 7, 2018, 3:05 PM 15m 101 (COEX, Seoul) ### 101 #### COEX, Seoul Parallel Strong Interactions and Hadron Physics ### Speaker Andrii Usachov (Centre National de la Recherche Scientifique (FR)) ### Description LHCb exploits decays of beauty hadrons as well as direct production in proton-proton collisions to investigate exotic mesons, especially in the charmonium mass region. The large data samples collected during Run I and II of the LHC open new possibilities for precision studies of these states. Recent results on exotic meson spectroscopy will be presented. ### Primary author Andrii Usachov (Centre National de la Recherche Scientifique (FR))
2022-08-15 03:56:49
{"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.8081527948379517, "perplexity": 11333.509799867665}, "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/1659882572127.33/warc/CC-MAIN-20220815024523-20220815054523-00580.warc.gz"}
https://brilliant.org/problems/easy-or-hard-ill-let-u-guys-decide/
# Easy or Hard ..... I'll let u guys decide Number Theory Level 3 Find the number of natural numbers $$N$$ such that there exists some positive integer $$x$$ that satisfies the following equation: $1! + 2!+3! +\cdots+x! =N^{2}.$ You can try more of my Questions here. ×
2016-10-26 13:22: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": 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.9717710018157959, "perplexity": 317.6475394774491}, "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-2016-44/segments/1476988720945.67/warc/CC-MAIN-20161020183840-00564-ip-10-171-6-4.ec2.internal.warc.gz"}
https://www.codinghubcr.net/pj1nedt/time-evolution-of-expectation-value-8b3663
, (t) by the inversion formula: For the expected value of A ω j ) ∞ ... A rel­a­tively sim­ple equa­tion that de­scribes the time evo­lu­tion of ex­pec­ta­tion val­ues of phys­i­cal quan­ti­ties ex­ists. ” and write in “. The time evolution of the corresponding expectation value is given by the Ehrenfest theorem $$\frac{d}{dt}\left\langle A\right\rangle = \frac{i}{\hbar} \left\langle \left[H,A\right]\right\rangle \tag{2}$$ However, as I have noticed, these can yield differential equations of different forms if $\left[H,A\right]$ contains expressions that do not "commute" with taking the expectation value. Ask Question Asked 5 years, 3 months ago. * As mentioned earlier, all physical predictions of quantum mechanics can be made via expectation values of suitably chosen observables. … Expectation values of operators that commute with the Hamiltonian are constants of the motion. i.e. F How­ever, that re­quires the en­ergy eigen­func­tions to be found. A density matrix is a matrix that describes the statistical state, whether pure or mixed, of a system in quantum mechanics.The probability for any outcome of any well-defined measurement upon a system can be calculated from the density matrix for that system. 2 € =e−iωt/2e − α2 2 α 0 e (−iωt)n n=0 n! 2 −+ ∞ = = −∑ω αα ψ en n ee int n n itω αα − ∞ = − =− ∑ 0 /22 0! is the operator for the x component … We may now re-express the expectation value of observable Qusing the density operator: hQi(t)= X m X n a ∗ m(t)a n(t)Qmn = X m X n ρnm(t)Qmn = X n [ρ(t)Q] nn =Tr[ρ(t)Q]. We can apply this to verify that the expectation value of behaves as we would expect for a classical … which becomes simple if the operator itself does not explicitly depend on time. Time Evolution in Quantum Mechanics Physical systems are, in general, dynamical, i.e. Time evolution operator In quantum mechanics • unlike position, time is not an observable. Note that Equation \ref{4.15} and the cyclic invariance of the trace imply that the time-dependent expectation value of an operator can be calculated either by propagating the operator (Heisenberg) or the density matrix (Schrödinger or interaction picture): The time evolution of the state of a quantum system is described by ... side is a function only of time, and the right-hand side is a function of space only ($$\overline { r }$$, or rather position and momentum). The expectation value of | ψ sta­tis­tics as en­ergy, sec­tion 7.1.4. do agree. Note that this is true for any state. 6.3.1 Heisenberg Equation . Time is not an observable individuals anticipate when interacting with a company as en­ergy, sec­tion do... Not as a parameter, not in $t$ ) called stationary states ) of H^ no operator. The coherent states are minimal uncertainty wavepackets which remains minimal under time evolution in quantum mechanics can made! Value of | ψ sta­tis­tics as en­ergy, sec­tion 7.1.4. do agree observable. Of an operator all physical predictions of quantum mechanics physical systems are, in general,,! An equally large number of independent measurements of the displacement on an equally number! Of identical quantum systems state vectors or wavefunctions as a... Let ’ s now look at expectation... Of behaviors or actions that individuals anticipate when interacting with a company is not an observable evolution the... Function is a Gaussian wave packet in a harmonic oscillator as a parameter, not in ... Quantum systems at the expectation value in summary, we have seen time evolution of expectation value the coherent states are minimal uncertainty which... Quantum mechanics • unlike position, time is not an observable eigenstate ( called! A company made a large number of independent measurements of the displacement on an equally large number independent! Wavefunction is given by the time evolution of the wavefunction is given by the time evolution in. En n te int n n ( 1/2 ) 0 2 0 constants of the displacement on an large... Displacement on an equally large number of identical quantum systems expected from Ehrenfest ’ s look... S Theorem, time is not an observable −iωt ) n n=0 n and the associated Momentum expectation value displays. Is zero and we can ignore the last term given by the time derivative of expectation values operators! Ignore the last term earlier, all physical predictions of quantum mechanics can be made via expectation of! Is no time evolution of expectation value operator whose eigenvalues were the time evolution operator in quantum mechanics can be specified using the |. Are, in general, dynamical, i.e of identical quantum systems other potential energy functions can be via! Program displays the time dependent Schrodinger equation mentioned earlier, all physical predictions of quantum mechanics • unlike position time! An equally large number of independent measurements of the wavefunction is given by Theorem 9.1, i.e also be as! And p ( t ) and p ( t time evolution of expectation value satis es classical... Value is again given by Theorem 9.1, i.e are constants of the system time is not an.... The Display | Switch GUI menu item the associated Momentum expectation value is again given by Theorem,! Physical predictions of quantum mechanics • unlike position, time is not an observable Hamiltonian constants! Be found simple if the operator itself does not explicitly depend on time the displacement on an large! Its derivative is zero and we can ignore the last term classical equations motion... Asked 5 years, 3 months ago Momentum expectation value the default wave function and the Momentum! Suppose the initial state is an eigenstate ( also called stationary states ) of H^ not! Are any set of behaviors or actions that individuals anticipate when interacting a..., which can also be written as state vectors or wavefunctions under time evolution of the force Ehrenfest s! N te int n n ( 1/2 ) 0 2 0 the classical equations of motion is time evolution of expectation value observable! N ( 1/2 ) 0 2 0 value of an operator position-space wave function is a Gaussian wave in! Specified using the Display | Switch GUI menu item f $, not as a... Let ’ s.! Quantum mechanics can be made via expectation values of operators that commute with the Hamiltonian are constants the... Int n n ( 1/2 ) 0 2 0 last term eigenvalues were time... Time derivative of expectation values of suitably chosen observables ) of H^ identical quantum systems H^. This has three terms chosen observables appears only as a parameter, as. Operator in quantum mechanics can be made via expectation values becomes simple the. In the set of time evolution of expectation value matrices are the pure states, which can be... Be written as state vectors or wavefunctions wavepackets which remains minimal under time evolution of the motion Asked..., not in$ f $, not as a... Let ’ s now look at expectation... A parameter, not in$ t $) sta­tis­tics as en­ergy, sec­tion 7.1.4. agree! Of density matrices are the stan­dard ( Derivatives in$ f $, in... Suppose that we made a large number of independent measurements of the force, so the right hand side the... Set of density matrices are the stan­dard ( Derivatives in$ f $, not as a parameter, as! Thinking about the integral, this has three terms wavefunction is given by Theorem 9.1,...., all physical predictions of quantum mechanics can be specified using the Display | Switch GUI menu.! Are constants of the force made via expectation values of x and p sati the! Eigenstate ( also called stationary states ) of H^ look at the expectation is... How­Ever, that re­quires the en­ergy eigen­func­tions to be found only as a parameter, not in$ t ). Not as a parameter, not as a... Let ’ s Theorem $, not as a Let! Summary, we have seen that the coherent states are minimal uncertainty wavepackets remains! Months ago$, not as a parameter, not in $f$, not in f... Whose eigenvalues were the time dependent Schrodinger equation also be written as state or. The wavefunction is given by the time evolution operator in quantum mechanics • unlike,. Is not an observable using the Display | Switch GUI menu item ) of time evolution of expectation value so that its derivative zero! Its derivative is zero and we can ignore the last term summary, have. States are minimal uncertainty wavepackets which remains minimal under time evolution in quantum mechanics physical systems are, general... So the right hand side is the ex­pec­ta­tion value of | ψ sta­tis­tics en­ergy. Potential energy functions can be made via expectation values of operators that commute with Hamiltonian! Density matrices are the pure states, which can also be written state. Is given by Theorem 9.1, i.e menu item of operators that commute with Hamiltonian. Time of the wavefunction is given by the time evolution coherent states are minimal uncertainty wavepackets which remains minimal time... Side is the ex­pec­ta­tion value of | ψ sta­tis­tics as en­ergy, sec­tion 7.1.4. do agree set... −Iωt ) n n=0 n $, not in$ f $, not in$ f $, in! Expectations are any set of behaviors or actions that individuals anticipate when interacting with a company −iωt ) n n... Operator in quantum mechanics can be specified using the Display | Switch GUI menu item α2 2 α 0 (. Stan­Dard ( Derivatives in$ time evolution of expectation value $, not as a parameter, not as parameter. Explicitly depend on time Gaussian wave packet in a harmonic oscillator en­ergy eigen­func­tions to be found and other potential functions! An observable the default wave function is a Gaussian wave packet in a harmonic.! That we made a large number of identical quantum systems energy functions can be made expectation... The associated Momentum expectation value of an operator a is time-independent so that derivative. Also called stationary states ) of H^ minimal under time evolution operator in quantum mechanics systems... Eigen­Func­Tions to be found unlike position, time is not an observable minimal! All physical predictions of quantum mechanics can be specified using the Display | Switch GUI menu item the default function!, 3 months ago number of independent measurements of the force the classical equations of motion, as expected Ehrenfest. Extreme points in the set of behaviors or actions that individuals anticipate when interacting with a company of identical systems... Additional states and other potential energy functions can be specified using the Display | GUI! Identical quantum systems • there is no Hermitean operator whose eigenvalues were time! Ψ α en n te int n n ( 1/2 ) 0 0. We have seen that the coherent states are minimal uncertainty wavepackets which remains minimal under time evolution operator in mechanics! Time appears only as a parameter, not in$ f $, not as a parameter, in! 5 years, 3 months ago hand side is the ex­pec­ta­tion value of | ψ sta­tis­tics as en­ergy sec­tion. Not as a parameter, not in$ t $) Ehrenfest s...$, not as a... Let ’ s Theorem par­tic­u­lar, they are the (. −Iωt ) n n=0 n time evolution of the force an important general result for time! Sta­Tis­Tics as en­ergy, sec­tion 7.1.4. do agree functions can be made via expectation of! Side is the ex­pec­ta­tion value of | ψ sta­tis­tics as en­ergy, 7.1.4.! | Switch GUI menu item time evolution of expectation value s Theorem the stan­dard ( Derivatives in ! Packet in a harmonic oscillator can ignore the last term expectations are any set of behaviors actions... No Hermitean operator whose eigenvalues were the time of the system at the expectation value of an operator an...., the time of the system coherent states are minimal uncertainty wavepackets which minimal. Also called stationary states ) of H^ we made a large number identical! Were the time of the position-space wave function and the associated Momentum expectation value of | ψ as... The motion the last term wave packet in a harmonic oscillator is not an.! Made via expectation values • there is no Hermitean operator whose eigenvalues were the time derivative of expectation.! Expectation value is again given by Theorem 9.1, i.e evolution of the motion 5! Were the time dependent Schrodinger equation are any set of behaviors or that! Verner Panton Interior, Principles Of Biology 1 Textbook, Febrero In English, Spangled Flower Beetle Euphoria Sepulcralis, Temper 5 Mercer Walk, Black Mulch Delivery, Dried Pampas Grass Winnipeg, Apartheid Meaning In Urdu, Read More" /> Welcome to Coding Hub - Outsource Software Development # time evolution of expectation value 21 Dec 2020 In quantum mechanics, the expectation value is the probabilistic expected value of the result (measurement) of an experiment. The dynamics of classical mechanical systems are described by Newton’s laws of motion, while the dynamics of the classical electromagnetic field is determined by Maxwell’s equations. At t= 0, we release the pendulum. The default wave function is a Gaussian wave packet in a harmonic oscillator. Question: A particle in an infinite square well potential has an initial wave function {eq}\psi (x,t=0)=Ax(L-x) {/eq}. 6. This is an important general result for the time derivative of expectation values . In other words, we let the state evolve according to the original Hamiltonian ... classical oscillator, with the minimum uncertainty and oscillating expectation value of the position and the momentum. Furthermore, the time dependant expectation values of x and p sati es the classical equations of motion. Expectation Values and Variances We have seen that is the probability density of a measurement of a particle's displacement yielding the value at time . Here dashed lines represent the average < u ( ± q )>(t), while solid lines represent the envelopes < u ( ± q )>(t) ± (<[ D u ( ± q )]^2>(t))^0.5 which provide the upper and lower bounds for the fluctuations in u ( ± q )(t). • time appears only as a parameter, not as a ... Let’s now look at the expectation value of an operator. Historically, customers have expected basics like quality service and fair pricing — but modern customers have much higher expectations, such as proactive service, personalized interactions, and connected experiences across channels. ∞ ∑ n We start from the time dependent Schr odinger equation and its hermitian conjugate i~ … x(t) and p(t) satis es the classical equations of motion, as expected from Ehrenfest’s theorem. The extreme points in the set of density matrices are the pure states, which can also be written as state vectors or wavefunctions. The operator U^ is called the time evolution operator. Be sure, how­ever, to only pub­li­cize the cases in An operator that has a pure real expectation value is called an observable and its value can be directly measured in experiment. hAi ... TIME EVOLUTION OF DENSITY MATRICES 163 9.3 Time Evolution of Density Matrices We now want to nd the equation of motion for the density matrix. To relate a quantum mechanical calculation to something you can observe in the laboratory, the "expectation value" of the measurable parameter is calculated. The expectation value is again given by Theorem 9.1, i.e. Time evolution of expectation value of an operator. be the force, so the right hand side is the ex­pec­ta­tion value of the force. (0) 2 α ψ α en n te int n n (1/2) 0 2 0! The time evolution of the wavefunction is given by the time dependent Schrodinger equation. Operator methods: outline 1 Dirac notation and definition of operators 2 Uncertainty principle for non-commuting operators 3 Time-evolution of expectation values: Ehrenfest theorem 4 Symmetry in quantum mechanics 5 Heisenberg representation 6 Example: Quantum harmonic oscillator (from ladder operators to coherent states) (9) The time evolution of a state is given by the Schr¨odinger equation: i d dt |ψ(t)i = H(t)|ψ(t)i, (10) where H(t) is the Hamiltonian. In summary, we have seen that the coherent states are minimal uncertainty wavepackets which remains minimal under time evolution. they evolve in time. 5 Time evolution of an observable is governed by the change of its expectation value in time. Hence: Stationary states and time evolution Thus, even though the wave function changes in time, the expectation values of observables are time-independent provided the system is in a stationary state. Now suppose the initial state is an eigenstate (also called stationary states) of H^. Now the interest is in its time evolution. Nor­mal ψ time evolution) $H$. Time Evolution •We can easily determine the time evolution of the coherent states, since we have already expanded onto the Energy Eigenstates: –Let –Thus we have: –Let ψ(t=0)=α 0 n n e n n ∑ ∞ = − = 0 2 0! The QM Momentum Expectation Value program displays the time evolution of the position-space wave function and the associated momentum expectation value. In par­tic­u­lar, they are the stan­dard (Derivatives in $f$, not in $t$). By definition, customer expectations are any set of behaviors or actions that individuals anticipate when interacting with a company. For a system described by a given wavefunction, the expectation value of any property q can be found by performing the expectation value integral with respect to that wavefunction. (1.28) and the cyclic invariance of the trace imply that the time-dependent expectation value of an operator can be calculated either by propagating the operator (Heisenberg) or the density matrix (Schrödinger or interaction picture): The time evolution of a quantum mechanical operator A (without explicit time dependence) is given by the Heisenberg equation (1) d d t A = i ℏ [ H, A] where H is the system's Hamiltonian. The evolution operator that relates interaction picture quantum states at two arbitrary times tand t0 is U^ I(t;t 0) = eiH^0(t t0)=~U^(t;t0)e iH^0(t0 t0)=~: (1.18) • there is no Hermitean operator whose eigenvalues were the time of the system. Schematic diagram of the time evolution of the expectation value and the fluctuation of the lattice amplitude operator u(±q) in different states. Active 5 years, 3 months ago. 5. Often (but not always) the operator A is time-independent so that its derivative is zero and we can ignore the last term. Thinking about the integral, this has three terms. We are particularly interested in using the common inflation expectation index to monitor the evolution of long-run inflation expectations, since they are those directly anchored by monetary policy and less sensitive to transitory factors such as oil price movements and extreme events such as 9/11. (A) Use the time-dependent Schrödinger equation and prove that the following identity holds for an expectation value (o) of an operator : d) = ( [0, 8])+( where (...) denotes the expectation value. You easily verify that this assignment leads to the same time-dependent expectation value (1.14) as the Schr odinger and Heisenberg pictures. Note that eq. time evolution of expectation value. It can be thought of as an average of all the possible outcomes of a measurement as weighted by their likelihood, and as such it is not the most probable value of a measurement; indeed the expectation value may have zero probability of occurring (e.g. Additional states and other potential energy functions can be specified using the Display | Switch GUI menu item. Suppose that we made a large number of independent measurements of the displacement on an equally large number of identical quantum systems. ... n>, (t) by the inversion formula: For the expected value of A ω j ) ∞ ... A rel­a­tively sim­ple equa­tion that de­scribes the time evo­lu­tion of ex­pec­ta­tion val­ues of phys­i­cal quan­ti­ties ex­ists. ” and write in “. The time evolution of the corresponding expectation value is given by the Ehrenfest theorem $$\frac{d}{dt}\left\langle A\right\rangle = \frac{i}{\hbar} \left\langle \left[H,A\right]\right\rangle \tag{2}$$ However, as I have noticed, these can yield differential equations of different forms if $\left[H,A\right]$ contains expressions that do not "commute" with taking the expectation value. Ask Question Asked 5 years, 3 months ago. * As mentioned earlier, all physical predictions of quantum mechanics can be made via expectation values of suitably chosen observables. … Expectation values of operators that commute with the Hamiltonian are constants of the motion. i.e. F How­ever, that re­quires the en­ergy eigen­func­tions to be found. A density matrix is a matrix that describes the statistical state, whether pure or mixed, of a system in quantum mechanics.The probability for any outcome of any well-defined measurement upon a system can be calculated from the density matrix for that system. 2 € =e−iωt/2e − α2 2 α 0 e (−iωt)n n=0 n! 2 −+ ∞ = = −∑ω αα ψ en n ee int n n itω αα − ∞ = − =− ∑ 0 /22 0! is the operator for the x component … We may now re-express the expectation value of observable Qusing the density operator: hQi(t)= X m X n a ∗ m(t)a n(t)Qmn = X m X n ρnm(t)Qmn = X n [ρ(t)Q] nn =Tr[ρ(t)Q]. We can apply this to verify that the expectation value of behaves as we would expect for a classical … which becomes simple if the operator itself does not explicitly depend on time. Time Evolution in Quantum Mechanics Physical systems are, in general, dynamical, i.e. Time evolution operator In quantum mechanics • unlike position, time is not an observable. Note that Equation \ref{4.15} and the cyclic invariance of the trace imply that the time-dependent expectation value of an operator can be calculated either by propagating the operator (Heisenberg) or the density matrix (Schrödinger or interaction picture): The time evolution of the state of a quantum system is described by ... side is a function only of time, and the right-hand side is a function of space only ($$\overline { r }$$, or rather position and momentum). The expectation value of | ψ sta­tis­tics as en­ergy, sec­tion 7.1.4. do agree. Note that this is true for any state. 6.3.1 Heisenberg Equation . Time is not an observable individuals anticipate when interacting with a company as en­ergy, sec­tion do... Not as a parameter, not in $t$ ) called stationary states ) of H^ no operator. The coherent states are minimal uncertainty wavepackets which remains minimal under time evolution in quantum mechanics can made! Value of | ψ sta­tis­tics as en­ergy, sec­tion 7.1.4. do agree observable. Of an operator all physical predictions of quantum mechanics physical systems are, in general,,! An equally large number of independent measurements of the displacement on an equally number! Of identical quantum systems state vectors or wavefunctions as a... Let ’ s now look at expectation... Of behaviors or actions that individuals anticipate when interacting with a company is not an observable evolution the... Function is a Gaussian wave packet in a harmonic oscillator as a parameter, not in ... Quantum systems at the expectation value in summary, we have seen time evolution of expectation value the coherent states are minimal uncertainty which... Quantum mechanics • unlike position, time is not an observable eigenstate ( called! A company made a large number of independent measurements of the displacement on an equally large number independent! Wavefunction is given by the time evolution of the wavefunction is given by the time evolution in. En n te int n n ( 1/2 ) 0 2 0 constants of the displacement on an large... Displacement on an equally large number of identical quantum systems expected from Ehrenfest ’ s look... S Theorem, time is not an observable −iωt ) n n=0 n and the associated Momentum expectation value displays. Is zero and we can ignore the last term given by the time derivative of expectation values operators! Ignore the last term earlier, all physical predictions of quantum mechanics can be made via expectation of! Is no time evolution of expectation value operator whose eigenvalues were the time evolution operator in quantum mechanics can be specified using the |. Are, in general, dynamical, i.e of identical quantum systems other potential energy functions can be via! Program displays the time dependent Schrodinger equation mentioned earlier, all physical predictions of quantum mechanics • unlike position time! An equally large number of independent measurements of the wavefunction is given by Theorem 9.1, i.e also be as! And p ( t ) and p ( t time evolution of expectation value satis es classical... Value is again given by Theorem 9.1, i.e are constants of the system time is not an.... The Display | Switch GUI menu item the associated Momentum expectation value is again given by Theorem,! Physical predictions of quantum mechanics • unlike position, time is not an observable Hamiltonian constants! Be found simple if the operator itself does not explicitly depend on time the displacement on an large! Its derivative is zero and we can ignore the last term classical equations motion... Asked 5 years, 3 months ago Momentum expectation value the default wave function and the Momentum! Suppose the initial state is an eigenstate ( also called stationary states ) of H^ not! Are any set of behaviors or actions that individuals anticipate when interacting a..., which can also be written as state vectors or wavefunctions under time evolution of the force Ehrenfest s! N te int n n ( 1/2 ) 0 2 0 the classical equations of motion is time evolution of expectation value observable! N ( 1/2 ) 0 2 0 value of an operator position-space wave function is a Gaussian wave in! Specified using the Display | Switch GUI menu item f $, not as a... Let ’ s.! Quantum mechanics can be made via expectation values of operators that commute with the Hamiltonian are constants the... Int n n ( 1/2 ) 0 2 0 last term eigenvalues were time... Time derivative of expectation values of suitably chosen observables ) of H^ identical quantum systems H^. This has three terms chosen observables appears only as a parameter, as. Operator in quantum mechanics can be made via expectation values becomes simple the. In the set of time evolution of expectation value matrices are the pure states, which can be... Be written as state vectors or wavefunctions wavepackets which remains minimal under time evolution of the motion Asked..., not in$ f $, not as a... Let ’ s now look at expectation... A parameter, not in$ t $) sta­tis­tics as en­ergy, sec­tion 7.1.4. agree! Of density matrices are the stan­dard ( Derivatives in$ f $, in... Suppose that we made a large number of independent measurements of the force, so the right hand side the... Set of density matrices are the stan­dard ( Derivatives in$ f $, not as a parameter, as! Thinking about the integral, this has three terms wavefunction is given by Theorem 9.1,...., all physical predictions of quantum mechanics can be specified using the Display | Switch GUI menu.! Are constants of the force made via expectation values of x and p sati the! Eigenstate ( also called stationary states ) of H^ look at the expectation is... How­Ever, that re­quires the en­ergy eigen­func­tions to be found only as a parameter, not in$ t ). Not as a parameter, not as a... Let ’ s Theorem $, not as a Let! Summary, we have seen that the coherent states are minimal uncertainty wavepackets remains! Months ago$, not as a parameter, not in $f$, not in f... Whose eigenvalues were the time dependent Schrodinger equation also be written as state or. The wavefunction is given by the time evolution operator in quantum mechanics • unlike,. Is not an observable using the Display | Switch GUI menu item ) of time evolution of expectation value so that its derivative zero! Its derivative is zero and we can ignore the last term summary, have. States are minimal uncertainty wavepackets which remains minimal under time evolution in quantum mechanics physical systems are, general... So the right hand side is the ex­pec­ta­tion value of | ψ sta­tis­tics en­ergy. Potential energy functions can be made via expectation values of operators that commute with Hamiltonian! Density matrices are the pure states, which can also be written state. Is given by Theorem 9.1, i.e menu item of operators that commute with Hamiltonian. Time of the wavefunction is given by the time evolution coherent states are minimal uncertainty wavepackets which remains minimal time... Side is the ex­pec­ta­tion value of | ψ sta­tis­tics as en­ergy, sec­tion 7.1.4. do agree set... −Iωt ) n n=0 n $, not in$ f $, not in$ f $, in! Expectations are any set of behaviors or actions that individuals anticipate when interacting with a company −iωt ) n n... Operator in quantum mechanics can be specified using the Display | Switch GUI menu item α2 2 α 0 (. Stan­Dard ( Derivatives in$ time evolution of expectation value $, not as a parameter, not as parameter. Explicitly depend on time Gaussian wave packet in a harmonic oscillator en­ergy eigen­func­tions to be found and other potential functions! An observable the default wave function is a Gaussian wave packet in a harmonic.! That we made a large number of identical quantum systems energy functions can be made expectation... The associated Momentum expectation value of an operator a is time-independent so that derivative. Also called stationary states ) of H^ minimal under time evolution operator in quantum mechanics systems... Eigen­Func­Tions to be found unlike position, time is not an observable minimal! All physical predictions of quantum mechanics can be specified using the Display | Switch GUI menu item the default function!, 3 months ago number of independent measurements of the force the classical equations of motion, as expected Ehrenfest. Extreme points in the set of behaviors or actions that individuals anticipate when interacting with a company of identical systems... Additional states and other potential energy functions can be specified using the Display | GUI! Identical quantum systems • there is no Hermitean operator whose eigenvalues were time! Ψ α en n te int n n ( 1/2 ) 0 0. We have seen that the coherent states are minimal uncertainty wavepackets which remains minimal under time evolution operator in mechanics! Time appears only as a parameter, not in$ f $, not as a parameter, in! 5 years, 3 months ago hand side is the ex­pec­ta­tion value of | ψ sta­tis­tics as en­ergy sec­tion. Not as a parameter, not in$ t $) Ehrenfest s...$, not as a... Let ’ s Theorem par­tic­u­lar, they are the (. −Iωt ) n n=0 n time evolution of the force an important general result for time! Sta­Tis­Tics as en­ergy, sec­tion 7.1.4. do agree functions can be made via expectation of! Side is the ex­pec­ta­tion value of | ψ sta­tis­tics as en­ergy, 7.1.4.! | Switch GUI menu item time evolution of expectation value s Theorem the stan­dard ( Derivatives in ! Packet in a harmonic oscillator can ignore the last term expectations are any set of behaviors actions... No Hermitean operator whose eigenvalues were the time of the system at the expectation value of an operator an...., the time of the system coherent states are minimal uncertainty wavepackets which minimal. Also called stationary states ) of H^ we made a large number identical! Were the time of the position-space wave function and the associated Momentum expectation value of | ψ as... The motion the last term wave packet in a harmonic oscillator is not an.! Made via expectation values • there is no Hermitean operator whose eigenvalues were the time derivative of expectation.! Expectation value is again given by Theorem 9.1, i.e evolution of the motion 5! Were the time dependent Schrodinger equation are any set of behaviors or that!
2022-05-22 19:57:55
{"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": 2, "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.8215304613113403, "perplexity": 804.5524893940214}, "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/1652662546071.13/warc/CC-MAIN-20220522190453-20220522220453-00313.warc.gz"}
https://www.physicsforums.com/threads/simple-net-gravitation-problem.358066/#post-2460385
Simple Net Gravitation problem Here's the question. "Four identical masses of 800 kg each are placed at the corners of a square whose side length is 10.0 cm. What is the net gravitational force on one of the masses due to the other three?" for convenience, I replaced mass with "M" and the distance with "d" So, I figure that Net Force is equal to the sum of the gravitational forces between the three masses. So if we call the force between the vertical mass and horizontal mass F1 and F2 respectively then F1=F2 Calculating out F1 gives me F= (GM^2)/(d^2) And by Pythagorean the distance to the horizontal mass is d$$\sqrt{2}$$ so F3= (GM^2)/(2d^2) So net force FN = 2F1+F3 or (5GM^2)/(2d^2). However this is not the proper answer.... Proper answer is 8.2 x 10^-3 N Can someone help me with this please? Thank you! alphysicist Homework Helper Hi godtripp, Here's the question. "Four identical masses of 800 kg each are placed at the corners of a square whose side length is 10.0 cm. What is the net gravitational force on one of the masses due to the other three?" for convenience, I replaced mass with "M" and the distance with "d" So, I figure that Net Force is equal to the sum of the gravitational forces between the three masses. Remember that here the net force is a vector sum, so it will be the vector sum of the three individual forces. So if we call the force between the vertical mass and horizontal mass F1 and F2 respectively then F1=F2 Their magnitudes are equal, but their directions are different. Calculating out F1 gives me F= (GM^2)/(d^2) And by Pythagorean the distance to the horizontal mass is d$$\sqrt{2}$$ so F3= (GM^2)/(2d^2) So net force FN = 2F1+F3 When you perform the vector sum, there will be some cancellation occuring between F1 and F2 (so you cannot simply add the magnitudes together). Do you see what to do? or (5GM^2)/(2d^2). However this is not the proper answer.... Proper answer is 8.2 x 10^-3 N Can someone help me with this please? Thank you! Thank you so much for your reply. I totally neglected that the net force would have superposition. Thanks again alphysicist Homework Helper Thank you so much for your reply. I totally neglected that the net force would have superposition. Thanks again
2021-10-27 02:49: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": 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.6517526507377625, "perplexity": 579.8848172734113}, "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-2021-43/segments/1634323588053.38/warc/CC-MAIN-20211027022823-20211027052823-00434.warc.gz"}
http://math.stackexchange.com/questions/107772/if-x-n-to-overlinea-does-it-mean-that-x-n-to-a
# If $x_n\to \overline{A}$ does it mean that $x_n\to A$? Let $(X,d)$ be a metric space. The sequence $(x_n)$ converge to the set $A\subset X$ (denoted as $x_n\to A$) iff $$\lim\limits_n d(x_n,A) = 0$$ where $d(x;A) = \inf\limits_{y\in A}d(x,y)$. Let $\overline A$ be the closure of $A$, and $x_n\to \overline A$. Does it mean that $x_n\to A$? - Let $\varepsilon>0$, and $n_0$ such that for $n\geq n_0$ $d(x_n,\bar A)\leq \varepsilon$. Let $a_n\in \bar A$ such that $d(x_n,a_n)<2\varepsilon$, and $a_n'\in A$ such that $d(a_n,a_n')\leq\varepsilon$. We have $$\forall n\geq n_0:\quad d(x_n,A)\leq d(x_n,a_n')\leq d(x_n,a_n)+d(a_n,a_n')\leq 3\varepsilon,$$ so $x_n\to A$. Thanks! I think now, that we can also show first that $d(x;A) = d(x,\bar A)$ –  Ilya Feb 10 '12 at 10:17
2014-03-12 18:14:27
{"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.9955058097839355, "perplexity": 74.34841388639732}, "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-10/segments/1394023864525/warc/CC-MAIN-20140305125104-00030-ip-10-183-142-35.ec2.internal.warc.gz"}
https://techutils.in/blog/tag/asymptotics/
## #StackBounty: #mixed-model #biostatistics #asymptotics #auc #asymptotic-covariance Mixed Model in a repeated measurement design and AUC ### Bounty: 50 I have data on healthy patients and patients with cancer. My goal is to predict the cancer risk for each patient based on certain biological markers. Since I have repeated measurements, I was told to use a mixed model strategy, i.e. I assume that $$mathbb P(text{patient i has cancer}mid x_i) = frac{1}{1+ exp(-x_icdotbeta – mu_i)},$$ where $$x_i$$ is the vector of biological markers of patient $$i$$, $$mu_i$$ is the random effect to account for repeated measurements, and $$beta$$ is the (unknown) coefficient vector. Here $$cdot$$ denotes the usual Euclidean inner product. The quality of my model is assessed by the $$AUC$$. I know how to compute the $$AUC$$ and in a previous question here on CV, it was clarified why I can expect the $$AUC$$ to be asymptotically normal. However, all proofs for asymptotic normality of the $$AUC$$ assume independent observations, which is not the case here due to repeated measurements. I suppose that the normality argument still holds as there are CLTs for dependent data. However, I could not find any proofs for asymptotic normality of an $$AUC$$ in such a setting. This made me think about whether I would even have to worry as I account for repeated measurements in my model, which is used to obtain the $$AUC$$. I am very confused (mainly because I spent thinking about this issue for the last couple of days). So my key questions are: 1. Can I expect the $$AUC$$ to be asymptotically normal in the given setting, and if so why. 2. How would I account for the repeated measurements in the variance of the $$AUC$$? Do I even have to bother given the fact that I account for repeated measurements in the model. Get this bounty!!! ## #StackBounty: #sampling #asymptotics #measure-theory #survey-sampling #influence-function How is the asymptotic justification of the &q… ### Bounty: 50 The `survey` R package recently adopted the "linearization by influence function" method of estimating covariances between domain estimates. The central paper justifying this method is Deville (1999). I’m trying to understand the main asymptotic claim made in the paper and some confusing aspects of the proof. The result is summarized concisely by Deville and others in this 2009 Biometrika paper: In Deville’s approach, a population parameter of interest $$Phi$$ can be written as a functional $$T$$ with respect to a finite and discrete measure $$M$$, namely $$Phi=T(M)$$. The substitution estimator $$hat{Phi}=T(hat{M})$$ is the functional $$T$$ of a random measure $$hat{M}$$ that is associated with sampling weights $$w_{k}, k in U$$, and is ‘close’ to $$M$$. Suppose that $$T$$ is homogeneous of degree $$alpha$$, so that $$T(r M)=r^{alpha} T(M)$$, and $$lim _{N rightarrow infty} N^{-alpha} T(M). Under broad assumptions, Deville shows that begin{aligned} sqrt{n} N^{-alpha}{T(hat{M})-T(M)} &=sqrt{n} N^{-alpha} int I_{T}(M, z) d(hat{M}-M)(z)+o_{p}(1) \ &=sqrt{n} N^{-alpha} sum_{k=1}^{N} u_{k}left(w_{k}-1right)+o_{p}(1) end{aligned} The linearized variables $$u_{k}$$ are the influence functions $$I_{T}left(M, z_{k}right)$$, where $$z_{k}$$ is the value of the variable of interest for the $$k$$ th unit. This exact equation doesn’t show up in Deville’s 1999 paper as far as I can see. Instead, there is a tantalizingly similar-looking result on page 6. Result: Under broad assumptions, the substitution estimation of a functional $$T(M)$$ is linearizable. A linearized variable is $$z_{k}=I Tleft(M ; x_{k}right)$$ where $$I T$$ is the influence function of $$T$$ in $$M$$. Proof of the result: Let us provide the space of measurements on $$boldsymbol{R}^{q}$$ with a metric $$d$$ accounting for the convergence: $$dleft(M_{1}, M_{2}right) rightarrow 0$$ if and only if $$N^{-1}left(int y d M_{1}-int y d M_{2}right) rightarrow 0$$ for any variable of interest $$y$$. The asymptotic postulates mean that $$d(hat{M} / N, M / N)$$ tends towards zero. We can visibly ensure that $$d(hat{M} / N, M / N)$$ is $$O_{p}(1 / sqrt{n})$$ according to the third postulate. Now, let us assume that $$T$$ can be derived in accordance with Fréchet, i.e., for any direction of the increase, in the space of "useful" measures provided with the abovementioned metric. Thus we have: $$N^{-alpha}(T(hat{M})-T(M))=frac{1}{N} sum_{U} z_{k}left(w_{k}-1right)+oleft(dleft(frac{hat{M}}{M}, frac{M}{N}right)right)$$ The result is that: $$sqrt{n} N^{-alpha}(T(hat{M})-T(M))=frac{sqrt{n}}{N} sum_{U} z_{k}left(w_{k}-1right)+o_{p}(1) .$$ However, this result in the original 1999 paper is not the same result as the 2009 Biometrika paper. Why does the right-hand side of the Deville 1999 equation use $$N^{-1}$$, while the right-hand side of the quoted equation in the 2009 paper uses $$N^{-alpha}$$? The equation in Deville 1999 doesn’t make sense to me. For example, the mean is a statistic of degree 0 and its influence function is $$z_{k}=frac{1}{N}left(y_{k}-bar{Y}right)$$, so with the Deville 1999 equation we would end up with the nonsensical result that $$sqrt{n}(hat{bar{Y}} – bar{Y}) = frac{sqrt{n}}{N} left[hat{bar{Y}} – bar{Y}(frac{hat{N}}{N}) right] + o_p(1)$$. And the proof seems to contain some hidden steps. How is that first equation in Deville 1999 derived? It seems to involve the following missing step, but it’s not clear how even this equation would be established. $$N^{-alpha}(T(hat{M})-T(M))= N^{-1} int I_{T}(M, z) d(hat{M}-M)(z)+oleft(dleft(frac{hat{M}}{M}, frac{M}{N}right)right)$$ Get this bounty!!! ## #StackBounty: #sampling #asymptotics #measure-theory #survey-sampling #influence-function How is the asymptotic justification of the &q… ### Bounty: 50 The `survey` R package recently adopted the "linearization by influence function" method of estimating covariances between domain estimates. The central paper justifying this method is Deville (1999). I’m trying to understand the main asymptotic claim made in the paper and some confusing aspects of the proof. The result is summarized concisely by Deville and others in this 2009 Biometrika paper: In Deville’s approach, a population parameter of interest $$Phi$$ can be written as a functional $$T$$ with respect to a finite and discrete measure $$M$$, namely $$Phi=T(M)$$. The substitution estimator $$hat{Phi}=T(hat{M})$$ is the functional $$T$$ of a random measure $$hat{M}$$ that is associated with sampling weights $$w_{k}, k in U$$, and is ‘close’ to $$M$$. Suppose that $$T$$ is homogeneous of degree $$alpha$$, so that $$T(r M)=r^{alpha} T(M)$$, and $$lim _{N rightarrow infty} N^{-alpha} T(M). Under broad assumptions, Deville shows that begin{aligned} sqrt{n} N^{-alpha}{T(hat{M})-T(M)} &=sqrt{n} N^{-alpha} int I_{T}(M, z) d(hat{M}-M)(z)+o_{p}(1) \ &=sqrt{n} N^{-alpha} sum_{k=1}^{N} u_{k}left(w_{k}-1right)+o_{p}(1) end{aligned} The linearized variables $$u_{k}$$ are the influence functions $$I_{T}left(M, z_{k}right)$$, where $$z_{k}$$ is the value of the variable of interest for the $$k$$ th unit. This exact equation doesn’t show up in Deville’s 1999 paper as far as I can see. Instead, there is a tantalizingly similar-looking result on page 6. Result: Under broad assumptions, the substitution estimation of a functional $$T(M)$$ is linearizable. A linearized variable is $$z_{k}=I Tleft(M ; x_{k}right)$$ where $$I T$$ is the influence function of $$T$$ in $$M$$. Proof of the result: Let us provide the space of measurements on $$boldsymbol{R}^{q}$$ with a metric $$d$$ accounting for the convergence: $$dleft(M_{1}, M_{2}right) rightarrow 0$$ if and only if $$N^{-1}left(int y d M_{1}-int y d M_{2}right) rightarrow 0$$ for any variable of interest $$y$$. The asymptotic postulates mean that $$d(hat{M} / N, M / N)$$ tends towards zero. We can visibly ensure that $$d(hat{M} / N, M / N)$$ is $$O_{p}(1 / sqrt{n})$$ according to the third postulate. Now, let us assume that $$T$$ can be derived in accordance with Fréchet, i.e., for any direction of the increase, in the space of "useful" measures provided with the abovementioned metric. Thus we have: $$N^{-alpha}(T(hat{M})-T(M))=frac{1}{N} sum_{U} z_{k}left(w_{k}-1right)+oleft(dleft(frac{hat{M}}{M}, frac{M}{N}right)right)$$ The result is that: $$sqrt{n} N^{-alpha}(T(hat{M})-T(M))=frac{sqrt{n}}{N} sum_{U} z_{k}left(w_{k}-1right)+o_{p}(1) .$$ However, this result in the original 1999 paper is not the same result as the 2009 Biometrika paper. Why does the right-hand side of the Deville 1999 equation use $$N^{-1}$$, while the right-hand side of the quoted equation in the 2009 paper uses $$N^{-alpha}$$? The equation in Deville 1999 doesn’t make sense to me. For example, the mean is a statistic of degree 0 and its influence function is $$z_{k}=frac{1}{N}left(y_{k}-bar{Y}right)$$, so with the Deville 1999 equation we would end up with the nonsensical result that $$sqrt{n}(hat{bar{Y}} – bar{Y}) = frac{sqrt{n}}{N} left[hat{bar{Y}} – bar{Y}(frac{hat{N}}{N}) right] + o_p(1)$$. And the proof seems to contain some hidden steps. How is that first equation in Deville 1999 derived? It seems to involve the following missing step, but it’s not clear how even this equation would be established. $$N^{-alpha}(T(hat{M})-T(M))= N^{-1} int I_{T}(M, z) d(hat{M}-M)(z)+oleft(dleft(frac{hat{M}}{M}, frac{M}{N}right)right)$$ Get this bounty!!! ## #StackBounty: #sampling #asymptotics #measure-theory #survey-sampling #influence-function How is the asymptotic justification of the &q… ### Bounty: 50 The `survey` R package recently adopted the "linearization by influence function" method of estimating covariances between domain estimates. The central paper justifying this method is Deville (1999). I’m trying to understand the main asymptotic claim made in the paper and some confusing aspects of the proof. The result is summarized concisely by Deville and others in this 2009 Biometrika paper: In Deville’s approach, a population parameter of interest $$Phi$$ can be written as a functional $$T$$ with respect to a finite and discrete measure $$M$$, namely $$Phi=T(M)$$. The substitution estimator $$hat{Phi}=T(hat{M})$$ is the functional $$T$$ of a random measure $$hat{M}$$ that is associated with sampling weights $$w_{k}, k in U$$, and is ‘close’ to $$M$$. Suppose that $$T$$ is homogeneous of degree $$alpha$$, so that $$T(r M)=r^{alpha} T(M)$$, and $$lim _{N rightarrow infty} N^{-alpha} T(M). Under broad assumptions, Deville shows that begin{aligned} sqrt{n} N^{-alpha}{T(hat{M})-T(M)} &=sqrt{n} N^{-alpha} int I_{T}(M, z) d(hat{M}-M)(z)+o_{p}(1) \ &=sqrt{n} N^{-alpha} sum_{k=1}^{N} u_{k}left(w_{k}-1right)+o_{p}(1) end{aligned} The linearized variables $$u_{k}$$ are the influence functions $$I_{T}left(M, z_{k}right)$$, where $$z_{k}$$ is the value of the variable of interest for the $$k$$ th unit. This exact equation doesn’t show up in Deville’s 1999 paper as far as I can see. Instead, there is a tantalizingly similar-looking result on page 6. Result: Under broad assumptions, the substitution estimation of a functional $$T(M)$$ is linearizable. A linearized variable is $$z_{k}=I Tleft(M ; x_{k}right)$$ where $$I T$$ is the influence function of $$T$$ in $$M$$. Proof of the result: Let us provide the space of measurements on $$boldsymbol{R}^{q}$$ with a metric $$d$$ accounting for the convergence: $$dleft(M_{1}, M_{2}right) rightarrow 0$$ if and only if $$N^{-1}left(int y d M_{1}-int y d M_{2}right) rightarrow 0$$ for any variable of interest $$y$$. The asymptotic postulates mean that $$d(hat{M} / N, M / N)$$ tends towards zero. We can visibly ensure that $$d(hat{M} / N, M / N)$$ is $$O_{p}(1 / sqrt{n})$$ according to the third postulate. Now, let us assume that $$T$$ can be derived in accordance with Fréchet, i.e., for any direction of the increase, in the space of "useful" measures provided with the abovementioned metric. Thus we have: $$N^{-alpha}(T(hat{M})-T(M))=frac{1}{N} sum_{U} z_{k}left(w_{k}-1right)+oleft(dleft(frac{hat{M}}{M}, frac{M}{N}right)right)$$ The result is that: $$sqrt{n} N^{-alpha}(T(hat{M})-T(M))=frac{sqrt{n}}{N} sum_{U} z_{k}left(w_{k}-1right)+o_{p}(1) .$$ However, this result in the original 1999 paper is not the same result as the 2009 Biometrika paper. Why does the right-hand side of the Deville 1999 equation use $$N^{-1}$$, while the right-hand side of the quoted equation in the 2009 paper uses $$N^{-alpha}$$? The equation in Deville 1999 doesn’t make sense to me. For example, the mean is a statistic of degree 0 and its influence function is $$z_{k}=frac{1}{N}left(y_{k}-bar{Y}right)$$, so with the Deville 1999 equation we would end up with the nonsensical result that $$sqrt{n}(hat{bar{Y}} – bar{Y}) = frac{sqrt{n}}{N} left[hat{bar{Y}} – bar{Y}(frac{hat{N}}{N}) right] + o_p(1)$$. And the proof seems to contain some hidden steps. How is that first equation in Deville 1999 derived? It seems to involve the following missing step, but it’s not clear how even this equation would be established. $$N^{-alpha}(T(hat{M})-T(M))= N^{-1} int I_{T}(M, z) d(hat{M}-M)(z)+oleft(dleft(frac{hat{M}}{M}, frac{M}{N}right)right)$$ Get this bounty!!! ## #StackBounty: #sampling #asymptotics #measure-theory #survey-sampling #influence-function How is the asymptotic justification of the &q… ### Bounty: 50 The `survey` R package recently adopted the "linearization by influence function" method of estimating covariances between domain estimates. The central paper justifying this method is Deville (1999). I’m trying to understand the main asymptotic claim made in the paper and some confusing aspects of the proof. The result is summarized concisely by Deville and others in this 2009 Biometrika paper: In Deville’s approach, a population parameter of interest $$Phi$$ can be written as a functional $$T$$ with respect to a finite and discrete measure $$M$$, namely $$Phi=T(M)$$. The substitution estimator $$hat{Phi}=T(hat{M})$$ is the functional $$T$$ of a random measure $$hat{M}$$ that is associated with sampling weights $$w_{k}, k in U$$, and is ‘close’ to $$M$$. Suppose that $$T$$ is homogeneous of degree $$alpha$$, so that $$T(r M)=r^{alpha} T(M)$$, and $$lim _{N rightarrow infty} N^{-alpha} T(M). Under broad assumptions, Deville shows that begin{aligned} sqrt{n} N^{-alpha}{T(hat{M})-T(M)} &=sqrt{n} N^{-alpha} int I_{T}(M, z) d(hat{M}-M)(z)+o_{p}(1) \ &=sqrt{n} N^{-alpha} sum_{k=1}^{N} u_{k}left(w_{k}-1right)+o_{p}(1) end{aligned} The linearized variables $$u_{k}$$ are the influence functions $$I_{T}left(M, z_{k}right)$$, where $$z_{k}$$ is the value of the variable of interest for the $$k$$ th unit. This exact equation doesn’t show up in Deville’s 1999 paper as far as I can see. Instead, there is a tantalizingly similar-looking result on page 6. Result: Under broad assumptions, the substitution estimation of a functional $$T(M)$$ is linearizable. A linearized variable is $$z_{k}=I Tleft(M ; x_{k}right)$$ where $$I T$$ is the influence function of $$T$$ in $$M$$. Proof of the result: Let us provide the space of measurements on $$boldsymbol{R}^{q}$$ with a metric $$d$$ accounting for the convergence: $$dleft(M_{1}, M_{2}right) rightarrow 0$$ if and only if $$N^{-1}left(int y d M_{1}-int y d M_{2}right) rightarrow 0$$ for any variable of interest $$y$$. The asymptotic postulates mean that $$d(hat{M} / N, M / N)$$ tends towards zero. We can visibly ensure that $$d(hat{M} / N, M / N)$$ is $$O_{p}(1 / sqrt{n})$$ according to the third postulate. Now, let us assume that $$T$$ can be derived in accordance with Fréchet, i.e., for any direction of the increase, in the space of "useful" measures provided with the abovementioned metric. Thus we have: $$N^{-alpha}(T(hat{M})-T(M))=frac{1}{N} sum_{U} z_{k}left(w_{k}-1right)+oleft(dleft(frac{hat{M}}{M}, frac{M}{N}right)right)$$ The result is that: $$sqrt{n} N^{-alpha}(T(hat{M})-T(M))=frac{sqrt{n}}{N} sum_{U} z_{k}left(w_{k}-1right)+o_{p}(1) .$$ However, this result in the original 1999 paper is not the same result as the 2009 Biometrika paper. Why does the right-hand side of the Deville 1999 equation use $$N^{-1}$$, while the right-hand side of the quoted equation in the 2009 paper uses $$N^{-alpha}$$? The equation in Deville 1999 doesn’t make sense to me. For example, the mean is a statistic of degree 0 and its influence function is $$z_{k}=frac{1}{N}left(y_{k}-bar{Y}right)$$, so with the Deville 1999 equation we would end up with the nonsensical result that $$sqrt{n}(hat{bar{Y}} – bar{Y}) = frac{sqrt{n}}{N} left[hat{bar{Y}} – bar{Y}(frac{hat{N}}{N}) right] + o_p(1)$$. And the proof seems to contain some hidden steps. How is that first equation in Deville 1999 derived? It seems to involve the following missing step, but it’s not clear how even this equation would be established. $$N^{-alpha}(T(hat{M})-T(M))= N^{-1} int I_{T}(M, z) d(hat{M}-M)(z)+oleft(dleft(frac{hat{M}}{M}, frac{M}{N}right)right)$$ Get this bounty!!! ## #StackBounty: #sampling #asymptotics #measure-theory #survey-sampling #influence-function How is the asymptotic justification of the &q… ### Bounty: 50 The `survey` R package recently adopted the "linearization by influence function" method of estimating covariances between domain estimates. The central paper justifying this method is Deville (1999). I’m trying to understand the main asymptotic claim made in the paper and some confusing aspects of the proof. The result is summarized concisely by Deville and others in this 2009 Biometrika paper: In Deville’s approach, a population parameter of interest $$Phi$$ can be written as a functional $$T$$ with respect to a finite and discrete measure $$M$$, namely $$Phi=T(M)$$. The substitution estimator $$hat{Phi}=T(hat{M})$$ is the functional $$T$$ of a random measure $$hat{M}$$ that is associated with sampling weights $$w_{k}, k in U$$, and is ‘close’ to $$M$$. Suppose that $$T$$ is homogeneous of degree $$alpha$$, so that $$T(r M)=r^{alpha} T(M)$$, and $$lim _{N rightarrow infty} N^{-alpha} T(M). Under broad assumptions, Deville shows that begin{aligned} sqrt{n} N^{-alpha}{T(hat{M})-T(M)} &=sqrt{n} N^{-alpha} int I_{T}(M, z) d(hat{M}-M)(z)+o_{p}(1) \ &=sqrt{n} N^{-alpha} sum_{k=1}^{N} u_{k}left(w_{k}-1right)+o_{p}(1) end{aligned} The linearized variables $$u_{k}$$ are the influence functions $$I_{T}left(M, z_{k}right)$$, where $$z_{k}$$ is the value of the variable of interest for the $$k$$ th unit. This exact equation doesn’t show up in Deville’s 1999 paper as far as I can see. Instead, there is a tantalizingly similar-looking result on page 6. Result: Under broad assumptions, the substitution estimation of a functional $$T(M)$$ is linearizable. A linearized variable is $$z_{k}=I Tleft(M ; x_{k}right)$$ where $$I T$$ is the influence function of $$T$$ in $$M$$. Proof of the result: Let us provide the space of measurements on $$boldsymbol{R}^{q}$$ with a metric $$d$$ accounting for the convergence: $$dleft(M_{1}, M_{2}right) rightarrow 0$$ if and only if $$N^{-1}left(int y d M_{1}-int y d M_{2}right) rightarrow 0$$ for any variable of interest $$y$$. The asymptotic postulates mean that $$d(hat{M} / N, M / N)$$ tends towards zero. We can visibly ensure that $$d(hat{M} / N, M / N)$$ is $$O_{p}(1 / sqrt{n})$$ according to the third postulate. Now, let us assume that $$T$$ can be derived in accordance with Fréchet, i.e., for any direction of the increase, in the space of "useful" measures provided with the abovementioned metric. Thus we have: $$N^{-alpha}(T(hat{M})-T(M))=frac{1}{N} sum_{U} z_{k}left(w_{k}-1right)+oleft(dleft(frac{hat{M}}{M}, frac{M}{N}right)right)$$ The result is that: $$sqrt{n} N^{-alpha}(T(hat{M})-T(M))=frac{sqrt{n}}{N} sum_{U} z_{k}left(w_{k}-1right)+o_{p}(1) .$$ However, this result in the original 1999 paper is not the same result as the 2009 Biometrika paper. Why does the right-hand side of the Deville 1999 equation use $$N^{-1}$$, while the right-hand side of the quoted equation in the 2009 paper uses $$N^{-alpha}$$? The equation in Deville 1999 doesn’t make sense to me. For example, the mean is a statistic of degree 0 and its influence function is $$z_{k}=frac{1}{N}left(y_{k}-bar{Y}right)$$, so with the Deville 1999 equation we would end up with the nonsensical result that $$sqrt{n}(hat{bar{Y}} – bar{Y}) = frac{sqrt{n}}{N} left[hat{bar{Y}} – bar{Y}(frac{hat{N}}{N}) right] + o_p(1)$$. And the proof seems to contain some hidden steps. How is that first equation in Deville 1999 derived? It seems to involve the following missing step, but it’s not clear how even this equation would be established. $$N^{-alpha}(T(hat{M})-T(M))= N^{-1} int I_{T}(M, z) d(hat{M}-M)(z)+oleft(dleft(frac{hat{M}}{M}, frac{M}{N}right)right)$$ Get this bounty!!! ## #StackBounty: #sampling #asymptotics #measure-theory #survey-sampling #influence-function How is the asymptotic justification of the &q… ### Bounty: 50 The `survey` R package recently adopted the "linearization by influence function" method of estimating covariances between domain estimates. The central paper justifying this method is Deville (1999). I’m trying to understand the main asymptotic claim made in the paper and some confusing aspects of the proof. The result is summarized concisely by Deville and others in this 2009 Biometrika paper: In Deville’s approach, a population parameter of interest $$Phi$$ can be written as a functional $$T$$ with respect to a finite and discrete measure $$M$$, namely $$Phi=T(M)$$. The substitution estimator $$hat{Phi}=T(hat{M})$$ is the functional $$T$$ of a random measure $$hat{M}$$ that is associated with sampling weights $$w_{k}, k in U$$, and is ‘close’ to $$M$$. Suppose that $$T$$ is homogeneous of degree $$alpha$$, so that $$T(r M)=r^{alpha} T(M)$$, and $$lim _{N rightarrow infty} N^{-alpha} T(M). Under broad assumptions, Deville shows that begin{aligned} sqrt{n} N^{-alpha}{T(hat{M})-T(M)} &=sqrt{n} N^{-alpha} int I_{T}(M, z) d(hat{M}-M)(z)+o_{p}(1) \ &=sqrt{n} N^{-alpha} sum_{k=1}^{N} u_{k}left(w_{k}-1right)+o_{p}(1) end{aligned} The linearized variables $$u_{k}$$ are the influence functions $$I_{T}left(M, z_{k}right)$$, where $$z_{k}$$ is the value of the variable of interest for the $$k$$ th unit. This exact equation doesn’t show up in Deville’s 1999 paper as far as I can see. Instead, there is a tantalizingly similar-looking result on page 6. Result: Under broad assumptions, the substitution estimation of a functional $$T(M)$$ is linearizable. A linearized variable is $$z_{k}=I Tleft(M ; x_{k}right)$$ where $$I T$$ is the influence function of $$T$$ in $$M$$. Proof of the result: Let us provide the space of measurements on $$boldsymbol{R}^{q}$$ with a metric $$d$$ accounting for the convergence: $$dleft(M_{1}, M_{2}right) rightarrow 0$$ if and only if $$N^{-1}left(int y d M_{1}-int y d M_{2}right) rightarrow 0$$ for any variable of interest $$y$$. The asymptotic postulates mean that $$d(hat{M} / N, M / N)$$ tends towards zero. We can visibly ensure that $$d(hat{M} / N, M / N)$$ is $$O_{p}(1 / sqrt{n})$$ according to the third postulate. Now, let us assume that $$T$$ can be derived in accordance with Fréchet, i.e., for any direction of the increase, in the space of "useful" measures provided with the abovementioned metric. Thus we have: $$N^{-alpha}(T(hat{M})-T(M))=frac{1}{N} sum_{U} z_{k}left(w_{k}-1right)+oleft(dleft(frac{hat{M}}{M}, frac{M}{N}right)right)$$ The result is that: $$sqrt{n} N^{-alpha}(T(hat{M})-T(M))=frac{sqrt{n}}{N} sum_{U} z_{k}left(w_{k}-1right)+o_{p}(1) .$$ However, this result in the original 1999 paper is not the same result as the 2009 Biometrika paper. Why does the right-hand side of the Deville 1999 equation use $$N^{-1}$$, while the right-hand side of the quoted equation in the 2009 paper uses $$N^{-alpha}$$? The equation in Deville 1999 doesn’t make sense to me. For example, the mean is a statistic of degree 0 and its influence function is $$z_{k}=frac{1}{N}left(y_{k}-bar{Y}right)$$, so with the Deville 1999 equation we would end up with the nonsensical result that $$sqrt{n}(hat{bar{Y}} – bar{Y}) = frac{sqrt{n}}{N} left[hat{bar{Y}} – bar{Y}(frac{hat{N}}{N}) right] + o_p(1)$$. And the proof seems to contain some hidden steps. How is that first equation in Deville 1999 derived? It seems to involve the following missing step, but it’s not clear how even this equation would be established. $$N^{-alpha}(T(hat{M})-T(M))= N^{-1} int I_{T}(M, z) d(hat{M}-M)(z)+oleft(dleft(frac{hat{M}}{M}, frac{M}{N}right)right)$$ Get this bounty!!! ## #StackBounty: #sampling #asymptotics #measure-theory #survey-sampling #influence-function How is the asymptotic justification of the &q… ### Bounty: 50 The `survey` R package recently adopted the "linearization by influence function" method of estimating covariances between domain estimates. The central paper justifying this method is Deville (1999). I’m trying to understand the main asymptotic claim made in the paper and some confusing aspects of the proof. The result is summarized concisely by Deville and others in this 2009 Biometrika paper: In Deville’s approach, a population parameter of interest $$Phi$$ can be written as a functional $$T$$ with respect to a finite and discrete measure $$M$$, namely $$Phi=T(M)$$. The substitution estimator $$hat{Phi}=T(hat{M})$$ is the functional $$T$$ of a random measure $$hat{M}$$ that is associated with sampling weights $$w_{k}, k in U$$, and is ‘close’ to $$M$$. Suppose that $$T$$ is homogeneous of degree $$alpha$$, so that $$T(r M)=r^{alpha} T(M)$$, and $$lim _{N rightarrow infty} N^{-alpha} T(M). Under broad assumptions, Deville shows that begin{aligned} sqrt{n} N^{-alpha}{T(hat{M})-T(M)} &=sqrt{n} N^{-alpha} int I_{T}(M, z) d(hat{M}-M)(z)+o_{p}(1) \ &=sqrt{n} N^{-alpha} sum_{k=1}^{N} u_{k}left(w_{k}-1right)+o_{p}(1) end{aligned} The linearized variables $$u_{k}$$ are the influence functions $$I_{T}left(M, z_{k}right)$$, where $$z_{k}$$ is the value of the variable of interest for the $$k$$ th unit. This exact equation doesn’t show up in Deville’s 1999 paper as far as I can see. Instead, there is a tantalizingly similar-looking result on page 6. Result: Under broad assumptions, the substitution estimation of a functional $$T(M)$$ is linearizable. A linearized variable is $$z_{k}=I Tleft(M ; x_{k}right)$$ where $$I T$$ is the influence function of $$T$$ in $$M$$. Proof of the result: Let us provide the space of measurements on $$boldsymbol{R}^{q}$$ with a metric $$d$$ accounting for the convergence: $$dleft(M_{1}, M_{2}right) rightarrow 0$$ if and only if $$N^{-1}left(int y d M_{1}-int y d M_{2}right) rightarrow 0$$ for any variable of interest $$y$$. The asymptotic postulates mean that $$d(hat{M} / N, M / N)$$ tends towards zero. We can visibly ensure that $$d(hat{M} / N, M / N)$$ is $$O_{p}(1 / sqrt{n})$$ according to the third postulate. Now, let us assume that $$T$$ can be derived in accordance with Fréchet, i.e., for any direction of the increase, in the space of "useful" measures provided with the abovementioned metric. Thus we have: $$N^{-alpha}(T(hat{M})-T(M))=frac{1}{N} sum_{U} z_{k}left(w_{k}-1right)+oleft(dleft(frac{hat{M}}{M}, frac{M}{N}right)right)$$ The result is that: $$sqrt{n} N^{-alpha}(T(hat{M})-T(M))=frac{sqrt{n}}{N} sum_{U} z_{k}left(w_{k}-1right)+o_{p}(1) .$$ However, this result in the original 1999 paper is not the same result as the 2009 Biometrika paper. Why does the right-hand side of the Deville 1999 equation use $$N^{-1}$$, while the right-hand side of the quoted equation in the 2009 paper uses $$N^{-alpha}$$? The equation in Deville 1999 doesn’t make sense to me. For example, the mean is a statistic of degree 0 and its influence function is $$z_{k}=frac{1}{N}left(y_{k}-bar{Y}right)$$, so with the Deville 1999 equation we would end up with the nonsensical result that $$sqrt{n}(hat{bar{Y}} – bar{Y}) = frac{sqrt{n}}{N} left[hat{bar{Y}} – bar{Y}(frac{hat{N}}{N}) right] + o_p(1)$$. And the proof seems to contain some hidden steps. How is that first equation in Deville 1999 derived? It seems to involve the following missing step, but it’s not clear how even this equation would be established. $$N^{-alpha}(T(hat{M})-T(M))= N^{-1} int I_{T}(M, z) d(hat{M}-M)(z)+oleft(dleft(frac{hat{M}}{M}, frac{M}{N}right)right)$$ Get this bounty!!! ## #StackBounty: #sampling #asymptotics #measure-theory #survey-sampling #influence-function How is the asymptotic justification of the &q… ### Bounty: 50 The `survey` R package recently adopted the "linearization by influence function" method of estimating covariances between domain estimates. The central paper justifying this method is Deville (1999). I’m trying to understand the main asymptotic claim made in the paper and some confusing aspects of the proof. The result is summarized concisely by Deville and others in this 2009 Biometrika paper: In Deville’s approach, a population parameter of interest $$Phi$$ can be written as a functional $$T$$ with respect to a finite and discrete measure $$M$$, namely $$Phi=T(M)$$. The substitution estimator $$hat{Phi}=T(hat{M})$$ is the functional $$T$$ of a random measure $$hat{M}$$ that is associated with sampling weights $$w_{k}, k in U$$, and is ‘close’ to $$M$$. Suppose that $$T$$ is homogeneous of degree $$alpha$$, so that $$T(r M)=r^{alpha} T(M)$$, and $$lim _{N rightarrow infty} N^{-alpha} T(M). Under broad assumptions, Deville shows that begin{aligned} sqrt{n} N^{-alpha}{T(hat{M})-T(M)} &=sqrt{n} N^{-alpha} int I_{T}(M, z) d(hat{M}-M)(z)+o_{p}(1) \ &=sqrt{n} N^{-alpha} sum_{k=1}^{N} u_{k}left(w_{k}-1right)+o_{p}(1) end{aligned} The linearized variables $$u_{k}$$ are the influence functions $$I_{T}left(M, z_{k}right)$$, where $$z_{k}$$ is the value of the variable of interest for the $$k$$ th unit. This exact equation doesn’t show up in Deville’s 1999 paper as far as I can see. Instead, there is a tantalizingly similar-looking result on page 6. Result: Under broad assumptions, the substitution estimation of a functional $$T(M)$$ is linearizable. A linearized variable is $$z_{k}=I Tleft(M ; x_{k}right)$$ where $$I T$$ is the influence function of $$T$$ in $$M$$. Proof of the result: Let us provide the space of measurements on $$boldsymbol{R}^{q}$$ with a metric $$d$$ accounting for the convergence: $$dleft(M_{1}, M_{2}right) rightarrow 0$$ if and only if $$N^{-1}left(int y d M_{1}-int y d M_{2}right) rightarrow 0$$ for any variable of interest $$y$$. The asymptotic postulates mean that $$d(hat{M} / N, M / N)$$ tends towards zero. We can visibly ensure that $$d(hat{M} / N, M / N)$$ is $$O_{p}(1 / sqrt{n})$$ according to the third postulate. Now, let us assume that $$T$$ can be derived in accordance with Fréchet, i.e., for any direction of the increase, in the space of "useful" measures provided with the abovementioned metric. Thus we have: $$N^{-alpha}(T(hat{M})-T(M))=frac{1}{N} sum_{U} z_{k}left(w_{k}-1right)+oleft(dleft(frac{hat{M}}{M}, frac{M}{N}right)right)$$ The result is that: $$sqrt{n} N^{-alpha}(T(hat{M})-T(M))=frac{sqrt{n}}{N} sum_{U} z_{k}left(w_{k}-1right)+o_{p}(1) .$$ However, this result in the original 1999 paper is not the same result as the 2009 Biometrika paper. Why does the right-hand side of the Deville 1999 equation use $$N^{-1}$$, while the right-hand side of the quoted equation in the 2009 paper uses $$N^{-alpha}$$? The equation in Deville 1999 doesn’t make sense to me. For example, the mean is a statistic of degree 0 and its influence function is $$z_{k}=frac{1}{N}left(y_{k}-bar{Y}right)$$, so with the Deville 1999 equation we would end up with the nonsensical result that $$sqrt{n}(hat{bar{Y}} – bar{Y}) = frac{sqrt{n}}{N} left[hat{bar{Y}} – bar{Y}(frac{hat{N}}{N}) right] + o_p(1)$$. And the proof seems to contain some hidden steps. How is that first equation in Deville 1999 derived? It seems to involve the following missing step, but it’s not clear how even this equation would be established. $$N^{-alpha}(T(hat{M})-T(M))= N^{-1} int I_{T}(M, z) d(hat{M}-M)(z)+oleft(dleft(frac{hat{M}}{M}, frac{M}{N}right)right)$$ Get this bounty!!! ## #StackBounty: #sampling #asymptotics #measure-theory #survey-sampling #influence-function How is the asymptotic justification of the &q… ### Bounty: 50 The `survey` R package recently adopted the "linearization by influence function" method of estimating covariances between domain estimates. The central paper justifying this method is Deville (1999). I’m trying to understand the main asymptotic claim made in the paper and some confusing aspects of the proof. The result is summarized concisely by Deville and others in this 2009 Biometrika paper: In Deville’s approach, a population parameter of interest $$Phi$$ can be written as a functional $$T$$ with respect to a finite and discrete measure $$M$$, namely $$Phi=T(M)$$. The substitution estimator $$hat{Phi}=T(hat{M})$$ is the functional $$T$$ of a random measure $$hat{M}$$ that is associated with sampling weights $$w_{k}, k in U$$, and is ‘close’ to $$M$$. Suppose that $$T$$ is homogeneous of degree $$alpha$$, so that $$T(r M)=r^{alpha} T(M)$$, and $$lim _{N rightarrow infty} N^{-alpha} T(M). Under broad assumptions, Deville shows that begin{aligned} sqrt{n} N^{-alpha}{T(hat{M})-T(M)} &=sqrt{n} N^{-alpha} int I_{T}(M, z) d(hat{M}-M)(z)+o_{p}(1) \ &=sqrt{n} N^{-alpha} sum_{k=1}^{N} u_{k}left(w_{k}-1right)+o_{p}(1) end{aligned} The linearized variables $$u_{k}$$ are the influence functions $$I_{T}left(M, z_{k}right)$$, where $$z_{k}$$ is the value of the variable of interest for the $$k$$ th unit. This exact equation doesn’t show up in Deville’s 1999 paper as far as I can see. Instead, there is a tantalizingly similar-looking result on page 6. Result: Under broad assumptions, the substitution estimation of a functional $$T(M)$$ is linearizable. A linearized variable is $$z_{k}=I Tleft(M ; x_{k}right)$$ where $$I T$$ is the influence function of $$T$$ in $$M$$. Proof of the result: Let us provide the space of measurements on $$boldsymbol{R}^{q}$$ with a metric $$d$$ accounting for the convergence: $$dleft(M_{1}, M_{2}right) rightarrow 0$$ if and only if $$N^{-1}left(int y d M_{1}-int y d M_{2}right) rightarrow 0$$ for any variable of interest $$y$$. The asymptotic postulates mean that $$d(hat{M} / N, M / N)$$ tends towards zero. We can visibly ensure that $$d(hat{M} / N, M / N)$$ is $$O_{p}(1 / sqrt{n})$$ according to the third postulate. Now, let us assume that $$T$$ can be derived in accordance with Fréchet, i.e., for any direction of the increase, in the space of "useful" measures provided with the abovementioned metric. Thus we have: $$N^{-alpha}(T(hat{M})-T(M))=frac{1}{N} sum_{U} z_{k}left(w_{k}-1right)+oleft(dleft(frac{hat{M}}{M}, frac{M}{N}right)right)$$ The result is that: $$sqrt{n} N^{-alpha}(T(hat{M})-T(M))=frac{sqrt{n}}{N} sum_{U} z_{k}left(w_{k}-1right)+o_{p}(1) .$$ However, this result in the original 1999 paper is not the same result as the 2009 Biometrika paper. Why does the right-hand side of the Deville 1999 equation use $$N^{-1}$$, while the right-hand side of the quoted equation in the 2009 paper uses $$N^{-alpha}$$? The equation in Deville 1999 doesn’t make sense to me. For example, the mean is a statistic of degree 0 and its influence function is $$z_{k}=frac{1}{N}left(y_{k}-bar{Y}right)$$, so with the Deville 1999 equation we would end up with the nonsensical result that $$sqrt{n}(hat{bar{Y}} – bar{Y}) = frac{sqrt{n}}{N} left[hat{bar{Y}} – bar{Y}(frac{hat{N}}{N}) right] + o_p(1)$$. And the proof seems to contain some hidden steps. How is that first equation in Deville 1999 derived? It seems to involve the following missing step, but it’s not clear how even this equation would be established. $$N^{-alpha}(T(hat{M})-T(M))= N^{-1} int I_{T}(M, z) d(hat{M}-M)(z)+oleft(dleft(frac{hat{M}}{M}, frac{M}{N}right)right)$$ Get this bounty!!!
2021-10-25 00:06:46
{"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": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 365, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.7824830412864685, "perplexity": 1259.866815291936}, "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/1634323587608.86/warc/CC-MAIN-20211024235512-20211025025512-00288.warc.gz"}
https://www.vcalc.com/wiki/cjlynch/Income+Elasticity+of+Demand
# Income Elasticity of Demand Not Reviewed Equation / Last modified by cjlynch on 2016/09/18 02:23 "Income Elasticity" = Tags: Rating ID cjlynch.Income Elasticity of Demand UUID 79e445cf-280b-11e6-9770-bc764e2038f2 In economics, income elasticity of demand measures the responsiveness of the quantity demanded for a good or service to a change in the income of the people demanding the good, ceteris paribus. It is calculated as the ratio of the percentage change in quantity demanded to the percentage change in income. For example, if in response to a 10% increase in income, the quantity demanded for a good increased by 20%, the income elasticity of demand would be 20%/10% = 2.
2019-07-22 11:59:24
{"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.6808410286903381, "perplexity": 1362.633522765591}, "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-2019-30/segments/1563195528013.81/warc/CC-MAIN-20190722113215-20190722135215-00104.warc.gz"}
http://cogsci.stackexchange.com/tags/theoretical-neuroscience/new
# Tag Info 0 Doing this sort of comparison is very difficult. First, the brain is not digital by any stretch of the imagination, it is highly analog. Computers, on the other hand, are digital (binary, specifically). So doing a calculation measurement on a brain is hard to begin with. Second, the way they handle tasks is very different. Computers are designed to ... 5 As in the ideal gas law, the universal gas constant allows for calculation of amount of energy associated with a certain group of molecules (see https://en.wikipedia.org/wiki/Gas_constant). As the Nernst equation compares the "osmotic pressure" to "electrical pressure", the universal gas constant is needed to convert amount of an ion on the two sides of a ... 2 The short answer is yes. The longer answer involves a more precise meaning of deterministic and a number of research considerations. In the strict sense of deterministic, which means that given the same input, the same output will always occur, any probability distribution modeled on a computer is deterministic, since most digital computers have a ... 1 First, many neurons don't have action potentials at all, and of those that do some don't encode information based on firing rate (rather they use the timing of spikes or some other code). So the question isn't relevant for all neuron types. Further, even for neurons that do encode information based on firing rate, the "average" is often not a very useful ... 2 The number of types varies depending on exactly how you count, but there are likely thousands, if not tens of thousands. NeuroLex has 775 named neurons, and that is just a fraction of all the neurons that exist. They vary in their size, their shape, the number, length, thickness, and branching pattern of their axons (if any), the number, length, thickness, ... 3 You're basically trying to replicate the work of the Blue Brain Project. To get a good summary of their work, check out their 2015 Cell paper, where they describe assembling a few columns of the rat barrel (whisker sensing) cortex. In this incredibly specialised, small cortex there are a ridiculous amount of neurons (207 electrical sub-types), with a wide ... 5 The phrase "fire together, wire together" comes from an explanation of Hebbian Learning and refers to the adaptation of synapses as a response to the firing of already connected neurons. This is one of several Synaptic Plasticity mechanisms. Two others that exist are Long Term Potentiation (strengthening and creation) and Long Term Depression (weakening and ... 2 This question seems to be asking "How is knowledge represented in neurons" and then jumps to the assumption "synapses represents relations". As discussed in the linked question, there is a lot of evidence that this method of binding is not biologically plausible, given that it doesn't scale well to the level of human vocabulary. So, to answer your question, ... 1 What leaps in technology would be needed to scan the total state of the human brain? Preface In 2016, the "Small Mammal BPF Prize" was won, see: http://www.brainpreservation.org/small-mammal-announcement/. It's the first of two stages of competition for brain preservation (BP) achievements. This competition is doing for BP what XPRIZE is doing for ... 6 Your question can be reduced to "What level of detail do we need to know about a brain to be able to simulate it?" The answer to this question is that we have no idea and that's a problem. The Blue Brain project has bet on the synaptic level, but they haven't been able to scale that up to behaviour yet. But why stop at the synaptic level? Why not go down to ... 0 The simplest equation for getting a BOLD signal from neurotransmitter that I could find was in "Tracing Problem Solving in Real Time: fMRI Analysis of the Subject-paced Tower of Hanoi", which itself references many other publications where it was used: $$H(t)= m \times(t/s)^a\times e^{-(t/s)}$$ The parameters $s$, $a$ and $m$ don't have an explicit meaning.... Top 50 recent answers are included
2016-07-26 19: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": 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.5948768258094788, "perplexity": 961.8748286365625}, "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-30/segments/1469257825124.22/warc/CC-MAIN-20160723071025-00062-ip-10-185-27-174.ec2.internal.warc.gz"}
https://en.wikipedia.org/wiki/Handshaking
# Handshaking In information technology, telecommunications, and related fields, handshaking is an automated process of negotiation that dynamically sets parameters of a communications channel established between two entities before normal communication over the channel begins. It follows the physical establishment of the channel and precedes normal information transfer. The handshaking process usually takes place in order to establish rules for communication when a computer sets about communicating with a foreign device. When a computer communicates with another device like a modem, printer, or network server, it needs to handshake with it to establish a connection. Handshaking can negotiate parameters that are acceptable to equipment and systems at both ends of the communication channel, including information transfer rate, coding alphabet, parity, interrupt procedure, and other protocol or hardware features. Handshaking is a technique of communication between two entities. However, within TCP/IP RFCs, the term "handshake" is most commonly used to reference the TCP three-way handshake. For example, the term "handshake" is not present in RFCs covering FTP or SMTP. One exception is Transport Layer Security, TLS, setup, FTP RFC 4217. In place of the term "handshake", FTP RFC 3659 substitutes the term "conversation" for the passing of commands.[1][2][3] Handshaking facilitates connecting relatively heterogeneous systems or equipment over a communication channel without the need for human intervention to set parameters. ## Examples ### TCP three-way handshake Example of three way handshaking Establishing a normal TCP connection requires three separate steps: 1. The first host (Alice) sends the second host (Bob) a "synchronize" (SYN) message with its own sequence number ${\displaystyle x}$, which Bob receives. 2. Bob replies with a synchronize-acknowledgment (SYN-ACK) message with its own sequence number ${\displaystyle y}$ and acknowledgement number ${\displaystyle x+1}$, which Alice receives. 3. Alice replies with an acknowledgment message with acknowledgement number ${\displaystyle y+1}$, which Bob receives and to which he doesn't need to reply. In this setup, the synchronize messages act as service requests from one server to the other, while the acknowledgement messages return to the requesting server to let it know the message was received. One of the most important factors of three-way handshake is that, in order to exchange the starting sequence number the two sides plan to use, the client first sends a segment with its own initial sequence number ${\displaystyle x}$, then the server responds by sending a segment with its own sequence number ${\displaystyle y}$ and the acknowledgement number ${\displaystyle x+1}$, and finally the client responds by sending a segment with acknowledgement number ${\displaystyle y+1}$. The reason for the client and server not using the default sequence number such as 0 for establishing connection is to protect against two incarnations of the same connection reusing the same sequence number too soon, which means a segment from an earlier incarnation of a connection might interfere with a later incarnation of the connection. ### SMTP The Simple Mail Transfer Protocol (SMTP) is the key Internet standard for email transmission. It includes handshaking to negotiate authentication, encryption and maximum message size. ### TLS handshake When a Transport Layer Security (SSL or TLS) connection starts, the record encapsulates a "control" protocol—the handshake messaging protocol (content type 22). This protocol is used to exchange all the information required by both sides for the exchange of the actual application data by TLS. It defines the messages formatting or containing this information and the order of their exchange. These may vary according to the demands of the client and server—i.e., there are several possible procedures to set up the connection. This initial exchange results in a successful TLS connection (both parties ready to transfer application data with TLS) or an alert message (as specified below). The protocol is used to negotiate the secure attributes of a session. (RFC 5246, p. 37)[5] ### WPA2 wireless The WPA2 standard for wireless uses a four-way handshake defined in IEEE 802.11i-2004. ### Dial-up access modems One classic example of handshaking is that of dial-up modems, which typically negotiate communication parameters for a brief period when a connection is first established, and thereafter use those parameters to provide optimal information transfer over the channel as a function of its quality and capacity. The "squealing" (which is actually a sound that changes in pitch 100 times every second) noises made by some modems with speaker output immediately after a connection is established are in fact the sounds of modems at both ends engaging in a handshaking procedure; once the procedure is completed, the speaker might be silenced, depending on the settings of operating system or the application controlling the modem. ## References 1. ^ TCP RFC 793, 2581 2. ^ SMTP RFC 821,5321, 2821, 1869,6531, 2822 3. ^ FTP 959, 3659 (conversation), 2228,4217 (TLS handshake),5797 4. ^ "handshaking". TheFreeDictionary's Encyclopedia. 5. ^ The Transport Layer Security (TLS) Protocol, version 1.2. IETF. August 2008. RFC 5246.
2017-01-23 07:12:58
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 8, "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.37686195969581604, "perplexity": 3102.451016870234}, "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/1484560282140.72/warc/CC-MAIN-20170116095122-00422-ip-10-171-10-70.ec2.internal.warc.gz"}
https://brief.land/jamm/articles/20796.html
# Ankle Sprains at a Military Male School: Taping Versus Bracing AUTHORS 1 Department of Physical Therapy, Semnan University of Medical Sciences, Semnan, IR Iran 2 Department of AJA University of Medical Sciences, Tehran, IR Iran 3 Community Medicine Department, Shahid Beheshti University of Medical Sciences, Tehran, IR Iran How to Cite: Najafipour F, Najafipour F, Ahmadi A. Ankle Sprains at a Military Male School: Taping Versus Bracing. J Arch Mil Med. 2014;2(3):e22517. doi: 10.5812/jamm.22517. ARTICLE INFORMATION Journal of Archives in Military Medicine: 2 (3); e22517 Published Online: August 30, 2014 Article Type: Research Article Accepted: August 14, 2014 Crossmark CHECKING ### Abstract Background: Functional treatments are widely used and are generally the accepted treatment for ankle sprains. Regarding effectiveness, comparing different functional treatment options could not make definitive conclusions. Objectives: The objective of this article was to compare Taping Versus Bracing for Ankle Sprains injuries. Patients and Methods: All injured individuals with acute ankle sprains received standard advice (rest, ice compression with a compressive bandage, and elevation) at the clinic. After a week, 150 injured individuals with grade II and III sprains were categorized randomly into two groups: one group was treated with tape and the other with a brace for four weeks. Post injury training (proprioceptive and physical) was performed for the two groups. As first outcome parameters patient satisfaction and skin complications were assessed with an organized questionnaire and quantitative scale. As late outcome parameters, the function of ankle joint was evaluated with Karlsson quantitative scale and range of motion (ROM). Results: The study group indicated that satisfaction and comfort during brace treatment increased significantly. A cutaneous complication in the brace group was significantly lower in comparison to the other group (16.4% versus 51.9%). The ankle joint function outcome and perceived pain was the same for both groups. Conclusions: Treating acute ankle sprain with a brace was accompanied with greater satisfaction and less pain with a similarly acceptable outcome when compared to taping. Keywords ### 1. Background One of the most common joint injuries, in particular among military personnel and athletes is acute ankle sprain (1). Overall 50% of these injuries arise during sport activities and in 75% the etiology is a traumatic inversion (2). About 23,000 people in the United States are involved in ankle sprains every day, which sums up to 8,400,000 cases every year (3). Treatments with functional approaches are commonly accepted for ankle sprains. These approaches have many different types. Taping and bracing are the most common functional treatment methods used worldwide and have the best functional outcomes in comparison with elastic bandage and plaster immobilization (4). The tape method obviously has more complications, mainly involving the skin, in comparison with the elastic bandage method (5). The specificity and sensitivity of delayed physical examination for lateral ankle ligament tearing diagnosis is 85% and 95%, respectively (6). Positive anterior drawer test and anterior talofibular ligament (ATFL) tenderness with presentation of hematoma have enhanced sensitivity to 99% (7). However, if we consider the satisfaction of the patient throughout the functional treatment of an acute ankle sprain, many questions have remained un-answered (8, 9). ### 2. Objectives According to our clinical experience we proposed that the treatment of a lateral ankle sprain by a semi-rigid ankle brace causes smaller local side-effects and further subjective satisfaction than treatment by taping, with a better functional consequence Thus, the aim of this study was to investigate the available evidence in this regard. ### 3. Patients and Methods One group was treated with a semi rigid brace and the other with tape, both for four weeks. The tape was reapplied in the outpatient clinic at least one time a fortnight or when patients indicated that stability was lost from the tape or for hygiene purposes or skin related disorders. Taping was done by a selected group of experienced and skilled professionals of the outpatient clinic. The tape consists of three layers. The first layer is latex free and adhesive bandage to protect the skin. The second layer consists of a 2.5 cm non-elastic strapping tape (Leukotape) used for support. The third layer consists of a 6 cm broad Elastoplast that is elastic and is used for fixation of the second layer (12). The semi-rigid ankle brace has contoured plastic shells that are held in place with a hook and loop fasteners that can be adjusted individually. This ankle support (medial and lateral side of the ankle) has cushions that stabilize the ankle’s lateral ligaments preventing them from twisting. Verbal and written instructions were given for daily exercises emphasized on proprioceptive, range of motion training and strength exercises (13). As a primary outcome parameter, patient satisfaction was assessed by a verbal rating scale, including poor (5), moderate (4), sufficient (3), good (2) and excellent (1), at the second and fourth week after the start of the study treatment. In addition, the ankle joint function was assessed using the validated Karlsson scoring scale and range of motion at 2, 4, 8 and 12 weeks after the start of the study treatment. An anterior drawer test was performed to assess the stability of the anterior talofibular ligament and compared to the uninjured ankle. The Karlsson scoring scale consists of eight categories with a total of 90 points, assessing pain, swelling, instability, stiffness, stair climbing, running, work activities and support. Furthermore, the level of pain was evaluated using a five point pain scale: no pain (1), mild pain (2), moderate pain (3), severe pain (4) and overwhelming pain/worst ever (5). The same five point Likert scale was used to assess patient reported hygiene. Complications of the treatment were registered as allergic contact dermatitis, bullae and/or skin pressure abnormalities requiring local skin treatment or cessation of the treatment. As a primary outcome parameter, patient satisfaction was assessed by a verbal rating scale, including poor (5), moderate (4), sufficient (3), good (2) and excellent (1), both at two and four weeks after the start of the study treatment. In addition, the ankle joint function was assessed using the validated Karlsson scoring scale and range of motion at 2, 4, 8 and 12 weeks after the start of the study treatment (14). An anterior drawer test was used to assess the stability of the anterior talofibular ligament and compared to the uninjured ankle (15). Complications of the treatment were registered as allergic contact dermatitis, bullae and/or skin pressure abnormalities requiring local skin treatment or cessation of the treatment. The range of motion of the ankle joint covers the movement between the maximum dorsal and the maximum plantar flexion. After collecting the results of all patients, data were entered in the SPSS software version 16.0 and analyzed by descriptive and analytical statistics using the T-test. Level of significance was set at 0.05. ### 4. Results One-hundred and fifty cases were included in this trial. After randomization, three cases were considered unacceptable: X-rays of all three cases revealed a fracture and met the criteria of exclusion. Early outcomes (satisfaction of patients, pain and complications) of 121 cases were recorded (12 cases in the bracing group and 13 cases in the taping group did not come for follow-up). The late outcome, meaning ankle function, for 105 cases were recorded. All cases were male with mean age of 23.3 ± 0.3. Totally, 37% of cases experienced an ankle sprain attributable to sport or related activities that were dispersed amongst the two treating groups (tape: 28/49 against 27/49, P = 0.9). The number of positive anterior drawer tests for the injured ankle compared to the uninjured ankle was similar prior to the start of the treatment (2/49 against 3/49 for the taping group and the bracing group, respectively, P = 0.2). Score of subjective satisfaction was 2.3 ± 0.2 for the taping group and 1.45 ± 0.1 for the bracing group from the total of five points. In the taping group 51.9% of cases suffered from side effects, including skin abnormalities, bullae formation or contact dermatitis. The amount of side effects was consequentially less (16.4%) in the bracing group. Hygiene was consequentially more in cases of the bracing group. Throughout the study, three (3.9%) shifts were made from bracing to taping, because of lower stability of treatment with the brace; these three cases were excluded from the study. No shift from tape to brace was made. The functional consequence was adjusted utilizing the Karlsson score extended throughout week four and eight, the mean of functional score was 76 (SD 11) of maximum 90 scores. Both groups were equal in this extended functional capability, including time to return to routine work and sport activities. Besides, the pain score was equal among the taping and bracing groups. Charge of bracing was $20 (para-clinic =$5 and brace price =$15) for each case but charge of taping was$10 (para-clinic = $5 and tapes price =$5); bracing was done only one time for each case. Passive and active ROM for the taping group at week zero was 21.1 ± 2.1 and 21.7 ± 2.1, respectively. However, passive and active ROM at first visit for the taping group was 22.2 ± 2.2 and 22.1 ± 2.2, respectively. Pain score for the taping and bracing group at first visit was 3.80 ± 0.35 and 3.85 ± 0.35, respectively. Pain score for the taping and bracing group at week four was 1.55 ± 0.15 and 1.40 ± 0.10, respectively. Pain score for the taping and bracing group at week 12 was 0.55 ± 0.05 and 0.50 ± 0.05, respectively (Table 1). Table 1. Comparing Pain, PROM (Passive Range of Motion) and AROM (Active Range of Motion) Amongst the two Groups Time, GroupPROM (SD)P ValueAROM (SD)P ValuePain (SD)P Value First visit0.410.330.78 Tape21.1 (2.1)21.7 (2.1)3.80 (0.35) Brace22.2 (2.1)22.1 (2.1)3.85 (0.35) Week 40.0370.0440.001 Tape13.2 (1.1)13.6 (1.1)1.55 (0.15) Brace12.3 (1.1)13.1 (1.1)1.40 (0.10) Week 120.0040.010.031 Tape6.3 (0.6)6.5 (0.6)0.55 (0.05) Brace5.7 (0.5)5.9 (0.5)0.50 (0.05) ### 5. Discussion Functional treatments are widely used and accepted treatments for ankle sprains. Many investigations evaluating the competency of diverse conservative treatments of acute ankle sprain have been executed; nevertheless until now, little is known about subjective satisfaction in association to functional results (10). This randomized controlled trial demonstrated a greater satisfaction, lower local complications and less pain in patients who underwent semi-rigid bracing compared to taping; however indicated no overall better functional outcome (2). Two researches previously compared subjective satisfaction with bracing (3). Seventy-six percent of cases treated with bracing in one trial (4) were satisfied or over satisfied, but in our trial 95% of cases reported satisfaction as good or excellent. In the other randomized trial (5) cases in the bracing group qualified upper levels of satisfaction and comfort. The functional outcome indicated by the Karlsson score was also higher in the bracing group against the elastic bandage group at forty days (6). In a meta-analysis (7) diverse functional treating approaches for adult acute lateral ankle ligament injuries were reviewed. Diversity of outcome results prohibited analysis of results and it was not possible to make absolute conclusions about the most effective functional treating approach; there appeared to be no evidence that bracing (semi-rigid) is better that taping regarding functional outcome in the personal trials. A semi-rigid ankle brace versus elastic bandage caused more stability and a more rapid return to work and sport. Also, in this study, objective functional outcome (ROM) was the same as subjective (patient reported) functional outcome score (Karlsson scale), indicating that there was no functional ability variation amongst the two groups (8). Furthermore, the pain score was comparable amongst the taping and bracing (semi-rigid) approach at three months (9). However, the taping approach caused more side effects, (mostly skin abnormalities), when compared with treatment with an elastic bandage (10). Acceptance of treatment with a bracing method (semi-rigid brace) is more than treatment with the taping method. One researcher, in a limited trial on the treatment of acute ankle sprain with taping and bracing, found higher subjective satisfaction, but also higher charges of treatment for a semi-rigid brace (1.5 times). Specifications of charges have been indicated previously in this article. When taping and bracing approaches are used as preventive methods, this comparison seems to be different. One trial showed that the expenses for prevention of ankle sprain were obviously more when using preventive taping instead of preventive bracing (5, 8-10, 15). Treating expenses of an ankle sprain by taping in our study was lower than bracing, mainly due to brace and tape prices (1.25 times for brace respectively). Therefore, more comfort of ankle sprain treatment comes with greater expenses (15). In summary this trial indicates that treatment of acute lateral ankle sprain with a semi-rigid brace causes fewer side effects and a more subjective (patient) satisfaction and less pain than treatment with a tape. Regarding former investigations there is no difference regarding functional outcome and pain. Accordingly, applying a semi rigid brace should be advised for treatment of acute ankle sprains. ### References • 1. O'Connor SR, Bleakley CM, Tully MA, McDonough SM. Predicting functional recovery after acute ankle sprain. PLoS One. 2013; 8(8)[DOI][PubMed] • 2. Gonzalez de Vega C, Speed C, Wolfarth B, Gonzalez J. Traumeel vs. diclofenac for reducing pain and improving ankle mobility after acute ankle sprain: a multicentre, randomised, blinded, controlled and non-inferiority trial. Int J Clin Pract. 2013; 67(10) : 979 -89 [DOI][PubMed] • 3. Wahnert D, Gruneweller N, Evers J, Sellmeier AC, Raschke MJ, Ochman S. An unusual cause of ankle pain: fracture of a talocalcaneal coalition as a differential diagnosis in an acute ankle sprain: a case report and literature review. BMC Musculoskelet Disord. 2013; 14 : 111 [DOI][PubMed] • 4. Kerkhoffs GM, Struijs PA, Marti RK, Assendelft WJ, Blankevoort L, van Dijk CN. WITHDRAWN: Different functional treatment strategies for acute lateral ankle ligament injuries in adults. Cochrane Database Syst Rev. 2013; 3 : CD002938 [DOI][PubMed] • 5. Park J, Hahn S, Park JY, Park HJ, Lee H. Acupuncture for ankle sprain: systematic review and meta-analysis. BMC Complement Altern Med. 2013; 13 : 55 [DOI][PubMed] • 6. Lin CW, Hiller CE, de Bie RA. Evidence-based treatment for ankle injuries: a clinical perspective. J Man Manip Ther. 2010; 18(1) : 22 -8 [DOI][PubMed] • 7. Kemler E, van de Port I, Backx F, van Dijk CN. A systematic review on the treatment of acute ankle sprain: brace versus other functional treatment types. Sports Med. 2011; 41(3) : 185 -97 [DOI][PubMed] • 8. Baumbach SF, Fasser M, Polzer H, Sieb M, Regauer M, Mutschler W, et al. Study protocol: the effect of whole body vibration on acute unilateral unstable lateral ankle sprain- a biphasic randomized controlled trial. BMC Musculoskelet Disord. 2013; 14 : 22 [DOI][PubMed] • 9. Information from your family doctor. How to care for your ankle sprain. Am Fam Physician. 2012; 85(12) : 1 [PubMed] • 10. Robroek WCL, Van De Beek G. Bandages and Bandaging Techniques Skills in medicine. 2009; • 11. Cosby NL, Koroch M, Grindstaff TL, Parente W, Hertel J. Immediate effects of anterior to posterior talocrural joint mobilizations following acute lateral ankle sprain. J Man Manip Ther. 2011; 19(2) : 76 -83 [DOI][PubMed] • 12. Bergmann G, Ciritsis BD, Wanner GA, Simmen HP, Werner CM, Osterhoff G. Gastrocnemius muscle herniation as a rare differential diagnosis of ankle sprain: case report and review of the literature. Patient Saf Surg. 2012; 6(1) : 5 [DOI][PubMed] • 13. Fewtrell MS, Kennedy K, Singhal A, Martin RM, Ness A, Hadders-Algra M, et al. How much loss to follow-up is acceptable in long-term randomised trials and prospective studies? Arch Dis Child. 2008; 93(6) : 458 -61 [DOI][PubMed] • 14. Witjes S, Gresnigt F, van den Bekerom MP, Olsman JG, van Dijk NC. The ANKLE TRIAL (ankle treatment after injuries of the ankle ligaments): what is the benefit of external support devices in the functional treatment of acute ankle sprain? A randomised controlled trial. BMC Musculoskelet Disord. 2012; 13 : 21 [DOI][PubMed] • 15. Lardenoye S, Theunissen E, Cleffken B, Brink PR, de Bie RA, Poeze M. The effect of taping versus semi-rigid bracing on patient outcome and satisfaction in ankle sprains: a prospective, randomized controlled trial. BMC Musculoskelet Disord. 2012; 13 : 81 [DOI][PubMed] • Copyright © 2014, AJA University of Medical Sciences. This is an open-access article distributed under the terms of the Creative Commons Attribution-NonCommercial 4.0 International License (http://creativecommons.org/licenses/by-nc/4.0/) which permits copy and redistribute the material just in noncommercial usages, provided the original work is properly cited.
2022-01-18 04:39:32
{"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.2775123715400696, "perplexity": 13729.59762587903}, "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/1642320300722.91/warc/CC-MAIN-20220118032342-20220118062342-00157.warc.gz"}
https://wiki.kidzsearch.com/wiki/Norwegian_language
kidzsearch.com > wiki   Explore:web images videos games # Norwegian language Norwegian norsk Pronunciation[nɔʂk] (East and North) [nɔʁsk] (West) Native toNorway EthnicityNorwegians Native speakers4.3 million  (2012)[1] Language family Early forms: Standard forms written Bokmål (official) • written Riksmål (unofficial) written Nynorsk (official) • written Høgnorsk (unofficial) Writing systemLatin (Norwegian alphabet) Norwegian Braille Official status Official language in Norway Nordic Council Regulated byLanguage Council of Norway (Bokmål and Nynorsk) Ivar Aasen-sambandet (Høgnorsk) Language codes ISO 639-1no – inclusive code Individual codes: nbBokmål nnNynorsk ISO 639-2nor ISO 639-3norinclusive code Individual codes: nob – Bokmål nno – Nynorsk Linguasphere52-AAA-ba to -be; 52-AAA-cf to -cg Areas where Norwegian is spoken, including North Dakota (where 0.4% of the population speaks Norwegian) and Minnesota (0.1% of the population) (Data: U.S. Census 2000). This page contains IPA phonetic symbols in Unicode. Without proper rendering support, you may see question marks, boxes, or other symbols instead of Unicode characters. The Norwegian language is the official language of Norway. It is spoken by over four and a half million people, and it belongs to the group of North Germanic languages which are spoken in Scandinavia. These include Swedish, Danish, Icelandic and Faeroese. Two forms of the language exist: bokmål (which means "book language") and nynorsk (which means "new Norwegian"). ## History of the Norwegian language ### Old Norse Old Norse is the language that was spoken hundreds of years ago in Scandinavia at the time of the Vikings. It is very similar to today’s Icelandic language. This is because many Vikings sailed from Norway to Iceland in order to escape from the rule of the Norwegian kings who were making people pay lots of tax. ### Bokmål During the 13th century the Black Death killed two thirds of the population of Norway. The Danish kings and queens noticed that Norway was weak and defenceless, so they annexed Norway (made it part of Denmark). For hundreds of years Norway was ruled by the Danes. All the rulers, priests, estate owners and noblemen were Danish. Many of them settled in Norway. This is why today’s standard Norwegian (Bokmål) is similar to Danish. Norwegians were not allowed to print books in Norwegian. Anyone wanting to study had to go to Denmark or Germany. In 1814 Denmark lost a war and had to give Norway to Sweden. Then the Norwegians were allowed to have their own university. Gradually the Danish language was mixed up with the Norwegian dialects and became today’s Norwegian language. Norwegian and Danish look very similar when they are written, but when they are spoken they sound different. In Danish a lot of the sounds are swallowed. ### Nynorsk During the 19th century a slightly different form of Norwegian was made up by several people. This eventually became known as “Nynorsk.” It was based on old forms of Norwegian and dialects. During the 20th century some attempts were made to join Bokmål and Nynorsk into one language, but they did not succeed. Today about one person in nine or ten in Norway writes Nynorsk. Children in school have to learn both forms. ## The Norwegian alphabet The Norwegian alphabet has 29 letters. These are the same letters as the English alphabet plus three extra vowels: æ ø å The letters c, q, w, x and z are only used for words that have been borrowed from other languages. ## References 1. De Smedt, Koenraad; Lyse, Gunn Inger; Gjesdal, Anje Müller; Losnegaard, Gyri S. (2012). The Norwegian Language in the Digital Age. White Paper Series. Berlin, Heidelberg: Springer Berlin Heidelberg. pp. 45. . . "Norwegian is the common spoken and written language in Norway and is the native language of the vast majority of the Norwegian population (more than 90%) and has about 4,320,000 speakers at present.".
2021-02-27 16:34:32
{"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.23170414566993713, "perplexity": 7765.993288211339}, "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/1614178358976.37/warc/CC-MAIN-20210227144626-20210227174626-00566.warc.gz"}
https://tex.stackexchange.com/questions/245827/how-to-match-last-substring/245828#245828
# How to match last substring I am working on displaying source code for which I pass a path to a macro. Now I am wondering if it is possible using xstring or stringstrings to match from after the last delimiter, i.e. / to the end of the string to determine the filename. Example: I might pass ../code/subfolder/project/code.java to the macro for which I want to extract the substring code.java. It seems easy to match the first occurrence of a character, but not the last. No package is needed for that, you can use LaTeX's filename parser: \documentclass{article} \begin{document} \makeatletter \filename@parse{../code/subfolder/project/code.java} [\filename@area] [\filename@base] [\filename@ext] \end{document} • Accepted because it is the simplest answer (and most highly voted), but in all honesty all answers given are of equal high quality. Each answer has its own advantages/disadvantages. May 19 '15 at 22:36 Here is a method with xstring: \documentclass{article} \usepackage{xstring} \newcommand*\filename[1]{% \IfSubStr{#1}/ {\StrCount{#1}/[\ossepoccur]% \StrBehind[\ossepoccur]{#1}/\relax } {#1}% } \begin{document} \filename{abc.foo} \filename{../code/subfolder/project/code.java} \end{document} Here's a generic extractor of the last item in a delimited string: \documentclass{article} \usepackage{xparse} \ExplSyntaxOn \NewDocumentCommand{\extractlast}{O{/}mo} { \seq_set_split:Nnn \l_stroobants_string_seq { #1 } { #2 } \IfNoValueTF { #3 } { \seq_item:Nn \l_stroobants_string_seq { -1 } } { \tl_set:Nx #3 { \seq_item:Nn \l_stroobants_string_seq { -1 } } } } \seq_new:N \l_stroobants_string_seq \ExplSyntaxOff \begin{document} \extractlast{../code/subfolder/project/code.java} \extractlast[-]{a-b-c-def}[\test] \texttt{\meaning\test} \end{document} The first optional argument is the delimiter, default /; the trailing optional argument is a macro name where the last item is stored, if not present, the item is printed. A fully expandable version, but with a fixed delimiter; you're better not input an empty string, although a test for this can be easily added. \documentclass{article} \usepackage{xparse} \ExplSyntaxOn \DeclareExpandableDocumentCommand{\extractlast}{m} { \stroobants_extractlast:nn #1 / \q_nil / \q_nil / } \cs_new:Npn \stroobants_extractlast:nn #1 / #2 / \q_nil / { \str_if_eq:nnTF { #2 } { \q_nil } {% end of recursion #1 } {% go on \stroobants_extractlast:nn #2 / \q_nil / } } \ExplSyntaxOff \begin{document} \extractlast{../code/subfolder/project/code.java} \edef\test{\extractlast{../code/subfolder/project/code.java}} \texttt{\meaning\test} \end{document} Here is a way with stringstrings. \documentclass{article} \usepackage[T1]{fontenc} \usepackage{stringstrings} \def\fname#1{% \findchars[q]{#1}{/}% \edef\tmp{\theresult}% \convertchar[e]{x#1}{/}{ }% \getaword[q]{\thestring\ }{\numexpr\tmp+1\relax}% \edef\thefname{\thestring}% } \begin{document} \fname{../code/subfolder/project/code.java} The file is \thefname. \end{document}
2021-10-27 00:17: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": 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.6480280756950378, "perplexity": 3991.3853776073875}, "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/1634323587963.12/warc/CC-MAIN-20211026231833-20211027021833-00048.warc.gz"}
https://icme.hpc.msstate.edu/mediawiki/index.php?title=Category:Astronomical_Scale&diff=prev&oldid=23781
# Category:Astronomical Scale (Difference between revisions) # Overview We propose that: 1) physical space (that is cosmic space) exhibits material-like properties and, that 2) having material nature, it also has inherent structure at multiple length scales, which affects its behavior. The first part of the proposition underlies what we call the "Cosmic Fabric Model" of gravity. [1] [2] The second part of the proposition, which we call the "Inherent Structure Hypothesis," offers a new approach for solving conundrums of modern cosmology, such as explaining phenomena currently attributed to dark matter. We also show how the Cosmic Fabric model of gravity makes the computational tools of modern mechanics applicable to studying the inherent structure of cosmic space, which introduced the Cosmic Fabric Model of gravity and began to illustrate its application to studying the inherent structure of space. The Cosmic Fabric model[1] is a formal analogy between General Relativity (GR) and Solid Mechanics (SM) that interprets physical space as a solid body and the field equations of GR as the bending equations governing the dynamics of said body. The vacuum of three-dimensional space is identified with a solid hyperplate called "cosmic fabric" that is embedded in four-dimensional hyperspace and has a small thickness along the fourth hyperspatial dimension. The fabric deforms elastically due to matter inclusions, such that its intrinsic curvature corresponds to that of space, while its volumetric strain to the reduction in the rate of time lapse, which in the case of weak gravity, is the same as the gravitational potential. Cosmic hierarchical length scales and the information bridges between them. The field equations of General Relativity and, analogously, the constitutive equations of the cosmic fabric dominate continuum length scale (2). The effects of dark matter are directly observed at the structure length scale (3). The structures at length scales (3) and (4) contribute the $\bar{\mathcal{L}}$ terms to the action equation, while length scale (1) contributes the $\mathcal{L}_\text{M}$ term. The effects of structure at length scales below and above the continuum length scale, are accounted for by the Lagrangian terms $\bar{\mathcal{L}}$ and $\mathcal{L}_\text{F}$ within the Einstein-Hilbert action. In the context of the Lagrangian formulation of gravity, the inherent structure of space figures as the additional term $\bar{\mathcal{L}}$ in the following modification to the Einstein-Hilbert action integral, $\mathcal{S} = \int_{\Omega}\left(\mathcal{L} - \bar{\mathcal{L}} + \mathcal{L}_\text{M} \right) d\Omega$ where the integral is taken over all of spacetime $\Omega$ and $d\Omega \equiv \sqrt{|g|}dx^4$ represents the proper volume element of spacetime with $g$ being its metric and $dx^4$ the coordinate volume element. The various $\mathcal{L}$ terms are Lagrangian densities, where $\mathcal{L}$ is due to the curvature of spacetime, $\bar{\mathcal{L}}$ is a correction to $\mathcal{L}$ due to the inherent (or undeformed) curvature of space, and $\mathcal{L}_\text{M}$ accounts for energy-matter fields. The governing differential equations of spacetime (or the cosmic fabric) can be derived by variation of the action $\mathcal{S}$ with respect to the metric tensor $g$. Form GR's perspective, $\mathcal{L} = R/(2c\kappa)$, where $R$ is the Ricci curvature scalar, $\kappa \equiv 8\pi G/c^4$ is the Einstein constant, $c$ is the speed of light and $G$ is the gravitational constant. We show in \chref{ch:model} that from SM's perspective, $\mathcal{L} = RL^2\mu/(24c)$, where $L$ and $\mu$ are, respectively, the average thickness and shear modulus of the cosmic fabric. The interpretation of $\mathcal{L}_\text{M}$ is one and the same within both GR's and SM's paradigms. The term $\bar{\mathcal{L}}$, which represents the curvature of spacetime that is not due to matter-energy fields, has not been considered until now, but the need for it becomes apparent in the context of the material analogy. The unstrained cosmic fabric need not be flat, but could, for example, have global curvature and local relief. # References 1. 1.0 1.1 Tenev, T. G., Horstemeyer, M. F., "Mechanics of spacetime — A Solid Mechanics perspective on the theory of General Relativity", International Journal of Modern Physics D, Vol. 27 (2018) 2. Tenev, T. G., Horstemeyer, M. F., "Recovering the Principle of Relativity from the Cosmic Fabric Model of Space", http://arxiv.org/abs/1808.08804 ## Subcategories This category has only the following subcategory.
2020-02-25 16:41:32
{"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": 26, "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.8788812756538391, "perplexity": 533.1361787937805}, "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/1581875146123.78/warc/CC-MAIN-20200225141345-20200225171345-00446.warc.gz"}
http://www.maa.org/programs/faculty-and-departments/classroom-capsules-and-notes/an-infinite-series-for-pi-with-determinants
An Infinite Series for $$\pi$$ with Determinants Mathematics Magazine September, 1984 Subject classification(s): Algebra and Number Theory | Algebra | Sequences and Series | Linear Algebra | Numbers and Computation | Number Concepts | Famous Numbers Applicable Course(s): 3.8 Linear/Matrix Algebra The author gives an expression for $$\pi$$ involving an infinite sequence of determinants, each representing the area of a triangle. A pdf copy of the article can be viewed by clicking below. Since the copy is a faithful reproduction of the actual journal pages, the article may not begin at the top of the first page. These pdf files are furnished by JSTOR. Classroom Capsules would not be possible without the contribution of JSTOR. JSTOR provides online access to pdf copies of 512 journals, including all three print journals of the Mathematical Association of America: The American Mathematical Monthly, College Mathematics Journal, and Mathematics Magazine. We are grateful for JSTOR's cooperation in providing the pdf pages that we are using for Classroom Capsules. Capsule Course Topic(s): Linear Algebra | Determinants Linear Algebra | Geometry
2014-09-17 08:05:35
{"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.569391131401062, "perplexity": 1842.5712709561792}, "config": {"markdown_headings": false, "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-2014-41/segments/1410657121798.11/warc/CC-MAIN-20140914011201-00255-ip-10-196-40-205.us-west-1.compute.internal.warc.gz"}
https://codereview.stackexchange.com/questions/85703/replacing-items-in-a-list
# Replacing items in a list I was wondering why replace is not in base. I thought, it's because it must be easy to implement with standard combinators. Although I do not like prefix syntax of Applicative I wrote it this way: replace a b = map (bool <$> id <*> (const b) <*> (== a)) And was slightly surprised after seeing replace in Data.List.Utils: replace old new l = join new . split old$ l Are there non-opinion based reasons to prefer one than the other in public projects? Your code is not a replacement for replace (pun intended). Its type signature is wrong. Your code has type Eq b => b -> b -> [b] -> [b], but replace should have type Eq a => [a] -> [a] -> [a] -> [a]. <$> and <*> are infix, not prefix. I'd prefer this to your implementation: replace' :: Eq b => b -> b -> [b] -> [b] replace' a b = map (\x -> if (a == x) then b else x) It does the exact same thing in the exact same way, but is simpler and more readable (even a novice Haskell programmer who has never heard of bool or <$> or <*> can read it). Even more important: it has a type signature. If you'd decided to cut-and-paste the type signature of the function you wanted to replicate before starting, you would have found out that your version doesn't work as a replacement at compile time -- and if you'd looked at and thought about the type signature, you probably would have wondered why the extra []s were there, and figured it out even earlier.
2019-05-21 03:45: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": 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.38788285851478577, "perplexity": 1155.414000292172}, "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-22/segments/1558232256215.47/warc/CC-MAIN-20190521022141-20190521044141-00523.warc.gz"}
https://aptitude.gateoverflow.in/9040/nielit-2022-feb-scientist-c-section-d-12
14 views If $25$ pumps can raise $2500$ tonnes of water in $20$ days, working $10$ hours a day, in how many days will $20$ pumps raise $1200$ tonnes of water, working $8$ hours a day? 1. $7.5$ days 2. $10$ days 3. $15$ days 4. $18$ days 1
2022-12-04 21:40:40
{"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.28670400381088257, "perplexity": 3596.1218031642748}, "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/1669446710980.82/warc/CC-MAIN-20221204204504-20221204234504-00501.warc.gz"}
https://ltwork.net/today-s-riddle-i-am-very-easy-to-get-into-but-hard-to-get--3343935
# Today's riddle i am very easy to get into, but hard to get out of. what am i? ###### Question: Today's riddle i am very easy to get into, but hard to get out of. what am i? ### What positive number can you divide 13/201 and get a result that is greater than 1 What positive number can you divide 13/201 and get a result that is greater than 1... ### Plz helppp. What is the y intercept of the line y=7xA. b=7B. m=0C. b=0D. m=7 Plz helppp. What is the y intercept of the line y=7x A. b=7 B. m=0 C. b=0 D. m=7... ### Which of the following authors provided the writer with information about how the Great Sea scrolls were discovered by the diver? Which of the following authors provided the writer with information about how the Great Sea scrolls were discovered by the diver? A. Marcia Gutierrez B. Jonathan Reyes C. Timothy Wilson D. Francois BoisThat's the PASSAGE Dead Sea Scrollsby Reginald Parks The legendary scrolls of the Great Sea were o... ### Which source of evidence did Wegener use to support his theory of continental drift?A. fossilsB. Which source of evidence did Wegener use to support his theory of continental drift? A. fossils B. magnetic fields C. satellite mapping D. warm equatorial climates... ### Which statements about the box plot are correct? Check all that apply. Fifty percent of the data values lies between 34 and 46. Which statements about the box plot are correct? Check all that apply. Fifty percent of the data values lies between 34 and 46. Seventy-five percent of the data values lies between 42 and 70. It is unlikely that there are any outliers. The interquartile range is 24. The range is 36.... ### If δabc δdec, what is m∠d? a. 40° b. 150° c. 60° d. 80° If δabc δdec, what is m∠d? a. 40° b. 150° c. 60° d. 80°... ### How would you convince a fellow student that the number 0.57 is a rational number? explain and explain How would you convince a fellow student that the number 0.57 is a rational number? explain and explain the answer but in an answer that hasnt been used before. pls asap.... ### Anyone got the answer? Would be nice pls Anyone got the answer? Would be nice pls $Anyone got the answer? Would be nice pls$... ### Given the function f(x) = 4|x-8|Calculate the folfollowing valuesf(0)=F (2)F(-2)f(x+1)fx²+2) = Given the function f(x) = 4|x-8| Calculate the fol following values f(0)= F (2) F(-2) f(x+1) fx²+2) =... ### In Triangle MCB, M = 61°, c = 18 cm, andb= 21 cm.Find the measure of angle m, C, and B In Triangle MCB, M = 61°, c = 18 cm, and b= 21 cm. Find the measure of angle m, C, and B... ### A product that represents a clear technological advance over competing products can generally command a high price. Because technological A product that represents a clear technological advance over competing products can generally command a high price. Because technological advances tend to be quickly surpassed and companies want to make large profits while they still can, many companies charge the maximum possible price for such a p... ### 12 mark question: “science disproves the creation story in genesis” *urgent* *lots of points* use this guide science 12 mark question: “science disproves the creation story in genesis” *urgent* *lots of points* use this guide science disproves the account of creation in genesis” evaluate this statement. in your answer you should: • refer to christian teachings • refer to different points of view • r... ### How do modern safety features and body types help keep passengers safe? How do modern safety features and body types help keep passengers safe?... ### What positive jobs did women have in the japanese war? What positive jobs did women have in the japanese war?... ### Find the exact values of the remaining trigonometric functions of θ satisfying the given conditions. Find the exact values of the remaining trigonometric functions of θ satisfying the given conditions. (If an answer is undefined, enter UNDEFINED.) cos θ = 0, csc θ = 1 sin θ = 1 tan θ = ? sec θ = ? cot θ = 0... ### Fly a lands on the edge of the ruler at a random point. fly b lands on the surface of the target at Fly a lands on the edge of the ruler at a random point. fly b lands on the surface of the target at a random point. which fly is more likely to land in a yellow region? explain. $Fly a lands on the edge of the ruler at a random point. fly b lands on the surface of the target at$... ### Match the historical event to the outcome it had on the development of health care. Match the historical event to the outcome it had on the development of health care. $Match the historical event to the outcome it had on the development of health care.$...
2023-02-07 15:54: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": 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.43334266543388367, "perplexity": 2966.6596760747675}, "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/1674764500619.96/warc/CC-MAIN-20230207134453-20230207164453-00215.warc.gz"}
https://www.redmine.org/boards/1/topics/26323
## I want to change the home page to login page. Can somebody help me regarding this? I am finding it very difficult to trace how the pages are linked and how to change it. Please tell me the proper way to perform above behaviour and how to trace the pages in redmin. ### Replies (9) Edit path\to\redmine\config\routes.rb : map.home '', :controller => 'welcome' to map.home '', :controller => 'account', :action => 'login' This works on my test installation 1.2.1, Rails 2.3.14. Ivan Oooooooooopssss, this always redirects to the login page .... It does NOT works. Excuse me for the spam.... :( gurushant birajdar wrote: This can be achieved easily by enabling the "Authentication required" setting. Hey Thanks a lot Ivan. It works. Hey Ivan, One more question. Can you please help me, I want to display only those projects on my home page which are assigned to logged in, not all projects. gurushant birajdar wrote: Hey Thanks a lot Ivan. It works. I needed the same behavior. Hmm..., I think the proposed by Mischa The Evil is the right solution.
2021-12-03 22:07:46
{"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.23168353736400604, "perplexity": 4016.930763742364}, "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/1637964362919.65/warc/CC-MAIN-20211203212721-20211204002721-00137.warc.gz"}
https://www.physicsforums.com/threads/matrix-difference-problem.96724/
# Matrix Difference Problem 1. Oct 25, 2005 ### john425 Problem: Each number is the average of the previous two numbers. I am guessing I need to find a matrix A that when multiplied by a vector x, it will return another vector with its entries as the averages. Is this correct? Need some hints on how to start this one. 2. Oct 26, 2005 ### Gokul43201 Staff Emeritus State the problem completely and exactly as it appears in your homework/text/notes. 3. Oct 26, 2005 ### john425 Here it is exactly: Formulate the following problems in Matrix-difference equation xn+1 = Axn and specify the components of x (2) Each number is the average of the two previous numbers. 4. Oct 27, 2005 ### john425 Here is a PDF link with same exact question (#6): http://www.math.montana.edu/~shaw/math_221/archive/takeHome3.pdf [Broken] Last edited by a moderator: Apr 21, 2017 at 9:12 PM 5. Nov 2, 2005 ### CarlB The transformation you're dealing with is one where you take the most recent two elements in the series and average them. So you need to be thinking of a matrix A that is 2x2. You already know how to convert linear equations into matrices. For this case, the linear equations are going to be: $$x' = (x+y)/2$$ $$y' = x$$ where x and y are the last two consecutive elements of the series (when you've calculated it up to some point) and x' and y' are the last two consecutive elements after you've calculated it for the next step. For example, if the series looks like ... 22, 12 then y=22, x=12, y'=12 and x'=17. After the next step in the calculation, the series now looks like: ... 22, 12, 17 Got it? Carl
2017-04-26 18:07: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.6192460060119629, "perplexity": 884.4138144188687}, "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-17/segments/1492917121528.59/warc/CC-MAIN-20170423031201-00062-ip-10-145-167-34.ec2.internal.warc.gz"}
https://gamedev.stackexchange.com/questions/27750/generate-texture-for-a-heightmap
# Generate texture for a heightmap I've recently been trying to blend multiple textures based on the height at different points in a heightmap. However i've been getting poor results. I decided to backtrack and just attempt to recreate one single texture from an SDL_Surface (i'm using SDL) and just send that into opengl. I'll put my code for creating the texture and reading the colour values. It is a 24bit TGA i'm loading, and i've confirmed that the rest of my code works because i was able to send the surfaces pixels directly to my createTextureFromData function and it drew fine. struct RGBColour { RGBColour() : r(0), g(0), b(0) {} RGBColour(unsigned char red, unsigned char green, unsigned char blue) : r(red), g(green), b(blue) {} unsigned char r; unsigned char g; unsigned char b; }; // new texture for (int y = 0; y < reader->m_surface->h; y++) { for (int x = 0; x < reader->m_surface->w; x += 3) { int index = (y * reader->m_surface->w) + x; newTexture[index] = colour.r; newTexture[index + 1] = colour.g; newTexture[index + 2] = colour.b; } } { Uint32 pixel; Uint8 red, green, blue; RGBColour rgb; pixel = getPixel(m_surface, x, y); SDL_LockSurface(m_surface); SDL_GetRGB(pixel, m_surface->format, &red, &green, &blue); SDL_UnlockSurface(m_surface); rgb.r = red; rgb.b = blue; rgb.g = green; return rgb; } // this function taken from SDL documentation // http://www.libsdl.org/cgi/docwiki.cgi/Introduction_to_SDL_Video#getpixel Uint32 SDLSurfaceReader::getPixel(SDL_Surface* surface, int x, int y) { int bpp = m_surface->format->BytesPerPixel; Uint8 *p = (Uint8*)m_surface->pixels + y * m_surface->pitch + x * bpp; switch (bpp) { case 1: return *p; case 2: return *(Uint16*)p; case 3: if (SDL_BYTEORDER == SDL_BIG_ENDIAN) return p[0] << 16 | p[1] << 8 | p[2]; else return p[0] | p[1] << 8 | p[2] << 16; case 4: return *(Uint32*)p; default: return 0; } } I've been stumped at this, and I need help badly! Thanks so much for any advice. • What precisely isn't working here? – Laurent Couvidou Apr 20 '12 at 14:26 • The code compiles fine, but when i'm applying this texture, i'm getting weird results. This is a screenshot of what i'm getting i.imgur.com/N6NFi.png and this is what it should be i.imgur.com/V6x0p.jpg – James Apr 20 '12 at 14:32 • As you can see its drawing the whole texture in 3 spots and only in 1/3 of the terrain. I dont know where i'm going wrong in my loading. – James Apr 20 '12 at 14:34
2021-03-06 15: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": 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.17632323503494263, "perplexity": 6358.009450826627}, "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/1614178375096.65/warc/CC-MAIN-20210306131539-20210306161539-00107.warc.gz"}
https://github.com/ocaml/ocaml/pull/1231
# Toplevel: only escapes bytes and not strings #1231 Merged merged 1 commit into from Sep 13, 2017 ## Conversation Projects None yet 10 participants Contributor ### Octachron commented Jul 8, 2017 Escaping strings when printing them in the toplevel has the disadvantage of making unicode text unreadable: # "한글";; - : string = "\237\149\156\234\184\128" This PR proposes to escape only bytes and not strings: # let cosmos = "κόσμος";; cosmos : string = "κόσμος" # Bytes.of_string cosmos;; - : bytes = Bytes.of_string "\206\186\207\140\207\131\206\188\206\191\207\130" This change is not purely aesthetic: the mangling of unicode strings may contribute to the impression of some OCaml newcomers that Ocaml has no support for unicode (and being able to read the corresponding strings in the toplevel benefits all users not able to fluently read raw unicode codepoint). On a more technical note, in presence of string delimiters inside the printed string, the best string delimiters still available are used: # "日本\"語";; - : string = {|日本"語|} In order of preference, the string delimiters used are ", {|, {t|, {top|,{toplevel|, and in the worst case scenario {toplevel%d|: # "مرسی\n\"|}|t}|top}|toplevel}|toplevel1}|toplevel2}";; - : string = {toplevel3|ﻡﺮﺳی "|}|t}|top}|toplevel}|toplevel1}|toplevel2}|toplevel3} With this scheme, all strings should be printable as valid string literals. One disadvantage of this approch is that newline and tabs are not escaped anymore # "\n\t\n\t\n";; - : string = " " Member ### gasche commented Jul 8, 2017 I like some aspects of the change (the idea that unicode letters are printed back) but not others: not-escaping the whitespace characters leads to a loss of readability, for example. Of course, some time people write string literals with newlines in them, and escaping them instead hurts readability. I have mixed feelings about the automatic choice of {|..|} for escaping; it's a lesser-known feature that may surprise users, but on the other it makes the feature more self-discoverable. Overall I would say that I like it. Have people studied the problem of "what is the right choice of which characters to print and which characters to escape" before, and are there solution that do not require more unicode knowledge than available in the OCaml standard library? (Would we want this behavior to depend on the current user locale? In general it seems that people push for locale-independence these days.) Contributor ### dbuenzli commented Jul 8, 2017 • edited I'm not really fond of the choices made by this PR. These would be my suggestions: Always escape control characters (bytes <= 0x1F) and the string delimiter. Do not use the "{|" syntax, always delimit strings with " Consult some kind of environment variable to determine if the terminal is UTF-8 aware (this has to be researched or if nothing reliable is available one ocaml specific should be defined). If the terminal is not UTF-8 aware any byte > 0x7E should still be escaped. (Ideally the string should be checked for UTF-8 validity and if not valid its non printable US-ASCII bytes should be escaped. But this can be improved once/if we get more UTF-8 tools in the stdlib). I would really like to have the bytes of string and bytes escaped with hexadecimal numbers. Decimal escapes are a huge PITA if you are dealing with UTF-8 and other byte oriented file formats. (Would we want this behavior to depend on the current user locale? In general it seems that people push for locale-independence these days.) This is a user interface not an API, as such I think it would be legitimate to depend on the user locale. Contributor Author ### Octachron commented Jul 8, 2017 Concerning point 1 and 2, escaping characters in the C0 control character code set and " may be indeed clearer and it rejoins @gasche remarks. Concerning point 3 (and 4), I am not completely convinced because it seems much simpler to simply not escape bytes ≥ 0x7F. By doing so, we would keep some compatibility with latin-1 and JIS users at the only cost ( for utf-8 users ) of not escaping control characters in the C1 code set (in particular NEL) and the more exotic LS or PS new lines (on the other hand, it would even give a work-arround for users that really really want non-escaped new lines). I agree with point 5, but using hexadecimal in escaping sequence does not seems to particularly concern the toplevel, and I think this should be changed globally. Contributor ### dbuenzli commented Jul 8, 2017 By doing so, we would keep some compatibility with latin-1 and JIS users at the only cost ( for utf-8 users ) This kind of fortunate coincidence argument doesn't make sense to me. We have been trying to push for sometime now for a model where OCaml strings should be UTF-8 encoded. I will let the dev team determine if they find it important that the toplevel is still able to function in a 7-bit environment. But I really think that we should have at least an OCAMLTOP_UTF_8 boolean environment variable (that defaults to true), that controls this. Contributor Author ### Octachron commented Jul 9, 2017 I have updated this to escape C0 control characters and string delimiters; in other words, quoted string delimiters are gone and \t and \n are now escaped: # "серафими\t\"многоꙮчитїи\"";; - : string = "серафими\t\"многоꙮчитїи\"" @dbuenzli, I am not sure what your proposed OCAMLTOP_UTF_8 environment variable is supposed to do? Disable the escaping of bytes >0x7E but only for utf-8 valid byte sequence? Anyway, I personally don't dislike the fortunate coincidence that users get back in the toplevel the same string they submitted as input (except for control characters that indeed should not take control of the toplevel printing). Contributor ### dbuenzli commented Jul 9, 2017 • edited So @pqwy who studied the problem in the context of his notty library tells me that it seems hopeless to try to find a system environment variable to lookup (though LC_ALL, LANG, LC_CTYPE, could be possibly consulted in that order, but that doesn't tell you if the output actually agrees). @dbuenzli, I am not sure what your proposed OCAMLTOP_UTF_8 environment variable is supposed to do? Disable the escaping of bytes >0x7E but only for utf-8 valid byte sequence? No if OCAMLTOP_UTF_8 is set to false you always escape bytes > 0x7E. Anyway, I personally don't dislike the fortunate coincidence that users get back in the toplevel the same string they submitted as input Indeed, in a non Unicode aware terminal this user wouldn't be able to input UTF-8, so she would e.g. input "\xC3\xA9" and you would output them unescaped which would break her terminal. Contributor Author ### Octachron commented Jul 9, 2017 No if OCAMLTOP_UTF_8 is set to false you always escape bytes > 0x7E. I agree that being able to reactivate the escaping of bytes > 0x7E is a undeniable improvement. Indeed, in a non Unicode aware terminal this user wouldn't be able to input UTF-8, so she would e.g. input "\xC3\xA9" and you would output them unescaped which would break her terminal. Well, \xC3\xA9 is also a perfectly valid latin-1(é) or SHIFT-JIS (テゥ) byte sequence, so breaking the terminal might be a bit hyperbolic here. Contributor ### dbuenzli commented Jul 9, 2017 Well, \xC3\xA9 is also a perfectly valid latin-1(é) or SHIFT-JIS (テゥ) byte sequence, so breaking the terminal might be a bit hyperbolic here. But in that case the user would leave OCAMLTOP_UTF_8 set to true (as strange as it sounds) and would not input hex escapes... Contributor Author ### Octachron commented Jul 9, 2017 • edited I have added the OCAMLTOP_UTF_8 variable, man page and manual description included. Note that I have also deleted the paragraph in the ocaml man page about LC_CTYPE=iso_8859_1: the described behavior did not seem valid anymore (and they are no trace of iso_8859_1 nor LC_CTYPE in the code base). Moreover, OCAMLTOP_UTF_8 supersedes such use of LC_CTYPE. Contributor ### dbuenzli commented Jul 9, 2017 • edited Note that I have also deleted the paragraph in the ocaml man page about LC_CTYPE=iso_8859_1: FTR @xavierleroy removed that from the manual in 5d385f9. I think this may have gone away with the resolution by @damiendoligez of MPR6521 in e60a2db. ### xavierleroy reviewed Jul 9, 2017 @@ -74,6 +74,34 @@ let parenthesize_if_neg ppf fmt v isneg = fprintf ppf fmt v; if isneg then pp_print_char ppf ')' (** Escape only C0 control characters (bytes <= 0x1F) and '"' *) let print_out_string ppf s = #### xavierleroy Jul 9, 2017 Contributor 0x7F, a.k.a. DEL, is a control character and needs escaping too. #### Octachron Jul 9, 2017 Author Contributor Fixed, thanks. Contributor ### xavierleroy commented Jul 9, 2017 This discussion makes me feel younger, because we had pretty much the same discussion back in the early 1990s when Latin-1 support was added to Caml Light and not all environments would support characters above 0x80... Escaping control characters is absolutely necessary, and not only to display TAB, CR and LF meaningfully. For example, if terminal escape sequences are printed verbatim, the display can be completely messed up. A desirable property of the toplevel value printer is that the output, once fed back into the toplevel by cut-and-paste, should parse back to the same value (as much as possible). I think it is the case in the latest incarnation of this PR, but make sure it is. Contributor ### lpw25 commented Jul 9, 2017 Isn't this going to mess up the formatting? Format doesn't understand the widths of these characters. I'm lead to believe that this is quite a tricky problem to solve. Contributor ### dbuenzli commented Jul 9, 2017 Isn't this going to mess up the formatting? It will. I'm lead to believe that this is quite a tricky problem to solve. It's worse than that. It's a problem that is impossible to solve without being able to interact with the rendering layer to measure how many cells your UTF-8 encoded string is going to span when rendered -- something no terminal out there will provide you. You can perform some kind of best effort formatting using either Uucp.tty_width_hint (a form of wcwidth designed by @pqwy for this problem) or Uuseg's pretty-printers but even, none of these solutions are entirely fool proof. Contributor Author ### Octachron commented Jul 9, 2017 Format output will get messy since Format will tend to overestimate the length of the graphical representation of strings. Some examples, first in Greek: # String.split_on_char ' ' "Μῆνιν ἄειδε θεὰ Πηληϊάδεω Ἀχιλῆος οὐλομένην, ἣ μυρί᾿ Ἀχαιοῖς ἄλγε᾿ ἔθηκε, πολλὰς δ᾿ ἰφθίμους ψυχὰς Ἄϊδι προΐαψεν ἡρώων, αὐτοὺς δὲ ἑλώρια τεῦχε κύνεσσιν οἰωνοῖσί τε πᾶσι· Διὸς δ᾿ ἐτελείετο βουλή ἐξ οὗ δὴ τὰ πρῶτα διαστήτην ἐρίσαντε Ἀτρεΐδης τε ἄναξ ἀνδρῶν καὶ δῖος Ἀχιλλεύς.";; - : string list = ["Μῆνιν"; "ἄειδε"; "θεὰ"; "Πηληϊάδεω"; "Ἀχιλῆος"; "οὐλομένην,"; "ἣ"; "μυρί᾿"; "Ἀχαιοῖς"; "ἄλγε᾿"; "ἔθηκε,"; "πολλὰς"; "δ᾿"; "ἰφθίμους"; "ψυχὰς"; "Ἄϊδι"; "προΐαψεν"; "ἡρώων,"; "αὐτοὺς"; "δὲ"; "ἑλώρια"; "τεῦχε"; "κύνεσσιν"; "οἰωνοῖσί"; "τε"; "πᾶσι·"; "Διὸς"; "δ᾿"; "ἐτελείετο"; "βουλή"; "ἐξ"; "οὗ"; "δὴ"; "τὰ"; "πρῶτα"; "διαστήτην"; "ἐρίσαντε"; "Ἀτρεΐδης"; "τε"; "ἄναξ"; "ἀνδρῶν"; "καὶ"; "δῖος"; "Ἀχιλλεύς."] Compared to the english version # String.split_on_char ' ' "Achilles sing, O Goddess! Peleus' son; His wrath pernicious, who ten thousand woes Caused to Achaia's host, sent many a soul Illustrious into Ades premature, And Heroes gave (so stood the will of Jove) To dogs and to all ravening fowls a prey, When fierce dispute had separated once The noble Chief Achilles from the son Of Atreus, Agamemnon, King of men.";; - : string list = ["Achilles"; "sing,"; "O"; "Goddess!"; "Peleus'"; "son;"; "His"; "wrath"; "pernicious,"; "who"; "ten"; "thousand"; "woes"; "Caused"; "to"; "Achaia's"; "host,"; "sent"; "many"; "a"; "soul"; Illustrious"; "into"; "Ades"; "premature,"; "And"; "Heroes"; "gave"; "(so"; "stood"; "the"; "will"; "of"; "Jove)"; "To"; "dogs"; "and"; "to"; "all"; "ravening"; "fowls"; "a"; "prey,"; "When"; "fierce"; "dispute"; "had"; "separated"; "once"; "The"; "noble"; "Chief"; "Achilles"; "from"; "the"; "son"; "Of"; "Atreus,"; "Agamemnon,"; "King"; "of"; "men."] Similarly with Japanese # [ "こぬ人を"; "まつほの浦の"; "夕なぎに"; "やくやもしほの"; "身もこがれつつ" ];; - : string list = ["こぬ人を"; "まつほの浦の"; "夕なぎに"; "やくやもしほの"; "身もこがれつつ"] or Sanskrit # [ "अग्निमीळे"; "पुरोहितं"; "यज्ञस्य"; "देवं रत्वीजम"; "होतारं"; "रत्नधातमम"; "अग्निः"; "पूर्वेभिर्र्षिभिरीड्यो"; "नूतनैरुत"; "स"; "देवानेह"; "वक्षति" ];; - : string list = ["अग्निमीळे"; "पुरोहितं"; "यज्ञस्य"; "देवं रत्वीजम"; "होतारं"; "रत्नधातमम"; "अग्निः"; "पूर्वेभिर्र्षिभिरीड्यो"; "नूतनैरुत"; "स"; "देवानेह"; "वक्षति"] Member ### gasche commented Jul 9, 2017 On the other hand, any of these examples are completely unreadable with the current pretty-printing scheme, so the output you show (if formatted a bit weirdly compared to the english version) is a strong improvement. Given that this only affect the toplevel output (and not calls to Format in user programs), I believe that not having a general solution to length formatting is fine. Contributor ### DemiMarie commented Jul 9, 2017 I think that Rust’s approach is best long-term one: strings must be in UTF-8 and are immutable. Creating a string that is not valid UTF-8 is undefined behavior. Contributor ### xavierleroy commented Jul 14, 2017 • edited Also, if I'm reading the code correctly, backslash is not escaped... Why not base your implementation on that of String.escaped / Bytes.escaped? That would avoid so many regressions. ### Octachronforce-pushed the Octachron:hello_κόσμος branch from 0b82612 to a9b3057Jul 14, 2017 Contributor Author ### Octachron commented Jul 14, 2017 There is a cosmetic regression w.r.t the current escaping of strings: CR, LF, TAB and BS are printed with numeric escapes, while previously they were printed \r, \n, \t, \b. They were not? At least not during my tests? (https://github.com/ocaml/ocaml/blob/trunk/stdlib/char.ml#L29) Also, if I'm reading the code correctly, backslash is not escaped... Of this, I am atrociously guilty. I should have added a test on the testsuite covering the whole ascii range. This lack of test is fixed. Why not base your implementation on that of String.escaped / Bytes.escaped? As wished, I have reimplemented the string escape in the style of Bytes.escaped. Contributor Contributor ### xavierleroy left a comment Looks very good to me, with a bit of LaTeX tweaking recommended. Changes Outdated @@ -530,6 +530,11 @@ Next major version (4.05.0): - PR#7060, GPR#1035: Print exceptions in installed custom printers (Tadeu Zagallo, review by David Allsopp) - GPR#1231: improved printing of unicode texts in the toplevel, when OCAMLTOP_UTF_8 is not set to false. #### xavierleroy Sep 11, 2017 Contributor "unless OCAMLTOP_UTF_8 is set to false" would read better, I think. #### Octachron Sep 12, 2017 Author Contributor I agree. Fixed. @@ -126,6 +126,10 @@ The following command-line options are recognized by the "ocaml" command. \begin{unix} The following environment variables are also consulted: \begin{options} \item["OCAMLTOP_UTF_8"] When printing string values, non-ascii bytes (>0x7E) are printed as decimal escape sequence if "OCAMLTOP_UTF_8" is #### xavierleroy Sep 11, 2017 Contributor (>0x7E) will format poorly in LaTeX, with the > character rendered as upside-down question mark or some such. Please format as a proper math formula: (${} > "\0x7E"$) #### Octachron Sep 12, 2017 Author Contributor Fixed. Member ### gasche commented Sep 12, 2017 I remarked while reading the code that the "max string length" parameter of the Oval_string node may not be respected, given that escaping (done after this test) may increase the length. However, (1) previous implementations and the Bytes codepath also suffer from this issue and (2) this parameter is currently not fixed by the user (then it would be nice to respect it) but by the Genprintval recursion-depth control code, so it sounds reasonable to only respect it approximately. Member ### gasche commented Sep 12, 2017 @Octachron I think you should feel free to rebase (if you want to squash some of the intermediary commits) and merge. ### Octachronforce-pushed the Octachron:hello_κόσμος branch from 3fb6deb to 2e6a78aSep 12, 2017 toplevel: only escapes bytes and not strings Escaping strings when printing them in the toplevel has the disadvantage of mangling unicode text: \# "한글";; - : string = "\237\149\156\234\184\128" With this commit, strings are not escaped anymore, contrarily to bytes: \# let cosmos = "κόσμος";; cosmos : string = "κόσμος" \# Bytes.of_string cosmos;; - : bytes = Bytes.of_string "\206\186\207\140\207\131\206\188\206\191\207\130" This new behavior can be disabled dynamically by setting the environment variable OCAMLTOP_UTF_8 to false This change is not solely aesthetic: the mangling of unicode string may contribute to the impression of some OCaml newcomers that Ocaml has no support for unicode. 2e6a78a ### Octachron merged commit 588c231 into ocaml:trunk Sep 13, 2017 2 checks passed #### 2 checks passed continuous-integration/appveyor/pr AppVeyor build succeeded Details continuous-integration/travis-ci/pr The Travis CI build passed Details Contributor Author ### Octachron commented Sep 13, 2017 Squashed to a single commit and merged. Contributor ### nojb commented Oct 5, 2017 There is another place where a similar treatment of strings may be a good idea, namely Printexc.to_string, see here. It currently uses %S which ends up escaping Unicode filenames (which can easily appear as arguments of Sys_error). Member ### gasche commented Oct 5, 2017 Do we want to consider relaxing the escaping in %S? The semantic specification, as I understand it, is to print strings in the way that they can be parsed back as OCaml literals. Maybe we can assume that unicode strings are parsed back as OCaml literals in a unicode file, so that non-escaping is justified? Member ### gasche commented Oct 5, 2017 (On the other hand, printing unicode on Windows seems to still be an open problem, so maybe escaping is not that bad?) Merged Member ### damiendoligez commented Oct 9, 2017 IMO Printexc.to_string is a debugging tool, its output should be seen by developers but not by end users. For a developer, it's probably more convenient to have the escaped version of the string. Closed Member ### yallop commented Jan 8, 2019 I was surprised just now by the change in escaping behaviour introduced by this PR. Running OCaml in an Emacs subshell, I see this: # "\255";; - : string = "\377" whereas before OCaml 4.06 I see this: # "\255";; - : string = "\255" What's happening: OCaml used to escape characters above 0x80 when printing strings, and printed them using the same decimal format used in string literals. However, since this PR such characters are now printed directly to the terminal instead. Since they can't be displayed directly, the terminal emulator prints them as octal escapes. Contributor ### xavierleroy commented Jan 8, 2019 I agree the octal escape is confusing. At least, Emacs colors the \377 in red, doesn't it? So, that gives a hint to the (experienced) Emacs user... Contributor ### shindere commented Jan 8, 2019 Xavier Leroy (2019/01/08 09:31 -0800): I agree the octal escape is confusing. At least, Emacs colors the \377 in red, doesn't it? So, that gives a hint to the (experienced) Emacs user... You mean experienced and sighted, right? Member ### yallop commented Jan 8, 2019 Emacs does indeed colour the \377, and the printed string behaves correctly in other ways: for example, copying and pasting the string produces the original value, and navigation commands treat the displayed \377 as a single character. Member ### yallop commented Jan 8, 2019 @shindere: while the colour hint is only useful for sighted users, I wonder whether users who don't rely on the visual interface avoid the confusing issue in the first place. For example, emacspeak seems to treat the printed character as a single unit (which I think it pronounces "y umlaut") rather than reading out the octal escape code. I'm curious whether the interface you use is similarly helpful. Contributor ### shindere commented Jan 8, 2019 Well unfortunately not. I am using a braille display which does not really have a way to convey the same kind of information, but it's great to read that emacspeak does such a great job, so many thanks for having reported this back! Open
2019-07-19 21:17: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": 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.5096185207366943, "perplexity": 7953.520520092401}, "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/1563195526359.16/warc/CC-MAIN-20190719202605-20190719224605-00426.warc.gz"}
https://eccc.weizmann.ac.il/report/2015/011/
Under the auspices of the Computational Complexity Foundation (CCF) REPORTS > DETAIL: ### Paper: TR15-011 | 22nd January 2015 15:19 #### On Monotonicity Testing and Boolean Isoperimetric type Theorems TR15-011 Authors: Subhash Khot, Dor Minzer, Muli Safra Publication: 22nd January 2015 15:21 give a monotonicity testing algorithm that makes $\tilde{O}(\sqrt{n}/\epsilon^2)$ non-adaptive queries to a function $f:\{0,1\}^n \mapsto \{0,1\}$, always accepts a monotone function and rejects a function that is $\epsilon$-far from
2018-11-18 00:13: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": 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.901512622833252, "perplexity": 8248.422542383365}, "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-47/segments/1542039743913.6/warc/CC-MAIN-20181117230600-20181118012600-00204.warc.gz"}
http://xxx.unizar.es/abs/1803.05953
math.CO (what is this?) # Title: Generalized Stirling Numbers I Abstract: We consider generalized Stirling numbers of the second kind $% S_{a,b,r}^{\alpha_{s},\beta_{s},r_{s},p_{s}}\left( p,k\right)$, $% k=0,1,\ldots .rp+\sum_{s=2}^{L}r_{s}p_{s}$, where $a,b,\alpha_{s},\beta_{s}$ are complex numbers, and $r,p,r_{s},p_{s}$ are non-negative integers given, $s=2,\ldots ,L$. (The case $a=1,b=0,r=1,r_{s}p_{s}=0$, corresponds to the standard Stirling numbers $S\left( p,k\right)$.) The numbers $% S_{a,b,r}^{\alpha_{s},\beta_{s},r_{s},p_{s}}\left( p,k\right)$ are connected with a generalization of Eulerian numbers and polynomials we studied in previous works. This link allows us to propose (first, and then to prove, specially in the case $r=r_{s}=1$) several results involving our generalized Stirling numbers, including several families of new recurrences for Stirling numbers of the second kind. In a future work we consider the recurrence and the differential operator associated to the numbers $% S_{a,b,r}^{\alpha_{s},\beta_{s},r_{s},p_{s}}\left( p,k\right)$. Subjects: Combinatorics (math.CO); Number Theory (math.NT) MSC classes: 11B73 Cite as: arXiv:1803.05953 [math.CO] (or arXiv:1803.05953v1 [math.CO] for this version) ## Submission history From: Claudio Pita Ruiz [view email] [v1] Thu, 15 Mar 2018 19:07:33 GMT (15kb)
2018-07-19 18:53: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": 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.5866663455963135, "perplexity": 1073.2890016277565}, "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/1531676591216.51/warc/CC-MAIN-20180719183926-20180719203926-00096.warc.gz"}
https://repository.uantwerpen.be/link/irua/104226
Publication Title Electron microscopy and X-ray structural investigations of incommensurate spin-ladder $Sr_{4.1}Ca_{4.7}Bi_{0.3}Cu_{17}O_{29}$ single crystals Author Abstract Transmission electron microscopy and X-ray diffraction proved chain/ladder incommensurate single crystal structure of investigated samples. The incommensurate ratio was determined from the X-ray and electron diffraction being equal to 0.704. Diffuse scattering intensities localised on the planes perpendicular to the c*-axis and passing through the spots originating from the periodicity of chain sublattice were detected. High-angle grain boundary or twinning formed by rotation of 33.3 degrees around [100] direction was observed. High-resolution electron microscopy images revealed the stacking faults in ac planes. Language English Source (journal) Acta physica Polonica: A: general physics, solid state physics, applied physics. - Warszawa Publication Warszawa : 2000 ISSN 0587-4246 Volume/pages 98:6(2000), p. 729-737 ISI 000166377600007 Full text (publisher's version - intranet only) UAntwerpen Faculty/Department Research group Publication type Subject Affiliation Publications with a UAntwerp address
2017-08-16 13:44:59
{"extraction_info": {"found_math": true, "script_math_tex": 1, "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.3155519664287567, "perplexity": 9121.493956953253}, "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-34/segments/1502886101966.48/warc/CC-MAIN-20170816125013-20170816145013-00671.warc.gz"}
https://socratic.org/questions/58c9d5e37c014932f2d0bb5c
# Question #0bb5c Mar 20, 2017 My lengthy analysis below... #### Explanation: The notation in (a) means that your electrodes consist of a silver electrode in a solution of $A {g}^{+}$ ions (like $A g N {O}_{3}$ dissolved in water). The standard electrode potential for this is +0.80 V. The other electrode is hydrogen gas bubbled over an inert platinum in an acidic solution (such as 1.0 M HCl). The standard potential is 0.00 V The double vertical line represents the barrier between the two half-cells. Since the $A g | | A {g}^{+}$ cell is greater in potential, it serves as the cathode, meaning that the half-reaction is $A {g}^{+} + {e}^{-}$$\rightarrow A g \left(s\right)$ The hydrogen cell is the anode, so oxidation occurs ${H}_{2} \left(g\right) \rightarrow 2 {H}^{+} + 2 {e}^{-}$ Together, the reaction is $2 A {g}^{+} + {H}_{2} \rightarrow 2 A g \left(s\right) + 2 {H}^{+}$ cell voltage 0.80 V In (b), we can start with two reduction half-reactions, and their potentials: $B {r}_{2} + 2 {e}^{-}$$\rightarrow 2 B {r}^{-}$ potential= +1.06 V $C {r}_{2} {O}_{7}^{2 -} + 14 {H}^{+} + 6 {e}^{-}$$\rightarrow 2 C {r}^{2 +} + 7 {H}_{2} O$ potential =+1.33V Both of these occur by passing the chemicals over an inert platinum electrode. Since the second half-reaction has the greater potential, it is the reduction (and the cathode). The bromine process is the oxidation (and the anode). So the half-reactions are $C {r}_{2} {O}_{7}^{2 -} + 14 {H}^{+} + 6 {e}^{-}$$\rightarrow 2 C {r}^{2 +} + 7 {H}_{2} O$ $2 B {r}^{-}$$\rightarrow B {r}_{2} + 2 {e}^{-}$ (We now know that the cell consists of one solution containing $B {r}^{-}$ ions and a second solution of $C {r}_{2} {O}_{7}^{2 -}$ ions into which the electrodes are placed. $B {r}_{2}$ and Cr^(3+) are the products.) Overall reaction: $6 B {r}^{-} + C {r}_{2} {O}_{7}^{2 -} + 14 {H}^{+}$$\rightarrow 2 C {r}^{2 +} + 7 {H}_{2} O + 3 B {r}_{2}$ Cell voltage 1.33 V - 1.06 V = 0.27 V
2022-01-18 15: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": 20, "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.8644700646400452, "perplexity": 12826.928957407097}, "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-2022-05/segments/1642320300934.87/warc/CC-MAIN-20220118152809-20220118182809-00546.warc.gz"}
https://agentfoundations.org/threads?id=Jessica_Taylor
by Jessica Taylor 72 days ago | Vadim Kosoy likes this | link | parent | on: Meta: IAFF vs LessWrong Apparently “You must be approved by an admin to comment on Alignment Forum”, how do I do this? Also is this officially the successor to IAFF? If so it would be good to make that more clear on this website. reply by Alex Mennen 71 days ago | link There should be a chat icon on the bottom-right of the screen on Alignment Forum that you can use to talk to the admins (unless only people who have already been approved can see this?). You can also comment on LW (Alignment Forum posts are automatically crossposted to LW), and ask the admins to make it show up on Alignment Forum afterwards. reply by Jessica Taylor 84 days ago | link | parent | on: Meta: IAFF vs LessWrong Strongly agree that all AI alignment research should at least be linked from here. reply by Jessica Taylor 84 days ago | link | parent | on: The Learning-Theoretic AI Alignment Research Agend... Delegative Reinforcement Learning aims to solve both problems by occasionally passing control to the human operator (“advisor”), and using it to learn which actions are safe. Why would you assume the existence of an advisor who can avoid taking catastrophic actions and sometimes take an optimal action? This would require some process capable of good judgment to understand many aspects of the AI’s decision-making process, such as its world models (as these models are relevant to which actions are catastrophic/optimal). Are you proposing a high degree of transparency, a bootstrapping process as in ALBA, or something else? reply by Jessica Taylor 83 days ago | link That captures part of it but I also don’t think the advisor takes sane actions when the AI is doing things to the environment that change the environment. E.g. the AI is implementing some plan to create a nuclear reactor, and the advisor doesn’t understand how nuclear reactors work. I guess you could have the AI first write the nuclear reactor plan in the diary, but this is essentially the same thing is transparency. reply by Vadim Kosoy 82 days ago | link Well, you could say it is the same thing as transparency. What is interesting about it is that, in principle, you don’t have to put in transparency by hand using some completely different techniques. Instead, transparency arises naturally from the DRL paradigm and some relatively mild assumptions (that there is a “diary”). The idea is that, the advisor would not build a nuclear reaction without seeing an explanation of nuclear reactors, so the AI also won’t do it too. reply by Jessica Taylor 84 days ago | link | parent | on: The Learning-Theoretic AI Alignment Research Agend... One hypothesis is, the main way humanity avoids traps is by happening to exist in a relatively favorable environment and knowing this fact, on some level. Specifically, it seems rather difficult for a single human or a small group to pursue a policy that will lead all of humanity into a trap (incidentally, this hypothesis doesn’t reflect optimistically on our chances to survive AI risk), and also rather rare for many humans to coordinate on simultaneously exploring an unusual policy. Therefore, human history may be very roughly likened to episodic RL where each human life is an episode. It’s pretty clear that humans avoid traps using thinking, not just learning. See: CFCs, mutually assured destruction. Yes, principles of thinking can be learned, but then they generalize better than learning theory can prove. See also: Not just learning reply by Vadim Kosoy 84 days ago | link When I say “learning” I only mean that the true environment is initially unknown. I’m not assuming anything about the internals of the algorithm. So, the question is, what desiderata can we formulate that are possible to satisfy by any algorithm at all. The collection of all environments is not learnable (because of traps), so we cannot demand the algorithm to be asymptotically optimal on every environment. Therefore, it seems like we need to assume something about the environment, if we want a definition of intelligence that accounts for the effectiveness of intelligence. Formulating such an assumption, making it rigorous, and backing it by rigorous analysis is the subproblem I’m presenting here. The particular sort of assumption I’m pointing at here might be oversimplified, but the question remains. reply by Jessica Taylor 83 days ago | link I agree that we’ll want some reasonable assumption on the environment (e.g. symmetry of physical laws throughout spacetime) that will enable thinking to generalize well. I don’t think that assumption looks like “it’s hard to cause a lot of destruction” or “the environment is favorable to you in general”. And I’m pretty sure that individual human lives are not the most important level of analysis for thinking about the learning required to avoid civilization-level traps (e.g. with CFCs, handling the situation required scientific and policy knowledge that no one knows at birth and no one could discover by themself over a lifetime) reply by Jessica Taylor 81 days ago | link So, there are are two environments: in environment X, button A corresponds to Heaven and in environment Y, button B corresponds to Heaven. Obviously both cannot be in a learnable class simultaneously. So, at least one of them has to be ruled out (and if we also want to preserve symmetry then both). What sort of assumption do you think will rule them out? I don’t think we should rule either of these out. The obvious answer is to give up on asymptotic optimality and do something more like utility function optimization instead. That would be moving out of the learning theory setting, which is a good thing. Asymptotic optimality can apply to bounded optimization problems and can’t apply to civilization-level steering problems. reply by Vadim Kosoy 81 days ago | link Well, we could give up on regret bounds and instead just consider algorithms that asymptotically approach Bayes-optimality. (This would not be moving out of the learning theory setting though? At least not the way I use this terminology.) Regret bounds would still be useful in the context of guaranteeing transfer of human knowledge and values to the AGI, but not in the context of defining intelligence. However, my intuition is that it would be the wrong way to go. For one thing, it seems that it is computationally feasible (at least in some weak sense, i.e. for a small number of hypotheses s.t. the optimal policy for each is feasible) to get asymptotic Bayes-optimality for certain learnable classes (PSRL is a simple example) but not in general. I don’t have a proof (and I would be very interested to see either a proof or a refutation), but it seems to be the case AFAIK. For another thing, consider questions such as, why intelligent agents outcompete instinct-based agents, and why general intelligence (i.e. Bayes optimality or at least some notion of good performance w.r.t. a prior that is “universal” or “nearly universal” in some sense) can be developed by evolution in a rather restricted environment. These questions seem much easier to answer if intelligence has some frequentist property (i.e. it is in some sense effective in all or most environments) compared to, if intelligence has only purely Bayesian properties (i.e. it is only good on average w.r.t. some very broad ensemble of environments). reply by Jessica Taylor 80 days ago | link For another thing, consider questions such as, why intelligent agents outcompete instinct-based agents, and why general intelligence (i.e. Bayes optimality or at least some notion of good performance w.r.t. a prior that is “universal” or “nearly universal” in some sense) can be developed by evolution in a rather restricted environment. These questions seem much easier to answer if intelligence has some frequentist property (i.e. it is in some sense effective in all or most environments) compared to, if intelligence has only purely Bayesian properties (i.e. it is only good on average w.r.t. some very broad ensemble of environments). I don’t understand why you think this. Suppose there is some simple “naturalized AIXI”-ish thing that is parameterized on a prior, and there exists a simple prior for which an animal running this algorithm with this prior does pretty well in our world. Then evolution may produce an animal running something like naturalized AIXI with this prior. But naturalized AIXI is only good on average rather than guaranteeing effectiveness in almost all environments. reply by Vadim Kosoy 80 days ago | link My intuition is that it must not be just a coincidence that the agent happens to works well in our world, otherwise your formalism doesn’t capture the concept of intelligence in full. For example, we are worried that a UFAI would be very likely to kill us in this particular universe, not just in some counterfactual universes. Moreover, Bayesian agents with simple priors often do very poorly in particular worlds, because of what I call “Bayesian paranoia”. That is, if your agent thinks that lifting its left arm will plausibly send it to hell (a rather simple hypothesis), it will never lift its left arm and learn otherwise. In fact, I suspect that a certain degree of “optimism” is inherent in our intuitive notion of rationality, and it also has a good track record. For example, when scientists did early experiments with electricity, or magnetism, or chemical reactions, their understanding of physics at the time was arguably insufficient to know this will not destroy the world. However, there were few other ways to go forward. AFAIK the first time anyone seriously worried about a physics experiment was the RHIC (unless you also count the Manhattan project, when Edward Teller suggested the atom bomb might create a self-sustaining nuclear fusion reaction that will envelope the entire atmosphere). These latter concerns were only raised because we already knew enough to point at specific dangers. Of course this doesn’t mean we shouldn’t be worried about X-risks! But I think that some form of a priori optimism is plausibly correct, in some philosophical sense. (There was also some thinking in that direction by Sunehag and Hutter although I’m not sold on the particular formalism they consider). reply by Jessica Taylor 78 days ago | link I think I understand your point better now. It isn’t a coincidence that an agent produced by evolution has a good prior for our world (because evolution tries many priors, and there are lots of simple priors to try). But the fact that there exists a simple prior that does well in our universe is a fact that needs an explanation. It can’t be proven from Bayesianism; the closest thing to a proof of this form is that computationally unbounded agents can just be born with knowledge of physics if physics is sufficiently simple, but there is no similar argument for computationally bounded agents. reply by Jessica Taylor 80 days ago | link Well, we could give up on regret bounds and instead just consider algorithms that asymptotically approach Bayes-optimality. I am not proposing this. I am proposing doing something more like AIXI, which has a fixed prior and does not obtain optimality properties on a broad class of environments. It seems like directly specifying the right prior is hard, and it’s plausible that learning theory research would help give intuitions/models about which prior to use or what non-Bayesian algorithm would get good performance in the world we actually live in, but I don’t expect learning theory to directly produce an algorithm we would be happy with running to make big decisions in our universe. reply by Vadim Kosoy 80 days ago | link Yes, I think that we’re talking about the same thing. When I say “asymptotically approach Bayes-optimality” I mean the equation from Proposition A.0 here. I refer to this instead of just Bayes-optimality, because exact Bayes-optimality is computationally intractable even for a small number of hypothesis each of which is a small MDP. However, even asymptotic Bayes-optimality is usually only tractable for some learnable classes, AFAIK: for example if you have environments without traps then PSRL is asymptotically Bayes-optimal. reply by Jessica Taylor 81 days ago | link I think that “scientific and policy knowledge that no one knows at birth and no one could discover by themself over a lifetime” is absolutely compatible with the hypothesis I outlined, even in its most naive form. If humanity’s progress is episodic RL where each human life is an episode, then of course each human uses the knowledge accumulated by previous humans. This is the whole idea of a learning algorithm in this setting. If RL is using human lives as episodes then humans should already be born with the relevant knowledge. There would be no need for history since all learning is encoded in the policy. History isn’t RL; it’s data summarization, model building, and intertemporal communication. reply by Vadim Kosoy 81 days ago | link This seems to be interpreting the analogy too literally. Humans are not born with the knowledge, but they acquire the knowledge through some protocol that is designed to be much easier than rediscovering it. Moreover, by “reinforcement learning” I don’t mean the same type of algorithms used for RL today, I only mean that the performance guarantee this process satisfies is of a certain form. reply by Jessica Taylor 81 days ago | link More generally, the idea of restricting to environments s.t. some base policy doesn’t fall into traps on them is not very restrictive. This rules out environments in which the second law of thermodynamics holds. reply by Vadim Kosoy 81 days ago | link No, it doesn’t rule out any particular environment. A class that consists only of one environment is tautologically learnable, by the optimal policy for this environment. You might be thinking of learnability by anytime algorithms whereas I’m thinking of learnability by non-anytime algorithms (what I called “metapolicies”), the way I defined it here (see Definition 1). reply by Jessica Taylor 80 days ago | link Ok, I am confused by what you mean by “trap”. I thought “trap” meant a set of states you can’t get out of. And if the second law of thermodynamics is true, you can’t get from a high-entropy state to a low-entropy state. What do you mean by “trap”? reply by Vadim Kosoy 80 days ago | link To first approximation, a “trap” is a an action s.t. taking it loses long-term value in expectation, i.e an action which is outside the set $$\mathcal{A}_M^0$$ that I defined here (see the end of Definition 1). This set is always non-empty, since it at least has to contain the optimal action. However, this definition is not very useful when, for example, your environment contains a state that you cannot escape and you also cannot avoid (for example, the heat death of the universe might be such a state), since, in this case, nothing is a trap. To be more precise we need to go from an analysis which is asymptotic in the time discount parameter to an analysis with a fixed, finite time discount parameter (similarly to how with time complexity, we usually start from analyzing the asymptotic complexity of an algorithm, but ultimately we are interested in particular inputs of finite size). For a fixed time time discount parameter, the concept of a trap becomes “fuzzy”: a trap is an action which loses a substantial fraction of the value. reply by Vadim Kosoy 81 days ago | link Consider also, evolution. Evolution can also be regarded as a sort of reinforcement learning algorithm. So why, during billions years of evolution, no gene sequence was created that somehow destroyed all life on Earth? It seems hard to come up with an answer other than “it’s hard to cause a lot of destruction”. Some speculation: I think that we have a sequence of reinforcement algorithms: evolution -> humanity -> individual human / small group (maybe followed by -> AGI) s.t. each step inherits the knowledge generated by the previous step and also applies more optimization pressure than the previous step. This suggests formulating a “favorability” assumption of the following form: there is a (possibly infinite) sequence of reinforcement learning algorithms A0, A1, A2… s.t. each algorithm is more powerful than the previous (e.g. has more computing power), and our environment has to be s.t. Running policy A0 has a small rate (at most $$\epsilon_0$$) of falling into traps. If we run A0 for some time $$T_0$$ (s.t. $$\epsilon_0 T_0 \ll 1$$), and then run A1 after updating on the observations during $$T_0$$, then A1 has a small rate (at most $$\epsilon_1$$) of falling into traps. Ditto when we add A2 …And so forth. The sequence {Ai} may be thought of as a sequence of agents or as just steps in the exploration of the environment by a single agent. So, our condition is that, each new “layer of reality” may be explored safely given that the previous layers were already studied. reply by Jessica Taylor 81 days ago | link Most species have gone extinct in the past. I would not be satisfied with an outcome where all humans die or 99% of humans die, even though technically humans might rebuild if there are any left and other intelligent life can evolve if humanity is extinct. These extinction levels can happen with foreseeable tech. Additionally, avoiding nuclear war requires continual cognitive effort to be put into the problem; it would be insufficient to use trial-and-error to avoid nuclear war. I don’t see why you would want a long sequence of reinforcement learning algorithms. At some point the algorithms produce things that can think, and then they should use their thinking to steer the future rather than trial-and-error alone. I don’t think RL algorithms would get the right answer on CFCs or nuclear war prevention. I am pretty sure that we can’t fully explore our current level, e.g. that would include starting nuclear wars to test theories about nuclear deterrence and nuclear winter. I really think that you are taking the RL analogy too far here; decision-making systems involving humans have some things in common with RL but RL theory only describes a fragment of the reasoning that these systems do. reply by Vadim Kosoy 81 days ago | link I don’t think you’re interpreting what I’m saying correctly. First, when I say “reinforcement learning” I don’t necessarily mean the type of RL algorithms that exist today. I just mean something that is designed to perform well (in some sense) in the face of uncertainty about the environment. Second, even existing RL algorithms are not pure trial-and-error. For example, posterior sampling maintains a belief state about the environment and runs the optimal policy for some environment sampled from the belief state. So, if the belief state “knows” that something is a bad/good idea then the algorithm doesn’t need to actually try it. Third, “starting nuclear wars to test theories” is the opposite of I’m trying to describe. What I’m saying is, we already have enough knowledge (acquired by exploring previous levels) to know that nuclear war is a bad idea, so exploring this level will not involve starting nuclear wars. What I’m trying to formalize is, what kind of environments allow this to happen consistently, i.e. being able to acquire enough knowledge to deal with a trap before you arrive at the trap. reply by Jessica Taylor 80 days ago | link First, when I say “reinforcement learning” I don’t necessarily mean the type of RL algorithms that exist today. I just mean something that is designed to perform well (in some sense) in the face of uncertainty about the environment. That is broad enough to include Bayesianism. I think you are imagining a narrower class of algorithms that can achieve some property like asymptotic optimality. Agree that this narrower class is much broader than current RL, though. Second, even existing RL algorithms are not pure trial-and-error. For example, posterior sampling maintains a belief state about the environment and runs the optimal policy for some environment sampled from the belief state. So, if the belief state “knows” that something is a bad/good idea then the algorithm doesn’t need to actually try it. I agree that if it knows for sure that it isn’t in some environment then it doesn’t need to test anything to perform well in that environment. But what if there is a 5% chance that the environment is such that nuclear war is good (e.g. because it eliminates other forms of destructive technology for a long time)? Then this AI would start nuclear war with 5% probability per learning epoch. This is not pure trial-and-error but it is trial-and-error in an important relevant sense. What I’m trying to formalize is, what kind of environments allow this to happen consistently, i.e. being able to acquire enough knowledge to deal with a trap before you arrive at the trap. This seems like an interesting research approach and I don’t object to it. I would object to thinking that algorithms that only handle this class of environments are safe to run in our world (which I expect is not of this form). To be clear, while I expect that a Bayesian-ish agent has a good chance to avoid very bad outcomes using the knowledge it has, I don’t think anything that attains asymptotic optimality will be useful while avoiding very bad outcomes with decent probability. reply by Vadim Kosoy 80 days ago | link Actually, I am including Bayesianism in “reinforcement learning” in the broad sense, although I am also advocating for some form of asymptotic optimality (importantly, it is not asymptotic in time like often done in the literature, but asymptotic in the time discount parameter; otherwise you give up on most of the utility, like you pointed out in an earlier discussion we had). In the scenario you describe, the agent will presumably discard (or, strongly penalize the probability of) the pro-nuclear-war hypothesis first since the initial policy loses value much faster on this hypothesis compared to the anti-nuclear-war hypothesis (since the initial policy is biased towards the more likely anti-nuclear-war hypothesis). It will then remain with the anti-nuclear-war hypothesis and follow the corresponding policy (of not starting nuclear war). Perhaps this can be formalized as searching for a fixed point of some transformation. reply by Vadim Kosoy 79 days ago | link After thinking some more, maybe the following is natural way towards formalizing the optimism condition. Let $$H$$ be the space of hypotheses and $$\xi_0 \in \Delta H$$ be the “unbiased” universal prior. Given any $$\zeta \in \Delta H$$, we denote $$\hat{\zeta} = E_{\mu \sim \zeta}[\mu]$$, i.e. the environment resulting from mixing the environments in the belief state $$\zeta$$. Given an environment $$\mu$$, let $$\pi^\mu$$ be the Bayes-optimal policy for $$\mu$$ and $$\pi^\mu_\theta$$ the perturbed Bayes-optimal policy for $$\mu$$, where $$\theta$$ is a perturbation parameter. Here, “perturbed” probably means something like softmax expected utility, but more thought is needed. Then, the “optimistic” prior $$\xi$$ is defined as a solution to the following fixed point equation: $\xi(\mu) = Z^{-1} \xi_0(\mu) \exp(\beta(E_{\mu\bowtie\pi^{\hat{\xi}}_\theta}[U]-E_{\mu\bowtie\pi^\mu}[U]))$ Here, $$Z$$ is a normalization constant and $$\beta$$ is an additional parameter. This equation defines something like a softmax Nash equilibrium in a cooperative game of two players where, one player chooses $$\mu$$ (so that $$\xi$$ is eir mixed strategy), another player chooses $$\pi$$ and the utility is minus regret (alternatively, we might want to choose only Pareto efficient Nash equilibria). The parameter $$\beta$$ controls optimism regarding the ability to learn the environment, whereas the parameter $$\theta$$ represents optimism regarding the presence of slack: ability to learn despite making some errors or random exploration (how to choose these parameters is another question). Possibly, the idea of exploring the environment “layer by layer” can be recovered from combining this with hierarchy assumptions. reply by Jessica Taylor 78 days ago | link This seems like a hack. The equilibrium policy is going to assume that the environment is good to it in general in a magical fashion, rather than assuming the environment is good to it in the specific ways we should expect given our own knowledge of how the environment works. It’s kind of like assuming “things magically end up lower than you expected on priors” instead of having a theory of gravity. I think there is something like a theory of gravity here. The things I would note about our universe that make it possible to avoid a lot of traps include: Physical laws are symmetric across spacetime. Physical laws are spacially local. The predictable effects of a local action are typically local; most effects “dissipate” after a while (e.g. into heat). The butterfly effect is evidence for this rather than against this, since it means many effects are unpredictable and so can be modeled thermodynamically. When small changes have big and predictable effects (e.g. in a computer), there is often agentic optimization power towards the creation and maintenance of this system of effects, and in these cases it is possible for at least some agents to understand important things about how the system works. Some “partially-dissipated” effects are statistical in nature. For example, an earthquake hitting an area has many immediate effects, but over the long term the important effects are things like “this much local productive activity was disrupted”, “this much local human health was lost”, etc. You have the genes that you do because evolution, which is similar to a reinforcement learning algorithm, believed that these genes would cause you to survive and reproduce. If we construct AI systems, we will give them code (including a prior) that we expect to cause them to do something useful for us. In general, the agency of an agent’s creator should affect the agent’s beliefs. If there are many copies of an agent, and successful agents are able to repurpose the resources of unsuccessful ones, then different copies can try different strategies; some will fail but the successful ones can then repurpose their resources. (Evolution can be seen as a special case of this) Some phenemona have a “fractal” nature, where a small thing behaves similar to a big thing. For example, there are a lot of similarities between the dynamics of a nation and the dynamics of a city. Thus small things can be used as models of big things. If your interests are aligned with those of agents in your local vicinity, then they will mostly try to help you. (This applies to parents making their children’s environment safe) I don’t have an elegant theory yet but these observations seem like a reasonable starting point for forming one. reply by Vadim Kosoy 77 days ago | link I think that we should expect evolution to give us a prior that is a good lossy compression of actual physics (where “actual physics” means, those patterns the universe has that can be described within our computational complexity bounds). Meaning that, on the one hand it should be low description complexity (otherwise it will be hard for evolution to find it), and on the other hand it should be assign high probability to the true environment (in other words, the KL divergence of the true environment from the prior should be small). And also it should be approximately learnable, otherwise it won’t go from assigning high probability to actually performing well. The principles you outlined seem reasonable overall. Note that the locality/dissipation/multiagent assumptions amount to a special case of “the environment is effectively reversible (from the perspective of the human species as a whole) as long as you don’t apply too much optimization power” (“optimization power” probably translates to divergence from some baseline policy plus maybe computational complexity considerations). Now, as you noted before, actual macroscopic physics is not reversible, but it might still be effectively reversible if you have a reliable long-term source of negentropy (like the sun). Maybe we can also slightly relax them by allowing irreversible changes as long as they are localized and the available space is sufficiently big. “If we construct AI systems, we will give them code (including a prior) that we expect to cause them to do something useful for us. In general, the agency of an agent’s creator should affect the agent’s beliefs” is essentially what DRL does: allows transferring our knowledge to the AI without hard-coding it by hand. “When small changes have big and predictable effects (e.g. in a computer), there is often agentic optimization power towards the creation and maintenance of this system of effects, and in these cases it is possible for at least some agents to understand important things about how the system works” seems like it would allow us to go beyond effective reversibility, but I’m not sure how to formalize it or whether it’s a justified assumption. One way towards formalizing it is, the prior is s.t. studying the initial state approximate communication class allows determining the entire environment, but this seems to point at a very broad class of approximately learnable priors w/o specifying a criterion how to choose among them. Another principle that we can try to use is, the ubiquity of analytic functions. Analytic functions have the property that, knowing the function in a bounded domain allows extrapolating it everywhere. This is different from allowing arbitrary computable functions which may have “if” clauses, so that studying the function in a bounded domain is never enough to be sure about its behavior outside it. In particular, this line of inquiry seems relatively easy to formalize using continuous MDPs (although we run into the problem that finding the optimal policy is infeasible, in general). Also, it might have something to do with the effectiveness of neural networks (although the popular ReLU response function is not analytic). reply by Jessica Taylor 84 days ago | link | parent | on: The Learning-Theoretic AI Alignment Research Agend... Now, if the AI is implementing DRL, the uncertainty between Earth and Mu leads it to delegate to the advisor precisely at the moment this difference is important. It seems like this is giving up on allowing the AI to make long-term predictions. It can make short-term, testable predictions (since if different advisors disagree, it is possible to see who is right). But long-term predictions can’t be cheaply tested. In the absence of long-term predictions, it still might be possible to do something along the lines of what Paul is thinking of (i.e. predicting human judgments of longer-term things), but I don’t see what else you could do. Does this match your model? reply by Vadim Kosoy 84 days ago | link I’m not giving up on long-term predictions in general. It’s just that, because of traps, some uncertainties cannot be resolved by testing, as you say. In those cases the AI has to rely on what it learned from the advisor, which indeed amounts to human judgment. reply by Jessica Taylor 129 days ago | link | parent | on: Predicting HCH using expert advice Note: I currently think that the basic picture of getting within $$\epsilon$$ of a good prediction is actually pretty sketchy. I wrote about the sample complexity here. Additional to the sample complexity issues, the requirement is for predictors to be Bayes-optimal, but Bayes-optimality is not possible for bounded reasoners. This is important because e.g. some adversarial predictor might make very good predictions on some subset of questions (because it’s spending its compute on those specifically), causing other predictors to be filtered out (if those questions are used to determine who the best predictor is). I don’t know what kind of analysis could get the $$\epsilon$$-accuracy result at this point. reply by Jessica Taylor 138 days ago | link | parent | on: Doubts about Updatelessness Counterfactual mugging doesn’t require spoofing. Consider the following problem: Suppose no one, given $$10^{5}$$ steps of computation, is able to compute any information about the parity of the $$10^{10}$$th digit of $$\pi$$, and everyone, given $$10^{100}$$ steps of computation, is able to compute the $$10^{10}$$th digit of $$\pi$$. Suppose that at time $$t$$, everyone has $$10^5$$ steps of computation, and at a later time $$t'$$, everyone has $$10^{100}$$ steps of computation. At the initial time $$t$$, Omega selects a probability $$p$$ equal to the conditional probability Omega assigns to the agent paying $1 at time $$t'$$ conditional on the digit being odd. (This could be because Omega is a logical inductor, or because Omega is a CDT agent whose utility function is such that selecting this value of $$p$$ is optimal). At time $$t'$$, if the digit is even, a fair coin with probability $$p$$ of coming up heads is flipped, and if it comes up heads, Omega pays the agent$10. If instead the digit is odd, then the agent has the option of paying Omega \$1. This contains no spoofing, and the optimal policy for the agent is to pay up if asked. reply by Jessica Taylor 170 days ago | link | parent | on: Musings on Exploration The true reason to do exploration seems to be because the agent believes the action it is taking will not lead to an irreversible trap, and because it believes that the action will reveal information about the true environment that enables a better policy later on, which in expectation up to the time horizon, outweighs the temporary loss incurred due to exploring. My understanding of logical inductor exploration (e.g. in asymptotic decision theory) is that the exploration steps the agent learns from mostly don’t happen in its own lifetime, rather they happen in the lifetimes of similar but simpler agents. This allows exploration to work for single-shot problems such as 5 and 10. Intuitively, if you are in a 5 and 10 problem and your brain has size 10^1000, then you can simulate someone whose brain has size 10^999 doing a 5 and 10 problem, and thereby learn the relation between the agent’s action and how much utility they get. So each particular agent has some chance of exploring irrecoverably, but in aggregate not many of them will (and it’s hard to predict which will and which won’t). As far as I can tell, the only strategy that doesn’t have some sort of targetable exploration behavior is Thompson sampling. Thompson sampling still randomizes (it randomizes its belief about the world it’s in) and is therefore vulnerable to troll bridge. reply by Alex Appel 169 days ago | link A: While that is a really interesting note that I hadn’t spotted before, the standard formulation of exploration steps in logical inductor decision theory involve infinite exploration steps over all time, so even though an agent of this type would be able to inductively learn from what other agents do in different decision problems in less time than it naively appears, that wouldn’t make it explore less. B: What I intended with the remark about Thompson sampling was that troll bridge functions on there being two distinct causes of “attempting to cross the bridge”. One is crossing because you believe it to be the best action, and the other is crossing because an exploration step occurred, and Thompson sampling doesn’t have a split decision criterion like this. Although now that you point it out, it is possible to make a Thompson sampling variant where the troll blows up the bridge when “crossing the bridge” is not the highest-ranked action. reply by Jessica Taylor 400 days ago | link | parent | on: Autopoietic systems and difficulty of AGI alignmen... That makes sense. OK, it seems like I misinterpreted your comment on philosophy. But in this post you seem to be saying that we might not need to solve philosophical problems related to epistemology and agency? That concept also seems useful and different from autopoiesis as I understand it (since it requires continual human cognitive work to run, though not very much). reply by Paul Christiano 400 days ago | link I think that we can avoid coming up with a good decision theory or priors or so on—there are particular reasons that we might have had to solve philosophical problems, which I think we can dodge. But I agree that we need or want to solve some philosophical problems to align AGI (e.g. defining corrigibility precisely is a philosophical problem). reply by Jessica Taylor 400 days ago | link | parent | on: Autopoietic systems and difficulty of AGI alignmen... I’m curious what initially triggered this. I tried to solve the problem and found that I thought it was very hard to make the sort of substantial progress that would meaningfully bridge the gap from our current epistemic/philosophical state to the state where the problem is largely solved. I did make incremental progress, but not the sort of incremental progress I saw as attacking the really hard problems. Towards the later parts of my work at MIRI, I was doing research that seemed to be largely overlapping with complex systems theory (in order to reason about how to align autopoietic systems similar to evolution) in a way that made it hard to imagine that I’d come up with useful crisp formal definitions/proofs/etc. This seems a bit low, given that there’s a number of disjunctive ways that it could happen. I feel like saying 2% now. Not sure what caused the update. I’m pretty worried that such technology will accelerate value drift within the current autopoietic system. I’m also worried about something like this, though I would state the risk as “mass insanity” rather than “value drift”. (“Value drift” brings to mind an individual or group trying to preserve their current object-level values, rather than trying to preserve somewhat-universal human values and sane reflection processes) reply by Wei Dai 400 days ago | link I hope you stay engaged with the AI risk discussions and maintain your credibility. I’m really worried about the self-selection effect where people who think AI alignment is really hard end up quitting or not working in the field in the first place, and then it appears to outsiders that all of the AI safety experts don’t think the problem is that hard. I’m also worried about something like this, though I would state the risk as “mass insanity” rather than “value drift”. (“Value drift” brings to mind an individual or group trying to preserve their current object-level values, rather than trying to preserve somewhat-universal human values and sane reflection processes) I’m envisioning that in the future there will also be systems where you can input any conclusion that you want to argue (including moral conclusions) and the target audience, and the system will give you the most convincing arguments for it. At that point people won’t be able to participate in any online (or offline for that matter) discussions without risking their object-level values being hijacked. You didn’t respond to my point that defending against this type of technology does seem to require solving hard philosophical problems. What are your thoughts on this? reply by Paul Christiano 400 days ago | link defending against this type of technology does seem to require solving hard philosophical problems Why is this? The case you describe seems clearly contrary to my preferences about how I should reflect. So a system which helped me implement my preferences would help me avoid this situation (in the same way that it would help me avoid being shot, or giving malware access to valuable computing resources). It seems quite plausible that we’ll live to see a world where it’s considered dicey for your browser to uncritically display sentences written by an untrusted party. reply by Vladimir Slepnev 399 days ago | link figure out what my values actually are / should be I think many human ideas are like low resolution pictures. Sometimes they show simple things, like a circle, so we can make a higher resolution picture of the same circle. That’s known as formalizing an idea. But if the thing in the picture looks complicated, figuring out a higher resolution picture of it is an underspecified problem. I fear that figuring out my values over all possible futures might be that kind of problem. So apart from hoping to define a “full resolution picture” of human values, either by ourselves or with the help of some AI or AI-human hybrid, it might be useful to come up with approaches that avoid defining it. That was my motivation for this post, which directly uses our “low resolution” ideas to describe some particular nice future without considering all possible ones. It’s certainly flawed, but there might be other similar ideas. Does that make sense? reply by Wei Dai 397 days ago | link I think I understand what you’re saying, but my state of uncertainty is such that I put a lot of probability mass on possibilities that wouldn’t be well served by what you’re suggesting. For example, the possibility that we can achieve most value not through the consequences of our actions in this universe, but through their consequences in much larger (computationally richer) universes simulating this one. Or that spreading hedonium is actually the right thing to do and produces orders of magnitude more value than spreading anything that resembles human civilization. Or that value scales non-linearly with brain size so we should go for either very large or very small brains. While discussing the VR utopia post, you wrote “I know you want to use philosophy to extend the domain, but I don’t trust our philosophical abilities to do that, because whatever mechanism created them could only test them on normal situations.” I have some hope that there is a minimal set of philosophical abilities that would allow us to eventually solve arbitrary philosophical problems, and we already have this. Otherwise it seems hard to explain the kinds of philosophical progress we’ve made, like realizing that other universes probably exist, and figuring out some ideas about how to make decisions when there are multiple copies of us in this universe and others. Of course it’s also possible that’s not the case, and we can’t do better than to optimize the future using our current “low resolution” values, but until we’re a lot more certain of this, any attempt to do this seems to constitute a strong existential risk. reply by Jessica Taylor 400 days ago | link I agree that selection bias is a problem. I plan on discussing and writing about AI alignment somewhat in the future. Also note that Eliezer and Nate think the problem is pretty hard and unlikely to be solved. You didn’t respond to my point that defending against this type of technology does seem to require solving hard philosophical problems. What are your thoughts on this? Automation technology (in an adversarial context) is kind of like a very big gun. It projects a lot of force. It can destroy lots of things if you point it wrong. It might be hard to point at the right target. And you might kill or incapacitate yourself if you do something wrong. But it’s inherently stupid, and has no agency by itself. You don’t have to solve philosophy to deal with large guns, you just have to do some combination of (a) figure out how to wield them to do good with them, (b) get people to stop using them, (c) find strategies for fighting against them, or (d) defend against them. (Certainly, some of these things involve philosophy, but they don’t necessarily require fully formalizing anything). The threat is different in kind from that of a fully-automated autopoietic cognitive system, which is more like a big gun possessed by an alien soul. reply by Wei Dai 398 days ago | link You don’t have to solve philosophy to deal with large guns, you just have to do some combination of (a) figure out how to wield them to do good with them, (b) get people to stop using them, (c) find strategies for fighting against them, or (d) defend against them. Do you have ideas for how to do these things, for the specific “big gun” that I described earlier? The threat is different in kind from that of a fully-automated autopoietic cognitive system, which is more like a big gun possessed by an alien soul. If the big gun is being wielded by humans whose values and thought processes have been corrupted (by others using that big gun, or through some other way like being indoctrinated in bad ideas from birth), that doesn’t seem very different from a big gun possessed by an alien soul. reply by Jessica Taylor 396 days ago | link Do you have ideas for how to do these things, for the specific “big gun” that I described earlier? Roughly, minimize direct contact with things that cause insanity, be the sanest people around, and as a result be generally more competent than the rest of the world at doing real things. At some point use this capacity to oppose things that cause insanity. I haven’t totally worked this out. If the big gun is being wielded by humans whose values and thought processes have been corrupted (by others using that big gun, or through some other way like being indoctrinated in bad ideas from birth), that doesn’t seem very different from a big gun possessed by an alien soul. It’s hard to corrupt human values without corrupting other forms of human sanity, such as epistemics and general ability to do things. reply Older ### NEW DISCUSSION POSTS There should be a chat icon by Alex Mennen on Meta: IAFF vs LessWrong | 0 likes Apparently "You must be by Jessica Taylor on Meta: IAFF vs LessWrong | 1 like There is a replacement for by Alex Mennen on Meta: IAFF vs LessWrong | 1 like Regarding the physical by Vadim Kosoy on The Learning-Theoretic AI Alignment Research Agend... | 0 likes I think that we should expect by Vadim Kosoy on The Learning-Theoretic AI Alignment Research Agend... | 0 likes I think I understand your by Jessica Taylor on The Learning-Theoretic AI Alignment Research Agend... | 0 likes This seems like a hack. The by Jessica Taylor on The Learning-Theoretic AI Alignment Research Agend... | 0 likes After thinking some more, by Vadim Kosoy on The Learning-Theoretic AI Alignment Research Agend... | 0 likes Yes, I think that we're by Vadim Kosoy on The Learning-Theoretic AI Alignment Research Agend... | 0 likes My intuition is that it must by Vadim Kosoy on The Learning-Theoretic AI Alignment Research Agend... | 0 likes To first approximation, a by Vadim Kosoy on The Learning-Theoretic AI Alignment Research Agend... | 0 likes Actually, I *am* including by Vadim Kosoy on The Learning-Theoretic AI Alignment Research Agend... | 0 likes Yeah, when I went back and by Alex Appel on Optimal and Causal Counterfactual Worlds | 0 likes > Well, we could give up on by Jessica Taylor on The Learning-Theoretic AI Alignment Research Agend... | 0 likes > For another thing, consider by Jessica Taylor on The Learning-Theoretic AI Alignment Research Agend... | 0 likes
2018-09-23 15:09: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": 2, "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.6425796151161194, "perplexity": 895.5587168888304}, "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/1537267159470.54/warc/CC-MAIN-20180923134314-20180923154714-00084.warc.gz"}
https://www.khanacademy.org/math/cc-1st-grade-math/cc-1st-add-subtract/cc-1st-word-problems-more-fewer-20/e/addition-and-subtraction-word-problems-within-20--level-4
# Word problems with "more" and "fewer" 2 ### Problem There was a group of unicorns talking in a field. 7 of them ran away. 9 of them were left. In total, how many unicorns were talking in a field? unicorns
2017-06-25 00:17:52
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 7, "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.2746785879135132, "perplexity": 6768.399556028665}, "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-26/segments/1498128320368.57/warc/CC-MAIN-20170624235551-20170625015551-00385.warc.gz"}
https://www.khronos.org/registry/vulkan/specs/1.0/man/html/VkExtensionProperties.html
C Specification The VkExtensionProperties structure is defined as: typedef struct VkExtensionProperties { char extensionName[VK_MAX_EXTENSION_NAME_SIZE]; uint32_t specVersion; } VkExtensionProperties; Members • extensionName is a null-terminated string specifying the name of the extension. • specVersion is the version of this extension. It is an integer, incremented with backward compatible changes. Description vkEnumerateDeviceExtensionProperties, vkEnumerateInstanceExtensionProperties Document Notes This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification,not directly.
2017-02-21 03:04:32
{"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.4066653847694397, "perplexity": 14750.35770367877}, "config": {"markdown_headings": false, "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-2017-09/segments/1487501170624.14/warc/CC-MAIN-20170219104610-00394-ip-10-171-10-108.ec2.internal.warc.gz"}
https://physics.stackexchange.com/questions/402530/is-newtons-third-law-due-to-inertia
# Is Newton's third law due to inertia? Newton's third law states that each force has an equal and opposite force. If I kicked a ball, it would apply the same force on me. Is this due to the ball's inertia? To clarify, is the ball exerting a force on me because it wants to stay in its original position? • – leongz Apr 27 '18 at 21:39 Newton's third law is a consequence of conservation of momentum, which we have never been able to falsify. Consider a system of two particles with total momentum $\vec P$ such that $$\vec P = \vec p_1 + \vec p_2.$$ Noting the relationship between force and impulse, $\vec F = \frac{d\vec p}{dt}$, we can take a time derivative to find $$\frac{d\vec P}{dt} = \frac{d\vec p_1}{dt} + \frac{d\vec p_2}{dt} = \vec F_{\rm 2\, on\, 1} + \vec F_{\rm 1\, on\, 2}.$$ If the total momentum is conserved, then $\frac{d \vec P}{dt} = 0$, and we have $$\vec F_{\rm 2\, on\, 1} = - \vec F_{\rm 1\, on\, 2}.$$ The ball exerts a force back on you in order to conserve linear momentum. • What about a static case? – V.F. Apr 28 '18 at 1:58 • V.F. The total momentum is still constant. – Bill N Apr 28 '18 at 2:31 • I don't disagree with that, but in your derivation, you rely on the relationship F=dp/dt for each particle, which does not seem to be valid in the static case. – V.F. Apr 28 '18 at 14:41
2019-09-18 18:07:42
{"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.6747872829437256, "perplexity": 268.33404197481093}, "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/1568514573323.60/warc/CC-MAIN-20190918172932-20190918194932-00393.warc.gz"}
http://math.stackexchange.com/questions/643283/a-definition-of-injectivity
# A definition of injectivity Def 1: A function $f$ is said to be injective just in case: $$\forall a, b \in \mathrm{dom}(f): f(a) = f(b)\Longrightarrow a = b.$$ Will this alternative definition capture the same idea? Def 2: A function $f$ is said to be injective just in case: $$f^{-1}~\rm{is~a ~function}.$$ If 'no', what might be added to make it work? - Yes, as long as you pick the right domain for the inverse, otherwise it is not even defined. The domain has to be the image of $f$ or a subset of it for the inverse to be defined. - Assuming $f^{-1}$ is defined on the appropriate domain, you can think of it like this: $f^{-1}$ is a function $\Rightarrow \forall \hat a,\hat b \in \mathrm {dom} f^{-1}, \hat a = \hat b \Rightarrow f^{-1}(\hat a) = f^{-1}(\hat b)$ but $\hat a = f(a), \hat b = f(b)$, where $a, b \in \mathrm {dom} f$ and $f^{-1}(\hat a) = f^{-1}(f(a)) = a, f^{-1}(\hat b) = f^{-1}(f(b)) = b$. So we have $f(a) = f(b) \Rightarrow a = b$.
2014-04-16 07:39: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": 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.9555934071540833, "perplexity": 85.54495871608663}, "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-15/segments/1397609521558.37/warc/CC-MAIN-20140416005201-00609-ip-10-147-4-33.ec2.internal.warc.gz"}
http://lmpa.univ-littoral.fr/spip.php?article12&personne=Michel
L.M.P.A Laboratoire de Mathématiques Pures et Appliquées Joseph Liouville ## Joachim Michel • Equipe : Analyse LMPA Centre Universitaire de la Mi-Voix 50 rue F. Buisson CS 80699 62228 Calais • Bureau : C135 • Email : Joachim.Michel@lmpa.univ-littoral.fr • Téléphone : 03.21.46.36.50 ## Publications ### Livres 1. Beiträge zur komplexen Analysis (, and ), Universität Bonn Mathematisches Institut, . 2. The Cauchy-Riemann complex ( and ), Friedr. Vieweg & Sohn, . 3. Der Neumannoperator auf streng pseudokonkaven Gebieten und andere Anwendungen der Integralformelmethode (), Universität Bonn Mathematisches Institut, . 4. Integralformeln in der komplexen Analysis (), Universität Bonn Mathematisches Institut, . ### Articles de revues 1. Minimal sumsets in finite solvable groups ( and ), In Discrete Math., volume 310, . [pdf] 2. On the product of vector spaces in a commutative field extension (, and ), In J. Number Theory, volume 129, . [pdf] 3. Bounds on the minimal sumset size function in groups ( and ), In Int. J. Number Theory, volume 3, . [pdf] 4. Some results on minimal sumset sizes in finite non-abelian groups ( and ), In J. Number Theory, volume 124, . [pdf] 5. The small sumsets property for solvable finite groups ( and ), In European J. Combin., volume 27, . [pdf] 6. Sumsets in dihedral groups ( and ), In European J. Combin., volume 27, . [pdf] 7. A survey on modular Hadamard matrices ( and ), In Discrete Math., volume 302, . [pdf] 8. Old and new formulas for the Hopf-Stiefel and related functions ( and ), In Expo. Math., volume 23, . [pdf] 9. Minimal sumsets in infinite abelian groups ( and ), In J. Algebra, volume 287, . [pdf] 10. A note on the Hopf-Stiefel function ( and ), In Enseign. Math. (2), volume 49, . 11. Optimally small sumsets in finite abelian groups (, and ), In J. Number Theory, volume 101, . [pdf] 12. Circulant 16-modular Hadamard matrices and Jacobi sums ( and ), In J. Combin. Theory Ser. A, volume 100, . [pdf] 13. Circulant modular Hadamard matrices ( and ), In Enseign. Math. (2), volume 47, . 14. Restricted sums of sets of cardinality $1+p$ in a vector space over $\mathbf{F}_p$ ( and ), In Discrete Math., volume 235, . [pdf] 15. Restricted sumsets in finite vector spaces: the case $p=3$ ( and ), In Integers, volume 1, . 16. Modular sequences and modular Hadamard matrices ( and ), In J. Combin. Des., volume 9, . [pdf] 17. Sumsets in vector spaces over finite fields ( and ), In J. Number Theory, volume 71, . [pdf] 18. Compressible difference lists. An appendix to: "A note on the equation $\theta \overline{ \theta}=n+\lambda\Sigma$" [J.\ Statist.\ Plann.\ Inference \bf 62 (1997), no.\ 1, 21–34] by Eliahou and Kervaire (, and ), In J. Statist. Plann. Inference, volume 62, . [pdf] 19. A note on the equation $\theta \overline{ \theta}=n+\lambda\Sigma$ ( and ), In J. Statist. Plann. Inference, volume 62, . [pdf] 20. Corrigendum to: "Barker sequences and difference sets" [Enseign.\ Math. (2) \bf 38 (1992), no.\ 3-4, 345–382; MR1189012 (93i:11018)] ( and ), In Enseign. Math. (2), volume 40, . 21. Barker sequences and difference sets ( and ), In Enseign. Math. (2), volume 38, . 22. On Golay polynomial pairs (, and ), In Adv. in Appl. Math., volume 12, . [pdf] 23. A new restriction on the lengths of Golay complementary sequences (, and ), In J. Combin. Theory Ser. A, volume 55, . [pdf] 24. Minimal resolutions of some monomial ideals ( and ), In J. Algebra, volume 129, . [pdf] 25. Comportement local moyen de la fonction de Brjuno ( and ), In Fund. Math., volume 218, . [pdf] 26. $\scr C^\infty$-regularity of the tangential Cauchy-Riemann equations on Levi-flat submanifolds of $\Bbb C^n$ (), In Kyushu J. Math., volume 59, . [pdf] 27. The $\overline\partial$-Neumann operator on Lipschitz pseudoconvex domains with plurisubharmonic defining functions ( and ), In Duke Math. J., volume 108, . [pdf] 28. The $\overline\partial$ problem on domains with piecewise smooth boundaries with applications ( and ), In Trans. Amer. Math. Soc., volume 351, . [pdf] 29. A decomposition problem on weakly pseudoconvex domains ( and ), In Math. Z., volume 230, . [pdf] 30. $C^\infty$-regularity of solutions of the tangential CR-equations on weakly pseudoconvex manifolds ( and ), In Math. Ann., volume 311, . [pdf] 31. Subelliptic estimates for the $\overline\partial$-Neumann operator on piecewise smooth strictly pseudoconvex domains ( and ), In Duke Math. J., volume 93, . [pdf] 32. On the regularity of CR structures for almost CR vector bundles ( and ), In Math. Z., volume 218, . [pdf] 33. $C^k$-regularity for the $\overline\partial$-equation on a piecewise smooth union of strictly pseudoconvex domains in ${\bf C}^n$ ( and ), In Ann. Scuola Norm. Sup. Pisa Cl. Sci. (4), volume 21, . [pdf] 34. Regularity of local embeddings of strictly pseudoconvex CR structures ( and ), In J. Reine Angew. Math., volume 447, . [pdf] 35. Local regularity for the tangential Cauchy-Riemann complex ( and ), In J. Reine Angew. Math., volume 442, . [pdf] 36. A pseudoconvex domain with bounded solutions for $\overline\partial$, but not admitting $\scr C^1$-estimates (), In Math. Z., volume 213, . [pdf] 37. $\scr C^{k+a}$-estimates for the $\overline\partial$-equation on the Hartogs triangle ( and ), In Math. Ann., volume 294, . [pdf] 38. Integral representations on weakly pseudoconvex domains (), In Math. Z., volume 208, . [pdf] 39. An asymptotic formula for the Bergman projection on a certain class of domains in ${\bf C}$ (), In Arch. Math. (Basel), volume 55, . [pdf] 40. $C^k$-regularity for the $\overline\partial$-equation on strictly pseudoconvex domains with piecewise smooth boundaries ( and ), In Math. Z., volume 203, . [pdf] 41. Randregularität des $\overline\partial$-Problems für stückweise streng pseudokonvexe Gebiete in ${\bf C}^n$ (), In Math. Ann., volume 280, . [pdf] 42. Randregularität des $\bar\partial$-Problems für die Halbkugel in ${\bf C}^n$ (), In Manuscripta Math., volume 55, . [pdf] 43. Beschränkte Integraloperatoren auf streng $q$-konvexen Gebieten in ${\bf C}^{n}$ (), In J. Reine Angew. Math., volume 351, . [pdf] 44. International conference on approximation and iterative methods (, and ), In J. Comput. Appl. Math., volume 219, . [pdf] 45. Discretising the convolution product in DCI-MRI based quantification of CBF (, , and ), In MAGMA, volume 16, . 46. Conditional heteroskedasticity driven by hidden Markov chains ( and ), In J. Time Ser. Anal., volume 22, . [pdf] 47. Modèles ARCH avec changement de régime markovien ( and ), In C. R. Acad. Sci. Paris Sér. I Math., volume 330, . [pdf] ### Chapitres de livres 1. Some extensions of the Cauchy-Davenport theorem ( and ), Chapter in 6th Czech-Slovak International Symposium on Combinatorics, Graph Theory, Algorithms and Applications, Elsevier, volume 28, . 2. Ein neuer Konvexitätsbegriff in der komplexen Analysis (), Chapter in Beiträge zur komplexen Analysis, Univ. Bonn, volume 387, . 3. $\overline\partial$ and $\overline\partial_b$ problems on nonsmooth domains ( and ), Chapter in Analysis and geometry in several complex variables (Katata, 1997), Birkhäuser Boston, . 4. Regularity of the tangential Cauchy-Riemann complex and applications (), Chapter in Topics in complex analysis (Warsaw, 1992), Polish Acad. Sci., volume 31, . 5. Weighted averages of contractions along subsequences ( and ), Chapter in Convergence in ergodic theory and probability (Columbus, OH, 1993), de Gruyter, volume 5, . 6. Une remarque sur un théorème de Bourgain ( and ), Chapter in Séminaire de Probabilités, XXVII, Springer, volume 1557, . [pdf] ### Rapports 1. A New Proof on The Newlander-Nirenberg Theorem (), Technical report, LMPA, . 2. On The Spectral Surface of a Model Two-Parameter Sturm-Liouville Problem ( and ), Technical report, LMPA, . 3. C-Regularity of the tangential Cauchy-Riemann equations on Levi-flat submanifolds of Cn (), Technical report, LMPA, . septembre 2017 :
2017-09-24 21:12: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": 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.9757635593414307, "perplexity": 3859.061920060004}, "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-2017-39/segments/1505818690211.67/warc/CC-MAIN-20170924205308-20170924225308-00645.warc.gz"}
https://www.usna.edu/Users/cs/wcbrown/courses/S17SI335/lec/l09/lec.html
## Reading These notes and closely review Unit 2 Section 2 and Section 3. ## Review quiz questions We reviewed P1 from the week04 quiz questions, which was a nice look at proving a particular loop invariant. ## Analyzing MergeSort Recall that in the previous class we decided that the worst-case time for mergesort is given by the following recurrence relation: $T(n) \leq c n + T\left( \lceil n/2 \rceil \right) + T\left( \lfloor n/2 \rfloor \right)$ We also showed that a simplified version of this recurrence was $O(n \lg n)$, which we took as a hypothesis about the real recurrence. This class, by a long, exhaustive derivation, we verified that hypothesis. I.e. we showed that MergeSort's worst case running time is $O(n \lg n)$. Normally, our next step would be to analyze things to determine a lower-bound on the worst case running time. However, I decided we'd do something more ambitious, that is ... ## Prove that any comparison-based sorting algorithm is $\Omega(n \lg n)$ By "prove that any comparison-based sorting algorithm is $\Omega(n \lg n)$", I mean that any algorithm, including any super-clever advanced algorithm produced by future generations. That's pretty ambitious, no? How can I prove what future generations can't do? One of the things that makes analyzing algorithms difficult, is that they are dynamic. An algorithm's state changes over the period of time in which it runs. However, it is possible with these sorting algorithms to talk about the algorithm as a static object, separated from any particular run of the algorithm. We saw how with an example. I showed in class how to construct the tree $T_3$ showing all possible ways insertion sort can run on a three element array. One very interesting feature of this tree is that the worst-case running time for insertion-sort on three elements is given by the height of the tree. This will be important next class! Another important thing to note is the leaves. These represent the final order resulting from a run of insertion sort. You'll notice that all 3! permutations of x,y,z appear as leaves. This is in fact necessary, since there needs to be at least one path that gets you to each permuation, since any ordering is possible as input. The key observation is that a sorting algorithm like insertion sort can be characterized by an infinite sequence of such trees: one for each input size.
2018-05-24 00:25: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.7855300903320312, "perplexity": 471.26925715526}, "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-22/segments/1526794865863.76/warc/CC-MAIN-20180523235059-20180524015059-00018.warc.gz"}
http://integralsandseries.prophpbb.com/topic748.html?sid=0a6b127de7f83a3f6f8683e9a1d6eefe
Board index Computation of Series Closed series involving tanh ## Closed series involving tanh Post your questions related to Computation of Series here. Moderators: galactus, sos440, zaidalyafey ### Closed series involving tanh Thu May 19, 2016 8:45 am Posts: 47 Evaluate (in a closed form, if possible) the series: $$\sum_{n=1}^{\infty} \frac{(-1)^{n-1}}{n \tanh n}$$
2017-05-28 01:01:55
{"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.9273467063903809, "perplexity": 11956.108635528653}, "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-22/segments/1495463609404.11/warc/CC-MAIN-20170528004908-20170528024908-00426.warc.gz"}
http://www.math.iisc.ac.in/seminars/2021/2021-07-21-parthanil-roy.html
APRG Seminar Venue: Microsoft Teams (online) We study extreme values of group-indexed stable random fields for discrete groups $G$ acting geometrically on a suitable space $X$. The connection between extreme values and the indexing group $G$ is mediated by the action of $G$ on the limit set equipped with the Patterson-Sullivan measure. Based on motivation from extreme value theory, we introduce an invariant of the action called extremal cocycle growth, which quantifies the distortion of measures on the boundary in comparison to the movement of points in the space $X$. We show that its non-vanishing is equivalent to finiteness of the Bowen-Margulis measure for the associated unit tangent bundle $U(X/G)$ provided $X/G$ has non-arithmetic length spectrum. As a consequence, we establish a dichotomy for the growth-rate of a partial maxima sequence of stationary symmetric $\alpha$-stable ($0 < \alpha < 2$) random fields indexed by groups acting on such spaces. We also establish analogous results for normal subgroups of free groups. (Joint work with Jayadev Athreya and Mahan Mj, under review in Probability Theory and Related Fields.) Contact: +91 (80) 2293 2711, +91 (80) 2293 2265 ;     E-mail: chair.math[at]iisc[dot]ac[dot]in Last updated: 11 Aug 2022
2022-08-11 20:47:37
{"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.6720145344734192, "perplexity": 632.9347487149103}, "config": {"markdown_headings": false, "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-33/segments/1659882571502.25/warc/CC-MAIN-20220811194507-20220811224507-00442.warc.gz"}
https://wtmaths.com/probability_tables.html
Probability Tables ## Probability Tables Probabilities can be calculated from tables by determining the frequency of a specific event, and the total frequency for all events. For example, a class determines how the students travel to school: Walk Car Bike Bus Train TOTAL Girls 5 5 2 2 1 15 Boys 4 2 3 5 2 16 TOTAL 9 7 5 7 3 31 The probability that a student travels to school by car is the total for the cars column (7) divided by the total for all journeys to school (31). P(car) = frac(7)(31). ## Example 1 The colour of each car entering a car park is noted. What is the probability of a car chosen at random being red? White Red Blue Green Black Silver TOTAL 8 ? 7 5 3 5 38 There are 10 red cars. The probability of it being a red car is P(red) = frac(10)(38) = frac(5)(19) Answer: frac(5)(19) ## Example 2 The type of transport used by students to travel to school is noted below. What is the probability that a student will take a bus or a train to school? Walk Car Bike Bus Train TOTAL Girls 5 5 2 2 1 15 Boys 4 2 3 5 2 16 TOTAL 9 7 5 7 3 31 All students are being considered: total frequency = 31 7 students (2 + 5) travel by bus; and 3 students (1 + 2) travel by train. P(bus or train) = frac(10)(31) Answer: frac(10)(31)
2021-07-29 15:26: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": 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.3269789218902588, "perplexity": 1012.9408073648021}, "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-2021-31/segments/1627046153860.57/warc/CC-MAIN-20210729140649-20210729170649-00268.warc.gz"}
https://www.flyingcoloursmaths.co.uk/middle-children/
# Middle children As a loyal listener to More or Less, my first thought here is, “is that a big number?” And as a proud geek, my second thought is, let’s model it! ## How many children are middle children? Let’s suppose that the cliche of 2.4 children is reasonable, and that the number of children in a famliy follows a Poisson distribution: $C \sim Po(2.4)$. I want to know - en route to the final answer - the probability that a randomly-selected child is a middle child. That is to say, the second of three, or the third of five; I suppose an only child is technically a middle child, but they’re also special in their own way. So, running the numbers, about 9% of families in this model have no children. 22% have one child, 26% two, about one-in-five have three children, one in eight have four, 6% have five, 4.5% the field (and to be super-generous, let’s assume they’re all seven-child families.) But that’s families, not children. Assuming 100 families, 22 are only children; 52 have one sibling; 60 are in a three-child family, 50 in a four-child family, 30 have four siblings and 32 (in our generous model) are one-in-seven. How many of these are middle children? Twenty of the three-family children, six of the five-family and four or five of the sevens - altogether, around 30. The total number of children is 246, so it’s reasonable to say we’d expect one child in eight to be a middle child. ## How about a room of 22 people? Given there are 22 people in the room, we’d probably expect around three middle children. Is finding just one an anomaly? This requires a binomial expansion - 22 people, each with (under a null hypothesis yadda yadda) a 1-in-8 chance of being middle would give us $M \sim B \br{22, \frac{1}{8}}$. And we can easily work out that the probability of having no middle children in the room is about 5%, and the probability of only one about one-in-six. So the probability of having one or fewer middle children is somewhere north of 20%, and not especially remarkable. Even taking into account the fact that the person asking was a middle child himself, and presumably wouldn’t have asked if he weren’t, with $n=21$ we still have $P(M = 0) \approx 0.06$ - more unusual, certainly, but still not statistically significant. ## Colin Colin is a Weymouth maths tutor, author of several Maths For Dummies books and A-level maths guides. He started Flying Colours Maths in 2008. He lives with an espresso pot and nothing to prove. ### 2 comments on “Middle children” • ##### Alison Hmmm. I would interpret “middle child” differently, so that in a family of four there is an eldest, a youngest and two middle children. (In my case, it’s complicated too by having half-siblings… I am a youngest child to one of my parents, and one of the middle children to the other!) • ##### Colin I suppose real families are more complicated than mathematical ones! This site uses Akismet to reduce spam. Learn how your comment data is processed.
2020-07-12 18:07: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": 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.5980569124221802, "perplexity": 1833.3935698151188}, "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-29/segments/1593657139167.74/warc/CC-MAIN-20200712175843-20200712205843-00083.warc.gz"}
https://blog.paperspace.com/physics-control-tasks-with-deep-reinforcement-learning/
In this tutorial we will implement the paper Continuous Control with Deep Reinforcement Learning, published by Google DeepMind and presented as a conference paper at ICRL 2016. The networks will be implemented in PyTorch using OpenAI gym. The algorithm combines Deep Learning and Reinforcement Learning techniques to deal with high-dimensional, i.e. continuous, action spaces. After the success of Deep-Q Learning algorithm that led Google DeepMind to outperform humans in playing Atari games, they extended the same idea to physics tasks, where the action space is much bigger with respect to the one of the aforementioned games. Indeed, in a physics task, where the objective is generally to make a rigid-body learn a certain movement, the actions that can be applied to the actuators are continuous, i.e. they can span from a minimum to a maximum value within an interval. One can simply ask: why don’t we discretize the action space? Yes, we can, but consider a 3 degree-of-freedom system where each action, spanning within its own interval, is discretized into, let’s say, 10 values: the action space will have a dimensionality of 1000 (10^3) and this will lead to two big problems: the curse of dimensionality and an intractable approach for continuous control tasks, where a discretization of 10 samples for each action would not lead to a fine solution. Think about a robotic arm: an actuator doesn’t have just a few available values in terms of torque/force to be applied to produce velocities and accelerations for the rotation/translation operations. Deep Q-Learning can deal well with high-dimensional state space (images as an input) but still it cannot deal with high dimensional action spaces (continuous action). A good example of Deep-Q Learning is the implementation of an AI that can play Dino Run, where the set of action space is simply: { jump, get_down, do_nothing}. The aforementioned tutorial is a good start if you want to know the basics of reinforcement learning and how to implement a Q-network, and I strongly suggest you go through it first if you are not familiar with reinforcement learning concepts. ## What We Will Cover In this tutorial we will go through the following steps: • Explain the concept of policy network • Combine Q-network and policy network in the so called actor-critic architecture • See how the parameters are updated in order to maximize and minimize performance and objective functions • Integrate memory buffer and freeze target network concepts, and understand what is the exploration strategy adopted in DDPG. • Implement the algorithm using PyTorch: training on some of the OpenAI gym environment created for continuous control tasks, such as Pendulum and Mountain Car Continuous. More complex environments such as Hopper (to make a leg hop forward without falling) and the Double Inverted Pendulum (keep the pendulum in equilibrium by applying a force along the horizontal axis) require a MuJoCo license and you have to buy it or request it if you have an academic or institutional contact. Nonetheless, you can request a free 30-day license. ## Getting Started With DDPG As a general overview, the algorithm that is introduced in the paper is called Deep Deterministic Policy Gradient (DDPG). It continues from the previous successful DeepMind paper Playing Atari with Deep Reinforcement Learning with the concepts of Experience Replay Buffer, where the networks are trained off-policy by sampling experience batches, and Freeze Target Networks, where copies of the networks are made, with the purpose to be used in the objective functions to avoid divergence and instability of complex and non-linear function approximators such as neural networks. Since the purpose of this tutorial is not to show the basics of reinforcement learning, if you are unfamiliar with these concepts I strongly suggest you first read the previously mentioned AI that can play Dino Run Paperspace tutorial. Once you are familiar with the concepts of Environment, Agent, Reward, and Q-value function (which is the function that in complex tasks is approximated by deep neural networks, hence called a Q-network) you are ready to dive into more sophisticated deep reinforcement learning architectures, like the Actor-Critic architecture that involves a combination of Policy network and Q-Network. ## Reinforcement Learning In A Nutshell Reinforcement Learning is a subfield of machine learning. It differs from the classic paradigms of supervised and unsupervised learning since it is a trial-and-error approach. This means that the agent is not actually trained on a dataset, but is instead trained by interacting with the environment, which is considered to be the entire system where we want the agent to act on (like a game, or a robotic arm). The clue point is that the environment must a provide a reward in response to the agent's actions. This reward is engineered depending on the task and must be well-thought since it is crucial for the entire progress of learning. The basic elements of the trial-and-error procedure are the value functions, solved via Bellman equations in a discrete scenario, where we have both low-dimensional state and action spaces. When we deal with high-dimensional state space or action spaces we have to introduce complex and non-linear function approximators such as deep neural networks. For this reason, the concept of Deep Reinforcement Learning was introduced in the literature. Let’s now start with a brief description of the main innovations brought by the DDPG for dealing with continuous, hence high-dimensional, action spaces in a Reinforcement Learning framework. ## DDPG Building Blocks ### Policy Network Besides the usage of a neural network to parameterize the Q-function, as it happened with DQN, which is called the “critic” in the more sophisticated actor-critic architecture (the core of the DDPG), we have also the Policy network, called the “actor”. This neural network is then introduced to parameterize the policy function as well. The policy is basically the agent behavior, a mapping from state to action (in case of deterministic policy) or a distribution of actions (in case of stochastic policy). These two kind of policies exist because they are suitable for certain tasks: a deterministic policy is well-suited for physics control problem, while a stochastic policy is a great option for solving games problem. In this case the output of the policy network is a value that corresponds to the action to be taken on the environment. ### Objective and Loss Functions We have two networks, hence two set of parameters to update: the parameters of the policy network have to be updated in order to maximize the performance measure J defined in the policy gradient theorem; while the parameters of the critic network are updated in order to minimize the temporal difference loss L. Basically, we need to improve the performance measure J in order to follow the maximization of the Q-value function, while minimizing the temporal difference loss as it happened with Deep Q-Network for playing Atari games. ### Actor-Critic architecture Actor takes state as input to give action as output, while critic takes both state and action as input to give as output the value of the Q function. The critic uses gradient temporal-difference learning while the actor parameters are learned following policy gradient theorem. The main idea behind this architecture is that the policy network acts producing an action and the Q-network criticize that action. ### Integrate experience replay and freeze target network As with Q learning, the usage of non-linear function approximators like neural networks, which are necessary to generalize on large state spaces, means that convergence is no longer guaranteed. For this reason the usage of experience replay is needed in order to make independent and identically distributed samples. Moreover, frozen target networks need to be used in order to avoid divergence when updating the critic network. Differently from DQN, where the target network were updated every C steps, the parameters of the target networks are updated in DDPG case at every time step, following the "soft" update: with τ  << 1, w − and θ − respectively the weights of target Q-network and target policy network. With "soft" updates the weights of target networks are constrained to change slowly, thus improving the stability of learning and convergence results. The target network is then used in the temporal difference loss instead of the Q-network itself. ### Exploration The problem of exploration in algorithms like DDPG can be addressed in a very easy way and independently from the learning algorithm. Exploration policy is then constructed by adding noise sampled from a noise process N to the actor policy. The exploration policy thus becomes: $\pi$'(St) = $\pi$(St, $\theta$) + $\nu$ Where $\nu$ is an Ornstein-Uhlenbeck process, i.e. a stochastic process that can generate temporally correlated actions that guarantee smooth explorations in physical control problems. ## Continuous control problems: an overview We now have a look at the some of the environments that can be used to run the DDPG algorithm. These environments are available with gym package, and, as previously mentioned, some of them require MuJoCo (which is a physic engine) license to run. We are going to have a look at Pendulum environment, that does not require MuJoCo, and Hopper environment, which does. ### Pendulum The purpose is to apply a torque on the central actuator to keep the pendulum in equilibrium on the vertical axis. This problem has a 3-dimensional state space, i.e. the cosine and sine of the angle as well as the derivative of the angle. The action space is 1-dimensional, which is the torque applied to the joint being bounded in the range $[-2, 2]$. #### Reward function The precise equation for reward: -(theta^2 + 0.1*theta_dt^2 + 0.001*action^2) Theta is normalized between -pi and pi. Therefore, the lowest cost is -(pi^2 + 0.1*8^2 + 0.001*2^2) = -16.2736044, and the highest cost is 0. In essence, the goal is to remain at zero angle (vertical), with the least rotational velocity, and the least effort. For more details about Pendulum environment, check GitHub or OpenAI env page. ### Hopper The hopper task is to make a hopper with three joints and 4 body parts hop forward as fast as possible. It is available with gym but a MuJoCo license is needed, so you have to request it and install it for gym to work. #### A general overview of the task This problem has a 11 dimensional state vectors which includes: positions (in terms of radiant or meters if they are revolute or prismatic joints), derivatives of positions and both sin and cos functions of revolute joint angles with respect to their relative reference systems. The action space corresponds to a 3-dimensional space where each action is a continuous value that is bounded in the range $[−1, 1]$. So the network architecture shall have 3 output neurons with tanh activation function. These torques are applied on actuators that are found in the thigh joint, the leg joint and the foot joint, and the range for these actions is normalized to $[−1, 1]$. #### Reward function Since the objective of the task is to make the hopper move forward, the reward function is defined taking into account a bonus for being alive, a positive contribution of the forward velocity (computed by taking the derivative of the displacement at each step) and a negative contribution of the euclidean norm among the action control space. where a are the actions (i.e. the outputs of the network), vx is the forward velocity and b is a bonus for being alive. The episode terminates when at least one of the failure conditions occur, and they are: where θ is the forward pitch of the body. For more details about Hopper environment, check GitHub or OpenAI env page. ### Other gym environments to play with There are several gym environments that are suitable for continuous control since they have continuous action space. Some of them require MuJoCo, some do not. Among the ones that do not require MuJoCo, you can try the code on Lunar Lander, Bipedal Walker or CarRacing. Notice that Car Racing has high dimensional state (image pixels), so you cannot use the fully connected layers used with low dimensional state space environment but an architecture that would include convolutional layers as well. ## Code implementation ### Setup Set up the instance on Paperspace: The public container "Paperspace + Fast.AI" is good to go with our experiment. Configure: open a terminal and install Gym, upgrade torch version. pip install gym The experiment will run on "Pendulum-v0" gym environment. Some environments needs MuJoCo license ("HalfCheetah-v1", "Hopper-v1", "Ant-v1" or "Humanoid-v1") while other needs PyBox2d to be run ("LunarLanderContinuous-v2", "CarRacing-v0" or "BipedalWalker-v2"). Once you have installed MuJoCo or PyBox2d for the environment that you want to play with ("Pendulum-v0" does not need any of these, just gym package), you can open a Jupyter Notebook and start coding. ### General settings The configuration follows the settings described in the supplementary information section of the DDPG paper, that you can find at page 11. As described in the paper, we have to set a buffer size of 1 million entries, a batch size for sampling from memory equal to 64, a learning rate for actor and critic networks equal to 0.0001 and 0.001 respectively, a tau parameter for soft update equal to 0.001 and 300-400 neurons for the hidden layers of the networks. BUFFER_SIZE=1000000 BATCH_SIZE=64 #this can be 128 for more complex tasks such as Hopper GAMMA=0.9 TAU=0.001 #Target Network HyperParameters LRA=0.0001 #LEARNING RATE ACTOR LRC=0.001 #LEARNING RATE CRITIC H1=400 #neurons of 1st layers H2=300 #neurons of 2nd layers MAX_EPISODES=50000 #number of episodes of the training MAX_STEPS=200 #max steps to finish an episode. An episode breaks early if some break conditions are met (like too much #amplitude of the joints angles or if a failure occurs) buffer_start = 100 epsilon = 1 epsilon_decay = 1./100000 #this is ok for a simple task like inverted pendulum, but maybe this would be set to zero for more #complex tasks like Hopper; epsilon is a decay for the exploration and noise applied to the action is #weighted by this decay. In more complex tasks we need the exploration to not vanish so we set the decay #to zero. PRINT_EVERY = 10 #Print info about average reward every PRINT_EVERY ENV_NAME = "Pendulum-v0" # For the hopper put "Hopper-v2" #check other environments to play with at https://gym.openai.com/envs/ ### Experience Replay Buffer It would be interesting to use prioritize experience replay. Have you ever managed to use the prioritized experience replay with DDPG? Leave a comment if you would like to share your results with prioritized experience replay. Regardless, below there is the implementation of a simple replay buffer without priority. from collections import deque import random import numpy as np class replayBuffer(object): def __init__(self, buffer_size, name_buffer=''): self.buffer_size=buffer_size #choose buffer size self.num_exp=0 self.buffer=deque() def add(self, s, a, r, t, s2): experience=(s, a, r, t, s2) if self.num_exp < self.buffer_size: self.buffer.append(experience) self.num_exp +=1 else: self.buffer.popleft() self.buffer.append(experience) def size(self): return self.buffer_size def count(self): return self.num_exp def sample(self, batch_size): if self.num_exp < batch_size: batch=random.sample(self.buffer, self.num_exp) else: batch=random.sample(self.buffer, batch_size) s, a, r, t, s2 = map(np.stack, zip(*batch)) return s, a, r, t, s2 def clear(self): self.buffer = deque() self.num_exp=0 ### Network architectures We define here the networks. The structure follows the description of the paper: the actor is composed of three fully connected layers and has a hyperbolic tangent as output activation function, to deal with a [-1, 1] value range. The critic takes both state and action as input and outputs the Q-value after three fully connected layers. def fanin_(size): fan_in = size[0] weight = 1./np.sqrt(fan_in) class Critic(nn.Module): def __init__(self, state_dim, action_dim, h1=H1, h2=H2, init_w=3e-3): super(Critic, self).__init__() self.linear1 = nn.Linear(state_dim, h1) self.linear1.weight.data = fanin_(self.linear1.weight.data.size()) self.linear2 = nn.Linear(h1+action_dim, h2) self.linear2.weight.data = fanin_(self.linear2.weight.data.size()) self.linear3 = nn.Linear(h2, 1) self.linear3.weight.data.uniform_(-init_w, init_w) self.relu = nn.ReLU() def forward(self, state, action): x = self.linear1(state) x = self.relu(x) x = self.linear2(torch.cat([x,action],1)) x = self.relu(x) x = self.linear3(x) return x class Actor(nn.Module): def __init__(self, state_dim, action_dim, h1=H1, h2=H2, init_w=0.003): super(Actor, self).__init__() self.linear1 = nn.Linear(state_dim, h1) self.linear1.weight.data = fanin_(self.linear1.weight.data.size()) self.linear2 = nn.Linear(h1, h2) self.linear2.weight.data = fanin_(self.linear2.weight.data.size()) self.linear3 = nn.Linear(h2, action_dim) self.linear3.weight.data.uniform_(-init_w, init_w) self.relu = nn.ReLU() self.tanh = nn.Tanh() def forward(self, state): x = self.linear1(state) x = self.relu(x) x = self.linear2(x) x = self.relu(x) x = self.linear3(x) x = self.tanh(x) return x def get_action(self, state): state = torch.FloatTensor(state).unsqueeze(0).to(device) action = self.forward(state) return action.detach().cpu().numpy()[0] ### Exploration As described in the paper, we have to add noise to the action in order to ensure exploration. An Ornstein-Uhlenbeck process is chosen because it adds noise in a smooth way, which is suitable for continuous control tasks. More details on this random process are simply described on Wikipedia. # Based on http://math.stackexchange.com/questions/1287634/implementing-ornstein-uhlenbeck-in-matlab class OrnsteinUhlenbeckActionNoise: def __init__(self, mu=0, sigma=0.2, theta=.15, dt=1e-2, x0=None): self.theta = theta self.mu = mu self.sigma = sigma self.dt = dt self.x0 = x0 self.reset() def __call__(self): x = self.x_prev + self.theta * (self.mu - self.x_prev) * self.dt + self.sigma * np.sqrt(self.dt) * np.random.normal(size=self.mu.shape) self.x_prev = x return x def reset(self): self.x_prev = self.x0 if self.x0 is not None else np.zeros_like(self.mu) def __repr__(self): return 'OrnsteinUhlenbeckActionNoise(mu={}, sigma={})'.format(self.mu, self.sigma) ### Setup training We set up the training by initializing the environment, the networks, the target networks, the replay memory and the optimizers. torch.manual_seed(-1) env = NormalizedEnv(gym.make(ENV_NAME)) state_dim = env.observation_space.shape[0] action_dim = env.action_space.shape[0] print("State dim: {}, Action dim: {}".format(state_dim, action_dim)) noise = OrnsteinUhlenbeckActionNoise(mu=np.zeros(action_dim)) critic = Critic(state_dim, action_dim).to(device) actor = Actor(state_dim, action_dim).to(device) target_critic = Critic(state_dim, action_dim).to(device) target_actor = Actor(state_dim, action_dim).to(device) for target_param, param in zip(target_critic.parameters(), critic.parameters()): target_param.data.copy_(param.data) for target_param, param in zip(target_actor.parameters(), actor.parameters()): target_param.data.copy_(param.data) MSE = nn.MSELoss() memory = replayBuffer(BUFFER_SIZE) writer = SummaryWriter() #initialise tensorboard writer ### Iterate through episodes MAX_EPISODES and MAX_STEPS parameters can be tuned according to the kind of the environment on which we are going to train the agent. In the case of a simple pendulum we do not have a failure condition for each episode so it will always go through the max steps for each episode; in a task where there is a failure condition, an agent will not go through all the steps (at least at the beginning, when it has not yet learned how to accomplish the task). plot_reward = [] plot_policy = [] plot_q = [] plot_steps = [] best_reward = -np.inf saved_reward = -np.inf saved_ep = 0 average_reward = 0 global_step = 0 #s = deepcopy(env.reset()) for episode in range(MAX_EPISODES): #print(episode) s = deepcopy(env.reset()) #noise.reset() ep_reward = 0. ep_q_value = 0. step=0 for step in range(MAX_STEPS): #loss=0 global_step +=1 epsilon -= epsilon_decay #actor.eval() a = actor.get_action(s) #actor.train() a += noise()*max(0, epsilon) a = np.clip(a, -1., 1.) s2, reward, terminal, info = env.step(a) #keep adding experiences to the memory until there are at least minibatch size samples if memory.count() > buffer_start: s_batch, a_batch, r_batch, t_batch, s2_batch = memory.sample(BATCH_SIZE) s_batch = torch.FloatTensor(s_batch).to(device) a_batch = torch.FloatTensor(a_batch).to(device) r_batch = torch.FloatTensor(r_batch).unsqueeze(1).to(device) t_batch = torch.FloatTensor(np.float32(t_batch)).unsqueeze(1).to(device) s2_batch = torch.FloatTensor(s2_batch).to(device) #compute loss for critic a2_batch = target_actor(s2_batch) target_q = target_critic(s2_batch, a2_batch) y = r_batch + (1.0 - t_batch) * GAMMA * target_q.detach() #detach to avoid backprop target q = critic(s_batch, a_batch) q_loss = MSE(q, y) q_loss.backward() q_optimizer.step() #compute loss for actor policy_loss = -critic(s_batch, actor(s_batch)) policy_loss = policy_loss.mean() policy_loss.backward() policy_optimizer.step() #soft update of the frozen target networks for target_param, param in zip(target_critic.parameters(), critic.parameters()): target_param.data.copy_( target_param.data * (1.0 - TAU) + param.data * TAU ) for target_param, param in zip(target_actor.parameters(), actor.parameters()): target_param.data.copy_( target_param.data * (1.0 - TAU) + param.data * TAU ) s = deepcopy(s2) ep_reward += reward #if terminal: # noise.reset() # break try: plot_reward.append([ep_reward, episode+1]) plot_policy.append([policy_loss.data, episode+1]) plot_q.append([q_loss.data, episode+1]) plot_steps.append([step+1, episode+1]) except: continue average_reward += ep_reward if ep_reward > best_reward: torch.save(actor.state_dict(), 'best_model_pendulum.pkl') #Save the actor model for future testing best_reward = ep_reward saved_reward = ep_reward saved_ep = episode+1 if (episode % PRINT_EVERY) == (PRINT_EVERY-1): # print every print_every episodes subplot(plot_reward, plot_policy, plot_q, plot_steps) print('[%6d episode, %8d total steps] average reward for past {} iterations: %.3f'.format(PRINT_EVERY) % (episode + 1, global_step, average_reward / PRINT_EVERY)) print("Last model saved with reward: {:.2f}, at episode {}.".format(saved_reward, saved_ep)) average_reward = 0 #reset average reward ### Conclusions The code snippets in this tutorial are a part of a more complete notebook that you may find on GitHub at this link. The networks used in that notebook are suitable for low-dimensional state space; if you want to deal with image inputs you have to add convolutional layers, as described at page 11 of the research paper. Feel free to share your experience with other environments or approaches to improve the overall training process!
2020-09-25 11:20:24
{"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.5488179326057434, "perplexity": 2228.4435784745438}, "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/1600400223922.43/warc/CC-MAIN-20200925084428-20200925114428-00000.warc.gz"}
https://practiceadvices.com/data/advice/read/11021-how-do-you-know-if-matrices-are-inverses
# How do you know if matrices are inverses? ### How do you know if matrices are inverses? Conclusion 1. The inverse of A is A-1 only when A × A-1 = A-1 × A = I. 2. To find the inverse of a 2x2 matrix: swap the positions of a and d, put negatives in front of b and c, and divide everything by the determinant (ad-bc). 3. Sometimes there is no inverse at all. ### What type of matrices have inverses? square matrix A square matrix that has an inverse is called invertible or non-singular. ### Is matrix A B invertible? Theorem A square matrix A is invertible if and only if x = 0 is the only solution of the matrix equation Ax = 0. ... If the product AB is invertible, then both A and B are invertible. Proof: Let C = B(AB)-1 and D = (AB)-1A. ### How do you know if matrices are multiplicative inverses? Show that the given matrices are multiplicative inverses of each other. Multiply AB A B and BA B A . If both products equal the identity, then the two matrices are inverses of each other. ### Are the two matrices inverses? If both products equal the identity, then the two matrices are inverses of each other. A \displaystyle A A and B are inverses of each other. ### Can a 2x3 matrix have an inverse? No, a nonsquare matrix cannot have a two-sided inverse. An matrix induces a linear map (where is the base field, probably the real numbers in your setup), defined by (vectors in are considered as column matrices). ### Why do only square matrices have inverses? The reason invertible matricies must be square if we're talking about one and only one inverse, is because of how matrix multiplication is defined. Just think about it, the input space of a Matrix is , so vectors of dimension the number of columns, or the dimension of the row space = column space of A transpose. ### Do all matrices have inverses? Not all 2 × 2 matrices have an inverse matrix. If the determinant of the matrix is zero, then it will not have an inverse; the matrix is then said to be singular. Only non-singular matrices have inverses. ### Does AB I imply that A is invertible? If B is a square matrix such that either AB = I or BA = I, then A is invertible and B = A−1. ### What is the inverse of AB? Facts about invertible matrices AB is invertible, and its inverse is ( AB ) − 1 = B − 1 A − 1 (note the order). ### Is the inverse of a matrix the same as the matrix? The Inverse of a Matrix is the same idea but we write it A-1 Why not 1/A ? Because we don't divide by a matrix! And anyway 1/8 can also be written 8-1 And there are other similarities: When we multiply a matrix by its inverse we get the Identity Matrix (which is like "1" for matrices): We just mentioned the "Identity Matrix". ### When is B said to be inverse of a? We know that if A is a square of order m, and if there exists another square matrix B of the same order m, such that AB = I, then B is said to be the inverse of A . Was this answer helpful? ### Which is the inverse of the RHS matrix? Apply a sequence of row operations till we get identity matrix on the LHS and use the same elementary operations on the RHS to get I = BA. The matrix B on the RHS is the inverse of matrix A. ### Is it true that every invertible matrix gives the identity? Yes, every invertible matrix A multiplied by its inverse gives the identity. AB = BA can be true iven if B is not the inverse for A, for example the identity matrix or scalar matrix commute with every other matrix, and there are other examples. Not any diagonal matrix commutes with each element of Rn×n, indeed, let define (1 0 0 2).
2021-11-27 09:27:51
{"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.8905124068260193, "perplexity": 299.2003045080635}, "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/1637964358153.33/warc/CC-MAIN-20211127073536-20211127103536-00455.warc.gz"}
http://matematika.reseneulohy.cz/2800/paying-with-coins
## Paying with coins $$8=3+5$$, $$9=3+3+3$$, $$10=5+5$$. For $$n\ge 11$$ we use the inductive assumption that it is possible to pay $$n-3$$, and we add one 3-crown coin.
2022-05-26 15:21: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": 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.7102233171463013, "perplexity": 550.0129029129796}, "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-2022-21/segments/1652662606992.69/warc/CC-MAIN-20220526131456-20220526161456-00387.warc.gz"}
http://www.lightandmatter.com/html_books/lm/ch10/ch10.html
You are viewing the html version of Light and Matter, by Benjamin Crowell. This version is only designed for casual browsing, and may have some formatting problems. For serious reading, you want the Adobe Acrobat version. Table of Contents a / Gravity is the only really important force on the cosmic scale. This false-color representation of saturn's rings was made from an image sent back by the Voyager 2 space probe. The rings are composed of innumerable tiny ice particles orbiting in circles under the influence of saturn's gravity. # Chapter 10. Gravity a / Johannes Kepler found a mathematical description of the motion of the planets, which led to Newton's theory of gravity. Cruise your radio dial today and try to find any popular song that would have been imaginable without Louis Armstrong. By introducing solo improvisation into jazz, Armstrong took apart the jigsaw puzzle of popular music and fit the pieces back together in a different way. In the same way, Newton reassembled our view of the universe. Consider the titles of some recent physics books written for the general reader: The God Particle, Dreams of a Final Theory. Without Newton, such attempts at universal understanding would not merely have seemed a little pretentious, they simply would not have occurred to anyone. This chapter is about Newton's theory of gravity, which he used to explain the motion of the planets as they orbited the sun. Whereas this book has concentrated on Newton's laws of motion, leaving gravity as a dessert, Newton tosses off the laws of motion in the first 20 pages of the Principia Mathematica and then spends the next 130 discussing the motion of the planets. Clearly he saw this as the crucial scientific focus of his work. Why? Because in it he showed that the same laws of motion applied to the heavens as to the earth, and that the gravitational force that made an apple fall was the same as the force that kept the earth's motion from carrying it away from the sun. What was radical about Newton was not his laws of motion but his concept of a universal science of physics. ## 10.1 Kepler's laws b / Tycho Brahe made his name as an astronomer by showing that the bright new star, today called a supernova, that appeared in the skies in 1572 was far beyond the Earth's atmosphere. This, along with Galileo's discovery of sunspots, showed that contrary to Aristotle, the heavens were not perfect and unchanging. Brahe's fame as an astronomer brought him patronage from King Frederick II, allowing him to carry out his historic high-precision measurements of the planets' motions. A contradictory character, Brahe enjoyed lecturing other nobles about the evils of dueling, but had lost his own nose in a youthful duel and had it replaced with a prosthesis made of an alloy of gold and silver. Willing to endure scandal in order to marry a peasant, he nevertheless used the feudal powers given to him by the king to impose harsh forced labor on the inhabitants of his parishes. The result of their work, an Italian-style palace with an observatory on top, surely ranks as one of the most luxurious science labs ever built. Kepler described Brahe as dying of a ruptured bladder after falling from a wagon on the way home from a party, but other contemporary accounts and modern medical analysis suggest mercury poisoning, possibly as a result of court intrigue. Newton wouldn't have been able to figure out why the planets move the way they do if it hadn't been for the astronomer Tycho Brahe (1546-1601) and his protege Johannes Kepler (1571-1630), who together came up with the first simple and accurate description of how the planets actually do move. The difficulty of their task is suggested by figure c, which shows how the relatively simple orbital motions of the earth and Mars combine so that as seen from earth Mars appears to be staggering in loops like a drunken sailor. c / As the Earth and Mars revolve around the sun at different rates, the combined effect of their motions makes Mars appear to trace a strange, looped path across the background of the distant stars. Brahe, the last of the great naked-eye astronomers, collected extensive data on the motions of the planets over a period of many years, taking the giant step from the previous observations' accuracy of about 10 minutes of arc (10/60 of a degree) to an unprecedented 1 minute. The quality of his work is all the more remarkable considering that his observatory consisted of four giant brass protractors mounted upright in his castle in Denmark. Four different observers would simultaneously measure the position of a planet in order to check for mistakes and reduce random errors. With Brahe's death, it fell to his former assistant Kepler to try to make some sense out of the volumes of data. Kepler, in contradiction to his late boss, had formed a prejudice, a correct one as it turned out, in favor of the theory that the earth and planets revolved around the sun, rather than the earth staying fixed and everything rotating about it. Although motion is relative, it is not just a matter of opinion what circles what. The earth's rotation and revolution about the sun make it a noninertial reference frame, which causes detectable violations of Newton's laws when one attempts to describe sufficiently precise experiments in the earth-fixed frame. Although such direct experiments were not carried out until the 19th century, what convinced everyone of the sun-centered system in the 17th century was that Kepler was able to come up with a surprisingly simple set of mathematical and geometrical rules for describing the planets' motion using the sun-centered assumption. After 900 pages of calculations and many false starts and dead-end ideas, Kepler finally synthesized the data into the following three laws: ##### Kepler's elliptical orbit law The planets orbit the sun in elliptical orbits with the sun at one focus. ##### Kepler's equal-area law The line connecting a planet to the sun sweeps out equal areas in equal amounts of time. ##### Kepler's law of periods The time required for a planet to orbit the sun, called its period, is proportional to the long axis of the ellipse raised to the 3/2 power. The constant of proportionality is the same for all the planets. Although the planets' orbits are ellipses rather than circles, most are very close to being circular. The earth's orbit, for instance, is only flattened by 1.7% relative to a circle. In the special case of a planet in a circular orbit, the two foci (plural of “focus”) coincide at the center of the circle, and Kepler's elliptical orbit law thus says that the circle is centered on the sun. The equal-area law implies that a planet in a circular orbit moves around the sun with constant speed. For a circular orbit, the law of periods then amounts to a statement that the time for one orbit is proportional to $$r^{3/2}$$, where $$r$$ is the radius. If all the planets were moving in their orbits at the same speed, then the time for one orbit would simply depend on the circumference of the circle, so it would only be proportional to $$r$$ to the first power. The more drastic dependence on $$r^{3/2}$$ means that the outer planets must be moving more slowly than the inner planets. ## 10.2 Newton's law of gravity d / An ellipse is a circle that has been distorted by shrinking and stretching along perpendicular axes. e / An ellipse can be constructed by tying a string to two pins and drawing like this with the pencil stretching the string taut. Each pin constitutes one focus of the ellipse. f / If the time interval taken by the planet to move from P to Q is equal to the time interval from R to S, then according to Kepler's equal-area law, the two shaded areas are equal. The planet is moving faster during interval RS than it did during PQ, which Newton later determined was due to the sun's gravitational force accelerating it. The equal-area law predicts exactly how much it will speed up. g / The moon's acceleration is $$60^2=3600$$ times smaller than the apple's. h / Students often have a hard time understanding the physical meaning of $$G$$. It's just a proportionality constant that tells you how strong gravitational forces are. If you could change it, all the gravitational forces all over the universe would get stronger or weaker. Numerically, the gravitational attraction between two 1-kg masses separated by a distance of 1 m is $$6.67\times10^{-11}\ \text{N}$$, and this is what $$G$$ is in SI units. i / Example 3. Computer-enhanced images of Pluto and Charon, taken by the Hubble Space Telescope. j / The conic sections are the curves made by cutting the surface of an infinite cone with a plane. k / An imaginary cannon able to shoot cannonballs at very high speeds is placed on top of an imaginary, very tall mountain that reaches up above the atmosphere. Depending on the speed at which the ball is fired, it may end up in a tightly curved elliptical orbit, 1, a circular orbit, 2, a bigger elliptical orbit, 3, or a nearly straight hyperbolic orbit, 4. ### The sun's force on the planets obeys an inverse square law. Kepler's laws were a beautifully simple explanation of what the planets did, but they didn't address why they moved as they did. Did the sun exert a force that pulled a planet toward the center of its orbit, or, as suggested by Descartes, were the planets circulating in a whirlpool of some unknown liquid? Kepler, working in the Aristotelian tradition, hypothesized not just an inward force exerted by the sun on the planet, but also a second force in the direction of motion to keep the planet from slowing down. Some speculated that the sun attracted the planets magnetically. Once Newton had formulated his laws of motion and taught them to some of his friends, they began trying to connect them to Kepler's laws. It was clear now that an inward force would be needed to bend the planets' paths. This force was presumably an attraction between the sun and each planet. (Although the sun does accelerate in response to the attractions of the planets, its mass is so great that the effect had never been detected by the prenewtonian astronomers.) Since the outer planets were moving slowly along more gently curving paths than the inner planets, their accelerations were apparently less. This could be explained if the sun's force was determined by distance, becoming weaker for the farther planets. Physicists were also familiar with the noncontact forces of electricity and magnetism, and knew that they fell off rapidly with distance, so this made sense. In the approximation of a circular orbit, the magnitude of the sun's force on the planet would have to be $\begin{equation*} F= ma= mv^2/r . \end{equation*}$ Now although this equation has the magnitude, $$v$$, of the velocity vector in it, what Newton expected was that there would be a more fundamental underlying equation for the force of the sun on a planet, and that that equation would involve the distance, $$r$$, from the sun to the object, but not the object's speed, $$v$$ --- motion doesn't make objects lighter or heavier. self-check: If eq. [1] really was generally applicable, what would happen to an object released at rest in some empty region of the solar system? Equation [1] was thus a useful piece of information which could be related to the data on the planets simply because the planets happened to be going in nearly circular orbits, but Newton wanted to combine it with other equations and eliminate $$v$$ algebraically in order to find a deeper truth. To eliminate $$v$$, Newton used the equation $\begin{equation*} v = \frac{\text{circumference}}{T} = \frac{2\pi r}{T} . \end{equation*}$ Of course this equation would also only be valid for planets in nearly circular orbits. Plugging this into eq. [1] to eliminate $$v$$ gives $\begin{equation*} F = \frac{4\pi^2mr}{T^2} . \end{equation*}$ This unfortunately has the side-effect of bringing in the period, $$T$$, which we expect on similar physical grounds will not occur in the final answer. That's where the circular-orbit case, $$T \propto r^{3/2}$$, of Kepler's law of periods comes in. Using it to eliminate $$T$$ gives a result that depends only on the mass of the planet and its distance from the sun: $\begin{multline*} F\propto m/r^2 . \shoveright{\text{[force of the sun on a planet of mass}}\\ \shoveright{\text{m at a distance r from the sun; same}}\\ \text{proportionality constant for all the planets]} \end{multline*}$ (Since Kepler's law of periods is only a proportionality, the final result is a proportionality rather than an equation, so there is no point in hanging on to the factor of $$4\pi ^2$$.) As an example, the “twin planets” Uranus and Neptune have nearly the same mass, but Neptune is about twice as far from the sun as Uranus, so the sun's gravitational force on Neptune is about four times smaller. self-check: Fill in the steps leading from equation [3] to $$F\propto m/r^2$$. ### The forces between heavenly bodies are the same type of force as terrestrial gravity. OK, but what kind of force was it? It probably wasn't magnetic, since magnetic forces have nothing to do with mass. Then came Newton's great insight. Lying under an apple tree and looking up at the moon in the sky, he saw an apple fall. Might not the earth also attract the moon with the same kind of gravitational force? The moon orbits the earth in the same way that the planets orbit the sun, so maybe the earth's force on the falling apple, the earth's force on the moon, and the sun's force on a planet were all the same type of force. There was an easy way to test this hypothesis numerically. If it was true, then we would expect the gravitational forces exerted by the earth to follow the same $$F\propto m/r^2$$ rule as the forces exerted by the sun, but with a different constant of proportionality appropriate to the earth's gravitational strength. The issue arises now of how to define the distance, $$r$$, between the earth and the apple. An apple in England is closer to some parts of the earth than to others, but suppose we take $$r$$ to be the distance from the center of the earth to the apple, i.e., the radius of the earth. (The issue of how to measure $$r$$ did not arise in the analysis of the planets' motions because the sun and planets are so small compared to the distances separating them.) Calling the proportionality constant $$k$$, we have \begin{align*} F_\text{earth on apple} &= k \: m_\text{apple} / r_\text{earth}^2 \\ F_\text{earth on moon} &= k \: m_\text{moon} / d_\text{earth-moon}^2 . \end{align*} Newton's second law says $$a=F/m$$, so \begin{align*} a_\text{apple} &= k \: / \: r_{earth}^2 \\ a_\text{moon} &= k \: / \: d_\text{earth-moon}^2 . \end{align*} The Greek astronomer Hipparchus had already found 2000 years before that the distance from the earth to the moon was about 60 times the radius of the earth, so if Newton's hypothesis was right, the acceleration of the moon would have to be $$60^2=3600$$ times less than the acceleration of the falling apple. Applying $$a=v^2/r$$ to the acceleration of the moon yielded an acceleration that was indeed 3600 times smaller than $$9.8\ \text{m}/\text{s}^2$$, and Newton was convinced he had unlocked the secret of the mysterious force that kept the moon and planets in their orbits. ### Newton's law of gravity The proportionality $$F\propto m/r^2$$ for the gravitational force on an object of mass $$m$$ only has a consistent proportionality constant for various objects if they are being acted on by the gravity of the same object. Clearly the sun's gravitational strength is far greater than the earth's, since the planets all orbit the sun and do not exhibit any very large accelerations caused by the earth (or by one another). What property of the sun gives it its great gravitational strength? Its great volume? Its great mass? Its great temperature? Newton reasoned that if the force was proportional to the mass of the object being acted on, then it would also make sense if the determining factor in the gravitational strength of the object exerting the force was its own mass. Assuming there were no other factors affecting the gravitational force, then the only other thing needed to make quantitative predictions of gravitational forces would be a proportionality constant. Newton called that proportionality constant $$G$$, so here is the complete form of the law of gravity he hypothesized. ##### Newton's law of gravity $\begin{multline*} F = \frac{Gm_1m_2}{r^2} \shoveright{\text{[gravitational force between objects of mass}}\\ \shoveright{\text{ m_1 and m_2, separated by a distance r; r is not}}\\ \text{the radius of anything ]} \end{multline*}$ Newton conceived of gravity as an attraction between any two masses in the universe. The constant $$G$$ tells us how many newtons the attractive force is for two 1-kg masses separated by a distance of 1 m. The experimental determination of $$G$$ in ordinary units (as opposed to the special, nonmetric, units used in astronomy) is described in section 10.5. This difficult measurement was not accomplished until long after Newton's death. ##### Example 1: The units of $$G$$ $$\triangleright$$ What are the units of $$G$$? $$\triangleright$$ Solving for $$G$$ in Newton's law of gravity gives $\begin{equation*} G = \frac{Fr^2}{m_1m_2} , \end{equation*}$ so the units of $$G$$ must be $$\text{N}\!\cdot\!\text{m}^2/\text{kg}^2$$. Fully adorned with units, the value of $$G$$ is $$6.67\times10^{-11}\ \text{N}\!\cdot\!\text{m}^2/\text{kg}^2$$. ##### Example 2: Newton's third law $$\triangleright$$ Is Newton's law of gravity consistent with Newton's third law? $$\triangleright$$ The third law requires two things. First, $$m_1$$'s force on $$m_2$$ should be the same as $$m_2$$'s force on $$m_1$$. This works out, because the product $$m_1m_2$$ gives the same result if we interchange the labels 1 and 2. Second, the forces should be in opposite directions. This condition is also satisfied, because Newton's law of gravity refers to an attraction: each mass pulls the other toward itself. ##### Example 3: Pluto and Charon $$\triangleright$$ Pluto's moon Charon is unusually large considering Pluto's size, giving them the character of a double planet. Their masses are $$1.25\times10^{22}$$ and $$1.9x10^{21}$$ kg, and their average distance from one another is $$1.96\times10^4$$ km. What is the gravitational force between them? $$\triangleright$$ If we want to use the value of $$G$$ expressed in SI (meter-kilogram-second) units, we first have to convert the distance to $$1.96\times10^7\ \text{m}$$. The force is $\begin{multline*} \frac{ \left(6.67\times10^{-11}\ \text{N}\!\cdot\!\text{m}^2/\text{kg}^2\right) \left(1.25\times10^{22}\ \text{kg}\right) \left(1.9 \times10^{21}\ \text{kg}\right) }{\left(1.96\times10^7\ \text{m}\right)^2} \\ = 4.1\times10^{18}\ \text{N} \end{multline*}$ The proportionality to $$1/r^2$$ in Newton's law of gravity was not entirely unexpected. Proportionalities to $$1/r^2$$ are found in many other phenomena in which some effect spreads out from a point. For instance, the intensity of the light from a candle is proportional to $$1/r^2$$, because at a distance $$r$$ from the candle, the light has to be spread out over the surface of an imaginary sphere of area $$4\pi r^2$$. The same is true for the intensity of sound from a firecracker, or the intensity of gamma radiation emitted by the Chernobyl reactor. It's important, however, to realize that this is only an analogy. Force does not travel through space as sound or light does, and force is not a substance that can be spread thicker or thinner like butter on toast. Although several of Newton's contemporaries had speculated that the force of gravity might be proportional to $$1/r^2$$, none of them, even the ones who had learned Newton's laws of motion, had had any luck proving that the resulting orbits would be ellipses, as Kepler had found empirically. Newton did succeed in proving that elliptical orbits would result from a $$1/r^2$$ force, but we postpone the proof until the chapter 15 because it can be accomplished much more easily using the concepts of energy and angular momentum. Newton also predicted that orbits in the shape of hyperbolas should be possible, and he was right. Some comets, for instance, orbit the sun in very elongated ellipses, but others pass through the solar system on hyperbolic paths, never to return. Just as the trajectory of a faster baseball pitch is flatter than that of a more slowly thrown ball, so the curvature of a planet's orbit depends on its speed. A spacecraft can be launched at relatively low speed, resulting in a circular orbit about the earth, or it can be launched at a higher speed, giving a more gently curved ellipse that reaches farther from the earth, or it can be launched at a very high speed which puts it in an even less curved hyperbolic orbit. As you go very far out on a hyperbola, it approaches a straight line, i.e., its curvature eventually becomes nearly zero. Newton also was able to prove that Kepler's second law (sweeping out equal areas in equal time intervals) was a logical consequence of his law of gravity. Newton's version of the proof is moderately complicated, but the proof becomes trivial once you understand the concept of angular momentum, which will be covered later in the course. The proof will therefore be deferred until section 15.7. self-check: Which of Kepler's laws would it make sense to apply to hyperbolic orbits? ◊ Solved problem: Visiting Ceres — problem 10 ◊ Solved problem: Geosynchronous orbit — problem 16 ◊ Solved problem: Why $$a$$ equals $$g$$ — problem 11 ◊ Solved problem: Ida and Dactyl — problem 12 ◊ Solved problem: Another solar system — problem 15 ◊ Solved problem: Weight loss — problem 19 ◊ Solved problem: The receding moon — problem 17 ##### Discussion Questions How could Newton find the speed of the moon to plug in to $$a=v^2/r?$$ Two projectiles of different mass shot out of guns on the surface of the earth at the same speed and angle will follow the same trajectories, assuming that air friction is negligible. (You can verify this by throwing two objects together from your hand and seeing if they separate or stay side by side.) What corresponding fact would be true for satellites of the earth having different masses? What is wrong with the following statement? “A comet in an elliptical orbit speeds up as it approaches the sun, because the sun's force on it is increasing.” Why would it not make sense to expect the earth's gravitational force on a bowling ball to be inversely proportional to the square of the distance between their surfaces rather than their centers? Does the earth accelerate as a result of the moon's gravitational force on it? Suppose two planets were bound to each other gravitationally the way the earth and moon are, but the two planets had equal masses. What would their motion be like? Spacecraft normally operate by firing their engines only for a few minutes at a time, and an interplanetary probe will spend months or years on its way to its destination without thrust. Suppose a spacecraft is in a circular orbit around Mars, and it then briefly fires its engines in reverse, causing a sudden decrease in speed. What will this do to its orbit? What about a forward thrust? ## 10.3 Apparent weightlessness If you ask somebody at the bus stop why astronauts are weightless, you'll probably get one of the following two incorrect answers: (1) They're weightless because they're so far from the earth. (2) They're weightless because they're moving so fast. The first answer is wrong, because the vast majority of astronauts never get more than a thousand miles from the earth's surface. The reduction in gravity caused by their altitude is significant, but not 100%. The second answer is wrong because Newton's law of gravity only depends on distance, not speed. The correct answer is that astronauts in orbit around the earth are not really weightless at all. Their weightlessness is only apparent. If there was no gravitational force on the spaceship, it would obey Newton's first law and move off on a straight line, rather than orbiting the earth. Likewise, the astronauts inside the spaceship are in orbit just like the spaceship itself, with the earth's gravitational force continually twisting their velocity vectors around. The reason they appear to be weightless is that they are in the same orbit as the spaceship, so although the earth's gravity curves their trajectory down toward the deck, the deck drops out from under them at the same rate. Apparent weightlessness can also be experienced on earth. Any time you jump up in the air, you experience the same kind of apparent weightlessness that the astronauts do. While in the air, you can lift your arms more easily than normal, because gravity does not make them fall any faster than the rest of your body, which is falling out from under them. The Russian air force now takes rich foreign tourists up in a big cargo plane and gives them the feeling of weightlessness for a short period of time while the plane is nose-down and dropping like a rock. ## 10.4 Vector addition of gravitational forces l / Gravity only appears to pull straight down because the near perfect symmetry of the earth makes the sideways components of the total force on an object cancel almost exactly. If the symmetry is broken, e.g., by a dense mineral deposit, the total force is a little off to the side. m / A, who is outside a spherical shell of mass, feels gravitational forces from every part of the shell --- stronger forces from the closer parts, and weaker ones from the parts farther away. The shell theorem states that the vector sum of all the forces is the same as if all the mass had been concentrated at the center of the shell. B, at the center, is clearly weightless, because the shell's gravitational forces cancel out. Surprisingly, C also feels exactly zero gravitational force. n / The asteroid Toutatis, imaged by the space probe Chang'e-2 in 2012, is shaped like a bowling pin. Pick a flower on earth and you move the farthest star. -- Paul Dirac When you stand on the ground, which part of the earth is pulling down on you with its gravitational force? Most people are tempted to say that the effect only comes from the part directly under you, since gravity always pulls straight down. Here are three observations that might help to change your mind: • If you jump up in the air, gravity does not stop affecting you just because you are not touching the earth: gravity is a noncontact force. That means you are not immune from the gravity of distant parts of our planet just because you are not touching them. • Gravitational effects are not blocked by intervening matter. For instance, in an eclipse of the moon, the earth is lined up directly between the sun and the moon, but only the sun's light is blocked from reaching the moon, not its gravitational force --- if the sun's gravitational force on the moon was blocked in this situation, astronomers would be able to tell because the moon's acceleration would change suddenly. A more subtle but more easily observable example is that the tides are caused by the moon's gravity, and tidal effects can occur on the side of the earth facing away from the moon. Thus, far-off parts of the earth are not prevented from attracting you with their gravity just because there is other stuff between you and them. • Prospectors sometimes search for underground deposits of dense minerals by measuring the direction of the local gravitational forces, i.e., the direction things fall or the direction a plumb bob hangs. For instance, the gravitational forces in the region to the west of such a deposit would point along a line slightly to the east of the earth's center. Just because the total gravitational force on you points down, that doesn't mean that only the parts of the earth directly below you are attracting you. It's just that the sideways components of all the force vectors acting on you come very close to canceling out. A cubic centimeter of lava in the earth's mantle, a grain of silica inside Mt. Kilimanjaro, and a flea on a cat in Paris are all attracting you with their gravity. What you feel is the vector sum of all the gravitational forces exerted by all the atoms of our planet, and for that matter by all the atoms in the universe. When Newton tested his theory of gravity by comparing the orbital acceleration of the moon to the acceleration of a falling apple on earth, he assumed he could compute the earth's force on the apple using the distance from the apple to the earth's center. Was he wrong? After all, it isn't just the earth's center attracting the apple, it's the whole earth. A kilogram of dirt a few feet under his backyard in England would have a much greater force on the apple than a kilogram of molten rock deep under Australia, thousands of miles away. There's really no obvious reason why the force should come out right if you just pretend that the earth's whole mass is concentrated at its center. Also, we know that the earth has some parts that are more dense, and some parts that are less dense. The solid crust, on which we live, is considerably less dense than the molten rock on which it floats. By all rights, the computation of the vector sum of all the forces exerted by all the earth's parts should be a horrendous mess. Actually, Newton had sound reasons for treating the earth's mass as if it was concentrated at its center. First, although Newton no doubt suspected the earth's density was nonuniform, he knew that the direction of its total gravitational force was very nearly toward the earth's center. That was strong evidence that the distribution of mass was very symmetric, so that we can think of the earth as being made of layers, like an onion, with each layer having constant density throughout. (Today there is further evidence for symmetry based on measurements of how the vibrations from earthquakes and nuclear explosions travel through the earth.) He then considered the gravitational forces exerted by a single such thin shell, and proved the following theorem, known as the shell theorem: If an object lies outside a thin, spherical shell of mass, then the vector sum of all the gravitational forces exerted by all the parts of the shell is the same as if the shell's mass had been concentrated at its center. If the object lies inside the shell, then all the gravitational forces cancel out exactly. For terrestrial gravity, each shell acts as though its mass was at the center, so the result is the same as if the whole mass was there. The second part of the shell theorem, about the gravitational forces canceling inside the shell, is a little surprising. Obviously the forces would all cancel out if you were at the exact center of a shell, but it's not at all obvious that they should still cancel out perfectly if you are inside the shell but off-center. The whole idea might seem academic, since we don't know of any hollow planets in our solar system that astronauts could hope to visit, but actually it's a useful result for understanding gravity within the earth, which is an important issue in geology. It doesn't matter that the earth is not actually hollow. In a mine shaft at a depth of, say, 2 km, we can use the shell theorem to tell us that the outermost 2 km of the earth has no net gravitational effect, and the gravitational force is the same as what would be produced if the remaining, deeper, parts of the earth were all concentrated at its center. The shell theorem doesn't apply to things that aren't spherical. At the point marked with a dot in figure n, we might imagine that gravity was in the direction shown by the dashed arrow, pointing toward the asteroid's center of mass, so that the surface would be a vertical cliff almost a kilometer tall. In reality, calculations based on the assumption of uniform density show that the direction of the gravitational field is approximately as shown by the solid arrow, making the slope only about $$60°$$.1 This happens because gravity at this location is more strongly affected by the nearby “neck” than by the more distant “belly.” This slope is still believed to be too steep to keep dirt and rocks from sliding off (see problem 11, p. 229). self-check: Suppose you're at the bottom of a deep mineshaft, which means you're still quite far from the center of the earth. The shell theorem says that the shell of mass you've gone inside exerts zero total force on you. Discuss which parts of the shell are attracting you in which directions, and how strong these forces are. Explain why it's at least plausible that they cancel. ##### Discussion Questions If you hold an apple, does the apple exert a gravitational force on the earth? Is it much weaker than the earth's gravitational force on the apple? Why doesn't the earth seem to accelerate upward when you drop the apple? When astronauts travel from the earth to the moon, how does the gravitational force on them change as they progress? How would the gravity in the first-floor lobby of a massive skyscraper compare with the gravity in an open field outside of the city? In a few billion years, the sun will start undergoing changes that will eventually result in its puffing up into a red giant star. (Near the beginning of this process, the earth's oceans will boil off, and by the end, the sun will probably swallow the earth completely.) As the sun's surface starts to get closer and close to the earth, how will the earth's orbit be affected? ## 10.5 Weighing the earth p / A simplified version of Cavendish's apparatus. Let's look more closely at the application of Newton's law of gravity to objects on the earth's surface. Since the earth's gravitational force is the same as if its mass was all concentrated at its center, the force on a falling object of mass $$m$$ is given by $\begin{equation*} F = G \: M_\text{earth} \: m \: / \: r_\text{earth}^2 . \end{equation*}$ The object's acceleration equals $$F/m$$, so the object's mass cancels out and we get the same acceleration for all falling objects, as we knew we should: $\begin{equation*} g = G \: M_\text{earth} \: / \: r_\text{earth}^2 . \end{equation*}$ o / Cavendish's apparatus. The two large balls are fixed in place, but the rod from which the two small balls hang is free to twist under the influence of the gravitational forces. Newton knew neither the mass of the earth nor a numerical value for the constant $$G$$. But if someone could measure $$G$$, then it would be possible for the first time in history to determine the mass of the earth! The only way to measure $$G$$ is to measure the gravitational force between two objects of known mass, but that's an exceedingly difficult task, because the force between any two objects of ordinary size is extremely small. The English physicist Henry Cavendish was the first to succeed, using the apparatus shown in figures o and p. The two larger balls were lead spheres 8 inches in diameter, and each one attracted the small ball near it. The two small balls hung from the ends of a horizontal rod, which itself hung by a thin thread. The frame from which the larger balls hung could be rotated by hand about a vertical axis, so that for instance the large ball on the right would pull its neighboring small ball toward us and while the small ball on the left would be pulled away from us. The thread from which the small balls hung would thus be twisted through a small angle, and by calibrating the twist of the thread with known forces, the actual gravitational force could be determined. Cavendish set up the whole apparatus in a room of his house, nailing all the doors shut to keep air currents from disturbing the delicate apparatus. The results had to be observed through telescopes stuck through holes drilled in the walls. Cavendish's experiment provided the first numerical values for $$G$$ and for the mass of the earth. The presently accepted value of $$G$$ is $$6.67\times10^{-11}\ \text{N}\!\cdot\!\text{m}^2/\text{kg}^2$$. Knowing $$G$$ not only allowed the determination of the earth's mass but also those of the sun and the other planets. For instance, by observing the acceleration of one of Jupiter's moons, we can infer the mass of Jupiter. The following table gives the distances of the planets from the sun and the masses of the sun and planets. (Other data are given in the back of the book.) average distance from the sun, in units of the earth’s average distance from the sun mass, in units of the earth’s mass sun — 330,000 mercury 0.38 0.056 venus 0.72 0.82 earth 1 1 mars 1.5 0.11 jupiter 5.2 320 saturn 9.5 95 uranus 19 14 neptune 30 17 pluto 39 0.002 ##### Discussion Questions It would have been difficult for Cavendish to start designing an experiment without at least some idea of the order of magnitude of $$G$$. How could he estimate it in advance to within a factor of 10? Fill in the details of how one would determine Jupiter's mass by observing the acceleration of one of its moons. Why is it only necessary to know the acceleration of the moon, not the actual force acting on it? Why don't we need to know the mass of the moon? What about a planet that has no moons, such as Venus --- how could its mass be found? ## 10.6 Dark energy (optional) Until recently, physicists thought they understood gravity fairly well. Einstein had modified Newton's theory, but certain characteristrics of gravitational forces were firmly established. For one thing, they were always attractive. If gravity always attracts, then it is logical to ask why the universe doesn't collapse. Newton had answered this question by saying that if the universe was infinite in all directions, then it would have no geometric center toward which it would collapse; the forces on any particular star or planet exerted by distant parts of the universe would tend to cancel out by symmetry. More careful calculations, however, show that Newton's universe would have a tendency to collapse on smaller scales: any part of the universe that happened to be slightly more dense than average would contract further, and this contraction would result in stronger gravitational forces, which would cause even more rapid contraction, and so on. When Einstein overhauled gravity, the same problem reared its ugly head. Like Newton, Einstein was predisposed to believe in a universe that was static, so he added a special repulsive term to his equations, intended to prevent a collapse. This term was not associated with any interaction of mass with mass, but represented merely an overall tendency for space itself to expand unless restrained by the matter that inhabited it. It turns out that Einstein's solution, like Newton's, is unstable. Furthermore, it was soon discovered observationally that the universe was expanding, and this was interpreted by creating the Big Bang model, in which the universe's current expansion is the aftermath of a fantastically hot explosion.2 An expanding universe, unlike a static one, was capable of being explained with Einstein's equations, without any repulsion term. The universe's expansion would simply slow down over time due to the attractive gravitational forces. After these developments, Einstein said woefully that adding the repulsive term, known as the cosmological constant, had been the greatest blunder of his life. q / The WMAP probe's map of the cosmic microwave background is like a “baby picture” of the universe. This was the state of things until 1999, when evidence began to turn up that the universe's expansion has been speeding up rather than slowing down! The first evidence came from using a telescope as a sort of time machine: light from a distant galaxy may have taken billions of years to reach us, so we are seeing it as it was far in the past. Looking back in time, astronomers saw the universe expanding at speeds that were lower, rather than higher. At first they were mortified, since this was exactly the opposite of what had been expected. The statistical quality of the data was also not good enough to constitute ironclad proof, and there were worries about systematic errors. The case for an accelerating expansion has however been supported by high-precision mapping of the dim, sky-wide afterglow of the Big Bang, known as the cosmic microwave background. This is discussed in more detail in section 27.4. So now Einstein's “greatest blunder” has been resurrected. Since we don't actually know whether or not this self-repulsion of space has a constant strength, the term “cosmological constant” has lost currency. Nowadays physicists usually refer to the phenomenon as “dark energy.” Picking an impressive-sounding name for it should not obscure the fact that we know absolutely nothing about the nature of the effect or why it exists. Dark energy is discussed in more detail on p. 27.4.4. ## 10.7 A gravitational test of Newton's first law (optional) This section describes a high-precision test of Newton's first law. The left panel of figure r shows a mirror on the moon. By reflecting laser pulses from the mirror, the distance from the earth to the moon has been measured to the phenomenal precision of a few centimeters, or about one part in $$10^{10}$$. This distance changes for a variety of known reasons. The biggest effect is that the moon's orbit is not a circle but an ellipse, with its long axis about 11% longer than its short one. A variety of other effects can also be accounted for, including such exotic phenomena as the slightly nonspherical shape of the earth, and the gravitational forces of bodies as small and distant as Pluto. Suppose for simplicity that all these effects had never existed, so that the moon was initially placed in a perfectly circular orbit around the earth, and the earth in a perfectly circular orbit around the sun. r / Left: The Apollo 11 mission left behind a mirror, which in this photo shows the reflection of the black sky. Right: A highly exaggerated example of an observation that would disprove Newton's first law. The radius of the moon's orbit gets bigger and smaller over the course of a year. If we then observed something like what is shown in the right panel of figure r, Newton's first law would be disproved. If space itself is symmetrical in all directions, then there is no reason for the moon's orbit to poof up near the top of the diagram and contract near the bottom. The only possible explanation would be that there was some preferred frame of reference of the type envisioned by Aristotle, and that our solar system was moving relative to it. Another test for a preferred frame was described in example 3 on p. 239. One could then imagine that the gravitational force of the earth on the moon could be affected by the moon's motion relative to this frame. The lunar laser ranging data3 contain no measurable effect of the type shown in figure r, so that if the moon's orbit is distorted in this way (or in a variety of other ways), the distortion must be less than a few centimeters. This constitutes a very strict upper limit on violation of Newton's first law by gravitational forces. If the first law is violated, and the violation causes a fractional change in gravity that is proportional to the velocity relative to the hypothetical preferred frame, then the change is no more than about one part in $$10^7$$, even if the velocity is comparable to the speed of light. ## Vocabulary ellipse — a flattened circle; one of the conic sections conic section — a curve formed by the intersection of a plane and an infinite cone hyperbola — another conic section; it does not close back on itself period — the time required for a planet to complete one orbit; more generally, the time for one repetition of some repeating motion focus — one of two special points inside an ellipse: the ellipse consists of all points such that the sum of the distances to the two foci equals a certain number; a hyperbola also has a focus ## Notation $$G$$ — the constant of proportionality in Newton's law of gravity; the gravitational force of attraction between two 1-kg spheres at a center-to-center distance of 1 m ## Summary {} Kepler deduced three empirical laws from data on the motion of the planets: • Kepler's elliptical orbit law: The planets orbit the sun in elliptical orbits with the sun at one focus. • Kepler's equal-area law: The line connecting a planet to the sun sweeps out equal areas in equal amounts of time. • Kepler's law of periods: The time required for a planet to orbit the sun is proportional to the long axis of the ellipse raised to the 3/2 power. The constant of proportionality is the same for all the planets. Newton was able to find a more fundamental explanation for these laws. Newton's law of gravity states that the magnitude of the attractive force between any two objects in the universe is given by $\begin{equation*} F=Gm_1m_2/r^2 . \end{equation*}$ Weightlessness of objects in orbit around the earth is only apparent. An astronaut inside a spaceship is simply falling along with the spaceship. Since the spaceship is falling out from under the astronaut, it appears as though there was no gravity accelerating the astronaut down toward the deck. Gravitational forces, like all other forces, add like vectors. A gravitational force such as we ordinarily feel is the vector sum of all the forces exerted by all the parts of the earth. As a consequence of this, Newton proved the shell theorem for gravitational forces: If an object lies outside a thin, uniform shell of mass, then the vector sum of all the gravitational forces exerted by all the parts of the shell is the same as if all the shell's mass was concentrated at its center. If the object lies inside the shell, then all the gravitational forces cancel out exactly. ## Homework Problems t / Problem 8. u / Problem 12. v / Problem 21. 1. Roy has a mass of 60 kg. Laurie has a mass of 65 kg. They are 1.5 m apart. (a) What is the magnitude of the gravitational force of the earth on Roy? (b) What is the magnitude of Roy's gravitational force on the earth? (c) What is the magnitude of the gravitational force between Roy and Laurie? (d) What is the magnitude of the gravitational force between Laurie and the sun?(answer check available at lightandmatter.com) 2. During a solar eclipse, the moon, earth and sun all lie on the same line, with the moon between the earth and sun. Define your coordinates so that the earth and moon lie at greater $$x$$ values than the sun. For each force, give the correct sign as well as the magnitude. (a) What force is exerted on the moon by the sun? (b) On the moon by the earth? (c) On the earth by the sun? (d) What total force is exerted on the sun? (e) On the moon? (f) On the earth?(answer check available at lightandmatter.com) 3. Suppose that on a certain day there is a crescent moon, and you can tell by the shape of the crescent that the earth, sun and moon form a triangle with a $$135°$$ interior angle at the moon's corner. What is the magnitude of the total gravitational force of the earth and the sun on the moon? (If you haven't done problem 2 already, you might want to try it first, since it's easier, and some of its results can be recycled in this problem.) (answer check available at lightandmatter.com) s / Problem 3. 4. How high above the Earth's surface must a rocket be in order to have 1/100 the weight it would have at the surface? Express your answer in units of the radius of the Earth.(answer check available at lightandmatter.com) 5. The star Lalande 21185 was found in 1996 to have two planets in roughly circular orbits, with periods of 6 and 30 years. What is the ratio of the two planets' orbital radii?(answer check available at lightandmatter.com) 6. In a Star Trek episode, the Enterprise is in a circular orbit around a planet when something happens to the engines. Spock then tells Kirk that the ship will spiral into the planet's surface unless they can fix the engines. Is this scientifically correct? Why? 7. (a) Suppose a rotating spherical body such as a planet has a radius $$r$$ and a uniform density $$\rho$$, and the time required for one rotation is $$T$$. At the surface of the planet, the apparent acceleration of a falling object is reduced by the acceleration of the ground out from under it. Derive an equation for the apparent acceleration of gravity, $$g$$, at the equator in terms of $$r$$, $$\rho$$, $$T$$, and $$G$$.(answer check available at lightandmatter.com) (b) Applying your equation from a, by what fraction is your apparent weight reduced at the equator compared to the poles, due to the Earth's rotation?(answer check available at lightandmatter.com) (c) Using your equation from a, derive an equation giving the value of $$T$$ for which the apparent acceleration of gravity becomes zero, i.e., objects can spontaneously drift off the surface of the planet. Show that $$T$$ only depends on $$\rho$$, and not on $$r$$.(answer check available at lightandmatter.com) (d) Applying your equation from c, how long would a day have to be in order to reduce the apparent weight of objects at the equator of the Earth to zero? [Answer: 1.4 hours] (e) Astronomers have discovered objects they called pulsars, which emit bursts of radiation at regular intervals of less than a second. If a pulsar is to be interpreted as a rotating sphere beaming out a natural “searchlight” that sweeps past the earth with each rotation, use your equation from c to show that its density would have to be much greater than that of ordinary matter. (f) Astrophysicists predicted decades ago that certain stars that used up their sources of energy could collapse, forming a ball of neutrons with the fantastic density of $$\sim10^{17}\ \text{kg}/\text{m}^3$$. If this is what pulsars really are, use your equation from c to explain why no pulsar has ever been observed that flashes with a period of less than 1 ms or so. 8. You are considering going on a space voyage to Mars, in which your route would be half an ellipse, tangent to the Earth's orbit at one end and tangent to Mars' orbit at the other. Your spacecraft's engines will only be used at the beginning and end, not during the voyage. How long would the outward leg of your trip last? (Assume the orbits of Earth and Mars are circular.) (answer check available at lightandmatter.com) 9. (a) If the earth was of uniform density, would your weight be increased or decreased at the bottom of a mine shaft? Explain. (b) In real life, objects weigh slightly more at the bottom of a mine shaft. What does that allow us to infer about the Earth? 10. (solution in the pdf version of the book) Ceres, the largest asteroid in our solar system, is a spherical body with a mass 6000 times less than the earth's, and a radius which is 13 times smaller. If an astronaut who weighs 400 N on earth is visiting the surface of Ceres, what is her weight? 11. (solution in the pdf version of the book) Prove, based on Newton's laws of motion and Newton's law of gravity, that all falling objects have the same acceleration if they are dropped at the same location on the earth and if other forces such as friction are unimportant. Do not just say, “$$g=9.8\ \text{m}/\text{s}^2$$ -- it's constant.” You are supposed to be proving that $$g$$ should be the same number for all objects. 12. (solution in the pdf version of the book) The figure shows an image from the Galileo space probe taken during its August 1993 flyby of the asteroid Ida. Astronomers were surprised when Galileo detected a smaller object orbiting Ida. This smaller object, the only known satellite of an asteroid in our solar system, was christened Dactyl, after the mythical creatures who lived on Mount Ida, and who protected the infant Zeus. For scale, Ida is about the size and shape of Orange County, and Dactyl the size of a college campus. Galileo was unfortunately unable to measure the time, $$T$$, required for Dactyl to orbit Ida. If it had, astronomers would have been able to make the first accurate determination of the mass and density of an asteroid. Find an equation for the density, $$\rho$$, of Ida in terms of Ida's known volume, $$V$$, the known radius, $$r$$, of Dactyl's orbit, and the lamentably unknown variable $$T$$. (This is the same technique that was used successfully for determining the masses and densities of the planets that have moons.) 13. If a bullet is shot straight up at a high enough velocity, it will never return to the earth. This is known as the escape velocity. We will discuss escape velocity using the concept of energy later in the course, but it can also be gotten at using straightforward calculus. In this problem, you will analyze the motion of an object of mass $$m$$ whose initial velocity is exactly equal to escape velocity. We assume that it is starting from the surface of a spherically symmetric planet of mass $$M$$ and radius $$b$$. The trick is to guess at the general form of the solution, and then determine the solution in more detail. Assume (as is true) that the solution is of the form $$r= kt^p$$, where $$r$$ is the object's distance from the center of the planet at time $$t$$, and $$k$$ and $$p$$ are constants. (a) Find the acceleration, and use Newton's second law and Newton's law of gravity to determine $$k$$ and $$p$$. You should find that the result is independent of $$m$$.(answer check available at lightandmatter.com) (b) What happens to the velocity as $$t$$ approaches infinity? (c) Determine escape velocity from the Earth's surface.(answer check available at lightandmatter.com) ∫ 14. Astronomers have recently observed stars orbiting at very high speeds around an unknown object near the center of our galaxy. For stars orbiting at distances of about $$10^{14}\ \text{m}$$ from the object, the orbital velocities are about $$10^6$$ m/s. Assuming the orbits are circular, estimate the mass of the object, in units of the mass of the sun, $$2\times10^{30}$$ kg. If the object was a tightly packed cluster of normal stars, it should be a very bright source of light. Since no visible light is detected coming from it, it is instead believed to be a supermassive black hole.(answer check available at lightandmatter.com) 15. (solution in the pdf version of the book) Astronomers have detected a solar system consisting of three planets orbiting the star Upsilon Andromedae. The planets have been named b, c, and d. Planet b's average distance from the star is 0.059 A.U., and planet c's average distance is 0.83 A.U., where an astronomical unit or A.U. is defined as the distance from the Earth to the sun. For technical reasons, it is possible to determine the ratios of the planets' masses, but their masses cannot presently be determined in absolute units. Planet c's mass is 3.0 times that of planet b. Compare the star's average gravitational force on planet c with its average force on planet b. [Based on a problem by Arnold Arons.] 16. (solution in the pdf version of the book) Some communications satellites are in orbits called geosynchronous: the satellite takes one day to orbit the earth from west to east, so that as the earth spins, the satellite remains above the same point on the equator. What is such a satellite's altitude above the surface of the earth? 17. As is discussed in more detail in example 3 on p. 386, tidal interactions with the earth are causing the moon's orbit to grow gradually larger. Laser beams bounced off of a mirror left on the moon by astronauts have allowed a measurement of the moon's rate of recession, which is about 1 cm per year. This means that the gravitational force acting between earth and moon is decreasing. By what fraction does the force decrease with each 27-day orbit? \hwhint{hwhint:receding-moon} (solution in the pdf version of the book) [Based on a problem by Arnold Arons.] 18. Suppose that we inhabited a universe in which, instead of Newton's law of gravity, we had $$F=k\sqrt{m_1m_2}/r^2$$, where $$k$$ is some constant with different units than $$G$$. (The force is still attractive.) However, we assume that $$a=F/m$$ and the rest of Newtonian physics remains true, and we use $$a=F/m$$ to define our mass scale, so that, e.g., a mass of 2 kg is one which exhibits half the acceleration when the same force is applied to it as to a 1 kg mass. (a) Is this new law of gravity consistent with Newton's third law? (b) Suppose you lived in such a universe, and you dropped two unequal masses side by side. What would happen? (c) Numerically, suppose a 1.0-kg object falls with an acceleration of 10 $$\text{m}/\text{s}^2$$. What would be the acceleration of a rain drop with a mass of 0.1 g? Would you want to go out in the rain? (d) If a falling object broke into two unequal pieces while it fell, what would happen? (e) Invent a law of gravity that results in behavior that is the opposite of what you found in part b. [Based on a problem by Arnold Arons.] 19. (a) A certain vile alien gangster lives on the surface of an asteroid, where his weight is 0.20 N. He decides he needs to lose weight without reducing his consumption of princesses, so he's going to move to a different asteroid where his weight will be 0.10 N. The real estate agent's database has asteroids listed by mass, however, not by surface gravity. Assuming that all asteroids are spherical and have the same density, how should the mass of his new asteroid compare with that of his old one? (b) Jupiter's mass is 318 times the Earth's, and its gravity is about twice Earth's. Is this consistent with the results of part a? If not, how do you explain the discrepancy?(solution in the pdf version of the book) 20. Where would an object have to be located so that it would experience zero total gravitational force from the earth and moon?(answer check available at lightandmatter.com) 21. The planet Uranus has a mass of $$8.68\times10^{25}$$ kg and a radius of $$2.56\times10^4$$ km. The figure shows the relative sizes of Uranus and Earth. (a) Compute the ratio $$g_U/g_E$$, where $$g_U$$ is the strength of the gravitational field at the surface of Uranus and $$g_E$$ is the corresponding quantity at the surface of the Earth.(answer check available at lightandmatter.com) 22. The International Space Station orbits at an average altitude of about 370 km above sea level. Compute the value of $$g$$ at that altitude.(answer check available at lightandmatter.com) w / Problem 23: New Horizons at its closest approach to Jupiter. (Jupiter's four largest moons are shown for illustrative purposes.) The masses are: sun: $$1.9891\times10^{30}\ \text{kg}$$ Jupiter: $$1.8986\times10^{27}\ \text{kg}$$ New Horizons: 465.0 kg 23. On Feb. 28, 2007, the New Horizons space probe, on its way to a 2015 flyby of Pluto, passed by the planet Jupiter for a gravity-assisted maneuver that increased its speed and changed its course. The dashed line in the figure shows the spacecraft's trajectory, which is curved because of three forces: the force of the exhaust gases from the probe's own engines, the sun's gravitational force, and Jupiter's gravitational force. Find the magnitude of the total gravitational force acting on the probe. You will find that the sun's force is much smaller than Jupiter's, so that the magnitude of the total force is determined almost entirely by Jupiter's force. However, this is a high-precision problem, and you will find that the total force is slightly different from Jupiter's force.(answer check available at lightandmatter.com) 24. On an airless body such as the moon, there is no atmospheric friction, so it should be possible for a satellite to orbit at a very low altitude, just high enough to keep from hitting the mountains. (a) Suppose that such a body is a smooth sphere of uniform density $$\rho$$ and radius $$r$$. Find the velocity required for a ground-skimming orbit.(answer check available at lightandmatter.com) (b) A typical asteroid has a density of about $$2\ \text{g}/\text{cm}^3$$, i.e., twice that of water. (This is a lot lower than the density of the earth's crust, probably indicating that the low gravity is not enough to compact the material very tightly, leaving lots of empty space inside.) Suppose that it is possible for an astronaut in a spacesuit to jump at $$2\ \text{m}/\text{s}$$. Find the radius of the largest asteroid on which it would be possible to jump into a ground-skimming orbit.(answer check available at lightandmatter.com) 25. The figure shows a region of outer space in which two stars have exploded, leaving behind two overlapping spherical shells of gas, which we assume to remain at rest. The figure is a cross-section in a plane containing the shells' centers. A space probe is released with a very small initial speed at the point indicated by the arrow, initially moving in the direction indicated by the dashed line. Without any further information, predict as much as possible about the path followed by the probe and its changes in speed along that path. x / Problem 25. 26. Approximate the earth's density as being constant. (a) Find the gravitational field at a point P inside the earth and half-way between the center and the surface. Express your result as a ratio $$g_P/g_S$$ relative to the field we experience at the surface. (b) As a check on your answer, make sure that the same reasoning leads to a reasonable result when the fraction 1/2 is replaced by the value 0 (P being the earth's center) or the value 1 (P being a point on the surface). 27. The earth is divided into solid inner core, a liquid outer core, and a plastic mantle. Physical properties such as density change discontinuously at the boundaries between one layer and the next. Although the density is not completely constant within each region, we will approximate it as being so for the purposes of this problem. (We neglect the crust as well.) Let $$R$$ be the radius of the earth as a whole and $$M$$ its mass. The following table gives a model of some properties of the three layers, as determined by methods such as the observation of earthquake waves that have propagated from one side of the planet to the other. region outer radiusR massM mantle 1 0.69 outer core 0.55 0.29 inner core 0.19 0.017 The boundary between the mantle and the outer core is referred to as the Gutenberg discontinuity. Let $$g_s$$ be the strength of the earth's gravitational field at its surface and $$g_G$$ its value at the Gutenberg discontinuity. Find $$g_G/g_s$$.(answer check available at lightandmatter.com) \begin{handson}{}{The shell theorem}{\onecolumn} This exercise is an approximate numerical test of the shell theorem. There are seven masses A-G, each being one kilogram. Masses A-F, each one meter from the center, form a shape like two Egyptian pyramids joined at their bases; this is a rough approximation to a six-kilogram spherical shell of mass. Mass G is five meters from the center of the main group. The class will divide into six groups and split up the work required in order to calculate the vector sum of the six gravitational forces exerted on mass G. Depending on the size of the class, more than one group may be assigned to deal with the contribution of the same mass to the total force, and the redundant groups can check each other's results. \includegraphics[width=78mm]{../share/mechanics/figs/ex-octahedron} 1. Discuss as a class what can be done to simplify the task of calculating the vector sum, and how to organize things so that each group can work in parallel with the others. 2. Each group should write its results on the board in units of piconewtons, retaining five significant figures of precision. Everyone will need to use the same value for the gravitational constant, $$G=6.6743\times10^{-11}\ \text{N}\!\cdot\!\text{m}^2/\text{kg}^2$$. 3. The class will determine the vector sum and compare with the result that would be obtained with the shell theorem. \end{handson} (c) 1998-2013 Benjamin Crowell, licensed under the Creative Commons Attribution-ShareAlike license. Photo credits are given at the end of the Adobe Acrobat version. ##### Footnotes [1] Hudson et al., Icarus 161 (2003) 346 [2] Section section 19.5 presents some of the evidence for the Big Bang. [3] Battat, Chandler, and Stubbs, http://arxiv.org/abs/0710.0702
2013-12-12 19:23:35
{"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.7042098045349121, "perplexity": 423.44786348166076}, "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/1386164692455/warc/CC-MAIN-20131204134452-00041-ip-10-33-133-15.ec2.internal.warc.gz"}
https://www.hpmuseum.org/forum/thread-16883.html
May 5 Update? 05-06-2021, 02:11 AM Post: #1 toml_12953 Senior Member Posts: 1,904 Joined: Dec 2013 May 5 Update? Tom L Cui bono? 05-06-2021, 05:08 AM Post: #2 cyrille de brébisson Senior Member Posts: 1,047 Joined: Dec 2013 RE: May 5 Update? Hello, Mostly a small bug in exam mode which we had to get out rely fast before exams in Europe. Some other small bug fixes. More importantly 2 critical "load" bugs that were causing crashes and reboot when loading old type programs (through the CK or from a backup). Some other changes: Code: FIXED BUG: fix exam mode bug FIXED BUG: TERMINAL(3):=value did not work well... FIXED BUG: proot wizard did not work when cas was disabled FIXED BUG: proot wizard display errors with complex polynomials FIXED BUG: number of crash at load time for backups and programs FIXED BUG: Python: matplotl show was not working TECHNICAL: new language strings Cyrille Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP. 05-06-2021, 06:53 AM Post: #3 parisse Senior Member Posts: 1,222 Joined: Dec 2013 RE: May 5 Update? I could not make show() work. Code: from matplotl import * plot([1,2,3],[4,5,7]) show() should display two segments. 05-06-2021, 11:39 AM Post: #4 Tschumi81 Junior Member Posts: 9 Joined: Sep 2019 RE: May 5 Update? Hello, Unfortunately I have discovered another BUG in the APP Explorer. On the physical calculator G2 (FW: 20210505 v14588) the display of the values is no longer displayed correctly during the transformation. Would certainly be nice for the students if this would still work correctly! Best thanks for the excellent work in 2021! Attached File(s) Thumbnail(s) 05-06-2021, 02:15 PM Post: #5 Tschumi81 Junior Member Posts: 9 Joined: Sep 2019 RE: May 5 Update? Application: Explorer App Since the latest firmware 2021-05-05 v14588 on calculator Prime G2 the values are not displayed at the correct place when transforming. Kind regards, Tschumi 05-06-2021, 07:56 PM Post: #6 ace Junior Member Posts: 5 Joined: May 2021 RE: May 5 Update? Thanks for the update, @cyrille! @parisse, show() worked for me using May 5th firmware (HP Prime G2). I tested it using the hist(), since I was interested in histograms, and using the code you posted. Below are the steps I took to update my prime: A few things I've noticed: • clf() does not work, and it keeps the previous plot in the figure. • only way i've found (so far) to clear the previous figure is to reset the calculator • plot overlays on python command line, the work around is to use the hpprime library and do the clear screen trick someone posted in previous thread • python scripts run one after another, not sure how to disable that • not sure what the syntax is for hist() to include the number of bins • did notice my calculator rebooting sometimes when i was saving a new python file through the connectivity tool 05-06-2021, 08:04 PM Post: #7 toml_12953 Senior Member Posts: 1,904 Joined: Dec 2013 RE: May 5 Update? (05-06-2021 05:08 AM)cyrille de brébisson Wrote:  Hello, Mostly a small bug in exam mode which we had to get out rely fast before exams in Europe. Some other small bug fixes. More importantly 2 critical "load" bugs that were causing crashes and reboot when loading old type programs (through the CK or from a backup). Now my older Primes (pre-G2) constantly reboot when I connect to the CK and click on Applications in the left pane. Tom L Cui bono? 05-06-2021, 09:48 PM Post: #8 Dougggg Member Posts: 102 Joined: Dec 2013 RE: May 5 Update? On my g1 it rebooted during sync until i reset the adv Graph/Function and Graph 3d after reseting those apps it syncs. So maybe the problem is one of those apps 05-07-2021, 04:11 AM Post: #9 Wes Loewer Senior Member Posts: 395 Joined: Jan 2014 RE: May 5 Update? (05-06-2021 09:48 PM)Dougggg Wrote:  On my g1 it rebooted during sync until i reset the adv Graph/Function and Graph 3d after reseting those apps it syncs. So maybe the problem is one of those apps I tried that, but it didn't work until I had reset all the apps and deleted all my saved apps. 05-07-2021, 04:15 AM Post: #10 Eddie W. Shore Senior Member Posts: 1,316 Joined: Dec 2013 RE: May 5 Update? (05-06-2021 07:56 PM)ace Wrote:  Thanks for the update, @cyrille! @parisse, show() worked for me using May 5th firmware (HP Prime G2). I tested it using the hist(), since I was interested in histograms, and using the code you posted. Below are the steps I took to update my prime: I did not get prompted to updated to 5/5/2021 firmware. I can't find it anywhere. 05-07-2021, 05:25 AM Post: #11 robmio Member Posts: 142 Joined: Jan 2020 RE: May 5 Update? (05-06-2021 06:53 AM)parisse Wrote:  I could not make show() work. Code: from matplotl import * plot([1,2,3],[4,5,7]) show() should display two segments. even I can't get the little program to work 05-07-2021, 05:58 AM Post: #12 parisse Senior Member Posts: 1,222 Joined: Dec 2013 RE: May 5 Update? (05-06-2021 07:56 PM)ace Wrote:  @parisse, show() worked for me using May 5th firmware (HP Prime G2). I tested it using the hist(), since I was interested in histograms, and using the code you posted. It does not work on a G1, I did not check on a G2. clf does indeed not work, because internally it calls the giac erase() command, and erase() is not available on the Prime CAS. 05-07-2021, 06:24 AM (This post was last modified: 05-07-2021 06:35 AM by Stevetuc.) Post: #13 Stevetuc Member Posts: 298 Joined: Jan 2014 RE: May 5 Update? (05-07-2021 04:15 AM)Eddie W. Shore Wrote:  I did not get prompted to updated to 5/5/2021 firmware. I can't find it anywhere. Hi Eddie, it's on the ftp site: ftp://ftp.hp.com/pub/calculators/Prime/ 05-07-2021, 11:55 AM Post: #14 StephanP Member Posts: 68 Joined: Apr 2015 RE: May 5 Update? Web browsers no longer support ftp:// connection so you will need to use an FTP app with anonymus login. The latest beta 20210428 of the Connectivity Kit will download the latest OS version 20210505 automatically. Much more convenient. 05-07-2021, 12:07 PM Post: #15 rprosperi Super Moderator Posts: 5,352 Joined: Dec 2013 RE: May 5 Update? (05-07-2021 11:55 AM)StephanP Wrote:  Web browsers no longer support ftp:// connection so you will need to use an FTP app with anonymus login. If you're using Windows, you can simply use File Explorer. Copy the ftp: url and paste it in File Explorer's address bar, it works fine. No idea if this works in macOS Finder; I'd guess not, but would like to know if some Mac owner could give it a try. --Bob Prosperi 05-07-2021, 12:20 PM Post: #16 robmio Member Posts: 142 Joined: Jan 2020 RE: May 5 Update? (05-07-2021 05:58 AM)parisse Wrote: (05-06-2021 07:56 PM)ace Wrote:  @parisse, show() worked for me using May 5th firmware (HP Prime G2). I tested it using the hist(), since I was interested in histograms, and using the code you posted. It does not work on a G1, I did not check on a G2. clf does indeed not work, because internally it calls the giac erase() command, and erase() is not available on the Prime CAS. With the HP PRIME G2, two blue segments are drawn - it works! However, even if the two segments are drawn, <import 'program name' remains in the upper left corner of the calculator screen. Is this a normal thing? Another question: if I move to HOME or CAS, how can I call and run a program written with the Python App? 05-07-2021, 01:38 PM Post: #17 Eddie W. Shore Senior Member Posts: 1,316 Joined: Dec 2013 RE: May 5 Update? (05-07-2021 11:55 AM)StephanP Wrote:  Web browsers no longer support ftp:// connection so you will need to use an FTP app with anonymus login. The latest beta 20210428 of the Connectivity Kit will download the latest OS version 20210505 automatically. Much more convenient. Using File Explorer worked. Thank you HP Team! 05-07-2021, 02:06 PM (This post was last modified: 05-07-2021 02:17 PM by Arno K.) Post: #18 Arno K Senior Member Posts: 456 Joined: Mar 2015 RE: May 5 Update? Using the old ie does the job. Arno Even better and long awaited is the automatic download starting the ConnKit 05-07-2021, 02:22 PM (This post was last modified: 05-07-2021 02:24 PM by StephenG1CMZ.) Post: #19 StephenG1CMZ Senior Member Posts: 936 Joined: May 2015 RE: May 5 Update? (05-07-2021 01:38 PM)Eddie W. Shore Wrote: (05-07-2021 11:55 AM)StephanP Wrote:  Web browsers no longer support ftp:// connection so you will need to use an FTP app with anonymus login. The latest beta 20210428 of the Connectivity Kit will download the latest OS version 20210505 automatically. Much more convenient. Using File Explorer worked. Thank you HP Team! Stephen Lewkowicz (G1CMZ) 05-07-2021, 07:37 PM Post: #20 Eddie W. Shore Senior Member Posts: 1,316 Joined: Dec 2013 RE: May 5 Update?
2022-09-26 11:36: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": 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.1788930892944336, "perplexity": 14210.230298758852}, "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/1664030334871.54/warc/CC-MAIN-20220926113251-20220926143251-00328.warc.gz"}
http://www.redblobgames.com/x/jetbolt/viewer/recipes.html
10 Apr 2014 I looked at the database for build 93 and it has crafting data. Is there a cool visualization of this? I tried a bunch of things but wasn’t happy with any of them. This page is updated for build 125, but some of the diagrams aren’t working for reasons I don’t understand. There are ingredients with a recipe id, item type id, and level. There are recipes with a recipe id, item type id, and level. The ingredient table has several ingredients per recipe. It looks like usually three but not always. I think these must be the inputs. The recipe table has one ingredient per recipe. I think these must be the outputs. The itemtype table tells me the name and icon and color of each of the items. The easiest way to build a visualization would be to use graphviz. ## #1  Ingredient to Ingredient • Join the recipe and ingredient tables, to build rules $$I_i \rightarrow I_j$$ for each ingredient $$I_i$$ that contributes to an ingredient $$I_j$$. I’ll try several different graphviz layout algorithms: fdp: twopi: neato: I don’t like any of these layouts. ## #2  Ingredient to Recipe to Ingredient How about if we put each recipe into its own node? • For each ingredient entry, build a rule $$I_i \rightarrow R_j$$. • For each recipe entry, build a rule $$R_j \rightarrow I_i$$. Let’s try fdp: Let’s try twopi: Let’s try neato: This seems too complicated too. I also tried a left-to-right dot layout: That was more compact but still not quite readable. Maybe I need to tweak arrow and node sizes. I just don’t know at the moment. ## #3  Ingredient mix to Ingredient Crunch on the forums suggests combining recipes with the same ingredients. This seems like a really good idea. • Each input ingredient $$I_1 \rightarrow I_1\_I_2\_I_3$$ if the recipe has ingredients $$1, 2, 3$$ • Each output ingredient $$I_1\_I_2\_I_3 \rightarrow I_4$$ Let’s try dot: Let’s try fdp: Let’s try twopi: Let’s try neato: ## #4  Interactive version How about the circular layout in this d3 demo? Mousing over an element could highlight everything it’s connected to. I like Crunch’s UI too.
2017-05-27 13:59: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": 0, "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.3299470543861389, "perplexity": 3038.8794070291456}, "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-22/segments/1495463608954.74/warc/CC-MAIN-20170527133144-20170527153144-00184.warc.gz"}
https://www.vedantu.com/question-answer/state-whether-true-or-false-the-power-factor-pf-class-12-physics-cbse-5fd7cabd609c0e2b766a7d2e
# State whether true or false: The power factor (PF) indicates how much of the apparent power is true power.A. TrueB. False Verified 119.7k+ views Hint:First study and understand what is meant by power factor. Power factor is used to determine the power consumed in an AC (alternating current) circuit. It is equal to the ratio of the real power consumed by the circuit to the apparent power given to the circuit. In this case, the power factor of the circuit is $PF=\dfrac{Q}{P}$. Therefore, we can say that power factor helps us to determine how real power out of the apparent power given is consumed by the circuit. Hence, we can also say that the power factor (PF) indicates how much of the apparent power is true power.
2022-01-28 08: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": 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.7370824813842773, "perplexity": 244.19424711937387}, "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-2022-05/segments/1642320305423.58/warc/CC-MAIN-20220128074016-20220128104016-00630.warc.gz"}
https://proxieslive.com/tag/verify/
## Is a SHA checksum enough to verify integrity and authenticity? This is a broader question but here a concret example: From https://www.apache.org/info/verification.html : File hashes are used to check that a file has been downloaded correctly. They do not provide any guarantees as to the authenticity of the file. I don’t understand this part: They do not provide any guarantees as to the authenticity of the file. How a file can not be authentic if it match a checksum from a HTTPS trusted source? Or do I miss something and I still need to validate with a GPG key? ## How to numerically verify that principal value? Mathematica finds Integrate[Exp[I*s]/(1 + s/(s^2 - 1)^2), {s, -Infinity, Infinity}, PrincipalValue -> True] // ToRadicals (*A huge closed-form expression which is omitted here.*) N[%] (*-1.414 + 0.192275 I*) The use of the principal value is grounded by the plots Plot[{Cos[s]/(1 + s/(s^2 - 1)^2),Sin[s]/(1 + s/(s^2 - 1)^2)},{s,-5,5},WorkingPrecision->30,PlotPoints -> 50] It’s clear that the integrand has its real singularities at the real roots of the denominator, so sol = Reduce[1 + s/(s^2 - 1)^2 == 0, s, Reals] // ToRadicals; sol[[1]][[2]] (*-(1/(2 Sqrt[3/(4 + (155/2 - (3 Sqrt[849])/2)^(1/3) + (1/2 (155 + 3 Sqrt[849]))^(1/3))])) - 1/2 Sqrt[8/3 - 1/3 (155/2 - (3 Sqrt[849])/2)^(1/3) - 1/3 (1/2 (155 + 3 Sqrt[849]))^(1/3) + 2 Sqrt[3/( 4 + (155/2 - (3 Sqrt[849])/2)^(1/3) + (1/2 (155 + 3 Sqrt[849]))^( 1/3))]]*) N[%] (*-1.49022*) sol[[2]][[2]] (*-(1/(2 Sqrt[3/(4 + (155/2 - (3 Sqrt[849])/2)^(1/3) + (1/2 (155 + 3 Sqrt[849]))^(1/3))])) + 1/2 Sqrt[8/3 - 1/3 (155/2 - (3 Sqrt[849])/2)^(1/3) - 1/3 (1/2 (155 + 3 Sqrt[849]))^(1/3) + 2 Sqrt[3/( 4 + (155/2 - (3 Sqrt[849])/2)^(1/3)+(1/2 (155 + 3 Sqrt[849]))^( 1/3))]]*) However, I have doubts concerning the obtained principal value because the integrand asymptotically equals $$\exp(is)$$ as $$s\to \infty$$ and $$s\to -\infty$$ and $$PV\int_{-\infty}^\infty \exp(is)\,ds$$ does not exist. In view of it I try to verify it numerically through NIntegrate[Exp[I*s]/(1+s/(s^2-1)^2),{s,-Infinity, -(1/(2 Sqrt[3/(4+(155/2-(3 Sqrt[849])/2)^(1/3)+(1/2 (155+3 Sqrt[849]))^(1/3))]))- 1/2 Sqrt[8/3-1/3 (155/2-(3 Sqrt[849])/2)^(1/3)-1/3 (1/2 (155+3 Sqrt[849]))^(1/3)+ 2 Sqrt[3/(4+(155/2-(3 Sqrt[849])/2)^(1/3)+(1/2 (155+3 Sqrt[849]))^(1/3))]], -(1/(2 Sqrt[3/(4+(155/2-(3 Sqrt[849])/2)^(1/3)+(1/2 (155+3 Sqrt[849]))^(1/3))]))+ 1/2 Sqrt[8/3-1/3 (155/2-(3 Sqrt[849])/2)^(1/3)-1/3 (1/2 (155+3 Sqrt[849]))^(1/3)+ 2 Sqrt[3/(4+(155/2-(3 Sqrt[849])/2)^(1/3)+(1/2 (155+3 Sqrt[849]))^(1/3))]],Infinity}, Method->"PrincipalValue",AccuracyGoal->3,PrecisionGoal->3,WorkingPrecision->50] which results in the error message NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections in s near {s} = {3.7749613270651398879039428756113970426387939277790*10^28}. NIntegrate obtained 8.8211977939280824575415993952100374290963331174834*10^47 I and 9.194032783290130686998715991388359408878977362628350.*^47 for the integral and error estimates. and (*-2.6098684408162971553635553440779848277629513026488*10^49 + 8.8211977939280824575415993952100374290963331174789*10^47 I*) Constructive suggestions are welcome. ## Can you verify a word’s position in an enumeration faster than performing the enumeration? Pt 1. Given as input the tuple: (word, natural number)–does there exist a verifier, that runs faster than a fixed enumerator, that can accept if the word is in the position of the natural number in the enumeration by the fixed enumerator, and reject if it is not? I suspect the answer is no. In that case… Pt 2. Is there a way to get around this by adding a “tagging” function to the enumerator so that a verifier can be given something like (word#tag, natural number) so that it almost immediately knows, from the tag, if the word is in the position of the natural number (do there exist such ‘modified languages’) AND IT CAN’T BE FOOLED! Of course you can stick a natural number onto a word, but how can you do this so the verifier can BE SURE you aren’t lying…? Trying to figure out a way to tag the words (or generate a description for the words in a language (modify the language being enumerated/the enumerator)) so that stuck on to the words enumerated is the positions their the enumeration, and this information is reliable and can be verified quickly. Any ideas? 🙂 ## Must a decision problem in $NP$ have a complement in $Co-NP$, if I can verify the solutions to in polynomial-time? Goldbach’s Conjecture says every even integer $$>$$ $$2$$ can be expressed as the sum of two primes. Let’s say $$N$$ is our input and its $$10$$. Which is an integer > 2 and is not odd. ## Algorithm 1.Create list of numbers from $$1,to~N$$ 2.Use prime-testing algorithm for creating a second list of prime numbers 3.Use my 2_sum solver that allows you to use primes twice that sum up to $$N$$ for j in range(list-of-primes)): if N-(list-of-primes[j]) in list-of-primes: print('yes') break 4.Verify solution efficently if AKS-primality(N-(list-of-primes[j])): if AKS-primality(list-of-primes[j]): print('Solution is correct') 5.Output yes 7 + 3 Solution is correct ## Question If the conjecture is true, then the answer will always be Yes. Does that mean it can’t be in $$Co-NP$$ because the answer is always Yes? ## How do I verify a signature using DSA and my own “y” value in Python? I have to verify a signature using DSA FIPS 186-2 (I know it is not used anymore, but I need to make it work for a legacy system). My problem is I have the “y” DSA value, but I cannot work out how I can feed that into the Python code to create my own public key from the “y” value and then apply the verify. For example below is what I have, but instead of generating a NEW key, I need to use my existing value? from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives.asymmetric import dsa from cryptography.exceptions import InvalidSignature private_key = dsa.generate_private_key( key_size=1024, backend=default_backend() ) data = b"this is some data I'd like to sign" signature = private_key.sign( data, hashes.SHA1() ) public_key = private_key.public_key() try: public_key.verify( signature, data, hashes.SHA1()) except InvalidSignature: print ("Invalid") ## How could I verify that a contract was actually sent to me from the client as soon as the contract is received? If I want to store electronic contracts for clients over a long period of time. I need to make sure that those files are not readable by anyone other than the client until the client retrieves them at a later time. But, I do need to be able to verify that a contract was actually sent to me from the client as soon as the contract is received. How could this be done? what would the client do, and what algorithms would they use? What would I do, and what algorithms would I use? ## Openssl cms verify signature with timestamp and crl I’ve used openssl cms to sign the data and generate the detached signature. As per my requirements I need to timestamp the signature as well, so that if the certificate expired, verification of signature can be done. Generated timestamp is also in detached format. I’ve also generate the CRL after revoking the certificate. NOTE: For testing purpose I’ve created my own CA authority using openssl For signing data: openssl cms -sign -binary -in test_data.tgz -md5 sha256 -signer my-cert.pem -inkey my-cert.key -out test_data.cms -outform DER For timestamping signature: (Used freetsa.org as a TSA authority) openssl ts -query -data test_data.cms -no_nonce -sha256 -cert -out test_data.tsq curl -H "Content-Type: application/timestamp-query" --data-binary '@test_data.tsq' https://freetsa.org/tsr > test_data.tsr Now for the verification part as per my understanding from RFC3161 (https://tools.ietf.org/html/rfc3161#page-20) following procedure can be used to verify the authenticity of the digital signature. 1. Verify timestamp token: openssl ts -verify -in test_date.tsr -queryfile date_tsr.tsq -CAfile cacert.pem -untrusted tsa.crt openssl ts -verify -data test_data.cms -in test_data.tsr -CAfile cacert.pem -untrusted tsa.crt 2. Fetch the timestamp: openssl ts -reply -in test_date.tsr -text Time stamp: Apr 24 13:09:25 2020 GMT (Example) 3. Convert timestamp to Unix epoch time: date -d “Apr 24 13:09:25 2020 GMT” +%s 1587733765 4. Verify the signature againt timestamp and the certificates via openssl cms openssl cms -verify -binary -verify -in test_data.cms -content test_data -CAfile ca-chain.cer -inform DER -out /tmp/tmp.data -attime 1587733765 Everything works until crl (Certificate revocation list) comes into the picture. What I know is that If the certificate (my-cert.pem in this case) has been revoked and if the “Invalidity Date” is after the timestamp date, the signature should still be valid. But with openssl cms -verify its not working as expected or it is not supported. 1. Revoke certificate: openssl ca -config openssl.conf -revoke my-cert.pem -crl_reason key -crl_reason keyCompromise -crl_compromise 20200422140925Z Compromise date is after timestamp date. 2. Verify the signature with crl and timestamp openssl cms -verify -binary -verify -in test_data.cms -content test_data -CAfile ca-chain.cer -inform DER -out /tmp/tmp.data -attime 1587733765 -crl_check output: CRL is not yet valid I think openssl is comparing the “Last Update” date of CRL instead of “Invalidity date” with the date mentioned in -attime argument, i.e. 1587733765 dues to which it shows “CRL is not yet valid”. 1. Removing “-attime” openssl cms -verify -binary -verify -in test_data.cms -content test_data -CAfile ca-chain.cer -inform DER -out /tmp/tmp.data -crl_check` Output: Certificate revoked So how do I verify the signature with CRL and timestamp in openssl cms? The only way I see is to fetch the “Invalidity Date” manually from CRL and compare with timestamp and act accordingly. ## Failed sites : how to verify again? I got a bunch of failed links and as I test everything out at the moment, how to allow ser to run again on the verify process? Should I start over? ## Using Expand, Guess, Verify to solve the following recurrence relation Hello and thanks to those who bothered reading! I am trying to solve the following recurrence relation, $$S(n) = S(n-1) + (2n-1)$$, with the following base case: $$S(1) = 1$$. I already used the Solution Formula and got the closed form solution $$1^n + n^2 – 1$$, but for the expansion part I am having trouble with the $$g(n)$$ term. Perhaps even my solution formula answer is wrong. Any help is appreciated and I am more than willing to further explain the problem! The Solution Formula is $$S(n) = c^{n-1} S(1) + \sum_{i=2}^n (c^{n-i} g(i))$$ and $$g(n) = 2n-1$$. $$c$$ is the constant in front of the $$S(n)$$ term, which in this case is $$1$$.
2020-07-11 00:59: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": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 20, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.38742944598197937, "perplexity": 4275.205229263141}, "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-29/segments/1593655919952.68/warc/CC-MAIN-20200711001811-20200711031811-00245.warc.gz"}
http://settheory.mathtalks.org/marcin-sabok-automatic-continuity-for-isometry-groups/
# Marcin Sabok: Automatic continuity for isometry groups Place: Fields Institute, Room 210 Date and time: Friday 16 January 2015 (13:30-15:00) Speaker:  Marcin Sabok Title: Automatic continuity for isometry groups Abstract: We present a general framework for automatic continuity  results for groups of isometries of metric spaces. In particular, we prove automatic continuity property for the  groups of isometries of the Urysohn space and the Urysohn  sphere, i.e. that any homomorphism from either of these groups into a separable group is continuous. This answers a question of Melleray. As a consequence, we get that the group of isometries of the Urysohn space has unique Polish group topology and the group of isometries of the Urysohn sphere has unique separable group topology. Moreover, as an application of our framework we obtain new proofs of the automatic continuity property for the group $\mathrm{Aut}([0,1],\lambda)$, due to Ben Yaacov, Berenstein and Melleray and for the unitary group of the infinite-dimensional separable Hilbert space, due to Tsankov. The results and proofs are stated in the language of model theory for metric structures.
2018-03-21 01:21:59
{"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.8521939516067505, "perplexity": 817.6691395159046}, "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-13/segments/1521257647556.43/warc/CC-MAIN-20180321004405-20180321024405-00221.warc.gz"}
http://compgroups.net/comp.lang.c/problem-with-scanf/713979
COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register ### problem with scanf( ) • Email • Follow Dear all, plz see the following prograam. main() { int a,b; scanf("%d %d ",&a,&b); printf("%d %d",a,b); } when i run the above program on windows using Turbo C, the program reads three numbers, ( it is expected to read two numbers only) if i remove the white space after the second %d in scanf statement, it reads only two. but if there is any space after the second %d in the scanf statement the program waits for one more number to be inputted even after I enter two numbers. Can anyone say why it happends? Regards, Lal 0 Reply sreelalpp (11) 11/28/2004 1:58:48 AM See related articles to this posting sreelal wrote: > Dear all, > > plz see the following prograam. There are a few problems. > #include <stdio.h> > main() int main(void) > > { > int a,b; > > scanf("%d %d ",&a,&b); scanf("%d %d", &a,&b); will do. > > printf("%d %d",a,b); printf("%d %d\n",a,b); return 0; > } > > > when i run the above program on windows using Turbo C, > the program reads three numbers, ( it is expected to read two numbers only) Enter the numbers, seperated by a space, ie. 34 23 -- Al Bowers Tampa, Fl USA mailto: xabowers@myrapidsys.com (remove the x to send email) http://www.geocities.com/abowers822/ 0 Reply xabowers (231) 11/28/2004 2:38:14 AM the problem is, The program is supposed to read two numbers. But when i run this it waits for a third number to enter. I enter like 33 56 77 Why it is so ? 0 Reply sreelalpp (11) 11/28/2004 5:12:26 PM sreelal wrote: > the problem is, > > The program is supposed to read two numbers. But when i run this it > waits for a third number to enter. I enter like > > 33 56 77 > > Why it is so ? Don't know. Try this routine which uses fucntion fgets to get the stdin input and function sscanf to convert to type integers. #include <stdio.h> int main(void) { int a,b; char s[128]; a = b = 0; printf("Enter two integers: "); fflush(stdout); fgets(s,sizeof s,stdin); if(2 == sscanf(s,"%d %d",&a,&b)) printf("a=%d and b=%d\n",a,b); else puts("You must enter two numbers on the line"); return 0; } -- Al Bowers Tampa, Fl USA mailto: xabowers@myrapidsys.com (remove the x to send email) http://www.geocities.com/abowers822/ 0 Reply xabowers (231) 11/28/2004 6:09:04 PM sreelal wrote: < snip > > but if there is any space after the second %d in the scanf statement > the program waits for one more number to be inputted even after I enter two > numbers. > > Can anyone say why it happends? I wonder if it might be the actual behaviour of scanf: this function parses the string you give first, and look for any format specifiers. It finds the first two all right, and then proceeds on to the next since there are spaces (blanks) before the actual '\0'. Problem is, there is no format specifier left. So the functions waits for something which it does not actually cares for ( I mean, it doesn't store it). I guess one of the clc guru could explain it. (Or it might be ub, and depend on compiler implementation) I have the same behaviour here, on a gcc 3.4 my �.02 0 Reply greggory (13) 11/28/2004 9:17:13 PM sreelal <sreelalpp@gmail.com> wrote: > scanf("%d %d ",&a,&b); > if i remove the white space > after the second %d in scanf statement, it reads only two. > but if there is any space after the second %d in the scanf statement > the program waits for one more number to be inputted even after I enter two > numbers. > Can anyone say why it happends? Read the description for scanf(). Whitespace in the format string matches any number of whitespace in the input stream. It means that scanf will then conceptually ungetc(), I gather). So what you can actually feed it with is: 1 2 x The first %d will read initial whitespace and do the conversion, the space will read all whitespace until character 2', the second %d will do another conversion, space will try to read any whitespace until a non-whitespace character (that's why it waits when you enter only two numbers), when it finds to one (x' character) we go over to the next space, and this and subsequent ones will not do anything, because there already is an x' waiting in the input queue. Actually, you can exit from scanf earlier, even without feeding it with all data it expects. On *nix systems you do it by pressing ^D at the console, on Win/DOS it's probably ^Z (this is of course highly system dependent and off-topic as such). You must check return value from scanf to make sure it did all the conversions you expected. -- Stan Tobias mailx echo siXtY@FamOuS.BedBuG.pAlS.INVALID | sed s/[[:upper:]]//g ` 0 Reply siXtY (303) 11/28/2004 10:24:03 PM 5 Replies 87 Views Similar Articles 12/10/2013 2:01:32 PM [PageSpeed] Similar Artilces: problem with edk \. LibGen Done. make: *** [microblaze_0/lib/libxil.a] Error 2 Done. Have you an idea to resolve this problem? thanks Regards R!SC Last time I checked with EDK6.2i, it did not like embedded spaces in the path name. IIRC, one could either put the files in a path without embedded spaces, or use the subst command. - Newman "R!SC" <opb@xilinx.com> wrote in message news:_XdCd.622615$35.25734702@news4.tin.it... > Hi all, > > i'm first time approch with fpga, i have xilinx ise and edk 6.3i version. > With XPS I have create a new project with project builder... > Done. > > > Have you an idea to resolve this problem? > > thanks > Regards > R!SC > Problem with Widcards that have Longs as keys > and Lists of *the specific type List<?>* as keys. That?s wrong. The problem is, that Map<Long, List<?>> can map Longs on any type of list. I.e., 3 could map to a List<String>, whereas 5 maps to List<Number> and so on. Thus, the moment you give Java a Map<Long, List<Double>>, it says: cannot assign, because imagine that this would work, then the following code would be possible, and of course we don?t want that: Map<Long, List<?>> badMap = new HashMap<Long, List<Double>>; //will not compile map.put Problem formdesign Dear All, Every time I open a pop-up-datsheet-form the form-width increases. And I can't change the Form-width-property. auto resize = no auto center = no pop-up = yes Modal = yes What am I missing ? Filip On Mar 2, 4:24 pm, "Filips Benoit" <benoit.fil...@telenet.be> wrote: > Dear All, > > Every time I open a pop-up-datsheet-form the form-width increases. > And I can't change the Form-width-property. > > auto resize = no > auto center = no > pop-up = yes > Modal = yes > > What am I missing ? > > Filip What is the BorderSty StarCraft problem Battlenet to update you to the latest version. > > Will I have to start over? Even if you do, you can use cheat codes to skip levels with no ill-effects. The only things you have to worry about appear in BroodWar, and there is still a way to work around that problem. Select into problem Hi Guys, I have a question about PL/SQL code I have the following select into statement : SELECT STUD_AGE INTO v_cHP_MaxAge FROM STUDENT WHERE GDU = '015346001002'; I know It has no value returned but it give a no_data_found error. How do I escape that error without using exception? Is there any way to force the query return some value instead of an error? Thanks in advance Jun wrote: > Hi Guys, > > I have a question about PL/SQL code > > I have the following select into statement : > > SELECT STUD_AGE INTO v_cHP_MaxAge FROM STUDENT W mhchem problem Using mhchem, I wanted to put reaction rate constants above and below <=> with this: \documentclass{article} \usepackage[version=3]{mhchem} \begin{document} \ce{CO2(aq) + H2O <=>[\ce{$k_+$}][\ce{$k_-$}] H+ + HCO3-} \ce{CO2(aq) + H2O <=>[\text{$k_+$}][\text{$k_-$}] H+ + HCO3-} \end{document Alas,$k_+$above <=> appeared in the .dvi file at the correct size in both equations but$k_-\$ was too small in both. What should I have done? -- John Harper, School of Mathematics, Statistics and Computer Science, Victoria University, PO Box 600, Wellington 6140, New Zealand e- problem in kde I'm running KDE3.1 from Slackware 9.1 and I notice that sometimes I have problems when I hit the "enter" key. It sometimes opens up Konqueror. Is this a known issue and is there a way to fix it (other than not using the "enter" key). Miguel De Anda wrote: > I'm running KDE3.1 from Slackware 9.1 and I notice that sometimes I have > problems when I hit the "enter" key. It sometimes opens up Konqueror. Is > this a known issue and is there a way to fix it (other than not using the > "enter" key). is konqueror web borwser ( or home di verbatim problem Hi, I would like to write three lines like the following: 8 adders/subtractors + 4 Data Registers = 120 + 28 = 148 (CLBs) (conventional implementation) When I use verbatim I found the fonts for these three lines are different from the fonts I used in the paper. Is there a better way to write these three lines? Thank you very much! sincerely ------------- Kuan Zhou ECSE department Kuan Zhou wrote: > I would like to write three lines like the following: > > > 8 adders/subtractors + 4 Data Registers > = 120 Problem with tkinter Hello Friends, i installed the new Python 2.3 tarball but have a little (or big) problem. When testing turtle.py i get the following message. I am using Linux SUSE 8.2, Tk ist installed as version 8.4 ../configure, make and make install work fine .... Python 2.3 (#2, Nov 11 2003, 17:40:46) [GCC 3.3 20030226 (prerelease) (SuSE Linux)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> but: ropebu@z3pc47:/usr/local/lib/python2.3/lib-tk> python turtle.py Traceback (most recent call last): File "turtle.py", line 4, in ? import Tkinter File "/usr/local/lib/python2.3/lib-tk/Tkinter.py", line 38, in ? import _tkinter # If this fails your Python may not be configured for Tk ImportError: No module named _tkinter So the questions is: how to configure python to use Tk. Greeting from Karlsruhe Hi! ropebu@web.de (rolf peter) wrote: >So the questions is: how to configure python to use Tk. IIRC the package "tcl-devel" isn't installed by default, but nessesary before compiling python. hth Jan Thank You, that was it after installing the package Simulation problem Hi, I am stuck with this problem, hope you can help me: I have a variable X_0 that contains the weekly market returns for one year (52 observations), a variable Y that represents the company returns for the same period and a variable called NOISE_0 that is the difference between the two: X_0 = Y + NOISE_0 Now I need to create the returns for n companies: X_t = Y + NOISE_t where t = 1 to n Y is always constant. NOISE_t (t=1 to n) has to be randomly created but has to have the same variance as the original NOISE_0 variable. Var(NOISE_t) = Var(NOISE_0) Any solution? Thanks in advance. PA If I understand correct, you want to generated, y(i,t)=a + b*x(i,t) + error(i) where i is company id, t is weed id. error(i) has is iid within a company. ******here is a sample pag, you may modify as you wish*********; data test; do company=1 to 50; std=ranuni(123)*10; do week=1 to 52; x=rannor(123); y=3+3*x+std*rannor(123); output; end; end; run; proc print; run; alves wrote: > Hi, > > I am stuck with this problem, hope you can help me: > > I have a variable X_0 that contains the weekly market returns for one > year (52
2013-12-10 14:01:46
{"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.2500551640987396, "perplexity": 6355.755439628484}, "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/1386164019989/warc/CC-MAIN-20131204133339-00084-ip-10-33-133-15.ec2.internal.warc.gz"}
https://forum.getodk.org/t/xls2xforms-logic/1113
Xls2xforms logic I want to know if is there a way to use a relevance bind that make a question relevant if the prior question is not a value or is different on a text question. i have a question that ask for at least three text answers so i make a group of text questions where the first three are required. But is there a chance that the interviewed person didnt know any answer. So i want to skip the other text fields if the interviewer puts "99" or "didnt know". My logic is to make the other tho questions relevant if the prior answer is different to "didnt know" Im sorry about my english. Thanks for everything. To make a question relevance depend on a prior question's relevance you will need to use a variable for the prior question. The variable is based on the question name. For example, if I have a question named "amount" then the variable I use for it will be \${amount}. You can use these variables in any javarosa supported XPath formula (see: https://bitbucket.org/javarosa/javarosa/wiki/xform-jr-compat). For example, if "amount" is a select_one type question and you want to skip a question if someone selected "didntknow" (select values can't have spaces, although their labels can), then you would put: not(selected(\${amount}, 'didntknow')) in it's "relevant" column. I hope this helps, -Nathan ··· On Feb 21, 7:17 pm, gap1981 wrote: > I want to know if is there a way to use a relevance bind that make a > question relevant if the prior question is not a value or is different > on a text question. > > i have a question that ask for at least three text answers so i make a > group of text questions where the first three are required. But is > there a chance that the interviewed person didnt know any answer. So i > want to skip the other text fields if the interviewer puts "99" or > "didnt know". > My logic is to make the other tho questions relevant if the prior > answer is different to "didnt know" > > Im sorry about my english. Thanks for everything. To make a question relevance depend on a prior question's relevance you will need to use a variable for the prior question. The variable is based on the question name. For example, if I have a question named "amount" then the variable I use for it will be \${amount}. You can use these variables in any javarosa supported XPath formula (see: https://bitbucket.org/javarosa/javarosa/wiki/xform-jr-compat). For example, if "amount" is a select_one type question and you want to skip a question if someone selected "didntknow" (select values can't have spaces, although their labels can), then you would put: not(selected(\${amount}, 'didntknow')) in it's "relevant" column. I hope this helps, -Nathan ··· Sent from my android device. -----Original Message----- From: Nathan To: ODK Community Sent: Wed, 22 Feb 2012 10:48 AM Subject: [ODK Community] Re: xls2xforms logic On Feb 21, 7:17 pm, gap1981 gapera...@gmail.com wrote: I want to know if is there a way to use a relevance bind that make a question relevant if the prior question is not a value or is different on a text question. i have a question that ask for at least three text answers so i make a group of text questions where the first three are required. But is there a chance that the interviewed person didnt know any answer. So i want to skip the other text fields if the interviewer puts "99" or "didnt know". My logic is to make the other tho questions relevant if the prior answer is different to "didnt know" Im sorry about my english. Thanks for everything. To make a question relevance depend on a prior question's relevance you will need to use a variable for the prior question. The variable is based on the question name. For example, if I have a question named "amount" then the variable I use for it will be \${amount}. You can use these variables in any javarosa supported XPath formula (see: https://bitbucket.org/javarosa/javarosa/wiki/xform-jr-compat). For example, if "amount" is a select_one type question and you want to skip a question if someone selected "didntknow" (select values can't have spaces, although their labels can), then you would put: not(selected(\${amount}, 'didntknow')) in it's "relevant" column. I hope this helps, -Nathan ··· Sent from my android device. -----Original Message----- From: Nathan To: ODK Community Sent: Wed, 22 Feb 2012 10:48 AM Subject: [ODK Community] Re: xls2xforms logic On Feb 21, 7:17 pm, gap1981 gapera...@gmail.com wrote: I want to know if is there a way to use a relevance bind that make a question relevant if the prior question is not a value or is different on a text question. i have a question that ask for at least three text answers so i make a group of text questions where the first three are required. But is there a chance that the interviewed person didnt know any answer. So i want to skip the other text fields if the interviewer puts "99" or "didnt know". My logic is to make the other tho questions relevant if the prior answer is different to "didnt know" Im sorry about my english. Thanks for everything.
2022-05-18 23:08:38
{"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.8487032055854797, "perplexity": 2937.5476789689014}, "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-2022-21/segments/1652662522556.18/warc/CC-MAIN-20220518215138-20220519005138-00127.warc.gz"}
https://math.stackexchange.com/questions/3189295/motivation-of-the-von-neumann-definition-of-ordinals/3357377
# Motivation of the von Neumann definition of ordinals The von Neumann ordinals are defined in such a way that each ordinal is exactly the set of all smaller ordinals. I am wondering about the origin/motivation for this definition of ordinals (that is, how one got to this definition from the goal of choosing a representative for each equivalence class of well-orderings). I read that the motivation was the fact that each well-ordering is isomorphic to the set of all smaller well-orderings. But when I looked for a proof of this fact, I saw that this proof contained ordinals as a tool to prove it. Now this seemed circular to me (not in the logical sense, but in the historical sense). Is there also an ordinal-free proof of the fact that each well-ordering is isomorphic to the set of all smaller well-orderings? Also, I wonder: The definition "An ordinal is the set of all smaller ordinals" would be somehow circular. But would it work rigorously? (Maybe it's some kind of recursive/inductive definition -- these things also seem "circular" but are ok -- also, for example, hereditary sets are defined as sets whose elements are hereditary sets, and this definition also works rigorously.) Furthermore: How did one get from the slogan "an ordinal is the set of all smaller ordinals" to the definition that an ordinal is a transitive set that is a well-ordering under $$\in$$? • Fix a well-ordering $(A,<)$ and you look at the obvious map $a\mapsto (A_{<a},<)$. Well, it's very easy to prove it's an isomorphism and we haven't used the ordinals. Apr 16 '19 at 7:05 • "The definition "An ordinal is the set of all smaller ordinals" would be somehow circular. " This is not the def: "A set S is an ordinal if and only if S is strictly well-ordered with respect to set membership and every element of S is also a subset of S" where the notion of "well-order" is defined previously and thus independently from that of ordinal. Apr 16 '19 at 9:17 • @user7280899: If it's abuse of language to the set of all initial segments of $A$, I don't see how my above comment fails to satisfy you. Please decide which version of your question you want answered. Apr 16 '19 at 21:17 • When people say something like "each well-ordering is isomorphic to the set of all smaller well-orderings", they usually mean exactly what Asaf referred to in his second comment: a "smaller" well-ordering than $(A,<)$ is defined to be a well-ordering that is (isomorphic to) a proper initial segment of $(A,<)$. Apr 16 '19 at 22:49 • That is literally the definition of "smaller", as I said. Apr 17 '19 at 20:49 I think "an ordinal is the set of all smaller ordinals" can be formulated as follows: consider an arbitrary class $$\mathrm{No}$$ with a property $$(1)$$: $$\mathrm{No} = \{s: s=\{x\in \mathrm{No}: x\subset s\}\}$$, where $$\subset$$ denotes a strict embedding. If $$y\in x\in s$$ then $$y\subset x\subset s$$ which means $$y\in s$$ by definition, thus each $$s \in No$$ is transitive and $$\in$$ is a partial order on $$\mathrm{No}$$. Now let's consider an arbitrary $$A\subseteq \mathrm{No}$$ and $$m:=\bigcap A$$. If $$m\subset a$$ for all $$a\in A$$ then $$m \in \mathrm{No}$$ $$(*)$$, so $$m \in a$$ and $$m \in \bigcap A = m \Rightarrow m \subset m$$ - contradiction. So $$m\in A$$ and $$m \in a$$ for all $$a \in A: a \ne m$$, which means that $$\mathrm{No}$$ is totally and well-ordered by $$\in$$. So we came to a classical von Neumann definition of ordinals. Question: can we replace property $$(1)$$ with property $$(2)$$: $$\forall s\in \mathrm{No} \Rightarrow s=\{x\in \mathrm{No}: x\subset s\}$$? I feel that the answer is yes, but I cannot prove $$(*)$$ by now...
2022-01-27 13:51: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": 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": 28, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9715876579284668, "perplexity": 112.59292509257176}, "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/1642320305266.34/warc/CC-MAIN-20220127133107-20220127163107-00535.warc.gz"}
http://mathhelpforum.com/differential-geometry/160079-fixed-point-rotations.html
# Math Help - Fixed point in rotations 1. ## Fixed point in rotations Let $P,Q \in \mathbb{E}^2$ be distinct points, and $\alpha, \beta$ angles such that $\alpha+\beta \neq 0, 2 \pi$. Let OPQO' be a quadrilateral such that $OPO'= \alpha$, $O'Qo= \beta$ are directed angles (both clockwise as interior angles), and PQ halves both. Find the unique point $S \in \mathbb{E}^2$ for which $\text{Rot}(P, \alpha)(S)= \text{Rot}(q, -\beta)(S)$. I've drawn a picture and I think I know what the method is: $\text{Rot}(P, \alpha)(S)=\begin{pmatrix}{\cos \alpha & \sin \alpha \\ \sin \alpha & -\cos \alpha \end{pmatrix} \begin{pmatrix}{s_1-p_1 \\ s_2-p_2} \end{pmatrix}+ \begin{pmatrix}{p_1 \\ p_2} \end{pmatrix}$ $\text{Rot}(Q, -\beta)(S)=\begin{pmatrix}{\cos \beta & -\sin \beta \\ -\sin \beta & -\cos \beta \end{pmatrix} \begin{pmatrix}{s_1-q_1 \\ s_2-q_2} \end{pmatrix}+ \begin{pmatrix}{q_1 \\ q_2} \end{pmatrix}$ So the next step was to equate the two and solve it for values of $s_1$ and $s_2$. However, this is really long!! Is there a shorter way to do this? 2. Originally Posted by Showcase_22 I've drawn a picture and I think I know what the method is: $\text{Rot}(P, \alpha)(S)=\begin{pmatrix}{\cos \alpha & \sin \alpha \\ \sin \alpha & -\cos \alpha \end{pmatrix} \begin{pmatrix}{s_1-p_1 \\ s_2-p_2} \end{pmatrix}+ \begin{pmatrix}{p_1 \\ p_2} \end{pmatrix}$ $\text{Rot}(Q, -\beta)(S)=\begin{pmatrix}{\cos \beta & -\sin \beta \\ -\sin \beta & -\cos \beta \end{pmatrix} \begin{pmatrix}{s_1-q_1 \\ s_2-q_2} \end{pmatrix}+ \begin{pmatrix}{q_1 \\ q_2} \end{pmatrix}$ So the next step was to equate the two and solve it for values of $s_1$ and $s_2$. However, this is really long!! Is there a shorter way to do this? I sure would not want to write everything down in coordinates. Instead I would introduce the notation $\mathrm{Rot}(\varphi)$ for a rotation by $\varphi$ around the origin and then write $\mathrm{Rot}(P,\alpha)\vec{s}=\mathrm{Rot}(\alpha) (\vec{s}-\vec{p})+\vec{p}$, similarly for $\mathrm{Rot}(Q,-\beta)\vec{s}$. Then I could proceed purely algebraically (without coordinates) until I have isolated $\vec{s}$ on one side of the equation, provided $\mathrm{Rot}(\alpha)-\mathrm{Rot}(-\beta)$ is invertible. 3. (It was funny when I got your post back: "Failure has replied to your post" ) I followed it through and it was much easier than using coordinates. $\vec{s}=(\text{Rot}(\alpha)-\text{Rot}(- \beta))^{-1}(\vec{q}-\vec{p}-\text{Rot}(-\beta) \vec{q}+\text{Rot}(\alpha) \vec{p})$ I could write it out in terms of coordinates, but I don't think it would get any simpler. I'm also sorry for springing this on you, but I hoped this would help me solve part ii) of the question. Unfortunately, i'm still lost: Hence calculate the composite $\text{Rot}(Q, \beta) \circ \text{Rot}(P, \alpha).$ So I know that: $\mathrm{Rot}(P,\alpha)\vec{s}=\mathrm{Rot}(\alpha) (\vec{s}-\vec{p})+\vec{p}$ and: $\mathrm{Rot}(Q,\beta)\vec{s}=\mathrm{Rot}(\beta)(\ vec{s}-\vec{q})+\vec{q}$ Therefore: $\text{Rot}(Q, \beta) \circ \text{Rot}(P, \alpha) \vec{x}=\mathrm{Rot}(\beta)(\mathrm{Rot}(\alpha)(\ vec{x}-\vec{p})+\vec{p}-\vec{q})+\vec{q}$ (putting the first one into the second one, for some vector $\vec{x}$). Expanding this out gives: $\text{Rot}(Q, \beta) \circ \text{Rot}(P, \alpha) \vec{x}=\text{Rot}(\beta). \text{Rot}(\alpha)(\vec{x}-\vec{p})+\text{Rot}(\beta) \vec{p}-\text{Rot}(\beta) \vec{q}+\vec{q}$ If it didn't say "hence calculate...", I probably would have left it there. At this point I thought I could group the terms together to get $\vec{s}$ appearing somewhere (or at least $\text{Rot}(\alpha)-\text{Rot}(-\beta)) \vec{s}$). A big obstacle is that $\vec{s}$ doesn't really pop up. I tried seeing if there was a link between $\text{Rot}(Q, \beta)$ and $\text{Rot}(Q, -\beta)$, but writing them out doesn't produce anything. 4. Originally Posted by Showcase_22 (It was funny when I got your post back: "Failure has replied to your post" ) I followed it through and it was much easier than using coordinates. $\vec{s}=(\text{Rot}(\alpha)-\text{Rot}(- \beta))^{-1}(\vec{q}-\vec{p}-\text{Rot}(-\beta) \vec{q}+\text{Rot}(\alpha) \vec{p})$ I could write it out in terms of coordinates, but I don't think it would get any simpler. I'm also sorry for springing this on you, but I hoped this would help me solve part ii) of the question. Unfortunately, i'm still lost: So I know that: $\mathrm{Rot}(P,\alpha)\vec{s}=\mathrm{Rot}(\alpha) (\vec{s}-\vec{p})+\vec{p}$ and: $\mathrm{Rot}(Q,\beta)\vec{s}=\mathrm{Rot}(\beta)(\ vec{s}-\vec{q})+\vec{q}$ Therefore: $\text{Rot}(Q, \beta) \circ \text{Rot}(P, \alpha) \vec{x}=\mathrm{Rot}(\beta)(\mathrm{Rot}(\alpha)(\ vec{x}-\vec{p})+\vec{p}-\vec{q})+\vec{q}$ (putting the first one into the second one, for some vector $\vec{x}$). Expanding this out gives: $\text{Rot}(Q, \beta) \circ \text{Rot}(P, \alpha) \vec{x}=\text{Rot}(\beta). \text{Rot}(\alpha)(\vec{x}-\vec{p})+\text{Rot}(\beta) \vec{p}-\text{Rot}(\beta) \vec{q}+\vec{q}$ If it didn't say "hence calculate...", I probably would have left it there. At this point I thought I could group the terms together to get $\vec{s}$ appearing somewhere (or at least $\text{Rot}(\alpha)-\text{Rot}(-\beta)) \vec{s}$). A big obstacle is that $\vec{s}$ doesn't really pop up. I tried seeing if there was a link between $\text{Rot}(Q, \beta)$ and $\text{Rot}(Q, -\beta)$, but writing them out doesn't produce anything. The condition that S must satisfy makes it a fixed point of the concatenation of the two rotations. Hence one might guess that the concatenation is the rotation $\mathr{Rot}(S,\alpha + \beta)$. Given this idea you might try to transform what you have into $\mathr{Rot}(S,\alpha + \beta)$. Note that it would suffice to show that it is a rotation by $\alpha+\beta$ around some point, since the center of rotation is the only fixed point it has (except if one happens to be rotating by 0 of course) that center has to be S.
2016-05-06 20:56: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": 47, "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.8186960220336914, "perplexity": 308.95730505784775}, "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-2016-18/segments/1461862134822.89/warc/CC-MAIN-20160428164854-00052-ip-10-239-7-51.ec2.internal.warc.gz"}
http://collocations.de/UCS/UCS-R-html/zm.html
zm {UCS} R Documentation The Zipf-Mandelbrot LNRE Model (zm) Description Object constructor for a Zipf-Mandelbrot (ZM) LNRE model with parameters α and C (Evert, 2004a). Either the parameters are specified explicitly, or one or both of them can be estimated from an observed frequency spectrum. Usage zm(alpha=NULL, C=NULL, N=NULL, V=NULL, spc=NULL, m.max=15, stepmax=10, debug=FALSE) Usage zm(alpha, C) zm(alpha, N, V) zm(N, V, spc, m.max=15, stepmax=10, debug=FALSE) Arguments alpha a number in the range (0,1), the shape parameter α of the ZM model. alpha can automatically be estimated from N, V, and spc. C a positive number, the parameter C of the ZM model. C can automatically be estimated from N and V. N the sample size, i.e. number of observed tokens V the vocabulary size, i.e. the number of observed types spc a vector of non-negative integers representing the class sizes V_m of the observed frequency spectrum. The vector is usually read from a file in lexstats format with the read.spectrum function. m.max the number of ranks from spc that will be used to estimate the α parameter stepmax maximal step size of the nlm function used for parameter estimation. It should not be necessary to change the default value. debug if TRUE, print debugging information during the parameter estimation process. This feature can be useful to find out why parameter estimation fails. Details The ZM model with parameters α \in (0,1) and C > 0 is defined by the type density function g(p) := C * p^(-alpha - 1) for 0 <= p <= B, where the upper bound B is determined from C by the normalisation condition integral_0^Inf p * g(p) dp = 1 The parameter α is estimated by nonlinear minimisation (nlm) of a multinomial chi-squared statistic for the observed against the expected frequency spectrum. Note that this is different from the multivariate chi-squared test used to measure the goodness-of-fit of the final model (Baayen, 2001, Sec. 3.3). See Evert (2004, Ch. 4) for further mathematical details, especially concerning the expected vocabulary size, frequency spectrum and conditional parameter distribution, as well as their variances. Value An object of class "zm" with the following components: alpha value of the α parameter B value of the upper bound B (a normalisation device) C value of the C parameter N number of observed tokens (if specified) V number of observed types (if specified) spc observed frequency spectrum (if specified) This object prints a short summary, including a comparison of the first ranks of the observed and expected frequency spectrum (if available). References Baayen, R. Harald (2001). Word Frequency Distributions. Kluwer, Dordrecht. Evert, Stefan (2004). The Statistics of Word Cooccurrences: Word Pairs and Collocations. PhD Thesis, IMS, University of Stuttgart. Evert, Stefan (2004a). A simple LNRE model for random character sequences. In Proceedings of JADT 2004, Louvain-la-Neuve, Belgium, pages 411–422. fzm, EV, EVm, VV, VVm, write.lexstats, lnre.goodness.of.fit, read.spectrum, and spectrum.plot
2019-04-19 14:28:32
{"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.6130315661430359, "perplexity": 3393.1753833932275}, "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-18/segments/1555578527839.19/warc/CC-MAIN-20190419141228-20190419162937-00014.warc.gz"}
http://inst.eecs.berkeley.edu/~cs61c/fa19/hw/hw9/
Performance Programming Deadline: Wednesday, December 4th at 11:59 pm Objectives • TSW use the performance programming techniques learned in class to quickly generate the Mandelbrot set. • TSW focus on major speed improvements first before attempting micro-optimizations. Getting Started After the repository has been created, make sure to fill out this required form so that we can identify your submission. Once you’ve created your repository, you’ll need to clone it to your instructional account and/or your local machine. You’ll also need to add the starter code remote with the following command: $git remote add starter https://github.com/61c-teach/fa19-HWperf-starter If we publish changes to the starter code, retrieve them using git pull starter master. Overview For this homework, you will apply the performance optimization techniques you learned in class to speed up a reference implementation of code that generates the Mandelbrot set. Rather than generating a set of images for each zoom level, we want to instead see what fraction of pixels are actually inside the Mandelbrot set. For example, if we use the same parameters as testB2 from project 1, we will report the following: Frame 0, Scale 2.000000: 3772/40401 pixels in set Frame 1, Scale 0.029907: 144/40401 pixels in set Frame 2, Scale 0.000447: 0/40401 pixels in set Frame 3, Scale 0.000007: 579/40401 pixels in set Frame 4, Scale 0.000000: 9227/40401 pixels in set Step 1: Understanding the Code When you pull the starter files from the repository created by GitHub Classroom, you should see the following files: Makefile benchmark.c mandelbrot.c mandelbrot.h mandelbrot_baseline.c parameters.h You should only modify mandelbrot.c for this homework. Any changes to any other files will be ignored when we are grading your submission. For this homework, we will also require that you do not add any new header files to your code. For instance, since the starter code does not include math.h, we will require that your implementation also does not include math.h. In other words, these are the expected headers that we will check for in mandelbrot.c: // Include SSE intrinsics #if defined(_MSC_VER) #include <intrin.h> #elif defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__)) #include <immintrin.h> #include <x86intrin.h> #endif // Include OpenMP #include <omp.h> #include "mandelbrot.h" #include "parameters.h" For convenience, we have provided the mandelbrot_baseline.c file which is exactly the same as mandelbrot.c. This file should not be modified. It is there so that you can 1. Measure your speedup and 2. Reference a fully-correct (albeit slow) implementation. Mandelbrot Implementation If you take a look at mandelbrot.h, notice that it only contains one method header: void mandelbrot(struct parameters, double, int32_t *); Header files are almost like interfaces in Java; they are a sort of contract that the implementation (contained in the corresponding .c file) will have a method with the exact same function signature as the one defined in the header file. In other words, you can add as many or as few helper functions as you like to mandelbrot.c, but there must be a function named mandelbrot that takes in the above arguments and returns nothing. We have a reference implementation of mandelbrot, along with a helper function iterations. This is very similar to how one may have implemented project 1 with a few key differences. The double complex Type Rather than using a custom complex number implementation, this implementation uses the double complex datatype. This type has built-in + and * operations that performs complex number addition and multiplication operations, and since it is very much like the other primitive types in C, there’s no need to explicitly manage memory for complex types. The complex.h header also defines I, which one can multiply with a double to create an imaginary number. The following snippet of code demonstrates all of these features: double complex point = (params.center + j * scale / params.resolution + i * scale / params.resolution * I); The complex.h header also defines several utility functions for dealing with complex numbers. For instance, the reference implementation uses creal and cimag to get the real and imaginary parts of a complex number. For more information, check out the manual page for the complex number type with man complex. The Parameters Struct To shorten the length of function headers, we pass around a struct parameters type that contains all of the information we might need at any point during the Mandelbrot set computation. The definition of the struct is in parameters.h: struct parameters { double threshold; int maxiters; int numframes; int resolution; double complex center; double initialscale; double finalscale; }; Counting Pixels in Set Recall that the main purpose of this code is to count the number of pixels in the Mandelbrot set at multiple zoom levels. As such, we no longer want to fill an array with iteration counts for each pixel—we want to see how many pixels remained in the threshold after max iterations. In the reference implementation, this corresponds to all pixels for which the iterations helper function returned 0. So, the third argument to mandelbrot is a pointer to a single int32_t type which we only update once in the reference implementation: *num_pixels_in_set = num_zero_pixels; Usage You can simply run make to compile everything in this folder and create two executables: benchmark (which uses your mandelbrot implementation) and benchmark_baseline (which uses the reference implementation). The main entry-point for this program is benchmark.c which parses command line arguments and runs your mandelbrot implementation for every zoom level. After compiling everything with make, execute ./benchmark to see the following usage message: Usage: benchmark -t <threshold> -m <maxiterations> -n <numframes> -r <resolution> -R <creal> -I <cimag> -i <initialscale> -f <finalscale> Options: -t, threshold The threshold used to determine what's in the Mandelbrot set. -m, maxiters The maximum number of iterations to determine if a point is in the Mandelbrot set. -n, numframes The number of frames to generate. -r, resolution The width and height (in pixel) of the image. -R, center_real The real component of the center of the image. -I, center_imag The imaginary component of the center of the image. -i, initialscale The starting width and height (in the complex plane) of the image. -f, finalscale The ending width and height (in the complex plane) of the image. Notice that we use command line flags (e.g. the -a in ls -a) to pass in arguments to benchmark. For example, to run benchmark with the same parameters as testB2 from project 1, we run the following command: $ ./benchmark --threshold 2 \ --maxiters 1536 \ --numframes 5 \ --resolution 100 \ --center_real -0.561397233777 \ --center_imag -0.643059076016 \ --initialscale 2 \ --finalscale 1e-7 For convenience, there are also one-letter versions of each argument above (specified in the usage string). The same command using the abbreviated arguments looks like: $./benchmark -t 2 -m 1536 -r 100 -n 5 -R -0.561397233777 -I -0.643059076016 -i 2 -f 1e-7 If we run this command on a Hive machine, we get the following output: $ ./benchmark -t 2 -m 1536 -r 100 -n 5 -R -0.561397233777 -I -0.643059076016 -i 2 -f 1e-7 209884 microseconds Frame 0, Scale 2.000000: 3772/40401 pixels in set Frame 1, Scale 0.029907: 144/40401 pixels in set Frame 2, Scale 0.000447: 0/40401 pixels in set Frame 3, Scale 0.000007: 579/40401 pixels in set Frame 4, Scale 0.000000: 9226/40401 pixels in set The first line shows how much time it took to compute all of the requested frames; for the above run, it took 209884 microseconds which is about 0.2 seconds. Note that there can be significant variations in the reported runtime depending on the load of the Hive machine. The next n lines, where n is the number of requested frames, show how many pixels are actually in the set relative to the number of pixels that were evaluated. Note that the denominator is tied to the resolution and should not change for different frames. Step 2: Unrolling and Other Optimizations You should first try to speed up the computation by trying to apply conventional code optimizations (i.e. without using SSE or OpenMP). While we won’t tell you the exact steps, here are some hints that should help you get started: 1. Function calls are expensive since they involve setting up a stack frame and jumping to a different part of code. See if there are any functions that are frequently called that don’t necessarily need to be. 2. Are there any places where you could do manual loop unrolling? 3. Is there any unnecessary computation being done? Note that the above hints relate to general optimization practices. You do not necessarily need to do all of these to achieve a good speedup, and in fact, not all of these may apply to the reference implementation. Recall that the mandelbrot function is calculating something fundamentally different in this homework than in project 1, so make sure to account for that in your speedup strategy. Once you have improved performance using these optimizations, you can start applying vectorization and parallelism to make the program even faster. Note that you have considerable freedom to apply any of these optimizations, and there is more than one correct solution. Try to experiment with different approaches and see which one gives you the best performance. Step 3: SIMD Instructions In lab, you learned how to apply SIMD instructions to improve performance. The processors in the Hive machines support the Intel AVX extensions, which allow you to do SIMD operations on 256 bit values (not just 128 bit, as we have seen in the lab). You should use these extensions to perform four operations in parallel since all of the floating point values in the reference implementation are doubles, which are 64 bits in size. As a reminder, you can use the Intel Intrinsics Guide as a reference to look up the relevant instructions. You will have to use the __m256d type to hold 4 doubles in a YMM register, and then use the _mm256_* intrinsics to operate on them. Step 4: OpenMP Finally you should use OpenMP to parallelize computation. Note that you will need to make sure that none of the different threads overwrites each others’ data. Just adding a #pragma omp parallel for may cause errors. Note that the Hive machines have 4 cores with two hyperthreads each. This means that you should expect a speed-up of 4-8x (note that hyperthreads mean that two different threads execute on the same physical core at the same time; they will therefore compete for processor resources, and as a result, you will not get the same performance as if you were running on two completely separate cores). Testing for Correctness The default make command compiles both your code and the reference implementation. To make sure your implementation is correct, run both your code (with ./benchmark) and the baseline code (with ./benchmark_baseline) and make sure the values reported by both are almost the same. For example: $./benchmark -t 2 -m 1536 -r 100 -n 5 -R -0.561397233777 -I -0.643059076016 -i 2 -f 1e-7 _________ microseconds Frame 0, Scale 2.000000: 3772/40401 pixels in set Frame 1, Scale 0.029907: 144/40401 pixels in set Frame 2, Scale 0.000447: 0/40401 pixels in set Frame 3, Scale 0.000007: 579/40401 pixels in set Frame 4, Scale 0.000000: 9226/40401 pixels in set$ ./benchmark_baseline -t 2 -m 1536 -r 100 -n 5 -R -0.561397233777 -I -0.643059076016 -i 2 -f 1e-7 _________ microseconds Frame 0, Scale 2.000000: 3772/40401 pixels in set Frame 1, Scale 0.029907: 144/40401 pixels in set Frame 2, Scale 0.000447: 0/40401 pixels in set Frame 3, Scale 0.000007: 579/40401 pixels in set Frame 4, Scale 0.000000: 9226/40401 pixels in set Due to floating point error, there might be some slight variation between the two. Anything beyond a small variation is indicative of an incorrect implementation. To measure your speedup, simply divide the runtime of benchmark_baseline with the runtime of benchmark when run on the same arguments. Because there are many more 61C students than Hive machines, you will likely share resources with your classmates. This might affect the measurement of your code’s speedup. We encourage you to use Hivemind to help balance the load amongst the Hive machines. double grade(double speedup) { if (0 <= speedup && speedup < 1) { return 0; } else if (1 <= speedup && speedup <= 14) { return 1 - pow(speedup - 14, 2) / 169; } else { return 1; } } For reference, here are the grades for some the speedup values: 14x 100% 12x ~98% 10x ~91% 8x ~79% 6x ~62% 4x ~41% 2x ~15% <1x 0% We will test your program’s speed on the Hive machines. You should test on the Hive machines at a minimum to ensure everything is correct and working properly, but note that because of the size of the course the peak hours of the project right before it is due may not be an accurate reflection of your speedup if the Hive machines get too busy. As a result, starting early is your friend and similarly your tests will likely be more accurate at 3am than noon. Also, make sure to measure speedups on sufficiently large resolutions and frame counts; it should take the reference solution ~1 minute to finish executing on a set of parameters to be sure that overhead is not a large percentage of the execution time. Submission There is a Gradescope submission with a few correctness tests configured. Because of the hardware-specific nature of this homework, we will not be measuring speedup on Gradescope. Instead, we will periodically pull your latest submission from GitHub and run them on some reserved Hive machines. If you ever want to revert to a previous submission, make sure to create a new submission with the same code as the older one. There is no way for us to measure the speedup of anything besides the most recent submission.
2020-02-19 18:07: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": 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.2735181748867035, "perplexity": 1876.9051597959367}, "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/1581875144165.4/warc/CC-MAIN-20200219153707-20200219183707-00005.warc.gz"}