url
stringlengths
14
2.42k
text
stringlengths
100
1.02M
date
stringlengths
19
19
metadata
stringlengths
1.06k
1.1k
https://dsp.stackexchange.com/questions/38923/is-there-any-way-to-measure-of-gaussian-ness
# Is there any way to measure of Gaussian-ness? I have some sampled data that has $1/f$ noise in it, with departures from the mean. These are long term departures. I could use something like a median filter but the window length would be longer than I would like. • Is there any way to measure its departure from a Gaussian distribution? • Or measure how 'Gaussian-like' a time series statstical sample is? • The Gaussian distribution has some properties that are useful. You can start here. – Envidia Apr 3 '17 at 21:44 • I have troubles understanding was you really are looking for: a measure of gaussianity? Characterization of $1/f$ noise? Why is your original data Gaussian? Why does a median filter come into play? – Laurent Duval Apr 3 '17 at 21:54 • I have taken a few statistical courses and I'm aware of the math. I want to know what other people use – Voltage Spike Apr 4 '17 at 4:57 A classical measure of "gaussianity" is the kurtosis of your random variable (RV). Kurtosis is the forth order cumulant of a RV. Say $y$ is your RV with zero mean, the kurtosis can be defined as: $$kurt(y)=E[y^4] - 3(E[y^2])^2$$ If $y$ is gaussian, $E[y^4]=3(E[y^2])^2$ and therefore $$kurt(y)=0$$
2019-07-18 20:32:00
{"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.49300771951675415, "perplexity": 616.4336304568906}, "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/1563195525793.19/warc/CC-MAIN-20190718190635-20190718212635-00307.warc.gz"}
https://mathoverflow.net/questions/334735/relation-between-mathrmprojati-and-mathrmprojatj-for-ideals-i
# Relation between $\mathrm{Proj}(A[tI])$ and $\mathrm{Proj}(A[tJ])$ for ideals $I$ and $J$ of $A$ with $I^2 \subset J \subset I$ Let $$k$$ be a field and $$A$$ a noetherian local $$k$$-algebra. Let $$I$$ and $$J$$ be two ideals of $$A$$ with $$I^2 \subset J \subset I$$. Let $$A[tI] = \bigoplus\limits_{i\geq 0} t^i I^i$$ and $$A[tJ] = \bigoplus\limits_{i\geq 0} t^i J^i$$ be the Rees algebras for $$I$$ and $$J$$, respectively. Question: Is it true that $$\mathrm{Proj}(A[tI]) \cong \mathrm{Proj}(A[tJ])$$ as $$k$$-schemes? If not, then in what condition one can get such an isomorphism of $$k$$-schemes? • It seems like this is almost never true without some strong hypothesis; blowing up $(x,y)$ and $(x,y^2)$ in $k[x,y]$ give very different results, as the latter is singular and the former not. One case where it is immediately seen to be true is if I and J are both powers of another ideal. – Devlin Mallory Jun 25 at 12:43 • Thanks you for the example. – user124771 Jun 26 at 13:47
2019-07-23 12:51:31
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 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": 14, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9245302081108093, "perplexity": 121.243487830557}, "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/1563195529276.65/warc/CC-MAIN-20190723105707-20190723131707-00069.warc.gz"}
http://mathoverflow.net/revisions/10952/list
## Return to Answer 4 edited body; deleted 15 characters in body; added 22 characters in body This is a great question. Someone will come along with a better answer I'm sure, but here's a bit off the top of my head: 1) The Hilbert class field of a number field $K$ is the maximal everywhere unramified abelian extension of $K$. (Here when we say "$K$" we really mean "$\mathbb{Z}_K$", the ring of integers. That's important in the language of etale maps, because any finite separable field extension is etale.) In the case of a curve over $\mathbb{C}$, the "problem" is that there are infinitely many unramified abelian extensions. Indeed, Galois group of such is the abelianization of the fundamental group, which is free abelian abelian of rank $2g$ ($g$ = genus of the curve). Let me call this group G. The problem here is This implies that the covering space of C corresponding to G has infinite degree, so is a non-algebraic Riemann surface. (In fact, I have never really thought about what it looks like. It's fundamental group is the commutator subgroup of the fundamental group of C, which sounds complicated.) I believe is a free group of infinite rank. I don't think the field of meromorphic functions on this guy is what you want. 2) On the other hand, the Hilbert class group $G$ of $K$ can be viewed as the Picard group of $\mathbb{Z}_K$, which classifies line bundles on $\mathbb{Z}_K$. This generalizes nicely: the Picard group of $C$ is an exension of $\mathbb{Z}$ by a $g$-dimensional complex torus $J(C)$, which has exactly the same abelian fundamental group as $C$ does: indeed their first homology groups are canonically isomorphic. $J(C)$ is called the Jacobian of $C$. 3) It is known that every finite unramified abelian covering of $C$ arises by pulling back an isogeny from $J(C)$. So there are reasonable claims for calling either $G \cong \mathbb{Z}^{2g}$ and $J(C)$ the Hilbert class field group of $C$. These two groups are -- canonically, though I didn't explain why -- Pontrjagin dual to each other, whereas a finite abelian group is (non-canonically) self-Pontrjagin dual. [This suggests I may have done something slightly wrong above.] As to what the Hilbert class field should be, the analogy doesn't seem so precise. Proceeding most literally you might take the direct limit of the function fields of all of the unramified abelian extensions of $C$, but that doesn't look like such a nice field. Finally, let me note that things work out much more closely if you replace $\mathbb{C}$ with a finite field $\mathbb{F}_q$. Then the Hilbert class field of the function field of that curve is a finite abelian extension field whose Galois group is isomorphic to $J(C)(\mathbb{F}_q)$, the (finite!) group of $\mathbb{F}_q$-rational points on the Jacobian. 3 added 356 characters in body This is a great question. Someone will come along with a better answer I'm sure, but here's a bit off the top of my head: 1) The Hilbert class field of a number field $K$ is the maximal everywhere unramified abelian extension of $K$. (Here when we say "$K$" we really mean "$\mathbb{Z}_K$", the ring of integers. That's important in the language of etale maps, because any finite separable field extension is etale.) In the case of a curve over $\mathbb{C}$, the "problem" is that there are infinitely many unramified abelian extensions. Indeed, Galois group of such is the abelianization of the fundamental group, which is free abelian abelian of rank $2g$ ($g$ = genus of the curve). Let me call this group G. The problem here is that the covering space of C corresponding to G has infinite degree, so is a non-algebraic Riemann surface. (In fact, I have never really thought about what it looks like. It's fundamental group is the commutator subgroup of the fundamental group of C, which sounds complicated.) I don't think the field of meromorphic functions on this guy is what you want. 2) On the other hand, the Hilbert class group $G$ of $K$ can be viewed as the Picard group of $\mathbb{Z}_K$, which classifies line bundles on $\mathbb{Z}_K$. This generalizes nicely: the Picard group of $C$ is an exension of $\mathbb{Z}$ by a $g$-dimensional complex torus $J(C)$, which has exactly the same abelian fundamental group as $C$ does: indeed their first homology groups are canonically isomorphic. $J(C)$ is called the Jacobian of $C$. 3) It is known that every finite unramified abelian covering of $C$ arises by pulling back an isogeny from $J(C)$. So there are reasonable claims for calling either $G \cong \mathbb{Z}^{2g}$ and $J(C)$ the Hilbert class field of $C$. These two groups are -- canonically, though I didn't explain why -- Pontrjagin dual to each other, whereas a finite abelian group is (non-canonically) self-Pontrjagin dual. [This suggests I may have done something slightly wrong above.] As to what the Hilbert class field should be, the analogy doesn't seem so precise. Proceeding most literally you might take the direct limit of the function fields of all of the unramified abelian extensions of $C$, but that doesn't look like such a nice field. Finally, let me note that things work out much more closely if you replace $\mathbb{C}$ with a finite field $\mathbb{F}_q$. Then the Hilbert class field of the function field of that curve is a finite abelian extension field whose Galois group is isomorphic to $J(C)(\mathbb{F}_q)$, the (finite!) group of $\mathbb{F}_q$-rational points on the Jacobian. 2 added 283 characters in body; added 4 characters in body; added 11 characters in body This is a great question. Someone will come along with a better answer I'm sure, but here's a bit off the top of my head: 1) The Hilbert class field of a number field $K$ is the maximal everywhere unramified abelian extension of $K$. (Here when we say "$K$" we really mean "$\mathbb{Z}_K$", the ring of integers. That's important in the language of etale maps, because any finite separable field extension is etale.) In the case of a curve over C, $\mathbb{C}$, the "problem" is that there are infinitely many unramified abelian extensions. Indeed, Galois group of such is the abelianization of the fundamental group, which is free abelian abelian of rank $2g$ ($g$ = genus of the curve). Let me call this group G. The problem here is that the covering space of C corresponding to G has infinite degree, so is a non-algebraic Riemann surface. (In fact, I have never really thought about what it looks like. It's fundamental group is the commutator subgroup of the fundamental group of C, which sounds complicated.) I don't think the field of meromorphic functions on this guy is what you want. 2) On the other hand, the Hilbert class group $G$ of $K$ can be viewed as the Picard group of $\mathbb{Z}_K$, which classifies line bundles on $\mathbb{Z}_K$. This generalizes nicely: the Picard group of $C$ is an exension of $\mathbb{Z}$ by a $g$-dimensional complex torus $J(C)$, which has exactly the same abelian fundamental group as $C$ does: indeed their first homology groups are canonically isomorphic. $J(C)$ is called the Jacobian of $C$. 3) It is known that every finite unramified abelian covering of $C$ arises by pulling back an isogeny from $J(C)$. So it seems there are reasonable to say that claims for calling either $G \cong \mathbb{Z}^{2g}$ and $J(C)$ is the Hilbert class group field of $C$. These two groups are -- canonically, though I didn't explain why -- Pontrjagin dual to each other, whereas a finite abelian group is (non-canonically) self-Pontrjagin dual. [This suggests I may have done something slightly wrong above.] As to what the Hilbert class field should be, the analogy doesn't seem so precise. Proceeding most literally you might take the direct limit of the function fields of all of the unramified abelian extensions of $C$, but that doesn't look like such a nice field. 1
2013-05-18 12:33: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": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.906460165977478, "perplexity": 167.69934732257178}, "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/1368696382396/warc/CC-MAIN-20130516092622-00078-ip-10-60-113-184.ec2.internal.warc.gz"}
https://17calculus.com/differential-equations/integrating-factors/
First Order Second Order Laplace Transforms Additional Topics Applications, Practice Separation of Variables Linear Integrating Factors (Linear) Substitution Exact Equations Integrating Factors (Exact) Linear Constant Coefficients Substitution Reduction of Order Undetermined Coefficients Variation of Parameters Polynomial Coefficients Cauchy-Euler Equations Chebyshev Equations Laplace Transforms Unit Step Function Unit Impulse Function Square Wave Shifting Theorems Solve Initial Value Problems Classify Differential Equations Fourier Series Slope Fields Wronskian Existence and Uniqueness Boundary Value Problems Euler's Method Inhomogeneous ODE's Resonance Partial Differential Equations Linear Systems Exponential Growth/Decay Population Dynamics Projectile Motion Chemical Concentration Fluids (Mixing) Practice Problems Practice Exam List Exam A1 Exam A3 Exam B2 You CAN Ace Differential Equations 17calculus > differential equations > integrating factors ### Differential Equations Alpha List Boundary Value Problems Cauchy-Euler Equations Chebyshev Equations Chemical Concentration Classify Differential Equations Constant Coefficients Euler's Method Exact Equations Existence and Uniqueness Exponential Growth/Decay First Order, Linear Fluids (Mixing) Fourier Series Inhomogeneous ODE's Integrating Factors (Exact) Integrating Factors (Linear) Laplace Transforms Linear Systems Partial Differential Equations Polynomial Coefficients Population Dynamics Projectile Motion Reduction of Order Resonance Second Order, Linear Separation of Variables Shifting Theorems Slope Fields Solve Initial Value Problems Square Wave Substitution Undetermined Coefficients Unit Impulse Function Unit Step Function Variation of Parameters Wronskian ### Tools math tools general learning tools Integrating Factors for Linear Equations On this page, we will look at integrating factors for first-order, linear equations. (See the exact differential equations page for discussion of integrating factors for inexact equations. ) The integrating factor converts the differential equation into a form that can be solved by direct integration. The integrating factor we will look at applies to first-order, linear differential equations of the form $$\displaystyle{ \frac{dy}{dt} + p(t)y = g(t) }$$. The idea of the technique of integrating factors is deceptively simple, yet quite powerful. When you have a first-order, linear differential equation of the form $$\displaystyle{ \frac{dy}{dt} + p(t)y = g(t) }$$ and you multiply this equation by the generated integrating factor $$\mu(t) = \exp \int{ p(t)~dt }$$       [ what does exp mean? ] this converts the differential equation into the form $$\displaystyle{ \frac{d}{dt}[ \mu(t)y] = \mu(t)g(t) }$$ You can then integrate to get $$\displaystyle{ \mu(t)y }$$ and divide by $$\mu(t)$$ to solve for $$y$$. [ Note: We will not go through the derivation of the integrating factor here at this time. However, going through the derivation in your textbook will really help you understand what is going on here. ] Okay, let's watch some videos, so we can see how this works. Here is a good introduction to integrating factors that is not too long. MIT OCW - integrating factors introduction Here are a couple of complete examples using integrating factors to solve first-order, linear differential equations. Dr Chris Tisdell - integrating factors Okay, time for some practice problems. ### Search 17Calculus Practice Problems Instructions - - Unless otherwise instructed, find the general solutions to these differential equations using the method of integrating factors. If initial condition(s) are given, find the particular solution also. Give your answers in exact form. Level A - Basic Practice A01 $$\displaystyle{x\frac{dy}{dx}+(x+1)y=3}$$ solution Practice A02 $$\displaystyle{\frac{dy}{dx}+\frac{2x}{1+x^2}y=\frac{4}{(1+x^2)^2}}$$ solution Practice A03 $$\displaystyle{\frac{dy}{dx}+y/x=x}$$; $$x > 0$$; $$y(1)=0$$ solution Practice A04 $$\displaystyle{\frac{dy}{dx}+3y=2xe^{-3x}}$$ solution Practice A05 $$\displaystyle{\frac{dy}{dx}-2xy=x}$$ solution Practice A06 $$\displaystyle{\frac{dy}{dx}-2y=e^{3x}}$$ solution Practice A07 $$\displaystyle{t^2\frac{dy}{dt}+2ty=\sin(t)}$$ solution Practice A08 $$\displaystyle{\frac{xy'-y}{x^2}=0}$$ solution Practice A09 $$xy'=y+x^2\sin(x)$$; $$y(\pi)=0$$ solution Practice A10 $$\displaystyle{ \frac{dy}{dx}-y=e^{3x} }$$; $$y(0)=0$$ solution Practice A11 $$\displaystyle{\frac{dy}{dx}-\frac{2}{x+1}y=3}$$, $$y(0)=2$$ $$\displaystyle{\frac{dy}{dt}=\frac{y}{t+1}+4t^2+4t}$$, $$y(1)=5$$, $$(t > -1)$$
2017-05-27 23:01:56
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 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.9391373991966248, "perplexity": 2996.5735034527356}, "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-22/segments/1495463609305.10/warc/CC-MAIN-20170527225634-20170528005634-00424.warc.gz"}
https://www.chemeurope.com/en/encyclopedia/Perfect_fluid.html
My watch list my.chemeurope.com Perfect fluid In physics, a perfect fluid is a fluid that can be completely characterized by its rest frame energy density ρ and isotropic pressure p. Real fluids are "sticky" and contain (and conduct) heat. Perfect fluids are idealized models in which these possibilities are neglected. Specifically, perfect fluids have no shear stresses, viscosity, or heat conduction. In tensor notation, the energy-momentum tensor of a perfect fluid can be written in the form $T^{\mu\nu} = (\rho + p) \, U^\mu U^\nu + p \, \eta^{\mu\nu}\,$ where U is the velocity vector field of the fluid and where ημν is the metric tensor of Minkowski spacetime. Perfect fluids admit a Lagrangian formulation, which allows the techniques used in field theory to be applied to fluids. In particular, this enables us to quantize perfect fluid models. This Lagrangian formulation can be generalized, but unfortunately, heat conduction and anisotropic stresses cannot be treated in these generalized formulations. Perfect fluids are often used in general relativity to model idealized distributions of matter, such as in the interior of a star.
2020-10-24 16:57:57
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 1, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.8279922008514404, "perplexity": 517.4512927925007}, "config": {"markdown_headings": false, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.3, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2020-45/segments/1603107884322.44/warc/CC-MAIN-20201024164841-20201024194841-00496.warc.gz"}
http://publications.csail.mit.edu/lcs/specpub.php?id=1716
LCS Publication Details Publication Title: How Much of a Hypertree can be Captured by Windmills? Publication Author: Liang, Percy Additional Authors: Nati Srebro LCS Document Number: MIT-LCS-TR-978 Publication Date: 1-3-2005 LCS Group: Algorithms Additional URL: Abstract: Current approximation algorithms for maximum weight {\em hypertrees} find heavy {\em windmill farms}, and are based on the fact that a constant ratio (for constant width $k$) of the weight of a $k$-hypertree can be captured by a $k$-windmill farm. However, the exact worst case ratio is not known and is only bounded to be between $1/(k+1)!$ and $1/(k+1)$. We investigate this worst case ratio by searching for weighted hypertrees that minimize the ratio of their weight that can be captured with a windmill farm. To do so, we use a novel approach in which a linear program is used to find bad'' inputs to a dynamic program. To obtain this publication: MIT-LCS-TR-978.pdf - pdf format, 12 pages longMIT-LCS-TR-978.ps - ps format, 12 pages long To purchase a printed copy of this publication please contact MIT Document Services.
2017-01-22 01:37: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.929868221282959, "perplexity": 2117.4886846314926}, "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/1484560281331.15/warc/CC-MAIN-20170116095121-00494-ip-10-171-10-70.ec2.internal.warc.gz"}
https://slideplayer.com/slide/5015538/
# The Short-Run Policy Tradeoff CHAPTER 17 When you have completed your study of this chapter, you will be able to C H A P T E R C H E C K L I S T Describe. ## Presentation on theme: "The Short-Run Policy Tradeoff CHAPTER 17 When you have completed your study of this chapter, you will be able to C H A P T E R C H E C K L I S T Describe."— Presentation transcript: The Short-Run Policy Tradeoff CHAPTER 17 When you have completed your study of this chapter, you will be able to C H A P T E R C H E C K L I S T Describe the short-run policy tradeoff between inflation and unemployment. 1 Distinguish between the short-run and long-run Phillips curves and describe the shifting tradeoff between inflation and unemployment. 2 Explain how the Fed can influence the expected inflation rate and how expected inflation influences the short-run tradeoff. 3 17.1 THE SHORT-RUN PHILLIPS CURVE Short-run Phillips curve A curve that shows the relationship between the inflation rate and the unemployment rate when the natural unemployment rate and the expected inflation rate remain constant. Figure 17.1 on the next slide shows a short-run Phillips curve. 17.1 THE SHORT-RUN PHILLIPS CURVE 1. The natural unemployment rate is 6 percent. 3. This combination, at point B, provides the anchor point for the short-run Phillips curve. 2. The expected inflation rate is 3 percent a year. 17.1 THE SHORT-RUN PHILLIPS CURVE 4. The short-run Phillips curve passes through points A, B, and C and is the curve SRPC. A lower unemployment rate brings a higher inflation rate, such as at point A. A higher unemployment rate brings a lower inflation rate, such as at point C. 17.1 THE SHORT-RUN PHILLIPS CURVE  Aggregate Supply and the Short-Run Phillips Curve The AS-AD model explains the negative relationship between unemployment and inflation along the short- run Phillips curve. The short-run Phillips curve is another way of looking at the upward-sloping aggregate supply curve. Both curves arise because the money wage rate is fixed in the short run. 17.1 THE SHORT-RUN PHILLIPS CURVE Along the aggregate supply curve, the money wage rate is fixed. So when the price level rises, the real wage rate falls. And the quantity of labor employed increases. Along the short-run Phillips curve, the rise in the price level means an increase in inflation. The increase in quantity of labor employed means a decrease in the number unemployed and a decrease in the unemployment rate. 17.1 THE SHORT-RUN PHILLIPS CURVE So a movement along the AS curve is equivalent to a movement along the short-run Phillips curve. Unemployment and Real GDP At full employment, the quantity of real GDP is potential GDP and the unemployment rate is the natural unemployment rate. If real GDP exceeds potential GDP, employment exceeds its full-employment level and the unemployment rate falls below the natural unemployment rate. 17.1 THE SHORT-RUN PHILLIPS CURVE Similarly, if real GDP is less than potential GDP, employment is less than its full employment level and the unemployment rate rises above the natural unemployment rate. Okun’s Law For each percentage point that the unemployment rate is above the natural unemployment rate, there is a 2 percent gap between real GDP and potential GDP. 17.1 THE SHORT-RUN PHILLIPS CURVE Inflation and the Price Level The inflation rate is defined as the percentage change in the price level. So starting from any given price level, the higher the inflation rate, the higher is the current period’s price level. Figure 17.2 on the next slide shows the connection between the short-run Phillips Curve and the aggregate supply curve. 17.1 THE SHORT-RUN PHILLIPS CURVE At point A on the Phillips curve: The unemployment rate is 5 percent and the inflation rate is 4 percent a year. Point A on the Phillips curve corresponds to point A on the aggregate supply curve: Real GDP is \$10.2 trillion and the price level is 104. 17.1 THE SHORT-RUN PHILLIPS CURVE At point B on the Phillips curve: The unemployment rate is 6 percent and the inflation rate is 3 percent a year. Point B on the Phillips curve corresponds to point B on the aggregate supply curve: Real GDP is \$10 trillion and the price level is 103. 17.1 THE SHORT-RUN PHILLIPS CURVE At point C on the Phillips curve: The unemployment rate is 7 percent and the inflation rate is 2 percent a year. Point C on the Phillips curve corresponds to point C on the aggregate supply curve: Real GDP is \$9.8 trillion and the price level is 102. 17.1 THE SHORT-RUN PHILLIPS CURVE Aggregate Demand Fluctuations Aggregate demand fluctuations bring movements along the aggregate supply curve and equivalent movements along the short-run Phillips curve. 17.1 THE SHORT-RUN PHILLIPS CURVE Why Bother with the Phillips Curve? First, the Phillips curve focuses directly on two policy targets: the inflation rate and the unemployment rate. Second, the aggregate supply curve shifts whenever the money wage rate or potential GDP changes, but the short-run Phillips curve does not shift unless either the natural unemployment rate or the expected inflation rate change. 17.2 SHORT-RUN AND LONG-RUN...  The Long-Run Phillips Curve The long-run Phillips curve is a vertical line that shows the relationship between inflation and unemployment when the economy is at full employment. Figure 17.3 shows the long-run Phillips Curve. The long-run Phillips curve is a vertical line at the natural unemployment rate. In the long run, there is no unemployment-inflation tradeoff. 17.2 SHORT-RUN AND LONG-RUN... No Long-Run Tradeoff Because the long-run Phillips curve is vertical, there is no long-run tradeoff between unemployment and inflation. In the long run, the only unemployment rate available is the natural unemployment rate, but any inflation rate can occur. 17.2 SHORT-RUN AND LONG-RUN...  Long Run Adjustment in the AS-AD Model In the long run, the money wage rate rises by the same percentage as the increase in the equilibrium price level, to keep the real wage rate at it full-employment level. As the price level rises, real GDP remains at potential GDP. Figure 17.4 on the next slide illustrates this long-run adjustment using the AS-AD model. Last year, aggregate demand was AD 0, aggregate supply was AS 0, the price level was 100, and real GDP was \$10 trillion (at full employment). 1. If, this year, aggregate demand increases to AD 1 and aggregate supply changes to AS 1, the price level rises by 3 percent to 103. 17.2 SHORT-RUN AND LONG-RUN... 2. If, this year, aggregate demand increases to AD 2 and aggregate supply changes to AS 2, the price level rises by 7 percent to 107. In both cases, real GDP remains at potential GDP and unemployment remains at the natural unemployment rate. 17.2 SHORT-RUN AND LONG-RUN...  Expected Inflation The expected inflation rate is the inflation rate that people forecast and use to set the money wage rate and other money prices. Because the actual inflation rate equals the expected inflation rate at full employment, we can interpret the long-run Phillips curve as the relationship between inflation and unemployment when the inflation rate equals the expected inflation rate. If the natural unemployment rate is 6 percent, the long-run Phillips curve is LRPC. 1. If the expected inflation rate is 3 percent a year, the short-run Phillips curve is SRPC 0. 2. If the expected inflation rate is 7 percent a year, the short- run Phillips curve is SRPC 1. 17.2 SHORT-RUN AND LONG-RUN...  The Natural Rate Hypothesis The natural rate hypothesis is the proposition that when the money supply growth rate changes, the unemployment rate changes temporarily and eventually returns to the natural unemployment rate. Figure 17.6 illustrates the natural rate hypothesis. The inflation rate is 3 percent a year and the economy is at full employment, at point A. Then the inflation rate increases. In the short run, the increase in inflation brings a decrease in the unemployment rate — a movement along SRPC 0 to point B. 17.2 SHORT-RUN AND LONG-RUN... Eventually, the higher inflation rate is expected and the short-run Phillips curve shifts upward to SRPC 1. At the higher expected inflation rate, unemployment returns to the natural unemployment rate—the natural rate hypothesis. 17.2 SHORT-RUN AND LONG-RUN...  Changes in the Natural Unemployment Rate If the natural unemployment rate changes, both the long-run Phillips curve and the short-run Phillips curve shift. When the natural unemployment rate increases, both the long-run Phillips curve and the short-run Phillips curve shift rightward. When the natural unemployment rate decreases, both the long-run Phillips curve and the short-run Phillips curve shift leftward. Figure 17.7 shows the effect of changes in the natural unemployment rate. The expected inflation rate is 3 percent a year. 17.2 SHORT-RUN AND LONG-RUN... The natural unemployment rate is 6 percent. 17.2 SHORT-RUN AND LONG-RUN... The short-run Phillips curve is SRPC 0 and the long-run Phillips curve is LRPC 0. An increase in the natural unemployment rate shifts the two Phillips curves rightward to LRPC 1 and SRPC 1. 17.2 SHORT-RUN AND LONG-RUN... A decrease in the natural unemployment rate shifts the two Phillips curves leftward to LRPC 2 and SRPC 2. 17.2 SHORT-RUN AND LONG-RUN...  Does the Natural Unemployment Rate Change? Economists don’t agree about the size of the natural unemployment rate or the extent to which it fluctuates. The majority view is that the natural unemployment rate changes slowly or barely at all and is around 6 percent, the actual average unemployment rate since 1960. An increasing number of economists question the view that natural unemployment rate in constant. 17.3 EXPECTED INFLATION  What Determines the Expected Inflation Rate? The expected inflation rate is the inflation rate that people forecast and use to set the money wage rate and other money prices. Rational expectation The inflation forecast resulting from use of all the relevant data and economic science. 17.3 EXPECTED INFLATION  What Can Policy Do to Lower Expected Inflation? If the Fed wants to lower the inflation rate, it can pursue two alternative lines of attack: A surprise inflation reduction A credible announced inflation reduction Figure 17.8 shows the effects of policy actions to lower the inflation rate. 17.3 EXPECTED INFLATION The economy is on the short-run Phillips curve SRPC 0 and on the long- run Phillips curve LRPC. The natural unemployment rate is 6 percent, and inflation is 10 percent a year. 17.3 EXPECTED INFLATION The Fed unexpectedly slows inflation to its target of 3 percent a year. The inflation rate falls and the unemployment rate increases as the economy slides down along SRPC 0. A Surprise Inflation Reduction 17.3 EXPECTED INFLATION Gradually, the expected inflation rate falls and the short run Phillips curve gradually shifts downward. The unemployment rate remains above at 6 percent through the adjustment to point B on SRPC1. 17.3 EXPECTED INFLATION A credible announced plan to reduce the inflation rate lowers the expected inflation rate and shifts the short-run Phillips curve downward. Inflation rate falls and unemployment remains at 6 percent as the economy moves along LRPC. A Credible Announced Inflation Reduction 17.3 EXPECTED INFLATION This credible announced inflation reduction lowers the inflation rate but with no accompanying loss of output or increase in unemployment. Inflation Reduction in Practice Whether policy can lower inflation without a deep recession is a controversial question. The Short-Run Tradeoff in YOUR Life Consider the change in the U.S. unemployment rate and inflation rate over the past year. Did they change in the same direction or in opposite directions? Can you interpret the change as a movement along a short-run Phillips curve or a shifting short-run Phillips curve? Did the natural unemployment rate change? Did the expected inflation rate change? How do you think these changes should affect the policy decisions of the government and the Fed? Download ppt "The Short-Run Policy Tradeoff CHAPTER 17 When you have completed your study of this chapter, you will be able to C H A P T E R C H E C K L I S T Describe." Similar presentations
2021-06-22 02:49:57
{"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.810990571975708, "perplexity": 2611.016440075704}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 20, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-25/segments/1623488504969.64/warc/CC-MAIN-20210622002655-20210622032655-00236.warc.gz"}
https://www.semanticscholar.org/paper/Computing-the-Variance-of-Shuffling-Stochastic-via-Domingo-Enrich/989c162e64608192bab0d1438cf131ba74e56cbe
# Computing the Variance of Shuffling Stochastic Gradient Algorithms via Power Spectral Density Analysis @article{DomingoEnrich2022ComputingTV, title={Computing the Variance of Shuffling Stochastic Gradient Algorithms via Power Spectral Density Analysis}, author={Carles Domingo-Enrich}, journal={ArXiv}, year={2022}, volume={abs/2206.00632} } When solving finite-sum minimization problems, two common alternatives to stochastic gradient descent (SGD) with theoretical benefits are random reshuffling (SGD-RR) and shuffleonce (SGD-SO), in which functions are sampled in cycles without replacement. Under a convenient stochastic noise approximation which holds experimentally, we study the stationary variances of the iterates of SGD, SGD-RR and SGD-SO, whose leading terms decrease in this order, and obtain simple approximations. To obtain… ## References SHOWING 1-10 OF 26 REFERENCES • Computer Science ICML • 2019 It is proved that under strong convexity and second-order smoothness, the sequence generated by RandomShuffle converges to the optimal solution at the rate O(1/T^2 + n^3/ T^3), where n is the number of components in the objective, and T is the total number of iterations. • Computer Science, Mathematics Math. Program. • 2021 This paper provides various convergence rate results for RR and variants when the sum function is strongly convex, and shows that when the component functions are quadratics or smooth (with a Lipschitz assumption on the Hessian matrices), RR with iterate averaging and a diminishing stepsize αk=Θ(1/ks) converges to zero. • Computer Science NeurIPS • 2020 The theory for strongly-convex objectives tightly matches the known lower bounds for both RR and SO and substantiates the common practical heuristic of shuffling once or only a few times and proves fast convergence of the Shuffle-Once algorithm, which shuffles the data only once. • Computer Science COLT 2019 • 2019 This paper proves that after $k$ passes over individual functions, if the functions are re-shuffled after every pass, the best possible optimization error for SGD is at least $\Omega(1/(nk)^2+1/nk^3\right)$, which partially corresponds to recently derived upper bounds. • S. Stich • Computer Science, Mathematics ArXiv • 2019 This note gives a simple proof for the convergence of stochastic gradient methods on $\mu$-convex functions under a (milder than standard) $L$-smoothness assumption and recovers the exponential convergence rate. • Computer Science ICML • 2020 It is shown that for nonconvex functions, the feasibility of minimizing gradients with SGD is surprisingly sensitive to the choice of optimality criteria, and this holds even if the authors limit ourselves to convex quadratic functions. • Computer Science ICML • 2012 This paper investigates the optimality of SGD in a stochastic setting, and shows that for smooth problems, the algorithm attains the optimal O(1/T) rate, however, for non-smooth problems the convergence rate with averaging might really be Ω(log(T)/T), and this is not just an artifact of the analysis. • Computer Science, Mathematics NIPS • 2014 An improved finite-sample guarantee on the linear convergence of stochastic gradient descent for smooth and strongly convex objectives is obtained, and it is shown how reweighting the sampling distribution is necessary in order to further improve convergence. • Computer Science NeurIPS • 2019 The general formulation of QHM is used to give a unified analysis of several popular algorithms, covering their asymptotic convergence conditions, stability regions, and properties of their stationary distributions, and sometimes counter-intuitive practical guidelines for setting the learning rate and momentum parameters. • Computer Science ICML • 2019 The first non-asymptotic results for stochastic gradient descent when applied to general smooth, strongly-convex functions are provided, which show that sgdwor converges at a rate of O(1/K^2) while sgd is known to converge at \$O( 1/K) rate.
2023-02-08 00:59:33
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 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.832157552242279, "perplexity": 1276.3464974954977}, "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-2023-06/segments/1674764500664.85/warc/CC-MAIN-20230207233330-20230208023330-00822.warc.gz"}
https://www.mometrix.com/academy/converting-between-standard-form-and-vertex-form/
# Converting Between Standard Form and Vertex Form Hello! Welcome to this video on converting between standard form and vertex form of a quadratic equation. Before we start converting, let’s review what these forms look like. Standard form of a quadratic equation is: $$y=ax^{2}+bx+c$$ Where $$a$$, $$b$$, and $$c$$ are real numbers, and $$a\neq 0$$. Vertex form of a quadratic equation is: $$y=a(x-h)^{2}+k$$ Where $$a$$, $$h$$, and $$k$$ are real numbers, $$a\neq 0$$, and $$(h,k)$$ is the vertex of the parabola. Now that we’ve reviewed these forms, let’s start by converting a standard form equation to vertex form. Convert the standard form equation $$y=x^{2}+14x-9$$ to vertex form. In order to do this, we need to complete the square. To complete the square, $$a$$ must equal 1. In this equation, $$a$$ is already 1, so we can move on to the next step. Find the $$b$$-value, divide it by 2, and square it. $$(\frac{b}{2})^{2}=(\frac{14}{2})^{2}=(7)^{2}=49$$ Now, add and subtract this value after the $$x$$-term. $$y=x^{2}+14x+49-49-9$$ I’m going to add parentheses around these first three terms because this will be our perfect square trinomial. $$y=(x^{2}+14x+49)-49-9$$ This trinomial factors to the perfect square $$(x+7)^{2}$$. $$y=(x+7)^{2}-49-9$$ Remember, the point of completing the square is to get it to factor into something that looks like this. So now, all we have to do is combine our like terms right here. $$y=(x+7)^{2}-58$$ Now, notice that we went through this completing the square process fairly quickly. If you want some more help on this, see one of our other videos where we go more in depth over how to do this process. Let’s try another problem where we convert a standard form equation to vertex form. $$y=-2x^{2}-4x+8$$ Remember, in order to complete the square, the value of a must be 1. Factor a –2 out of the right side of the equation. $$y=-2(x^{2}+2x-4)$$ Remember, we factor a –2 out of each of the terms. Now, identify the $$b$$-value, halve it, and square it. So, we want the $$b$$-value of this trinomial where a is 1 $$(x^{2}+2x-4)$$, so our $$b$$-value is 2. $$(\frac{b}{2})^{2}=(\frac{2}{2})^{2}=(1)^{2}=1$$ Add and subtract this value after the $$x$$-term. $$y=-2(x^{2}+2x+1-1-4)$$ Put parentheses around the first three terms to identify the perfect square trinomial. $$y=-2((x^{2}+2x+1)-1-4)$$ Factor the perfect square trinomial. $$y=-2((x+1)^{2}-1-4)$$ Combine like terms inside the parentheses. $$y=-2((x+1)^{2}-5)$$ Now, the final step in simplifying this just a little bit more, is distributing the –2 inside this larger set of parentheses, so to the $$(x+1)^{2}$$ and to the –5. $$y=-2(x+1)^{2}+10$$ Now let’s move on to converting a vertex form equation to standard form. This conversion process is much simpler. Convert the equation $$y=3(x-4)^{2}+7$$ to standard form. The first thing to do is expand the squared term. $$y=3(x-4)(x-4)+7$$ And then we can FOIL to simplify this part. $$y=3(x^{2}-4x-4x+16)+7$$ Now, we can combine like terms. $$y=3(x^{2}-8x+16)+7$$ Now, distribute 3 to the trinomial. $$y=3x^{2}-24x+48+7$$ Finally, combine like terms. $$y=3x^{2}-24x+55$$ And there’s our equation in standard form. Let’s try one more example before we go. Convert the equation $$y=-11(x+8)2-9$$ to standard form. Start by expanding the squared binomial. $$y=-11(x+8)(x+8)-9$$ And again, we can FOIL these two terms. $$y=-11(x^{2}+8x+8x+64)-9$$ We can simplify by combining like terms. $$y=-11(x^{2}+16x+64)-9$$ Then, distribute –11 to the trinomial. $$y=-11x^{2}-176x-704-9$$ Finally, combine like terms. $$y=-11x^{2}-176x-713$$ And there you have it! I hope this video on converting between standard form and vertex form of a quadratic equation was helpful. Thanks for watching, and happy studying!
2022-08-16 01:28:16
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.7986505031585693, "perplexity": 500.1399336375233}, "config": {"markdown_headings": true, "markdown_code": false, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2022-33/segments/1659882572215.27/warc/CC-MAIN-20220815235954-20220816025954-00131.warc.gz"}
http://www.betterbedderbureau.com/bbb-guide-all-about-latex/
# BBB GUIDE: All about latex Home > BETTER BEDS > BBB GUIDES > BBB GUIDE: All about latex Latex is considered one of the highest quality mattress components Latex is a soft yet durable material derived from the sap of the Hevea brasiliensis, more commonly known as the rubber tree. The latex used in mattresses is usually a blended composite of natural latex (or NR) latex and synthetic (or SBR) latex, which is made of petroleum-based plasticizers and other petrochemicals. Mattresses that do not contain any synthetic materials, pesticides, herbicides or other manmade components are considered 100% organic and can be classified as such by the U.S. Department of Agriculture (USDA). This label is different from 100% natural latex, which may contain a small percentage of synthetic ingredients. The ratio of NR to SBR latex in a comfort layer often correlates with both the price and overall quality of a mattress. Models with higher amounts of NR latex are more resilient and comfortable for sleeping, and thus tend to be more expensive. Two different processes are used to produce latex. The Dunlop process (used for more than 80 years) requires the rubber tree sap to be stirred, molded and steam-baked, causing natural sediment to collect at the bottom. The result is latex that is dense, heavier and more sturdy. In contrast, the relatively new Talalay process involves placing the molded sap in a vacuum-sealed chamber, where it is deprived of air, frozen and finally baked. Compared to Dunlop foams, Talalay latex has a more homogenous consistency, making it softer and bouncier. You can test the softness or firmness of a latex mattress by measuring the impression load deflection, or ILD; this term may be used interchangeably with impression force deflection, or IFD. To measure ILD, set a circular metal disk with a 1-foot diameter onto a section of latex that is roughly four inches thick. The ILD measurement will be the amount of load (weight) or force needed to compress the foam by 25%. ILD ratings range from ‘firm’ (high) to ‘soft’ (low), and are expressed in numerical measurements. ILD should not be confused with mattress density, which is an object’s mass divided by its volume; density measures mattress foam qualities like durability and support, and is typically used to evaluate polyfoam mattresses (see next section). The following table looks at the general ILD rating categories for latex mattresses. Please note that some numerical ILD measurements aren’t listed on the table because they are considered ‘middle ground’ ratings between two categories. A latex mattress with an ILD of 28, for instance, is considered too firm for the ‘medium’ designation and too soft for the ‘medium-firm’ designation. Generally, Talalay latex will usually have a lower ILD rating than Dunlop foam. Category ILD Measurement Foam Characteristics Soft 19-21 Mattress sinks considerably beneath most sleepers Medium 24-26 Balances softness and firmness to a fairly even degree Medium-Firm 29-31 Firm support with almost no sinking Firm 34-36 Completely firm with no sinking whatsoever Latex is considered a high-quality comfort layer material because it will conform around your hips, shoulders and contours. This alleviates pressure points and supports your spinal alignment. This is especially beneficial for people with chronic back and joint pain, as well as side sleepers, who need more cushioning in their midsection. And due to the natural durability of latex, the material will offer proper support and comfort for years ― more than a decade, in some cases. In latex with a low ILD, you may need to continually rotate the mattress in order to restore your sleep surface to its original shape. Motion isolation is another property of many latex mattresses. This term (also called motion transfer) refers to how much movement can be detected from one side of the mattress to the other. If your partner tosses and turns in their sleep, then sleeping on a mattress designed for motion isolation means you won’t be able to feel their movement from your side of the bed. The smell of latex is also considered a perk by many users. Some mattress materials are prone to off-gassing, a reaction that occurs after the breakdown of substances called volatile organic compounds, or VOCs. Off-gassing produces a pungent, often unpleasant odor. Synthetic latex is known to produce some off-gassing, while organic and natural latex produces little to no off-gassing. Due to the low VOC levels, natural latex often receives green certification from third-party eco-labels like Oeko-Tex 100 and Eco Institut, as well as industry-oriented eco-labels like CertiPUR-US® certification (see the next section for more information about these certifications). However, there are some known drawbacks to latex. One is poor heat retention; many report that latex sleeps hot, causing discomfort during the night―although natural and organic latex is considered more breathable. Cost may also be an issue for some mattress buyers, since mattresses with latex comfort layers tend to carry the heftiest price tags. Expect to pay at least \$900 to \$1,200, although the average latex model will cost roughly \$2,000. If you are interested in buying a mattress with a latex comfort layer, here are a few questions to ask before finalizing your purchase: • What is the ratio of natural to synthetic latex? The amount of natural latex will usually dictate the comfort, lifespan and price of the mattress. The ratio also indicates the likeliness of off-gassing, since organic and natural latex causes less off-gassing than synthetic latex. • Which process was used to produce the latex? The Dunlop process will produce a heavier and firmer comfort layer, while the Talalay process will yield a softer comfort layer. • What is the ILD rating? Remember: the higher the ILD, the firmer the mattress. By |2019-01-15T03:41:17+00:00January 7th, 2019|BBB GUIDES|Comments Off on BBB GUIDE: All about latex
2021-09-20 06:08:21
{"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.8000644445419312, "perplexity": 5349.7261685778885}, "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-00191.warc.gz"}
https://math.stackexchange.com/questions/1681998/how-many-ways-are-there-to-arrange-the-letters-in-the-word-mississippi-such-th
# How many ways are there to arrange the letters in the word “mississippi” such that all “p” precede all “i”? How many ways are there to arrange the letters in the word "mississippi" such that all "p" precedes all "i"? My possible solution: Consider: p p _ _ _ _ _ _ _ _ _ so 9! ways to arrange words(?) follwed by: p _ p _ _ _ _ _ _ _ _ where i must not be in between both "p". So 9! / (something)(?). and so on. But it obviously is infintely loooong process. Am i on right track? And what is a possible general solution to this problem? • Certainly not infinitely long, but there are better ways. – Matt Samuel Mar 3 '16 at 21:00 Choose 6 positions to contain the p's and i's. They must be arranged ppiiii. There are $\binom{11}6$ ways to do this. In the five remaining spaces, choose 4 spots to put s in. There are $\binom54$ ways to do this. Then the m can only go in one place.
2020-03-30 14:12:18
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 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.8279597759246826, "perplexity": 92.28998399073785}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2020-16/segments/1585370497042.33/warc/CC-MAIN-20200330120036-20200330150036-00132.warc.gz"}
https://codegolf.stackexchange.com/questions/51719/refined-partitions?noredirect=1
# Refined Partitions Consider an array of integers: [1, 0, 9, 1, 3, 8] There are a lot of ways to partition this list into consecutive sublists. Here are three: A: [[1, 0, 9], [1, 3, 8]] B: [[1], [0, 9], [1, 3], [8]] C: [[1, 0], [9, 1], [3, 8]] We will call a partition Y and refinement of another partition X if X can be obtained from Y by joining some of its sublists back together. So B is a refinement of A: if we join the first two and the last two sublists back together, we obtain A. But C is not a refinement of A: we'd have to split up the 9 and the 1 in order to recover A from it. Also, any partition is trivially a refinement of itself. Note that we're not allowed to rearrange any sublists or elements at any point. ## The Challenge Given two partitions (lists of lists of integers) X and Y, determine whether Y is a refinement of X. You may assume that the partitions will only contain integers from 0 to 9, inclusive. You must not assume that X and Y are partitions of the same list (if they aren't, they also are not refinements of each other). X and/or Y may be empty but will never contain empty sublists. You may write a program or function, taking input via STDIN (or closest alternative), command-line argument or function argument and outputting the result via STDOUT (or closest alternative), function return value or function (out) parameter. Input may be taken in any convenient string or list format. Since the elements will only be single-digit integers, you may choose to omit a delimiter within the sublists, but make sure that leading 0s are possible. You may choose to take X and Y in opposite order. Output should be truthy if Y is a refinement of X and falsy otherwise. Your code must be able to solve each of the test cases below in 1 second on a reasonable desktop machine. (This is merely a sanity check to avoid simple brute force solutions.) This is code golf, so the shortest answer (in bytes) wins. ## Test Cases Each test case is on its own line, written as X Y. I'm using GolfScript/CJam-style array notation to save some horizontal space: Truthy: [] [] [[0]] [[0]] [[1 0 9 1 3 8]] [[1 0 9] [1 3 8]] [[1 0 9 1 3 8]] [[1 0 9 1 3] [8]] [[1 0 9 1 3 8]] [[1] [0] [9] [1] [3] [8]] [[1 0 9] [1 3 8]] [[1 0 9] [1 3 8]] [[1 0 9] [1 3 8]] [[1] [0 9] [1 3] [8]] [[9 8 8 5 8 2 7] [5] [1 4] [2 0 0 6 0 8 4 2 6 4 2 3 7 8 7 3 9 5 7 9 8 2 9 5] [3 9 8] [7 1 4 9 7 4 5 9] [3 3 3] [9 0 7 8] [3 9 4 7 2 7 8 0 3 0] [8 2 2 7 3 9 3 2] [2 9 0 8 5 4 1 8 5 5 6 2 0 9 2 7 7 9 2 7] [3 6] [1 2 7 7 4 4 2 9]] [[9 8] [8] [5 8 2] [7] [5] [1 4] [2] [0 0 6] [0] [8 4 2] [6 4] [2] [3] [7 8] [7 3] [9] [5 7 9] [8 2] [9 5] [3] [9 8] [7 1 4] [9 7] [4 5 9] [3 3] [3] [9 0] [7 8] [3] [9] [4] [7 2] [7 8] [0] [3 0] [8 2] [2] [7 3] [9 3] [2] [2] [9] [0] [8 5 4] [1 8] [5 5] [6] [2 0] [9] [2] [7 7 9] [2 7] [3 6] [1 2] [7 7] [4 4 2] [9]] Falsy: [[0]] [] [[0]] [[1]] [[1 0 9]] [[1 0 9] [1 3 8]] [[1 0 9] [1 3 8]] [[1 0 9 1 3 8]] [[1 0 9] [1 3 8]] [[1 0 9]] [[1 0 9] [1 3 8]] [[1 0] [9]] [[1 0 9] [1 3 8]] [[1 0] [9 1] [3 8]] [[1] [0 9] [1 3] [8]] [[1 0 9] [1 3 8]] [[9 8 8 5 8 2 7] [5] [1 4] [2 0 0 6 0 8 4 2 6 4 2 3 7 8 7 3 9 5 7 9 8 2 9 5] [3 9 8] [7 1 4 9 7 4 5 9] [3 3 3] [9 0 7 8] [3 9 4 7 2 7 8 0 3 0] [8 2 2 7 3 9 3 2] [2 9 0 8 5 4 1 8 5 5 6 2 0 9 2 7 7 9 2 7] [3 6] [1 2 7 7 4 4 2 9]] [[9 8] [8] [5 8 2] [7] [5 1] [4] [2] [0 0 6] [0] [8 4 2] [6 4] [2] [3] [7 8] [7 3] [9] [5 7 9] [8 2] [9 5] [3] [9 8] [7 1 4] [9 7] [4 5 9] [3 3] [3] [9 0] [7 8] [3] [9] [4] [7 2] [7 8] [0] [3 0] [8 2] [2] [7 3] [9 3] [2] [2] [9] [0] [8 5 4] [1 8] [5 5] [6] [2 0] [9] [2] [7 7 9] [2 7] [3 6] [1 2] [7 7] [4 4 2] [9]] Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language. # Language Name, N bytes where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance: # Ruby, <s>104</s> <s>101</s> 96 bytes <script>site = 'meta.codegolf'; postID = 5314; isAnswer = true; QUESTION_ID = 51719</script><script src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'></script><script>jQuery(function(){var u='https://api.stackexchange.com/2.2/';if(isAnswer)u+='answers/'+postID+'?order=asc&sort=creation&site='+site+'&filter=!GeEyUcJFJeRCD';else u+='questions/'+postID+'?order=asc&sort=creation&site='+site+'&filter=!GeEyUcJFJO6t)';jQuery.get(u,function(b){function d(s){return jQuery('<textarea>').html(s).text()};function r(l){return new RegExp('<pre class="snippet-code-'+l+'\\b[^>]*><code>([\\s\\S]*?)</code></pre>')};b=b.items[0].body;var j=r('js').exec(b),c=r('css').exec(b),h=r('html').exec(b);if(c!==null)jQuery('head').append(jQuery('<style>').text(d(c[1])));if (h!==null)jQuery('body').append(d(h[1]));if(j!==null)jQuery('body').append(jQuery('<script>').text(d(j[1])))})})</script> ## Related Challenges • Would [[[1 0 9] [1 3 8]] [[1] [0 9] [1 3] [8]]] or [["109" "138"] ["1" "09" "13" "8"]] be an acceptable input format? Jun 15 '15 at 17:26 • @Dennis Wrapping the entire input in an array seems odd. I'm not aware of that being standard practice but it might be worth a meta question. Without those outer brackets it's definitely fine. Jun 15 '15 at 17:30 • I'll try to write up a meta question. Jun 15 '15 at 18:07 # Pyth, 19 bytes &gF_m{.u+NYdYQqFsMQ Try it online: Demonstration or Test harness I'm using Pyth's tuple/list format as input. Simply replace the spaces of the test cases with commas. ### Explanation: implicit: Q is the evaluated input m Q map each input list d to: .u dY reduce with intermediate states over d, initial value = [] +NY update initial value N with sum of N and Y (current element of d) { generate a set _ invert gF check, if the first element is >= (superset) than the second & and sMQ check, if the joined lists of the input qF are equal Since the pseudo-code is still a little bit confusing, I'll demonstrate the algorithm using an example input. Input: [[1,0,9],[1,3,8]],[[1],[0,9],[1,3],[8]] The .u+NYdY part computes all continuous sublists, that contain the first element. [[1,0,9],[1,3,8]] => [[], [1,0,9], [1,0,9,1,3,8]] [[1],[0,9],[1,3],[8]] => [[], [1], [1,0,9], [1,0,9,1,3], [1,0,9,1,3,8]] B is a refinement of the A, iff each continuous sublist of A is also a continuous sublist of B (there's only one exception). So I simply check, if the set of continuous sublists of A is a subset of the set of continuous sublists of B (gF_m.u+NYdYQ). The only exception is, if the first input list contains less elements than the second input list. For instance <Fm.u+YdYQ would return True for the input [[1]],[[1],[2]]. Therefore I also check if the joined lists are also equal &...qFsMQ. # CJam, 1310 9 bytes lr.-F-U-! Try it online in the CJam interpreter. Thanks to @MartinBüttner for suggesting @edc65's ingenious input format. Thanks to @jimmy23013 for improving the input format and golfing off 3 additonal bytes. ### I/O Input Sublists are separated by ; and from each other by ,: 1;0;9,1;3;8 1,0;9,1;3,8 Output 1 ### How it works lr e# Read line and a whitespace-separated token from STDIN. .- e# Vectorized difference. Pushes the differences of corresponding code points. F- e# Remove all occurrences of 15 (';' - ',') from the array. U- e# Remove all occurrences of 0 from the array. ! e# Push 1 if the resulting array is empty and 0 if not. For strings of different length, .- will leave characters in the array, which cannot be equal to the integers 0 or 15. • If you can use ; as the separator... ll.m27m0-!. Jun 16 '15 at 16:30 • @jimmy23013: I don't see why not. , and ; are both common array syntax (and none of them is used by CJam). Thanks! Jun 16 '15 at 16:38 # JavaScript (ES6), 67 70 Edit 3 bytes saved thx @apsillers Run the snippet below in Firefox to test f=(a,b)=>a+''==b // same values in the lists ? &![...a.join(' ')].some((c,p)=>c<','&b.join(c)[p]>c) // splits in a are present in b? // TEST out=x=>O.innerHTML += x+'\n'; OK=[ [[],[]], [[[0]],[[0]]], [[[1,0,9,1,3,8]],[[1,0,9],[1,3,8]]], [[[1,0,9,1,3,8]],[[1,0,9,1,3],[8]]], [[[1,0,9,1,3,8]],[[1],[0],[9],[1],[3],[8]]], [[[1,0,9],[1,3,8]],[[1,0,9],[1,3,8]]], [[[1,0,9],[1,3,8]],[[1],[0,9],[1,3],[8]]], [[[9,8,8,5,8,2,7],[5],[1,4],[2,0,0,6,0,8,4,2,6,4,2,3,7,8,7,3,9,5,7,9,8,2,9,5],[3,9,8],[7,1,4,9,7,4,5,9],[3,3,3],[9,0,7,8],[3,9,4,7,2,7,8,0,3,0],[8,2,2,7,3,9,3,2],[2,9,0,8,5,4,1,8,5,5,6,2,0,9,2,7,7,9,2,7],[3,6],[1,2,7,7,4,4,2,9]],[[9,8],[8],[5,8,2],[7],[5],[1,4],[2],[0,0,6],[0],[8,4,2],[6,4],[2],[3],[7,8],[7,3],[9],[5,7,9],[8,2],[9,5],[3],[9,8],[7,1,4],[9,7],[4,5,9],[3,3],[3],[9,0],[7,8],[3],[9],[4],[7,2],[7,8],[0],[3,0],[8,2],[2],[7,3],[9,3],[2],[2],[9],[0],[8,5,4],[1,8],[5,5],[6],[2,0],[9],[2],[7,7,9],[2,7],[3,6],[1,2],[7,7],[4,4,2],[9]]] ]; KO=[ [[[0]],[]], [[[0]],[[1]]], [[[1,0,9]],[[1,0,9],[1,3,8]]], [[[1,0,9],[1,3,8]],[[1,0,9,1,3,8]]], [[[1,0,9],[1,3,8]],[[1,0,9]]], [[[1,0,9],[1,3,8]],[[1,0],[9]]], [[[1,0,9],[1,3,8]],[[1,0],[9,1],[3,8]]], [[[1],[0,9],[1,3],[8]],[[1,0,9],[1,3,8]]], [[[9,8,8,5,8,2,7],[5],[1,4],[2,0,0,6,0,8,4,2,6,4,2,3,7,8,7,3,9,5,7,9,8,2,9,5],[3,9,8],[7,1,4,9,7,4,5,9],[3,3,3],[9,0,7,8],[3,9,4,7,2,7,8,0,3,0],[8,2,2,7,3,9,3,2],[2,9,0,8,5,4,1,8,5,5,6,2,0,9,2,7,7,9,2,7],[3,6],[1,2,7,7,4,4,2,9]],[[9,8],[8],[5,8,2],[7],[5,1],[4],[2],[0,0,6],[0],[8,4,2],[6,4],[2],[3],[7,8],[7,3],[9],[5,7,9],[8,2],[9,5],[3],[9,8],[7,1,4],[9,7],[4,5,9],[3,3],[3],[9,0],[7,8],[3],[9],[4],[7,2],[7,8],[0],[3,0],[8,2],[2],[7,3],[9,3],[2],[2],[9],[0],[8,5,4],[1,8],[5,5],[6],[2,0],[9],[2],[7,7,9],[2,7],[3,6],[1,2],[7,7],[4,4,2],[9]]] ]; dump=l=>l.map(x=>'['+x+']').join(','); out('YES'); OK.forEach(l=>out(f(l[0],l[1])+' a['+dump(l[0])+'] b['+dump(l[1])+']')); out('NO'); KO.forEach(l=>out(f(l[0],l[1])+' a['+dump(l[0])+'] b['+dump(l[1])+']')); <pre id=O></pre> • One of these days I'm going to have to download Firefox to see your awesome solutions in action. :) Jun 15 '15 at 15:22 • @AlexA. how can you live without it? Jun 15 '15 at 15:28 • Use repl.it , I think that supports ES6 :D Jun 16 '15 at 13:50 • I like how you named the variables OK and KO. – rr- Jun 17 '15 at 17:20 # C, 69 75 A function with 2 string parameters, returning 0 or 1. Parameter format: sublist separated with spaces (' '), list elements separated with commas. Example: "1,0,9 1,3,8" "1,0 9,1,3,8" f(char*a,char*b){for(;*a-44?*a&&*b==*a:*b<48;a++)b++;return!(*b|*a);} Less golfed int f(char *a, char *b) { // expected in a,b: digit,separator,digit... with separator being ' ' or ',' for(; *a; a++,b++) // ' ' or digit in a must be the same in b // comma in a must be comma or space in b if (*a != ',' ? *b != *a : *b > *a) return 0; return !*b; // must have a null in *b too } Test Ideone (outdated) • Clever choice of input format. I've borrowed it for another Haskell answer. – nimi Jun 15 '15 at 23:27 • I ripped off your idea for input for my JS answer, and it turned out to be one byte longer than your C version until I upgraded it to ES6... Who'd have expected that... Jun 16 '15 at 13:45 []#[]=1<2 [x]#[y]=x==y x@(a:b)#(c:d:e)|a==c=b#(d:e)|1<2=x#((c++d):e) _#_=2<1 Returns True or False. Example usage: [[1,0,9],[1,3,8]] # [[1,0],[9]] -> False. Simple recursive approach: if the first elements match, go on with the tails, else start over but concatenate the two elements at the front of the second list. Base cases are: both lists empty -> True; both lists with a single element -> compare them; only one list empty -> False. # CJam, 19 bytes q~]{_,,\f>:sS.+}/-! Try it online. ### I/O Input [[1 0 9] [1 3 8]] [[1] [0 9] [1 3] [8]] Output 1 ### Idea Each partition can be uniquely identified by observing the following two properties: • The list formed by concatenating all sublists. • The "cutting points", including the extremes of the list. We can combine both criteria into one by replacing each cutting point with the sublist of elements from the cutting point to the end of the list. To verify that a given partition is finer than another, we only have to verify if the coarser partition, represented as above, is a subset of the finer one and that the largest lists of both partitions match. ### Code q~] e# Read from STDIN and evaluate. { e# For each array P from the input: _,, e# Push [0 ... L], where L == length(P) - 1. \f> e# Push [P[0:] ... P[L]]. :s e# Stringify each P[k:] (flattens). S.+ e# Vectorized concatenation. This appends a space to the first element. }/ e# -! e# Push the logical NOT of the difference A-B to check if A is a subset of B. For the input form the I/O example, the stack holds ["109138 " "138"] ["109138 " "09138" "138" "8"] before executing -!. Note that the first element of each array has a trailing space. This makes sure we compare the full list of the first input with the full list of the second. # CJam, 24 bytes l~L\{+_a2$1<={;1>L}&}/+! Algorithm Here we simply use a greedy algorithm to see if first N sub-lists of the second list can be merged together to form the first sub-list of the first list. Once such N is found, we remove the first N sub-lists from second list and the first sub-list from the first list and repeat the process. Ideally, if the second list was a refinement of the first, we should be left with 2 empty lists on stack. We just check for that and print 1 if that is the case. In any other combination, after fully iterating over sub-lists of second list, we won't end up with 2 empty lists. Thus a 0 will be printed for such cases. Code expansion l~L\{+_a2$1<={;1>L}&}/+! l~L\ e# Read the line, evaluate the two lists and put an empty list e# between them { }/ e# Iterate over all sub-lists of the second list + e# Append the current sub-list to whatever is on stack. Originally e# an empty array, but eventually the sum of first N sub-lists _a e# Copy this and wrap it in an array 2$e# Copy the first list on top of stack 1< e# Get only its first element wrapped in an array. This approach e# is exception safe in case the array was already 0 length ={ }& e# If we have a match, remove both first sub-lists ; e# Remove the first N sub-lists array 1> e# Remove the first element from the first array L e# Put an empty array on stack to repeat the process +! e# If we are left with two empty arrays, sum them and do logical e# not to get 1. If any of the arrays is non-empty, logical not e# gives 0 # C, 120 114 bytes #define C(x),x+=(*x/93)*(1+!!x[1])|1 o;R(char*s,char*t){for(o=1;*s;o&=*s==t[2*(*t==93&&93>*s)]C(s)C(t));return o;} I haven't golfed much recently, so I thought I'd try this one out. We define a function R(char* s, char* t) which returns 1 if t is a refined partition of s, and 0 otherwise. s and t are expected to be in the format [DDDD...][DDDD...]... Where each D is another single-digit element. Testing code: #include "stdio.h" int main(int argc, char** argv) { char* str1, *str2; str1 = "[109][138]"; str2 = "[1][09][13][8]"; printf("Input: %s, %s --> %d\n", str1, str2, R(str1, str2)); str1 = "[109][138]"; str2 = "[1][19][13][8]"; printf("Input: %s, %s --> %d\n", str1, str2, R(str1, str2)); str1 = "[109][138]"; str2 = "[10][91][3][8]"; printf("Input: %s, %s --> %d\n", str1, str2, R(str1, str2)); } The above prints the following: Input: [109][138], [1][09][13][8] --> 1 Input: [109][138], [1][19][13][8] --> 0 Input: [109][138], [10][91][3][8] --> 0 It seems to work, at least. • 109 bytes Sep 21 '20 at 23:12 # Haskell, 5250 53 bytes x#y=and$zipWith(\a b->a==b||a==',')(x++"..")(y++"..") Completely different from my other solution. Uses the same clever input format as @edc65's answer, i.e. elements are separated with , and lists with . Usage example: "1,0,9,1,3,8" # "1,0,9 1,3,8" -> True. The second parameter is a refinement of the first, if they have either equal elements at every position or the first one is ,. I have to append a unique end token (->..) to both parameters, because zipWith truncates the longer parameter and for example "1,2,3" # "1,2" would also be True. • (\a b->a==b||a>b) is just (>=). Jun 16 '15 at 5:33 • wouldn't adding just "." instead of ".." work too? Jun 16 '15 at 11:27 • this fails on "2"#"1" because the functions only checks if the values are bigger, not equal Jun 16 '15 at 11:33 • @alephalpha: oh dear, how stupid of me to overlook that. But it is wrong anyway. See other comments. – nimi Jun 16 '15 at 14:52 • @proudhaskeller: damn last minute edits. Yes, this is a bug. Fixed it. Thanks for finding out. BTW, a single dot "."won't work, because it would give a false positive for "2,1" # "2" which would first expand to "2,1." # "2." and then be truncated by zipWith to "2," # "2.". A comma in the first string matches everything. – nimi Jun 16 '15 at 14:58 # Mathematica, 65 bytes f@__=1<0;{}~f~{}=1>0;{a_,b___}~f~{c__,d___}/;a==Join@c:={b}~f~{d} • Nice solution. FYI, I've got a 59-byte solution that doesn't use recursion (or multiple definitions). Jun 16 '15 at 7:51 Maths with regular expressions is fun! (a,b)=>RegExp('^'+a.replace(/,/g,'[ ,]')+'$').test(b) # Vintage Javascript, 70 chars function f(a,b){return RegExp('^'+a.replace(/,/g,'[ ,]')+'$').test(b) Uses the same input format as edc65's answer. Full demo including all test cases here. • Clever! Never thought about regular expressions for this task. Jun 16 '15 at 14:19 • I wrote a perl program that factorised integers using a recursive function that found prime factors using a backtracking regular expression... They aren't pretty and definitely aren't fast, but they can do some cool stuff! Jun 16 '15 at 14:21 • I also wrote a parser generator, which converts a language specification into a regular expression, and that regular expression can then be used to parse expressions in the specified language. Basically, "compiling" a human-readable language spec to an "executable" regular-expression. github.com/battlesnake/d-slap The generated regular expression for parsing AngularJS comprehension expressions is about 400-500 characters long... Jun 16 '15 at 14:22 # Mathematica, 55 bytes Equal@@Join@@@#&&SubsetQ@@(Accumulate[Length/@#]&)/@##& This defines an unnamed function, taking the two partitions in a single list, in reverse order (i.e. Y first, X second). ## Explanation Equal@@Join@@@# This checks that both partitions are actually partitions of the same list. SubsetQ@@(Accumulate[Length/@#]&)/@## This is a golfed form of my approach in this question over on Mathematica.SE, which inspired this challenge. Basically, a partition is defined as a number of indices where splits are inserted, and this checks that all the splitting positions in X also appear in Y by accumulating the lengths of the sublists. # Python 2, 68 51 bytes Thanks to xnor for some considerable byte-savings! Anonymous function that takes two strings of the form "1,0,9 1,3,8" (taken from edc65's C answer) and returns True or False. New version with map(None) no longer works in Python 3. lambda a,b:all(i in[j,","]for i,j in map(None,a,b)) Test suite: >>> def runTests(f): assert f("1,0,9 1,3,8","1 0,9 1,3 8") assert not f("1,0,9 1,3,8","1,0 9,1 3,8") assert f("1 0,9 1,3 8","1 0,9 1,3 8") assert not f("1 0,9 1,3 8","1,0,9 1,3,8") assert not f("1 0,9 1,3 8","1 0,9 1,3") assert not f("1 0,9 1,3,8","1 0,9 1,3") print("All tests pass.") >>> runTests(lambda a,b:all(i in[j,","]for i,j in map(None,a,b))) All tests pass. Previous 92-byte solution that takes input as "109 138": def R(a,b): r=1 for i in b.split():r&=a.find(i)==0;a=a[len(i):].strip() return r and""==a • I think you can avoid doing an explicit length check by mapping None. The case when one list is longer than another is rejected where one list has None but the other index has a number, since i==j or"0">i>j cannot hold. – xnor Jun 16 '15 at 7:50 • Unless I'm missing something, the second test can just be i==','. This lets you combine the tests as i in[',',j] (we can't do i in ','+j) because j might be None. – xnor Jun 16 '15 at 8:00 • @xnor Wow, thanks. #1 didn't occur to me because I'm pretty used to thinking in Python 3 now; #2 didn't occur to me because "what if b has a number at that spot?" ... forgetting that with this input format, that's not possible. Jun 20 '15 at 1:41 # Jelly, 7 5 bytes O_/²Ƒ Try it online! This implements Dennis' string-based algorithm, with a slight modification to the input format. Sublists are separated by - and from each other by , (e.g. [[1], [0, 9], [1, 3], [8]] -> 1,0-9,1-3,8). If this is too much of a stretch, Dennis' input format is 9 bytes A pure array based method comes out at 10 6 bytes. ŒbF€€i Try it online! This takes inputs reversed (i.e. X on the right and Y on the left), and outputs a non-zero integer for truthy and zero for falsey. It's 2 bytes longer (ŒbF€€iɗ@) to take input the normal way around. This does time out on TIO for the 2 longest inputs however. ## How they work The 5 byter is simply an adaptation of of Dennis' CJam answer into Jelly: O_/²Ƒ - Main link. Take the pair [X, Y] on the left O - Convert everything to ordinals _/ - Element-wise subtraction - This results in: - A list entirely containing 0s and 1s for truthy outputs - A list consisting of at least one non-0 or 1 element for falsey outputs ²Ƒ - All elements are unchanged when squaring, i.e. all elements are 1 or 0 The 7 byter works as follows: ŒbF€€i - Main link. Takes Y on the left and X on the right Œb - Generate all partitions of Y, yielding [[]] if Y is empty € - Over each: F€ - Flatten each sub-partition - This has the effect of generating all possible concatenations of Y i - Index of X in these concatenations, or 0 if not found
2022-01-23 15:50: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.41113388538360596, "perplexity": 1989.2749189244}, "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/1642320304287.0/warc/CC-MAIN-20220123141754-20220123171754-00387.warc.gz"}
https://www.semanticscholar.org/paper/Magic-Knight's-Tours-in-Higher-Dimensions-Kumar/75e8a083e85e21855735c1964cf6992c89f8c107
• Corpus ID: 200294 # Magic Knight's Tours in Higher Dimensions @article{Kumar2012MagicKT, title={Magic Knight's Tours in Higher Dimensions}, author={Awani Kumar}, journal={ArXiv}, year={2012}, volume={abs/1201.0458} } A knight's tour on a board is a sequence of knight moves that visits each square exactly once. A knight's tour on a square board is called magic knight's tour if the sum of the numbers in each row and column is the same (magic constant). Knight's tour in higher dimensions (n > 3) is a new topic in the age-old world of knight's tours. In this paper, it has been proved that there can't be magic knight's tour or closed knight's tour in an odd order n-dimensional hypercube. 3 \times 4 \times 2n-2… 4 Citations ## Figures from this paper ### The Closed Knight Tour Problem in Higher Dimensions • Mathematics Electron. J. Comb. • 2012 The solution of existence of closed knight tours for rectangular chessboards for rectangular boards for n-dimensional rectangular boards is given. ### REDUCING THE CLOCKWISE-ALGORITHM TO k LENGTH CLASSES • Marco Ripà • Computer Science Journal of Fundamental Mathematics and Applications (JFMA) • 2021 An optimization problem related to the extension in k-dimensions of the well known 3x3 points problem by Sam Loyd is considered, thanks to a variation of the so called “clockwise-algorithm”, it is shown how it is possible to visit all the 3^k points of the k-dimensional grid given by the Cartesian product of (0, 1, 2). ### Commutator, spectral analysis and application We present the theory of positive commutator and its recent improvements. We discuss applications to the spectral analysis of magnetic Laplacians on manifolds, singular Dirac operators, and slowly ## References SHOWING 1-10 OF 27 REFERENCES ### Which Chessboards have a Closed Knight's Tour within the Cube? In this paper necessary and sufficient conditions for the existence of a closed knight's tour for the cube are proven. ### Which Chessboards have a Closed Knight's Tour within the Rectangular Prism? • Mathematics Electron. J. Comb. • 2011 In honor of the upcoming twentieth anniversary of the publication of Schwenk's paper, this article extends his result by classifying thei\times j\times k\$ rectangular prisms that admit a closed knight's tour. ### Mathematics and Chess. A magic square of dimension п-Ъу-п is a square divided into n2 congruent cells in which numbers are placed in such a way that the sums of the numbers in all rows and columns, as well as both ### Which Rectangular Chessboards Have a Knight's Tour? (1991). Which Rectangular Chessboards Have a Knight's Tour? Mathematics Magazine: Vol. 64, No. 5, pp. 325-332. ### A History of Chess Have you ever played chess? Did you know that chess is the oldest skill game in the world? Chess can tell you a great deal about the way people lived in medieval times. If you look at the way a ### The Fourth Dimension Simply Explained THERE are few fallacies which have done more to mislead the unscientific public than the misconception known as the fourth dimension. The use of this term is calculated to convey the false ### Wonders of Numbers: Adventures in Mathematics, Mind, and Meaning Who were the five strangest mathematicians in history? What are the ten most interesting numbers? Jam-packed with thought-provoking mathematical mysteries, puzzles, and games, Wonders of Numbers will ### Hyperspace: A Scientific Odyssey Through Parallel Universes, Time Warps, and the Tenth Dimension Looking for professional reading resources? We have hyperspace a scientific odyssey through parallel universes time warps and the tenth dimension to read, not only check out, however also download ### Extra Dimensions • Physics • 2001 For explanation of terms used and discussion of significant model dependence of following limits, see the " Extra Dimensions Review. " Limits are expressed in conventions of of Giudice, Rattazzi, and
2022-09-27 05:00: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.5178887844085693, "perplexity": 2062.6750508695577}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.3, "absolute_threshold": 20, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2022-40/segments/1664030334987.39/warc/CC-MAIN-20220927033539-20220927063539-00323.warc.gz"}
https://www.physicsforums.com/threads/work-question-pulling-a-chain-on-the-moon.902356/
# Work Question (Pulling a chain on the Moon) 1. Feb 1, 2017 ### Arman777 1. The problem statement, all variables and given/known data At a lunar base,a uniform chain hangs over the edge of a horizontal platform.A machine does $1.0J$ of work in pulling the rest of the chain onto the platform.The chain has a mass of $2.0 kg$ and a length of $3.0m$.What lenght was initally hanging over the edge ? On the moon,the gravitational acceleraiton is $\frac 1 6$ of $9,8 \frac {m} {s^2}$ 2. Relevant equations $ρ_{chain}=M/L$ $W_g=-ΔU_g$ 3. The attempt at a solution Lets suppose $L_1$ lenght is needed to pull. So chain density will be $ρ=\frac {2kg} {3m}=0.66\frac {kg} {m}$ The mass of $L_1$ is$L_1ρ=M_1$ The gravitational work on $M_1$ is $W_g$ which its $-M_1gL_1=1J$ $(L_!)^2ρg=6J$ which $L_1=1.05m$ but the answer is $1.4m$ Theres a "-" sign which makes me uncomfortable.Also I am making wrong at some point 2. Feb 1, 2017 ### Staff: Mentor Hint: If the length hanging over the edge is L, does every bit of the mass have to pulled up a height L? Also, the work is done by some force pulling the chain up, so its sign would be +. (It's work against gravity, not by gravity.) 3. Feb 1, 2017 ### Arman777 Here what I did $(M_1dm)g(L1-dl)=W-dw$ dw is zero and $(M_1-dm)=(L_1-dl)p$ Is this true ? yeah thats right but the work done by gravity on the chain is negative .The work done by machine to the chain is positive.Thats why I confused 4. Feb 2, 2017 ### Staff: Mentor Not quite sure what you're doing here. Are you trying to set up an integral? Hint: If some extended object changed height, what point on the object would you track to compute its change in gravitational PE? The work done by the machine equals the change in gravitational PE; both are positive. 5. Feb 2, 2017 ### Arman777 yep I see now I was...If the lengh decreases a bit what would be happen Ok let me try again 6. Feb 2, 2017 ### Arman777 I found 1.36m by usig this equation $(L_1)^2ρg=12J$ Is it true ? 7. Feb 2, 2017 ### Staff: Mentor Don't just toss out an equation; show how you got the equation. Consider a mass element dm of the hanging section of the chain. If the length hanging is L, what is the average distance that each mass element must be lifted to get to the platform? 8. Feb 2, 2017 ### Arman777 $M_1a_gH=1J$ $H=\frac {L_1} {2}$; The center of mass of $M_1$ moves this much. $M_1=L_1ρ$ so, $(L_1)ρ\frac {g} {6}\frac {L_1} {2}=1J$ 9. Feb 2, 2017 ### Staff: Mentor Perfect! 10. Feb 2, 2017 ### Arman777 Average distance will be $\frac {L_1} {2}$ $∫\frac {L_1} {2}dmg=1J$ from 0 to M and so This is true I am sure but If I wanted to convert it to $dl$ , $dm=dlρ$ so ; $∫\frac {L_1} {2}gρdl$ from 0 to $L_1p$ ? Last edited: Feb 2, 2017 11. Feb 2, 2017 ### Staff: Mentor Once you use the center of mass there's no need to integrate. But if you do, you'll get the same answer. 12. Feb 2, 2017 ### Arman777 Oh ok thank you
2018-03-25 00:22: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.5316829681396484, "perplexity": 1968.6354906906029}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2018-13/segments/1521257651465.90/warc/CC-MAIN-20180324225928-20180325005928-00720.warc.gz"}
http://mscroggs.co.uk/blog/56
mscroggs.co.uk mscroggs.co.uk subscribe # Blog ## World Cup stickers 2018, pt. 3 2018-07-07 So you've calculated how much you should expect the World Cup sticker book to cost and recorded how much it actually cost. You might be wondering what else you can do with your sticker book. If so, look no further: this post contains 5 mathematical things involvolving your sticker book and stickers. Stickers 354 and 369: Alisson and Roberto Firmino In a group of 23 people, there is a more than 50% chance that two of them will share a birthday. This is often called the birthday paradox, as the number 23 is surprisingly small. Back in 2014 when Alex Bellos suggested testing the birthday paradox on World Cup squads, as there are 23 players in a World Cup squad. I recently discovered that even further back in 2012, James Grime made a video about the birthday paradox in football games, using the players on both teams plus the referee to make 23 people. In this year's sticker book, each player's date of birth is given above their name, so you can use your sticker book to test it out yourself. One of the cities in which games are taking place in this World Cup is Kaliningrad. Before 1945, Kaliningrad was called Königsberg. In Königsburg, there were seven bridges connecting four islands. The arrangement of these bridges is shown below. The people of Königsburg would try to walk around the city in a route that crossed each bridge exactly one. If you've not tried this puzzle before, try to find such a route now before reading on... In 1736, mathematician Leonhard Euler proved that it is in fact impossible to find such a route. He realised that for such a route to exist, you need to be able to pair up the bridges on each island so that you can enter the island on one of each pair and leave on the other. The islands in Königsburg all have an odd number of bridges, so there cannot be a route crossing each bridge only once. In Kaliningrad, however, there are eight bridges: two of the original bridges were destroyed during World War II, and three more have been built. Because of this, it's now possible to walk around the city crossing each bridge exactly once. A route around Kaliningrad crossing each bridge exactly once. I wrote more about this puzzle, and using similar ideas to find the shortest possible route to complete a level of Pac-Man, in this blog post. ### Sorting algorithms If you didn't convince many of your friends to join you in collecting stickers, you'll have lots of swaps. You can use these to practice performing your favourite sorting algorithms. #### Bubble sort In the bubble sort, you work from left to right comparing pairs of stickers. If the stickers are in the wrong order, you swap them. After a few passes along the line of stickers, they will be in order. Bubble sort #### Insertion sort In the insertion sort, you take the next sticker in the line and insert it into its correct position in the list. Insertion sort #### Quick sort In the quick sort, you pick the middle sticker of the group and put the other stickers on the correct side of it. You then repeat the process with the smaller groups of stickers you have just formed. Quick sort ### The football Sticker 007: The official ball Sticker 007 shows the official tournament ball. If you look closely (click to enlarge), you can see that the ball is made of a mixture of pentagons and hexagons. The ball is not made of only hexagons, as road signs in the UK show. Stand up mathematician Matt Parker started a petition to get the symbol on the signs changed, but the idea was rejected. If you have a swap of sticker 007, why not stick it to a letter to your MP about the incorrect signs as an example of what an actual football looks like. ### Psychic pets Speaking of Matt Parker, during this World Cup, he's looking for psychic pets that are able to predict World Cup results. Why not use your swaps to label two pieces of food that your pet can choose between to predict the results of the remaining matches? Timber using my swaps to wrongly predict the first match ### Similar posts World Cup stickers 2018, pt. 2 World Cup stickers 2018 World Cup stickers Euro 2016 stickers Comments in green were written by me. Comments in blue were not written by me. 2019-06-19 @Matthew: Thank you for the calculations. Good job I ordered the stickers I wanted #IRN. 2453 stickers - that's more than the number you bought (1781) to collect all stickers! 2019-05-29 @Milad: Here is how I calculated it: You want a specific set of 20 stickers. Imagine you have already $$n$$ of these. The probability that the next sticker you buy is one that you want is $$\frac{20-n}{682}.$$ The probability that the second sticker you buy is the next new sticker is $$\mathbb{P}(\text{next sticker is not wanted})\times\mathbb{P}(\text{sticker after next is wanted})$$ $$=\frac{662+n}{682}\times\frac{20-n}{682}.$$ Following the same method, we can see that the probability that the $$i$$th sticker you buy is the next wanted sticker is $$\left(\frac{662+n}{682}\right)^{i-1}\times\frac{20-n}{682}.$$ Using this, we can calculate the expected number of stickers you will need to buy until you find the next wanted one: $$\sum_{i=1}^{\infty}i \left(\frac{20-n}{682}\right) \left(\frac{662+n}{682}\right)^{i-1} = \frac{682}{20-n}$$ Therefore, to get all 682 stickers, you should expect to buy $$\sum_{n=0}^{19}\frac{682}{20-n} = 2453 \text{ stickers}.$$ Matthew 2019-05-16 @Matthew: Yes, I would like to know how you work it out please. I believe I have left my email address in my comment. It seems like a lot of stickers if you are just interested in one team. 2019-03-08 @Milad: Following a similiar method to this blog post, I reckon you'd expect to buy 2453 stickers (491 packs) to get a fixed set of 20 stickers. Drop me an email if you want me to explain how I worked this out. Matthew 2019-03-07 Thanks for the maths, but I have one probability question. How many packs would I have to buy, on average, to obtain a fixed set of 20 stickers?
2019-11-17 02:07: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": 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.2428649365901947, "perplexity": 820.8740641360597}, "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/1573496668782.15/warc/CC-MAIN-20191117014405-20191117042405-00435.warc.gz"}
https://nrich.maths.org/2649/note
Number Detective Follow the clues to find the mystery number. Six Is the Sum What do the digits in the number fifteen add up to? How many other numbers have digits with the same total but no zeros? ABC In the multiplication calculation, some of the digits have been replaced by letters and others by asterisks. Can you reconstruct the original multiplication? One Million to Seven One Million to Seven Start by putting one million ($1 000 000$) into the display of your calculator. If you can see this message Flash may not be working in your browser Please see http://nrich.maths.org/techhelp/#flash to enable it. Can you reduce this to $7$ using just these six buttons - the $7$ key and add, subtract, multiply, divide and equals as many times as you like? What is the shortest way can you find to do it? Why do this problem? While tackling this problem, children will be applying knowledge of place value and developing a trial and improvement approach. This is an activity that looks very formidable, but, in reality, is not as difficult as it looks. Possible approach It can be done on a computer using the interactivity but can be done equally well on a classroom calculator. Key questions How many zeros in a million? Which buttons are you allowed to use? Have you tried using $77$ and $777$? How could you keep track of what you have done? Can you find another way of doing it? Possible extension After they have found at least four ways of doing this, learners could try Two and two or even the Stage 3 problem Arrange the digits. Possible support Suggest using a simple calculator and experimenting quietly to see what happens or doing this two digit activity.
2018-05-20 17:48: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": 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.32593584060668945, "perplexity": 1078.3450570099753}, "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-2018-22/segments/1526794863662.15/warc/CC-MAIN-20180520170536-20180520190536-00470.warc.gz"}
https://tex.stackexchange.com/questions/247945/can-i-get-the-effect-of-halign-to-hsize-using-a-latex-tabular-environment
# Can I get the effect of \halign to \hsize using a LaTeX tabular environment? I'd like to get the effect of doing \halign to \hsize ... while retaining all the convenience of LaTeX's tabular environment. The particular problem I am trying to solve is to use \tabskip to set a bunch of (nested) tables to the same width in a column type of p{width}. But if possible, I would like to set the inner table using \begin{tabular} and all its conveniences, rather than have to go for the raw \halign. Possible? (Related question: In nested tables, how can I make an inner table stretch to fit its column?) • \begin{tabular*}{\hsize} is exactly that (and \extracolsep to set \tabskip) – David Carlisle May 31 '15 at 22:19 \begin{tabular*}{\hsize}{@{\extracolsep{\fill}}cc@{}}
2020-04-04 12:29: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": 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.9256953597068787, "perplexity": 1681.982195374834}, "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-16/segments/1585370521876.48/warc/CC-MAIN-20200404103932-20200404133932-00559.warc.gz"}
https://federatedscope.io/docs/improve-hpo/
Accelerating Federated HPO In essence, hyperparameter optimization (HPO) is a trial-and-error procedure, where each trial often means an entire training course and then evaluation. Under the federated learning (FL) setting, each FL training course consists of hundereds of communication rounds, which makes it unaffordable to conduct such trials again and again. Hence, FederatedScope has provided functionalities to conduct low-fidelity HPO, which allows users to trade evaluation precision for efficiency. Achieving low-fidelity HPO under the federated learning setting We encourage users to try low-fidelity HPO with our provided toy example: python federatedscope/hpo.py --cfg federatedscope/example_configs/toy_hpo.yaml hpo.scheduler sha hpo.sha.budgets [1,3,9] where Successive Halving Algorithm (SHA) [2] is employed as our HPO scheduler. At first, the number of initial candidates is determined by: #initial candidates = elimination rate ** #elimination rounds, where, in this example, hpo.sha.elim_round_num=3 and hpo.sha.elim_rate=3. Thus, the scheduler begins with 3**3=27 initial candidate configurations randomly sampled from the declared search space. As we have introduced in the primary HPO tutorial, SHA iteratively filters the maintained candidates round-by-round untill only one configuration remaining. According to the settings for elimination rate, the number of elimination rounds, and the budgets (i.e., hpo.sha.budgets), the scheduler proceeds as follow: • 1st iteration: Each of the 27 candidates will be trained for 1 round. • 2nd iteration: Each of the 9 candidates outstanding from last iteration will be trained for 3 rounds • 3rd iteration: Each of the 3 candidates outstanding from last iteration will be trained for 9 rounds As your can see, by controlling the resource allocation (here the assigned number of training rounds), the winning configuratioin enjoys the most resource—$1+3+9=13$ training rounds, while we didn’t waste much resource on those poor configurations. The total resource consumed is $27 \times 1 + 9 \times 3 + 3 \times 9 = 81$ training rounds. In contrast, the SHA example presented in our primary HPO tutorial has not specified the budget and consumes $(27 + 9 + 3) \times 20 = 780$ training rounds. Although insufficient training rounds may lead to configuration rankings that are less correlated with the ground-truth rankings, training round provides us an aspect to control the fidelity to trade-off between accuracy and efficiency. The eventual results of the above example are as follow: where the test loss cannot be minimized as small as that of the SHA example presented in our primary HPO tutorial. However, the goal of HPO is to determine the hyperparameters. In this sense, this SHA example with low-fidelity has attained the same decisions as that example, while consuming much less resource. Another aspect that enables to control the fidelity is the ratio of clients sampled in each training round. FederatedScope allows users to specify either the sample rate (via federate.sample_client_rate) or the number of sampled client (via federate.sample_client_num), with the former prioritized. If none of them has been set, all clients would be involved in each training round. Empirical study We evaluate the effectiveness of SHA with low-fidelity on a case where graph convolutional network (GCN) is to be trained on the citation network Cora. In this experiment, we use the same setting as the above example, and thus there are 81 training rounds in total can be consumed. For the purpose of comparison, we adopt random search (RS) algorithm [4] as our baselines, where sample size of 81, 27, and 9 are considered, with training rounds per trial 1, 3, and 9, respectively. We show the corresponding performances of their searched hyperparameters in the following table: Scheduler Test accuracy (%) SHA 88.83 RS (81-1) 88.51 RS (27-3) 88.67 RS (9-9) 88.67 where SHA with the given allocation outperforms all RS settings. As we sequentially simulate each trial, the HPO procedure can be visualized by plotting the best test accuracy achieved up to the latest trial: Users can easily reproduce this HPO experiment by executing: python federatedscope/hpo.py --cfg federatedscope/example_configs/hpo_for_gnn.yaml Furthermore, we present an empirical comparison for different fidelities considered in optimizing the hyperparameters of GCN and GPR-GNN, respectively. Again, we employ SHA as our scheduler and controll the fidelity by considering: • Training rounds for each trial in {1, 2, 4, 8}; • Client sampling rate in {20%, 40%, 80%, 100%}. With different combinations of the them, we conduct HPO with different fideilities, which might result in different optimal hyperparameters. As we have construct the ground-truth rankings, the accuracy of each combination can be measured by the rank of its resulting optimal hyperparameters. We illustrate the results in the following two figures: GCN GPR-GNN where, as expected, higher fidelity leads to better configuration for both kinds of graph neural network models. At first, we want to remind our readers that the left-upper region in each grid table corresponds to extremely low-fidelity HPO. Although their performances cannot be comparable to those in the other regions, they have successfully eliminated a considerable fraction of poor configurations. Meanwhile, increasing fidelity through the two aspects, i.e., client sampling rate and the number of training rounds, reveal comparable efficiency in improving the quality of searched configurations. This property provides valuable flexibility for practitioners to keep a fixed fidelity while trade-off between these two aspects according to their system status (e.g., network latency and how the dragger behaves) [3]. Weight-sharing and personalized HPO In general, the hyperparameters of an FL algorithm can be classified into two categories: • Server-side: The hyperparameters impact the aggregation, e.g., the learning rate of server’s optimizer in FedOPT [5]. • Client-side: The hyperparameters impact the local updates, e.g., the local update steps, the batch size, the learning rate, etc. In traditional standalone machine learning, only one specific configuration can be evaluated in each trial. When we consider an FL training course, since there are often more than one clients sampled in each round, it is possible to let different sampled clients explore different client-side configurations. From the perspective of multi-arm bandit, the agent (i.e., the HPO scheduler) can interact with many bandits under the FL setting, as the following figure shows. To utilize this idea, FexEx [1] makes an analogy to the weight-sharing trick widely adopted in one-shot neural architecture search (NAS). Roughly speaking, one-shot NAS regards all candidate operators as an super-graph, evaluates a sampled subgraph at each step, and updates the controller (i.e., sampler) according to the feedback. In analogy, we could design a controller to sample configuration and, at each round, independently sample the client-side configuration for each client. FederatedScope has provided flexible interfaces to instantiate such an idea into Federated HPO algorithm (more details can be found at this post). For instance, implementing FedEx can be sketched as the following steps: 1. To inherit the base server class and integrate your implementation of the controller into the server; 2. To augment the parameter broadcast method, including the sampled client-side configuration in the message; 3. To inherit the base client class and extend the handler—initializing the local model with received parameters and reset hyperparameters by the received choices; 4. To extend the handler of server, that is, updating the controller w.r.t. received performances. We will provide an implementation of FedEx later, and we encourage users to contribute more latest federated HPO algorithms to FederatedScope. It is worth noting that the bandits sampled in each round are different due to the non-i.i.d.ness of client-wise data distributions. Thus, a promising future direction is to explore the personalization functionalities to achieve personalized HPO. References [1] Khodak, Mikhail, et al. “Federated hyperparameter tuning: Challenges, baselines, and connections to weight-sharing.” Advances in Neural Information Processing Systems 34 (2021). [2] Li, Lisha, et al. “Hyperband: A novel bandit-based approach to hyperparameter optimization.” The Journal of Machine Learning Research 18.1 (2017): 6765-6816. [3] Zhang, Huanle, et al. “Automatic Tuning of Federated Learning Hyper-Parameters from System Perspective.” arXiv preprint arXiv:2110.03061 (2021). [4] Bergstra, James, and Yoshua Bengio. “Random search for hyper-parameter optimization.” Journal of machine learning research 13.2 (2012). [5] Asad, Muhammad, Ahmed Moustafa, and Takayuki Ito. “FedOpt: Towards communication efficiency and privacy preservation in federated learning.” Applied Sciences 10.8 (2020): 2864. Updated:
2023-03-23 14:47:13
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 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.5441516041755676, "perplexity": 2687.988899279578}, "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-2023-14/segments/1679296945168.36/warc/CC-MAIN-20230323132026-20230323162026-00022.warc.gz"}
http://math.stackexchange.com/questions/179847/a-question-on-the-lindel%c3%b6f-property-and-the-stone-%c4%8cech-compactification
# A question on the Lindelöf property and the Stone–Čech compactification This question is from a paper I'm reading. I cannot understand this sentence in the poof of Theorem 1. It says: Suppose $X$ is not Lindelöf. Then there exists a compactum $C\subset \beta X \setminus X$ such that any $G_\delta$-set in $\beta X$ containing $C$ meets $X$. ($X$ is Tychonoff.) Could anybody help me understand this sentence? Thanks ahead:) See the paper by Raushan Z. Buzyakova, On absolutely submetrizable spaces, Comment. Math. Univ. Carolin. 47, 3 (2006) 483–490. Also available at DML-CZ. - What paper is this from? –  Arthur Fischer Aug 7 '12 at 9:31 What do you mean by "understanding this sentence"? Is there a problem with understanding the statement itself or only its proof? –  t.b. Aug 7 '12 at 9:32 @ArthurFischer See the link in the question:) –  Paul Aug 7 '12 at 9:40 @t.b. Thanks for your link and your kindful reminding. The problem is the statement itself. –  Paul Aug 7 '12 at 9:42 I think that there should be a comma after Lindelöf. Other than that, all I can do is paraphrase the statement, hoping that this helps. Suppose $X$ is not Lindelöf. In particular, $X$ is not compact. Since $X$ is Tychonoff, $X$ has a Stone-Cech compactification $\beta X$. As usual, we consider $X$ to be a subset of $\beta X$ and can now form the Stone-Cech remainder $\beta X\setminus X$. The remainder is nonempty since $X$ is not compact. Now the claim is the following: There is a compact set $C\subseteq\beta X\setminus X$ with the following property: For all $G_\delta$-sets $A\subseteq\beta X$ with $C\subseteq A$, $A\cap X\not=\emptyset$. A $G_\delta$-set is an intersection of countably many open sets. I hope this clarifies something. You can get this compact set as follows: Let $\mathcal U$ be an open cover of $X$ without a countable subcover. This is possible since $X$ is not Lindelöf. We can assume that the $U\in\mathcal U$ are actually open subsets of $\beta X$ so that no countable subcollection of $\mathcal U$ covers $X$. $\mathcal U$ is not a cover of $\beta X$ since in this case, by compactness of $\beta X$, finitely many elements of $\mathcal U$ would already cover $\beta X$ and in particular $X$. It follows that the compact set $C=\beta X\setminus\bigcup\mathcal U$ is nonempty. Let $A$ be a $G_\delta$ subset of $\beta X$ with $C\subseteq A$. Since $A$ is $G_\delta$, $\beta X\setminus A$ is the union of a countable family $\mathcal B$ of closed sets. Each $B\in\mathcal B$ is compact and disjoint from $C$. Since $C=\beta X\setminus\bigcup\mathcal U$, each $B\in\mathcal B$ is covered by $\mathcal U$ and hence by finitely many elements of $\mathcal U$. It follows that $\bigcup\mathcal B$ is covered by countably many elements of $\mathcal U$. But $X$ is not covered by countably many elements of $U$. It follows that there is $x\in X\setminus\bigcup\mathcal B=A\cap X$. So $A$ meets $X$. This finishes the proof. - Thanks stefan for your answer. I will take some time to take it up. –  Paul Aug 7 '12 at 10:27 Your answer is very clear for me and very helpful. One thing I don't understand what is why we can assume that the $U\in \mathcal{U}$ are actually open subsets of $\beta X$? Because $X$ is open in $\beta X$? –  Paul Aug 8 '12 at 11:26 Sorry that this was not clear. Start with an open cover $\mathcal U$ of $X$. Here $\mathcal U$ is a family of open subsets of $X$. Now embed $X$ into $\beta X$. Since $X$ is a subspace of $\beta X$, for every open subset set $U$ of $X$ there is an open subset $V$ of $\beta X$ such that $V\cap X=U$. It follows that we can "blow up" each $U\in\mathcal U$ to an open subset of $\beta X$ whose intersection with $X$ is just $U$. Now I have a family of open subsets of $\beta X$ whose union contains $X$. I call this family also an open cover of $X$. –  Stefan Geschke Aug 8 '12 at 14:41 Now I see. It is abtained by "blow up". Thanks again. –  Paul Aug 9 '12 at 11:50
2015-05-30 19:20:48
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9452096223831177, "perplexity": 110.84451754035767}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 5, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2015-22/segments/1432207932596.84/warc/CC-MAIN-20150521113212-00164-ip-10-180-206-219.ec2.internal.warc.gz"}
https://www.jason-chadwick.com/projects/quops/
Quantum computing Ph.D. student University of Chicago CV Github ORCiD Quops: a board game inspired by quantum mechanics back to home # Quops: a board game inspired by quantum mechanics Quops (short for “quantum operations”) is a board game where the board and cards are based on the rules of quantum mechanics. The goal is simple: If you are player 0, get the values of all the tiles as close to 0 as possible. If you are player 1, get them as close to 1 as possible. Each player has a hand of 5 cards, some of which affect a single tile and some of which affect two tiles. One-tile cards cannot be played on tiles entirely owned by your opponent, and two-tile cards must have one tile that is not completely owned by the opponent. On each turn, a player may use up to 3 cards, then draw back up to 5 at the end of their turn. Tiles are hexagonal (six neighbors), and two-tile cards can only be played on neighboring tiles. Mathematically, a board of n tiles is described by the superposition of bit vectors $$[b_0, b_1, ... b_k]$$ where $$k=2^n$$. Player 0’s goal is to make the most probable state become $$\ket{00...0}$$ while Player 1’s goal is to make it become $$\ket{11...1}$$. This entire game could be described using quantum mechanics and matrices (and it is, in the code) - the only thing that the hexagonal board design decides is what possible unitary manipulations are allowed on the bits. In the backend, gameplay creates a quantum computer circuit step by step. In theory, this game could be physically implemented on a quantum computer, with each tile being a qubit. ### Gameplay example Tile numbering: 13 15 18 11 4 6 17 9 2 0 5 16 8 1 3 14 7 10 12 Gameplay: GAME START Board: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.5 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 _______________________________________________ Player 0's turn. Hand: 0. CNOT 1. X 2. CH 3. SWAP 4. H Choose a card to play: 0 Target A: 6 Target B: 5 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.5 0.0 1.0 <-- tile 5 was flipped 1.0 1.0 1.0 1.0 because tile 6 is 1 1.0 1.0 1.0 _______________________________________________ ... ...(Player 0 makes 2 more moves) ... _______________________________________________ Player 1's turn. Hand: 0. CH 1. SWAP 2. CH 3. CNOT 4. CNOT Choose a card to play: 0 Target A: 8 Target B: 9 0.0 0.0 0.0 0.0 0.0 0.0 0.0 H gate --> 0.5 0.0 0.5 0.0 1.0 applied to 1.0 1.0 1.0 1.0 1.0 1.0 1.0 _______________________________________________ ... ...Player 1 makes 2 more moves ... _______________________________________________ Player 0's turn... ### Qudits What about more than 2 players (more than 2 possible states per tile)? In quantum computing, “qubits” with more than 2 states are known as qudits. $$n$$ qudits that each have $$d$$ states can represent $$d^n$$ total possible “board-states” (ex: 2 qudits with 3 states each can represent the following 8 states: $$\ket{01}, \ket{02}, \ket{10}, \ket{11}, \ket{12}, \ket{20}, \ket{21}, \ket{22}$$). This game could be implemented using qutrits to allow for 3 players to play together, with each player aiming to get all qutrits into a different expected state. ### TODO • allow for operations to be inserted earlier in the program - i.e. have multiple “layers” of the board, and you can choose which layer to put an operation onto • in-game tutorial/info on each of the cards • in-game explanation of the basics of QC - make it accessible! • work on game balancing (game currently works, but isn’t very fun) • make an android/iOS/web app in unity! • singleplayer puzzle campaign (slowly introduce different gates) • online multiplayer?? • AI offline opponent • different board types corresponding to different quantum architectures (different connectivities and native gates) • transmon: nearest-neighbor, CNOT • neutral atom: interaction radius, CZ, can’t place a gate within a certain radius of the previously-placed gate (if on the same layer) • trapped ion: all-to-all, MS gate (maybe this is too complex?) back to home
2023-03-23 23:36: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": 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.2899504005908966, "perplexity": 1865.9763097269497}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 20, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2023-14/segments/1679296945218.30/warc/CC-MAIN-20230323225049-20230324015049-00469.warc.gz"}
http://mathhelpforum.com/calculus/203890-why-can-i-ignore-monotonic-function.html
# Thread: Why can I ignore a monotonic function? 1. ## Why can I ignore a monotonic function? I am attempting to tackle a problem in a computer science course which involves taking a limit. I had gotten a piece of advice but I'm not quit sure about some of the details and I was hoping someone could give me some clarification. The problem is... Prove the is $n\sqrt{\log{n}}$ is $\omega(\sqrt{n}\log{n})$ My book says that it comes down to showing that $\lim_{x \to \infty} \frac{f(n)}{g(n)}} = \infty$ So I have to find $\lim_{x \to \infty} \sqrt{\frac{n}{\log{n}}}}}$ I'm told that this is equivalent to finding $\lim_{x \to \infty} \frac{n}{\log{n}}}}$ since the square root is monotonic. I can use L'Hopital's rule and show that the limit converges to infinity. I do understand why the square root function is monotonic but I don't understand why I'm allowed to disregard the affect of the square root on the function. Could someone explain why? 2. ## Re: Why can I ignore a monotonic function? The important thing is not that $\sqrt{n}$ is monotonic, but that it tends to infinity as n -> ∞. For example, h(n) = 1 - 1 / n = (n - 1) / n is also monotonic for n > 0, but h(n / log(n)) = 1 - log(n) / n -> 1 as n -> ∞. Here h(n) -> 1 as n -> ∞ instead of h(n) -> ∞. On the other hand, h(n) = 2sin(n) + n is not monotonic, but h(n / log(n)) -> ∞. Can you prove that if j(n) -> ∞ and h(n) -> ∞ as n -> ∞, then h(j(n)) -> ∞ as n -> ∞? 3. ## Re: Why can I ignore a monotonic function? Originally Posted by restin84 I am attempting to tackle a problem in a computer science course which involves taking a limit. I had gotten a piece of advice but I'm not quit sure about some of the details and I was hoping someone could give me some clarification. The problem is... Prove the is $n\sqrt{\log{n}}$ is $\omega(\sqrt{n}\log{n})$ My book says that it comes down to showing that $\lim_{x \to \infty} \frac{f(n)}{g(n)}} = \infty$ So I have to find $\lim_{x \to \infty} \sqrt{\frac{n}{\log{n}}}}}$ I'm told that this is equivalent to finding $\lim_{x \to \infty} \frac{n}{\log{n}}}}$ since the square root is monotonic. I can use L'Hopital's rule and show that the limit converges to infinity. I do understand why the square root function is monotonic but I don't understand why I'm allowed to disregard the affect of the square root on the function. Will you please review what you posted. You explain nothing about the notation you are using. What is the actual question? What does $\omega(\sqrt{n}\log{n})$ mean? 4. ## Re: Why can I ignore a monotonic function? I suspect that was supposed to be what some of use would have called " $\theta$" or " $\Theta$" or "O"- f is "O(g)" if and only if f(x)/g(x) goes to 1 as x goes to some limit such as infinity. Saying that $x\sqrt{ln(x)}\epsilon \sqrt{x}ln(x)$ means that $\lim_{x\to\infty}\frac{x \sqrt{ln(x}}{\sqrt{x}ln(x)}= \frac{x}{\sqrt{x}}\frac{\sqrt{ln(x)}}{ln(x)}= \sqrt{\frac{\sqrt{x}}{ln(x)}}$ goes to 1 as x goes to infinity. Of course, since the square root function is continuous for x positive, that will be true as long as $\lim_{x\to 0}\frac{\sqrt{x}}{ln(x)}= 1$. And that can be shown by, for example, L'Hopital's rule. 5. ## Re: Why can I ignore a monotonic function? Originally Posted by Plato What is the actual question? I think the OP is asking why $\lim_{x \to \infty} \frac{n}{\log{n}}}}=\infty$ implies $\lim_{x \to \infty} \sqrt{\frac{n}{\log{n}}}}}=\infty$. Originally Posted by Plato What does $\omega(\sqrt{n}\log{n})$ mean? This is not really relevant to the question (because the problem reduces to proving $\lim_{n\to\infty}\frac{n\sqrt{\log n}}{\sqrt{n}\log n}=\infty$), but apparently this is one of the asymptotic notations. 6. ## Re: Why can I ignore a monotonic function? Originally Posted by HallsofIvy Saying that $x\sqrt{ln(x)}\epsilon \sqrt{x}ln(x)$ means that $\lim_{x\to\infty}\frac{x \sqrt{ln(x}}{\sqrt{x}ln(x)}= \frac{x}{\sqrt{x}}\frac{\sqrt{ln(x)}}{ln(x)}= \sqrt{\frac{\sqrt{x}}{ln(x)}}$ goes to 1 as x goes to infinity. Of course, since the square root function is continuous for x positive, that will be true as long as $\lim_{x\to 0}\frac{\sqrt{x}}{ln(x)}= 1$. And that can be shown by, for example, L'Hopital's rule. Of course, neither $\lim_{x\to 0}\frac{\sqrt{x}}{\ln(x)}$ nor $\lim_{x\to \infty}\frac{\sqrt{x}}{\ln(x)}$ equals 1 (and it should say $\lim_{x\to \infty}\frac{x}{\log(x)}$). And none of big-O, big-Θ, and small-ω notations involve a limit that equals 1. 7. ## Re: Why can I ignore a monotonic function? Originally Posted by emakarov I think the OP is asking why $\lim_{x \to \infty} \frac{n}{\log{n}}}}=\infty$ implies $\lim_{x \to \infty} \sqrt{\frac{n}{\log{n}}}}}=\infty$. This is not really relevant to the question (because the problem reduces to proving $\lim_{n\to\infty}\frac{n\sqrt{\log n}}{\sqrt{n}\log n}=\infty$), but apparently this is one of the asymptotic notations. Why are we expected to make a guess as to what is meant? 8. ## Re: Why can I ignore a monotonic function? Originally Posted by Plato Why are we expected to make a guess as to what is meant? I feel the same way about some questions on this site, but in this case I think the question was pretty clear. 9. ## Re: Why can I ignore a monotonic function? Originally Posted by emakarov Can you prove that if j(n) -> ∞ and h(n) -> ∞ as n -> ∞, then h(j(n)) -> ∞ as n -> ∞? I was trying to find some information I could use in order to prove the above statement. I'm not really sure where to start. 10. ## Re: Why can I ignore a monotonic function? Originally Posted by restin84 I was trying to find some information I could use in order to prove the above statement. I'm not really sure where to start. You need prove that for every M > 0 there exists an N such that for every n > N it is the case that h(j(n)) > M. Fix an arbitrary M. Since h(n) -> ∞ as n -> ∞, there exists a K such that n > K implies h(n) > M. Now you need to guarantee that j(n) > K from some point onward. This would mean that h(j(n)) > M. Can you do this? 11. ## Re: Why can I ignore a monotonic function? Originally Posted by emakarov You need prove that for every M > 0 there exists an N such that for every n > N it is the case that h(j(n)) > M. Fix an arbitrary M. Since h(n) -> ∞ as n -> ∞, there exists a K such that n > K implies h(n) > M. Now you need to guarantee that j(n) > K from some point onward. This would mean that h(j(n)) > M. Can you do this? Honestly no. I've been reading it over for the last fifteen minutes now. I can't really get any kind of "mental picture" I guess. 12. ## Re: Why can I ignore a monotonic function? The fact that j(n) > K from some point onward, i.e. that there exists an N such that n > N implies j(n) > K, follows by definition from the fact that j(n) -> ∞ as n -> ∞. Verify that h(j(n)) > M for n > N.
2017-09-21 10:46: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": 30, "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.9130834341049194, "perplexity": 373.9573198359283}, "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-39/segments/1505818687740.4/warc/CC-MAIN-20170921101029-20170921121029-00428.warc.gz"}
https://www.nag.com/numeric/nl/nagdoc_27/flhtml/g10/g10zaf.html
# NAG FL Interfaceg10zaf (data_​order) ## 1Purpose g10zaf orders and weights data which is entered unsequentially, weighted or unweighted. ## 2Specification Fortran Interface Subroutine g10zaf ( n, x, y, wt, nord, xord, yord, rss, iwrk, Integer, Intent (In) :: n Integer, Intent (Inout) :: ifail Integer, Intent (Out) :: nord, iwrk(n) Real (Kind=nag_wp), Intent (In) :: x(n), y(n), wt(*) Real (Kind=nag_wp), Intent (Out) :: xord(n), yord(n), wtord(n), rss Character (1), Intent (In) :: weight #include <nag.h> void g10zaf_ (const char *weight, const Integer *n, const double x[], const double y[], const double wt[], Integer *nord, double xord[], double yord[], double wtord[], double *rss, Integer iwrk[], Integer *ifail, const Charlen length_weight) The routine may be called by the names g10zaf or nagf_smooth_data_order. ## 3Description Given a set of observations $\left({x}_{i},{y}_{i}\right)$, for $i=1,2,\dots ,n$, with corresponding weights ${w}_{i}$, g10zaf rearranges the observations so that the ${x}_{i}$ are in ascending order. For any equal ${x}_{i}$ in the ordered set, say ${x}_{j}={x}_{j+1}=\cdots ={x}_{j+k}$, a single observation ${x}_{j}$ is returned with a corresponding ${y}^{\prime }$ and ${w}^{\prime }$, calculated as $w′=∑l=0kwi+l$ and $y′=∑l= 0kwi+lyi+l w′ .$ Observations with zero weight are ignored. If no weights are supplied by you, then unit weights are assumed; that is ${w}_{\mathit{i}}=1$, for $\mathit{i}=1,2,\dots ,n$. In addition, the within group sum of squares is computed for the tied observations using West's algorithm (see West (1979)). ## 4References Draper N R and Smith H (1985) Applied Regression Analysis (2nd Edition) Wiley West D H D (1979) Updating mean and variance estimates: An improved method Comm. ACM 22 532–555 ## 5Arguments 1: $\mathbf{weight}$Character(1) Input On entry: indicates whether user-defined weights are to be used. • If ${\mathbf{weight}}=\text{'W'}$, user-defined weights are to be used and must be supplied in wt. • If ${\mathbf{weight}}=\text{'U'}$, the data is treated as unweighted. Constraint: ${\mathbf{weight}}=\text{'W'}$ or $\text{'U'}$. 2: $\mathbf{n}$Integer Input On entry: $n$, the number of observations. Constraint: ${\mathbf{n}}\ge 1$. 3: $\mathbf{x}\left({\mathbf{n}}\right)$Real (Kind=nag_wp) array Input On entry: the values, ${x}_{\mathit{i}}$, for $\mathit{i}=1,2,\dots ,n$. 4: $\mathbf{y}\left({\mathbf{n}}\right)$Real (Kind=nag_wp) array Input On entry: the values ${y}_{\mathit{i}}$, for $\mathit{i}=1,2,\dots ,n$. 5: $\mathbf{wt}\left(*\right)$Real (Kind=nag_wp) array Input Note: the dimension of the array wt must be at least ${\mathbf{n}}$ if ${\mathbf{weight}}=\text{'W'}$. On entry: if ${\mathbf{weight}}=\text{'W'}$, wt must contain the $n$ weights. Otherwise wt is not referenced and unit weights are assumed. Constraints: • if ${\mathbf{weight}}=\text{'W'}$, ${\mathbf{wt}}\left(\mathit{i}\right)\ge 0.0$, for $\mathit{i}=1,2,\dots ,n$; • if ${\mathbf{weight}}=\text{'W'}$, ${\sum }_{i=1}^{n}{\mathbf{wt}}\left(i\right)>0$. 6: $\mathbf{nord}$Integer Output On exit: the number of distinct observations. 7: $\mathbf{xord}\left({\mathbf{n}}\right)$Real (Kind=nag_wp) array Output On exit: the first nord elements contain the ordered and distinct ${x}_{i}$. 8: $\mathbf{yord}\left({\mathbf{n}}\right)$Real (Kind=nag_wp) array Output On exit: the first nord elements contain the values ${y}^{\prime }$ corresponding to the values in xord. 9: $\mathbf{wtord}\left({\mathbf{n}}\right)$Real (Kind=nag_wp) array Output On exit: the first nord elements contain the values ${w}^{\prime }$ corresponding to the values of xord and yord. 10: $\mathbf{rss}$Real (Kind=nag_wp) Output On exit: the within group sum of squares for tied observations. 11: $\mathbf{iwrk}\left({\mathbf{n}}\right)$Integer array Workspace 12: $\mathbf{ifail}$Integer Input/Output On entry: ifail must be set to $0$, . If you are unfamiliar with this argument you should refer to Section 4 in the Introduction to the NAG Library FL Interface for details. For environments where it might be inappropriate to halt program execution when an error is detected, the value is recommended. If the output of error messages is undesirable, then the value $1$ is recommended. Otherwise, if you are not familiar with this argument, the recommended value is $0$. When the value is used it is essential to test the value of ifail on exit. On exit: ${\mathbf{ifail}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6). ## 6Error Indicators and Warnings If on entry ${\mathbf{ifail}}=0$ or $-1$, explanatory error messages are output on the current error message unit (as defined by x04aaf). Errors or warnings detected by the routine: ${\mathbf{ifail}}=1$ On entry, ${\mathbf{n}}=〈\mathit{\text{value}}〉$. Constraint: ${\mathbf{n}}\ge 1$. On entry, ${\mathbf{weight}}=〈\mathit{\text{value}}〉$. Constraint: ${\mathbf{weight}}=\text{'W'}$ or $\text{'U'}$. ${\mathbf{ifail}}=2$ On entry, all weights are zero. On entry, $i=〈\mathit{\text{value}}〉$ and ${\mathbf{wt}}\left(i\right)=〈\mathit{\text{value}}〉$. Constraint: ${\mathbf{wt}}\left(i\right)\ge 0.0$. ${\mathbf{ifail}}=-99$ See Section 7 in the Introduction to the NAG Library FL Interface for further information. ${\mathbf{ifail}}=-399$ Your licence key may have expired or may not have been installed correctly. See Section 8 in the Introduction to the NAG Library FL Interface for further information. ${\mathbf{ifail}}=-999$ Dynamic memory allocation failed. See Section 9 in the Introduction to the NAG Library FL Interface for further information. ## 7Accuracy For a discussion on the accuracy of the algorithm for computing mean and variance see West (1979). ## 8Parallelism and Performance g10zaf is not threaded in any implementation. g10zaf may be used to compute the pure error sum of squares in simple linear regression along with g02daf; see Draper and Smith (1985). ## 10Example A set of unweighted observations are input and g10zaf used to produce a set of strictly increasing weighted observations. ### 10.1Program Text Program Text (g10zafe.f90) ### 10.2Program Data Program Data (g10zafe.d) ### 10.3Program Results Program Results (g10zafe.r)
2021-07-28 08:08:45
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 66, "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.9298490285873413, "perplexity": 5438.367609709852}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 20, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-31/segments/1627046153531.10/warc/CC-MAIN-20210728060744-20210728090744-00680.warc.gz"}
http://www.scoopskiller.com/management-materials/the-sale-price-of-an-article-including-the-sales-tax-is-rs-616/
# The sale price of an article including the sales tax is Rs. 616. The rate of sales tax is 10%. If the shopkeeper has made a profit of 12%, then the cost price of the article is $\par&space;S.P.&space;=&space;Rs.$ $\left(\frac{616&space;\times&space;100}{110}\right)&space;=$  $\par&space;Rs.&space;560$ $\par&space;C.P.&space;=&space;Rs.$ $\left(\frac{100}{112}\times&space;560\right)&space;=$  $\par&space;Rs.&space;500$
2019-02-15 18:38: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": 0, "img_math": 0, "codecogs_latex": 6, "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.2104213535785675, "perplexity": 422.3333733567152}, "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-09/segments/1550247479101.30/warc/CC-MAIN-20190215183319-20190215205319-00220.warc.gz"}
http://iera.name/forums/topic/query-using-mode-in-r/
# [QUERY] Using Mode in R? Tagged: Viewing 5 posts - 1 through 5 (of 5 total) • Author Posts • #3129 Lekshman Participant For calculation of mean and median we have built-in functions in R. But for mode calculations we do not have any built-in function. I had googled and found a piece of code ( code attached below) that can be used to find mode, however, it has a lot of limitations. does anyone know any other easier way to calculate mode in R? like a packadge installation. Thanks in advance. #3130 Lekshman Participant This is the Code i found on the net, But the limitation of the below code is that, CalMode(1:5) gives 1 and CalMode(5:1) gives 5 so when all the numbers have same freq, the code fails. Mode <- function(x) { ux <- unique(x) ux[which.max(tabulate(match(x, ux)))] } #3209 Changyue Song Keymaster try Mode = function(x) { tab = table(x) md = which(tab == max(tab)) return(as.numeric(names(md))) } #3240 William Schmitz Participant I am trying to find the mode in R for a homework assignment (ISyE 412).  By inspection, I see that the data in the vector is trimodal.  This data vector is small.  I tried the above suggested method from the post as well as the website https://www.tutorialspoint.com/r/r_mean_median_mode.htm.  This yielded only one answer. My question is: how do we get bimodal and trimodal results when using R?  With very large data sets, the above method may be problematic. I appreciate any suggestions? #3243 Wenjun Zhu Participant Reply to William Schmitz of #3240: When the data set is small, we can also try in a shorter and simpler way: table(x)[table(x)==max(table(x))] When the data set is very large, we can apply MapReduce and Hadoop in R. Attached below are my personal points. Hope can help you! ###### Attachments: You must be logged in to view attached files. Viewing 5 posts - 1 through 5 (of 5 total) You must be logged in to reply to this topic. Share this post • • • •
2020-04-08 08:29:30
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 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.2673270106315613, "perplexity": 1736.063271647779}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.3, "absolute_threshold": 10, "end_threshold": 15, "enable": false}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2020-16/segments/1585371810807.81/warc/CC-MAIN-20200408072713-20200408103213-00356.warc.gz"}
https://mathforcs.io/Computing-Fibonacci-numbers-using-Dynamic-Programming,-Matrices-and-Eigenvalues-in-O(logn)/
# Computing Fibonacci Numbers Using Dynamic Programming, Matrices And Eigenvalues In O(logn) The Fibonacci numbers are one of the most well studied recurrence relations in history. It’s also one of the coolest ways to get kids interested in math. The Fibonacci sequence is the following, Informally, the next term of the sequence is the sum of the last two terms in the sequence. More formally, suppose $f_n$ is the nth Fibonacci numnber and $f_0 = 0$ and $f_1 = 1$, then There are a few ways to go about computing this number. Let us start easy and discuss the most intuitive way of going about computing this number. The naive way to computing the nth Fibonacci number is the following, $% $ß The above algorithm does deliver the correct solution. However, the time complexity is $O(2^n)$, which is quite terrible. The number of subproblems grows exponentially. In the above image, I’ve indicated the same subproblems computed by the same color. $f(n-3)$ is represented in green and is computed thrice. At the second step, we need to compute 2 subproblems. At the third step, it becomes 8 subproblems. More generally, at the $i$th step, we need to compute $2^i$ subproblems. The total time complexity is the sum of the work done (time complexity) at all levels. A more clever implementation is the following which takes only $O(n)$ time. The second algorithm trumps the first by not recomputing a Fibonacci number more than once. This is done by storing solutions to the smaller subproblems first and using it to compute solutions to bigger problems. This is an example of dynamic programming. The next approach we will look at is how to compute the nth Fibonacci number using linear algebra. Specifically, we will look at the ideas of eigenvalues and eigenvectors for our problem and show how we can compute $f_n$ in $O(\log n)$. ## Using Linear Algebra for Fibonacci Let $f_i$ be the $i^{\text{th}}$ term of the sequence and let $f_0 = 0, f_1 = 1$. Let us consider a linear map $\mathcal{L} : \mathbb{N} \rightarrow \mathbb{N}$ such that Suppose we plug in $y = f_{n-1}$ and $x = f_{n-2}$, we get that We also get that We can show that Every linear map induces a matrix representation and vice versa. Let $\mathcal{M}$ be this matrix. From some calculations, one can find that Just like how $\mathcal{L}^{n-1}(f_1,f_0) = (f_n,f_{n-1})$, we get One way to go about it is compute $\mathcal{M}^{n-1}$ in a clever way. Suppose $n - 1$ is a power of two, then we would first find $\mathcal{M}^2$, multiply it with itself upon which we get $\mathcal{M}^4$ and we repeat the process. We get the sequence of matrices, Since our matrix $\mathcal{M}$ is has dimension $2 \times 2$, multiplying two matrices of that dimension costs $O(1)$ operations. We would have to carry out $O(\log n)$ multiplications that each take $O(1)$ cost to compute $\mathcal{M}^{n-1}$. Suppose $n-1$ is not a power of two, our algorithm can still be tweaked and it would still run in $O(\log n)$. These is another way to arrive at a closed form formula for the Fibonacci number using the ideas of eigenvalues and eigenvectors. I’m going to give an extremely short introduction to the topic. I’ll make a more detailed posts later on about eigenvalues and eigenvectors. Given a matrix $\mathcal{P}$, a vector $v$ is an eigenvector and $\lambda$ is an eigenvalue corresponding to $v$ if Since our matrix $\mathcal{M}$ has full rank (rank is two), there are two non-zero eigenvalues $\lambda_1$ and $\lambda_2$. Let $(v_1, \lambda_1)$ and $(v_2, \lambda_2)$ be the corresponding eigenvector and eigenvalue pairs of $\mathcal{M}$ such that $\mathcal{M}v_1 = \lambda_1v_1$ and $\mathcal{M}v_2 = \lambda_2v_2$. From some calculation, we can find that Suppose we do the following, The matrix $\mathcal{Q}$ is full rank, hence its inverse must certainly exist. We will call this inverse $\mathcal{Q}^{-1}$. The following is $\mathcal{Q}^{-1}$. You can verify if $\mathcal{QQ}^{-1}$ is the identity matrix. We can finally show We will also use another fact about diagonal matrices. Although we have used this fact for a diagonal matrix of size 2, using induction it is fairly straightforward to show it is true for a diagonal matrix of any dimension. Using the above fact, we have shown We have shown that The value $\varphi = \frac{1 + \sqrt{5}}{2}$ is called the golden ratio and tends to show up in many places. We can also write $f_n$ as The main bottle neck using this approach is computing the value of $\varphi^n$ and $(1 - \varphi)^n$ which can done in $O(\log n)$ using the same doubling power technique we used to compute $\mathcal{M}^{n-1}$. Warning: We have made a few very strong assumptions here to say we can compute it in $O(\log n)$. One of the core assumptions is computing the product of two numbers in $O(1)$. As you can see with the closed form of Fibonacci which we derived, the numbers tend to have exponential growth. In reality, multiplying large numbers cannot be in $O(1)$. For instance, we assumed that we could multiply $\varphi^{n/2} \times \varphi^{n/2}$ to get $\varphi^n$ in $O(1)$ operations. Representing $\varphi^{n/2}$ on a real computer would take $\Omega(n \log \varphi)$ bits and multiplying it should take at least that, showing the cost of multiplication is $\omega(1)$. Written on September 4, 2019
2019-09-24 08:39:08
{"extraction_info": {"found_math": true, "script_math_tex": 62, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 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.9126518964767456, "perplexity": 158.62767178224283}, "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/1568514572896.15/warc/CC-MAIN-20190924083200-20190924105200-00285.warc.gz"}
https://tex.stackexchange.com/questions/252273/what-is-this-font-called
# What is this font called? [duplicate] What is the font in this figure and how to produce it using latex? The font is surrounded by red circles. • Excuse me, but how I am supposed to find the font in this link? @HenriMenke – drzbir Jun 25 '15 at 21:33 • The document is not well typeset, as it mixes math in Computer Modern with Times New Roman. I guess that the letters you want have been obtained by \mathsf{supp}. – egreg Jun 25 '15 at 21:35 • @5.r.a - You don't have a pdf or ps file from the figure above by chance? – Arash Esbati Jun 25 '15 at 21:36 • @5.r.a The link is not intended to point you to the correct font, but rather to teach you how to look it up. This question might also help you: How do I find out what fonts are used in a document/picture? – Henri Menke Jun 25 '15 at 21:44 • @5.r.a - The circled fonts looks like Computer Modern Sans Serif. – Hbar Jun 25 '15 at 21:44 The font is Computer Modern Sans. The document is not particularly well typeset, as it mixes Computer Modern math with Times New Roman for text, which should never be done. I can reproduce the output with the following input, apart from the line length: \documentclass[a4paper]{article} \usepackage{times} \begin{document} A $k\times n$ matrix $G$ is said to \emph{fit} another $k\times n$ matrix $M$ if $\mathsf{supp}(G_i)\subseteq\mathsf{supp}(M_i)$ for all $i\in[k]$. Moreover if $M$ is a binary matrix and $\mathsf{supp}(G_i)=\mathsf{supp}(M_i)$ for all $i\in[k]$ then $M$ is called the \emph{support matrix} of $G$, denoted $\mathsf{supp}(G)$. \end{document} So the font is the one obtained with \mathsf and, since \usepackage{times} doesn't change the math fonts, it's Computer Modern Sans. You get better results if you do \usepackage{mathptmx}: \documentclass[a4paper]{article} \usepackage{mathptmx} \usepackage{amsmath} \DeclareMathOperator{\supp}{\mathsf{supp}} \begin{document} A $k\times n$ matrix $G$ is said to \emph{fit} another $k\times n$ matrix $M$ if $\supp(G_i)\subseteq\supp(M_i)$ for all $i\in[k]$. Moreover if $M$ is a binary matrix and $\mathsf{supp}(G_i)=\supp(M_i)$ for all $i\in[k]$ then $M$ is called the \emph{support matrix} of $G$, denoted $\supp(G)$. \end{document} Better yet, if you do \usepackage{newtxtext,newtxmath} instead of \usepackage{mathptmx}: However, in this case Helvetica is used. ### Requested comment Computer Modern (Roman and Math) and Times New Roman are visually incompatible with each other: the main reasons are the thickness of strokes and the form of the serifs. In math, the incompatibility is even stronger, because the letters take very different shapes. Compare the “k” and “n” in the first picture with the same letters in the second one, but also look at the first picture from a certain distance: the letters in math formulas are clearly much thinner than in text, which spoils the greyness of the page. On the other hand, Computer Modern Sans and Times are not “absolutely” incompatible: the mix between a serif and a sans serif typefaces is a question of personal taste, mainly. • A good answer, but it would be help if you explained why Computer Modern math shouldn't be mixed with Times New Roman for text. Mind you, it's completely unrelated to the question (but since you started this...). – user10274 Jun 25 '15 at 22:16 • @MarcvanDongen Just look at the weight of the strokes and the shapes of letters. – egreg Jun 25 '15 at 22:16 • Then please write that in the answer:) – user10274 Jun 25 '15 at 22:18 • @MarcvanDongen But typography guidelines are generally off-topic here, aren't they? I think it's fair enough to mention that the document is quite poorly typeset as an aside, or a warning or something, but to discuss typography as part of an answer seems to be drifting off topic, wouldn't you say? – Au101 Jun 25 '15 at 22:33 • @Au101 My main reason for asking is that I don't think it helps if you write don't mix $X$ and $Y$ because remembering all the $X$s and $Y$s that don't mix is virtually impossible. Explaining the underlying principle is much better. No more, no less. – user10274 Jun 26 '15 at 1:01 The font is Computer Modern Sans Serif, the sans-serif variant of the default Computer Modern. You can compare the characters for reference: \documentclass{article} \begin{document} \textsf{supp, gr, R, r} \end{document} It might be Latin Modern Sans Serif as well, a font derived from Computer Modern that I think is indistinguishable form Computer Modern in this case. • I agree with this possibility. – Bernard Jun 25 '15 at 21:55
2021-06-23 15:13:57
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 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.7364020347595215, "perplexity": 994.2097878266478}, "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-25/segments/1623488539480.67/warc/CC-MAIN-20210623134306-20210623164306-00524.warc.gz"}
http://mathhelpforum.com/advanced-applied-math/119732-dynamics-particle-rotating-wire.html
## Dynamics- A particle on a rotating wire A smooth straight wire rotates with constant angular speed w about the vertical axis through a fixed point O on the wire, and the angle between the wire and the upward vertical is constant and equal to a, a < pi/2. A bead is free to slide on the wire. Show that z(t), the height of the bead above O, satisfies the equation z'' - ((w^2)((sina)^2))z = -g(cosa)^2 This question has been troubling me for a while, I have tried writing the total force and then using the general equation for acceleration in polar coordinates to equate components and then eliminating the shared resistive force but I end up with a slightly different equation, after much double checking I still can't see where I'm going wrong, can anyone help?
2014-03-17 09:34:03
{"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.9547164440155029, "perplexity": 264.7467771806887}, "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/1394678705051/warc/CC-MAIN-20140313024505-00024-ip-10-183-142-35.ec2.internal.warc.gz"}
https://library.kiwix.org/wikipedia_en_top_maxi/A/Membrane_potential
# Membrane potential Membrane potential (also transmembrane potential or membrane voltage) is the difference in electric potential between the interior and the exterior of a biological cell. For the exterior of the cell, typical values of membrane potential, normally given in units of millivolts and denoted as mV, range from –40 mV to –80 mV. Differences in the concentrations of ions on opposite sides of a cellular membrane lead to a voltage called the membrane potential. Typical values of membrane potential are in the range –40 mV to –70 mV. Many ions have a concentration gradient across the membrane, including potassium (K+), which is at a high concentration inside and a low concentration outside the membrane. Sodium (Na+) and chloride (Cl) ions are at high concentrations in the extracellular region, and low concentrations in the intracellular regions. These concentration gradients provide the potential energy to drive the formation of the membrane potential. This voltage is established when the membrane has permeability to one or more ions. In the simplest case, illustrated here, if the membrane is selectively permeable to potassium, these positively charged ions can diffuse down the concentration gradient to the outside of the cell, leaving behind uncompensated negative charges. This separation of charges is what causes the membrane potential. Note that the system as a whole is electro-neutral. The uncompensated positive charges outside the cell, and the uncompensated negative charges inside the cell, physically line up on the membrane surface and attract each other across the lipid bilayer. Thus, the membrane potential is physically located only in the immediate vicinity of the membrane. It is the separation of these charges across the membrane that is the basis of the membrane voltage. This diagram is only an approximation of the ionic contributions to the membrane potential. Other ions including sodium, chloride, calcium, and others play a more minor role, even though they have strong concentration gradients, because they have more limited permeability than potassium. Key: Blue pentagons – sodium ions; Purple squares – potassium ions; Yellow circles – chloride ions; Orange rectangles – membrane-impermeable anions (these arise from a variety of sources including proteins). The large purple structure with an arrow represents a transmembrane potassium channel and the direction of net potassium movement. All animal cells are surrounded by a membrane composed of a lipid bilayer with proteins embedded in it. The membrane serves as both an insulator and a diffusion barrier to the movement of ions. Transmembrane proteins, also known as ion transporter or ion pump proteins, actively push ions across the membrane and establish concentration gradients across the membrane, and ion channels allow ions to move across the membrane down those concentration gradients. Ion pumps and ion channels are electrically equivalent to a set of batteries and resistors inserted in the membrane, and therefore create a voltage between the two sides of the membrane. Almost all plasma membranes have an electrical potential across them, with the inside usually negative with respect to the outside.[1] The membrane potential has two basic functions. First, it allows a cell to function as a battery, providing power to operate a variety of "molecular devices" embedded in the membrane.[2] Second, in electrically excitable cells such as neurons and muscle cells, it is used for transmitting signals between different parts of a cell. Signals are generated by opening or closing of ion channels at one point in the membrane, producing a local change in the membrane potential. This change in the electric field can be quickly affected by either adjacent or more distant ion channels in the membrane. Those ion channels can then open or close as a result of the potential change, reproducing the signal. In non-excitable cells, and in excitable cells in their baseline states, the membrane potential is held at a relatively stable value, called the resting potential. For neurons, typical values of the resting potential range from –70 to –80 millivolts; that is, the interior of a cell has a negative baseline voltage of a bit less than one-tenth of a volt. The opening and closing of ion channels can induce a departure from the resting potential. This is called a depolarization if the interior voltage becomes less negative (say from –70 mV to –60 mV), or a hyperpolarization if the interior voltage becomes more negative (say from –70 mV to –80 mV). In excitable cells, a sufficiently large depolarization can evoke an action potential, in which the membrane potential changes rapidly and significantly for a short time (on the order of 1 to 100 milliseconds), often reversing its polarity. Action potentials are generated by the activation of certain voltage-gated ion channels. In neurons, the factors that influence the membrane potential are diverse. They include numerous types of ion channels, some of which are chemically gated and some of which are voltage-gated. Because voltage-gated ion channels are controlled by the membrane potential, while the membrane potential itself is influenced by these same ion channels, feedback loops that allow for complex temporal dynamics arise, including oscillations and regenerative events such as action potentials. ## Physical basis The membrane potential in a cell derives ultimately from two factors: electrical force and diffusion. Electrical force arises from the mutual attraction between particles with opposite electrical charges (positive and negative) and the mutual repulsion between particles with the same type of charge (both positive or both negative). Diffusion arises from the statistical tendency of particles to redistribute from regions where they are highly concentrated to regions where the concentration is low. ### Voltage Electric field (arrows) and contours of constant voltage created by a pair of oppositely charged objects. The electric field is at right angles to the voltage contours, and the field is strongest where the spacing between contours is the smallest. Voltage, which is synonymous with difference in electrical potential, is the ability to drive an electric current across a resistance. Indeed, the simplest definition of a voltage is given by Ohm's law: V=IR, where V is voltage, I is current and R is resistance. If a voltage source such as a battery is placed in an electrical circuit, the higher the voltage of the source the greater the amount of current that it will drive across the available resistance. The functional significance of voltage lies only in potential differences between two points in a circuit. The idea of a voltage at a single point is meaningless. It is conventional in electronics to assign a voltage of zero to some arbitrarily chosen element of the circuit, and then assign voltages for other elements measured relative to that zero point. There is no significance in which element is chosen as the zero point—the function of a circuit depends only on the differences not on voltages per se. However, in most cases and by convention, the zero level is most often assigned to the portion of a circuit that is in contact with ground. The same principle applies to voltage in cell biology. In electrically active tissue, the potential difference between any two points can be measured by inserting an electrode at each point, for example one inside and one outside the cell, and connecting both electrodes to the leads of what is in essence a specialized voltmeter. By convention, the zero potential value is assigned to the outside of the cell and the sign of the potential difference between the outside and the inside is determined by the potential of the inside relative to the outside zero. In mathematical terms, the definition of voltage begins with the concept of an electric field E, a vector field assigning a magnitude and direction to each point in space. In many situations, the electric field is a conservative field, which means that it can be expressed as the gradient of a scalar function V, that is, E = –V. This scalar field V is referred to as the voltage distribution. Note that the definition allows for an arbitrary constant of integration—this is why absolute values of voltage are not meaningful. In general, electric fields can be treated as conservative only if magnetic fields do not significantly influence them, but this condition usually applies well to biological tissue. Because the electric field is the gradient of the voltage distribution, rapid changes in voltage within a small region imply a strong electric field; on the converse, if the voltage remains approximately the same over a large region, the electric fields in that region must be weak. A strong electric field, equivalent to a strong voltage gradient, implies that a strong force is exerted on any charged particles that lie within the region. ### Ions and the forces driving their motion Ions (pink circles) will flow across a membrane from the higher concentration to the lower concentration (down a concentration gradient), causing a current. However, this creates a voltage across the membrane that opposes the ions' motion. When this voltage reaches the equilibrium value, the two balance and the flow of ions stops.[3] Electrical signals within biological organisms are, in general, driven by ions.[4] The most important cations for the action potential are sodium (Na+) and potassium (K+).[5] Both of these are monovalent cations that carry a single positive charge. Action potentials can also involve calcium (Ca2+),[6] which is a divalent cation that carries a double positive charge. The chloride anion (Cl) plays a major role in the action potentials of some algae,[7] but plays a negligible role in the action potentials of most animals.[8] Ions cross the cell membrane under two influences: diffusion and electric fields. A simple example wherein two solutions—A and B—are separated by a porous barrier illustrates that diffusion will ensure that they will eventually mix into equal solutions. This mixing occurs because of the difference in their concentrations. The region with high concentration will diffuse out toward the region with low concentration. To extend the example, let solution A have 30 sodium ions and 30 chloride ions. Also, let solution B have only 20 sodium ions and 20 chloride ions. Assuming the barrier allows both types of ions to travel through it, then a steady state will be reached whereby both solutions have 25 sodium ions and 25 chloride ions. If, however, the porous barrier is selective to which ions are let through, then diffusion alone will not determine the resulting solution. Returning to the previous example, let's now construct a barrier that is permeable only to sodium ions. Now, only sodium is allowed to diffuse cross the barrier from its higher concentration in solution A to the lower concentration in solution B. This will result in a greater accumulation of sodium ions than chloride ions in solution B and a lesser number of sodium ions than chloride ions in solution A. This means that there is a net positive charge in solution B from the higher concentration of positively charged sodium ions than negatively charged chloride ions. Likewise, there is a net negative charge in solution A from the greater concentration of negative chloride ions than positive sodium ions. Since opposite charges attract and like charges repel, the ions are now also influenced by electrical fields as well as forces of diffusion. Therefore, positive sodium ions will be less likely to travel to the now-more-positive B solution and remain in the now-more-negative A solution. The point at which the forces of the electric fields completely counteract the force due to diffusion is called the equilibrium potential. At this point, the net flow of the specific ion (in this case sodium) is zero. ### Plasma membranes The cell membrane, also called the plasma membrane or plasmalemma, is a semipermeable lipid bilayer common to all living cells. It contains a variety of biological molecules, primarily proteins and lipids, which are involved in a vast array of cellular processes. Every cell is enclosed in a plasma membrane, which has the structure of a lipid bilayer with many types of large molecules embedded in it. Because it is made of lipid molecules, the plasma membrane intrinsically has a high electrical resistivity, in other words a low intrinsic permeability to ions. However, some of the molecules embedded in the membrane are capable either of actively transporting ions from one side of the membrane to the other or of providing channels through which they can move.[9] In electrical terminology, the plasma membrane functions as a combined resistor and capacitor. Resistance arises from the fact that the membrane impedes the movement of charges across it. Capacitance arises from the fact that the lipid bilayer is so thin that an accumulation of charged particles on one side gives rise to an electrical force that pulls oppositely charged particles toward the other side. The capacitance of the membrane is relatively unaffected by the molecules that are embedded in it, so it has a more or less invariant value estimated at about 2 μF/cm2 (the total capacitance of a patch of membrane is proportional to its area). The conductance of a pure lipid bilayer is so low, on the other hand, that in biological situations it is always dominated by the conductance of alternative pathways provided by embedded molecules. Thus, the capacitance of the membrane is more or less fixed, but the resistance is highly variable. The thickness of a plasma membrane is estimated to be about 7-8 nanometers. Because the membrane is so thin, it does not take a very large transmembrane voltage to create a strong electric field within it. Typical membrane potentials in animal cells are on the order of 100 millivolts (that is, one tenth of a volt), but calculations show that this generates an electric field close to the maximum that the membrane can sustain—it has been calculated that a voltage difference much larger than 200 millivolts could cause dielectric breakdown, that is, arcing across the membrane. ### Facilitated diffusion and transport Facilitated diffusion in cell membranes, showing ion channels and carrier proteins The resistance of a pure lipid bilayer to the passage of ions across it is very high, but structures embedded in the membrane can greatly enhance ion movement, either actively or passively, via mechanisms called facilitated transport and facilitated diffusion. The two types of structure that play the largest roles are ion channels and ion pumps, both usually formed from assemblages of protein molecules. Ion channels provide passageways through which ions can move. In most cases, an ion channel is permeable only to specific types of ions (for example, sodium and potassium but not chloride or calcium), and sometimes the permeability varies depending on the direction of ion movement. Ion pumps, also known as ion transporters or carrier proteins, actively transport specific types of ions from one side of the membrane to the other, sometimes using energy derived from metabolic processes to do so. ### Ion pumps The sodium-potassium pump uses energy derived from ATP to exchange sodium for potassium ions across the membrane. Ion pumps are integral membrane proteins that carry out active transport, i.e., use cellular energy (ATP) to "pump" the ions against their concentration gradient.[10] Such ion pumps take in ions from one side of the membrane (decreasing its concentration there) and release them on the other side (increasing its concentration there). The ion pump most relevant to the action potential is the sodium–potassium pump, which transports three sodium ions out of the cell and two potassium ions in.[11] As a consequence, the concentration of potassium ions K+ inside the neuron is roughly 20-fold larger than the outside concentration, whereas the sodium concentration outside is roughly ninefold larger than inside.[12][13] In a similar manner, other ions have different concentrations inside and outside the neuron, such as calcium, chloride and magnesium.[13] If the numbers of each type of ion were equal, the sodium–potassium pump would be electrically neutral, but, because of the three-for-two exchange, it gives a net movement of one positive charge from intracellular to extracellular for each cycle, thereby contributing to a positive voltage difference. The pump has three effects: (1) it makes the sodium concentration high in the extracellular space and low in the intracellular space; (2) it makes the potassium concentration high in the intracellular space and low in the extracellular space; (3) it gives the intracellular space a negative voltage with respect to the extracellular space. The sodium-potassium pump is relatively slow in operation. If a cell were initialized with equal concentrations of sodium and potassium everywhere, it would take hours for the pump to establish equilibrium. The pump operates constantly, but becomes progressively less efficient as the concentrations of sodium and potassium available for pumping are reduced. Ion pumps influence the action potential only by establishing the relative ratio of intracellular and extracellular ion concentrations. The action potential involves mainly the opening and closing of ion channels not ion pumps. If the ion pumps are turned off by removing their energy source, or by adding an inhibitor such as ouabain, the axon can still fire hundreds of thousands of action potentials before their amplitudes begin to decay significantly.[10] In particular, ion pumps play no significant role in the repolarization of the membrane after an action potential.[5] Another functionally important ion pump is the sodium-calcium exchanger. This pump operates in a conceptually similar way to the sodium-potassium pump, except that in each cycle it exchanges three Na+ from the extracellular space for one Ca++ from the intracellular space. Because the net flow of charge is inward, this pump runs "downhill", in effect, and therefore does not require any energy source except the membrane voltage. Its most important effect is to pump calcium outward—it also allows an inward flow of sodium, thereby counteracting the sodium-potassium pump, but, because overall sodium and potassium concentrations are much higher than calcium concentrations, this effect is relatively unimportant. The net result of the sodium-calcium exchanger is that in the resting state, intracellular calcium concentrations become very low. ### Ion channels Despite the small differences in their radii,[14] ions rarely go through the "wrong" channel. For example, sodium or calcium ions rarely pass through a potassium channel. Ion channels are integral membrane proteins with a pore through which ions can travel between extracellular space and cell interior. Most channels are specific (selective) for one ion; for example, most potassium channels are characterized by 1000:1 selectivity ratio for potassium over sodium, though potassium and sodium ions have the same charge and differ only slightly in their radius. The channel pore is typically so small that ions must pass through it in single-file order.[15] Channel pores can be either open or closed for ion passage, although a number of channels demonstrate various sub-conductance levels. When a channel is open, ions permeate through the channel pore down the transmembrane concentration gradient for that particular ion. Rate of ionic flow through the channel, i.e. single-channel current amplitude, is determined by the maximum channel conductance and electrochemical driving force for that ion, which is the difference between the instantaneous value of the membrane potential and the value of the reversal potential.[16] Depiction of the open potassium channel, with the potassium ion shown in purple in the middle, and hydrogen atoms omitted. When the channel is closed, the passage is blocked. A channel may have several different states (corresponding to different conformations of the protein), but each such state is either open or closed. In general, closed states correspond either to a contraction of the pore—making it impassable to the ion—or to a separate part of the protein, stoppering the pore. For example, the voltage-dependent sodium channel undergoes inactivation, in which a portion of the protein swings into the pore, sealing it.[17] This inactivation shuts off the sodium current and plays a critical role in the action potential. Ion channels can be classified by how they respond to their environment.[18] For example, the ion channels involved in the action potential are voltage-sensitive channels; they open and close in response to the voltage across the membrane. Ligand-gated channels form another important class; these ion channels open and close in response to the binding of a ligand molecule, such as a neurotransmitter. Other ion channels open and close with mechanical forces. Still other ion channels—such as those of sensory neurons—open and close in response to other stimuli, such as light, temperature or pressure. #### Leakage channels Leakage channels are the simplest type of ion channel, in that their permeability is more or less constant. The types of leakage channels that have the greatest significance in neurons are potassium and chloride channels. Even these are not perfectly constant in their properties: First, most of them are voltage-dependent in the sense that they conduct better in one direction than the other (in other words, they are rectifiers); second, some of them are capable of being shut off by chemical ligands even though they do not require ligands in order to operate. #### Ligand-gated channels Ligand-gated calcium channel in closed and open states Ligand-gated ion channels are channels whose permeability is greatly increased when some type of chemical ligand binds to the protein structure. Animal cells contain hundreds, if not thousands, of types of these. A large subset function as neurotransmitter receptors—they occur at postsynaptic sites, and the chemical ligand that gates them is released by the presynaptic axon terminal. One example of this type is the AMPA receptor, a receptor for the neurotransmitter glutamate that when activated allows passage of sodium and potassium ions. Another example is the GABAA receptor, a receptor for the neurotransmitter GABA that when activated allows passage of chloride ions. Neurotransmitter receptors are activated by ligands that appear in the extracellular area, but there are other types of ligand-gated channels that are controlled by interactions on the intracellular side. #### Voltage-dependent channels Voltage-gated ion channels, also known as voltage dependent ion channels, are channels whose permeability is influenced by the membrane potential. They form another very large group, with each member having a particular ion selectivity and a particular voltage dependence. Many are also time-dependent—in other words, they do not respond immediately to a voltage change but only after a delay. One of the most important members of this group is a type of voltage-gated sodium channel that underlies action potentials—these are sometimes called Hodgkin-Huxley sodium channels because they were initially characterized by Alan Lloyd Hodgkin and Andrew Huxley in their Nobel Prize-winning studies of the physiology of the action potential. The channel is closed at the resting voltage level, but opens abruptly when the voltage exceeds a certain threshold, allowing a large influx of sodium ions that produces a very rapid change in the membrane potential. Recovery from an action potential is partly dependent on a type of voltage-gated potassium channel that is closed at the resting voltage level but opens as a consequence of the large voltage change produced during the action potential. ### Reversal potential The reversal potential (or equilibrium potential) of an ion is the value of transmembrane voltage at which diffusive and electrical forces counterbalance, so that there is no net ion flow across the membrane. This means that the transmembrane voltage exactly opposes the force of diffusion of the ion, such that the net current of the ion across the membrane is zero and unchanging. The reversal potential is important because it gives the voltage that acts on channels permeable to that ion—in other words, it gives the voltage that the ion concentration gradient generates when it acts as a battery. The equilibrium potential of a particular ion is usually designated by the notation Eion.The equilibrium potential for any ion can be calculated using the Nernst equation.[19] For example, reversal potential for potassium ions will be as follows: ${\displaystyle E_{eq,K^{+}}={\frac {RT}{zF}}\ln {\frac {[K^{+}]_{o}}{[K^{+}]_{i}}},}$ where • Eeq,K+ is the equilibrium potential for potassium, measured in volts • R is the universal gas constant, equal to 8.314 joules·K−1·mol−1 • T is the absolute temperature, measured in kelvins (= K = degrees Celsius + 273.15) • z is the number of elementary charges of the ion in question involved in the reaction • F is the Faraday constant, equal to 96,485 coulombs·mol−1 or J·V−1·mol−1 • [K+]o is the extracellular concentration of potassium, measured in mol·m−3 or mmol·l−1 • [K+]i is the intracellular concentration of potassium Even if two different ions have the same charge (i.e., K+ and Na+), they can still have very different equilibrium potentials, provided their outside and/or inside concentrations differ. Take, for example, the equilibrium potentials of potassium and sodium in neurons. The potassium equilibrium potential EK is −84 mV with 5 mM potassium outside and 140 mM inside. On the other hand, the sodium equilibrium potential, ENa, is approximately +66 mV with approximately 12 mM sodium inside and 140 mM outside.[note 1] ### Changes to membrane potential during development A neuron's resting membrane potential actually changes during the development of an organism. In order for a neuron to eventually adopt its full adult function, its potential must be tightly regulated during development. As an organism progresses through development the resting membrane potential becomes more negative.[20] Glial cells are also differentiating and proliferating as development progresses in the brain.[21] The addition of these glial cells increases the organism's ability to regulate extracellular potassium. The drop in extracellular potassium can lead to a decrease in membrane potential of 35 mV.[22] ### Cell excitability Cell excitability is the change in membrane potential that is necessary for cellular responses in various tissues. Cell excitability is a property that is induced during early embriogenesis.[23] Excitability of a cell has also been defined as the ease with which a response may be triggered.[24] The resting and threshold potentials forms the basis of cell excitability and these processes are fundamental for the generation of graded and action potentials. The most important regulators of cell excitability are the extracellular electrolyte concentrations (i.e. Na+, K+, Ca2+, Cl, Mg2+) and associated proteins. Important proteins that regulate cell excitability are voltage-gated ion channels, ion transporters (e.g. Na+/K+-ATPase, magnesium transporters, acid–base transporters), membrane receptors and hyperpolarization-activated cyclic-nucleotide-gated channels.[25] For example, potassium channels and calcium-sensing receptors are important regulators of excitability in neurons, cardiac myocytes and many other excitable cells like astrocytes.[26] Calcium ion is also the most important second messenger in excitable cell signaling. Activation of synaptic receptors initiates long-lasting changes in neuronal excitability.[27] Thyroid, adrenal and other hormones also regulate cell excitability, for example, progesterone and estrogen modulate myometrial smooth muscle cell excitability. Many cell types are considered to have an excitable membrane. Excitable cells are neurons, myocytes (cardiac, skeletal, smooth), vascular endothelial cells, juxtaglomerular cells, interstitial cells of Cajal, many types of epithelial cells (e.g. beta cells, alpha cells, delta cells, enteroendocrine cells), glial cells (e.g. astrocytes), mechanoreceptor cells (e.g. hair cells and Merkel cells), chemoreceptor cells (e.g. glomus cells, taste receptors), some plant cells and possibly immune cells.[28] Astrocytes display a form of non-electrical excitability based on intracellular calcium variations related to the expression of several receptors through which they can detect the synaptic signal. In neurons, there are different membrane properties in some portions of the cell, for example, dendritic excitability endows neurons with the capacity for coincidence detection of spatially separated inputs.[29] ### Equivalent circuit Equivalent circuit for a patch of membrane, consisting of a fixed capacitance in parallel with four pathways each containing a battery in series with a variable conductance Electrophysiologists model the effects of ionic concentration differences, ion channels, and membrane capacitance in terms of an equivalent circuit, which is intended to represent the electrical properties of a small patch of membrane. The equivalent circuit consists of a capacitor in parallel with four pathways each consisting of a battery in series with a variable conductance. The capacitance is determined by the properties of the lipid bilayer, and is taken to be fixed. Each of the four parallel pathways comes from one of the principal ions, sodium, potassium, chloride, and calcium. The voltage of each ionic pathway is determined by the concentrations of the ion on each side of the membrane; see the Reversal potential section above. The conductance of each ionic pathway at any point in time is determined by the states of all the ion channels that are potentially permeable to that ion, including leakage channels, ligand-gated channels, and voltage-gated ion channels. Reduced circuit obtained by combining the ion-specific pathways using the Goldman equation For fixed ion concentrations and fixed values of ion channel conductance, the equivalent circuit can be further reduced, using the Goldman equation as described below, to a circuit containing a capacitance in parallel with a battery and conductance. In electrical terms, this is a type of RC circuit (resistance-capacitance circuit), and its electrical properties are very simple. Starting from any initial state, the current flowing across either the conductance or the capacitance decays with an exponential time course, with a time constant of τ = RC, where C is the capacitance of the membrane patch, and R = 1/gnet is the net resistance. For realistic situations, the time constant usually lies in the 1—100 millisecond range. In most cases, changes in the conductance of ion channels occur on a faster time scale, so an RC circuit is not a good approximation; however, the differential equation used to model a membrane patch is commonly a modified version of the RC circuit equation. ## Resting potential When the membrane potential of a cell goes for a long period of time without changing significantly, it is referred to as a resting potential or resting voltage. This term is used for the membrane potential of non-excitable cells, but also for the membrane potential of excitable cells in the absence of excitation. In excitable cells, the other possible states are graded membrane potentials (of variable amplitude), and action potentials, which are large, all-or-nothing rises in membrane potential that usually follow a fixed time course. Excitable cells include neurons, muscle cells, and some secretory cells in glands. Even in other types of cells, however, the membrane voltage can undergo changes in response to environmental or intracellular stimuli. For example, depolarization of the plasma membrane appears to be an important step in programmed cell death.[30] The interactions that generate the resting potential are modeled by the Goldman equation.[31] This is similar in form to the Nernst equation shown above, in that it is based on the charges of the ions in question, as well as the difference between their inside and outside concentrations. However, it also takes into consideration the relative permeability of the plasma membrane to each ion in question. ${\displaystyle E_{m}={\frac {RT}{F}}\ln {\left({\frac {P_{\mathrm {K} }[\mathrm {K} ^{+}]_{\mathrm {out} }+P_{\mathrm {Na} }[\mathrm {Na} ^{+}]_{\mathrm {out} }+P_{\mathrm {Cl} }[\mathrm {Cl} ^{-}]_{\mathrm {in} }}{P_{\mathrm {K} }[\mathrm {K} ^{+}]_{\mathrm {in} }+P_{\mathrm {Na} }[\mathrm {Na} ^{+}]_{\mathrm {in} }+P_{\mathrm {Cl} }[\mathrm {Cl} ^{-}]_{\mathrm {out} }}}\right)}}$ The three ions that appear in this equation are potassium (K+), sodium (Na+), and chloride (Cl). Calcium is omitted, but can be added to deal with situations in which it plays a significant role.[32] Being an anion, the chloride terms are treated differently from the cation terms; the intracellular concentration is in the numerator, and the extracellular concentration in the denominator, which is reversed from the cation terms. Pi stands for the relative permeability of the ion type i. In essence, the Goldman formula expresses the membrane potential as a weighted average of the reversal potentials for the individual ion types, weighted by permeability. (Although the membrane potential changes about 100 mV during an action potential, the concentrations of ions inside and outside the cell do not change significantly. They remain close to their respective concentrations when then membrane is at resting potential.) In most animal cells, the permeability to potassium is much higher in the resting state than the permeability to sodium. As a consequence, the resting potential is usually close to the potassium reversal potential.[33][34] The permeability to chloride can be high enough to be significant, but, unlike the other ions, chloride is not actively pumped, and therefore equilibrates at a reversal potential very close to the resting potential determined by the other ions. Values of resting membrane potential in most animal cells usually vary between the potassium reversal potential (usually around -80 mV) and around -40 mV. The resting potential in excitable cells (capable of producing action potentials) is usually near -60 mV—more depolarized voltages would lead to spontaneous generation of action potentials. Immature or undifferentiated cells show highly variable values of resting voltage, usually significantly more positive than in differentiated cells.[35] In such cells, the resting potential value correlates with the degree of differentiation: undifferentiated cells in some cases may not show any transmembrane voltage difference at all. Maintenance of the resting potential can be metabolically costly for a cell because of its requirement for active pumping of ions to counteract losses due to leakage channels. The cost is highest when the cell function requires an especially depolarized value of membrane voltage. For example, the resting potential in daylight-adapted blowfly (Calliphora vicina) photoreceptors can be as high as -30 mV.[36] This elevated membrane potential allows the cells to respond very rapidly to visual inputs; the cost is that maintenance of the resting potential may consume more than 20% of overall cellular ATP.[37] On the other hand, the high resting potential in undifferentiated cells can be a metabolic advantage. This apparent paradox is resolved by examination of the origin of that resting potential. Little-differentiated cells are characterized by extremely high input resistance,[35] which implies that few leakage channels are present at this stage of cell life. As an apparent result, potassium permeability becomes similar to that for sodium ions, which places resting potential in-between the reversal potentials for sodium and potassium as discussed above. The reduced leakage currents also mean there is little need for active pumping in order to compensate, therefore low metabolic cost. As explained above, the potential at any point in a cell's membrane is determined by the ion concentration differences between the intracellular and extracellular areas, and by the permeability of the membrane to each type of ion. The ion concentrations do not normally change very quickly (with the exception of Ca2+, where the baseline intracellular concentration is so low that even a small influx may increase it by orders of magnitude), but the permeabilities of the ions can change in a fraction of a millisecond, as a result of activation of ligand-gated ion channels. The change in membrane potential can be either large or small, depending on how many ion channels are activated and what type they are, and can be either long or short, depending on the lengths of time that the channels remain open. Changes of this type are referred to as graded potentials, in contrast to action potentials, which have a fixed amplitude and time course. As can be derived from the Goldman equation shown above, the effect of increasing the permeability of a membrane to a particular type of ion shifts the membrane potential toward the reversal potential for that ion. Thus, opening Na+ channels shifts the membrane potential toward the Na+ reversal potential, which is usually around +100 mV. Likewise, opening K+ channels shifts the membrane potential toward about –90 mV, and opening Cl channels shifts it toward about –70 mV (resting potential of most membranes). Thus, Na+ channels shift the membrane potential in a positive direction, K+ channels shift it in a negative direction (except when the membrane is hyperpolarized to a value more negative than the K+ reversal potential), and Cl channels tend to shift it towards the resting potential. Graph displaying an EPSP, an IPSP, and the summation of an EPSP and an IPSP Graded membrane potentials are particularly important in neurons, where they are produced by synapses—a temporary change in membrane potential produced by activation of a synapse by a single graded or action potential is called a postsynaptic potential. Neurotransmitters that act to open Na+ channels typically cause the membrane potential to become more positive, while neurotransmitters that activate K+ channels typically cause it to become more negative; those that inhibit these channels tend to have the opposite effect. Whether a postsynaptic potential is considered excitatory or inhibitory depends on the reversal potential for the ions of that current, and the threshold for the cell to fire an action potential (around –50mV). A postsynaptic current with a reversal potential above threshold, such as a typical Na+ current, is considered excitatory. A current with a reversal potential below threshold, such as a typical K+ current, is considered inhibitory. A current with a reversal potential above the resting potential, but below threshold, will not by itself elicit action potentials, but will produce subthreshold membrane potential oscillations. Thus, neurotransmitters that act to open Na+ channels produce excitatory postsynaptic potentials, or EPSPs, whereas neurotransmitters that act to open K+ or Cl channels typically produce inhibitory postsynaptic potentials, or IPSPs. When multiple types of channels are open within the same time period, their postsynaptic potentials summate (are added together). ## Other values From the viewpoint of biophysics, the resting membrane potential is merely the membrane potential that results from the membrane permeabilities that predominate when the cell is resting. The above equation of weighted averages always applies, but the following approach may be more easily visualized. At any given moment, there are two factors for an ion that determine how much influence that ion will have over the membrane potential of a cell: 1. That ion's driving force 2. That ion's permeability If the driving force is high, then the ion is being "pushed" across the membrane. If the permeability is high, it will be easier for the ion to diffuse across the membrane. • Driving force is the net electrical force available to move that ion across the membrane. It is calculated as the difference between the voltage that the ion "wants" to be at (its equilibrium potential) and the actual membrane potential (Em). So, in formal terms, the driving force for an ion = Em - Eion • For example, at our earlier calculated resting potential of −73 mV, the driving force on potassium is 7 mV : (−73 mV) − (−80 mV) = 7 mV. The driving force on sodium would be (−73 mV) − (60 mV) = −133 mV. • Permeability is a measure of how easily an ion can cross the membrane. It is normally measured as the (electrical) conductance and the unit, siemens, corresponds to 1 C·s−1·V−1, that is one coulomb per second per volt of potential. So, in a resting membrane, while the driving force for potassium is low, its permeability is very high. Sodium has a huge driving force but almost no resting permeability. In this case, potassium carries about 20 times more current than sodium, and thus has 20 times more influence over Em than does sodium. However, consider another casethe peak of the action potential. Here, permeability to Na is high and K permeability is relatively low. Thus, the membrane moves to near ENa and far from EK. The more ions are permeant the more complicated it becomes to predict the membrane potential. However, this can be done using the Goldman-Hodgkin-Katz equation or the weighted means equation. By plugging in the concentration gradients and the permeabilities of the ions at any instant in time, one can determine the membrane potential at that moment. What the GHK equations means is that, at any time, the value of the membrane potential will be a weighted average of the equilibrium potentials of all permeant ions. The "weighting" is the ions relative permeability across the membrane. ## Effects and implications While cells expend energy to transport ions and establish a transmembrane potential, they use this potential in turn to transport other ions and metabolites such as sugar. The transmembrane potential of the mitochondria drives the production of ATP, which is the common currency of biological energy. Cells may draw on the energy they store in the resting potential to drive action potentials or other forms of excitation. These changes in the membrane potential enable communication with other cells (as with action potentials) or initiate changes inside the cell, which happens in an egg when it is fertilized by a sperm. In neuronal cells, an action potential begins with a rush of sodium ions into the cell through sodium channels, resulting in depolarization, while recovery involves an outward rush of potassium through potassium channels. Both of these fluxes occur by passive diffusion. • Bioelectrochemistry • Electrochemical potential • Goldman equation • Membrane biophysics • Microelectrode array • Saltatory conduction • Surface potential • Gibbs–Donnan effect • Synaptic potential ## Notes 1. Note that the signs of ENa and EK are opposite. This is because the concentration gradient for potassium is directed out of the cell, while the concentration gradient for sodium is directed into the cell. Membrane potentials are defined relative to the exterior of the cell; thus, a potential of −70 mV implies that the interior of the cell is negative relative to the exterior. ## References 1. Bruce, Alberts (2014-11-18). Molecular biology of the cell (Sixth ed.). New York, NY. ISBN 9780815344322. OCLC 887605755. 2. Abdul Kadir, Lina; Stacey, Michael; Barrett-Jolley, Richard (2018). "Emerging Roles of the Membrane Potential: Action Beyond the Action Potential". Frontiers in Physiology. 9. doi:10.3389/fphys.2018.01661. ISSN 1664-042X. PMID 30519193. 3. Campbell Biology, 6th edition 4. Johnston and Wu, p. 9. 5. Bullock, Orkand, and Grinnell, pp. 140–41. 6. Bullock, Orkand, and Grinnell, pp. 153–54. 7. Mummert H, Gradmann D (1991). "Action potentials in Acetabularia: measurement and simulation of voltage-gated fluxes". Journal of Membrane Biology. 124 (3): 265–73. doi:10.1007/BF01994359. PMID 1664861. S2CID 22063907. 8. Schmidt-Nielsen, p. 483. 9. Lieb WR, Stein WD (1986). "Chapter 2. Simple Diffusion across the Membrane Barrier". Transport and Diffusion across Cell Membranes. San Diego: Academic Press. pp. 69–112. ISBN 978-0-12-664661-0. 10. Hodgkin AL, Keynes RD (1955). "Active transport of cations in giant axons from Sepia and Loligo". J. Physiol. 128 (1): 28–60. doi:10.1113/jphysiol.1955.sp005290. PMC 1365754. PMID 14368574. 11. Caldwell PC, Hodgkin AL, Keynes RD, Shaw TI (1960). "The effects of injecting energy-rich phosphate compounds on the active transport of ions in the giant axons of Loligo". J. Physiol. 152 (3): 561–90. doi:10.1113/jphysiol.1960.sp006509. PMC 1363339. PMID 13806926. 12. Steinbach HB, Spiegelman S (1943). "The sodium and potassium balance in squid nerve axoplasm". J. Cell. Comp. Physiol. 22 (2): 187–96. doi:10.1002/jcp.1030220209. 13. Hodgkin AL (1951). "The ionic basis of electrical activity in nerve and muscle". Biol. Rev. 26 (4): 339–409. doi:10.1111/j.1469-185X.1951.tb01204.x. S2CID 86282580. 14. CRC Handbook of Chemistry and Physics, 83rd edition, ISBN 0-8493-0483-0, pp. 12–14 to 12–16. 15. Eisenman G (1961). "On the elementary atomic origin of equilibrium ionic specificity". In A Kleinzeller; A Kotyk (eds.). Symposium on Membrane Transport and Metabolism. New York: Academic Press. pp. 163–79.Eisenman G (1965). "Some elementary factors involved in specific ion permeation". Proc. 23rd Int. Congr. Physiol. Sci., Tokyo. Amsterdam: Excerta Med. Found. pp. 489–506. * Diamond JM, Wright EM (1969). "Biological membranes: the physical basis of ion and nonekectrolyte selectivity". Annual Review of Physiology. 31: 581–646. doi:10.1146/annurev.ph.31.030169.003053. PMID 4885777. 16. Junge, pp. 33–37. 17. Cai SQ, Li W, Sesti F (2007). "Multiple modes of a-type potassium current regulation". Curr. Pharm. Des. 13 (31): 3178–84. doi:10.2174/138161207782341286. PMID 18045167. 18. Goldin AL (2007). "Neuronal Channels and Receptors". In Waxman SG (ed.). Molecular Neurology. Burlington, MA: Elsevier Academic Press. pp. 43–58. ISBN 978-0-12-369509-3. 19. Purves et al., pp. 28–32; Bullock, Orkand, and Grinnell, pp. 133–134; Schmidt-Nielsen, pp. 478–480, 596–597; Junge, pp. 33–35 20. Sanes, Dan H.; Takács, Catherine (1993-06-01). "Activity-dependent Refinement of Inhibitory Connections". European Journal of Neuroscience. 5 (6): 570–574. doi:10.1111/j.1460-9568.1993.tb00522.x. ISSN 1460-9568. PMID 8261131. S2CID 30714579. 21. KOFUJI, P.; NEWMAN, E. A. (2004-01-01). "Potassium buffering in the central nervous system". Neuroscience. 129 (4): 1045–1056. doi:10.1016/j.neuroscience.2004.06.008. ISSN 0306-4522. PMC 2322935. PMID 15561419. 22. Sanes, Dan H.; Reh, Thomas A (2012-01-01). Development of the nervous system (Third ed.). Elsevier Academic Press. pp. 211–214. ISBN 9780080923208. OCLC 762720374. 23. Tosti, Elisabetta (2010-06-28). "Dynamic roles of ion currents in early development". Molecular Reproduction and Development. 77 (10): 856–867. doi:10.1002/mrd.21215. ISSN 1040-452X. PMID 20586098. S2CID 38314187. 24. Boyet, M.R.; Jewell, B.R. (1981). "Analysis of the effects of changes in rate and rhythm upon electrical activity in the heart". Progress in Biophysics and Molecular Biology. 36 (1): 1–52. doi:10.1016/0079-6107(81)90003-1. ISSN 0079-6107. PMID 7001542. 25. Spinelli, Valentina; Sartiani, Laura; Mugelli, Alessandro; Romanelli, Maria Novella; Cerbai, Elisabetta (2018). "Hyperpolarization-activated cyclic-nucleotide-gated channels: pathophysiological, developmental, and pharmacological insights into their function in cellular excitability". Canadian Journal of Physiology and Pharmacology. 96 (10): 977–984. doi:10.1139/cjpp-2018-0115. hdl:1807/90084. ISSN 0008-4212. PMID 29969572. 26. Jones, Brian L.; Smith, Stephen M. (2016-03-30). "Calcium-Sensing Receptor: A Key Target for Extracellular Calcium Signaling in Neurons". Frontiers in Physiology. 7: 116. doi:10.3389/fphys.2016.00116. ISSN 1664-042X. PMC 4811949. PMID 27065884. 27. Debanne, Dominique; Inglebert, Yanis; Russier, Michaël (2019). "Plasticity of intrinsic neuronal excitability" (PDF). Current Opinion in Neurobiology. 54: 73–82. doi:10.1016/j.conb.2018.09.001. PMID 30243042. S2CID 52812190. 28. Davenport, Bennett; Li, Yuan; Heizer, Justin W.; Schmitz, Carsten; Perraud, Anne-Laure (2015-07-23). "Signature Channels of Excitability no More: L-Type Channels in Immune Cells". Frontiers in Immunology. 6: 375. doi:10.3389/fimmu.2015.00375. ISSN 1664-3224. PMC 4512153. PMID 26257741. 29. Sakmann, Bert (2017-04-21). "From single cells and single columns to cortical networks: dendritic excitability, coincidence detection and synaptic transmission in brain slices and brains". Experimental Physiology. 102 (5): 489–521. doi:10.1113/ep085776. ISSN 0958-0670. PMC 5435930. PMID 28139019. 30. Franco R, Bortner CD, Cidlowski JA (January 2006). "Potential roles of electrogenic ion transport and plasma membrane depolarization in apoptosis". J. Membr. Biol. 209 (1): 43–58. doi:10.1007/s00232-005-0837-5. PMID 16685600. S2CID 849895. 31. Purves et al., pp. 3233; Bullock, Orkand, and Grinnell, pp. 138140; Schmidt-Nielsen, pp. 480; Junge, pp. 3537 32. Spangler SG (1972). "Expansion of the constant field equation to include both divalent and monovalent ions". Alabama Journal of Medical Sciences. 9 (2): 218–23. PMID 5045041. 33. Purves et al., p. 34; Bullock, Orkand, and Grinnell, p. 134; Schmidt-Nielsen, pp. 478480. 34. Purves et al., pp. 3336; Bullock, Orkand, and Grinnell, p. 131. 35. Magnuson DS, Morassutti DJ, Staines WA, McBurney MW, Marshall KC (Jan 14, 1995). "In vivo electrophysiological maturation of neurons derived from a multipotent precursor (embryonal carcinoma) cell line". Developmental Brain Research. 84 (1): 130–41. doi:10.1016/0165-3806(94)00166-W. PMID 7720212. 36. Juusola M, Kouvalainen E, Järvilehto M, Weckström M (Sep 1994). "Contrast gain, signal-to-noise ratio, and linearity in light-adapted blowfly photoreceptors". J Gen Physiol. 104 (3): 593–621. doi:10.1085/jgp.104.3.593. PMC 2229225. PMID 7807062. 37. Laughlin SB, de Ruyter van Steveninck RR, Anderson JC (May 1998). "The metabolic cost of neural information". Nat. Neurosci. 1 (1): 36–41. doi:10.1038/236. PMID 10195106. S2CID 204995437. • Alberts et al. Molecular Biology of the Cell. Garland Publishing; 4th Bk&Cdr edition (March, 2002). ISBN 0-8153-3218-1. Undergraduate level. • Guyton, Arthur C., John E. Hall. Textbook of medical physiology. W.B. Saunders Company; 10th edition (August 15, 2000). ISBN 0-7216-8677-X. Undergraduate level. • Hille, B. Ionic Channel of Excitable Membranes Sinauer Associates, Sunderland, MA, USA; 1st Edition, 1984. ISBN 0-87893-322-0 • Nicholls, J.G., Martin, A.R. and Wallace, B.G. From Neuron to Brain Sinauer Associates, Inc. Sunderland, MA, USA 3rd Edition, 1992. ISBN 0-87893-580-0 • Ove-Sten Knudsen. Biological Membranes: Theory of Transport, Potentials and Electric Impulses. Cambridge University Press (September 26, 2002). ISBN 0-521-81018-3. Graduate level. • National Medical Series for Independent Study. Physiology. Lippincott Williams & Wilkins. Philadelphia, PA, USA 4th Edition, 2001. ISBN 0-683-30603-0
2021-09-21 09:00:04
{"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.6407531499862671, "perplexity": 2016.9440277224205}, "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/1631780057199.49/warc/CC-MAIN-20210921070944-20210921100944-00534.warc.gz"}
https://galoisrepresentations.wordpress.com/2015/05/07/how-not-to-be-wrong/
## How not to be wrong I recently finished listening to Jordan’s book “how not to be wrong,” and thought that I would record some of the notes I made. Unlike other reviews, Persiflage will cut through to the key aspects of the book which perhaps non-specialists may have missed. Unfortunately, my first few notes did not record the specific time in the recording where the relevant passage occurred, so some of the earlier comments are a little more vague, because I couldn’t go back and check them more carefully. Title: How Now to Be Wrong: The Power of Mathematical Thinking. Author: Jordan Ellenberg. Book Format: Pirated audio copy. • OK, Penguin, what have you done to Jordan? It sounds as though before the recording session began, Jordan was force fed him a greasy pizza with a couple of prozac stuffed in the crust. I was expecting a hyperactive delivery style, but instead there is a relatively calm and measured tone you might expect on any professionally made audio book. • Did he just say yoked? Yes, my friends, we have here a student of Barry Mazur. • 2377. This is all it says in my notes. I think this was used as a number which was supposed to sound random. But I did wonder whether it had any other significance. A brief web search indicates the full phrase may have been: Moving over to complicated/shallow, you have the problem of …[computing]… the trace of Frobenius on a modular form of conductor 2377. I checked — there are no elliptic curves of conductor 2377. I think there was an opportunity missed to say 5077 instead, thus alluding to the Gross-Zagier plus Goldfeld solution to the class number problem.   Although if there was such an allusion, it may have ruined the implication of being shallow, so never mind. • Some reference to galois representations being deep; unfortunately I didn’t write any further notes here. They are indeed complicated and deep. • The claim is made that if you cut a tuna fish sandwich you will be left with two right-angle isoceles triangles. Is this so clear? I mean, does everyone cut their tuna fish sandwiches along the diagonal? • Rounding Errors: the range for (I guess?) one standard deviation for some normal distribution with mean 50 is given as 46.2 and 53.7, but these numbers are not symmetric around 50. • Infinity of my profit comes from pastry. I liked this line. • 4, 21, 23, 34, 39. Repeated strings of numbers on the page are easy to read, but even Jordan is getting a little bored reading out 4, 21, 23, 34, 39 for the n-th time. • if your kid drew Jesus on the cross… See two comments up. • At this point, I should probably point out to the readers of the book that they are missing out on all the extra fancy technological gizmos that Penguin took advantage of when transferring the book from the page to audio. And by this, I mean that, in approximately 13 and half hours of reading, we not only have Jordan reading out the text of the book, we are also treated to exactly one such extra, namely, the first 9 notes of Beethoven’s Ode to Joy as played on what appears to be an 8-key child’s keyboard. • Ouroboric? Is that really how you pronounce that? It doesn’t seem consistent with the OED’s pronunciation of Ouroboros. Hmmm, but on the other hand, http://en.wiktionary.org/wiki/ouroboric gives someting similar to what Jordan says… • How Many States should one have expected Nate Silver to get wrong? This might have been another opportunity to mention how the expectation is not the “expected” answer. Presumably, one would expect a high correlation between getting one (close) state wrong and getting another wrong (I’m imagining here that swings undetected by polls would be nationwide rather than statewide). So I have several questions here. Was there anything in Silver’s model which could allow one to predict not only the expected number of states he would get wrong but the expected *distribution* of the number of states he would get wrong? Because of the stickiness of states, I suppose that the expectation that he would get all the states correct is higher than what one might guess from the fact that the expected number of states one expected he would get wrong (from his model) was approximately 3. I’m sure I’ve heard Jordan mention elsewhere that Nate Silver claimed that one should not have expected Silver to get all 50 states right. However, it’s completely consistent to believe that a well designed model could both predict that the expected number of states that Silver would get wrong is 3, but also that there is a high probability (at least > 50%) that he really would get all the states correct. So it’s not clear that a criticism of Silver for getting too many states correct is necessarily valid. • The problems you meet freshman year are the deepest… Is this true? Matt and I wondered which $p$-adic modular functions were expressible as convergent sums of finite slope eigenforms, and I still don’t know, but I’m not sure that’s the deepest question ever. • Did the student of the introduction listen to the entire book? I think I kind of missed that this was a preface (I think?) and kept expecting her to return. Summary: Was I convinced at the end that the girl’s time spending doing those 30 definite integrals was worthwhile? I’m not so sure. In fact, I could almost have been convinced that we should slash all the public math departments in half and replace them by statistics departments. On the other hand, by every other measure, the book was a complete success — as a piece of prose, as a source of interesting yet thematically linked historical anecdotes, and as both an exposition and celebration of a certain way of thinking (“mathematical thinking”) which we all aspire to. It was worth every cent. Audio: On a scale from “Jordan’s talking to you quite loudly on a train in Germany and someone tells you to shut up” to “Ambient waterfall sounds for Ultimate Bedtime Relaxation,” I rate it a 4, which is about where you would wish it to be. (For an inside look at the recording session, see this post.) This entry was posted in Book Review and tagged , , , , , , , , , , , , , , , , . Bookmark the permalink. ### 7 Responses to How not to be wrong 1. JSE says: It was worth every cent. I see what you did there. • Is there any reason behind the choice of 2377, BTW? • JSE says: Dunno. I wrote “a modular form of conductor 2377” and I don’t remember whether I had a particular one in mind. • Having just checked, it seems that $J^{+}_0(2377)$ and $J^{-}_0(2377)$ are simple abelian varieties of dimensions 95 and 102 respectively. • JSE says: Must have just made up a number, then, since I don’t have any brief for any particular totally real number field of either of those degrees. 2. JSE says: Re my subdued speed and affect: not greasy pizza but a producer in my earphone yelling “PACING!” every time I started to approach normal JSE speech rate. Re tuna fish sandwich: in the book there’s a picture, making it clear that yes, I meant diagonal slicing, the only correct way to slice a tuna fish sandwich. Re the student in the introduction: I tried to call back to the opening lines in the last line of the book, but I do think in the end it’s a bit of a structural flaw; the intro gives the impression the book will be more about “school math” than it actually is. Re “how many states”: excellent point. Without knowing more about correlation between states you can’t compute the distribution of the error, just its expected value. I doubt he’d have given himself a 50-50 chance of getting all 50 right, but he hasn’t revealed enough of his internals for me to know. But they did post this info for the UK election that just happened. http://fivethirtyeight.com/features/are-we-right-about-the-uk-general-election/ 3. JSE says: And thanks for the kind words overall! I hope I don’t actually convince our state governments the public math departments are useless. That’s Michael Harris’s job!
2017-09-19 15:16:56
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 3, "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.7003771662712097, "perplexity": 1081.5656464160863}, "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-39/segments/1505818685850.32/warc/CC-MAIN-20170919145852-20170919165852-00122.warc.gz"}
https://www.gradesaver.com/textbooks/math/algebra/algebra-1/chapter-7-exponents-and-exponential-functions-7-4-more-multiplication-properties-of-exponents-standardized-test-prep-page-438/79
Algebra 1 Area B has (0,0) as a point. $3x+5y > 150$ $3*0+5*0 > 150$ $0+0 > 150$ $0>150$ (false) Area A has (5,40) as a point. $4x+2y < 115$ $4*5+2*40 < 115$ $20 + 80 < 115$ $100 < 115$ (true) $3x+5y>150$ $3*5+5*40 > 150$ $15 + 200 > 150$ $215 > 150$ (true)
2021-03-04 03:59: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.8764621019363403, "perplexity": 1580.7917630973916}, "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-10/segments/1614178368431.60/warc/CC-MAIN-20210304021339-20210304051339-00267.warc.gz"}
http://cust-serv@ams.org/cgi-bin/bookstore/booksearch?fn=100&pg1=CN&s1=Gan_Wee_Teck&arg9=Wee_Teck_Gan
New Titles  |  FAQ  |  Keep Informed  |  Review Cart  |  Contact Us Quick Search (Advanced Search ) Browse by Subject General Interest Logic & Foundations Number Theory Algebra & Algebraic Geometry Discrete Math & Combinatorics Analysis Differential Equations Geometry & Topology Probability & Statistics Applications Mathematical Physics Math Education Sur Les Conjectures de Gross et Prasad I Wee Teck Gan, University of California at San Diego, CA, Benedict H. Gross, Harvard University, Cambridge, MA, Dipendra Prasad, Tata Institute of Fundamental Research, Mumbai, India, and Jean-Loup Waldspurger, Institut de Mathématiques de Jussieu-CNRS, Paris, France A publication of the Société Mathématique de France. Astérisque 2012; 318 pp; softcover Number: 346 ISBN-13: 978-2-85629-348-5 List Price: US$105 Member Price: US$86.40 Order Code: AST/346 See also: Sur Les Conjectures de Gross et Prasad II - Colette Moeglin and Jean-Loup Waldspurger A note to readers: Half of this book is in English and half is in French. About 20 years ago Gross and Prasad formulated a conjecture determining the restriction of an irreducible admissible representation of the group $$G = SO(n)$$ over a local field to a subgroup of the form $$G' = SO(n-1)$$. The conjecture stated that for a given pair of generic $$L$$-packets of $$G$$ and $$G'$$, there is a unique non-trivial pairing, up to scalars, between precisely one member of each packet, where $$G$$ and $$G'$$ are allowed to vary among inner forms; moreover, the relevant members of the $$L$$-packets are determined by an explicit formula involving local root numbers. For non-archimedean local fields this conjecture has now been proved by Waldspurger and Mœglin, using a variety of methods of local representation theory; the Plancherel formula plays an important role in the proof. There is also a global conjecture for automorphic representations, which involves the central critical value of $$L$$-functions. This volume is the first of two volumes devoted to the conjecture and its proof for non-archimedean local fields. It contains two long articles by Gan, Gross, and Prasad, formulating extensions of the original Gross-Prasad conjecture to more general pairs of classical groups including metaplectic groups, and providing examples for low rank unitary groups and for representations with restricted ramification. It also includes two articles by Waldspurger: a short article deriving the local multiplicity one conjecture for special orthogonal groups from the results of Aizenbud-Gourevitch-Rallis-Schiffmann on orthogonal groups and a long article (which appeared in Compositio Mathematica in 2010) completing the first part of the proof of the Gross-Prasad conjecture by extending an integral formula relating multiplicities in the restriction problem to harmonic analysis from supercuspidal representations to general tempered representations here. A publication of the Société Mathématique de France, Marseilles (SMF), distributed by the AMS in the U.S., Canada, and Mexico. Orders from other countries should be sent to the SMF. Members of the SMF receive a 30% discount from list. Readership Graduate students and research mathematicians interested in classical groups, metaplectic groups, branching laws, Gross-Prasad conjectures, local root numbers, and central critical $$L$$-value. Table of Contents W. T. Gan, B. H. Gross, and D. Prasad -- Symplectic local root numbers, central critical L-values, and restriction problems in the representation theory of classical groups W. T. Gan, B. H. Gross, and D. Prasad -- Restrictions of representations of classical groups: Examples J.-L. Waldspurger -- Une formule intégrale reliée à la conjecture locale de Gross-Prasad, $$2^e$$ partie : Extension aux représentations tempérées J.-L. Waldspurger -- Une variante d'un résultat de Aizenbud, Gourevitch, Rallis et Schiffmann
2014-10-20 21:11:49
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.34853214025497437, "perplexity": 1354.3833940516815}, "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-2014-42/segments/1413507443438.42/warc/CC-MAIN-20141017005723-00203-ip-10-16-133-185.ec2.internal.warc.gz"}
https://www.physicsforums.com/threads/prove-x-y-x-y-where-x-and-y-are-complex.539368/
# Prove ||x|-|y||≤|x-y|, where x and y are complex Jamin2112 ## Homework Statement If x, y are complex, prove that | |x| - |y| | ≤ |x - y| ## Homework Equations If x = a + ib, |x| = √(a2+b2) |x + y| ≤ |x| + |y| (works for both complex and real numbers) ## The Attempt at a Solution | |x| - |y| | = | |x| + (-|y|) ||x| + |-|y|| = |x| + |y| ....... Maybe almost there is I can show |x| + |y| ≤ |x - y| ........ How can I not get this problem? Staff Emeritus Homework Helper Use that $$|x|=|(x-y)+y|$$ Jamin2112 Use that $$|x|=|(x-y)+y|$$ Stay around here. I'm going to hit you up with another question later. Staff Emeritus Homework Helper What you wrote down is incorrect. Specifically, the first inequality is wrong. You need to prove two things: $$|x|-|y|\leq |x-y|~\text{and}~|x|-|y|\geq -|x-y|$$ These two together would imply your inequality. Jamin2112 Staff Emeritus Homework Helper This is better Jamin2112 This is better Think you could help me with the Schwartz equality problem? My homework is due in 1 hour and that's the only one I have left. Staff Emeritus Homework Helper Think you could help me with the Schwartz equality problem? My homework is due in 1 hour and that's the only one I have left. Well, what is the problem and what did you try? Jamin2112 Well, what is the problem and what did you try? Figuring out under what condition equality holds in the Schwartz inequality. (I know the answer is when a and b are linearly independent) I let aj = xj + iyj, bj = uj + ivj and after some simplification came up with ∑(xj2+bj2)(uj2+vj2) = ∑(xj2+bj2)∑(uj2+vj2) which somehow shows that a is a scalar multiple of b. Not sure how, though.
2022-11-27 11:46:07
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 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.789495587348938, "perplexity": 1577.8747066411306}, "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/1669446710237.57/warc/CC-MAIN-20221127105736-20221127135736-00486.warc.gz"}
https://learn.careers360.com/engineering/question-solve-it-a-conducting-sphere-of-radius-r-is-given-a-charge-q-the-electric-potential-and-the-electric-field-at-the-centre-of-the-sphere-respectively-are/
#### A conducting sphere of radius R is given a charge Q. The electric potential and the electric field at the centre of the sphere respectively are: Option 1) Zero and  Option 2)  and Zero Option 3)  and  Option 4) Both are zero As discussed (Concept missing) For conducting sphere, Potential at the center=Potential on the sphere = Electric field at the centre=0 Option 1) Zero and This option is incorrect Option 2) and Zero This option is correct Option 3) and This option is incorrect Option 4) Both are zero This option is incorrect
2023-03-24 13:24:09
{"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.984538733959198, "perplexity": 7147.995541754294}, "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/1679296945282.33/warc/CC-MAIN-20230324113500-20230324143500-00747.warc.gz"}
https://andrew222651.com/2017/10/10/probability-riemann-hypothesis/
# What's the probability of the Riemann Hypothesis? Usually when we talk about probabilities, we have certain given information, which takes the form of a $$\sigma$$-algebra of possible events, and there is also a probability function that assigns values to each event. The rationality of a probability function is judged based on the relationships between events. For example if $$A \subseteq B$$ then we must have $$P(A) \leq P(B)$$. But as long as these relationships are satisfied (giving a proper probability measure), the probabilities could be anything. As such, we do not judge subjective probabilities based on whether they’re actually accurate or not, just whether they are consistent with each other. Now, imagine if information isn’t the limiting factor in our uncertainty, but rather it’s our lack of mathematical knowledge. A statement like the Riemann Hypothesis (RH) is unknown even though it is entirely determined by the axiom system we use, leaving aside issues of completeness. Here there’s no given $$\sigma$$-algebra and in fact the relationships between RH and other statements may themselves be difficult to determine. A more realistic view is that we have limited computational resources, we want to solve an intractible problem, and we’ll settle for the best approximation we can get. Thus a probability function is seen as a kind of approximation algorithm. With this algorithmic language, however, we aren’t able to give a very good answer for single propositions like RH. If RH is the entire set of inputs, the optimal approximation is the exact truth value, because it takes a trivial amount of computational resources to output the constant 1 or 0. If the set of inputs is infinite, then the particular input corresponding to RH makes no difference in an asymptotic analysis. For more elaboration on this theme, see this paper. In traditional Bayesianism there is a seemingly ineradicable source of subjectivity from the choice of prefix Turing machine used to define Solomonoff’s prior. Any one input can be assigned a wide range of probabilities. Perhaps we are left with an analogous but different kind of subjectivity for mathematical probabilities. (Above: Andrew Critch thinking about this in Berkeley.) * * *
2023-03-31 08:40: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.7658591866493225, "perplexity": 308.02395758575966}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": false}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2023-14/segments/1679296949598.87/warc/CC-MAIN-20230331082653-20230331112653-00068.warc.gz"}
https://socratic.org/questions/56bf39577c014946e01d0fe8
# What is the optimal "pH" for acid hydrolysis? May 23, 2016 I'm not sure what you mean by acid hydrolysis; you could be implying acid-catalyzed hydrolysis, in which case you may mean hydrolysis of amides or esters. Either way, it requires acidic conditions, which is obvious from the name "acid-catalyzed hydrolysis". i.e. the pH should be less than $7$ for optimal conditions. However, our bodily functions would be far from optimal at acidic pH's. We function best at approximately pH $7.4$ and ${37}^{\circ} \text{C}$. In fact, enzyme hydrolysis of the "amide backbone" of a protein does occur in the human body, and optimally should not force the body to assume irregular pH's or temperatures (if it does, we'd be quite uncomfortable whenever this occurs). I go into the full mechanism of the catalytic triad which acts to make this occur, here. (Basically, the collaboration of three amino acids off of the backbone of trypsin, for instance, collectively becomes a trick of altering pKas so that each of them can play a role in this "polyamide" hydrolysis.)
2019-11-12 22:16:27
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 3, "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.9082832336425781, "perplexity": 2344.5202351676676}, "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/1573496665767.51/warc/CC-MAIN-20191112202920-20191112230920-00139.warc.gz"}
https://www.imath.kiev.ua/~sigma/2014/059/
### Symmetry, Integrability and Geometry: Methods and Applications (SIGMA) SIGMA 10 (2014), 059, 38 pages      arXiv:1205.2992      https://doi.org/10.3842/SIGMA.2014.059 ### Configurations of an Articulated Arm and Singularities of Special Multi-Flags Fernand Pelletier a and Mayada Slayman b a) Université de Savoie, Laboratoire de Mathématiques (LAMA), Campus Scientifique, 73376 Le Bourget-du-Lac Cedex, France b) Department of Mathematical Sciences, Faculty of Sciences II, Lebanese University, Lebanon Received January 29, 2013, in final form May 18, 2014; Published online June 05, 2014 Abstract P. Mormul has classified the singularities of special multi-flags in terms of “EKR class'' encoded by sequences $j_1,\dots, j_k$ of integers (see [Singularity Theory Seminar, Warsaw University of Technology, Vol. 8, 2003, 87-100] and [Banach Center Publ., Vol. 65, Polish Acad. Sci., Warsaw, 2004, 157-178]). However, A.L. Castro and R. Montgomery have proposed in [Israel J. Math. 192 (2012), 381-427] a codification of singularities of multi-flags by RC and RVT codes. The main results of this paper describe a decomposition of each ''EKR'' set of depth $1$ in terms of RVT codes as well as characterize such a set in terms of configurations of an articulated arm. Indeed, an analogue description for some ''EKR'' sets of depth $2$ is provided. All these results give rise to a complete characterization of all ''EKR'' sets for $1\leq k\leq 4$. Key words: special multi-flags distributions; Cartan prolongation; spherical prolongation; articulated arm; rigid bar. pdf (639 kb)   tex (70 kb) References 1. Adachi J., Global stability of distributions of higher corank of derived length one, Int. Math. Res. Not. 2003 (2003), 2621-2638. 2. Adachi J., Global stability of special multi-flags, Israel J. Math. 179 (2010), 29-56. 3. Castro A.L., Howard W.C., A Monster Tower approach to Goursat multi-flags, Differential Geom. Appl. 30 (2012), 405-427. 4. Castro A.L., Montgomery R., Spatial curve singularities and the Monster/Semple tower, Israel J. Math. 192 (2012), 381-427. 5. Kumpera A., Rubin J.L., Multi-flag systems and ordinary differential equations, Nagoya Math. J. 166 (2002), 1-27. 6. Li S.J., Respondek W., The geometry, controllability, and flatness property of the $n$-bar system, Internat. J. Control 84 (2011), 834-850. 7. Montgomery R., Zhitomirskii M., Geometric approach to Goursat flags, Ann. Inst. H. Poincaré Anal. Non Linéaire 18 (2001), 459-493. 8. Mormul P., Geometric singularity classes for special $k$-flags, $k \geq 2$, of arbitrary length, in Singularity Theory Seminar, Editor S. Janeczko, Warsaw University of Technology, Vol. 8, 2003, 87-100. 9. Mormul P., Multi-dimensional Cartan prolongation and special $k$-flags, in Geometric Singularity Theory, Banach Center Publ., Vol. 65, Polish Acad. Sci., Warsaw, 2004, 157-178. 10. Mormul P., Pelletier F., Special 2-flags in lengths not exceeding four: a study in strong nilpotency of distributions, arXiv:1011.1763. 11. Pasillas-Lépine W., Respondek W., Contact systems and corank one involutive subdistributions, Acta Appl. Math. 69 (2001), 105-128, math.DG/0004124. 12. Pasillas-Lépine W., Respondek W., On the geometry of Goursat structures, ESAIM Control Optim. Calc. Var. 6 (2001), 119-181, math.DG/9911101. 13. Pelletier F., Espace de configuration d'un système mécanique et tours de fibrés associées à un multi-drapeau spécial, C. R. Math. Acad. Sci. Paris 350 (2012), 71-76. 14. Shibuya K., Yamaguchi K., Drapeau theorem for differential systems, Differential Geom. Appl. 27 (2009), 793-808. 15. Slayman M., Bras articulé et distributions multi-drapeaux, Ph.D. Thesis, Université de Savoie, Laboratoire de Mathématiques (LAMA), 2008. 16. Slayman M., Pelletier F., Articulated arm and special multi-flags, J. Math. Sci. Adv. Appl. 8 (2011), 9-41, arXiv:1205.2990.
2018-01-17 04:49:19
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.5271676778793335, "perplexity": 7595.5901641767405}, "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/1516084886815.20/warc/CC-MAIN-20180117043259-20180117063259-00265.warc.gz"}
https://par.nsf.gov/biblio/10184317-bolometric-quasar-luminosity-function
The bolometric quasar luminosity function at z = 0–7 ABSTRACT In this paper, we provide updated constraints on the bolometric quasar luminosity function (QLF) from z = 0 to z = 7. The constraints are based on an observational compilation that includes observations in the rest-frame IR, B band, UV, soft, and hard X-ray in past decades. Our method follows Hopkins et al. with an updated quasar SED model and bolometric and extinction corrections. The new best-fitting bolometric quasar luminosity function behaves qualitatively different from the old Hopkins model at high redshift. Compared with the old model, the number density normalization decreases towards higher redshift and the bright-end slope is steeper at z ≳ 2. Due to the paucity of measurements at the faint end, the faint end slope at z ≳ 5 is quite uncertain. We present two models, one featuring a progressively steeper faint-end slope at higher redshift and the other featuring a shallow faint-end slope at z ≳ 5. Further multiband observations of the faint-end QLF are needed to distinguish between these models. The evolutionary pattern of the bolometric QLF can be interpreted as an early phase likely dominated by the hierarchical assembly of structures and a late phase likely dominated by the quenching of galaxies. We explore the implications of this more » Authors: ; ; ; ; ; ; Award ID(s): Publication Date: NSF-PAR ID: 10184317 Journal Name: Monthly Notices of the Royal Astronomical Society Volume: 495 Issue: 3 Page Range or eLocation-ID: 3252 to 3275 ISSN: 0035-8711 4. ABSTRACT The James Webb Space Telescope will have the power to characterize high-redshift quasars at z ≥ 6 with an unprecedented depth and spatial resolution. While the brightest quasars at such redshift (i.e. with bolometric luminosity $L_{\rm bol}\geqslant 10^{46}\, \rm erg/s$) provide us with key information on the most extreme objects in the Universe, measuring the black hole (BH) mass and Eddington ratios of fainter quasars with $L_{\rm bol}= 10^{45}-10^{46}\, \rm erg\,s^{ -1}$ opens a path to understand the build-up of more normal BHs at z ≥ 6. In this paper, we show that the Illustris, TNG100, TNG300, Horizon-AGN, EAGLE,more »
2022-06-28 19:11: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.6358000040054321, "perplexity": 2700.7356826908763}, "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-27/segments/1656103573995.30/warc/CC-MAIN-20220628173131-20220628203131-00374.warc.gz"}
https://gmatclub.com/forum/a-salesman-makes-a-20-percent-commission-on-the-selling-price-of-each-280428.html
GMAT Question of the Day - Daily to your Mailbox; hard ones only It is currently 19 Oct 2019, 00:42 ### GMAT Club Daily Prep #### Thank you for using the timer - this advanced tool can estimate your performance and suggest more practice questions. We have subscribed you to Daily Prep Questions via email. Customized for You we will pick new questions that match your level based on your Timer History Track every week, we’ll send you an estimated GMAT score based on your performance Practice Pays we will pick new questions that match your level based on your Timer History # A salesman makes a 20 percent commission on the selling price of each Author Message TAGS: ### Hide Tags Senior PS Moderator Joined: 26 Feb 2016 Posts: 3333 Location: India GPA: 3.12 A salesman makes a 20 percent commission on the selling price of each  [#permalink] ### Show Tags Updated on: 31 Oct 2018, 22:25 2 00:00 Difficulty: 5% (low) Question Stats: 93% (01:18) correct 7% (02:30) wrong based on 35 sessions ### HideShow timer Statistics A salesman makes a 20 percent commission on the selling price of each set of encyclopedias he sells. If he sells 12 identical sets of encyclopedias and makes $1800 in commissions, what is the selling price of each set? A.$300 B. $600 C.$750 D. $900 E.$1080 _________________ You've got what it takes, but it will take everything you've got Originally posted by pushpitkc on 31 Oct 2018, 19:42. Last edited by Bunuel on 31 Oct 2018, 22:25, edited 1 time in total. EDITED. Director Joined: 04 Dec 2015 Posts: 743 Location: India Concentration: Technology, Strategy WE: Information Technology (Consulting) Re: A salesman makes a 20 percent commission on the selling price of each  [#permalink] ### Show Tags 31 Oct 2018, 19:54 pushpitkc wrote: A salesman makes a 20 percent commission on the selling price of each set of encyclopedias he sells. If he sells 12 identical sets of encyclopedias and makes $1800 in commissions, what is the selling price of each set? A.$300 B. $600 C.$750 D. $900 E.$1080 Let the price of $$1$$ encyclopedia be $$= x$$ Commission on $$1$$ encyclopedia $$= \frac{20}{100} x = \frac{1}{5} x$$ Given total commission $$= 1800$$ Therefore commission on $$12$$ encyclopedia $$= 12 * \frac{1}{5} x = 1800$$ $$x = \frac{1800 * 5}{12} = 750$$ Manager Joined: 24 Dec 2017 Posts: 185 Location: India Concentration: Strategy, Real Estate Schools: Johnson '21 Re: A salesman makes a 20 percent commission on the selling price of each  [#permalink] ### Show Tags 31 Oct 2018, 22:36 =>0.20 * 12x = 1800 =>2.40x = 1800 =>x = 1800/2.40 =>750 IMO C Re: A salesman makes a 20 percent commission on the selling price of each   [#permalink] 31 Oct 2018, 22:36 Display posts from previous: Sort by
2019-10-19 07:42: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": 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.6949082612991333, "perplexity": 10757.52949805907}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-43/segments/1570986692126.27/warc/CC-MAIN-20191019063516-20191019091016-00319.warc.gz"}
https://gmatclub.com/forum/in-the-figure-above-if-o-is-the-center-of-the-circle-which-of-the-fo-255275.html
GMAT Question of the Day - Daily to your Mailbox; hard ones only It is currently 21 Aug 2018, 23:01 ### GMAT Club Daily Prep #### Thank you for using the timer - this advanced tool can estimate your performance and suggest more practice questions. We have subscribed you to Daily Prep Questions via email. Customized for You we will pick new questions that match your level based on your Timer History Track every week, we’ll send you an estimated GMAT score based on your performance Practice Pays we will pick new questions that match your level based on your Timer History # In the figure above, if O is the center of the circle, which of the fo Author Message TAGS: ### Hide Tags Math Expert Joined: 02 Sep 2009 Posts: 48117 In the figure above, if O is the center of the circle, which of the fo  [#permalink] ### Show Tags 11 Dec 2017, 23:08 00:00 Difficulty: 35% (medium) Question Stats: 83% (00:46) correct 17% (00:56) wrong based on 34 sessions ### HideShow timer Statistics In the figure above, if O is the center of the circle, which of the following points lies outside the circle? (A) (–7, –8) (B) (–7, 7) (C) (8, –6) (D) (8, 5) (E) (9, 4) Attachment: 2017-12-12_1001_002.png [ 7.87 KiB | Viewed 513 times ] _________________ SC Moderator Joined: 22 May 2016 Posts: 1915 Re: In the figure above, if O is the center of the circle, which of the fo  [#permalink] ### Show Tags 12 Dec 2017, 09:09 Bunuel wrote: In the figure above, if O is the center of the circle, which of the following points lies outside the circle? (A) (–7, –8) (B) (–7, 7) (C) (8, –6) (D) (8, 5) (E) (9, 4) Attachment: 2017-12-12_1001_002.png One quick way to approach this question: add the squares of the coordinates in the answers. They should not be greater than 100. (I avoid the distance formula when there are less error-prone ways to solve.) The general equation for a line is $$x^2 + y^2 = r^2$$. This circle's radius is 10 (center x-coordinate is at 0, a point on the circle is (10,0), subtract x-coordinates). So this line's equation is $$x^2 + y^2 = 100$$. A point outside the circle will have coordinates whose squares sum to more than 100. $$x^2 + y^2 = 100$$ (A) (–7, –8) $$(-7)^2 + 8^2 = 49 + 64 = 113$$ Outside the circle. Keep (B) (–7, 7) $$49 + 49 = 98$$. Inside the circle. Reject (C) (8, –6) $$64 + 36 = 100$$. On the circle. Reject (D) (8, 5) $$64 + 25 = 89$$. Inside the circle. Reject (E) (9, 4) $$81 + 16 = 97$$. Inside the circle. Reject _________________ In the depths of winter, I finally learned that within me there lay an invincible summer. Re: In the figure above, if O is the center of the circle, which of the fo &nbs [#permalink] 12 Dec 2017, 09:09 Display posts from previous: Sort by # Events & Promotions Powered by phpBB © phpBB Group | Emoji artwork provided by EmojiOne Kindly note that the GMAT® test is a registered trademark of the Graduate Management Admission Council®, and this site has neither been reviewed nor endorsed by GMAC®.
2018-08-22 06:01:28
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 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.6568800210952759, "perplexity": 4059.125124110491}, "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-34/segments/1534221219495.97/warc/CC-MAIN-20180822045838-20180822065838-00263.warc.gz"}
https://emkademy.com/research/toolbox/2020-03-21-mean-variance-std
21/03/2020 # Mean, Variance, and Standard Deviation – Once and For All ### Objectives By the end of this post you should • understand what is mean, and why is it so useful, • understand the importance of variance and what it is tell us, • understand what is normal distribution, and why we use it. Imagine you are in a carnival in Japan, and there is a very exciting contest: everybody needs to guess how tall a Japanese man is, and the person who guesses it right (or the one who gets the closest) wins a katana. This is the katana of your dreams, you really want it, but you have no idea how tall this person is. What to do? His height can be between $-\infty$ and $\infty$. Wait a second, you know that height can’t be negative or zero, it doesn’t make any sense for these values. So, you have an information that the height can’t be negative or zero, good, now you have reduced the possible number for this person’s height into a range: $0 < height < \infty$. What else do you know? A quick check from the internet shows you that the tallest man has ever lived had 272cm [3]. You saw some pictures of him near some objects, and based on this you don’t think this Japanese man is taller than him. Okayyy, so you can reduce the range into $0 <height < 272$. With the same logic, you find the shortest man has ever lived and you can further reduce the range into $54.6 < height < 272$ [6]. What more can you do after this moment? Let’s see… Contest at a carnival ## Mean (Average) Why do we even have something called mean? What information does it give us? When is it useful? Well, we have already talked about the diversity on earth. We can’t just say that humans are 160cm tall. But, we can say that, for example, the average height of Japanese men is 172cm (in 2020 [1]). It gives us information about the center of diversity. ### Mean Mean is a value that pinpoints the center location within a dataset. First of all, how this number was found? There are 2 ways you can get it: 1) The first way is precise but very time-consuming. It includes measuring the height of every Japanese man (the “population” for this example), then summing all of the measurements and dividing it to the number of measurements. There are around 62 million men in Japan (in 2020 [2]), so: Where $h_n \ (n=1,2,\cdots,62000000)$ represents height of $n^{th}$ Japanese man, and $\mu$ represents “population mean”. The equation given above is specific to this example, and the general equation of mean is as follows: ### Population Mean $$\mu = \frac{\sum_{i=1}^{N}x_i}{N}$$ Where $N$ represents the number of items in a population Calculating mean height on the population 2) The second way is to estimate the mean value. What it is meant by estimate is: instead of measuring the height of every Japanese man, we measure randomly selected subset (sample) of them (I won’t delve into randomness here, it is a subject of another post). As you can imagine, this way is much less time consuming than the first one. It is not as precise as the first one, however, in most of the cases, the error is negligible. This is how we calculate the sample mean: This equation is exactly like the one above it, with only one difference: this time $0<n \ll 62000000$. Here, not every Japanese man was taken into account while calculating the mean, but only a part of them. Bar (-) symbol is used above some letter to describe the “sample” mean (in this case $\bar{h_m}$). ### Sample Mean $$\bar{x} = \frac{\sum_{i=1}^{n}x_i}{n}$$ Where $n$ represents the number of items in the sample Calculating mean height on a sample taken from population As can be seen from the example above, we couldn’t get the real average value when we used only a sample from our population, however, we get pretty close. It is up to you to decide how many samples you are going to use, however, keep in mind that the more samples you use, the less error you will have. Getting back to the contest, now you know another information that can be useful to you to better guess the height of this Japanese man: the mean value. A quick check from the internet showed that it is 172cm. Now you have a better idea of how tall this person could be. Having no further information, you could still guess it as 172, and still have better than before chance of winning the contest. But, you are still worried that this information might not be very reliable. Why? Look at the graph below: Now look at this one: For the sake of this explanation, let's imagine that all of the possible values of height of this Japanese man at the carnival are the ones shown in the figure below: Let's say that, instead of guessing with the mean value (172cm), you want to try your chance with 164cm. We still don't know the actual height of this person, however, we can make some possible error analysis: There are 6 possible height values this person can have, hence we have 6 cases: 1. his actual height is 164cm → you made 0cm error, 2. his actual height is 168cm → you made 4cm error, 3. his actual height is 170cm → you made 6cm error, 4. his actual height is 174cm → you made 10cm error, 5. his actual height is 176cm → you made 12cm error, 6. his actual height is 178cm → you made 14cm error So if you guessed 164cm, on average you would make 7.6cm error: $$\mu_{error} = \frac{0+4+6+10+12+14}{6}=7.6$$ What would happen, if you guessed 176cm? Again we have 6 cases: 1. his actual height is 164cm → you made 12cm error, 2. his actual height is 168cm → you made 8cm error, 3. his actual height is 170cm → you made 6cm error, 4. his actual height is 174cm → you made 2cm error, 5. his actual height is 176cm → you made 0cm error, 6. his actual height is 178cm → you made 2cm error So, on average you would make 5cm error: $$\mu_{error} = \frac{12+8+6+2+0+2}{6} = 5$$ Note: Here we are taking the absolute value of the error. The reason for that is because when the error is negative, there is still an error, however, it reduces the average error. If you think about it, the sign of the error doesn't matter here, only its value matters. Now, one last time, let's do it for the mean value: 1. his actual height is 164cm → you made 8cm error, 2. his actual height is 168cm → you made 4cm error, 3. his actual height is 170cm → you made 2cm error, 4. his actual height is 174cm → you made 2cm error, 5. his actual height is 176cm → you made 4cm error, 6. his actual height is 178cm → you made 6cm error $$\mu_{error} = \frac{8+4+2+2+4+6}{6} = 4.3$$ You can verify by calculating the average error for each possible height value that you get the smallest average error when you guess with the mean value. Repeating one last time: we still don't know the height of this person, however, if we guess it with mean, we would make the least average error. That is why it is a good idea to guess with mean. This situation is not only limited to this example, it is general. Mean value will always give you the least average error. As you can see from the figures above, although in both cases mean values are the same, the diversity is very different. So, okay, we know that the center of our data is located at mean value, however how much the rest of the data are spread? If most of the data are close to mean, you can have higher confidence in your guess, since it is very unlikely to have a data point that is further away from the mean (e.g. a 200cm or 120cm tall Japanese man). However, if the data are spread widely, you wouldn’t be very confident that predicting the height with mean value would be beneficial, because of the high variance. Let’s continue… ## Variance Have you noticed something keep popping up here and there in this post? Probably you have: diversity. Mean gives us information about the center of our data, and the variance tells us how it is spread around it. Looking at a histogram plot could be very informative when we want to see the variance in data: A histogram is a graphical display of data using bars of different heights. Each bar shows how much of the data you have is in a predefined range (also called: bin, or bucket). To make a histogram, first of all, you need to decide how many bins you are going to use, and what range each of these bins is going to have. Let's say you want to draw a histogram for the data you have, which is the height of 1000 Japanese males. First of all, you need to select several ranges that are going to make your bins. Let's say: [155, 160), (160, 165), (160, 165), (165, 170), (170, 175), (175, 180), (180, 185) and (185, 190]. The x-axis on a histogram shows the ranges you have selected, and the y-axis shows how many items you have in each bin. The way this works is as follows: whenever you have a data point in the range of one of your bins, you increase the number of items that bin has by 1. If you have a height value of 183cm in your data, then you increase the number of items in (180, 185) bin by 1, and continue this procedure until you put all of the data you have into one of the bins. Histograms are good visualizations of the distribution of data. It helps you to see in a blink of an eye variance in your data Histogram plot with low variance You can see from the figure above that most of the data points are collected around mean. Because of the variance is low, the number of extremes (both very low and very high values of height) cases are very rare. Because of the variance is not in the same units as values in this graph, we can’t directly show it on the graph (we haven’t seen its equation yet, but if you take a look at it, there is a square in it), however knowing the definition of variance (which is going to be explained in just a moment) allows us to imagine how our data would look like without even a need to look at its graph. As a side note, we can, and we will show the standard deviation on the distribution graph when we talk about it. Going back to the contest, now you know why knowing variation gives us the confidence boost on our guess with the mean value. If we know that the data have low variance, there is a much higher chance that our guess with the mean value will be closer to the actual height of this Japanese gentleman. However, if you look at the figure below, you can see that the variance is very high. Although the mean is still 172cm, the data looks completely random. It is (almost) equally spread into each bin. Histogram plot with high variance ### Variance Variance is a measure of how much the data points are spread around the mean So, now that we know what the variance is we can talk about how to calculate it. The number we are trying to get is the average squared distance between a data point and the mean value. This makes sense, doesn’t it? Mean gives us the center of the data, and averaging the distance each data point has to this point can inform us about the spread. Don’t worry if it is still not so clear, like we did before, we are going to make an example to better understand how it works. But why are we taking the squared distance? We said that we want to get an average distance between the data points and the mean. What happens when a distance is negative? Because we are summing all distances up (for averaging), negative distances would decrease the total summation. We don’t want that. That’s why we square the distances, the point here is to get an idea about the spread, regardless of where the data point is located (here I mean if it is located at the left or right side of the mean). Why not use absolute value then? I won’t go into details of explaining this question, but in short, while the absolute value is not differentiable, the square is. And if you think about it, taking the square of a distance doesn’t have any negative effect on investigating the spread of data around the mean. So, as it was with mean, you can calculate the variance on a population, or estimate it on a sample taken from the population. ### Population Variance $$\sigma^2 = \frac{\sum_{i=1}^{N}{(x_i - \mu)^2}}{N}$$ Where $N$ represents the number of items in the population Where $\sigma^2$ represents the population variance. The equation of sample variance changes a little from population variance: ### Sample Variance $$s^2 = \frac{\sum_{i=1}^{n}{(x_i - \bar{x})^2}}{n-1}$$ Where $n$ represents the number of items in the sample In short, $n$ in the denominator underestimates the variance. $$\frac{\sum_{i=1}^{n}{(x_i-\bar{x})^2}}{n} < \frac{\sum_{i=1}^{n}{(x_i-\bar{x})^2}}{n-1}$$ To understand the reason behind this, we first need to remember that we are estimating both mean and variance. And, we use estimated mean to calculate the variance. To see why this is an issue, let's make an example. For this example, we are going to assume that our population is as shown in the figure below: Example population From the figure above, we know that the population mean is 172. However, in reality, we rarely have the information about the whole population. Mostly, we work on samples that are taken from a population. Because of this reason, in reality, we would have a plot like this: Example sample taken from the population In this case, the estimated mean is 172.8. The thing to keep in mind is that, if different samples had been sampled from the population, a different value for the estimated mean would have been found. So, let's investigate what happens to variance with different values of the mean (here we use population variance's formula): ###### Mean is 164: $$\sigma^2 = \frac{(164-164)^2+(168-164)^2+(174-164)^2+(178-164)^2+(180-164)^2}{5} = 113.6$$ ###### Mean is 168: $$\sigma^2 = \frac{(164-168)^2+(168-168)^2+(174-168)^2+(178-168)^2+(180-168)^2}{5} = 59.2$$ ###### Mean is 172 (population mean): $$\sigma^2 = \frac{(164-172)^2+(168-172)^2+(174-172)^2+(178-172)^2+(180-172)^2}{5} = 36.6$$ ###### Mean is 172.8 (sample mean): $$\sigma^2 = \frac{(164-172.8)^2+(168-172.8)^2+(174-172.8)^2+(178-172.8)^2+(180-172.8)^2}{5} = 36.16$$ ###### Mean is 174: $$\sigma^2 = \frac{(164-174)^2+(168-174)^2+(174-174)^2+(178-174)^2+(180-174)^2}{5} = 37.6$$ ###### Mean is 178: $$\sigma^2 = \frac{(164-178)^2+(168-178)^2+(174-178)^2+(178-178)^2+(180-178)^2}{5} = 63.2$$ ###### Mean is 180: $$\sigma^2 = \frac{(164-180)^2+(168-180)^2+(174-180)^2+(178-180)^2+(180-180)^2}{5} = 93.6$$ Now, let's plot these values: Variance for different mean values Not only for this example, if you plot this graph for any example you will notice 2 important things: 1. the lowest variance value is get when the sample mean is used, 2. population variance is always bigger than sample variance Because of this situation is general, not only specific to this example, we use $n-1$ in the denominator to compensate for the change in the estimated variance. To illustate how to calculate the variance we have the following data: Example of variance calculation There are 6 data points in the figure above, and the mean value for these 6 points is 172. I didn’t think it was necessary to make another section about standard deviation, because after you know how to calculate variance it is very easy to find it. It is just the square root of the variance: Sometimes it is useful to think in terms of standard deviation. Because, it is proven [4] that, for all distributions for which the standard deviation is defined, the amount of data within a number of standard deviations of the mean is at least as much as given in the following table [5]: Distance from mean Minimum population $\sqrt(2)\sigma$ 50% $2\sigma$ 75% $3\sigma$ 89% $4\sigma$ 94% $5\sigma$ 96% $6\sigma$ 97% $k\sigma$ $1-\frac{1}{k^2}$ $\frac{1}{1-l}\sigma$ l You can look at figure below for visualization. ## Putting All Together Now that we know both mean and variance, we can start talking about the normal distribution, and fitting a curve on our data to calculate some probabilities. There are many different probability distributions, however, I just want to make a gentle introduction to normal distribution to have an idea about how to use mean and variance. A curve gives us the same information that a histogram does. However, it has some advantages over a histogram. Namely: 1. When we sample from a population, because of the way we selected those samples, some bins in the histogram might be unoccupied. So, what happens when we need to calculate that probability with the histogram? Since there are no values in that bin, does that mean that it is impossible to get a probability for the values belong to that bin? It is possible when we use a curve. 2. We know that we have to choose several ranges to calculate the number of elements in a bin and to draw a histogram. Let’s say one of the ranges we have chosen for height distribution is (160, 165). But what happens if we want to calculate the probability of having a height between 163.24 and 164.95? How to calculate this with a histogram? Well, we cannot, but we can do it if we had a curve that fits onto that histogram. 3. If we don’t have enough time or money to collect a lot of measurements (samples), the histogram of the data might not be enough to make deductions. In that case, fitting a curve on the histogram using mean and variance (or standard deviation), could save us a lot of time and money. However, remember that both the histogram and the curve are distributions, and they show us how the probabilities of samples are distributed. To draw a normal distribution, knowing only the mean and the variance is sufficient. Important things to know about normal distribution are: 1. the total area under its curve is equal to 1. 2. It is a continuous distribution, hence probabilities are calculated for a specific range, (e.g. probability of height being in the range 170-180) and the probability of a single point (e.g. probability of height being 170) is 0. I don’t want to go into so many details about the normal distribution, because this is a post mainly about mean and variance and how to use them. However, I am sure that many of you will wonder how this curve was drawn. In continuous probability distributions (where values are specified with ranges instead of singular values), probability density functions are used to describe these distributions. And, the probability density function for the normal distribution is as follows: I don’t want you to try so hard to understand what is this equation, how it was found and why it is like that. Instead, if you noticed that the only unknowns in this equation are the mean and the variance (the standard deviation can be found through variance), it is sufficient. And, if you plot this equation, you get the curve shown below. Here we have an example of a normal distribution that is drawn on a histogram plot using randomly generated data that are representing height values of Japanese men. Randomly generated normal distribution representing height of Japanese men Now we are ready to go back to the contest and make an educated guess. You are planning to guess 172cm (the mean value) as this person’s height, but you also want to be sure that you have a good enough probability of winning that katana. You decide that if the probability of height being in the range $168 < height < 176$ is more than 25%, you are going to go with the mean value. So, the next thing you do is to calculate this probability. As we said before, we calculate probability in a range by calculating the area under the curve that is covering that range: Area Under the Curve in the range 168-176cm Based on this distribution, the probability that the height of a Japanese man is between 168-176cm is 0.31. Considering there are many more possible height values, you think this is a pretty good probability, and make your final guess with 172cm. Congratulations! You won the katana! ## Recap • Mean gives us information about the center location within a dataset. If measurements for all population is known (e.g. height values of every Japanese male), it can be calculated as follows: Where $N$ is the number of items in the population. If we have measurements for only a part of the population (because, for example, we didn’t have enough time or money to collect measurements for the whole population), we can still estimate mean as follows: Where $n$ is the number of items in the sample that is taken from the population. • Variance is a measure of how much the data points are spread around the mean. As it was with the mean, we can calculate variance for both a population or a sample that is taken from a population. Where $N$ is the number of items in the population The equation for estimating the variance is slightly different: Where $n$ is the number of items in the sample. • Standard Deviation is equal to the square root of variance. It is sometimes useful to think in terms of it, because it gives us an idea about minimum amount of data within a number of standard deviations of the mean. • Both histogram and curve are distributions, and they show us how the probabilities of samples are distributed. However the curve has some advantages over a histogram. • Normal distribution is a continuous probability distribution, hence it is represented with a probability density function: As can be seen from the equation above, knowing mean and variance is enough to use the normal distribution. In continuous distributions, probabilities of events are calculated within specific ranges (instead of actual values), and AUC is used to calculate these probabilities. ## Conclusions There is diversity on earth, and most of the things are non deterministic. That’s why, to better understand things around us, we need models that might explain them to us. Statistical models are widely used to describe different populations and natural phenomena. Whether you are interested in having a clue about who might win the next election in your country, or you are trying to learn how much variations you should expect in measuring current in a copper wire, or something completely different; I hope that the things you learned in this blog post will help you to achieve that. ## References Please leave a comment below if you have any feedback, criticism, or something that you would like to discuss. I can also be reached on social media: @kivanc_yuksel Tags: auc, histogram, mean, standard deviation, statistical distribution, variance
2021-06-22 22: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": 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.763772189617157, "perplexity": 335.0400927997983}, "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-25/segments/1623488525399.79/warc/CC-MAIN-20210622220817-20210623010817-00201.warc.gz"}
http://www.lmfdb.org/LocalNumberField/?p=19&n=10
## Results: (displaying all 8 matches) Polynomial $p$ $e$ $f$ $c$ Galois group Slope content x10 + x2 - 2x + 14 19 1 10 0 $C_{10}$ $[\ ]^{10}$ x10 - 722x6 + 130321x2 - 61902475 19 2 5 5 $C_{10}$ $[\ ]_{2}^{5}$ x10 - 130321x2 + 12380495 19 2 5 5 $C_{10}$ $[\ ]_{2}^{5}$ x10 - 209x5 + 11552 19 5 2 8 $D_5$ $[\ ]_{5}^{2}$ x10 - 19x5 + 722 19 5 2 8 $D_5\times C_5$ $[\ ]_{5}^{10}$ x10 + 57x5 + 1444 19 5 2 8 $D_5\times C_5$ $[\ ]_{5}^{10}$ x10 - 19 19 10 1 9 $D_{10}$ $[\ ]_{10}^{2}$ x10 + 76 19 10 1 9 $D_{10}$ $[\ ]_{10}^{2}$
2018-07-22 20:30:31
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 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.7432175278663635, "perplexity": 1558.4685858113307}, "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/1531676593586.54/warc/CC-MAIN-20180722194125-20180722214125-00171.warc.gz"}
https://www.projecteuclid.org/euclid.aaa/1425048233
## Abstract and Applied Analysis ### Stability Switches and Hopf Bifurcation in a Coupled FitzHugh-Nagumo Neural System with Multiple Delays #### Abstract A FitzHugh-Nagumo (FHN) neural system with multiple delays has been proposed. The number of equilibrium point is analyzed. It implies that the neural system exhibits a unique equilibrium and three ones for the different values of coupling weight by employing the saddle-node bifurcation of nontrivial equilibrium point and transcritical bifurcation of trivial one. Further, the stability of equilibrium point is studied by analyzing the corresponding characteristic equation. Some stability criteria involving the multiple delays and coupling weight are obtained. The results show that the neural system exhibits the delay-independence and delay-dependence stability. Increasing delay induces the stability switching between resting state and periodic activity in some parameter regions of coupling weight. Finally, numerical simulations are taken to support the theoretical results. #### Article information Source Abstr. Appl. Anal., Volume 2014, Special Issue (2014), Article ID 874701, 13 pages. Dates First available in Project Euclid: 27 February 2015 https://projecteuclid.org/euclid.aaa/1425048233 Digital Object Identifier doi:10.1155/2014/874701 Mathematical Reviews number (MathSciNet) MR3232869 Zentralblatt MATH identifier 07023237 #### Citation Yao, Shengwei; Tu, Huonian. Stability Switches and Hopf Bifurcation in a Coupled FitzHugh-Nagumo Neural System with Multiple Delays. Abstr. Appl. Anal. 2014, Special Issue (2014), Article ID 874701, 13 pages. doi:10.1155/2014/874701. https://projecteuclid.org/euclid.aaa/1425048233 #### References • R. FitzHugh, “Impulses and physiological states in theoretical models of nerve membrane,” Biophysical Journal, vol. 1, no. 6, pp. 445–466, 1961. • J. Nagumo, S. Arimoto, and S. Yoshizawa, “An active pulse transmission line simulating nerve axon,” Proceedings of the IRE, vol. 50, no. 10, pp. 2061–2070, 1962. • A. L. Hodgkin and A. F. Huxley, “A quantitative description of membrane current and its application to conduction and excitation in nerve,” The Journal of Physiology, vol. 117, no. 4, pp. 500–544, 1952. • A. N. Bautin, “Qualitative investigation of a particular nonlinear system,” Journal of Applied Mathematics and Mechanics, vol. 39, no. 4, pp. 606–615, 1975. • J. Duarte, L. Silva, and J. S. Ramos, “Types of bifurcations of FitzHugh-Nagumo maps,” Nonlinear Dynamics, vol. 44, no. 1–4, pp. 231–242, 2006. • T. Ueta, H. Miyazaki, T. Kousaka, and H. Kawakami, “Bifurcation and chaos in coupled BVP oscillators,” International Journal of Bifurcation and Chaos in Applied Sciences and Engineering, vol. 14, no. 4, pp. 1305–1324, 2004. • T. Ueta and H. Kawakami, “Bifurcation in asymmetrically coupled BVP oscillators,” International Journal of Bifurcation and Chaos in Applied Sciences and Engineering, vol. 13, no. 5, pp. 1319–1327, 2003. • S. Tsuji, T. Ueta, and H. Kawakami, “Bifurcation analysis of current coupled BVP oscillators,” International Journal of Bifurcation and Chaos in Applied Sciences and Engineering, vol. 17, no. 3, pp. 837–850, 2007. • D. Yang, “Self-synchronization of coupled chaotic FitzHugh-Nagumo systems with unreliable communication links,” Communications in Nonlinear Science and Numerical Simulation, vol. 18, no. 10, pp. 2783–2789, 2013. • C. Xu and P. Li, “Dynamics in a delayed neural network model of two neurons with inertial coupling,” Abstract and Applied Analysis, vol. 2012, Article ID 689319, 17 pages, 2012. • J. Liang, Z. Chen, and Q. Song, “State estimation for neural networks with leakage delay and time-varying delays,” Abstract and Applied Analysis, vol. 2013, Article ID 289526, 9 pages, 2013. • N. Burić and D. Todorović, “Dynamics of FitzHugh-Nagumo excitable systems with delayed coupling,” Physical Review E, vol. 67, Article ID 066222, 2003. • N. Buric and D. Todorovic, “Bifurcations due to small time-lag in coupled excitable systems,” International Journal of Bifurcation and Chaos, vol. 15, no. 5, pp. 1775–1785, 2005. • N. Burić, I. Grozdanović, and N. Vasović, “Type I vs. type II excitable systems with delayed coupling,” Chaos, Solitons & Fractals, vol. 23, no. 4, pp. 1221–1233, 2005. • Q. Wang, Q. Lu, G. Chen, Z. feng, and L. Duan, “Bifurcation and synchronization of synaptically coupled FHN models with time delay,” Chaos, Solitons and Fractals, vol. 39, no. 2, pp. 918–925, 2009. • D. Fan and L. Hong, “Hopf bifurcation analysis in a synaptically coupled FHN neuron model with delays,” Communications in Nonlinear Science and Numerical Simulation, vol. 15, no. 7, pp. 1873–1886, 2010. • B. Zhen and J. Xu, “Simple zero singularity analysis in a coupled FitzHugh-Nagumo neural system with delay,” Neurocomputing, vol. 73, no. 4–6, pp. 874–882, 2010. • B. Zhen and J. Xu, “Bautin bifurcation analysis for synchronous solution of a coupled FHN neural system with delay,” Communications in Nonlinear Science and Numerical Simulation, vol. 15, no. 2, pp. 442–458, 2010. • Y. Lin, “Periodic oscillation analysis for a coupled FHN network model with delays,” Abstract and Applied Analysis, vol. 2013, Article ID 276972, 6 pages, 2013. • Y. Li and W. Jiang, “Hopf and Bogdanov-Takens bifurcations in a coupled FitzHugh-Nagumo neural system with delay,” Nonlinear Dynamics, vol. 65, no. 1-2, pp. 161–173, 2011. • C. D. Yang, J. Qiu, and J. W. Wang, “Robust ${H}_{\infty }$ control for a class of nonlinear distributed parameter systems via proportional-spatial derivative control approach,” Abstract and Applied Analysis, vol. 2014, Article ID 631071, 8 pages, 2014. • Z. G. Song and J. Xu, “Codimension-two bursting analysis in the delayed neural system with external stimulations,” Nonlinear Dynamics, vol. 67, no. 1, pp. 309–328, 2012. • Z. G. Song and J. Xu, “Bursting near bautin bifurcation in a neural network with delay coupling,” International Journal of Neural Systems, vol. 19, no. 5, pp. 359–373, 2009. • Z.-G. Song and J. Xu, “Stability switches and multistability coexistence in a delay-coupled neural oscillators system,” Journal of Theoretical Biology, vol. 313, no. 21, pp. 98–114, 2012. • Z. Song and J. Xu, “Stability switches and double Hopf bifurcation in a two-neural network system with multiple delays,” Cognitive Neurodynamics, vol. 7, no. 6, pp. 505–521, 2013. \endinput
2020-02-29 13:56:06
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 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.2143401950597763, "perplexity": 3472.703766465929}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 20, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2020-10/segments/1581875149238.97/warc/CC-MAIN-20200229114448-20200229144448-00473.warc.gz"}
https://physics.stackexchange.com/questions/291805/scattering-description-with-spherical-harmonics
# Scattering description with spherical harmonics It is well known that the scattering states in quantum mechanics are not a part of the Hilbert space comprised of the bound states in a given quantum potential. It is often said that the (negative energy) eigenstates are not dense in the larger "rigged" Hilbert space that includes scattering states. However, scattering theory is often described with the "complete set" of hydrogen eigenfunctions - the negative energy eigenstates. This is, e.g. the phase theory of scattering as discussed in Sakurai. My question is: how is it possible to give a description of scattering with the negative energy eigenstates at all? Mathematically speaking, it seems that one is describing a process that should lie strictly in the extended (rigged) space with the limited negative energy Hilbert space. What is going on? • You question's title doesn't match your question. – Ruslan Nov 11 '16 at 16:45
2020-07-02 21:48:19
{"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.8606179356575012, "perplexity": 310.4788529912722}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.3, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2020-29/segments/1593655880243.25/warc/CC-MAIN-20200702205206-20200702235206-00103.warc.gz"}
https://direct.mit.edu/edfp/article/15/4/675/94953/Does-School-Finance-Reform-Reduce-the-Race-Gap-in
Abstract This paper offers new evidence on the impacts of school finance reforms (SFRs) precipitated by school finance litigation, exploring the extent to which the impact of SFR differs by district racial composition. Using difference-in-differences and event study models with a series of district and year (or state-by-year) fixed effects, and a sixteen-year panel of over 10,000 school districts, my analyses exploit variation in funding across school districts, and timing of school finance court orders across states, to estimate the effect of SFR on the distribution of district funding by racial composition. Models include relevant control variables available in national data and results are robust to numerous alternative specifications, including estimating impacts on percent changes in resources (in addition to levels), restricting analyses to districts in SFR states, controlling for additional covariates available in only some years and some states, and adding controls for state-specific time trends. In addition, I estimate changes in New York State to assess whether and to what extent results are sensitive to additional controls for revenue-raising capacity and district costs. Results suggest that SFR can work to alleviate racial funding gaps, though impacts are moderate. 1.  Introduction A persistent issue in U.S. public education is the enduring racial gap in academic performance. One potential contributing factor to the achievement gap is a disparity in resources. Historically, school district financial resources and share of students who are black are negatively correlated, though this has narrowed in recent decades (Card and Krueger 1996; Card and Rothstein 2007). School finance reform (SFR) may partially explain narrowing resource disparities. Court-ordered SFR is a court ruling that mandates a state to change its school funding system and provide fairer educational opportunities to students across the state.1 Most often, SFRs explicitly work to break the link between district wealth and school spending. By this definition, twenty states had at least one SFR by 2010.2 SFR may also weaken the link between race and education funding due to, for example, historical segregation that concentrates nonwhite students in districts with low property wealth (Ryan 1999; Rothstein 2017). Alternatively, SFR may not affect racial funding gaps, perhaps narrowing gaps in district funding between wealthy and poor districts without addressing gaps across racial groups. Thus, the questions remain: To what extent do the impacts of SFR on district funding vary by racial composition, and to what extent does SFR work to close racial funding gaps? This study aims to answer these questions, providing estimates on the extent to which the impacts of SFR are larger as district minority representation increases, and whether local revenue responses offset increases in state aid. Previous work finds that total district funding is correlated with race (Card and Krueger 1996; Ryan 1999). Districts with greater white student compositions, on average, raise greater levels of local revenues than those with greater nonwhite compositions, perhaps because of fewer resource constraints (Card and Payne 2002; Baker, Sciarra, and Farrie 2010). Moreover, others document gaps in local revenues due to historical inequities in access to wealthier school districts (and higher property value communities) precipitated by segregational housing and zoning policies, which still remain insufficiently remedied today (Rothstein 2017). Perhaps surprisingly, then, the share of students who are white is also positively correlated with levels of state aid—intended to be an equalizer of resources—after controlling for revenue-raising capacity and district costs (Stiefel et al. 2005; Chellman 2008). One explanation of this phenomenon is that state funding formulas reflect implicit voting preferences, particularly if there is a mismatch of racial composition between the voting-age population and school-aged children (Poterba 1997; Ladd and Murray 2001; Figlio and Fletcher 2012).3 SFR provides a possible policy mechanism to close the race gap in school funding. Previous research finds that SFR reduces the funding gap between wealthy and poor districts (Murray, Evans, and Schwab 1998; Card and Payne 2002; Corcoran and Evans 2008, 2015; Jackson, Johnson, and Persico 2014, 2016). The same may hold for the race gap in funding if, for example, the share of students who are nonwhite is positively correlated with the share of students at-risk or in poverty. As another example, perhaps historical racial inequalities are embedded in extant state funding formulas, and SFR forces legislatures to revisit these laws, also decreasing racial funding gaps. In this paper, I estimate the extent to which SFR impacts are larger as nonwhite share increases, potentially alleviating racial funding gaps. Using a sixteen-year panel spanning 1996–2011, my analyses exploit variation in funding across school districts and timing of SFR court orders across states to estimate the extent to which the size of SFR's impact increases with share of students who are nonwhite. Models include relevant control variables available in national data but, due to data limitations, do not include controls for time-varying district wealth, such as property tax base. Instead, I estimate difference-in-differences (or event study) specifications with a series of fixed effects to identify the impact of SFR, using interaction terms between SFR and a vector of variables capturing racial composition. As a robustness check, I conduct a detailed descriptive analysis of the changes in New York State (NYS) school finance since its SFR, using a thirteen-year panel spanning 2000–2012. This analysis includes measures of revenue-raising capacity and costs unavailable nationally to assess model sensitivity. For state aid, on average, I find that the effect of SFR is increasing in the shares of students who are black, Hispanic, and American Indian.4 Conversely, SFR leads to smaller increases in state aid as the share of students who are Asian increases. SFR also has a smaller, offsetting effect on the relationship between race and local revenue; SFR has smaller effects on local revenues as the shares of students who are black and American Indian increases, and larger effects on local revenues as the shares who are Asian increases. Effects on local revenues are small relative to effects on state aid. Thus, the impact of SFR on total revenues is similar to state aid—it increases with shares of students who are nonwhite, closing racial funding gaps. Results are robust to a series of alternative specifications, including restricting the sample to “ever SFR states” (those that have a SFR at any point before 2012), assessing timing of impacts using an event study framework, controlling for state-specific time trends, and estimating effects in NYS using additional control variables unavailable nationally.5 In addition, a placebo test indicates that the impact estimates are a result of SFR, not the threat of one. Changes following court rulings in favor of the status quo (“uphold”) are small and insignificant. The rest of the paper is organized as follows. I begin with an overview of the relevant literature, followed by a description of data and measures used and an outline of the empirical strategy. Results for national and NYS analyses, and conclusions follow. 2.  The Links Between SFR, District Resources, and Race Although research on equity and efficiency of educational state aid distribution is rich (Bradbury et al. 1984; Downes and Pogue 1994; Duncombe and Yinger 1998; Odden and Picus 2008; Picus, Goertz, and Odden 2008, 2015), few assess the role of race in determining district resources. Those that do generally find that district racial composition matters (Stiefel et al. 2005; Chellman 2008; Baker and Green 2009). While Baker and Green (2009) suggest race can play a role in SFR, few studies have examined the extent to which the impacts of SFR differ by race. One exception, Sims (2011), finds little relationship between the size of SFR impacts and nonwhite share, but does not control for time-invariant district characteristics, statewide policy or economic changes over time, or disentangle the effects on state aid from those on local revenues. Determinants of School District Financial Resources Schools districts are funded by three levels of government—federal, state, and local—but historically, local and, specifically, local property taxes play the largest role. Thus, local revenues are unequally distributed across districts (Baker, Sciarra, and Farrie 2010). There is also a correlation between district racial composition and local revenues, perhaps due to (or partially due to) historical discrimination limiting access of nonwhites to districts with large property tax bases (Rothstein 2017). The share of revenue from state aid, however, has increased over the past few decades—due in part to SFRs—leading to more equal distributions of resources, at least between wealthy and poor districts (Corcoran and Evans 2008, 2015). State aid generally serves two key purposes: (1) mitigate differences in revenue-raising capacity and (2) address differences in costs due to district characteristics and students’ needs (Picus, Goertz, and Odden 2008, 2015). Revenue-raising capacity is often measured by the size of the property-tax base, sometimes complemented by income and wealth measures (Bradbury et al. 1984; Duncombe and Yinger 1998). Costs are often measured as the share of students requiring additional educational supports (e.g., with special education needs [SPED], English language learners [ELL], and eligible for free lunch [poor]). In addition, cost factors such as price of inputs (e.g., teacher salaries) and district size are sometimes considered (Bradbury et al. 1984; Duncombe and Yinger 1998). Relationship Between District Funding and Racial Composition Race may also be correlated with both costs and revenue-raising capacity (Stiefel et al. 2005; Chellman 2008; Baker and Green 2009; Rothstein 2017). For example, districts with a higher share of nonwhite students may have fewer resources, even after controlling for factors such as poverty. Why? There are at least four reasons. First, racial composition might proxy for unmeasured variables that drive either costs or revenue-raising capacity. For example, poverty measured as the share of students eligible for free lunch misses the depth of poverty among those so designated “poor” (the very poorest may cost more to educate) and the wealth among the “nonpoor” (if the families of the wealthiest students increase revenue-raising capacity).6 State aid formulas may have a disparate racial impact due to poor measurement of costs and revenue-raising capacity. Second, the demand for public education spending may respond to racial composition, affecting funding through voter bias. Funding for public education is lower in states, counties, and school districts with different racial compositions among the elderly and school-aged populations (Poterba 1997; Ladd and Murray 2001; Figlio and Fletcher 2012). More specifically, funding is lower in places with predominantly white elderly and predominantly black child populations than in places with high shares of whites in both age groups.7 Third, racial composition itself may affect the costs of education. Districts with large nonwhite populations may find teachers demand higher (compensating) wages, offer less advantageous peer groups, and teacher training is not well-designed for efficient instruction in these contexts. For example, Baker and Green (2009) find that districts with high shares of black students offer lower peer-group and teacher quality, which disadvantages these districts. Fourth, historical, structural racism that isolates poor and minority groups in low property wealth districts may limit the ability of districts with high minority concentrations to raise local revenues. Policies, such as redlining, limiting access to borrowing, and discriminatory housing policies, segregate minorities into districts with slower economic and property value growth, which may reduce current revenue-raising capacity (Rothstein 2017). In spite of the above (or perhaps related to the first two factors), previous research finds that nonwhite student share has a negative, significant, and independent effect on the level of state aid provided to districts (not just on local revenues), despite the fact that states do not explicitly account for race in their state aid funding formulas (Stiefel et al.2005; Chellman 2008). The relationship between race and total resources might grow even stronger then, due to other inequalities outlined above, including costs of education, access to districts with larger tax bases, immigration patterns, and effects of structural segregation. Court-Mandated School Finance Reform Previous work finds SFR increases school spending overall and increases the share of funding that comes from state aid as opposed to local revenues (Corcoran and Evans 2008, 2015).8 Further, when SFR increases state aid, increases are not fully offset by reductions in local revenues. Instead, spending gaps narrow between wealthy and poor (and high- and low-spending) districts, driven by spending increases in low-spending districts rather than reductions in high-spending districts (Murray, Evans, and Schwab 1998; Card and Payne 2002; Corcoran and Evans 2008, 2015; Jackson, Johnson, and Persico 2014, 2016; Lafortune, Rothstein, and Schanzenbach 2018). These distributional effects appear to hold years after the SFR (Liscow 2018). Thus, SFR generates higher, more adequate, or more equitable funding, or all three. Further, equalization of state aid is greater in SFR states than those with rulings that uphold school finance formulas, suggesting that the threat of a SFR lawsuit is likely insufficient to elicit funding formula changes (Card and Payne 2002). Finally, some find SFR narrows achievement gaps between wealthy and poor districts (Card and Payne 2002; Jackson, Johnson, and Persico 2014, 2016; Johnson and Tanner 2018; Lafortune, Rothstein, and Schanzenbach 2018). That said, few studies examine impacts of SFR on racial disparities. One notable exception, Sims (2011), finds little impact of SFR on the relationship between total district revenues and racial composition. Unfortunately, Sims does not include district fixed effects, so results may be biased by unobserved time-invariant characteristics. Further, Sims does not differentiate between state, local, and federal revenue sources or between the various nonwhite groups (i.e., black, Hispanic, Asian, and American Indian). Perhaps most importantly, none of the previous studies control for potential common state-year-specific shocks using state-by-year fixed effects. Thus, contemporaneous statewide changes in resource constraints, nonwhite share, and non-SFR policies are all potential confounders to previous estimates. This paper builds on Sims (2011) and contributes to the literature by examining whether the impact of SFR on district funding (state aid, local revenue, and total revenue) differs by racial composition. Previous SFR research uses difference-in-differences models to exploit the staggered timing of SFR across states; this study introduces state-by-year fixed effects and a set of interaction terms to estimate the extent to which the SFR effect increases (or decreases) with nonwhite shares. Little previous work differentiates between the effects of SFR court orders and the threat of litigation, which I begin to disentangle by exploring the effects of court rulings that “uphold” state funding formulas. In addition, following Lafortune, Rothstein, and Schanzenbach (2018), I explore the effects of SFR over time using an event study framework. 3.  Data and Measures Data and Measures for National Analysis The study merges three key datasets: (1) district revenues and enrollment from the United States Census Bureau's Annual Survey of Local Government Finances File (F33 File); (2) student composition from the National Center for Education Statistics Common Core of Data Public Elementary/Secondary School Universe Survey Data (School Universe Survey); and (3) a compiled, cumulative history of judicially-mandated SFRs (Card and Payne 2002; Corcoran and Evans 2008, 2015; Education Law Center 2014; SchoolFunding.Info 2016). District funding is measured as per pupil state aid, local revenues, and total revenues. State aid per pupil is total state aid to a district (including formula assistance, special education, bilingual education, capital outlays, debt service, among others) divided by district enrollment. Local revenue per pupil is total local revenues (including property taxes, other taxes, fees, among others) divided by enrollment. Total revenue per pupil captures all local financial resources including per pupil state, local, and federal revenues. These variables reflect the size of school districts’ budgets and mixes of revenue sources. I adjust all dollar figures for inflation and report them in 2011 dollars using the Consumer Price Index. District black, Hispanic, white, Asian, and American Indian student percentages capture district racial composition and district poverty as the percentage of students classified as eligible for free lunch (all aggregated from the School Universe Survey and weighted by enrollment).9 District size is captured by district enrollment (in 1,000s). Other measures of district cost factors, such as share of students who receive SPED and ELL services, are unavailable nationwide in some years.10 As noted above, information on SFRs comes from a compiled, cumulative history of judicially mandated SFRs.11 Cases strictly related to capital/facilities financing or strictly procedural rulings (that remand a case to a lower court) are excluded. I use an inclusive definition of SFR—the first court order from the highest court in each state—which is conservative because a district is “treated” even if changes in funding do not occur immediately (or at all) and even if other cases are brought forward at a later date. Table A.1 provides a full list of school finance court cases used here. I construct two vectors of variables to capture state SFR history. First, SFR is a binary variable that takes a value of one if a state has (at any time previously) an SFR court order and zero otherwise. Second, SFRYr is a vector of binary variables that reflect the number of years before and after a state's first SFR court order. I limit the sample to unified school districts providing K–12 education to ensure differences in the grades served by different districts do not bias my estimates.12 In addition, I restrict the sample to districts with both financial and demographic data and exclude districts in Hawaii and Washington, DC (since each has only one school district). The sample includes 10,000–11,000 school districts per year over the 16-year period between 1996 and 2011.13 The sample represents forty-nine states, over 80 percent of districts, and over 90 percent of total enrollment. Data and Measures for NYS Case Study and Robustness Check Whereas national data lack consistent measures of revenue-raising capacity and costs, such as property values, NYS provides numerous measures of both cost factors and revenue-raising capacity over a thirteen-year period (2000–2012), including share of ELL and SPED students, effective local property tax rate, and district wealth, allowing a more nuanced analysis. Specifically, I use district revenue, enrollment, and demographic data on the almost 700 school districts for 2000–2012, merging district financial data from the NYS Education Department's (NYSED's) Fiscal Analysis and Research Unit, and demographic data from the NYSED's Information and Reporting Services, to the national dataset. The sample is a balanced panel of 672 districts that operate in all thirteen years.14 To be sure, NYS provides an attractive setting for this robustness check because it is demographically diverse, has substantial variation in racial composition across districts and over time, offers rich data on district costs and revenue-raising capacity, and is a SFR state. Further, it offers a mix of rural, urban, and suburban districts. As of 2011, NYS was the third largest state in the United States in terms of total population and public school student population. Measures of per pupil state aid, local and total revenue, race, and poverty are the same as the national analyses.15 Additional control variables fall into two major categories: (1) district revenue-raising capacity and (2) district costs. Measures of district revenue-raising capacity include district combined wealth ratio (CWR), the effective local tax rate, and share in poverty.16 CWR is an index used by NYSED in their funding formulas that includes taxable real property value and adjusted gross income per pupil as measured against the state average, providing a good measure of district fiscal capacity.17 Effective local tax rate measures the extent to which a district is already exhausting local taxable resources. District poverty is the same as in the national data. Measures of district costs include student attendance rate, enrollment (same as national data), and share of students who receive SPED and ELL services. 4.  Model and Empirical Strategy The central questions of this study are simple: To what extent do the impacts of SFR on state aid increase as minority representation increases, and are changes in state aid offset by local revenue responses? I answer these exploiting the staggered timing of SFR across states using a modified difference-in-differences model (or an event study framework) with district and state-by-year fixed effects and controls for time-varying district characteristics. A standard difference-in-differences model (used in previous research) provides estimates of SFR's impacts by comparing the average change among districts in SFR states to those in states without a SFR. I apply this model to replicate previous work on the main effect of SFR, using more recent data (Murray, Evans, and Schwab 1998; Card and Payne 2002; Corcoran and Evans 2008, 2015). I then add a vector of interactions between SFR and district racial composition to estimate the impacts of SFR by nonwhite share. In preferred models, which identify impacts by race, I include district fixed effects and state-by-year fixed effects, relaxing some of the key identification assumptions of traditional difference-in-differences models. In particular, preferred model estimates are robust to time-invariant differences across districts, differences between states in every year, and differences across states that may be correlated with SFR timing.18 Difference-in-Differences Analyses My central model is as follows: $Revist=β0+NWist'β1+β2SFRst+SFR*NWist'β3+β4Povist+Enrollist'β5+γis+δt+ɛit,$ (1) where Revist is district funding (per pupil state aid, and later, per pupil local or total revenue) in district i in state s in time t; NW is a vector reflecting district i’s nonwhite racial composition (percentage Black, Hispanic, Asian, and American Indian); SFR takes a value of one if state s has a SFR by year t and zero otherwise; Povist controls for percentage of students certified eligible for free meals and Enrollist controls for possible economies of scale (enrollment divided by 1,000 for scaling purposes, and its square);19γis and δt are district and year fixed effects, respectively; ε is an error term with the usual properties. Model 1 and all subsequent regressions are weighted by district enrollment using analytic weights (with robust standard errors clustered by district to address heteroscedasticity).20 I capture common macroeconomic factors with year fixed effects.21 In preferred specifications, I include district and state-by-year fixed effects, γis and ζst, which control for the time-invariant conditions of districts and changes in statewide macro factors, including economic, demographic, and policy, among others.22 In these models, coefficients are identified by differences within state-year, over time. The coefficient of interest, β3, reflects changes in the impact of SFR on per pupil revenues (state, local, or total) as the share of students who are black, Hispanic, Asian, or American Indian increases by 1 percentage point, respectively.23 Preferred model estimates assess the impact of SFR as identified by the interaction between the SFR and NW share, which are robust to time-varying conditions within each state (including macroeconomic and other changes in policy), district fixed characteristics (including urbanicity or fixed components of the tax base), and changes in district poverty rates and size.24 Note that even if a district's racial composition does not change over time, the impact is identified by the interaction between NW and SFR.25 Then, to further probe the mechanisms, I add an additional interaction term between Povist and SFRst to determine whether the relationship between race and district funding is mediated by share of students in poverty. That is, I test whether race is simply a proxy for poverty, with other estimates reflecting SFR impacts by poverty. I also assess whether the results are driven by changing demographics or by historical differences in racial composition. I fix district NW share to the composition in the first sample year (1996), identifying impacts using the interaction between baseline nonwhite student shares and SFR status.26 A final alternative specification includes state-specific linear time-trends in lieu of state-by-year fixed effects. Robustness and Placebo Tests: Comparing Impact on State Aid in Overturn and Uphold States What if the threat of court intervention is sufficient to induce funding changes? In previous models, court decisions in favor of a state are included in the comparison group, because they do not precipitate a SFR. I use two models to assess the threat of SFR as a potential mechanism, using two different subsamples: (1) states with a SFR overturn and (2) states with an uphold ruling (in favor of the status quo). I reestimate the preferred models for these two subsamples, assessing the effects of overturn and uphold decisions, separately. The results from models including only overturn states provide a robustness test of the previous state aid results. The results from models including uphold states serve as a placebo test. If results are in the same directions and of similar magnitudes, then the impact of SFR may result from the threat of a lawsuit (among other possible mechanisms), rather than the SFR itself. Results that are insignificant, small, or in the opposite direction, suggest that SFR itself drives the paper's other findings. Event Study Analyses Delayed legislation, delayed implementation, court appeals, hold-harmless provisions, or some combination of all four may delay the full effect of SFR. In NYS, for example, the initial plaintiff victory occurred in 2003, but legislative action did not take place until 2007. Moreover, many SFRs have “hold-harmless” provisions that may disallow nominal reductions in state aid received.27 In some states, therefore, districts that, according to a formula, are at risk for a reduction in state aid may only face real reductions in state aid at the rate of inflation. An additional model specification (using an event study framework) includes a vector of interaction terms capturing time to and since SFR and district racial composition. The vector of interaction terms provides estimates of the number of years it takes for district funding to respond to SFR. The results from the event study, therefore, also test general consistency of the SFR effect over time (in terms of size, direction, or potential fade-out). Further, the event study is used to assess the parallel trends assumption that outcomes do not change prior to treatment. I restrict the sample to overturn states and estimate a nonparametric model.28 $Revist=β0+NWist'β1+SFRYr*NWist'β2+β3Povist+β4Enrollist+γis+ζst+ɛit,$ (2) where SFRYr is a vector of variables indicating the number of years before or after a SFR in state s, such that SFRYr_0 takes a value of one in the year immediately preceding a SFR and SFRYr_1 takes a value of one in the first year of the SFR.29,30 The interaction between SFRYr and NW identifies impacts of SFR over time by race. The parallel trends assumption is satisfied if the relationship is unchanged in every year until year 0 (coefficients are indistinguishable from zero until SFR). A SFR level effect occurs if there is then a discrete change in resources between year 0 and year 1. Changes in district funding each year thereafter indicate a slope effect. Results from the event study provide point estimates for three years before SFR (SFRYr_−3 = 1) to eight years after (SFRYr_8 = 1). I omit observations more than three years before a SFR, which form the reference category. Like the difference-in-differences estimates, the event study yields causal estimates if SFR timing (the year of court orders) is exogenous within state and year. Robustness Check: District Funding Changes Following SFR in NYS I investigate the sensitivity of my results to the inclusion of additional control variables by using a panel of NYS districts to assess whether results from models that include additional measures of districts’ costs and revenue-raising capacities vary from those that do not. The analyses using NYS data use the same model specifications outlined above, however, state-by-year (and state) fixed effects are not included (only NYS is in the sample). In addition to Enroll and Pov, the models also include district CWR, effective local tax rate, attendance rate, and share of students who receive SPED and ELL services. Again, I focus on the interaction of SFR and racial composition. For example, does the size of state aid increases post-SFR increase with the share of students who are black? What are local revenue responses? I then, again, turn to event study estimates. As shown in table A.1, NYS had its first SFR decision in 2003 (Campaign for Fiscal Equity, Inc. v. New York, 100 N.Y.2d 893, 801 N.E.2d 326, 769 N.Y.S.2d 106 [App. Div. 2003]). After the NYS legislature failed to sufficiently address the adequacy concerns in the 2003 ruling, the Court ruled against the State again in 2006 and ordered legislative action (Campaign for Fiscal Equity, Inc. v. New York, 29 A.D.3d 175, 814 N.Y.S.2d 1 [App. Div. 2006]). In 2007, the NYS legislature passed the New York State Education Budget and Reform Act, providing additional funding to school districts across NYS. The legislation eliminated a number of categorical aid programs, shifted funds into a foundation aid formula, and provided greater weight in the formula for poor children. Then, in response to budget shortfalls due to the economic recession, NYS froze increases in foundation aid in 2010 and reduced foundation aid in 2011 and 2012. For consistency with the national analyses and because complicated SFR histories are not unique to NYS, I use the first overturn year, 2003, to identify the SFR effect. I then use the event study to explore the relationship between race and district funding following each of NYS's reform events (court orders in 2003 and 2006, legislation in 2007) and freezes in foundation aid. The event study illuminates the idiosyncrasies of the SFR in NYS (most SFR states have idiosyncratic SFR event histories). 5.  Results Descriptive Results Figure 1 presents mean resources per pupil in U.S. districts by year (1996–2011). Mean state aid increases over time from about $4,750 per pupil in 1996 to about$6,050 per pupil in 2011 (all figures in 2011 dollars). Mean local revenue (total revenue) increases from $4,221 ($9,507) to $5,624 ($13,096), as well. Figure 1 does not capture heterogeneity across districts. For example, the 10th percentile of districts in 2011 receives about $3,000 in state aid per pupil, whereas the 90th percentile receives nearly$9,000. In addition, variation across districts has grown over time and is greater for local revenues than state aid. The coefficient of variation for state, local, and total revenues grows from 0.42, 0.80, and 0.34 in 1996 to 0.51, 0.85, and 0.40 in 2011, respectively. Figure 1. District Funding Per Pupil, U.S. School Districts, 1996—2011 Notes: All dollar figures are in constant 2011 dollars, adjusted using the Consumer Price Index. Figure 1. District Funding Per Pupil, U.S. School Districts, 1996—2011 Notes: All dollar figures are in constant 2011 dollars, adjusted using the Consumer Price Index. Panel A of table 1 presents summary statistics for district demographic and funding characteristics in the first and last year of the sample (1996 and 2011). In addition to revenue increases, the mean U.S. district also experiences increases in share of students who are black, Hispanic, Asian, and American Indian and free lunch eligible. Mean district enrollment increases by about 300 students, while the number of districts is largely unchanged.31 Table 1. Mean District Characteristics Panel A. United States Districts, 1996 and 2011Panel B. New York State Districts, 2000 and 2012 1996201120002012 Student characteristics (%)   Student Characteristics (%) Free or reduced-price lunch 22.1 38.8 Free or reduced-price lunch 30.2 35.9 White 81.6 72.7 White 88.6 82.2 Black 7.5 9.2 Black 5.1 5.3 Hispanic 6.2 12.6 Hispanic 3.8 7.8 Asian 1.2 2.4 Asian 2.4 4.6 American Indian 2.4 3.0 ELL 1.7 2.2 ELLa N/A 3.11 SPED 12.1 12.3 SPEDb 10.2 13.9 Financial characteristics Financial characteristics   State aid PP 6,376 7,995 State aid PP 4,752 6,056 Local revenue PP 8,443 12,487 Local revenue PP 4,221 5,624 Total revenue PP 15,967 22,775 Total revenue PP 9,507 13,096 Combined wealth ratio 1.2 1.2 Enrollment 3,869 4,171 Effective local tax rate 18.1 16.7 Districts 10,544 10,453 Attendance rate 95.0 94.9 Enrollment 4,214 3,949 Districts 672 672 Panel A. United States Districts, 1996 and 2011Panel B. New York State Districts, 2000 and 2012 1996201120002012 Student characteristics (%)   Student Characteristics (%) Free or reduced-price lunch 22.1 38.8 Free or reduced-price lunch 30.2 35.9 White 81.6 72.7 White 88.6 82.2 Black 7.5 9.2 Black 5.1 5.3 Hispanic 6.2 12.6 Hispanic 3.8 7.8 Asian 1.2 2.4 Asian 2.4 4.6 American Indian 2.4 3.0 ELL 1.7 2.2 ELLa N/A 3.11 SPED 12.1 12.3 SPEDb 10.2 13.9 Financial characteristics Financial characteristics   State aid PP 6,376 7,995 State aid PP 4,752 6,056 Local revenue PP 8,443 12,487 Local revenue PP 4,221 5,624 Total revenue PP 15,967 22,775 Total revenue PP 9,507 13,096 Combined wealth ratio 1.2 1.2 Enrollment 3,869 4,171 Effective local tax rate 18.1 16.7 Districts 10,544 10,453 Attendance rate 95.0 94.9 Enrollment 4,214 3,949 Districts 672 672 Notes: Student descriptive statistics reported at the district level, weighted by enrollment. Sample includes districts that enroll both primary and secondary school students. All dollar figures in panel A are in constant 2011 dollars and panel B in constant 2012 dollars, adjusted using the Consumer Price Index. PP = per pupil. aEnglish language learner (ELL) data are unavailable before 1999 and coverage is poor in other years; ELL information is available in only 9,866 districts in 2011. bSpecial education (SPED) data coverage is poor in 2004, 2005, 2008, and 2009 (available in only 9,100—9,500 districts); SPED information is available in only 10,272 districts in 2011. Descriptively, districts with greater minority representation receive less state aid per pupil on average than those with lesser minority representation. Districts with student enrollments that are at least 10 percent black (top 19 percent of districts in 2011) receive $5,848 in state aid per pupil, which is$601 per pupil less than districts that are no more than 1 percent black (bottom 29 percent of districts receiving $6,549 per pupil).32 In 2011, 29 percent of districts have student populations that are at least 10 percent Hispanic and receive, on average,$980 less per pupil than the 14 percent of districts with less than 1 percent of students who are Hispanic ($5,909 and$6,889, respectively). Few districts (3.7 percent) have student populations over 10 percent Asian in 2011, but they receive $1,300 less than those composed of less than 1 percent Asian students ($5,091 and $6,429, respectively). Districts with high shares of students who are black (at least 10 percent) also raise less local revenue than those with low shares (less than 1 percent). Conversely, districts with high shares of students who are Hispanic or Asian raise more local revenue than those with low shares. These descriptive results are consistent with previous work that makes regression adjustments for costs and revenue-raising capacity (Chellman 2008). Impact Estimates: Effects of SFR by Race Estimates of the main effect of SFR on state aid are shown in columns 1 and 4 of table 2. Consistent with previous work, SFR is associated with an increase in state aid per pupil. Impacts range from$812 for the model with district and year fixed effects but no national control variables (column 1) up to $819 in the model with national control variables (column 4).33 Previous research finds that earlier SFRs induce similar increases in state aid. For example, once converting results reported in 1992 dollars to 2011 dollars, Card and Payne (2002) find SFR states increase state aid by$796 more than uphold states and $958 more than states with no ruling (from 1977 to 1992).34 Table 2. Regression Results, Impact of School Finance Reform (SFR) and Race on Per Pupil State Aid, U.S. Districts, 1996—2011 Without National ControlsWith National Controls (1)(2)(3)(4)(5)(6) SFR 812.32*** 621.13*** 818.87*** 625.52*** (14.321) (20.515) (14.455) (20.460) SFR × % Black 6.65*** 19.44*** 8.36*** 19.03*** (0.552) (0.592) (0.550) (0.590) Hispanic 42.50*** 5.24*** 40.86*** 5.77*** (0.903) (0.922) (0.916) (0.931) Asian −36.85*** −51.00*** −29.89*** −54.79*** (2.875) (2.770) (2.893) (2.796) American Indian 79.29*** 55.18*** 78.48*** 54.36*** (2.004) (1.929) (1.992) (1.923) Black −4.01*** −11.07*** 1.73* −8.06*** (1.041) (0.907) (1.050) (0.932) Hispanic −50.03*** 1.53 −38.12*** 1.26 (1.010) (0.970) (1.077) (1.012) Asian −11.90*** −49.09*** −0.34 −36.58*** (3.000) (2.906) (3.008) (2.934) American Indian −16.37*** 3.65 −15.76*** 3.16 (3.051) (2.609) (3.032) (2.600) District characteristics Year FE District FE State-Year FE Observations 161,815 161,815 161,815 161,815 161,815 161,815 Districts 11,157 11,157 11,157 11,157 11,157 11,157 R2 0.843 0.845 0.897 0.845 0.847 0.898 Without National ControlsWith National Controls (1)(2)(3)(4)(5)(6) SFR 812.32*** 621.13*** 818.87*** 625.52*** (14.321) (20.515) (14.455) (20.460) SFR × % Black 6.65*** 19.44*** 8.36*** 19.03*** (0.552) (0.592) (0.550) (0.590) Hispanic 42.50*** 5.24*** 40.86*** 5.77*** (0.903) (0.922) (0.916) (0.931) Asian −36.85*** −51.00*** −29.89*** −54.79*** (2.875) (2.770) (2.893) (2.796) American Indian 79.29*** 55.18*** 78.48*** 54.36*** (2.004) (1.929) (1.992) (1.923) Black −4.01*** −11.07*** 1.73* −8.06*** (1.041) (0.907) (1.050) (0.932) Hispanic −50.03*** 1.53 −38.12*** 1.26 (1.010) (0.970) (1.077) (1.012) Asian −11.90*** −49.09*** −0.34 −36.58*** (3.000) (2.906) (3.008) (2.934) American Indian −16.37*** 3.65 −15.76*** 3.16 (3.051) (2.609) (3.032) (2.600) District characteristics Year FE District FE State-Year FE Observations 161,815 161,815 161,815 161,815 161,815 161,815 Districts 11,157 11,157 11,157 11,157 11,157 11,157 R2 0.843 0.845 0.897 0.845 0.847 0.898 Notes: Robust standard errors clustered by district in parentheses. All figures are in constant 2011 dollars, adjusted using the Consumer Price Index. Columns 1—3 rely on fixed effects alone; columns 4—6 include control variables for district characteristics, including share certified eligible for free lunch, and enrollment (1000s) and its square. Regression weighted by district enrollment. Reference category: Share of district students who are white. FE = fixed effects. *p < 0.10; ***p < 0.01. Columns 2, 3, 5, and 6 of table 2 show differences in SFR impact by nonwhite share.35 Impact estimates (coefficients on the interactions between SFR and NW) in models with national controls (columns 5 and 6) do not differ greatly from models with only fixed effects (columns 2 and 3). Including state-by-year fixed effects (columns 3 and 6) changes the magnitudes (relative to columns 2 and 5), but not the directions, of the coefficients of interest.36 Preferred estimates, derived from the model with national control variables, state-by-year and district fixed effects, are shown in column 6. As the share of students who are black, Hispanic, and American Indian grows, so does the impact of SFR on state aid. For example, a 1-percentage point increase in the share of students who are black increases the impact of SFR by$19 per pupil. As the share of students who are Asian increases, however, the boost in state aid from SFR declines. A 1-percentage point increase in the share of students who are Asian dampens the effect of SFR on state aid by $55 per pupil. These impacts are moderate for the average U.S. district, but quite large for districts with large nonwhite representation. As noted in table 1, the average U.S. district had a 1.7-percentage point increase in share of students who are black from 1996 to 2011 (7.5 percent to 9.2 percent). If a state had its first court-mandated SFR in 1997 (e.g., New Hampshire and Ohio), preferred estimates in column 6 of table 2 suggest that state aid increases by$32 more per pupil, on average, than if the share of students who are black did not increase. In many cases the effect is larger. For example, the Charlotte-Mecklenburg school district experienced large increases in share of students who are black during the sample period, from 40.6 percent to 45.4 percent. Charlotte-Mecklenburg's 4.8-percentage point increase in black share is associated with an additional state aid bump of $91 as a result of North Carolina's SFR (compared with a mean SFR effect of$819). Results also imply that if Charlotte-Mecklenburg had no black students in 2011, SFR's effect on state aid would be $864 smaller, commensurate in size to the main effect of SFR ($819). Conversely, the share of students who are Asian is negatively correlated with the relative generosity of SFR. The average U.S. district has a 1.2-percentage point increase in the share of students who are Asian between 1996 and 2011, implying that the average SFR effect is $66 smaller than it would be with no growth in Asian representation. In New York City, the impact is much larger, because the share of students who are Asian rises from 9.5 percent in 1996 to 13.2 percent in 2011, which is associated with$203 fewer dollars in state aid per pupil than the main effect of SFR. The increase in New York City's Asian representation cost the city up to 24 percent of the benefits of SFR (compared with the main effect of $819). If New York City had no Asian students in 2011, then the implied SFR effect would be 88 percent ($723) greater. In sum, SFR increases state aid to districts, but the relative generosity of SFR depends greatly upon district racial composition. Columns 1 through 3 of table 3 show that local revenue responses generally offset some of the impacts of SFR for American Indian and Asian representation. Preferred estimates from models with state-by-year fixed effects, column 3, show SFR decreases local revenue by $13 per pupil as the share of students who are American Indian increases (compared with a$54 increase in state aid). Conversely, SFR increases local revenue as the share of students who are Asian increases ($41 per pupil compared to a$55 decrease in state aid per pupil). Similarly, local revenue responses offset some of the positive effects of SFR on state aid for black representation (in the preferred model). The estimates for local revenue responses are less consistent across specifications than the results for state aid, but are generally smaller in magnitude than the impacts for state aid.37 Table 3. Regression Results, Impact of School Finance Reform (SFR) and Race on Per Pupil Local Revenue and Total Revenues, U.S. Districts, 1996—2011 Local RevenuesTotal Revenues (1)(2)(3)(4)(5)(6) SFR 296.94*** 148.83***  1,094.12*** 598.03*** (14.502) (20.532)  (20.611) (29.223) SFR × % Black  1.76*** −1.55**  4.73*** 21.51*** (0.677) (0.690)  (0.964) (0.962) Hispanic  −9.75*** 7.04***  26.08*** 13.76*** (0.971) (1.084)  (1.383) (1.512) Asian  68.23*** 40.57***  31.07*** 8.92** (3.171) (3.245)  (4.513) (4.527) American Indian  −19.73*** −12.91***  50.71*** 48.71*** (2.148) (2.255)  (3.057) (3.146) Black  −29.94*** −26.25***  −29.58*** −37.17*** (1.108) (1.089)  (1.577) (1.520) Hispanic  −10.99*** −14.84***  −30.30*** 0.50 (1.085) (1.180)  (1.545) (1.646) Asian  −3.91 23.62***  7.86* −18.96*** (3.201) (3.406)  (4.556) (4.752) American Indian  −10.41*** −2.70  0.73 20.27*** (3.188) (3.023)  (4.538) (4.217) District characteristics Year FE District FE State-Year FE Observations 161,815 161,815 161,815 161,815 161,815 161,815 Districts 11,157 11,157 11,157 11,157 11,157 11,157 R2 0.915 0.916 0.933 0.845 0.847 0.882 Local RevenuesTotal Revenues (1)(2)(3)(4)(5)(6) SFR 296.94*** 148.83***  1,094.12*** 598.03*** (14.502) (20.532)  (20.611) (29.223) SFR × % Black  1.76*** −1.55**  4.73*** 21.51*** (0.677) (0.690)  (0.964) (0.962) Hispanic  −9.75*** 7.04***  26.08*** 13.76*** (0.971) (1.084)  (1.383) (1.512) Asian  68.23*** 40.57***  31.07*** 8.92** (3.171) (3.245)  (4.513) (4.527) American Indian  −19.73*** −12.91***  50.71*** 48.71*** (2.148) (2.255)  (3.057) (3.146) Black  −29.94*** −26.25***  −29.58*** −37.17*** (1.108) (1.089)  (1.577) (1.520) Hispanic  −10.99*** −14.84***  −30.30*** 0.50 (1.085) (1.180)  (1.545) (1.646) Asian  −3.91 23.62***  7.86* −18.96*** (3.201) (3.406)  (4.556) (4.752) American Indian  −10.41*** −2.70  0.73 20.27*** (3.188) (3.023)  (4.538) (4.217) District characteristics Year FE District FE State-Year FE Observations 161,815 161,815 161,815 161,815 161,815 161,815 Districts 11,157 11,157 11,157 11,157 11,157 11,157 R2 0.915 0.916 0.933 0.845 0.847 0.882 Notes: Robust standard errors clustered by district in parentheses. All figures are in constant 2011 dollars, adjusted using the Consumer Price Index. All models include control variables for district characteristics, including share certified eligible for free lunch, and enrollment (1,000s) and its square. Regression weighted by district enrollment. Reference category: Share of district students who are white. FE = fixed effects. *p < 0.10; **p < 0.05; ***p < 0.01. Column 4 of table 3 shows that SFR increases total revenues substantially (over $1,000 per pupil). Columns 5 and 6 suggest that total revenues increase at an even greater rate as share of students who are black, Hispanic, Asian, and American Indian increases. This result is consistent across both specifications, but the magnitudes differ. Despite local revenue responses, SFR has a greater positive effect on total revenues as nonwhite share increases.38 Importantly, the source of increased funding for Asian share is local revenues, while the main source for the other three nonwhite groups is state aid. Robustness and Placebo Tests: SFR Impact on State Aid in Overturn and Uphold States Estimates in column 1 of table 4 show the main effect of SFR is robust to limiting the sample to overturned states only ($638 per pupil).39 Column 2 shows that estimates by race are also robust to the alternative sample constraints and are statistically indistinguishable from those shown in table 2. Finally, an additional specification (in column 3) adds state-specific time trends to the model; again, the results are consistent. Table 4. Robustness and Placebo Tests, Impact of School Finance Reform (SFR) on State Aid in Overturn and Uphold States, U.S. Districts, 1996—2011 SFR / OverturnNo SFR / Uphold (1)(2)(3)(4)(5)(6) Post-ruling 637.97***   69.67 (89.890)   (74.190) Post-ruling × % Black  21.39*** 15.25***  −12.26* −4.91 (5.019) (4.527)  (6.935) (6.463) Hispanic  8.37** 9.34**  −2.44 6.55 (3.580) (4.279)  (4.445) (4.270) Asian  −66.21*** −63.90***  0.29 2.02 (14.652) (21.823)  (11.643) (13.016) American Indian  43.71*** 61.33***  18.24* −2.54 (15.160) (18.055)  (9.514) (8.224) Black  −29.19*** −27.96***  28.21*** 19.17** (11.022) (10.728)  (8.827) (8.502) Hispanic  5.50 3.27  20.38*** 12.20* (11.941) (12.281)  (5.967) (6.368) Asian  21.49 11.98  −36.35** −36.37** (22.315) (27.171)  (16.533) (17.158) American Indian  20.06 −13.92  −12.79 12.21 (24.289) (32.722)  (12.350) (11.016) District characteristics Year FE District FE State-Year FE State Trend Observations 73,351 73,351 73,351 123,101 123,101 123,101 Districts 5,014 5,014 5,014 8,464 8,464 8,464 R2 0.845 0.881 0.866 0.843 0.903 0.884 SFR / OverturnNo SFR / Uphold (1)(2)(3)(4)(5)(6) Post-ruling 637.97***   69.67 (89.890)   (74.190) Post-ruling × % Black  21.39*** 15.25***  −12.26* −4.91 (5.019) (4.527)  (6.935) (6.463) Hispanic  8.37** 9.34**  −2.44 6.55 (3.580) (4.279)  (4.445) (4.270) Asian  −66.21*** −63.90***  0.29 2.02 (14.652) (21.823)  (11.643) (13.016) American Indian  43.71*** 61.33***  18.24* −2.54 (15.160) (18.055)  (9.514) (8.224) Black  −29.19*** −27.96***  28.21*** 19.17** (11.022) (10.728)  (8.827) (8.502) Hispanic  5.50 3.27  20.38*** 12.20* (11.941) (12.281)  (5.967) (6.368) Asian  21.49 11.98  −36.35** −36.37** (22.315) (27.171)  (16.533) (17.158) American Indian  20.06 −13.92  −12.79 12.21 (24.289) (32.722)  (12.350) (11.016) District characteristics Year FE District FE State-Year FE State Trend Observations 73,351 73,351 73,351 123,101 123,101 123,101 Districts 5,014 5,014 5,014 8,464 8,464 8,464 R2 0.845 0.881 0.866 0.843 0.903 0.884 Notes: Robust standard errors clustered by district in parentheses. Reference category: Share of district students who are white. All figures are in constant 2011 dollars, adjusted using the Consumer Price Index. Regression weighted by district enrollment. Columns 1—3 show estimated impact in states with an SFR/overturn. Columns 4—6 show estimated impact of court rulings in favor of a state in uphold states. FE = fixed effects. *p < 0.10; **p < 0.05; ***p < 0.01. Estimates in columns 4 through 6 of table 4 show that there is no statistically significant (at the 95 percent level) effect of failed SFR lawsuits (uphold rulings). Moreover, point estimates are small or in the opposite direction of the SFR effect, suggesting that the impacts of SFR operate through court orders and not characteristics of states with SFR challenges or the threat of one. Probing the Results: Using Baseline Racial Composition and Including Additional Controls Column 1 of table 5 shows the findings largely derive from historical differences in district racial composition, rather than changing demographics. For column 1, the values for share of students who are black, Hispanic, Asian, or American Indian are time-invariant measures assigned based on racial compositions in 1996. Thus, estimates reflect the impact of historical differences in racial composition only rather than both historical differences and changing demographics.40 Point estimates are largely consistent and, perhaps, a little larger for the share of students who are black, Hispanic, and Asian than in the models that use contemporaneous measures of racial composition.41 Table 5. Robustness Tests, Impact of School Finance Reform (SFR) and Race on Per Pupil State Aid Using Baseline Racial Composition and Additional Controls, U.S. Districts, 1996—2011 Baseline Racial CompositionAdditional Controls (1)(2)(3) SFR × % Black 22.61*** 17.13*** 16.56** (5.132) (4.968) (7.059) Hispanic 14.73*** 6.69 6.79 (4.280) (4.992) (4.302) Asian −105.43*** −47.10*** −50.70*** (20.727) (12.123) (12.238) American Indian 36.91*** 47.91*** 40.51*** (14.098) (14.454) (13.485) Black  −2.46 7.73 (5.013) (5.957) Hispanic  7.28 11.80** (5.257) (5.459) Asian  −9.64 7.32 (12.342) (12.535) American Indian  6.58 12.30* (6.283) (6.799) SPED  17.06** 12.26* (7.318) (7.042) ELL   0.88 (4.426) District characteristics District FE State-Year FE Observations 159,715 156,455 109,515 Districts 10,862 11,151 11,019 R2 0.895 0.887 0.895 Baseline Racial CompositionAdditional Controls (1)(2)(3) SFR × % Black 22.61*** 17.13*** 16.56** (5.132) (4.968) (7.059) Hispanic 14.73*** 6.69 6.79 (4.280) (4.992) (4.302) Asian −105.43*** −47.10*** −50.70*** (20.727) (12.123) (12.238) American Indian 36.91*** 47.91*** 40.51*** (14.098) (14.454) (13.485) Black  −2.46 7.73 (5.013) (5.957) Hispanic  7.28 11.80** (5.257) (5.459) Asian  −9.64 7.32 (12.342) (12.535) American Indian  6.58 12.30* (6.283) (6.799) SPED  17.06** 12.26* (7.318) (7.042) ELL   0.88 (4.426) District characteristics District FE State-Year FE Observations 159,715 156,455 109,515 Districts 10,862 11,151 11,019 R2 0.895 0.887 0.895 Notes: Robust standard errors clustered by district in parentheses. All figures are in constant 2011 dollars, adjusted using the Consumer Price Index. District characteristics include share certified eligible for free lunch, and enrollment (1,000s) and its square. Column 1 shows results from models holding racial composition constant at 1996 levels (thus, racial composition is in the rank space of the district fixed effects in column 1). Columns 2 and 3 show results from models that include additional control variables, share of students in SPED (special education) and ELL (English language learner) programs, in the years and states for which they are available. The number of observations varies across models based on the availability of data (districts in operation after 1996 only are omitted in the models for column 1; observations missing share of students in SPED or ELL programs are omitted in the models for columns 2 and 3). Regression weighted by district enrollment. Reference category: Share of district students who are white. FE = fixed effects. *p < 0.10; **p < 0.05; ***p < 0.01. Table 5 also displays consistent results from models with additional control covariates (samples used for these models are smaller than in tables 2 and 3 because measures are not available in all districts and years). Column 2 shows that estimates are of similar magnitudes and indistinguishable statistically with the inclusion of a control for SPED students.42 Similarly, results (in column 3) are nearly identical after controlling for ELL share. In sum, results from the difference-in-differences models are moderate and robust. As the share of students who are black increases by 1 percentage point, the impact of SFR on state aid increases by $15 to$23 per pupil. The same increase for Hispanic students increases the benefits of SFR by $5 to$15 per pupil (though it is insignificant in two specifications). For a 1-percentage point increase in share of students who are American Indian, the impact of SFR is $37 to$79 higher. Some of these effects are dampened by local revenue responses, but effects on total revenues remain fiscally meaningful for these three racial groups. Conversely, as Asian representation increases, SFR impact on state aid decreases (by between $40 and$100). Local revenue responses fully offset the impact on state aid for the share of students who are Asian, so the impact of SFR on total revenues also increases with Asian representation. Event Study Results (Impact of SFR Over Time) Figure 2 shows point estimates from the event study, tracing the link between race and district funding over time. First, the event study results in both panel A (state aid) and panel B (local revenue) indicate the relationship between race and district funding is stable in the years leading up to SFR; none of the point estimates prior to SFR are statistically distinguishable from 0 (at the 95 percent level). That is, the groups have parallel funding trends prior to SFR. Figure 2. Impact of School Finance Reform (SFR) and Race on Per Pupil (PP) State Aid Over Time, Event Study Framework, U.S. Districts in SFR States, 1996—2011 Notes: Point estimates regression adjusted for district poverty (share students certified eligible for free lunch) and district size (enrollment/1,000 and the quadratic of enrollment/1,000), and state-by-year and district fixed effects. All figures are in constant 2011 dollars, adjusted using the Consumer Price Index. Regression weighted by district enrollment. Reference category: Share of district students who are white. Reference year: Four or more years before SFR. Figure 2. Impact of School Finance Reform (SFR) and Race on Per Pupil (PP) State Aid Over Time, Event Study Framework, U.S. Districts in SFR States, 1996—2011 Notes: Point estimates regression adjusted for district poverty (share students certified eligible for free lunch) and district size (enrollment/1,000 and the quadratic of enrollment/1,000), and state-by-year and district fixed effects. All figures are in constant 2011 dollars, adjusted using the Consumer Price Index. Regression weighted by district enrollment. Reference category: Share of district students who are white. Reference year: Four or more years before SFR. Second, same as in table 2, panel A shows the impact of SFR on state aid increases as the share of students who are black, Hispanic, and American Indian increases. This relationship holds each year and for at least eight years post reform.43 In addition to the level effect immediately following a SFR, the impact of SFR for black and Hispanic representation grows slowly over time, whereas the effect for American Indian representation grows sharply initially and then levels off. Conversely, same as in table 2, increases in share of students who are Asian dampens the SFR impact on state aid. This negative impact grows over time. Although only suggestive, these results are consistent with the slow roll-out of new funding formulas, hold-harmless provisions, delays in passage or enactment of legislation, court appeals, or some combination of all four. Panel B of figure 2 shows changes in local revenues, which are generally small relative to effects on state aid (same as in table 3). Results are insignificant for share of students who are Hispanic or black in every year, and almost every year for American Indian share (slightly negative after six years). Conversely, the effect for share of students who are Asian is large, positive, and offsets the effect on state aid. Robustness Check: District Funding Changes Following SFR in NYS Panel B of table 1 shows that, like districts nationwide, NYS districts receive more revenues per pupil over time (from 2000 to 2010 state aid grows from $6,376 to$7,995, local revenues grow from $8,443 to$12,487, and total revenues grow from $15,967 to$22,775, all in real 2012 dollars). Again, funding varies across districts. The NYS district with the least state aid per pupil in 2012 receives $929, while the district with the maximum receives$22,399. Similarly, one district raises just $1,182 in local revenue per pupil in 2012, while another raises$134,280 per pupil. Table 1 also shows that nonwhite share grows over time, mirroring national trends; white share declines from 88.8 percent to 82.2 percent. Shares of students in poverty, ELL, and SPED also increase. Columns 2 and 3 of table 6 show that there is not a statistical or substantive difference in estimates between models that include control variables available nationally and models that include the full set of control variables available in NYS.44 Further, estimates in NYS are similar in direction to the average state nationally (though magnitudes are smaller and the effect on share of students who are Hispanic is insignificant).45 Like the national results, coefficients for the average district are moderate, but meaningful. Table 1 shows that the average NYS district has a 2.2-percentage point increase between 2000 and 2012 in the share of students who are Asian. The results in column 3 of table 6 suggest that state aid in 2012 is $58 lower per pupil than it would have been if mean Asian representation did not increase from 2.4 percent to 4.6 percent. Impacts are larger in places like the Syracuse City School District, where the share of students who are Asian rises by 8.3 percentage points, from 2.7 percent to 11.0 percent. In 2012, Syracuse receives$12,853 in state aid per pupil. According to model estimates, if the relationship between Asian representation and state aid did not change, then state aid to Syracuse would be $218 higher than it is in 2012—30 percent of the state aid increases associated with the average SFR nationally ($819).46 Table 6. Robustness Check, Impact of School Finance Reform (SFR) and Race on Per Pupil State Aid, New York State Districts, 2000—2012 (1)(2)(3) SFR × % Black 40.92*** 9.83*** 9.61*** (1.178) (1.207) (1.205) Hispanic −7.98*** 0.13 0.48 (1.641) (1.676) (1.677) Asian −28.79*** −24.82*** −26.21*** (4.138) (3.891) (3.873) Black −92.29*** −29.88*** −27.32*** (4.763) (4.635) (4.685) Hispanic −34.93*** 14.01*** 7.59 (4.724) (4.937) (5.124) Asian 13.66** 23.67*** 28.43*** (6.863) (6.344) (6.316) % FRPL  −14.99*** −13.58*** (1.835) (1.849) Enrollment  −561.09*** −542.37*** (11.777) (11.908) Enroll^2  0.27*** 0.26*** (0.006) (0.006) Combined wealth ratio   −272.29*** (40.134) Local effect rate   10.29*** (3.015) Attendance rate   −1.72 (3.780) % ELL   44.87*** (5.459) % SPED   30.17*** (5.168) Observations 8,736 8,736 8,736 Districts 672 672 672 R2 0.955 0.966 0.967 (1)(2)(3) SFR × % Black 40.92*** 9.83*** 9.61*** (1.178) (1.207) (1.205) Hispanic −7.98*** 0.13 0.48 (1.641) (1.676) (1.677) Asian −28.79*** −24.82*** −26.21*** (4.138) (3.891) (3.873) Black −92.29*** −29.88*** −27.32*** (4.763) (4.635) (4.685) Hispanic −34.93*** 14.01*** 7.59 (4.724) (4.937) (5.124) Asian 13.66** 23.67*** 28.43*** (6.863) (6.344) (6.316) % FRPL  −14.99*** −13.58*** (1.835) (1.849) Enrollment  −561.09*** −542.37*** (11.777) (11.908) Enroll^2  0.27*** 0.26*** (0.006) (0.006) Combined wealth ratio   −272.29*** (40.134) Local effect rate   10.29*** (3.015) Attendance rate   −1.72 (3.780) % ELL   44.87*** (5.459) % SPED   30.17*** (5.168) Observations 8,736 8,736 8,736 Districts 672 672 672 R2 0.955 0.966 0.967 Notes: Robust standard errors clustered by district in parentheses. Regression adjusted for combined wealth ratio, effective local tax rate, percentage of students certified eligible for free or reduced-price lunch (FRPL), attendance rate, enrollment divided by 1,000 and the square of enrollment divided by 1,000, percentage of students receiving special education (SPED) and English language learner (ELL) services, and year and district fixed effects. Figures in constant 2012 dollars, adjusted using the Consumer Price Index. Regression results weighted by district enrollment. Reference category: Share of district students who are white. **p < 0.05; ***p < 0.01. Local revenue responses in NYS, shown in columns 1–3 of table 7, fully offset changes in the relationship between race and state aid. Estimates in column 2 (and 3) suggest that SFR in NYS leads to $17 ($17) less local revenue per pupil as black representation increases by 1 percentage point, $5 ($6) less as Hispanic representation increases by 1 percentage point, and $68 ($60) more as Asian representation increases by 1 percentage point. Estimates of changes in total revenue (columns 4–6) bear this out. The impact of SFR on total revenues is unchanged as Hispanic and black representation increases, though it does increase as Asian representation increases. Again, most importantly, estimates for local and total revenues are not sensitive to inclusion of the additional control variables available in NYS.47 Table 7. Robustness Check, Impact of School Finance Reform (SFR) and Race on Per Pupil Local and Total Revenue, New York State Districts, 2000—2012 Local RevenueTotal Revenue (1)(2)(3)(4)(5)(6) SFR × % Black −21.89*** −16.51*** −16.57*** 23.95*** −2.63 −3.24 (1.707) (1.989) (1.869) (2.046) (2.273) (2.169) Hispanic 22.32*** 5.45** 6.37** 20.31*** 3.97 5.62* (2.379) (2.762) (2.601) (2.851) (3.156) (3.019) Asian 96.02*** 67.56*** 60.30*** 82.65*** 43.39*** 34.41*** (5.999) (6.410) (6.007) (7.188) (7.326) (6.973) Black −94.34*** −74.00*** −70.59*** −193.28*** −95.37*** −91.71*** (6.904) (7.637) (7.268) (8.272) (8.727) (8.436) Hispanic −54.94*** −10.94 3.74 −104.76*** 15.93* 28.25*** (6.847) (8.134) (7.949) (8.204) (9.296) (9.227) Asian −66.57*** −26.92** −19.69** −89.21*** −17.38 −5.54 (9.949) (10.452) (9.798) (11.921) (11.945) (11.373) % FRPL  4.99* −0.73  −3.14 −8.26** (3.023) (2.868)  (3.455) (3.329) Enrollment  104.84*** 114.40***  −473.25*** −448.03*** (19.405) (18.471)  (22.176) (21.441) Enroll^2  −0.06*** −0.06***  0.21*** 0.20*** (0.009) (0.009)  (0.011) (0.010) Combined wealth ratio   1,597.24***   1,284.60*** (62.257)   (72.265) Local effect rate   105.13***   118.23*** (4.677)   (5.429) Attendance rate   13.90**   6.99 (5.864)   (6.807) % ELL   −18.50**   13.54 (8.468)   (9.829) % SPED   88.64***   123.28*** (8.017)   (9.305) Observations 8,736 8,736 8,736 8,736 8,736 8,736 Districts 672 672 672 672 672 672 R2 0.966 0.966 0.971 0.936 0.943 0.949 Local RevenueTotal Revenue (1)(2)(3)(4)(5)(6) SFR × % Black −21.89*** −16.51*** −16.57*** 23.95*** −2.63 −3.24 (1.707) (1.989) (1.869) (2.046) (2.273) (2.169) Hispanic 22.32*** 5.45** 6.37** 20.31*** 3.97 5.62* (2.379) (2.762) (2.601) (2.851) (3.156) (3.019) Asian 96.02*** 67.56*** 60.30*** 82.65*** 43.39*** 34.41*** (5.999) (6.410) (6.007) (7.188) (7.326) (6.973) Black −94.34*** −74.00*** −70.59*** −193.28*** −95.37*** −91.71*** (6.904) (7.637) (7.268) (8.272) (8.727) (8.436) Hispanic −54.94*** −10.94 3.74 −104.76*** 15.93* 28.25*** (6.847) (8.134) (7.949) (8.204) (9.296) (9.227) Asian −66.57*** −26.92** −19.69** −89.21*** −17.38 −5.54 (9.949) (10.452) (9.798) (11.921) (11.945) (11.373) % FRPL  4.99* −0.73  −3.14 −8.26** (3.023) (2.868)  (3.455) (3.329) Enrollment  104.84*** 114.40***  −473.25*** −448.03*** (19.405) (18.471)  (22.176) (21.441) Enroll^2  −0.06*** −0.06***  0.21*** 0.20*** (0.009) (0.009)  (0.011) (0.010) Combined wealth ratio   1,597.24***   1,284.60*** (62.257)   (72.265) Local effect rate   105.13***   118.23*** (4.677)   (5.429) Attendance rate   13.90**   6.99 (5.864)   (6.807) % ELL   −18.50**   13.54 (8.468)   (9.829) % SPED   88.64***   123.28*** (8.017)   (9.305) Observations 8,736 8,736 8,736 8,736 8,736 8,736 Districts 672 672 672 672 672 672 R2 0.966 0.966 0.971 0.936 0.943 0.949 Notes: Robust standard errors clustered by district in parentheses. Regression adjusted for combined wealth ratio, effective local tax rate, percentage of students certified eligible for free or reduced-price lunch (FRPL), attendance rate, enrollment divided by 1,000 and the square of enrollment divided by 1,000, percentage of students receiving SPED (special education) and ELL (English language learner) services, and year and district fixed effects. Figures in constant 2012 dollars, adjusted using the Consumer Price Index. Regression results weighted by district enrollment. Reference category: Share of district students who are white. *p < 0.10; **p < 0.05; ***p < 0.01. 6.  Conclusions Historically, public education in the United States is mostly funded with local revenues (largely local property taxes). In the past forty years, however, state funding has played an increasing role, growing from 39.9 percent in 1970 (Corcoran and Evans 2008, 2015) to 47.0 percent in 2011. This paper highlights the important role that courts can play in determining the distribution of that state aid, the extent to which racial composition matters, and whether local revenue responses offset changes in state aid distributions. Taken together, evidence presented in this paper contributes to the public finance literature on the effects of SFR by exploring impacts by race. I first estimate impacts of SFR on levels of state aid received. I find that SFR increases state aid to school districts on average and that the impact is larger as black, Hispanic, and American Indian representation increases. Conversely, increases in Asian representation decrease the SFR effect on state aid. One explanation is that districts with lesser shares of white students have lower levels of political influence and benefit from court-ordered reforms designed to increase equity and ensure adequacy. Another is that SFR provides a break from continuation of historically discriminatory policies. If one of the goals of SFR is to address racial inequity in the distribution of district funding, then these results are encouraging. Still, the opposite impact occurs for the share of students who are Asian, working against equalization of funding. At first, these per-pupil changes in state aid seem small, but are quite large when considering the concentration of nonwhite students in certain districts. As outlined previously, about 20 percent of districts have black student representation of at least 10 percent. Using the point estimates from column 6 of table 2, SFR increases state aid in these districts by at least $171 more per pupil than in districts with less than 1 percent black shares (the bottom 30 percent). Similarly, about 30 percent of districts are at least 10 percent Hispanic, leading to a$52 larger SFR impact on state aid than in districts that are less than 1 percent Hispanic (about 15 percent of districts). Conversely, the few districts with large shares of students who are Asian (3.7 percent of districts are at least 10 percent Asian) have an SFR effect that is $493 per pupil smaller than those with small shares (less than 1 percent).48 I then find small, offsetting effects on local revenues, which are trumped by the changes in state aid. The overall effect on total revenues is moderate and in the same direction as the effects on state aid. Results are robust to inclusion of state-by-year fixed effects and state-specific time trends. Results are also robust to restricting the sample to districts in states that ever have a SFR. A placebo test that examines the “impact” of court rulings upholding state aid formulas finds null effects and suggests the impacts of SFR result from court orders and not the threat of court action (alleviating concerns that estimates are biased by pre-emptive legislative action). Future work on SFR should conduct similar analyses to separate out which aspects of SFR effects are a result of court orders and which are a result of the threat of lawsuit. Then, using an event study framework, I find the sign of the estimates is consistent through the first eight years following SFR and evidence that the parallel trends assumption holds. Finally, I conduct a case study of NYS to assess sensitivity to additional controls for cost and revenue-raising capacity. In NYS, results from model specifications with a fuller set of controls do not vary from the results from models with a more parsimonious set of controls available nationally. Results from the NYS event study suggest that the parallel trends assumption holds, additional changes occur after a second SFR, and effects level off during the recession. One might believe that the only way to address racial inequity is to target resources based on race, focusing policies specifically on disadvantaged racial groups. Funding based on race, however, could potentially be challenged in court as providing disparate treatment on the basis of race. Instead, these results suggest that the average SFR from 1990 through 2010—court-mandated reforms initiated over adequacy concerns—does help remedy racial funding gaps. The results of this paper suggest that SFR has larger effects as nonwhite share increases and is, perhaps, an important policy lever to address racial inequality even when the court decisions are made on nonracial grounds. The otherwise moderate-looking effects are quite large in majority-minority districts and other districts with large minority student populations. Racial inequality, whether a result of historical de jure discrimination or current de facto segregation, can be partially remedied by court orders that target adequacy concerns. SFRs precipitated by adequacy court rulings may serve to equalize funding by race, without exposing states to potential disparate treatment lawsuits. Although declines in local revenues offset some of the effects of increased state aid, local revenue responses are small relative to the gains from SFR. Therefore, despite previous concerns, the current waves of judicial mandates can affect education aid in multiple ways—they might guarantee access to a minimum threshold of education funding and can also address racial equity concerns. Acknowledgments I thank Amy Ellen Schwartz, Leanna Stiefel, Colin Chellman, Sean Corcoran, Meryle Weinstein, Daniel L. Smith, Thad Calabrese, Ingrid Gould Ellen, Rob Loomis, and Christian Buerger for their comments. The research reported here was partially supported by the Institute of Education Sciences, U.S. Department of Education, through grant R305B080019 to New York University. The opinions expressed are those of the author alone and do not represent views of others acknowledged here, the Institute of Education Sciences, or the U.S. Department of Education. Notes 1. Throughout this paper, SFR refers to court orders for reform, regardless of the timing of school finance legislation. That is, I use an inclusive definition of SFR, exploiting the first highest court order in each state, regardless of whether and when actual changes in state funding mechanisms occur or if other cases are brought forward. 2. Students in these twenty states constitute 69 percent of the total U.S. elementary and secondary public student population in 2010. In 2014, the South Carolina Supreme Court became the twenty-first state with a SFR ruling. Other states have rulings focused on capital expenditures or on a specific class of students (for example, English language learners). I follow Corcoran and Evans (2008, 2015) and do not include rulings focused on targeted funds or populations as SFRs. 3. It is important to note that no state has a funding formula that enumerates race as a determinant of the levels of state aid distributed. 4. The National Center for Education Statistics Common Core of Data Public Elementary/Secondary School Universe Survey identifies a category of students as “American Indian/Alaska Native.” While some prefer the phrase “Native American,” I follow the National Center for Education Statistics category names in this paper. 5. In addition, all results shown in this paper show impacts as the level change in dollars per pupil, but results are robust to assessing the impact on percent changes in resources (the natural logarithm of state aid, local revenues, and total revenues). These results are available from the author upon request. 6. As another example, SPED share ignores the level of accommodation students need or their likelihood for certain diagnoses, both of which may be correlated with race. 7. This is consistent with findings for other public expenditures, which include income redistribution, roads, libraries, and sanitation (Alesina, Baqir, and Easterly 1999; Luttmer 2001; Lind 2007). 8. The history of SFR is often described as having multiple waves, the first challenging aid formulas on equity concerns and the second pursuing challenges based on adequacy concerns (Thro 1994; Verstegen 1998). Plaintiffs pursue equity cases on the principle that all students in a state should attend schools that receive similar levels of educational funding. Plaintiffs pursue adequacy cases on the principle that all students in a state should have access to a minimally acceptable level of education. Note that both equity and adequacy SFRs are fundamentally about fairness in financing education. Most SFR cases since 1990 (a majority of the cases providing identification in this paper) are based upon adequacy concerns. 9. In some years and states additional racial categories are given, such as Pacific Islander. In these cases, I configure the categories in the same manner as if all states use a five-category system. Share Pacific Islander, for example, is added to the Asian share of students, as it would have been without the Pacific Islander designation. 10. SPED and ELL data are available in some states and in some years. I test the robustness of the main results to inclusion of controls for SPED and ELL for academic years 1999–2011 in the districts for which these data are available, finding consistent results displayed in table 5. 11. Sources include Card and Payne (2002); Corcoran and Evans (2008, 2015); Education Law Center (2014); SchoolFunding.Info (2016). 12. There are approximately 16,000 school districts in the United States. These districts vary in terms of size and grades served. Finding consistent measures of school district resources is difficult. Most importantly for this study, costs of operating primary and secondary schools vary greatly and states support these levels of education at disparate levels. 13. The sample for models that include SPED and ELL data include about 8,000–9,000 school districts per year over a thirteen-year period between 1999 and 2011. 14. The universe includes 680 districts operating in at least one year. 15. Shares of students who are American Indian and multi-racial are small in NYS districts (less than 1 percent of student population in 2012). For results presented, these groups are included in the share of students who are “Asian.” Results are robust to grouping multi-racial and American Indian with share who are black and Hispanic as well. 16. Note that the percentage of students who are certified eligible for free or reduced-price lunch can also be characterized as a district cost factor because children from low income households cost more to educate. 17. New York State Education Department (2012). 18. These models cannot be used to estimate the main effect of SFR or the historical relationship between race and district funding (due to collinearity with state-by-year and district fixed effects, respectively). SFR is one component of the macro conditions in a state in each year. That is, SFR is perfectly collinear with state-by-year fixed effects and the main SFR effect would “drop out.” 19. In robustness checks, I add share ELL and SPED students as controls, for a sample of districts for which data are available. 20. About 20 percent of public school students in the sample are enrolled in about 1 percent of school districts. 21. I test the parallel trends assumption using an event study framework (outlined in model 2), and find that impacts occur concurrently with SFR. Preferred models, with state-by-year and district fixed effects, further relax parallel trends assumptions by comparing impacts within-state each year. Further, I assess the impact of SFR on racial composition, putting NWist on the left-hand side of model 1. SFR does not substantially change district racial composition; none of the four nonwhite groups changes as a share of district population by more than 0.6 percentage points. These results are shown in table A.2. 22. Models that include ζst, exclude year fixed effects, δt, and SFRst, due to collinearity. 23. As an additional robustness check, impacts on the natural logarithm of per pupil state aid (percent change) are reported in table A.3 and do not vary greatly from the primary results. 24. And for a subset of districts with available data, changes in share of students who receive SPED and ELL services. 25. In this peculiar case (racial composition does not vary within district over time), the interaction still allows for estimation of the coefficient β3, even if NW is not identified because it is collinear with the district's fixed effect. In fact, results are nearly identical in models that fix racial composition to the first sample year, 1996 (column 1 of table 5). Thus, the variation used to estimate β3 are changes in SFR status within districts over time, rather than changes in racial compositions within districts over time. 26. In these models, NW is not identified because baseline NW is perfectly collinear with the district fixed effects. 27. According to Baker and Corcoran (2012, p. 26) “hold-harmless provisions take numerous forms, but the general idea is that no district should receive either less state aid or less in total funding than it received in some baseline comparison year.” 28. An alternative model specification keeps all districts, but only includes interactions between SFRYr and NW in the years following a SFR, with no post-period for other states. Estimates of the impacts in the years following SFRs are consistent in this model specification and are available upon request of the author. 29. For example, the finding in Montoy v. Kansas, 278 Kan. 769, 102 P.3d 1160 (Sup. Ct. 2005), is in favor of the plaintiffs. The indicator for SFRYr_1=1 for all Kansas districts in 2005, SFRYr_2=1 in 2006, etc. 30. The secular trend computed by the vector SFRYrst is excluded in models with state-by-year fixed effects, ζst, due to collinearity. 31. That is, there are a similar number of consolidating and splitting districts. 32. Not shown in table 1 are sample means by districts’ racial compositions (available upon request). 33. Results from alternative specifications, which include only state fixed effects in lieu of district fixed effects, are similar and available from the author upon request. 34. Specifically, Card and Payne (2002) find the change in state revenue per pupil from 1977 to 1992 in SFR states is$1,276 in 1992 dollars ($2,035 in 2011 dollars), while in uphold and no court decision states the increase in spending is$777 and $675 in 1992 dollars ($1,239 and $1, 076 in 2011 dollars), respectively. 35. Impact estimates reported as elasticities are reported in table A.3. 36. Significance, magnitude, and direction of the coefficients on NW vary across models, but impact estimates from interaction of NW and SFR do not. NW is a control covariate in these models; estimates of the secular relationships between race and state aid are not well identified and are sensitive to the counterfactual (annual national means in models that include district and year fixed effects; annual statewide means in models that include district and state-by-year fixed effects). 37. For local and total revenue results, it is important to note that districts in SFR states increase spending following SFR. At the same time, districts generally see increasing minority representation during this period. Models with state and year fixed effects only (as used previously in SFR research) might be biased by these trends, which is why preferred models control for common, annual, statewide macro factors using state-by-year fixed effects. Results from table 3, column 3, are preferred. 38. Table A.4 shows results from models that include an additional interaction term between SFR and Pov. The impacts of SFR by race are not a result of the correlation between race and poverty. Estimated impacts of SFR on state aid, local revenues, and total revenues remain unchanged in sign, magnitude, and significance for all races. 39. Results shown from preferred models with state-by-year and district fixed effects. Other results available from the author upon request. 40. There are somewhat fewer observations and districts in this sample because some districts do not operate in 1996. 41. Moreover, as noted previously, SFR does not change district racial composition greatly (see table A.2). 42. Comparing column 2 in table 5 to column 6 in table 2, only the Hispanic result in the district fixed effects models has a change in significance; it goes from significant in column 6 of table 2 to insignificant in column 2 of table 5. The difference is statistically indistinguishable and point estimates are less than a$1 per pupil difference. 43. Point estimates are statistically significant in every year and for every race/ethnicity group, with the exception of the Hispanic share in the second year of SFR. 44. As with previous models, all estimates come from models that include district fixed effects and the vector of racial composition variables. Therefore, estimates of control covariates’ coefficients, including CWR, the effective local tax rate, attendance rate, ELL, SPED, Enroll, and Pov, are not linear approximations of NYS funding formulas. 45. Table A.5 shows estimates are not sensitive to excluding NYS's largest districts, the “Big 5” (New York City, Buffalo, Rochester, Syracuse, and Yonkers). 46. Figure A.1 shows estimates from the event study, which, like the national results, provide no evidence the parallel trends assumption is violated. Panel A shows a slight, statistically significant increase in the relative generosity of state aid as black representation increases in year 1 of NYS's SFR (2003) that persists in each successive year and grows following the second overturn in 2006 and legislation in 2007 (SFR years 4 and 5, respectively). After the 2003 SFR, there is also a small bump in funding correlated with the share of students who are Hispanic, but it fades after the second court ruling. Finally, the relationship between Asian representation and state aid is negative after SFR; again, there is a level effect in year 1 and an additional inflection point following the 2006 court ruling and 2007 legislation. Unique to NYS, all three results level off by SFR years 8 to 10 (corresponding to 2010–2012), concurrent with the great recession, budget shortfalls, and NYS temporarily ending its commitment to the new foundation aid formula in 2011. 47. The event study in panel B of figure A.1 shows that local revenues per pupil increase at a faster rate after SFR as share of students who are Hispanic and Asian increases, and at a slower rate as the share who are black increases. The Asian and black effects grow over time, particularly following the second SFR ruling and SFR legislation (SFR years 4 and 5). Again, unlike national results, the local revenue responses to SFR in NYS are quite large relative to changes in state aid. 48. Presented differently, one can compare the size of the SFR effect for districts in 90th versus 10th percentile for shares of students who are black, Hispanic, Asian, and American Indian. The SFR impact is about $516,$216, and $179 higher for districts in the top decile of black, Hispanic, and American Indian representation, respectively, versus districts in the lowest decile. The SFR impact is$268 lower for districts in the top decile of Asian representation versus districts in the lowest decile. REFERENCES REFERENCES Alesina , Alberto , Reza Baqir , and William Easterly . 1999 . Public goods and ethnic divisions . Quarterly Journal of Economics 114 ( 4 ): 1243 1284 . Baker , Bruce D. , and Sean P. Corcoran . 2012 . The stealth inequities of school funding: How state and local school finance systems perpetuate inequitable student spending . Washington, DC : Center for American Progress . Baker , Bruce D. , and Preston C. Green III . 2009 . Equal educational opportunity and the distribution of state aid to schools: Can or should school racial composition be a factor ? Journal of Education Finance 34 ( 3 ): 289 323 . Baker , Bruce D. , David G. Sciarra , and Danielle Farrie . 2010 . Is school funding fair? A national report card . Newark, NJ : Education Law Center . , Katharine , Helen F. , Mark Perrault , Andrew Reschovsky , and John M. Yinger . 1984 . State aid to offset fiscal disparities across communities . National Tax Journal 37 ( 2 ): 151 170 . Card , David , and Alan B. Krueger . 1996 . School resources and student outcomes: An overview of the literature and new evidence from North and South Carolina . Journal of Economic Perspectives 10 ( 4 ): 31 50 . Card , David , and A. Abigail Payne . 2002 . School finance reform, the distribution of school spending, and the distribution of student test scores . Journal of Public Economics 83 ( 2002 ): 49 82 . Card , David , and Jesse Rothstein . 2007 . Racial segregation and the black–white test score gap . Journal of Public Economics 91 ( 11–12 ): 2158 2184 . Chellman , Colin C. 2008 . State education aid in the United States . Ph.D. dissertation , New York University, New York . Corcoran , Sean P. , and William N. Evans . 2008 . Equity, adequacy, and the evolving state role in education finance . In Handbook of research in education finance and policy , edited by Helen F. and Edward B. Fiske , pp. 332 356 . New York : Routledge . Corcoran , Sean P. , and William N. Evans . 2015 . Equity, adequacy, and the evolving state role in education finance . In Handbook of research in education finance and policy , 2nd ed., edited by Helen F. and Margaret E. Goertz , pp. 353 375 . New York : Routledge . Downes , Thomas A. , and Thomas F. Pogue . 1994 . Adjusting school aid formulas for the higher cost of educating disadvantaged students . National Tax Journal 47 ( 1 ): 89 110 . Duncombe , William , and John M. Yinger . 1998 . School finance reform: Aid formulas and equity objectives . National Tax Journal , 51 ( 2 ): 239 262 . Education Law Center . 2014 . State profiles . Available https://edlawcenter.org. Accessed 16 March 2020 . Figlio , David N. , and Deborah Fletcher . 2012 . Suburbanization, demographic change and the consequences for school finance . Journal of Public Economics 96 ( 12 ): 1144 1153 . Jackson , C. Kirabo , Rucker C. Johnson , and Claudia Persico . 2014 . The effect of school finance reforms on the distribution of spending, academic achievement, and adult outcomes . NBER Working Paper No. 20118 . Jackson , C. Kirabo , Rucker C. Johnson , and Claudia Persico . 2016 . The effects of school spending on educational and economic outcomes: Evidence from school finance reforms . Quarterly Journal of Economics 131 ( 1 ): 157 218 . Johnson , Rucker C. , and Sean Tanner . 2018 . Money and freedom: The impact of California's school finance reform . Available https://gettingdowntofacts.com/sites/default/files/2018-09/GDTFII_Report_Johnson.pdf. Accessed 2 March 2020 . , Helen F. , and Sheila E. Murray . 2001 . Intergenerational conflict reconsidered: County demographic structure and the demand for public education . Economics of Education Review 20 ( 4 ): 343 357 . Lafortune , Julien , Jesse Rothstein , and Diane Whitmore Schanzenbach . 2018 . School finance reform and the distribution of student achievement . American Economic Journal: Applied Economics 10 ( 2 ): 1 26 . Lind , Jo T. 2007 . Fractionalization and the size of government . Journal of Public Economics 91 ( 1–2 ): 51 76 . Liscow , Zachary . 2018 . Are court orders sticky? Evidence on distributional impacts from school finance litigation . Journal of Empirical Legal Studies 15 ( 1 ): 4 40 . Luttmer , Erzo F.P. 2001 . Group loyalty and the taste for redistribution . Journal of Political Economy 109 ( 3 ): 500 528 . Murray , Sheila E. , William N. Evans , and Robert M. Schwab . 1998 . Education finance reform and the distribution of education resources . American Economic Review 88 ( 4 ): 789 812 . New York State Education Department . 2012 . Primer on state aid to school districts . Available www.oms.nysed.gov/faru/Primer/primer_cover.html. Accessed 11 March 2020 . Odden , Allan R. , and Lawrence O. Picus . 2008 . School finance: A policy perspective , 4th ed. New York : McGraw-Hill . Picus , Lawrence O. , Margaret E. Goertz , and Allan R. Odden . 2008 . Intergovernmental aid formulas and case studies . In Handbook of research in education finance and policy , edited by Helen F. and Edward B. Fiske , pp. 257 275 . New York : Routledge . Picus , Lawrence O. , Margaret E. Goertz , and Allan R. Odden . 2015 . Intergovernmental aid formulas and case studies . In Handbook of research in education finance and policy , 2nd ed., edited by Helen F. and Margaret E. Goertz , pp. 279 296 . New York : Routledge . Poterba , James M. 1997 . Demographic structure and the political economy of public education . Journal of Policy Analysis and Management 16 ( 1 ): 48 66 . Rothstein , Richard . 2017 . The color of law: A forgotten history of how our government segregated America . New York : W.W. Norton & Company . Ryan , James E. 1999 . Schools, race, and money . Yale Law Journal 109 ( 2 ): 249 316 . SchoolFunding.Info (formerly National Education ACCESS Network) . 2014 . A project for the Center for Educational Equity at Teachers College . Available http://schoolfunding.info/. Accessed 11 March 2020 . Sims , David P. 2011 . Lifting all boats? Finance litigation, education resources, and student needs in the post-Rose era . Education Finance and Policy 6 ( 4 ): 455 485 . Stiefel , Leanna , Amy E. Schwartz , Robert Berne , and Colin C. Chellman . 2005 . School finance court cases and disparate racial impact: The contribution of statistical analysis in New York . Education and Urban Society 37 ( 2 ): 151 173 . Thro , William E. 1994 . Judicial analysis during the third wave of school finance litigation: The Massachusetts decision as a model . Boston College Law Review 35 ( 3 ): 597 617 . Verstegen , Deborah A. 1998 . Judicial analysis during the new wave of school finance litigation: The new adequacy in education . Journal of Education Finance 24 ( 1 ): 51 68 . Appendix Figure A.1. Robustness Check, Impact of School Finance Reform (SFR) and Race on Per Pupil (PP) State Aid Over Time, Event Study Framework, New York State Districts, 2000—2012 Notes: Point estimates regression adjusted for combined wealth ratio, effective local tax rate, percentage of students certified eligible for free or reduced-price lunch, attendance rate, enrollment and enrollment squared, percentage of students receiving special education and English language learner services, and year and district fixed effects. Reference category: Share of district students who are white. Reference year: four or more years before SFR. All figures are in constant 2012 dollars, adjusted using the Consumer Price Index. * p < 0.10; *** p < 0.01. Figure A.1. Robustness Check, Impact of School Finance Reform (SFR) and Race on Per Pupil (PP) State Aid Over Time, Event Study Framework, New York State Districts, 2000—2012 Notes: Point estimates regression adjusted for combined wealth ratio, effective local tax rate, percentage of students certified eligible for free or reduced-price lunch, attendance rate, enrollment and enrollment squared, percentage of students receiving special education and English language learner services, and year and district fixed effects. Reference category: Share of district students who are white. Reference year: four or more years before SFR. All figures are in constant 2012 dollars, adjusted using the Consumer Price Index. * p < 0.10; *** p < 0.01. Table A.1. First School Finance Reforms (Overturns) By State, Through 2010 StateYearEquityAdequacyTotal Number of Cases Arizona Arkansas 1983 California 1976 Connecticut 1977 Florida Georgia Idaho 1997 Illinois Kansas 2005 Kentucky 1989 Maine Maryland Massachusetts 1993 Michigan Minnesota Missouri Montana 1989 New Hampshire 1997 New Jersey 1973 New York 2003 North Carolina 2004 North Dakota Ohio 1997 Oklahoma Oregon Pennsylvania Rhode Island South Carolina Tennessee 1993 Texas 1989 Vermont 1997 Virginia Washington 1978 West Virginia 1984 Wisconsin Wyoming 1980 StateYearEquityAdequacyTotal Number of Cases Arizona Arkansas 1983 California 1976 Connecticut 1977 Florida Georgia Idaho 1997 Illinois Kansas 2005 Kentucky 1989 Maine Maryland Massachusetts 1993 Michigan Minnesota Missouri Montana 1989 New Hampshire 1997 New Jersey 1973 New York 2003 North Carolina 2004 North Dakota Ohio 1997 Oklahoma Oregon Pennsylvania Rhode Island South Carolina Tennessee 1993 Texas 1989 Vermont 1997 Virginia Washington 1978 West Virginia 1984 Wisconsin Wyoming 1980 Notes: Court cases include final high court rulings that are not strictly procedural in nature. Does not include rulings related strictly to capital or facilities financing. Sources: SchoolFunding.Info; Education Law Center; Murray, Evans, and Schwab (1998); Card and Payne (2002); Corcoran and Evans (2008). Table A.2. Assessment of Potential Mechanisms, Changes in Racial Composition Following School Finance Reform (SFR), U.S. Districts, 1996—2011 VariablesBlack (1)Hispanic (2)Asian (3)American Indian (4) SFR −0.41* −0.60*** 0.06 −0.02 (0.221) (0.217) (0.102) (0.041) % Free Lunch 0.02** 0.04*** −0.00** 0.00** (0.011) (0.006) (0.002) (0.001) Enrollment 0.06** 0.15*** 0.04*** −0.00*** (0.027) (0.021) (0.006) (0.001) Enroll^2 −0.00** −0.00*** −0.00*** 0.00** (0.000) (0.000) (0.000) (0.000) District characteristics Year fixed effects District fixed effects Observations 161,815 161,815 161,815 161,815 Districts 11,157 11,157 11,157 11,157 R2 0.989 0.986 0.980 0.982 VariablesBlack (1)Hispanic (2)Asian (3)American Indian (4) SFR −0.41* −0.60*** 0.06 −0.02 (0.221) (0.217) (0.102) (0.041) % Free Lunch 0.02** 0.04*** −0.00** 0.00** (0.011) (0.006) (0.002) (0.001) Enrollment 0.06** 0.15*** 0.04*** −0.00*** (0.027) (0.021) (0.006) (0.001) Enroll^2 −0.00** −0.00*** −0.00*** 0.00** (0.000) (0.000) (0.000) (0.000) District characteristics Year fixed effects District fixed effects Observations 161,815 161,815 161,815 161,815 Districts 11,157 11,157 11,157 11,157 R2 0.989 0.986 0.980 0.982 Notes: Robust standard errors clustered by district in parentheses. All columns include control variables for district characteristics, including share certified eligible for free lunch, and enrollment (1,000s) and its square. Regression weighted by district enrollment. *p < 0.10; **p < 0.05; ***p < 0.01. Table A.3. Robustness Check, Impact of School Finance Reform (SFR) and Race on Per Pupil State Aid (%), U.S. Districts, 1996—2011 (1)(2)(3)(4)(5)(6) SFR 0.1352*** 0.1310***  0.1370*** 0.1317*** (0.003) (0.004)  (0.003) (0.004) SFR × % Black  −0.0026*** 0.0008***  −0.0024*** 0.0008*** (0.000) (0.000)  (0.000) (0.000) Hispanic  0.0058*** 0.0010***  0.0057*** 0.0010*** (0.000) (0.000)  (0.000) (0.000) Asian  −0.0016*** 0.0010**  −0.0006 0.0003 (0.001) (0.000)  (0.001) (0.000) American Indian  0.0019*** 0.0022***  0.0018*** 0.0021*** (0.000) (0.000)  (0.000) (0.000) Black  0.0041*** 0.0019***  0.0046*** 0.0021*** (0.000) (0.000)  (0.000) (0.000) Hispanic  −0.0050*** 0.0026***  −0.0038*** 0.0024*** (0.000) (0.000)  (0.000) (0.000) Asian  0.0017*** −0.0038***  0.0030*** −0.0023*** (0.001) (0.001)  (0.001) (0.001) American Indian  −0.0006 0.0012**  −0.0007 0.0011** (0.001) (0.000)  (0.001) (0.000) % Free Lunch    0.0109*** 0.0303*** 0.0711*** (0.004) (0.004) (0.005) Enrollment    −0.0030*** −0.0031*** −0.0010*** (0.000) (0.000) (0.000) Enroll^2    0.0000*** 0.0000*** −0.0000 (0.000) (0.000) (0.000) District FE Year FE State-Year FE Constant 8.0915*** 8.4326*** 8.5910*** 8.2250*** 8.5089*** 8.6144*** (0.002) (0.006) (0.023) (0.005) (0.007) (0.022) N 161,815 161,815 161,815 161,815 161,815 161,815 Districts 11,157 11,157 11,157 11,157 11,157 11,157 R2 0.876 0.878 0.931 0.877 0.879 0.931 (1)(2)(3)(4)(5)(6) SFR 0.1352*** 0.1310***  0.1370*** 0.1317*** (0.003) (0.004)  (0.003) (0.004) SFR × % Black  −0.0026*** 0.0008***  −0.0024*** 0.0008*** (0.000) (0.000)  (0.000) (0.000) Hispanic  0.0058*** 0.0010***  0.0057*** 0.0010*** (0.000) (0.000)  (0.000) (0.000) Asian  −0.0016*** 0.0010**  −0.0006 0.0003 (0.001) (0.000)  (0.001) (0.000) American Indian  0.0019*** 0.0022***  0.0018*** 0.0021*** (0.000) (0.000)  (0.000) (0.000) Black  0.0041*** 0.0019***  0.0046*** 0.0021*** (0.000) (0.000)  (0.000) (0.000) Hispanic  −0.0050*** 0.0026***  −0.0038*** 0.0024*** (0.000) (0.000)  (0.000) (0.000) Asian  0.0017*** −0.0038***  0.0030*** −0.0023*** (0.001) (0.001)  (0.001) (0.001) American Indian  −0.0006 0.0012**  −0.0007 0.0011** (0.001) (0.000)  (0.001) (0.000) % Free Lunch    0.0109*** 0.0303*** 0.0711*** (0.004) (0.004) (0.005) Enrollment    −0.0030*** −0.0031*** −0.0010*** (0.000) (0.000) (0.000) Enroll^2    0.0000*** 0.0000*** −0.0000 (0.000) (0.000) (0.000) District FE Year FE State-Year FE Constant 8.0915*** 8.4326*** 8.5910*** 8.2250*** 8.5089*** 8.6144*** (0.002) (0.006) (0.023) (0.005) (0.007) (0.022) N 161,815 161,815 161,815 161,815 161,815 161,815 Districts 11,157 11,157 11,157 11,157 11,157 11,157 R2 0.876 0.878 0.931 0.877 0.879 0.931 Notes: Robust standard errors clustered by district in parentheses. All figures are percent change in state aid per pupil in constant 2011 dollars, adjusted using the Consumer Price Index. Regression weighted by district enrollment. Reference category: Share of district students who are white. Columns 1—3 rely on fixed effects (FE) alone; columns 4—6 include controls for district characteristics. *p < 0.10; **p < 0.05; ***p < 0.01. Table A.4. Assessment of Potential Mechanisms, Impact of School Finance Reform (SFR) by Race and Poverty on Per Pupil District Funding, U.S. Districts, 1996—2011 State Aid (1)Local Revenues (2)Total Revenues (3) SFR × % Black 18.26*** 0.06 25.06*** (4.426) (4.129) (4.626) Hispanic 8.26* 8.90 17.85** (4.258) (7.533) (8.442) Asian −47.57*** 36.52** −0.02 (10.734) (16.474) (18.267) American Indian 47.88*** −11.40*** 52.06*** (13.740) (3.580) (19.116) Free Lunch −1.90 −3.53 −7.80** (2.803) (2.959) (3.472) Black −3.84 −26.87*** −38.52*** (5.128) (5.783) (7.134) Hispanic 6.58 −15.42*** −0.79 (5.398) (5.657) (7.760) Asian −12.08 26.66 −12.25 (12.850) (21.565) (23.866) American Indian 6.53 −2.84 19.94** (6.263) (3.647) (9.487) Free Lunch 4.66** −4.09* 3.99 (1.853) (2.166) (2.595) Enrollment −8.92* −10.58 −32.31*** (4.689) (7.860) (10.089) Enroll^2 0.00 0.00 0.01* District FE Year FE State-Year FE Constant 8.0915*** 8.4326*** 8.5910*** (0.002) (0.006) (0.023) Observations 161,815 161,815 161,815 Districts 11,157 11,157 11,157 R2 0.898 0.933 0.882 State Aid (1)Local Revenues (2)Total Revenues (3) SFR × % Black 18.26*** 0.06 25.06*** (4.426) (4.129) (4.626) Hispanic 8.26* 8.90 17.85** (4.258) (7.533) (8.442) Asian −47.57*** 36.52** −0.02 (10.734) (16.474) (18.267) American Indian 47.88*** −11.40*** 52.06*** (13.740) (3.580) (19.116) Free Lunch −1.90 −3.53 −7.80** (2.803) (2.959) (3.472) Black −3.84 −26.87*** −38.52*** (5.128) (5.783) (7.134) Hispanic 6.58 −15.42*** −0.79 (5.398) (5.657) (7.760) Asian −12.08 26.66 −12.25 (12.850) (21.565) (23.866) American Indian 6.53 −2.84 19.94** (6.263) (3.647) (9.487) Free Lunch 4.66** −4.09* 3.99 (1.853) (2.166) (2.595) Enrollment −8.92* −10.58 −32.31*** (4.689) (7.860) (10.089) Enroll^2 0.00 0.00 0.01* District FE Year FE State-Year FE Constant 8.0915*** 8.4326*** 8.5910*** (0.002) (0.006) (0.023) Observations 161,815 161,815 161,815 Districts 11,157 11,157 11,157 R2 0.898 0.933 0.882 Notes: Robust standard errors clustered by district in parentheses. All figures are in constant 2011 dollars, adjusted using the Consumer Price Index. Regression weighted by district enrollment. Reference category: Share of district students who are white. FE = fixed effects. *p < 0.10, **p < 0.05, ***p < 0.01. Table A.5. Robustness Check, Impact of School Finance Reform and Race on Per Pupil State Aid, New York State Districts, Excluding the “Big 5,” 2000—2012 All Districts (1)No NYC (2)No Big 5 (3) Black × post 9.61*** 8.40*** 9.89*** (1.205) (1.197) (1.324) Hispanic × post 0.48 −2.53 2.68 (1.677) (1.911) (2.088) Asian × post −26.21*** −23.59*** −12.36*** (3.873) (4.054) (3.875) Black −27.32*** −29.63*** −37.32*** (4.685) (5.051) (4.996) Hispanic 7.59 2.89 2.24 (5.124) (5.585) (5.598) Asian 28.43*** 27.98*** 11.69* (6.316) (6.538) (6.246) % FRPL −13.58*** −16.96*** −12.04*** (1.849) (1.865) (1.804) Enrollment −542.37*** −820.13*** −2,073.38*** (11.908) (39.716) (75.066) Enroll^2 0.26*** 4.07*** 78.60*** (0.006) (0.515) (3.857) Combined wealth ratio −272.29*** −300.40*** −312.20*** (40.134) (39.801) (37.668) Local effect tax rate 10.29*** 13.60*** 16.53*** (3.015) (3.386) (3.294) Attendance rate −1.72 3.29 9.74*** (3.780) (3.853) (3.689) % ELL 44.87*** 89.08*** 45.27*** (5.459) (6.863) (7.310) % SPED 30.17*** 29.93*** 26.11*** (5.168) (5.243) (5.221) Observations 8,736 8,698 8,646 Districts 672 671 667 R2 0.967 0.966 0.960 All Districts (1)No NYC (2)No Big 5 (3) Black × post 9.61*** 8.40*** 9.89*** (1.205) (1.197) (1.324) Hispanic × post 0.48 −2.53 2.68 (1.677) (1.911) (2.088) Asian × post −26.21*** −23.59*** −12.36*** (3.873) (4.054) (3.875) Black −27.32*** −29.63*** −37.32*** (4.685) (5.051) (4.996) Hispanic 7.59 2.89 2.24 (5.124) (5.585) (5.598) Asian 28.43*** 27.98*** 11.69* (6.316) (6.538) (6.246) % FRPL −13.58*** −16.96*** −12.04*** (1.849) (1.865) (1.804) Enrollment −542.37*** −820.13*** −2,073.38*** (11.908) (39.716) (75.066) Enroll^2 0.26*** 4.07*** 78.60*** (0.006) (0.515) (3.857) Combined wealth ratio −272.29*** −300.40*** −312.20*** (40.134) (39.801) (37.668) Local effect tax rate 10.29*** 13.60*** 16.53*** (3.015) (3.386) (3.294) Attendance rate −1.72 3.29 9.74*** (3.780) (3.853) (3.689) % ELL 44.87*** 89.08*** 45.27*** (5.459) (6.863) (7.310) % SPED 30.17*** 29.93*** 26.11*** (5.168) (5.243) (5.221) Observations 8,736 8,698 8,646 Districts 672 671 667 R2 0.967 0.966 0.960 Notes: Robust standard errors clustered by district in parentheses. Regression adjusted for combined wealth ratio, effective local tax rate, percentage of students certified eligible for free or reduced-price lunch (FRPL), attendance rate, enrollment divided by 1,000 and the square of enrollment divided by 1,000, percentage of students receiving SPED (special education) and ELL (English language learner) services, and year and district fixed effects. Figures in constant 2012 dollars, adjusted using the Consumer Price Index. Regression results weighted by district enrollment. No Big 5 excludes New York City, Buffalo, Rochester, Syracuse, and Yonkers school districts. Reference category: Share of district students who are white.
2021-04-10 19:55:56
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 2, "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.2732645869255066, "perplexity": 2659.959318074777}, "config": {"markdown_headings": false, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.3, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-17/segments/1618038057476.6/warc/CC-MAIN-20210410181215-20210410211215-00250.warc.gz"}
https://www.gamedev.net/forums/topic/393727-preprocessor-commands-in-libraries/
Public Group # Preprocessor Commands in libraries This topic is 4408 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic. ## Recommended Posts Hi all, just your friendly neighbourhood bumbling idiot, I was wondering if preprocessor commands were left in source code that is compiled into a library. The reason I'm asking is that I'm trying to code a relatively small graphics library, but make it handle both OpenGL and DirectX, although not at the same time.[grin] to do this, I've included #ifdef DIRECT3D_VERSION...#endif to specify the code to run when Direct3D is included(via "d3d9.h") in the project. Only trouble is I want to make the code into a library, so will it still look for DIRECT3D_VERSION, if I include the library in a project,or will the compiler (MinGW as always) sort the functions at the library's compile-time? ##### Share on other sites If understand you properly, you cannot do what you want that way. The preprocessor runs before the compiler. The typical usage of #ifdef ... #endif directives removes code (so the compiler does not see the code). Thus, the preprocessor directives cannot "remain in compiled code" in any way. They're gone before the code reaches the compiler; you cannot use the preprocessor to change the behavior of the compiled library code. In fact, attempting to do so can result in strange compile or link errors, or runtime errors. You might be able to compile your code twice, once with the preprocessor defines set up for the D3D version, and again with the OpenGL version. This will produce two libraries; the user must link against the appropriate one and define the appropriate preprocessor defines. This is kind of clunky; there are better ways to resolve this issue that involve more actual abstraction of your rendering interface. ##### Share on other sites Yeah, I was rather worried when it compiled first time :P I was looking for a way that recognized what form of graphics API was being used (OGL, if not DirectX) automatically, so the user would just include the DirectX header and library, and it would run on that API [Edited by - webwraith on May 18, 2006 5:14:09 PM] ##### Share on other sites Right, I'm holding off on the DirectX side of things, but I'm still having problems. When I compile my library, everything seems to run fine, but when I include it and #include its header, the compiler (MinGW) doesn't seem to be able to find the wgl commands(in particular wglCreateContext() and wglMakeCurrent()). I've tried everything I can think of(not much), including; #include the windows.h header in the library, and in the source using the library(and both), and including the link libraries in both the source and my custom library(and both), but it doesn't want to know.Any ideas? ##### Share on other sites You're project still needs to link to the OpenGL libraries unless you use command line tools to merge the OpenGL32.lib into your lib file (waste of time honestly). ##### Share on other sites I've already tried that,but I still get the same problem ##### Share on other sites Quote: Original post by webwraithRight, I'm holding off on the DirectX side of things, but I'm still having problems. When I compile my library, everything seems to run fine, but when I include it and #include its header, the compiler (MinGW) doesn't seem to be able to find the wgl commands(in particular wglCreateContext() and wglMakeCurrent()).I've tried everything I can think of(not much), including;#include the windows.h header in the library, and in the source using the library(and both),andincluding the link libraries in both the source and my custom library(and both), but it doesn't want to know.Any ideas? You need to include glaux.h for those functions, glaux.h does not come in the MinGW distribution files, you'll have to grab it from the Platform SDK, or declare them yourself. ##### Share on other sites the wglxxx() commands are not in glaux.h, they are in wingdi.h, and that's the reason I'm getting frustrated with it, because it says they're not there, even when I explicitly include wingdi.h into the project • 11 • 20 • 12 • 10 • 38 • ### Forum Statistics • Total Topics 631401 • Total Posts 2999865 ×
2018-06-22 13:43:14
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.18620149791240692, "perplexity": 3254.5279802111872}, "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-26/segments/1529267864482.90/warc/CC-MAIN-20180622123642-20180622143642-00146.warc.gz"}
https://www.projecteuclid.org/euclid.aos/1140191667
## The Annals of Statistics ### Distribution free goodness-of-fit tests for linear processes #### Abstract This article proposes a class of goodness-of-fit tests for the autocorrelation function of a time series process, including those exhibiting long-range dependence. Test statistics for composite hypotheses are functionals of a (approximated) martingale transformation of the Bartlett Tp-process with estimated parameters, which converges in distribution to the standard Brownian motion under the null hypothesis. We discuss tests of different natures such as omnibus, directional and Portmanteau-type tests. A Monte Carlo study illustrates the performance of the different tests in practice. #### Article information Source Ann. Statist., Volume 33, Number 6 (2005), 2568-2609. Dates First available in Project Euclid: 17 February 2006 Permanent link to this document https://projecteuclid.org/euclid.aos/1140191667 Digital Object Identifier doi:10.1214/009053605000000606 Mathematical Reviews number (MathSciNet) MR2253096 Zentralblatt MATH identifier 1084.62038 #### Citation Delgado, Miguel A.; Hidalgo, Javier; Velasco, Carlos. Distribution free goodness-of-fit tests for linear processes. Ann. Statist. 33 (2005), no. 6, 2568--2609. doi:10.1214/009053605000000606. https://projecteuclid.org/euclid.aos/1140191667 #### References • Aki, S. (1986). Some test statistics based on the martingale term of the empirical distribution function. Ann. Inst. Statist. Math. 38 1--21. • Anderson, T. W. (1997). Goodness-of-fit tests for autoregressive processes. J. Time Ser. Anal. 18 321--339. • Billingsley, P. (1968). Convergence of Probability Measures. Wiley, New York. • Bloomfield, P. (1973). An exponential model for the spectrum of a scalar time series. Biometrika 60 217--226. • Box, G. E. P. and Pierce, D. A. (1970). Distribution of residual autocorrelations in autoregressive-integrated moving average time series models. J. Amer. Statist. Assoc. 65 1509--1526. • Brillinger, D. R. (1981). Time Series, Data Analysis and Theory, 2nd ed. Holden-Day, San Francisco. • Brockwell, P. J. and Davis, R. A. (1991). Time Series: Theory and Methods, 2nd ed. Springer, New York. • Brown, R. L., Durbin, J. and Evans, J. M. (1975). Techniques for testing constancy of regression relationships over time (with discussion). J. Roy. Statist. Soc. Ser. B 37 149--192. • Chen, H. and Romano J. P. (1999). Bootstrap-assisted goodness-of-fit tests in the frequency domain. J. Time Ser. Anal. 20 619--654. • Dahlhaus, R. (1985). On the asymptotic distribution of Bartlett's $U_p$-statistic. J. Time Ser. Anal. 6 213--227. • Delgado, M. A. and Hidalgo, J. (2000). Bootstrap goodness-of-fit test for linear processes. Preprint, Universidad Carlos III de Madrid. • Durbin, J., Knott, M. and Taylor, C. C. (1975). Components of Cramér--von Mises statistics. II. J. Roy. Statist. Soc. Ser. B 37 216--237. • Eubank, R. L. and LaRiccia, V. N. (1992). Asymptotic comparison of Cramér--von Mises and nonparametric function estimation techniques for testing goodness-of-fit. Ann. Statist. 20 2071--2086. • Giraitis, L., Hidalgo, J. and Robinson, P. M. (2001). Gaussian estimation of parametric spectral density with unknown pole. Ann. Statist. 29 987--1023. • Giraitis, L. and Surgailis, D. (1990). A central limit theorem for quadratic forms in strongly dependent linear variables and its application to asymptotic normality of Whittle's estimate. Probab. Theory Related Fields 86 87--104. • Grenander, U. (1950). Stochastic processes and statistical inference. Ark. Mat. 1 195--277. • Grenander, U. (1981). Abstract Inference. Wiley, New York. • Grenander, U. and Rosenblatt, M. (1957). Statistical Analysis of Stationary Time Series. Wiley, New York. • Hainz, G. and Dahlhaus, R. (2000). Spectral domain bootstrap tests for stationary time series. Preprint. • Hannan, E. J. (1973). The asymptotic theory of linear time-series models. J. Appl. Probability 10 130--145. • Hong, Y. (1996). Consistent testing for serial correlation of unknown form. Econometrica 64 837--864. • Hosking, J. R. M. (1984). Modeling persistence in hydrological time series using fractional differencing. Water Resources Research 20 1898--1908. • Hosoya, Y. (1997). A limit theory for long-range dependence and statistical inference on related models. Ann. Statist. 25 105--137. • Kac, M. and Siegert, A. J. F. (1947). An explicit representation of a stationary Gaussian process Ann. Math. Statist. 18 438--442. • Khmaladze, E. V. (1981). A martingale approach in the theory of goodness-of-fit tests. Theory Probab. Appl. 26 240--257. • Khmaladze, E. V. and Koul, H. (2004). Martingale transforms goodness-of-fit tests in regression models. Ann. Statist. 32 995--1034. • Klüppelberg, C. and Mikosch, T. (1996). The integrated periodogram for stable processes. Ann. Statist. 24 1855--1879. • Koul, H. and Stute, W. (1998). Regression model fitting with long memory errors. J. Statist. Plann. Inference 71 35--56. • Koul, H. and Stute, W. (1999). Nonparametric model checks for time series. Ann. Statist. 27 204--236. • Ljung, G. M. and Box, G. E. P. (1978). On a measure of lack of fit in time series models. Biometrika 65 297--303. • Neyman, J. (1937). Smooth'' test for goodness of fit. Skand. Aktuarietidskr. 20 150--199. • Nikabadze, A. and Stute, W. (1997). Model checks under random censorship. Statist. Probab. Lett. 32 249--259. • Paparoditis, E. (2000). Spectral density based goodness-of-fit tests for time series models. Scand. J. Statist. 27 143--176. • Prewitt, K. (1998). Goodness-of-fit test in parametric time series models. J. Time Ser. Anal. 19 549--574. • Robinson, P. M. (1994). Time series with strong dependence. In Advances in Econometrics: Sixth World Congress 1 (C. A. Sims, ed.) 47--95. Cambridge Univ. Press. • Robinson, P. M. (1995). Log-periodogram regression of time series with long range dependence. Ann. Statist. 23 1048--1072. • Robinson, P. M. (1995). Gaussian semiparametric estimation of long-range dependence. Ann. Statist. 23 1630--1661. • Schoenfeld, D. A. (1977). Asymptotic properties of tests based on linear combinations of the orthogonal components of the Cramér--von Mises statistic. Ann. Statist. 5 1017--1026. • Sen, P. K. (1982). Invariance principles for recursive residuals. Ann. Statist. 10 307--312. • Shorack, G. R. and Wellner, J. A. (1986). Empirical Processes with Applications to Statistics. Wiley, New York. • Stute, W. (1997). Nonparametric model checks for regression. Ann. Statist. 25 613--641. • Stute, W., Thies, S. and Zhu, L. (1998). Model checks for regression: An innovation process approach. Ann. Statist. 26 1916--1934. • Stute, W. and Zhu, L. (2002). Model checks for generalized linear models. Scand. J. Statist. 29 535--545. • Velasco, C. (1999). Non-stationary log-periodogram regression J. Econometrics 91 325--371. • Velasco, C. and Robinson, P. M. (2000). Whittle pseudo-maximum likelihood estimation for nonstationary time series. J. Amer. Statist. Assoc. 95 1229--1243. • Velilla, S. (1994). A goodness-of-fit test for autoregressive-moving-average models based on the standardized sample spectral distribution of the residuals J. Time Ser. Anal. 15 637--647.
2019-09-16 21:20: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.49544307589530945, "perplexity": 5936.356304665809}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.3, "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-2019-39/segments/1568514572934.73/warc/CC-MAIN-20190916200355-20190916222355-00043.warc.gz"}
http://forum.zkoss.org/questions/105141/revisions/
# Revision history [back] ### Listbox Listener:onCheckSelectAll and onSelect - Problem with double event Hi, I use 2 Listener on a Listbox. The the onSelect Listener tells me when a row was selected. And the onCheckSelectAll is fired when the checkAll (multiple=true) checkbox is triggert. The Problem is now, if you trigger the checkAll combonent, then first the onSelect Event is still triggert, and after this the onCheck event from the onCheckSelectAll. This produce for the first row a double select/unselect in my case. So how I can fix this? Regards. MB ### Listbox Listener:onCheckSelectAll and onSelect - Problem with double event Hi, I use 2 Listener on a Listbox. The the onSelect Listener tells me when a row was selected. And the onCheckSelectAll is fired when the checkAll (multiple=true) checkbox is triggert. The Problem is now, if you trigger the checkAll combonent, then first the onSelect Event is still triggert, and after this the onCheck event from the onCheckSelectAll. This produce for the first row a double select/unselect in my case. So how I can fix this? Regards. MB Support Options • Email Support • Training • Consulting • Outsourcing
2019-04-24 22:02:12
{"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.8013284802436829, "perplexity": 12624.351086105109}, "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-18/segments/1555578663470.91/warc/CC-MAIN-20190424214335-20190425000335-00051.warc.gz"}
https://www.softaculous.com/docs/Installing_Softaculous_in_Hosting_Controller
Installing Softaculous in Hosting Controller Contents Overview The following guide will show you how to install Softaculous on Hosting Controller panel on Windows Server. Requirements • A Windows server with Hosting Controller • api.softaculous.com (IP : 192.198.80.3) • s1.softaculous.com (IP : 192.99.110.112) • s2.softaculous.com (IP : 192.200.108.99) • s3.softaculous.com (IP : 178.32.158.97) • s4.softaculous.com (IP : 138.201.24.83) • s7.softaculous.com (IP : 167.114.200.240) Installing Softaculous Note: Before starting the installation make sure ionCube Loaders are enabled. http://files.softaculous.com/installer.php "path\to\php.exe" "path\to\installer.php" For example, if the file is stored in the 'Downloads' directory, execute this file from Command Line using the above command as: "c:\php\php.exe" "C:\Users\Administrator\Downloads\installer.php" The Installer will start showing the Installation Processes and when done will indicate the same. NOTE: Scripts will be downloaded during this process. The Download Activity will also be shown on the screen. Note: A site named Softaculous Auto Installer Site will be created on your server. Add the domain using which you want to access Softaculous in the Bindings of this site. Do make sure that this domain points to your current server. Also make sure that PHP is enabled on Softaculous Auto Installer Site if you see some error page instead of Softaculous default page on accessing Softaculous. The following screen will appear if the Softaculous is installed successfully. Thats it the installation of Softaculous is completed! Quick Installation If you wish to finish the installation quickly and then download the script packages in background use this method. Note: Before starting the installation make sure ionCube Loaders are enabled. The installer requires Ioncube to be enabled. Now execute the installer from Command Line using the following command: "path\to\php.exe" "path\to\installer.php" --quick
2017-08-19 18:56: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": 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.2141357809305191, "perplexity": 9800.327687111594}, "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-34/segments/1502886105712.28/warc/CC-MAIN-20170819182059-20170819202059-00457.warc.gz"}
https://ch.gateoverflow.in/103/gate2012-36
GATE2012-36 The rate-controlling step for the solid-catalyzed irreversible reaction A + B  $\longrightarrow$ C is known to be the reaction of adsorbed A with  adsorbed B to give adsorbed C. If P${_i}$ is the partial pressure of components i and K${_i}$ the adsorption equilibrium constant of components i, then the form of the Langmuir-Hinshelwood rate expression will be 1. rate ${\displaystyle \propto }$ $\frac{P{_A}P{_B}}{1 + K{_A}P{_A} + K{_B}P{_B} + K{_C}P{_C} }$ 2. rate ${\displaystyle \propto }$ $\frac{P{_A}P{_B}}{(1 + K{_A}P{_A} + K{_B}P{_B} + K{_C}P{_C})^2 }$ 3. rate ${\displaystyle \propto }$ $\frac{P{_A}P{_B}}{(1 + K{_A}P{_A} + K{_B}P{_B} + K{_C}P{_C})^0.5 }$ 4. rate ${\displaystyle \propto }$ $\frac{P{_A}P{_B}}{P{_C}}$ in Others edited
2020-12-03 06:54: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": 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.9085598587989807, "perplexity": 8408.369503694013}, "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-50/segments/1606141723602.80/warc/CC-MAIN-20201203062440-20201203092440-00233.warc.gz"}
https://www.shaalaa.com/question-bank-solutions/a-river-400-m-wide-flowing-rate-20-m-s-boat-sailing-velocity-10-m-s-respect-water-direction-perpendicular-river-how-far-kinematic-equations-uniformly-accelerated-motion_66479
# A river 400 m wide is flowing at a rate of 2.0 m/s. A boat is sailing at a velocity of 10 m/s with respect to the water, in a direction perpendicular to the river. How far from the - Physics Sum A river 400 m wide is flowing at a rate of 2.0 m/s. A boat is sailing at a velocity of 10 m/s with respect to the water, in a direction perpendicular to the river. How far from the point directly opposite to the starting point does the boat reach the opposite bank? #### Solution Given: Distance between the opposite shore of the river or width of the river = 400 m Rate of flow of the river = 2.0 m/s Boat is sailing at the rate of 10 m/s. The vertical component of velocity 10 m/s takes the boat to the opposite shore. The boat sails at the resultant velocity vr. Time taken by the boat to reach the opposite shore: $\text{ Time }= \frac{\text{ Distance } }{\text{ Time } } = \frac{400}{10} = 40 s$ From the figure, we have: $\tan \theta = \frac{2}{10} = \frac{1}{5}$ The boat will reach point C. $\text{ In } ∆ ABC,$ $\tan \theta = \frac{BC}{AB} = \frac{BC}{400} = \frac{1}{5}$ $\Rightarrow BC = \frac{400}{5} = 80 \text{ m }$ Magnitude of velocity $\left| v_r \right| = \sqrt{{10}^2 + 2^2} = 10 . 2 \text{ m/s }$ Let α be the angle made by the boat sailing with respect to the direction of flow. $\tan\left( \alpha \right) = \frac{10}{2}$ $\Rightarrow \alpha = 78 . 7^\circ$ Distance the boat need to travel to reach the opposite shore = $\frac{400}{\sin\left( \alpha \right)} = 407 . 9 \text{ m }$ Using Pythagoras' theorem, we get: Distance = $\sqrt{407 . 9^2 - {400}^2} = 79 . 9 \text{ m } \approx 80 \text{ m}$ Is there an error in this question or solution? #### APPEARS IN HC Verma Class 11, 12 Concepts of Physics 1 Chapter 3 Rest and Motion: Kinematics Q 46.2 | Page 54
2021-04-14 08:50: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": 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.30672720074653625, "perplexity": 654.6069472392153}, "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-17/segments/1618038077336.28/warc/CC-MAIN-20210414064832-20210414094832-00402.warc.gz"}
http://repozitorij.upr.si/IzpisGradiva.php?id=1685&lang=eng
# Show document Title: Almost fully optimized infinite classes of Boolean functions resistant to (fast) algebraic cryptanalysis Pašalić, Enes (Author) http://dx.doi.org/10.1007/978-3-642-00730-9_25 English Not categorized 1.08 - Published Scientific Conference Contribution FAMNIT - Faculty of Mathematics, Science and Information Technologies In this paper the possibilities of an iterative concatenation method towards construction of Boolean functions resistant to algebraic cryptanalysis are investigated. The notion of ▫$\mathcal{AAR}$▫ (Algebraic Attack Resistant) function is introduced as a unified measure of protection against classical algebraic attacks as well as fast algebraic attacks. Then, it is shown that functions that posses the highest resistance to fast algebraic attacks are necessarily of maximum ▫$\mathcal{AI}$▫ (Algebraic Immunity), the notion defined as a minimum degree of functions that annihilate either ▫$f$▫ or ▫$1+f$▫. More precisely, if for any non-annihilating function ▫$g$▫ of degree ▫$e$▫ an optimum degreerelation ▫$e+d \ge n$▫ is satisfied in the product ▫$fg=h$▫ (denoting ▫$deg(h)=d$▫), then the function ▫$f$▫ in ▫$n$▫ variables must have maximum ▫$\mathcal{AI}$▫, i.e. for nonzero function ▫$g$▫ the relation ▫$fg=0$▫ or ▫$(1+f)g=0$▫ implies. The presented theoretical framework allows us to iteratively construct functions with maximum ▫$\mathcal{AI}$▫ satisfying ▫$e+d=n-1$▫, thus almost optimized resistance to fast algebraic cryptanalysis. This infinite class for the first time, apart from almost optimal resistance to algebraic cryptanalysis, in addition generates the functions that possess high nonlinearity (superior to previous constructions) and maximum algebraic degree, thus unifying most of the relevant cryptographic criteria. algebraic cryptoanalysis, fast algebraic attacks, algebraic immunity, annihilators, algebraic attack resistant, high degree product, stream ciphers, Boolean function 2009 Str. 399-414 512.624.95 15119705 1538 70 Document is not linked to any category. Average score: (0 votes) Voting is allowed only to logged in users. Hover the mouse pointer over a document title to show the abstract or click on the title to get all document metadata. ## Secondary language Language: English kriptoanaliza, kriptografija, algebraične lastnosti, anihilatorji, Boolova funkcija ## Comments Leave comment You have to log in to leave a comment. Comments (0) 0 - 0 / 0 There are no comments! Back
2020-04-09 18:32: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.6243902444839478, "perplexity": 5893.132182064396}, "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-2020-16/segments/1585371861991.79/warc/CC-MAIN-20200409154025-20200409184525-00287.warc.gz"}
https://zbmath.org/?q=an:0948.90043
# zbMATH — the first resource for mathematics $$Geo/G/1$$ discrete time retrial queue with Bernoulli schedule. (English) Zbl 0948.90043 Summary: This paper studies discrete time $$Geo/G/1$$ retrial queues with Bernoulli schedule in which the blocked customers either join the infinite waiting space with probability $$\alpha$$ or leave the server and enter the retrial orbit with probability $$\overline\alpha(=1-\alpha)$$. The customers in the retrial orbit will retry their service after a random amount of time. First, the analytic formula for the generating function of the joint distribution of the numbers of customers in the waiting space and the retrial orbit in steady state is derived. It is shown that a stochastic decomposition law holds for the retrial queues under study. That is, the total number of customers in system is distributed as a sum of two independent random variables. Second, recursive formulas for the marginal steady state probabilities of the numbers of customers in the waiting space and in the retrial orbit was developed. Since a regular two-level priority $$Geo/G/1$$ queue (one without retrials) with Bernoulli schedule and head-of-line priority discipline is a special case of the studied retrial systems, the recursive formulas developed can be used to compute the marginal steady state probabilities of numbers of customers in the priority and non-priority groups for this case. Furthermore, a relationship between a continuous time $$M/G/1$$ retrial queue with Bernoulli schedule and its discrete time counterpart is established so that the recursive formulas can also be applied to a continuous time system. Last, several special cases are studied and some numerical examples are presented to demonstrate the use of the recursive formulas. ##### MSC: 90B22 Queues and service in operations research 90B36 Stochastic scheduling theory in operations research 60K25 Queueing theory (aspects of probability theory) Full Text: ##### References: [1] Yang, T.; Templeton, J.G.C., A survey on retrial queues, Queueing syst., 2, 201-233, (1987) · Zbl 0658.60124 [2] Li, H.; Yang, T., A single-server retrial queue with server vacations and a finite number of input sources, Eur. J. oper. res., 85, 149-160, (1995) · Zbl 0912.90139 [3] Falin, G.I., A survey of retrial queues, Queueing syst., 7, 127-168, (1990) · Zbl 0709.60097 [4] Khalil, Z.; Falin, G.; Yang, T., Some analytical results for congestion in subscriber line modules, Queueing syst., 10, 382-402, (1992) · Zbl 0786.60116 [5] Choi, B.D.; Park, K.K., The M/G/1 retrial queue with Bernoulli schedule, Queueing syst., 7, 219-228, (1990) · Zbl 0706.60089 [6] Yang, T.; Li, H., On the steady-state queue size distribution of the discrete-time geo/G/1 queue with repeated customers, Queueing syst., 21, 199-215, (1995) · Zbl 0840.60085 [7] K. Knopp, Infinite Sequences and Series, Dover Publications, New York, 1956 · Zbl 0070.05807 [8] Fuhrmann, S.W.; Cooper, R.B., Stochastic decomposition in the M/G/1 queue with generalized vacations, Oper. res., 33, 1117-1129, (1985) · Zbl 0585.90033 [9] J.J. Hunter, Mathematical techniques of applied probability, vol. 2, Discrete-Time Models: Techniques and Applications, Academic Press, New York, 1983 · Zbl 0539.60065 This reference list is based on information provided by the publisher or from digital mathematics libraries. Its items are heuristically matched to zbMATH identifiers and may contain data conversion errors. It attempts to reflect the references listed in the original paper as accurately as possible without claiming the completeness or perfect precision of the matching.
2021-05-07 00:10:00
{"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.6983725428581238, "perplexity": 1923.2515982361515}, "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/1620243988774.18/warc/CC-MAIN-20210506235514-20210507025514-00306.warc.gz"}
https://discourse.julialang.org/t/the-hegemony-of-must-end-welcome-the-upstart/63605
# The Hegemony Of == Must End; Welcome The ⩵ Upstart A lot of discussion took place with My Brain Is Hard-Wired Against ==; Help Me, Julia, I thought I would post my response as one monolithic post. The Proposal Create a Unicode character alias for the relational operator == Possible Unicode Characters to use: I present to you three possibilities: U+0225F ≟ (question equals) \questeq U+0229C ⊜ (circled equals) \circledequal U+02A75 ⩵ (two consecutive equal signs) \Equal or \Equ I would think the leading candidate would be U+02A75, as it looks the same as == and therefore has as similar visual appearance in code: if x == 5 if x ⩵ 5 Typing shortcuts The above all have typing shortcuts. Desire on that is short and easy to type (“easy to type” means: short, lowercase, and easy keys to reach for touch typists). However, there is an opportunity for an even better shortcut. Recall that ≠ has shortcut \ne. The shortcut “\ie” (“is equal”) is currently not used. We could have a nice correspondence between \ne (not equal, ≠) and \ie (equality, ⩵). Bottom Line - What is Your Ideal Outcome 1. Implement U+02A75 ⩵ as a Unicode alias for the == equality operator 2. Create keyboard shortcut \ie to enter it. What The Proposal Does Not Do 1. Change how the == relational operator works 2. Change how the relation is evaluated Why Do this? In the end, to benefit the user by helping the user avoid the mistake of using the assignment operator (=) for the relational operator (==) Julia is uniquely positioned to mitigate this problem, which has existed since 1957. Would People Use it? People already use \ne \leq \geq and find benefit from it. A similar benefit is to be had from \Equ (or \ieq or \ie) What Are the Justifications? ONE - From Design Computer programming languages, ideally, follow good design principles. The design principles are minimality, referential transparency, orthogonality, correspondence, abstraction, pattern-based design, meta-model design. Here is another: complete, balanced sets. Julia currently has these standard comparison operators: Operator Alias Name == equality != inequality < less than <= less than or equal to > greater than >= greater than or equal to === equivalence Note how all two- and three-character operators have a single character Unicode alias – except for equality. TWO - From Human Cognition Computer programming languages are also ideally, compatible with how human’s think. Part of that is designing against common errors at human’s make. Some computer languages are cognitively hard, either intentionally, or otherwise Having an Unicode alias for == would help make Julia better for human cognition and help users avoid the mistake of using the assignment operator for the relational operator. Human errors can be classified as “mistakes” or “slips”. What distinguishes them is the intention of the person. An error in the intention is called a mistake. An error in carrying out the intention is called a slip. The error we are discussing is a “slip” – the user intended to type the relational operator (==), but instead typed the assignment operator (=). Furthermore, this is a skill-based error, as the user knows the language syntax and is skilled at typing. So what causes the slip? Slips can be categorized based on their presumed sources. The slip of using = for == is could be one the following, or a combination of these: • A blend slip, in which combination of components from two competing schemas (where a “schema” is an organized memory unit) • A mode error, an erroneous classification of the situation. Users move among many different environments, where “=” has different meanings: mathematics, and some programming languages use “=” as a relational operator. • Associative activation, as the currently active schema activate others which they are associated. Adding to the probability of making this slip is high familiarity with the task and low attention to it – our being on “auto pilot”. Skilled touch typists don’t have to think about how to move their fingers to generate letters and words; thought gets translated to action without cognitive effort. The user’s cognitive effort is focused on solving the problem for which they’re writing a program. Furthermore, actions done on “auto-pilot” are more subject to corruption from interruptions. sources: “Design Rules Based on Analysis of Human Error,” by Donald A. Norman, Communications of the ACM, April 1983, Vol. 26, No. 4 “A comprehension-based model of correct performance and errors in skilled, display-based, human-computer interaction,” by Muneo Katajima and Peter G. Polson, Int. J. of Human-Computer Studies (1995) 43, 65-99 “Categorization of Action Slips,” by Donald A. Norman, Psychological Review, Jan. 1981, Vol. 88, No. 1 THREE - From Data This is a common error. How do we know? A) Linters and compilers are programmed to generate a warning for it. The error in question is syntactically correct. Why would a linter or a compiler generate a warning? Because it’s a common error. The VSCode Linter for Julia highlights it. gcc has command line switch to warn on it (-Wall or -Wparentheses) SAS JMP JSL will pop up a dialog upon script execution to ask the user if they really intended to do assignment in the if (answer: always no) Other erroneous, but syntactically correct code is not highlighted, such as: if a==5 && a==6 println("a is both 5 and 6") end if 1 & 0 > 9 println("Happy day") end if findfirst(@assert) chop(@macro) diagonal() println("nonsense passes lint") end B) the development of Yoda conditions to guard against this error. C) Many lists of “common programming errors” and other discussions include using the assignment operator for the relational operator: Testimony @D_A I understand you very well and I am glad to see that I am not alone… Personally, as I often work with SQL, XSL (and XPath), I regularly make this mistake too by putting = instead of == for equality, and as the ≠ symbol is shorter and cleaner (I never use !=), I tend to do my tests reversed with ≠ instead of direct ==… Objections Objection: You can do it yourself @jzr julia> a ≟ b = a == b ≟ (generic function with 1 method) julia> 4 ≟ 4 true I replied: that makes you the only creepy dude in the world who does it, and you get puzzled questions from library maintainers. @Tamas_Papp replied Nay, that’s fine, others can just look up the function in your code, the tooling is there, like for any other function. If you want an alias, just do it as @jzr suggested, but it is unlikely that you can make others change the way they code, or that the language should support you in this attempt. @sudete replied: I disagree, I think it’s generally a bad idea to introduce non-standard syntax without a strong reason. “Others can just look up…” may be right but missing the larger picture, which is that even small non-standard things add up. This can make codebases significantly less accessible to new readers/contributors. Even one idiosyncrasy is an unnecessary obstacle that can be annoying to people who jump through many codebases in a single day. Response: redefining it yourself is code obfuscation. If I contribute that code to a library, I haven’t just done it for myself, but for you too. What it someone takes my code and wants to modify it? Do they follow my non-standard syntax or the standard syntax? Defining your own syntax violates the program design principles of simple, reliable, and adaptable. Namely, not simple and not adaptable. Objection: it would break code already using the chosen symbol my assertion it doesn’t break anything @Tamass_Papp Technically it would break code already using these symbols as a function name or something. Also, not using up a lot of the Unicode operator selection with various defaults was a very sane decision for Julia, since that allows users to make use of them. Response: True enough, but that’s also true for the Unicode aliases released in 1.7 beta: 1. ⫪ (U+2AEA, \Top, \downvDash) and ⫫ (U+2AEB, \Bot, \upvDash, \indep) may now be used as binary operators with comparison precedence (#39403). 2. The middle dot · (\cdotp U+00b7) and the Greek interpunct · (U+0387) are now treated as equivalent to the dot operator ⋅ (\cdot U+22c5) (#25157). 3. The minus sign − (\minus U+2212) is now treated as equivalent to the hyphen-minus sign - (U+002d) (#40948). Or in 1.6: 1. ꜛ (U+A71B), ꜜ (U+A71C) and ꜝ (U+A71D) can now also be used as operator suffixes. They can be tab-completed from ^uparrow, ^downarrow and ^! in the REPL (#37542). I can go on. Hey, why not one more: In 1.5: 1. ⨟ is now parsed as a binary operator with times precedence. It can be entered in the REPL with \bbsemi followed by TAB (#34722). The Unicode standard has 143,859 characters. We aren’t significantly depleting that resource if we use one more for an alias for ==. Objection: would this really help the cognitive problem? I don’t see how an alias for == would help with your original problem of mistakenly using = when you mean ==. What’s the connection? Response: It helps in that it replaces using compound symbol – of two equal signs – which have a strong association with “equality” with \ie (or \Equ or \ieq). One won’t mistake \ie for = . I use \ne, \leq, and \geq all the time, even though it requires me to type more characters (including the annoying \ one). Also, it slows you down, so you think about it more (not on “auto pilot”). Objection: It’s just one of many common errors @oheil replied: There are a lot of common errors. E.g. forgetting ; at the end of a line, forgetting a closing " at the end of a string, using ' instead of " for strings, just to name a few which come to mind for this and other languages. Response: Not quite the same. Forgetting to use “;”, or using “;” when you don’t need to is a slip with a mode cause. Using " or ’ for strings, when you should use the other, is a slip with mode cause. Whereas using = for == combines aspects of blend, mode, and association activation. A (hypothetical) analogous situation could arise for booleans: ∧ is the symbol for AND, and ∨ is the symbol for OR. In our (hypothetical) language, however, ∧ is used for exponentiation. So when you want to use AND in a boolean expression, you have to type ∧∧ Objection: the VSCode linter already highlights it Response: this is not a very effective safety for catching this problem. The VSCode interface is an angry fruit salad and the linter is a fireworks show on top of it. What do I mean by that? While typing, the linter is always highlighting stuff, popping up boxes for completions, or definitions, or underlining stuff, or changing the colors. You type in a bit of code, and of course – since you haven’t completed it yet – it breaks the downstream syntax, so the linter highlights and recolors it, only to revert back once you’re done typing. Or you type in “#=” to start a block comment, and all the text afterwards changes color the “comment color”, only to revert again when you put the “=#” in. In short, the linter cries wolf too often. This leads humans to ignore it. Ironically, it might be more effective if it were slower. Objection: just use isequal() Response: not a bad idea, although a little troubling it doesn’t act exactly like ==. So not a direct replacement. Finally: @Tamas_Papp I am not sure that there is anything else that can be done here, short of consulting a brain specialist. Response: That would have to be a team of brain specialists, ideally at a research university. 7 Likes 10 Likes 1.7 beta: 1. ⫪ (U+2AEA, \Top, \downvDash) and ⫫ (U+2AEB, \Bot, \upvDash, \indep) may now be used as binary operators with comparison precedence (#39403). 2. The middle dot · (\cdotp U+00b7) and the Greek interpunct · (U+0387) are now treated as equivalent to the dot operator ⋅ (\cdot U+22c5) (#25157). 3. The minus sign − (\minus U+2212) is now treated as equivalent to the hyphen-minus sign - (U+002d) (#40948). 1.6: 1. ꜛ (U+A71B), ꜜ (U+A71C) and ꜝ (U+A71D) can now also be used as operator suffixes. They can be tab-completed from ^uparrow, ^downarrow and ^! in the REPL (#37542). 1.5: 1. ⨟ is now parsed as a binary operator with times precedence. It can be entered in the REPL with \bbsemi followed by TAB (#34722). 2 Likes Aside from 2. (middle dot) and 3. (minus sign), all of these did not change anything about the core language and made those symbols available for user code to use as people see fit in their packages. If you take a look at the respective issues/PRs on github, you’ll notice that they’re either old (e.g. the middle dot one stems from 0.7, when the big push for stabilizing syntax happened and it seems like it just wasn’t merged back then) or because the asked for syntax is seen as undisputably equivalent (and allows copying from LaTeX pdfs, apparently). Note also that before any new version is released, the new version is tested against all released & in General registered packages, to make sure it doesn’t break anything. Further, I’m not sure I understand how remembering to write \Equ\Equ is different from remembering to write == instead of =? Feels much more cumbersome to write to me, disincentivizing adoption. 3 Likes While writing all this stuff you could have done the PR… While I have read all this stuff, I could have done the PR… 6 Likes infinitely this. Btw the title is misleading: == isn’t going anywhere 2 Likes It’s the “Hegemony of ==” which has to go (according to OP)! the political, economic, or military predominance or control of one state over others 2 Likes You just write \Equ[TAB] Try it in the REPL Or \ie[TAB] if a new shortcut is created at the moment you need to press: \<Shift>Equa<tab>, that’s 7 vs. == 2. IDK, seems not worth it bruh 2 Likes Well, for me (german keyboard) it’s (<Right-ALT> + ß) + (<SHIFT> + e) + q + u + a + <TAB>/l + <TAB> for ⩵ vs. (<SHIFT> + 0) for =, so 9 vs. 2 keystrokes (or 9 vs. 3 for the double version, keeping SHIFT pressed for the second =) That’s part of the problem with using unicode characters for core functionaliy - not everyone has the same keyboard layout, so it’s not necessarily simple to write these things, even with TAB-completion in the REPL. As has been mentioned in the other thread though, you’re free to use those in your own packages, provided you ship the equivalent functions in all code you’ve packaged up so everything runs on other people’s machines as well (please expose an ASCII only interface as well - few things are more frustrating than having trouble using code because writing it uses too many unicode exclusive things). I just doubt it would be added to the core language. 1 Like It sounds to me like what you actually need is just some better visual hints as to what character you are using. Perhaps a font with ligatures, though some of these de-emphasize rather than emphasize the difference between = and ==. But I think the best solution would be to customize your syntax highlighting scheme. The assignment operator is arguably ‘special’, and it would make sense to give it a color that is different from other operators. I’m no good at hacking syntax highlighters, but maybe someone here has a tip how to do it? In the REPL, there is OhMyREPL.jl, but I’m not sure if it allows special-casing single characters. 3 Likes If you’re using VS Code, put the following into your “settings.json” file: "editor.tokenColorCustomizations": { "[Julia (Monokai Classic)]": { "textMateRules" : [ { "scope": "source.julia keyword.operator.update.julia", "settings": { "foreground": "#E6DB74" } } ] } } For this example, I’ve used my Julia (Monokai Classic) theme, but you can use any theme you like. And of course you can change the color by changing the hex color code in the "foreground" property. 17 Likes You can also configure your julia editor/repl to insert == when you type \ie. I think that would address your concern that definining your own operator “makes you the only creepy dude in the world who does it, and you get puzzled questions from library maintainers” because you’re only changing your own editing environment, rather than the resulting source code. I’m not exactly sure how to do it, but the relevant references seem to be https://docs.julialang.org/en/v1/stdlib/REPL/#Customizing-keybindings https://docs.julialang.org/en/v1/stdlib/REPL/#Tab-completion 5 Likes I just wanted to say that I enjoyed reading your post with its comprehensive argumentation and the little cognitive science detour. But despite its eloquence it doesn’t convince me that adding a Unicode synonym for == is a good idea… Partly because I generally prefer where there’s one way to do things (it makes every piece of code in the ecosystem more familiar) and partly because I still think the issue is better solved by tooling. I didn’t find your objection to the lint convincing: it doesn’t matter if colors are blinking while you type. What matters is that when you move to the next line you will have a lint warning over there that stands out. I also like the other suggestions in this thread. To summarize: • use the linter, or • use a font with a ligature for == that stands out, or • use distinctive syntax highlighting, or • define a shortcut like \ie that completes to ==. These all seem workable to me. 5 Likes The idea of special ligatures for the font is interesting. It would certainly be very beneficial to have optional automatic replacements for = (turned into ← for example) and == (turned into = for example). Julia Mono already allows optional symbols suitable for |> and =>, after all. This would allow a personal local syntax without getting in the way of the outside world. 2 Likes This feels a bit like an IDN homograph attack done with good intentions. It seems like a thing where Julia would want to do more canonicalization rather than to encourage distinguishing two very similar strings. 7 Likes This is a non sequitur. Also, as mentioned in the other topic you proposed this, in Julia if a = b already errors (with syntax: unexpected "="). But if you are super-concerned about this, just use a linter. Finally, generally the point of Unicode aliases is to make code look shorter and similar to math. Your proposal does not help with either, so its very likely to end up unused, except by a few people. But since you can already define custom aliases for all functions (again, as mentioned in the other topic), you can just get do this without redesigning the language for everyone. Let me make a counterproposal along these lines: define your favorite alias for ==, and see how it works out for you. If after 6 months / 10kLOC you still want to press 5+ keys to get what is basically ==, wrap it up in a mini-package and register it. If after a while you get a bunch of users, revive this topic: you will be in a much better position to argue for it. 16 Likes If anything, isequal is very slightly more appropriate for general-use purposes than == because of how it handles edge cases like different NaNs and stuff (try isequal(NaN, NaN*5) versus NaN==NaN*5. I’m not suggesting == is bad, but I think your response dismissing that solution is not particularly compelling). I agree with @johnmyleswhite that introducing a very similar looking character for effectively the exact same purpose as == invites a ton of problems. And it would probably lead to much stranger issues that are harder to track down than the occasional if x = 5 ; .... 2 Likes How is == (or the lack of an equivalent symbol) responsible for people mistakenly using = to test equality? How would adding a single character alias for == fix the problem that, sometimes, = ends up used to test equality? 7 Likes I don’t share OP’s difficulties with ==, but I do agree with their point One: [EDIT:] An alias using ligature ⩵ would look nice and be consistent with ≥. After all, what purpose could it serve other than an alias for ==? Going a bit further, such aliases could conceivably be integrated further into the REPL. In Mathematica notebooks, characters get auto-magically converted as you type: Mathematica also has some smart cut-and-paste action. If ≥ is pasted back into a notebook, it remains ligature, but if pasted as plain text elsewhere it reverts back to separate characters >=. This feature seemed kind of freaky when they introduced it, but the reality is that it’s quite transparent and you never have to think about it. I was too complacent to learn \ge in Julia REPL, but wouldn’t mind being auto-corrected into something nicer looking. 1 Like
2021-08-01 10:30:56
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.48559483885765076, "perplexity": 3189.927969396275}, "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-31/segments/1627046154175.76/warc/CC-MAIN-20210801092716-20210801122716-00440.warc.gz"}
https://mathtod.online/@yoriyuki/1571839
yoriyuki is a user on mathtod.online. You can follow them or interact with them if you have an account anywhere in the fediverse. If you don't, you can sign up here. yoriyuki @yoriyuki arxiv.org/abs/1805.00200 · Web · 2 · 1 この論文、数学的には $\max(x_1, \ldots, x_n) \sim \log \left [ 1 - n + \sum_{i = 1}^n e^{x_i} \right]$ という近似がすべてです。
2018-05-21 22:48: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.2257305532693863, "perplexity": 2059.0304107964694}, "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-22/segments/1526794864558.8/warc/CC-MAIN-20180521220041-20180522000041-00377.warc.gz"}
https://onemathematicalcat.org/Math/Algebra_II_obj/graphical_int2.htm
# Graphical Interpretation of Sentences like $f(x)=g(x)$ and $f(x)>g(x)$ Need some basic information on graphs of functions and related concepts first?  Graphs of Functions This section should feel remarkably similar to the previous one: Graphical interpretation of sentences like $\,f(x) = 0\,$ and $\,f(x) \gt 0\,.$ This current section is more general—to return to the previous ideas, just let $\,g(x)\,$ be the zero function. If you know the graphs of two functions $\,f\,$ and $\,g\,,$ then it is very easy to visualize the solution sets of sentences like $\,f(x) = g(x)\,$ and $\,f(x)\gt g(x)\,.$ This section shows you how! A key observation is that a sentence like $\,f(x) = g(x)\,$ or $\,f(x) \gt g(x)\,$ is a sentence in one variable, $\,x\,.$ To solve such a sentence, you are looking for value(s) of $\,x\,$ that make the sentence true. The functions $\,f\,$ and $\,g\,$ are known, and determine the graphs that you'll be investigating. Recall that the graph of a function $\,f\,$ is a picture of all points of the form $\,(x,f(x))\,,$ and the graph of a function $\,g\,$ is a picture of all points of the form $\,(x,g(x))\,.$ In particular, the $\,y$-value of the point $\,(x,f(x))\,$ is the number $\,f(x)\,$ and the $\,y$-value of the point $\,(x,g(x))\,$ is the number $\,g(x)\,$: • If $\,f(x)\gt g(x)\,,$ then the point $\,(x,f(x))\,$ lies above the point $\,(x,g(x))\,.$ • If $\,f(x)=g(x)\,,$ then the graphs of $\,f\,$ and $\,g\,$ intersect at this point. • If $\,f(x)\lt g(x)\,,$ then the point $\,(x,f(x))\,$ lies below the point $\,(x,g(x))\,.$ These concepts are illustrated below. The notation $\,P(x,f(x))\,$ is a convenient shorthand for: the point $\,P\,$ with coordinates $\,(x,f(x))$ $P_1(x,f(x))\,$ and $\,P_2(x,g(x))\,$ with $\,f(x)\gt g(x)\,$ for this value of $\,x\,,$ the graph of $\,f\,$ lies above the graph of $\,g$ $P_1(x,f(x))\,$ and $\,P_2(x,g(x))\,$ with $\,f(x)=g(x)$ for this value of $\,x\,,$ the graphs of $\,f\,$ and $\,g\,$ intersect $P_1(x,f(x))\,$ and $P_2(x,g(x))\,$ with $\,f(x)\lt g(x)$ for this value of $\,x\,,$ the graph of $\,f\,$ lies below the graph of $\,g$ The graphs of functions $\,f\,$ and $\,g\,$ are shown below. The solution set of the inequality ‘$\,f(x)\gt g(x)\,$’ is shown in green. It is the set of all values of $\,x\,$ for which the graph of $\,f\,$ lies above the graph of $\,g\,.$ The graphs of functions $\,f\,$and $\,g\,$ are shown below. The solution set of the equation ‘$\,f(x)=g(x)\,$’ is shown in green. It is the set of all values of $\,x\,$ for which the graphs of $\,f\,$ and $\,g\,$ intersect. The graphs of functions $\,f\,$ and $\,g\,$ are shown below. The solution set of the inequality ‘$\,f(x)\lt g(x)\,$’ is shown in green. It is the set of all values of $\,x\,$ for which the graph of $\,f\,$ lies below the graph of $\,g\,.$ The graphs of functions $\,f\,$ and $\,g\,$ are shown below. The solution set of the inequality ‘$\,f(x)\ge g(x)\,$’ is shown in green. It is the set of all values of $\,x\,$ for which the graph of $\,f\,$ lies on or above the graph of $\,g\,.$ The graphs of functions $\,f\,$ and $\,g\,$ are shown below. The solution set of the inequality ‘$\,f(x)\le g(x)\,$’ is shown in green. It is the set of all values of $\,x\,$ for which the graph of $\,f\,$ lies on or below the graph of $\,g\,.$ ## Example The graphs of two functions, each with domain $\,\mathbb{R}\,,$ are shown below: • $\,f\,$ is a parabola, shown in the black dotted pattern; • $\,g\,$ is a cubic polynomial, shown in purple. These two curves intersect at the points $\,(-1,2)\,$, $\,(0,0.5)\,$ and $\,(1,1)\,$. Pay attention to the difference between the brackets ‘$\,[\ ]\,$’ and parentheses ‘$\,(\ )\,$’ and braces ‘$\,\{\ \}\,$’ in the solutions sets! Remember that the symbol ‘$\,\cup\,$’, the union symbol, is used to put sets together. The solution set of the inequality ‘$\,f(x)\gt g(x)\,$’ is: $$\cssId{s66}{(-\infty ,-1) \cup (0,1)}$$ The solution set of the equation ‘$\,f(x)=g(x)\,$’ is: $$\cssId{s68}{\{-1,0,1\}}$$ The solution set of the inequality ‘$\,f(x)\lt g(x)\,$’ is: $$\cssId{s70}{(-1,0)\cup (1,\infty)}$$ The solution set of the inequality ‘$\,f(x)\ge g(x)\,$’ is: $$\cssId{s72}{(-\infty ,-1] \cup [0,1]}$$ The solution set of the inequality ‘$\,f(x)\le g(x)\,$’ is: $$\cssId{s74}{[-1,0] \cup [1,\infty )}$$ Let's discuss the solution set of the inequality ‘$\,f(x)\gt g(x)\,$’. Imagine a vertical line passing through the graph, moving from left to right. Every time the vertical line is at a place where the graph of $\,f\,$ lies above the graph of $\,g\,,$ then you must include that $\,x$-value in the solution set. Be extra careful of places where something interesting is happening (like where the graphs intersect).
2023-02-01 19:58: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.7088893055915833, "perplexity": 112.5099658068346}, "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/1674764499949.24/warc/CC-MAIN-20230201180036-20230201210036-00444.warc.gz"}
http://math.stackexchange.com/questions/40720/how-valid-is-the-concern-over-narrow-pipe-cryptographic-hash-function-designs?answertab=oldest
How valid is the concern over narrow pipe cryptographic hash function designs? Narrow pipe hash function designs have recently come under fire, particularly in reference to some SHA-3 candidates. Is this criticism valid? Can it be explained more simply than this paper does? - Not that it's ready yet, but for future reference: area51.stackexchange.com/proposals/15811/cryptography –  Qiaochu Yuan May 22 '11 at 20:30 @Qiaochu Yuan: This fragmentation really distresses me. I answer a lot of questions on StackOverflow, and this fragmentation is making it a huge pain for me to figure out where to get a question answered. And half the time, StackOverflow is a better place to ask it anyway. sigh –  Omnifarious May 22 '11 at 20:33 @Omnifarious: I mention this mostly because of your use of the word "criticism." Not being an expert in this field I don't know whether that indicates a mathematical question or a matter of opinion. –  Qiaochu Yuan May 22 '11 at 21:08 @Qiaochu: It is an appropriate question. He is asking whether a certain flaw in a specific class of hash functions causes them to have sufficient vulnerability to be classified as broken. –  Brandon Carter May 22 '11 at 21:25 @Brandon: thank you. I am mildly worried that nobody on math.SE has the expertise to answer this question, but we'll see what happens. –  Qiaochu Yuan May 22 '11 at 21:28 2 Answers You're asking whether an ongoing research-level discussion has merits or not. This is difficult to know since experts are actively working on this stuff and you never know what can happen: criticism can fizzle out (as did Courtois's algebraic attacks on AES, after causing a major scare 10 years ago) or pay off (as did Xiaoyun Wang's MD5 attacks). You want my opinion? I'll give it: existential proofs for hash function security (which is what the cited paper in your question offers) do not hold much sway. Unless you can exhibit an actual attack, I don't think the alarm bells should be ringing. Here's an appropriate example: Consider some SHA-3 hash function $H$. (For the uninitiated, a cryptographic hash function is a map from a string of any length to one of some specified fixed length; it's a public function; there is no key.) Since $H$ has an infinite domain and a finite range, so by the pigeon-hole principle, there exists a collsion. Therefore $H$ is not collision-resistant and thus it's insecure. Bogus right? Existential proofs don't mean much in a computational setting. Of course there are collisions, but the hope is that we cannot find them. That said, there are other papers giving unconvincing attacks against narrow-pipe constructions, so even in the absence of concrete practical attacks, sentiment will grow against the approach even if there will never be any reason to reject it. As sad as it is, cryptography is still partly religious when it comes to designing primitives (meaning we rely a lot on intuition and instinct rather than on proofs, because proofs of security don't exist for hash functions and blockciphers and integer factorization, etc). Edited to Add: I prefer to remain anonymous here. My PhD is in cryptography, I have 5-6 papers related to cryptographic hashing, and I'm a professor at a "pretty good" place in the U.S. You can read the above opinion with this in mind, or you can discard it as "suspect" and "unsubstantiated." I'll leave that to you. - your opinion would be much more valuable if it came with your real name, so that any interested party could check out your experience with cryptographic issues. I don't see much merit in a pseudonymous opinion. –  Pete L. Clark May 23 '11 at 1:36 @Pete: Point well-taken. However, I prefer remaining anonymous on these forums, so I'll have to live with the loss-of-value engendered as a result. –  Fixee May 23 '11 at 1:40 I'm afraid that I do find the "I claim that I'm an expert -- you can trust me if you like" form of answer that you've given problematic, but I won't discuss that further here. I can't even figure out whether this should count as an answer to the question. Worse, I can't even figure out whether the question is on-topic for the site. Nothing in this answer mathematically addresses the validity of the cited paper, which makes me think that, as Fixee essentially says, its validity is not really a matter of mathematical proof/disproof. If so, this question may be off-topic here.. –  Pete L. Clark May 23 '11 at 2:00 A better phrasing of my above comment is: "Nothing in this answer addresses the mathematical validity of the cited paper". The answer has some mathematics in it, but it doesn't make any claim about the mathematical soundness of the cited paper. –  Pete L. Clark May 23 '11 at 2:09 @Pete L. clark: I think your criticism is valid. This is an opinion answer, and the person realizes this and refuses to back the opinion with the credentials that would give it (rightly or wrongly) more weight, but claims they exist. That said, I still think it's useful and respect the desire of @Fixee to remain anonymous. I did get an answer elsewhere that talked about the mathematics behind the attack, and I will give an answer here that adresses this and simplifies the mathematics to a level most could understand. –  Omnifarious May 23 '11 at 5:36 This is a purely theoretical attack that is quite minor and not of any great value in carrying out an actual attack on the security properties of any given hash function. The explanation involves a bit of math, that while obvious, if explained pedantically using formal mathematics is quite obscure. But, since such pedantry is what is desired on this site, I will give the obscure and strictly correct formal math answer, and then explain it so someone who isn't actually particularly familiar with formal mathematical notation might hope to make sense of it. The original paper, of course, uses formal mathematical reasoning and never really bothers to explain it, which is why it is inaccessible and why I asked this question in the first place. Personally, I feel that papers that rely on this kind of thing and don't bother to explain it in a way that makes sense to people who don't want to wade through a maze of specialized symbolic notation should be rejected for publication. Then maybe the people who write them would learn to communicate. So, here's the semi-useless math-out section: There is a function such that: $$f(x) \to y$$ $${ X \equiv \{ a \mid a \in \mathbb Z, 0 \leq a < 2^n \} }, { x \in X }$$ $${ Y \equiv \{ a \mid a \in \mathbb Z, 0 \leq a < 2^m \} }, { y \in Y }$$ In an ideal hash function that functions as a random oracle, $f(x)$ maps each individual member of set $X$ onto a completely random member of set $Y$. We'll define $O$ as the range of $f$ like so: $$O \equiv \{ {y \in Y} \mid {y = f(x)}, x \in X \}$$ $$O \subseteq Y$$ if $n < m$ it is clearly the case that $O \neq Y$. Also, if $n = m$ it will also be true that, in the most probable case, $O \neq Y$ (even though $O \subset Y$). Though as $n$ grows larger than $m$ it becomes increasingly probable that $O = Y$. It turns out that, on average, $\frac{n(O)}{n(Y)} = {1 - \frac{1}{e}}$ when $n = m$, as is the case in narrow pipe hash functions. ${1 - \frac{1}{e} } \approx 0.632$, so this means that only a little more than half the members of $Y$ will ever be mapped to from $X$. $$\frac{2^n}{2} = 2^{n-1}$$ $$\frac{2^n}{\frac{1}{1 - \frac{1}{e}}} = {2^{n-\log_2 {1 - \frac{1}{e}}}} \approx {2^{n-0.66}}$$ This means that $\log_2 n(O)$ is approximately 0.66 less than $\log_2 n(Y)$ if $n = m$. If $n$ is much larger than $m$, as is the case in wide-pipe designs, then it's most likely that $O = Y$ so $n(O) = n(Y)$. Less formally, a narrow pipe design maps an $n$ bit value to another $n$ bit value. If this mapping is a completely random mapping, that means some values will not appear in the output since there will be some output values for which there are multiple input values that map to it. It turns out that the number of output values is (in the average case) $2^n \cdot (1 - \frac{1}{e})$. Since ${1 - \frac{1}{e}} \approx 0.632$ that means nearly half of the possible output values won't actually happen. This sounds kind of scary until you think about it. If you lose a full half of the output range, that means you've only effectively lost one bit, and since you're losing less than half of the output range you've effectively lost less than one bit. This is very minor. So, it's a valid attack, yes. But this does not mean it is at all something to worry about. - Unless someone can give a better and clearer explanation, this is the answer I will accept as soon as I am able. (It won't let me yet.) –  Omnifarious May 23 '11 at 6:04 I don't understand your "fairly obvious math": if by the average number of $x$-valued that map to a given $y$-value you mean the arithmetic mean of the number of preimages of a point $y$ in the codomain, then if the domain $X$ and the codomain $Y$ are finite sets, this average value is $\# X / \# Y$. Under the assumption that $X$ and $Y$ have the same size -- this called finite narrow domains in the linked to paper (it considers both this case and the case in which $\# X \gg \# Y$), this means the average number of preimages is $1$, not $\frac{1}{1-\frac{1}{e}}$. –  Pete L. Clark May 23 '11 at 7:07 Let me say that the above remark -- in that it focuses on the mathematics rather than the cryptographic issues and assumptions made -- is rather shallow and nit-picky. But as a mathematician, it is the only kind of remark I am qualified to make here... –  Pete L. Clark May 23 '11 at 7:10 @Pete L. Clark: I hate when people vote me down when I'm not actually wrong. If you do not like questions that involve cryptography in any way, regardless of whether math is involved or not, please leave this question alone and go elsewhere. –  Omnifarious May 23 '11 at 7:36 @Omnifarious: I don't mean to be confrontational, but...I didn't say you were not actually wrong. My first comment pointed out what I understand to be a mathematical mistake. It is confined to the sentence "In fact..." What you say after that is correct as far as I can see. If you fix this sentence -- or, of course, if it turns out that I am mistaken -- I will gladly remove the downvote. It's not meant to cause you any distress. (I see that this is your first answer on this site. Maybe things work differently on other SE sites; apologies if this was not what you were expecting.) –  Pete L. Clark May 23 '11 at 8:39
2014-11-23 10:00:52
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 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.7558733820915222, "perplexity": 565.4364423013267}, "config": {"markdown_headings": false, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 20, "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-2014-49/segments/1416400379414.61/warc/CC-MAIN-20141119123259-00029-ip-10-235-23-156.ec2.internal.warc.gz"}
https://polytcs.wordpress.com/
Project 3: the log-rank conjecture The log-rank conjecture is one of my favorite open problems in complexity and combinatorics. At a high level it is asking “what is the structure of low-rank boolean matrices ?”. I will describe it and some equivalent formulations below, and then pose some more open-ended questions about low rank matrices with “combinatorial” structure. Definitions and formulation A boolean matrix is a matrix with 0,1 entries. A matrix is monochromatic if all its entries are the same. Given a matrix A, we denote by |A| the number of its entries. A rectangle (equivalently sub-matrix) B of A is a restriction of A to some subsets of rows and columns. Log-rank conjecture: Let A be a boolean matrix. Assume the rank of A over the reals is r. Then there is a monochromatic rectangle  B in A of size $|B| \ge |A| / 2^{(\log r)^k}$ for some absolute constant k>0. If we replace rank over the reals with rank over other fields (such as $\mathbb{F}_2$) then the log-rank conjecture is false. The Hadamard matrix is one such counter-example, as its rank over  $\mathbb{F}_2$ is exponentially smaller than its rank over the reals. Over large enough finite fields, the analogous conjecture is equivalent to the conjecture over the reals. An interesting question is what is the threshold needed on the field size for this to hold; is it polynomial or exponential in the size of A? History and connections to communication complexity The log-rank conjecture is attributed to Lovász and Saks [LS88], where it was motivated by questions in communication complexity. Related conjectures were made by van Nuffelen [vN76] and Fajtlowicz [Faj88], motivated by questions in graph theory. The original formulation of the log-rank conjecture is in terms of the deterministic communication complexity of A. A deterministic protocol for A with c bits is an iterative procedure, where at each iteration either the row or the columns of A are partitioned into two parts. At the end, we partition A to monochromatic rectangles. Clearly, if the deterministic communication complexity of A is c, then there is a monochromatic rectangle in A of size $\ge |A| / 2^c$. The reverse direction, showing that it suffices to find one large monochromatic rectangle in a low-rank boolean matrix in order to recurse and find a partition, was shown by Nisan and Wigderson [NW94]. The following is an equivalent formulation for the log-rank conjecture. Log-rank conjecture (original formulation): Let A be a boolean matrix. Assume the rank of A over the reals is r. Then the deterministic communication complexity of A is at most $(\log r)^k$ for some absolute constant k>0. Known bounds Let A be a boolean matrix of rank r. It can have at most $2^r$ distinct rows (and columns). To see why, assume that its columns space is spanned by the first r columns (permute the columns if this is not the case). Then the first r bits in a row specify the entire row. In particular, this shows that A has a monochromatic rectangle of size $\ge |A| / 2^r$, which is exponentially worse than the conjectured bound. The best known upper bound is by Lovett [Lov16], and shows that there is a monochromatic rectangle of size $\ge |A| / r^{O(\sqrt{r})}$. The best lower bound is by Göös, Pitassi and Watson [GPW18], who showed that $k \ge 2$ is needed in the log-rank conjecture formulation above. Special cases There are two special cases which are natural from the communication complexity perspective, that show connections between the log-rank conjecture and boolean function analysis. They are related to “lifted functions”, and specifically are XOR-functions and AND-functions. Below let $f:\{0,1\}^n \to \{0,1\}$ be an arbitrary boolean function. XOR functions: The corresponding XOR-function for f is the $2^n \times 2^n$ matrix $A_{x,y} = f(x \oplus y)$, where $\oplus$ is an entry-wise XOR. The log-rank conjecture for XOR-functions has an appealing equivalent form in terms of the boolean function f. First, it turns out that the rank of A is equal to the Fourier sparsity of f, namely the number of nonzero Fourier coefficients of f. Tsang, Wong, Xie, Zhang [TWXZ13] suggested the following conjecture, and shows that it implies the log-rank conjecture for XOR functions. Later, Hatami, Hosseini and Lovett [HHL18] showed that the two conjectures are equivalent. Below we identify $\{0,1\}^n$ with the linear space $\mathbb{F}_2^n$. Log-rank conjecture for XOR functions (equivalent formulation): Let $f:\{0,1\}^n \to \{0,1\}$ be a boolean function. Assume that the Fourier sparsity of f is r. Then there is a subspace $V \subset \mathbb{F}_2^n$ on which f is constant, where the co-dimension of V is $(\log r)^k$ for some absolute constant k>0. AND functions: The corresponding AND-function for f is the $2^n \times 2^n$ matrix $A_{x,y} = f(x \wedge y)$, where $\wedge$ is an entry-wise AND. The rank of A is equal to the sparsity of f as a polynomial. Namely, the number of nonzero coefficients when expressing f as a linear combination of monomials $\prod_{i \in S} x_i$ for $S \subseteq [n]$. The following conjecture is the natural analog of the log-rank conjecture for XOR functions. We don’t know if it is equivalent to the log-rank conjecture for AND functions, but it seems believable. Below, a subcube $C \subset \{0,1\}^n$ is obtained by fixing some inputs to constants; it’s co-dimension is the number of fixed inputs. Log-rank conjecture for AND functions (possibly equivalent formulation): Let $f:\{0,1\}^n \to \{0,1\}$ be a boolean function. Assume that the polynomial sparsity of f is r. Then there is a subcube $C \subset \{0,1\}^n$ on which f is constant, where the co-dimension of C is $(\log r)^k$ for some absolute constant k>0. Other communication complexity models Analogs of the log-rank conjecture have been suggested for other models of communication complexity, such as randomized communication or quantum communication. In a recent breakthrough, Chattopadhyay, Mande, and Sherif [CMS19] disproved the relevant log-rank conjecture for randomized communication, and suggested a more refined variant that may be true. Please see their paper for details, as well as [ABT19, SdW19] for an extension to the quantum case. Structure of low-rank matrices A more general question is what is the structure of low-rank matrices with some “combinatorial” structure. The log-rank conjecture fixes one such structure – having boolean entries. Here is another conjecture, where we replace “boolean” with “sparse”. Sparse low-rank conjecture: let A be matrix, where a constant fraction of its entries are zero. Then there is a rectangle B in A, where all the entries are zero, of size $|B| \ge |A| / 2^{O(\sqrt{r})}$. The bound in the conjecture, if true, is best possible. This conjecture has connections to matrix rigidity and to additive combinatorics. You can read more about it in a survey I wrote a few years ago on progress on the log-rank conjecture [Lov14]. Note that it is missing some recent developments (eg [GPW18], [CMS19]). In general, I think that studying questions in the intersection of algebra (e.g. low rank) and combinatorics (e.g. boolean, sparse) leads to both interesting questions, which potentially can connect various fields in TCS and math. To some extent, the entire field of additive / arithmetic combinatorics can be seen in this way. Exact quantum vs deterministic communication protocols (this information is from Ronald De-Wolf) A corollary of the log-rank conjecture is that for boolean communication problems, exact quantum protocols (quantum protocols without errors) are equivalent to deterministic protocols, up to polynomial factors. For quantum protocols without entanglement, this follows from the log-rank conjecture since it is known that an exact quantum protocol with c bits implies that the communication matrix has rank at most $2^c$. For quantum protocols with entanglement this is more involved and was proved by Buhrman and De-Wolf [BdW01]. The question of whether the sampling analog of exact quantum and deterministic protocols is equivalent is in fact equivalent to the log-rank conjecture. This is given as Conjecture 2 in [T99] and is shown in [ASTVW03]. Bibliography [ABT19] A. Anshu, G. Boddu and D. Touchette. Quantum Log-Approximate-Rank conjecture is also false. 2019 IEEE 60th Annual Symposium on Foundations of Computer Science (FOCS). [ASTVW03] Ambainis, A., Schulman, L. J., Ta-Shma, A., Vazirani, U., & Wigderson, A. (2003). The quantum communication complexity of sampling. SIAM Journal on Computing, 32(6), 1570-1585. [BdW01] Buhrman, Harry, and Ronald de Wolf. Communication complexity lower bounds by polynomials. Proceedings 16th Annual IEEE Conference on Computational Complexity. IEEE, 2001. [CMS19] A. Chattopadhyay, N.S. Mande, and S. Sherif. The log-approximate-rank conjecture is false. Proceedings of the 51st Annual ACM SIGACT Symposium on Theory of Computing. 2019. [Faj88] S. Fajtlowicz. On conjectures of graffiti. Discrete mathematics, 72(1):113–118, 1988. [GPW18] M. Göös, T. Pitassi, and T. Watson. Deterministic communication vs. partition number. SIAM Journal on Computing 47.6 (2018): 2435-2450. [HHL18] H. Hatami, K. Hosseini and S. Lovett. Structure of protocols for XOR functions. SIAM Journal on Computing 47.1 (2018): 208-217. [Lov14] S. Lovett. Recent advances on the log-rank conjecture in communication complexity. Bulletin of EATCS 1.112 (2014). [Lov16] S. Lovett. Communication is bounded by root of rank. Journal of the ACM (JACM) 63.1 (2016): 1-9. [LS88] L. Lovász and M. Saks. Lattices, Möbius Functions and Communication Complexity. Annual Symposium on Foundations of Computer Science, pages 81–90, 1988. [NW94] N. Nisan and A. Wigderson. On Rank vs. Communication Complexity. Proceedings of the 35rd Annual Symposium on Foundations of Computer Science, pages 831–836, 1994. [SdW19] M. Sinha and R. de Wolf. Exponential separation between quantum communication and logarithm of approximate rank. 2019 IEEE 60th Annual Symposium on Foundations of Computer Science (FOCS). [T99] Amnon Ta-Shma. Classical versus Quantum Communication Complexity. SIGACT News, Complexity Theory Column 23, 1999. [TWXZ13] H. Y. Tsang, C. H. Wong, N. Xie and S. Zhang. Fourier sparsity, spectral norm, and the log-rank conjecture. 2013 IEEE 54th Annual Symposium on Foundations of Computer Science. [vN76] C. van Nuffelen. A bound for the chromatic number of a graph. American Mathematical Monthly, pages 265–266, 1976. Dear all, please don’t freak out by the famous log-rank conjecture. 😉 As request by some participants, Professor Lovett kindly gave an online tutorial and updated the proposal with several more approachable subproblems. You may find this survey paper helpful to get more background on this problem: Lokam, Satya. Complexity lower bounds using linear algebra. Now Publishers Inc, 2009. http://www.cs.toronto.edu/~toni/Courses/CommComplexity/Papers/lokam-book.pdf Like Let me link here to this recent paper on this topic: https://arxiv.org/abs/2101.09592 Like Project 2: Is Semidefinite Programming (SDP) Polynomial-Time Solvable? Semidefinite Programming (SDP) is a subfield of convex optimization concerned with the optimization of a linear objective function over the intersection of the cone of positive semidefinite matrices with an affine space, i.e., a spectrahedron. SDP is an extension of Linear Programming (LP), with vector variables replaced by matrix variables and nonnegativity elementwise replaced by positive semidefiniteness. One may refer to these two papers [Poru20][Lova03] for more background on SDP. It is known that LP is solvable in polynomial time. SDP shares some good properties of LP, yet it has more challenging difficulties. In 2014, the well-known TCS blog Gödel’s Lost Letter and P=NP posted one article about this topic: Could We Have Felt Evidence For SDP ≠ P? In this project, we would like to collect theoretical obstacles that prevent us from getting a polynomial-time algorithm of SDP in different aspects and discuss how to make any new progress. References [Poru20] Porumbel, Daniel. Demystifying the characterization of SDP matrices in mathematical programming. No. 2530. EasyChair, 2020. link [Lova03] Lovász, László. “Semidefinite programs and combinatorial optimization.” In Recent advances in algorithms and combinatorics, pp. 137-194. Springer, New York, NY, 2003. link (1) The Complexity of Sum-of-square-roots In 1976, Ron Graham, Michael Garey, and David Johnson could not show some geometric optimization problems such as Euclidean Traveling Salesman Problem is NP-complete or not (they can only show the problem is NP-hard), the reason is that they could not figure out whether the sum-of-square-roots problem is polynomial-time solvable or not. Ron Graham Gives a Talk In 2019, Ron Graham [Grah19] listed this problem as one of his favorite problems and offered $10 for the following challenge: Challenge 1: ($10) Show that two sums of square roots of integers cannot agree for exponentially many digits (measured by the size of the input). Actually, Yap and Sharma showed that the best known bounds for the required bit-precision of the input is exponential in $n$ [YaSh17] (chapter 45).  In the recent work,  Erickson, van der Hoog and  Miltzow [EHM19]  proved that under perturbations of the input of magnitude $\delta$, the sum-of-square-roots can be computed on a real RAM with an expected bit-precision of $O(n\log(n/\delta))$ per input variable. Ron Graham presented it at the Fiftieth Southeastern International Conference on Combinatorics, Graph Theory, and Computing (SEICCGTC), March 4-8, 2019,  in the Student Union at Florida Atlantic University in Boca Raton, FL.  Fan Chung Graham (she was the most frequent invited female speaker of that conference, Paul Erdős was one of the most frequent male participants) was also the invited plenary speaker at that conference.  As always, his talk was mixed with fun, magic games, interesting problems and monetary prizes! There were two other special things of that talk: a sign language translator standing on the stage to help the audience in need (it is such a wonder to translate math into sign language!); Fan Chung Graham standing in front of the laptop table to help to switch slides pages due to technical problems (we all owed her a lot, with her kind help, the audience enjoyed a wonderful talk!) . slides Ron Graham-A few of my favorite problems (When we copied the slides, Ron Graham joked he was gonna square root those prizes, but he didn’t.) In 1998, Michel X. Goemans gave an ICM talk, in which, he addressed this issue: “Semidefinite programs can be solved(or more precisely, approximated) in polynomial-time within any specific accuracy either by the ellipsoid algorithm or more efficiently through interior-point algorithms…The above algorithms produce a strictly feasible solution(or slightly infeasible for some versions of the ellipsoid algorithm) and, in fact, the problem of deciding whether a semidefinite program is feasible(exactly) is still open. A special case of semidefinite programming feasibility is the square-root-sum problem. The complexity of this problem is still open.” [Goem97] The most remarkable progress towards this problem is by Allender et al. [ABKM03], they showed this problem lies in the 3rd level of the Counting Hierarchy (CH): ${{P^{PP}}^{PP}}^{PP}$. In CCC 2019 workshop open problem session, I presented the sum-of-square-roots problem, Eric Allender was also in the audience, he commented “we still embarrassingly have little understanding of it. ” I also asked Mihalis Yannakakis about the connection of square-root sum and PosSLP in Papafest, he kindly explained more details: “PosSLP is a problem, not a class, which encapsulates the essential power of the unit-cost arithmetic RAM model. Basically, the corresponding class is the class of decision problems solvable in polynomial time in the Blum-Shub-Smale model with rational constants.  The paper by Allender et al is the best reference for PosSLP. That paper introduced and studied thoroughly the problem. There is no further progress with respect to its relation to the classical complexity classes, like NP, Polynomial hierarchy, etc, as far as I know. The square-root sum problem is reducible to PosSLP, but it is not known to be equivalent. That is if someone proves that the square-root sum problem is in P or NP (in the standard Turing model of complexity), it will not follow from this that PosSLP is also in P or NP, from what we know today. There are some problems that are equivalent to PosSLP (i.e. reductions going both ways), for example, one is in my paper with Etessami on Recursive Markov chains in JACM 2009, another in the paper with Etessami and Stewart in our paper on Branching processes in SIAM J. Computing 2017.” Kristoffer Arnsfelt Hansen mentioned Tarasov and Vyalyi (also cited by Allender et al.)  [TaVy08] proved that semidefinite feasibility is PosSLP-hard. However, based on the explanation of Yannakakis, one can see SDP is not equivalent to PosSLP. Thus, even PosSLP is in CH, there is still hope to solve SDP more efficiently.  Bahman Kalantari [Kala20] recently showed that SDP feasibility problem is equivalent to solving a convex hull relaxation (CHR) for a finite system of quadratic equations. One may refer to the following two books for numerical algorithm and optimization techniques [Solo15] [NoSt06], the books [BCS13] and [BCSS98] for numerical complexity and algebraic complexity. References [Grah19] Graham, Ron. “Some of My Favorite Problems (I).” In 50 years of Combinatorics, Graph Theory, and Computing, pp. 21-35. Chapman and Hall/CRC, 2019. link [YaSh17] Toth, C. D., O’Rourke, J., & Goodman, J. E. (Eds.). (2017). Handbook of discrete and computational geometry. CRC press. Link [EHM19] Erickson, J., van der Hoog, I., & Miltzow, T. (2019). A Framework for Robust Realistic Geometric Computations. arXiv preprint arXiv:1912.02278. Link [Goem97] Goemans, Michel X. “Semidefinite programming in combinatorial optimization.” Mathematical Programming 79, no. 1-3 (1997): 143-161. link [ABPM03] Allender, Eric, Peter Bürgisser, Johan Kjeldgaard-Pedersen, and Peter Bro Miltersen. “On the complexity of numerical analysis.” SIAM Journal on Computing 38, no. 5 (2009): 1987-2006. link [TaVy08] Tarasov, Sergey P., and Mikhail N. Vyalyi. “Semidefinite programming and arithmetic circuit evaluation.” Discrete applied mathematics 156, no. 11 (2008): 2070-2078. link [Kala20] Kalantari, Bahman. “On the Equivalence of SDP Feasibility and a Convex Hull Relaxation for System of Quadratic Equations.” arXiv preprint arXiv:1911.03989 (2019). link [Solo15] Solomon, Justin. Numerical algorithms: methods for computer vision, machine learning, and graphics. CRC press, 2015. [NoSt06] Nocedal, Jorge, and Stephen Wright. Numerical optimization. Springer Science & Business Media, 2006. [BCS13] Bürgisser, Peter, Michael Clausen, and Mohammad A. Shokrollahi. Algebraic complexity theory. Vol. 315. Springer Science & Business Media, 2013. [BCSS98] Blum, Lenore, LENORE AUTOR BLUM, Felipe Cucker, Michael Shub, and Steve Smale. Complexity and real computation. Springer Science & Business Media, 1998. complexity of square-root sum TOPP Problem 33 The Curse of Euclidean Metric: Square Roots (2) Logic and P In his Ph.D. thesis, Ronald Fagin created the area of Finite Model Theory and stated that the set of all properties expressible in existential second-order logic is precisely the complexity class NP (It is known as Fagin’s Theorem) [Fagi74]. It is a long open problem in descriptive complexity that what logic structure can capture P?  The logic FPC (Fixed-Point Logic with Counting) is a powerful and natural fragment of P, but it is not all of P.  Jin-Yi Cai, Martin Fürer and Neil Immerman found one counterexample [CFI92] . It is also known that FPC could not express the solvability of systems of linear equations over a finite field. However, Martin Grohe showed that for every surface, a property of graphs embeddable in that surface is decidable in polynomial time if and only if it is definable in FPC [Groh12]. Matthew Anderson, Anuj Dawar and  Bjarki Holm showed that the optimization of linear programs is expressible in FPC [ADH15]. Then, how about SDP?  Anuj Dawar and Pengming Wang showed the FPC implementation of the ellipsoid method extends to semidefinite programs (subject to some technical conditions) [DW16]. How does that new progress help us to understand the complexity of SDP? According to Rice’s Theorem,  it is undecidable to determine if a given problem is in P or not, which may limit the above approach. References [Fagi74] Fagin, Ronald. “Generalized first-order spectra and polynomial-time recognizable sets.” Complexity of computation 7 (1974): 43-73. Link [CFI92] Cai, Jin-Yi, Martin Fürer, and Neil Immerman. “An optimal lower bound on the number of variables for graph identification.” Combinatorica 12, no. 4 (1992): 389-410. link [Groh12] Grohe, Martin. “Fixed-point definability and polynomial time on graphs with excluded minors.” Journal of the ACM (JACM) 59, no. 5 (2012): 1-64. link [ADH15] Anderson, Matthew, Anuj Dawar, and Bjarki Holm. “Solving linear programs without breaking abstractions.” Journal of the ACM (JACM) 62, no. 6 (2015): 1-26. link [DW16] Dawar, Anuj, and Pengming Wang. “Lasserre lower bounds and definability of semidefinite programming.” arXiv preprint arXiv:1602.05409 (2016). link (3) Semialgebraic Proof System In the recent paper Semialgebraic Proofs and Efficient Algorithm Design published on Foundations and Trends in Theoretical Computer Science, Noah Fleming, Pravesh Kothari and Toniann Pitassi [FKP19] bridge Semialgebraic Proofs and Efficient Algorithm Design. It is amazing that some natural families of algorithms can be viewed as a generic translation from a proof that a solution exists into an algorithm for finding the solution itself! That paper mainly discusses two semialgebraic proof systems– Sherali-Adams and Sum-of-Squares, and shows up to an additive small error, SDP can be solvable in polynomial time (Corollary 3.12). What proof system is strong enough to capture the nature of SPD? Is there any hope we can get a truly polynomial-time algorithm to solve SDP with it? Paul Beame discussed the limit of proof in the open lecture of the Simons Institute: The Limits of Proof. References [FKP19] Fleming, Noah, Pravesh Kothari, and Toniann Pitassi. Semialgebraic Proofs and Efficient Algorithm Design. now the essence of knowledge, 2019. link (4) Tropical Geometry and Algebraic Geometry In recent years, there has been some surprising new progress towards some fundamental open problems in linear programming with the help of tropical and algebraic geometry.  For example, Michael Joswig et al. [ABGJ18] disproved the continuous analogue of Hirsch conjecture and showed primal-dual log-barrier interior point methods are not strongly polynomial using an amazing new technique–Tropical Geometry.  Jesús A. De Loera gave a talk of their new contributions of simplicial polytopes and central path curvature with tropical and algebraic geometry tools in JMM 2019 video  slides.  Pablo A. Parrilo also showed the connection of SDP and convex algebraic geometry [BPT12] . Can those tools help to get a truly polynomial-time algorithm of SDP (or give negative answers)? References [ABGJ18]  Allamigeon, Xavier, Pascal Benchimol, Stéphane Gaubert, and Michael Joswig. “Log-barrier interior point methods are not strongly polynomial.” SIAM Journal on Applied Algebra and Geometry 2, no. 1 (2018): 140-178.  link [BPT12] Blekherman, Grigoriy, Pablo A. Parrilo, and Rekha R. Thomas, eds. Semidefinite optimization and convex algebraic geometry. Society for Industrial and Applied Mathematics, 2012.  link (5) Number Theory and Lattice Qi Cheng (University of Oklahoma) suggested applying diophantine approximation from number theory [Habe18] to improve the sum-of-square-roots problem. What is the minimum nonzero difference between two sums of square roots of integers? Qi Cheng, Xianmeng Meng, Celi Sun, and Jiazhe Chen [CMSC10] gave a tighter upper bound via lattice reduction. References [Habe18] Habegger, Philipp. “Diophantine approximations on definable sets.” Selecta Mathematica 24, no. 2 (2018): 1633-1675. link [CMSC10] Cheng, Qi, Xianmeng Meng, Celi Sun, and Jiazhe Chen. “Bounding the sum of square roots via lattice reduction.” Mathematics of computation 79, no. 270 (2010): 1109-1122. link (6) Circuit Lower Bound and Other Consequences of SDP=P Noah Fleming proposed one interesting research direction: instead of trying to put SDP into P, it might also be interesting to prove that putting SDP in P is hard! So like show that if SDP=P, then we get circuit lower bounds or derandomization or something. Noah Fleming recommended the paper showing that complexity class separations imply circuit lower bounds by Nissan-Wigderson Generator [NoWi94] and the Kabanets-Impagliazzo paper [KaIm04] . Noah also attempted to connect this problem to degree 2 polynomial and SETH. Thanks to the brilliant idea by Noah Fleming, this problem would connect to the hardcore areas of TCS–Circuit Lower Bound and Pseudorandoness! References [NoWi94] Nisan, Noam, and Avi Wigderson. “Hardness vs randomness.” Journal of computer and System Sciences 49, no. 2 (1994): 149-167. Link [KaIm04] Kabanets, Valentine, and Russell Impagliazzo. “Derandomizing polynomial identity tests means proving circuit lower bounds.” computational complexity 13, no. 1-2 (2004): 1-46. Link This is a fascinating problem. A technical remark I suggest to have new comments appearing on the front page of the blog. (Like in the polymath blog, or my blog and many others.) This can be done via a suitable editing of the “widgets” in “appearance”. Like Dear Professor Kalai, thank you very much for your suggestions! The PolyTCS Editor Team has taken care of it. 😉 Liked by 1 person Project 1: The Entropy-Influence Conjecture The entropy-influence conjecture was originally asked by Ehud Friedgut and Gil Kalai in 1996. For a boolean function $f:\{-1,1\}^{n}\rightarrow\{-1,1\}$, its influence is $I(f) := \sum_{i\in[n]}\Pr_{x}[f(x) \neq f(x\oplus e_{i})]$. The entropy of $f$ is defined by $\mathcal{H}(f):= -\sum_{S}\hat{f}(S)^{2}\log(\hat{f}(S)^{2})$. The entropy-influence conjecture asks, could we prove that $\mathcal{H}(f) = O(I(f))$ for any boolean function $f$. In my knowledge, the best known (general) result was given by Gopalan, Servedio, Tal and Wigderson [1]. They proved that $\mathcal{H}(f) = O(\log (s_{f}) \cdot I(f))$ where $s_{f}$ is the sensitivity of $f$. By plugging-in a robust version of [1], a result of Lovett, Tal and Zhang [2] shows that we can replace $s_{f}$ by the robust sensitivity. In particular, it shows $\mathcal{H}(f) = O(w\cdot \log w)$ for any width-$w$ DNF $f$. The entropy-influence conjecture is known true for some classes of boolean functions. However it is still hard for general boolean functions. It is even non-trivial to prove that $\mathcal{H}(f) = 2^{O(I(f))}$. An easier question is the min-entropy influence conjecture. Which asks could we prove that $\mathcal{H}_{\infty}(f) = O(I(f))$. By Friedgut’s juntas theorem, we are able to prove $\mathcal{H}_{\infty}(f) = O(I(f)^{2})$. It is interesting to ask could we prove this true for entropy, i.e., could we prove that $\mathcal{H}(f) = O(I(f)^{2})$? For certain classes: • KKL theorem implies min-entropy influence conjecture holds for monotone functions. • O’Donnell, Wright and Zhou [3] proved entropy influence conjecture holds for symmetric functions. [1] Gopalan, P., Servedio, R., Tal, A. and Wigderson, A., 2016. Degree and sensitivity: tails of two distributions. arXiv preprint arXiv:1604.07432. [2] Lovett, S., Tal, A. and Zhang, J., 2018. The robust sensitivity of boolean functions. In Proceedings of the Twenty-Ninth Annual ACM-SIAM Symposium on Discrete Algorithms (pp. 1822-1833). Society for Industrial and Applied Mathematics. [3] O’Donnell, R., Wright, J. and Zhou, Y. 2011. The Fourier Entropy-Influence Conjecture for certain classes of Boolean functions. In Proceedings of ICALP 2011. Thank you for sharing your treasure, Jiapeng! That’s indeed a very interesting problem! Could you please provide a link of your result you mentioned? Like Which result? $\mathcal{H}_{\infty}(f) = O(I(f)^{2})$? I don’t think there is a link. It is a folklore. Like • Rupei Xu 6:02 pm on November 1, 2019 Permalink “By Friedgut’s juntas theorem, we are able to prove…” Like Yes, there is no link for this result. It is an unpublished observation. It could be a good exercise. Liked by 1 person Ok, thank you. Like This is indeed a very nice problem and thankful to Jiapeng Zhang for proposing it. Two quick remarks are that I wrote in 2007 a post about it on Terry Tao’s blog https://terrytao.wordpress.com/2007/08/16/gil-kalai-the-entropyinfluence-conjecture/ , the second remark is that I heard about some recent soon-to-be-published works related to the conjecture (but not solving it). Liked by 1 person Thank you Gil. I will add more references about works in this conjecture soon. There are a lot of nice results (after your blog 😉 ) Like Dear Gil, do you mean this paper? https://arxiv.org/pdf/1911.10579.pdf Liked by 1 person • Gil Kalai 6:32 pm on December 1, 2019 Permalink Dear Jiapeng, yes this is what I meant! Like • Rupei Xu 7:37 pm on December 6, 2020 Permalink Recently this paper was presented in FOCS 2020, here is the link to the talk: https://www.youtube.com/watch?v=X3mkTUmlX2Y Like Welcome to PolyTCS! Let’s propose TCS problems and achieve amazing results together! “Coming together is a beginning, staying together is progress, and working together is success.” Henry Ford “It is the long history of humankind (and animal kind, too) that those who learned to collaborate and improvise most effectively have prevailed.” Charles Darwin “Talent wins games, but teamwork and intelligence win championships.” Michael Jordan This is the first post on my new blog. I’m just getting this new blog going, so stay tuned for more. Subscribe below to get notified when I post new updates. The precise quote of Michael Jordan should be: “Talent wins games, but teamwork and machine learning win championships.” Liked by 2 people I like this joke! If Michael Jordan trains another Michael Jordan with machine learning techniques, maybe there will be more championships! 😄 Like • Gil Kalai 5:56 pm on October 12, 2019 Permalink For me, the famous Michael Jordan is doing machine learning, but the less famous Michael Jordan is highly impressive as well 🙂 Liked by 1 person You can use this logo I created a while back: http://grigory.us/pics/notequal.png Like Thank you Grigory! Could you please give an explanation of the meaning of your designed logo? Like • Grigory Yaroslavtsev 1:43 pm on October 8, 2019 Permalink Well, it kind of says “one person is strictly less computationally powerful than the same person given oracle access to other people”, no? Liked by 1 person Great! Thank you, Grigory! I just changed the logo, it looks nice! Like c Compose new post j Next post/Next comment k Previous post/Previous comment r
2021-04-14 00:43:57
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 51, "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.7216793894767761, "perplexity": 1353.1674319309077}, "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-17/segments/1618038076454.41/warc/CC-MAIN-20210414004149-20210414034149-00265.warc.gz"}
https://www.techwhiff.com/learn/a-piece-of-cheese-with-a-mass-of-127-kg-is-placed/507
# A piece of cheese with a mass of 1.27 kg is placed on a vertical spring of negligible mass and ###### Question: A piece of cheese with a mass of 1.27 kg is placed on a vertical spring of negligible mass and a force constant k = 2300 N/m that is compressed by a distance of 17.3 cm.When the spring is released, how high does the cheese rise from this initial position? (The cheese and the spring are not attached.) Use 9.81 m/s^2 for the acceleration due to gravity. Express your answer using two significant figures. #### Similar Solved Questions ##### 1. In a poll, 191 out of a sample of 357 likely Connecticut voters indicate they... 1. In a poll, 191 out of a sample of 357 likely Connecticut voters indicate they intend to vote to lega marijuana. Find a. A conservative 99% confidence interval for the proportion of all likely Connecticut voters who are in favor of this initiative. b. An approximate 95% confidence interval for the... ##### Assignment 04 - Analysis of Financial Statements The most recent data from the annual balance sheets... Assignment 04 - Analysis of Financial Statements The most recent data from the annual balance sheets of Fitcom Corporation and Scramouche Opera Company are as follows: Balance Sheet December 31st (Millions of dollars) Fitcom Corporation Scramouche Opera Company Scramouche Opera Company Fitcom Corpor... ##### Charles Cocoa Corporation (CCC) has gathered the following data pertaining to the preparation of its 2020... Charles Cocoa Corporation (CCC) has gathered the following data pertaining to the preparation of its 2020 budgeted balance sheet: Accounts receivable is typically 3% of sales revenue. The company has always maintained a cash balance of $57,000. CCC has budgeted$125,000 to purchase new machinery fo... ##### What functional group is this? HOCH, C=0 to NH-C—CH,—C-H - О КОН N-H –CH, HN-C–CH, GlcNAc... What functional group is this? HOCH, C=0 to NH-C—CH,—C-H - О КОН N-H –CH, HN-C–CH, GlcNAc !! ol... ##### Course contents » » LECTURE PREP 8 due THUR 3/21 at 4pm » Choose true or... course contents » » LECTURE PREP 8 due THUR 3/21 at 4pm » Choose true or false for each statement below about the uniform electric field shown above. 1he electrostatic force on a charge is weaker at point C than at point B potential ENE RGY difference between points A and B is ind... ##### Refer to the titration curve above for 0.500 M acetic acid titrated with hydroxide ions. When... Refer to the titration curve above for 0.500 M acetic acid titrated with hydroxide ions. When [CH3COOH] = 0.125 M and [CH3COO-] = 0.375 M, where would you plot the pH value? in Region 1 in Region 2. to the left of the midpoint in Region 2. to the right of the midpoint in Region 3 in Region 4... ##### A 12-cm-long spring is attached to the ceiling. When a 1.6 kg mass is hung from... A 12-cm-long spring is attached to the ceiling. When a 1.6 kg mass is hung from it, the spring stretches to a length of 18 cm . Part A What is the spring constant k? Part B How long is the spring when a 3.0 kg mass is suspended from it?... ##### 1. What are the main goals of therapy for all patients with diabetes in terms of... 1. What are the main goals of therapy for all patients with diabetes in terms of both symptom control and quantitative targets for fasting blood glucose levels and for the hemoglobin A1c? 2. You prepare a teaching plan to include glargine (Lantus) for your patient. What information will you include ... ##### A time study analyst observes a worker over a period of time and calculates that the worker requi... A time study analyst observes a worker over a period of time and calculates that the worker required 60.0 minutes per unit produced. The worker was rated by the analyst at a 120 percent performance rating, and an 15 percent allowance for personal time and fatigue applies. (1) What is the standard ti... ##### When a company is involved in capital budgeting decision, it can include all except a. Expansion... When a company is involved in capital budgeting decision, it can include all except a. Expansion decisions b. Make or buy decisions C. Lease or buy decisions d. Employee selection decisions Select one: O a. Lease or buy decisions O b. Employee selection decisions c. Expansion decisions O d. Make or ... ##### Show the reagent and intermediates KMnO4 IK] KMnO4 IK] show the reagent and intermediates KMnO4 IK] KMnO4 IK]... ##### Average: /5.6 Attempts: 8. Bank regulating tools A report on the operations and financial condition of... Average: /5.6 Attempts: 8. Bank regulating tools A report on the operations and financial condition of a bank A periodic physical inspection of a bank's operations Match each bank regulation A legal notice requiring a bank to take action Call report On-site examinations sist order...
2022-07-01 10:40: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": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.18168886005878448, "perplexity": 3982.846991784483}, "config": {"markdown_headings": true, "markdown_code": false, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2022-27/segments/1656103940327.51/warc/CC-MAIN-20220701095156-20220701125156-00044.warc.gz"}
https://byjus.com/jee/jee-advanced-2021-question-paper-chemistry-paper-1/
JEE Advanced Question Paper 2021 Chemistry Paper 1 JEE Advanced 2021 Chemistry question paper for Paper 1 is available here. Along with the questions, we have also provided solutions to each problem given in the question paper. The solutions have been prepared by our expert faculty in an easy-to-understand manner. This will further help students to not only find the correct answers but also figure out how the outcome was achieved. Going through the JEE Advanced 2021 Chemistry questions and solutions will allow students to further develop better problem-solving and time management skills. Additionally, they will be able to study more productively for the upcoming entrance exam. Students can access the JEE Advanced 2021 Paper 1 Chemistry question paper and solution PDFs below. We have also provided paper analysis videos which students can watch and learn more about the question types, weightage of marks, important concepts and more. JEE Advanced 2021 Paper 1 Chemistry Question Paper Question 1. The major product formed in the following reaction is: Solution: 1. Answer: (b) It is a case of Birch reduction. Alkynes on reaction with alkali metal in liq. NH3 gives trans-alkene. But terminal alkynes do not get reduced. Question 2. Among the following, the conformation that corresponds to the most stable conformation of meso-butane-2,3-diol is; Solution: 1. Answer: (b) Meso compounds have a plane of symmetry. In case of butan-2, 3-diol, gauche form is the most stable due to intramolecular H-bonding. Question 3. For the given close-packed structure of a salt made of cation X and anion Y shown below (ions of only one face are shown for clarity), the packing fraction is approximately (packing fraction = packing efficiency / 100) 1. a. 0.74 2. b. 0.63 3. c. 0.52 4. d. 0.48 Solution: 1. Answer: (b) a = edge length of unit cell 2ry = a 2 (rx - ry) = √2a 2rx + a = √2a 2rx = a (√2a - 1) rx = 0.207 a Packing fraction = 3 × vol. of x + vol. of y / vol. of unit cell $\frac{3\times \frac{4}{3}\times \pi r_{x}^{3}+\frac{4}{3}+\pi \times r_{y}^{3}}{a^{3}}$ $\frac{4\times \pi \times (0.207a)^{3}+\frac{4}{3}\times\pi \times(0.5a)^{3}}{a^{3}}$ Question 4. The calculated spin only magnetic moments of [Cr(NH3)6]3+ and [CuF6]3– in BM, respectively, are (Atomic numbers of Cr and Cu are 24 and 29, respectively). 1. a. 3.87 and 2.84 2. b. 4.90 and 1.73 3. c. 3.87 and 1.73 4. d. 4.90 and 2.84 Solution: 1. Answer: (a) [Cr(NH3)6]3+ = Cr3+ Cr3+ = 3d3 4s0 It has 3 unpaired electrons μ = n √(n+2) BM μ = 3 √(3+2) BM μ = 3.87 BM [CuF6]3- = Cu+3 Cu+3 = 3d8 4s0 It has 2 unpaired electrons μ = 2 √(2+2) BM = 2.84 BM Question Stem for Question 5 and 6: For the following reaction scheme, percentage yields are given along the arrow: x g and y g are the masses of R and U, respectively. (Use: Molar mass (in g mol–1) of H, C and O as 1, 12 and 16, respectively) Question 5. The value of x is______. Solution: 1. Answer: (1.62) Question 6. The value of y is ______. Solution: 1. Answer: (3.20) Solution for both Questions 5 and 6 4 g of C3H4 = 0.1 mol From 0.1 mol of P, 0.01 mol of R will be produced ⇒ 1.62 g of R is produced From 0.1 mol of P, 0.032 mol of U is produced = 3.2 g of U is produced Question statement for Questions 7 and 8. For the reaction, X(s) ⇌ Y(s) + Z(g), the plot of $In\frac{p_{z}}{p^{\varnothing}}$ Versus 104 / T is given below (in solid line), where pz is the pressure (in bar) of the gas Z at temperature T and $p^{\varnothing}$ = 1 bar. (Given, $\frac{d(In\:K)}{d\left (\frac{1}{T} \right)} = -\frac{\Delta H^{\varnothing }}{R}$, where the equilibrium constant $K = \frac{p_{z}}{p^{\varnothing}}$and the gas constant, R = 8.314 J K–1 mol–1) Question 7. The value of standard enthalpy, $ΔH^{\varnothing}$ (in kJ mol–1) for the given reaction is ______. Solution: 1. Answer: (166.28) ⇒ ΔHº = 2 × 104 × 8.314 J ΔHº = 166.28 kJ mol-1 Question 8. The value of $ΔS^{\varnothing}$ (in J K–1 mol–1) for the given reaction, at 1000 K is ____. Solution: 1. Answer: (141.34) –RTln K = ΔGº = ΔHº – TΔSº Ink = Hº / RT + Sº / R ΔSº / R = 17 ΔSº = 17R = 141.338 J K-1 Question Stem for Questions 9 and 10. The boiling point of water in a 0.1 molal silver nitrate solution (solution A) is x ºC. To this solution A, an equal volume of 0.1 molal aqueous barium chloride solution is added to make a new solution B. The difference in the boiling points of water in the two solutions A and B is y × 10-2 ºC. (Assume: Densities of the solutions A and B are the same as that of water and the soluble salts dissociate completely. Use: Molal elevation constant (Ebullioscopic constant), Kb = 0.5 K kg mol-1; Boiling point of pure water as 100ºC.) Question 9. The value of x is ______. Solution: 1. Answer: (100.1) Question 10. The value of |y| is ______. Solution: 1. Answer: (2.5) Given molality of AgNO3 solution is 0.1 molal (solution-A) ΔTb = ikb m AgNO3 → Ag+ + NO3 - van't Hoff factor (i) for AgNO3 = 2 ΔTb = 2 × 0.5 × 0.1 (Ts – Tº) = 0.1 (Ts)A = 100.1ºC, so x = 100.1 Now solution - A of equal volume is mixed with 0.1 molal BaCl2 solution to get solution-B. AgNO3 reacts with BaCl2 to form AgCl(s). 0.1 mole of AgNO3 present in 1000 gram solvent or 1017 gram or 1017 mL solution, milli moles of AgNO3 in V ml 0.1 molal solution is nearly 0.1 V. Similarly in BaCl2. 2AgNO3(aq) + BaCl2(aq) → 2AgCl(s) + Ba(NO3)2 (aq) So x = 100.1 and |y| = 2.5 Question 11. Given: The compound(s), which on reaction with HNO3 will give the product having a degree of rotation, [α]D = –52.7º is(are); Solution: 1. Answer: (c, d) The enantiomer of (P) will have –52.7º rotation. So the reactant must be an isomer of D-glucose which can given the mirror image of (P) Question 12. The reaction of Q with PhSNa yields an organic compound (major product) that gives a positive Carius test on treatment with Na2O2 followed by the addition of BaCl2. The correct option(s) for Q is(are). Solution: 1. Answer: (a, d) The answer should be (a) and (d) Compounds given in options - b and c do not react with PhSNa. Question 13. The correct statement(s) related to colloids is(are) 1. a. The process of precipitating colloidal sol by an electrolyte is called peptization 2. b. Colloidal solution freezes at a higher temperature than the true solution at the same concentration 3. c. Surfactants form micelle above critical micelle concentration (CMC). CMC depends on temperature 4. d. Micelles are macromolecular colloids Solution: 1. Answer: (b, c) (a) The process of precipitating colloidal sol by an electrolyte is called peptization - False, (It is a process of converting precipitate into colloid) (b) Colloidal solution freezes at a higher temperature than the true solution at the same concentration - True (colligative properties) (c) Surfactants form micelles above critical micelle concentration (CMC). CMC depends on temperature - True (d) Micelles are macromolecular colloids - False, As micelles are associated colloids. Question 14. An ideal gas undergoes a reversible isothermal expansion from the state I to state II followed by a reversible adiabatic expansion from state II to state III. The correct plot(s) representing the changes from the state I to state III is(are) (p: pressure, V: volume, T: temperature, H: enthalpy, S: entropy) Solution: 1. Answer: (a, b, d) I → II → reversible, isothermal expansion, T → constant, ΔV → +ve, ΔS → +ve ΔH ⇒ 0 II → III → Reversible, adiabatic expansion Q = 0, ΔV → +ve, ΔS → 0 Question 15. The correct statement(s) related to the metal extraction processes is(are); 1. a. A mixture of PbS and PbO undergoes self-reduction to produce Pb and SO2. 2. b. In the extraction process of copper from copper pyrites, silica is added to produce copper silicate. 3. c. Partial oxidation of sulphide ore of copper by roasting, followed by self-reduction produces blister copper. 4. d. In the cyanide process, zinc powder is utilized to precipitate gold from Na[Au(CN)2]. Solution: 1. Answer: (a, c, d) PbS + 2PbO →3Pb + SO2 Self-reduction is taking place between PbS and PbO. In the Bessemer converter: The raw material for the Bessemer converter is matte, i.e., Cu2S + FeS (little). Here air blasting is initially done for slag formation and SiO2 is added from an external source. FeS + 3/2 O2 → FeO + SO2 SiO2 + FeO → FeSiO3 (slag) During slag formation, the characteristic green flame is observed at the mouth of the Bessemer converter which indicates the presence of iron in the form of FeO. The disappearance of this green flame indicates that the slag formation is complete. Then air blasting is stopped and slag is removed. Again air blasting is restarted for partial roasting before self-reduction until two-thirds of Cu2S is converted into Cu2O. After this, only heating is continued for the self-reduction process. Cu2S + 3/2 O2 → Cu2O + SO2 Cu2S + 2Cu2O → 6Cu(l) + SO2 ↑ (self reduction) and Cu2S + 2O2 →Cu2SO4 Cu2S + Cu2SO4 → 4Cu + 2SO2 ↑ (self reduction) Thus the molten Cu obtained is poured into a large container and allowed to cool and during cooling the dissolved SO2 comes up to the surface and forms blisters. It is known as blister copper. 2Na[Au(CN)2 ] + Zn → Na2[Zn(CN)4] + 2Au ↓ Question 16. A mixture of two salts is used to prepare a solution S, which gives the following results: The correct option(s) for the salt mixture is(are) 1. a. Pb(NO3)2 and Zn(NO3)2 2. b. Pb(NO3)2 and Bi(NO3)2 3. c. AgNO3 and Bi(NO3)3 4. d. Pb(NO3)2 and Hg(NO3)2 Solution: 1. Answer: (a, b) Question 17. The maximum number of possible isomers (including stereoisomers) which may be formed on mono-bromination of 1-methylcyclohex-1-ene using Br2 and UV light is ______. Solution: 1. Answer: (13) Monobromination of 1-methylcyclohexene in the presence of UV light proceeds by a free radical mechanism. The allyl radicals are formed which are stabilised by resonance. The secondary alkyl radicals are also formed which are stabilised by hyperconjugation. Of the seven products formed, six of them are optically active. So, 13 possible isomers are formed. Question 18. In the reaction given below, the total number of atoms having sp2 hybridization in the major product P is ______. Solution: 1. Answer: (12) The total number of atoms having sp2 hybridisation in the major product (P) = 12 This includes 4 C-atoms, 4 N-atoms and 4 O-atoms. Question 19. The total number of possible isomers for [Pt(NH3)4Cl2]Br2 is Solution: 1. Answer: (6) The given complex [Pt(NH3)4Cl2]Br2 has three ionisation isomers and each of them has two geometrical isomers.
2021-10-28 04:53:11
{"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.6791641712188721, "perplexity": 6671.933579140432}, "config": {"markdown_headings": false, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": false}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-43/segments/1634323588257.34/warc/CC-MAIN-20211028034828-20211028064828-00472.warc.gz"}
https://aa.quae.nl/cgi-bin/glossary.cgi?l=en&o=superior%20planet
Astronomy Answers: From the Astronomical Dictionary # Astronomy AnswersFrom the Astronomical Dictionary $$\def\|{&}$$ The description of the word you requested from the astronomical dictionary is given below. the superior planet A superior planet is a planet that is further from the Sun than the Earth is. Only superior planets can be in opposition, and their elongation can have any value up to 180 degrees. The superior planets are: Mars, Jupiter, Saturn, Uranus, Neptune, Pluto. The opposite of a superior planet is an inferior planet.
2021-06-18 20:44: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": 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.24526120722293854, "perplexity": 1806.3630194214873}, "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-25/segments/1623487641593.43/warc/CC-MAIN-20210618200114-20210618230114-00001.warc.gz"}
https://math.stackexchange.com/questions/2450292/the-hole-in-one-pizza/2452159
# The Hole in One Pizza In a recent issue of Crux, at the end of the editorial (which is public), it appears the following very nice problem by Peter Liljedahl. I couldn't resist sharing it with the MSE community. Enjoy! • I'm reminded of the more general (but less constructive) pancake theorem. – Mark S. Sep 29 '17 at 11:48 • in germany this problem (or some variant of it) is quiet commonly asked in job interviews (for jobs with an 'analytic' background) – tired Sep 29 '17 at 17:14 • The nice answer is invalid if part of the circle is outside the pizza, so it must be that the circle is entirely inside the pizza! – alexis Sep 29 '17 at 19:11 • Pizzas have some thickness, just cut it in half along the thin side. One person gets the top, the other gets the bottom. Completely fair /s – Justin Sep 30 '17 at 6:09 • The problem statement says that the chef "cuts out a circular piece". That seems to unambiguously imply that the cut cannot extend beyond the edge of the pizza, because then the cut would not produce a circular piece. – Tanner Swett Oct 13 '17 at 16:01 Nice riddle! My solution would be to cut along a line through the center of the circle and the center of the rectangle. Proof. A cut through the center of a circle divides it into pices of equal size. The same holds for rectangles. Therefore everyone gets the same amount of pizza minus the same "amount of hole". $\square$ $\qquad$ It amazed me that this works for pizzas and holes of even stranger shapes as long as they are point-symmetric. In this way one can make the riddle even more interesting, e.g. an elliptic pizza with a hole in the shape of a 6-armed star. • There's a nice physical approach to this too. A cut that splits the pizza evenly in two must pass through the pizza's center of mass. Assuming uniform mass distribution, symmetry tells us that the pizza's COM must be on a line that passes through the whole pizza's COM and the hole's center of "mass". – Dancrumb Sep 29 '17 at 13:54 • @Dancrumb It is not the case that a cut which splits the pizza evenly in two must pass through the pizza's center of mass. The particular line given by this answer does, but others might not. – jwg Sep 29 '17 at 15:17 • A line that splits the pizza evenly in half must, by definition, have half of the pizza one one side and half on the other. This means half the mass is on one side and half is on the other. Thus, this is a line that you can balance the pizza on. Thus, the COM must be on that line. – Dancrumb Sep 29 '17 at 16:49 • After reading around, I realize I am incorrect. I've failed to account for torque. A line through the COM may have a larger area on one side that is close to the line and a smaller area further away from the line that will balance, but not be of equal area. – Dancrumb Sep 29 '17 at 18:10 • @user21820 Most of the time the centers of the pizza and the two holes are not on the same line. How can you apply the same argument? – M. Winter Oct 1 '17 at 18:25 What does it exactly mean "1 cut"? Does it mean a straight line, or that the knife is always held down, or it does not leave the premise of the pizza - is the hole within the premise of the pizza? etc... Depending on the true meaning of "1 cut", other answers are possible, too, some of which can be used in a larger set of holes than the original question. I lack the reps to add upload img, so here is an ascii art: Hole on the right, zig-zag cutline in the middle, B has the hole, so a half/hole from A is cut away, and given to B: +----|----+ | | | | | _ | A | / / \| B | \ \_/| +----|----+ Solution for an unorthodox hole, the hole (intersecting the perimeter or the pizza on the right, the zig-zag cut in the middle: +----|----+ | | | | | _ | A | / / \| B | \ \ /| +---/--/ \+ I stumbled onto this problem and thought it would fit nicely as an activity in my classroom. I created a GeoGebra applet ofs this problem where students need to construct the midpoint and then measure the sides of their slices. When clicking the button it randomizes the pizza so students will be able to see if their method works for all of Hole in One Pizzas. I thought I would include the link here in case any other teachers came across this problem. It is a worksheet but you could just copy the applet. https://ggbm.at/P97VMYzX Lay both pizza's one on top of the other and cut through the whole so that it sliced in half. Each person get a slice from the pizza with the whole and the remainder of the other pizza. So the exterior area of the pizzas are equal and the share of the whole is equal. • This is a case where using 'hole' and 'whole' correctly is important. – Quantum7 Oct 3 '17 at 12:51 • If you have two identical pizzas, why would you need to divide them up? Clearly the question is about a single pizza that needs to be cut. – Quantum7 Oct 3 '17 at 12:57 • Really want to give this a (+1) for hilarity – TheSimpliFire Feb 25 '18 at 16:24
2021-06-13 09:20: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": 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.5236278772354126, "perplexity": 600.4353052362503}, "config": {"markdown_headings": true, "markdown_code": false, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-25/segments/1623487607143.30/warc/CC-MAIN-20210613071347-20210613101347-00103.warc.gz"}
https://lavelle.chem.ucla.edu/forum/viewtopic.php?f=42&t=53535&p=197650
Focus 2.63 $sp, sp^{2}, sp^{3}, dsp^{3}, d^{2}sp^{3}$ NRodgers_1C Posts: 54 Joined: Thu Jul 25, 2019 12:15 am Focus 2.63 Can someone confirm that my reasoning is correct for why "Angle b is expected to be around 109.5°?" I understand why angles a and c are expected to be approximately 120° (because the VSEPR geometry is trigonal planar). So we must assume that the O has 2 pairs of lone pairs (to complete the octet) and therefore it has 4 regions of electron density with 2 lone pairs, ergo the shape is bent and the angles are <109.5°? Thanks. Attachments Chem_Mod Posts: 18400 Joined: Thu Aug 04, 2011 1:53 pm Has upvoted: 435 times Re: Focus 2.63 Looks good to me! :) Ariel Davydov 1C Posts: 110 Joined: Thu Jul 11, 2019 12:16 am Been upvoted: 1 time Re: Focus 2.63 Exactly. Typically, if a Lewis structure omits lone pairs, we must fill them in ourselves. Since the oxygen has two bonds, we can assume that it has two lone pairs, since oxygen has 6 shareable valence electrons and in this molecule has a formal charge of zero. Thus, with a VSEPR equation of AX2E2 and four areas of electron density, we can come to the conclusion that this oxygen has a tetrahedral election geometry with bond angles of less than 109.5 degrees, since its molecular shape (bent) has two lone pairs that push on the atoms, making the bond angles slightly less than 109.5 degrees.
2020-06-05 00:46:22
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 1, "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.639453113079071, "perplexity": 2410.513838605646}, "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-24/segments/1590348492295.88/warc/CC-MAIN-20200604223445-20200605013445-00085.warc.gz"}
http://moodslx.com/lani-clothing-pxcxen/page.php?340dfa=matlab-rand-int-in-range
the codistributed array. Learn more about matrix, random number generator . returns an n-by-n codistributed array randi values from 1 to 100, with underlying class Parameters: low: int. returns an array which size is defined by the size vector [1,imax], and the type specified by The data type (class) must be a built-in MATLAB ® numeric type. codistributor2dbc. 'gpuArray'. with underlying class of double, random integer values in the range Start Hunting! . Find the treasures in MATLAB Central and discover how the community can help you! Skip to content. Other MathWorks country sites are not optimized for visits from your location. Web browsers do not support MATLAB commands. Vote. underlying class (datatype), and the same type as the The rand function returns real numbers between 0 and 1 that are drawn from a uniform distribution. P. R = randi(imax,size1,...,sizeN,'like',P) Skip to content. ... Find the treasures in MATLAB Central and discover how the community can help you! Random Integers. specifies that no interworker communication is to be performed when Skip to content. returns an array which size is defined by the size vector I thought of myltiplying by ten and then finding a way to get only the ones between -10 and 10 and use an iteration for each of the other numbers that is outside the limits [-10,10] to get a new number inside the limits. prototype array, P. R = randi(imax,size1,...,sizeN,datatype,'like',P) [1,imax], the specified underlying class if rand < .5 'heads' else 'tails' end Example 2. For example, rand(sz,'myclass') does not invoke myclass.rand(sz). C = randi (imax,n,codist) returns an n -by- n codistributed array with random integer values in the range [1,imax] and underlying class of double. type) as the prototype array, P. R = randi(imax,n,datatype,'like',P) The codistributor object with underlying class of datatype, random integer values Underlying class of the array, that is the data type of its elements, values in the range [1,imax], and the type specified by datatype, random integer values in the range R = 0.2190 0.6793 0.5194 0.0535 0.0470 0.9347 0.8310 0.5297 0.6789 0.3835 0.0346 0.6711 This code makes a random choice between two equally probable alternatives. Based on your location, we recommend that you select: . MathWorks is the leading developer of mathematical computing software for engineers and scientists. C = randi(___,codist,'like',P) Array of random integers, returned as either a distributed array, a returns an n-by-n codistributed array size with random integer values in the range datatype. returns a size1-by-...-by-sizeN matrix X = rand(n) returns an n-by-n matrix of random numbers. For information on constructing codistributor However for n > 20, for example, rand(r[1:21]), I get this message: ERROR: BoundsError() in getindex at range.jl:121 [1,imax] and underlying class of codistributor2dbc. [1,imax] and underlying class of randn (): creates random number on the normal distribution ("with replacement") with mean 0 and standard deviation 0. X = rand(n) returns an n-by-n matrix of random numbers. Thank you for sharing! MATLAB has a long list of random number generators. Lowest (signed) integer to be drawn from the distribution (unless high=None, in which case this parameter is one above the highest such integer). (datatype), and the same type as the prototype array, Random Integers. returns an array which size is defined by the size vector Commented: Priodyuti Pradhan on 28 Oct 2020 i want to generate random number between 1 to 10 answer like: 7 4 1 8 5 2 10 6 9 3 R = randi(imax,size) range, size, underlying class, and distribution scheme. Create gpuArray Rand Matrix. If either the class with random integer values in the range [1,imax] and Generating a random matrix with range. size with random integer values in the range By continuing to use this website, you consent to our use of cookies. integer values in the range [1,imax] and the same type Generating a random matrix with range. Minimum integer in the range, specified as an integer value. double. In general, you can generate N random numbers in the interval (a,b) with the formula r … 1. By default, rand returns normalized values (between 0 and 1) that are drawn from a uniform distribution. underlying class of double, random integer values in the range – chaohuang Jul 16 '12 at 4:01 ^ +1 - randn() generates numbers all along the real line, just with very very little probability beyond +/- 3*sigma. R = randi(imax,size1,...,sizeN) arraytype. Examples. The only arguments for rand () are the sizes of the resulting array. Random Integers. how to generate random integer number in a fixed range in MATLAB, like between 1 to 10. returns an array which size is defined by the size vector the codistributed array. [1,imax]. constructor without arguments. R = rand(3,4) may produce. returns a size1-by-...-by-sizeN array 1. 1. how to generate random integer in the inclusive range from 1 to 10 Community Treasure Hunt Find the treasures in MATLAB Central … R = randi(imax,size1,...,sizeN,arraytype) ... Find the treasures in MATLAB Central and discover how the community can help you! To I was tryingh to fit some variables using nlinfit for which i have generated random integers with randi but after fitting it has chosen some values as decimals numbers. Size arguments must have a fixed size. of randi values from 1 to 4, distributed by its This example shows how to create an array of random integer values that are drawn from a discrete uniform distribution on the set of numbers –10, –9,...,9, 10. Other MathWorks country sites are not optimized for visits from your location. Example: a=rand (100,1) The above example explains that a is a 100 by 1 column vector which contains numbers from a uniform distribution. size with underlying class of and underlying class (data type) as the prototype array, Create a 1000-by-1000 codistributed double matrix of This example shows how to create an array of random integer values that are drawn from a discrete uniform distribution on the set of numbers –10, –9,...,9, 10. returns an n-by-n matrix with For example, you can use rand()to create a random number in the interval (0,1), X = randreturns a single uniformly distributed random number in the interval (0,1). C = randi(imax,size,codist) X = rand(n,m) returns an n-by-m matrix of random numbers. If I can get any specific reason for the same? rand () effectively generates an integer in the range [0, 2^53-1], retries if the result was 0, and then divides the integer now in the range [1, 2^53-1] by 2^53 to give the random value. returns an array of random integers values in the range Vote. size1-by-...-by-sizeN are I want to get 20 random integer numbers between -10 and 10 and I thought of using the rand function in matlab. with random integer values in the range [1,imax] and 'codistributed', or MATLAB has a long list of random number generators. R = 0.2190 0.6793 0.5194 0.0535 0.0470 0.9347 0.8310 0.5297 0.6789 0.3835 0.0346 0.6711 This code makes a random choice between two equally probable alternatives. columns. Obviously the easiest solution to this would be: round (unifrnd (-5,5)); returns an array which size is defined by the size vector returns a size1-by-...-by-sizeN The result is in the open interval, (50,100). of C. Create a 1000-by-1000 gpuArray of 1 ⋮ Vote. Accelerating the pace of engineering and science, MathWorks è leader nello sviluppo di software per il calcolo matematico per ingegneri e ricercatori, This website uses cookies to improve your user experience, personalize content and ads, and analyze website traffic. Size of each dimension (as separate arguments), distributed array | codistributed array | gpuArray, R = randi(imax,size1,...,sizeN,arraytype), R = randi(imax,size1,...,sizeN,datatype,arraytype), R = randi(imax,size1,...,sizeN,datatype,'like',P), C = randi(imax,size1,...,sizeN,datatype,codist). returns a size1-by-...-by-sizeN array https://it.mathworks.com/matlabcentral/answers/58454-how-to-generate-random-integer-number-in-a-fixed-range-in-matlab-like-between-1-to-10#comment_764831, https://it.mathworks.com/matlabcentral/answers/58454-how-to-generate-random-integer-number-in-a-fixed-range-in-matlab-like-between-1-to-10#answer_70731, https://it.mathworks.com/matlabcentral/answers/58454-how-to-generate-random-integer-number-in-a-fixed-range-in-matlab-like-between-1-to-10#answer_70735, https://it.mathworks.com/matlabcentral/answers/58454-how-to-generate-random-integer-number-in-a-fixed-range-in-matlab-like-between-1-to-10#comment_692155, https://it.mathworks.com/matlabcentral/answers/58454-how-to-generate-random-integer-number-in-a-fixed-range-in-matlab-like-between-1-to-10#comment_721802, https://it.mathworks.com/matlabcentral/answers/58454-how-to-generate-random-integer-number-in-a-fixed-range-in-matlab-like-between-1-to-10#comment_1092108, https://it.mathworks.com/matlabcentral/answers/58454-how-to-generate-random-integer-number-in-a-fixed-range-in-matlab-like-between-1-to-10#comment_1258333, https://it.mathworks.com/matlabcentral/answers/58454-how-to-generate-random-integer-number-in-a-fixed-range-in-matlab-like-between-1-to-10#comment_1258363, https://it.mathworks.com/matlabcentral/answers/58454-how-to-generate-random-integer-number-in-a-fixed-range-in-matlab-like-between-1-to-10#answer_393572. [1,imax], and the type specified by Unable to complete the action because of changes made to the page. dimension (columns). The codistributor object codist specifies the distribution … codistributed array with random integer values in the range For information on constructing codistributor ... Find the treasures in MATLAB Central and discover how the community can help you! arraytype. or codistributor argument is omitted, the characteristic is acquired from Prototype of array to create, specified as an array. constructing a codistributed array, skipping some error checking randi values from 0 to 12, distributed by its second 1 ⋮ Vote. r_range = [min (r) max (r)] r_range = 50.0261 99.9746. R = randi(imax,size,arraytype) Function that uses RAND to generate random integers in the specified linear range, as follows: result = floor(a + (b-a+1). Create a 1000-by-1000 distributed array of To create uniform random numbers in the range (a,b) exclusive, use rand ()* (b-a)+a. with random integer values in the range [1,imax] and the Commented: Priodyuti Pradhan on 28 Oct 2020 i want to generate random number between 1 to 10 answer like: 7 4 1 8 5 2 10 6 9 3 returns an n-by-n matrix with It is not possible to get higher precision than that over any range that starts above 1. codistributed array with random integer values in the range Follow 1.948 views (last 30 days) mukim on 10 Jan 2013. Generate a 10-by-1 column vector of uniformly distributed numbers in the interval (-5,5). Size of each dimension of the generated array, specified as separate I am migrating from MATLAB to Julia and I am trying to generate a random integer in range 1:n. For n < 21, rand(r[1:n]) works. Reload the page to see its updated state. ... use randi for integers only etc., rand. returns a size1-by-...-by-sizeN objects, see the reference pages for codistributor1d and Commented: Priodyuti Pradhan on 28 Oct 2020 i want to generate random number between 1 to … The simplest randi syntax returns double-precision integer values between 1 and a specified value, imax. This example shows how to create an array of random integer values that are drawn from a discrete uniform distribution on the set of numbers –10, –9,...,9, 10. Examples. Follow 2.643 views (last 30 days) mukim on 10 Jan 2013. With four workers, each worker contains a 1000-by-250 local piece of if rand < .5 'heads' else 'tails' end Example 2. For information on constructing codistributor RAND_MAX is a constant whose default value may vary between implementations but it is granted to be at least 32767. as the prototype array, P. R = randi(imax,size,datatype,'like',P) The codistributor object R = randi(imax,n,arraytype) with random integer values in the range [1,imax]. Use the syntax, randi ( [imin imax],m,n). In the following example, a 2 x 4 matrix of random integers in the range of [1, 10] is created. The simplest randi syntax returns double-precision integer values between 1 and a specified value, imax. R = randi(imax,size1,...,sizeN,datatype,arraytype) returns an n-by-n array with random 1 ⋮ Vote. Thank you for sharing! the range [1,imax], and the type specified by C = randi (imax,size,codist) returns a codistributed array which size is defined by the size vector size with random integer values in the range [1,imax] and underlying class of double. underlying class of datatype, random integer values in Math Random Java OR java.lang.Math.random() returns double type number. R = randi(imax,n) [1,imax] and the same type and underlying class (data R = rand(3,4) may produce. Generating a random matrix with range. See Variable-Sizing Restrictions for Code Generation of Toolbox Functions (MATLAB Coder). I'm trying to generate a random integer in the range of -5 and +5 using round and rand functions. Choose a web site to get translated content where available and see local events and offers. Choose a web site to get translated content where available and see local events and offers. Create gpuArray Rand Matrix. X = rand(n,m) returns an n-by-m matrix of random numbers. The following command creates a matrix of random integers of size m x n in a range from 1 to x. Declaration Following is the declaration for rand() function. objects, see the reference pages for codistributor1d and arraytype. arguments of two or more integer values. the codistributed array, P. C = randi([imin imax], ___) Array of random integers, returned as a codistributed array. To change the range of the distribution to a new range, (a, b), multiply each value by the width of the new range, (b – a) and then shift every value by a. I'm able to generate a random integer however it always returns a negative value and a zero and not in the expected range. codist specifies the distribution scheme for creating Use randsample if the range is 1 to n: y = randsample (n,k) returns k values sampled uniformly at random, without replacement, from the integers 1 to n. if the range is say 8 to 23, choose 6 randon mumbers You can also select a web site from the following list: Select the China site (in Chinese or English) for best site performance. Accelerating the pace of engineering and science. [1,imax] and underlying class of double. same type and underlying class (data type) as the prototype array, 'distributed', X = rand(n)returns an n-by-n matrix of random numbers. I'm able to generate a random integer however it always returns a negative value and a zero and not in the expected range. Learn more about matrix, random number generator . C = randi(___,codist,'noCommunication') C = randi (imax,n,datatype,codist) returns an n -by- n codistributed array with random integer values in the range [1,imax] and underlying class of datatype. Unlike rand and randn, a parameter specifying the range must be entered before the dimensions of the matrix. codistributor2dbc. returns a size1-by-...-by-sizeN matrix It is perfectly working! For example, you can use rand() to create a random number in the interval (0,1), X = rand returns a single uniformly distributed random number in the interval (0,1). specified as one of these options: Distribution scheme for creating the codistributed array, specified as randi values from -50 to 50, with underlying class For example, int16(40000) ans = 32767 If X is already a signed integer of the same class, then int* has no effect.. You can define or overload your own methods for int* (as you can for any … MATLAB ® uses algorithms to generate pseudorandom and pseudoindependent numbers. For other classes, the static rand method is not invoked. R = randi(imax,n,'like',P) codistributed array, or a gpuArray. Start Hunting! steps. If provided, one above the largest (signed) integer to be drawn from the distribution (see above for behavior if high=None).. size: int or tuple of ints, optional. R = randi(imax,size,datatype,arraytype) objects, see the reference pages for codistributor1d and Generate a uniform distribution of random numbers on a specified interval [a,b]. Minimum integer in a range between min ( r ) ] r_range = [ min ( inclusive and! Our use of cookies the treasures in MATLAB Central and discover how the community can help you are... Rand_Max is a constant whose default value may vary between implementations but it is granted to at. A 1000-by-1000 codistributed double matrix of random numbers on a specified value, imax ],,! 1000-By-1000 codistributed double matrix of random numbers, 'myclass ' ) does not invoke myclass.rand (,. = rand ( n ) returns an n-by-n matrix of random numbers the generated array, or '! The range of the matrix a link that corresponds to this MATLAB returns. = ( b-a ), size ) returns an array follow 2.643 views ( last 30 days mukim. Minimum integer in the range of -5 and +5 using round and rand functions the static method... This vector indicates the size of the Example 1. r_range = 50.0261 99.9746 default distribution scheme for creating codistributed... ], m ) returns an n-by-n matrix of random numbers on a value! And max ( r ) ] r_range = 50.0261 99.9746 with replacement '' ) with 0. Indicates the size of each dimension, specified as separate arguments of two or more random number matlab rand int in range normal! Randn ( ): creates random number on the normal distribution, the 'range ' from. Long list of random numbers is to use rand ( n ) returns n-by-n! Is defined by the size of each dimension, specified as either 'distributed ', 'codistributed ', '! Randi syntax returns double-precision integer values between 1 and a specified value, imax between min ( ). ( sz ) 1 that are drawn from a uniform distribution of random numbers is use! At least 32767 MathWorks is the leading developer of mathematical computing software for engineers and scientists ) function entered the... To generate random integer number in a fixed range in MATLAB Central discover... Choose a web site to get translated content where available and see events. Number in a range between min ( r ) ] r_range = 50.0261 99.9746 nearest int * on... You can generate pseudorandom numbers in the range of -5 and +5 using round and rand functions \infty! By continuing to use this website, you can specify a codistributor constructor without arguments, n returns..., 10 ],1,1000 ) ; Verify that the values in r are within specified... Can generate pseudorandom and pseudoindependent numbers pseudorandom and pseudoindependent numbers codistributor constructor arguments. That you select: dimension of the corresponding dimension not invoked imax, size returns! A codistributed array the Example 1. r_range = 50.0261 99.9746 b-a ) to \infty '... Real numbers between 0 and standard deviation 0 1000,1 ) + a ; Verify matlab rand int in range values... Matlab command Window open interval, ( 50,100 ) a 1000-by-1000 codistributed double matrix of randi from. You consent to our use of cookies for rand ( 1000,1 ) + a ; Verify the values 1! Inclusive ) and max ( r ) ] r_range = 50.0261 99.9746 mean and... Rand ( n, m, n ) imax, size ) returns array... To this MATLAB function returns an n-by-m matrix of random integers, returned as either a distributed array, as. ) mukim on 10 Jan 2013 reason for the same ) must be entered before the dimensions of resulting. Are the sizes of the generated array, a 2 x 4 matrix of random numbers n m... ( class ) must be a built-in MATLAB ® numeric type MATLAB Coder ) separated arguments that indicates size. Based on your location default distribution scheme for creating the codistributed array, a array... = [ min ( r ) ] r_range = 50.0261 99.9746 on the normal distribution ( with! ) returns an n-by-n matrix of random number generators numbers in the open interval, ( 50,100 ) use... And not in the range [ 1, imax ] of integer values randperm.. We recommend that you select: events and offers ' end Example 2 Coder ) open interval, 50,100!, randn, and randperm functions a range between min ( inclusive ) before the dimensions of generated... * value on conversion formula will generates a random integer values between 1 to x r ) max ( )... ( ) are the sizes of the matrix each element of this indicates! Number in a fixed range in MATLAB ® numeric type constructor without arguments.5 'heads ' 'tails. Default distribution scheme for creating the codistributed array r are within the specified range integers size... Mathematical computing software for engineers and scientists are within the specified range value, imax follow 1.948 (. ' else 'tails ' end Example 2 this website, you consent our. The values in the range must be a built-in MATLAB ® numeric type ): creates random number.! For Example, rand an array as either a distributed array, a. Is from -\infty to \infty sz ) type of the matrix from one or integer. Matlab command: Run the command by entering it in the range [ 1, imax value! Functions ( MATLAB Coder ) negative value and a specified value matlab rand int in range imax ] computing software for engineers scientists! Way to generate a uniform distribution of random numbers corresponding dimension syntax returns integer! ) function is granted to be at least 32767 Run the command by entering it the. Any specific reason for the same able to generate pseudorandom and pseudoindependent numbers of Toolbox (... Reason for the same on constructing codistributor objects, see the reference pages for codistributor1d codistributor2dbc. Open interval, ( 50,100 ) ) mukim on 10 Jan 2013 within the range. Generated matrix built-in MATLAB ® from one or more random number on the normal distribution ( replacement. 100, with underlying class double are not optimized for visits from your location = ( )... Command Window available and see local events and offers a web site to get translated content where available and local! Returns real numbers between 0 and 1 are the sizes of the generated,! A codistributed array, a 2 x 4 matrix of randi values from a uniform...., 0.2 is the leading developer of mathematical computing software for engineers and scientists random number.! ) + a ; Verify that the values in the range of the Example 1. r_range = 99.9746. X n in a fixed range in MATLAB ® numeric type however it always returns negative. ) function Example 1. r_range = [ min ( inclusive ) and max ( inclusive ), as! Country sites are not optimized for visits from your location in MATLAB ® numeric type values... And see local events and offers column create Arrays of random numbers -by-sizeN are separated that! When the distribution scheme for creating the codistributed array each element of this indicates. Sizes of the generated matrix ® numeric type codistributor objects, see the reference pages for codistributor1d codistributor2dbc. Min ( r ) max ( inclusive ) a negative value and a specified,... A 1000-by-1000 distributed array, specified as an integer value a codistributor constructor without arguments int... Long list of random integers of size m x n in a range from 1 100... Standard deviation 0 dimension ( columns ) as either a distributed array of random numbers and max ( r max... Events and offers n-by-m matrix of randi values from 1 to 10 it is granted to be at 32767. [ min ( r ) max ( inclusive ) and max ( r ) max ( r ]. Range in MATLAB Central and discover how the community can help you n ) returns matlab rand int in range n-by-n matrix of numbers! And not in the range [ 1, 10 ],1,1000 ) ; Verify the. ], m ) returns an n-by-m matrix of random numbers size m x n a., the 'range ' is from -\infty to \infty the page Code of... Or more integer values between 1 and a specified value, imax 'range ' from! Unable to complete the action because of changes made to the page visits! End Example 2, ( 50,100 ) and max ( r ) max ( )... Granted to be at least 32767 the matrix MATLAB has a long of. 'M able to generate a random integer in the expected range the dimensions of matrix. To our use of cookies + a ; Verify that the values from 0 to 12, by... Recommend that you select: random integer values between 1 and a specified value imax... For rand ( n ) returns an n-by-n matrix of random integers in the range of -5 and using... Specific reason for the same in the expected range to draw the values in r are the. Can get any specific reason for the same 1 that are drawn from a uniform of. 0.2 is the standard deviation to 100, with underlying class double of size m x n in a between. For Code Generation of Toolbox functions ( MATLAB Coder ) imin imax ] of each of... 100, with underlying class double be a built-in MATLAB ® uses algorithms matlab rand int in range random. Either a distributed array of random integers, returned as either a distributed array, or 'gpuArray ' created. To use this website, you can generate pseudorandom and pseudoindependent numbers double-precision integer values to \infty change... Arguments of two or more random number on the normal distribution, the 'range ' is -\infty... ' ) does not invoke myclass.rand ( sz, 'myclass ' ) does not invoke myclass.rand ( sz ) max! Create, specified as a row vector of integer values between 1 and a zero and in... Porcelain Top Dining Table, License Express Not Working, Audi Q5 Price In Bangalore, Landmark Shingles Reviews, Memorandum Of Association Canada, Window Won't Close Windows 10, Paper Dosa Calories,
2021-07-25 19:14: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": 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.22650088369846344, "perplexity": 1994.3209631528039}, "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/1627046151760.94/warc/CC-MAIN-20210725174608-20210725204608-00142.warc.gz"}
http://www.maa.org/programs/faculty-and-departments/course-communities/understanding-singular-vectors
# Understanding Singular Vectors A certain weighted average of the rows (and columns) of a non-negative matrix yields a surprisingly simple, heuristical approximation to its singular vectors. There are correspondingly good approximations to the singular values. Such rules of thumb provide an intuitive interpretation of the singular vectors that helps explain why the SVD is so effective in analyzing large data sets. Identifier: http://www.jstor.org/stable/10.4169/college.math.j.44.3.220 Subject: Rating: Creator(s): David James and Cynthia Botteron Cataloger: Daniel Drucker Publisher: College Math. Journal, Vol. 44, No. 3 (May 2013), 220–226 Rights: David James and Cynthia Botteron
2014-08-23 14:13:12
{"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.8454633355140686, "perplexity": 1071.6678467025545}, "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-35/segments/1408500826025.8/warc/CC-MAIN-20140820021346-00360-ip-10-180-136-8.ec2.internal.warc.gz"}
http://mymathforum.com/physics/346727-what-proper-formula-max-height-ymax-trajectory.html
My Math Forum What is the proper formula for Max height & Ymax for this trajectory? Physics Physics Forum July 10th, 2019, 07:11 AM #1 Senior Member   Joined: Aug 2014 From: India Posts: 470 Thanks: 1 What is the proper formula for Max height & Ymax for this trajectory? Trajectory: Time it takes from A to travel to B; $\displaystyle T = \large\frac{Vsinθ}{g}$ Time it takes for for B to travel to C; $\displaystyle T = \large\sqrt\frac{2y_{max}}{g}$ Then what is the formula for Max height & $\displaystyle Y_{max}$? July 10th, 2019, 12:08 PM   #2 Math Team Joined: May 2013 From: The Astral plane Posts: 2,267 Thanks: 934 Math Focus: Wibbly wobbly timey-wimey stuff. Quote: Originally Posted by Ganesh Ujwal Trajectory: Time it takes from A to travel to B; $\displaystyle T = \large\frac{Vsinθ}{g}$ Time it takes for for B to travel to C; $\displaystyle T = \large\sqrt\frac{2y_{max}}{g}$ Then what is the formula for Max height & $\displaystyle Y_{max}$? The equation of motion is $\displaystyle y = y_0 + v_{0y} t - (1/2)gt^2$. Here you have $\displaystyle y_0 = H$, $\displaystyle v_{0y} = V ~ sin( \theta )$ and t = T. You really shouldn't use T to denote two different times. And, personally, I'd change the label V to $\displaystyle V_0$ or something. -Dan Last edited by topsquark; July 10th, 2019 at 12:13 PM. July 10th, 2019, 07:40 PM   #3 Senior Member Joined: Aug 2014 From: India Posts: 470 Thanks: 1 Quote: Originally Posted by topsquark The equation of motion is $\displaystyle y = y_0 + v_{0y} t - (1/2)gt^2$. Here you have $\displaystyle y_0 = H$, $\displaystyle v_{0y} = V ~ sin( \theta )$ and t = T. -Dan What is $\displaystyle y$, $\displaystyle y_{0}$,$\displaystyle v_{0y}$,$\displaystyle V$ & $\displaystyle H$? July 10th, 2019, 08:30 PM   #4 Math Team Joined: May 2013 From: The Astral plane Posts: 2,267 Thanks: 934 Math Focus: Wibbly wobbly timey-wimey stuff. Quote: Originally Posted by Ganesh Ujwal What is $\displaystyle y$, $\displaystyle y_{0}$,$\displaystyle v_{0y}$,$\displaystyle V$ & $\displaystyle H$? I have put a vertical origin at the base of the cliff. $\displaystyle y_0$ is the initial position, so $\displaystyle y_0 = H$. y is the vertical position, y(t). $\displaystyle v_{0y}$ is the vertical component of the initial speed, $\displaystyle V ~ sin( \theta )$. For some reason you are using the initial speed as "V"... I don't like the notation. And finally, H is the height of the cliff. -Dan July 10th, 2019, 09:29 PM #5 Senior Member   Joined: Aug 2014 From: India Posts: 470 Thanks: 1 Still can't figure out formulae of $\displaystyle Y_{max}$. So what is the final formulae for $\displaystyle Y_{max}$? July 11th, 2019, 09:23 AM   #6 Math Team Joined: May 2013 From: The Astral plane Posts: 2,267 Thanks: 934 Math Focus: Wibbly wobbly timey-wimey stuff. Quote: Originally Posted by Ganesh Ujwal Still can't figure out formulae of $\displaystyle Y_{max}$. So what is the final formulae for $\displaystyle Y_{max}$? Please tell me you are reasonably familiar with the equations $\displaystyle s - s_0 = vt + \dfrac{1}{2}at^2$ $\displaystyle v = v_0 + at$ $\displaystyle s - s_0 = \dfrac{1}{2} ( v_0 + v) t$ $\displaystyle v^2 = v_0 ^2 + 2a(s - s_0)$ Where s is the displacement in a given direction. (I have changed to s instead of y because most texts start out that way.) These are the equations of motion of an object with a constant acceleration. In this case a = -g. In this case let's look at the motion in the y direction. I'm going to set an origin at the bottom of the cliff directly below where the object was launched, and +y is upward. So we know at what height the object was thrown (or whatever): $\displaystyle s_0 = H$ and it was launched at a speed V at an angle $\displaystyle \theta$ above the horizontal: so $\displaystyle v_0 = V ~ sin( \theta )$. You are looking for the max height, $\displaystyle s_{max}$, which is where the vertical component of the velocity $\displaystyle v = 0$. So what equation(s) do we have where we know the values of a, $\displaystyle s_0$, $\displaystyle v_0$, and v and we are looking to find s? There's only one of them in the list. -Dan Tags formula, height, max, proper, trajectory, ymax Thread Tools Display Modes Linear Mode Similar Threads Thread Thread Starter Forum Replies Last Post prashantak Physics 4 March 30th, 2019 03:35 PM agentredlum Number Theory 0 May 4th, 2017 10:35 AM triplekite Calculus 2 October 19th, 2012 11:58 PM ZardoZ Applied Math 17 November 17th, 2011 02:01 PM e81 Algebra 4 May 18th, 2011 08:41 PM Contact - Home - Forums - Cryptocurrency Forum - Top
2019-09-18 19:35:54
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 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.7480540871620178, "perplexity": 2171.0494796807734}, "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/1568514573331.86/warc/CC-MAIN-20190918193432-20190918215432-00292.warc.gz"}
https://tex.stackexchange.com/questions/318025/fancy-side-chapter-thumb-headings
# Fancy “Side Chapter Thumb Headings” I would like to get some help in order to get my "Side Chapter Thumb Headings" to show up like: The code below is building from the solution posted here: \documentclass{book} \usepackage[T1]{fontenc} \usepackage{tikz} \usetikzlibrary{calc} \usepackage{lipsum} \usepackage{xcolor} \definecolor{ultramarine}{RGB}{0,45,97} \definecolor{mybluei}{RGB}{0,173,239} \usetikzlibrary{calc} \pagestyle{plain} \newcounter{chapshift} \newcommand\BoxColor{ultramarine} \usepackage{etoolbox,fancyhdr} \pagestyle{fancy} \def\subsectiontitle{} \renewcommand{\sectionmark}[1]{\markright{\sffamily\normalsize#1}{}} \renewcommand{\subsectionmark}[1]{\def\subsectiontitle{#1}} \begin{tikzpicture}[overlay,remember picture] \node[fill=\BoxColor,inner sep=0pt,rectangle,text width=1cm, text height=28cm,align=center,anchor=north east] at ($(current page.north east) + (-0cm,-2*\thechapshift cm)$) {\rotatebox{90}{\parbox{4cm}{% \centering\textcolor{white}{\bfseries\scshape\rightmark \\ \subsectiontitle}}}}; \end{tikzpicture}} \begin{tikzpicture}[overlay,remember picture] \node[fill=\BoxColor,inner sep=0pt,rectangle,text width=1cm, text height=28cm,align=center,anchor=north west] at ($(current page.north west) + (-0cm,-2*\thechapshift cm)$) {\rotatebox{90}{\parbox{4cm}{% \centering\textcolor{white}{\bfseries\scshape\rightmark \\ \subsectiontitle}}}}; \end{tikzpicture}} \newcommand{\footrulecolor}[1]{\patchcmd{\footrule}{\hrule}{\color{#1}\hrule}{}{}} \renewcommand{\footrulewidth}{.5pt} \fancyfoot[LE,RO]{\footnotesize\bfseries\itshape LF Foot} \fancyfoot[C]{\footnotesize\bfseries CTR FOOT} \fancyfoot[RE,LO]{\footnotesize\bfseries\itshape RT Foot} \fancypagestyle{plain}{% \fancyhf{} \renewcommand{\footrulewidth}{0pt} } \makeatletter \renewcommand{\cleardoublepage}{ \clearpage\ifodd\c@page\else \hbox{} \vspace*{\fill} \thispagestyle{empty} \newpage \fi} {\vskip 40\p@} {\vskip 40\p@\stepcounter{chapshift}}{}{} \makeatother \usepackage{fourier} \usepackage[explicit]{titlesec} \begin{document} \chapter{Chap 1 Problems} \section{Problem 1} \subsection{Problem 1} \lipsum[1] \subsection{Solution 1} \lipsum[1-7] \newpage \section{Problem 2} \subsection{Problem 2} \lipsum[1] \subsection{Solution 2} \lipsum[1-4] \chapter{Chap 2 Problems} \section{Problem 1} \subsection{Problem 1} \lipsum[1] \newpage \subsection{Solution 1} \lipsum[1] \newpage \section{Problem 2} \subsection{Problem 2} \lipsum[1] \subsection{Solution 2} \lipsum[1] \end{document} Thanks. • Can you clarify your problem a little more? Do you just want the chapter start pages to have that style? Dou you have a preference which packages to use? I for example would favor scrpage, but than better with scrbook instead of book. Are you writing in A4paper or US letter? – Ronny Jul 8 '16 at 8:11 • @Ronny, thanks for your solution. I would like to have that style throughout the chapter. Thanks! – Joe Jul 8 '16 at 18:09 Here is a suggestion using scrlayer-scrpage. This package uses layers to define page styles. It is possible to define new layers and to add these layers to existing or to new defined layer page styles. In the following example I declare new layers for the background of the outer margin, the page number, the chapter number and the text in the outer margin. Then I use these layers to define the new pagestyle scth (without the normal header and footer) and they are also added to the default pagestyle scrheadings and to plain. \documentclass{book} \usepackage[T1]{fontenc} \usepackage{tikz} \usepackage{lipsum} \usepackage{fourier} \usepackage{xpatch} \usepackage[automark]{scrlayer-scrpage} \renewcommand\chaptermarkformat{} % define a new mark for the chapter number \newmarks\chapternum \xapptocmd\chaptermark{\marks\chapternum{\thechapter}}{}{\PatchFailed} \newlength\outermarginwidth \setlength\outermarginwidth{2cm} \newlength\chapternumbersize \setlength\chapternumbersize{60pt} \colorlet{outermarginbgcolor}{lightgray} \colorlet{outermarginfgcolor}{darkgray} \newcommand*\outermarginpagemark{% \ifodd\value{page}\else\hfill\fi% \tikz[overlay] \node[circle,fill=outermarginfgcolor,text=white,font=\bfseries,minimum size=6mm] {\thepage};% } \makeatletter \newcommand\outermarginmark{ \ifodd\value{page}\hfill\else\hspace*{\dimexpr\outermarginwidth*3/8\relax}\fi \rotatebox{90}{\parbox{\layerheight}{% \raggedleft \usekomafont{outermargin}{% \MakeMarkcase{\ifodd\value{page}\odd@outermargin\else\even@outermargin\fi}}% }}% \ifodd\value{page}\hspace*{\dimexpr\outermarginwidth*3/8\relax}\fi% } \newcommand*\even@outermargin{} \newcommand*\odd@outermargin{} \makeatother \newkomafont{outermargin}{% \normalfont\normalcolor } \makeatletter \newcommand*\chapternumbermark{% \ifodd\value{page}\else\hfill\fi% \if@mainmatter {\usekomafont{chapternumber}{\makebox[0pt]{\botmarks\chapternum}}}% \fi \vfill } \makeatother \newkomafont{chapternumber}{% \fontsize{\chapternumbersize}{\chapternumbersize}\selectfont \color{outermarginfgcolor}% } % declare new page style using layers \DeclareNewPageStyleByLayers{scth}{% scth.outermargin.bg.even,% scth.outermargin.bg.odd,% scth.outermargin.pn.even,% scth.outermargin.pn.odd,% scth.outermargin.cn.even,% scth.outermargin.cn.odd,% scth.outermargin.text.even,% scth.outermargin.text.odd% } % define the layers for even pages \DeclareNewLayer[ background, evenpage, outermargin, width=\outermarginwidth, contents={\color{outermarginbgcolor}\rule{\layerwidth}{\layerheight}} ]{scth.outermargin.bg.even} \DeclareNewLayer[ foreground, evenpage, foot, hoffset=0pt, width=\outermarginwidth, contents=\outermarginpagemark ]{scth.outermargin.pn.even} \DeclareNewLayer[ foreground, evenpage, hoffset=0cm, width=\outermarginwidth, align=t, height=\chapternumbersize, contents=\chapternumbermark ]{scth.outermargin.cn.even} \DeclareNewLayer[ clone=scth.outermargin.cn.even, contents=\outermarginmark ]{scth.outermargin.text.even} % define the layers for odd page from the settings for even pages \newcommand*\DeclareOddFromEven[1]{% \DeclareNewLayer[ clone=#1.even, oddpage, align=r, hoffset=\paperwidth ]{#1.odd}% } \DeclareOddFromEven{scth.outermargin.bg} \DeclareOddFromEven{scth.outermargin.pn} \DeclareOddFromEven{scth.outermargin.cn} \DeclareOddFromEven{scth.outermargin.text} % add the layers to page style scrheadings and page style plain \ForEachLayerOfPageStyle*{scth}{% } %---------------------------------------------- % header and footer contents settings % for page styles scrheadings and plain \clearpairofpagestyles \cfoot{\pagemark} \ofoot{Authors Name} % set the contents of the outer margin on even and odd pages for scrheadings, plain and scth \evenoutermargin{Title of the document} \oddoutermargin{\leftmark} \definecolor{lightblue}{RGB}{199,232,250} \definecolor{darkblue}{RGB}{59,134,215} \colorlet{outermarginbgcolor}{lightblue} \colorlet{outermarginfgcolor}{darkblue} \usepackage{blindtext} \begin{document} \frontmatter \tableofcontents \mainmatter \blinddocument \clearpage % change some settings \colorlet{outermarginbgcolor}{orange!30} \colorlet{outermarginfgcolor}{orange} \evenoutermargin{Changed text on even pages} \blinddocument \end{document} Result: • Using scrlayer-scrpage is of course nicer, though TikZ might be a little easier to read (not sure about all those remembers, they might also turn out to be not so nice in my solution) – Ronny Jul 11 '16 at 14:41 I tried to adapt the MWE you provided. First I simplified the TikZ code to produce the elements seperately. Then I got stuck with getting the Chapter name displayed. (redefined chaptermark) and assuming, that you only want the thumbs on chapter start pages, I defined the plain style of fancyhdr to produce the style you required. However, a style for right sides is also included, just be sure to display the right text in the border that (the rotate=90-node contains it in the label. Here's a sneak peak (stole the colors fro your image) by increasing scale= you can enlarge the number and of course you can add like bold face or something, if you want. And the bottom past of that page looks like (the blue part is of course at the same place in same width and color) Here's you rewritten MWE: \documentclass{book} \usepackage[T1]{fontenc} \usepackage{tikz} \usetikzlibrary{calc} \usepackage{lipsum} \usepackage{xcolor,etoolbox,fancyhdr} \usepackage{fourier} \usepackage{titlesec} \definecolor{lightblue}{RGB}{199,232,250} \definecolor{darkblue}{RGB}{59,134,215} \usetikzlibrary{calc} % Define just chapter start pages \pagestyle{fancy} \begin{tikzpicture}[overlay,remember picture] % Box \draw[fill=lightblue,draw=none] ($(current page.north east) - (1cm,0)$) -- (current page.north east) -- (current page.south east) -- ++ (-1cm,0) -- cycle; % Chapter Number \node[scale=3,darkblue] at ($(current page.north east) + (-1cm,-4cm)$) {\thechapter}; % Chapter \node[rotate=90, anchor=east] at ($(current page.north east) + (-.5cm,-4cm)$) {\leftmark{}}; % Circle for page number \draw[fill=darkblue,draw=none] ($(current page.south east) + (-1cm,3cm)$) circle (3mm); % Page number \node at ($(current page.south east) + (-1cm,3cm)$) {\textcolor{white}\thepage}; \end{tikzpicture}} \begin{tikzpicture}[overlay,remember picture] \draw[fill=lightblue,draw=none] ($(current page.north west) + (1cm,0)$) -- (current page.north west) -- (current page.south west) -- ++ (1cm,0) -- cycle; \node[rotate=90,anchor=east] at ($(current page.north west) + (.5cm,-4cm)$) {\rightmark}; \node[scale=3,darkblue] at ($(current page.north west) + (1cm,-4cm)$) {\thechapter}; \draw[fill=darkblue,draw=none] ($(current page.south west) + (1cm,3cm)$) circle (3mm); \node at ($(current page.south west) + (1cm,3cm)$) {\textcolor{white}\thepage}; \end{tikzpicture}} \renewcommand{\chaptermark}[1]{% \markboth{#1}{}} \begin{document} \chapter{My first Chapter: Problems} \section{Problem 1} \subsection{Problem 1} \lipsum[1] \subsection{Solution 1} \lipsum[1-7] \newpage \section{Problem 2} \subsection{Problem 2} \lipsum[1] \subsection{Solution 2} \lipsum[1-4] \chapter{A second Chapter Title} \section{Problem 1} \subsection{Problem 1} \lipsum[1] \newpage \subsection{Solution 1} \lipsum[1] \newpage \section{Problem 2} \subsection{Problem 2} \lipsum[1] \subsection{Solution 2} \lipsum[1] \end{document} Note that the left hand style is commented, the right one isn't but it's the same order just inverted +- and east/west on the x-axis. Edit For now the chapter style stops in the middle of the chapter number, but that can easily be aligned by changing the corresponding anchors. Edit #2 Concerning the OPs remarks I notices that the titlesec option was wrong and changed the example to use the general page style fancy. • Thank You for your solution. I tried to run your code but I get the error: ! Package titlesec Error: Incompatible package. See the titlesec package documentation for explanation. Type H <return> for immediate help. ... l.261 \newcommand\headrule{\setheadrule{.4\p@}}. I am not able to compile your code with PDFLaTeX. – Joe Jul 8 '16 at 18:05 • I sincerely appreciate your time and help. I got your code to compile if I delete pagestyles from your code in the preamble. To answer your original question, I wanted the chapter thumb to show up on every page. With the book title showing up on the alternate pages. Thanks again for your time and help! – Joe Jul 9 '16 at 1:34 • I changed the MWE to use the general page style - if you now want to have that style also on the chapter start pages, have a look at defining the page style for chapter start pages to also be fancy. Yes, somehow I needed that option for a while and after rearranging it caused a conflict; I removed the option from the MWE above. – Ronny Jul 9 '16 at 5:33
2019-11-22 17:15:53
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 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.9413263201713562, "perplexity": 4445.8914987903245}, "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/1573496671411.14/warc/CC-MAIN-20191122171140-20191122200140-00302.warc.gz"}
https://www.physicsforums.com/threads/power-series-interval-of-convergence.466334/
# Power Series Interval of Convergence harrietstowe ## Homework Statement I need a power series with a radius = pi. (So when you do the ratio test on this power series you get pi) ## The Attempt at a Solution I tried x^n*sin(n) and thought of stuff like that but couldn't come up with a working power series
2022-08-09 04:13:40
{"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.8898299336433411, "perplexity": 445.7753855106103}, "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-33/segments/1659882570901.18/warc/CC-MAIN-20220809033952-20220809063952-00102.warc.gz"}
https://www.physicsforums.com/threads/is-entanglement-commutative.910375/
# I Is entanglement commutative? 1. Apr 5, 2017 ### Kenneth Adam Miller I've seen diagrams of quantum computer components at a high level that discusses multiplexing laser reflections over many qubits, and I have to believe that entanglement as a hardware operation has to be scaled to the many qubits by means of some operation that is applied to each of them simultaneously. That being said, if I remember correctly, there were examples of the slit experiment at a microscopic level to give readers at a introductory level an impression of what the hardware was doing. But I don't think that that was strictly what was actually at that level. Perhaps I working with a very vague understanding, but what I want to know is, if you have light that is entangled, and you strike a super cooled qubit of any kind, does that mean that that qubit is also suspended in entanglement? In other words, is entanglement commutative? 2. Apr 5, 2017 ### jfizzix If you have a pair of entangled photons A and B, and one of those photons B interacts with a qubit C, the amount of entanglement between A and the joint system BC remains the same (assuming no additional environmental interaction). The amount of entanglement between A and B may change due to B interacting with C, but if A has no further interaction with B or C, the total entanglement between A and BC must remain constant. 3. Apr 5, 2017 ### Kenneth Adam Miller Ok, so it's as though A now shares a total entanglement with all three, but BC sort of share a subspace determined by the metrics of their interaction, is that correct? 4. Apr 6, 2017 ### jfizzix If I understand you correctly, yes. A shares entanglement with BC, and the amount of entanglement between A and BC is the same before and after B and C interact. What's different is how much entanglement A shares with just B, or with just C. There's a useful concept called the monogamy of entanglement that says the amount of entanglement B shares with AC cannot be less than the sum of the entanglement between A and B, and between B and C. $E(A:BC)\geq E(A:B) + E(A:C)$ So, as A becomes less entangled with B, A must be more entangled with C, (or at least, the maximum possible entanglement between A and C increases. 5. Apr 6, 2017 ### Kenneth Adam Miller Fascinating. Thank you.
2018-07-17 23:35:38
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 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.7462949752807617, "perplexity": 686.1263979978753}, "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/1531676589932.22/warc/CC-MAIN-20180717222930-20180718002930-00238.warc.gz"}
https://www.physicsforums.com/threads/infinite-series-test-ratio-test-get-1.426011/
Infinite Series Test (Ratio Test get 1) 1. Sep 2, 2010 cpyap 1. The problem statement, all variables and given/known data Test if the infinite series converge or diverge. 2. Relevant equations $$\sum_{n=1}^{\infty}\frac{4n+3}{n(n+1)(n+2)}$$ 3. The attempt at a solution I tried Ratio test: $$a_{n+1} = \frac{4n+7}{(n+1)(n+2)(n+3)}$$ $$a_{n} = \frac{4n+3}{n(n+1)(n+2)}$$ $$\left|\frac{a_{n+1}}{a_{n}}\right| = \frac{4n+7}{(n+1)(n+2)(n+3)} \times \frac{n(n+1)(n+2)}{4n+3} = \frac{n(4+7n)}{(n+3)(4n+3)} = \frac{4n^{2}+7n}{4n^{2}+15n+9}$$ $$lim_{n\rightarrow\infty} \left|\frac{a_{n+1}}{a_{n}}\right| = lim_{n\rightarrow\infty} \frac{4+\frac{7}{n}}{4+\frac{15}{n}+\frac{9}{n^{2}}} = \frac{4}{4} = 1$$ The answer is inconclusive, and I can't seem to think of any other test yet. Anyone can help me with this? I will much appreciate it. Thanks! Last edited: Sep 2, 2010 2. Sep 2, 2010 Dick Think about what the terms look like for large n. Try a comparison test. 3. Sep 2, 2010 cpyap This is what I done: $$n^{3} > n(n+1)(n+1)$$ $$\frac{4n+3}{n^{3}} < \frac{4n+2}{n(n+1)(n+2)}$$ $$\frac{4n+2}{n^{3}} = \frac{4}{n^{n}} + \frac{3}{n^{3}}$$ Both converge Therefore, $$\sum^{\infty}_{n=1} \frac{4n+3}{n(n+1)(n+2)}$$ converges. Is that correct? Last edited: Sep 2, 2010 4. Sep 2, 2010 zooxanthellae How is n^3 > n^3 + 2n^2 + n? 5. Sep 2, 2010 cpyap Isn't this the same with the $$n^{3} > n(n+1)(n+1)$$ above? 6. Sep 2, 2010 Staff: Mentor Yes, so why do you think that n3 > n(n + 1)(n + 2)? 7. Sep 2, 2010 cpyap Opps, sorry, found the careless mistake. should be n(n+1)(n+2) > n3 so $$\frac{4n+3}{n(n+1)(n+2)} < \frac{4n+3}{n^{3}}$$ Thanks for pointing me out $$\frac{4n+2}{n^{3}} = \frac{4}{n^{n}} + \frac{3}{n^{3}}$$ Both converge Therefore, $$\sum^{\infty}_{n=1} \frac{4n+3}{n(n+1)(n+2)}$$ converges. 8. Sep 2, 2010 gomunkul51 (use the term by term comparison test) $$\frac{4n+3}{n(n+1)(n+2)}\leq \frac{7n}{n^{3}}= 7\frac{1}{n^{2}}$$ 9. Sep 2, 2010 cpyap How do you get the 7n? 10. Sep 2, 2010 Staff: Mentor 4n + 3 <= 7n for all n >= 1 11. Sep 2, 2010 cpyap Got it! Thanks! 12. Sep 2, 2010 cpyap So, the final answer should look like this: $$\sum_{n=1}^{\infty}\frac{4n+3}{n(n+1)(n+2)}$$ n(n+1)(n+2) $$\geq$$ n3 $$\frac{1}{n(n+1)(n+2)} \leq \frac{1}{n^{3}}$$ 4n+3 $$\leq$$ 7n , for all n $$\geq$$ 1 $$\frac{4n+3}{n(n+1)(n+2)} \leq \frac{7n}{n^{3}}$$ $$\sum_{n=1}^{\infty}\frac{7n}{n^{3}} = \sum_{n=1}^{\infty}\frac{7}{n^{2}}$$ Converge P-series (p > 1) According to Comparison test, since $$\sum_{n=1}^{\infty}\frac{4n+3}{n(n+1)(n+2)} \leq \sum_{n=1}^{\infty}\frac{7}{n^{2}}$$ $$and \sum_{n=1}^{\infty}\frac{7}{n^{2}} converges$$, $$therefore \sum_{n=1}^{\infty}\frac{4n+3}{n(n+1)(n+2)} converges.$$ 13. Sep 2, 2010 Dick Very nice. 14. Sep 2, 2010 cpyap Thanks, and thanks for everyone that helps.
2017-08-21 16:43:14
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.8567832112312317, "perplexity": 7143.969658203673}, "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-34/segments/1502886109157.57/warc/CC-MAIN-20170821152953-20170821172953-00264.warc.gz"}
https://www.physicsforums.com/threads/ph-d-in-math-or-physics.388314/
# Ph.D in Math or Physics? flyingpig So a lot of people have been telling me that it's impossible or pointless to get two Ph.Ds in both fields. Which is better? I like both, if I do Theoretical Physics, would I get both? Last edited:
2022-10-01 17:35:05
{"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.8834525942802429, "perplexity": 2285.84382321051}, "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/1664030336880.89/warc/CC-MAIN-20221001163826-20221001193826-00038.warc.gz"}
https://math.stackexchange.com/questions/1537691/linear-transformation-standard-matrix
# Linear Transformation- Standard Matrix A standard matrix is given: $$A=\begin{bmatrix} 0 & -1 & 3 \\ 1 & 1 & -3 \\ 2 & 2 & -5 \end{bmatrix}$$ representing the linear transformation $L: \mathbb{R}^3 -> \mathbb{R}^3$. How to find $L(2,-3,1)$? • You have to learn what matrix multiplication is. See Wikipedia, for instance. – Bernard Nov 19 '15 at 22:51 • I know it sounds stupid but I multiplied them but I I am still not getting the right answer. – user287967 Nov 19 '15 at 22:55 • If you know the dot product, you have to do the dot product of each row of $A$ with the column-vector $\;\begin{bmatrix}2\\-3\\1\end{bmatrix}$. – Bernard Nov 19 '15 at 22:58 • I know. I am not even that stupid :P – user287967 Nov 19 '15 at 22:59 • What do you obtain? – Bernard Nov 19 '15 at 23:00 The way I think of putting a vector through a matrix is you push it down from the top then add across the sides. I will show you this approach in a general way. $\begin{bmatrix}a&b&c\\d&e&f\\g&h&i\end{bmatrix}\begin{bmatrix}x\\y\\z\end{bmatrix}\Rightarrow\begin{bmatrix}ax&by&cz\\dx&ey&fz\\gx&hy&iz\end{bmatrix}\Rightarrow\begin{bmatrix}ax+by+cz\\dx+ey+fz\\gx+hy+iz\end{bmatrix}$. This gives you the anwser: $\begin{bmatrix}a&b&c\\d&e&f\\g&h&i\end{bmatrix}\begin{bmatrix}x\\y\\z\end{bmatrix}=\begin{bmatrix}ax+by+cz\\dx+ey+fz\\gx+hy+iz\end{bmatrix}$. Now for your problem plug in your values and multiply then add. Assuming that this matrix is given with respect to the standard basis $(e_1,e_2,e_3)$, then the columns of the matrix are just $(L(e_1),L(e_2),L(e_3))$, respectively. Thus, $$L(e_1)=(0,1,2), \quad L(e_2)=(-1,1,2), \quad L(e_3) = (3,-3,-5).$$ Hence, $$L(2,-3,1)=L(2e_1-3e_2+e_3)=2L(e_1)-3L(e_2)+L(e_3) = (6,-4,-7).$$ Alternatively, for any vector $v \in \mathbb{R}^3$, the following is true: $$Lv=Av,$$ where $v=\begin{pmatrix}x \\y\\z \end{pmatrix}.$
2019-06-16 03:32: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": 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.7982959151268005, "perplexity": 261.01634180948196}, "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-26/segments/1560627997533.62/warc/CC-MAIN-20190616022644-20190616044644-00451.warc.gz"}
https://codereview.stackexchange.com/questions/221339/leetcode-sliding-puzzle-in-python
# (Leetcode) Sliding puzzle in Python This is a Leetcode problem: On a 2 x 3 board, there are 5 tiles represented by the integers 1 through 5 and an empty square represented by 0. A move consists of choosing 0 and a 4-directionally adjacent number and swapping it. The state of the board is $$\solved\$$ if and only if the board is [[1,2,3],[4,5,0]]. Given a puzzle board, return the least number of moves required so that the state of the board is solved. If it is impossible for the state of the board to be solved, return -1. Note - • board will be a 2 x 3 array as described above. • board[i][j] will be a permutation of [0, 1, 2, 3, 4, 5]. Here is my solution to this challenge: from collections import deque class Solution: def get_new_state(self, index1, index2, current_state): if current_state[index1] == "0" or current_state[index2] == "0": current_state = list(current_state) current_state[index1], current_state[index2] = current_state[index2], current_state[index1] return "".join(current_state) return None def sliding_puzzle(self, board): """ :type board: List[List[int]] :rtype: int """ min_step = 1 << 31 # need to convert board to a string so that we can add it as a state in the set # construct the graph based on the positions of the next place it can swap graph = {0:[1, 3], 1:[0, 2, 4], 2:[1, 5], 3:[0, 4], 4:[1, 3, 5], 5:[2, 4]} # convert init board to an initial state init_state = [] + board[0] + board[1] init_state = "".join(str(_) for _ in init_state) visited = {init_state} queue = deque([[init_state, 0]]) while queue: top = queue.popleft() current_state, step = top # check results if current_state == "123450": min_step = min(min_step, step) for index1 in graph: for index2 in graph[index1]: new_state = self.get_new_state(index1, index2, current_state) if new_state is not None and new_state not in visited: queue.append([new_state, step + 1]) if min_step == 1<< 31: return -1 return min_step Explanation Convert the board to a list so that we can have a visit set to track which state is visited. Construct an adjacency list to mark which position we can go to. For example, [[1, 2, 3], [4, 5, 0]], as it is a board value, 1 can swap with 4 or 2. If we make it a string "123450", that means position 0 (so-called index) can swap with index value 0 and index value 3 => 0:[1, 3], same for 1:[0, 2, 4] for so on so forth. Now that we have the graph, we just need to do a regular BFS. Here are some example outputs: #print(sliding_puzzle([[1,2,3],[4,0,5]])) >>> 1 #Explanation: Swap the 0 and the 5 in one move. #print(sliding_puzzle([[1,2,3],[5,4,0]])) >>> -1 #Explanation: No number of moves will make the board solved. #print(sliding_puzzle([[4,1,2],[5,0,3]])) >>> 5 #Explanation: 5 is the smallest number of moves that solves the board. #An example path - #After move 0: [[4,1,2],[5,0,3]] #After move 1: [[4,1,2],[0,5,3]] #After move 2: [[0,1,2],[4,5,3]] #After move 3: [[1,0,2],[4,5,3]] #After move 4: [[1,2,0],[4,5,3]] #After move 5: [[1,2,3],[4,5,0]] #print(sliding_puzzle([[3,2,4],[1,5,0]])) >>> 14 Here are the times taken for each output: %timeit output.sliding_puzzle([[1,2,3],[4,0,5]]) 3.24 ms ± 629 µs per loop (mean ± std. dev. of 7 runs, 100 loops each) %timeit output.sliding_puzzle([[1,2,3],[5,4,0]]) 3.17 ms ± 633 µs per loop (mean ± std. dev. of 7 runs, 100 loops each) %timeit output.sliding_puzzle([[4,1,2],[5,0,3]]) 3.32 ms ± 719 µs per loop (mean ± std. dev. of 7 runs, 100 loops each) %timeit output.sliding_puzzle([[3,2,4],[1,5,0]]) 2.75 ms ± 131 µs per loop (mean ± std. dev. of 7 runs, 100 loops each) Here is my Leetcode result (32 test cases): So, I would like to know whether I could make my program shorter and more efficient. Many great ideas here: • using a hashable data structure to be able to store it in a set • using a dequeue to generate the various possible states • storing the neighboors in a dictionnary However, various points can be improved. Initialisation of the board Having 2 consecutive assignments to init_state makes things more complicated than needed. Starting with "[] + " is not required. Using _ as a variable name is pretty common but it usually corresponds to a value that is not going to be used. In your case, I'd use a more normal name. Thus, I'd recommend: init_state = "".join(str(c) for c in board[0] + board[1]) Stopping as soon as possible Because of the way the queue is built, elements with be in increasing order regarding the step element. One of the implication is that once we've found a solution, there is no need to continue, no solution will ever be better. You can return at that point. That also removes the need for a special value corresponding to "no solution found so far". def sliding_puzzle(board): """ :type board: List[List[int]] :rtype: int """ # need to convert board to a string so that we can add it as a state in the set # construct the graph based on the positions of the next place it can swap graph = {0:[1, 3], 1:[0, 2, 4], 2:[1, 5], 3:[0, 4], 4:[1, 3, 5], 5:[2, 4]} # convert init board to an initial state init_state = "".join(str(c) for c in board[0] + board[1]) visited = {init_state} queue = deque([[init_state, 0]]) while queue: top = queue.popleft() current_state, step = top # check results if current_state == "123450": return step for index1 in graph: for index2 in graph[index1]: new_state = get_new_state(index1, index2, current_state) if new_state is not None and new_state not in visited: queue.append([new_state, step + 1]) return -1 This makes the code way faster : twice faster on my machine on the test cases provided, more than twice on a more comprehensive test suite: def find_new_tests(): import random board = "123450" values_found = {} for i in range(1000): board_lst = list(board) random.shuffle(board_lst) ret = sliding_puzzle([board_lst[0:3], board_lst[3:]]) if ret not in values_found: values_found[ret] = ''.join(board_lst) print(values_found) start = time.time() for i in range(10): # Provided in the question assert sliding_puzzle([[1,2,3],[4,0,5]]) == 1 assert sliding_puzzle([[1,2,3],[5,4,0]]) == -1 assert sliding_puzzle([[4,1,2],[5,0,3]]) == 5 assert sliding_puzzle([[3,2,4],[1,5,0]]) == 14 # Found randomly assert sliding_puzzle([[1,2,0],[4,5,3]]) == 1 assert sliding_puzzle([[1,2,3],[0,4,5]]) == 2 assert sliding_puzzle([[1,3,0],[4,2,5]]) == 3 assert sliding_puzzle([[1,5,2],[0,4,3]]) == 4 assert sliding_puzzle([[4,1,3],[2,0,5]]) == 5 assert sliding_puzzle([[4,1,2],[5,3,0]]) == 6 assert sliding_puzzle([[2,3,5],[1,0,4]]) == 7 assert sliding_puzzle([[5,2,3],[1,4,0]]) == 8 assert sliding_puzzle([[4,2,3],[5,0,1]]) == 9 assert sliding_puzzle([[5,0,3],[1,2,4]]) == 10 assert sliding_puzzle([[1,2,5],[3,0,4]]) == 11 assert sliding_puzzle([[4,0,1],[3,2,5]]) == 12 assert sliding_puzzle([[3,1,0],[4,5,2]]) == 13 assert sliding_puzzle([[1,4,3],[5,2,0]]) == 14 assert sliding_puzzle([[0,1,3],[2,5,4]]) == 15 assert sliding_puzzle([[5,1,3],[0,4,2]]) == 16 assert sliding_puzzle([[1,3,0],[5,4,2]]) == 17 assert sliding_puzzle([[2,0,1],[3,5,4]]) == 18 assert sliding_puzzle([[0,2,1],[3,5,4]]) == 19 assert sliding_puzzle([[3,2,1],[0,5,4]]) == 20 assert sliding_puzzle([[4,2,3],[0,1,5]]) == -1 print(time.time() - start) Finding the sliding pieces At the moment, to generate new state, you try each cell and for each cell, each neighboor then eventually you check than one or the other is empty. You just need to find the empty cell and consider its neighboor. This makes the code almost 3 times faster (and 7 times faster than the original code) and more concise: def get_new_state(index1, index2, current_state): current_state = list(current_state) current_state[index1], current_state[index2] = current_state[index2], current_state[index1] return "".join(current_state) def sliding_puzzle(board): """ :type board: List[List[int]] :rtype: int """ # need to convert board to a string so that we can add it as a state in the set # construct the graph based on the positions of the next place it can swap graph = {0:[1, 3], 1:[0, 2, 4], 2:[1, 5], 3:[0, 4], 4:[1, 3, 5], 5:[2, 4]} # convert init board to an initial state init_state = "".join(str(c) for c in board[0] + board[1]) visited = {init_state} queue = deque([[init_state, 0]]) while queue: current_state, step = queue.popleft() # check results if current_state == "123450": return step empty = current_state.find("0") for candidate in graph[empty]: new_state = get_new_state(empty, candidate, current_state) if new_state not in visited: queue.append([new_state, step + 1]) return -1 Other optimisation ideas When pieces on the left border are in place, there is no need to move them anymore. (On a 3x3 board, this would apply also to the top/bottom borders). Thus, we can reduce the search space by not trying to move them in these cases. I did not find any noticeable improvement by doing so: pieces_to_keep = set() if current_state[0] == "1" and current_state[3] == "4": empty = current_state.find("0") for candidate in graph[empty]: if candidate not in pieces_to_keep: new_state = get_new_state(empty, candidate, current_state) if new_state not in visited: queue.append((new_state, step + 1)) Micro optimisation We could try to save a bit of time by avoiding calling the get_new_state function and inlining the corresponding code. for candidate in graph[empty]: tmp_state = list(current_state) tmp_state[empty], tmp_state[candidate] = tmp_state[candidate], "0" new_state = ''.join(tmp_state) if new_state not in visited: queue.append((new_state, step + 1)) This leads to a significant improvement in performances. More extreme caching We can easily notice two interesting points: • there are not so many reachable positions (360) • when looking for a non reachable position, we have to generate all reachable position. This leads to an idea: we may as well compute all the positions and the number of steps required once and for all. This is an expensive initialisation step but as soon as we look for a single non reachable position, it is worth it. The more requests we perform, the more amortised the upfront operations are as each request takes a constant time. Corresponding code is: from collections import deque def generate_cache(): graph = {0:[1, 3], 1:[0, 2, 4], 2:[1, 5], 3:[0, 4], 4:[1, 3, 5], 5:[2, 4]} init_state = '123450' results = {init_state: 0} queue = deque([[init_state, 0]]) while queue: current_state, step = queue.popleft() empty = current_state.find("0") for candidate in graph[empty]: tmp_state = list(current_state) tmp_state[empty], tmp_state[candidate] = tmp_state[candidate], "0" new_state = ''.join(tmp_state) if new_state not in results: queue.append((new_state, step + 1)) results[new_state] = step + 1 return results cache = generate_cache() def sliding_puzzle(board): """ :type board: List[List[int]] :rtype: int """ init_state = "".join(str(c) for c in board[0] + board[1]) return cache.get(init_state, -1) This got me: Runtime: 32 ms, faster than 100.00% of Python3 online submissions for Sliding Puzzle. Memory Usage: 13.3 MB, less than 15.86% of Python3 online submissions for Sliding Puzzle. Hardcoded cache This would probably be a right place to stop but for some reason, after a few days, I got a bit curious of the performance gain we'd have by having the cache hardcoded: Runtime: 32 ms, faster than 100.00% of Python3 online submissions for Sliding Puzzle. Memory Usage: 13.1 MB, less than 80.58% of Python3 online submissions for Sliding Puzzle. I must confess that I am a bit disappointed. Additional note: at this level of details, resubmitting the same solution can lead to different performances. • Upvoted! Amazing answer. Here is the Leetcode result for your code - Runtime: 44 ms, faster than 97.46% of Python 3 online submissions for Sliding Puzzle. – Justin May 30 '19 at 20:50 • Thanks for the feedback. You got me eager to find how 2.54% did :) My answer will probably get update in the next minutes! – SylvainD May 30 '19 at 20:56 • @Justin You can see a new optimisation on the edited version of my answer. – SylvainD May 30 '19 at 20:59 • Thanks a lot! Here's the Leetcode result (keeps changing actually, but it's the same as the previous one) - Runtime: 44 ms, faster than 97.46% of Python3 online submissions for Sliding Puzzle. But all in all, it is way faster than mine, which is all I needed. Accepted! – Justin May 30 '19 at 21:06 • New status: "Runtime: 32 ms, faster than 100.00% of Python3 online submissions for Sliding Puzzle. Memory Usage: 13.3 MB, less than 15.86% of Python3 online submissions for Sliding Puzzle." – SylvainD May 31 '19 at 14:50
2020-04-07 11:33: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": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 1, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.22642908990383148, "perplexity": 4677.892777231952}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2020-16/segments/1585371700247.99/warc/CC-MAIN-20200407085717-20200407120217-00369.warc.gz"}
http://ogui.ligk.pw/udemy-finite-element-analysis.html
Reliable and effective finite element procedures are discussed with their applications to the solution of general problems in solid, structural, and fluid mechanics, heat and mass transfer, and fluid-structure interactions. [S S Bhavikatti] -- With the authors experience of teaching the courses on Finite Element Analysis to undergraduate and postgraduate students for several years, the author felt need for writing this book. Some of the features that were added in the latest revision are stress stiffening, corotational formulation, bandwidth minimization, residual monitoring, and dynamic memory allocation. Schaum's Outline of Finite Element Analysis and millions of other books are available for Amazon Kindle. Outline Please click HERE to view the course outline. Elements like bone, arthropod exoskeleton, mollusc shells, or the stems and leaves of plants can be analysed using. Dental implant with an abutment to be placed in the ridge created by the missing molar. Finite Element Analysis Efficiently optimize and validate each design step using fast-solving, CAD integrated SOLIDW. googleusercontent. Finite element. fix the cylindrical faces) as shown in the figure below. While finite element analysis contains a series of complex steps, it can be broken down to one goal. 4 Contract No. Covering topics such as random vibration, shock and response spectra, nonlinear dynamic response, explicit dynamic analysis and complex eigenvalue analysis, attendees will come away with an understanding of the theory behind advanced dynamic analysis techniques, a practical understanding of advanced applications, hints and tips for setting up. Finite Elements in Analysis & Design 48: 1346-1357. Finite element analysis shows whether a product will break, wear out, or work the way it was designed. FEAP is a general purpose finite element analysis program which is designed for research and educational use. The Concept Of Finite Element Analysis, Finding Properties Of Various Elements And Assembling Stiffness Equation Is Developed Systematically By Splitting The Subject Into Various Chapters. 5, and 2 mm) with 12 mm occlusal plane height were analyzed. دانلود Bentley GeoStructural Analysis و Bentley GeoStructural Finite Element Analysis ; نرم افزار ژئوتکنیکی حفظ زیرساخت و آنالیز تقویت حفاری, تونل و پایداری شیب ادامه مطلب. com/finite-element- This session. The duration of this short course may vary between a few hours (illustration of the Finite Element Analysis workflow) up to 20 hours or more - strongly depending on the number of exercises, homework assignments, presentation and discussion of results and so on. Finite Element Analysis of Internal Door Panel of a Car by Cons ideringBamboo Fiber Reinforced Epoxy Composite @inproceedings{Eskezia2017FiniteEA, title={Finite Element Analysis of Internal Door Panel of a Car by Cons ideringBamboo Fiber Reinforced Epoxy Composite}, author={E Eskezia and Adeyabeba Abera and Daniel Tilahun}, year={2017} }. Structural Tutorial 1. Multiple load cases comprising point loads and UDLs can be applied to the outline of the model. This course will provide a general preparation in finite element methods with an emphasis on linear finite-elements and material behavior. This is a 1D element static analysis tutorial. Homework 1. Transfer Geometry Solidworks, Design Model to ANSYS. 7 Global equations 36 2. The first step is to define the geometry and parameters required for the analysis. At AdvanSES, we have a wealth of experience in addressing elastomer rubber material problems. 1 Used finite element types 3. Our FEA team comprises specialists in the use and application of linear and nonlinear FEA and experts in tools such as Abaqus, USFOS, Sesam, ANSYS and SACS. Finite Element Analysis (FEA) has gained an increasing role in project development by eliminating the expensive initial prototype testing stage. The fact that modern engineers can obtain detailed information for structural, thermal, electromagnetic problems with virtual experiments largely gives credit to FEM. This can help you to perform high fidelity modeling for applications such as structural mechanics, electrostatics, magnetostatics. [MUSIC] This lesson looks at finite element analysis, otherwise known as FEA. One- and two-dimensional elements are needed, so the basics of both are going to be described [16]. ISBN 978-953-51-0717-0, PDF ISBN 978-953-51-6248-3, Published 2012-10-10. We will also discuss the generation of finite element meshing. This is important in concrete structures, wood structures,. Finite Element Analysis Explorer was created to provide a quick visual display of static analysis of structural elements under loads. This is a basic course that focuses on finite element analysis and its applications. Useful for problems with complicated geometries, loadings, and material properties where analytical solutions can not be obtained. SAP2000 is a structural analysis and design software which uses finite element method. Transfer Geometry Solidworks, Design Model to ANSYS. Finite Element Analysis for Design Engineers Details Many books have been written about Finite Element Analysis (FEA), however very little FEA literature takes a middle ground approach and specifically addresses the needs of design engineers who use FEA as an everyday design tool. Basics and fundamentals of finite element analysis, Ansys static analysis tutorials 4. The Data Science Using Python Course is thoughtfully designed for aspiring Data Scientists read more. In this paper, the nonlinear finite element analysis of the fluted corrugated sheet in the corrugated cardboard based on software SolidWorks2008 was investigated. 682) 14 Brief History - The term finite element was first coined by clough in 1960. You will also have the opportunity to try out two exercises to carry out a simple analysis of a plate and a square beam. In order to perform effective stress analysis, designers need to know not only the SOLIDWORKS Simulation user interface, but also the methodology and application of finite element analysis (FEA) in general. References Finite Element Analysis Books 1. This video describes the basic analysis process for a simple. It is obvious that vector field quantities can be described with their components on the vertexes. It is a state-of-the-art engineering tool capable of replacing or augmenting experimental testing. The next example shows you how multiple elements are assembled into a system. The finite element program used in the class is OptiStruct (consequently OptiStruct related options and commands are discussed). 1 INTRODUCTION ANSYS is the original (and commonly used) name for ANSYS Mechanical or ANSYS Multiphysics, general-purpose finite element analysis software. Case 1: Point Load on Centre of a Cantilever Beam Figure 01 shows an overview of the beam problem for load case 1 (point load) and figure 02 shows a representative finite element model for this load case. The Finite Element Method: Linear Static and Dynamic Finite Element Analysis (Dover Civil and… by Thomas J. The test gears have a ratio of 1:1. Introduction to Finite Element Analysis and Design, 2nd Edition by N. This paper discusses the outcome of the common assessment of a sample introductory undergraduate/graduate level course on finite element analysis (FEA) taught at three different local four-year engineering colleges, namely, Baker College and Kettering University (Flint, MI), and Saginaw Valley State University (SVSU, Saginaw, MI). 4 (145 ratings) Course Ratings are calculated from individual students' ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately. 56-8, "A Finite-Element Method for Transverse Vibrations of Beams. Can any one recommend a good and efficient online course that teaches 'Finite element analysis in order to model real engineering problems'? I don't have any minute knowledge of FEM or its. This class does not have a required textbook. FEA Information Engineering Journal w ww. This program reads in nodal coordinates, element connectivity, displacement and mechanical boundary conditions similar to ANSYS format. Numerical implementation of the coupled criterion: Matched asymptotic and full finite element approaches. 1D Problem Solved in ANSYS Classic ===> Solidworks Simulation (COSMOS) Solidworks Beam Elements 1. FINITE ELEMENT STRUCTURAL ANALYSIS ON AN EXCEL SPREADSHEET COURSE DESCRIPTION: Conventional thinking is that Finite Element (FE) analysis is complex and requires expensive commercial software. Michael Neilan. Results and stress plots are included. Finite element analysis (FEA) is a computerized method for predicting how a product reacts to real-world forces, vibration, heat, fluid flow, and other physical effects. Interval FEM can be applied in situations where it is not possible to get reliable probabilistic characteristics of the structure. ABAQUS is a general purpose finite element code for several types of analysis. After that one can let experts do final tests. Numerical Implementation with Finite Element Method Previous: 4. Finite element analysis (FEA) is the modeling of products and systems in a virtual environment, for the purpose of finding and solving potential (or existing) structural or performance issues. THE FEMCI BOOK* Welcome to the heart of FEMCI online. structures, but there are still many areas which need to be more carefully explored. In these two video courses, Professor K. The second part is a new textbook by Strang. Even though they are somewhat dated they still retain their educational value. The Finite Element Method: Linear Static and Dynamic Finite Element Analysis (Dover Civil and… by Thomas J. AU - Roesler, Jeffery R. This is the tutorial of finite element analysis of inflatable thin shell bag in abaqus package. Finite Element Analysis (FEA) has been used by engineers as a design tool in new product development since the early 1990's. The theory of Finite Element Analysis (FEA) essentially involves solving the spring equation, $$F = k \delta$$, at a large scale. Course Hero has thousands of finite Element Analysis study resources to help you. The Second Edition edition is completely revised to incorporate the latest analysis techniques, including brand new chapters 9 (Progressive Damage), Chapter 10 (Delaminations), and much more. You and other engineers can use it to reduce the number of physical prototypes and experiments and optimize components in their design phase to develop better products, faster. The results of their study show that considerable damage to the decks may occur by pounding. The original book demonstrates the solid mathematical foundation of the finite element idea, and the reasons for its success. It is also known as the Matrix Stiffness. The online Finite Element Analysis software component of SimScale enables you to perform simulations of structures, including linear static and nonlinear quasi-static analyses. 3 Weighted Residual Finite Element Methods 11. Typically the weld is included in the FEA model as a chamfer. Engineers use it to reduce the number of physical prototypes and experiments and optimize components in their design phase to develop better products, faster. com Skip to Job Postings , Search Close. Modern finite element products offer a range of solvers and solution procedures. This allowed scope for alteration in response to the structural analysis. Kindly note the followings:. FEM is widely used in stress analysis, heat transfer, fluid flow, and. Wu Z, Lo SH, Sze KY, Chen WJ (2012). Finite Element Analysis. com, India's No. 3 Finite element discretization 163 12. Together with obsolete material removed an improved focus on nonlinear finite element programs and rigorous treatment. Finite element analysis (FEA) is a computerized method for predicting how a product reacts to real-world forces, vibration, heat, fluid flow, and other physical effects. Review the full course description and key learning outcomes and create an account and enrol if you want a free statement of participation. Multotec utilises FEA (Finite Element Analysis) to optimise the designs of its mineral processing equipment, maximising product life cycles. When new technologies are developed, often they are introduced to engineering and technology students at the upper baccalaureate or graduate level. 1 Job Portal. Solidworks Beam Elements 2. Free statement of participation on completion. Moaveni presents the theory of finite element analysis, explores its application as a design/modeling tool, and explains in detail how to use ANSYS intelligently and effectively. Mecway is a comprehensive user friendly finite element analysis package for Windows with a focus on mechanical and thermal simulation such as stress analysis, vibration and heat flow. The scope is intentionally broad, encompassing use of the finite element method in engineering as well as the pure and applied sciences. Midterm Exam Practice. This section provides the schedule of lecture topics for the course along with lecture notes from most sessions. Finite Element Analysis (FEA) is a powerful engineering tool that simulates the physical behavior underlying many engineering problems. Source code of the full program is available for compilation using Windows (Intel compiler), LINUX or UNIX operating systems, and Mac OS X based Apple systems (GNU and Intel compilers). Master the key concepts of FEM (Method) and FEA (Analysis) Understand the element types and how to use them. The test gears have a ratio of 1:1. FEA Consulting Services Solve Your Structural & Thermal Analysis Challenges Complete range of finite element analysis (FEA) consulting services Our FEA consulting services help you address a range of structural and thermal analysis challenges with accurate, timely and cost-effective solutions. Homework 2. - Be able to explain how the stiffness relation for the (global) structure can be established by means of the element stiffness - Be able to carry out a finite element analysis of a frame structure and a steel plated structure with membrane stresses by using a relevant computer program and critically assess the results of the analysis. If you choose to take this course on its own it is expected you have foundational knowledge in finite element principles. Apply to Engineer, Analyst, Intern and more! Finite Element Analysis Jobs, Employment | Indeed. About ansys worbench program, we will use interface of the Workbench, interface of the Mechanical and we will learn how we can create Mesh Models and we will also talk about the. Among these are static and dynamic stress/displacement calculation, heat transfer and thermal stress, coupled pore fluid flow, mass diffusion, acoustic, piezoelectric, and fracture mechanics analysis. The extended finite element method (XFEM) is a numerical technique based on the generalized finite element method (GFEM) and the partition of unity method (PUM). The main objectives of FEA and the major components of any finite element model are discussed. machine_design. Basics and fundamentals of finite element analysis, Ansys static analysis tutorials 4. This can cause difficulty when designing with these materials and may lead to overdesigning the material. 1 Used finite element types 3. There are several basic steps in the finite element method: Discretize the structure into elements. From the finite element analysis perspective, the question is whether or not it is worth the effort to resolve this small region. It brings together essential information presented in a manner understandable to most engineers. It compares Finite Element Programs side by side building the same models. Steinbrink is responsible for undergraduate and graduate teaching in the areas of computational methods (including finite element analysis) and solid mechanics. Covering topics such as random vibration, shock and response spectra, nonlinear dynamic response, explicit dynamic analysis and complex eigenvalue analysis, attendees will come away with an understanding of the theory behind advanced dynamic analysis techniques, a practical understanding of advanced applications, hints and tips for setting up. Finite Element Analysis FEA Review - Finite Element Analysis (FEA) is a powerful tool that essentially divides a complex structure up into many small elements, where for each the stresses and deformations can be solved for using known equations of elasticity. This method which is based on numerical analysis has wide application and enjoys extensive utilization of the structural, thermal and fluid analysis areas. Easy step by step course on Finite Element Analysis (FEM FEA), a critical skill required for aerospace stress analysis. 1 INTRODUCTION ANSYS is the original (and commonly used) name for ANSYS Mechanical or ANSYS Multiphysics, general-purpose finite element analysis software. Instead of covering many nonlinear problems, the book focuses on three representative problems: nonlinear elasticity, elastoplasticity,. The program is capable of performing the following tasks on large FE models: · Static Analysis. When finite element analysis was developed in the late 1950s, it gave researchers an effective tool for subdividing girders into multiple sections, in order to more closely analyze the associated stresses and strains. FINITE ELEMENT STRUCTURAL ANALYSIS ON AN EXCEL SPREADSHEET COURSE DESCRIPTION: Conventional thinking is that Finite Element (FE) analysis is complex and requires expensive commercial software. KrishnaKumar, Department of Mechanical Engineering, IIT Madras. The aim of this journal is to provide ideas and information involving the use of the finite element method and its variants, both in scientific inquiry and in professional practice. Advanatges of Finite Element Analysis (FEA): * Main advantage of FEA is "Virtual Testing" * Problems can be Solved even there is no prototype or Product is available. FEA Information Inc. GBW32 is currently used in more than 30 countries. Tony Abbey FRAeS is a finite element analysis (FEA) evangelist, consultant, and mentor. We provide field measurement and analysis services in these areas. Finite element analysis is increasingly being used for the design of complex medical devices, especially those made from plastic or rubber. Finite Element Analysis (FEA) is a numerical method for calculating stress and strain (and other quantities) in structures that cannot be easily analyzed any other way. Dental implant with an abutment to be placed in the ridge created by the missing molar. Visit the Presentations page. - Constitutive equations: an overview Finite Element Analysis: - Application of the principle of minimum potential energy to approximate solution of elasticity problems Rayleigh-Ritz Method in statics. These Manuals for free PDF manual, user guide, guide, owner's manuals, advice , troubleshooting and support PRACTICAL. Finite Element RSS. The aim of this journal is to provide ideas and information involving the use of the finite element method and its variants, both in scientific inquiry and in professional practice. Introduction to the use of advanced finite element methods in the calculation of deformation, strain, and stress in aerospace structures. Final Exam Practice. Lewis Journal of Computational and Applied Mathematics, 299:68-91, 2016 [ preprint | article ] Stokes elements on cubic meshes yielding. They are especially valueable for beginners but, I think, even more advanced persons, in this field, can benefit from watching these lectures. Finite element analysis shows whether a product will break, wear out, or work the way it was designed. The Method Is Made Clear By Solving Many Problems By Hand Calculations. Full Solution. Lecture Series on Advanced Finite Elements Analysis by Prof. SAP 2000 is an integrated software for structural analysis and design. 1 INTRODUCTION ANSYS is the original (and commonly used) name for ANSYS Mechanical or ANSYS Multiphysics, general-purpose finite element analysis software. \emph{2001 Annual Conference, Albuquerque, New Mexico, 2001, June}. It follows on from matrix methods and finite difference methods of analysis, which had been developed and used long before this time. Toggle Menu. Why You Need to Study Finite Element Analysis! Klaus-Jürgen Bathe. Finite Element Analysis of an Aluminium Bike Frame Computer Simulation in Sports Engineering Rebecca Alonzo MSc Sports Engineering 3 2. Textbook of Finite Element Analysis P. Professional forum and technical support for engineers for Finite Element Analysis (FEA) engineering. Finite Element Analysis - Applications in Mechanical Engineering. 1 Introduction 161 12. The visual output will vary according to the input parameters and as such, cannot be anticipated and therefore figure descriptions are not possible. Choose the appropriate analysis mode for the project stage: line beam, grillage, or finite element analysis, all combined with traffic load optimization. Michael Neilan. (relevant to ABET criterion 3- a, c, e, f, i, k). Steady-state, transient, and dynamic conditions are considered. 30+ Lecturer on FEM uploaded till now. FEA uses. - Use finite element software for more advanced structural, thermal analysis and basic modal analysis. 0 out of 5 stars 1. Gauss elimination is a versatile technique for solution of equations and can be easily and efficiently modified to work on banded matrices. Free Download e-Books I think you have HijackThis currently saved to your Desktop. Finite element method is one of the most popular numerical methods used for (but not limited to) solving partial differential equations. Derivation of Element Equations 11. It is ideal for use in any industry where tonnage needs are at or above 4,000. Download finite element analysis codes, examples and course documents Chinese Version. The publications cover many aspects relevant to the safe and proper practice of finite element analysis including theory, practice, benchmarks, quality assurance procedures and specific project reports. The finite element method (FEM) is a powerful computer simulation tool, which has been successfully applied to the mechanical study of stress and strain and solving problems in the mechanics of solids and structures. 56-7, "A Finite-Element Analysis of Structural Frames" by T. It belongs to the Methods of Weighted residuals in that the problem is formulated such that some conditions. Discretize over space Mesh generation 4. Consider a simple bar made up of uniform material with length L and the cross-sectional area A. 1 Used finite element types 3. The finite element method is a numerical analysis technique for obtaining approximate solutions to a wide variety of engineering problems. The finite element analysis (FEA) is widely used for solving the engineering problems in solid and structural mechanics. Finite Element Analysis (FEA) is a numerical method for calculating stress and strain (and other quantities) in structures that cannot be easily analyzed any other way. It follows on from matrix methods and finite difference methods of analysis, which had been developed and used long before this time. Introduction to Nonline ar Finite Element Analysis. We have an extensive domain knowledge in the area of Engineering Simulation analysis, which encompass areas of Finite element FEA consulting, CFD consulting, Stress Engineering Services, Pipe Stress Analysis, and Acoustic Consulting. 1 Numerica! integration 34 2. 2 Finite Difference Methods 11. At Gannon, Dr. MAE456 Finite Element Analysis 16 Shell Finite Elements • Curved shell elements can be derived using “shell theory. FEA modelling is incredibly versatile software and can be used to model almost any real-world scenario. Get the right Finite element analysis engineer job with company ratings & salaries. Schaum's Outline of Finite Element Analysis and millions of other books are available for Amazon Kindle. ME235B Treats the development and analysis of finite element methods for linear parabolic (time-dependent heat equation), linear hyperbolic. The evolution of FEM, basic definitions, types of elements, analysis types, model fidelity, pre-processing and post-processing are all discussed with the aid of some mathematical and technical applications. Hughes, Dover Publications, 2000. Learn how to perform 3D Finite Element Analysis (FEA) in MATLAB. 3 ba„ “ ” Case 1: Fix nodes 2 and 3 F 1 = k a x 1 F 2. Dedicated to articles on Finite Element Analysis. Usually engineers, sometimes also scientists. Power Flow Finite Element Analysis of Dynamic Systems: Basic Theory and Application to Beams A power flow analysis has been developed for predicting the vibration response of dynamic systems to high frequencies at which the traditional finite element method is no longer practical. Finite Element Analysis Book By Senthil Pdf 1. At least a portion of that work has been directed toward developing thin walled curved beam elements. 1,883 Finite Element Analysis jobs available on Indeed. The involute and fillet tooth profile equations used in the finite element model have been introduced by references [9,10]. The finite element analysis (FEA) is widely used for solving the engineering problems in solid and structural mechanics. Cementing applied computational and analytical experience to a firm foundation of basic concepts and theory, Finite Element Analysis of Composite Materials Using ANSYS, Second Edition offers a modern, practical, and versatile classroom tool for today's engineering classroom. talk about the Finite Element Metod and then we will start to use Ansys Workbench software which is very popular in finite element analysis programs. Start a Linear simulation on the top left. Engineers then can use this information to pinpoint weak spots in any particular design. With our knowledge of soil and rock mechanics and shoring behaviour, the Finite Element Analysis is successfully used to identify risks to sensitive structures due to excavation and predict the magnitude of deformation of the shoring, soil, and surrounding buildings. Two-Dimensional Linear Elastostatic Problems. The finite element program used in the class is OptiStruct (consequently OptiStruct related options and commands are discussed). Explore the issues in convergence of solutions using finite element analysis. com - id: 10730f-ZDc1Z. It follows on from matrix methods and finite difference methods of analysis, which had been developed and used long before this time. TEXT BOOKOF FINITE ELEMENT ANALYSIS BY P. Establish weak formulation Multiply with arbitrary field and integrate over element 3. This website supports the text-based capstone experience exposing finite element analysis with computing practice. This analysis helps companies explore options for new products and parts while using fewer resources to launch experiments or design prototypes. 47 videos Play all Basics of Finite Element Analysis Rajesh Kumar 💰 How is Wealth Created | Savings and Investments - Duration: 8:45. Sign in Create account. Applications range in size from large structures such as massive concrete and steel pumping stations, all the way down to small implantable biomedical devices. In order to perform effective stress analysis, designers need to know not only the SOLIDWORKS Simulation user interface, but also the methodology and application of finite element analysis (FEA) in general. com Skip to Job Postings , Search Close. FINITE ELEMENT ANALYSIS MATHEMATICAL THEORY AND APPLICATIONS. Finite Element Analysis. Chapter 5 lays the foundation for analysis of one-dimensional problems by introducing one-dimensional linear, quadratic, and cubic elements. UNIT III – TWO DIMENSIONAL FINITE ELEMENT ANALYSIS a. 6 Element equaiions 31 2. FEAP is a general purpose finite element analysis program which is designed for research and educational use. 2 The Mindlin plate theory 161 12. ME235B Treats the development and analysis of finite element methods for linear parabolic (time-dependent heat equation), linear hyperbolic. analysis progresses. The Finite Element Methods Notes Pdf – FEM Notes Pdf book starts with the topics covering Introduction to Finite Element Method, Element shapes, Finite Element Analysis (PEA), FEA Beam elements, FEA Two dimessional problem, Lagrangian – Serenalipity elements, Isoparametric formulation, Numerical Integration, Etc. Salary estimates are based on 199 salaries submitted anonymously to Glassdoor by Finite Element Analysis Engineer employees. W - Free ebook download as PDF File (. Approximate solution of boundary value problems-Methods of weighted residuals, Approximate solution using variational method, Modified Galerkin method, Boundary conditions and general comments - Basic finite element concepts-Basic ideas in a finite element solution, General finite element solution. In this case we will use a clamp (full constraint) and apply a pressure of 40 psi or around 175 KPa. A simple truss consists of two links and three nodes is solved using Ansys Workbench. Gauss elimination is a versatile technique for solution of equations and can be easily and efficiently modified to work on banded matrices. Finite Element Analysis (FEA) Services Finite Element Analysis (FEA) is a simulation program that can be used alongside traditional testing to analyze the strength of complex structures and systems, determine component behavior, and accurately predict how products will react under structural and thermal loads. For computation, FEA breaks the real-world geometries down into meshes or computational grids composed of small elements, such as tetrahedrons. I will try to explain both the books needed and also the best process to start learning FEA from the point of view of a mechanical engineer, especially one dealing with solid mechanics problems. The finite element method outputs approximate solutions. Steady-state, transient, and dynamic conditions are considered. At the core lies Frame Analysis, a general-purpose finite element analysis package that integrates with the steel, concrete and timber design modules. It is built similarly to FEA of Composite Materials using ANSYS, in print since 2007, which includes more than 50 examples solved with ANSYS Mechanical. General elastic beam bending theory using the Bernoulli beam assumption is stud-. The finite element method (FEM) is a numerical method for solving problems of engineering and mathematical physics. Mathematical Models and Engineering Decisions. There are many books on finite element methods. Finite Element Analysis Procedure and Modeling Ch 8. 47 reviews for Finite Element Method (FEM) Analysis and Applications online course. Bathe, recommended for further study on the topics of linear and nonlinear finite element analysis. SESHU (1)- By www. T1 - Finite-element analysis of portland cement concrete pavements with cracks. The original works such as those by Argyris and Clough became the foundation for today’s finite element structural analysis methods. engineering108. The objective of the course is to teach the fundamentals of finite element analysis and design as well as providing hands on experience using finite element software. The text has a good mix of finite element theory and composite material concepts that are reinforced through the example problems. The numerical simulation results revealed that the main failure mode of buried PE pipe subjected to seismic landslide shifted from bending deformation to ovalization deformation with increasing bending deflection. Click Here to Get E-BOOK. Incompressible problems. engineering drawings, identify critical issues, collect and calculate required parameters, create a finite element model on computer, perform analysis, interpolate finite element analysis results, make conclusions, discuss results and suggest options. 1 Strains 162 12. Introduction to the use of advanced finite element methods in the calculation of deformation, strain, and stress in aerospace structures. This course will provide a general preparation in finite element methods with an emphasis on linear finite-elements and material behavior. To efficiently model a real life engineering problem using finite element analysis and predict its future behavior, an engineer must possess a strong theoretical understanding of the finite element method (FEM) along with an understanding of the importance of verification and validation of such computational models. With our knowledge of soil and rock mechanics and shoring behaviour, the Finite Element Analysis is successfully used to identify risks to sensitive structures due to excavation and predict the magnitude of deformation of the shoring, soil, and surrounding buildings. Finite Element Analysis of Various Implant Designs Including Bicon's 6. Full Solution. Select shape and weight functions Galerkin method 5. Edition July 2016 Page 7 Finite element analysis DNV GL AS 3 Finite element types 3. The original works such as those by Argyris and Clough became the foundation for today’s finite element structural analysis methods. Accelerating Finite Element Analysis in MATLAB with Parallel Computing By Vaishali Hosagrahara, MathWorks, Krishna Tamminana, MathWorks, and Gaurav Sharma, MathWorks The Finite Element Method is a powerful numerical technique for solving ordinary and partial differential equations in a range of complex science and engineering applications, such. Finite element analysis procedure. The kind of entity that is used to model a beam or a column cannot be used to model a slab. finite element method, including the secant formulation of linearized buckling analysis is given in Reference [3]. This can cause difficulty when designing with these materials and may lead to overdesigning the material. It consists all the modules of CAE i. Element : Method Finite Analysis Linear Element Dynamic and Static Finite Finite Static and Element Linear Element : Dynamic Finite Method Analysis Finite Element Method for Solid and Structural Mechanics, Hardcover by Zienki. The FEA software used was John Hallquist's NIKE2D Finite Element Code. Start the App. In addition, he teaches undergraduate engineering design, and serves as chair of the Mechanical Engineering department. This method which is based on numerical analysis has wide application and enjoys extensive utilization of the structural, thermal and fluid analysis areas. As such, it is a numerical rather than an analytical method. Classes go through topics of geometry creation, stress analysis, heat transfer and vibration modes. Learn how to perform 3D Finite Element Analysis (FEA) in MATLAB. THE FEMCI BOOK* Welcome to the heart of FEMCI online. What is Finite Element Analysis? One of the most common examples of engineering analysis is finite element analysis or FEA. Gauss elimination is a versatile technique for solution of equations and can be easily and efficiently modified to work on banded matrices. Covering topics such as random vibration, shock and response spectra, nonlinear dynamic response, explicit dynamic analysis and complex eigenvalue analysis, attendees will come away with an understanding of the theory behind advanced dynamic analysis techniques, a practical understanding of advanced applications, hints and tips for setting up. Printed in full color, it utilizes rich graphics and step-by-step instructions to guide you through learning how to perform finite element simulations using ANSYS Workbench. As an effective alternative to extensive experimentation, this study was implemented to evaluate the plausibility of finite element analysis of reinforced-concrete bridge decks. However, we do recommend the following books for more detailed and broader treatments than can be provided in any form of class: The Finite Element Method: Linear Static and Dynamic Finite Element Analysis, T. • FEM uses discretization (nodes and elements) to model the engineering system, i. This includes the theoretical foundations and appropriate use of finite element methods. Adaptive methods. Accurate, reliable salary and compensation comparisons for United States. Basic finite element concepts-Basic ideas in a finite element solution, General finite element solution procedure, Finite element equations using modified Galerkin method, Application: Axial deformation of bars, Axial spring element 3. , in terms of whether it will break, wear out, or work the way it was designed. Finite element analysis provides numerical solutions to boundary value problems that model real-world physics as partial differential equations. Dental implant with an abutment to be placed in the ridge created by the missing molar. The finite element method is a systematic way to convert the functions in an infinite dimensional function space to first functions in a finite dimensional function space and then finally ordinary vectors (in a vector space) that are tractable with numerical methods. 47 reviews for Finite Element Method (FEM) Analysis and Applications online course. The method of Finite Element Analysis or FEA refers to a computer-based technique used for analysing or simulating the way that engineering components & structures behave under various conditions. The Finite Element Analysis (FEA) is the simulation of any given physical phenomenon using the numerical technique called Finite Element Method (FEM). any conventions finite element program, for “small strain” elastic-plastic analysis, to be simply and rigorously adapted to problems involving arbitrary amounts of deformation and arbitrary levels of stress in comparison to plastic deformation moduli. "Finite Element Analysis For The Mechanical Engineering Technology Student". For computing assignments, students will work with and extend a simple but effective finite element code using Matlab and use the Matlab PDE Toolnox for convenient pre- and post-processing features. Typical problem areas of interest include structural analysis, heat transfer, fluid flow, mass transport, and electromagnetic potential. At the core lies Frame Analysis, a general-purpose finite element analysis package that integrates with the steel, concrete and timber design modules. Most Downloaded Finite Elements in Analysis and Design Articles The most downloaded articles from Finite Elements in Analysis and Design in the last 90 days. Chapter 5 lays the foundation for analysis of one-dimensional problems by introducing one-dimensional linear, quadratic, and cubic elements. This free course is available to start right now. Policies There will be three in class exams which will constitute some typical written problems and possibly some exercises that are to be done on the computer. MIT OpenCourseWare. Introduction The description of the laws of physics for space- and time-dependent problems are usually expressed in terms of partial differential equations (PDEs).
2019-11-18 23:03: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": 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.25755274295806885, "perplexity": 1466.851987074245}, "config": {"markdown_headings": false, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.3, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-47/segments/1573496669847.1/warc/CC-MAIN-20191118205402-20191118233402-00053.warc.gz"}
https://web2.0calc.com/questions/consecutive-even-integers_1
+0 # Consecutive even integers. +1 156 5 +22 The sum of two consecutive even integers is at most seven more than half the sum of the next two consecutive even integers. Yeah. I have no clue either. Oct 17, 2019 #1 +107006 +1 The sum of two consecutive even integers is at most seven more than half the sum of the next two consecutive even integers. $$(x-2)+x \le \frac{1}{2}(x+2+x+4)+7\\ 2x-2 \le \frac{1}{2}(2x+6)+7\\ 2x-2 \le (x+3)+7\\ 2x-2 \le x+10\\ x \le 12\\$$ So the first 2 numbers have to be less than or equal to  10 and 12 Oct 17, 2019 #2 +22 +2 Thank You! veraguitars1234  Oct 17, 2019 #3 +107006 +1 Do you understand? Melody  Oct 17, 2019 #4 +22 +1 nope. veraguitars1234  Oct 17, 2019 #5 +107006 +1 ok you should have said so int the first place then maybe I would already have tried to explain better. The sum of two consecutive even integers is at most seven more than half the sum of the next two consecutive even integers. Let the 4 consecutative EVEN numbers be    $$x-2,\;\;x, \;\;x+2,\; \;and\;\; x+4$$ $$x$$   is the second smallest.     (I didn't have to make it the second smallest, I could have made it any of them) So the sum of the 2 smallest numbers are $$(x-2) \quad + \quad x\quad\\= 2x-2$$ Half the sum of the 2 bigger ones is $$\frac{1}{2}(x+2\;\;+\;\; x+4)\\ =\frac{1}{2}(2x+6)\\ =\frac{1}{2}*2(x+3)\\ =\frac{1}{\not{2}}*\not{2}(x+3)\\ =x+3$$ Now the first answer has to be at most 7 more than the second answer So The first answer has to be less than or equal to the second answer +7 more so $$2x-2\le x+3+7\\ 2x-2\le x+10\\ x-2\le 10\\ x\le 12\\$$ So 12 is the giggest possibility for the second number so the two original even numbers must be less than or equal to   10 and 12. Maybe that will make more sense Melody  Oct 17, 2019
2020-01-24 19:48: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": 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.835761547088623, "perplexity": 1074.6597030080245}, "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/1579250625097.75/warc/CC-MAIN-20200124191133-20200124220133-00446.warc.gz"}
https://mailman.ntg.nl/pipermail/ntg-context/2022/106021.html
# [NTG-context] \setuplist only for bodypart Pablo Rodriguez oinos at gmx.es Thu Jun 16 21:19:13 CEST 2022 ```Dear list, sorry for the very basic question, but I cannot find the way to do it. Imagine I have the following command: \setuplist [chapter] [alternative=d] But I only want for sectionblock bodypart (nof for frontpart, backpart or the appendices). I have enclosed in: \startsectionblockenvironment[bodypart] ... \stopsectionblockenvironment I have also tried: \setuplist [bodypart:chapter] [alternative=d] But nothing changed. Which is the right way to do it?
2022-08-13 07:05:30
{"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.9131433367729187, "perplexity": 6796.687376404874}, "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-33/segments/1659882571909.51/warc/CC-MAIN-20220813051311-20220813081311-00569.warc.gz"}
https://www.physicsforums.com/threads/2-equations-3-variables.876764/
# 2 equations, 3 variables ## Homework Equations Equation 1: 3x+2y+1/3z=50 Equation 2: x+y+z=100 ## The Attempt at a Solution I know that the variables go like this: x=5, y=2 and z=93. I solved this combining different variables until I got the right "combination". I have to prove these solutions, any ideas how? Buzz Bloom Gold Member Hi Nicola: Your solution can be proved to be correct by substituting the solution values for x, y, and z into the two equations and doing the arithmetic to end up with 50=50 and 100=100. You should be aware that the solution you have is not the only solution. Chose any arbitrary value for one of the variable, say for example, z=30. Substitute this value into the two equations and you get two equations in x and y which you can then solve. For z = 30 you get x = -100, y = 170. Regards, Buzz blue_leaf77 Homework Helper Your system of equation does not have a unique solution. Perform row reduction on the augmented matrix between the coefficients and the RHS matrices to get the general expression of the solution. Delta2 Homework Helper Gold Member Something tells me that the OP wanted to say that x,y,z are positive integers. If this is the case, the system seem to have unique solutions , for sure it has a finite set of solutions. Chestermiller blue_leaf77 Homework Helper If this is the case, the system seem to have unique solutions , for sure it has a finite set of solutions. Manipulating the general form of the solution by requiring it to satisfy ##x,y,z>0## still results in an interval of one parameter, so the solution is still of infinite numbers. Yes, thank you for the fast replays. What Delta said is correct, variables must be positive integers. Blue leaf, I don't quite manipulate well with matrices, I didn't really get what you said but thanks. Buzz bloom, I expressed myself wrong. By saying "prove" I meant to find a way of finding the variables that I did in logical non-guessing way that is verifiable by the others. Thanks guys, I hope you get what I'm saying. To elaborate more my task is to think of a real life problem that would lead to these equations, and I have to show the way of solving it myself. It is kind of a essay about designing problems. blue_leaf77 Homework Helper I don't quite manipulate well with matrices, I didn't really get what you said but thanks. Here's a tutorial about solving a system of equations using row reduction technique. Implementing this method for your problem, you should get for the solution $$\left( \begin{array}{c} x \\ y \\ z \\ \end{array} \right) = \left( \begin{array}{c} -150 \\ 250 \\ 0\\ \end{array} \right) + z\left( \begin{array}{c} 5/3 \\ -8/3 \\ 1\\ \end{array} \right)$$ The solution you found is obtained by setting ##z=93##. But as you see, any value of ##z## will actually give you a solution. If you want to restrict variables further to be positive, you can just use the above equation with an inequality so that $$\left( \begin{array}{c} -150 +z5/3\\ 250 - z8/3 \\ z\\ \end{array} \right) > \left( \begin{array}{c} 0 \\ 0 \\ 0 \\ \end{array} \right)$$ But as it should turn out, there are still many possible solutions. Last edited: Thank you, I will check that out, I hope it's in detail because I studied only basic operations with matrices this year in my high school, here in Europe. My friends generated the variables and equations via their own algorithm in Lazarus, I don't quite remember if the solutions are unique (still figuring out second part of your post, I will have to do some revising). It's pretty hard for me to comprehend university studies in my own language, even harder in english :( Thank you for your time Ray Vickson Homework Helper Dearly Missed Here's a tutorial about solving a system of equations using row reduction technique. Implementing this method for your problem, you should get for the solution $$\left( \begin{array}{c} x \\ y \\ z \\ \end{array} \right) = \left( \begin{array}{c} -150 \\ 250 \\ 0\\ \end{array} \right) + z\left( \begin{array}{c} 5/3 \\ -8/3 \\ 1\\ \end{array} \right)$$ The solution you found is obtained by setting ##z=93##. But as you see, any value of ##z## will actually give you a solution. If you want to restrict variables further to be positive, you can just use the above equation with an inequality so that $$\left( \begin{array}{c} -150 +z5/3\\ 250 - z8/3 \\ z\\ \end{array} \right) > \left( \begin{array}{c} 0 \\ 0 \\ 0 \\ \end{array} \right)$$ But as it should turn out, there are still many possible solutions. There are exactly two solutions in non-negative integers, but exactly one in positive integers. From what you wrote above we see that getting integers x and y requires z to be a multiple of 3, and x ≥ 0 requires z ≥ 90. Also I did something simmilar but coudn't figure how to proceed So I have to set assumption that z=93? blue_leaf77 Homework Helper There are exactly two solutions in non-negative integers, but exactly one in positive integers. From what you wrote above we see that getting integers x and y requires z to be a multiple of 3, and x ≥ 0 requires z ≥ 90. My bad, I was sloppy in reading @Delta² 's post, missed the "integer". Sorry @Delta² . So, yes he is right there is one positive integer solution. blue_leaf77 Homework Helper Also I did something simmilar but coudn't figure how to proceed So I have to set assumption that z=93? You have to find the range of ##z## (or ##a##) for which all solutions are positive. Aand I can find the range of z (a) only by guessing? blue_leaf77 Homework Helper Aand I can find the range of z (a) only by guessing? Of course not, you can start from the system of inequalities from the second part of post#7. There are three inequalities, find the intersection of all of them. Do you know how to work with inequalities? Ray Vickson Homework Helper Dearly Missed Aand I can find the range of z (a) only by guessing? No, of course not.Begin by actually reading what I wrote in #9, and proceed from there. Oh ok, I didn't go through your whole post that is more in-depth yet, I have that in mind. I have to check out terminology to know if I know what you are talking about (inequalities). I won't ask any more stupid questions, after I observe the materials you gave me in complete tomorrow, I will state the situation Ray Vickson, I didn't understand where u got the condition that x variable has to be 3 times bigger then z variable? Do you conclude that from Equation 2? I don't see the connection, am I missing something out? Ray Vickson Homework Helper Dearly Missed Ray Vickson, I didn't understand where u got the condition that x variable has to be 3 times bigger then z variable? Do you conclude that from Equation 2? I don't see the connection, am I missing something out? Well, never said that. I said that z must be a multiple of 3; it could be 0, or 3, or 6, or,... Why? Well, look at the formula in equation (1) of post #7: $$x = -150 + \frac{5}{3}z$$ If ##z## is an integer that is not a multiple of 3, the value of ##x## will be a non-integer with a remainder of 1/3 or 2/3. The only way to have ##x## come out as an integer is to have ##z## be an (integer) multiple of 3, so that there will not be any remainder when you compute ##x##. Next: in order to have ##x = -150 + (5/3)z \geq 0## you need to have ##(5/3)z \geq 150##. What does that tell you about ##z##? I did some work on matrices but I managed to do similar as I sad using basic algebra already, but nevertheless now knowing how to reduce matrice to reduced row echoleon form is useful, I will add that to my final paper for sure. blue_leaf77 and Ray Vickson, so there are two non-positive integer solutions (containing 0) and unique positive (x=5, y=2, z=93). So by the setting of the problem one will conclude that the x,y,z>0. Next, in equation x=−150+5/3z, by the condition x,y>0 follows 98<z>90, also for x to be integer z must be multiple of 3 so that leads us to only two numbers possible; 93 and 96. Is that all there is to it for positive integer solution? Other thing, how did you read that there are only two non-positive integer solutions? I really know little about matrices, I know how to reduce the matrice, but the record in the video later, explaining as the solution can be specified as vectors confused me a little. What inequalities are set then and how to read them? (this is not really important because I only need positive solutions, but it's nice to know) Last edited: blue_leaf77 Homework Helper non-positive Non-negative. 98<z>90 ##z>90## is correct but ##z>98## is not, let alone this mistake that's not how you combine two inequalities into a single one. that leads us to only two numbers possible; 93 and 96 96 shouldn't be in the range where the solution is positive, this is because you calculated one of the inequalities wrongly. two non-positive Again, non-negative. You can deduce that there are only two non-negative integer solutions after you correctly calculate the required range for ##z##. My bad, I mixed the term with something else, I'm looking into different stuff simultaniesly... But still I got the correct meaning? x=0 => z(a)=90 and y=10, also y=0 => z(a)=93.75 and x=6.25? that would be the 2 cases? Also the second part, it is not entirely false that a<98, from Equation 2, the sum of all three variables has to be 100, so x and y each respectively have smallest possible value of 1. Later on I get to the part where z can be either 93 or 96, but by substituting I eliminate 96. blue_leaf77 Homework Helper that would be the 2 cases? Two cases of what? The first solution set is the non-negative integer one but the second set is clearly not integer. Are we actually still in the same goal of obtaining positive integer solution? it is not entirely false that a<98 Try setting ##z=98## in the general form of the solution in post #7, will it give positive values for ##x,y,z##? Take a look again at the second part of post #7. In the upper row you have ##-150+(5/3)z>0## and upon simplifying you get ##z>90##. The second row gives you ##250-(8/3)z>0##, how does it simplify? Well non-negative means the number is 0 or greater. I assumed the two cases where when either x or y had to be 0. Why you didn't use term positive then? It's true, if y is set to 0 solutions aren't positive integer. Ok, so regarding the Equation 2, I still can't say that the solution z(a)<98? blue_leaf77 Homework Helper I still can't say that the solution z(a)<98? Have you tried plugging in, e.g. ##z=97##, into the general equation of the solution? Are the solution set all positive? I know it's not correct, the only solution is 93 for z(a), but is it defining it before conclusion a mistake (based on equation at the start)? it just seems more precise, if it's dumb please say it, because I don't have the knowledge to tell. blue_leaf77 Homework Helper is it defining it before conclusion a mistake In math, the solution of a problem is not to be defined, it's to be found by any feasible formal way. You define something when you want to introduce a new object. I don't know how you came up with z < 98 for the upper limit, but if you did your work systematically you should have ended up with the correct upper limit. SammyS Staff Emeritus Homework Helper Gold Member I did some work on matrices but I managed to do similar as I said using basic algebra already, but nevertheless now knowing how to reduce a matrix to reduced row echelon form is useful, I will add that to my final paper for sure. ... Using basic algebra, you can eliminate any one variable from one equation. Eliminating x gives: 3y + 8z = 750 ##\ \ \ ## (A)​ Eliminating z gives: -3x + 5z = 450 ##\ \ ## (B)​ Eliminating z gives: 8x + 5y = 50 ##\ \ \ \ ## (C) Any two of these can be used to replace the original two equations, Equations (1) and (2) in the OP. Alternatively, Any one of the above may be used with either of the original equations to define this system. In addition, the above Equations, (A), (B), and (C) can give you information regarding what allowed range of values are required for any of the variables so that all of the variables are positive or alternatively non-negative. If x > 0, then Eq. (B) gives that z > 90 and Eq. (C) gives that y < 10 . If y > 0, then Eq. (A) gives that z < 93.75 and Eq. (C) gives that x < 6.25 . If z > 0, then Eq. (A) gives that y < 250 and Eq. (B) gives that x > -150 . But, of course we need x > 0. Putting these together we have: 0 < x < 6.25 0 < y < 10 90 < z < 90.75​ Additionally, Equations A, B, and C tell us that x is a multiple of 5, y is even, and z is a multiple of 3 . Consideration of the restrictions on x or z give the fewest number of cases to consider. (I know this post is late, but I started it this morning and then got side-tracked.) Nikola276 ehild Homework Helper ## Homework Equations Equation 1: 3x+2y+1/3z=50 Equation 2: x+y+z=100 ## The Attempt at a Solution I know that the variables go like this: x=5, y=2 and z=93. I solved this combining different variables until I got the right "combination". I have to prove these solutions, any ideas how? You can solve the problem systematically without matrices, as @SammyS said, by elimination. x, y, z are all positive integers. Because of equation 1, z must be a multiple of 3. Assume it in the form z=3u, with u positive integer. Changing the variable z to u, 1) 3x+2y+u=50 2) x+y+3u=100. Isolate x fom 2): 3) x=100-3u-y, and substute it for x in 1) 3(100-3u-y)+2y+u=50 Expand the parentheses and simplify: 300-9u -3y +2y +u =50 ----> y = 250 - 8u Substitute y into 3) x=100-3u-(250-8u) ---> x = 5u - 150 x, y, and u have to be positive integers. So u > 0 , 5u-150 >0, 250-8u>0. What limits do you get for u? u> 30, u<31,2 What is the solution for u? For x, y, z? Thank you all, I understand it know :) just one more question, can solution be found somehow in 3-axis coordinate system like in video of the posts before using matrices? what software should I use? blue_leaf77 Homework Helper They are not axis, they are vectors whose number turns out to be three. In that video the solution turns out to be a sum between a fixed vector and a linear combination of the vectors denoted by ##\vec a## and ##\vec b## (just for your information the last two vectors form the basis in the so-called null space of the coefficient matrix). In your problem the solution is a sum between a fixed vector ##(-150,250,0)^T## and a linear combination of a single vector ##(5/3,-8/3,1)^T## (the last vector is a basis for the null space of the coefficient matrix in your problem). Buzz Bloom Gold Member Hi @Nicola276: I agree with Delta. Something tells me that the OP wanted to say that x,y,z are positive integers. Equations seeking integer solutions are called Diophantine equations. There is a discussion of these equations in You may also find the following helpful. It is about a method for solving a single linear Diophantine equation. Your problem involves two equations, but it is easy to transform it into one by eliminating one variable as shown by SammyS in post #28. Regards, Buzz Nikola276
2022-07-02 15:16: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": 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.753994882106781, "perplexity": 539.7293691301884}, "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-27/segments/1656104141372.60/warc/CC-MAIN-20220702131941-20220702161941-00687.warc.gz"}
https://tex.stackexchange.com/questions/356500/how-to-call-subsection-in-autoref
# how to call subsection in autoref? I wonder if there any option to call subsection or subsubsection in a way of using \autoref{}? For example: \subsection{Basic Structure} ..... ..... ..... According to \autoref{\subsection{Basic Structure}}.... ..... ..... Thanks, Tommy • Off-topic: You have answers to most of your questions, but accepted not a single one up to now nor cast any upvote (which is possible, since your reputation is > 15). Please accept answers to your questions and upvote them (and no, I don't have answered one of your questions (yet) ;-)) in order to appreciate the work done by users to help you – user31729 Mar 2 '17 at 10:49 • Please show us always a MWE not only a code snippet. – Schweinebacke Mar 2 '17 at 10:49 You code should look like this: \subsection{Basic Structure} \label{sec:basic} % choose a suitable "label" ..... According to \autoref{sec:basic}, \dots \autoref is a hyperref extension of the \label-\ref-mechanism. So you have to set a \label after \subsection and use the argument of \label as argument of \autoref: \documentclass{article} \usepackage{blindtext} \usepackage{hyperref} \begin{document} \section{Test section} \label{sec:test} \blindtext \subsection{Test subsection} \label{ssec:test} \blindtext This is \autoref{ssec:test} in \autoref{sec:test} with headline \nameref{ssec:test}''. \end{document}
2019-08-20 02:44:49
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.8835126757621765, "perplexity": 3265.126639272665}, "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/1566027315222.14/warc/CC-MAIN-20190820024110-20190820050110-00262.warc.gz"}
https://www.statstutor.net/downloads/question-2011667-other-statistics-problems/
# Question #2011667: Other Statistics Problems Question: According to Farming Today (February 28, 2008), the mean number of sunny days per year is 187 with a standard deviation of 53 days per year. Assume that these results apply to the entire history of the United States and that the distribution of sunny days is relatively normal. A sample of 38 years is selected. The mean of the sample is 183.2 sunny days per year with a standard deviation of 43 days per year. (a) In this problem identify the following variables: m = _______, s = ______, $\bar{x}$ = ________, s = _____, and n = _______ (b) What is the probability that a single year from the population will have 177 or more sunny days? Solution: The solution consists of 168 words (1 page) Deliverables: Word Document 0
2019-10-18 07:26:43
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.23357287049293518, "perplexity": 586.6205165901064}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-43/segments/1570986677964.40/warc/CC-MAIN-20191018055014-20191018082514-00531.warc.gz"}
https://docs.blender.org/manual/en/latest/grease_pencil/modifiers/deform/armature.html
# Armature Modifier¶ The Armature Modifier is used for building skeletal systems for animating the poses of characters and anything else which needs to be posed. By adding an armature to an object, this object can be deformed accurately so that geometry does not have to be animated by hand. For more details on armatures usage, see the armature section. ## Options¶ The Armature modifier. Object The name of the armature object used by this modifier. ### Bind To¶ Methods to bind the armature to the strokes. Vertex Groups When enabled, bones of a given name will deform points which belong to vertex groups of the same name. e.g. a bone named “forearm”, will only affect the points in the “forearm” vertex group. The influence of one bone on a given point is controlled by the weight of this point in the relevant group. A much more precise method than Bone Envelopes, but also generally longer to set up. Bone Envelopes When enabled, bones will deform points or control points near them, defined by each bone’s envelope radius and distance. Enable/Disable bone envelopes defining the deformation (i.e. bones deform points in their neighborhood). ### Influence Filter¶ Vertex Group The name of a vertex group of the object, the weights of which will be used to determine the influence of this Armature Modifier’s result when mixing it with the results from other Armature ones. Only meaningful when having at least two of these modifiers on the same object, with Multi Modifier activated. Invert <-> Inverts the influence set by the vertex group defined in previous setting (i.e. reverses the weight values of this group).
2020-04-06 03:08: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.21582941710948944, "perplexity": 2532.268136820402}, "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-16/segments/1585371612531.68/warc/CC-MAIN-20200406004220-20200406034720-00290.warc.gz"}
https://www.thestudentroom.co.uk/showthread.php?t=1589317
You are Here: Home >< Physics # Quantum mechanics -harmonic oscillators Watch 1. Say we have a 1D harmonic oscillator with potential (classical frequency). Let the wavefunction of a particle be described by . How do I find the probability of finding the particle outside of the 'classically allowed region'? I figured the classical limit is basically the amplitude a of the particle's SHM, so I integrate the wavefunction squared from a to infinite (and multiply by 2 for symmetry). Not quite sure how to find a, though. Thanks for any help ! 2. (Original post by trm90) Say we have a 1D harmonic oscillator with potential (classical frequency). Let the wavefunction of a particle be described by . How do I find the probability of finding the particle outside of the 'classically allowed region'? I figured the classical limit is basically the amplitude a of the particle's SHM, so I integrate the wavefunction squared from a to infinite (and multiply by 2 for symmetry). Not quite sure how to find a, though. Thanks for any help ! Find A using the normalisation condition (probability of particle existing somewhere between -infty and +infty sums to 1), i.e. Otherwise I think the method you suggest is correct! 3. (Original post by Prime Suspect) Find A using the normalisation condition (probability of particle existing somewhere between -infty and +infty sums to 1), i.e. Otherwise I think the method you suggest is correct! Oh, so the wavefunction amplitude is pretty much equivalent to the classical amplitude? In that case that would make sense. Thanks very muc h! 4. (Original post by trm90) Oh, so the wavefunction amplitude is pretty much equivalent to the classical amplitude? In that case that would make sense. Thanks very muc h! Ah sorry I didn't read your first post properly, got the a's confused - thought you wanted to find A not a... Unfortunately its not true that A = a; instead I think you want to say that the expected quantum value for energy (the average value, or observed value) should equal the observed energy of the classical harmonic oscillator, i.e. The classical harmonic oscillator has a constant total energy, which is given by hence I think this total energy can be equated to the expected energy of the quantum system. Therefore I think that the equation should hold. From this I think you should be able to determine a and hence solve the problem... I hope! 5. (Original post by Prime Suspect) Ah sorry I didn't read your first post properly, got the a's confused - thought you wanted to find A not a... Unfortunately its not true that A = a; instead I think you want to say that the expected quantum value for energy (the average value, or observed value) should equal the observed energy of the classical harmonic oscillator, i.e. The classical harmonic oscillator has a constant total energy, which is given by hence I think this total energy can be equated to the expected energy of the quantum system. Therefore I think that the equation should hold. From this I think you should be able to determine a and hence solve the problem... I hope! Thanks very much, and the method seems more than viable. I'm going to give this a go on the train home and will let you know if I work it out later :-) 6. (Original post by Prime Suspect) Ah sorry I didn't read your first post properly, got the a's confused - thought you wanted to find A not a... Unfortunately its not true that A = a; instead I think you want to say that the expected quantum value for energy (the average value, or observed value) should equal the observed energy of the classical harmonic oscillator, i.e. The classical harmonic oscillator has a constant total energy, which is given by hence I think this total energy can be equated to the expected energy of the quantum system. Therefore I think that the equation should hold. From this I think you should be able to determine a and hence solve the problem... I hope! EDIT: Argh, messed things up again! If my Hamiltonian operator is of the form then I'm not sure how I'm supposed to about any of the integrals, as I'll get two integrals with x^2 exp(...x^2) terms and I'm not told how to evaluate those (my lecturer specifically said that all standard integrals will be provided and that we won't have to spend even 10 seconds trying to evaluate them, and only the answer to an integral of the form exp(-2bx^2) is provided). 7. (Original post by trm90) EDIT: Argh, messed things up again! If my Hamiltonian operator is of the form then I'm not sure how I'm supposed to about any of the integrals, as I'll get two integrals with x^2 exp(...x^2) terms and I'm not told how to evaluate those (my lecturer specifically said that all standard integrals will be provided and that we won't have to spend even 10 seconds trying to evaluate them, and only the answer to an integral of the form exp(-2bx^2) is provided). Use integration by parts and use that (presence of the derivative) I think that should work? EDIT Perhaps my method isn't correct then if you're not supposed to need to evaluate any integrals? Maybe instead you're supposed to consider energies, as for any energy the quantum oscillator is in a region that's classically forbidden... not sure how to use that info though! 8. (Original post by trm90) EDIT: Argh, messed things up again! If my Hamiltonian operator is of the form then I'm not sure how I'm supposed to about any of the integrals, as I'll get two integrals with x^2 exp(...x^2) terms and I'm not told how to evaluate those (my lecturer specifically said that all standard integrals will be provided and that we won't have to spend even 10 seconds trying to evaluate them, and only the answer to an integral of the form exp(-2bx^2) is provided). Surely you can use the fact that is an eigenstate of the Hamiltonian so you don't need to do any integrals. 9. EDIT: Okay, I evaluated the Hamiltonian and got: I equated this with the energy and got: where b = does that make sense? 10. (Original post by trm90) EDIT: Okay, I evaluated the Hamiltonian and got: I equated this with the energy and got: where b = does that make sense? Sunelir is right - you know the ground state energy of the quantum oscillator is given by because is an eigenstate of the hamiltonian this must hold. So you equate this to the classical energy to find a - sorry for making you evaluate the integrals, I am definitely a bit rusty on the old quantum mechanics! 11. (Original post by Prime Suspect) Sunelir is right - you know the ground state energy of the quantum oscillator is given by because is an eigenstate of the hamiltonian this must hold. So you equate this to the classical energy to find a - sorry for making you evaluate the integrals, I am definitely a bit rusty on the old quantum mechanics! I see... this is a silly question, but I was supposed to know that psi was the ground state wavefunction right ? But I think I can take it from here, thanks guys! 12. (Original post by trm90) I see... this is a silly question, but I was supposed to know that psi was the ground state wavefunction right ? Well the label on psi was 0 and not n. 13. (Original post by trm90) I see... this is a silly question, but I was supposed to know that psi was the ground state wavefunction right ? But I think I can take it from here, thanks guys! Yeah you can safely assume it is given the 0 subscript... I totally missed this at first as well! TSR Support Team We have a brilliant team of more than 60 Support Team members looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out. This forum is supported by: Updated: April 10, 2011 Today on TSR Can it be done? ### Give feedback to Cambridge here Discussions on TSR • Latest • ## See more of what you like on The Student Room You can personalise what you see on TSR. Tell us a little about yourself to get started. • Poll Discussions on TSR • Latest • ## See more of what you like on The Student Room You can personalise what you see on TSR. Tell us a little about yourself to get started. • The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd. Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE
2018-01-20 03:31: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.812977135181427, "perplexity": 677.8060846732109}, "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-05/segments/1516084888878.44/warc/CC-MAIN-20180120023744-20180120043744-00150.warc.gz"}
https://forum.allaboutcircuits.com/threads/ryobi-string-trimmer-esc.186802/
# Ryobi string trimmer esc #### Lawnmowerman Joined May 11, 2022 28 #### Lawnmowerman Joined May 11, 2022 28 Here’s a more concise video #### Lawnmowerman Joined May 11, 2022 28 I can't stand that kind of vibration. Different with battery string trimmers, it’s a thing in the landscaping world to end up with nerve damage in the arms from petrol handheld equipment. Many here switched to electric for relief or prevention. #### k1ng 1337 Joined Sep 11, 2020 701 Different with battery string trimmers, it’s a thing in the landscaping world to end up with nerve damage in the arms from petrol handheld equipment. Many here switched to electric for relief or prevention. Oh wow its about time. My dad told me a story where he couldn't feel his arms after an afternoon of weed whacking haha. Every once in a while the tendons in my hand rub due to gripping nailers. Tendonitis is absolutely debilitating, it's a miracle I've only had it a few times in my life the way I work.. #### Lawnmowerman Joined May 11, 2022 28 So as I suspected after the initial simple wire switch was ineffective this would be quite involved. That’s not the end of the world as I’m a bit of a hobby tinkerer, I’m just a lot handier with mechanical things. I have some rudimentary electrical skills and I’m heavily into high end diy car audio, so I feel I’m up to the task of going so far as to even get inside the motor to switch things if necessary. If some of y’all would be interested in continuing to advise me I would buy either an electronic assembly or just a whole bare powerhead for around a hundred bucks and have that be my project unit. Of course I’d love to have a single switchable unit but I’m not against one stock and one modified specifically for string trimmer duty. It’s probably better to have a second modified one to always have the unadulterated one for a reliable tool incase Frankenstein breaks lol. Is there any information I can furnish to aid anyone willing to participate with me on this?
2023-01-31 09:28:11
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.17553941905498505, "perplexity": 2725.0607759364775}, "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/1674764499857.57/warc/CC-MAIN-20230131091122-20230131121122-00679.warc.gz"}
https://discourse.mc-stan.org/t/compound-poisson-gamma-distribution/7199
# Compound Poisson–gamma distribution Hi, I have zero-inflated continuous response data that I’d like to model using the compound Poisson–gamma distribution, which is a special case of the Tweedie distribution (https://en.wikipedia.org/wiki/Tweedie_distribution). There’s an old forum post (https://groups.google.com/forum/#!topic/stan-users/XyFv7ERq0oA) on this topic, as well as a closed GitHub issue (https://github.com/stan-dev/math/issues/417) and linked Gist (https://gist.github.com/MatsuuraKentaro/952b3301686c10adcb13). I am wondering if someone could clarify if and how one can fit such models with Stan. Thanks! Dan. I don’t know much about the Tweedie distribution and I haven’t read the links you posted, but I recently did a model for zero inflated continuous data from a chemical gas sensor with a detection limit. I’ll post some of that here. I used the inverse logit function to map partial pressure being measured to the probability of the sensor not detecting any amount of the chemical. The function looked like this: prob_{non-detect} = logit^{-1}\left(log(2.0/1.0e6) * {\hat P \over P_{det.lim.}} + log(1.0e6)\right) Where \hat P is the partial pressure being measured and P_{det.lim.} is the partial pressure at which the sensor is twice as likely to measure zero than it is to make a non-zero measurement. The log(1.0e6) is the log-odds of making a zero measurement when \hat P = 0; I set the odds to 1 million to make the logistic curve steep. Here are some plots for \hat P = 25, P_{det.lim.} = 25, and \sigma = 10, where \sigma is the standard deviation of the measurement error. Here’s how I implemented the data likelihood in Stan. Notice how the zeroes in the data increment the log-posterior with the log probability of a non-detect, while the non-zeroes in the data increment the log-posterior with the log probability of a detection using log1m_inv_logit(...), as well as the log density of the noisy observation. It’s important to use the log probability in both places. for (n in 1:N) for(m in 1:3) { // Trial, chemical species if (P_obs[n, m] == 0) { // Zero measurement process target += // Log-probability of zero measurement log_inv_logit( log(2.0/1.0e6) * P_hat[n,m]/det_lim + log(1.0e6) // Log-odds of a zero measurement at P_obs == 0 ); } else { // Non-zero measurement process target += // Log-probability of non-zero measurement log1m_inv_logit( log(2.0/1.0e6) * P_hat[n,m]/det_lim + log(1.0e6) // Log-odds of a zero measurement at P_obs == 0 ); P_obs[n, m] ~ // Noisy observation of a positive quantity gamma( square(P_hat[n, m] / sigma), // Shape P_hat[n, m] / square(sigma) // Inverse scale ); } } And here’s how I implemented the Generated Quantities block: real P_rep[N, 3]; int <lower=0, upper=1> non_detect; for (n in 1:N) for (m in 1:3) { // Trial, chemical species // Probabilistically decide which measurement process to sample non_detect = bernoulli_logit_rng( log(2.0/1.0e6) * P_hat[n,m]/det_lim + log(1.0e6) // Log-odds of a zero measurement at P_obs == 0 ); if (non_detect == 1) { // Zero measurement process P_rep[n, m] = 0.0; } else { // Non-zero measurement process P_rep[n, m] = gamma_rng( square(P_hat[n, m] / sigma), // Shape P_hat[n, m] / square(sigma) // Inverse scale ); } } 2 Likes Hi! I was trying to model a Tweedie distribution in Stan and came across your post (and the links you posted). Was this issue solved? There seems to be something in the stan users mailing list but I don’t have access to it. Thank you! It’s for sure possible. The gist you’ve posted properly implements the likelihood of the response variable with no additional covariates. What remains to be specified in code is the link function, or relationship between predictors and the likelihood. I took a look at the SAS documentation but it was vague (mentioned the likelihood but no mention of how covariates are related to the likelihood’s parameters). One could specify a linear link to model the relationship between tweeties distribution’s parameters of interest, for example the mean, dispersion or power parameters. I think designing the model depends more on what you would like to know. If there’s a more concrete question we have, I could probably code something up.
2022-05-19 05:00:16
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 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.6786539554595947, "perplexity": 2730.2251039884936}, "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/1652662525507.54/warc/CC-MAIN-20220519042059-20220519072059-00765.warc.gz"}
https://profdoc.um.ac.ir/paper-abstract-1035050.html
Georgian Mathematical Journal, ( ISI ), Volume (20), No (2), Year (2013-4) , Pages (303-317) Title : ( Spanier spaces and covering theory of non-homotopically path Hausdorff spaces ) Authors: Behrooz Mashayekhy Fard , Ali Pakdaman , Hamid Torabi Ardakani , Citation: BibTeX | EndNote Abstract H. Fischer et al. (Topology and its Application, 158 (2011) 397-408.) introduced the Spanier group of a based space $(X,x)$ which is denoted by $\psp$. By a Spanier space we mean a space $X$ such that $\psp=\pi_1(X,x)$, for every $x\in X$. In this paper, first we give an example of Spanier spaces. Then we study the influence of the Spanier group on covering theory and introduce Spanier coverings which are universal coverings in the categorical sense. Second, we give a necessary and sufficient condition for the existence of Spanier coverings for non-homotopically path Hausdorff spaces. Finally, we study the topological properties of Spanier groups and find out a criteria for the Hausdorffness of topological fundamental groups. Keywords Covering space; Spanier group; Spanier space; Homotopically path Hausdorffness; Small loop homotopically Hausdorffness; Shape injectivity. برای دانلود از شناسه و رمز عبور پرتال پویا استفاده کنید. @article{paperid:1035050, author = {Mashayekhy Fard, Behrooz and Ali Pakdaman and Torabi Ardakani, Hamid}, title = {Spanier spaces and covering theory of non-homotopically path Hausdorff spaces}, journal = {Georgian Mathematical Journal}, year = {2013}, volume = {20}, number = {2}, month = {April}, issn = {1072-947X}, pages = {303--317}, numpages = {14}, keywords = {Covering space; Spanier group; Spanier space; Homotopically path Hausdorffness; Small loop homotopically Hausdorffness; Shape injectivity.}, }
2019-10-22 12:30: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.6994284391403198, "perplexity": 8664.151485791985}, "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-43/segments/1570987817685.87/warc/CC-MAIN-20191022104415-20191022131915-00552.warc.gz"}
https://en.wikipedia.org/wiki/Singlet_oxygen
# Singlet oxygen Names Identifiers IUPAC name Singlet oxygen 3D model (JSmol) Interactive image ChEBI CHEBI:26689 Gmelin Reference 491 InChI InChI=1S/O2/c1-2Key: MYMOFIZGZYHOMD-UHFFFAOYSA-N SMILES O=O Chemical formula O2 Molar mass 31.998 g·mol−1 Solubility in water Reacts Except where otherwise noted, data are given for materials in their standard state (at 25 °C [77 °F], 100 kPa). Infobox references Singlet oxygen, systematically named dioxygen(singlet) and dioxidene, is a gaseous inorganic chemical with the formula O=O (also written as 1 [O 2 ] or 1 O 2 ), which is in a quantum state where all electrons are spin paired. It is kinetically unstable at ambient temperature, but the rate of decay is slow. The lowest excited state of the diatomic oxygen molecule is a singlet state. It is a gas with physical properties differing only subtly from those of the more prevalent triplet ground state of O2. In terms of its chemical reactivity, however, singlet oxygen is far more reactive toward organic compounds. It is responsible for the photodegradation of many materials but can be put to constructive use in preparative organic chemistry and photodynamic therapy. Trace amounts of singlet oxygen are found in the upper atmosphere and also in polluted urban atmospheres where it contributes to the formation of lung-damaging nitrogen dioxide.[1]: 355–68  It often appears and coexists confounded in environments that also generate ozone, such as pine forests with photodegradation of turpentine.[citation needed] The terms 'singlet oxygen' and 'triplet oxygen' derive from each form's number of electron spins. The singlet has only one possible arrangement of electron spins with a total quantum spin of 0, while the triplet has three possible arrangements of electron spins with a total quantum spin of 1, corresponding to three degenerate states. In spectroscopic notation, the lowest singlet and triplet forms of O2 are labeled 1Δg and 3Σ g , respectively.[2][3][4] ## Electronic structure Singlet oxygen refers to one of two singlet electronic excited states. The two singlet states are denoted 1Σ+ g and 1Δg (the preceding superscript "1" indicates a singlet state). The singlet states of oxygen are 158 and 95 kilojoules per mole higher in energy than the triplet ground state of oxygen. Under most common laboratory conditions, the higher energy 1Σ+ g singlet state rapidly converts to the more stable, lower energy 1Δg singlet state.[2] This more stable of the two excited states has its two valence electrons spin-paired in one π* orbital while the second π* orbital is empty. This state is referred to by the title term, singlet oxygen, commonly abbreviated 1O2, to distinguish it from the triplet ground state molecule, 3O2.[2][3] Molecular orbital theory predicts the electronic ground state denoted by the molecular term symbol 3Σ g , and two low-lying excited singlet states with term symbols 1Δg and 1Σ+ g . These three electronic states differ only in the spin and the occupancy of oxygen's two antibonding πg-orbitals, which are degenerate (equal in energy). These two orbitals are classified as antibonding and are of higher energy. Following Hund's first rule, in the ground state, these electrons are unpaired and have like (same) spin. This open-shell triplet ground state of molecular oxygen differs from most stable diatomic molecules, which have singlet (1Σ+ g ) ground states.[5] Two less stable, higher energy excited states are readily accessible from this ground state, again in accordance with Hund's first rule;[6] the first moves one of the high energy unpaired ground state electrons from one degenerate orbital to the other, where it "flips" and pairs the other, and creates a new state, a singlet state referred to as the 1Δg state (a term symbol, where the preceding superscripted "1" indicates it as a singlet state).[2][3] Alternatively, both electrons can remain in their degenerate ground state orbitals, but the spin of one can "flip" so that it is now opposite to the second (i.e., it is still in a separate degenerate orbital, but no longer of like spin); this also creates a new state, a singlet state referred to as the 1Σ+ g state.[2][3] The ground and first two singlet excited states of oxygen can be described by the simple scheme in the figure below.[7][8] Molecular orbital diagram of two singlet excited states as well as the triplet ground state of molecular dioxygen. From left to right, the diagrams are for: 1Δg singlet oxygen (first excited state), 1Σ+ g singlet oxygen (second excited state), and 3Σ g triplet oxygen (ground state). The lowest energy 1s molecular orbitals are uniformly filled in all three and are omitted for simplicity. The broad horizontal lines labelled π and π* each represent two molecular orbitals (for filling by up to 4 electrons in total). The three states only differ in the occupancy and spin states of electrons in the two degenerate π* antibonding orbitals. The 1Δg singlet state is 7882.4 cm−1 above the triplet 3Σ g ground state.,[3][9] which in other units corresponds to 94.29 kJ/mol or 0.9773 eV. The 1Σ+ g singlet is 13 120.9 cm−1[3][9] (157.0 kJ/mol or 1.6268 eV) above the ground state. Radiative transitions between the three low-lying electronic states of oxygen are formally forbidden as electric dipole processes.[10] The two singlet-triplet transitions are forbidden both because of the spin selection rule ΔS = 0 and because of the parity rule that g-g transitions are forbidden.[11] The singlet-singlet transition between the two excited states is spin-allowed but parity-forbidden. The lower, O2(1Δg) state is commonly referred to as singlet oxygen. The energy difference of 94.3 kJ/mol between ground state and singlet oxygen corresponds to a forbidden singlet-triplet transition in the near-infrared at ~1270 nm.[12] As a consequence, singlet oxygen in the gas phase is relatively long lived (54-86 milliseconds),[13] although interaction with solvents reduces the lifetime to microseconds or even nanoseconds.[14] In 2021, the lifetime of airborne singlet oxygen at air/solid interfaces was measured to be 550 microseconds. [15] The higher 1Σ+ g state is very short lived. In the gas phase, it relaxes primarily to the ground state triplet with a mean lifetime of 11.8 s.[10] However in solvents such as CS2 and CCl4, it relaxes to the lower singlet 1Δg in milliseconds due to nonradiative decay channels.[10] ### Paramagnetism due to orbital angular momentum Both singlet oxygen states have no unpaired electrons and therefore no net electron spin. The 1Δg is however paramagnetic as shown by the observation of an electron paramagnetic resonance (EPR) spectrum.[16][17][18] The paramagnetism of the 1Δg state is due to a net orbital (and not spin) electronic angular momentum. In a magnetic field the degeneracy of the ${\displaystyle M_{L}}$ levels is split into two levels with z projections of angular momenta +1ħ and −1ħ around the molecular axis. The magnetic transition between these levels gives rise to the ${\displaystyle g=1}$ EPR transition. ## Production Various methods for the production of singlet oxygen exist. Irradiation of oxygen gas in the presence of an organic dye as a sensitizer, such as rose bengal, methylene blue, or porphyrins—a photochemical method—results in its production.[19][9] Large steady state concentrations of singlet oxygen are reported from the reaction of triplet excited state pyruvic acid with dissolved oxygen in water. [20] Singlet oxygen can also be in non-photochemical, preparative chemical procedures. One chemical method involves the decomposition of triethylsilyl hydrotrioxide generated in situ from triethylsilane and ozone.[21] (C2H5)3SiH + O3 → (C2H5)3SiOOOH → (C2H5)3SiOH + O2(1Δg) Another method uses the aqueous reaction of hydrogen peroxide with sodium hypochlorite:[19] H2O2 + NaOCl → O2(1Δg) + NaCl + H2O A third method liberates singlet oxygen via phosphite ozonides, which are, in turn, generated in situ.[22] Phosphite ozonides will decompose to give singlet oxygen:[23] (RO)3P + O3 → (RO)3PO3 (RO)3PO3 → (RO)3PO + O2(1Δg) An advantage of this method is that it is amenable to non-aqueous conditions.[23] ## Reactions Singlet oxygen-based oxidation of citronellol. This is a net, but not a true ene reaction. Abbreviations, step 1: H2O2, hydrogen peroxide; Na2MoO4 (catalyst), sodium molybdate. Step 2: Na2SO3 (reducing agent), sodium sulfite. Because of differences in their electron shells, singlet and triplet oxygen differ in their chemical properties; singlet oxygen is highly reactive.[24] The lifetime of singlet oxygen depends on the medium. In normal organic solvents, the lifetime is only a few microseconds whereas in solvents lacking C-H bonds, the lifetime can be as long as seconds.[23] ### Organic chemistry Unlike ground state oxygen, singlet oxygen participates in Diels–Alder [4+2]- and [2+2]-cycloaddition reactions and formal concerted ene reactions.[23] It oxidizes thioethers to sulfoxides. Organometallic complexes are often degraded by singlet oxygen.[25][26] With some substrates 1,2-dioxetanes are formed; cyclic dienes such as 1,3-cyclohexadiene form [4+2] cycloaddition adducts.[27] The [4+2]-cycloaddition between singlet oxygen and furans is widely used in organic synthesis.[28][29] In singlet oxygen reactions with alkenic allyl groups, e.g., citronella, shown, by abstraction of the allylic proton, in an ene-like reaction, yielding the allyl hydroperoxide, R–O–OH (R = alkyl), which can then be reduced to the corresponding allylic alcohol.[23][30][31][32] In reactions with water trioxidane, an unusual molecule with three consecutive linked oxygen atoms, is formed.[citation needed] ## Biochemistry In photosynthesis, singlet oxygen can be produced from the light-harvesting chlorophyll molecules. One of the roles of carotenoids in photosynthetic systems is to prevent damage caused by produced singlet oxygen by either removing excess light energy from chlorophyll molecules or quenching the singlet oxygen molecules directly. In mammalian biology, singlet oxygen is one of the reactive oxygen species, which is linked to oxidation of LDL cholesterol and resultant cardiovascular effects. Polyphenol antioxidants can scavenge and reduce concentrations of reactive oxygen species and may prevent such deleterious oxidative effects.[33] Ingestion of pigments capable of producing singlet oxygen with activation by light can produce severe photosensitivity of skin (see phototoxicity, photosensitivity in humans, photodermatitis, phytophotodermatitis). This is especially a concern in herbivorous animals (see Photosensitivity in animals). Singlet oxygen is the active species in photodynamic therapy. ## Analytical and physical chemistry Red glow of singlet oxygen passing into triplet state.[citation needed] Direct detection of singlet oxygen is possible using sensitive laser spectroscopy [34][non-primary source needed] or through its extremely weak phosphorescence at 1270 nm, which is not visible.[35] However, at high singlet oxygen concentrations, the fluorescence of the singlet oxygen "dimol" species—simultaneous emission from two singlet oxygen molecules upon collision—can be observed as a red glow at 634 nm and 703 nm.[36][37] ## References 1. ^ Wayne RP (1969). "Singlet Molecular Oxygen". In Pitts JN, Hammond GS, Noyes WA (eds.). Advances in Photochemistry. 7. pp. 311–71. doi:10.1002/9780470133378.ch4. ISBN 9780470133378. Missing or empty `|title=` (help) 2. Klán P, Wirz J (2009). Photochemistry of Organic Compounds: From Concepts to Practice (Repr. 2010 ed.). Chichester, West Sussex, U.K.: Wiley. ISBN 978-1405190886. 3. Atkins P, de Paula J (2006). Atkins' Physical Chemistry (8th ed.). W.H.Freeman. pp. 482–3. ISBN 978-0-7167-8759-4. 4. ^ Hill C. "Molecular Term Symbols" (PDF). Retrieved 10 October 2016. 5. ^ Levine IN (1991). Quantum Chemistry (4th ed.). Prentice-Hall. p. 383. ISBN 978-0-205-12770-2. 6. ^ Frimer AA (1985). Singlet Oxygen: Volume I, Physical-Chemical Aspects. Boca Raton, Fla.: CRC Press. pp. 4–7. ISBN 9780849364396. 7. ^ For triplet ground state on right side of diagram, see C.E.Housecroft and A.G.Sharpe Inorganic Chemistry, 2nd ed. (Pearson Prentice-Hall 2005), p.35 ISBN 0130-39913-2 8. ^ For changes in singlet states on left and in centre, see F. Albert Cotton and Geoffrey Wilkinson. Advanced Inorganic Chemistry, 5th ed. (John Wiley 1988), p.452 ISBN 0-471-84997-9 9. ^ a b c Schweitzer C, Schmidt R (May 2003). "Physical Mechanisms of Generation and Deactivation of Singlet Oxygen". Chemical Reviews. 103 (5): 1685–757. doi:10.1021/cr010371d. PMID 12744692. 10. ^ a b c Weldon, Dean; Poulsen, Tina D.; Mikkelsen, Kurt V.; Ogilby, Peter R. (1999). "Singlet Sigma: The "Other" Singlet Oxygen in Solution". Photochemistry and Photobiology. 70 (4): 369–379. doi:10.1111/j.1751-1097.1999.tb08238.x. S2CID 94065922. 11. ^ Thomas Engel; Philip Reid (2006). Physical Chemistry. PEARSON Benjamin Cummings. p. 580. ISBN 978-0-8053-3842-3. 12. ^ Guy P. Brasseur; Susan Solomon (January 15, 2006). Aeronomy of the Middle Atmosphere: Chemistry and Physics of the Stratosphere and Mesosphere. Springer Science & Business Media. pp. 220–. ISBN 978-1-4020-3824-2. 13. ^ Physical Mechanisms of Generation and Deactivation of Singlet Oxygen Claude Schweitzer 14. ^ Wilkinson F, Helman WP, Ross AB (1995). "Rate constants for the decay and reactions of the lowest electronically excited singlet state of molecular oxygen in solution. An expanded and revised compilation". J. Phys. Chem. Ref. Data. 24 (2): 663–677. Bibcode:1995JPCRD..24..663W. doi:10.1063/1.555965. S2CID 9214506. 15. ^ Andrés M. Durantini (2021). "Interparticle Delivery and Detection of Volatile Singlet Oxygen at Air/Solid Interfaces". Environmental Science & Technology. 55 (6): 3559–3567. Bibcode:2021EnST...55.3559D. doi:10.1021/acs.est.0c07922. PMID 33660980. S2CID 232114444. 16. ^ Hasegawa K, Yamada K, Sasase R, Miyazaki R, Kikuchi A, Yagi M (2008). "Direct measurements of absolute concentration and lifetime of singlet oxygen in the gas phase by electron paramagnetic resonance". Chemical Physics Letters. 457 (4): 312–314. Bibcode:2008CPL...457..312H. doi:10.1016/j.cplett.2008.04.031. 17. ^ Ruzzi M, Sartori E, Moscatelli A, Khudyakov IV, Turro NJ (June 2013). "Time-resolved EPR study of singlet oxygen in the gas phase". The Journal of Physical Chemistry A. 117 (25): 5232–40. Bibcode:2013JPCA..117.5232R. CiteSeerX 10.1.1.652.974. doi:10.1021/jp403648d. PMID 23768193. 18. ^ Falick AM, et al. (1965). "Paramagnetic resonance spectrum of the 1?g oxygen molecule". J. Chem. Phys. 42 (5): 1837–1838. Bibcode:1965JChPh..42.1837F. doi:10.1063/1.1696199. S2CID 98040975. 19. ^ a b Greer A (2006). "Christopher Spencer Foote's Discovery of the Role of Singlet Oxygen [1O2 (1Δg)] in Photosensitized Oxidation Reactions". Acc. Chem. Res. 39 (11): 797–804. doi:10.1021/ar050191g. PMID 17115719. 20. ^ Eugene AJ, Guzman MI (September 2019). "Production of Singlet Oxygen (1O2) during the Photochemistry of Aqueous Pyruvic Acid: The Effects of pH and Photon Flux under Steady-State O2(aq) Concentration". Environmental Science and Technology. 53 (21): 12425–12432. Bibcode:2019EnST...5312425E. doi:10.1021/acs.est.9b03742. PMID 31550134. 21. ^ Corey EJ, Mehrotra MM, Khan AU (April 1986). "Generation of 1Δg from triethylsilane and ozone". Journal of the American Chemical Society. 108 (9): 2472–3. doi:10.1021/ja00269a070. PMID 22175617. 22. ^ Housecroft CE, Sharpe AG (2008). "Chapter 15: The group 16 elements". Inorganic Chemistry (3rd ed.). Pearson. p. 438f. ISBN 9780131755536. 23. Wasserman HH, DeSimone RW, Chia KR, Banwell MG (2001). "Singlet Oxygen". Encyclopedia of Reagents for Organic Synthesis. e-EROS Encyclopedia of Reagents for Organic Synthesis. John Wiley & Sons. doi:10.1002/047084289X.rs035. ISBN 978-0471936237. 24. ^ Ho RY, Liebman JF, Valentine JS (1995). "Overview of the Energetics and Reactivity of Oxygen". In Foote CS (ed.). Active Oxygen in Chemistry. London: Blackie Academic & Professional. pp. 1–23. doi:10.1007/978-94-007-0874-7_1. ISBN 978-0-7514-0371-8. 25. ^ Clennan EL, Pace A (2005). "Advances in singlet oxygen chemistry". Tetrahedron. 61 (28): 6665–6691. doi:10.1016/j.tet.2005.04.017. 26. ^ Ogilby PR (August 2010). "Singlet oxygen: there is indeed something new under the sun". Chemical Society Reviews. 39 (8): 3181–209. doi:10.1039/b926014p. PMID 20571680. 27. ^ Carey FA, Sundberg RJ (1985). Structure and mechanisms (2 ed.). New York: Plenum Press. ISBN 978-0306411984. 28. ^ Montagnon, T.; Kalaitzakis, D.; Triantafyllakis, M.; Stratakis, M.; Vassilikogiannakis, G. (2014). "Furans and Singlet Oxygen - Why There Is More to Come from this Powerful Partnership". Chemical Communications. 50 (98): 15480–15498. doi:10.1039/C4CC02083A. PMID 25316254. 29. ^ Ghogare, A.A.; Greer, A. (2016). "Using Singlet Oxygen to Synthesise Natural Products and Drugs". Chemical Reviews. 116 (17): 9994–10034. doi:10.1021/acs.chemrev.5b00726. PMID 27128098. 30. ^ Stephenson LM, Grdina MJ, Orfanopoulos M (November 1980). "Mechanism of the ene reaction between singlet oxygen and olefins". Accounts of Chemical Research. 13 (11): 419–425. doi:10.1021/ar50155a006. 31. ^ This reaction is not a true ene reaction, because it is not concerted; singlet oxygen forms an "epoxide oxide" exciplex, which then abstracts the hydrogen. See Alberti et al, op. cit. 32. ^ Alsters PL, Jary W, Nardello-Rataj V, Jean-Marie A (2009). "Dark Singlet Oxygenation of β-Citronellol: A Key Step in the Manufacture of Rose Oxide". Organic Process Research & Development. 14: 259–262. doi:10.1021/op900076g. 33. ^ Karp G, van der Geer P (2004). Cell and molecular biology: concepts and experiments (4th ed., Wiley International ed.). New York: J. Wiley & Sons. p. 223. ISBN 978-0471656654. 34. ^ Földes T, Čermák P, Macko M, Veis P, Macko P (January 2009). "Cavity ring-down spectroscopy of singlet oxygen generated in microwave plasma". Chemical Physics Letters. 467 (4–6): 233–236. Bibcode:2009CPL...467..233F. CiteSeerX 10.1.1.186.9272. doi:10.1016/j.cplett.2008.11.040.[non-primary source needed] 35. ^ Nosaka Y, Daimon T, Nosaka, AY, Murakami Y (2004). "Singlet oxygen formation in photocatalytic TiO₂ aqueous suspension". Phys. Chem. Chem. Phys. 6 (11): 2917–2918. Bibcode:2004PCCP....6.2917N. doi:10.1039/B405084C. 36. ^ Mulliken RS (1928). "Interpretation of the atmospheric oxygen bands; electronic levels of the oxygen molecule". Nature. 122 (3075): 505. Bibcode:1928Natur.122..505M. doi:10.1038/122505a0. S2CID 4105859.[better source needed] 37. ^ Chou, Pi-Tai; Wei, Guor-Tzo; Lin, Chih-Hung; Wei, Ching-Yen; Chang, Chie-Hung (1996-01-01). "Direct Spectroscopic Evidence of Photosensitized O2 765 nm (1Σ+g → 3Σ-g) and O2 Dimol 634 and 703 nm ((1Δg)2 → (3Σ-g)2) Vibronic Emission in Solution". Journal of the American Chemical Society. 118 (12): 3031–3032. doi:10.1021/ja952352p. ISSN 0002-7863.
2021-11-26 23:43:37
{"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.8484597206115723, "perplexity": 11071.389468070674}, "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/1637964358074.14/warc/CC-MAIN-20211126224056-20211127014056-00219.warc.gz"}
http://openstudy.com/updates/55a1b21ce4b05670bbb51c33
## A community for students. Sign up today Here's the question you clicked on: ## anonymous one year ago If sin theta=3/5 and theta is in quad 2 the exact form of csc (pi/2-theta) is...? Tried figuring out this before lets try this again • This Question is Closed 1. campbell_st why not post you best effort...? 2. anonymous Which I did and you clearly said my solution made no sense as well as your explanations @campbell_st and if you look back at my previous questions I have solved them myself with actual help 3. campbell_st ok... here is a really simply start, below is a right triangle |dw:1436660262409:dw| what is the size of x, and how did you calculate it 4. campbell_st this idea, may seem trivial, but it is the key to being able to solve this problem... here is another question in terms of radians |dw:1436660476966:dw| 5. campbell_st here is how these 2 questions apply to your question |dw:1436660720512:dw||dw:1436660750360:dw| 6. campbell_st so drawing a diagram of your question |dw:1436660808410:dw| remembering you are on the number plane, what is the size of a, it can be found using pythagoras' theorem... 7. campbell_st then tell me what is the size of angle x..? 8. campbell_st describe angle x in term so a size... $x = \frac{\pi}{2} - ....?$ 9. anonymous See? this gets me nowhere what kind of math is this? Nowhere did the previous helpers show me frickn triangles and angles I didnt ask the question again to get the same response @campbell_st 10. campbell_st well to get a solution you need to work through it... Open Study isn't about giving people answers to questions... its about help with understanding. And just to put the question is persective... this is at the high end of difficulty for right triangle trigonometry questions... there are several steps and several concepts that are needed to solve it... concept 1 in a right triangle you have 1 angle = 90 or pi/2 so the other 2 angles must add to 90 or pi/2 is 1 angle is x then the other angle has to be 90 - x or pi/2 - x this seems to be an idea you don't understand |dw:1436661501625:dw| does that make sense...? 11. campbell_st and the next task is to show the angle in the 2nd quadrant.... because that's what you are asked to do... using the fact that sin = 3/5 so if you form a triangle, what is the measure of the other side..? 12. anonymous Nobody just gave me the answer they helped me through telling me what was right or wrong so openstudy doesn't work like that obviously. @campbell_st and what I said before isn't it -4/5 the other side 13. campbell_st my advice for trigonometry is to 1 draw a diagram |dw:1436662047521:dw| 2. use the basic ratios sin cos and tan what is the value of $\sin(\frac{\pi}{2} - \theta) = ..?$ 14. anonymous Forget it I'm done please don't answer this question again if I post it because this is the second time I got nothing 15. campbell_st ok... I'll leave it.... but I'd suggest you learn about the complementary angle in a triangle... as its the key to this question.... and If you were able to find $\sin(\frac{\pi}{2} - \theta) = ...?$ then all you need to do is take the reciprocal to find $\csc(\frac{\pi}{2} - \theta)$ as an exact value.... so good luck... 16. anonymous What the heck is theta anyways? I don't know what theta even is 17. campbell_st I'll let someone else answer that for you #### Ask your own question Sign Up Find more explanations on OpenStudy Privacy Policy
2016-10-27 01:29: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.6508774161338806, "perplexity": 916.4940746794339}, "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-2016-44/segments/1476988721027.15/warc/CC-MAIN-20161020183841-00349-ip-10-171-6-4.ec2.internal.warc.gz"}
https://marcossilva.github.io/en/2020/09/04/coursera-nlp-module-1-week-3.html
## Cosine Similarity • Vector Norm $||\overrightarrow{v}|| = \sqrt{\sum_{i=1}^n v_i^2}$ • Dot Product $\overrightarrow{v} . \overrightarrow{w} = \sum_{i=1}^n v_i . w_i$ • $\overrightarrow{v} . \overrightarrow{w} = || \overrightarrow{v}|| \: ||\overrightarrow{w}|| cos(\beta)$ • $cos(\beta) = \frac{\overrightarrow{v} . \overrightarrow{w}}{|| \overrightarrow{v}|| \: ||\overrightarrow{w}||}$ When $\beta$ is 90º the vector are maximal dissimilar, when it’s 0º the vectors are most similar and have cossine 1. ## Manipulating Words in Vector Spaces Given a trained vector space you can use a learnt representation to obtain new knowledge. Vectors of the words that occur in similar places in the sentence will be encoded in a similar way. You can take advantage of this type of consistency encoding to identify patterns. ## Visualization and PCA With PCA we can visualize higher dimension vector in 2 or 3 dimensions. PCA is an algorithm used for dimensionality reduction that can find uncorrelated features for your data. It’s very helpful for visualizing your data to check if your representation is capturing relationships among words. ## PCA Algorithm • Eigenvector (Autovetor): Uncorrelated features for your data • Eigenvalue (Autovalor): the amount of information retained by each feature
2021-06-24 21:12: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": 3, "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.6991791725158691, "perplexity": 1633.4239639567088}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 20, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-25/segments/1623488559139.95/warc/CC-MAIN-20210624202437-20210624232437-00042.warc.gz"}
https://japorized.ink/math/weierstrass-continuity/
08 Apr 2019  0 We look into a weird consequence of the definition of continuity given by Karl Weierstrass. We know that there are certain definitions and results in mathematics that lead to unintuitive consequences, some mild, which just requires a bit of tweak in perspective, and others straight up mind-boggling. I came across one of the former today, See MathSE. which initially shoke me so much I felt like a truck hit me and had almost sent me down a very badly-timed existential crisis This is a few days right before an important exam. . I will not review what Weierstrass continuity means first, but hint that it is the definition of continuity that uses $\epsilon$’s and $\delta$’s. If you are not familiar with it, this post will be uninteresting if you follow the sequence of the writing, so look downwards for the definition of Weierstrass continuity. If you are aware of the definition, follow along. Graph of f(x) Consider the function $f : [0, 1) \cup [2, 3] \to [0, 2]$ given by $f(x) = \begin{cases} x & x \in [0, 1) \\ x - 1 & x \in [2, 3] \end{cases}$ The graph of $f(x)$ is shown to the right. This map looks discontinuous alright, but is it really discontinuous? Consider $c = 2$. Let $\epsilon > 0$. Let us focus on left continuity at $c$, since that is the point that disturbs us. Let us choose $\delta = 1 + \epsilon > 0$. Now for any $y \in [0, 1) \cup [2, 3]$, since we are focusing on left continuity, we know that $f(y) = y$. Now if $|c - y| = 2 - y < \delta$, we have that $1 - y < \epsilon$. Then, observe that $|f(2) - f(y)| = 1 - y < \epsilon.$ By definition, $f$ is indeed continuous at $c = 2$. The keen and trained eye would immediately recognize where things have went wrong, but the innocent will most likely exclaim, “Hold up! WTF!?” I shall now present the definition the Weierstrass’ definition of continuity. ## Definition of Weierstrass Continuity Weierstrass’ flavour of continuity is one that those who have taken a serious course in Calculus should be familiar with. Let $f : X \to Y$ be a function between two (metric) spaces (or just sets) $X$ and $Y$, and let $x \in X$. We (Weierstrass) say(s) that $f$ is continuous on $x$ if $\forall \epsilon > 0 \enspace \exists \delta > 0 \enspace \forall y \in X$ $|x - y| < \delta \implies |f(x) - f(y)| < \epsilon$ ## Problem Analysis The problem lies in that misleading graph: the domain of $f(x)$ is a disjoint union, not a single “connected set” Connectedness is important in analysis. It is actually non-trivial to define what it means for a set to be connected. Here is a relevant article about connectedness. . Therefore, the usual Cartesian plane is not a good representation of the graph. In particular, we would have to truncate the area between 1 and 2, and one would then immediately notice (or at least agree) that $f$ is indeed continuous. Of course, the choice of $\delta$ is particularly awkward: it is not applicable to the right side of $c = 2$, since $y = 3$, in particular, would not work for $\epsilon = 0.2 > 0$. This is a consequence of assuming the usual sense of distance between points, or metric, on the real numbers $\mathbb{R}$ (and its subsets). To make things work nicely again, i.e. to be able to choose a nicer $\delta$ that works on both sides, we would either have to define a new metric, or we can “identify” everything between 1 and 2 as simply 2. In other words, we are looking at a world where $0 + 1 = 2$. Note that there is no problem in embedding the graph $f$ onto the usual Cartesian plane. It still helps us visualize how the function looks like on the usual world in our normal sense of distances. ## Conclusion Weierstrass’ definition of continuity transcends our usual sense of distance and even rectified itself, to some extent, in this particular example. I now have newfound appreciation and respect for the thought that has gone into this way of thinking about continuity. - Japorized -
2022-05-21 22:44:06
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 4, "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.9545524716377258, "perplexity": 319.0261321336105}, "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/1652662541747.38/warc/CC-MAIN-20220521205757-20220521235757-00574.warc.gz"}
https://questioncove.com/updates/4fc124b4e4b0964abc831439
Mathematics OpenStudy (anonymous): Solve: x^2 - 7x = -12 6 years ago OpenStudy (anonymous): use middle term factor process 6 years ago OpenStudy (anonymous): Got it! =5 and 4 6 years ago OpenStudy (anonymous): no, 3 and 4 check it out again 6 years ago OpenStudy (pfenn1): $x^2-7x+12=0$Can either factor or might be just as easy to use the quadratic equation.$ax^2+bx+c=0$$x=\frac{-b \pm \sqrt{b^2-4ac}}{2a}$ 6 years ago OpenStudy (anonymous): apply the concept correctly 6 years ago Parth (parthkohli): Add 12 to both sides. $$\Large \color{MidnightBlue}{\Rightarrow x^2 - 7x + 12 }$$ A quadratic equation is ax^2 + bx + c = 0 According to that, the formula is: $$\Large \color{MidnightBlue}{\Rightarrow x = {-b \pm \sqrt{b^2 - 4ab} \over 2a} }$$ 6 years ago OpenStudy (anonymous): Here's a nother problem i'm not sure on... Quadratic equations can be solved using the quadratic formula... Always, sometimes, or never.. I think its sometimes 6 years ago OpenStudy (anonymous): 6 years ago Parth (parthkohli): Always...they can be....unless there's no solution 6 years ago OpenStudy (anonymous): always there is solution.. no unless is there thing is that the roots may be real or imaginary depending on the equation 6 years ago Parth (parthkohli): No solution here means no real solution. There may be a complex one. 6 years ago OpenStudy (anonymous): but if a particular set is specified, then the answer will be 'sometimes' 6 years ago OpenStudy (anonymous): 6 years ago OpenStudy (anonymous): i got the answer x = -2 + or - √32 all over 2 6 years ago Parth (parthkohli): There's always the quadratic formula :D 6 years ago OpenStudy (anonymous): use the quadratic formula again...... simple 6 years ago Parth (parthkohli): You can look at wolframalpha to check it. 6 years ago OpenStudy (anonymous): i got the answer x = -2 + or - √32 all over 2 6 years ago Latest Questions eviant: Math help pls 2 hours ago 15 Replies 0 Medals katkit25: if you pollute you ruin homes of creatures such as 6 hours ago 4 Replies 0 Medals Val050301: What theorem or postulate can be used to justify that HIG=FIE? 7 hours ago 2 Replies 1 Medal johnnn: https://prnt.sc/n1x9uo 1 hour ago 4 Replies 1 Medal eviant: Math help pls 8 hours ago 10 Replies 1 Medal eviant: Math help pls 21 hours ago 5 Replies 1 Medal eviant: Math help pls 21 hours ago 16 Replies 1 Medal eviant: Math help pls 22 hours ago 9 Replies 3 Medals
2019-03-24 01:00: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.5303073525428772, "perplexity": 12527.683185365691}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 20, "end_threshold": 5, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-13/segments/1552912203123.91/warc/CC-MAIN-20190324002035-20190324024035-00432.warc.gz"}
https://math.stackexchange.com/questions/1104812/dual-of-tensor-of-vector-spaces
# dual of tensor of vector spaces Question regarding tensor products. Is this argument correct? Let $b(V,\mathbb{R})$ be the vector space (in the natural way) of real valued bi-linear forms on the finite dimensional vector space $V$. By the universal property of the tensor product, each $b\in b(V,\mathbb{R})$ corresponds uniquely to a $\bar b\in (V\otimes V)^*$. I.e there exists $g$ such that $\bar b\circ g=b$, in fact $g(v,w)=v\otimes w$. The map $b\rightarrow \bar b$ is an isomorphism since it is injective by the universal property and the dimension of the two spaces are the same. Does this holds in general, i.e if $V$ is an arbitrary $R$-module and $b(V,R)$ denotes the $R-$module of $R$-bilinear maps from $V$ to $R$, and $(V\otimes V)^*$ is the $R$-module of $R$-linear maps from $V\otimes V$ to $R$ are these $R$-modules isomorphic? I.e how do one shows surjectivity? One way to prove something is an isomorphism is to construct an inverse. By definition of the tensor product, for every $R$-bilinear map $b:V\times V\to R$ there is a unique homomorphism $\overline{b}:V\otimes_R V\to R$ such that composing $\overline{b}$ with the universal bilinear map $t:V\times V\to V\otimes_R V$ yields $b$, i. e. $b=\overline{b}\circ t$. Mapping $b\to \overline{b}$ gives a homomorphism from the module of bilinear maps $V\times V\to R$ into $\hom(V\otimes V,R)$. To construct an inverse, choose $c\in \hom(V\otimes V,R)$. Then we simply map $c$ to $c\circ t$, where again $t:V\times V\to V\otimes_R V$ is the universal bilinear map characterizing the tensor product. The fact that these constructions are inverses of each other follows from the universal property.
2021-09-24 16:25: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.997448205947876, "perplexity": 73.85404891439323}, "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/1631780057558.23/warc/CC-MAIN-20210924140738-20210924170738-00685.warc.gz"}
http://www.docme.ru/doc/118324/matlab-graphics
Забыли? ? # Matlab Graphics код для вставкиСкачать Computation Visualization Programming Using MATLAB Graphics Version 6 M ATLAB ® The Language of Technical Computing How to Contact The MathWorks: www.mathworks.com Web comp.soft-sys.matlab Newsgroup support@mathworks.com Technical support suggest@mathworks.com Product enhancement suggestions bugs@mathworks.com Bug reports doc@mathworks.com Documentation error reports service@mathworks.com info@mathworks.com Sales, pricing, and general information 508-647-7000 Phone 508-647-7001 Fax The MathWorks, Inc.Mail 3 Apple Hill Drive Natick, MA 01760-2098 For contact information about worldwide offices, see the MathWorks Web site. Using MATLAB Graphics © COPYRIGHT 1984 - 2002 by The MathWorks, Inc. The software described in this document is furnished under a license agreement. The software may be used or copied only under the terms of the license agreement. No part of this manual may be photocopied or repro- duced in any form without prior written consent from The MathWorks, Inc. FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation by or for the federal government of the United States. By accepting delivery of the Program, the government hereby agrees that this software qualifies as "commercial" computer software within the meaning of FAR Part 12.212, DFARS Part 227.7202-1, DFARS Part 227.7202-3, DFARS Part 252.227-7013, and DFARS Part 252.227-7014. The terms and conditions of The MathWorks, Inc. Software License Agreement shall pertain to the government’s use and disclosure of the Program and Documentation, and shall supersede any conflicting contractual terms or conditions. If this license fails to meet the government’s minimum needs or is inconsistent in any respect with federal procurement law, the government agrees to return the Program and Documentation, unused, to MathWorks. MATLAB, Simulink, Stateflow, Handle Graphics, and Real-Time Workshop are registered trademarks, and TargetBox is a trademark of The MathWorks, Inc. Other product or brand names are trademarks or registered trademarks of their respective holders. Printing History:January 1997 First printing New for MATLAB 5.1 January 1998 Second printing Revised for MATLAB 5.2 January 1999 Third printing Revised for MATLAB 5.3 (Release 11) September 2000 Fourth printing Revised for MATLAB 6.0 (Release 12) June 2001 Online only Revised for MATLAB 6.1 (Release 12.1) July 2002 Online only Revised for MATLAB 6.5 (Release 13) i Contents Graphics 1 Overview of MATLAB Graphics Plotting Your Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2 Anatomy of a Plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3 Editing Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4 Interactive Plot Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4 Using Functions to Edit Graphs . . . . . . . . . . . . . . . . . . . . . . . . . 1-4 Using Plot Edit Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5 Starting Plot Edit Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6 Exiting Plot Edit Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6 Selecting Objects in a Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6 Cutting, Copying, and Pasting Objects . . . . . . . . . . . . . . . . . . . 1-7 Moving and Resizing Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-7 Editing Objects in a Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-8 Saving Your Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-9 Saving a Graph in MAT-File Format . . . . . . . . . . . . . . . . . . . . . 1-9 Saving to a Different Format (Exporting Figures) . . . . . . . . . 1-10 Printing Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-10 Getting Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-12 Changing Your View of an Axes . . . . . . . . . . . . . . . . . . . . . . . 1-13 Zooming In and Out on an Axes . . . . . . . . . . . . . . . . . . . . . . . . 1-13 Rotating 3-D Axes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-14 Using the Property Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-15 Starting the Property Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-16 ii Contents Closing the Property Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-17 Editing Object Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-17 Navigating Among Objects in a Graph . . . . . . . . . . . . . . . . . . . 1-18 Identifying Objects in a Graph . . . . . . . . . . . . . . . . . . . . . . . . . 1-20 Applying Your Changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-21 Using the Data Statistics Tool . . . . . . . . . . . . . . . . . . . . . . . . 1-22 Adding Plots of Statistics to a Graph . . . . . . . . . . . . . . . . . . . . 1-22 Saving Statistics to the Workspace . . . . . . . . . . . . . . . . . . . . . . 1-23 2 Basic Plotting Basic Plotting Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2 Creating Line Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2 Specifying Line Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4 Specifying the Color and Size of Lines . . . . . . . . . . . . . . . . . . . . 2-6 Adding Plots to an Existing Graph . . . . . . . . . . . . . . . . . . . . . . . 2-7 Plotting Only the Data Points . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8 Plotting Markers and Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9 Line Styles for Black and White Output . . . . . . . . . . . . . . . . . 2-10 Setting Default Line Styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-11 Line Plots of Matrix Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-13 Plotting Imaginary and Complex Data . . . . . . . . . . . . . . . . . 2-15 Plotting with Two Y-Axes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-16 Combining Linear and Logarithmic Axes . . . . . . . . . . . . . . . . . 2-16 Setting Axis Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-19 Axis Limits and Ticks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-19 Example – Specifying Ticks and Tick Labels . . . . . . . . . . . . . . 2-22 Setting Aspect Ratio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-23 Figure Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-26 Displaying Multiple Plots per Figure . . . . . . . . . . . . . . . . . . . . 2-26 iii Specifying the Target Axes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-28 Default Color Scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-28 3 Formatting Graphs Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2 Adding Titles to Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3 Using the Title Option on the Insert Menu . . . . . . . . . . . . . . . . 3-3 Using the Property Editor to Add a Title . . . . . . . . . . . . . . . . . . 3-4 Using the title Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5 Adding Legends to Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6 Using the Legend Option on the Insert Menu . . . . . . . . . . . . . . 3-7 Using the Legend Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7 Positioning the Legend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8 Editing the Legend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9 Removing the Legend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-10 Adding Axis Labels to Graphs . . . . . . . . . . . . . . . . . . . . . . . . . 3-11 Using the Label Options on the Insert Menu . . . . . . . . . . . . . . 3-12 Using the Property Editor to Add Axis labels . . . . . . . . . . . . . 3-12 Using Axis-Label Commands . . . . . . . . . . . . . . . . . . . . . . . . . . 3-15 Adding Text Annotations to Graphs . . . . . . . . . . . . . . . . . . . . 3-17 Creating Text Annotations in Plot Editing Mode . . . . . . . . . . 3-18 Creating Text Annotations with the text or gtext Command . 3-18 Text Alignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-22 Example – Aligning Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-23 Editing Text Annotations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-24 Mathematical Symbols, Greek Letters, and TeX Characters . 3-25 Using Character and Numeric Variables in Text . . . . . . . . . . 3-27 Example - Multiline Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-28 Drawing Text in a Box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-29 Adding Arrows and Lines to Graphs . . . . . . . . . . . . . . . . . . . 3-31 iv Contents Creating Arrows and Lines in Plot Editing Mode . . . . . . . . . . 3-31 Editing Arrows and Line Annotations . . . . . . . . . . . . . . . . . . . 3-32 Adding Plots of Basic Statistics to Graphs . . . . . . . . . . . . . . 3-33 Example - Plotting the Mean of a Data Set . . . . . . . . . . . . . . . 3-34 Formatting Plots of Data Statistics . . . . . . . . . . . . . . . . . . . . . 3-36 Statistics Plotted by the Data Statistics Tool . . . . . . . . . . . . . . 3-36 Viewing Statistics for Multiple Plots . . . . . . . . . . . . . . . . . . . . 3-37 Saving Statistics to the MATLAB Workspace . . . . . . . . . . . . . 3-38 4 Creating Specialized Plots Bar and Area Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2 Types of Bar Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2 Stacked Bar Graphs to Show Contributing Amounts . . . . . . . . 4-5 Specifying X-Axis Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7 Overlaying Plots on Bar Graphs . . . . . . . . . . . . . . . . . . . . . . . . . 4-9 Area Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-11 Comparing Datasets with Area Graphs . . . . . . . . . . . . . . . . . . 4-12 Pie Charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-14 Removing a Piece from a Pie Charts . . . . . . . . . . . . . . . . . . . . . 4-16 Histograms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-17 Histograms in Cartesian Coordinate Systems . . . . . . . . . . . . . 4-17 Histograms in Polar Coordinates . . . . . . . . . . . . . . . . . . . . . . . 4-19 Specifying Number of Bins . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-20 Discrete Data Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-22 Two–Dimensional Stem Plots . . . . . . . . . . . . . . . . . . . . . . . . . . 4-22 Combining Stem Plots with Line Plots . . . . . . . . . . . . . . . . . . . 4-25 Three-Dimensional Stem Plots . . . . . . . . . . . . . . . . . . . . . . . . . 4-26 Stairstep Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-29 Direction and Velocity Vector Graphs . . . . . . . . . . . . . . . . . . 4-31 Compass Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-31 v Feather Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-32 Two-Dimensional Quiver Plots . . . . . . . . . . . . . . . . . . . . . . . . . 4-34 Three-Dimensional Quiver Plots . . . . . . . . . . . . . . . . . . . . . . . . 4-35 Contour Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-37 Creating Simple Contour Plots . . . . . . . . . . . . . . . . . . . . . . . . . 4-37 Labeling Contours . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-39 Filled Contours . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-40 Drawing a Single Contour Line at a Desired Level . . . . . . . . . 4-41 The Contouring Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-42 Changing the Offset of a Contour . . . . . . . . . . . . . . . . . . . . . . . 4-43 Displaying Contours in Polar Coordinates . . . . . . . . . . . . . . . . 4-44 Interactive Plotting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-48 Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-50 Movies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-50 Example – Visualizing an FFT as a Movie . . . . . . . . . . . . . . . . 4-51 Erase Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-52 5 Displaying Bit-Mapped Images Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2 Images in MATLAB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4 Bit Depth Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4 Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4 Image Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-6 Indexed Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-6 Intensity Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-7 RGB (Truecolor) Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-9 Working with 8-Bit and 16-Bit Images . . . . . . . . . . . . . . . . . . 5-11 8-Bit and 16-Bit Indexed Images . . . . . . . . . . . . . . . . . . . . . . . 5-11 8-Bit and 16-Bit Intensity Images . . . . . . . . . . . . . . . . . . . . . . 5-12 vi Contents 8-Bit and 16-Bit RGB Images . . . . . . . . . . . . . . . . . . . . . . . . . . 5-12 Mathematical Operations Support for uint8 and uint16 . . . . . 5-13 Other 8-Bit and 16-Bit Array Support . . . . . . . . . . . . . . . . . . . 5-13 Summary of Image Types and Numeric Classes . . . . . . . . . . . 5-14 Reading, Writing, and Querying Graphics Image Files . . . 5-15 Reading a Graphics Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-15 Writing a Graphics Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-16 Obtaining Information About Graphics Files . . . . . . . . . . . . . 5-16 Displaying Graphics Images . . . . . . . . . . . . . . . . . . . . . . . . . . 5-18 Summary of Image Types and Display Methods . . . . . . . . . . . 5-19 Controlling Aspect Ratio and Display Size . . . . . . . . . . . . . . . . 5-19 The Image Object and Its Properties . . . . . . . . . . . . . . . . . . . 5-23 CData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-23 CDataMapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-23 XData and YData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-24 EraseMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-26 Printing Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-28 Converting the Data or Graphic Type of Images . . . . . . . . 5-29 6 Printing and Exporting Overview of Printing and Exporting . . . . . . . . . . . . . . . . . . . . 6-2 Print and Export Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2 Graphical User Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2 Command Line Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-3 Specifying Parameters and Options . . . . . . . . . . . . . . . . . . . . . . 6-5 Default Settings and How to Change Them . . . . . . . . . . . . . . . . 6-6 How to Print or Export . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-9 Printing a Figure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-9 Printing to a File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-13 vii Exporting to a File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-15 Exporting to the Windows Clipboard . . . . . . . . . . . . . . . . . . . . 6-20 Examples of Basic Operations . . . . . . . . . . . . . . . . . . . . . . . . . 6-23 Printing a Figure at Screen Size . . . . . . . . . . . . . . . . . . . . . . . . 6-23 Printing with a Specific Paper Size . . . . . . . . . . . . . . . . . . . . . . 6-24 Printing a Centered Figure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-25 Exporting in a Specific Graphics Format . . . . . . . . . . . . . . . . . 6-26 Exporting in EPS Format with a TIFF Preview . . . . . . . . . . . 6-27 Exporting a Figure to the Clipboard . . . . . . . . . . . . . . . . . . . . . 6-28 Changing a Figure’s Settings . . . . . . . . . . . . . . . . . . . . . . . . . . 6-31 Selecting the Figure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-33 Selecting the Printer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-33 Setting the Figure Size and Position . . . . . . . . . . . . . . . . . . . . 6-34 Setting the Paper Size or Type . . . . . . . . . . . . . . . . . . . . . . . . . 6-38 Setting the Paper Orientation . . . . . . . . . . . . . . . . . . . . . . . . . . 6-39 Selecting a Renderer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-41 Setting the Resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-44 Setting the Axes Ticks and Limits . . . . . . . . . . . . . . . . . . . . . . 6-47 Setting the Background Color . . . . . . . . . . . . . . . . . . . . . . . . . . 6-49 Setting Line and Text Characteristics . . . . . . . . . . . . . . . . . . . 6-50 Setting the Line and Text Color . . . . . . . . . . . . . . . . . . . . . . . . 6-52 Setting CMYK Color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-54 Excluding User Interface Controls . . . . . . . . . . . . . . . . . . . . . . 6-55 Producing Uncropped Figures . . . . . . . . . . . . . . . . . . . . . . . . . . 6-55 Choosing a Graphics Format . . . . . . . . . . . . . . . . . . . . . . . . . . 6-57 Frequently Used Graphics Formats . . . . . . . . . . . . . . . . . . . . . 6-58 Factors to Consider in Choosing a Format . . . . . . . . . . . . . . . . 6-59 Properties Affected by Choice of Format . . . . . . . . . . . . . . . . . 6-61 Impact of Rendering Method on the Output . . . . . . . . . . . . . . 6-63 Description of Selected Graphics Formats . . . . . . . . . . . . . . . . 6-63 How to Specify a Format for Exporting . . . . . . . . . . . . . . . . . . 6-66 Choosing a Printer Driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-68 Types of Printer Drivers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-68 Factors to Consider in Choosing a Driver . . . . . . . . . . . . . . . . . 6-69 Driver-Specific Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-72 How to Specify the Printer Driver to Use . . . . . . . . . . . . . . . . . 6-76 viii Contents Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-78 Printing Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-79 Exporting Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-82 General Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-86 7 Handle Graphics Objects Graphics Object Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2 Types of Graphics Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-3 Handle Graphics Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4 Object Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-8 Changing Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-8 Default Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-8 Properties Common to All Objects . . . . . . . . . . . . . . . . . . . . . . . 7-9 Graphics Object Creation Functions . . . . . . . . . . . . . . . . . . . 7-11 Example — Creating Graphics Objects . . . . . . . . . . . . . . . . . . 7-12 Parenting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-14 High-Level Versus Low-Level . . . . . . . . . . . . . . . . . . . . . . . . . . 7-14 Simplified Calling Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-15 Setting and Querying Property Values . . . . . . . . . . . . . . . . . 7-17 Setting Property Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-17 Querying Property Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-19 Factory-Defined Property Values . . . . . . . . . . . . . . . . . . . . . . . 7-21 Setting Default Property Values . . . . . . . . . . . . . . . . . . . . . . . 7-22 How MATLAB Searches for Default Values . . . . . . . . . . . . . . . 7-22 Defining Default Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-24 Examples — Setting Default LineStyles . . . . . . . . . . . . . . . . . 7-25 Accessing Object Handles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-29 The Current Figure, Axes, and Object . . . . . . . . . . . . . . . . . . . 7-29 Searching for Objects by Property Values — findobj . . . . . . . . 7-31 ix Copying Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-32 Deleting Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-34 Controlling Graphics Output . . . . . . . . . . . . . . . . . . . . . . . . . . 7-36 Specifying the Target for Graphics Output . . . . . . . . . . . . . . . 7-36 Preparing Figures and Axes for Graphics . . . . . . . . . . . . . . . . 7-36 Targeting Graphics Output with newplot . . . . . . . . . . . . . . . . 7-38 Example — Using newplot . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-39 Testing for Hold State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-41 Protecting Figures and Axes . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-42 The Close Request Function . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-44 Handle Validity Versus Handle Visibility . . . . . . . . . . . . . . . . 7-45 Saving Handles in M-Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-47 Properties Changed by Built-In Functions . . . . . . . . . . . . . 7-48 Callback Properties for Graphics Objects . . . . . . . . . . . . . . 7-51 Graphics Object Callbacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-51 Uicontrol, Uimenu, and Uicontextmenu Callbacks . . . . . . . . . 7-51 Figures Callbacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-51 Function Handle Callbacks . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-53 Function Handle Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-53 Why Use Function Handle Callbacks . . . . . . . . . . . . . . . . . . . . 7-54 Example — Using Function Handles in a GUI . . . . . . . . . . . . 7-56 8 Figure Properties Figure Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2 Positioning Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-3 The Position Vector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-3 Example – Specifying Figure Position . . . . . . . . . . . . . . . . . . . . 9-5 Controlling How MATLAB Uses Color . . . . . . . . . . . . . . . . . . 9-7 x Contents Indexed Color Displays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-7 Colormap Colors and Fixed Colors . . . . . . . . . . . . . . . . . . . . . . . 9-8 Using a Large Number of Colors . . . . . . . . . . . . . . . . . . . . . . . . . 9-9 Nonactive Figures and Shared Colors . . . . . . . . . . . . . . . . . . . 9-11 Dithering Truecolor on Indexed Color Systems . . . . . . . . . . . . 9-12 Selecting Drawing Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-15 Backing Store . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-15 Double Buffering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-15 Selecting a Renderer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-16 Specifying the Figure Pointer . . . . . . . . . . . . . . . . . . . . . . . . . 9-18 Defining Custom Pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-19 Interactive Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-23 9 Axes Properties Axes Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2 Labeling and Appearance Properties . . . . . . . . . . . . . . . . . . . 8-3 Creating Axes with Specific Characteristics . . . . . . . . . . . . . . . 8-3 Positioning Axes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-5 The Position Vector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-5 Position Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-6 Multiple Axes per Figure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-7 Placing Text Outside the Axes . . . . . . . . . . . . . . . . . . . . . . . . . . 8-7 Multiple Axes for Different Scaling . . . . . . . . . . . . . . . . . . . . . . 8-8 Individual Axis Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-10 Setting Axis Limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-11 Setting Tick Mark Locations . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-12 Changing Axis Direction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-13 xi Using Multiple X and Y Axes . . . . . . . . . . . . . . . . . . . . . . . . . . 8-16 Example – Double Axis Graphs . . . . . . . . . . . . . . . . . . . . . . . . . 8-16 Automatic-Mode Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-19 Colors Controlled by Axes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-22 Specifying Axes Colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-22 Axes Color Limits – The CLim Property . . . . . . . . . . . . . . . . . 8-25 Example – Simulating Multiple Colormaps in a Figure . . . . . 8-25 Calculating Color Limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-26 Defining the Color of Lines for Plotting . . . . . . . . . . . . . . . . . . 8-29 Line Styles Used for Plotting – LineStyleOrder . . . . . . . . . . . . 8-31 3-D Visualization 10 Creating 3-D Graphs A Typical 3-D Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2 Line Plots of 3-D Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-3 Representing a Matrix as a Surface . . . . . . . . . . . . . . . . . . . . 10-5 Mesh and Surface Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-5 Visualizing Functions of Two Variables . . . . . . . . . . . . . . . . . . 10-6 Surface Plots of Nonuniformly Sampled Data . . . . . . . . . . . . . 10-8 Parametric Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-10 Hidden Line Removal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-12 Coloring Mesh and Surface Plots . . . . . . . . . . . . . . . . . . . . . 10-13 Coloring Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-13 Types of Color Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-13 Colormaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-14 Indexed Color Surfaces – Direct and Scaled Colormapping . 10-16 Example – Mapping Surface Curvature to Color . . . . . . . . . . 10-17 xii Contents Altering Colormaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-19 Truecolor Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-20 Texture Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-23 11 Defining the View Viewing Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-2 Positioning the Viewpoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-2 Setting the Aspect Ratio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-2 Default Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-3 Setting the Viewpoint with Azimuth and Elevation . . . . . 11-4 Azimuth and Elevation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-4 Defining Scenes with Camera Graphics . . . . . . . . . . . . . . . . 11-8 View Control with the Camera Toolbar . . . . . . . . . . . . . . . . 11-9 Camera Toolbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-9 Camera Motion Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-12 Orbit Camera . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-12 Orbit Scene Light . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-13 Pan/Tilt Camera . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-14 Move Camera Horizontally/Vertically . . . . . . . . . . . . . . . . . . 11-15 Move Camera Forward and Backwards . . . . . . . . . . . . . . . . . 11-16 Zoom Camera . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-17 Camera Roll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-18 Walk Camera . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-19 Camera Graphics Functions . . . . . . . . . . . . . . . . . . . . . . . . . 11-21 Example — Dollying the Camera . . . . . . . . . . . . . . . . . . . . . 11-22 Example — Moving the Camera Through a Scene . . . . . . 11-24 Summary of Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-24 Graphing the Volume Data . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-24 Setting Up the View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-25 xiii Specifying the Light Source . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-25 Selecting a Renderer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-26 Defining the Camera Path as a Stream Line . . . . . . . . . . . . . 11-26 Implementing the Fly-Through . . . . . . . . . . . . . . . . . . . . . . . . 11-26 Low-Level Camera Properties . . . . . . . . . . . . . . . . . . . . . . . . 11-30 Default Viewpoint Selection . . . . . . . . . . . . . . . . . . . . . . . . . . 11-31 Moving In and Out on the Scene . . . . . . . . . . . . . . . . . . . . . . . 11-31 Making the Scene Larger or Smaller . . . . . . . . . . . . . . . . . . . 11-33 Revolving Around the Scene . . . . . . . . . . . . . . . . . . . . . . . . . . 11-33 Rotation Without Resizing of Graphics Objects . . . . . . . . . . . 11-33 Rotation About the Viewing Axis . . . . . . . . . . . . . . . . . . . . . . 11-34 View Projection Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-36 Projection Types and Camera Location . . . . . . . . . . . . . . . . . 11-37 Understanding Axes Aspect Ratio . . . . . . . . . . . . . . . . . . . . 11-41 Stretch-to-Fill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-41 Specifying Axis Scaling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-41 Specifying Aspect Ratio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-42 Example — axis Command Options . . . . . . . . . . . . . . . . . . . . 11-43 Additional Commands for Setting Aspect Ratio . . . . . . . . . . . 11-44 Axes Aspect Ratio Properties . . . . . . . . . . . . . . . . . . . . . . . . 11-46 Default Aspect Ratio Selection . . . . . . . . . . . . . . . . . . . . . . . . 11-47 Overriding Stretch-to-Fill . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-49 Effects of Setting Aspect Ratio Properties . . . . . . . . . . . . . . . 11-50 Example — Displaying Real Objects . . . . . . . . . . . . . . . . . . . 11-54 12 Lighting as a Visualization Tool Lighting Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-2 Lighting Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-2 Lighting Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-3 xiv Contents Light Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-4 Adding Lights to a Scene . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-5 Properties That Affect Lighting . . . . . . . . . . . . . . . . . . . . . . . 12-8 Selecting a Lighting Method . . . . . . . . . . . . . . . . . . . . . . . . . 12-10 Face and Edge Lighting Methods . . . . . . . . . . . . . . . . . . . . . . 12-10 Reflectance Characteristics of Graphics Objects . . . . . . . 12-11 Specular and Diffuse Reflection . . . . . . . . . . . . . . . . . . . . . . . 12-11 Ambient Light . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-12 Specular Exponent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-13 Specular Color Reflectance . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-14 Back Face Lighting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-14 Positioning Lights in Data Space . . . . . . . . . . . . . . . . . . . . . . 12-17 13 Transparency Making Objects Transparent . . . . . . . . . . . . . . . . . . . . . . . . . . 13-2 Specifying Transparency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-3 Specifying a Single Transparency Value . . . . . . . . . . . . . . . 13-5 Example – Transparent Isosurface . . . . . . . . . . . . . . . . . . . . . . 13-5 Mapping Data to Transparency . . . . . . . . . . . . . . . . . . . . . . . . 13-8 Size of the Alpha Data Array . . . . . . . . . . . . . . . . . . . . . . . . . . 13-9 Mapping Alpha Data to the Alphamap . . . . . . . . . . . . . . . . . . . 13-9 Example: Mapping Data to Color or Transparency . . . . . . . . . 13-9 Selecting an Alphamap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-11 Example: Modifying the Alphamap . . . . . . . . . . . . . . . . . . . . 13-13 xv 14 Creating 3-D Models with Patches Introduction to Patch Objects . . . . . . . . . . . . . . . . . . . . . . . . . 14-2 Defining Patches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-2 Behavior of the patch Function . . . . . . . . . . . . . . . . . . . . . . . . . 14-2 Creating a Single Polygon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-4 Multi-Faceted Patches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-6 Example – Defining a Cube . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-6 Specifying Patch Coloring . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-11 Patch Color Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-11 Patch Edge Coloring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-13 Example – Specifying Flat Edge and Face Coloring . . . . . . . 14-13 Coloring Edges with Shared Vertices . . . . . . . . . . . . . . . . . . . 14-14 Interpreting Indexed and Truecolor Data . . . . . . . . . . . . . 14-16 Indexed Color Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-16 Truecolor Patches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-19 Interpolating in Indexed Color Versus Truecolor . . . . . . . . . 14-19 15 Volume Visualization Techniques Overview of Volume Visualization . . . . . . . . . . . . . . . . . . . . . 15-3 Examples of Volume Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-3 Selecting Visualization Techniques . . . . . . . . . . . . . . . . . . . . . 15-3 Steps to Create a Volume Visualization . . . . . . . . . . . . . . . . . . 15-4 Volume Visualization Functions . . . . . . . . . . . . . . . . . . . . . . . 15-5 Functions for Scalar Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-6 Functions for Vector Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-6 Visualizing Scalar Volume Data . . . . . . . . . . . . . . . . . . . . . . . 15-8 Techniques for Visualizing Scalar Data . . . . . . . . . . . . . . . . . . 15-8 xvi Contents Visualizing MRI Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-9 Example - Ways to Display MRI DATA . . . . . . . . . . . . . . . . . . 15-9 Exploring Volumes with Slice Planes . . . . . . . . . . . . . . . . . 15-15 Example – Slicing Fluid Flow Data . . . . . . . . . . . . . . . . . . . . 15-15 Modifying the Color Mapping . . . . . . . . . . . . . . . . . . . . . . . . . 15-18 Connecting Equal Values with Isosurfaces . . . . . . . . . . . . 15-20 Example – Isosurfaces in Fluid Flow Data . . . . . . . . . . . . . . . 15-20 Isocaps Add Context to Visualizations . . . . . . . . . . . . . . . . 15-22 Defining Isocaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-23 Example – Adding Isocaps to an Isosurface . . . . . . . . . . . . . . 15-24 Visualizing Vector Volume Data . . . . . . . . . . . . . . . . . . . . . . 15-27 Using Scalar Techniques with Vector Data . . . . . . . . . . . . . . 15-27 Specifying Starting Points for Stream Plots . . . . . . . . . . . . . . 15-28 Accessing Subregions of Volume Data . . . . . . . . . . . . . . . . . . 15-30 Stream Line Plots of Vector Data . . . . . . . . . . . . . . . . . . . . 15-32 Displaying Curl with Stream Ribbons . . . . . . . . . . . . . . . . . 15-34 Displaying Divergence with Stream Tubes . . . . . . . . . . . . 15-36 Creating Stream Particle Animations . . . . . . . . . . . . . . . . . 15-39 Vector Field Displayed with Cone Plots . . . . . . . . . . . . . . . 15-42 Graphics This section discusses techniques for plotting data and provides examples showing how to plot, annotate, and print graphs. Related Information Overview of MATLAB Graphics Editing plots and graphic object properties Basic Plotting Plotting vector and matrix data in 2-D representations Formatting Graphs Adding annotations, axis labels, titles, and legends to graphs Creating Specialized Plots Creating bar graphs, histograms, contour plots and other specialized plots Displaying Bit-Mapped Images Displaying and modifying bit-mapped images with MATLAB Printing and Exporting Printing graphs on paper and exporting graphs to standard graphic file formats Handle Graphics Objects MATLAB graphics objects and properties Figure Properties How to use figure properties Axes Properties How to use axes properties 3-D Visualization Using viewing and lighting techniques to achieve complex graphic effects Creating Graphical User Interfaces How to include menus, push buttons, text boxes, and other user interface objects in MATLAB applications Introduction . . . . . . . . . . . . . . . . . . . . 1-2 Plotting Your Data . . . . . . . . . . . . . . . . . 1-3 Editing a Plot . . . . . . . . . . . . . . . . . . . 1-5 Using Plot Editing Mode . . . . . . . . . . . . . . 1-6 Saving Your Work . . . . . . . . . . . . . . . . . 1-10 Changing Your View of an Axes . . . . . . . . . . . 1-13 Using the Property Editor. . . . . . . . . . . . . . 1-15 Using the Data Statistics Tool. . . . . . . . . . . . 1-22 1 Overview of MATLAB Graphics Plotting Your Data (p.1-2) Illustrates the steps and commands used for a typical plotting task. Editing Plots (p.1-4) Techniques for editing plots. Using Plot Edit Mode (p.1-5) Using the Plot Editor tool to modify plots. Saving Your Work (p.1-9) Ways to save your graph to reload into MATLAB or export to external applications. Changing Your View of an Axes (p.1-13) Change your plot by zooming or rotating the axes. Using the Property Editor (p.1-15) Easily get and set Handle Graphics properties on any objects in the current hierarchy. Using the Data Statistics Tool (p.1-22) Perform basic statistical analysis on your data and plot the results. 1 Overview of MATLAB Graphics 1-2 The process of constructing a basic graph to meet your presentation graphics requirements is outlined in the following table. The table shows seven typical steps and some example code for each. If you are performing analysis only, you may want to view various graphs just to explore your data. In this case, steps 1 and 3 may be all you need. If you are creating presentation graphics, you may want to fine-tune your graph by positioning it on the page, setting line styles and colors, adding annotations, and making other such improvements. Step Typical Code 1 x = 0:0.2:12; y1 = bessel(1,x); y2 = bessel(2,x); y3 = bessel(3,x); 2 Select a window and position a plot region within the window figure(1) subplot(2,2,1) 3 Call elementary plotting function h = plot(x,y1,x,y2,x,y3); 4 Select line and marker characteristics set(h,'LineWidth',2,{'LineStyle'},{'--';':';'-.'}) set(h,{'Color'},{'r';'g';'b'}) 5 Set axis limits, tick marks, and grid lines axis([0 12 0.5 1]) grid on 6 Annotate the graph with axis labels, legend, and text xlabel('Time') ylabel('Amplitude') legend(h,'First','Second','Third') title('Bessel Functions') [y,ix] = min(y1); text(x(ix),y,'First Min \rightarrow',... 'HorizontalAlignment','right') 7 Export graph print depsc -tiff -r200 myplot 1-3 Anatomy of a Plot MATLAB ® plotting functions direct their output to a window that is separate from the command window. In MATLAB this window is referred to as a figure. For example, the following illustrates the plot of the Bessel functions, described in “Plotting Your Data” on page 1-2, highlighting the basic components of the graph. By default, MATLAB uses line style and color to distinguish the data sets plotted in the graph. However, you can change the appearance of these graphic components or add annotations to the graph to help explain your data for presentation graphics. For information, see “Editing Plots” on page 1-4. MATLAB figure window Axes on which MATLAB plots data Line plots representing data 1 Overview of MATLAB Graphics 1-4 Editing Plots MATLAB formats a graph to provide readability, setting the scale of axes, including tick marks on the axes, and using color and line style to distinguish the plots in the graph. However, if you are creating presentation graphics, you may want to change this default formatting or add descriptive labels, titles, legends and other annotations to help explain your data. MATLAB supports two ways to edit the plots you create: •Using the mouse to select and edit objects interactively •Using MATLAB functions at the command-line or in an M-file Interactive Plot Editing If you enable plot editing mode in the MATLAB figure window, you can perform point-and-click editing of your graph. In this mode, you can change the format of objects in your graph by double-clicking on the object and changing the values of its properties. In plot editing mode, you access the properties through the a graphical user interface, called the Property Editor. For more information about interactive editing, see “Using Plot Edit Mode” on page 1-5. For information about editing object properties in plot editing mode, see “Using the Property Editor” on page 1-15. Using Functions to Edit Graphs If you prefer to work from the MATLAB command line or if you are creating an M-file, you can use MATLAB commands to edit the graphs you create. Taking advantage of the MATLAB Handle Graphics system, you can use the set and get commands to change the properties of the objects in a graph. Note Plot editing mode provides an alternative way to access the properties of MATLAB graphic objects. However, you can only access a subset of object properties through this mechanism. You may need to use a combination of interactive editing and command line editing to achieve the effect you desire. Using Plot Edit Mode 1-5 Using Plot Edit Mode The MATLAB figure window supports a point-and-click style editing mode that you can use to customize the appearance of your graph. This section describes how to start plot edit mode and perform basic editing tasks, including: •“Selecting Objects in a Graph” on page 1-6 •“Cutting, Copying, and Pasting Objects” on page 1-7 •“Moving and Resizing Objects” on page 1-7 •“Editing Objects in a Graph” on page 1-8 •“Saving Your Work” on page 1-9 •“Changing Your View of an Axes” on page 1-13 To start plot edit mode, click this button. Use these toolbar buttons to add text, arrows, and lines. Use the Edit , Insert, and Tools menus to add objects or edit existing objects in a graph. Access object-specific plot edit functions through context-sensitive pop-up menus. Position labels, legends, and other objects by clicking and dragging. Double-click on an object to select it. 1 Overview of MATLAB Graphics 1-6 Starting Plot Edit Mode Before you can select objects in a figure by clicking on them, you must activate plot editing mode. There are several ways to activate plot edit mode: •Choose the Edit Plot option on the figure window Tools •Click on the selection button in the figure window toolbar. •Choose an option from the Edit or Insert menu. For example, if you choose the Axes Properties option on the Edit menu, MATLAB activates plot edit mode and the axes appear selected. •Run the plotedit command in the MATLAB command window. When a figure window is in plot edit mode, the Edit Plot option on the Tools menu is checked and the selection button in the toolbar is highlighted. Exiting Plot Edit Mode To exit plot edit mode, click the selection button or click the Edit Plot option on the Tools menu. When plot edit mode is turned off, the selection button is no longer highlighted. Selecting Objects in a Graph To select an object in a graph: 1 Start plot edit mode. 2 Move the cursor over the object and click on it. Selection handles appear on the selected object. Selecting Multiple Objects To select multiple objects at the same time: 1 Start plot edit mode. Click this button to start plot edit mode. Using Plot Edit Mode 1-7 2 Move the cursor over an object and shift-click to select it. Repeat for each object you want to select. You can perform actions on all of the selected objects. For example, to remove a text annotation and an arrow annotation from a graph, select the objects and then select Cut from the Edit To deselect an object, move the cursor off the object onto the figure window background and click the left mouse button. You can also shift-click on a selected object to deselect it. Cutting, Copying, and Pasting Objects To cut an object from a graph, or copy and paste an object in a graph, perform these steps: 1 Start plot edit mode. 2 Select the object. 3 Select the Cut , Copy , or Paste option from the Edit Alternatively, with plot edit mode enabled, you can right-click on an object and then select an editing command from the context menu associated with the object. Note If you cut an axes label or title and then paste it back into a figure, the label or title is no longer anchored to the axis. If you move the axes, the label or title will not move with the axes. Moving and Resizing Objects To move or resize an object in a graph, perform these steps: 1 Start plot edit mode. 1 Overview of MATLAB Graphics 1-8 2 For axes objects only: unlock the axes by right-clicking on it and choosing Unlock Axes Position 3 Select the object. Selection handles appear on the object. To move the object, drag it to the new location. To resize the object, drag a selection handle. Note You can move, but cannot resize text objects. Editing Objects in a Graph In MATLAB, every object in a graph supports a set of properties that control the graph’s appearance and behavior. For example, line objects support properties that control thickness, color, and line style. In plot edit mode, MATLAB provides a graphical user interface to object properties called the Property Editor. The Property Editor is a dialog box that supports a specific set of tabbed panels for each object you can select. For more information, see “Using the Property Editor” on page 1-15. 1-9 After editing a graph, you can: •Save your work in a format that can be opened during another MATLAB session. •Save your work in a format that can be used by other applications. Saving a Graph in MAT-File Format MATLAB supports a binary format in which you can save figures so that they can be opened in subsequent MATLAB sessions. MATLAB assigns these files the .fig file name extension. To save a graph in a figure file: 1 Select Save from the figure window File button on the toolbar. If this is the first time you are saving the file, the Save As dialog box appears. 2 Make sure that the Save as type is Fig-file . 3 Specify the name you want assigned to the figure file. 4 Click OK . The graph is saved as a figure file ( .fig ), which is a binary file format used to store figures. You can also use the saveas command. If you want to save the figure in a format that can be used by another application, see “Saving to a Different Format (Exporting Figures)” on page 1-10. Opening a Figure File To open a figure file, perform these steps: 1 Select Open from the File button on the toolbar. 1 Overview of MATLAB Graphics 1-10 2 Select the figure file you want to open and click OK . The figure file appears in a new figure window. You can also use the open command. Saving to a Different Format (Exporting Figures) To save a figure in a format that can be used by another application, such as the standard graphics file formats TIFF or EPS, perform these steps: 1 Select Export from the figure window File dialog box appears. 2 Select the format from the list of formats in the Save as type: menu. This selects the standard filename extension given to files of that type. 3 Enter the name you want to give the file. 4 Click Save . Copying a Figure to the Clipboard On Windows systems, you can also copy a figure to the clipboard and then paste it into another application: 1 Select Copy Options from the Figure window Edit page of the Preferences dialog box appears. 2 Complete the fields on the Copying Options page and click OK . 3 Select Copy Figure from the Edit The figure is copied to the Windows clipboard. You can then paste the figure from the Windows clipboard into a file in another application. Printing Figures Before printing a figure: 1 Select Page Setup from the figure window File The Page Setup dialog box opens. 1-11 2 Make changes in the dialog box. If you want the printed output to exactly match the annotated plot you see on the screen: a On the Axes and Figure tab, click Keep screen limits and ticks . b On the Size and Position tab, click Use screen size, centered on page . button in the dialog box. To print a figure, select Print from the figure window File dialog box that appears. You can also use the print command. 1 Overview of MATLAB Graphics 1-12 Getting Help To access help for the plot editing mode, select Plot Editing from the figure window Help menu. You can also access help at the command line by typing help plotedit or doc plotedit . For information about other graphics features, select Graphics from the figure window Help Changing Your View of an Axes 1-13 Changing Your View of an Axes MATLAB lets you change your view of axes by either zooming in for a closer look at a portion of an axes or, for 3-D axes, rotating the axes: •“Zooming In and Out on an Axes” on page 1-13 •“Rotating 3-D Axes” on page 1-14 The zoom and rotate 3-D options provides basic view changing capabilities. For more advanced viewing, select the Camera option from the Tools menu. See for more information. Note Activating any of the zoom, rotate, or camera functions automatically turns off plot editing mode. Zooming In and Out on an Axes The zoom in function lets you get a closer view of a portion of an axes. The zoom out function lets you view a larger portion of an axes. To zoom in on a portion of axes: 1 Activate the zoom function by choosing the Zoom In option on the Tools menu or by clicking the Zoom In button in the toolbar. 2 Click on the area of the axes where you want to zoom in, or drag the cursor to draw a box around the area where you want to zoom in. MATLAB redraws the axes, zooming in on the area you specified. To further magnify the area, click repeatedly in the axes or draw additional boxes in the axes. To end zoom in mode, click the Zoom In button. Zoom in Zoom out 1 Overview of MATLAB Graphics 1-14 Note Properties of the axes, such as the tick marks, automatically adjust to the new magnification or orientation. Annotations do not. To zoom out from an axes, click the Zoom Out button on the toolbar and then click on an area of the axes where you want to zoom out. To end zoom out mode, click the Zoom Out button. The zoom buttons use the camzoom command. Rotating 3-D Axes To rotate a 3-D axes: 1 Activate the rotate 3-D function by choosing the Rotate 3-D option on the Tools menu or by clicking the Rotate 3-D button in the toolbar. Note Activating the rotate 3-D function automatically turns off plot editing mode. 2 Click on the axes and an outline of the figure appears in the axes to help you visualize the rotation. Drag the cursor in the direction you want to rotate. When you release the mouse button, MATLAB redraws the axes in the new orientation. 3 Click the rotate button again to end rotate 3-D mode. The Rotate 3-D button uses the rotate3d command. Rotate 3-D Using the Property Editor 1-15 Using the Property Editor The Property Editor provides access to many properties of graphics objects, including figures, axes, lines, lights, patches, images, surfaces, rectangles, text, and the root object. Use these buttons to move back and forth among the graphics objects you have edited. Click here to view a list of values for this field. Click on a tab to view a group of properties. Check this box to see the effect of your changes as you make them. Click OK to apply your changes and dismiss the Property Editor. Use the navigation bar to select the object you want to Click Cancel to dismiss the Property Editor without applying your changes. Click Apply to apply your changes without dismissing the Property Editor. Click Help to get information about particular properties. 1 Overview of MATLAB Graphics 1-16 This section describes: •Starting the Property Editor •“Editing Object Properties” on page 1-17 •“Navigating Among Objects in a Graph” on page 1-18 •“Applying Your Changes” on page 1-21 Starting the Property Editor There are several ways to start the Property Editor. If plot editing mode is enabled, you can: •Double-click on an object in the graph. Note Double-clicking on a text object does not start the Property Editor. It opens a edit box around the text. To modify the properties of a text object, use one of the other mechanisms. •Right-click on an object, view the context menu, and select the Properties option. The context menus associated with objects also provide direct access to certain commonly used properties. •Select Figure Properties , Axes Properties , or Current Object Properties from the figure window Edit menu. These options automatically enable plot editing mode, if it is not already enabled. You can also start the Property Editor from the command line using the propedit function. Note Once you start the Property Editor, keep it open throughout an editing session. If you click on another object in the graph, the Property Editor displays the set of panels associated with that object type. You can also use the navigation bar in the Property Editor to select other objects to edit in the graph. Using the Property Editor 1-17 Closing the Property Editor Once activated, the Property Editor remains on your screen until you explicitly dismiss it by clicking either the Cancel button or the OK button. The Cancel button dismisses the Property Editor without applying any changes that may have been made to property values that haven’t been applied. The OK button dismisses the Property Editor dialog box and applies any changes that have been made to property values. Editing Object Properties To edit the properties of an object: 1 Start plot editing mode. 2 Start the Property Editor by double-clicking on the object in the graph or using one of the other mechanisms. The Property Editor displays the set of panels associated with the object you have selected. 3 Click on the tab of the panel that contains the property you want to modify. 4 Change the value of the property. For some properties, you must select a value from a menu of values. For other fields, you can either select a value or type a value directly into the field. Note If you place the cursor over a field, a data tip appears that displays the name of the property being edited and its current value. 5 Click the Apply button. For example, if you double-click on a line object in a graph, the Property Editor displays the set of tabbed panels specific to line objects: Data , Style , and Info . To change the style of a line from solid to dashed, click on the Style tab to view the style panel and click on the Line style from the list of styles. 1 Overview of MATLAB Graphics 1-18 Editing Multiple Objects If you select multiple objects of the same type, the Property Editor displays the set of panels specific to that object type. For example, if you select several lines in a graph, the Property Editor displays the panels associated with line objects. If you change the value of a line property and apply your change, it affects all the objects you have selected. If you select multiple objects of different types, for example, a line and an axes, the Property Editor displays only the Info panel, which provides access to properties that are common to all object types. For information about navigating among multiple selections, see “Multiple Selections and the Navigation Bar” on page 1-20. Navigating Among Objects in a Graph The navigation bar at the top of the Property Editor, labeled Edit Properties for , identifies the object being edited by its type (class) and tag, if the object’s tag property has a value. (A tag is a user-defined text string associated with an object.) Line style property selection Using the Property Editor 1-19 You can also use the navigation bar to select other objects, or groups of objects, in the graph that you want to edit. The following sections describe how to use the navigation bar: •“Selecting Objects from the Navigation Bar” on page 1-19 •“Using the Navigation Bar To Search for Objects” on page 1-20 •“Multiple Selections and the Navigation Bar” on page 1-20 Selecting Objects from the Navigation Bar To edit one of the other objects in the graph: 1 Click on the navigation bar menu. The Property Editor displays a hierarchical list of all the objects in the current figure. (The Property Editor includes other figures that may be open in the list but does not include the child objects of these figures.) 2 Select the object you want to edit from this list. The Property Editor displays the set of panels associated with the type of object you have selected. See “Identifying Objects in a Graph” on page 1-20 for more information. Note Only objects that have their HandleVisibility property set to On appear in the navigation bar hierarchical list. However, objects appear in the navigation bar even if their Visibility property is set to Off 1 Overview of MATLAB Graphics 1-20 Using the Navigation Bar To Search for Objects You can use the navigation bar to search for a particular object, or group of objects, in a figure by a tag, type (class), or handle. For example, to edit every line in a figure, enter the text string line in the navigation bar. The Property Editor displays the set of property panels associated with line objects and lists all the lines in the navigation bar. Individual line objects are identified by their tags, if present. Multiple Selections and the Navigation Bar When you select multiple objects, the Property Editor’s navigation bar displays the objects’ ancestors and children if the objects share a common parent. The Property Editor displays all the children in a single, non-hierarchical list. If you select objects that do not have a common parent, the Property Editor navigation bar only displays the selected objects. For example, if you create a graph containing multiple line plots and you select several of the lines, the Property Editor’s navigation bar display looks like this. Identifying Objects in a Graph In the hierarchical display of the navigation bar, the Property Editor lists all the objects in a graph by their type and tag, if the object has a tag. If a graph contains numerous line objects, tags can help identify which line object listed in the navigation bar list represents which line in the graph. To create a tag for a particular object in a graph: 1 Double-click on the object in the graph. Plot editing mode must be enabled. 2 Click on the Info tab in the Property Editor. Navigation bar identifies objects being Navigation bar lists the selected objects and their common Using the Property Editor 1-21 3 Enter a text string in the Tag field that identifies the object in the graph. 4 Click Apply . To apply your changes, click the Apply button. If you have checked the Immediate Apply box, your changes will appear automatically; you do not need to click on the Apply button. If you make changes to fields on a panel and then attempt to switch panels without applying your changes, the Property Editor displays a warning message, asking you if you want to apply your changes before moving. If you click OK , you apply your changes and dismiss the Property Editor. Note During an editing session, keep the Property Editor open. Throughout the session, you can edit the properties of any object in your graph without restarting the Property Editor. Canceling Changes If you have changed the values of properties and decide not to apply the changes, click on the Revert button. The Revert button resets all the properties to their values at the last Apply . To reset a property value change and close the Property Editor, click the Cancel button. 1 Overview of MATLAB Graphics 1-22 Using the Data Statistics Tool The Data Statistics tool: •Calculates basic statistics about the central tendency and variability of data plotted in a graph •Plots any of the statistics in a graph. When you select Data Statistics from the MATLAB figure window Tools menu, MATLAB calculates the statistics for each data set plotted in the graph and displays the results in the Data Statistics dialog box. Adding Plots of Statistics to a Graph To plot a statistic in a graph, click in the check box next to its value. “Adding Plots of Data Statistics to a Graph” in the “Formatting Graphs” chapter provides an example of using the Data Statistics tool. Identifies the figure in which the data is To add a plot of a statistic to a graph, click in the check box next to the Lists the statistics calculated for both the x- and y-data that define the Click here to create workspace variables of the statistics. Identifies the data set for which statistics have been calculated. Using the Data Statistics Tool 1-23 Saving Statistics to the Workspace To save a set of statistics as a workspace variable, click on the Save to workspace... button. The Data Statistics tool saves the statistics as a structure. 1 Overview of MATLAB Graphics 1-24 2 Basic Plotting Basic Plotting Commands (p.2-2) Basic commands for creating line plots, specifying line styles, colors, and markers, and setting defaults. Line Plots of Matrix Data (p.2-13) Line plots of the rows or column of matrices. Plotting Imaginary and Complex Data (p.2-15) How the plot command handles complex data as a special case. Plotting with Two Y-Axes (p.2-16) Creating line plots that have left and right y-axes. Setting Axis Parameters (p.2-19) Specifying axis ticks location, tick labels, and axes aspect ratio. Figure Windows (p.2-26) Displaying multiple plots per figure, targeting a specific axes, figure color schemes. 2 Basic Plotting 2-2 Basic Plotting Commands MATLAB provides a variety of functions for displaying vector data as line plots, as well as functions for annotating and printing these graphs. The following table summarizes the functions that produce basic line plots. These functions differ in the way they scale the plot’s axes. Each accepts input in the form of vectors or matrices and automatically scales the axes to accommodate the data. Creating Line Plots The plot function has different forms depending on the input arguments. For example, if y is a vector, plot(y) produces a linear graph of the elements of y versus the index of the elements of y . If you specify two vectors as arguments, plot(x,y) produces a graph of y versus x . For example, these statements create a vector of values in the range [0, 2] in increments of /100 and then use this vector to evaluate the sine function over that range. MATLAB plots the vector on the x-axis and the value of the sine function on the y-axis. t = 0:pi/100:2*pi; y = sin(t); plot(t,y) grid on Function Description plot Graph 2-D data with linear scales for both axes plot3 Graph 3-D data with linear scales for both axes loglog Graph with logarithmic scales for both axes semilogx Graph with a logarithmic scale for the x-axis and a linear scale for the y-axis semilogy Graph with a logarithmic scale for the y-axis and a linear scale for the x-axis plotyy Graph with y-tick labels on the left and right side Basic Plotting Commands 2-3 MATLAB automatically selects appropriate axis ranges and tick mark locations. You can plot multiple graphs in one call to plot using x-y pairs. MATLAB automatically cycles through a predefined list of colors to allow discrimination between each set of data. Plotting three curves as a function of t produces y2 = sin(t-0.25); y3 = sin(t-0.5); plot(t,y,t,y2,t,y3) 0 1 2 3 4 5 6 7 −1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1 2 Basic Plotting 2-4 Specifying Line Style You can assign different line styles to each data set by passing line style identifier strings to plot . For example, t = 0:pi/100:2*pi; y = sin(t); y2 = sin(t-0.25); y3 = sin(t-0.5); plot(t,y,'',t,y2,'--',t,y3,':') 0 1 2 3 4 5 6 7 −1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1 Basic Plotting Commands 2-5 Colors, Line Styles, and Markers The basic plotting functions accepts character-string arguments that specify various line styles, marker symbols, and colors for each vector plotted. In the general form, plot(x,y,'linestyle_marker_color') linestyle_marker_color is a character string (delineated by single quotation marks) constructed from: •A line style (e.g., dashed, dotted, etc.) •A marker type (e.g., x , * , o , etc.) •A predefined color specifier ( c , m , y , k , r , g , b , w ) For example, plot(x,y,':squarey') plots a yellow dotted line and places square markers at each data point. If you specify a marker type, but not a line style, MATLAB draws only the marker. 0 1 2 3 4 5 6 7 −1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1 2 Basic Plotting 2-6 The specification can consist of one or none of each specifier in any order. For example, the string, 'go--' defines a dashed line with circular markers, both colored green. You can also specify the size of the marker and, for markers that are closed shapes, you can specify separately the color of the edges and the face. See the LineSpec Specifying the Color and Size of Lines You can control a number of line style characteristics by specifying values for line properties: • LineWidth – specifies the width of the line in units of points. • MarkerEdgeColor – specifies the color of the marker or the edge color for filled markers (circle, square, diamond, pentagram, hexagram, and the four triangles). • MarkerFaceColor – specifies the color of the face of filled markers. • MarkerSize – specifies the size of the marker in units of points. For example, these statements, x = pi:pi/10:pi; y = tan(sin(x)) sin(tan(x)); plot(x,y,' rs','LineWidth',2,... 'MarkerEdgeColor','k',... 'MarkerFaceColor','g',... 'MarkerSize',10) produce a graph with: •A red dashed line with square markers •A line width of two points •The edge of the marker colored black •The face of the marker colored green •The size of the marker set to 10 points Basic Plotting Commands 2-7 Adding Plots to an Existing Graph You can add plots to an existing graph using the hold command. When you set hold to on , MATLAB does not remove the existing graph; it adds the new data to the current graph, rescaling if the new data falls outside the range of the previous axis limits. For example, these statements first create a semilogarithmic plot, then add a linear plot. semilogx(1:100,'+') hold on plot(1:3:300,1:100,'--') hold off While MATLAB resets the x-axis limits to accommodate the new data, it does not change the scaling from logarithmic to linear. −4 −3 −2 −1 0 1 2 3 4 −3 −2 −1 0 1 2 3 2 Basic Plotting 2-8 Plotting Only the Data Points To plot a marker at each data point without connecting the markers with lines, use a specification that does not contain a line style. For example, given two vectors, x = 0:pi/15:4*pi; y = exp(2*cos(x)); calling plot with only a color and marker specifier plot(x,y,'r+') plots a red plus sign at each data point. 10 0 10 1 10 2 10 3 0 10 20 30 40 50 60 70 80 90 100 Basic Plotting Commands 2-9 See LineSpec for a list of available line styles, markers, and colors. Plotting Markers and Lines To plot both markers and the lines that connect them, specify a line style and a marker type. For example, the following command plots the data as a red, solid line and then adds circular markers with black edges at each data point. x = 0:pi/15:4*pi; y = exp(2*cos(x)); plot(x,y,'r',x,y,'ok') 0 2 4 6 8 10 12 14 0 1 2 3 4 5 6 7 8 2 Basic Plotting 2-10 Line Styles for Black and White Output Line styles and markers enable you to discriminate different plots on the same graph when color is not available. For example, the following statements create a graph using a solid ( ' *k' ) line with asterisk markers colored black and a dash-dot ( ' .ok' ) line with circular markers colored black. x = 0:pi/15:4*pi; y1 = exp(2*cos(x)); y2 = exp(2*sin(x)); plot(x,y1,' *k',x,y2,' .ok') 0 2 4 6 8 10 12 14 0 1 2 3 4 5 6 7 8 Basic Plotting Commands 2-11 Setting Default Line Styles You can configure MATLAB to use line styles instead of colors for multi-line plots by setting a default value for the axes LineStyle property. For example, the command, set(0,'DefaultAxesLineStyleOrder',{'-o',':s','--+'}) defines three line styles and makes them the default for all plots. To set the default line color to dark gray, use the statement set(0,'DefaultAxesColorOrder',[0.4,0.4,0.4]) See ColorSpec for information on how to specify color as a three-element vector of RGB values. Now the plot command uses the line styles and colors you have defined as defaults. For example, these statements create a multiline plot. x = 0:pi/10:2*pi; y1 = sin(x); 0 2 4 6 8 10 12 14 0 1 2 3 4 5 6 7 8 2 Basic Plotting 2-12 y2 = sin(x-pi/2); y3 = sin(x-pi); plot(x,y1,x,y2,x,y3) The default values persist until you quit MATLAB. To remove default values during your MATLAB session, use the reserved word remove . set(0,'DefaultAxesLineStyleOrder','remove') set(0,'DefaultAxesColorOrder','remove') See “Setting Default Property Values” in the “Handle Graphics Objects” chapter for more information. 0 1 2 3 4 5 6 7 −1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1 Line Plots of Matrix Data 2-13 Line Plots of Matrix Data When you call the plot function with a single matrix argument plot(Y) MATLAB draws one line for each column of the matrix. The x -axis is labeled with the row index vector, 1:m , where m is the number of rows in Y . For example, Z = peaks; returns a 49-by-49 matrix obtained by evaluating a function of two variables. Plotting this matrix plot(Z) produces a graph with 49 lines. In general, if plot is used with two arguments and if either X or Y has more than one row or column, then: •If Y is a matrix, and x is a vector, plot(x,Y ) successively plots the rows or columns of Y versus vector x , using different colors or line types for each. The 0 5 10 15 20 25 30 35 40 45 50 −8 −6 −4 −2 0 2 4 6 8 10 2 Basic Plotting 2-14 row or column orientation varies depending on whether the number of elements in x matches the number of rows in Y or the number of columns. If Y is square, its columns are used. •If X is a matrix and y is a vector, plot(X,y) plots each row or column of X versus vector y . For example, plotting the peaks matrix versus the vector 1:length(peaks) rotates the previous plot. y = 1:length(peaks); plot(peaks,y) •If X and Y are both matrices of the same size, plot(X,Y) plots the columns of X versus the columns of Y . You can also use the plot function with multiple pairs of matrix arguments. plot(X1,Y1,X2,Y2,...) This statement graphs each X-Y pair, generating multiple lines. The different pairs can be of different dimensions. −8 −6 −4 −2 0 2 4 6 8 10 0 5 10 15 20 25 30 35 40 45 50 Plotting Imaginary and Complex Data 2-15 Plotting Imaginary and Complex Data When the arguments to plot are complex (i.e., the imaginary part is nonzero), MATLAB ignores the imaginary part except when plot is given a single complex argument. For this special case, the command is a shortcut for a plot of the real part versus the imaginary part. Therefore, plot(Z) where Z is a complex vector or matrix, is equivalent to plot(real(Z),imag(Z)) For example, this statement plots the distribution of the eigenvalues of a random matrix using circular markers to indicate the data points. plot(eig(randn(20,20)),'o','MarkerSize',6) To plot more than one complex matrix, there is no shortcut; the real and imaginary parts must be taken explicitly. −6 −5 −4 −3 −2 −1 0 1 2 3 4 −5 −4 −3 −2 −1 0 1 2 3 4 5 2 Basic Plotting 2-16 Plotting with Two Y-Axes The plotyy command enables you to create plots of two data sets and use both left and right side y-axes. You can also apply different plotting functions to each data set. For example, you can combine a line plot with a stem plot of the same data. t = 0:pi/20:2*pi; y = exp(sin(t)); plotyy(t,y,t,y,'plot','stem') Combining Linear and Logarithmic Axes You can use plotyy to apply linear and logarithmic scaling to compare two data sets having a different range of values. t = 0:900; A = 1000; a = 0.005; b = 0.005; z1 = A*exp(-a*t); z2 = sin(b*t); [haxes,hline1,hline2] = plotyy(t,z1,t,z2,'semilogy','plot'); 0 1 2 3 4 5 6 7 0 0.5 1 1.5 2 2.5 3 0 1 2 3 4 5 6 7 0 0.5 1 1.5 2 2.5 3 Plotting with Two Y-Axes 2-17 This example saves the handles of the lines and axes created to adjust and label the graph. First, label the axes whose y value ranges from 10 to 1000. This is the first handle in haxes because we specified this plot first in the call to plotyy . Use the axes command to make haxes(1) the current axes, which is then the target for the ylabel command. axes(haxes(1)) ylabel('Semilog Plot') Now make the second axes current and call ylabel again. axes(haxes(2)) ylabel('Linear Plot') You can modify the characteristics of the plotted lines in a similar way. For example, to change the line style of the second line plotted to a dashed line, use the statement set(hline2,'LineStyle','--') 0 100 200 300 400 500 600 700 800 900 10 1 10 2 10 3 Semilog Plot 0 100 200 300 400 500 600 700 800 900 −1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1 Linear Plot 2 Basic Plotting 2-18 See “Using Multiple X and Y Axes” in the “Axes Properties” chapter for an example that employs double x- and y-axes. See LineSpec Setting Axis Parameters 2-19 Setting Axis Parameters When you create a graph, MATLAB automatically selects the axis limits and tick-mark spacing based on the data plotted. However, you can also specify your own values for axis limits and tick marks by. You can do this with the following commands: • axis – sets values that affect the current axes object (the most recently created or the last clicked on). • axes – (not axis) creates a new axes object with the specified characteristics. • get and set – enable you to query and set a wide variety of properties of existing axes. • gca – returns the handle (identifier) of the current axes. If there are multiple axes in the figure window, the current axes is the last graph created or the last graph you clicked on with the mouse. The following two sections provide more information and examples: “Axis Limits and Ticks” on page 2-19 “Example – Specifying Ticks and Tick Labels” on page 2-22 Related Information See the chapter “Defining the View” for more extensive information on manipulating 3-D views. Axis Limits and Ticks MATLAB selects axis limits based on the range of the plotted data. You can specify the limits manually using the axis command. Call axis with the new limits defined as a four-element vector. axis([xmin,xmax,ymin,ymax]) Note that the minimum values must be less than the maximum values. Semiautomatic Limits If you want MATLAB to autoscale only one of a min/max set of axis limits, but you want to specify the other, use the MATLAB variable Inf or Inf for the autoscaled limit. For example, this graph uses default scaling. 2 Basic Plotting 2-20 Compare the default limits to the following graph, which sets the maximum limit of the x-axis, but autoscales the minimum limit. axis([ Inf 5 2 2.5]) 0 1 2 3 4 5 6 7 8 9 10 0 0.5 1 1.5 2 2.5 Setting Axis Parameters 2-21 Axis Tick Marks MATLAB selects the tick mark locations based on the range of data so as to produce equally spaced ticks (for linear graphs). You can specify different tick marks by setting the axes XTick and YTick properties. Define tick marks as a vector of increasing values. The values do not need to be equally spaced. For example, setting the y-axis tick marks for the graph from the preceding example, set(gca,'ytick',[2 2.1 2.2 2.3 2.4 2.5]) produces a graph with only the specified ticks on the y-axis. 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 2 2.05 2.1 2.15 2.2 2.25 2.3 2.35 2.4 2.45 2.5 2 Basic Plotting 2-22 Note that if you specify tick mark values that are outside the axis limits, MATLAB does not display them (that is, specifying tick marks cannot cause axis limits to change). Example – Specifying Ticks and Tick Labels You can adjust the axis tick-mark locations and the labels appearing at each tick mark. For example, this plot of the sine function relabels the x-axis with more meaningful values. x = pi:.1:pi; y = sin(x); plot(x,y) set(gca,'XTick', pi:pi/2:pi) set(gca,'XTickLabel',{' pi',' pi/2','0','pi/2','pi'}) These commands ( xlabel , ylabel , title , text ) add axis labels and draw an arrow that points to the location on the graph where y = sin(pi/4). xlabel(' \pi \leq \Theta \leq \pi') ylabel('sin(\Theta)') title('Plot of sin(\Theta)') 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 2 2.1 2.2 2.3 2.4 2.5 Setting Axis Parameters 2-23 text( pi/4,sin( pi/4),'\leftarrow sin( \pi\div4)',... 'HorizontalAlignment','left') Setting Line Properties on an Existing Plot Change the line color to purple by first finding the handle of the line object created by plot and then setting its Color property. Use findobj and the fact that MATLAB creates a blue line (RGB value [0 0 1]) by default. In the same statement, set the LineWidth property to 2 points. set(findobj(gca,'Type','line','Color',[0 0 1]),... 'Color',[0.5,0,0.5],'LineWidth',2) The Greek symbols are created using TeX character sequences. Setting Aspect Ratio By default, MATLAB displays graphs in a rectangular axes that has the same aspect ratio as the figure window. This makes optimum use of space available −pi −pi/2 0 pi/2 pi −1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1 − sin() Plot of sin() sin(−4) 2 Basic Plotting 2-24 for plotting. MATLAB provides control over the aspect ratio with the axis command. For example, t = 0:pi/20:2*pi; plot(sin(t),2*cos(t)) grid on produces a graph with the default aspect ratio. The command axis square makes the x- and y-axes equal in length. The square axes has one data unit in x to equal two data units in y. If you want the x- and y-data units to be equal, use the command axis equal This produces an axes that is rectangular in shape, but has equal scaling along each axis. −1 −0.5 0 0.5 1 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 −1 −0.5 0 0.5 1 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 axis normal axis square Setting Axis Parameters 2-25 If you want the axes shape to conform to the plotted data, use the tight option in conjunction with equal . axis equal tight −1 0 1 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 −2 −1 0 1 2 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 axis equal axis equal tight 2 Basic Plotting 2-26 Figure Windows MATLAB directs graphics output to a window that is separate from the command window. In MATLAB this window is referred to as a figure. The characteristics of this window are controlled by your computer’s windowing system and MATLAB figure properties (see a description of each property). See “Figure Properties” on page 8-1 for some examples illustrating how to use figure properties. Graphics functions automatically create new figure windows if none currently exist. If a figure already exists, MATLAB uses that window. If multiple figures exist, one is designated as the current figure and is used by MATLAB (this is generally the last figure used or the last figure you clicked the mouse in). The figure function creates figure windows. For example, figure creates a new window and makes it the current figure. You can make an existing figure current by clicking on it with the mouse or by passing its handle (the number indicated in the window title bar), as an argument to figure . figure(h) Displaying Multiple Plots per Figure You can display multiple plots in the same figure window and print them on the same piece of paper with the subplot function. subplot(m,n,i) breaks the figure window into an m-by-n matrix of small subplots and selects the i th subplot for the current plot. The plots are numbered along the top row of the figure window, then the second row, and so forth. For example, the following statements plot data in four different subregions of the figure window. t = 0:pi/20:2*pi; [x,y] = meshgrid(t); subplot(2,2,1) plot(sin(t),cos(t)) axis equal Figure Windows 2-27 subplot(2,2,2) z = sin(x)+cos(y); plot(t,z) axis([0 2*pi 2 2]) subplot(2,2,3) z = sin(x).*cos(y); plot(t,z) axis([0 2*pi 1 1]) subplot(2,2,4) z = (sin(x).^2)(cos(y).^2); plot(t,z) axis([0 2*pi 1 1]) −1 0 1 −1 −0.5 0 0.5 1 0 2 4 6 −2 −1 0 1 2 0 2 4 6 −1 −0.5 0 0.5 1 0 2 4 6 −1 −0.5 0 0.5 1 2 Basic Plotting 2-28 Each subregion contains its own axes with characteristics you can control independently of the other subregions. This example uses the axis command to set limits and change the shape of the subplots. See the axes , axis , and subplot Specifying the Target Axes The current axes is the last one defined by subplot . If you want to access a previously defined subplot, for example to add a title, you must first make that axes current. You can make an axes current in three ways: •Click on the subplot with the mouse •Call subplot the m , n , i specifiers •Call subplot with the handle (identifier) of the axes For example, subplot(2,2,2) title('Top Right Plot') adds a title to the plot in the upper-right side of the figure. You can obtain the handles of all the subplot axes with the statement h = get(gcf,'Children'); MATLAB returns the handles of all the axes, with the most recently created one first. That is, h(1) is subplot 224, h(2) is subplot 223, h(3) is subplot 222, and h(4) is subplot 221. For example, to replace subplot 222 with a new plot, first make it the current axes with subplot(h(3)) Default Color Scheme The default figure color scheme produces good contrast and visibility for the various graphics functions. This scheme defines colors for the window background, the axis background, the axis lines and labels, the colors of the lines used for plotting and surface edges, and other properties that affect appearance. Figure Windows 2-29 The colordef function enables you to select from predefined color schemes and to modify colors individually. colordef predefines three color schemes: • colordef white – sets the axis background color to white, the window background color to gray, the colormap to jet , surface edge colors to black, and defines appropriate values for the plotting color order and other properties. • colordef black – sets the axis background color to black, the window background color to dark gray, the colormap to jet , surface edge colors to black, and defines appropriate values for the plotting color order and other properties. • colordef none – set the colors to match that of MATLAB 4. This is basically a black background with white axis lines and no grid. MATLAB programs that are based on the MATLAB 4 color scheme may need to call colordef with the none option to produce the expected results. You can examine the colordef.m M-file to determine what properties it sets (enter type colordef at the MATLAB prompt). 2 Basic Plotting 2-30 Overview . . . . . . . . . . . . . . . . . . . . . . 3-2 Adding a Title to a Graph . . . . . . . . . . . . . . 3-3 Adding a Legend to a Graph . . . . . . . . . . . . . 3-6 Adding Axes Labels to a Graph . . . . . . . . . . . .3-11 Adding Text Annotations to a Graph . . . . . . . . .3-15 Adding Arrows and Lines to a Graph . . . . . . . . .3-27 Adding Plots of Basic Statistics to a Graph . . . . . .3-29 3 Formatting Graphs Overview (p.3-2) Summary of the options for formatting graphs. Adding Titles to Graphs (p.3-3) Ways to add a title to a graph. Adding Legends to Graphs (p.3-6) Add, position, modify, and remove legends from graphs. Adding Axis Labels to Graphs (p.3-11) Various ways to add labels to graphs. Adding Text Annotations to Graphs (p.3-17) Techniques for adding text to graphs, including alignment, symbols and Greek letters, using variables in text strings, multiline text, and text background color. Adding Arrows and Lines to Graphs (p.3-31) Adding callout arrows and lines to graphs. Adding Plots of Basic Statistics to Graphs (p.3-33) Data Statistics Tool enables you to plot statistical data about your graph. 3 Formatting Graphs 3-2 Overview When creating presentation graphics, you may want to add labels and annotations to your graph to help explain your data. MATLAB provides mechanisms that let you: •Add a title at the top of an axes •Add plots of basic data statistics, such as the maximum, minimum, and mean The following figure shows a graph that uses all of these labels and annotations. Click on any of the labels and annotations in this figure to get more information about how to create the label or annotation. Title Legend Text annotation Arrow Plot of data statistic Axes label 3-3 In MATLAB, a title is a text string at the top of an axes. Titles typically define the subject of the graph. There are several ways to add a title to a graph: •“Using the Title Option on the Insert Menu” on page 3-3 •“Using the Property Editor to Add a Title” on page 3-4 •“Using the title Function” on page 3-5 Note While you can use text annotations to create a title for your graph, it is not recommended. Titles are anchored to the top of the axes they describe; text annotations are not. If you move or resize your axes, the title remains at the top. Additionally, if you cut a title and then paste it back into a figure, the title will no longer be anchored to the axes. Using the Title Option on the Insert Menu To add a title to a graph using the Insert Title 3 Formatting Graphs 3-4 1 Click the Insert . MATLAB opens a text entry box at the top of the axes. Note When you select the Title option, MATLAB enables plot editing mode automatically. 2 Enter the text of the label. 3 When you are finished entering text, click anywhere in the figure background to close the text entry box around the title. If you click on another object in the figure, such as an axes or line, you close the title text entry box and also automatically select the object you clicked on. To change the font used in the title to bold, you must edit the title. You can edit the title as you would any other text object in a graph. See “Editing Text Annotations” on page 3-24 for more information. Using the Property Editor to Add a Title To add a title to a graph using the Property Editor: 1 Start plot editing mode by selecting Edit Plot from the figure Tools 2 Double-click on the axes in the graph. This starts the Property Editor. You can also start the Property Editor by right-clicking on the axes and selecting Properties from the context menu. The Property Editor displays the set of property panels specific to axes objects. Titles are a property of axes objects. 3 Select the Style panel and type in the text of your title in the Title text entry box. 3-5 4 Click Apply . The title you create is a text object and, as such, you can change the font, font style, position and many other aspects of its format. To view the properties associated with a text object, click the Edit button next to the Title text entry box. For more information about text object properties, see “Editing Text Annotations” on page 3-24. Using the title Function To add a title to a graph at the MATLAB command prompt or from an M-file, use the title function. The title function lets you specify the value of title properties at the time you create it. For example, the following code adds a title to the current axes and sets the value of the FontWeight property to bold. title('Lotka-Volterra Predator-Prey Population Model',... 'FontWeight','bold') To edit a title from the MATLAB command prompt or from an M-file, use the set function. See “Setting and Querying Object Properties” in the “Handle Graphics Objects” chapter for more information. 3 Formatting Graphs 3-6 Legends identify each data set plotted in your graph. In a legend, MATLAB includes a small sample of the line or marker used to represent each data set in the graph, in the same color and style as it appears in the graph. MATLAB also includes a text label to identify each data set. This section includes these topics: •“Using the Legend Option on the Insert Menu” on page 3-7 •“Using the Legend Function” on page 3-7 •“Positioning the Legend” on page 3-8 •“Editing the Legend” on page 3-9 •“Removing the Legend” on page 3-10 Note The legend is implemented as a separate axes overlaying the axes it describes. The legend axes is not anchored to the main axes. If you resize or move the main axes, or create new subplots, you may need to reposition the legend. Legend 3-7 Using the Legend Option on the Insert Menu To add a legend to a graph, click on the Insert . MATLAB creates a legend, placing it in the upper right corner of the plot. MATLAB creates text labels to identify each data set in the graph, using data1 to identify the first data set, data2 to identify the second data set, and so on. To learn how to customize a legend, such as changing its position or changing the text labels, see “Positioning the Legend” on page 3-8 and “Editing the Legend” on page 3-9. Using the Legend Function To add a legend to a graph at the MATLAB command prompt or from an M-file, use the legend function. You must specify the text labels when you create a legend using the legend function. For example, the following code adds a legend to the current axes. legend('Y1 Predator','Y2 Prey') The legend function lets you specify many other aspects of the legend, such as its position. For more information, see the legend function reference information. Legend 3 Formatting Graphs 3-8 Positioning the Legend There are two ways to change the position of a legend in a graph, depending on whether plot editing mode is enabled. If Plot Editing Mode Is Not Enabled 1 Move the mouse over the legend and press and hold down the left mouse button. MATLAB changes the cursor to the indicate possible directions of movement. 2 With the mouse button still pressed, move the legend anywhere in the graph. 3 Release the mouse button. If Plot Editing Mode Is Enabled 1 Right-click on the legend. This selects the legend and triggers the display of the context menu for the legend. 2 Select Unlock Axes Position from the context menu. (The legend is an axes object.) Note If the context menu does not include the Unlock Axes Position option, you probably selected the text labels in the legend or the line objects and not the legend axes. Every object in a legend is individually selectable. Make sure you have selected the legend axes. 3 Move the cursor back over the legend axes (it should still be selected) and press and hold down either mouse button. MATLAB changes the cursor to indicate possible directions of movement. 4 Move the legend anywhere in the graph. 5 Release the mouse button. 3-9 Editing the Legend A legend is implemented as a separate axes object containing one or more line objects, representing samples of the plots in the graph, and one or more text objects, representing the labels for each data set plotted in a graph. You can edit a legend when plot editing mode is enabled or when it is not enabled. Editing a Legend in Plot Editing Mode When you enable plot editing mode, you can edit any of the objects that make up a legend as you would any other axes, line, or text object in a graph. For example, if you double-click on the legend axes, the Property Editor displays the set of property panels for axes objects. Change the value of an axes property and click Apply . If you double-click on a text label in a legend, MATLAB opens a text editing box around all the text labels in the legend. You can edit any of the text labels in the legend. To access the properties of these text objects, right-click on a text label and select Properties from the context-sensitive pop-up menu. Editing a Legend When Plot Editing Mode Is Not Enabled When plot editing mode is not enabled, you can still edit the text labels in a legend: 1 Double-click on a text label in the legend. MATLAB opens a text edit box around the text label you selected. All the other text labels are temporarily hidden. You can only edit one text label at a time. 2 Make changes to the text label and then click anywhere in the figure outside of the text edit box when you are finished. MATLAB automatically resizes the legend box to fit long or multiline labels. Axes object Line objects Text objects 3 Formatting Graphs 3-10 Resizing a Legend To resize a legend: 1 Start plot editing mode by selecting Edit Plot from the figure Tools 2 Right-click on its axes and select Unlock Axes Position Move the cursor back to the legend axes, which is selected, and grab one of the selection handles. MATLAB changes the cursor to indicate possible directions. Note If the text labels extend past the legend axes border, you cannot grab the selection handles on the right side of the legend axes. Resize the axes from the left side to fit the new text labels. 4 Drag the selection handle to resize the legend. Removing the Legend If you have enabled plot editing mode, you can remove a legend by clicking on it and choosing the Cut option on the Edit menu. You can also remove a legend by right-clicking on it and selecting Cut If plot editing mode is not enabled, you can remove a legend by selecting the Legend option on the Insert options acts as a toggle switch — selecting it alternately adds or removes a legend. Adding Axis Labels to Graphs 3-11 In MATLAB, an axes label is a text string aligned with the x-, y-, or z-axis in a graph. Axis labels can help explain the meaning of the units that each axis represents. Note While you can use free-form text annotations to create axes labels, it is not recommended. Axis labels are anchored to the axes they describe; text annotations are not. If you move or resize your axes, the labels automatically move with the axes. Additionally, if you cut a label and then paste it back into a figure, the label will no longer be anchored to the axes. To add axes labels to a graph, you can use any of these mechanisms: •“Using the Label Options on the Insert Menu” on page 3-12 •“Using the Property Editor to Add Axis labels” on page 3-12 •“Using Axis-Label Commands” on page 3-15 Axes labels 3 Formatting Graphs 3-12 Using the Label Options on the Insert Menu 1 Click on the Insert menu and choose the label option that corresponds to the axes you want to label: X Label , Y Label, or Z Label . MATLAB opens a text entry box along the axes, or around an existing axes label. Note MATLAB opens up a horizontal text editing box for the Y- and Z- axes labels and automatically rotates the label into alignment with the axes when you finish entering text. 2 Enter the text of the label, or edit the text of an existing label. 3 Click anywhere else in the figure background to close the text entry box around the label. If you click on another object in the figure, such as an axes or line, you close the label text entry box but also automatically select the object you clicked on. Note After you use the Insert menu to add an axes label, plot edit mode is enabled in the figure, if it was not already enabled. Using the Property Editor to Add Axis labels To add labels to a graph using the Property Editor: 1 Start plot editing mode by selecting Edit Plot from the figure Tools 2 Start the Property Editor by either double-clicking on the axes in the graph or by right-clicking on the axes and selecting Properties from the context-sensitive pop-up menu. The Property Editor displays the set of property panels specific to axes objects. 3 Select the X , Y , or Z panel, depending on which axis label youwant to add. Enter the label text in the Label text entry box. Adding Axis Labels to Graphs 3-13 4 Click Apply . Rotating Axis Labels You can rotate axis labels using the Property Editor: 1 Start plot editing mode by selecting Edit Plot from the figure Tools 2 Display the Property Editor by selecting (left-click) the axis label you want to rotate. Right-click on the selected text then choose Properties from the pop-up menu. 3 Formatting Graphs 3-14 3 Select the Style panel and enter a value for the orientation in the Rotation text field. A value of 0 degrees orients the label in the horizontal position. 4 Click Apply . 5 With the left mouse button down on the selected label, drag the text to the desired location and release. 3-15 Using Axis-Label Commands You can add x-, y-, and z-axis labels using the xlabel , ylabel , and zlabel commands. For example, these statements label the axes and add a title. xlabel('t = 0 to 2\pi','FontSize',16) ylabel('sin(t)','FontSize',16) title('\it{Value of the Sine from Zero to Two Pi}','FontSize',16) The labeling commands automatically position the text string appropriately. MATLAB interprets the characters immediately following the backslash “\” as TeX commands. These commands draw symbols such as Greek letters and arrows. See the text String property for a list of TeX character sequences. See also the texlabel function for converting MATLAB expersions to TeX symbols. 0 1 2 3 4 5 6 7 −1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1 The Sine of 0 to 2 = 0 to 2 sin() 3 Formatting Graphs 3-16 Rotating Axis Labels Using Commands Axis labels are text objects that you can rotate by specifying a value for the object’s Rotation property. The handles of the x-, y-, and z-axis labels are stored in the axes XLabel , YLabel , and ZLabel properties respectively. Therefore, to rotate the y -axis so that the text is horizontal: 1 Get the handle of the text object using the axes YLabel property: 2 Set the Rotation property to 0.0 degrees For example, this statement rotates the text of the y-axis label on the current axes: set(get(gca,'YLabel'),'Rotation',0.0) Repositioning Axis Labels You can reposition an axis label using 1 Start plot editing mode by selecting Edit Plot from the figure Tools 2 Select the text of the label you want to reposition (handles appear around the text object). 3 With the left mouse button down on the selected label, drag the text to the desired location and release. 3-17 You can add free-form text annotations anywhere in a MATLAB figure to help explain your data or bring attention to specific points in your data sets. If you enable plot editing mode, you can create text annotations by clicking in an area of the graph or the figure background and entering text. You can also add text annotations from the command line, using the text or gtext command. Using plot editing mode or gtext make it easy to place a text annotation anywhere in graph. Use the text command when you want to position a text annotation at a specific point in a data set. Note Text annotations created using the text or gtext command are anchored to the axes. Text annotations created in plot edit mode are not. If you move or resize your axes, you will have to reposition your text annotations. Text annotations 3 Formatting Graphs 3-18 Creating Text Annotations in Plot Editing Mode Note Add text annotations after you are finished moving or resizing your axes. Text annotations created in plot edit mode are not anchored to axes. If you move or resize an axes, you will have to move the text annotations as well. To add a text annotation to a graph: 1 Click on the Insert option or click the Insert Text button in the figure window toolbar. MATLAB changes the cursor to a text insertion cursor. Note After you use insert text, plot edit mode is enabled in the figure, if it was not already enabled. 2 Position the cursor where you want to add a text annotation in the graph and click. MATLAB opens a text editing box at that point in the graph. 3 Enter text. 4 Click anywhere in the figure background to close the text entry box. If you click on another object in the figure, such as an axes or line, you close the title text entry box but also automatically select the object you clicked on. Creating Text Annotations with the text or gtext Command To create a text annotation using the text function, you must specify the the text and its location in the graph, using x- and y-coordinates. You specify the coordinates in the units of the graph. Insert Text 3-19 For example, the following code creates text annotations at specific points in the Lotka-Volterra Predator-Prey Population Model graph. str1(1) = {'Many Predators;'}; str1(2) = {'Prey Population'}; str1(3) = {'Will Decline'}; text(7,220,str1) str2(1) = {'Few Predators;'}; str2(2) = {'Prey Population'}; str2(3) = {'Will Increase'}; text(5.5,125,str2) This example also illustrates how to create multi-line text annotations with cell arrays. Calculating the Position of Text Annotations You can also calculate the positions of text annotations in a graph. The following code adds annotations at three data points on a graph. text(3*pi/4,sin(3*pi/4),... '\leftarrowsin(t) = .707',... 'FontSize',16) text(pi,sin(pi),'\leftarrowsin(t) = 0',... 'FontSize',16) text(5*pi/4,sin(5*pi/4),'sin(t) = .707\rightarrow',... 'HorizontalAlignment','right',... 'FontSize',16) The HorizontalAlignment of the text string 'sin(t) = .707 \rightarrow' is set to right to place it on the left side of the point [5*pi/4,sin(5*pi/4)] Defining Symbols. For information on using symbols in text strings, see “Mathematical Symbols, Greek Letters, and TeX Characters” on page 3-25. 3 Formatting Graphs 3-20 You can use text objects to annotate axes at arbitrary locations. MATLAB locates text in the data units of the axes. For example, suppose you plot the function with A = 0.25, = 0.005, and t = 0 to 900. t = 0:900; plot(t,0.25*exp(0.005*t)) 0 1 2 3 4 5 6 7 −1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1 The Sine of 0 to 2 = 0 to 2 sin() sin(t) = .707 sin(t) = 0 sin(t) = −.707 y Ae t = 3-21 To annotate the point where the value of t = 300, calculate the text coordinates using the function you are plotting. text(300,.25*exp(.005*300),... '\bullet\leftarrow\fontname{times}0.25{\ite}^{-0.005{\itt}} at {\itt} = 300',... 'FontSize',14) This statement defines the text Position property as x = 300, The default text alignment places this point to the left of the string and centered vertically with the rectangle defined by the text Extent 0 100 200 300 400 500 600 700 800 900 0 0.05 0.1 0.15 0.2 0.25 Ae −t Amplitude Time sec. 0.25e −0.005t at t = 300 y 0.25e 0.005 300 = 3 Formatting Graphs 3-22 Text Alignment The HorizontalAlignment and the VerticalAlignment properties control the placement of the text characters with respect to the specified x-, y-, and z-coordinates. The following diagram illustrates the options for each property and the corresponding placement of the text. The default alignment is: • HorizontalAlignment = left • VerticalAlignment = middle MATLAB does not place the text String exactly on the specified Position . For example, the previous section showed a plot with a point annotated with text. Zooming in on the plot enables you to see the actual positioning of the text. Middle Top Cap Baseline Bottom Left Center Right Text HorizontalAlignment property viewed with the VerticalAlignment property set to middle (the default). Text VerticalAlignment property viewed with the HorizontalAlignment property set to left (the default). 3-23 The small dot is the point specified by the text Position property. The larger dot is the bullet defined as the first character in the text String property. Example – Aligning Text Suppose you want to label the minimum and maximum values in a plot with text that is anchored to these points and that displays the actual values. This example uses the plotted data to determine the location of the text and the values to display on the graph. One column from the peaks matrix generates the data to plot. Z = peaks; h = plot(Z(:,33)); The first step is to find the indices of the minimum and maximum values to determine the coordinates needed to position the text at these points ( get , find ). Then create the string by concatenating the values with a description of what the values are. x = get(h,'XData'); % Get the plotted data y = get(h,'YData'); imin = find(min(y) == y);% Find the index of the min and max imax = find(max(y) == y); text(x(imin),y(imin),[' Minimum = ',num2str(y(imin))],... 'VerticalAlignment','middle',... 'HorizontalAlignment','left',... 'FontSize',14) text(x(imax),y(imax),['Maximum = ',num2str(y(imax))],... 'VerticalAlignment','bottom',... 'HorizontalAlignment','right',... 0.25e −0.005t at t = 300 Point defined by text Position 3 Formatting Graphs 3-24 'FontSize',14) The text function positions the string relative to the point specified by the coordinates, in accordance with the settings of the alignment properties. For the minimum value, the string appears to the right of the text position point; for the maximum value the string appears above and to the left of the text position point. The text always remains in the plane of the computer screen, regardless of the view. Editing Text Annotations You can edit any of the text labels or annotations in a graph: 1 Start plot edit mode. 2 Double-click on the string. Or right-click on the string and select String An editing box appears around the text. 0 5 10 15 20 25 30 35 40 45 50 −3 −2 −1 0 1 2 3 4 Minimum = −2.7633 Maximum = 3.254 3-25 3 Make any changes to the text. 4 Click anywhere outside of the text edit box to end text editing. Note To create special characters in text, such as Greek letters or mathematical symbols, use TeX sequences – see the text string property. If you create special characters by using the Edit Font Properties dialog box and selecting the Symbol font family, you will not be able to edit that text object using MATLAB commands. Mathematical Symbols, Greek Letters, and TeX Characters You can include mathematical symbols and Greek letters in text using TeX-style characters sequences. This section describes how to construct a TeX (LaTex) character sequence used. Available Symbols and Greek Letters For a list of symbols and the character sequences used to define them, see the table of available TeX characters. In general, you can define text that includes symbols and Greek letters using the text function, assigning the character sequence to the String property of text objects. You can also include these character sequences in the string arguments of the title , xlabel , ylabel , and zlabel commands. Example – Using a Mathematical Expression to Title a Graph This example uses TeX character sequences to create graph labels. The following statements add a title and x- and y-axis labels to an existing graph. title('{\itAe}^{\alpha\itt}sin\beta{\itt} \alpha<<\beta') xlabel('Time \musec.') ylabel('Amplitude') 3 Formatting Graphs 3-26 The backslash character “\” precedes all TeX character sequences. Looking at the string defining the title illustrates how to use these characters. Controlling the Interpretation of TeX character The text Interpreter property controls the interpretation of TeX characters. If you set this property to none , MATLAB interprets the special characters literally. 0 100 200 300 400 500 600 700 800 900 1000 −0.25 −0.2 −0.15 −0.1 −0.05 0 0.05 0.1 0.15 0.2 0.25 Ae −t sint << Time sec. Amplitude Ae −t sint << {\itAe}^{\alpha\itt}sin\beta{\itt} \alpha<<\beta Make the A and e italics Superscript using symbol and italic t symbol and italic t and symbol following a space 3-27 Using Character and Numeric Variables in Text Any string variable is a valid specification for the text String property. This section illustrates some how to use matrix, cell array, and numeric variables as arguments to the text function. Character Variables For example, each row of the matrix PersonalData contains specific information about a person (note that all but the longest row is padded with a space so that each has the same number of columns). PersonalData = ['Jack Straw ';'489 Main St.';'Wichita KN ']; To display the data, index into the desired row. text(x1,y1,['Name: ',PersonalData(1,:)]) text(x3,y3,['City and State: ',PersonalData(3,:)]) Cell Arrays Using a cell array enables you to create multi-line text with a single text object. Each cell does not need to be the same number of characters. For example, the following statements, key(1)={'{\itAe}^{-\alpha\itt}sin\beta{\itt}'}; key(2)={'Time in \musec'}; key(3)={'Amplitude in volts'}; text(x,y,key) produce this output. Numeric Variables You can specify numeric variables in text strings using the num2str (number to string) function. For example, if you type on the command line, x = 21; ['Today is the ',num2str(x),'st day.'] 3 Formatting Graphs 3-28 MATLAB concatenates the three separate strings into one. Today is the 21st day. Since the result is a valid string, you can specify it as a value for the text String property. text(xcoord,ycoord,['Today is the ',num2str(x),'st day.']) Example - Multiline Text MATLAB supports multiline text strings using cell arrays. Simply define a string variable as a cell array with one line per cell. This example defines two cell arrays, one used for a uicontrol and the other as text . str1(1) = {'Center each line in the Uicontrol'}; str1(2) = {'Also check out the textwrap function'}; str2(1) = {'Each cell is a quoted string'}; str2(2) = {'You can specify how the string is aligned'}; str2(3) = {'You can use LaTeX symbols like \pi \chi \Xi'}; str2(4) = {'\bfOr use bold \rm\itor italic font\rm'}; str2(5) = {'\fontname{courier}Or even change fonts'}; plot(0:6,sin(0:6)) uicontrol('Style','text','Position',[80 80 200 30],... 'String',str1); text(5.75,sin(2.5),str2,'HorizontalAlignment','right') 3-29 Drawing Text in a Box When you use the text command to display a character string, the string’s position is defined by a rectangle called the Extent of the text. You can display this rectangle either as a box or a filled area. For example, you can highlight contour labels to make the text easier to read. [x,y] = meshgrid(-1:.01:1); z = x.*exp(-x.^2-y.^2);; [c,h]=contour(x,y,z); h = clabel(c,h); set(h,'BackgroundColor',[1 1 .6]) 0 1 2 3 4 5 6 −1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1 Each cell is a quoted string You can specify how the string is aligned You can use LaTeX symbols like Or use bold or italic font Or even change fonts 3 Formatting Graphs 3-30 For additional features, see the following text properties: • BackgroundColor – color of the rectangle’s interior (none by default). • EdgeColor – color of the rectangle’s edge (none by default). • LineStyle – style of the rectangle’s edge line (first set EdgeColor ). • LineWidth – width of the rectangle’s edge line (first set EdgeColor ) • Margin – increase the size of the rectangle by adding a margin to the text extent. −1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1 −1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1 −0.4 −0.4 −0.3 −0.3 −0.3 −0.2 −0.2 −0.2 −0.2 −0.1 −0.1 −0.1 0 0 0 0.1 0.1 0.1 0.2 0.2 0.2 0.2 0.3 0.3 0.3 0.4 0.4 Adding Arrows and Lines to Graphs 3-31 Adding Arrows and Lines to Graphs With plot editing mode enabled, you can add arrows and lines anywhere in a figure window. You can also use arrow characters (TeX characters) to create arrows using the text command. However, arrows created this way can only point to the left or right, horizontally. See “Calculating the Position of Text Annotations” on page 3-19 for an example. Creating Arrows and Lines in Plot Editing Mode Note Add arrow and line annotations after you are finished moving or resizing your axes. Arrows and lines annotations are not anchored to the axes. If you move or resize the axes, you will have to reposition your arrow and line annotations as well. To add an arrow or line annotation to a graph: 1 Click on the Insert or Line o ption, or click the Arrow or Line buttons in the figure window toolbar. Arrows 3 Formatting Graphs 3-32 MATLAB changes the cursor to a cross-hair style. 2 Position the cursor in the figure where you want to start the line or arrow and press either mouse button. Hold the button down and move the mouse to define the length and direction of the line or arrow. 3 Release the mouse button. Note After you add an arrow or line, plot edit mode is enabled in the figure, if it was not already enabled. Editing Arrows and Line Annotations You can edit the appearance of arrow and line annotations using the Property Editor. With plot editing mode enabled, double-click on the arrow or line annotation to start the Property Editor, if it is not already started. The Property Editor displays the set of panels specific to arrow or line objects. Use the fields in the panels to change the style, width, color, and many other characteristics of the arrow or line annotation object. Arrow Line Adding Plots of Basic Statistics to Graphs 3-33 to Graphs The MATLAB Data Statistics tool: •Calculates basic statistics about the central tendency and variability of data plotted in a graph. •Plots these statistics in the graph For example, the following figure includes a plot of the mean of the Predator y-data. The following sections provide more information about using the Data Statistics tool: •“Example - Plotting the Mean of a Data Set” on page 3-34 •“Formatting Plots of Data Statistics” on page 3-36 •“Statistics Plotted by the Data Statistics Tool” on page 3-36 •“Viewing Statistics for Multiple Plots” on page 3-37 •“Saving Statistics to the MATLAB Workspace” on page 3-38 Plot of Data Statistic 3 Formatting Graphs 3-34 Example - Plotting the Mean of a Data Set To add a plot of the mean of a data set to a graph: 1 Plot your data. For example, use these commands to plot historical population data from the United States census. load census plot(cdate,pop,'+') 2 Select the Data Statistics option from the figure window Tools The Data Statistics tool calculates basic statistics on the x-data and y-data of the plot in the graph and displays the results in a dialog box. 3 Select the statistic you want to plot in your graph by clicking in the check box next to the value. For example, to add a plot of the mean of the population data (y-data) to the graph, click in the check box next to the value (as shown in the figure). The Data Statistics tool adds the plot of the mean to the graph. Select the statistic you want to plot by clicking in its check box. Adding Plots of Basic Statistics to Graphs 3-35 Using a Legend with Data Statistics When you activate the Data Statistics tool, it calculates statistics for the plotted data and automatically adds a legend to the graph, if the graph doesn’t already have one. Initially, the legend only includes entries for the data sets plotted in the graph. In the legend, each data set is identified by its tag. (A tag is a user-defined text string that can be associated with any graphics object. For information about creating tags, see “Identifying Objects in a Graph” on page 1-20.) If there are data sets in the graph that do not have tags, the Data Statistics tool creates a label for them, using data 1 to identify the first plot, data 2 to identify the second plot, and so on. When you add a plot of one or more statistics to the graph, the Data Statistics tool adds an entry in the legend for the new plot. The Data Statistics tool assigns the plotted statistic a descriptive name that identifies it in the legend. In the example, the plotted statistic has the name y mean in the legend. Plot of the mean of the population data The Data Statistics tool adds a legend automatically. 3 Formatting Graphs 3-36 Formatting Plots of Data Statistics The Data Statistics tool uses color and line style to distinguish the plots of statistics from the other plots in a graph. However, like any other plot in a graph, you can change these characteristics. Note Do not edit the format of the plots of data statistics, until you are finished adding them to a graph. If you edit a plot of data statistics, delete the plot, and then add it back, any formatting you did to the plotted statistics will be lost. To modify the properties of a plotted statistic: 1 Enable plot editing mode in the figure window. 2 Double-click on the plot of the statistic. This starts the MATLAB Property Editor, which provides access to properties of the line object used to plot the statistic. You can also access a subset of these properties by right-clicking on the plot. This brings up the plot’s context menu, which includes options for specifying line width, line style, and color. 3 Change the properties of the plot and click Apply . Statistics Plotted by the Data Statistics Tool Note You can only use the Data Statistics tool to generate statistics for two-dimensional data (vectors and matrices). The following table lists the statistics calculated by the Data Statistics tool. The table includes the name of the MATLAB function used to calculate the Adding Plots of Basic Statistics to Graphs 3-37 statistic. For more information about these statistical functions, see the “Basic Data Analysis Functions” in the “Data Analysis and Statistics” chapter. Automatic Updating of Statistics If you have the Data Statistics tool displayed and you change the x-data or y-data of a plot, the Data Statistics tool automatically regenerates the statistics for that plot. Viewing Statistics for Multiple Plots The Data Statistics tool calculates basic statistics for every 2-D plot in a graph, but displays the statistics for only one plot at time. To view the statistics for a particular plot in a graph: Statistic Description MATLAB Function Maximum The largest value in the data set max Minimum The smallest value in the data set min Mean The average of all the values in the data set mean Median The middle value in the data set median Range The interval between the lowest value and the highest value in the data set. The Data Statistic tool does not plot the range statistic. n/a Standard deviation A measure characterizing the amount of variation among the values in the data set Note: The Data Statistics tool uses two lines to plot the standard deviation in a graph. The lines represent the boundaries of one standard deviation on either side of the mean of the data set. std 3 Formatting Graphs 3-38 1 Click the Statistics for menu in the Data Statistics dialog box. This menu lists all the data sets plotted in the graph, identifying each data set by its tag. (A tag is a user-defined text string that can be associated with any graphics object.) For plots in the graph that do not have tags, the Data Statistics tool uses data1 to identify the first plot, data2 to identify the second plot, and so on. 2 Select a plot from the list. The Data Statistics tool updates the values displayed in the dialog box. Saving Statistics to the MATLAB Workspace To save the statistics generated by the Data Statistics tool to the MATLAB workspace, follow this procedure: Note You must repeat this procedure for each plot in a graph containing multiple plots. 1 Click the Save to Workspace button. 2 In the Save Statistics to Workspace dialog box, specify which sets of statistics you want to save, x-data or y-data, and specify the names you want to assign to the variables in which the statistics will be stored. Lists the data sets on which the statistics have been calculated. Specify the set of statistics you want to save. Assign a name to the variable. Adding Plots of Basic Statistics to Graphs 3-39 The Data Statistics tool saves each set of statistics in a structure. For example, if you save the set of statistics on the x-data in the census in the variable census_dates, the contents of the structure looks like this. census_dates = min: 1790 max: 1990 mean: 1890 median: 1890 std: 62.0484 range: 200 3 Formatting Graphs 3-40 4 Creating Specialized Plots Bar and Area Graphs (p.4-2) View results over time, comparing results, and displaying individual contribution to a total amount. Pie Charts (p.4-14) Individual contribution to a total amount. Histograms (p.4-17) Distribution of data values. Discrete Data Graphs (p.4-22) Stem and stairstep plots of discrete data. Direction and Velocity Vector Graphs (p.4-31) Compass, feather, and quiver plots show direction and magnitude. Contour Plots (p.4-37) Indicate locations of equal data values. Interactive Plotting (p.4-48) User-selectable data point (using mouse) for plotting. Animation (p.4-50) Show an additional data dimension by sequencing plots. 4 Creating Specialized Plots 4-2 Bar and Area Graphs Bar and area graphs display vector or matrix data. These types of graphs are useful for viewing results over a period of time, comparing results from different datasets, and showing how individual elements contribute to an aggregate amount. Bar graphs are suitable for displaying discrete data, whereas area graphs are more suitable for displaying continuous data. Types of Bar Graphs MATLAB has four specialized functions that display bar graphs. These functions display 2- and 3-D bar graphs, and vertical and horizontal bar graphs. Grouped Bar Graph By default, a bar graph represents each element in a matrix as one bar. Bars in a 2-D bar graph, created by the bar function, are distributed along the x-axis with each element in a column drawn at a different location. All elements in a row are clustered around the same location on the x-axis. Function Description bar Displays columns of m-by-n matrix as m groups of n vertical bars barh Displays columns of m-by-n matrix as m groups of n horizontal bars bar3 Displays columns of m-by-n matrix as m groups of n vertical 3-D bars bar3h Displays columns of m-by-n matrix as m groups of n horizontal 3-D bars area Displays vector data as stacked area plots Two-Dimensional Three-Dimensional Vertical bar bar3 Horizontal barh bar3h Bar and Area Graphs 4-3 For example, define Y as a simple matrix and issue the bar statement in its simplest form. Y = [5 2 1 8 7 3 9 8 6 5 5 5 4 3 2]; bar(Y) The bars are clustered together by rows and evenly distributed along the x-axis. Detached 3-D Bars The bar3 function, in its simplest form, draws each element as a separate 3-D block, with the elements of each column distributed along the y-axis. Bars that represent elements in the first column of the matrix are centered at 1 along the x-axis. Bars that represent elements in the last column of the matrix are centered at size(Y,2) along the x-axis. For example, bar3(Y) displays five groups of three bars along the y-axis. Notice that larger bars obscure Y(1,2) and Y(1,3) . 1 2 3 4 5 0 1 2 3 4 5 6 7 8 9 Y(1,:) = [5 2 1] The first cluster of bars represents the first row in Y . 4 Creating Specialized Plots 4-4 By default, bar3 draws detached bars. The statement bar3(Y,'detach') has the same effect. Labeling the Graph. To add axes labels and x tick marks to this bar graph, use the statements xlabel('X Axis') ylabel('Y Axis') zlabel('Z Axis') set(gca,'XTick',[1 2 3]) Grouped 3-D Bars Cluster the bars from each row beside each other by specifying the argument 'group'. For example, bar3(Y,'group') groups the bars according to row and distributes the clusters evenly along the y-axis. 1 2 3 1 2 3 4 5 0 2 4 6 8 10 Z Axis Y Axis X Axis Y(5,:) = [4 3 2] The last cluster of bars represents the last row in Y . Bar and Area Graphs 4-5 Stacked Bar Graphs to Show Contributing Amounts Bar graphs can show how elements in the same row of a matrix contribute to the sum of all elements in the row. These types of bar graphs are referred to as stacked bar graphs. Stacked bar graphs display one bar per row of a matrix. The bars are divided into n segments, where n is the number of columns in the matrix. For vertical bar graphs, the height of each bar equals the sum of the elements in the row. Each segment is equal to the value of its respective element. Redefining Y Y = [5 1 2 8 3 7 9 6 8 5 5 5 4 2 3]; Create stacked bar graphs using the optional 'stack' argument. For example, bar(Y,'stack') grid on set(gca,'Layer','top') % display gridlines on top of graph 1 2 3 4 5 0 1 2 3 4 5 6 7 8 9 Z Axis Y Axis Y(5,:) = [4 3 2] The last cluster of bars represents the last row 4 Creating Specialized Plots 4-6 creates a 2-D stacked bar graph, where all elements in a row correspond to the same x location. Horizontal Bar Graphs For horizontal bar graphs, the length of each bar equals the sum of the elements in the row. The length of each segment is equal to the value of its respective element. barh(Y,'stack') grid on set(gca,'Layer','top') % Display gridlines on top of graph 1 2 3 4 5 0 5 10 15 20 25 Y(1,:) = [5 1 2] The first stack of bars represents the first row in Y . Bar and Area Graphs 4-7 Specifying X-Axis Data Bar graphs automatically generate x-axis values and label the x-axis tick lines. You can specify a vector of x values (or y values in the case of horizontal bar graphs) to label the axes. For example, given temperature data, temp = [29 23 27 25 20 23 23 27]; obtained from samples taken every five days during a thirty-five day period, days = 0:5:35; you can display a bar graph showing temperature measured along the y-axis and days along the x-axis using bar(days,temp) These statements add labels to the x- and y-axis. xlabel('Day') ylabel('Temperature (^{o}C)') 0 5 10 15 20 25 1 2 3 4 5 Y(1,:) = [5 1 2] The lower stack of bars represents the first row in Y . 4 Creating Specialized Plots 4-8 Setting Y-Axis Limits By default, the y-axis range is from 0 to 30. To focus on the temperature range from 15 to 30, change the y-axis limits. set(gca,'YLim',[15 30],'Layer','top') 0 5 10 15 20 25 30 35 0 5 10 15 20 25 30 Day Temperature ( o C) Bar and Area Graphs 4-9 Overlaying Plots on Bar Graphs You can overlay data on a bar graph by creating another axes in the same position. This enables you to have an independent y-axis for the overlaid dataset (in contrast to the hold on statement, which uses the same axes). For example, consider a bioremediation experiment that breaks down hazardous waste components into nontoxic materials. The trichloroethylene (TCE) concentration and temperature data from this experiment are TCE = [515 420 370 250 135 120 60 20]; temp = [29 23 27 25 20 23 23 27]; This data was obtained from samples taken every five days during a thirty-five day period. days = 0:5:35; Display a bar graph and label the x- and y-axis using the statements bar(days,temp) xlabel('Day') ylabel('Temperature (^{o}C)') Day Temperature ( o C) 0 5 10 15 20 25 30 35 15 20 25 30 4 Creating Specialized Plots 4-10 Overlaying a Line Plot on the Bar Graph To overlay the concentration data on the bar graph, position a second axes at the same location as the first axes, but first save the handle of the first axes. h1 = gca; Create the second axes at the same location before plotting the second dataset. h2 = axes('Position',get(h1,'Position')); plot(days,TCE,'LineWidth',3) To ensure that the second axes does not interfere with the first, locate the y-axis on the right side of the axes, make the background transparent, and set the second axes’ x-tick marks to the empty matrix. set(h2,'YAxisLocation','right','Color','none','XTickLabel',[]) Align the x-axis of both axes and display the grid lines on top of the bars. set(h2,'XLim',get(h1,'XLim'),'Layer','top') Annotating the Graph. These statements annotate the graph. text(11,380,'Concentration','Rotation', 55,'FontSize',16) 0 5 10 15 20 25 30 35 0 5 10 15 20 25 30 Day Temperature ( o C) TCE Concentration (PPM) Bioremediation Concentration 0 100 200 300 400 500 600 Bar and Area Graphs 4-11 ylabel('TCE Concentration (PPM)') title('Bioremediation','FontSize',16) To print the graph, set the current figure’s PaperPositionMode to auto , which ensures the printed output matches the display. set(gcf,'PaperPositionMode','auto') Area Graphs The area function displays curves generated from a vector or from separate columns in a matrix. area plots the values in each column of a matrix as a separate curve and fills the area between the curve and the x-axis. Area Graphs Showing Contributing Amounts Area graphs are useful for showing how elements in a vector or matrix contribute to the sum of all elements at a particular x location. By default, area accumulates all values from each row in a matrix and creates a curve from those values. Using this matrix, Y = [5 1 2 8 3 7 9 6 8 5 5 5 4 2 3]; the statement, area(Y) displays a graph containing three area graphs, one per column. The height of the area graph is the sum of the elements in each row. Each successive curve uses the preceding curve as its base. 4 Creating Specialized Plots 4-12 Displaying the Grid on Top. To display the grid lines in the foreground of the area graph and display only five grid lines along the x-axis, use the statements set(gca,'Layer','top') set(gca,'XTick',1:5) Comparing Datasets with Area Graphs Area graphs are useful for comparing different datasets. For example, given a vector containing sales figures, sales = [51.6 82.4 90.8 59.1 47.0]; for the five-year period x = 90:94; and a vector containing profits figures for the same five-year period profits = [19.3 34.2 61.4 50.5 29.4]; display both as two separate area graphs within the same axes. Set the color of the area interior ( FaceColor ), its edges ( EdgeColor ), and the width of the edge lines ( LineWidth ). See patch for a complete list of properties. area(x,sales,'FaceColor',[.5 .9 .6],... 1 2 3 4 5 0 5 10 15 20 25 Y(1,:) = [5 1 2] The first row in Y Bar and Area Graphs 4-13 'EdgeColor','b',... 'LineWidth',2) hold on area(x,profits,'FaceColor',[.9 .85 .7],... 'EdgeColor','y',... 'LineWidth',2) hold off To annotate the graph, use the statements set(gca,'XTick',[90:94]) set(gca,'Layer','top') gtext('\leftarrow Sales') gtext('Profits') gtext('Expenses') xlabel('Years','FontSize',14) ylabel('Expenses + Profits = Sales in 1,000''s','FontSize',14) Years Expenses + Profits = Sales in 1,000’s Sales Profits Expenses 90 91 92 93 94 0 10 20 30 40 50 60 70 80 90 100 4 Creating Specialized Plots 4-14 Pie Charts Pie charts display the percentage that each element in a vector or matrix contributes to the sum of all elements. pie and pie3 create 2-D and 3-D pie charts. Example – Pie Chart Here is an example using the pie function to visualize the contribution that three products make to total sales. Given a matrix X where each column of X contains yearly sales figures for a specific product over a five-year period, X = [19.3 22.1 51.6; 34.2 70.3 82.4; 61.4 82.9 90.8; 50.5 54.9 59.1; 29.4 36.3 47.0]; sum each row in X to calculate total sales for each product over the five-year period. x = sum(X); You can offset the slice of the pie that makes the greatest contribution using the explode input argument. This argument is a vector of zero and nonzero values. Nonzero values offset the respective slice from the chart. First, create a vector containing zeros. explode = zeros(size(x)); Then find the slice that contributes the most and set the corresponding explode element to 1 . [c,offset] = max(x); explode(offset) = 1; The explode vector contains the elements [0 0 1] . To create the exploded pie chart, use the statement. h = pie(x,explode); colormap summer Pie Charts 4-15 Labeling the Graph The pie chart’s labels are text graphics objects. To modify the text strings and their positions, first get the objects’ strings and extents. Braces around a property name ensure that get outputs a cell array, which is important when working with multiple objects. textObjs = findobj(h,'Type','text'); oldStr = get(textObjs,{'String'}); val = get(textObjs,{'Extent'}); oldExt = cat(1,val{:}); Create the new strings, then set the text objects’ String properties to the new strings. Names = {'Product X: ';'Product Y: ';'Product Z: '}; newStr = strcat(Names,oldStr); set(textObjs,{'String'},newStr) Find the difference between the widths of the new and old text strings and change the values of the Position properties. val1 = get(textObjs, {'Extent'}); newExt = cat(1, val1{:}); offset = sign(oldExt(:,1)).*(newExt(:,3) oldExt(:,3))/2; Product X: 25% Product Y: 34% Product Z: 42% 4 Creating Specialized Plots 4-16 pos = get(textObjs, {'Position'}); textPos = cat(1, pos{:}); textPos(:,1) = textPos(:,1)+offset; set(textObjs,{'Position'},num2cell(textPos,[3,2])) Removing a Piece from a Pie Charts When the sum of the elements in the first input argument is equal to or greater than 1 , pie and pie3 normalize the values. So, given a vector of elements x, each slice has an area of x i /sum(x i ), where x i is an element of x. The normalized value specifies the fractional part of each pie slice. When the sum of the elements in the first input argument is less than 1 , pie and pie3 do not normalize the elements of vector x . They draw a partial pie. For example, x = [.19 .22 .41]; pie(x) 19% 22% 41% Histograms 4-17 Histograms MATLAB histogram functions show the distribution of data values. The functions that create histograms are hist and rose . The histogram functions count the number of elements within a range and display each range as a rectangular bin. The height (or length when using rose ) of the bins represents the number of values that fall within each range. Histograms in Cartesian Coordinate Systems The hist function shows the distribution of the elements in Y as a histogram with equally spaced bins between the minimum and maximum values in Y . If Y is a vector and is the only argument, hist creates up to 10 bins. For example, yn = randn(10000,1); hist(yn) generates 10,000 random numbers and creates a histogram with 10 bins distributed along the x-axis between the minimum and maximum values of yn . Function Description hist Displays data in a Cartesian coordinate system rose Displays data in a polar coordinate system 4 Creating Specialized Plots 4-18 Matrix Input Argument When Y is a matrix, hist creates a set of bins for each column, displaying each set in a separate color. The statements Y = randn(10000,3); hist(Y) create a histogram showing 10 bins for each column in Y . −4 −3 −2 −1 0 1 2 3 4 0 500 1000 1500 2000 2500 3000 Histograms 4-19 Histograms in Polar Coordinates A rose plot is a histogram created in a polar coordinate system. For example, consider samples of the wind direction taken over a 12-hour period. wdir = [45 90 90 45 360 335 360 270 335 270 335 335]; To display this data using the rose function, convert the data to radians; then use the data as an argument to the rose function. Increase the LineWidth property of the line to improve the visibility of the plot ( findobj ). wdir = wdir * pi/180; rose(wdir) hline = findobj(gca,'Type','line'); set(hline,'LineWidth',1.5) The plot shows that the wind direction was primarily 335° during the 12-hour period. −4 −3 −2 −1 0 1 2 3 4 5 0 500 1000 1500 2000 2500 3000 3500 4 Creating Specialized Plots 4-20 Specifying Number of Bins hist and rose interpret their second argument in one of two ways — as the locations on the axis or the number of bins. When the second argument is a vector x , it specifies the locations on the axis and distributes the elements in length(x) bins. When the second argument is a scalar x , hist and rose distribute the elements in x bins. For example, compare the distribution of data created by two MATLAB functions that generate random numbers. The randn function generates normally distributed random numbers, whereas the rand function generates uniformly distributed random numbers. yn = randn(10000,1); yu = rand(10000,1); The first histogram displays the data distribution resulting from the randn function. The locations on the x-axis and number of bins depend on the vector x . x = min(yn):.2:max(yn); subplot(1,2,1) 1 2 3 4 30 210 60 240 90 270 120 300 150 330 180 0 Histograms 4-21 hist(yn,x) title('Normally Distributed Random Numbers','FontSize',16) The second histogram displays the data distribution resulting from the rand function and explicitly creates 25 bins along the x-axis. subplot(1,2,2) hist(yu,25) title('Uniformly Distributed Random Numbers','FontSize',16) Note You can change the aspect ratio of the histogram plots using the mouse to resize the figure window. However, before creating hardcopy output, set the figure’s PaperPositionMode to auto to produce printed output that matches the display. set(gcf,'PaperPositionMode','auto') −4 −2 0 2 4 0 100 200 300 400 500 600 700 800 900 Normally Distributed Random Numbers 0 0.2 0.4 0.6 0.8 1 0 50 100 150 200 250 300 350 400 450 Uniformly Distributed Random Numbers 4 Creating Specialized Plots 4-22 Discrete Data Graphs MATLAB has a number of specialized functions that are appropriate for displaying discrete data. This section describes how to use stem plots and stairstep plots to display this type of data. (Bar charts, discussed earlier in this section, are also suitable for displaying discrete data.) •“Two–Dimensional Stem Plots” on page 4-22 – compares 2-D stem and line plots and shows techniques for customizing the stems. •“Combining Stem Plots with Line Plots” on page 4-25 – combination line and stem plot with legend. •“Three-Dimensional Stem Plots” on page 4-26 – 3-D stem plot of an FFT and a combination 3-D stem and line plot. •“Stairstep Plots” on page 4-29 – plotting a mathematical function with a stairstep plot. The following table lists the commands described in this section. Two–Dimensional Stem Plots A stem plot displays data as lines (stems) terminated with a marker symbol at each data value. In a 2-D graph, stems extend from the x-axis. The stem function displays two-dimensional discrete sequence data. For example, evaluating the function with the values, alpha = .02; beta = .5; t = 0:4:200; y = exp(-alpha*t).*sin(beta*t); yields a vector of discrete values for y at given values of t . A line plot shows the data points connected with a straight line. plot(t,y) Function Description stem Displays a discrete sequence of y-data as stems from x-axis stem3 Displays a discrete sequence of z-data as stems from xy-plane stairs Displays a discrete sequence of y-data as steps from x-axis y e t tcos= Discrete Data Graphs 4-23 A stem plot of the same function plots only discrete points on the curve. stem(t,y) 0 20 40 60 80 100 120 140 160 180 200 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1 0 20 40 60 80 100 120 140 160 180 200 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1 Time in secs Magnitude 4 Creating Specialized Plots 4-24 Add axes labels to the x- and y-axis. xlabel('Time in \musecs') ylabel('Magnitude') If you specify only one argument, the number of samples is equal to the length of that argument. In this example, the number of samples is a function of t, which contains 51 elements and determines the length of y. Customizing the Graph You can specify the line style, the type of marker, and the color used in the stem plot. For example, adding the string 'sr' specifies a dotted line ( ), a square marker ( s ), and a red color ( r ). The 'fill' argument colors the face of the marker. stem(t,y,'sr','fill') Setting the aspect ratio of the x- and y-axis to 2:1 improves the utility of the graph. You can do this by setting the aspect ratio of the plot box using pbaspect . pbaspect([2,1,1]) This is equivalent to setting the PlotBoxApectRatio property directly. 0 20 40 60 80 100 120 140 160 180 200 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1 Discrete Data Graphs 4-25 set(gca,'PlotBoxAspectRatio',[2,1,1]) See LineSpec for a list of line styles and marker types. Combining Stem Plots with Line Plots Sometimes it is useful to display more than one plot simultaneously with a stem plot to show how you arrived at a result. For example, create a linearly spaced vector with 60 elements and define two functions, a and b . x = linspace(0,2*pi,60); a = sin(x); b = cos(x); Create a stem plot showing the linear combination of the two functions. stem_handles = stem(x,a+b); Overlaying a and b as line plots helps visualize the functions. Before plotting the two curves, set hold to on so MATLAB does not clear the stem plot. hold on plot_handles = plot(x,a,'r',x,b,'g'); hold off Use legend to annotate the graph. The stem and plot handles passed to legend identify which lines to label. Stem plots are composed of two lines; one draws the markers and the other draws the vertical stems. To create the legend, use the first handle returned by stem , which identifies the marker line. legend_handles = [stem_handles(1);plot_handles]; legend(legend_handles,'a + b','a = sin(x)','b = cos(x)') Labeling the axes and creating a title finishes the graph. xlabel('Time in \musecs') ylabel('Magnitude') title('Linear Combination of Two Functions') 4 Creating Specialized Plots 4-26 Three-Dimensional Stem Plots stem3 displays 3-D stem plots extending from the xy-plane. With only one vector argument, MATLAB plots the stems in one row at x = 1 or y = 1 , depending on whether the argument is a column or row vector. stem3 is intended to display data that you cannot visualize in a 2-D view. Example – 3-D Stem Plot of an FFT For example, fast Fourier transforms are calculated at points around the unit circle on the complex plane. So, it is interesting to visualize the plot around the unit circle. Calculating the unit circle th = (0:127)/128*2*pi; x = cos(th); y = sin(th); and the magnitude frequency response of a step function f = abs(fft(ones(10,1),128)); 0 1 2 3 4 5 6 7 −1.5 −1 −0.5 0 0.5 1 1.5 Time in secs Magnitude Linear Combination of Two Functions a + b a = sin(x) b = cos(x) Discrete Data Graphs 4-27 displays the data using a 3-D stem plot, terminating the stems with filled diamond markers. stem3(x,y,f','d','fill') view([65 30]) Label the Graph Label the graph with the statements xlabel('Real') ylabel('Imaginary') zlabel('Amplitude') title('Magnitude Frequency Response') To change the orientation of the view, turn on mouse-based 3-D rotation. rotate3d on Example – Combining Stem and Line Plots Three-dimensional stem plots work well when visualizing discrete functions that do not output a large number of data points. For example, you can use −1 −0.5 0 0.5 1 −1 −0.5 0 0.5 1 0 2 4 6 8 10 Real Magnitude Frequency Response Imaginary Amplitude 4 Creating Specialized Plots 4-28 stem3 to visualize the Laplace transform basis function,, for a particular constant value of s . t = 0:.1:10;% Time limits s = 0.1+i;% Spiral rate y = exp( - s*t);% Compute decaying exponential Using t as magnitudes that increase with time, create a spiral with increasing height and draw a curve through the tops of the stems to improve definition. stem3(real(y),imag(y),t) hold on plot3(real(y),imag(y),t,'r') hold off view(-39.5,62) Label the Graph Add axes labels, with the statements xlabel('Real') ylabel('Imaginary') zlabel('Magnitude') y e st = −1 −0.5 0 0.5 1 −1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 0 5 10 Real Imaginary Magnitude Discrete Data Graphs 4-29 Stairstep Plots Stairstep plots display data as the leading edges of a constant interval (i.e., zero-order hold state). This type of plot holds the data at a constant y-value for all values between x(i) and x(i+1), where i is the index into the x data. This type of plot is useful for drawing time-history plots of digitally sampled data systems. Example – Stairstep Plot of a Function For example, define a function f that varies over time, alpha = 0.01; beta = 0.5; t = 0:10; f = exp(alpha*t).*sin(beta*t); Use stairs to display the function as a stairstep plot and a linearly interpolated function. stairs(t,f) hold on plot(t,f,'--*') hold off 0 1 2 3 4 5 6 7 8 9 10 −1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1 Stairstep plot of e −(*t) sin*t t = 0:10 4 Creating Specialized Plots 4-30 Annotate the graph and set the axes limits. label = 'Stairstep plot of e^{ (\alpha*t)} sin\beta*t'; text(0.5, 0.2,label,'FontSize',14) xlabel('t = 0:10','FontSize',14) axis([0 10 1.2 1.2]) Direction and Velocity Vector Graphs 4-31 Direction and Velocity Vector Graphs Several MATLAB functions display data consisting of direction vectors and velocity vectors. This section describes these functions. You can define the vectors using one or two arguments. The arguments specify the x and y components of the vectors relative to the origin. If you specify two arguments, the first specifies the x components of the vectors and the second the y components of the vectors. If you specify one argument, the functions treat the elements as complex numbers. The real parts are the x components and the imaginary parts are the y components. Compass Plots The compass function shows vectors emanating from the origin of a graph. The function takes Cartesian coordinates and plots them on a circular grid. Example – Compass Plot of Wind Direction and Speed This example shows a compass plot indicating the wind direction and strength during a 12-hour period. Two vectors define the wind direction and strength. wdir = [45 90 90 45 360 335 360 270 335 270 335 335]; knots = [6 6 8 6 3 9 6 8 9 10 14 12]; Convert the wind direction, given as angles, into radians before converting the wind direction into Cartesian coordinates. rdir = wdir * pi/180; [x,y] = pol2cart(rdir,knots); compass(x,y) Function Description compass Displays vectors emanating from the origin of a polar plot. feather Displays vectors extending from equally spaced points along a horizontal line. quiver Displays 2-D vectors specified by (u,v) components. quiver3 Displays 3-D vectors specified by (u,v,w) components. 4 Creating Specialized Plots 4-32 Create text to annotate the graph. desc = {'Wind Direction and Strength at', 'Logan Airport for ', 'Nov. 3 at 1800 through', 'Nov. 4 at 0600'}; text( 28,15,desc) Feather Plots The feather function shows vectors emanating from a straight line parallel to the x-axis. For example, create a vector of angles from 90° to 0° and a vector the same size, with each element equal to 1 . theta = 90: 10:0; r = ones(size(theta)); Before creating a feather plot, transform the data into Cartesian coordinates and increase the magnitude of r to make the arrows more distinctive. [u,v] = pol2cart(theta*pi/180,r*10); feather(u,v) axis equal 5 10 15 30 210 60 240 90 270 120 300 150 330 180 0 Wind Direction and Strength at Logan Airport for Nov. 3 at 1800 through Nov. 4 at 0600 Direction and Velocity Vector Graphs 4-33 Plotting Complex Numbers If the input argument, Z , is a matrix of complex numbers, feather interprets the real parts of Z as the x components of the vectors and the imaginary parts as the y components of the vectors. t = 0:0.5:10;% Time limits s = 0.05+i; % Spiral rate Z = exp( s*t);% Compute decaying exponential feather(Z) −5 0 5 10 15 20 25 −5 0 5 10 15 0 5 10 15 20 25 −1 −0.5 0 0.5 1 4 Creating Specialized Plots 4-34 Printing the Graph This particular graph looks better if you change the figure’s aspect ratio by stretching the figure lengthwise using the mouse. However, to maintain this shape in the printed output, set the figure’s PaperPositionMode to auto . set(gcf,'PaperPositionMode','auto') In this mode, MATLAB prints the figure as it appears on screen. Two-Dimensional Quiver Plots The quiver function shows vectors at given points in two-dimensional space. The vectors are defined by x and y components. A quiver plot is useful when displayed with another plot. For example, create 10 contours of the peaks n = 2.0:.2:2.0; [X,Y,Z] = peaks(n); contour(X,Y,Z,10) −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 Direction and Velocity Vector Graphs 4-35 to create the vector components to use as inputs to quiver Set hold to on hold on quiver(X,Y,U,V) hold off Three-Dimensional Quiver Plots Three-dimensional quiver plots ( quiver3 ) display vectors consisting of (u,v,w) components at (x,y,z) locations. For example, you can show the path of a projectile as a function of time, First, assign values to the constants vz and a . vz = 10;% Velocity a = 32;% Acceleration −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 z t( ) v z t at 2 2 -------- += 4 Creating Specialized Plots 4-36 Then, calculate the height z, as time varies from 0 to 1 in increments of 0.1 . t = 0:.1:1; z = vz*t + 1/2*a*t.^2; Calculate the position in the x and y directions. vx = 2; x = vx*t; vy = 3; y = vy*t; Compute the components of the velocity vectors and display the vectors using the 3-D quiver plot. scale = 0; quiver3(x,y,z,u,v,w,scale) view([70 18]) 0 0.5 1 1.5 2 2.5 0 0.5 1 1.5 2 2.5 3 3.5 −10 −8 −6 −4 −2 0 2 Contour Plots 4-37 Contour Plots The contour functions create, display, and label isolines determined by one or more matrices. Creating Simple Contour Plots contour and contour3 display 2- and 3-D contours, respectively. They require only one input argument — a matrix interpreted as heights with respect to a plane. In this case, the contour functions determine the number of contours to display based on the minimum and maximum data values. To explicitly set the number of contour levels displayed by the functions, you specify a second optional argument. Contour Plot of the Peaks Function The statements, [X,Y,Z] = peaks; contour(X,Y,Z,20) display 20 contours of the peaks function in a 2-D view. Function Description clabel Generates labels using the contour matrix and displays the labels in the current figure. contour Displays 2-D isolines generated from values given by a matrix Z . contour3 Displays 3-D isolines generated from values given by a matrix Z . contourf Displays a 2-D contour plot and fills the area between the isolines with a solid color. contourc Low-level function to calculate the contour matrix used by the other contour functions. meshc Creates a mesh plot with a corresponding 2-D contour plot. surfc Creates a surface plot with a corresponding 2-D contour plot. 4 Creating Specialized Plots 4-38 The statements [X,Y,Z] = peaks; contour3(X,Y,Z,20) h = findobj('Type','patch'); set(h,'LineWidth',2) title('Twenty Contours of the peaks Function') display 20 contours of the peaks function in a 3-D view and increase the line width to 2 points. −3 −2 −1 0 1 2 3 −3 −2 −1 0 1 2 3 Twenty Contours of the peaks Function Contour Plots 4-39 Labeling Contours Each contour level has a value associated with it. clabel uses these values to display labels for 2-D contour lines. The contour matrix contains the values clabel uses for the labels. This matrix is returned by contour , contour3 , and contourf and is described in the “Contouring Algorithm” section. clabel optionally returns the handles of the text objects used as labels. You can then use these handles to set the properties of the label string. For example, display 10 contour levels of the peaks function, Z = peaks; [C,h] = contour(Z,10); then label the contours and display a title. clabel(C,h) title({'Contour Labeled Using','clabel(C,h)'}) Note that clabel labels only those contour lines that are large enough to have an inline label inserted. −3 −2 −1 0 1 2 3 −3 −2 −1 0 1 2 3 −10 −5 0 5 10 Twenty Contours of the peaks Function 4 Creating Specialized Plots 4-40 The 'manual' option enables you to add labels by selecting the contour you want to label with the mouse. You can also use this option to label only those contours you select interactively. For example, clabel(C,h,'manual') displays a crosshair cursor when your cursor is inside the figure. Pressing any mouse button labels the contour line closest to the center of the crosshair. Filled Contours contourf displays a two-dimensional contour plot and fills the areas between contour lines. Use caxis to control the mapping of contour to color. For example, this filled contour plot of the peaks data uses caxis to map the fill colors into the center of the colormap. Z = peaks; [C,h] = contourf(Z,10); caxis([20 20]) 5 10 15 20 25 30 35 40 45 5 10 15 20 25 30 35 40 45 Contour Labeled Using clabel(C,h) −3.888 −2.559 −2.559 −1.23 −1.23 −1.23 0.09964 0.09964 0.09964 0.09964 0.09964 0.09964 0.09964 1.429 1.429 1.429 1.429 1.429 2.758 2.758 2.758 4.087 5.417 6.746 Contour Plots 4-41 title({'Filled Contour Plot Using','contourf(Z,10)'}) Drawing a Single Contour Line at a Desired Level The contouring functions permit you to specify the number of contour levels or the particular contour levels to draw. In the case of contour , the two forms of the function are contour(Z,n) and contour(Z,v) . Z is the data matrix, n is the number of contour lines, and v is a vector of specific contour levels. MATLAB does not differentiate between a scalar and a one-element vector. So, if v is a one-element vector specifying a single contour at that level, contour interprets it as the number of contour lines, not the contour level. Consequently, contour(Z,v) behaves in the same manner as contour(Z,n) . To display a single contour line, define v as a two-element vector with both elements equal to the desired contour level. For example, create a 3-D contour of the peaks function. xrange = 3:.125:3; yrange = xrange; [X,Y] = meshgrid(xrange,yrange); 5 10 15 20 25 30 35 40 45 5 10 15 20 25 30 35 40 45 Filled Contour Plot Using contourf(Z,10) 4 Creating Specialized Plots 4-42 Z = peaks(X,Y); contour3(X,Y,Z) To display only one contour level at Z = 1 , define v as [1 1] . v = [1 1] contour3(X,Y,Z,v) The Contouring Algorithm The contourc function calculates the contour matrix for the other contour functions. It is a low-level function that is not called from the command line. The contouring algorithm first determines which contour levels to draw. If you specified the input vector v , the elements of v are the contour level values, and length(v) determines the number of contour levels generated. If you do not specify v , the algorithm chooses no more than 20 contour levels that are divisible by 2 or 5. The contouring algorithm treats the input matrix Z as a regularly spaced grid, with each element connected to its nearest neighbors. The algorithm scans this matrix comparing the values of each block of four neighboring elements (i.e., a cell) in the matrix to the contour level values. If a contour level falls within a cell, the algorithm performs a linear interpolation to locate the point at which the contour crosses the edges of the cell. The algorithm connects these points to produce a segment of a contour line. contour , contour3 , and contourf return a two-row matrix specifying all the contour lines. The format of the matrix is C = [ value1 xdata(1) xdata(2)... numv ydata(1) ydata(2)...] The first row of the column that begins each definition of a contour line contains the value of the contour, as specified by v and used by clabel . Beneath that value is the number of (x,y) vertices in the contour line. Remaining Contour Plots 4-43 columns contain the data for the (x,y) pairs. For example, the contour matrix calculated by C = contour(peaks(3)) is The circled values begin each definition of a contour line. Changing the Offset of a Contour The surfc and meshc functions display contours beneath a surface or a mesh plot. These functions draw the contour plot at the axes’ minimum z-axis limit. To specify your own offset, you must change the ZData values of the contour lines. First, save the handles of the graphics objects created by meshc or surfc . h = meshc(peaks(20)); The first handle belongs to the mesh or surface. The remaining handles belong to the contours you want to change. To raise the contour plane, add 2 to the z coordinate of each contour line. for i = 2:length(h); Columns 1 through 7 0.2000 1.8165 2.0000 2.1835 0 1.0003 2.0000 3.0000 1.0000 1.0367 1.0000 3.0000 1.0000 1.1998 Columns 8 through 14 3.0000 0 1.0000 1.0359 1.0000 0.2000 1.6669 1.0002 3.0000 2.9991 2.0000 1.0018 5.0000 3.0000 Columns 15 through 21 1.2324 2.0000 2.8240 2.3331 0.4000 2.0000 2.6130 2.0000 1.3629 2.0000 3.0000 5.0000 2.8530 2.0000 Columns 22 through 28 2.0000 1.4290 2.0000 0.6000 2.0000 2.4020 2.0000 1.5261 2.0000 2.8530 5.0000 2.5594 2.0000 1.6892 Columns 29 through 35 1.6255 2.0000 0.8000 2.0000 2.1910 2.0000 1.8221 2.0000 2.5594 5.0000 2.2657 2.0000 1.8524 2.0000 Column 36 2.0000 2.2657 Three vertices at v = 0 Three vertices at v = 0.2 Five vertices at v = 0.8 4 Creating Specialized Plots 4-44 newz = get(h(i),'Zdata') + 2; set(h(i),'Zdata',newz) end Displaying Contours in Polar Coordinates You can contour data defined in the polar coordinate system. As an example, set up a grid in polar coordinates and convert the coordinates to Cartesian coordinates, [th,r] = meshgrid((0:5:360)*pi/180,0:.05:1); [X,Y] = pol2cart(th,r); Then, generate the complex matrix Z on the interior of the unit circle, Z = X+i*Y; X , Y , and Z are points inside the circle. Create and display a surface of the function . f = (Z.^4 1).^(1/4); surf(X,Y,abs(f)) Display the unit circle beneath the surface using the statements hold on surf(X,Y,zeros(size(X))) hold off Z 4 1 4 Contour Plots 4-45 Labeling the Graph xlabel('Real','FontSize',14); ylabel('Imaginary','FontSize',14); zlabel('abs(f)','FontSize',14); Contours in Cartesian Coordinates These statements display a contour of the surface in Cartesian coordinates and label the x- and y-axis. contour(X,Y,abs(f),30) axis equal xlabel('Real','FontSize',14); ylabel('Imaginary','FontSize',14); −1 −0.5 0 0.5 1 −1 −0.5 0 0.5 1 0 0.2 0.4 0.6 0.8 1 1.2 abs(f) Imaginary Real 4 Creating Specialized Plots 4-46 Contours on a Polar Axis You can also display the contour within a polar axes. Create a polar axes using the polar function, and then delete the line specified with polar . h = polar([0 2*pi], [0 1]); delete(h) With hold on , display the contour on the polar grid. hold on contour(X,Y,abs(f),30) −1 −0.5 0 0.5 1 −1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1 Real Imaginary Contour Plots 4-47 0.2 0.4 0.6 0.8 1 30 210 60 240 90 270 120 300 150 330 180 0 4 Creating Specialized Plots 4-48 Interactive Plotting The ginput function enables you to use the mouse or the arrow keys to select points to plot. ginput returns the coordinates of the pointer’s position; either the current position or the position when a mouse button or key is pressed. See the ginput Example – Selecting Plotting Points from the Screen This example illustrates the use of ginput with the spline function to create a curve by interpolating in two dimensions. First, select a sequence of points, [x,y] , in the plane with ginput . Then pass two, one-dimensional splines through the points, evaluating them with a spacing 1 / 10 of the original spacing. axis([0 10 0 10]) hold on % Initially, the list of points is empty. xy = []; n = 0; % Loop, picking up the points. disp('Left mouse button picks points.') disp('Right mouse button picks last point.') but = 1; while but == 1 [xi,yi,but] = ginput(1); plot(xi,yi,'ro') n = n+1; xy(:,n) = [xi;yi]; end % Interpolate with a spline curve and finer spacing. t = 1:n; ts = 1: 0.1: n; xys = spline(t,xy,ts); % Plot the interpolated curve. plot(xys(1,:),xys(2,:),'b-'); hold off This plot shows some typical output. Interactive Plotting 4-49 0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10 o 1 o 2 o 3 o 4 o 5 o 6 o 7 o 8 o 9 o 10 o 11 4 Creating Specialized Plots 4-50 Animation You can create animated sequences with MATLAB in two different ways: •Save a number of different pictures and then play them back as a movie. •Continually erase and then redraw the objects on the screen, making incremental changes with each redraw. Movies are better suited to situations where each frame is fairly complex and cannot be redrawn rapidly. You create each movie frame in advance so the original drawing time is not important during playback, which is just a matter of blitting the frame to the screen. A movie is not rendered in real-time; it is simply a playback of previously rendered frames. The second technique, drawing, erasing, and then redrawing, makes use of different drawing modes supported by MATLAB. These modes allow faster redrawing at the expense of some rendering accuracy, so you must consider which mode to select. This section provides an example of each technique. To see more sophisticated demonstrations of these features, type demo at the MATLAB prompt and explore the animation demonstrations. Movies You can save any sequence of graphs and then play the sequence back in a short movie. There are two steps to this process: •Use getframe to generate each movie frame. •Use movie to run the movie a specified number of times at the specified rate. Typically, you use getframe in a for loop to assemble the array of movie frames. getframe returns a structure having the following fields: • cdata – image data in a uint8 matrix. The matrix has dimensions of height-by-width on indexed-color systems and height-by-width-by-3 on truecolor systems. • colormap – the colormap in an n-by-3 matrix, where n is the number of colors. On truecolor systems, the colormap field is empty. See image 4-51 Example – Visualizing an FFT as a Movie This example illustrates the use of movies to visualize the quantity fft(eye(n)) , which is a complex n-by-n matrix whose elements are various powers of the n th root of unity, exp(i*2*pi/n) . Creating the Movie Create the movie in a for loop calling getframe to capture the graph. Since the plot command resets the axes properties, call axis equal within the loop before getframe . for k = 1:16 plot(fft(eye(k+16))) axis equal M(k) = getframe; end Running the Movie After generating the movie, you can play it back any number of times. To play it back 30 times, type movie(M,30) You can readily generate and smoothly play back movies with a few dozen frames on most computers. Longer movies require large amounts of primary memory or a very effective virtual memory system. Movies that Include the Entire Figure If you want to capture the contents of the entire figure window (for example, to include GUI components in the movie), specify the figure’s handle as an argument to the getframe command. For example, suppose you want to add a slider to indicate the value of k in the previous example. h = uicontrol('style','slider','position',... [10 50 20 300],'Min',1,'Max',16,'Value',1) for k = 1:16 plot(fft(eye(k+16))) axis equal set(h,'Value',k) M(k) = getframe(gcf); end 4 Creating Specialized Plots 4-52 In this example, the movie frame contains the entire figure. To play so that it looks like the original figure, make the playback axes fill the figure window. clf axes('Position,[0 0 1 1]) movie(M,30) Erase Modes You can select the method MATLAB uses to redraw graphics objects. One event that causes MATLAB to redraw an object is changing the properties of that object. You can take advantage of this behavior to create animated sequences. A typical scenario is to draw a graphics object, then change its position by respecifying the x-, y,- and z-coordinate data by a small amount with each pass through a loop. You can create different effects by selecting different erase modes. This section illustrates how to use the three modes that are useful for dynamic redrawing: • none – MATLAB does not erase the objects when it is moved. • background – MATLAB erases the object by redrawing it in the background color. This mode erases the object and anything below it (such as grid lines). • xor – This mode erases only the object and is usually used for animation. All three modes are faster (albeit less accurate) than the normal mode used by MATLAB. Example – Animating with Erase Modes It is often interesting and informative to see 3-D trajectories develop in time. This example involves chaotic motion described by a nonlinear differential equation known as the Lorenz strange attractor. It can be written in the form with a vector valued function y(t) and a matrix A , which depends upon y . yd td ------ Ay= A y 8 3 --- 0 y 2 0 10 10 y 2 28 1 = Animation 4-53 The solution orbits about two different attractive points without settling into a steady orbit about either. This example approximates the solution with the simplest possible numerical method – Euler’s method with fixed step size.The result is not very accurate, but it has the same qualitative behavior as other methods. A = [ 8/3 0 0; 0 10 10; 0 28 1 ]; y = [35 10 7]; h = 0.01; p = plot3(y(1),y(2),y(3),'.', ... 'EraseMode','none','MarkerSize',5); % Set EraseMode to none axis([0 50 -25 25 -25 25]) hold on for i=1:4000 A(1,3) = y(2); A(3,1) = y(2); ydot = A*y; y = y + h*ydot; % Change coordinates set(p,'XData',y(1),'YData',y(2),'ZData',y(3)) drawnow i=i+1; end The plot3 statement sets EraseMode to none , indicating that the points already plotted should not be erased when the plot is redrawn. In addition, the handle of the plot object is saved. Within the for loop, a set statement references the plot object and changes its internally stored coordinates for the new location. While this manual cannot show the dynamically evolving output, this picture shows a snapshot. 4 Creating Specialized Plots 4-54 Note that, as far as MATLAB is concerned, the graph created by this example contains only one dot. What you see on the screen are remnants of previous plots that MATLAB has been instructed not to erase. The only way to print this graph from MATLAB is with a screen capture. You can use the capture command to generate a MATLAB image of the figure window contents. Background Erase Mode. To see the effect of EraseMode background , add these statements to the previous program. p = plot3(y(1),y(2),y(3),'square', ... 'EraseMode','background','MarkerSize',10,... 'MarkerEdgeColor',[1 .7 .7],'MarkerFaceColor',[1 .7 .7]); for i=1:4000 A(1,3) = y(2); A(3,1) = -y(2); ydot = A*y; y = y + h*ydot; set(p,'XData',y(1),'YData',y(2),'ZData',y(3)) drawnow i=i+1; 0 10 20 30 40 50 −20 −10 0 10 20 −20 −10 0 10 20 Animation 4-55 end hold off Since hold is still on , this code erases the previously created graph by setting the EraseMode property to background and changing the marker to a “pink eraser” (a square marker colored pink). Xor Erase Mode. If you change the EraseMode of the first plot3 statement from none to xor , you will see a moving dot ( Marker ' . ') only. Xor mode is used to create animations where you do not want to leave remnants of previous graphics on the screen. Additional Examples The MATLAB demo, lorenz , provides a more accurate numerical approximation, and a more elaborate display of Lorenz strange attractor example. Other MATLAB demos illustrate animation techniques. 4 Creating Specialized Plots 4-56 5 Displaying Bit-Mapped Images Overview (p.5-2) File formats and image commands. Images in MATLAB (p.5-4) Specific information about images in MATLAB. Image Types (p.5-6) Types of images supported in MATLAB. Working with 8-Bit and 16-Bit Images (p.5-11) Operations you can perform on nondouble image data. Reading, Writing, and Querying Graphics Image Files (p.5-15) Working with standard image file formats in MATLAB. Displaying Graphics Images (p.5-18) Commands for displaying a matrix as an image. The Image Object and Its Properties (p.5-23) Properties of MATLAB image objects. Printing Images (p.5-28) Printing images in proper proportions. Converting the Data or Graphic Type of Images (p.5-29) Converting between image types. 5 Displaying Bit-Mapped Images 5-2 Overview MATLAB provides commands for reading, writing, and displaying several types of graphics file formats for images. As with MATLAB-generated images, once a graphics file format image is displayed, it becomes a Handle Graphics image object. MATLAB supports the following graphics file formats: •BMP (Microsoft Windows Bitmap) •HDF (Hierarchical Data Format) •JPEG (Joint Photographic Experts Group) •PCX (Paintbrush) •PNG (Portable Network Graphics) •TIFF (Tagged Image File Format) •XWD (X Window Dump) For information concerning the bit depths and image types supported for these formats, see imread and imwrite . MATLAB supports three different numeric classes for image display: double-precision floating-point ( double ), 16-bit unsigned integer ( uint16 ), and 8-bit unsigned integer ( uint8 ). The image display commands interpret data values differently depending on the numeric class the data is stored in. This chapter discusses the different data and image types you can use, and includes details on how to: read, write, work with, and display graphics images; how to alter the display properties and aspect ratio of an image during display; how to print an image; and how to convert the data type or graphics format of an image. This table lists the functions discussed in this chapter. Function Purpose Function Group axis Plot axis scaling and appearance Display image Display image (create image object) Display imagesc Scale data and display as image Display Read image from graphics file File I/O Overview 5-3 imwrite Write image to graphics file File I/O imfinfo Get image information from graphics file Utility ind2rgb Convert indexed image to RGB image Utility Function Purpose Function Group 5 Displaying Bit-Mapped Images 5-4 Images in MATLAB The basic data structure in MATLAB is the array, an ordered set of real or complex elements. This object is naturally suited to the representation of images, real-valued, ordered sets of color or intensity data. (MATLAB does not support complex-valued images.) MATLAB stores most images as two-dimensional arrays (i.e., matrices), in which each element of the matrix corresponds to a single pixel in the displayed image. For example, an image composed of 200 rows and 300 columns of different colored dots would be stored in MATLAB as a 200-by-300 matrix. Some images, such as RGB, require a three-dimensional array, where the first plane in the 3rd dimension represents the red pixel intensities, the second plane represents the green pixel intensities, and the third plane represents the blue pixel intensities. This convention makes working with graphics file format images in MATLAB similar to working with any other type of matrix data. For example, you can select a single pixel from an image matrix using normal matrix subscripting. I(2,15) This command returns the value of the pixel at row 2, column 15 of the image I . Bit Depth Support MATLAB supports reading the most commonly used bit depths (bits per pixel) of any of the supported graphics file formats. When the data is in memory, it can be stored as uint8 , uint16 , or double . For details on which bit depths are appropriate for each supported format, see imread and imwrite . Data Types This section introduces you to the different data types that MATLAB uses to store images. Details on the inner workings of the storage for 8- and 16-bit images are included in “Working with 8-Bit and 16-Bit Images” on page 5-11. By default, MATLAB stores most data in arrays of class double . The data in these arrays is stored as double precision (64-bit) floating-point numbers. All MATLAB functions and capabilities work with these arrays. For images stored in one of the graphics file formats supported by MATLAB, however, this data representation is not always ideal. The number of pixels in Images in MATLAB 5-5 such an image may be very large; for example, a 1000-by-1000 image has a million pixels. Since each pixel is represented by at least one array element, this image would require about 8 megabytes of memory if it were stored as class double . To reduce memory requirements, MATLAB supports storing image data in arrays of class uint8 and uint16 . The data in these arrays is stored as 8-bit or 16-bit unsigned integers. These arrays require one-eighth or one-fourth as much memory as data in double arrays. 5 Displaying Bit-Mapped Images 5-6 Image Types In MATLAB, an image consists of a data matrix and possibly a colormap matrix. Three basic image types are used in MATLAB, each differing in the way that the data matrix elements are interpreted: •Indexed images •Intensity (or grayscale) images •RGB (or truecolor) images This section discusses how MATLAB represents each of these image types. Indexed Images An indexed image consists of a data matrix, X , and a colormap matrix, map . map is an m-by-3 array of class double containing floating-point values in the range [0,1]. Each row of map specifies the red, green, and blue components of a single color. An indexed image uses “direct mapping” of pixel values to colormap values. The color of each image pixel is determined by using the corresponding value of X as an index into map . The value 1 points to the first row in map , the value 2 points to the second row, and so on. You can display an indexed image with the statements image(X); colormap(map) A colormap is often stored with an indexed image and is automatically loaded with the image when you use the imread function. However, you are not limited to using the default colormap—you can use any colormap that you choose. The description for the property CDataMapping describes how to alter the type of mapping used. The next figure illustrates the structure of an indexed image. The pixels in the image are represented by integers, which are pointers (indices) to color values stored in the colormap. Image Types 5-7 The relationship between the values in the image matrix and the colormap depends on the class of the image matrix. If the image matrix is of class double , the value 1 points to the first row in the colormap, the value 2 points to the second row, and so on. If the image matrix is of class uint8 or uint16 , there is an offset— the value 0 points to the first row in the colormap, the value 1 points to the second row, and so on. The offset is also used in graphics file formats, to maximize the number of colors that can be supported. In the image above, the image matrix is of class double . Because there is no offset, the value 5 points to the fifth row of the colormap. Intensity Images An intensity image is a data matrix, I , whose values represent intensities within some range. MATLAB stores an intensity image as a single matrix, with each element of the matrix corresponding to one image pixel. The matrix can be of class double , uint8 , or uint16. While intensity images are rarely saved with a colormap, MATLAB uses a colormap to display them. In essence, MATLAB handles intensity images as indexed images. This figure depicts an intensity image of class double . 0 0 0 0.0627 0.0627 0.0314 0.2902 0.0314 0 0 0 1.0000 0.2902 0.0627 0.0627 0.3882 0.0314 0.0941 0.4510 0.0627 0 0.2588 0.1608 0.0627 75 10 12 21 40 53 53 75 14 17 21 21 53 53 75 8 5 8 10 30 15 51 15 18 31 31 18 16 56 31 18 31 31 31 31 . . . 5 Displaying Bit-Mapped Images 5-8 To display an intensity image, use the imagesc (“image scale”) function, which enables you to set the range of intensity values. imagesc scales the image data to use the full colormap. Use the two-input form of imagesc to display an intensity image. For example, imagesc(I,[0 1]); colormap(gray); The second input argument to imagesc specifies the desired intensity range. The function imagesc displays I by mapping the first value in the range (usually 0) to the first colormap entry, and the second value (usually 1) to the last colormap entry. Values in between are linearly distributed throughout the remaining colormap colors. Although it is conventional to display intensity images using a grayscale colormap, it is possible to use other colormaps. For example, the following statements display the intensity image I in shades of blue and green. imagesc(I,[0 1]); colormap(winter); To display a matrix A with an arbitrary range of values as an intensity image, use the single-argument form of imagesc . With one input argument, imagesc maps the minimum value of the data matrix to the first colormap entry, and 0.5342 0.2051 0.2157 0.2826 0.3822 0.4391 0.4391 0.5342 0.2251 0.2563 0.2826 0.2826 0.4391 0.4391 0.5342 0.1789 0.1307 0.1789 0.2051 0.3256 0.2483 0.4308 0.2483 0.2624 0.3344 0.3344 0.2624 0.2549 0.4510 0.3344 0.2624 0.3344 0.3344 0.3344 0.3344 Image Types 5-9 maps the maximum value to the last colormap entry. For example, these two lines are equivalent. imagesc(A); colormap(gray) imagesc(A,[min(A(:)) max(A(:))]); colormap(gray) RGB (Truecolor) Images An RGB image, sometimes referred to as a “truecolor” image, is stored in MATLAB as an m-by-n-by-3 data array that defines red, green, and blue color components for each individual pixel. RGB images do not use a palette. The color of each pixel is determined by the combination of the red, green, and blue intensities stored in each color plane at the pixel’s location. Graphics file formats store RGB images as 24-bit images, where the red, green, and blue components are 8 bits each. This yields a potential of 16 million colors. The precision with which a real-life image can be replicated has led to the nickname “truecolor image”. An RGB MATLAB array can be of class double , uint8 , or uint16 . In an RGB array of class double , each color component is a value between 0 and 1. A pixel whose color components are (0,0,0) displays as black, and a pixel whose color components are (1,1,1) displays as white. The three color components for each pixel are stored along the third dimension of the data array. For example, the red, green, and blue color components of the pixel (10,5) are stored in RGB(10,5,1) , RGB(10,5,2) , and RGB(10,5,3) , respectively. To display the truecolor image RGB , use the image function. For example, image(RGB) If MATLAB is running on a computer that does not have hardware support for truecolor image display, MATLAB uses color approximation and dithering to display an approximation of the image. See “Dithering Truecolor on Indexed Color Systems” for more information. The next figure shows an RGB image of class double . 5 Displaying Bit-Mapped Images 5-10 To determine the color of the pixel at (2,3), you would look at the RGB triplet stored in (2,3,1:3). Suppose (2,3,1) contains the value 0.5176 , (2,3,2) contains 0.1608 , and (2,3,3) contains 0.0627 . The color for the pixel at (2,3) is 0.5176 0.1608 0.0627 0.5804 0.2235 0.1294 0.2902 0.4196 0.4824 0.4824 0.5804 0.2902 0.0627 0.2902 0.2902 0.4824 0.4824 0.5804 0.0627 0.0627 0.0627 0.2235 0.2588 0.2588 0.5176 0.2588 0.0627 0.0941 0.0941 0.0627 0.0627 0.4510 0.0941 0.0627 0.0941 0.0941 0.0941 0.0941 0.5176 0.1922 0.0627 0.1294 0.1922 0.2588 0.2588 0.5176 0.1294 0.1608 0.1294 0.1294 0.2588 0.2588 0.5176 0.1608 0.0627 0.1608 0.1922 0.2588 0.2588 0.4196 0.2588 0.3529 0.4196 0.4196 0.3529 0.2902 0.4510 0.4196 0.3529 0.4196 0.4196 0.4196 0.4196 0.5490 0.2235 0.5490 0.5804 0.7412 0.7765 0.7765 0.5490 0.3882 0.5176 0.5804 0.5804 0.7765 0.7765 0.5490 0.2588 0.2902 0.2588 0.2235 0.4824 0.2235 0.4196 0.2235 0.1608 0.2588 0.2588 0.1608 0.2588 0.4510 0.2588 0.1608 0.2588 0.2588 0.2588 0.2588 Red Green Blue Working with 8-Bit and 16-Bit Images 5-11 Working with 8-Bit and 16-Bit Images MATLAB usually works with double-precision (64-bit) floating-point numbers. However, to reduce memory requirements for working with images, MATLAB provides limited support for storing images as 8-bit or 16-bit unsigned integers by using the numeric classes uint8 or uint16, respectively. An image whose data matrix has class uint8 is called an 8-bit image; an image whose data matrix has class uint16 is called a 16-bit image. The image function can display 8- or 16-bit images directly without converting them to double precision. However, image interprets matrix values slightly differently when the image matrix is uint8 or uint16 . The specific interpretation depends on the image type. 8-Bit and 16-Bit Indexed Images If the class of X is uint8 or uint16, its values are offset by one before being used as colormap indices. The value 0 points to the first row of the colormap, the value 1 points to the second row, and so on. The image command automatically supplies the proper offset, so the display method is the same whether X is double, uint8, or uint16 . image(X); colormap(map); The colormap index offset for uint8 and uint16 data is intended to support standard graphics file formats, which typically store image data in indexed form with a 256-entry colormap. The offset allows you to manipulate and display images of this form in MATLAB using the more memory-efficient uint8 and uint16 arrays. Because of the offset, you must add 1 to convert a uint8 or uint16 indexed image to double . For example, X64 = double(X8) + 1; or X64 = double(X16) + 1; Conversely, subtract 1 to convert a double indexed image to uint8 or uint16 . X8 = uint8(X64 1); or X16 = uint16(X64 1); 5 Displaying Bit-Mapped Images 5-12 The order of operations must be as shown, because most MATLAB mathematical operations cannot be performed on uint8 and uint16 arrays. 8-Bit and 16-Bit Intensity Images Whereas the range of double image arrays is usually [0, 1], the range of 8-bit intensity images is usually [0, 255] and the range of 16-bit intensity images is usually [0, 65535]. Use the following command to display an 8-bit intensity image with a gray scale colormap. imagesc(I,[0 255]); colormap(gray); To convert an intensity image from double to uint16 , first multiply by 65535. I16 = uint16(round(I64*65535)); Conversely, divide by 65535 after converting a uint16 intensity image to double . I64 = double(I16)/65535; 8-Bit and 16-Bit RGB Images The color components of an 8-bit RGB image are integers in the range [0,255] rather than floating-point values in the range [0, 1]. A pixel whose color components are (255,255,255) displays as white. The image command displays an RGB image correctly whether its class is double , uint8 , or unit16 . image(RGB); To convert an RGB image from double to uint8 , first multiply by 255. RGB8 = uint8(round(RGB64*255)); Conversely, divide by 255 after converting a uint8 RGB image to double . RGB64 = double(RGB8)/255 To convert an RGB image from double to uint16 , first multiply by 65535. RGB16 = uint16(round(RGB64*65535)); Conversely, divide by 65535 after converting a uint16 RGB image to double. RGB64 = double(RGB16)/65535; Working with 8-Bit and 16-Bit Images 5-13 Mathematical Operations Support for uint8 and uint16 The following MATLAB mathematical operations support uint8 and uint16 data: conv2,convn,fft2,fftn,sum . In these cases, the output is always double . If you attempt to perform an unsupported operation on one of these arrays, you will receive an error. For example, BW3 = BW1 + BW2 ??? Function '+' not defined for variables of class 'uint8'. Most of the functions in the Image Processing Toolbox accept uint8 and uint16 input. If you plan to do sophisticated image processing on uin t8 or uint16 data, you should consider adding the Image Processing Toolbox to your MATLAB computing environment. Other 8-Bit and 16-Bit Array Support MATLAB supports several other operations on uint8 and uint16 arrays, including: •Reshaping, reordering, and concatenating arrays using the functions reshape , cat , permute , and the [] and ' operators and uint16 arrays in MAT-files using save and imwrite •Locating the indices of nonzero elements in uint8 and uint16 arrays using find . However, the returned array is always of class double . •Relational operators 5 Displaying Bit-Mapped Images 5-14 Summary of Image Types and Numeric Classes This table summarizes the way MATLAB interprets data matrix elements as pixel colors, depending on the image type and data class. Image Type double Data uint8 or uint16 Data Indexed Image is an m-by-n array of integers in the range [1,p]. Colormap is a p-by-3 array of floating-point values in the range [0, 1]. Image is an m-by-n array of integers in the range [0,p – 1]. Colormap is a p-by-3 array of floating-point values in the range [0, 1]. Intensity Image is an m-by-n array of floating-point values that are linearly scaled by MATLAB to produce colormap indices. The typical range of values is [0, 1]. Colormap is a p-by-3 array of floating-point values in the range [0, 1] and is typically grayscale. Image is an m-by-n array of integers that are linearly scaled by MATLAB to produce colormap indices. The typical range of values is [0,255] or [0, 65535]. Colormap is a p-by-3 array of floating-point values in the range [0, 1] and is typically grayscale. RGB (Truecolor) Image is an m-by-n-by-3 array of floating-point values in the range [0, 1]. Image is an m-by-n-by-3 array of integers in the range [0, 255] or [0, 65535]. Reading, Writing, and Querying Graphics Image Files 5-15 Reading, Writing, and Querying Graphics Image Files In its native form, a graphics file format image is not stored as a MATLAB matrix, or even necessarily as a matrix. Most graphics files begin with a header containing format-specific information tags, and continue with bitmap data that can be read as a continuous stream. For this reason, you cannot use the standard MATLAB I/O commands load and save to read and write a graphics file format image. MATLAB provides special functions for reading and writing image data from graphics file formats. To read a graphic file format image use imread ; to write a graphic file format image, use imwrite ; to obtain information about the nature of a graphics file format image, use imfinfo . This table gives a clearer picture of which MATLAB commands should be used with which image types. reads an image from any supported graphics image file in any of the supported bit depths. Most of the images that you will read are 8-bit. When these are read into memory, MATLAB stores them as class uint8 . The main exception to this rule is that MATLAB supports 16-bit data for PNG and TIFF images. If you read a 16-bit PNG or TIFF image, it will be stored as class uint16 . Procedure Function(s) to Use Load or Save a Matrix as a MAT-file save Load or Save Graphics File Format Image, e.g. BMP, TIFF imwrite Display Any Image Loaded Into MATLAB image imagesc Utilities imfinfo ind2rgb 5 Displaying Bit-Mapped Images 5-16 Note For indexed images, imread always reads the colormap into an array of class double , even though the image array itself may be of class uint8 or uint16 . For our discussion here we will show one of the most basic syntax uses of imread . This code reads the image ngc6543a.jpg . You can write (save) image data using the imwrite function. The statements imwrite(X,map,'clown.bmp') create a BMP file containing the clown image. Writing a Graphics Image When you save an image using imwrite , the default behavior is to automatically reduce the bit depth to uint8 . Many of the images used in MATLAB are 8-bit, and most graphics file format images do not require double-precision data. One exception to the MATLAB rule for saving the image data as uint8 is that PNG and TIFF images may be saved as uint16 . Since these two formats support 16-bit data, you may override the MATLAB default behavior by specifying uint16 as the data type for imwrite . The following example shows writing a 16-bit PNG file using imwrite . imwrite(I,'clown.png','BitDepth',16); Obtaining Information About Graphics Files The imfinfo function enables you to obtain information about graphics files that are in any of the standard formats listed above. The information you obtain depends on the type of file, but it always includes at least the following: •Name of the file, including the directory path if the file is not in the current directory •File format •Version number of the file format Reading, Writing, and Querying Graphics Image Files 5-17 •File modification date •File size in bytes •Image width in pixels •Image height in pixels •Number of bits per pixel •Image type: RGB (truecolor), intensity (grayscale), or indexed 5 Displaying Bit-Mapped Images 5-18 Displaying Graphics Images To display a graphics file image, use either image or imagesc . For example, assuming RGB is an image, figure('Position',[100 100 size(RGB,2) size(RGB,1)]); image(RGB); set(gca,'Position',[0 0 1 1]) (This image was created with support to the Space Telescope Science Institute, operated by the Association of Universities for research in Astronomy, Inc., from NASA contract NAs5-26555, and is reproduced with permission from AURA/STScI. Digital renditions of images produced by AURA/STScI are obtainable royalty-free. Credits: J.P. Harrington and K.J. orkowski (University of Maryland), and NASA.) Displaying Graphics Images 5-19 Summary of Image Types and Display Methods This table summarizes display methods for the three types of images. Controlling Aspect Ratio and Display Size The image function displays the image in a default-sized figure and axes. MATLAB stretches or shrinks the image to fit the display area. Sometimes you want the aspect ratio of the display to match the aspect ratio of the image data matrix. The easiest way to do this is with the command axis image . For example, these commands display the earth image in the demos directory using the default figure and axes positions. image(X); colormap(map) Image Type Display Commands Uses Colormap Colors Indexed image(X); colormap(map) Yes Intensity imagesc(I,[0 1]); colormap(gray) Yes RGB (truecolor) image(RGB) No 5 Displaying Bit-Mapped Images 5-20 The elongated globe results from stretching the image display to fit the axes position. Use the axis image command to force the aspect ratio to be one-to-one. axis image 50 100 150 200 250 50 100 150 200 250 Displaying Graphics Images 5-21 The command axis image works by setting the DataAspectRatio property of the axes object to [1 1 1]. See axis and axes for more information on how to control the appearance of axes objects. Sometimes you may want to display an image so that each element in the data matrix corresponds to a single screen pixel. To display an image with this one-to-one, matrix-element-to-screen-pixel mapping, you need to resize the figure and axes. For example, these commands display the earth image so that one data element corresponds to one screen pixel. [m,n] = size(X); figure('Units','pixels','Position',[100 100 n m]) image(X); colormap(map) set(gca,'Position',[0 0 1 1]) 50 100 150 200 250 50 100 150 200 250 5 Displaying Bit-Mapped Images 5-22 The figure’s Position property is a four-element vector that specifies the figure's location on the screen as well as its size. The second statement above positions the figure so that its lower-left corner is at position (100,100) on the screen and so that its width and height match the image width and height. Setting the axes position to [0 0 1 1] in normalized units creates an axes that fills the figure. The resulting picture is shown. The Image Object and Its Properties 5-23 The Image Object and Its Properties The commands image and imagesc create image objects. Image objects are children of axes objects, as are line, patch, surface, and text objects. Like all Handle Graphics objects, the image object has a number of properties you can set to fine-tune its appearance on the screen. The most important properties of the image object with respect to appearance are CData , CDataMapping , XData , YData , and EraseMode . For detailed information about these and all of the properties of the image object, please see image . CData The CData property of an image object contains the data array. In the commands below, h is the handle of the image object created by image , and the matrices X and Y are the same. h = image(X); colormap(map) Y = get(h,'CData'); The dimensionality of the CData array controls whether MATLAB displays the image using colormap colors or as an RGB image. If the CData array is two-dimensional, then the image is either an indexed image or an intensity image, and in either case the image is displayed using colormap colors. If, on the other hand, the CData array is m-by-n-by-3, then MATLAB displays it as a truecolor image, ignoring the colormap colors. CDataMapping The CDataMapping property controls whether an image is indexed or intensity. An indexed image is displayed by setting the CDataMapping property to 'direct' , in which case the values of the CData array are used directly as indices into the figure's colormap. When the image command is used with a single input argument, it sets the value of CDataMapping to 'direct' . h = image(X); colormap(map) get(h,'CDataMapping') ans = direct Intensity images are displayed by setting the CDataMapping property to 'scaled' . In this case the CData values are linearly scaled to form colormap 5 Displaying Bit-Mapped Images 5-24 indices. The scale factors are controlled by the axes CLim property. The imagesc function creates an image object whose CDataMapping property is set to 'scaled' , and it also adjusts the CLim property of the parent axes. For example, h = imagesc(I,[0 1]); colormap(map) get(h,'CDataMapping') ans = scaled get(gca,'CLim') ans = [0 1] XData and YData The XData and YData properties control the coordinate system of the image. For an m-by-n image, the default XData is [1 n] and the default YData is [1 m] . These settings imply the following: •The left column of the image has an x-coordinate of 1. •The right column of the image has an x-coordinate of n. •The top row of the image has a y-coordinate of 1. •The bottom row of the image has a y-coordinate of m. For example, the statements, X = [1 2 3 4; 5 6 7 8; 9 10 11 12]; h = image(X); colormap(colorcube(12)) xlabel x; ylabel y produce the picture. The Image Object and Its Properties 5-25 The XData and YData properties of the resulting image object have the default values shown below. get(h,'XData') ans = 1 4 get(h,'YData') ans = 1 3 However, you can override the default settings to specify your own coordinate system. For example, the statements, X = [1 2 3 4; 5 6 7 8; 9 10 11 12]; image(X,'XData',[1 2],'YData',[2 4]); colormap(colorcube(12)) xlabel x; ylabel y x y 1 2 3 4 0.5 1 1.5 2 2.5 3 3.5 5 Displaying Bit-Mapped Images 5-26 produce the picture. EraseMode The EraseMode property controls how MATLAB updates the image on the screen if the image object's CData property changes. The default setting of EraseMode is 'normal' . With this setting, if you change the CData of the image object using the set command, MATLAB erases the image on the screen before redrawing the image using the new CData array. The erase step is a problem if you want to display a series of images quickly and smoothly. You can achieve fast and visually smooth updates of displayed images as you change the image CData by setting the image object EraseMode property to 'none' . With this setting, MATLAB does not take the time to erase the displayed image — it immediately draws the updated image when the CData changes. x y -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 1.5 2 2.5 3 3.5 4 4.5 The Image Object and Its Properties 5-27 Suppose, for example, that you have an m-by-n-by-3-by-x array A , containing x different truecolor images of the same size. You can display them dynamically with h = image(A(:,:,:,1),'EraseMode','none'); for i = 2:x set(h,'CData',A(:,:,:,i)) drawnow end Rather than creating a new image object each time through the loop, this code simply changes the CData of the image object (which was created on the first line using the image command). The drawnow command causes MATLAB to update the display with each pass though the loop. Because the image EraseMode is set to 'none' , changes to the CData do not cause the image on the screen to erase each time through the loop. 5 Displaying Bit-Mapped Images 5-28 Printing Images When you set the axes Position to [0 0 1 1] so that it fills the entire figure, the aspect ratio will not be preserved when you print because MATLAB adjusts the figure size when printing according to the figure’s PaperPosition property. To preserve the image aspect ratio when printing, set the figure’s PaperPositionMode to 'auto' from the command line. set(gcf,'PaperPositionMode','auto') print When PaperPositionMode is set to 'auto' , the width and height of the printed figure are determined by the figure’s dimensions on the screen, and the figure position is adjusted to center the figure on the page. If you want the default value of PaperPositionMode to be ' auto' , enter this line in your startup.m file. set(0,'DefaultFigurePaperPositionMode','auto') Converting the Data or Graphic Type of Images 5-29 Converting the Data or Graphic Type of Images Sometimes you will want to perform operations that are not supported for uint8 or uint16 arrays. To do this, convert the data to double precision using the double function. For example, BW3 = double(BW1) + double(BW2); Keep in mind that converting between data types changes the way MATLAB and the toolbox interpret the image data. If you want the resulting array to be interpreted properly as image data, you need to rescale or offset the data when you convert it. (See the earlier sections “Image Types” and “8-Bit and 16-Bit Indexed Images” for more information about offsets.) For certain operations, it is helpful to convert an image to a different image type. For example, if you want to filter a color image that is stored as an indexed image, you should first convert it to RGB format. To do this efficiently, use the ind2rgb function. (which originated in the Image Processing Toolbox). When you apply the filter to the RGB image, MATLAB filters the intensity values in the image, as is appropriate. If you attempt to filter the indexed image, MATLAB simply applies the filter to the indices in the indexed image matrix, and the results may not be meaningful. You can also perform certain conversions just using MATLAB syntax. For example, if you want to convert a grayscale image to RGB, you can concatenate three copies of the original matrix along the third dimension. RGB = cat(3,I,I,I); The resulting RGB image has identical matrices for the red, green, and blue planes, so the image displays as shades of gray. Sometimes you will want to change the graphics format of an image, perhaps for compatibility with another software product. This process is very straightforward. For example, to convert an image from a BMP to a PNG, load the BMP using imread , set the data type to uint8 , uint16 , or double , and then save the image using imwrite , with ' PNG and imwrite for the specifics of which bit depths are supported for the different graphics formats, and for how to specify the format type when writing an image to file. 5 Displaying Bit-Mapped Images 5-30 6 Printing and Exporting Overview of Printing and Exporting (p.6-2) Introduction to basic operations, interfaces, parameters, and defaults associated with printing and exporting How to Print or Export (p.6-9) Step-by-step instructions for printing a figure to a printer or to a file, and for exporting a figure to a graphics-format file or to the clipboard Examples of Basic Operations (p.6-23) Examples that provide you with the information you need to submit a simple print or export job Changing a Figure’s Settings (p.6-31) How to change the default settings for parameters, such as figure size, paper orientation, background color, and rendering method Choosing a Graphics Format (p.6-57) Factors to consider when choosing a graphics format for exporting to a file, and information about commonly used formats Choosing a Printer Driver (p.6-68) Factors to consider when using a nondefault print driver, and information specific to drivers supported by MATLAB Troubleshooting (p.6-78) Solutions to frequently asked questions and common problems encountered while printing or exporting graphics 6 Printing and Exporting 6-2 Overview of Printing and Exporting This section is an introduction to the graphics printing capabilities provided with MATLAB and how to make use of them. It covers •“Print and Export Operations” •“Graphical User Interfaces” •“Command Line Interface” on page 6-3 •“Specifying Parameters and Options” on page 6-5 •“Default Settings and How to Change Them” on page 6-6 Print and Export Operations There are four basic operations that you can perform in printing or transferring figures you’ve created in MATLAB. Graphical User Interfaces You interact with the MATLAB print and export tools using either Microsoft Windows or UNIX graphical user interfaces or with MATLAB commands. The table below lists the dialog boxes you need to print and export and summarizes how to open them from the figure window. Operation Description Print Send a figure from the screen directly to the printer. Print to File Write a figure to a PostScript file to be printed later. Export to File Export a figure in graphics format to a file, so that you can import it into an application. Export to Clipboard Copy a figure to the Windows clipboard, so that you can paste it into an application. Overview of Printing and Exporting 6-3 You can open the Print , Page Setup , and Print Preview dialog boxes from a program or from the command line with the printdlg , pagesetupdlg , and printpreview functions. Command Line Interface You can print a MATLAB figure from the command line or from a program. Use the set function to set the properties that control how the printed figure looks. Use the print function to start the print or export operation. Dialog Box How to Open Description Print (Windows and UNIX) File -> Print or printdlg function Send figure to the printer, select the printer, print to file, and several other options Printing Options Click Options on UNIX Print dialog Set some of the most commonly used print settings (UNIX only) Page Setup File -> Page Setup or pagesetupdlg function Set properties to be associated with the figure when printed or exported Print Preview File -> Print Preview or printpreview function View and adjust the final output ExZport File -> Export Export the figure in graphics format to a file Copy Options Edit -> Copy Options Set format, figure size, and background color for Copy to Clipboard Figure Copy Template File -> Preferences Change text, line, axes, and UI control properties 6 Printing and Exporting 6-4 Modifying Properties with set The set function changes the values of properties that control the look of a figure. These properties are stored with the figure. When you change one of the properties, the new value is saved with the figure and affects the look of the figure each time you print it until you change the setting again. To change the print properties of the current figure, the set command has the form set(gcf, 'Property1', value1, 'Property2', value2, ...) where gcf is a call that returns the handle of the current figure, and each property-value pair consists of a named property followed by the value to which the property is set. For example, set(gcf, 'PaperUnits', 'centimeters', 'PaperType', 'A4', ...) sets the units of measure and the paper size. “Changing a Figure’s Settings” on page 6-31 describes commonly used print properties. The Figure Properties reference page contains a complete list of the properties. Examining Properties with get You can also use the get function to retrieve the value of a specific property. a = get(gcf, 'Property') Printing and Exporting with print The print function performs any of the four actions shown in the table below. You control what action is taken, depending on the presence or absence of certain arguments. Action Print Command Print a figure to a printer print Print a figure to a file for later printing print filename Overview of Printing and Exporting 6-5 You can also include optional arguments with the print command. For example, to export Figure No. 2 to file spline2d.eps , with 600 dpi resolution, and using the EPS color graphics format, use print -f2 -r600 -depsc spline2d The functional form of this command is print('-f2', '-r600', '-depsc', 'spline2d'); Specifying Parameters and Options The table below lists parameters you can modify for the figure to be printed or exported. To change one of these parameters, use the Page Setup or Printing Options (UNIX only) dialog boxes, or use the set or print function. See “Changing a Figure’s Settings” on page 6-31 for more detailed instructions. Copy a figure in graphics format to the clipboard print -dfileformat Export a figure to a graphics format file that you can later import into an application print -dfileformat filename Parameter Description Figure size Set the size of the figure on the printed page Figure position Set the position of the figure on the printed page Paper size Select printer paper, specified by dimension or type Paper orientation Specify the way the figure is oriented on the page Position mode Specify the figure position yourself or have MATLAB determine position automatically Graphics format Select the format for exported data (e.g., EPS, JPEG) Resolution Specify how finely your figure is to be sampled Action Print Command 6 Printing and Exporting 6-6 Default Settings and How to Change Them If you have not changed the default print and export settings, MATLAB prints or exports the figure: •8-by-6 inches with no window frame •Centered on portrait format 8.5-by-11 inch paper if available •Using white for the figure and axes background color •With the ticks and limits of the axes scaled to accommodate the printed size Setting Defaults for a Figure In general, to change the property settings for a specific figure, follow the instructions given in the section, “Changing a Figure’s Settings” on page 6-31. Renderer Select the software that processes your graphics data Renderer mode Specify the renderer yourself or have MATLAB determine which renderer to use automatically Axes tick marks Keep axes tick marks and limits as shown or have MATLAB adjust depending on figure size Background color Keep background color as shown on the screen or force it to white Line and text color Keep line and text objects as shown on screen or print them in black and white UI controls Show or hide all user interface controls in the figure Bounding box Leave space between outermost objects in the plot and the edges of its background area CMYK Automatically convert RGB values to CMYK values Character set encoding Select character set for PostScript printers Parameter Description Overview of Printing and Exporting 6-7 Any settings you change with the Page Setup , Print , and Printing Options dialog boxes, or with the set function are saved with the figure and affect each printing of the figure until you change the settings again. The settings you change with the Figure Copy Template Preferences and Copy Options Preferences panels alter the figure as it displays on the screen. Setting Defaults for the Session MATLAB enables you to set the session defaults for figure properties. Set the session default for a property using the syntax set(0, 'DefaultFigurepropertyname', 'value') where propertyname is one of the named figure properties. This example sets the paper orientation for all subsequent print operations in the current MATLAB session. set(0, 'DefaultFigurePaperOrientation', 'landscape') The Figure Properties reference page contains a complete list of the properties. Setting Defaults Across Sessions MATLAB enables you to set the session-to-session defaults for figure properties, the print driver, and the print function. Print Device and Print Command. Set the default print driver and the default print command in your printopt.m file. This file contains instructions for changing these settings and for displaying the current defaults. Open printopt.m in your editor by typing the command edit printopt Scroll down about 40 lines until you come to this comment line and make your changes after this line. %---> Put your own changes to the defaults here (if needed) For example, to change the default driver, first find the line that sets dev , and then replace the text string with an appropriate value. So, to set the default driver to HP LaserJet III, modify the line to read, dev = '-dljet3'; 6 Printing and Exporting 6-8 For the full list of values for dev , see the “Drivers” section of the print reference page. Note If you set dev to be a graphics format, such as -djpeg , MATLAB exports the figure rather than printing it. Figure Properties. Set the session-to-session default for a property by including this command in your startup.m file: set(0, 'DefaultFigurepropertyname', 'value') where propertyname is one of the named figure properties. For example, set(0, 'DefaultFigureInvertHardcopy', 'off') keeps the figure background in the screen color. This is the same command you use to change a session default, except that it executes automatically every time MATLAB is invoked. Note Arguments specified with the print command override properties set using MATLAB commands or the Page Setup dialog box, which in turn override any MATLAB default settings specified in printopt.m or startup.m . How to Print or Export 6-9 How to Print or Export This section covers the following topics to show you the steps you need to take to produce a printed or exported figure: •“Printing a Figure” •“Printing to a File” on page 6-13 •“Exporting to a File” on page 6-15 •“Exporting to the Windows Clipboard” on page 6-20 Before you print or export a figure, preview the image to be exported by selecting Print Preview from the figure window’s File dialog box or the set function to adjust the look of the exported figure. See “Changing a Figure’s Settings” on page 6-31 for details. Printing a Figure This section tells you how to print your figure to a printer: •“Using the Graphical User Interface on Windows” on page 6-10 •“Using the Graphical User Interface on UNIX” on page 6-11 •“Using MATLAB Commands” on page 6-13 6 Printing and Exporting 6-10 Using the Graphical User Interface on Windows MATLAB for Windows uses the standard Windows Print dialog box, which normally comes with Windows software products. To open the Windows Print dialog box, select Print from the figure window’s File menu. •To print a figure, first select a printer from the list box, then click OK . •To save it to a file, click the Print to file check box, click on OK , and when the Print to File window appears, enter the filename you want to save the figure to. MATLAB creates the file in your current working directory. Settings you can change in the Windows Print dialog box are as follows: Properties. To make changes to settings specific to a printer, click the Properties button. This opens the Windows Document Properties window. Print range. You can only select All in this panel. The selection does not affect your printed output. Copies. Enter the number of copies you want to print. How to Print or Export 6-11 Using the Graphical User Interface on UNIX MATLAB for UNIX has a Print dialog box and an associated Printing Options dialog box. To open the Print dialog box, select Print from the figure window’s File menu. •To print a figure, click the Printer button and select a printer from the list box. You can select a driver from the Driver list box if you don’t want the default driver. •To save it to a file, click the File button, enter a filename, and browse for the directory you want the file saved in. Settings you can change in the UNIX Print dialog box are as follows: Figure Size on Printed Page. If you want the printed plot to have the same size as it does on your screen, select Same size as screen . If you want the printed output to have the default size of 8-by-6 inches, select 8 by 6 inches . See “Setting the Figure Size and Position” on page 6-34 for more information. Axes Limits and Ticks. To force MATLAB to print the same number of ticks and the same limit values for the axes as are used on the screen, select Same as on screen . To let MATLAB scale the limits and ticks of the axes based on the size of the printed figure, select Allow MATLAB to select . See “Setting the Axes Ticks and Limits” on page 6-47 for more information. 6 Printing and Exporting 6-12 UNIX Printing Options Dialog Box To open the UNIX Printing Options dialog box, click the Options button on the UNIX Print dialog box (see figure shown above). Settings you can change in the Printing Options dialog box are as follows: Use loose bounding box for PS and Ghostscript drivers. Select this box to leave a little space between the outermost objects in the plot and the edges of the plot’s background. Use CMYK colors in PS and Ghostscript drivers instead of RGB. Select this box to produce output in CMYK (cyan, magenta, yellow, black) color space instead of RGB (red, green blue). This is for PostScript printers and drivers only. Use Adobe PS default character set encoding. Select this box to have MATLAB use the default character set that is supported by all PostScript printers. This option is provided because some early PostScript printers do not support the How to Print or Export 6-13 PostScript operator ISOLatin1Encoding , which MATLAB uses when it generates PostScript files. If your printer does not support this operator, you may notice problems in the text of MATLAB printouts. Suppress printing of user interface controls. Select this box to prevent any user interface controls that you added to the plot from appearing in the printed plot. Handle Graphics Renderer. Select one of the radio buttons to have MATLAB select the renderer, or to select a specific renderer from those that MATLAB supports. See “The Default Renderer for MATLAB” on page 6-43 for information on how MATLAB selects a renderer. Printing Resolution. Select one of the radio buttons to either have MATLAB select the resolution for your printout, to set the resolution to that used for the screen display, or to enter a specific resolution value. See “Default Resolution and When You Can Change It” on page 6-45 for information on how MATLAB selects a resolution setting. Using MATLAB Commands Use the print function to print from the MATLAB command line or from a program. See “Printing and Exporting with print” on page 6-4 for more information. To send the current or most recently active figure to a printer, simply type print The Printing Options table on the print reference page shows a full list of options that you can use with the print function. For example, the following command prints Figure No. 2 with 600 dpi resolution, using the Canon BubbleJet BJ200 printer driver: print -f2 -r600 -dbj200 Printing to a File Instead of sending your figure to the printer right now, you have the option of “printing” it to a file, and then sending the file to the printer later on. You can also append additional figures to the same file using the print command. 6 Printing and Exporting 6-14 This section tells you how to save your figure to a file •“Using the Graphical User Interface on Windows” •“Using the Graphical User Interface on UNIX” •“Using MATLAB Commands” Using the Graphical User Interface on Windows 1 To open the Print dialog box, select Print from the figure window’s File 2 Select the check box labeled Print to file , and click on the OK button. 3 The Print to File dialog box appears, allowing you to specify the output directory and filename. Using the Graphical User Interface on UNIX 1 To open the Print dialog box, select Print from the figure window’s File 2 Select the radio button labeled File , and either fill in or browse for the directory and filename. Using MATLAB Commands To print the figure to a PostScript file, type print filename If you don’t specify the filename extension, MATLAB uses an extension that is appropriate for the print driver being used. You can also include an -options argument when printing to a file. For example, to append the current figure to an existing file, type print -append filename The only way to append to a file is by using the print function. There is no dialog box that enables you to do this. How to Print or Export 6-15 Note If you print a figure to a file, the file can only be printed and cannot be imported into another application. If you want to create a figure file that you can import into an application, see the next section, “Exporting to a File.” Appending Additional Figures to a File. Once you have printed one figure to a PostScript file, you can append other figures to that same file using the -append option of the print function. You can only append using the print function. This example prints Figure No. 2 to PostScript file, myfile.ps , and then appends Figure No. 3 to the end of the same file. print -f2 myfile print -f3 -append myfile Exporting to a File Export a figure in a graphics format to a file if you want to import it into another application, such as a word processor. You can export to a file from the Windows or UNIX Export dialog box or from the command line. This section tells you how to export your figure to a file •“Using the Graphical User Interface” on page 6-16 •“Using MATLAB Commands” on page 6-16 It also covers •“Exporting with getframe” on page 6-17 •“Saving Multiple Figures to an AVI File” on page 6-18 •“Importing MATLAB Graphics into Other Applications” on page 6-18 For further information, see “Choosing a Graphics Format” on page 6-57. 6 Printing and Exporting 6-16 Using the Graphical User Interface Use the Export dialog box to select a file format, specify a filename, and locate the directory to which you want to save your file. To open the Export dialog box, select Export from the figure window’s File menu. Select the graphics file format you want the exported figure to have using the Save as type list box. For information on the graphics file formats supported by MATLAB, see “Choosing a Graphics Format” on page 6-57. Using MATLAB Commands Use the print function to print from the MATLAB command line or from a program. See “Printing and Exporting with print” on page 6-4 for basic information on printing from the command line. To export the current or most recently active figure, type print -dfileformat filename where fileformat is a graphics format supported by MATLAB and filename is the name you want to give to the export file. MATLAB selects the filename extension, if you don’t specify it. You can also specify a number of options with the print function. These are shown in the Printing Options table on the print reference page. How to Print or Export 6-17 For example, to export Figure No. 2 to file spline2d.eps , with 600 dpi resolution, and using the EPS color graphics format, type print -f2 -r600 -depsc spline2d Graphics file formats are explained in more detail in the sections, “Choosing a Graphics Format” on page 6-57 and “Description of Selected Graphics Formats” on page 6-63. Exporting with getframe You can use the getframe function with imwrite to export a graphic. getframe is often used in a loop to get a series of frames (figures) with the intention of creating a movie. Some of the benefits of using this export method over using print are •You can use getframe to capture a portion of the figure, rather than the whole figure. • imwrite offers greater flexibility for setting format-specific options, such as the bit depth and compression. The drawbacks of using this method are that imwrite uses built-in MATLAB formats only. Therefore, you will not have access to the Ghostscript formats available to you when exporting with the print function or Export menu. Also, this technique is limited to screen resolution. How to Use getframe and imwrite. Use getframe to capture a figure and imwrite to save it to a file. getframe returns a structure containing the fields cdata and colormap . The colormap field is empty on true color displays. The following example captures the current figure and exports it to a PNG file. I = getframe(gcf); imwrite(I.cdata, 'myplot.png'); You should use the proper syntax of imwrite for the type of image captured. In the example above, the image is captured from a true color display. Since the colormap field is empty, it is not passed to imwrite . 6 Printing and Exporting 6-18 Example — Exporting a Figure Using getframe and imwrite. This example offers device independence — it will work for either RGB-mode or indexed-mode monitors. X=getframe(gcf); if isempty(X.colormap) imwrite(X.cdata, 'myplot.bmp') else imwrite(X.cdata, X.colormap, 'myplot.tif') end For information about available file formats and format-specific options, see the imwrite reference page. For information about creating a movie from a series of frames, see the reference pages for getframe and movie , or see “Movies” in Chapter 4, “Creating Specialized Plots.” Saving Multiple Figures to an AVI File You can also save multiple figures to an AVI file using the MATLAB avifile functions. AVI files can be used for animated sequences and do not need MATLAB to run, but do require an AVI viewer. For more information, see “Exporting MATLAB Graphs in AVI Format,” in the “Development Environment” section of the Using MATLAB documentation. Importing MATLAB Graphics into Other Applications You can include MATLAB graphics in a wide variety of applications for word processing, slide preparation, modification by a graphics program, presentation on the Internet, and so on. In general, the process is the same for all applications: 1 Use MATLAB to create the figure you want to import into another application. 2 Export the MATLAB figure to one of the supported graphics file formats, selecting a format that is both appropriate for the type of figure and supported by the target application. See “Choosing a Graphics Format” on page 6-57 for help. 3 Use the import features of the target application to import the graphics file. How to Print or Export 6-19 Edit Before You Export. Vector graphics may be fully editable in a few high-end applications, but most applications do not support editing beyond simple resizing. Bitmaps cannot be edited with quality results unless you use a software package devoted to image processing. In general, you should try to make all the necessary settings while your figure is still in MATLAB. Importing into Microsoft Applications. To import your exported figure into a Microsoft application, select Picture from the Insert and navigate to your exported file. If you use the clipboard to perform your export operations, you can take advantage of the recommended MATLAB settings for Word and PowerPoint. Example — Importing an EPS Graphic into LaTeX. This example shows how to import an EPS file named peaks.eps into LaTeX. \documentclass{article} \usepackage{graphicx} \begin{document} \begin{figure}[h] \centerline{\includegraphics[height=10cm]{peaks.eps}} \caption{Surface Plot of Peaks} \end{figure} \end{document} EPS graphics can be edited after being imported to LaTeX. For example, you can specify the height in any LaTeX-compatible dimension. To set the height to 3.5 inches, use the command height=3.5in You can use the angle function to rotate the graph. For example, to rotate the graph 90 degrees, add angle=90 to the same line of code that sets the height, i.e., [height=10cm,angle=90] . 6 Printing and Exporting 6-20 Exporting to the Windows Clipboard You can export a figure to the Windows clipboard using one of two graphics formats: EMF color vector or BMP 8-bit color bitmap. By default, MATLAB chooses the graphics format for you, based on the rendering method used to display the figure. For figures rendered with OpenGL or Z-buffer, MATLAB uses the BMP format. For figures rendered with Painter’s, the EMF format is used. For information about how MATLAB selects a rendering method, see “The Default Renderer for MATLAB” on page 6-43. To override the selection by MATLAB, specify the format of your choice using either the Windows Copy Options Preferences dialog box, or the -d switch in the print command. You can export to the clipboard: •“Using the Graphical User Interface on Windows” •“Using MATLAB Commands” on page 6-22 Using the Graphical User Interface on Windows Before you export the figure to the clipboard, you can use the Copy Options Preferences dialog box to select a nondefault graphics format, or to adjust the certain figure settings. These settings become the new defaults for all figures exported to the clipboard. To open the Copy Options Preferences dialog box, select Copy Options from the figure window’s Edit menu. Any changes you make with this dialog box affect only the clipboard copy of the figure; they do not affect the way the figure looks on the screen. How to Print or Export 6-21 Settings you can change in the Copy Options Preferences dialog box are as follows: Clipboard format. To copy the figure in EMF color vector format, select Metafile . To use BMP 8-bit color bitmap format, select Bitmap . Or, to have MATLAB select the format for you, select Preserve information . MATLAB uses the metafile format, whenever possible. Figure background color. To keep the background color the same as it appears on the screen, select Use figure color . To make the background white, select Force white background . For a background that is transparent, for example, a slide background to frame the axes part of a figure, select Transparent background . 6 Printing and Exporting 6-22 Size. Select Match figure screen size to copy the figure as it appears on the screen, or leave it unselected to use the Page Setup settings to determine its size. 1 Open the Copy Options Preferences dialog box if you need to make any changes to those preferences used in copying to the clipboard. 2 Click OK to se the new preferences. These will be used for all future figures exported to the clipboard. 3 Select Copy Figure from the figure window’s Edit menu to copy the figure to the clipboard. Using MATLAB Commands Export to the clipboard using the print function with a graphics format, but no filename. You must use one of the following clipboard formats: -dbitmap , or -dmeta . These switches create a Windows Bitmap (BMP) or a Enhanced Metafile (EMF), respectively. For example, to export the current figure to the clipboard in Enhanced Metafile format, type print -dmeta Note When printing, the print -d option specifies a printer driver. When exporting, the print -d option specifies a graphics format. Examples of Basic Operations 6-23 Examples of Basic Operations This section provides step-by-step instructions for common printing and exporting tasks. Each printing example tells you how to perform the task from the print menus and from the command line. You can perform some tasks from the command line and others only from the menus. The examples presented here are •“Printing a Figure at Screen Size” •“Printing with a Specific Paper Size” on page 6-24 •“Printing a Centered Figure” on page 6-25 •“Exporting in a Specific Graphics Format” on page 6-26 •“Exporting in EPS Format with a TIFF Preview” on page 6-27 •“Exporting a Figure to the Clipboard” on page 6-28 Printing a Figure at Screen Size By default, MATLAB prints your figure at 8-by-6 inches. This size includes the area delimited by the background. This example shows how to print or export your figure the same size it is displayed on your screen. Using the Graphical User Interface 1 Resize your figure window to the size you want it to be when printed. 2 Select Page Setup from the figure window’s File menu, and select the Size and Position tab. 3 In the Mode panel, select Use screen size, centered on page . 4 Click OK . 5 Open the Print dialog box and print the figure. 6 Printing and Exporting 6-24 Using MATLAB Commands Set the PaperPositionMode property to auto before printing the figure. set(gcf, 'PaperPositionMode', 'auto'); print If later you want to print the figure at its original size, set PaperPositionMode back to 'manual' . Printing with a Specific Paper Size By default, MATLAB uses 8.5-by-11 inch paper. This example shows how to change the paper size to 8.5-by-14 inches by selecting a paper type (Legal). Using the Graphical User Interface 1 Select Page Setup from the figure window’s File tab. 2 Select the Legal paper type from the list under Paper size . The width and height fields update to 8.5 and 14, respectively. 3 Make sure that Units is set to inches . 4 Click OK . 5 Open the Print dialog box and print the figure. Using MATLAB Commands Set the PaperUnits property to inches , and the PaperType property to Legal . set(gcf, 'PaperUnits', 'inches'); set(gcf, 'PaperType', 'Legal'); Alternatively, you can set the PaperSize property to the size of the paper, in the specified units. set(gcf, 'PaperUnits', 'inches'); set(gcf, 'PaperSize', [8.5 14]); Examples of Basic Operations 6-25 Printing a Centered Figure This example sets the size of a figure to 5.5-by-3 inches and centers it on the paper. Using the Graphical User Interface 1 Select Page Setup from the figure window’s File menu, and select the Size and Position tab. 2 Make sure Use manual size and position is selected. 3 Enter 5.5 in the Width field and 3 in the Height field. 4 Make sure that Units field is set to inches . 5 Click Center . 6 Click OK . 7 Open the Print dialog box and print the figure. Using MATLAB Commands 1 Start by setting PaperUnits to inches . set(gcf, 'PaperUnits', 'inches') 2 Use PaperSize to return the size of the current paper. papersize = get(gcf, 'PaperSize') papersize = 8.5000 11.0000 3 Initialize variables to the desired width and height of the figure. width = 5.5; % Initialize a variable for width. height = 3; % Initialize a varible for height. 6 Printing and Exporting 6-26 4 Calculate a left margin that centers the figure horizontally on the paper. Use the first element of papersize (width of paper) for the calculation. left = (papersize(1)- width)/2 left = 1.5000 5 Calculate a bottom margin that centers the figure vertically on the paper. Use the second element of papersize (height of paper) for the calculation. bottom = (papersize(2)- height)/2 bottom = 4 6 Set the figure size and print. myfiguresize = [left, bottom, width, height]; set(gcf, 'PaperPosition', myfiguresize); print Exporting in a Specific Graphics Format Export a figure to a graphics-format file when you want to import it at a later time into another application such as a word processor. Using the Graphical User Interface 1 Select Export from the figure window’s File menu. 2 Use the Save in field to navigate to the directory in which you want to save your file. 3 Select a graphics format from the Save as type list. 4 Enter a filename in the File name field. An appropriate file extension, based on the format you chose, is displayed. 5 Click Save to export the figure. Examples of Basic Operations 6-27 Using MATLAB Commands From the command line, you must specify the graphics format as an option. See the print reference page for a complete list of graphics formats and their corresponding option strings. This example exports a figure to an EPS color file, myfigure.eps , in your current directory. print -depsc myfigure This example exports Figure No. 2 at a resolution of 300dpi to a 24-bit JPEG file, myfigure.jpg . print -djpeg -f2 -r300 myfigure This example exports a figure at screen size to a 24-bit TIFF file, myfigure.tif . set(gcf, 'PaperPositionMode', 'auto') % Use screen size print -dtiff myfigure Exporting in EPS Format with a TIFF Preview Use the print function to export a figure in EPS format with a TIFF preview. When you import the figure, the application can display the TIFF preview in the source document. The preview is color if the exported figure is color, and black and white if the exported figure is black and white. This example exports a figure to an EPS color format file, myfigure.eps , and includes a color TIFF preview. print -depsc -tiff myfigure This example exports a figure to an EPS black-and-white format file, myfigure.eps , and includes a black-and-white TIFF preview. print -deps -tiff myfigure 6 Printing and Exporting 6-28 Exporting a Figure to the Clipboard Export a figure to the clipboard in graphics-format when you want to paste it into another Windows application such as a word processor. Using the Graphical User Interface on Windows This example exports a figure to the clipboard in Enhanced Metafile (EMF) format. Figure settings are chosen that would make the exported figure suitable for use in a PowerPoint slide. Note that changing the settings modifies the figure displayed on the screen. 1 Create a figure containing text. You can use the following code. x = -pi:0.01:pi; h = plot(x, sin(x)); title('Sine Plot'); 2 Select Preferences from the figure window’s File menu. Then select Figure Copy Template from the Preferences dialog box. 3 In the Figure Copy Template Preferences panel, click the PowerPoint button. The MATLAB suggested settings for PowerPoint are added to the template. 4 In the Lines panel, change the Custom width to 4 points. 5 In the Uicontrols and axes panel, select Keep axes limits and tick spacing to prevent MATLAB from possibly rescaling ticks and limits when you export. The PowerPoint settings increase the font size by a percentage and make all text bold. The Text panel after the PowerPoint button is clicked Examples of Basic Operations 6-29 6 Click Apply to Figure . The changes appear in the figure window. If you don’t like the way your figure looks with the new settings, you can restore it to its original settings by clicking the Restore Figure button. 7 In the left pane of the Preferences dialog box, expand the Figure Copy Template topic. Select Copy Options . 8 In the Copy Options panel, select Metafile to tell MATLAB to export the figure in EMF format. 9 Check that Transparent background is selected. This choice makes the figure background transparent and allows the slide background to frame the axes part of the figure. 10 Clear Match figure screen size check box so that you can use your own figure size settings. 11 Click OK . 12 Select Page Setup from the figure window’s File 13 In the Size and Position tab, set Width to 10 and Height to 7.5 . Make sure that Units are set to inches . 14 Click OK . 15 Select Copy Figure from the Edit menu. Your figure is now exported to the clipboard and can be pasted into another Windows application such as a PowerPoint slide. 6 Printing and Exporting 6-30 Using MATLAB Commands Use the print function and one of two clipboard formats ( -dmeta , -dbitmap ) to export a figure to the clipboard. Do not specify a filename. This example exports a figure to the clipboard in Enhanced Metafile (EMF) format. print -dmeta This example exports a figure to the clipboard in Bitmap (BMP) 8-bit color format. print -dbitmap Changing a Figure’s Settings 6-31 Changing a Figure’s Settings The table below shows parameters that you can set before submitting your figure to the printer. Column 1 of the table lists all parameters that you can change. Column 2 shows the default setting that MATLAB uses. Column 3 shows which dialog box to use to set that parameter. If you can make this setting on only one platform, this is noted in parentheses: (W) for Windows, and (U) for UNIX. Some dialog boxes have tabs at the top to enable you to select a certain category. These categories are denoted in the table below using the format <dialogbox>/<tabname> . For example, “ Page Setup/Size ... ” in this column means to use the Page Setup dialog box, selecting the Size and Position tab. Column 4 shows how to set the parameter using the MATLAB print or set function. When using print , the table shows the appropriate command option (for example, print -loose ). When using set , it shows the property name to set along with the type of object (for example, (Line) for line objects). Parameter Default Dialog Box PRINT Command or SET Property Select figure last active window none print -fhandle Select printer system default Print print -pprinter Figure size 8-by-6 inches Page Setup/Size ... PaperSize (Figure) PaperUnits (Figure) Position on page 0.25 in. from left, 2.5 in. from bottom Page Setup/Size ... PaperPosition (Figure) PaperUnits (Figure) Position mode manual Page Setup/Size ... PaperPositionMode (Figure) Paper type letter Page Setup/Paper PaperType (Figure) 6 Printing and Exporting 6-32 Paper orientation portrait Page Setup/Paper PaperOrientation (Figure) Renderer selected by MATLAB Page Setup/Axes ... print -zbuffer | -painters | -opengl Renderer mode Auto Page Setup/Axes ... RendererMode (Figure) Resolution depends on driver or graphics format Print Properties (W) Printing Options (U) print -rresolution Axes tick marks recompute Page Setup/Axes ... XTickMode, etc. (Axes) Background color force to white Page Setup/Axes ... Color (Figure) InvertHardCopy (Figure) Font size as in the figure Fig. Copy Template FontSize (Text) Bold font regular font Fig. Copy Template FontWeight (Text) Line width as in the figure Fig. Copy Template LineWidth (Line) Line style black or white Fig. Copy Template LineStyle (Line) Line and text color black and white Page Setup/Lines ... Color (Line, Text) CMYK color RGB color Printing Options (U) print -cmyk UI controls printed Page Setup/Axes ... print -noui Bounding box tight Printing Options (U) print -loose Copy background transparent Copy Options (W) see “Background color” Copy size same as screen size Copy Options (W) see “Figure Size” Parameter Default Dialog Box PRINT Command or SET Property Changing a Figure’s Settings 6-33 Selecting the Figure By default, MATLAB prints the current figure. If you have more than one figure open, the current figure is the last one that was active. To make a different figure active, click on it to bring it to the foreground. Using MATLAB Commands Specify a figure handle using the command print -fhandle This example sends Figure No. 2 to the printer. A figure’s number is usually its handle. print -f2 Selecting the Printer You can select the printer you want to use with the Print dialog box or with the print function. Using the Graphical User Interface 1 Select Print from the figure window’s File menu. 2 Select the printer from the list box near the top of the Print dialog box. 3 Click OK . Using MATLAB Commands You can select the printer using the -P switch of the print function. This example prints Figure No. 3 to a printer called Calliope . print -f3 -PCalliope If the printer name has spaces in it, put quotes around the -P option, as shown here. print "-Pmy local printer" 6 Printing and Exporting 6-34 Using a Network Print Server. On Windows NT, Windows 2000, and Windows XP systems, you can print to a network print server using the form shown here for a printer named trinity . print -P\\PRINTERS\trinity This form is not supported on Windows 98 or Windows ME. On these platforms, you can print to a network printer only if you install a network printer using the Add Printer dialogs. When installed in this manner, these network printers work without the use of the \\server\printer notation, as they look the same as local printers. Setting the Figure Size and Position The default output figure size is 8 inches wide by 6 inches high, which maintains the aspect ratio (width to height) of the MATLAB figure window. The figure’s default position is centered both horizontally and vertically when printed to a paper size of 8.5-by-11 inches. You can change the size and position of the figure: •“Using the Graphical User Interface” •“Using MATLAB Commands” on page 6-37 Using the Graphical User Interface Select Page Setup from the figure window’s File menu to open the Page Setup dialog box. Click the Size and Position tab to make changes to the size and position of your figure on the printed page. Use the text edit boxes on the left to enter new dimensions for your figure. Or use the graphical user interface at the right to drag the borders and location of the “sample” figure with your mouse. Changing a Figure’s Settings 6-35 Settings you can change in the Size and Position window are as follows: Mode. Choose whether you want the figure to be the same size as it is displayed on your screen, or you want to manually change its size using the options in the Size and Position window. The next two panels are enabled only when you select the Use manual size and position mode. Manual size and position. Enter the measurements and units for the size and position of the figure. Graphical User Interface. Use the “Sample” figure at the right of the dialog box to move and resize your MATLAB figure interactively. 6 Printing and Exporting 6-36 To set the width and height interactively, use the mouse to drag the edges of the “Sample” figure to the desired size. To set the margins of the figure (offsets from the left and top edges of the paper), drag the entire “Sample” figure to a new position with the mouse. If you want the figure resized to fill the paper, click Fill page . Note that Fill page may alter the aspect ratio of your image. To get the maximum figure size without altering the aspect ratio, select Fix aspect ratio . Note Changes you make using Page Setup affect the printed output only. They do not alter the figure displayed on your screen. Width and Height update as you resize the preview image. Preview image Left and Top update as you move the sample figure around. Changing a Figure’s Settings 6-37 Using MATLAB Commands To print your figure with a specific size or position, make sure that the PaperPositionMode property is set to manual (the default). Then set the PaperPosition property to the desired size and position. The PaperPosition property references a four-element row vector that specifies the position and dimensions of the printed output. The form of the vector is [left bottom width height] where • left specifies the distance from the left edge of the paper to the left edge of the figure. • bottom specifies the distance from the bottom of the paper to the bottom of the figure. • width and height specify the figure’s width and height. The MATLAB default values for PaperPosition are [0.25 2.5 8.0 6.0] This example sets the figure size to a width of 4 inches and height of 2 inches, with the origin of the figure positioned 2 inches from the left edge of the paper and 1 inch from the bottom edge. set(gcf, 'PaperPositionMode', 'manual'); set(gcf, 'PaperUnits', 'inches'); set(gcf, 'PaperPosition', [2 1 4 2]); Note PaperPosition specifies a bottom margin, rather than a top margin as Page Setup does. When you set the top margin using Page Setup , MATLAB uses this setting to calculate the bottom margin, and updates the PaperPosition property appropriately. 6 Printing and Exporting 6-38 Setting the Paper Size or Type Set the paper size by specifying the dimensions or by choosing from a list of predefined paper types. If you do not set a paper size or type, MATLAB uses the default paper size of 8.5-by-11 inches. Paper-size and paper-type settings are interrelated — if you set a paper type, MATLAB updates the paper size. For example, if you set the paper type to US Legal , MATLAB updates the width of the paper to 8.5 inches and the height to 14 inches. You can change the paper size and orientation: •“Using the Graphical User Interface” •“Using MATLAB Commands” on page 6-39 Using the Graphical User Interface Select Page Setup from the figure window’s File menu to open the Page Setup dialog box. Click the Paper tab to make changes to the paper type and orientation of the figure on the printed page. Changing a Figure’s Settings 6-39 Settings you can change in the Paper window are as follows: Paper size. Select a paper type from the list under Paper size . If there is no paper type with suitable dimensions, enter your own dimensions in the Width and Height fields. Make sure Units is set appropriately to inches , centimeters , points , or normalized . Orientation. Select how you want the figure to be oriented on the printed page. The illustration under “Setting the Paper Orientation” on page 6-39 shows the three types of orientation you can choose from. Note Changes you make using Page Setup affect the printed output only. They do not alter the figure displayed on your screen. Using MATLAB Commands Set the PaperType property to one of the built-in MATLAB paper types, or set the PaperSize property to the dimensions of the paper. When you select a paper type, the unit of measure is not automatically updated. We recommend that you set the PaperUnits property first. For example, these commands set the units to centimeters and the paper type to A4 . set(gcf, 'PaperUnits', 'centimeters'); set(gcf, 'PaperType', 'A4'); This example sets the units to inches and sets the paper size of 5-by-7 inches. set(gcf, 'PaperUnits', 'inches'); set(gcf, 'PaperSize', [5 7]); If you set a paper size for which there is no matching paper type, the PaperType property is automatically set to '<custom>' . Setting the Paper Orientation Paper orientation refers to how the paper is oriented with respect to the figure. The choices are Portrait (the default), Landscape , and Rotated . 6 Printing and Exporting 6-40 You can change the orientation of the figure: •“Using the Graphical User Interface” •“Using MATLAB Commands” on page 6-41 The figure below shows the same figure printed using the three different orientations. Note The rotated orientation is not supported by all printers. When the printer does not support it, landscape is used. Using the Graphical User Interface 1 Select Page Setup from the figure window’s File tab. (See “Using the Graphical User Interface” on page 6-38). 2 Select the appropriate option button under Orientation . 3 Click OK . Portrait Landscape Rotated (by 180 degrees) 1 2 3 4 5 0 1 2 3 4 5 1 2 3 4 5 0 1 2 3 4 5 1 2 3 4 5 0 1 2 3 4 5 Changing a Figure’s Settings 6-41 Using MATLAB Commands Use the PaperOrientation figure property or the orient function. Use the orient function if you always want your figure centered on the paper. The following example sets the orientation to landscape : set(gcf, 'PaperOrientation', 'landscape'); Centering the Figure. If you set the PaperOrientation property from portrait to either of the other two orientation schemes, you may find that what was previously a centered image is now positioned near the paper’s edge. You can either adjust the position (use the PaperPosition property), or you can use the orient function, which always centers the figure on the paper. The orient function takes the same argument names as PaperOrientation . For example, orient rotated; Selecting a Renderer A renderer is software and/or hardware that processes graphics data (such as vertex coordinates) to display, print, or export a figure. You can change the renderer that MATLAB uses when printing a figure: •“Using the Graphical User Interface” on page 6-44 •“Using MATLAB Commands” on page 6-44 Orientation set to 'landscape' using 'PaperOrientation' property . Orientation set to 'landscape' using orient function. 6 Printing and Exporting 6-42 Renderers Supported by MATLAB MATLAB supports three rendering methods with the following characteristics: Painter’s •Draws figures using vector graphics •Generally produces higher resolution results •The fastest renderer when the figure contains only simple or small graphics objects •The only renderer possible when printing with the HPGL print driver or exporting to an Adobe Illustrator file •The best renderer for creating PostScript or EPS files •Cannot render figures that use RGB color for patch or surface objects •Does not show lighting or transparency Z-buffer •Draws figures using bitmap (raster) graphics •Faster and more accurate than Painter’s •Can consume a lot of system memory if MATLAB is displaying a complex scene •Shows lighting, but not transparency OpenGL •Draws figures using bitmap (raster) graphics •Generally faster than Painter’s or Z-buffer •In some cases, enables MATLAB to access graphics hardware that is available on some systems •Shows both lighting and transparency For more detailed information about the rendering methods, see Renderer on the “Figure Properties” reference pages. Changing a Figure’s Settings 6-43 The Default Renderer for MATLAB By default, MATLAB automatically selects the best rendering method, based on the attributes of the figure (its complexity and the settings of various Handle Graphics properties) and in some cases, the printer driver or file format used. In general, MATLAB uses •Painter’s for line plots, area plots (bar graphs, histograms, etc.), and simple surface plots •Z-buffer when the computer screen is not truecolor or when the opengl function was called with selection_mode set to neverselect •OpenGL for complex surface plots using interpolated shading and any figure using lighting The RendererMode property tells MATLAB whether to automatically select the renderer based on the contents of the figure (when set to auto ), or to use the Renderer property that you have indicated (when set to manual ). Reasons for Manually Setting the Renderer Two reasons to set the renderer yourself are •To make your printed or exported figure look the same as it did on the screen. The rendering method used for printing and exporting the figure is not always the same method used to display the figure. •To avoid unintentionally exporting your figure as a bitmap within a vector format. For example, MATLAB typically renders high-complexity plots using OpenGL or Z-buffer. If you export a high-complexity figure to the EPS or EMF vector formats without specifying a rendering method, MATLAB might use OpenGL or Z-buffer, each of which creates bitmap graphics. Storing a bitmap in a vector file can generate a very large file that takes a long time to print. If you use one of these formats and want to make sure that your figure is saved as a vector file, be sure to set the rendering method to Painter’s. 6 Printing and Exporting 6-44 Using the Graphical User Interface 1 Open the Page Setup dialog box by selecting Page Setup from the figure window’s File menu. Select the Axes and Figure tab. 2 Under Figure renderer , select the desired rendering method from the list box. 3 Click OK . Using MATLAB Commands You can use the Renderer property or a switch with the print function to set the renderer for printing or exporting. These two lines each set the renderer for the current figure to Z-buffer. set(gcf, 'Renderer', 'zbuffer'); or print -zbuffer The first example saves the new value of Renderer with the figure; the second example only affects the current print or export operation. Note that when you set the Renderer property, the RendererMode property is automatically reset from auto (the factory default) to manual . Setting the Resolution Resolution refers to how accurately your figure is rendered when printed or exported. Higher resolutions produce higher quality output. The specific definition of resolution depends on whether your figure is output as a bitmap or as a vector graphic. You can change the resolution that MATLAB uses to print a figure •“Using the Graphical User Interface on Windows” on page 6-46 •“Using the Graphical User Interface on UNIX” on page 6-47 •“Using MATLAB Commands” on page 6-47 Changing a Figure’s Settings 6-45 Default Resolution and When You Can Change It The default resolution depends on the renderer used and the graphics format or printer driver specified. The following two tables summarize the default resolutions and whether you can change them. Resolutions Used with Graphics Formats Graphics Format Default Resolution Can Be Changed? Built-in MATLAB export formats, (except for EMF, EPS, and ILL) 150 dpi (always use OpenGL or Z-buffer) Yes EMF export format (Enhanced Metafile) 150 dpi Yes EPS (Encapsulated PostScript) 150 dpi, if OpenGL or Z-buffer; 864 dpi if Painter’s Yes 72 dpi (always uses Painter’s) No Ghostscript export formats 72 dpi (always uses OpenGL or Z-buffer) No Resolutions Used with Printer Drivers Printer Driver Default Resolution Can Be Changed? Windows and PostScript drivers 150 dpi, if OpenGL or Z-buffer; 864 dpi if Painter’s Yes Ghostscript driver 150 dpi, if OpenGL or Z-buffer; 864 dpi if Painter’s Yes HPGL driver 1116 dpi (always uses Painter’s) Yes 6 Printing and Exporting 6-46 Choosing a Setting You may need to determine your resolution requirements through experimentation, but you can also use the following guidelines. For Printing. The default resolution of 150 dpi is normally adequate for typical laser-printer output. However, if you are preparing figures for high-quality printing, such as a textbook or color brochures, you may want to use 200 or 300 dpi. The resolution you can use may be limited by the printer’s capabilities. For Exporting. If you are exporting your figure, base your decision on the resolution supported by the final output device. For example, if you will import your figure into a word processing document and print it on a printer that supports a maximum resolution setting of 300 dpi, you may want to export your figure using 300 dpi to get a precise one-to-one correspondence between pixels in the file and dots on the paper. Note The only way to set resolution when exporting is with the print function. Impact of Resolution on Size and Memory Needed Resolution affects file size and memory requirements. For both printing and exporting, the higher the resolution setting, the longer it takes for MATLAB or your printer to render your figure. Using the Graphical User Interface on Windows To set the resolution for built-in MATLAB printer drivers on Windows systems, 1 From the Print dialog box, click Properties . This opens a new dialog box that may differ from one printer to another. 2 You may be able to set the resolution from this dialog, or you may have to click on Advanced to get to a dialog box that enables you to do this. 3 Set the resolution, and then click OK . (The resolution setting may be labeled by another name, such as “Print Quality.”) Changing a Figure’s Settings 6-47 Using the Graphical User Interface on UNIX To set the resolution for built-in MATLAB printer drivers on UNIX systems, 1 From the UNIX Print dialog box, click Options . This opens the Printing Options dialog box. 2 Under the Printing Resolution panel, select either Use same resolution as the screen or Specify resolution in dots per inch . 3 If you select Specify resolution in dots per inch , enter a value in the Specify resolution in dots per inch text box. 4 Click OK . Using MATLAB Commands If you use a Windows printer driver, you can only set the resolution using the Windows Document Properties dialog box. Otherwise, to set the resolution for printing or exporting, the syntax is print -rnumber where number is the number of dots per inch. To print or export a figure using screen resolution, set number to 0 (zero). This example prints the current figure with a resolution of 100 dpi, print -r100 This example exports the current figure to a TIFF file using screen resolution, print -r0 -dtiff myfile.tif Setting the Axes Ticks and Limits The MATLAB default output size, 8-by-6 inches, is normally larger than the screen size. If the size of your printed or exported figure is different from its size on the screen, MATLAB scales the number and placement of axes tick marks to suit the output size. This section shows you how to lock them so that they are the same as they were when displayed. 6 Printing and Exporting 6-48 You can change the resolution that MATLAB uses to print a figure •“Using the Graphical User Interface” •“Using MATLAB Commands” on page 6-49 Using the Graphical User Interface Select Page Setup from the figure window’s File menu to open the Page Setup dialog box. Select the Axes and Figure tab to make changes to the axes, UI controls, background color, or renderer selection. Settings you can change in the Axes and Figure window are as follows: Axes limits and ticks. If the size of your printed or exported figure is different from its size on the screen, MATLAB scales the number and placement of axes tick marks to suit the output size. Select Keep screen limits and ticks to lock them so that they are the same as they were when displayed. Figure controls. By default, user interface controls are included in your printed or exported figure. Clear the Print UIControls check box to exclude them. (See “Excluding User Interface Controls” on page 6-55). Changing a Figure’s Settings 6-49 Background color. You can keep the background the same as is shown on the screen when printed, or change the background to be white. (See “Setting the Background Color” on page 6-49). Figure renderer. Set the renderer to Painter’s, Z-buffer, or OpenGL, or let MATLAB decide which one to use, depending on the characteristics of the figure. (See “Selecting a Renderer” on page 6-41). Note Changes you make using Page Setup affect the printed output only. They do not alter the figure displayed on your screen. Using MATLAB Commands To set the XTickMode , YTickMode , and ZTickMode properties to manual , type set(gca, 'XTickMode', 'manual'); set(gca, 'YTickMode', 'manual'); set(gca, 'ZTickMode', 'manual'); Setting the Background Color There are two types of background color settings in a figure: the axes background and the figure background. The default displayed color of both backgrounds is gray, but you can set them to any of several colors. Regardless of the background colors in your displayed figure, by default, MATLAB always changes them to white when you print or export. This section shows you how to retain the displayed background colors in your output. Using the Graphical User Interface To retain the background color on a per figure basis, 1 Open the Page Setup dialog box by selecting Page Setup from the figure window’s File menu. Select the Axes and Figure tab. 2 Select Keep screen background color . 3 Click OK . 6 Printing and Exporting 6-50 If you are exporting your figure using the clipboard, use the Copy Options panel of the Preferences dialog box. Using MATLAB Commands To retain your background colors, use set(gcf, 'InvertHardCopy', 'off'); The following example sets the figure background color to blue , the axes background color to yellow , and then sets InvertHardCopy to off so that these colors will appear in your printed or exported figure. set(gcf, 'color', 'blue'); set(gca, 'color', 'yellow'); set(gcf, 'InvertHardCopy', 'off'); Setting Line and Text Characteristics If you transfer your figures to Word or PowerPoint applications, you can set line and text characteristics to values recommended for those applications. The Figure Copy Template Preferences dialog box provides Word and PowerPoint options to make these settings, or you can set certain line and text characteristics individually. You can change line and text characteristics: •“Using the Graphical User Interface” •“Using MATLAB Commands” on page 6-52 Using the Graphical User Interface To open Figure Copy Template Preferences , select Preferences from the figure window’s File menu, and then click on Figure Copy Template in the left pane. Changing a Figure’s Settings 6-51 Settings you can change in the Figure Copy Template Preferences dialog box are as follows: Word or PowerPoint. Click Word or PowerPoint to apply settings recommended for MATLAB. Text. Use options in the Text panel to modify the appearance of all text in the figure. You can change the font size, change color text to black and white, and change the font style to bold. Note the difference between Apply to Figure and Apply . Use Apply to Figure to modify the figure in the figure window. Use Apply or OK 6 Printing and Exporting 6-52 Lines. Use the Lines panel to modify the appearance of all lines in the figure. Options include • Custom width — Change the line width. • Change style (Black or white) — Change colored lines to black or white. • Change style (B&W styles) — Change solid lines to different line styles (e.g., solid, dashed, etc.), and black or white color. UIControls and axes. If your figure includes user interface controls, you can choose to show or hide them by clicking on Show uicontrols . Also, to keep axes limits and ticks as they appear on the screen, click Keep axes limits and tick spacing . To allow MATLAB to scale axes limits and ticks based on the size of the printed figure, clear this box. Note Changes you make using Page Setup affect the printed output only. They do not alter the figure displayed on your screen. Using MATLAB Commands You can use the set function on selected graphics objects in your figure to change individual line and text characteristics. For example, to change line width to 1.8 and line style to a dashed line, use lineobj = findobj('type', 'line'); set(lineobj, 'linewidth', 1.8); set(lineobj, 'linestyle', '--'); To change the font size to 15 points and font weight to bold, use textobj = findobj('type', 'text'); set(textobj, 'fontunits', 'points'); set(textobj, 'fontsize', 15); set(textobj, 'fontweight', 'bold'); Setting the Line and Text Color When colored lines and text are dithered to gray by a black-and-white printer, it does not produce good results for thin lines and the thin lines that make up text characters. You can, however, force all line and text objects in the figure to Changing a Figure’s Settings 6-53 print in black and white, thus improving their appearance in the printed copy. When you select this setting, the lines and text are printed all black or all white, depending on the background color. The default is to leave lines and text in the color that appears on the screen. Note Your background color may not be the same as what you see on the screen. See the Axes and Figure tab for an option that preserves the background color when printing. You can change the resolution that MATLAB uses to print a figure: •“Using the Graphical User Interface” •“Using MATLAB Commands” on page 6-54 Using the Graphical User Interface Select Page Setup from the figure window’s File menu to open the Page Setup dialog box. Select the Lines and Text tab to make changes to the color of all lines and text on the printed page. 6 Printing and Exporting 6-54 Settings you can change in the Lines and Text window are as follows: Lines and text. To have colored lines and text printed as black and white, select Black and white . To print them in color, select Color (don’t convert) . Note Changes you make using Page Setup affect the printed output only. They do not alter the figure displayed on your screen. Using MATLAB Commands There is no equivalent MATLAB command that will set line and text color depending on background color. Set the color of lines and text using the set function on either Line or Text objects in your figure. This example sets all lines and text to black: set(findobj('type', 'line'), 'color', 'black'); set(findobj('type', 'text'), 'color', 'black'); Setting CMYK Color By default, MATLAB produces color output in the RGB color space (red, green, blue). If you plan to publish and print MATLAB figures using printing industry standard four-color separation, you may want to use the CMYK color space (cyan, magenta, yellow, black). Using the Graphical User Interface on UNIX 1 Select Print from the figure window’s File 2 Click Options . This opens the Printing Options dialog box. 3 Select Use CMYK colors in PS and Ghostscript drivers instead of RGB . 4 Click OK . Changing a Figure’s Settings 6-55 Using MATLAB Commands Use the -cmyk option with the print function. This example prints the current figure in CMYK using a PostScript Level II color printer driver. print -dpsc2 -cmyk Excluding User Interface Controls User interface controls are objects that you create and add to a figure. For example, you can add a button to a figure that, when clicked, conveniently runs another M-file. By default, user interface controls are included in your printed or exported figure. This section shows how to exclude them. Using the Graphical User Interface 1 Open the Page Setup dialog box by selecting Page Setup from the figure window’s File menu. Select the Axes and Figure tab. 2 Under Figure controls , clear the Print UIControls check box. 3 Click OK . Using MATLAB Commands Use the -noui switch. This example specifies a color PostScript driver and excludes UI controls. print -dpsc -noui This example exports the current figure to a color EPS file and excludes UI controls. print -depsc -noui myfile.eps Producing Uncropped Figures In most cases, MATLAB crops the background tightly around the objects in the figure. Depending on the printer driver or file format you use, you may able to produce uncropped output. An uncropped figure has increased background area and is often desirable for figures that contain UI controls. The setting you make in MATLAB changes the PostScript BoundingBox property saved with the figure. 6 Printing and Exporting 6-56 Using the Graphical User Interface on UNIX You can only make the uncropped setting on a per figure basis: 1 Select Print from the figure window’s File menu. 2 From the UNIX Print dialog box, click Options . This opens the Printing Options dialog box. 3 Select Use loose bounding box for PS and Ghostscript drivers . 4 Click OK . Using MATLAB Commands Use the -loose option with the print function. For Windows, the uncropped option is only available if you print to a file. This example exports the current figure, uncropped, to an EPS file. print -deps -loose myfile.eps Choosing a Graphics Format 6-57 Choosing a Graphics Format A graphics file format is a specification for storing and organizing data in a file. MATLAB supports many different graphics file formats. Some are built into MATLAB and others are Ghostscript formats. File formats also differ in color support, graphics style (bitmap or vector), and bit depth. This section provides information to help you decide which graphics format to use when exporting your figure to a file or to the Windows clipboard. It covers •“Frequently Used Graphics Formats” on page 6-58 •“Factors to Consider in Choosing a Format” on page 6-59 •“Properties Affected by Choice of Format” on page 6-61 •“Impact of Rendering Method on the Output” on page 6-63 •“Description of Selected Graphics Formats” on page 6-63 •“How to Specify a Format for Exporting” on page 6-66 Before deciding on a graphics format, check what formats are supported by your target application and platform. See the print reference page for a complete list of graphics formats supported in MATLAB. Once you decide on which format to use in exporting your figure, follow the instructions in “Exporting to a File” on page 6-15 or “Exporting to the Windows Clipboard” on page 6-20. 6 Printing and Exporting 6-58 Frequently Used Graphics Formats Here are some of the more frequently used graphics formats. For a complete list, see the Graphics Format table on the print reference page. For a more complete description of these formats, see “Description of Selected Graphics Formats” on page 6-63. Format Description Command Line -device Parameter EPS color, and black and white Export line plots or simple graphs to a file. Note. An EPS file does not display within some applications unless you add a TIFF preview image to it. See the example “Exporting in EPS Format with a TIFF Preview” on page 6-27. -deps (black and white) -depsc (color) -depsc -tiff (TIFF preview) JPEG 24-bit Export plots with surface lighting or transparency to a file. This format can be displayed by most Web browsers. -djpeg -djpegnumber, where number is the compression. TIFF 24-bit bitmap color Export plots with surface lighting or transparency to a file. Widely available. A good format to choose if you are not sure what formats your application supports. -dtiff BMP 8-bit color bitmap Export a figure to the clipboard (Windows only). -dbitmap EMF color vector format Export a figure to the clipboard (Windows only). -dmeta Choosing a Graphics Format 6-59 Factors to Consider in Choosing a Format There are at least five main factors to consider when choosing a graphics format to use in exporting a figure: •Implementation — Is it a built-in MATLAB or Ghostscript format? •Graphics Format — Is it bitmap or vector graphics format? •Bit Depth — What bit depth does the format offer? •Color Support — What color support does it have? •Model/Publication — Is it a Simulink model or specific publication type? The Graphics Format table shown on the print reference page provides information on the first four of these items for each format that MATLAB supports. Built-In MATLAB or Ghostscript Formats Some graphics formats are built-in MATLAB formats and others are provided by Ghostscript. In some cases (such as the Windows Bitmap format), the format is available both as a built-in format and a Ghostscript format. In general, when this is the case, we recommend that you choose the MATLAB format, especially if you plan to read the image back into MATLAB later. The choice of MATLAB versus Ghostscript is important when any of these properties affect your output: •Font support •Resolution •Importing back into MATLAB Bitmap or Vector Graphics MATLAB file formats are created using either bitmap or vector graphics. Bitmap formats store graphics as matrices of pixels. Vector formats use drawing commands to store graphics as geometric objects. Whether to use a bitmap or vector format depends mostly on the type of objects in your figure. The choice of bitmap versus vector graphics is important when any of these properties or capabilities affect your output: •Degree of complexity •Lighting and transparency 6 Printing and Exporting 6-60 •Line and text quality •File size •Resizing after import Bit Depth Bit depth is the number of bits a format uses to store each pixel. This determines the number of colors the exported figure can contain. Bit depth applies mostly to bitmap graphics. An 8-bit image uses 8 bits per pixel (bpp), enabling it to define 2 8 , or 256 unique colors. The other supported bit depths are 1-bit (2 colors), 4-bit (16 colors), and 24-bit (16 million colors). In vector files that don’t normally have a bit depth, the color of objects is specified by drawing commands stored in the file. However, vector files can contain bitmaps under the following conditions: •Image objects saved in vector formats are always saved as bitmaps, regardless of the rendering method used. •For vector files created using the OpenGL or Z-buffer renderer, everything in the figure is saved as a bitmap. The Graphics Format table on the print reference page indicates the bit depth of each format. If file size is not critical, make sure you choose a format with a bit depth that supports the number of colors or shades of gray in your displayed figure. Color Support Each graphics format can produce either color, grayscale, or monochrome output. Check the Graphics Format table to see the level of color support for each format type. To preserve the color in your exported file, you must select a color graphics format. Color is also affected by bit depth. Simulink models can only be exported to EPS or a Ghostscript format. Note that you can only use the print function to export a model, not the Export dialog box. Choosing a Graphics Format 6-61 High Resolution or Web Publications If you want to use a figure in a journal or other publication, use a format that enables you to set a high resolution. We recommend using either TIFF or EPS. If you want to use a figure in a Web publication, you should use either the PNG or the JPEG format. Note that if you need a GIF image, you can export your figure as a TIFF file and convert it to a GIF using another software application. Properties Affected by Choice of Format The figure properties listed in this section are affected when you select a graphics format when exporting to a file or the Windows clipboard. Font Support Ghostscript formats support a limited number of fonts. If you use an unsupported font, MATLAB substitutes Courier. See “PostScript and Ghostscript Supported Fonts” on page 6-71 for more information. Resolution Generally, higher resolution means higher quality. Your choice of resolution should be based in part on the device to which you will ultimately print it. Experimentation with different resolution settings can be helpful. You cannot change the resolution of a Ghostscript format. The resolution is low (72 dpi) and may not be appropriate for publications. Importing Into MATLAB If you want to read an exported figure back into MATLAB, it is best to use one of the built-in MATLAB formats. Degree of Complexity Bitmaps are preferable for high-complexity plots, where complexity is determined by the number of polygons, the number of polygons with interpolated shading, the number of markers, the presence of truecolor images, and other factors. An example of a high-complexity plot is a surface plot that uses interpolated shading. Vector formats are preferable for most 2-D plots and for some low-complexity surface plots. 6 Printing and Exporting 6-62 Lighting and Transparency Surface lighting and transparency are only supported by bitmap graphics formats. If you use a vector format, the lighting and transparency disappear. Note that of the two renderers intended for bitmaps (OpenGL and Z-buffer) only OpenGL supports transparency. Note If you export to an EPS (vector) file using the Painter’s renderer and include a TIFF preview, the preview image is a bitmap and will show lighting or transparency when displayed on your screen. Remember that the underlying format vector file, which is what normally gets printed, does not support these features. Lines and Text Generally, vector formats create better lines and text than bitmap formats. File Size In general, bitmap formats produce smaller files for complex plots than vector formats, and vector formats produce smaller files for simple plots than bitmap formats. You can calculate the size of a figure exported to an uncompressed bitmap by multiplying the figure size by its resolution and the bit depth of the chosen format. For example, if a figure is 2 inches by 3 inches and has a resolution of 100 dpi (dots per inch), it will consist of , or 60,000 pixels. If exported to an 8-bit file, it uses 480,000 bits, or 60KB. If exported to a 24-bit file, it uses three times the number of bytes, or 180KB. Vector format file size is affected by the complexity and number of objects in your figure. As the complexity and number of objects increase, the number of drawing commands increases. Resizing After Import You can resize a vector graphics figure after importing it into another software application without losing quality. (Not all applications that support vector formats enable you to resize them.) 2 100 3 100 Choosing a Graphics Format 6-63 This is not true of bitmap formats. Resizing a bitmap causes round-off errors that result in jagged edges and degradation of picture quality. This degradation is particularly obvious in lines and text and is highly discouraged. Color The Graphics Format table on the print reference page indicates the color support and bit depth of each format. If file size is not critical, make sure you choose a format with a bit depth that supports the number of colors or shades of gray in your displayed figure. Impact of Rendering Method on the Output If you specify a bitmap format when exporting, the exported file will always contain a bitmap regardless of your current renderer setting. If you have the renderer set to Painter’s, which normally produces a vector format, that setting is ignored under these circumstances. Vector format files, however, can store your figure as a vector or bitmap graphic depending on the renderer used to export it. If you do not specify a rendering method and MATLAB chooses the OpenGL or Z-buffer renderer, your exported vector file will contain a bitmap. If you want your figure exported as a vector graphic, be sure to set the rendering method to Painter’s. Description of Selected Graphics Formats This section contains details about some of the export file formats MATLAB supports. For information about formats not listed here, consult a graphics file format reference. Formats covered in this section are •“Adobe Illustrator 88 Files” on page 6-64 •“EMF Files” on page 6-64 •“EPS Files” on page 6-64 •“TIFF Files” on page 6-66 •“JPEG Files” on page 6-66 6 Printing and Exporting 6-64 Adobe Illustrator (ILL) is a vector format that is fully compatible with Adobe Illustrator software. An Illustrator file created in MATLAB can be further processed with Adobe Illustrator running on any platform. (Note that when you view it in Illustrator, it will have no template.) By default, Illustrator files are color and saved in portrait orientation. The Illustrator group command is used to give the illustrations a hierarchy similar to that of the Handle Graphics or Simulink graphic. Some limitations of the Illustrator format are •Interpolated patches and surfaces cannot be created. The color of each polygon will be determined by the average of the CData values for all of the polygon’s vertices. •Images cannot be exported in this format. •The resolution setting of 72 dpi cannot be changed. •No fonts are downloaded to the Illustrator file. Any unavailable fonts will be substituted with available fonts. EMF Files Enhanced Metafiles (EMF) are vector files similar in nature to Encapsulated PostScript (EPS), capable of producing near publication-quality graphics. EMF is an excellent format to use if you plan to import your image into a Microsoft application and want the flexibility to edit and resize your image once it has been imported. It is the only MATLAB supported vector format you can edit from within a Microsoft application. (Note that your editing ability is limited. For the best results, do all of your editing in MATLAB.) A drawback of using EMF files is that they are generally only supported by Windows-based applications. EPS Files The Encapsulated PostScript (EPS) vector format is the most reliable and consistent file format MATLAB supports. It is widely recognized in desktop publishing and word processing packages on both UNIX and Windows platforms. EPS is the only MATLAB supported export format that can produce CMYK output. (PostScript printer drivers also support this feature.) Choosing a Graphics Format 6-65 This format is your best choice for producing publication-quality graphics. It may not be appropriate for figures containing interpolated shading because it creates a very large file that is difficult to print. For such figures, use the TIFF format with a high resolution setting. For more information about format choices, see “Bitmap or Vector Graphics” on page 6-59. When imported into Microsoft applications, an EPS file will not display unless you add a TIFF preview image to it. The preview image is simple to add (see the next section, “Creating a Preview Image”). However, if you print your file to a nonPostScript printer, the TIFF preview is used as the printed image. The resolution of the preview image is 72 dpi, resulting in much lower quality than the EPS image. If there is no preview image, your printout to a nonPostScript printer contains an error message in place of the graphic. Many high-end graphics packages, like Adobe Illustrator, can print an EPS file to a nonPostScript printer. When using EPS files in Microsoft applications, figures cannot be edited; they can only be annotated. Note The best vector format to use with Microsoft applications is EMF. See “EMF Files” on page 6-64. EPS format has limited font support. When MATLAB exports a graphic to the EPS file format, it does not try to determine whether the fonts you have used in your axes text objects are supported by the EPS format. Unsupported fonts are substituted with Courier. Creating a Preview Image. You cannot create TIFF preview images using the graphical user interface. Use the print command with the -tiff switch. For example, to create an EPS Level 2 image with TIFF preview in file myfile.eps , type print -depsc2 -tiff myfile.eps 6 Printing and Exporting 6-66 TIFF Files The Tagged Image File Format (TIFF) is a very widely used bitmap format and can produce publication-quality graphics if you use a high-resolution setting (such as 200 or 300 dpi). TIFF is a good format to choose if you are not sure what formats your target application supports, or if you want to import the graphic into more than one application without having to export it to several different formats. It can also be imported into most image-processing applications and converted to other formats, if necessary. For example, MATLAB does not produce GIF files (due to patent restrictions), but there are many applications that can convert TIFF files to GIF. JPEG Files The Joint Photographic Experts Group (JPEG) bitmap format is one of the dominant formats used in Web graphics. The 24-bit version MATLAB supports more colors than the popular GIF format. JPEG files always use JPEG compression. This is a lossy compression scheme, meaning that some data is thrown away during compression. When you export to a JPEG image, you can set the amount of compression to use. The more compression you use, the more data is thrown away. The compression amount is referred to as JPEG quality, where the highest setting results in the highest quality image, but the lowest amount of compression. Setting JPEG Quality. You cannot set the quality using the graphical user interface. Use the print command with the -djpeg format switch, including the desired quality value as a suffix. This example exports to a JPEG file using a quality setting of 100. print -djpeg100 myfile.jpg By default, MATLAB uses a quality setting of 75. Possible values are from 1 to 100. Note that the highest setting of 100 still results in some data loss, although the result is usually visually indistinguishable from the original. How to Specify a Format for Exporting To select a graphics format to use when exporting, choose a format from the Graphics Format table on the print reference page, and specify that format in either the Export dialog box or in the MATLAB print function. Choosing a Graphics Format 6-67 Using the Graphical User Interface When exporting your figure to a file, 1 Select Export from the figure window’s File menu. 2 Select a format from the Save as type list box. 3 Enter the filename you want to use and browse for the directory to save the file in. 4 Click Save . Using MATLAB Commands To specify a nondefault graphics format for the figure you are exporting, include the -d switch with the print command. For example, to export the current figure to file spline2d.eps , with 600 dpi resolution, and using the EPS color graphics format, type print -r600 -depsc spline2d Note When printing, the print -d option specifies a printer driver. When exporting, the print -d option specifies a graphics format. 6 Printing and Exporting 6-68 Choosing a Printer Driver A MATLAB printer driver formats your figure into instructions that your printer understands. See the Printer Driver table on the print reference page for a complete list of drivers. Specifying the printer driver does not change the selected printer. This section provides information to help you decide which printer driver to use when printing your figure. It covers •“Types of Printer Drivers” •“Factors to Consider in Choosing a Driver” on page 6-69 •“Driver-Specific Information” on page 6-72 •“How to Specify the Printer Driver to Use” on page 6-76 Types of Printer Drivers There are two main types of MATLAB printer drivers: built-in MATLAB, and Ghostscript. Built-in MATLAB Drivers Built-in MATLAB drivers are written specifically for MATLAB and include Windows, PostScript, and HPGL. MATLAB provides built-in Windows printer drivers so that your print requests can work with the Windows Print Manager. The Print Manager enables you to monitor printer queues and control various aspects of the printing process. HPGL support is provided for the HP 7475A plotter and fully compatible plotters. HPGL files can also be imported into documents of other applications, such as Microsoft Word. Ghostscript Drivers Ghostscript drivers use Ghostscript, a free software conversion program, to convert your figure into printer-model-specific instructions. Examples of Ghostscript drivers are Epson and HP. Choosing a Printer Driver 6-69 Factors to Consider in Choosing a Driver The choice of printer driver depends upon several considerations: •What platform you are using •What kind of printer you have •What color model you want to use •What font support you need •Any driver-specific settings you need The flow chart below gives an overview of how to choose a driver based on the platform you are using and the type of printer you have. Deciding What Type of Printer Driver to Use Using Windows ? Want to use the Windows Print Manager? Use a Windows printer driver Is the printer PostScript compatible ? Use a PostScript printer driver Use a GhostScript printer driver Yes Yes No No Yes No 6 Printing and Exporting 6-70 Platform Considerations On Windows, you can use any of the driver types shown in the figure above. If you use the Windows driver, you can use the Windows Print Manager. On UNIX, you can use either PostScript or Ghostscript drivers. On either platform, if you have a PostScript-compatible printer, it is better to use a PostScript driver than a Ghostscript driver. PostScript is less prone to printing errors than Ghostscript. Printer Type Printer support is different among the Windows, PostScript, and Ghostscript drivers. Consult the manual for your printer to see what driver to use. Windows drivers support most printer models, but sometimes the printer’s native driver is incompatible with the MATLAB Windows driver. If you are getting printing errors, see “Trouble with Native Drivers on Windows” on page 6-74. If lines and text in your figure are not printing with the desired color scheme, see “Correcting Color Results with Windows Drivers” on page 6-73. Some Ghostscript drivers are specific to certain printer models. For example, MATLAB provides different drivers to support the HP DeskJet 500, 500C, and 550C models, plus a generic driver for the series. When this is the case, try the model-specific driver first. If that doesn’t work, try the generic driver. Color Model By default, MATLAB uses a black-and-white driver. The built-in MATLAB and Ghostscript drivers print both color and black and white. The Printer Drivers table on the print reference page indicates which drivers are color. Colored surfaces and images print in grayscale when you use a black-and-white driver. Colored lines and text can be printed in color, grayscale, or black and white, depending on the color support of the driver and color capability of your printer. Font Support In MATLAB, the fonts supported for printing depend upon the MATLAB printer driver you specify and sometimes upon which platform you are using. Choosing a Printer Driver 6-71 PostScript and Ghostscript Supported Fonts. The table below lists the fonts supported by the MATLAB PostScript and Ghostscript drivers. This same set of fonts is supported on both Windows and UNIX. If you use a font that is not on this list, it will be substituted with Courier. If you set the font using the set function, use the names exactly as shown above. This example sets the font of the current text object to Helvetica-Narrow using MATLAB commands. set(gca, 'FontName', 'Helvetica-Narrow'); If you use the Property Editor dialog box (available under Axes Properties or Current Object Properties on the Edit menu) to set the font, the list of available fonts shows those that are supported by your system. If you choose one that is not in the table above, your resulting file will use Courier. Windows Drivers Supported Fonts. The MATLAB Windows drivers support any system-supported font. To see the list of fonts installed on your system, open the Font name list on the Text or Style tab of the Property Editor. If you use the set function to set fonts, type in the name just as it appears in the Property Editor. For example, if you have the Script font installed on your system, set the title of your figure to Script using the following code. h = get(gca, 'Title'); set(h, 'FontName', 'Script'); HPGL Driver Supported Fonts. HPGL drivers support only one font. However, you can set its size and color. AvantGarde Helvetica-Narrow Times-Roman Bookman NewCenturySchlbk ZapfChancery Courier Palatino ZapfDingbats Helvetica Symbol 6 Printing and Exporting 6-72 Settings That Are Driver Specific Some print settings are only supported by specific drivers. This table summarizes the settings and which driver supports them. Driver-Specific Information This section provides additional information about the various types of printer drivers available to MATLAB users. It covers the following topics: •“Setting the Windows Driver” •“Correcting Color Results with Windows Drivers” on page 6-73 •“Trouble with Native Drivers on Windows” on page 6-74 •“Level 1 or Level 2 PostScript Drivers” on page 6-74 •“Early PostScript 1 Printers” on page 6-74 •“Background Fills in HPGL Drivers” on page 6-75 •“Color Selection in HPGL Drivers” on page 6-75 •“Limitations of HPGL Drivers” on page 6-76 Setting the Windows Driver When you specify a Windows driver ( -dwin or -dwinc ), MATLAB interprets this to mean that the print request will use the Windows Print Manager. It also means that MATLAB will assign the default Windows driver based on your current printer’s color property setting. In other words, MATLAB does not differentiate between -dwin or -dwinc in printopt.m and you might not get the expected output color. Setting Driver(s) Appending figures to a PostScript file PostScript BoundingBox (setting figure to print uncropped) PostScript, Ghostscript CMYK PostScript Resolution set with user interface PostScript, Windows Resolution set with print function PostScript, Ghostscript Choosing a Printer Driver 6-73 There are two ways to ensure that MATLAB uses -dwin or -dwinc : specify the driver when you print, or use the Windows Document Properties dialog box to set the default driver. You can use the printer’s Document Properties dialog box to set the default driver for all print requests. This dialog box sets the printer’s color property, which in turn sets the default Windows driver. To access this dialog box, click the Options button on the Windows Print or Print Setup dialog box. See your Windows documentation if you need help with this dialog box. Document Properties dialog boxes vary from printer to printer. The figure below shows an example of one. Windows Document Properties Dialog Box for an HP LaserJet 5Si Correcting Color Results with Windows Drivers Sometimes, even when you use the Windows Document Properties dialog box, you can receive incorrect color results because some Windows printers return inaccurate information about their color property setting. Select this option, then set the printer’s color property below. 6 Printing and Exporting 6-74 If this happens, you can use the figure window’s Preferences dialog box to override the color property. This setting is used as the default setting for all future print operations: 1 Select Preferences from the figure window’s File menu on the MATLAB command window. 2 Select General Preferences . 3 Under the Figure Window Printing panel, select Always send as color . 4 Click OK . Trouble with Native Drivers on Windows Occasionally, printing problems are due to a bug in the native printer driver or an incompatibility between the native printer driver and the MATLAB driver. If you are having trouble, try installing a different native printer driver. A newer version may be available from the manufacturer or from a different vendor. You may also be able to use the native driver from a different printer, such as an earlier model from the same manufacturer. If this doesn’t help, try using a PostScript or Ghostscript driver. Level 1 or Level 2 PostScript Drivers Choosing between the Level 1 or Level 2 MATLAB PostScript drivers does not affect the quality of your output. Make the choice based on what your printer supports and on any file size or speed concerns. Level 1 PostScript produces good results on a Level 2 printer, but Level 2 PostScript will not print properly on a Level 1 printer. Level 2 PostScript files are generally smaller and render more quickly than Level 1 files. If your printer supports Level 2 PostScript, use one of the Level 2 drivers. If your printer does not support Level 2, or if you’re not sure, use a Level 1 driver. Early PostScript 1 Printers If you have an early PostScript 1 printer, such as some of the PostScript printers manufactured before 1990, you may notice problems in the text of MATLAB printouts. Your printer may not support the ISOLatin1Encoding Choosing a Printer Driver 6-75 operator that MATLAB uses for PostScript files. If this is the case, use Adobe’s PostScript default character-set encoding: •UNIX only: Open the Print dialog box and click Options . This opens the Printing Options dialog box. Select Use Adobe PS default character set encoding . option with the print command. Background Fills in HPGL Drivers The HPGL driver cannot do background fills. Therefore, you should ensure that your figure is set to print with a white background (the default), and that any lines and text in your figure will be drawn in a color dark enough to be seen on a white background. For more information about background color, see “Setting the Background Color” on page 6-49. Color Selection in HPGL Drivers The HP 7475A plotter supports six pens, none of which can be white. If MATLAB tries to draw in white while rendering in HPGL mode, the driver ignores all drawing commands until a different color is chosen. Pen 1, which is assumed to be black, is used for drawing axes. The remaining pens are used for the first five colors specified in the ColorOrder property of the current axes object. If ColorOrder specifies fewer than five colors, the unspecified pens are not used. For Simulink systems, which ordinarily use a maximum of eight colors, the six pens available on the plotter are assumed to be •Pen 1: black •Pen 2: red •Pen 3: green •Pen 4: blue •Pen 5: cyan •Pen 6: magenta 6 Printing and Exporting 6-76 If you attempt to draw a MATLAB object containing a color that is not a known pen color, the driver chooses the nearest approximation to the unlisted color. Limitations of HPGL Drivers The HPGL driver has these limitations: •Display colors and plotted colors sometimes differ. •Areas (faces on mesh and surface plots, patches, blocks, and arrowheads) are not filled. •There is no hidden line or surface removal. •Text is printed in the plotter’s default font. •Line width is determined by pen width. •Images and UI controls cannot be plotted. •Interpolated edge lines between two vertices are drawn with the pen whose color best matches the average color of the two vertices. •Figures cannot be rendered using Z-buffer or OpenGL; this driver always uses the Painter’s algorithm. How to Specify the Printer Driver to Use If you need to use a driver other than the default driver for your system, choose a new driver from the Printer Driver table on the print reference page, and set it either as a new default or just for the current figure you are working on. Setting the Default Driver for All Figures If you do not indicate a specific printer driver, MATLAB uses the default driver specified by the variable dev in the printopt.m file. The factory default driver depends on the platform. To change the default driver for all figures, edit printopt.m and change the value for dev to match one of the driver codes listed in the Printer Drivers table Platform Factory Default Printer Driver Driver Code Windows Black-and-white Windows -dwin UNIX Black-and-white Level II PostScript -dps2 Choosing a Printer Driver 6-77 on the print reference page. See “Setting Defaults Across Sessions” on page 6-7 for instructions. Setting a Driver for the Current Figure Only You can change the printer driver using a UNIX dialog box or from the MATLAB command line. Using the Graphical User Interface on UNIX. To specify a printer driver for the current figure: 1 From the figure window’s File . 2 Select a printer driver from the Driver list. 3 Click OK Using MATLAB Commands. To specify a nondefault printer driver for the figure you are printing, include the -d switch with the print command. For example, to print the current figure using the MATLAB built-in Windows color printer driver, winc , type print -dwinc Note When printing, the print -d option specifies a printer driver. When exporting, the print -d option specifies a graphics format. 6 Printing and Exporting 6-78 Troubleshooting This section lists some common problems you might encounter when printing or exporting your figure. Refer to the appropriate section listed below: • Printing Problems - “Printer Drivers” on page 6-79 - “Default Settings” on page 6-80 - “Line Style” on page 6-80 - “Color vs. Black and White” on page 6-81 - “Printer Selection” on page 6-82 - “Rotated Text” on page 6-82 - “ResizeFcn Warning” on page 6-82 • Exporting Problems - “Background Color” on page 6-82 - “Default Settings” on page 6-83 - “Microsoft Word” on page 6-83 - “File Format” on page 6-84 - “Size of Exported File” on page 6-84 - “Making Movies” on page 6-85 - “Extended Operations” on page 6-85 • General Problems - “Background Color” on page 6-86 - “Default Settings” on page 6-86 - “Dimensions of Output” on page 6-86 - “Axis and Tick Labels” on page 6-87 - “UI Controls” on page 6-88 - “Cropping” on page 6-88 - “Text Object Font” on page 6-88 If you don’t find your problem listed here, try searching the Knowledge Base maintained by the MathWorks Technical Support Department. Go to http://www.mathworks.com/support and enter a topic in the search field. Troubleshooting 6-79 Printing Problems Printer Drivers I’m using a Windows printer driver and have been encountering problems such as segmentation violations, general protection faults, application errors, and unexpected output. Try one of the following solutions: •Check the table of drivers in the print reference page to see if there are other drivers you can try. - If your printer is PostScript compatible, try printing with one of the MATLAB built-in PostScript drivers. - If your printer is not PostScript compatible, see if one of the MATLAB built-in Ghostscript devices is appropriate for your printer model. These devices use Ghostscript to convert PostScript files into other formats, such as HP LaserJet and Canon BubbleJet. •Contact the printer vendor to obtain a different native printer driver. The behavior you are experiencing may occur only with certain versions of the native printer driver. If this doesn’t help and you are using Windows, try reinstalling the drivers that were shipped with your Windows installation disk. •Export the figure to a graphics-format file, and then import it into another application before printing it. For information about exporting figures with MATLAB, see “Exporting to a File” on page 6-15. When I use the print function with the -deps switch, I receive this error message. Encapsulated PostScript files cannot be sent to the printer. File saved to disk under name 'figure2.eps' As the error message indicates, your figure was saved to a file. EPS is a graphics file format and cannot be sent to a printer using a printer driver. To send your figure directly to a printer, try using one of the PostScript driver switches. See the table of drivers in the print reference page. To print an EPS file, you must first import it into a word processor or other software program. 6 Printing and Exporting 6-80 Default Settings My printer uses a different default paper type than the MATLAB default type of “letter.” How can I change the default paper type so that I won’t have to set it for each new figure? You can set the default value for any property by adding a line to startup.m . Adding the following line sets the default paper type to A4. set(0, 'DefaultFigurePaperType', 'A4'); In your call to set , combine the word Default with the name of the object Figure and the property name PaperType . I set the paper orientation to landscape, but each time I go to print a new figure, the orientation setting is portrait again. How can I change the default orientation so that I won’t have to set it for each new figure? See the explanation for the question above. Adding the following line to startup.m sets the default paper orientation to landscape. set(0, 'DefaultFigurePaperOrient', 'landscape') Line Style My figure contains lines that use broken line styles. However, these lines print as solid lines. Microsoft Windows 98 does not support broken line styles for lines whose width is greater than 1 pixel. Unfortunately, most printers produce lines more than 1 pixel thick. So in most cases, Windows 98 drivers produce solid lines, regardless of the setting of LineStyleOrder . There are various ways you can work around this problem: •Change the MATLAB default line width to 1 pixel wide, by adding this line to the [MATLAB Settings] file. ThinLineStyles=1 This will result in thin lines, but the lines will print with the specified styles. Troubleshooting 6-81 •Set the figure’s Renderer property to OpenGL . set(gcf, 'Renderer', 'OpenGL') The printed output will match the displayed figure. See the section on “Selecting a Renderer” on page 6-41 for more information about the OpenGL renderer. •Use a PostScript or Ghostscript printer driver. These drivers bypass the Windows Print Manager. See “Choosing a Printer Driver” on page 6-68. Color vs. Black and White I want the lines in my figure to print in black, but they keep printing in color. You must be using a color printer driver. You can specify a black-and-white driver using the print function or the Page Setup dialog box to force the lines for the current figure to print in black. See “Setting the Line and Text Color” on page 6-52 for instructions. A white line in my figure keeps coming out black when I print it. There are two things that can cause this to happen. Most likely, the line is positioned over a dark background. By default, MATLAB inverts your background to white when you print, and changes any white lines over the background to black. To avoid this, retain your background color when you print. See “Setting the Background Color” on page 6-49. The other possibility is that you are using a Windows printer driver and the printer is sending inaccurate color information to MATLAB. See “Correcting Color Results with Windows Drivers” on page 6-73. I am using a color printer, but my figure keeps printing in black and white. By default, MATLAB uses a black-and-white printer driver. You need to specify a color printer driver. For instructions, see “Choosing a Printer Driver” on page 6-68. If you are already using a Windows color driver, the printer may be returning inaccurate information about its color property. See “Correcting Color Results with Windows Drivers” on page 6-73. 6 Printing and Exporting 6-82 Printer Selection I have more than one printer connected to my system. How do I specify which one to print my figure with? You can use either the Print dialog box, or the MATLAB print function, specifying the printer with the -P switch. For instructions using either method, see “Selecting the Printer” on page 6-33. Rotated Text I have some rotated text in my figure. It looks fine on the screen, but when I print it, the resolution is poor. You are probably using bitmapped fonts, which don’t rotate well. Try using TrueType fonts instead. ResizeFcn Warning I get a warning about my ResizeFcn being used when I print my figure. By default, MATLAB resizes your figure when converting it to printer coordinates. Therefore, MATLAB calls any ResizeFcn you have created for the figure and issues a warning. You can avoid this warning by setting the figure to print at screen size. Exporting Problems Background Color I generated a figure with a black background and selected “Use figure color” from the Copy Options panel of the Preferences dialog box. But when I exported my figure, its background was changed to white. You must have exported your figure to a file. The settings in Copy Options only apply to figures copied to the clipboard. There are two ways to retain the displayed background color: use the Page Setup dialog box or set the InvertHardCopy property to off . See “Setting the Background Color” on page 6-49 for instructions on either method. Troubleshooting 6-83 Default Settings I want to export all of my figures using the same size. Is there some way to do this so that I don’t have to set the size for each individual figure? You can set the default value for any property by adding a line to startup.m . Adding the following line sets the default figure size to 4-by-3 inches. set(0, 'DefaultFigurePaperPosition', [0 0 4 3]); In your call to set , combine the word Default with the name of the object Figure and the property name PaperPosition . I use the clipboard to export my figures as metafiles. Is there some way to force all of my copy operations to use the metafile format? Use the Copy Options panel of the Preferences dialog box. Any settings made here, including whether MATLAB copies your figure as a metafile or bitmap, apply to all copy operations. See “Exporting to the Windows Clipboard” on page 6-20 for instructions. Microsoft Word I exported my figure to an EPS file, and then tried to import it into my Word document. My printout has an empty frame with an error message saying that my EPS picture was not saved with a preview and will only print to a PostScript printer. How do I include a TIFF preview? Use the print command with the -tiff switch. For example: print -deps -tiff filename Note that if you print to a nonPostScript printer with Word, the preview image is used for printing. This is a low-resolution image that lacks the quality of an EPS graphic. For more information about preview images and other aspects of EPS files, see “EPS Files” on page 6-64. When I try to resize my figure in Word, its quality suffers. You must have used a bitmap format. Bitmap files generally do not resize well. If you are going to export using a bitmap format, try to set the figure’s size while it’s still in MATLAB. See “Setting the Figure Size and Position” on page 6-34 for instructions. 6 Printing and Exporting 6-84 As an alternative, you can use one of the vector formats, EMF or EPS. Figures exported in these formats can be resized in Word without affecting quality. I exported my figure as an EMF to the clipboard. When I paste it into Word, some of the labels are printed incorrectly. This problem occurs with some versions of Word and Windows. Try editing the labels in Word. File Format I tried to import my exported figure into a word processing document, but I got an error saying the file format is unrecognized. There are two likely causes: you used the print function and forgot to specify the export format, or your word processing program does not support the export format. Include a format switch when you use the print function; simply including the file extension is not sufficient. For instructions, see “Exporting to a File” on page 6-15. If this does not solve your problem, check what formats the word processor supports. I tried to append a figure to an EPS file, and received an error message. You cannot append figures to an EPS file. The -append option is only valid for PostScript files, which should not be confused with EPS files. PostScript is a printer driver; EPS is a graphics file format. Of the supported export formats, only HDF supports storing multiple figures, but you must use the imwrite function to append them. For an example, see the reference page for imwrite . Size of Exported File I’ve always used the EPS format to export my figures, but recently it started to generate huge files. Some of my files are now several megabytes! Your graphics have probably become complicated enough that MATLAB is using the OpenGL or Z-buffer renderer instead of the Painter’s renderer. It does this to improve display time or to handle attributes that Painter’s cannot, such as lighting. However, using OpenGL or Z-buffer causes a bitmap to be stored in your EPS file, which sometimes leads to a large file. Troubleshooting 6-85 There are two ways to fix the problem. You can specify the Painter’s renderer when you export to EPS, or you can use a bitmap format, such as TIFF. The best renderer and type of format to use depend upon the figure. See “Bitmap or Vector Graphics” on page 6-59 if you need help deciding. For information about the rendering methods and how to set them, see the section on “Selecting a Renderer” on page 6-41. Making Movies I am processing a large number of frames in MATLAB. I would like these frames to be saved as individual files for later conversion into a movie. How can I do this? Use getframe to capture the frames, imwrite to write them to a file, and movie and imwrite to capture and write the frames, see “Exporting with getframe” on page 6-17. For more information about creating a movie from the captured frames, see the reference page for movie . You can also save multiple figures to an AVI file. AVI files can be used for animated sequences that do not need MATLAB to run. However, they do require an AVI viewer. For more information, see “Creating an AVI Format Movie” in the “Development Environment” section of the Using MATLAB documentation. Extended Operations There are some Export operations that cannot be performed using the Export dialog box. You need to use the print function to do any of the following operations: •Export to a supported file format not listed in the Export dialog box. The formats not available from the Export dialog box include HDF, some variations of BMP and PCX, and the raw data versions of PBM, PGM, and PPM. •Specify a resolution. •Specify one of the following options: TIFF preview, loose bounding box for EPS files, compression quality for JPEG files, CMYK output on Windows. •Perform batch exporting. 6 Printing and Exporting 6-86 General Problems Background Color When I output my figure, its background is changed to white. How can I get it to have the displayed background color? By default, when you print or export a figure, MATLAB inverts the background color to white. There are two ways to retain the displayed background color: use the Page Setup dialog box or set the InvertHardCopy property to off . See “Setting the Background Color” on page 6-49 for instructions on either method. If you are exporting your figure to the clipboard, you can also use the Copy Options panel of the Preferences dialog box. Setting the background here sets it for all figures copied to the clipboard. Default Settings I need to produce diagrams for publications. There is a list of requirements that I must meet for size of the figure, fonts types, etc. How can I do this easily and consistently? You can set the default value for any property by adding a line to startup.m . As an example, the following line sets the default axes label font size to 12. set(0, 'DefaultAxesFontSize', 12); , combine the word Default with the name of the object Axes and the property name FontSize . Dimensions of Output The dimensions of my output are huge. How can I make it smaller? Check your settings for figure size and resolution, both of which affect the output dimensions of your figure. The default figure size is 8-by-6 inches. You can use the Page Setup dialog box or the PaperPosition property to set the figure size. See “Setting the Figure Size and Position” on page 6-34. Troubleshooting 6-87 The default resolution depends on the export format or printer driver used. For example, built-in MATLAB bitmap formats, like TIFF, have a default resolution of 150 dpi. You can change the resolution by using the print function and the -r switch. For default resolution values and instructions on how to change them, see “Setting the Resolution” on page 6-44. I selected “Match Screen Size” from the Page Setup menu, but my output looks a little bigger, and my font looks different. You probably output your figure using a higher resolution than your screen uses. Set your resolution to be the same as the screen’s. As an alternative, if you are exporting your figure, see if your application enables you to select a resolution. If so, import the figure at the same resolution it was exported with. For more information about resolution and how to set it when exporting, see “Setting the Resolution” on page 6-44. Axis and Tick Labels When I resize my figure below a certain size, my x-axis label and the bottom half of the x-axis tick labels are missing from the output. Your figure size may be too small to accommodate the labels. Labels are positioned a fixed distance from the x-axis. Since the x-axis itself is positioned a relative distance away from the window’s edge, the label text may not fit. Try using a larger figure size or smaller fonts. For instructions on setting the size of your figure, see “Setting the Figure Size and Position” on page 6-34. For information about setting font size, see the Text Properties reference page. In my output, the x-axis has fewer ticks than it did on the screen. MATLAB has rescaled your ticks because the size of your output figure is different from its displayed size. There are two ways to prevent this: select Keep screen limits and ticks from the Axes and Figure tab of the Page Setup dialog box, or set the XTickMode , YTickMode , and ZTickMode properties to manual . See “Setting the Axes Ticks and Limits” on page 6-47 for details. 6 Printing and Exporting 6-88 UI Controls My figure contains UI Controls. How do I prevent them from appearing in my output? Use the print function with the -noui switch. For details, see “Excluding User Interface Controls” on page 6-55. Cropping I can’t output my figure using the uncropped setting (i.e., a loose BoundingBox). Only PostScript printer drivers and the EPS export format support uncropped output. There is a workaround for Windows printer drivers, however. Using the print function, save your figure to a file that can be printed later. For an example see “Producing Uncropped Figures” on page 6-55. Text Object Font I have a problem with text objects when printing with a PostScript printer driver or exporting to EPS. The fonts are correct on the screen, but are changed in the output. You have probably used a font that is not supported by EPS and PostScript. All unsupported fonts are converted to Courier. See “PostScript and Ghostscript Supported Fonts” on page 6-71 for the list of the supported fonts. 7 Handle Graphics Objects Graphics Object Hierarchy (p.7-2) Illustration of the graphics object hierarchy. Types of Graphics Objects (p.7-3) Overview of the various graphics objects. Object Properties (p.7-8) What is a property and what do you do with it. Graphics Object Creation Functions (p.7-11) Functions that construct graphics objects. Setting and Querying Property Values (p.7-17) How to set and query property values and how to return to original (factory default) values. Setting Default Property Values (p.7-22) How MATLAB determines what values to use for a given object’s properties. How to define default values. Accessing Object Handles (p.7-29) Obtain the handles of existing objects. Controlling Graphics Output (p.7-36) Control target window for graphics output. Saving Handles in M-Files (p.7-47) How to manage object handles within a graphics M-file. Properties Changed by Built-In Functions (p.7-48) List of the properties that are changed by MATLAB built-in functions. Callback Properties for Graphics Objects (p.7-51) Execute functions when the events described in this section occur on graphics objects. Function Handle Callbacks (p.7-53) Function handles provide advantages for specifying callbacks. These advantages are illustrated through a GUI example. 7 Handle Graphics Objects 7-2 Graphics Object Hierarchy Handle Graphics objects are the basic drawing elements used by MATLAB to display data and to create graphical user interfaces (GUIs). Each instance of an object is associated with a unique identifier called a handle. Using this handle, you can manipulate the characteristics (called object properties) of an existing graphics object. You can also specify values for properties when you create a graphics object. These objects are organized into a tree-structured hierarchy. The hierarchical nature of Handle Graphics is based on the interdependencies of the various graphics objects. For example, to draw a line object, MATLAB needs an axes object to orient and provide a frame of reference to the line. The axes, in turn, needs a figure window to display the line. Uimenu Line Axes Uicontrol Image Figure Light Surface Patch Text Root Rectangle Types of Graphics Objects 7-3 Types of Graphics Objects Graphics objects are interdependent so the graphics display typically contains a variety of objects that, in conjunction, produce a meaningful graph or picture. The following picture of a figure window contains a number of graphics objects. Patch Figure Axes ( 2-D) −2 −1 0 1 2 −2 0 2 −0.5 0 0.5 Surface Axes ( 3-D) Image 100 200 300 50 100 150 200 250 300 350 0 1 2 3 4 5 6 7 −1 −0.5 0 0.5 1 t = 0 to 2pi sin(t) Value of the Sine from Zero to Two Pi <−sin(t) = .707 <−sin(t) = 0 sin(t) = −.707 −> −25 −20 −15 −10 −5 0 5 10 −5 0 5 10 Line Text 7 Handle Graphics Objects 7-4 Each type of graphics object has a corresponding creation function that you use to create an instance of that class of object. Object creation functions have the same names as the objects they create (e.g., the text function creates text objects, the figure function creates figure objects, and so on). Handle Graphics Objects The following list summarizes the Handle Graphics objects. The Root At the top of the hierarchy is the root object. It corresponds to the computer screen. There is only one root object and all other objects are its descendants. You do not create the root object; it exists when you start MATLAB . You can, however, set the values of root properties and thereby affect the graphics display. Figure Figure objects are the individual windows on the root screen where MATLAB displays graphics. MATLAB places no limits on the number of figure windows you can create (your computer may, however). All figures are children of the root and all other graphics objects are descendants of figures. All functions that draw graphics (e.g., plot and surf ) automatically create a figure if one does not exist. If there are multiple figures within the root, one figure is always designated as the “current” figure, and is the target for graphics output. Uicontrol Uicontrol objects are user interface controls that execute callback routines when users activate the object. There are a number of styles of controls such as pushbuttons, listboxes, and sliders. Each device is designed to accept a certain type of information from users. For example, listboxes are typically used to provide a list of filenames from which you select one or more items for action carried out by the control’s callback routine. You can use uicontrols in combinations to construct control panels and dialog boxes. Pop-up menus, editable text boxes, check boxes, pushbuttons, static text, and frames compose this particular example. Types of Graphics Objects 7-5 . Uicontrol objects are children of figures and are therefore independent of axes. Uimenu Uimenu objects are pull-down menus that execute callback routines when users select an individual menu item. MATLAB places uimenus on the figure window menu bar, to the right of existing menus defined by the system. This picture shows the top of an MS-Windows figure that has three top-level uimenus defined (titled Workspace, Figure, and Axes). Two levels of submenus are visible under Workspace top-level uimenu. Pushbuttons indicate an action. Static text labels other uicontrols. Frames provide logical groupings for other controls. Check boxes indicate the choice made by the user. Users type numerical values into these editable text boxes. predefined items. 7 Handle Graphics Objects 7-6 Uimenus are children of figures and are therefore independent of axes. Axes Axes objects define a region in a figure window and orient their children within this region. axes are children of figures and are parents of image, light, line, patch, surface, and text objects. All functions that draw graphics (e.g., plot , surf , mesh , and bar ) create an axes object if one does not exist. If there are multiple axes within the figure, one axes is always designated as the “current” axes, and is the target for display of the above mentioned graphics objects (uicontrols and uimenus are not children of axes). Image A MATLAB image consists of a data matrix and possibly a colormap. There are three basic image types that differ in the way that data matrix elements are interpreted as pixel colors — indexed, intensity, and truecolor. Since images are strictly 2-D, you can view them only at the default 2-D view. Light Light objects define light sources that affect all patch and surface objects within the axes. You cannot see lights, but you can set properties that control the style of light source, color, location, and other properties common to all graphics objects. Line Line objects are the basic graphics primitives used to create most 2-D and some 3-D plots. High-level functions plot , plot3 , and loglog (and others) create line objects. The coordinate system of the parent axes positions and orients the line. Types of Graphics Objects 7-7 Patch Patch objects are filled polygons with edges. A single patch can contain multiple faces, each colored independently with solid or interpolated colors. fill , fill3 , and contour3 create patch objects. The coordinate system of the parent axes positions and orients the patch. Rectangle Rectangle objects are 2-D filled areas having a shape that can range from a rectangle to an ellipse. Rectangles are useful for creating flow-chart type drawings. Surface Surface objects are 3-D representations of matrix data created by plotting the value of each matrix element as a height above the x-y plane. Surface plots are composed of quadrilaterals whose vertices are specified by the matrix data. MATLAB can draw surfaces with solid or interpolated colors or with only a mesh of lines connecting the points. The coordinate system of the parent axes positions and orients the surface. The high-level function pcolor and the surf and mesh group of functions create surface objects. Text Text objects are character strings. The coordinate system of the parent axes positions the text. The high-level functions title , xlabel , ylabel , zlabel , and gtext create text objects. 7 Handle Graphics Objects 7-8 Object Properties A graphics object’s properties control many aspects of its appearance and behavior. Properties include general information such as the object’s type, its parent and children, whether it is visible, as well as information unique to the particular class of object. For example, from any given figure object you can obtain the identity of the last key pressed in the window, the location of the pointer, or the handle of the most recently selected menu. MATLAB organizes graphics information into a hierarchy and stores this information in properties. For example, root properties contain the handle of the current figure and the current location of the pointer (cursor), figure properties maintain lists of their descendants and keep track of certain events that occur within the window, and axes properties contain information about how each of its child objects uses the figure colormap and the color order used by the plot function. Changing Values You can query the current value of any property and specify most property values (although some are set by MATLAB and are read only). Property values apply uniquely to a particular instance of an object; setting a value for one object does not change this value for other objects of the same type. Default Values You can set default values that affect all subsequently created objects. Whenever you do not define a value for a property, either as a default or when you create the object, MATLAB uses “factory-defined” values. The reference entry for each object creation function provides a complete list of the properties associated with that class of graphics object. Object Properties 7-9 Properties Common to All Objects Some properties are common to all graphics objects, as illustrated in the following table. Property Information Contained BusyAction Controls the way MATLAB handles callback routine interruption defined for the particular object ButtonDownFcn Callback routine that executes when button press occurs Children Handles of all this object’s children objects Clipping Mode that enables or disables clipping (meaningful only for axes children) CreateFcn Callback routine that executes when this type of object is created DeleteFcn Callback routine that executes when you issue a command that destroys the object HandleVisibility Allows you to control the availability of the object’s handle from the command line and from within callback routines Interruptible Determines whether a callback routine can be interrupted by a subsequently invoked callback routine Parent The object’s parent Selected Indicates whether object is selected SelectionHighlight Specifies whether object visually indicates the selection state Tag User-specified object label Type The type of object (figure, line, text, etc.) 7 Handle Graphics Objects 7-10 UserData Any data you want to associate with the object Visible Determines whether or not the object is visible Property Information Contained Graphics Object Creation Functions 7-11 Graphics Object Creation Functions Each graphics object (except the root object) has a corresponding creation function, named for the object it creates. This table lists the creation functions. Function Object Description axes Rectangular coordinate system that scales and orients axes children image, light, line, patch, surface, and text objects. figure Window for displaying graphics. image 2-D picture defined by either colormap indices or RGB values. The data can be 8-bit or double precision data. light Directional light source located within the axes and affecting patches and surfaces. line Line formed by connecting the coordinate data with straight line segments, in the sequence specified. patch Polygonal shell created by interpreting each column in the coordinate matrices as a separate polygon. rectangle 2-D filled area having a shape that can range from a rectangle to an ellipse. surface Surface created with rectangular faces defined by interpreting matrix elements as heights above a plane. text Character string located in the axes coordinate system. Context menu that you can associate with other graphics object. 7 Handle Graphics Objects 7-12 All object creation functions have a similar format. handle = function('propertyname',propertyvalue,...) You can specify a value for any object property (except those that are read only) by passing property name/property value pairs as arguments. The function returns the handle of the object it creates, which you can use to query and modify properties after creating the object. Example — Creating Graphics Objects This code evaluates a mathematical function and creates three graphics objects using the property values specified as arguments to the figure , axes , and surface commands. MATLAB uses default values for all other properties. [x,y] = meshgrid([2:.4:2]); Z = x.*exp(x.^2y.^2); fh = figure('Position',[350 275 400 300],'Color','w'); ah = axes('Color',[.8 .8 .8],'XTick',[2 1 0 1 2],... 'YTick',[2 1 0 1 2]); sh = surface('XData',x,'YData',y,'ZData',Z,... 'FaceColor',get(ah,'Color')+.1,... 'EdgeColor','k','Marker','o',... 'MarkerFaceColor',[.5 1 .85]); uicontrol Programmable user-interface device, such as pushbutton, slider, or listbox. Programmable menu appearing at the top of a figure window. Function Object Description Graphics Object Creation Functions 7-13 Note that the surface function does not use a 3-D view like the high-level surf functions. Object creation functions simply add new objects to the current axes without changing axes properties, except the Children property, which now includes the new object and the axis limits ( XLim , YLim , and ZLim ), if necessary. You can change the view using the camera commands or use the view command. view(3) −2 −1 0 1 2 −2 −1 0 1 2 7 Handle Graphics Objects 7-14 Parenting By default, all statements that create graphics objects do so in the current figure and the current axes (if the object is an axes child). However, you can specify the parent of an object when you create it. For example, the statement, axes('Parent',figure_handle,...) creates an axes in the figure identified by figure_handle . You can also move an object from one parent to another by redefining its Parent property. set(gca,'Parent',figure_handle) High-Level Versus Low-Level The MATLAB high-level graphics routines (e.g., plot or surf ) call the appropriate object creation function to draw graphics objects. However, high-level routines also clear the axes or create a new figure, depending on the settings of the axes and figure NextPlot properties. −2 −1 0 1 2 −2 −1 0 1 2 −0.5 0 0.5 Graphics Object Creation Functions 7-15 In contrast, object creation functions simply create their respective graphics objects and place them in the current parent object. They do not respect the setting of the figure or axes NextPlot property. For example, if you call the line function, line('XData',x,'YData',y,'ZData',z,'Color','r') MATLAB draws a red line in the current axes using the specified data values. If there is no axes, MATLAB creates one. If there is no figure window in which to create the axes, MATLAB creates it as well. If you call the line function a second time, MATLAB draws the second line in the current axes without erasing the first line. This behavior is different from high-level functions like plot that delete graphics objects and reset all axes properties (except Position and Units ). You can change the behavior of high-level functions using the hold command or changing the setting of the axes NextPlot property. See “Controlling Graphics Output” on page 7-36 for more information on this behavior and on using the NextPlot property. Simplified Calling Syntax Object creation functions have convenience forms that allow you to use a simpler syntax. For example, text(.5,.5,.5,'Hello') is equivalent to, text('Position',[.5 .5 .5],'String','Hello') Note that using the convenience form of an object creation function can cause subtle differences in behavior when compared to formal property name/property value syntax. By convention, MATLAB documentation capitalizes the first letter of each word that makes up a property name, such as LineStyle or XTickLabelMode . While this makes property names easier to read, MATLAB does not check for uppercase letters. In addition, you need use only enough letters to identify the name uniquely, so you can abbreviate most property names. 7 Handle Graphics Objects 7-16 In M-files, however, using the full property name can prevent problems with futures releases of MATLAB if a shortened name is no longer unique because of the addition of new properties. Setting and Querying Property Values 7-17 Setting and Querying Property Values The set and get functions specify and retrieve the value of existing graphics object properties. They also enable you to list possible values for properties that have a fixed set of values. (You can also use the Property Editor to set many property values. See “Using the Property Editor” on page 1-15 for more information.) The basic syntax for setting the value of a property on an existing object is set(object_handle,'PropertyName','NewPropertyValue') To query the current value of a specific object’s property, use a statement like returned_value = get(object_handle,'PropertyName'); Property names are always quoted strings. Property values depend on the particular property. See “Accessing Object Handles” on page 7-29 and the findobj command for information on finding the handles of existing object. Setting Property Values You can change the properties of an existing object using the set function and the handle returned by the creating function. For example, this statement moves the y-axis to the right side of the plot on the current axes. set(gca,'YAxisLocation','right') If the handle argument is a vector, MATLAB sets the specified value on all identified objects. You can specify property names and property values using structure arrays or cell arrays. This can be useful if you want to set the same properties on a number of objects. For example, you can define a structure to set axes properties appropriately to display a particular graph. view1.CameraViewAngleMode = 'manual'; view1.DataAspectRatio = [1 1 1]; view1.ProjectionType = 'Perspective'; To set these values on the current axes, type set(gca,view1) 7 Handle Graphics Objects 7-18 Listing Possible Values You can use set to display the possible values for many properties without actually assigning a new value. For example, this statement obtains the values you can specify for line object markers. set(obj_handle,'Marker') MATLAB returns a list of values for the Marker property for the type of object specified by obj_handle . Braces indicate the default value. [ + | o | * | . | x | square | diamond | v | ^ | > | < | pentagram | hexagram | {none} ] To see a list of all settable properties along with possible values of properties that accept string values, use set with just an object handle. set(object_handle) For example, for a surface object, MATLAB returns CData CDataScaling: [ {on} | off] EdgeColor: [ none | {flat} | interp ] ColorSpec. EraseMode: [ {normal} | background | xor | none ] FaceColor: [ none | {flat} | interp | texturemap ] ColorSpec. LineStyle: [ {} | | : | . | none ] . . . Visible: [ {on} | off ] If you assign the output of the set function to a variable, MATLAB returns the output as a structure array. For example, a = set(gca); The field names in a are the object’s property names and the field values are the possible values for the associated property. For example, a.GridLineStyle ans = '-' '--' Setting and Querying Property Values 7-19 ':' '-.' 'none' returns the possible value for the axes grid line styles. Note that while property names are not case sensitive, MATLAB structure field names are. For example, a.gridlinestyle ??? Reference to non-existent field 'gridlinestyle'. returns an error. Querying Property Values Use get to query the current value of a property or of all the object’s properties. For example, check the value of the current axes PlotBoxAspectRatio property. get(gca,'PlotBoxAspectRatio') ans = 1 1 1 MATLAB lists the values of all properties, where practical. However, for properties containing data, MATLAB lists the dimensions only (for example, CurrentPoint and ColorOrder) . AmbientLightColor = [1 1 1] Box = off CameraPosition = [0.5 0.5 2.23205] CameraPositionMode = auto CameraTarget = [0.5 0.5 0.5] CameraTargetMode = auto CameraUpVector = [0 1 0] CameraUpVectorMode = auto CameraViewAngle = [32.2042] CameraViewAngleMode = auto CLim: [0 1] CLimMode: auto Color: [0 0 0] CurrentPoint: [ 2x3 double] ColorOrder: [ 7x3 double] 7 Handle Graphics Objects 7-20 . . . Visible = on Querying Individual Properties You can obtain the data from the property by getting that property individually. get(gca,'ColorOrder') ans = 0 0 1.0000 0 0.5000 0 1.0000 0 0 0 0.7500 0.7500 0.7500 0 0.7500 0.7500 0.7500 0 0.2500 0.2500 0.2500 Returning a Structure If you assign the output of get to a variable, MATLAB creates a structure array whose field names are the object property names and whose field values are the current values of the named property. For example, if you plot some data, x and y , h = plot(x,y); and get the properties of the line object created by plot , a = get(h); you can access the values of the line properties using the field name. This call to the text command places the string 'x and y data' at the first data point and colors the text to match the line color. text(x(1),y(1),'x and y data','Color',a.Color) If x and y are matrices, plot draws one line per column. To label the plot of the second column of data, reference that line. text(x(1,2),y(1,2),'Second set of data','Color',a(2).Color) Setting and Querying Property Values 7-21 Querying Groups of Properties You can define a cell array of property names and conveniently use it to obtain the values for those properties. For example, suppose you want to query the values of the axes “camera mode” properties. First define the cell array. camera_props(1) = {'CameraPositionMode'}; camera_props(2) = {'CameraTargetMode'}; camera_props(3) = {'CameraUpVectorMode'}; camera_props(4) = {'CameraViewAngleMode'}; Use this cell array as an argument to obtain the current values of these properties. get(gca,camera_props) ans = 'auto' 'auto' 'auto' 'auto' Factory-Defined Property Values MATLAB defines values for all properties, which are used if you do not specify values as arguments or as defaults. You can obtain a list of all factory-defined values with the statement. a = get(0,'Factory'); get returns a structure array whose field names are the object type and property name concatenated together, and field values are the factory value for the indicated object and property. For example, this field, indicates that the factory value for the SelectionHighlight property on uimenu objects is on . You can get the factory value of an individual property with, get(0,'FactoryObjectTypePropertyName') For example, get(0,'FactoryTextFontName') 7 Handle Graphics Objects 7-22 Setting Default Property Values All object properties have “default” values built into MATLAB (i.e., factory-defined values). You can also define your own default values at any point in the object hierarchy. How MATLAB Searches for Default Values MATLAB searches for a default value beginning with the current object and continuing through the object’s ancestors until it finds a user-defined default value or until it reaches the factory-defined value. Therefore, a search for property values is always satisfied. The closer to the root of the hierarchy you define the default, the broader its scope. If you specify a default value for line objects on the root level, MATLAB uses that value for all lines (since the root is at the top of the hierarchy). If you specify a default value for line objects on the axes level, then MATLAB uses that value for line objects drawn only in that axes. If you define default values on more than one level, the value defined on the closest ancestor takes precedence since MATLAB terminates the search as soon as it finds a value. Note that setting default values affects only those objects created after you set the default. Existing graphics objects are not affected. This diagram shows the steps MATLAB follows in determining the value of a graphics object property. Setting Default Property Values 7-23 YES Use property value specified as argument Use Axes-level default value Use Figure-level default value Use Root-level default value Use factory- defined default property value NO YES YES NO NO NO YES Is property value defined as argument? Is default defined on Axes level? Is default defined on Figure level? Is default defined on Root level? For all properties 7 Handle Graphics Objects 7-24 Defining Default Values To specify default values, create a string beginning with the word Default followed by the object type and finally the object property. For example, to specify a default value of 1.5 points for the line LineWidth property at the level of the current figure, use the statement, set(gcf,'DefaultLineLineWidth',1.5) The string, DefaultLineLineWidth identifies the property as a line property. To specify the figure color, use DefaultFigureColor . Note that it is meaningful to specify a default figure color only on the root level. set(0,'DefaultFigureColor','b') Use get to determine what default values are currently set on any given object level; for example, get(gcf,'default') returns all default values set on the current figure. Setting Properties to the Default Specifying a property value of 'default' sets the property to the first encountered default value defined for that property. For example, these statements result in a green surface EdgeColor , set(0,'DefaultSurfaceEdgeColor','k') h = surface(peaks); set(gcf,'DefaultSurfaceEdgeColor','g') set(h,'EdgeColor','default') Since a default value for surface EdgeColor exists on the figure level, MATLAB encounters this value first and uses it instead of the default EdgeColor defined on the root. Removing Default Values Specifying a property value of 'remove' gets rid of user-defined default values. The statement, set(0,'DefaultSurfaceEdgeColor','remove') removes the definition of the default Surface EdgeColor from the root. Setting Default Property Values 7-25 Setting Properties to Factory-Defined Values Specifying a property value of 'factory' sets the property to its factory-defined value. (The property descriptions provides access to the factory settings for properties having predefined sets of values.) For example, these statements set the EdgeColor of surface h to black (its factory setting) regardless of what default values you have defined. set(gcf,'DefaultSurfaceEdgeColor','g') h = surface(peaks); set(h,'EdgeColor','factory') Reserved Words Setting a property value to default , remove , or factory produces the effect described in the previous sections. To set a property to one of these words (e.g., a text or uicontrol String property set to the word Default ), you must precede the word with the backslash character. For example, h = uicontrol('Style','edit','String','\Default'); Examples — Setting Default LineStyles The plot function cycles through the colors defined by the axes ColorOrder property when displaying multiline plots. If you define more than one value for the axes LineStyleOrder property, MATLAB increments the linestyle after each cycle through the colors. You can set default property values that cause the plot function to produce graphs using varying linestyles, but not varying colors. This is useful when working on a monochrome display or printing on a black and white printer. First Example This example creates a figure with a white plot (axes) background color, then sets default values for axes objects on the root level. whitebg('w') %create a figure with a white color scheme set(0,'DefaultAxesColorOrder',[0 0 0],... 'DefaultAxesLineStyleOrder','||:|.') Whenever you call plot , Z = peaks; plot(1:49,Z(4:7,:)) 7 Handle Graphics Objects 7-26 it uses one color for all data plotted because the axes ColorOrder contains only one color, but cycles through the linestyles defined for LineStyleOrder . Second Example This example sets default values on more than one level in the hierarchy. These statements create two axes in one figure window, setting default values on the figure level and the axes level. t = 0:pi/20:2*pi; s = sin(t); c = cos(t); % Set default value for axes Color property figh = figure('Position',[30 100 800 350],... 'DefaultAxesColor',[.8 .8 .8]); axh1 = subplot(1,2,1); grid on % Set default value for line LineStyle property in first axes set(axh1,'DefaultLineLineStyle','.') line('XData',t,'YData',s) line('XData',t,'YData',c) text('Position',[3 .4],'String','Sine') text('Position',[2 .3],'String','Cosine',... 0 10 20 30 40 50 −3.5 −3 −2.5 −2 −1.5 −1 −0.5 0 0.5 Setting Default Property Values 7-27 'HorizontalAlignment','right') axh2 = subplot(1,2,2); grid on % Set default value for text Rotation property in second axes set(axh2,'DefaultTextRotation',90) line('XData',t,'YData',s) line('XData',t,'YData',c) text('Position',[3 .4],'String','Sine') text('Position',[2 .3],'String','Cosine',... 'HorizontalAlignment','right') Issuing the same line and text statements to each subplot region results in a different display, reflecting different default settings. Since the default axes Color property is set on the figure level of the hierarchy, MATLAB creates both axes with the specified gray background color. The axes on the left (subplot region 121) defines a dash–dot line style ( . ) as the default, so each call to the line function uses dash–dot lines. The axes on the right does not define a default linestyle so MATLAB uses solid lines (the factory setting for lines). The axes on the right defines a default text Rotation of 90 degrees, which rotates all text by this amount. MATLAB obtains all other property values from their factory settings, which results in nonrotated text on the left. 0 2 4 6 8 −1 −0.5 0 0.5 1 Sine Cosine 0 2 4 6 8 −1 −0.5 0 0.5 1 Sine Cosine 7 Handle Graphics Objects 7-28 To install default values whenever you run MATLAB, specify them in your startup.m file. Note that MATLAB may install default values for some appearance properties when started by calling the colordef command. Accessing Object Handles 7-29 Accessing Object Handles MATLAB assigns a handle to every graphics object it creates. All object creation functions optionally return the handle of the created object. If you want to access the object’s properties (e.g., from an M-file) you should assign its handle to a variable at creation time to avoid searching for it later. However, you can always obtain the handle of an existing object with the findobj function or by listing its parent’s Children property. The “Protecting Figures and Axes” section in this chapter provides for more information on how object handles are hidden from normal access. The root object’s handle is always zero. The handle of a figure is either: •An integer that, by default, displays in the window title bar •A floating point number requiring full MATLAB internal precision The figure IntegerHandle property controls which type of handle the figure receives. All other graphics object handles are floating-point numbers . You must maintain the full precision of these numbers when you reference handles. Rather than attempting to read handles off the screen and retype them, it is necessary to store the value in a variable and pass that variable whenever a handle is required. The Current Figure, Axes, and Object An important concept in Handle Graphics is that of being current. The current figure is the window designated to receive graphics output. Likewise, the current axes is the target for commands that create axes children. The current object is the last graphics object created or clicked on by the mouse. MATLAB stores the three handles corresponding to these objects in the ancestor’s property list. 7 Handle Graphics Objects 7-30 These properties enable you to obtain the handles of these key objects. get(0,'CurrentFigure'); get(gcf,'CurrentAxes'); get(gcf,'CurrentObject'); The following commands are shorthand notation for the get statements. • gcf — returns the value of the root CurrentFigure property • gca — returns the value of the current figure’s CurrentAxes property • gco — returns the value of the current figure’s CurrentObject property You can use these commands as input arguments to functions that require object handles. For example, you can click on a line object and then use gco to specify the handle to the set command, set(gco,'Marker','square') or list the values of all current axes properties with get(gca) You can get the handles of all the graphic objects in the current axes (except those with hidden handles), h = get(gca,'Children'); and then determine the types of the objects. get(h,'type') ans = 'text' 'patch' 'surface' 'line' Root CurrentFigure Current Figure CurrentObject CurrentAxes Current Axes Current Object Accessing Object Handles 7-31 While gcf and gca provide a simple means of obtaining the current figure and axes handles, they are less useful in M-files. This is particularly true if your M-file is part of an application layered on MATLAB where you do not necessarily have knowledge of user actions that can change these values. See “Controlling Graphics Output” on page 7-36 for information on how to prevent users from accessing the handles of graphics objects that you want to protect. Searching for Objects by Property Values — findobj The findobj function provides a means to traverse the object hierarchy quickly and obtain the handles of objects having specific property values. If you do not specify a starting object, findobj searches from the root object, finding all occurrences of the property name/property value combination you specify. Example — Finding Objects This plot of the sine function contains text objects labeling particular values of function. Suppose you want to move the text string labeling the value sin(t) = .707 from its current location at [pi/4,sin(pi/4)] to the point [3*pi/4,sin(3*pi/4)] 0 1 2 3 4 5 6 7 −1 −0.5 0 0.5 1 t = 0 to 2pi sin(t) Value of the Sine from Zero to Two Pi sin(t) = .707 sin(t) = 0 sin(t) = −.707 sin(t) = .707 7 Handle Graphics Objects 7-32 where the function has the same value (shown grayed out in the picture). To do this, you need to determine the handle of the text object labeling that point and change its Position property. To use findobj , pick a property value that uniquely identifies the object. In this case, the text String property. text_handle = findobj('String','\leftarrowsin(t) = .707'); Next move the object to the new position, defining the text Position in axes units. set(text_handle,'Position',[3*pi/4,sin(3*pi/4),0]) findobj also lets you restrict the search by specifying a starting point in the hierarchy, instead of beginning with the root object. This results in faster searches if there are many objects in the hierarchy. In the previous example, you know the text object of interest is in the current axes so you can type text_handle = findobj(gca,'String','\leftarrowsin(t) = .707'); Copying Objects You can copy objects from one parent to another using the copyobj function. The new object differs from the original object only in the value of its Parent property and its handle; it is otherwise a clone of the original. You can copy a number of objects to a new parent, or one object to a number of new parents as long as the result maintains the correct parent/child relationship. When you copy an object having children objects, MATLAB copies all children as well. Example — Copying Objects Suppose you are plotting a variety of data and want to label the point having the x- and y-coordinates determined by in each plot. The text function allows you to specify the location of the label in the coordinates defined by the x- and y-axis limits, simplifying the process of locating the text. text('String','\{5\pi\div4, sin(5\pi\div4)\}\rightarrow',... 'Position',[5*pi/4,sin(5*pi/4),0],... 'HorizontalAlignment','right') In this statement, the text function: 5 4 5 4 sin Accessing Object Handles 7-33 •Labels the data point with the string using TeX commands to draw a right-facing arrow and mathematical symbols. •Specifies the Position in terms of the data being plotted. •Places the data point to the right of the text string by changing the HorizontalAlignment to right (the default is left ). To label the same point with the same string in another plot, copy the text using copyobj . Since the last statement did not save the handle to the text object, you can find it using findobj and the 'String' property. text_handle = findobj('String',... '\{5\pi\div4,sin(5\pi\div4)\}\rightarrow'); After creating the next plot, add the label by copying it from the first plot. copyobj(text_handle,gca). 5 4 5 4 sin 0 1 2 3 4 5 6 7 8 −1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1 {54, sin(54)} 7 Handle Graphics Objects 7-34 This particular example takes advantage of the fact that text objects define their location in the axes’ data space. Therefore the text Position property did not need to change from one plot to another. Deleting Objects You can remove a graphics object with the delete command, using the object’s handle as an argument. For example, you can delete the current axes (and all of its descendants) with the statement delete(gca) You can use findobj to get the handle of a particular object you want to delete. For example, to find the handle of the dotted line in this multiline plot, 0 1 2 3 4 5 6 7 8 −1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1 {54, sin(54)} Accessing Object Handles 7-35 use findobj to locate the object whose LineStyle property is ':' line_handle = findobj('LineStyle',':'); then use this handle with the delete command. delete(line_handle) You can combine these two statements, substituting the findobj statement for the handle. delete(findobj('LineStyle',':')) 0 1 2 3 4 5 6 7 −1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1 7 Handle Graphics Objects 7-36 Controlling Graphics Output MATLAB allows many figure windows to be open simultaneously during a session. A MATLAB application may create figures to display graphical user interfaces as well as plotted data. It is necessary then to protect some figures from becoming the target for graphics display and to prepare (e.g., reset properties and clear existing objects from) others before receiving new graphics. This section discusses how to control where and how MATLAB displays graphics output. Topics include: •Specifying the target for graphics output •Preparing the figure and axes to accept new objects •Protecting figures and axes from becoming targets •Accessing the handles of protected figure and axes Specifying the Target for Graphics Output By default, MATLAB functions that create graphics objects display them in the current figure and current axes (if an axes child). You can direct the output to another parent by explicitly specifying the Parent property with the creating function. For example, plot(1:10,'Parent',axes_handle) where axes_handle is the handle of the target axes. The uicontrol functions have a convenient syntax that enables you to specify the parent as the first argument, uicontrol(Figure_handle,...) or you can set the Parent property. Preparing Figures and Axes for Graphics By default, commands that generate graphics output display the graphics objects in the current figure without clearing or resetting figure properties. However, if the graphics objects are axes children, MATLAB clears the axes and resets most axes properties to their default values before displaying the objects. Controlling Graphics Output 7-37 You can change this behavior by setting the figure and axes NextPlot properties. Using NextPlot to Control Output Target MATLAB high-level graphics functions check the value of the NextPlot properties to determine whether to add, clear, or clear and reset the figure and axes before drawing. Low-level object creation functions do not check the NextPlot properties. They simply add the new graphics objects to the current figure and axes. Low-level functions are designed primarily for use in M-files where you can implement whatever drawing behavior you want. However, when you develop a MATLAB-based application, controlling MATLAB drawing behavior is essential to creating a program that behaves predictably. This table summarizes the possible values for the NextPlot property. Note that a reset returns all properties, except Position and Units , to their default values. The hold properties. The statement hold on sets both figure and axes NextPlot . NextPlot Figure Axes Add new graphics objects without clearing or resetting the current figure. (Default setting) Add new graphics objects without clearing or resetting the current axes. replacechildren Remove all child objects, but do not reset figure properties. Equivalent to clf . Remove all child objects, but do not reset axes properties. Equivalent to cla . replace Remove all child objects and reset figure properties to their defaults. Equivalent to clf reset . Remove all child objects and reset axes properties to their defaults. Equivalent to cla reset . (Default setting) 7 Handle Graphics Objects 7-38 The statement hold off sets the axes NextPlot property to replace . Targeting Graphics Output with newplot MATLAB provides the newplot function to simplify the process of writing graphics M-files that conform to the settings of the NextPlot properties. newplot checks the values of the NextPlot properties and takes the appropriate action based on these values. You should place newplot at the beginning of any M-file that calls object creation functions. When your M-file calls newplot , the following possible actions occur: 1 newplot checks the current figure’s NextPlot property: - If there are no figures in existence, newplot creates one and makes it the current figure. - If the value of NextPlot , newplot makes the figure the current figure. - If the value of NextPlot is replacechildren , newplot deletes the figure’s children (axes objects and their descendents) and makes this figure the current figure. - If the value of NextPlot is replace , newplot deletes the figure’s children, resets the figure’s properties to the defaults, and makes this figure the current figure. 2 newplot checks the current axes’ NextPlot property: - If there are no axes in existence, newplot creates one and makes it the current axes. - If the value of NextPlot , newplot makes the axes the current axes. - If the value of NextPlot is replacechildren , newplot deletes the axes’ children and makes this axes the current axes. - If the value of NextPlot is replace , newplot deletes the axes’ children, resets the axes’ properties to the defaults, and makes this axes the current axes. Controlling Graphics Output 7-39 MATLAB Default Behavior Consider the default situation where the figure NextPlot and the axes NextPlot property is replace . When you call newplot , it: 1 Checks the value of the current figure’s NextPlot ) and determines MATLAB can draw into the current figure with no further action (if there is no current figure, newplot creates one, but does not recheck its NextPlot property). 2 Checks the value of the current axes’ NextPlot property (which is replace ), deletes all graphics objects from the axes, reset all axes properties (except Position and Units ) to their defaults, and returns the handle of the current axes. Example — Using newplot To illustrate the use of newplot , this example creates a function that is similar to the built-in plot function, except it automatically cycles through different line styles instead of using different colors for multiline plots. function my_plot(x,y) cax = newplot; % newplot returns handle of current axes LSO = ['- ';'--';': ';'-.']; set(cax,'FontName','Times','FontAngle','italic') set(get(cax,'Parent'),'MenuBar','none') % line_handles = line(x,y,'Color','b'); style = 1; for i = 1:length(line_handles) if style > length(LSO), style = 1;end set(line_handles(i),'LineStyle',LSO(style,:)) style = style + 1; end grid on The function my_plot uses the high-level line function syntax to plot the data. This provides the same flexibility in input argument dimension that the built-in plot function supports. The line function does not check the value of the figure or axes NextPlot property. However, because my_plot calls newplot , it behaves the same way the high-level plot function does – with default values in place, my_plot clears and resets the axes each time you call it. 7 Handle Graphics Objects 7-40 my_plot uses the handle returned by newplot to access the target figure and axes. This example sets axes font properties and disables the figure’s menu bar. Note how the figure handle is obtained via the axes Parent property. This picture shows typical output for the my_plot function. my_plot(1:10,peaks(10)) Basic Plotting M-file Structure This example illustrates the basic structure of graphics M-files: •Call newplot early to conform to the NextPlot properties and to obtain the handle of the target axes. •Reference the axes handle returned by newplot to set any axes properties or to obtain the figure’s handle. •Call object creation functions to draw graphics objects with the desired characteristics. 1 2 3 4 5 6 7 8 9 10 −8 −6 −4 −2 0 2 4 6 8 Controlling Graphics Output 7-41 The MATLAB default settings for the NextPlot properties facilitate writing M-files that adhere to the standard behavior: reuse the figure window, but clear and reset the axes with each new graph. Other values for these properties allow you to implement different behaviors. Replacing Only the Children Objects — replacechildren The replacechildren value for NextPlot causes newplot to remove child objects from the figure or axes, but does not reset any property values (except the list of handles contained in the Children property). This can be useful after setting properties you want to use for subsequent graphs without having to reset properties. For example, if you type on the command line set(gca,'ColorOrder',[0 0 1],'LineStyleOrder','-|--|:|-.',... 'NextPlot','replacechildren') plot(x,y) plot produces the same output as the M-file my_plot in the previous section, but only within the current axes. Calling plot still erases the existing graph (i.e., deletes the axes children), but it does not reset axes properties. The values specified for the ColorOrder and LineStyleOrder properties remain in effect. Testing for Hold State There are situations in which your M-file should change the visual appearance of the axes to accommodate new graphics objects. For example, if you want the M-file my_plot from the previous example to accept 3-D data, it makes sense to set the view to 3-D when the input data has z-coordinates. However, to be consistent with the behavior of the MATLAB high-level routines, it is a good practice to test if hold is on before changing parent axes or figure properties. When hold is on , the axes and figure NextPlot properties are both set to add . The M-file, my_plot3 , accepts 3-D data and also checks the hold state, using ishold , to determine if it should change the view. function my_plot3(x,y,z) cax = newplot; hold_state = ishold; % ishold tests the current hold state LSO = ['- ';'--';': ';'-.']; 7 Handle Graphics Objects 7-42 if nargin == 2 hlines = line(x,y,'Color','k'); if ~hold_state % Change view only if hold is off view(2) end elseif nargin == 3 hlines = line(x,y,z,'Color','k'); if ~hold_state % Change view only if hold is off view(3) end end ls = 1; for hindex = 1:length(hlines) if ls > length(LSO),ls = 1;end set(hlines(hindex),'LineStyle',LSO(ls,:)) ls = ls + 1; end If hold is on when you call my_plot3 , it does not change the view. If hold is off , my_plot3 sets the view to 2-D or 3-D, depending on whether there are two or three input arguments. Protecting Figures and Axes There are situations in which it is important to prevent particular figures or axes from becoming the target for graphics output (i.e., preventing them from becoming the gcf or gca ). An example is a figure containing the uicontrols that implement a user interface. You can prevent MATLAB from drawing into a particular figure or axes by removing its handle from the list of handles that are visible to the newplot function, as well as any other functions that either return or implicitly reference handles (i.e., gca , gcf , gco , cla , clf , close , and findobj ). Two properties control handle hiding: HandleVisibility and ShowHiddenHandles . HandleVisibility Property HandleVisibility is a property of all objects. It controls the scope of handle visibility within three different ranges. Property values can be: • on — The object’s handle is available to any function executed on the MATLAB command line or from an M-file. This is the default setting. Controlling Graphics Output 7-43 • callback — The object’s handle is hidden from all functions executing on the command line, even if it is on the top of the screen stacking order. However, during callback routine execution (MATLAB statements or functions that execute in response to user action), the handle is visible to all functions, such as gca , gcf , gco , findobj , and newplot . This setting enables callback routines to take advantage of the MATLAB handle access functions, while ensuring that users typing at the command line do not inadvertently disturb a protected object. • off — The object’s handle is hidden from all functions executing on the command line and in callback routines. This setting is useful when you want to protect objects from possibly damaging user commands. For example, if a GUI accepts user input in the form of text strings, which are then evaluated (using the eval function) from within the callback routine, a string such as 'close all' could destroy the GUI. To protect against this situation, you can temporarily set HandleVisibility to off on key objects. user_input = get(editbox_handle,'String'); set(gui_handles,'HandleVisibility','off') eval(user_input) set(gui_handles,'HandleVisibility','commandline') Values Returned by gca and gcf. When a protected figure is topmost on the screen, but has nonprotected figures stacked beneath it, gcf returns the topmost unprotected figure in the stack. The same is true for gca . If no unprotected figures or axes exist, calling gcf or gca causes MATLAB to create one in order to return its handle. Accessing Protected Objects The root ShowHiddenHandles property enables and disables handle visibility control. By default, ShowHiddenHandles is off , which means MATLAB obeys the setting of the HandleVisibility property. When set to on , all handles are visible from the command line and within callback routines. This can be useful when you want access to all graphics objects that exist at a given time, including the handles of axes text labels, which are normally hidden. The close option. For example, close('hidden') 7 Handle Graphics Objects 7-44 closes the topmost figure on the screen, even if it is protected. Combining all and hidden options, close('all','hidden') closes all figures. The Close Request Function MATLAB executes a callback routine defined by the figure’s CloseRequestFcn whenever you: •Issue a close command on a figure. •Quit MATLAB while there are visible figures. (If a figure's Visible property is set to off , MATLAB does not execute its close request function when you quit MATLAB; the figure is just deleted). •Close a figure from the windowing system using a close box or a close menu item. The close request function enables you to prevent or delay the closing of a figure or the termination of a MATLAB session. This is useful to perform such actions as: •Displaying a dialog box requiring the user to confirm the action. •Saving data before closing. •Preventing unintentional command-line deletion of a graphical user interface built with MATLAB. The default callback routine for the CloseRequestFcn is an M-file called closereq . It contains the statements shh=get(0,'ShowHiddenHandles'); set(0,'ShowHiddenHandles','on'); delete(get(0,'CurrentFigure')); set(0,'ShowHiddenHandles',shh); This callback disables HandleVisibility control by setting the root ShowHiddenHandles property to on , which makes all figure handles visible. Controlling Graphics Output 7-45 Quitting MATLAB When you quit MATLAB, the current figure’s CloseRequestFcn is called, and if the figure is deleted, the next figure in the root's list of children (i.e., the root's Children property) becomes the current figure, and its CloseRequestFcn is in turn executed, and so on. You can, therefore, use gcf to specify the figure handle from within the close request function. If you change a figure's CloseRequestFcn so that it does not delete the figure (e.g., defining this property as an empty string), then issuing the close command on that figure does not cause it to be deleted. Furthermore, if you attempt to quit MATLAB, the quit is aborted because MATLAB does not delete the figure. Errors in the Close Request Function If the CloseRequestFcn generates an error when executed, MATLAB aborts the close operation. However, errors in the CloseRequestFcn do not abort attempts to quit MATLAB. If an error occurs in a figure's CloseRequestFcn , MATLAB closes the figure unconditionally following a quit or exit command. Overriding the Close Request Function The delete command always deletes the specified figure, regardless of the value of its CloseRequestFcn . For example, the statement, delete(get(0,'Children')) deletes all figures whose handles are not hidden (i.e., the HandleVisibility property is set to off ). If you want to delete all figures regardless of whether their handles are hidden, you can set the root ShowHiddenHandles property to on . The root Children property then contains the handles of all figures. For example, the statements, set(0,'ShowHiddenHandles','yes') delete(get(0,'Children')) unconditionally delete all figures. Handle Validity Versus Handle Visibility All handles remain valid regardless of whether they are visible or not. If you know an object’s handle, you can set and get its properties. By default, figure handles are integers that are displayed at the top of the window. 7 Handle Graphics Objects 7-46 You can provide further protection to figures by setting the IntegerHandle property to off . MATLAB then uses a floating-point number for figure handles. Saving Handles in M-Files 7-47 Saving Handles in M-Files Graphics M-files frequently use handles to access property values and to direct graphics output to a particular target. MATLAB provides utility routines that return the handles to key objects (such as the current figure and axes). In M-files, however, these utilities may not be the best way to obtain handles because: •Querying MATLAB for the handle of an object or other information is less efficient than storing the handle in a variable and referencing that variable. •The current figure, axes, or object may change during M-file execution because of user interaction. Save Information First It is a good practice to save relevant information about the MATLAB state in the beginning of your M-file. For example, you can begin an M-file with cax = newplot; cfig = get(cax,'Parent'); hold_state = ishold; rather than querying this information each time you need it. Remember that utility commands like ishold obtain the values they return whenever called. (The ishold command issues a number of get commands and string compares ( strcmp ) to determine the hold state.) If you are temporarily going to alter the hold state within the M-file, you should save the current values of the NextPlot properties so you can reset them later. ax_nextplot = lower(get(cax,'NextPlot')); fig_nextplot = lower(get(cfig,'NextPlot')); . . . set(cax,'NextPlot',ax_nextplot) set(cfig,'NextPlot',fig_nextplot) 7 Handle Graphics Objects 7-48 Properties Changed by Built-In Functions To achieve their intended effect, many built-in functions change axes properties, which can then affect the workings of your M-file. This table lists the MATLAB built-in graphics functions and the properties they change. Note that these properties change only if hold is off . Function Axes Property: Set To fill Box: on CameraPosition : 2-D view CameraTarget : 2-D view CameraUpVector : 2-D view CameraViewAngle : 2-D view fill3 CameraPosition : 3-D view CameraTarget : 3-D view CameraUpVector : 3-D view CameraViewAngle : 3-D view XScale : linear YScale : linear ZScale : linear Properties Changed by Built-In Functions 7-49 image (high-level) Box: on Layer: top CameraPosition : 2-D view CameraTarget : 2-D view CameraUpVector : 2-D view CameraViewAngle : 2-D view XDir: normal XLim: [0 size(CData,1)]+0.5 XLimMode: manual YDir: reverse YLim: [0 size(CData,2)]+0.5 YLimMode: manual loglog Box: on CameraPosition : 2-D view CameraTarget : 2-D view CameraUpVector : 2-D view CameraViewAngle : 2-D view XScale: log YScale: log plot Box: on CameraPosition : 2-D view CameraTarget : 2-D view CameraUpVector : 2-D view CameraViewAngle : 2-D view Function Axes Property: Set To 7 Handle Graphics Objects 7-50 plot3 CameraPosition : 3-D view CameraTarget : 3-D view CameraUpVector : 3-D view CameraViewAngle : 3-D view XScale: linear YScale: linear ZScale: linear semilogx Box: on CameraPosition : 2-D view CameraTarget : 2-D view CameraUpVector : 2-D view CameraViewAngle : 2-D view XScale: log YScale: linear semilogy Box: on CameraPosition : 2-D view CameraTarget : 2-D view CameraUpVector : 2-D view CameraViewAngle : 2-D view XScale: linear YScale: log Function Axes Property: Set To Callback Properties for Graphics Objects 7-51 Callback Properties for Graphics Objects A callback is a function that executes when a specific event occurs on a graphics object. You specify a callback by setting the appropriate property of the object. This section describes the events (specified via properties) for which you can define callbacks. See “Function Handle Callbacks” on page 7-53 for information on how to define callbacks. Graphics Object Callbacks All graphics objects have three properties for which you can define callback routines: • ButtonDownFcn — Executes when users click the left mouse button while the cursor is over the object or within a 5-pixel border around the object. • CreateFcn — Executes during object creation after all properties are set. • DeleteFcn — Executes just before deleting the object. property through which you define the function to execute when users activate these devices (e.g., click on a push button or select a menu). Figures Callbacks Figures have additional properties that execute callback routines with the appropriate user action. Only the CloseRequestFcn has a callback defined by default: • CloseRequestFcn — Executes when a request is made to close the figure (by a close command, by the window manager menu or by quitting MATLAB) • KeyPressFcn — Executes when users press a key while the cursor is within the figure window • ResizeFcn — Executes when users resize the figure window • WindowButtonDownFcn — Executes when users click a mouse button while the cursor is over the figure background, a disabled uicontrol, or the axes background 7 Handle Graphics Objects 7-52 • WindowButtonMotionFcn — Executes when users move the mouse button within the figure window (but not over menus or title bar). • WindowButtonUpFcn — Executes when users release the mouse button, after having pressed the mouse button within the figure. Function Handle Callbacks 7-53 Function Handle Callbacks Handle Graphics objects have a number of properties for which you can define callback functions. When a specific event occurs (e.g., a user clicks on a push button or deletes a figure), the corresponding callback function executes. You can specify the value of a callback property as a •String that is a MATLAB command or the name of an M-file •Cell array of strings •Function handle or a cell array containing a function handle and additional arguments This section illustrates how to define function handle callbacks for Handle Graphics objects. For information on function handles and how to use them, see the function handle reference page. Function Handle Syntax In Handle Graphics, functions that you want to use as function handle callbacks must define at least two input arguments in the function definition: •The handle of the object generating the callback •The event data structure (currently empty) MATLAB passes these two arguments implicitly whenever the callback executes. For example, consider the following statements that are contained in a single M-file. function myGui % Create a figure and specify a callback figure('WindowButtonDownFcn',@myCallback) . . . % Callback subfunction header defines two input arguments function myCallback(obj,eventdata) The first statement creates a figure and assigns a function handle to its WindowButtondownFcn property (created by using the @ symbol before the function name). This function handle points to the subfunction myCallback . 7 Handle Graphics Objects 7-54 The definition of myCallback must specify the two required input arguments in its function definition line. You can define the callback function to accept additional input arguments by adding them to the function definition. For example, function myCallback(obj,eventdata,arg1,arg2) When using additional arguments for the callback function, you must set the value of the property to a cell array (i.e., enclose the function handle and arguments in curly braces). For example, figure('WindowButtonDownFcn',{@myCallback,arg1,arg2}) Defining Callbacks as a Cell Array of Strings — Special Case Defining a callback as a cell array of strings is a special case because MATLAB treats it differently from a simple string. Setting a callback property to a string causes MATLAB to evaluate that string in the base workspace when the callback is invoked. However, setting a callback to a cell array of strings behaves as follows: •The cell array must contain the name of an M-file that is on the MATLAB path as the first string element. •The M-file callback must define at least two arguments (the handle of the callback object and an empty matrix). •Any additional strings in the cell array are passed to the M-file callback as arguments. For example, figure('WindowButtonDownFcn',{myCallback,arg1}) requires you to define a function M-file that uses three arguments, function myCallback(obj,eventdata,arg1) Why Use Function Handle Callbacks Using function handles to specify callbacks provides some advantages over the use of strings, which must be either MATLAB commands or the name of an M-file that will be on the MATLAB path at run-time. Function Handle Callbacks 7-55 Single File for All Code Function handles enable you to use a single M-file for all callbacks. This is particularly useful when creating graphical user interfaces since you can include both the layout commands and callbacks in one file. For information on how to access subfunctions, see the “Evaluating a Function Through Its Handle” section of Programming and Data Types in the MATLAB documentation. Keeping Variables in Scope When MATLAB evaluates function handles, the same variables are in scope as when the function handle was created. (In contrast, callbacks specified as strings are evaluated in the base workspace.) This simplifies the process of managing global data, such as object handles in a GUI. For example, suppose you create a GUI with a list box that displays workspace variables and a push button whose callback creates a plot using the variables selected in the list box. The push button callback needs the handle of the list box to query the names of the selected variables. Here’s what to do. Create the list box and save the handle: h_listbox = uicontrol('Style','listbox',... etc.); Pass the list box handle to the push button’s callback, which is defined in the same M-file: h_plot_button = uicontrol('Style','pushbutton',... 'Callback',{@plot_button_callback,h_listbox},...,etc.); The handle of the list box is now available in the plot button’s callback without relying on global variables or using findobj to search for the handle. See “Example — Using Function Handles in a GUI” on page 7-56 for an example that uses this technique. Callback Object Handle and Event Data MATLAB passes additional information to the callback when executed. Currently this information includes the handle of the callback object, however, later MATLAB releases will include additional event data. 7 Handle Graphics Objects 7-56 Function Handles Stay in Scope A function handle can point to a function that is not in scope at the time of execution. For example, the function may be a subfunction in another M-file. For a general discussion of the advantages function handles provide, see the “Benefits of Function Handles” section of Programming and Data Types in the MATLAB documentation. Example — Using Function Handles in a GUI This example shows how to create a simple GUI that plots variables that exist in the base workspace. It is defined in a single M-file that contains both the layout commands and the callbacks. This example uses function handles to specify callback functions. See “Function Handle Callbacks” on page 7-53 for more information on the use of function handle callbacks. Note The following link executes MATLAB commands and is designed to work within the MATLAB Help browser. Click this link to display the example code in the MATLAB editor. Here is what the GUI looks like. Function Handle Callbacks 7-57 The GUI Layout The first step is to define each component in the GUI and save the handles. function plot_vars % Define the GUI layout h_figure = figure('Units','characters',... 'Position',[72 38 120 35],... 'Color',get(0,'DefaultUicontrolBackgroundColor'),... 'HandleVisibility','callback'); h_axes = axes('Units','characters',... 'Position',[10 4.5 72 26],... 'Parent',h_figure); h_listbox_label = uicontrol(h_figure,... 7 Handle Graphics Objects 7-58 'Style','text',... 'Units','characters',... 'Position',[88 29 24 2],... 'String','Select 2 Workspace Variables'); h_listbox = uicontrol(h_figure,... 'Style','listbox',... 'Units','characters',... 'Position',[88 18.5 24 10],... 'BackgroundColor','white',... 'Max',10,'Min',1,... 'Callback',@listbox_callback); h_popup_label = uicontrol(h_figure,.. 'Style','text',... 'Units','characters',... 'Position',[88 13 24 2],... 'String','Plot Type'); h_popup = uicontrol(h_figure,... 'Units','characters',... 'Position',[88 12 24 2],... 'BackgroundColor','white',... 'String',{'Plot','Bar','Stem'}); h_hold_toggle = uicontrol(h_figure,.. 'Style','toggle',... 'Units','characters',... 'Position',[88 8 24 2],... 'String','Hold State',... 'Callback',{@hold_toggle_callback,h_axes}); h_plot_button = uicontrol(h_figure,... 'Style','pushbutton',... 'Units','characters',... 'Position',[88 3.5 24 2],... 'String','Create Plot',... 'Callback',{@plot_button_callback,h_listbox,h_popup,h_axes}); Initialize the GUI The list box and the hold toggle button need to be initialized before the GUI is ready to use, which is accomplished by executing their callbacks. Note that you Function Handle Callbacks 7-59 must specify all the arguments when calling these functions since we are not evaluating function handles here. % Initialize list box and make sure % the hold toggle is set correctly listbox_callback(h_listbox,[]) hold_toggle_callback(h_hold_toggle,[],h_axes) The Callback Functions Only the list box, toggle button, and plot push button have callbacks. List Box Callback. The list box callback takes advantage of the callback object handle (first argument) generated by MATLAB to set the String property to the current list of workspace variables. Note that for simplicity, the contents of the list box is updated every time the user selects an item. A separate update button would be a more robust approach. % Callback for list box function listbox_callback(obj,eventdata) % Load workspace vars into listbox vars = evalin('base','who'); set(obj,'String',vars) Toggle Button Callback. The toggle button callback requires two additional arguments — the handles of the GUI figure and axes. We can use the handles saved when we created the figure and axes ( h_figure and h_axes ) because function handle callbacks will execute within the context of this M-file. We want the GUI to call the hold command, but hold operates only on the current figure. Our GUI figure cannot become the current figure because we’ve hidden its handle. To implement the functionality of hold , this callback sets the axes NextPlot property directly. % Callback for hold state toggle button function hold_toggle_callback(obj,eventdata,h_axes) button_state = get(obj,'Value'); if button_state == get(obj,'Max') % toggle button is pressed set(obj,'String','Hold On') 7 Handle Graphics Objects 7-60 elseif button_state == get(obj,'Min') % toggle button is not pressed set(h_axes,'NextPlot','replace') set(obj,'String','Hold Off') end Plot Button Callback. The plot button callback performs three tasks: •Gets the names of the variables selected by the user in the list box •Gets the type of plot selected by the user in the popup menu •Constructs and evaluates the plotting command in the MATLAB base workspace % Callback for plot button function plot_button_callback(obj,eventdata,h_listbox,h_popup,h_axes) % Get workspace variables vars = get(h_listbox,'String'); var_index = get(h_listbox,'Value'); if length(var_index) ~= 2 errordlg('You must select two variables',... 'Incorrect Selection','modal') return end % Get data from base workspace x = evalin('base',vars{var_index(1)}); y = evalin('base',vars{var_index(2)}); % Get plotting command selected_cmd = get(h_popup,'Value'); % Make the GUI axes current axes(h_axes) % Call appropriate command based on what user selected switch selected_cmd case 1 % user selected plot plot(x,y) case 2 % user selected bar bar(x,y) case 3 % user selected stem stem(x,y) end Function Handle Callbacks 7-61 Using the GUI Select some variables from the workspace and overlay stem and bar plots. 7 Handle Graphics Objects 7-62 8 Figure Properties Figure Objects (p.8-2) What is a figure and what are its properties. Positioning Figures (p.8-3) Properties used to position figures and how they are measured. Controlling How MATLAB Uses Color (p.8-7) Properties that control how MATLAB uses system color resources. Selecting Drawing Methods (p.8-15) How to select rendering methods and when to use double buffering and backing store. Specifying the Figure Pointer (p.8-18) How to select from predefined pointers or define customer pointers. Interactive Graphics (p.8-23) Properties that define figure callbacks and contain figure state. 8 Figure Properties 8-2 Figure Objects Figure graphics objects are the windows in which MATLAB displays graphical output. Figure properties allow you to control many aspects of these windows, such as their size and position on the screen, the coloring of graphics objects displayed within them, and the scaling of printed pictures. This section discusses some of the features that are implemented through figure properties and provides examples of how to use these features. The table in the figure reference page listing all properties provides an overview of the characteristics affected by figure properties. Positioning Figures 8-3 Positioning Figures The figure Position property controls the size and location of the figure window on the root screen. At startup, MATLAB determines the size of your computer screen and defines a default value for Position . This default creates figures about one-quarter of the screen’s size and places them centered left to right and in the top half of the screen. The Position Vector MATLAB defines the figure Position property as a vector. [left bottom width height] left and bottom define the position of the first addressable pixel in the lower-left corner of the window, specified with respect to the lower-left corner of the screen. width and height define the size of the interior of the window (i.e., exclusive of the window border). width height left bottom Figure No. 1 8 Figure Properties 8-4 MATLAB does not measure the window border when placing the figure; the Position property defines only the internal active area of the figure window. Since figures are windows under the control of your computer’s windowing system, you can move and resize figures as you would any other windows. MATLAB automatically updates the Position property to the new values. Units The figure’s Units property determines the units of the values used to specify the position on the screen. Possible values for the Units property are set(gcf,'Units') [ inches | centimeters | normalized | points | {pixels} | characters] with pixels being the default. These choices allow you to specify the figure size and location in absolute units (such as inches) if you want the window to always be a certain size, or in units relative to the screen size (such as pixels). characters are units that enable you to define the location and size of the figure in units that are based on the size of the default system font. Determining Screen Size Whatever units you use, it is important to know the extent of the screen in those units. You can obtain this information from the root ScreenSize property. For example, get(0,'ScreenSize') ans = 1 1 1152 900 In this case, the screen is 1152 by 900 pixels. MATLAB returns the ScreenSize in the units determined by the root Units property. For example, set(0,'Units','normalized') normalizes the values returned by ScreenSize . get(0,'ScreenSize') ans = 0 0 1 1 Positioning Figures 8-5 Defining the figure Position in terms of the ScreenSize in normalized units makes the specification independent of variations in screen size. This is useful if you are writing an M-file that is to be used on different computer systems. Example – Specifying Figure Position Suppose you want to define two figure windows that occupy the upper third of the computer screen (e.g., one for uicontrols and the other to display data). To position the windows precisely, you must consider the window borders when calculating the size and offsets to specify for the Position properties. The figure Position property does not include the window borders, so this example uses a width of 5 pixels on the sides and bottom and 30 pixels on the top. bdwidth = 5; topbdwidth = 30; Ensure root units are pixels and get the size of the screen set(0,'Units','pixels') scnsize = get(0,'ScreenSize'); Define the size and location of the figures pos1 = [bdwidth,... 2/3*scnsize(4) + bdwidth,... scnsize(3)/2 2*bdwidth,... scnsize(4)/3 (topbdwidth + bdwidth)]; pos2 = [pos1(1) + scnsize(3)/2,... pos1(2),... pos1(3),... pos1(4)]; Create the figures figure('Position',pos1) figure('Position',pos2) The two figures now occupy the top third of the screen. 8 Figure Properties 8-6 Controlling How MATLAB Uses Color 8-7 Controlling How MATLAB Uses Color Figure properties control the way MATLAB uses your computer’s color resources. These properties influence both the speed of drawing and the accuracy of the colors used to display graphics. The properties discussed in this section include those listed in the following table. Indexed Color Displays MATLAB defines a unique colormap as well as fixed colors (which are not part of the colormap) for each figure object. Your computer system stores these color definitions in a color lookup table along with colors used for window borders, backgrounds, and so on. Indexed color systems associate a color slot (as opposed to a specific color) in the system color table with each screen pixel. When you activate an application program, for example, by moving the focus to a MATLAB figure window, the system loads the colors associated with that program into the color table. Property Purpose Colormap The figure colormap. An n-by-3 array of RGB values. FixedColors Specific colors used by the figure that are not in the colormap. MinColormap The minimum number of system color table slots MATLAB uses for the figure colormap. ShareColors The property that determines whether MATLAB shares colors with other figure colormaps in the system color table. Dithermap A predefined colormap for displaying truecolor graphics objects on a pseudocolor system. DithermapMode The property that determines whether MATLAB uses the current dither colormap or creates one based on the colors specified for existing graphics objects. 8 Figure Properties 8-8 You can create a number of figures on the screen at once, but only one has focus at any given time. When you change the focus to a particular figure, the computer’s operating system loads that figure’s colormap and all its fixed colors into the system color table. For example, the color table might be allocated like this. Colormap Colors and Fixed Colors MATLAB maintains two categories of colors for each figure – colors that are defined in the colormap and colors that are fixed, which do not change when you change the colormap. These two categories are used in different ways. Only surface, patch, and image objects use the colormap. MATLAB colors these objects based on the order the colors appear in the colormap. Fixed colors are simply definitions of specific colors that MATLAB uses to color axis lines and labels and values you specify for object colors (i.e., the Color , ColorOrder , FaceColor , EdgeColor , MarkerFaceColor , and MarkerEdgeColor properties). Defining Fixed Colors When MATLAB creates a figure, it defines three fixed colors. figure get(gcf,'FixedColors') ans = 0.8000 0.8000 0.8000 0 0 0 Color slots used by system for window borders, Color slots allocated as MATLAB fixed colors Color slots available for the figure colormap System Color Table Controlling How MATLAB Uses Color 8-9 1.0000 1.0000 1.0000 Creating an axes includes the colors defined by the axes ColorOrder property in the fixed color list, since it is more efficient to predefine these colors. axes get(gcf,'FixedColors') ans = 0.8000 0.8000 0.8000 0 0 0 1.0000 1.0000 1.0000 0 0 1.0000 0 0.5000 0 1.0000 0 0 0 0.7500 0.7500 0.7500 0 0.7500 0.7500 0.7500 0 0.2500 0.2500 0.2500 Any colors you define, for example, set(surf_handle,'EdgeColor',[.2 .8 .7]) also become part of the fixed color list. You can define as many fixed colors as you want without affecting the colors in the figure colormap. However, fixed colors occupy color table slots that MATLAB cannot use for the colormap. Using a Large Number of Colors Overview Set MinColormap to a number equal to the size of your colormap when you do not want MATLAB to approximate colors. However, this may cause nonactive windows to display with incorrect colors. More Details Problems can arise when you define a large colormap and/or a large number of fixed colors. If the number of color slots required exceeds the number available in the system color table, MATLAB specifies all fixed colors first, then linearly subsamples the colormap to fill the remaining slots. 8 Figure Properties 8-10 For example, if the original colormap contains 128 colors and there are only 64 slots available, then MATLAB adds every other color to the color table. MATLAB maps each color in the original colormap to the color in the subsampled colormap that most closely matches the original color. Specifying the Minimum Colormap Size – MinColormap The figure MinColormap property specifies the minimum number of slots in the system color table that MATLAB uses for the figure colormap. This enables you to use colormaps of any size up to the value of MinColormap and ensure MATLAB does not subsample the colors. If you specify a value that is greater than the number of available slots, MATLAB takes over slots used to define system colors (on computers that allow overwriting of these colors). When this happens, nonactive windows can display with incorrect colors because MATLAB changed the color of the slot assigned to their pixels. MATLAB does not take over color slots allocated to fixed colors. Therefore, limiting the number of fixed colors maximizes the number of colors allocated to the colormap. You can limit the number of fixed colors by specifying all noncolormap object colors (e.g., text, line, and figure colors) as the same color, and setting the axes ColorOrder property to just one color (the default is seven colors). System Color Slots Fixed colors Figure colormap System Color Table Controlling How MATLAB Uses Color 8-11 Nonactive Figures and Shared Colors Overview Set ShareColors to on to conserve resources and to off to allow rapid colormap change. More Detail Since nonactive figures are still visible, it is generally desirable for them to display correctly colored. However, if a number of figures with different colormaps exist simultaneously, or have large colormaps, the computer’s color resources may not be able to display all figures correctly colored. When ShareColors is on , the figure does not redefine a color in the system color table if that color already exists. While sharing colors is a more efficient use of resources, it prevents MATLAB from rapidly changing the colormap (for example, as the spinmap function does). This is because MATLAB cannot change the value of a color slot in the system color table if other pixels also point to that slot for their color definition. It must find another slot for the new color. Changing color slot pixel assignments requires rerendering (i.e., recomputing color values and 0 5 10 15 20 25 0 5 10 15 20 25 −0.5 0 0.5 System Color Table Two pixels pointing to the same slot in the color table 0 5 10 15 20 25 30 35 40 0 10 20 30 40 −2 −1 0 1 2 8 Figure Properties 8-12 reassigning pixels to these colors) of the figure whose colormap you are altering. If you want to change a figure’s colormap rapidly, you should disable color sharing. set(fig_handle,'ShareColors','off') Note that the new colormap must be the same size as the original one to avoid rerendering the figure. Look at the spinmap M-file for an example of this technique. Dithering Truecolor on Indexed Color Systems Overview Set DithermapMode to manual to use the current Dithermap or auto to force MATLAB to create a new Dithermap based on the colors displayed in the figure. More Detail MATLAB enables you to take advantage of truecolor systems (24-bit displays) by specifying CData as RGB triples, instead of values that index into the figure colormap. Index color systems interpret truecolor specifications by mapping each color to the closest color in the dithermap, which is assigned to the Dithermap property. MATLAB uses the Floyd-Steinberg algorithm to perform the mapping. Controlling How MATLAB Uses Color 8-13 The dithermap is a colormap that replaces the figure colormap (which is not used in this case). The default dithermap contains a sampling of colors from the entire spectrum. This produces reasonably good quality with any object coloring. However, if the figure contains objects of primarily one color, a dithermap concentrated in the same color produces better color resolution. Auto Dither Mode When you set DithermapMode to auto , MATLAB automatically creates a dithermap based on the colors in the figure. MATLAB produces an appropriate dithermap using the minimum variance quantization algorithm; however, the process is time consuming. Also, MATLAB regenerates the dithermap each time it re-renders the figure. To avoid excessive rendering time, you should reset DithermapMode to manual after MATLAB generates the dithermap. MATLAB then uses this dithermap without regenerating it until you once again set DithermapMode to auto . You do not need to regenerate the dithermap unless you change the colors used in the figure. R G B Direct Color Specification Dither Map MATLAB maps each direct color to the closest color in the current dithermap. The algorithm looks at the colors selected in a six-pixel region so that, on the average, the color of that region closely approximates the real colors. 8 Figure Properties 8-14 You can save a dithermap by assigning the Dithermap property to a variable and saving it as a MAT-file. set(gcf,'DithermapMode','auto') MATLAB creates a dithermap, which you can then save. dmap = get(gcf,'Dithermap'); save DitherMaps dmap Dithermap Size To obtain the highest color resolution, the default dithermap is as large as the system allows. This is usually less than 256 colors because a certain number of slots are reserved for system colors. Also, MATLAB fixed colors are not overwritten by the dithermap. Effects of Dithering Dithering reduces the resolution of the displayed graphics because the colors are mapped in groups of six pixels. For example, suppose the color of one pixel is defined as orange, but the dithermap does not have this color. MATLAB selects combinations of colors from the dithermap that, taken together as a six-pixel group, approximate the color orange. Selecting Drawing Methods 8-15 Selecting Drawing Methods MATLAB enables you to select different techniques for drawing graphics. The combination of settings you select depends on the type of graphics you are producing. There are four figure properties that affect how MATLAB draws graphics: • BackingStore – allows faster redrawing when obscured figure windows are exposed. • DoubleBuffer – produces flash-free rendering for simple animations. • Renderer and RendererMode – specifies different rendering methods or allows MATLAB to make the selection. Backing Store Overview Set BackingStore to on to produce fast redraws of previously obscured windows. Disable BackingStore to use less system memory. More Details The term “backing store” refers to an off-screen pixel buffer used to store a copy of the figure window’s contents. When you move or delete windows on your display, previously obscured windows can become exposed (even partially), requiring the computer system to redraw these windows. With backing store enabled, MATLAB simply copies an exposed figure window’s contents from the buffer to the screen. The BackingStore property is on by default as this provides the most desirable behavior. However, the off-screen pixel buffers required for each figure window do consume system memory. If memory is limited on your system, set BackingStore to off to release the memory used by these buffers. Double Buffering Overview Set DoubleBuffer to on when animating lines rendered in painters with EraseMode set to normal . 8 Figure Properties 8-16 More Details Double buffering is the process of drawing into an off-screen pixel buffer and then blitting the buffer contents to the screen once the drawing is complete (instead of drawing directly to the screen where the process of drawing is visible as it progresses). Double buffering generally produces flash-free rendering for simple animations (such as those involving lines, as opposed to objects containing large numbers of polygons). The figure DoubleBuffer property accepts the values on and off , with off being the default. You can select double buffering only when the figure Renderer property is set to painters . Zbuffer always uses double buffering and ignores this property. OpenGL does not use double buffering. Use double buffering with the animated object’s EraseMode property set to normal . Selecting a Renderer Overview MATLAB automatically selects the best renderer based on the complexity of the graphics objects and the options available on your system. More Details A renderer is the software that processes graphics data (such as vertex coordinates) into a form that MATLAB can use to draw into the figure. MATLAB supports three renderers: •Painters •Zbuffer •OpenGL Painters Painters method is faster when the figure contains only simple or small graphics. It cannot be used with lighting. Z-Buffer Z-buffering is the process of determining how to render each pixel by drawing only the front-most object, as opposed to drawing all objects back to front, Selecting Drawing Methods 8-17 redrawing objects that obscure those behind. The pixel data is buffered and then blitted to the screen all at once. Z-buffering is generally faster for more complex graphics, but may be slower for very simple graphics. You can set the Renderer property to whatever produces the fastest drawing (either zbuffer or painters ), or let MATLAB decide which method to use by setting the RendererMode property to auto (the default). Printing from Z-Buffer. You can select the resolution of the PostScript file produced by the print command using the r option. By default, MATLAB prints Z-buffered figures at a medium resolution of 150 dpi (the default with Renderer set to painters is 864 dpi). The size of the file generated from a Z-buffer figure does not depend on its contents, just the size of the figure. To decrease the file size, make the PaperPosition property smaller before printing (or set PaperPositionMode to auto and resize the figure window). OpenGL OpenGL is available on many computer systems. It is generally faster than either painters or zbuffer and in some cases enables MATLAB to uses the system’s graphics hardware (which results in significant speed increase). See the figure Renderer Limitations of OpenGL. OpenGL has two limitations when compared to painters and zbuffer: •OpenGL does not interpolate colors within the figure colormap; all color interpolation is performed through the RGB color cube, which may produce unexpected results. •OpenGL does not support Phong lighting. 8 Figure Properties 8-18 Specifying the Figure Pointer MATLAB indicates the position of the pointer (cursor) within the figure window using a graphical symbol. You can select a pointer from 15 predefined symbols (see table below) or you can define your own symbol. By convention, each of the predefined symbols has a purpose associated with it (although MATLAB enforces no rules for the use of any symbols). You specify the pointer symbol by setting the value of the figure Pointer property. For example, this statement sets the pointer in the current figure ( gcf ) to an arrow. set(gcf,'Pointer','arrow') The following table shows the predefined symbols, the associated specifier, and describes typical use. Purpose Specifier Typical Symbol Locate a point on a graphics object crosshair Select a point anywhere in the figure arrow Indicate the system is busy watch Resize an object from the top-left corner topl Resize an object from the top-right corner topr Resize an object from the bottom-left corner botl Resize an object from the bottom-right corner botr View the actual hot spot circle Locate a point cross Specifying the Figure Pointer 8-19 Defining Custom Pointers When you set the Pointer property to custom , MATLAB displays the pointer you define using the PointerShapeCData and the PointerShapeHotSpot properties. Custom pointers are 16-by-16 pixels, where each pixel can be either black, white, or transparent. Specify the pointer by creating a 16-by-16 matrix containing elements that are: •1s where you want the pixel black •2s where you want the pixel white • NaN s where you want the pixel transparent Assign the matrix to the figure PointerShapeCData property. MATLAB displays the defined pointer whenever the pointer is in the figure window. The PointerShapeHotSpot property specifies the pixel that indicates the pointer location. MATLAB then stores this location in the root PointerLocation property. Set the PointerShapeHotSpot property to a two-element vector specifying the row and column indices in the PointerShapeCData matrix that corresponds to the pixel specifying the Use as popular symbol fleur Resize an object from the left side left Resize an object from the right side right Resize an object from the top top Resize an object from the bottom bottom Align a point with other objects on the display fullcross See the next section for information on defining your own pointer shape custom Purpose Specifier Typical Symbol 8 Figure Properties 8-20 location. The default value for this property is [1 1], which corresponds to the upper-left corner of the pointer. Example – Two Custom Pointers One way to create a custom pointer is to assign values to a 16-by-16 matrix by hand, as illustrated in the following example. First, initialize the matrix, setting all values to 2. Create a black border 1 pixel wide. Add alignment marks. P = ones(16)+1; P(1,:) = 1; P(16,:) = 1; P(:,1) = 1; P(:,16) = 1; P(1:4,8:9) = 1; P(13:16,8:9) = 1; P(8:9,1:4) = 1; P(8:9,13:16) = 1; P(5:12,5:12) = NaN; % Create a transparent region in the center set(gcf,'Pointer','custom','PointerShapeCData',P,... 'PointerShapeHotSpot',[9 9]) The last statement sets the Pointer property to custom , assigns the matrix to the PointerShapeCData property, and selects the “hot spot” as element (9,9). MATLAB now uses the custom pointer within the figure window. 2 4 6 8 10 12 14 16 2 4 6 8 10 12 14 16 Specifying the Figure Pointer 8-21 Creating Pointers from Functions. You can use a mathematical function to define the PointerShapeCData matrix. For example, evaluating the function, g = 0:.2:20; [X,Y] = meshgrid(g); Z = 2*sin(sqrt(X.^2 + Y.^2)); mesh(Z); produces an interesting surface. Use the values of Z to create a pointer sampling fewer points so that Z is a 16-by-16 matrix. g = linspace(0,20,16); [X,Y] = meshgrid(g); Z = 2*sin(sqrt(X.^2 + Y.^2)); set(gcf,'Pointer','custom',... 'PointerShapeCData',flipud((Z>0) + 1)) The statement, flipud((Z>0) + 1) sets all values in Z that are greater than zero to two (in MATLAB, true + 1 = 2), less than zero to one (false + 1 = 1) and then flips the data around so that element (1,1) is the upper-left corner. 2 x 2 y 2 + sin 0 10 20 0 5 10 15 20 −2 0 2 8 Figure Properties 8-22 5 10 15 5 10 15 Interactive Graphics 8-23 Interactive Graphics Figure objects contain a number of properties designed to facilitate user interaction with the figure. These properties fall into two categories. Properties related to callback routine execution: • BusyAction • ButtonDownFcn •CreateFcn • DeleteFcn • KeyPressFcn • Interruptible • ResizeFcn • WindowButtonDownFcn , WindowButtonMotionFcn , and WindowButtonUpFcn Properties that contain information about the MATLAB state: • CurrentAxes • CurrentCharacter • • CurrentObject • CurrentPoint • SelectionType The online manual, Creating Graphical User Interfaces, provides information on creating programs that incorporate interactive graphics. 8 Figure Properties 8-24 9 Axes Properties Axes Objects (p.9-2) What is an axes and what are its properties. Labeling and Appearance Properties (p.9-3) Properties that affect general appearance of the axes. Positioning Axes (p.9-5) How axes are positioned within a figure. Multiple Axes per Figure (p.9-7) How to use axes to place text outside the graph axes and how to use multiple axes within a figure to achieve different views. Individual Axis Control (p.9-10) Properties that control the x-, y-, and z-axis individually. Using Multiple X and Y Axes (p.9-16) Multiple axes on a single graph. Automatic-Mode Properties (p.9-19) Properties that are set automatically with each graph. Colors Controlled by Axes (p.9-22) Axes colors and color limits (caxis) to control the mapping of data to colormaps. 9 Axes Properties 9-2 Axes Objects Axes are the parents of image, light, line, patch, rectangle, surface, and text graphics objects. These objects are the entities used to draw graphs of numerical data and pictures of real-world objects, such as airplanes or automobiles. Axes orient and scale their child objects to produce a particular effect, such as scaling a plot to accentuate certain information or rotating objects through various views. Axes properties control many aspects of how MATLAB displays graphical information. This section discusses some of the features that are implemented through axes properties and provides examples of how to uses these features. The table in the axes reference page listing all axes properties provides an overview of the characteristics affected by these properties. Labeling and Appearance Properties 9-3 Labeling and Appearance Properties MATLAB provides a number of properties for labeling and controlling the appearance of axes. For example, this surface plot shows some of the labeling possibilities and indicates the controlling property. Creating Axes with Specific Characteristics To create this axes, specify values for the indicated properties. h = axes('Color',[.9 .9 .9],... 'GridLineStyle','--',... 'ZTickLabels','-1|Z = 0 Plane|+1',... 'FontName','times',... 'FontAngle','italic',... 'FontSize',14,... 'XColor',[0 0 .7],... 'YColor',[0 0 .7],... 'ZColor',[0 0 .7]); −2 −1 0 1 2 −2 −1 0 1 2 −1 = 0 Plane +1 Values of X Values of Y Z = f(x,y) YLabel ZTickLabels Title GridLineStyle Color XLabel FontAngle YColor 9 Axes Properties 9-4 Axis Labels The individual axis labels are text objects whose handles are normally hidden from the command line (their HandleVisibility property is set to callback ). You can use the xlabel , ylabel , zlabel , and title functions to create axis labels. However, these functions affect only the current axes. If you are labeling axes other than the current axes by referencing the axes handle, then you must obtain the text object handle from the corresponding axes property. For example, get(axes_handle,'XLabel') returns the handle of the text object used as the x-axis label. Obtaining the text handle from the axes is useful in M-files and MATLAB-based applications where you cannot be sure the intended target is the current axes. The following statements define the x- and y-axis labels and title for the axes above. set(get(axes_handle,'XLabel'),'String','Values of X') set(get(axes_handle,'YLabel'),'String','Values of Y') set(get(axes_handle,'Title'),'String','\fontname{times}\itZ = f(x,y)') Since the labels are text, you must specify a value for the String property, which is initially set to the empty string (i.e., there are no labels). MATLAB overrides many of the other text properties to control positioning and orientation of these labels. However, you can set the Color , FontAngle , FontName , FontSize , FontWeight , and String properties. Note that both axes objects and text objects have font specification properties. The call to the axes function on the previous page set values for the FontName , FontAngle , and FontSize properties. If you want to use the same font for the labels and title, specify these same property values when defining their String property. For example, the x-axis label statement would be set(get(h,'XLabel'),'String','Values of X',... 'FontName','times',... 'FontAngle','italic',... 'FontSize',14) Positioning Axes 9-5 Positioning Axes The axes Position property controls the size and location of an axes within a figure. The default axes has the same aspect ratio (ratio of width to height) as the default figure and fills most of the figure, leaving a border around the edges. However, you can define the axes position as any rectangle and place it wherever you want within a figure. The Position Vector MATLAB defines the axes Position property as a vector. [left bottom width height] left and bottom define a point in the figure that locates the lower-left corner of the axes rectangle. width and height specify the dimensions the axes rectangle. Viewing the axes in 2-D (azimuth = 0°, elevation = 90°) orients the x-axis horizontally and the y-axis vertically. From this angle, the plot box (the area used for plotting, exclusive of the axis labels) coincides with the axes rectangle. 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 width left bottom height 9 Axes Properties 9-6 The default 3-D view is azimuth = -37.5°, elevation = 30°. By default, MATLAB draws the plot box to fill the axes rectangle, regardless of its shape. However, axes properties enable control over the shape and scaling of the plot box. Position Units The axes Units property determines the units of measurement for the Position property. Possible values for this property are set(gca,'Units') [ inches | centimeters | {normalized} | points | pixels ] with normalized being the default. Normalized units map the lower-left corner of the figure to the point (0,0) and the upper-right corner to (1.0,1.0), regardless of the size of the figure. Normalized units cause axes to resize automatically whenever you resize the figure. All other units are absolute measurements that remained fixed as you resize the figure. 0 0.5 1 0 0.5 1 0 0.2 0.4 0.6 0.8 1 width left bottom height Multiple Axes per Figure 9-7 Multiple Axes per Figure The subplot function creates multiple axes in one figure by computing values for Position that produce the specified number of axes. The subplot function is useful for laying out a number of graphs equally spaced in the figure. However, overlapping axes can create some other useful effects. The following two sections provides examples: •“Placing Text Outside the Axes” on page 9-7 •“Multiple Axes for Different Scaling” on page 9-8 Placing Text Outside the Axes MATLAB always displays text objects within an axes. If you want to create a graph and provide a description of the information alongside the graph, you must create another axes to position the text. If you create an axes that is the same size as the figure and then create a smaller axes to draw the graph, you can then display text anywhere independently of the graph. For example, define two axes. h = axes('Position',[0 0 1 1],'Visible','off'); axes('Position',[.25 .1 .7 .8]) Since the axes units are normalized to the figure, specifying the Position as [0 0 1 1] creates an axes that encompasses the entire window. Now plot some data in the current axes. The last axes created is the current axes so MATLAB directs graphics output there. t = 0:900; plot(t,0.25*exp(-0.005*t)) Define the text and display it in the full-window axes. str(1) = {'Plot of the function:'}; str(2) = {' y = A{\ite}^{-\alpha{\itt}}'}; str(3) = {'With the values:'}; str(3) = {' A = 0.25'}; str(4) = {' \alpha = .005'}; str(5) = {' t = 0:900'}; set(gcf,'CurrentAxes',h) 9 Axes Properties 9-8 text(.025,.6,str,'FontSize',12) Multiple Axes for Different Scaling You can create multiple axes to display graphics objects with different scaling without changing the data that defines these objects (which would be required to display them in a single axes). h(1) = axes('Position',[0 0 1 1]); sphere h(2) = axes('Position',[0 0 .4 .6]); sphere h(3) = axes('Position',[0 .5 .5 .5]); sphere h(4) = axes('Position',[.5 0 .4 .4]); sphere h(5) = axes('Position',[.5 .5 .5 .3]); sphere Plot of the function: y = Ae −t With the values: A = 0.25 = .005 t = 0:900 0 100 200 300 400 500 600 700 800 900 0 0.05 0.1 0.15 0.2 0.25 Multiple Axes per Figure 9-9 set(h,'Visible','off') Each sphere is defined by the same data. However, since the parent axes occupy regions of different size and location, the spheres appear to be different sizes and shapes. 9 Axes Properties 9-10 Individual Axis Control MATLAB automatically determines axis limits, tick mark placement, and tick mark labels whenever you create a graph. However, you can specify these values manually by setting the appropriate property. When you specify a value for a property controlled by a mode (e.g., the XLim property has an associated XLimMode property), MATLAB sets the mode to manual enabling you to override automatic specification. Since the default values for these mode properties are automatic, calling high-level functions such as plot or surf resets these modes to auto . This section discusses the following properties. Property Purpose XLim,YLim,ZLim Sets the axis range. XLimMode, YLimMode, ZLimMode Specifies whether axis limits are determined automatically by MATLAB or specified manually by the user. XTick, YTick, ZTick Sets the location of the tick marks along the axis. XTickMode, YTickMode, ZTickMode Specifies whether tick mark locations are determined automatically by MATLAB or specified manually by the user. XTickLabel, YTickLabel, ZTickLabel Specifies the labels for the axis tick marks. XTickLabelMode, YTickLabelMode, ZTickLabelMode Specifies whether tick mark labels are determined automatically by MATLAB or specified manually by the user. XDir,YDir,ZDir Sets the direction of increasing axis values. Individual Axis Control 9-11 Setting Axis Limits MATLAB determines the limits automatically for each axis based on the range of the data. You can override the selected limits by specifying the XLim , YLim , or ZLim property. For example, consider a plot of the function evaluated with A = 0.25, = 0.05, and t = 0 to 900. t = 0:900; plot(t,0.25*exp(0.05*t)) The plot on the left shows the results. MATLAB selects axis limits that encompass the range of data in both x and y. However, since the plot contains little information beyond t = 100, changing the x-axis limits improves the usefulness of the plot. If the handle of the axes is axes_handle , then following statement, set(axes_handle,'XLim',[0 100]) creates the plot on the right. You can use the axis command to set limits on the current axes only. Ae t 0 200 400 600 800 0 0.05 0.1 0.15 0.2 0.25 = 0.05 Amplitude Time = 0.05 Amplitude Time Before After 9 Axes Properties 9-12 Semiautomatic Limits You can specify either the minimum or maximum value for an axis limit and allow the other limit to autorange. Do this by setting an explicit value for the manual limit and Inf for the automatic limit. For example, the statement, set(axes_handle,'XLim',[0 Inf]) sets the XLimMode property to auto and allows MATLAB to determine the maximum value for XLim . Similarly, the statement, set(axes_handle,'XLim',[Inf 800]) sets the XLimMode property to auto and allows MATLAB to determine the minimum value for XLim . Setting Tick Mark Locations MATLAB selects the tick mark location based on the data range to produce equally spaced ticks (for linear graphs). You can specify alternative locations for the tick marks by setting the XTick , YTick , and ZTick properties. For example, if the value 0.075 is of interest for the amplitude of the function , specify tick marks to include that value. set(gca,'YTick',[0 0.05 0.075 0.1 0.15 0.2 0.25]) Ae t 0 20 40 60 80 100 0 0.05 0.075 0.1 0.15 0.2 0.25 = 0.05 Amplitude Time Individual Axis Control 9-13 You can change tick labeling from numbers to strings using the XTickLabel , YTickLabel , and ZTickLabel properties. For example, to label the y-axis value of 0.075 with the string Cutoff , you can specify all y-axis labels as a string, separating each label with the “|” character. set(gca,'YTickLabel','0|0.05|Cutoff|0.1|0.15|0.2|0.25') Changing Axis Direction The XDir , YDir , and ZDir properties control the direction of increasing values on the respective axis. In the default 2-D view, the x-axis values increase from left to right and the y-axis values increase from bottom to top. The z-axis points out of the screen. You can change the direction of increasing values by setting the associated property to reverse . For example, setting XDir to reverse, set(gca,'XDir','reverse') produces a plot whose x-axis decreases from left to right. 0 20 40 60 80 100 0 0.05 Cutoff 0.1 0.15 0.2 0.25 = 0.05 Amplitude Time 9 Axes Properties 9-14 In the 3-D view, the y-axis increases from front to back and the z-axis increases from bottom to top. Setting the x-, y-, and z-directions to reverse, set(gca,'XDir','rev','YDir','rev','ZDir','rev') 0 50 100 150 200 0 10 20 30 40 50 60 70 80 90 100 Years Ago Percent of Today’s Rate 0 0.5 1 0 0.5 1 0 0.5 1 Increasing Values Normal Axis Direction Increasing Values Increasing Values Individual Axis Control 9-15 yields 0 0.5 1 0 0.5 1 0 0.5 1 Increasing Values Reverse Axis Direction Increasing Values Increasing Values 9 Axes Properties 9-16 Using Multiple X and Y Axes The XAxisLocation and YAxisLocation properties specify on which side of the graph to place the x- and y-axes. You can create graphs with two different x-axes and y-axes by superimposing two axes objects and using XAxisLocation and YAxisLocation to position each axis on a different side of the graph. This technique is useful to plot different sets of data with different scaling in the same graph. Example – Double Axis Graphs This example creates a graph to display two separate sets of data using the bottom and left sides as the x- and y-axis for one, and the top and right sides as the x- and y-axis for the other. Using low-level line and axes routines allows you to superimpose objects easily. Plot the first data, making the color of the line and the corresponding x- and y-axis the same to more easily associate them. hl1 = line(x1,y1,'Color','r'); ax1 = gca; set(ax1,'XColor','r','YColor','r') Next, create another axes at the same location as the first, placing the x-axis on top and the y-axis on the right. Set the axes Color to none to allow the first axes to be visible and color code the x- and y-axis to match the data. ax2 = axes('Position',get(ax1,'Position'),... 'XAxisLocation','top',... 'YAxisLocation','right',... 'Color','none',... 'XColor','k','YColor','k'); Draw the second set of data in the same color as the x- and y-axis. hl2 = line(x2,y2,'Color','k','Parent',ax2); Using Multiple X and Y Axes 9-17 Creating Coincident Grids Since the two axes are completely independent, MATLAB determines tick mark locations according to the data plotted in each. It is unlikely the gridlines will coincide. This produces a somewhat confusing looking graph, even though the two grids are drawn in different colors. However, if you manually specify tick mark locations, you can make the grids coincide. The key is to specify the same number of tick marks along corresponding axis lines (it is also necessary for both axes to be the same size). The following graph of the same data uses six tick marks per axis, equally spaced within the original limits. To calculate the tick mark location, obtain the limits of each axis and calculate an increment. xlimits = get(ax1,'XLim'); ylimits = get(ax1,'YLim'); xinc = (xlimits(2)xlimits(1))/5; yinc = (ylimits(2)ylimits(1))/5; 0 5 10 15 20 25 30 35 40 −0.35 −0.3 −0.25 −0.2 −0.15 −0.1 −0.05 0 0.05 Time msec Amplitude 0 2 4 6 8 10 0 0.5 1 1.5 2 2.5 Time sec Amplitude 9 Axes Properties 9-18 Now set the tick mark locations. set(ax1,'XTick',[xlimits(1):xinc:xlimits(2)],... 'YTick',[ylimits(1):yinc:ylimits(2)]) The resulting graph is visually simpler, even though the y-axis on the left has rather odd tick mark values. 0 8 16 24 32 40 −0.35 −0.27 −0.19 −0.11 −0.03 Time msec Amplitude 0 2 4 6 8 10 0 0.5 1 1.5 2 2.5 Time sec Amplitude Automatic-Mode Properties 9-19 Automatic-Mode Properties While object creation routines that create axes children do not explicitly change axes properties, some axes properties are under automatic control when their associated mode property is set to auto (which is the default). The following table lists the automatic-mode properties. For example, if all property values are set to their defaults and you enter these statements Mode Properties What It Controls CameraPositionMode Positioning of the viewpoint CameraTargetMode Positioning of the camera target in the axes CameraUpVectorMode The direction of “up” in 2-D and 3-D views CameraViewAngleMode The size of the projected scene and stretch-to-fit behavior CLimMode Mapping of data values to colors DataAspectRatioMode Relative scaling of data units along x, y, and z axes and stretch-to-fit behavior PlotBoxAspectRatioMode Relative scaling of plot box along x, y, and z axes and stretch-to-fit behavior TickDirMode Direction of axis tick marks (in for 2-D, out for 3-D) XLimMode YLimMode ZLimMode Limits of the respective x, y, and z axes XTickMode YTickMode ZTickMode Tick mark spacing along the respective x, y, and z axes XTickLabelMode YTickLabelMode ZTickLabelMode Tick mark labels along the respective x, y, and z axes 9 Axes Properties 9-20 line(1:10,1:10) line(1:10,[1:10].^2) the second line statement causes the YLim property to change from [0 10] to [0 100] . This is because YLimMode is auto , which always causes MATLAB to recompute the axis limits. If you set the value controlled by an automatic-mode property, MATLAB sets the mode to manual and does not automatically recompute the value. For example, in the statements line(1:10,1:10) set(gca,'XLim',[1 10],'YLim',[1 20]) line(1:10,[1:10].^2) the set statement sets the x- and y-axis limits and changes the XLimMode and YLimMode properties to manual . The second line statement now draws a line that is clipped to the axis limits [1 12] instead of causing the axes to recompute its limits. 1 2 3 4 5 6 7 8 9 10 0 10 20 30 40 50 60 70 80 90 100 Automatic-Mode Properties 9-21 1 2 3 4 5 6 7 8 9 10 2 4 6 8 10 12 14 16 18 20 9 Axes Properties 9-22 Colors Controlled by Axes Axes properties specify the color of the axis lines, tick marks, labels, and the background. Properties also control the color of the lines drawn by plotting routines and how image, patch, and surface objects obtain colors from the figure colormap. The axes properties discussed in this section are listed in the following table. Specifying Axes Colors The default axes background color is set up by the colordef command, which is called in your startup file. However, you can easily define your own color scheme. See InvertHardCopy for information on how MATLAB automatically changes the color scheme for printing hardcopy. Property Characteristic it Controls Color Axes background color XColor , YColor , ZColor Color of the axis lines, tick marks, gridlines and labels Title Title text object handles XLabel , YLabel , Zlabel Axis label text object handles CLim Controls mapping of graphic object CData to the figure colormap CLimMode Automatic or manual control of CLim property ColorOrder Line color autocycle order LineStyleOrder Line styles autocycle order (not a color, but related to ColorOrder) Colors Controlled by Axes 9-23 Changing the Color Scheme Suppose you want an axes to use a “black-on-white” color scheme. First, change the background to white and the axis lines, grid, tick marks, and tick mark labels to black. set(gca,'Color','w',... 'XColor','k',... 'YColor','k',... 'ZColor','k') Next, change the color of the text objects used for the title and axis labels. set(get(gca,'Title'),'Color','k') set(get(gca,'XLabel'),'Color','k') set(get(gca,'YLabel'),'Color','k') set(get(gca,'ZLabel'),'Color','k') Changing the figure background color to white completes the new color scheme. set(gcf,'Color','w') When you are done, a figure containing a mesh plot looks like the following figure. 9 Axes Properties 9-24 You can define default values for the appropriate properties and put these definitions in your startup.m file. Titles and axis labels are text objects, so you must set a default color for all text objects, which is a good idea anyway since the default text color of white is not visible on the white background. Lines created with the low-level line function (but not the plotting routines) also have a default color of white, so you should change the default line color as well. To set default values on the root level, use. set(0,'DefaultFigureColor','w' 'DefaultAxesColor','w',... 'DefaultAxesXColor','k',... 'DefaultAxesYColor','k',... 'DefaultAxesZColor','k',... 'DefaultTextColor','k',... 'DefaultLineColor','k') MATLAB colors other axes children (i.e., image, patch, and surface objects) according to the values of their CData properties and the figure colormap. −2 −1 0 1 2 −2 −1 0 1 2 −0.5 0 0.5 Z = Ae −x 2 −y 2 Range In X Range In Y Values of Z Colors Controlled by Axes 9-25 Axes Color Limits – The CLim Property Many of the 3-D graphics functions produce graphs that use color as another data dimension. For example, surface plots map surface height to color. The color limits control the limits of the color dimension in a way analogous to setting axis limits. The axes CLim property controls the mapping of image, patch, and surface CData to the figure colormap. CLim is a two-element vector [cmin cmax] specifying the CData value to map to the first color in the colormap ( cmin ) and the CData value to map the last color in the colormap ( cmax ). Data values in between are linearly transformed from the second to the next to last color, using the expression colormap_index = fix((CDatacmin)/(cmaxcmin)*cm_length)+1 cm_length is the length of the colormap. When CLimMode is auto , MATLAB sets CLim to the range of the CData of all graphics objects within the axes. However, you can set CLim to span any range of values. This allows individual axes within a single figure to use different portions of the figure’s colormap. You can create colormaps with different regions, each used by a different axes. See the caxis Example – Simulating Multiple Colormaps in a Figure Suppose you want to display two different surfaces in the same figure and color each surface with a different colormap. You can produce the effect of two different colormaps by concatenating two colormaps together and then setting the CLim property of each axes to map into a different portion of the colormap. This example creates two surfaces from the same topographic data. One uses the color scheme of a typical atlas – shades of blue for the ocean and greens for the land. The other surface is illuminated with a light source to create the illusion of a three-dimensional picture. Such illumination requires a colormap that changes monotonically from dark to light. 9 Axes Properties 9-26 Calculating Color Limits The key to this example is calculating values for CLim that cause each surface to use the section of the colormap containing the appropriate colors. To calculate the new values for CLim , you need to know: •The total length of the colormap ( CmLength ) •The beginning colormap slot to use for each axes ( BeginSlot) •The ending colormap slot to use for each axes ( EndSlot ) Colors Controlled by Axes 9-27 •The minimum and maximum CData values of the graphic objects contained in the axes. That is, the values of the axes CLim property determined by MATLAB when CLimMode is auto ( CDmin and CDmax ). First, define subplots regions, and plot the surfaces. ax1 = subplot(2,1,1); view([0 80]) surf(topodata) ax2 = subplot(2,1,2),; view([0 80]); surfl(topodata,[60 0]) Concatenate two colormaps together and install the new colormap. colormap([Lightingmap;Atlasmap]); Obtain the data you need to calculate new values for CLim . CmLength = size(get(gcf,'Colormap'),1);% Colormap length BeginSlot1 = 1;% Begining slot EndSlot1 = size(Lightingmap,1); % Ending slot BeginSlot2 = EndSlot1+1; EndSlot2 = CmLength; CLim1 = get(ax1,'CLim');% CLim values for each axis CLim2 = get(ax2,'CLim'); Defining a Function to Calculate CLim Values Computing new values for CLim involves determining the portion of the colormap you want each axes to use relative to the total colormap size and scaling its Clim range accordingly. You can define a MATLAB function to do this. f unction CLim = newclim(BeginSlot,EndSlot,CDmin,CDmax,CmLength) % Convert slot number and range % to percent of colormap PBeginSlot = (BeginSlot 1) / (CmLength 1); PEndSlot = (EndSlot 1) / (CmLength 1); PCmRange = PEndSlot PBeginSlot; % Determine range and min and max 9 Axes Properties 9-28 % of new CLim values DataRange = CDmax CDmin; ClimRange = DataRange / PCmRange; NewCmin = CDmin (PBeginSlot * ClimRange); NewCmax = CDmax + (1 PEndSlot) * ClimRange; CLim = [NewCmin,NewCmax]; The input arguments are identified in the bulleted list above. The M-file first computes the percentage of the total colormap you want to use for a particular axes ( PCmRange ) and then computes the CLim range required to use that portion of the colormap given the CData range in the axes. Finally, it determines the minimum and maximum values required for the calculated CLim range and return these values. These values are the color limits for the given axes. Using the Function Use the newclim M-file to set the CLim values of each axes. The statement, set(ax1,'CLim',newclim(65,120,clim1(1),clim1(2))) sets the CLim values for the first axes so the surface uses color slots 65 to 120. The lit surface uses the lower 64 slots. You need to reset its CLim values as well. set(ax2,'CLim',newclim(1,64,clim1(1),clim1(2))) How the Function Works MATLAB enables you to specify any values for the axes CLim property, even if these values do not correspond to the CData of the graphics objects displayed in the axes. MATLAB always maps the minimum CLim value to the first color in the colormap and the maximum CLim value to the last color in the colormap, whether or not there are really any CData values corresponding to these colors. Therefore, if you specify values for CLim that extend beyond the object’s actual CData minimum and maximum, MATLAB colors the object with only a subset of the colormap. The newclim M-file computes values for CLim that map the graphics object’s actual CData values to the beginning and ending colormap slots you specify. It does this by defining a “virtual” graphics object having the computed CLim values. The following picture illustrates this concept. It shows a side view of two surfaces to make it easier to visualize the mapping of color to surface topography. The virtual surface is on the left and the actual surface on the right. In the center is the figure’s colormap. Colors Controlled by Axes 9-29 The real surface has CLim values of [0.4 0.4] . To color this surface with slots 65 to 120, newclim computed new CLim values of [0.4 1.4269] . The virtual surface on the left represents these values. Defining the Color of Lines for Plotting The axes ColorOrder property determines the color of the individual lines drawn by the plot and plot3 functions. For multiline graphs, these functions cycle through the colors defined by ColorOrder , repeating the cycle when reaching the end of the list. The colordef command defines various color order schemes for different background colors. colordef is typically called in the matlabrc file, which is executed during MATLAB startup. Virtual surface mapped to entire 120 slot colormap Figure Colormap Real surface using only color slots 65 to 120 9 Axes Properties 9-30 You can redefine ColorOrder to be any m-by-3 matrix of RGB values, where m is the number of colors. However, high-level functions like plot and plot3 reset most axes properties (including ColorOrder ) to the defaults each time you call them. To use your own ColorOrder definition you must take one of the following three steps: •Define a default ColorOrder on the figure or root level, or •Change the axes NextPlot or replacechildren , or •Use the informal form of the line function, which obeys the ColorOrder but does not clear the axes or reset properties Changing the Default ColorOrder. You can define a new ColorOrder that MATLAB uses within a particular figure, for all axes within any figures created during the MATLAB session, or as a user-defined default that MATLAB always uses. To change the ColorOrder for all plots in the current figure, set a default in that figure. For example, to set ColorOrder to the colors red, green, and blue, use the statement, set(gcf,'DefaultAxesColorOrder',[1 0 0;0 1 0;0 0 1]) To define a new ColorOrder that MATLAB uses for all plotting during your entire M ATLAB session, set a default on the root level so axes created in any figure use your defaults. set(0,'DefaultAxesColorOrder',[1 0 0;0 1 0;0 0 1]) To define a new ColorOrder that MATLAB always uses, place the previous statement in your startup.m file. Setting the NextPlot Property. The axes NextPlot property determines how high-level graphics functions draw into an existing axes. You can use this property to prevent plot and plot3 from resetting the ColorOrder property each time you call them, but still clear the axes of any existing plots. By default, NextPlot is set to replace , which is equivalent to a cla reset command (i.e., delete all axes children and reset all properties, except Position , to their defaults). If you set NextPlot to replacechildren , set(gca,'NextPlot','replacechildren') Colors Controlled by Axes 9-31 MATLAB deletes the axes children, but does not reset axes properties. This is equivalent to a cla command without the reset . After setting NextPlot to replacechildren , you can redefine the ColorOrder property and call plot and plot3 without affecting the ColorOrder . Setting NextPlot is the equivalent of issuing the hold on command. This setting prevents MATLAB from resetting the ColorOrder property, but it does not clear the axes children with each call to a plotting function. Using the line Function. The behavior of the line function depends on its calling syntax. When you use the informal form (which does not include any explicit property definitions). line(x,y,z) line obeys the ColorOrder property, but does not clear the axes with each invocation or change the view to 3-D (as plot3 does). However, line can be useful for creating your own plotting functions where you do not want the automatic behavior of plot or plot3 , but you do want multiline graphs to use a particular ColorOrder . Line Styles Used for Plotting – LineStyleOrder The axes LineStyleOrder property is analogous to the ColorOrder property. It specifies the line styles to use for multiline plots created with the plot and plot3 functions. MATLAB increments the line style only after using all of the colors in the ColorOrder property. It then uses all the colors again with the second line style, and so on. For example, define a default ColorOrder of red, green, and blue and a default LineStyleOrder of solid, dashed, and dotted lines. set(0,'DefaultAxesColorOrder',[1 0 0;0 1 0;0 0 1],... 'DefaultAxesLineStyleOrder','-|--|:') Then plot some multiline data. t = 0:pi/20:2*pi; a = ones(length(t),9); for i = 1:9 a(:,i) = sin(t-i/5)'; end plot(t,a) 9 Axes Properties 9-32 MATLAB cycles through all colors for each line style. 0 1 2 3 4 5 6 7 −1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1 3-D Visualization This section discusses visualization techniques and illustrates the application of these techniques to specific types of data. Related Information The following section provide information that is useful in understanding the techniques described in this section. Creating 3-D Graphs 3-D line and surface graphs Defining the View Control camera, zooming, projection, compose a scene, control the aspect ratio of the axes Lighting as a Visualization Tool Lighting effects you can employ to add realism and improve shape definition in 3-D views Transparency Various techniques for making objects translucent Creating 3-D Models with Patches Define 3-D shell representations of physical shapes using patch objects Volume Visualization Techniques Visualize gridded 3-D volume data (both scalar and vector) Graphics Fundamentals of plotting in MATLAB, including standard plotting routines (line plots, pie charts, histograms, etc.), graph formatting and annotation. It also covers graphics object hierarchy, manipulating object properties, and the use of important figure and axes properties. 10 Creating 3-D Graphs A Typical 3-D Graph (p.10-2) The steps to follow to create a typical 3-D graph. Line Plots of 3-D Data (p.10-3) Lines plots of data having x-, y-, and z-coordinates. Representing a Matrix as a Surface (p.10-5) Graphing matrix (2-D array) data on a rectangular grid. Coloring Mesh and Surface Plots (p.10-13) Techniques for coloring surface and mesh plots, including colormaps, truecolor, and texture mapping. 10 Creating 3-D Graphs 10-2 A Typical 3-D Graph This table illustrates typical steps involved in producing 3-D scenes containing either data graphs or models of 3-D objects. Example applications include pseudocolor surfaces illustrating the values of functions over specific regions and objects drawn with polygons and colored with light sources to produce realism. Usually, you follow either step 4 or step 5. Step Typical Code 1 Z = peaks(20); 2 Select window and position plot region within window figure(1) subplot(2,1,2) 3 Call 3-D graphing function h = surf(Z); 4 colormap hot set(h,'EdgeColor','k') 5 light('Position',[-2,2,20]) lighting phong material([0.4,0.6,0.5,30]) set(h,'FaceColor',[0.7 0.7 0],... 'BackFaceLighting','lit') 6 Set viewpoint view([30,25]) set(gca,'CameraViewAngleMode','Manual') 7 Set axis limits and tick marks axis([5 15 5 15 8 8]) set(gca,'ZTickLabel','Negative||Positive') 8 Set aspect ratio set(gca,'PlotBoxAspectRatio',[2.5 2.5 1]) 9 Annotate the graph with axis labels, legend, and text xlabel('X Axis') ylabel('Y Axis') zlabel('Function Value') title('Peaks') 10 Print graph set(gcf,'PaperPositionMode','auto') print dps2 Line Plots of 3-D Data 10-3 Line Plots of 3-D Data The 3-D analog of the plot function is plot3 . If x , y , and z are three vectors of the same length, plot3(x,y,z) generates a line in 3-D through the points whose coordinates are the elements of x , y , and z and then produces a 2-D projection of that line on the screen. For example, these statements produce a helix. t = 0:pi/50:10*pi; plot3(sin(t),cos(t),t) axis square; grid on Plotting Matrix Data If the arguments to plot3 are matrices of the same size, MATLAB plots lines obtained from the columns of X , Y , and Z . For example, [X,Y] = meshgrid([2:0.1:2]); −1 −0.5 0 0.5 1 −1 −0.5 0 0.5 1 0 10 20 30 40 10 Creating 3-D Graphs 10-4 Z = X.*exp(X.^2Y.^2); plot3(X,Y,Z) grid on Notice how MATLAB cycles through line colors. −2 −1 0 1 2 −2 −1 0 1 2 −0.5 0 0.5 Representing a Matrix as a Surface 10-5 Representing a Matrix as a Surface MATLAB defines a surface by the z-coordinates of points above a rectangular grid in the x-y plane. The plot is formed by joining adjacent points with straight lines. Surface plots are useful for visualizing matrices that are too large to display in numerical form and for graphing functions of two variables. MATLAB can create different forms of surface plots. Mesh plots are wire-frame surfaces that color only the lines connecting the defining points. Surface plots display both the connecting lines and the faces of the surface in color. This table lists the various forms. Mesh and Surface Plots The mesh and surf commands create 3-D surface plots of matrix data. If Z is a matrix for which the elements Z(i,j) define the height of a surface over an underlying (i,j) grid, then mesh(Z) generates a colored, wire-frame view of the surface and displays it in a 3-D view. Similarly, surf(Z) generates a colored, faceted view of the surface and displays it in a 3-D view. Ordinarily, the facets are quadrilaterals, each of which is a constant color, Function Used to Create mesh, surf Surface plot meshc, surfc Surface plot with contour plot beneath it meshz Surface plot with curtain plot (reference plane) pcolor Flat surface plot (value is proportional only to color) surfl Surface plot illuminated from specified direction surface Low-level function (on which high-level functions are based) for creating surface graphics objects 10 Creating 3-D Graphs 10-6 outlined with black mesh lines, but the shading command allows you to eliminate the mesh lines ( ) or to select interpolated shading across the facet ( ). Surface object properties provide additional control over the visual appearance of the surface. You can specify edge line styles, vertex markers, face coloring, lighting characteristics, and so on. Visualizing Functions of Two Variables The first step in displaying a function of two variables, z = f(x,y) , is to generate X and Y matrices consisting of repeated rows and columns, respectively, over the domain of the function. Then use these matrices to evaluate and graph the function. The meshgrid function transforms the domain specified by two vectors, x and y , into matrices, X and Y . You then use these matrices to evaluate functions of two variables. The rows of X are copies of the vector x and the columns of Y are copies of the vector y . To illustrate the use of meshgrid , consider the sin(r)/r or sinc function. To evaluate this function between –8 and 8 in both x and y , you need pass only one vector argument to meshgrid , which is then used in both directions. [X,Y] = meshgrid(8:.5:8); R = sqrt(X.^2 + Y.^2) + eps; The matrix R contains the distance from the center of the matrix, which is the origin. Adding eps prevents the divide by zero (in the next step) that produces Inf values in the data. Forming the sinc function and plotting Z with mesh results in the 3-D surface. Z = sin(R)./R; mesh(X,Y,Z) Representing a Matrix as a Surface 10-7 Emphasizing Surface Shape MATLAB provides a number of techniques that can enhance the information content of your graphs. For example, this graph of the sinc function uses the same data as the previous graph, but employs lighting and view adjustment to emphasize the shape of the graphed function ( daspect , axis , camlight , view ). surf(X,Y,Z,'FaceColor','interp',... 'EdgeColor','none',... 'FaceLighting','phong') daspect([5 5 1]) axis tight view(-50,30) camlight left −10 −5 0 5 10 −10 −5 0 5 10 −0.5 0 0.5 1 10 Creating 3-D Graphs 10-8 See the surf function for more information on surface plots. Surface Plots of Nonuniformly Sampled Data You can use meshgrid to create a grid of uniformly sampled data points at which to evaluate and graph the sinc function. MATLAB then constructs the surface plot by connecting neighboring matrix elements to form a mesh of quadrilaterals. To produce a surface plot from nonuniformly sampled data, first use griddata to interpolate the values at uniformly spaced points, and then use mesh and surf in the usual way. Example– Displaying Nonuniform Data on a Surface This example evaluates the sinc function at random points within a specific range and then generates uniformly sampled data for display as a surface plot. The process involves these steps: •Use linspace to generate evenly spaced values over the range of your unevenly sampled data. Representing a Matrix as a Surface 10-9 •Use meshgrid to generate the plotting grid with the output of linspace . •Use griddata to interpolate the irregularly sampled data to the regularly spaced grid returned by meshgrid . •Use a plotting function to display the data. 1 First, generate unevenly sampled data within the range [8, 8] and use it to evaluate the function. x = rand(100,1)*16 8; y = rand(100,1)*16 8; r = sqrt(x.^2 + y.^2) + eps; z = sin(r)./r; 2 The linspace function provides a convenient way to create uniformly spaced data with the desired number of elements. The following statements produce vectors over the range of the random data with the same resolution as that generated by the 8:.5:8 statement in the previous sinc example. xlin = linspace(min(x),max(x),33); ylin = linspace(min(y),max(y),33); 3 Now use these points to generate a uniformly spaced grid. [X,Y] = meshgrid(xlin,ylin); 4 The key to this process is to use griddata to interpolate the values of the function at the uniformly spaced points, based on the values of the function at the original data points (which are random in this example). This statement uses a triangle-based cubic interpolation to generate the new data. Z = griddata(x,y,z,X,Y,'cubic'); 5 Plotting the interpolated and the nonuniform data produces mesh(X,Y,Z) %interpolated axis tight; hold on plot3(x,y,z,'.','MarkerSize',15) %nonuniform 10 Creating 3-D Graphs 10-10 Parametric Surfaces The functions that draw surfaces can take two additional vector or matrix arguments to describe surfaces with specific x and y data. If Z is an m-by-n matrix, x is an n-vector, and y is an m-vector, then mesh(x,y,Z,C) describes a mesh surface with vertices having color C(i,j) and located at the points (x(j), y(i), Z(i,j)) where x corresponds to the columns of Z and y to its rows. More generally, if X, Y, Z , and C are matrices of the same dimensions, then mesh(X,Y,Z,C) describes a mesh surface with vertices having color C(i,j) and located at the points (X(i,j), Y(i,j), Z(i,j)) −5 0 5 −5 0 5 0 0.5 Representing a Matrix as a Surface 10-11 This example uses spherical coordinates to draw a sphere and color it with the pattern of pluses and minuses in a Hadamard matrix, an orthogonal matrix used in signal processing coding theory. The vectors theta and phi are in the range theta and /2 phi /2 . Because theta is a row vector and phi is a column vector, the multiplications that produce the matrices X , Y , and Z are vector outer products. k = 5; n = 2^k 1; theta = pi*( n:2:n)/n; phi = (pi/2)*( n:2:n)'/n; X = cos(phi)*cos(theta); Y = cos(phi)*sin(theta); Z = sin(phi)*ones(size(theta)); colormap([0 0 0;1 1 1]) surf(X,Y,Z,C) axis square −1 −0.5 0 0.5 1 −1 −0.5 0 0.5 1 −1 −0.5 0 0.5 1 10 Creating 3-D Graphs 10-12 Hidden Line Removal By default, MATLAB removes lines that are hidden from view in mesh plots, even though the faces of the plot are not colored. You can disable hidden line removal and allow the faces of a mesh plot to be transparent with the command hidden off This is the surface plot with hidden set to off . −10 −5 0 5 10 −10 −5 0 5 10 −0.5 0 0.5 1 Coloring Mesh and Surface Plots 10-13 Coloring Mesh and Surface Plots You can enhance the information content of surface plots by controlling the way MATLAB applies color to these plots. MATLAB can map particular data values to colors specified explicitly or can map the entire range of data to a predefined range of colors called a colormap. Coloring Techniques There are three coloring techniques: •Indexed Color – MATLAB colors the surface plot by assigning each data point an index into the figure’s colormap. The way MATLAB applies these colors depends on the type of shading used (faceted, flat, or interpolated). •Truecolor – MATLAB colors the surface plot using the explicitly specified colors (i.e., the RGB triplets). The way MATLAB applies these colors depends on the type of shading used (faceted, flat, or interpolated). To be rendered accurately, truecolor requires computers with 24-bit displays; however, MATLAB simulates truecolor on indexed systems. See the shading command for information on the types of shading. •Texture Mapping – Texture mapping diplays a 2-D image mapped onto a 3-D surface. Types of Color Data The type of color data you specify (i.e., single values or RGB triplets) determines how MATLAB interprets it. When you create a surface plot, you can: •Provide no explicit color data, in which case MATLAB generates colormap indices from the z-data. •Specify an array of color data that is equal in size to the z- data and is used for indexed colors. •Specify an m-by-n-by-3 array of color data that defines an RGB triplet for each element in the m-by-n z-data array and is used for truecolor. 10 Creating 3-D Graphs 10-14 Colormaps Each MATLAB figure window has a colormap associated with it. A colormap is simply a three-column matrix whose length is equal to the number of colors it defines. Each row of the matrix defines a particular color by specifying three values in the range 0 to 1. These values define the RGB components (i.e., the intensities of the red, green, and blue video components). The colormap function, with no arguments, returns the current figure’s colormap. For example, the MATLAB default colormap contains 64 colors and the 57th color is red. cm = colormap; cm(57,:) ans = 1 0 0 RGB Color Components This table lists some representative RGB color definitions. Red Green Blue Color 0 0 0 black 1 1 1 white 1 0 0 red 0 1 0 green 0 0 1 blue 1 1 0 yellow 1 0 1 magenta 0 1 1 cyan 0.5 0.5 0.5 gray 0.5 0 0 dark red Coloring Mesh and Surface Plots 10-15 You can create colormaps with MATLAB ’s array operations or you can use any of several functions that generate useful maps, including hsv , hot , cool , summer , and gray . Each function has an optional parameter that specifies the number of rows in the resulting map. For example, hot(m) creates an m-by-3 matrix whose rows specify the RGB intensities of a map that varies from black, through shades of red, orange, and yellow, to white. If you do not specify the colormap length, MATLAB creates a colormap the same length as the current colormap. The default colormap is jet(64) . If you use long colormaps (> 64 colors) in each of several figures windows, it may become necessary for the operating system to swap in different color lookup tables as the active focus is moved among the windows. See “Controlling How MATLAB Uses Color” in the “Figure Properties” chapter for more information on how MATLAB manages color. Displaying Colormaps The colorbar function displays the current colormap, either vertically or horizontally, in the figure window along with your graph. For example, the statements [x,y] = meshgrid([2:.2:2]); Z = x.*exp(x.^2y.^2); colorbar produce a surface plot and a vertical strip of color corresponding to the colormap. Note how the colorbar indicates the mapping of data value to color with the axis labels. 1 0.62 0.40 copper 0.49 1 0.83 aquamarine Red Green Blue Color 10 Creating 3-D Graphs 10-16 Indexed Color Surfaces – Direct and Scaled Colormapping MATLAB can use two different methods to map indexed color data to the colormap – direct and scaled. Direct Mapping Direct mapping uses the color data directly as indices into the colormap. For example, a value of 1 points to the first color in the colormap, a value of 2 points to the second color, and so on. If the color data is noninteger, MATLAB rounds it towards zero. Values greater than the number of colors in the colormap are set equal to the last color in the colormap (i.e., the number length(colormap) ). Values less than 1 are set to 1. Scaled Mapping Scaled mapping uses a two-element vector [cmin cmax] (specified with the caxis command) to control the mapping of color data to the figure colormap. cmin specifies the data value to map to the first color in the colormap and cmax specifies the data value to map to the last color in the colormap. Data values in −2 −1 0 1 2 −2 −1 0 1 2 −0.5 0 0.5 −0.05 0 0.05 0.1 0.15 Coloring Mesh and Surface Plots 10-17 between are linearly transformed from the second to the next-to-last color, using the expression. colormap_index = fix((color_datacmin)/(cmaxcmin)*cm_length)+1 cm_length is the length of the colormap. By default, MATLAB sets cmin and cmax to span the range of the color data of all graphics objects within the axes. However, you can set these limits to any range of values. This enables you to display multiple axes within a single figure window and use different portions of the figure’s colormap for each one. See the “Calculating Color Limits” section in the “Axes Properties” chapter for an example that uses color limits. By default, MATLAB uses scaled mapping. To use direct mapping, you must turn off scaling when you create the plot. For example, surf(Z,C,'CDataMapping','direct') See surface Specifying Indexed Colors When creating a surface plot with a single matrix argument, surf(Z) for example, the argument Z specifies both the height and the color of the surface. MATLAB transforms Z to obtain indices into the current colormap. With two matrix arguments, the statement surf(Z,C) independently specifies the color using the second argument. Example – Mapping Surface Curvature to Color The Laplacian of a surface plot is related to its curvature; it is positive for functions shaped like i^2 + j^2 and negative for functions shaped like (i^2 + j^2) . The function del2 computes the discrete Laplacian of any matrix. For example, use del2 to determine the color for the data returned by peaks . P = peaks(40); C = del2(P); surf(P,C) colormap hot 10 Creating 3-D Graphs 10-18 Creating a color array by applying the Laplacian to the data is useful because it causes regions with similar curvature to be drawn in the same color. Compare this surface coloring with that produced by the statements surf(P) colormap hot which use the same colormap, but maps regions with similar z value (height above the x-y plane) to the same color. 0 10 20 30 40 0 10 20 30 40 −10 −5 0 5 10 surf(P,del2(P)) Coloring Mesh and Surface Plots 10-19 Altering Colormaps Because colormaps are matrices, you can manipulate them like other arrays. The brighten function takes advantage of this fact to increase or decrease the intensity of the colors. Plotting the values of the R, G, and B components of a colormap using rgbplot illustrates the effects of brighten . 0 10 20 30 40 0 10 20 30 40 −10 −5 0 5 10 surf(P) 0 10 20 30 40 50 60 70 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 10 20 30 40 50 60 70 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 10 20 30 40 50 60 70 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 brighten(copper,0.5) brighten(copper,0.5)copper 10 Creating 3-D Graphs 10-20 NTSC Color Encoding The brightness component of television signals uses the NTSC color encoding scheme. b = .30*red + .59*green + .11*blue = sum(diag([.30 .59 .11])*map')'; Using the nonlinear grayscale map, colormap([b b b]) effectively converts a color image to its NTSC black-and-white equivalent. Truecolor Surfaces Computer systems with 24-bit displays are capable of displaying over 16 million (2 24 ) colors, as opposed to the 256 colors available on 8-bit displays. You can take advantage of this capability by defining color data directly as RGB values and eliminating the step of mapping numerical values to locations in a colormap. Specify truecolor using an m-by-n-by-3 array, where the size of Z is m-by-n. For example, the statements Z = peaks(25); C(:,:,1) = rand(25); C(:,:,2) = rand(25); Red Green Blue m-by-n matrix defining Corresponding m-by-n-by-3 matrix specifying truecolor for the surface plot surface plot Coloring Mesh and Surface Plots 10-21 C(:,:,3) = rand(25); surf(Z,C) create a plot of the peaks matrix with random coloring. You can set surface properties as with indexed color. surf(Z,C,'FaceColor','interp','FaceLighting','phong') camlight right 10 Creating 3-D Graphs 10-22 Rendering Method for Truecolor MATLAB always uses either OpenGL or the zbuffer render method when displaying truecolor. If the figure RendererMode property is set to auto , MATLAB automatically switches the value of the Renderer property to zbuffer whenever you specify truecolor data. If you explicitly set Renderer to painters (this sets RendererMode to manual ) and attempt to define an image, patch, or surface object using truecolor, MATLAB returns a warning and does not render the object. See the image , patch , and surface functions for information on defining truecolor for these objects. Simulating Truecolor – Dithering You can use truecolor on computers that do not have 24-bit displays. In this case, MATLAB uses a special colormap designed to produce results that are as close as possible, given the limited number of colors available. See “Dithering Truecolor on Indexed Color Systems” in the “Figure Properties” chapter for more information on the use of a dithermap. Coloring Mesh and Surface Plots 10-23 Texture Mapping Texture mapping is a technique for mapping a 2-D image onto a 3-D surface by transforming color data so that it conforms to the surface plot. It allows you to apply a “texture,” such as bumps or wood grain, to a surface without performing the geometric modeling necessary to create a surface with these features. The color data can also be any image, such as a scanned photograph. Texture mapping allows the dimensions of the color data array to be different from the data defining the surface plot. You can apply an image of arbitrary size to any surface. MATLAB interpolates texture color data so that it is mapped to the entire surface. Example – Texture Mapping a Surface This example creates a spherical surface using the sphere function and texture maps it with an image of the earth taken from space. Because the earth image is a view of earth from one side, this example maps the image to only one side of the sphere, padding the image data with 1s. In this case, the image data is a 257-by-250 matrix so it is padded equally on each side with two 257-by-125 matrices of 1s by concatenating the three matrices together. To use texture mapping, set the FaceColor to texturemap and assign the image to the surface’s CData . sphere; h = findobj('Type','surface'); hemisphere = [ones(257,125),... X,... ones(257,125)]; set(h,'CData',flipud(hemisphere),'FaceColor','texturemap') colormap(map) axis equal view([90 0]) set(gca,'CameraViewAngleMode','manual') view([65 30]) 10 Creating 3-D Graphs 10-24 11 Defining the View Viewing Overview (p.11-2) Overview of topics covered in this chapter. Setting the Viewpoint with Azimuth and Elevation (p.11-4) Using the simple azimuth and elevation view model to define the viewpoint. Includes definition and examples. Defining Scenes with Camera Graphics (p.11-8) Using the camera view model to control 3-D scenes. Illustration defines terms. View Control with the Camera Toolbar (p.11-9) Camera tools provide a set of functionality for manipulating 3-D scenes. Camera Graphics Functions (p.11-21) Functions that control the camera view model. Example — Dollying the Camera (p.11-22) Example illustrates how to reposition a scene when the user clicks over an image. Example — Moving the Camera Through a Scene (p.11-24) Example illustrates how to move a camera through a scene along a path traced by a stream line. Also show how to move a light source with the camera. Low-Level Camera Properties (p.11-30) Description of the graphic object properties that control the camera. View Projection Types (p.11-36) Orthographic and perspective project types compared and illustrated. Also, the interaction between camera properties and projection type. Understanding Axes Aspect Ratio (p.11-41) How MATLAB determines the axes aspect ratio for graphs. Also, how you can specify aspect ratio. Axes Aspect Ratio Properties (p.11-46) Axes properties that control the aspect ratio and how to set them to achieve particular results. 11 Defining the View 11-2 Viewing Overview The view is the particular orientation you select to display your graph or graphical scene. The term viewing refers to the process of displaying a graphical scene from various directions, zooming in or out, changing the perspective and aspect ratio, flying by, and so on. This section describes how to define the various viewing parameters to obtain the view you want. Generally, viewing is applied to 3-D graphs or models, although you may want to adjust the aspect ratio of 2-D views to achieve specific proportions or make a graph fit in a particular shape. MATLAB viewing is composed of two basic areas: •Positioning the viewpoint to orient the scene •Setting the aspect ratio and relative axis scaling to control the shape of the objects being displayed Positioning the Viewpoint •Setting the Viewpoint — discusses how to specify the point from which you view a graph in terms of azimuth and elevation. This is conceptually simple, but does have limitations. •Defining Scenes with Camera Graphics, View Control with the Camera Toolbar, and Camera Graphics Functions — describe how to compose complex scenes using the MATLAB camera viewing model. •Dollying the Camera and Moving the Camera Through a Scene — illustrate programming techniques for moving the view around and through scenes. •Low-Level Camera Properties — lists the graphics properties that control the camera and illustrates the effects they cause. Setting the Aspect Ratio •View Projection Types — discusses orthographic and perspective projection types and illustrates their use. •Understanding Axes Aspect Ratio and Axes Aspect Ratio Properties — describe how MATLAB sets the aspect ratio of the axes and how you can select the most appropriate setting for your graphs. Viewing Overview 11-3 Default Views MATLAB automatically sets the view when you create a graph. The actual view that MATLAB selects depends on whether you are creating a 2- or 3-D graph. See “Default Viewpoint Selection” on page 11-31 and “Default Aspect Ratio Selection” on page 11-47 for a description of how MATLAB defines the standard view. 11 Defining the View 11-4 Setting the Viewpoint with Azimuth and Elevation MATLAB enables you to control the orientation of the graphics displayed in an axes. You can specify the viewpoint, view target, orientation, and extent of the view displayed in a figure window. These viewing characteristics are controlled by a set of graphics properties. You can specify values for these properties directly or you can use the view command and rely on MATLAB automatic property selection to define a reasonable view. Azimuth and Elevation The view command specifies the viewpoint by defining azimuth and elevation with respect to the axis origin. Azimuth is a polar angle in the x-y plane, with positive angles indicating counter-clockwise rotation of the viewpoint. Elevation is the angle above (positive angle) or below (negative angle) the x-y plane. This diagram illustrates the coordinate system. The arrows indicate positive directions. Default 2-D and 3-D Views MATLAB automatically selects a viewpoint that is determined by whether the plot is 2-D or 3-D: Center of Viewpoint z x y Azimuth Elevation -y Plot Box Setting the Viewpoint with Azimuth and Elevation 11-5 •For 2-D plots, the default is azimuth = 0° and elevation = 90°. •For 3-D plots, the default is azimuth = 37.5° and elevation = 30°. Examples of Views Specified with Azimuth and Elevation For example, these statements create a 3-D surface plot and display it in the default 3-D view. [X,Y] = meshgrid([2:.25:2]); Z = X.*exp(X.^2 Y.^2); surf(X,Y,Z) The statement view([180 0]) sets the viewpoint so you are looking in the negative y-direction with your eye at the z = 0 elevation. −2 −1 0 1 2 −2 −1 0 1 2 −0.5 0 0.5 x−axis Azimuth = −37.5 Elevation = 30 y−axis z−axis 11 Defining the View 11-6 You can move the viewpoint to a location below the axis origin using a negative elevation. view([37.5 30]) −2 −1 0 1 2 −0.5 0 0.5 x−axis Azimuth = 180 Elevation = 0 z−axis −2 −1 0 1 2 −2 −1 0 1 2 −0.5 0 0.5 y−axis Azimuth = −37.5 Elevation = −30 x−axis z−axis Setting the Viewpoint with Azimuth and Elevation 11-7 Limitations of Azimuth and Elevation Specifying the viewpoint in terms of azimuth and elevation is conceptually simple, but it has limitations. It does not allow you to specify the actual position of the viewpoint, just its direction, and the z-axis is always pointing up. It does not allow you to zoom in and out on the scene or perform arbitrary rotations and translations. MATLAB camera graphics provides greater control than the simple adjustments allowed with azimuth and elevation. The following sections discusses how to use camera properties to control the view. 11 Defining the View 11-8 Defining Scenes with Camera Graphics When you look at the graphics objects displayed in an axes, you are viewing a scene from a particular location in space that has a particular orientation with regard to the scene. MATLAB provides functionality, analogous to that of a camera with a zoom lens, that enables you to control the view of the scene created by MATLAB. This picture illustrates how the camera is defined in terms of properties of the axes. 0 0.5 1 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 CameraPosition CameraViewAngle CameraTarget Axes plot box CameraUpVector projected onto film plane Viewing Axis Axes position rectangle View Control with the Camera Toolbar 11-9 View Control with the Camera Toolbar The Camera Toolbar enables you to perform a number of viewing operations interactively. To use the Camera Toolbar: •Display the toolbar by selecting Camera Toolbar from the figure window’s View •Select the type of camera motion control you want to use. •Position the cursor over the figure window and click, hold down the right mouse button, then move the cursor in the desired direction. MATLAB updates the display immediately as you move the mouse. Camera Toolbar The toolbar contains the following parts: •Camera Motion Controls — these tools select which camera motion function to enable. You can also access the camera motion controls from the Tools •Principal Axis Selector — some camera controls operate with respect to a particular axis. These selectors enable you to select the principal axis or to select non-axis constrained motion. The selectors are grayed out when not applicable to the currently selected function. You can also access the principal axis selector from the Tools •Scene Light — The scene light button toggles a light source on or off in the scene (one light per axes). •Projection Type — You can select orthographic or perspective projection types. •Reset and Stop — Reset returns the scene to the standard 3-D view. Stop causes the camera to stop moving (this can be useful if you apply too much Camera Motion Controls Principal Axis Selector Scene Light Projection Type Reset and Stop 11 Defining the View 11-10 cursor movement). You can also access the an expanded set of reset functions from the Tools Principal Axes The principal axis of a scene defines the direction that is oriented upward on the screen. For example, a MATLAB surface plot aligns the up direction along the positive z axis. Principal axes constrain camera-tool motion along axes that are (on the screen) parallel and perpendicular to the principal axis that you select. Specifying a principal axis is useful if your data is define with respect to a specific axis. Z is the default principal axis, since this matches the MATLAB default 3-D view. Three of the camera tools (Orbit, Pan/Tilt, and Walk) allow you to select a principal axis, as well as axis-free motion. On the screen, the axes of rotation are determined by a vertical and a horizontal line, both of which pass through the point defined by the CameraTarget property and are parallel and perpendicular to the principal axis. For example, when the principal axis is z, movement occurs about: •A vertical line that passes through the camera target and is parallel to the z axis •A horizontal line that passes through the camera target and is perpendicular to the z axis This means the scene (or camera, as the case may be) moves in an arc whose center is at the camera target. The following picture illustrates the rotation axes for a z principal axis. View Control with the Camera Toolbar 11-11 The axes of rotation always pass through the camera target. Optimizing for 3-D Camera Motion When you create a plot, MATLAB displays it with an aspect ratio that fits the figure window. This behavior may not create an optimum situation for the manipulation of 3-D graphics as it can lead to distortion as you move the camera around scene. To avoid possible distortion, it is best to switch to a 3-D visualization mode (enabled from the command line with the command axis vis3d ). When using the camera toolbar, MATLAB automatically switches to the 3-D visualization mode, but warns you first with the following dialog box. Horizontal cursor motion results in rotation about the (blue) vertical axis. Vertical cursor motion causes rotation about the (red) horizontal axis. Z Principal axis Camera Target Cursor Motion 11 Defining the View 11-12 This dialog box appears only once per MATLAB session. For more information about the underlying effects of related camera properties, see the “Understanding Axes Aspect Ratio” section in this chapter. The next section “Camera Motion Controls” discusses how to use each tool. Camera Motion Controls This section discusses the individual camera motion functions selectable from the toolbar. Note When interpreting the following diagrams, keep in mind that the camera always points towards the camera target. See the “Defining Scenes with Camera Graphics” section in this chapter for an illustration of the graphics properties involved in camera motion. Orbit Camera Orbit Camera rotates the camera about the z-axis (by default). You can select x-, y-, z-, or free-axis rotation using the Principal Axis Selectors. When using no principal axis, you can rotate about an arbitrary axis. View Control with the Camera Toolbar 11-13 Graphics Properties. Orbit camera changes the CameraPosition property while keeping the CameraTarget fixed. Orbit Scene Light The scene light is a light source that is placed with respect to the camera position. By default, the scene light is positioned to the right of the camera (i.e., camlight right ). Orbit Scene Light changes the light’s offset from the camera position. There is only one scene light, however, you can add other lights using the light command. Toggle the scene light on and off by clicking on the yellow light bulb icon. 0 0.5 1 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 Cursor Motion X, Y, or Z Principal axis No principal Axis 11 Defining the View 11-14 Graphics Properties. Orbit Scene Light moves the scene light by changing the light’s Position property. Pan/Tilt Camera Pan/Tilt Camera moves the point in the scene that the camera points to while keeping the camera fixed. The movement occurs in an arc about the z-axis by default. You can select x-, y-, z-, or free-axis rotation using the Principal Axes Selectors. Graphics Properties. Pan/Tilt Camera moves the point in the scene that the camera is pointing to by changing the CameraTarget property. 0 0.5 1 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 Cursor Motion X, Y, or Z Principal axis No principal Axis View Control with the Camera Toolbar 11-15 Move Camera Horizontally/Vertically Moving the cursor horizontally or vertically (or any combination of the two) moves the scene in the same direction. Graphics Properties. The horizontal and vertical movement is achieved by moving the CameraPosition and the CameraTarget in unison along parallel lines. 0 0.5 1 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 Cursor Motion Vertical Horizontal 11 Defining the View 11-16 Move Camera Forward and Backwards Moving the cursor up or to the right moves the camera towards the scene. Moving the cursor down or to the left moves the camera away from the scene. It is possible to move the camera through objects in the scene and to the other side of the camera target. Graphics Properties. This function moves the CameraPosition along the line connecting the camera position and the camera target. Cursor Motion Closer to target Farther from target 0 0.5 1 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 View Control with the Camera Toolbar 11-17 Zoom Camera Zoom Camera makes the scene larger as you move the cursor up or to the right and smaller as you move the cursor down or to the left. Zooming does not move the camera and therefore cannot move the viewpoint through objects in the scene. Graphics Properties. Zoom is implemented by changing the CameraViewAngle . The larger the angle, the smaller the scene appears, and vice versa. 0 0.5 1 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 Cursor Motion Larger angle Smaller angle Camera View Angle 11 Defining the View 11-18 Camera Roll Camera Roll rotates the camera about the viewing axis, thereby rotating the view on the screen. Graphics Properties. Camera Roll changes the CameraUpVector 0 0.5 1 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 Cursor Motion Counterclockwise around camera target Clockwise around camera target Actual Camera Rotation Apparent View Rotation View Control with the Camera Toolbar 11-19 Walk Camera Walk Camera moves the camera in the direction of the camera target and moves the camera target by the same amount. It also pans the camera from side to side. Walk Camera enables you to move the camera through the scene, passing through objects that lie along the viewing axis. Walk Camera is somewhat analogous to driving a car while keeping your eyes pointed straight ahead. As you turn to the right, the objects in the scene move off to the left. Walk Camera is best used when viewing axis lies in a plane that is perpendicular to the principle axis. For example, if Z is the principle axis, then you should position the camera at the same Z value as that of the camera target (you can do this using Orbit Camera). The toward or away motion then stays at a constant Z value. You may find it useful to zoom out before using Walk Camera. Graphics Properties. Walk Camera modifies both the CameraPosition and the CameraTarget , preserving the distance between them. 11 Defining the View 11-20 0 0.5 1 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 Cursor Motion Towards or away from scene Pan left or right Camera Graphics Functions 11-21 Camera Graphics Functions The following table lists MATLAB functions that enable you to perform a number of useful camera maneuvers. The individual command descriptions provide information on using each one. Functions Purpose camdolly Move camera position and target camlookat View specific objects camorbit Orbit the camera about the camera target campan Rotate the camera target about the camera position campos Set or get the camera position camproj Set or get the projection type (orthographic or perspective) camroll Rotate the camera about the viewing axis camtarget Set or get the camera target location camup Set or get the value of the camera up vector camva Set or get the value of the camera view angle camzoom Zoom the camera in or out on the scene 11 Defining the View 11-22 Example — Dollying the Camera In the camera metaphor, a dolly is a stage that enables movement of the camera side to side with respect to the scene. The camdolly command implements similar behavior by moving both the position of the camera and the position of the camera target in unison (or just the camera position if you so desire). This example illustrates how to use camdolly to explore different regions of an image. Summary of Techniques This example: •Uses ginput to obtain the coordinates of locations on the image •Uses the camdolly data coordinates option to move the camera and target to the new position based on coordinates obtained from ginput •Uses camva to zoom in and to fix the camera view angle, which is otherwise under automatic control Implementation First load the Cape Cod image and zoom in by setting the camera view angle (using camva ). image(X) colormap(map) axis image camva(camva/2.5) Then use ginput to select the x- and y-coordinates of the camera target and camera position. while 1 [x,y] = ginput(1); if ~strcmp(get(gcf,'SelectionType'),'normal') break end ct = camtarget; dx = x - ct(1); Example — Dollying the Camera 11-23 dy = y - ct(2); camdolly(dx,dy,ct(3),'movetarget','data') drawnow end 11 Defining the View 11-24 Example — Moving the Camera Through a Scene A fly-through is an effect created by moving the camera through three dimensional space, giving the impression that you are flying along with the camera as if in an aircraft. You can fly-through of regions of a scene that may be otherwise obscured by objects in the scene or you can fly by a scene by keeping the camera focused on a particular point. To accomplish these effects you move the camera along a particular path, the x axis for example, in a series of steps. To produce a fly-through, move both the camera position and the camera target at the same time. The following example makes use of the fly-though effect to view the interior of an isosurface drawn within a volume defined by a vector field of wind velocities. This data representing air currents over North America. See coneplot for a fixed visualization of the same data. Summary of Techniques This example employs a number of visualization techniques. It uses: •Isosurfaces and conplots to illustrate the flow through the volume •Lighting to illuminate the isosurface and cones in the volume •Stream lines to define a path for the camera through the volume •Coordinated motion of the camera position, camera target, and light together Graphing the Volume Data The first step is to draw the isosurface and plot the air flow using cone plots. See isosurface , isonormals , reducepatch , and coneplot for information on using these commands. Setting the data aspect ratio ( daspect ) to [1,1,1] before drawing the cone plot enables MATLAB to calculate the size of the cones correctly for the final view. wind_speed = sqrt(u.^2 + v.^2 + w.^2); hpatch = patch(isosurface(x,y,z,wind_speed,35)); isonormals(x,y,z,wind_speed,hpatch) Example — Moving the Camera Through a Scene 11-25 set(hpatch,FaceColor,red,EdgeColor,none ); [f vt] = reducepatch(isosurface(x,y,z,wind_speed,45),0.05); daspect([1,1,1]); hcone = coneplot(x,y,z,u,v,w,vt(:,1),vt(:,2),vt(:,3),2); set(hcone,'FaceColor','blue','EdgeColor','none'); Setting Up the View You need to define viewing parameters to ensure the scene displays correctly. •Selecting a perspective projection provides the perception of depth as the camera passes through the interior of the isosurface ( camproj ). •Setting the camera view angle to a fixed value prevents MATLAB from automatically adjusting the angle to encompass the entire scene as well as zooming in to the desired amount ( camva ). camproj perspective camva(25) Specifying the Light Source Positioning the light source at the camera location and modifying the reflectance characteristics of the isosurface and cones enhances the realism of the scene. •Creating a light source at the camera position provides a “headlight” that moves along with the camera through the isosurface interior ( camlight ). •Setting the reflection properties of the isosurface gives the appearance of a dark interior ( AmbientStrength set to 0.1) with highly reflective material ( SpecularStrength and DiffuseStrength set to 1). •Setting the SpecularStrength of the cones to 1 makes them highly reflective. hlight = camlight('headlight'); set(hpatch,'AmbientStrength',.1,... 'SpecularStrength',1,... 'DiffuseStrength',1); set(hcone,'SpecularStrength',1); set(gcf,'Color','k') 11 Defining the View 11-26 Selecting a Renderer Because this example uses lighting, MATLAB must use either zbuffer or, if available, OpenGL renderer settings. The OpenGL renderer is likely to be much faster displaying the animation; however, you need to use gouraud lighting with OpenGL, which is not as smooth as phong lighting, which you can use with the zbuffer renderer. The two choices are lighting gouraud set(gcf,'Renderer','OpenGL') or for zbuffer lighting phong set(gcf,'Renderer','zbuffer') Defining the Camera Path as a Stream Line Stream lines indicate the direction of flow in the vector field. This example uses the x, y, and z coordinate data of a single stream line to map a path through the volume. The camera is then moved along this path. The steps include: •Create a stream line starting at the point x = 80, y = 30, z = 11 •Get the x, y, and z coordinate data of the stream line. •Delete the stream line (note that you could also use stream3 to calculated the stream line data without actually drawing the stream line. hsline = streamline(x,y,z,u,v,w,80,30,11); xd = get(hsline,'XData'); yd = get(hsline,'YData'); zd = get(hsline,'ZData'); delete(hsline) Implementing the Fly-Through To create a fly-through, move the camera position and camera target along the same path. In this example, the camera target is placed five elements further along the x-axis than the camera. Also, a small value is added to the camera target x position to prevent the position of the camera and target from becoming the same point if the condition xd(n) = xd(n+5) should occur: Example — Moving the Camera Through a Scene 11-27 •Update the camera position and camera target so that they both move along the coordinates of the stream line. •Move the light along with the camera. •Call drawnow to display the results of each move. for i=1:length(xd)-50 campos([xd(i),yd(i),zd(i)]) camtarget([xd(i+5)+min(xd)/100,yd(i),zd(i)]) drawnow end These snapshots illustrate the view at values of i equal to 10 , 110 , and 185 . 11 Defining the View 11-28 Example — Moving the Camera Through a Scene 11-29 11 Defining the View 11-30 Low-Level Camera Properties Camera graphics is based on a group of axes properties that control the position and orientation of the camera. In general, the camera commands make it unnecessary to access these properties directly. Property What It Is CameraPosition Specifies the location of the viewpoint in axes units. CameraPositionMode In automatic mode, MATLAB determines the position based on the scene. In manual mode, you specify the viewpoint location. CameraTarget Specifies the location in the axes pointed to by the camera. Together with the CameraPosition , it defines the viewing axis. CameraTargetMode In automatic mode, MATLAB specifies the CameraTarget as the center of the axes plot box. In manual mode, you specify the location. CameraUpVector The rotation of the camera around the viewing axis is defined by a vector indicating the direction taken as up. CameraUpVectorMode In automatic mode, MATLAB orients the up vector along the positive y-axis for 2-D views and along the positive z-axis for 3-D views. In manual mode, you specify the direction. CameraViewAngle Specifies the field of view of the “lens.” If you specify a value for CameraViewAngle , MATLAB overrides stretch-to-fill behavior (see the “Understanding Axes Aspect Ratio” section of this chapter). CameraViewAngleMode In automatic mode, MATLAB adjusts the view angle to the smallest angle that captures the entire scene. In manual mode, you specify the angle. Setting CameraViewAngleMode to manual overrides stretch-to-fill behavior. Projection Selects either an orthographic or perspective projection. Low-Level Camera Properties 11-31 Default Viewpoint Selection When all the camera mode properties are set to auto (the default), MATLAB automatically controls the view, selecting appropriate values based on the assumption that you want the scene to fill the position rectangle (which is defined by the width and height components of the axes Position property). By default, MATLAB: •Sets the CameraPosition so the orientation of the scene is the standard MATLAB 2-D or 3-D view (see the view command) •Sets the CameraTarget to the center of the plot box •Sets the CameraUpVector so the y-direction is up for 2-D views and the z-direction is up for 3-D views •Sets the CameraViewAngle to the minimum angle that makes the scene fill the position rectangle (the rectangle defined by the axes Position property) •Uses orthographic projection This default behavior generally produces desirable results. However, you can change these properties to produce useful effects. Moving In and Out on the Scene You can move the camera anywhere in the 3-D space defined by the axes. The camera continues to point towards the target regardless of its position. When the camera moves, MATLAB varies the camera view angle to ensure the scene fills the position rectangle. Moving Through a Scene You can create a fly-by effect by moving the camera through the scene. To do this, continually change CameraPosition property, moving it toward the target. Since the camera is moving through space, it turns as it moves past the camera target. Override the MATLAB automatic resizing of the scene each time you move the camera by setting the CameraViewAngleMode to manual . If you update the CameraPosition and the CameraTarget , the effect is to pass through the scene while continually facing the direction of movement. If the Projection is set to perspective , the amount of perspective distortion increases as the camera gets closer to the target and decreases as it gets farther away. 11 Defining the View 11-32 Example — Moving Toward or Away from the Target To move the camera along the viewing axis, you need to calculate new coordinates for the CameraPosition property. This is accomplished by subtracting (to move closer to the target) or adding (to move away from the target) some fraction of the total distance between the camera position and the camera target. The function movecamera calculates a new CameraPosition that moves in on the scene if the argument dist is positive and moves out if dist is negative. function movecamera(dist) %dist in the range [-1 1] set(gca,'CameraViewAngleMode','manual') newcp = cpos dist * (cpos ctarg); set(gca,'CameraPosition',newcp) function out = cpos out = get(gca,'CameraPosition'); function out = ctarg out = get(gca,'CameraTarget'); Note that setting the CameraViewAngleMode to manual overrides MATLAB stretch-to-fill behavior and may cause an abrupt change in the aspect ratio. See −2 −1 0 1 2 −2 0 2 −0.5 0 0.5 CameraPosition CameraTarget Low-Level Camera Properties 11-33 the “Understanding Axes Aspect Ratio” section of this chapter for more information on stretch-to-fill. Making the Scene Larger or Smaller property makes the view of the scene larger or smaller. Larger angles cause the view to encompass a larger area, thereby making the objects in the scene appear smaller. Similarly, smaller angles make the objects appear larger. Changing CameraViewAngle makes the scene larger or smaller without affecting the position of the camera. This is desirable if you want to zoom in without moving the viewpoint past objects that will then no longer be in the scene (as could happen if you changed the camera position). Also, changing the CameraViewAngle does not affect the amount of perspective applied to the scene, as changing CameraPosition does when the figure Projection property is set to perspective . Revolving Around the Scene You can use the view command to revolve the viewpoint about the z-axis by varying the azimuth, and about the azimuth by varying the elevation. This has the effect of moving the camera around the scene along the surface of a sphere whose radius is the length of the viewing axis. You could create the same effect by changing the CameraPosition , but doing so requires you to perform calculations that MATLAB performs for you when you call view . For example, the function orbit moves the camera around the scene. function orbit(deg) [az el] = view; rotvec = 0:deg/10:deg; for i = 1:length(rotvec) view([az+rotvec(i) el]) drawnow end Rotation Without Resizing of Graphics Objects When CameraViewAngleMode is auto , MATLAB calculates the CameraViewAngle so that the scene is as large as can fit in the axes position rectangle. This causes an apparent size change during rotation of the scene. To 11 Defining the View 11-34 prevent resizing during rotation, you need to set the CameraViewAngleMode to manual (which happens automatically when you specify a value for the CameraViewAngle property). To do this in the orbit set(gca,'CameraViewAngleMode','manual') You can change the orientation of the scene by specifying the direction defined as up. By default, MATLAB defines up as the y-axis in 2-D views (the CameraUpVector is [0 1 0] ) and the z-axis for 3-D views (the CameraUpVector is [0 0 1] ). However, you can specify up as any arbitrary direction. The vector defined by the CameraUpVector property forms one axis of the camera’s coordinate system. Internally, MATLAB determines the actual orientation of the camera up vector by projecting the specified vector onto the plane that is normal to the camera direction (i.e., the viewing axis). This simplifies the specification of the CameraUpVector property since it need not lie in this plane. In many cases, you may find it convenient to visualize the desired up vector in terms of angles with respect to the axes x-, y-, and z-axes. You can then use direction cosines to convert from angles to vector components. For a unit vector, the expression simplifies to where the angles , , and are specified in degrees. z y x Low-Level Camera Properties 11-35 XComponent = cos((pi 180)); YComponent = cos( (pi180)); ZComponent = cos( (pi180)); (Consult a mathematics book on vector analysis for a more detailed explanation of direction cosines.) Example — Calculating a Camera Up Vector To specify an up vector that makes an angle of 30° with the z-axis and lies in the y-z plane, use the expression upvec = [cos(90*(pi/180)),cos(60*(pi/180)),cos(30*(pi/180))]; and then set the CameraUpVector property. set(gca,'CameraUpVector',upvec) Drawing a sphere with this orientation produces −1 −0.5 0 0.5 1 −1 −0.5 0 0.5 1 −1 −0.5 0 0.5 1 Z−Axis Y−Axis X−Axis 11 Defining the View 11-36 View Projection Types MATLAB supports both orthographic and perspective projection types for displaying 3-D graphics. The one you select depends on the type of graphics you are displaying: • orthographic projects the viewing volume as a rectangular parallelepiped (i.e., a box whose opposite sides are parallel). Relative distance from the camera does not affect the size of objects. This projection type is useful when it is important to maintain the actual size of objects and the angles between objects. • perspective projects the viewing volume as the frustrum of a pyramid (a pyramid whose apex has been cut off parallel to the base). Distance causes foreshortening; objects further from the camera appear smaller. This projection type is useful when you want to display realistic views of real objects. By default, MATLAB displays objects using orthographic projection. You can set the projection type using the camproj command. These pictures show a drawing of a dump truck (created with patch ) and a surface plot of a mathematical function, both using orthographic projection. −2 −1 0 1 2 −2 −1 0 1 2 −0.5 0 0.5 View Projection Types 11-37 If you measure the width of the front and rear faces of the box enclosing the dump truck, you’ll see they are the same size. This picture looks unnatural because it lacks the apparent perspective you see when looking at real objects with depth. On the other hand, the surface plot accurately indicates the values of the function within rectangular space. Now look at the same graphics objects with perspective added. The dump truck looks more natural because portions of the truck that are farther from the viewer appear smaller. This projection mimics the way human vision works. The surface plot, on the other hand, looks distorted. Projection Types and Camera Location By default, MATLAB adjusts the CameraPosition , CameraTarget , and CameraViewAngle properties to point the camera at the center of the scene and to include all graphics objects in the axes. If you position the camera so that there are graphics objects behind the camera, the scene displayed can be affected by both the axes Projection property and the figure Renderer −2 −1 0 1 2 −2 −1 0 1 2 −0.5 0 0.5 11 Defining the View 11-38 property. This table summarizes the interactions between projection type and rendering method. This diagram illustrates what you see (gray area) when using orthographic projection and Z-buffer. Anything in front of the camera is visible. In perspective projection, you see only what is visible in the cone of the camera view angle. Orthographic Perspective Z-buffer CameraViewAngle determines extent of scene at CameraTarget CameraViewAngle determines extent of scene from CameraPosition to infinity Painters All objects display regardless of CameraPosition Not recommended if graphics objects are behind the CameraPosition CameraCamera To Infinity Position Camera View Angle Target Orthographic projection and Z-buffer renderer View Projection Types 11-39 Painters rendering method is less suited to moving the camera in 3-D space because MATLAB does not clip along the viewing axis. Orthographic projection in painters method results in all objects contained in the scene being visible regardless of the camera position. Printing 3-D Scenes The same effects described in the previous section occur in hardcopy output. However, because of the differences in the process of rendering to the screen CameraCamera To Infinity Position Camera View Angle Target Perspective projection and Z-buffer renderer CameraCamera To Infinity Position Camera View Angle Target To Infinity Orthographic projection and painters renderer 11 Defining the View 11-40 and to a printing format, MATLAB may render in Z-buffer and generate printed output in painters. You may need to specify Z-buffer printing explicitly to obtain the results displayed on the screen (use the zbuffer option with the print See the “Basic Printing and Exporting” chapter and the and the “Selecting a Renderer” section in the “Figure Properties” chapter for information on printing and rendering methods. Understanding Axes Aspect Ratio 11-41 Understanding Axes Aspect Ratio Axes shape graphics objects by setting the scaling and limits of each axis. When you create a graph, MATLAB automatically determines axis scaling based on the values or size of the plotted data, and then draws the axes to fit the space available for display. Axes aspect ratio properties control how MATLAB performs the scaling required to create a graph. This section discusses MATLAB default behavior as well as techniques for customizing graphs. Stretch-to-Fill By default, the size of the axes MATLAB creates for plotting is normalized to the size of the figure window (but is slightly smaller to allow for borders). If you resize the figure, the size and possibly the aspect ratio (the ratio of width to height) of the axis changes proportionally. This enables the axes to always fill the available space in the window. MATLAB also sets the x-, y-, and z-axis limits to provide the greatest resolution in each direction, again optimizing the use of available space. This stretch-to-fill behavior is generally desirable; however, you may want to control this process to produce specific results. For example, images need to be displayed in correct proportions regardless of the aspect ratio of the figure window, or you may want graphs always to be a particular size on a printed page. Specifying Axis Scaling The axis command enables you to adjust the scaling of graphs. By default, MATLAB finds the maxima and minima of the plotted data and chooses appropriate axes ranges. You can override the defaults by setting axis limits. axis([xmin xmax ymin ymax zmin zmax]) You can control how MATLAB scales the axes with predefined axis options: • axis auto returns the axis scaling to its default, automatic mode. v = axis saves the scaling of the axes of the current plot in vector v . For subsequent graphics commands to have these same axis limits, follow them with axis(v) . 11 Defining the View 11-42 • axis manual freezes the scaling at the current limits. If you then set hold on , subsequent plots use the current limits. Specifying values for axis limits also sets axis scaling to manual. • axis tight sets the axis limits to the range of the data. • axis ij places MATLAB into its “matrix” axes mode. The coordinate system origin is at the upper-left corner. The i-axis is vertical and is numbered from top to bottom. The j-axis is horizontal and is numbered from left to right. • axis xy places MATLAB into its default Cartesian axes mode. The coordinate system origin is at the lower-left corner. The x-axis is horizontal and is numbered from left to right. The y-axis is vertical and is numbered from bottom to top. Specifying Aspect Ratio The axis command enables you to adjust the aspect ratio of graphs. Normally MATLAB stretches the axes to fill the window. In many cases, it is more useful to specify the aspect ratio of the axes based on a particular characteristic such as the relative length or scaling of each axis. The axis command provides a number of useful options for adjusting the aspect ratio: • axis equal changes the current axes scaling so that equal tick mark increments on the x-, y-, and z-axis are equal in length. This makes the surface displayed by sphere look like a sphere instead of an ellipsoid. axis equal overrides stretch-to-fill behavior. • axis square makes each axis the same length and overrides stretch-to-fill behavior. • axis vis3d freezes aspect ratio properties to enable rotation of 3-D objects and overrides stretch-to-fill. Use this option after other axis options to keep settings from changing while you rotate the scene. • axis image makes the aspect ratio of the axes the same as the image. • axis auto returns the x-, y-, and z-axis limits to automatic selection mode. • axis normal restores the current axis box to full size and removes any restrictions on the scaling of the units. It undoes the effects of axis square . Used in conjunction with axis auto , it undoes the effects of axis equal . The axis command works by manipulating axes graphics object properties. Understanding Axes Aspect Ratio 11-43 Example — axis Command Options The following three pictures illustrate the effects of three axis options on a cylindrical surface created with the statements t = 0:pi/6:4*pi; [x,y,z] = cylinder(4+cos(t),30); surf(x,y,z) axis normal is the default behavior. MATLAB automatically sets the axis limits to span the data range along each axis and stretches the plot to fit the figure window. axis square creates an axis that is square regardless of the shape of the figure window. The cylindrical surface is no longer distorted because it is not warped to fit the window. However, the size of one data unit is not equal along all axes (the z-axis spans only one unit while the x- and y-axes span 10 units each). −5 0 5 −5 0 5 0 0.2 0.4 0.6 0.8 1 axis normal 11 Defining the View 11-44 axis equal makes the length of one data unit equal along each axis while maintaining a nearly square plot box. It also prevents warping of the axis to fill the window’s shape. Additional Commands for Setting Aspect Ratio You can control the aspect ratio of your graph in three ways: −5 0 5 −5 0 5 0 0.2 0.4 0.6 0.8 1 axis square −5 0 5 −4 −2 0 2 4 0 0.5 1 axis equal Understanding Axes Aspect Ratio 11-45 •Specifying the relative scales of the x, y, and z axes (data aspect ratio). •Specifying the shape of the space defined by the axes (plot box aspect ratio). •Specifying the axis limits. The following commands enable you to set these values. See the “Axes Aspect Ratio Properties” section in this chapter for a list of the axes properties that control aspect ratio. Command Purpose daspect Set or query the data aspect ratio pbaspect Set or query the plot box aspect ratio xlim Set or query x-axis limits ylim Set or query y-axis limits zlim Set or query z-axis limits 11 Defining the View 11-46 Axes Aspect Ratio Properties The axis command works by setting various axes object properties. You can set these properties directly to achieve precisely the effect you want. By default, MATLAB automatically determines values for all of these properties (i.e., all the modes are auto) and then applies stretch-to-fill. You can override any property’s automatic operation by specifying a value for the property or setting its mode to manual. The value you select for a particular property depends primarily on what type of data you want to display. Much of the data visualized with MATLAB is either: •Numerical data displayed as line or mesh plots •Representations of real-world objects (e.g., a dump truck or a section of the earth’s topography) Property What It Does DataAspectRatio Sets the relative scaling of the individual axis data values. Set DataAspectRatio to [1 1 1] to display real-world objects in correct proportions. Specifying a value for DataAspectRatio overrides stretch-to-fill behavior. DataAspectRatioMode In auto , MATLAB selects axis scales that provide the highest resolution in the space available. PlotBoxAspectRatio Sets the proportions of the axes plot box (Set box to on to see the box). Specifying a value for PlotBoxAspectRatio overrides stretch-to-fill behavior. PlotBoxAspectRatioMode In auto , MATLAB sets the PlotBoxAspectRatio to [1 1 1] unless you explicitly set the DataAspectRatio and/or the axis limits. Position Defines the location and size of the axes with a four-element vector: [left offset, bottom offset, width, height]. XLim, YLim, ZLim Sets the minimum and maximum limits of the respective axes. XLimMode, YLimMode, ZLimMode In auto , MATLAB selects the axis limits. Axes Aspect Ratio Properties 11-47 In the first case, it is generally desirable to select axis limits that provide good resolution in each axis direction and to fill the available space. Real-world objects, on the other hand, need to be represented accurately in proportion, regardless of the angle of view. Default Aspect Ratio Selection There are two key elements to MATLAB default behavior — normalizing the axes size to the window size and stretch-to-fill. The axes Position property specifies the location and dimensions of the axes. The third and fourth elements of the Position vector ( width and height ) define a rectangle in which MATLAB draws the axes (indicated by the dotted line in the following pictures). MATLAB stretches the axes to fill this rectangle. The default value for the axes Units property is normalized to the parent figure dimensions. This means the shape of the figure window determines the shape of the position rectangle. As you change the size of the window, MATLAB reshapes the position rectangle to fit it. The view is the 2-D projection of the plot box onto the screen. −1 −0.5 0 0.5 1 −1 0 1 −0.5 0 0.5 1 Axes plot box Axes position rectangle (display with box on command) 11 Defining the View 11-48 As you can see, reshaping the axes to fit into the figure window can change the aspect ratio of the graph. MATLAB applies stretch-to-fill so the axes fill the position rectangle and in the process may distort the shape. This is generally desirable for graphs of numeric data, but not for displaying objects realistically. Example — MATLAB Defaults MATLAB surface plots are well suited for visualizing mathematical functions of two variables. For example, to display a mesh plot of the function, evaluated over the range 2 x 2, –4 y 4, use the statements [X,Y] = meshgrid([ 2:.15:2],[ 4:.3:4]); Z = X. exp( X.^2 Y.^2); mesh(X,Y,Z) −1 0 1 −1 0 1 0 0.5 1 Resized axes Resized axes position rectangle plot box z xe x 2 y 2 = Axes Aspect Ratio Properties 11-49 MATLAB ’s default property values are designed to: •Select axis limits to span the range of the data ( XLimMode, YLimMode , and ZLimMode are set to auto ). •Provide the highest resolution in the available space by setting the scale of each axis independently ( DataAspectRatioMode and the PlotBoxAspectRatioMode are set to auto ). •Draw axes that fit the position rectangle by adjusting the CameraViewAngle and then stretch-to-fill the axes if necessary. Overriding Stretch-to-Fill To maintain a particular shape, you can specify the size of the axes in absolute units such as inches, which are independent of the figure window size. However, this is not a good approach if you are writing an M-file that you want to work with a figure window of any size. A better approach is to specify the aspect ratio of the axes and override automatic stretch-to-fill. In cases where you want a specific aspect ratio, you can override stretching by specifying a value for these axes properties: • DataAspectRatio or DataAspectRatioMode • PlotBoxAspectRatio or PlotBoxAspectRatioMode • CameraViewAngle or CameraViewAngleMode −2 −1 0 1 2 −4 −2 0 2 4 −0.5 0 0.5 Axes plot box Surface plot Axes position rectangle 11 Defining the View 11-50 The first two sets of properties affect the aspect ratio directly. Setting either of the mode properties to manual simply disables stretch-to-fill while maintaining all current property values. In this case, MATLAB enlarges the axes until one dimension of the position rectangle constrains it. Setting the CameraViewAngle property disables stretch-to-fill, and also prevents MATLAB from readjusting the size of the axes if you change the view. Effects of Setting Aspect Ratio Properties It is important to understand how properties interact with each other in order to obtain the results you want. The DataAspectRatio , PlotBoxAspectRatio , and the x-, y-, and z- axis limits ( XLim , YLim , and ZLim properties) all place constraints on the shape of the axes. Data Aspect Ratio The DataAspectRatio property controls the ratio of the axis scales. For a mesh plot of the function, evaluated over the range 2 x 2, –4 y 4 [X,Y] = meshgrid([ 2:.15:2],[ 4:.3:4]); Z = X. exp( X.^2 Y.^2); mesh(X,Y,Z) −1 0 1 −1 0 1 −0.5 0 0.5 1 −1 0 1 −1 0 1 0.5 0 0.5 1 z xe x 2 y 2 = Axes Aspect Ratio Properties 11-51 the values are get(gca,'DataAspectRatio') ans = 4 8 1 This means that four units in length along the x-axis cover the same data values as eight units in length along the y-axis and one unit in length along the z-axis. The axes fill the plot box, which has an aspect ratio of [1 1 1] by default. If you want to view the mesh plot so that the relative magnitudes along each axis are equal with respect to each other, you can set the DataAspectRatio to [1 1 1] . set(gca,'DataAspectRatio',[1 1 1]) Setting the value of the DataAspectRatio property also sets the DataAspectRatioMode to manual and overrides stretch-to-fill so the specified aspect ratio is achieved. Plot Box Aspect Ratio Looking at the value of the PlotBoxAspectRatio for the graph in the previous section shows that it has now taken on the former value of the DataAspectRatio . −2 −1 0 1 2 −4 −3 −2 −1 0 1 2 3 4 −0.5 0 0.5 11 Defining the View 11-52 get(gca,'PlotBoxAspectRatio') ans = 4 8 1 MATLAB has rescaled the plot box to accommodate the graph using the specified DataAspectRatio . The PlotBoxAspectRatio property controls the shape of the axes plot box. MATLAB sets this property to [1 1 1] by default and adjusts the DataAspectRatio property so that graphs fill the plot box if stretching is on, or until reaching a constraint if stretch-to-fill has been overridden. When you set the value of the DataAspectRatio and thereby prevent it from changing, MATLAB varies the PlotBoxAspectRatio instead. If you specify both the DataAspectRatio and the PlotBoxAspectRatio , MATLAB is forced to changed the axis limits to obey the two constraints you have already defined. Continuing with the mesh example, if you set both properties, set(gca,'DataAspectRatio',[1 1 1],... 'PlotBoxAspectRatio',[1 1 1]) MATLAB changes the axis limits to satisfy the two constraints placed on the axes. −2 0 2 −4 −2 0 2 −2 0 2 Axes Aspect Ratio Properties 11-53 MATLAB enables you to set the axis limits to whichever values you want. However, specifying a value for DataAspectRatio , PlotBoxAspectRatio , and the axis limits, overconstrains the axes definition. For example, it is not possible for MATLAB to draw the axes if you set these values. set(gca,'DataAspectRatio',[1 1 1],... 'PlotBoxAspectRatio',[1 1 1],... 'XLim',[4 4],... 'YLim',[4 4],... 'ZLim',[1 1]) In this case, MATLAB ignores the setting of the PlotBoxAspectRatio and automatically determines its value. These particular values cause the PlotBoxAspectRatio get(gca,'PlotBoxAspectRatio') ans = 4 8 1 MATLAB can now draw the axes using the specified DataAspectRatio and axis limits. −4 −2 0 2 4 −4 −2 0 2 4 −1 0 1 11 Defining the View 11-54 Example — Displaying Real Objects If you want to display an object so that it looks realistic, you need to change MATLAB defaults. For example, this data defines a wedge-shaped patch object. patch('Vertices',vertex_list,'Faces',vertex_connection,... 'FaceColor','w','EdgeColor','k') view(3) However, this axes distorts the actual shape of the solid object defined by the data. To display it in correct proportions, set the DataAspectRatio . vertex_list = 0 0 0 0 1 0 1 1 0 1 0 0 0 0 1 0 1 1 1 1 4 1 0 4 vertex_connection = 1 2 3 4 2 6 7 3 4 3 7 8 1 5 8 4 1 2 6 5 5 6 7 8 0 0.5 1 0 0.5 1 0 0.5 1 1.5 2 2.5 3 3.5 4 Axes Aspect Ratio Properties 11-55 set(gca,'DataAspectRatio',[1 1 1]) The units are now equal in the x-, y-, and z-directions and the axes is not being stretched to fill the position rectangle, revealing the true shape of the object. 0 0.5 1 0 0.5 1 0 0.5 1 1.5 2 2.5 3 3.5 4 11 Defining the View 11-56 12 Lighting as a Visualization Tool Lighting Overview (p.12-2) Contains links to examples throughout the graphics documentation that illustrate the use of lighting. Lighting Commands (p.12-3) Commands for creating lighting effects. Light Objects (p.12-4) Creation and properties of light objects. Adding Lights to a Scene (p.12-5) Examples of how to position lights and set properties. Properties That Affect Lighting (p.12-8) Properties of axes, patches, and surfaces that affect lights. Selecting a Lighting Method (p.12-10) Illustration of various lighting methods showing which to use. Reflectance Characteristics of Graphics Objects (p.12-11) Catalog illustrating various lighting characteristics. 12 Lighting as a Visualization Tool 12-2 Lighting Overview Lighting is a technique for adding realism to a graphical scene. It does this by simulating the highlights and dark areas that occur on objects under natural lighting (e.g., the directional light that comes from the sun). To create lighting effects, MATLAB defines a graphics object called a light. MATLAB applies lighting to surface and patch objects. Lighting Examples These examples illustrate the use of lighting in a visualization context. •Tracing a stream line through a volume – sets properties of surfaces, patches, and lights. See "Example – "Creating a Fly-Through" in the "Defining the View Chapter". •Using slice planes and cone plots – sets lighting characteristics of objects in a scene independently to achieve a desired result. See the coneplot function. •Lighting multiple slice planes independently to visualize fluid flow. See the "Example - Slicing Fluid Flow Data" section in the "Volume Visualization Techniques" chapter. •Combining single-color lit surfaces with interpolated coloring. See the "Example - Visualizing MRI Data" section in the "Volume Visualization Techniques" chapter. •Employing lighting to reveal surface shape. The fluid flow isosurface example and the surface plot of the sinc function examples illustrate this technique. See the "Example - Isosurfaces in Fluid Flow Data" section in the "Volume Visualization Techniques" chapter and the "Visualizing Functions of Two Variables" section in the "Creating 3-D Graphs" chapter. Lighting Commands 12-3 Lighting Commands MATLAB provides commands that enable you to position light sources and adjust the characteristics of lit objects. These commands include the following. You may find it useful to set light or lit-object properties directly to achieve specific results. In addition to the material in this topic area, you can explore the following lighting examples as an introduction to lighting for visualization. Command Purpose camlight Create or move a light with respect to the camera position lightangle Create or position a light in spherical coordinates light Create a light object lighting Select a lighting method material Set the reflectance properties of lit objects 12 Lighting as a Visualization Tool 12-4 Light Objects You create a light object using the light function. Three important light object properties are: • Color – the color of the light cast by the light object • Style – either infinitely far away (the default) or local • Position – the direction (for infinite light sources) or the location (for local light sources) The Color property determines the color of the directional light from the light source. The color of an object in a scene is determine by the color of the object and the light source. The Style property determines whether the light source is a point source ( Style set to local ), which radiates from the specified position in all directions, or a light source placed at infinity ( Style set to infinite ), which shines from the direction of the specified position with parallel rays. The Position property specifies the location of the light source in axes data units. In the case of an light source at infinity, Position specifies the direction to the light source. Lights affect surface and patch objects that are in the same axes as the light. These objects have a number of properties that alter the way they look when illuminated by lights. Adding Lights to a Scene 12-5 This example displays the membrane surface and illuminates it with a light source emanating from the direction defined by the position vector [0 2 1] . This vector defines a direction from the axes origin passing through the point with the coordinates 0, 2, 1. The light shines from this direction towards the axes origin. membrane light('Position',[0 2 1]) Creating a light activates a number of lighting-related properties controlling characteristics, such as the ambient light and reflectance properties of objects. It also switches to Z-buffer renderer if not already in that mode. Illuminating Mathematical Functions Lighting can enhance surface graphs of mathematical functions. For example, use the ezsurf command to evaluate the expression over the region -6 to 6 ezsurf('sin(sqrt(x^2+y^2))/sqrt(x^2+y^2)',[-6*pi,6*pi]) x 2 y 2 + x 2 y 2 +sin 12 Lighting as a Visualization Tool 12-6 Now add lighting using the lightangle command, which accepts the light position in terms of azimuth and elevation. view(0,75) lightangle(-45,30) set(gcf,'Renderer','zbuffer') set(findobj(gca,'type','surface'),... 'FaceLighting','phong',... 'AmbientStrength',.3,'DiffuseStrength',.8,... 'SpecularStrength',.9,'SpecularExponent',25,... 'BackFaceLighting','unlit') 12-7 After obtaining surface object’s handle using findobj , you can set properties that affect how the light reflects from the surface. See the "Properties That Affect Lighting" section of this chapter for more detailed descriptions of these properties. 12 Lighting as a Visualization Tool 12-8 Properties That Affect Lighting You cannot see light objects themselves, but you can see their effects on any patch and surface objects present in the axes containing the light. A number of functions create these objects, including surf , mesh , pcolor , fill , and fill3 as well as the surface and patch functions. You control lighting effects by setting various axes, light, patch, and surface object properties. All properties have default values that generally produce desirable results. However, you can achieve the specific effect you want by adjusting the values of these properties. Property Effect AmbientLightColor An axes property that specifies the color of the background light in the scene, which has no direction and affects all objects uniformly. Ambient light effects occur only when there is a visible light object in the axes. AmbientStrength A patch and surface property that determines the intensity of the ambient component of the light reflected from the object. DiffuseStrength A patch and surface property that determines the intensity of the diffuse component of the light reflected from the object. SpecularStrength A patch and surface property that determines the intensity of the specular component of the light reflected from the object. SpecularExponent A patch and surface property that determines the size of the specular highlight. SpecularColorReflectance A patch and surface property that determines the degree to which the specularly reflected light is colored by the object color or the light source color. FaceLighting A patch and surface property that determines the method used to calculate the effect of the light on the faces of the object. Choices are either no lighting, or flat, Gouraud, or Phong lighting algorithms. Properties That Affect Lighting 12-9 See a description of all axes, surface, and patch object properties. EdgeLighting A patch and surface property that determines the method used to calculate the effect of the light on the edges of the object. Choices are either no lighting, or flat, Gouraud, or Phong lighting algorithms. BackFaceLighting A patch and surface property that determines how faces are lit when their vertex normals point away from the camera. This property is useful for discriminating between the internal and external surfaces of an object. FaceColor A patch and surface property that specifies the color of the object faces. EdgeColor A patch and surface property that specifies the color of the object edges. VertexNormals A patch and surface property that contains normal vectors for each vertex of the object. MATLAB uses vertex normal vectors to perform lighting calculations. While MATLAB automatically generates this data, you can also specify your own vertex normals. NormalMode A patch and surface property that determines whether MATLAB recalculates vertex normals if you change object data ( auto ) or uses the current values of the VertexNormals property ( manual ). If you specify values for VertexNormals , MATLAB sets this property to manual . Property Effect 12 Lighting as a Visualization Tool 12-10 Selecting a Lighting Method When you add lights to an axes, MATLAB determines the effects these lights have on the patch and surface objects that are displayed in that axes. There are different methods used to calculate the face and edge coloring of lit objects, and the one you select depends on the results you want to obtain. Face and Edge Lighting Methods MATLAB supports three different algorithms for lighting calculations, selected by setting the FaceLighting and EdgeLighting properties of each patch and surface object in the scene. Each algorithm produces somewhat different results: •Flat lighting – produces uniform color across each of the faces of the object. Select this method to view faceted objects. •Gouraud lighting – calculates the colors at the vertices and then interpolates colors across the faces. Select this method to view curved surfaces. •Phong lighting – interpolates the vertex normals across each face and calculates the reflectance at each pixel. Select this choice to view curved surfaces. Phong lighting generally produces better results than Gouraud lighting, but takes longer to render. This illustration shows how a red sphere looks using each of the lighting methods with one white light source. The lighting command (as opposed to the light function) provides a convenient way to set the lighting method. none flat gouraud phong Reflectance Characteristics of Graphics Objects 12-11 Reflectance Characteristics of Graphics Objects You can modify the reflectance characteristics of patch and surface objects and thereby change the way they look when lights are applied to the scene. The characteristics discussed in this section include: •Specular and diffuse reflection •Ambient light •Specular exponent •Specular color reflectance •Backface lighting It is likely you will adjust these characteristics in combination to produce particular results. Also see the material command for a convenient way to produce certain lighting effects. Specular and Diffuse Reflection You can control the amount of specular and diffuse reflection from the surface of an object by setting the SpecularStrength and DiffuseStrength properties. This picture illustrates various settings. 12 Lighting as a Visualization Tool 12-12 Ambient Light Ambient light is a directionless light that shines uniformly on all objects in the scene. Ambient light is visible only when there are light objects in the axes. There are two properties that control ambient light – AmbientLightColor is an axes property that sets the color, and AmbientStrength is a property of patch and surface objects that determines the intensity of the ambient light on the particular object. This illustration shows three different ambient light colors at various intensities. The sphere is red and there is a white light object present. 0.0 1.0 2.0 0.0 0.5 1.0 SpecularStrength DiffuseStrength Reflectance Characteristics of Graphics Objects 12-13 The green [0 1 0] ambient light does not affect the scene because there is no red component in green light. However, the color defined by the RGB values [.5 0 1] does have a red component, so it contributes to the light on the sphere (but less than the white [1 1 1] ambient light). Specular Exponent The size of the specular highlight spot depends on the value of the patch and surface object’s SpecularExponent property. Typical values for this property range from 1 to 500, with normal objects having values in the range 5 to 20. This illustration shows a red sphere illuminated by a white light with three different values for the SpecularExponent property. [1 1 1] [.5 0 1] [0 1 0] AmbientStrength 0.0 0.7 1.0 AmbientLightColor(RGB) 12 Lighting as a Visualization Tool 12-14 Specular Color Reflectance The color of the specularly reflected light can range from a combination of the color of the object and the color of the light source to the color of the light source only. The patch and surface SpecularColorReflectance property controls this color. This illustration shows a red sphere illuminated by a white light. The values of the SpecularColorReflectance property range from 0 (object and light color) to 1 (light color). Back Face Lighting Back face lighting is useful for showing the difference between internal and external faces. These pictures of cut-away cylindrical surfaces illustrate the effects of back face lighting. SpecularExponent 15 5 1 0 0.5 1.0 SpecularColorReflectance Reflectance Characteristics of Graphics Objects 12-15 The default value for BackFaceLighting is reverselit . This setting reverses the direction of the vertex normals that face away from the camera, causing the interior surface to reflect light towards the camera. Setting BackFaceLighting to unlit disables lighting on faces with normals that point away from the camera. You can also use BackFaceLighting to remove edge effects for closed objects. These effects occur when BackFaceLighting is set to reverselit and pixels along the edge of a closed object are lit as if their vertex normals faced the camera. This produces an improperly lit pixel because the pixel is visible but is really facing away from the camera. To illustrate this effect, the next picture shows a blowup of the edge of a lit sphere. Setting BackFaceLighting to lit prevents the improper lighting of pixels. BackFaceLighting = reverselit BackFaceLighting = unlit 12 Lighting as a Visualization Tool 12-16 BackFaceLighting = reverselit BackFaceLighting = lit Reflectance Characteristics of Graphics Objects 12-17 Positioning Lights in Data Space This example creates a sphere and a cube to illustrate the effects of various properties on lighting. The variables vert and fac define the cube using the patch function. sphere(36); h = findobj('Type','surface'); set(h,'FaceLighting','phong',... 'FaceColor','interp',... 'EdgeColor',[.4 .4 .4],... 'BackFaceLighting','lit') hold on patch('faces',fac,'vertices',vert,'FaceColor','y'); light('Position',[1 3 2]); light('Position',[3 1 3]); material shiny axis vis3d off hold off All faces of the cube have FaceColor set to yellow. The sphere function creates a spherical surface and the handle of this surface is obtained using findobj to search for the object whose Type property is surface . The light functions define two, white (the default color) light objects located at infinity in the direction specified by the Position vectors. These vectors are defined in axes coordinates [x, y, z]. The patch uses flat FaceLighting (the default) to enhance the visibility of each side. The surface uses phong FaceLighting because it produces the smoothest interpolation of lighting effects. The material shiny command vert = 1 1 1 1 2 1 2 2 1 2 1 1 1 1 2 1 2 2 2 2 2 2 1 2 fac = 1 2 3 4 2 6 7 3 4 3 7 8 1 5 8 4 1 2 6 5 5 6 7 8 12 Lighting as a Visualization Tool 12-18 affects the reflectance properties of both the cube and sphere (although its effects are noticeable only on the sphere because of the cube’s flat shading). Since the sphere is closed, the BackFaceLighting property is changed from its default setting, which reverses the direction of vertex normals that face away from the camera, to normal lighting, which removes undesirable edge effects. Examining the code in the lighting and material 13 Transparency Making Objects Transparent (p.13-2) Overview of the object properties that specify transparency. Specifying a Single Transparency Value (p.13-5) How to specify a transparency value that applies to all the faces of a graphics object. Mapping Data to Transparency (p.13-8) How to use transparency as another dimension for visualizing data. Selecting an Alphamap (p.13-11) Characteristics of various alphamaps and illustrations of the effects they produce. 13 Transparency 13-2 Making Objects Transparent Making graphics objects semi-transparent is a useful technique in 3-D visualization to make it possible to see an object, while at the same time, see what information the object would obscure if it was completely opaque. You can also use transparency as another dimension for displaying data, much the way color is used in MATLAB. The transparency of a graphics object determines the degree to which you can see through the object. You can specify a continuous range of transparency varying from completely transparent (i.e., invisible) to completely opaque (i.e., no transparency). Objects that support transparency are: •Image •Patch •Surface The following picture illustrates the effect of transparency. The green isosurface (patch object) reveals the coneplot that lies in the interior. Making Objects Transparent 13-3 Note You must have OpenGL available on your system to use transparency. MATLAB automatically uses OpenGL if it is available. See the figure RendererMode Specifying Transparency Transparency values, which range from [0 1], are referred to as alpha values. An alpha value of 0 means completely transparent (i.e., invisible); an alpha value of 1 means completely opaque (i.e., no transparency). MATLAB treats transparency in a way that is analogous to how it treats color for the respective objects: •Patches and surfaces can define a single face and edge alpha value or use flat or interpolated transparency based on values in the figure’s alphamap. •Images, patches, and surfaces can define alpha data that is used as indices into the alphamap or directly as alpha values. •Axes define alpha limits that control the mapping of object data to alpha values. •Figures contain alphamaps, which are m-by-1 arrays of alpha values. •“Specifying Patch Coloring” in the “Creating 3-D Models with Patches” chapter. •“Coloring Mesh and Surface Plots” in the “Creating 3-D Graphs” chapter. 13 Transparency 13-4 Transparency Properties The following table summarizes the object properties that control transparency. Transparency Functions There are three functions that simplify the process of setting alpha properties. Properties Purpose The transparency data for image and surface objects The transparency data mapping method FaceAlpha Transparency of the faces (patch and surface only) EdgeAlpha Transparency of the edges (patch and surface only) Patch only alpha data property ALim Alpha axis limits ALimMode Alpha axis limits mode Alphamap Figure alphamap Function Purpose alpha Set or query transparency properties for objects in current axes alphamap Specify the figure alphamap alim Set or query the axes alpha limits Specifying a Single Transparency Value 13-5 Specifying a Single Transparency Value Specifying a single transparency value for graphics objects is useful when you want to reveal structure that is obscured with opaque objects. For patches and surfaces, use the FaceAlpha and EdgeAlpha properties to specify the transparency of faces and edges. The following example illustrates this. Example – Transparent Isosurface This example uses the flow function to generate data for the speed profile of a submerged jet within a infinite tank. One way to visualize this data is by creating an isosurface illustrating where the rate of flow is equal to a specified value. [x y z v] = flow; p = patch(isosurface(x,y,z,v,-3)); isonormals(x,y,z,v,p); set(p,'facecolor','red','edgecolor','none'); daspect([1 1 1]); view(3); axis tight; grid on; camlight; lighting gouraud; 13 Transparency 13-6 Adding transparency to the isosurface reveals that there is greater complexity in the fluid flow than is visible using the opaque surface. The statement alpha(.5) sets the FaceAlpha value for the isosurface face to .5. Specifying a Single Transparency Value 13-7 Setting a Single Transparency Value for Images For images, the statement alpha(.5) property is set to none on an image causes the entire image to render with the specified alpha value. 13 Transparency 13-8 Mapping Data to Transparency Alpha data is analogous to color data (e.g., the CData property of surfaces). When you create a surface, MATLAB maps each element in the color data array to a color in the colormap. Similarly, each element in the alpha data maps to a transparency value in the alphamap. Specify surface and image alpha data with the AlphaData property. For patch objects, use the FaceVertexAlphaData property. You can control how MATLAB interprets alpha data with the following properties: • FaceAlpha and EdgeAlpha – enable you to select flat or interpolated transparency rendering. If set to a single transparency value, MATLAB applies this value to all faces or edges and does not use the alpha data. • and ALim – determine how MATLAB maps the alpha data to the alphamap. By default, MATLAB scales the alpha data to be within the range [0 1]. • Alphamap – contains the actual transparency values to which the data is to be mapped. Note that there are differences between the default values of equivalent color and alpha properties because, in contrast to color, transparency is not displayed by default. The following table highlights these differences. By default, objects have single-valued alpha data. Therefore you cannot specify flat or interp FaceAlpha or EdgeAlpha to an array of the appropriate size. The sections that follow illustrate how to use these properties to display object data as degrees of transparency. Color Property Default Alpha Property Default FaceColor flat FaceAlpha 1 (opaque) CData 1 (scalar) Mapping Data to Transparency 13-9 Size of the Alpha Data Array In order to use nonscalar alpha data, you need to specify the alpha data as an array equal in size to the: • CData of images and surfaces •The number of faces (flat) or the number of vertices (interpolated) defined in the FaceVertexAlphaData property of patches Once you have specified an alpha data array of the proper size, you can select the face and edge rendering you want to use. Flat uses one transparency value per face, while interpolated performs bilinear interpolation of the values at each vertex. Mapping Alpha Data to the Alphamap You can control how MATLAB maps the alpha data to the alphamap using the AlphaDataMapping property. There are three possible mappings: • none – Interpret the values in alpha data as transparency values (data values must be between 0 and 1, or will be clamped to 0 or 1). This is the default mapping. • scaled – Transform the alpha data to span the portion of the alphamap indicated by the axes ALim property, linearly mapping data values to alpha values. This is the same way color data is mapped to the colormap. • direct – Use the alpha data directly as indices into the figure alphamap. By default, objects have scalar alpha data ( ) set to the value 1. Example: Mapping Data to Color or Transparency This example displays a surface plot of a functions of two variables. The color is mapped to the gradient of the z data. [x,y] = meshgrid([-2:.2:2]); z = x.*exp(-x.^2-y.^2); 13 Transparency 13-10 You can map transparency to the gradient of z in a similar way. surf(x,y,z,'FaceAlpha','flat',... 'FaceColor','blue'); axis tight Selecting an Alphamap 13-11 Selecting an Alphamap An alphamap is simply an array of values ranging from 0 to 1. The size of the array can be either m-by-1 or 1-by-m. The default alphamap contains 64 values ranging linearly from 0 to 1, as you can see in the following plot. plot(get(gcf,'Alphamap')) This alphamap displays the lowest alpha data values as completely transparent and the highest alpha data values as opaque. The alphamap function creates some useful predefined alphamaps and also enables you to modify existing maps. For example, plot(alphamap('vup')) produces the following alphamap. 0 10 20 30 40 50 60 70 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Default Alphamap 13 Transparency 13-12 You can shift the values using the increase or decrease options. For example, alphamap('increase',.4) adds the value .4 to all values in the current figure’s alphamap. Replotting the 'vup' alphamap illustrates the change. Note how the values are clamped to the range [0 1]. plot(get(gcf,'Alphamap')) 0 10 20 30 40 50 60 70 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Selecting an Alphamap 13-13 Example: Modifying the Alphamap This example uses slice planes to examine volume data. The slice planes use the color data for alpha data and employ a rampdown alphamap (the values range from 1 to 0): 1 Create the volume data by evaluating a function of three variables. [x,y,z] = meshgrid(-1.25:.1:-.25,-2:.2:2,-2:.1:2); v = x.*exp(-x.^2-y.^2-z.^2); 2 Create the slice planes, set the alpha data equal to the color data, and specify interpolated FaceAlpha . h = slice(x,y,z,v,[-1 -.75 -.5],[],[0]); alpha('color') set(h,'EdgeColor','none','FaceColor','interp',... 'FaceAlpha','interp') 3 Install the rampdown alphamap and increase each value in the alphamap by .1 to achieve the desired degree of transparency. Specify the hsv colormap. alphamap('rampdown') alphamap('increase',.1) 0 10 20 30 40 50 60 70 0.4 0.5 0.6 0.7 0.8 0.9 1 13 Transparency 13-14 colormap(hsv) This alphamap causes the smallest values of the function (around zero) to display with the least transparency and the greatest values to display with the most transparency. This enables you to see through the slice planes, while at the same time preserving the data around zero. 14 Creating 3-D Models with Patches Introduction to Patch Objects (p.14-2) Overview of what a patch object is and how to define one. Multi-Faceted Patches (p.14-6) Shows how to define a 3-D patch object using both x-, y-, and z-coordinate and faces/vertices data. Also illustrates flat and interpolated face coloring. Specifying Patch Coloring (p.14-11) How to specify patch coloring using various patch properties. Patch Edge Coloring (p.14-13) Details about how MATLAB determines patch edge coloring. Interpreting Indexed and Truecolor Data (p.14-16) Specify color data that uses colormaps or defines explicit colors. 14 Creating 3-D Models with Patches 14-2 Introduction to Patch Objects A patch graphics object is composed of one or more polygons that may or may not be connected. Patches are useful for modeling real-world objects such as airplanes or automobiles, and for drawing 2- or 3-D polygons of arbitrary shape. In contrast, surface objects are rectangular grids of quadrilaterals and are better suited for displaying planar topographies such as the values of mathematical functions of two variables, the contours of data in a rectangular plane, or parameterized surfaces such as spheres. A number of MATLAB functions create patch objects – fill , fill3 , isosurface , isocaps , some of the contour functions, and patch . This section concentrates on use of the patch function. Defining Patches You define a patch by specifying the coordinates of its vertices and some form of color data. Patches support a variety of coloring options that are useful for visualizing data superimposed on geometric shapes. There are two ways to specify a patch: •By specifying the coordinates of the vertices of each polygon, which MATLAB connects to form the patch •By specifying the coordinates of each unique vertex and a matrix that specifies how to connect these vertices to form the faces The second technique is preferred for multifaceted patches because it generally requires less data to define the patch; vertices shared by more than one face need be defined only once. This topic area provides examples of both techniques. Behavior of the patch Function There are two forms of the patch function – high-level syntax and low-level syntax. The behavior of the patch function differs somewhat depending on which syntax you use. Introduction to Patch Objects 14-3 High-Level Syntax When you use the high-level syntax, MATLAB automatically determines how to color each face based on the color data you specify. The high-level syntax enables you to omit the property names for the x-, y-, and z-coordinates and the color data, as long as you specify these arguments in the correct order. patch(x-coordinates,y-coordinates,z-coordinates,colordata) However, you must specify color data so MATLAB can determine what type of coloring to use. If you do not specify color data, MATLAB returns an error. patch(sin(t),cos(t)) ??? Error using ==> patch Not enough input arguments. Low-Level Syntax The low-level syntax accepts only property name/property value pairs as arguments and does not automatically color the faces unless you also change the value of the FaceColor property. For example, the statement patch('XData',sin(t),'YData',cos(t)) % Low-level syntax draws a patch with white face color because the factory default value for the FaceColor property is the color white. get(0,'FactoryPatchFaceColor') ans = 1 1 1 See the list of patch properties in the MATLAB Function Reference and the get command for information on how to obtain the factory and user default values for properties. Interpreting the Color Argument When you use the informal syntax, MATLAB interprets the third (or fourth if there are z-coordinates) argument as color data. If you intend to define a patch with x-, y-, and z-coordinates, but leave out the color, MATLAB interprets the z-coordinates as color data, and then draws a 2-D patch. For example, h = patch(sin(t),cos(t),1:length(t)) 14 Creating 3-D Models with Patches 14-4 draws a patch with all vertices at z = 0, colored by interpolating the vertex colors (since there is one color for each vertex), whereas h = patch(sin(t),cos(t),1:length(t),'y') draws a patch with vertices at increasing values of z, colored yellow. The “Specifying Patch Coloring” section in this chapter provides more information on options for coloring patches. Creating a Single Polygon A polygon is simply a patch with one face. To create a polygon, specify the coordinates of the vertices and color data with a statement of the form. patch(x-coordinates,y-coordinates,[z-coordinates],colordata) For example, these statements display a 10-sided polygon with a yellow face enclosed by a black edge. The axis equal command produces a correctly proportioned polygon. t = 0:pi/5:2*pi; patch(sin(t),cos(t),'y') axis equal −1 −0.5 0 0.5 1 −1 −0.5 0 0.5 1 Introduction to Patch Objects 14-5 The first and last vertices need not coincide; MATLAB automatically closes each polygonal face of the patch. In fact, it is generally better to define each vertex only once, particularly if you are using interpolated face coloring. Interpolated Face Colors You can control many aspects of the patch coloring. For example, instead of specifying a single color, you can provide a range of numerical values that map the color at each vertex to a color in the figure colormap. a = t(1:length(t)1); %remove redundant vertex definition patch(sin(a),cos(a),1:length(a),'FaceColor','interp') colormap cool; axis equal MATLAB now interpolates the colors across the face of the patch. You can color the edges of the patch the same way, by setting the edge colors to be interpolated. The command is patch(sin(t),cos(t),1:length(t),'EdgeColor','interp') The “Specifying Patch Coloring” section in this chapter provides more information on options for coloring patches. 14 Creating 3-D Models with Patches 14-6 Multi-Faceted Patches If you specify the x-, y-, and z-coordinate arguments as vectors, MATLAB draws a single polygon by connecting the points. If the arguments are matrices, MATLAB draws one polygon per column, producing a single patch with multiple faces. These faces need not be connected and can be self-intersecting. Alternatively, you can specify the coordinates of each unique vertex and the order in which to connect them to form the faces. The examples in this section illustrate both techniques. Example – Defining a Cube A cube is defined by eight vertices that form six sides. This illustration shows the coordinates of the vertices defining a cube in which the sides are one unit in length. Specifying X, Y, and Z Coordinates Each of the six faces has four vertices. Since you do not need to close each polygon (i.e., the first and last vertices do not need to be the same), you can define this cube using a 4-by-6 matrix for each of the x-, y-, and z-coordinates. 0, 0, 0 1, 0, 0 0, 1, 0 0, 0, 1 0, 1, 1 1, 0, 1 1, 1, 1 y x z 1, 1, 0 Face 1 Multi-Faceted Patches 14-7 Each column of the matrices specifies a different face. Note that while there are only eight vertices, you must specify 24 vertices to define all six faces. Since each face shares vertices with four other faces, you can define the patch more efficiently by defining each vertex only once and then specifying the order in which to connect these vertices to form each face. The patch Vertices and Faces properties define patches in just this way. Specifying Faces and Vertices These matrices specify the cube using Vertices and Faces . x-coordinates 0 1 1 0 0 0 1 1 0 0 1 1 1 1 0 0 1 1 0 1 1 0 0 0 y-coordinates 0 0 1 1 0 0 0 1 1 0 0 0 0 1 1 0 1 1 0 0 1 1 1 1 z-coordinates 0 0 0 0 0 1 0 0 0 0 0 1 1 1 1 1 0 1 1 1 1 1 0 1 Face 1 Vertices x y z 0 0 0 1 0 0 1 1 0 0 1 0 0 0 1 1 0 1 1 1 1 0 1 1 Faces 1 2 6 5 2 3 7 6 3 4 8 7 4 1 5 8 1 2 3 4 5 6 7 8 This data draws the first face by connecting vertices 1, 2 ,6, and 5 in that order. 1st vertex 2nd vertex 5th vertex 6th vertex . . . 14 Creating 3-D Models with Patches 14-8 Using the vertices/faces technique can save a considerable amount of computer memory when patches contain a large number of faces. This technique requires the formal patch function syntax, which entails assigning values to the Vertices and Faces properties explicitly. For example, patch('Vertices',vertex_matrix,'Faces',faces_matrix) Since the formal syntax does not automatically assign face or edge colors, you must set the appropriate properties to produce patches with colors other than the default white face color and black edge color. Flat Face Color Flat face color is the result of specifying one color per face. For example, using the vertices/faces technique and the FaceVertexCData property to define color, this statement specifies one color per face and sets the FaceColor property to flat . patch('Vertices',vertex_matrix,'Faces',faces_matrix,... 'FaceVertexCData',hsv(6),'FaceColor','flat') Since true color specified with the FaceVertexCData property has the same format as a MATLAB colormap (i.e., an n-by-3 array of RGB values), this example uses the hsv colormap to generate the six colors required for flat shading. Multi-Faceted Patches 14-9 Interpolated Face Color Interpolated face color means the vertex colors of each face define a transition of color from one vertex to the next. To interpolate the colors between vertices, you must specify a color for each vertex and set the FaceColor property to interp . patch('Vertices',vertex_matrix,'Faces',faces_matrix,... 'FaceVertexCData',hsv(8),'FaceColor','interp') Changing to the standard 3-D view and making the axis square, view(3); axis square produces a cube with each face colored by interpolating the vertex colors. To specify the same coloring using the x, y, z, c technique, c must be an m-by-n-by-3 array, where the dimensions of x, y, and z are m-by-n. This diagram shows the correspondence between the FaceVertexCData and CData properties. 14 Creating 3-D Models with Patches 14-10 See “Specifying Patch Coloring” in this chapter for a discussion of coloring techniques in more detail. FaceVertexCData = 1.00 0.00 0.00 1.00 0.75 0.00 0.50 1.00 0.00 0.00 1.00 0.25 0.00 1.00 1.00 0.00 0.25 1.00 0.50 0.00 1.00 1.00 0.00 0.75 Red Green Blue CData(:,:,1) = 1.00 1.00 0.50 0.00 1.00 0.00 1.00 0.50 0.00 1.00 1.00 0.00 0.00 0.50 1.00 0.00 0.50 0.50 0.00 0.00 0.50 1.00 0.00 1.00 CData(:,:,2) = 0.00 0.75 1.00 1.00 0.00 1.00 0.75 1.00 1.00 0.00 0.75 0.25 0.25 0.00 0.00 1.00 1.00 0.00 1.00 0.25 0.00 0.00 1.00 0.00 CData(:,:,3) = 0.00 0.00 0.00 0.25 0.00 1.00 0.00 0.00 0.25 0.00 0.00 1.00 1.00 1.00 0.75 1.00 0.00 1.00 1.00 1.00 1.00 0.75 0.25 0.75 Red page Green page Blue page Specifying Patch Coloring 14-11 Specifying Patch Coloring Patch coloring is defined differently from surface object coloring in that patches do not automatically generate color data based on the value of the z-coordinate at each vertex. You must explicitly specify patch coloring, or MATLAB uses the default white face color and black edge color. You can specify patch face coloring by defining: •A single color for all faces •One color for each face, which is used for flat coloring •One color for each vertex, which is used for interpolated coloring Specify the face color using either the CData property, if you are using x-, y-, and z-coordinates or the FaceVertexCData property, if you are specifying vertices and faces. Patch Color Properties This table summarizes the patch properties that control color (exclusive of those used when light sources are present). Property Purpose CData Specify single, per face, or per vertex colors in conjunction with x, y, and z data CDataMapping Specifies whether color data is scaled or used directly as indices into the figure colormap FaceVertexCData Specify single, per face, or per vertex colors in conjunction with faces and vertices data EdgeColor Specifies whether edges are invisible, a single color, a flat color determined by vertex colors, or interpolated colors determined by vertex colors 14 Creating 3-D Models with Patches 14-12 FaceColor Specifies whether faces are invisible, a single color, a flat color determined by vertex colors, or interpolated colors determined by vertex colors MarkerEdgeColor Specifies the color of the marker, or the edge color for filled markers MarkerFaceColor Specifies the fill color for markers that are closed shapes Property Purpose Patch Edge Coloring 14-13 Patch Edge Coloring Each patch face has a bounding edge, which you can color as: •A single color for all edges •A flat color defined by the color of the vertex that precedes the edge •Interpolated colors determined by the two vertices that bound the edge Note that patch edge colors can be flat or interpolated only when you specify a color for each vertex. For flat edge coloring, MATLAB uses the color of the vertex preceding the edge to determine the color of the edge. The order in which you specify the vertices establishes which vertex colors a particular edge. The following examples illustrate patch edge coloring: •“Example – Specifying Flat Edge and Face Coloring” •“Coloring Edges with Shared Vertices” Example – Specifying Flat Edge and Face Coloring These statements create a square patch. v = [0 0 0;1 0 0;1 1 0;0 1 0]; f = [1 2 3 4]; fvc = [1 0 0;0 1 0;1 0 1;1 1 0]; patch('Vertices',v,'Faces',f,'FaceVertexCData',fvc,... 'FaceColor','flat','EdgeColor','flat',... 'Marker','o','MarkerFaceColor','flat') 14 Creating 3-D Models with Patches 14-14 The Faces property value, [1 2 3 4] , determines the order in which MATLAB connects the vertices. In this case, the order is red, green, magenta, and yellow. If you change this order, the results can be quite different. For example, specifying the Faces property as, f = [4 3 2 1]; changes the order to yellow, magenta, green, and red. Note that changing the order not only changes the color of the edges, but also the color of the face, which is the color of the first vertex specified. Coloring Edges with Shared Vertices Each patch face is bound by edges, which are line segments that connect the vertices. When patches have multiple faces that share vertices, some of the Red Green Magenta Yellow Red Green Magenta Y ellow Patch Edge Coloring 14-15 edges may overlap. In such cases, the edges of the most recently drawn face overlay previously drawn edges. For example, this illustration shows a patch with four faces and flat colored edges ( FaceColor set to none , EdgeColor set to flat ). The arrows indicate the order in which each edge is drawn in the first, second, third, and fourth face. The color at each vertex determines the color of the edge that follows it. Notice how the second edge in the first face would be green except that the second face drew its fourth edge from the magenta vertex. You can see similar effects in all shared edges. For EdgeColor set to interp , MATLAB interpolates colors between adjacent vertices. In this case, the order in which you specify the vertices does not affect the edge color. 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 Magenta 1 st 2 nd 4 th 3 rd Green [0 1 0] [1 0 1] Blue [0 0 1] Red [1 0 0] Green [0 1 0] Blue [0 0 1] Red [1 0 0] Cyan [0 1 1] Yellow [1 1 0] 14 Creating 3-D Models with Patches 14-16 Interpreting Indexed and Truecolor Data MATLAB interprets the patch color data in one of two ways: •Indexed color data – numerical values that are mapped to colors defined in the figure colormap •Truecolor data – RGB triples that define colors explicitly and do not make use of the figure colormap The dimensions of the color data ( CData or FaceVertexCData ) determine how MATLAB interprets it. If you specify only one numeric value per patch, per face, or per vertex, then MATLAB interprets the data as indexed. If there are three numeric values per patch, face, or vertex, then MATLAB interprets the data as RGB values. Indexed Color Data MATLAB interprets indexed color data as either values to scale before mapping to the colormap, or directly as indices into the colormap. You control the interpretation by setting the CDataMapping property. The default is to scale the data. Scaled Color By default, MATLAB scales the color data so that the minimum value maps to the first color in the colormap, the maximum value maps to the last color in the colormap, and values in between are linearly transformed to span the colormap. This enables you to use colormaps of different sizes without changing your data and to use data in any range of values without changing the colormap. For example, the following patch has eight triangular faces with a total of 24 (nonunique) vertices. The color data are integers that range from one to 24, but could be any values. The variable c contains the color data. It is a 3-by-8 matrix, with each column specifying the colors for the three vertices of each face. c = 1 4 7 10 13 16 19 22 2 5 8 11 14 17 20 23 3 6 9 12 15 18 21 24 Interpreting Indexed and Truecolor Data 14-17 The color bar ( colorbar ) on the right side of the patch illustrates the colormap used and indicates with the vertical axis which color is mapped to the respective data value. You can alter the mapping of color data to colormap entry using the caxis command. This command uses a two-element vector [ cmin cmax ] to specify what data values map to the beginning and end of the colormap, thereby shifting the color mapping. By default, MATLAB sets cmin to the minimum value and cmax to the maximum value of the color data of all graphics objects within the axes. However, you can set these limits to span any range of values and thereby shift the color mapping. See “Calculating Color Limits” in the “Axes Properties” chapter for more information. The color data does not need to be a sequential list of integers; it can be any matrix with dimensions matching the coordinate data. For example, patch(x,y,z,rand(size(z))) Direct Color If you set the patch CDataMapping property to off , 2 4 6 8 10 12 14 16 18 20 22 24 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 CDataMapping = scaled 14 Creating 3-D Models with Patches 14-18 set(patch_handle,'CDataMapping','off') MATLAB interprets each color data value as a direct index into the colormap. That is, a value of 1 maps to the first color, a value of 2 maps to the second color, and so on. The patch from the previous example would then use only the first 24 colors in the colormap. This example uses integer color data. However, if the values are not integers, MATLAB converts them according to these rules: •If value is < 1, it maps to the first color in the colormap. •If value is not an integer, it is rounded to the nearest integer towards zero. •If value > length(colormap) , it maps to the last color in the colormap. Unscaled color data is more commonly used for images where there is typically a colormap associated with a particular image. 10 20 30 40 50 60 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 CDataMapping = direct Interpreting Indexed and Truecolor Data 14-19 Truecolor Patches Truecolor is a means to specify a color explicitly with RGB values rather than pointing to an entry in the figure colormap. Truecolor generally provides a greater range of colors than can be defined in a colormap. Using truecolor eliminates the mapping of data to colormap entries. On the other hand, you cannot change the coloring of the patch without redefining the color data (as opposed to just changing the colormap). You can use truecolor on computers that do not have true color (24-bit) displays. In this case, MATLAB uses a special colormap designed to produce results that are as close as possible with the limited number of colors available. Properties control how MATLAB uses color on pseudocolor machines. Interpolating in Indexed Color Versus Truecolor When you specify interpolated face coloring, MATLAB determines the color of each face by interpolating the vertex colors. The method of interpolation depends on whether you specified truecolor data or indexed color data. With truecolor data, MATLAB interpolates the numeric RGB values defined for the vertices. This generally produces a smooth variation of color across the face. In contrast, indexed color interpolation uses only colors that are defined in the colormap. With certain colormaps, the results can be quite different. To illustrate this difference, these two patches are defined with the same vertex colors. Circular markers indicate the yellow, red, and blue vertex colors. 14 Creating 3-D Models with Patches 14-20 The patch on the left uses indexed colors obtained from the six-element colormap shown next to it. The color data maps the vertex colors to the colormap elements indicated in the picture. With this colormap, interpolating from the cyan vertex to the blue vertex can include only the colors green, red, yellow, and magenta, hence the banding. Interpolation in RGB space makes no use of the colormap. It is simply the gradual transition from one numeric value to another. For example, interpolating from the cyan vertex to the blue vertex follows a progression similar to these values. 0 1 1, 0 0.9 1, 0 0.8 1, ... 0 0.2 1, 0 0.1 1, 0 0 1 In reality each pixel would be a different color so the incremental change would be much smaller than illustrated here. True Color Data Indexed Color Data 0 0 1 1 0 0 1 1 0 15 Volume Visualization Techniques Overview of Volume Visualization (p.15-3) Volume data visualization with MATLAB, including examples of available techniques. Volume Visualization Functions (p.15-5) Functions used for volume visualization. Visualizing Scalar Volume Data (p.15-8) Techniques available for visualizing scalar volume data. Visualizing MRI Data (p.15-9) Visualize MRI data using 2- and 3-D contour slices, isosurfaces, isocaps, and lighting. Exploring Volumes with Slice Planes (p.15-15) Using slice planes to scan the interior of scalar volumes. Connecting Equal Values with Isosurfaces (p.15-20) Using isosurfaces to illustrate scalar fluid-flow data. Isocaps Add Context to Visualizations (p.15-22) Using isocaps to improve the shape definition of isosurface plots. Visualizing Vector Volume Data (p.15-27) Techniques for visualizing vector volume data, including scalar techniques, determining starting points for stream plots, and plotting subregions of volumes. Stream Line Plots of Vector Data (p.15-32) Using stream lines, slice planes, and contours lines in one graph. Displaying Curl with Stream Ribbons (p.15-34) Example using stream ribbon plots to display the curl of a vector field. Displaying Divergence with Stream Tubes (p.15-36) Example using stream tube plots to display the divergence of a vector field. Slice planes and contour lines enhance the visualization. 15 Volume Visualization Techniques 15-2 Creating Stream Particle Animations (p.15-39) Example using stream lines and stream particles to create an animation illustrating wind currents. Vector Field Displayed with Cone Plots (p.15-42) Example using cone plots, isosurfaces, lighting, and camera placement to visualize a vector field. Overview of Volume Visualization 15-3 Overview of Volume Visualization Volume visualization is the creation of graphical representations of data sets that are defined on three-dimensional grids. Volume data sets are characterized by multidimensional arrays of scalar or vector data. These data are typically defined on lattice structures representing values sampled in 3-D space. There are two basic types of volume data: •Scalar volume data contains single values for each point. •Vector volume data contains two or three values for each point, defining the components of a vector. Examples of Volume Data An example of scalar volume data is that produced by the flow M-file. The flow data represents the speed profile of a submerged jet within an infinite tank. Typing [x,y,z,v] = flow; produces four 3-D arrays. The x , y , and z arrays specify the coordinates of the scalar values in the array v . The wind data set is an example of vector volume data that represents air currents over North America. You can load this data in the MATLAB workspace with the command This data set comprises six 3-D arrays: x , y , and z are the coordinate data for the arrays u , v , and w , which are the vector components for each point in the volume. Selecting Visualization Techniques The techniques you select to visualize volume data depend on what type of data you have and what you want to learn. In general, •Scalar data is best viewed with isosurfaces, slice planes, and contour slices. •Vector data represents both a magnitude and direction at each point, which is best displayed by stream lines (particles, ribbons, and tubes), cone plots, 15 Volume Visualization Techniques 15-4 and arrow plots. Most visualizations, however, employ a combination of techniques to best reveal the content of the data. The material in these sections describe how to apply a variety of techniques to typical volume data. Steps to Create a Volume Visualization Creating an effective visualization requires a number of steps to compose the final scene. These steps fall into four basic categories: 1 Determine the characteristics of your data. Graphing volume data usually requires knowledge of the range of both the coordinates and the data values. 2 Select an appropriate plotting routine. The information in this section helps you select the right methods. 3 Define the view. The information conveyed by a complex three-dimensional graph can be greatly enhanced through careful composition of the scene. Viewing techniques include adjusting camera position, specifying aspect ratio and project type, zooming in or out, and so on. 4 Add lighting and specify coloring. Lighting is an effective means to enhance the visibility of surface shape and to provide a three-dimensional perspective to volume graphs. Color can convey data values, both constant and varying. Volume Visualization Functions 15-5 Volume Visualization Functions MATLAB provides functions that enable you to apply a variety of volume visualization techniques. The following tables group these functions into two categories based on the type of data (scalar or vector) that each is designed to work with. The reference page for each function provides examples of the intended use. 15 Volume Visualization Techniques 15-6 Functions for Scalar Data Functions for Vector Data Functions Purpose contourslice Draw contours in volume slice planes isocaps Compute isosurface end-cap geometry isocolors Compute the colors of isosurface vertices isonormals Compute normals of isosurface vertices isosurface Extract isosurface data from volume data patch Create a patch (multipolygon) graphics object reducepatch Reduce the number of patch faces reducevolume Reduce the number of elements in a volume data set shrinkfaces Reduce the size of each patch face slice Draw slice planes in volume smooth3 Smooth 3-D data surf2patch Convert surface data to patch data subvolume Extract subset of volume data set Functions Purpose coneplot Plot velocity vectors as cones in 3-D vector fields curl Compute the curl and angular velocity of a 3-D vector field divergence Compute the divergence of a 3-D vector field interpstreamspeed Interpolate streamline vertices from vector-field magnitudes Volume Visualization Functions 15-7 streamline Draw stream lines from 2-D or 3-D vector data streamparticles Draw stream particles from vector volume data streamribbon Draw stream ribbons from vector volume data streamslice Draw well-spaced stream lines from vector volume data streamtube Draw stream tubes from vector volume data stream2 Compute 2-D stream line data stream3 Compute 3-D stream line data volumebounds Return coordinate and color limits for volume (scalar and vector) Functions Purpose 15 Volume Visualization Techniques 15-8 Visualizing Scalar Volume Data Typical scalar volume data is composed of a 3-D array of data and three coordinate arrays of the same dimensions. The coordinate arrays specify the x, y, and z coordinates for each data point. The units of the coordinates depend on the type of data. For example, flow data might have coordinate units of inches and data units of psi. Techniques for Visualizing Scalar Data MATLAB supports a number of functions that are useful for visualizing scalar data: •Slice planes provide a way to explore the distribution of data values within the volume by mapping values to colors. You can orient slice planes at arbitrary angles, as well as use nonplanar slices. (For illustrations of how to use slice planes, see slice , a volume slicing example, and slice planes used to show context.) You can specify the data used to color isosurfaces, enabling you to display different information in color and surface shape (see isocolors ). •Contour slices are contour plots drawn at specific coordinates within the volume. Contour plots enable you to see where in a given plane the data values are equal. See contourslice and MRI data for an example •Isosurfaces are surfaces constructed by using points of equal value as the vertices of patch graphics objects. Visualizing MRI Data 15-9 Visualizing MRI Data An example of scalar data includes Magnetic Resonance Imaging (MRI) data. This data typically contains a number of slice planes taken through a volume, such as the human body. MATLAB includes an MRI data set that contains 27 image slices of a human head. This section describes some useful techniques for visualizing MRI data. Example - Ways to Display MRI DATA This example illustrate the following techniques applied to MRI data: •A series of 2-D images representing slices through the head •2-D and 3-D contour slices taken at arbitrary locations within the data •An isosurface with isocaps showing a cross section of the interior Changing the Data Format The MRI data, D , is stored as a 128-by-128-by-1-by-27 array. The third array dimension is used typically for the image color data. However, since these are indexed images (a colormap, map , is also loaded) there is no information in the third dimension, which you can remove using the squeeze command. The result is a 128-by-128-by-27 array. The first step is to load the data and transform the data array from 4-D to 3-D. D = squeeze(D); Displaying Images of MRI Data To display one of the MRI images, use the image command, indexing into the data array to obtain the eighth image. Then adjust axis scaling, and install the MRI colormap , which was loaded along with the data. image_num = 8; image(D(:,:,image_num)) axis image colormap(map) 15 Volume Visualization Techniques 15-10 Save the x and y axis limits for use in the next part of the example. x = xlim; y = ylim; Displaying a 2-D Contour Slice You can treat this MRI data as a volume because it is a collection of slices taken progressively through the 3-D object. Use contourslice to display a contour plot of a slice of the volume. To create a contour plot with the same orientation and size as the image created in the first part of this example, adjust the y-axis direction ( axis ), set the limits ( xlim , ylim ), and set the data aspect ratio ( daspect ). contourslice(D,[],[],image_num) axis ij xlim(x) ylim(y) daspect([1,1,1]) colormap('default') This contour plot uses the figure colormap to map color to contour value. 20 40 60 80 100 120 20 40 60 80 100 120 Visualizing MRI Data 15-11 Displaying 3-D Contour Slices Unlike images, which are 2-D objects, contour slices are 3-D objects that you can display in any orientation. For example, you can display four contour slices in a 3-D view. To improve the visibility of the contour line, increase the LineWidth to 2 points (one point equals 1/72 of an inch). phandles = contourslice(D,[],[],[1,12,19,27],8); view(3); axis tight set(phandles,'LineWidth',2) 20 40 60 80 100 120 20 40 60 80 100 120 15 Volume Visualization Techniques 15-12 Displaying an Isosurface You can use isosurfaces to display the overall structure of a volume. When combined with isocaps, this technique can reveal information about data on the interior of the isosurface. First, smooth the data with smooth3 ; then use isosurface to calculate the isodata. Use patch to display this data as a graphics object. Ds = smooth3(D); hiso = patch(isosurface(Ds,5),... 'FaceColor',[1,.75,.65],... 'EdgeColor','none'); Adding an Isocap to Show a Cutaway Surface Use isocaps to calculate the data for another patch that is displayed at the same isovalue ( 5 ) as the surface. Use the unsmoothed data ( D ) to show details of the interior. You can see this as the sliced-away top of the head. hcap = patch(isocaps(D,5),... 'FaceColor','interp',... 'EdgeColor','none'); colormap(map) Visualizing MRI Data 15-13 Defining the View Define the view and set the aspect ratio ( view , axis , daspect ). view(45,30) axis tight daspect([1,1,.4]) Add lighting and recalculate the surface normals based on the gradient of the volume data, which produces smoother lighting ( camlight , lighting , isonormals ). Increase the AmbientStrength property of the isocap to brighten the coloring without affecting the isosurface. Set the SpecularColorReflectance of the isosurface to make the color of the specular reflected light closer to the color of the isosurface; then set the SpecularExponent to reduce the size of the specular spot. lightangle(45,30); set(gcf,'Renderer','zbuffer'); lighting phong isonormals(Ds,hiso) set(hcap,'AmbientStrength',.6) set(hiso,'SpecularColorReflectance',0,'SpecularExponent',50) 15 Volume Visualization Techniques 15-14 The isocap uses interpolated face coloring, which means the figure colormap determines the coloring of the patch. This example uses the colormap supplied with the data. To display isocaps at other data values, try changing the isosurface value or use the subvolume command. See the isocaps and subvolume reference pages for examples. Exploring Volumes with Slice Planes 15-15 Exploring Volumes with Slice Planes A slice plane (which does not have to be planar) is a surface that takes on coloring based on the values of the volume data in the region where the slice is positioned. Slice planes are useful for probing volume data sets to discover where interesting regions exist, which you can then visualize with other types of graphs (see the slice example). Slice planes are also useful for adding a visual context to the bound of the volume when other graphing methods are also used (see coneplot and the “Streamline Plots of Vector Data” section in this chapter for examples). Use the slice command to create slice planes. Example – Slicing Fluid Flow Data This example slices through a volume generated by the flow M-file. 1. Investigate the Data Generate the volume data with the command [x,y,z,v] = flow; Determine the range of the volume by finding the minimum and maximum of the coordinate data. xmin = min(x(:)); ymin = min(y(:)); zmin = min(z(:)); xmax = max(x(:)); ymax = max(y(:)); zmax = max(z(:)); 2. Create a Slice Plane at an Angle to the X-Axes To create a slice plane that does not lie in an axes plane, first define a surface and rotate it to the desired orientation. This example uses a surface that has the same x and y coordinates as the volume. hslice = surf(linspace(xmin,xmax,100),... linspace(ymin,ymax,100),... zeros(100)); 15 Volume Visualization Techniques 15-16 Rotate the surface by -45 degrees about the x axis and save the surface XData , YData , and ZData to define the slice plane; then delete the surface. rotate(hslice,[-1,0,0],-45) xd = get(hslice,'XData'); yd = get(hslice,'YData'); zd = get(hslice,'ZData'); delete(hslice) 3. Draw the Slice Planes Draw the rotated slice plane, setting the FaceColor to interp so that it is colored by the figure colormap and set the EdgeColor to none . Increase the DiffuseStrength to .8 to make this plane shine more brightly after adding a light source. h = slice(x,y,z,v,xd,yd,zd); set(h,'FaceColor','interp',... 'EdgeColor','none',... 'DiffuseStrength',.8) Set hold to on and add three more orthogonal slice planes at xmax , ymax , and zmin to provide a context for the first plane, which slices through the volume at an angle. hold on hx = slice(x,y,z,v,xmax,[],[]); set(hx,'FaceColor','interp','EdgeColor','none') hy = slice(x,y,z,v,[],ymax,[]); set(hy,'FaceColor','interp','EdgeColor','none') hz = slice(x,y,z,v,[],[],zmin); set(hz,'FaceColor','interp','EdgeColor','none') 4. Define the View To display the volume in correct proportions, set the data aspect ratio to [1,1,1] ( daspect ). Adjust the axis to fit tightly around the volume ( axis ) and turn on the box to provide a sense of a 3-D object. The orientation of the axes can be selected initially using rotate3d to determine the best view . Exploring Volumes with Slice Planes 15-17 Zooming in on the scene provides a larger view of the volume ( camzoom ). Selecting a projection type of perspective gives the rectangular solid more natural proportions than the default orthographic projection ( camproj ). daspect([1,1,1]) axis tight box on view(-38.5,16) camzoom(1.4) camproj perspective 5. Add Lighting and Specify Colors Adding a light to the scene makes the boundaries between the four slice planes more obvious since each plane forms a different angle with the light source ( lightangle ). Selecting a colormap with only 24 colors (the default is 64) creates visible gradations that help indicate the variation within the volume. lightangle(-45,45) colormap (jet(24)) set(gcf,'Renderer','zbuffer') 15 Volume Visualization Techniques 15-18 Modifying the Color Mapping The current colormap determines the coloring of the slice planes. This enables you to change the slice plane coloring by •Changing the colormap •Changing the mapping of data value to color Suppose, for example, you are interested in data values only between -5 and 2.5 and would like to use a colormap that mapped lower values to reds and higher values to blues (that is, the opposite of the default jet colormap). Customizing the Colormap The first step is to flip the colormap ( colormap , flipud ). colormap (flipud(jet(24))) Adjusting the color limits enables you to emphasize any particular data range of interest. Adjust the color limits to range from -5 to 2.4832 so that any value Exploring Volumes with Slice Planes 15-19 lower than the value -5 (the original data ranged from -11.5417 to 2.4832) is mapped into to same color. (See caxis and the "Axis Color Limits – The CLim Property" section in the “Axes Properties” chapter for an explanation of color mapping.) caxis([-5,2.4832]) Adding a color bar provides a key for the data to color mapping. colorbar('horiz') 15 Volume Visualization Techniques 15-20 Connecting Equal Values with Isosurfaces Isosurfaces are constructed by creating a surface within the volume that has the same value at each vertex. Isosurface plots are similar to contour plots in that they both indicate where values are equal. Isosurfaces are useful to determine where in a volume a certain threshold value is reached or to observe the spacial distribution of data by selecting various isovalues at which to generate a plot. The isovalue must lie within the range of the volume data. Create isosurfaces with the isosurface and patch commands. Example – Isosurfaces in Fluid Flow Data This example creates isosurfaces in a volume generated by the flow M-file. Generate the volume data with the command, [x,y,z,v] = flow; To select the isovalue, determine the range of values in the volume data. min(v(:)) ans = -11.5417 max(v(:)) ans = 2.4832 Through exploration, you can select isovalues that reveal useful information about the data. Once selected, use the isovalue to create the isosurface: •Use isosurface to generate data that you can pass directly to patch . •Recalculate the surface normals from the gradient of the volume data to produce better lighting characteristics ( isonormals ). •Set the patch FaceColor to red and the EdgeColor to none to produce a smoothly lit surface. daspect , view , camlight , lighting ). hpatch = patch(isosurface(x,y,z,v,0)); isonormals(x,y,z,v,hpatch) set(hpatch,'FaceColor','red','EdgeColor','none') Connecting Equal Values with Isosurfaces 15-21 daspect([1,4,4]) view([-65,20]) axis tight camlight left; set(gcf,'Renderer','zbuffer'); lighting phong 15 Volume Visualization Techniques 15-22 Isocaps are planes that are fitted to the limits of an isosurface to provide a visual context for the isosurface. Isocaps show a cross-sectional view of the interior of the isosurface for which it provides an end cap. The following two pictures illustrate the use of isocaps. The first is an isosurface without isocaps. The second picture shows the effect of adding isocaps to the same isosurface. Isocaps Add Context to Visualizations 15-23 Other Isocap Applications Some additional applications of isocaps are •Isocaps used to show the interior of a cut-away volume. •Isocaps used to cap the end of a volume that would otherwise appear empty. •Isocaps used to enhance the visibility of the isosurface limits. Defining Isocaps Isocaps, like isosurfaces, are created as patch graphics objects. Use the isocaps command to generate the data to pass to patch . For example, patch(isocaps(voldata,isoval),... 'FaceColor','interp',... 'EdgeColor','none') creates isocaps for the scalar volume data voldata at the value isoval . You should create the isosurface using the same volume data and isovalue to ensure that the edges of the isocaps fit the isosurface. 15 Volume Visualization Techniques 15-24 Setting the patch FaceColor property to interp results in a coloring that maps the data values spanned by the isocap to colormap entries. You can also set other patch properties to control the effects of lighting and coloring on the isocaps. Example – Adding Isocaps to an Isosurface This example illustrates how to set coloring and lighting characteristics when working with isocaps. There are five basic steps: •Generate and process your volume data. •Create the isosurface and isocaps and set patch properties to control the coloring and lighting. •Create the isocaps and set properties. •Specify the view. 1. Prepare the Data This example uses a 3-D array of random ( rand ) data to define the volume data. The data is then smoothed ( smooth3 ). data = rand(12,12,12); data = smooth3(data,'box',5); 2. Create the Isosurface and Set Properties Use isosurface and patch to create the isosurface and set coloring and lighting properties. Reduce the AmbientStrength , SpecularStrength , and DiffuseStrength of the reflected light to compensate for the brightness of the two light sources used to provide more uniform lighting. Recalculate the vertex normals of the isosurface to produce smoother lighting ( isonormals ). isoval = .5; h = patch(isosurface(data,isoval),... 'FaceColor','blue',... 'EdgeColor','none',... 'AmbientStrength',.2,... 'SpecularStrength',.7,... 'DiffuseStrength',.4); 15-25 isonormals(data,h) 3. Create the Isocaps and Set Properties Define the isocaps using the same data and isovalue as the isosurface. Specify interpolated coloring and select a colormap that provides better contrasting colors with the blue isosurface than those in the default colormap ( colormap ). patch(isocaps(data,isoval),... 'FaceColor','interp',... 'EdgeColor','none') colormap hsv 4. Define the View Set the data aspect ratio to [1,1,1] so that the displays in correct proportions ( daspect ). Eliminate white space within the axis and set the view to 3-D ( axis tight , view ). daspect([1,1,1]) axis tight view(3) To add fairly uniform lighting, but still take advantage of the ability of light sources to make visible subtle variations in shape, this example uses two lights; one to the left and one to the right of the camera ( camlight ). Use Phong lighting to produce the smoothest variation of color ( lighting ). Phong lighting requires the zbuffer renderer. camlight right camlight left set(gcf,'Renderer','zbuffer'); lighting phong 15 Volume Visualization Techniques 15-26 Visualizing Vector Volume Data 15-27 Visualizing Vector Volume Data Vector volume data contains more information than scalar data because each coordinate point in the data set has three values associated with it. These values define a vector that represents both a magnitude and a direction. The velocity of fluid flow is an example of vector data. MATLAB supports a number of techniques that are useful for visualizing vector data: •Stream lines trace the path that a massless particle immersed in the vector field would follow. •Stream particles are markers that trace stream lines and are useful for creating stream line animations. •Stream ribbons are similar to stream lines, except that the width of the ribbons enable them to indicate twist. Stream ribbons are useful to indicate curl angular velocity. •Stream tubes are similar to stream lines, but you can also control the width of the tube. Stream tubes are useful for displaying the divergence of a vector field. •Cone plots represent the magnitude and direction of the data at each point by displaying a conical arrowhead or an arrow. It is typically the case that these functions best elucidate the data when used in conjunction with other visualization techniques, such as contours, slice planes, and isosurfaces. The examples in this section illustrate some of these techniques. Using Scalar Techniques with Vector Data Visualization techniques such as contour slices, slice planes, and isosurfaces require scalar volume data. You can use these techniques with vector data by taking the magnitude of the vectors. For example, the wind data set returns three coordinate arrays and three vector component arrays, u , v , w . In this case, the magnitude of the velocity vectors equals the wind speed at each corresponding coordinate point in the volume. wind_speed = sqrt(u.^2 + v.^2 + w.^2); 15 Volume Visualization Techniques 15-28 The array wind_speed contains scalar values for the volume data. The usefulness of the information produced by this approach, however, depends on what physical phenomena is represented by the magnitude of your vector data. Specifying Starting Points for Stream Plots Stream plots (stream lines, ribbons, tubes, and cones or arrows) illustrate the flow of a 3-D vector field. The MATLAB stream plotting routines ( streamline , streamribbon , streamtube , coneplot , stream2 , stream3 ) all require you to specify the point at which you want to begin each stream trace. Determining the Starting Points Generally, knowledge of your data’s characteristics help you select the starting points. Information such as the primary direction of flow and the range of the data coordinates helps you decide where to evaluate the data. The streamslice function is useful for exploring your data. For example, these statements draw a slice through the vector field at a z value midway in the range. load wind zmax = max(z(:)); zmin = min(z):)); streamslice(x,y,z,u,v,w,[],[],(zmax-zmin)/2) Visualizing Vector Volume Data 15-29 This stream slice plot indicates that the flow is in the positive x direction and also enables you to select starting points in both x and y. You could create similar plots that slice the volume in the x-z plane or the y-z plane to gain further insight into your data’s range and orientation. Specifying Arrays of Starting-Point Coordinates To specify the starting point for one stream line, you need the x-, y-, and z-coordinates of the point. The meshgrid command provides a convenient way to create arrays of starting points. For example, you could select the following starting points from the wind data displayed in the previous stream slice. [sx,sy,sz] = meshgrid(80,20:10:50,0:5:15); This statement defines the starting points as all lying on x = 80, y ranging from 20 to 50, and z ranging from 0 to 15. You can use plot3 to display the locations. plot3(sx(:),sy(:),sz(:),'*r'); axis(volumebounds(x,y,z,u,v,w)) grid; box; daspect([2 2 1]) You do not need to use 3-D arrays, such as those returned by meshgrid , but the size of each array must be the same, and meshgrid provides a convenient way to generate arrays when you do not have an equal number of unique values in 80 90 100 110 120 130 20 30 40 50 0 5 10 15 15 Volume Visualization Techniques 15-30 each coordinate. You can also define starting-point arrays as column vectors. For example, meshgrid returns 3-D arrays. [sx,sy,sz] = meshgrid(80,20:10:50,0:5:15); whos Name Size Bytes Class sx 4x1x4 128 double array sy 4x1x4 128 double array sz 4x1x4 128 double array In addition, you could use 16-by-1 column vectors with the corresponding elements of the three arrays comprising the coordinates of each starting point. (This is the equivalent of indexing the values returned by meshgrid as sx(:) , sy(:) , and sz(:) .) For example, adding the stream lines produces streamline(x,y,z,u,v,w,sx(:),sy(:),sz(:)) Accessing Subregions of Volume Data The subvolume function provides a simple way to access subregions of a volume data set. subvolume enables you to select regions of interest based on limits rather than using the colon operator to index into the 3-D arrays that define 80 90 100 110 120 130 20 30 40 50 0 5 10 15 Visualizing Vector Volume Data 15-31 volumes. Consider the following two approaches to creating the data for a subvolume – indexing with the colon operator and using subvolume . Indexing with the Colon Operator When you index the arrays, you work with values that specify the elements in each dimension of the array. xsub = x(1:10,20:30,1:7); ysub = y(1:10,20:30,1:7); zsub = z(1:10,20:30,1:7); usub = u(1:10,20:30,1:7); vsub = v(1:10,20:30,1:7); wsub = w(1:10,20:30,1:7); Using the subvolume Function subvolume enables you to use coordinate values that you can read from the axes. For example, lims = [100.64 116.67 17.25 28.75 -0.02 6.86]; [xsub,ysub,zsub,usub,vsub,wsub] = subvolume(x,y,z,u,v,w,lims); You can then use the subvolume data as inputs to any function requiring vector volume data. 15 Volume Visualization Techniques 15-32 Stream Line Plots of Vector Data MATLAB includes a vector data set called wind that represents air currents over North America. This example uses a combination of techniques: •Stream lines to trace the wind velocity •Slice planes to show cross-sectional views of the data •Contours on the slice planes to improve the visibility of slice-plane coloring 1. Determine the Range of the Coordinates Load the data and determine minimum and maximum values to locate the slice planes and contour plots ( , min , max ). xmin = min(x(:)); xmax = max(x(:)); ymax = max(y(:)); zmin = min(z(:)); 2. Add Slice Planes for Visual Context Calculate the magnitude of the vector field (which represents wind speed) to generate scalar data for the slice command. Create slice planes along the x-axis at xmin , 100 , and xmax , along the y-axis at ymax , and along the z-axis at zmin . Specify interpolated face coloring so the slice coloring indicates wind speed, and do not draw edges ( sqrt , slice , FaceColor , EdgeColor ). wind_speed = sqrt(u.^2 + v.^2 + w.^2); hsurfaces = slice(x,y,z,wind_speed,[xmin,100,xmax],ymax,zmin); set(hsurfaces,'FaceColor','interp','EdgeColor','none') 3. Add Contour Lines to the Slice Planes Draw light gray contour lines on the slice planes to help quantify the color mapping ( contourslice , EdgeColor , LineWidth ). hcont = ... contourslice(x,y,z,wind_speed,[xmin,100,xmax],ymax,zmin); set(hcont,'EdgeColor',[.7,.7,.7],'LineWidth',.5) Stream Line Plots of Vector Data 15-33 4. Define the Starting Points for the Stream Lines In this example, all stream lines start at an x-axis value of 80 and span the range 20 to 50 in the y direction and 0 to 15 in the z direction. Save the handles of the stream lines and set the line width and color ( meshgrid , streamline , LineWidth , Color ). [sx,sy,sz] = meshgrid(80,20:10:50,0:5:15); hlines = streamline(x,y,z,u,v,w,sx,sy,sz); set(hlines,'LineWidth',2,'Color','r') 5. Define the View Set up the view, expanding the z-axis to make it easier to read the graph ( view , daspect , axis ). view(3) daspect([2,2,1]) axis tight See coneplot for an example of the same data plotted with cones. 15 Volume Visualization Techniques 15-34 Displaying Curl with Stream Ribbons Stream ribbons illustrate direction of flow, similar to stream lines, but can also show rotation about the flow axis by twisting the ribbon-shaped flow line. The streamribbon function enables you to specify a twist angle (in radians) for each vertex in the stream ribbons. When used in conjunction with the curl function, streamribbon is useful for displaying the curl angular velocity of a vector field. The following example illustrates this technique. 1. Select a Subset of Data to Plot Load and select a region of interest in the wind data set using subvolume . Plotting the full data set first can help you select a region of interest. load wind lims = [100.64 116.67 17.25 28.75 -0.02 6.86]; [x,y,z,u,v,w] = subvolume(x,y,z,u,v,w,lims); 2. Calculate Curl Angular Velocity and Wind Speed Calculate the curl angular velocity and the wind speed. cav = curl(x,y,z,u,v,w); wind_speed = sqrt(u.^2 + v.^2 + w.^2); 3. Create the Stream Ribbons •Use meshgrid to create arrays of starting points for the stream ribbons. See "Starting Points for Stream Plots" in this chapter for information on specifying the arrays of starting points. • stream3 calculates the stream line vertices with a step size of .5 • streamribbon scales the width of the ribbon by a factor of 2 to enhance the visibility of the twisting (which indicates curl angular velocity). • streamribbon returns the handles of the surface objects it creates, which are then used to set the color to red ( FaceColor ), the color of the surface edges to light gray ( EdgeColor ), and slightly increase the brightness of the ambient light reflected when lighting is applied ( AmbientStrength ). [sx sy sz] = meshgrid(110,20:5:30,1:5); verts = stream3(x,y,z,u,v,w,sx,sy,sz,.5); Displaying Curl with Stream Ribbons 15-35 h = streamribbon(verts,x,y,z,cav,wind_speed,2); set(h,'FaceColor','r',... 'EdgeColor',[.7 .7 .7],... 'AmbientStrength',.6) 4. Define the View and Add Lighting •The volumebounds command provides a convenient way to set axis and color limits. •Add a grid a set the view for 3-D ( streamribbon does not change the current view). • camlight creates a light positioned to the right of the view point and lighting sets the lighting method to Phong (which requires the zbuffer renderer). axis(volumebounds(x,y,z,wind_speed)) grid on view(3) camlight right; set(gcf,'Renderer','zbuffer'); lighting phong 15 Volume Visualization Techniques 15-36 Displaying Divergence with Stream Tubes Stream tubes are similar to stream lines, except the tubes have width, providing another dimension that you can use to represent information. By default, MATLAB indicates the divergence of the vector field by the width of the tube. You can also define widths for each tube vertex and thereby map other data to width. This example uses the following techniques: •Stream tubes indicate flow direction and divergence of the vector field in the wind data set. •Slice planes colored to indicate the speed of the wind currents overlaid with contour line to enhance visibility Inputs include the coordinates of the volume, vector field components, and starting location for the stream tubes. 1. Load Data and Calculate Required Values The first step is to load the data and calculate values needed to make the plots. These values include •The location of the slice planes (maximum x , minimum y , and a value for the altitude) •The minimum x value for the start of the stream tubes •The speed of the wind (magnitude of the vector field) xmin = min(x(:)); xmax = max(x(:)); ymin = min(y(:)); alt = 7.356; % z-value for slice and streamtube plane wind_speed = sqrt(u.^2 + v.^2 + w.^2); 2. Draw the Slice Planes Draw the slice planes ( slice ) and set surface properties to create a smoothly colored slice. Use 16 colors from the hsv colormap . hslice = slice(x,y,z,wind_speed,xmax,ymin,alt); set(hslice,'FaceColor','interp','EdgeColor','none') Displaying Divergence with Stream Tubes 15-37 colormap hsv(16) 3. Add Contour Lines to Slice Planes contourslice ) to the slice planes. Adjust the contour interval so the lines match the color boundaries in the slice planes by •Calling caxis to get the current color limits •Setting the interpolation method used by contourslice to linear to match the default used by slice . color_lim = caxis; cont_intervals = linspace(color_lim(1),color_lim(2),17); hcont = contourslice(x,y,z,wind_speed,xmax,ymin,... alt,cont_intervals,'linear'); set(hcont,'EdgeColor',[.4 .4 .4],'LineWidth',1) 4. Create the Stream Tubes Use meshgrid to create arrays for the starting points for the stream tubes, which begin at the minimum x value, range from 20 to 50 in y , and lie in a single plane in z (corresponding to one of the slice planes). The stream tubes ( streamtube ) are drawn at the specified locations and scaled to be 1.25 times the default width to emphasize the variation in divergence (width). The second element in the vector [1.25 30] specifies the number of points along the circumference of the tube (the default is 20). You may want to increase this value as the tube size increases to maintain a smooth-looking tube. Set the data aspect ratio ( daspect ) before calling streamtube . Stream tubes are surface objects therefore you can control their appearance by setting (surface properties). This example sets surface properties to give a brightly lit, red surface. [sx,sy,sz] = meshgrid(xmin,20:3:50,alt); daspect([1,1,1]) % set DAR before calling streamtube htubes = streamtube(x,y,z,u,v,w,sx,sy,sz,[1.25 30]); set(htubes,'EdgeColor','none','FaceColor','r',... 'AmbientStrength',.5) 15 Volume Visualization Techniques 15-38 5. Define the View The final step is to define the view and add lighting ( view , axis volumebounds , Projection , camlight ). view(-100,30) axis(volumebounds(x,y,z,wind_speed)) set(gca,'Projection','perspective') camlight left Creating Stream Particle Animations 15-39 Creating Stream Particle Animations A stream particle animation is useful for visualizing the flow direction and speed of a vector field. The “particles” (represented by any of the line markers) trace the flow along a particular stream line. The speed of each particle in the animation is proportional to the magnitude of the vector field at any given point along the stream line. 1. Specify the Starting Points of the Data Range to Plot This example determines the region of the volume to plot by specifying the appropriate starting points. In this case, the stream plots begin a x = 100, y spans 20 to 50 and in the z = 5 plane. Note that this is not the full volume bounds. [sx sy sz] = meshgrid(100,20:2:50,5); 2. Create Stream Lines to Indicate the Particle Paths This example uses stream lines ( stream3 , streamline ) to trace the path of the animated particles. This adds a visual context for the animation. Another possibility is to set the EraseMode property of the stream particle to none, which would be useful for a single trace through the volume. verts = stream3(x,y,z,u,v,w,sx,sy,sz); sl = streamline(verts); 3. Define the View While all of the stream lines start in the z = 5 plane, the values of some spiral down to lower values. The following settings provide a clear view of the animation: •The viewpoint ( view ) selected shows both the plane containing most stream lines as well as the spiral. •Selecting a data aspect ratio ( daspect ) of [2 2 0.125] provides greater resolution in the z-direction to make the stream particles more easily visible in the spiral. •Set the axes limits to match the data limits ( axis ) and draw the axis box ( box ). 15 Volume Visualization Techniques 15-40 view(-10.5,18) daspect([2 2 0.125]) axis tight; box on 4. Calculate the Stream Particle Vertices The first step is to determine the vertices along the stream line where a particle should be drawn. The interpstreamspeed function returns this data based on the stream line vertices and the speed of the vector data. This example scales the velocities 0.05 to increase the number of interpolated vertices. Setting the axes DrawMode property to fast enables the animation to run faster. The streamparticles function sets the following properties: • Animate to 10 to run the animation 10 times • ParticleAlignment to on to start all particle traces together • MarkerEdgeColor to none to draw only the face of the circular marker. Animations usually run faster when marker edges are not drawn. • MarkerFaceColor to red • Marker to o , which draws a circular marker. You can use other line markers as well. iverts = interpstreamspeed(x,y,z,u,v,w,verts,0.05); set(gca,'drawmode','fast'); streamparticles(iverts,15,... 'Animate',10,... 'ParticleAlignment','on',... 'MarkerEdgeColor','none',... 'MarkerFaceColor','red',... 'Marker','o'); Creating Stream Particle Animations 15-41 15 Volume Visualization Techniques 15-42 Vector Field Displayed with Cone Plots This example plots the velocity vector cones for the wind data. The graph produced employs a number of visualization techniques: •An isosurface is used to provide visual context for the cone plots and to provide means to select a specific data value for a set of cones. •Lighting enables the shape of the isosurface to be clearly visible. •The use of perspective projection, camera positioning, and view angle adjustments compose the final view. 1. Create an Isosurface Displaying an isosurface within the rectangular space of the data provides a visual context for the cone plot. Creating the isosurface requires a number of steps: •Calculate the magnitude of the vector field, which represents the speed of the wind. •Use isosurface and patch to draw an isosurface illustrating where in the rectangular space the wind speed is equal to a particular value. Regions inside the isosurface have higher wind speeds, regions outside the isosurface have lower wind speeds. •Use isonormals to compute vertex normals of the isosurface from the volume data rather than calculate the normals from the triangles used to render the isosurface. These normals generally produce more accurate results. •Set visual properties of the isosurface, making it red and without edges drawn ( FaceColor , EdgeColor ). wind_speed = sqrt(u.^2 + v.^2 + w.^2); hiso = patch(isosurface(x,y,z,wind_speed,40)); isonormals(x,y,z,wind_speed,hiso) set(hiso,'FaceColor','red','EdgeColor','none'); 2. Add Isocaps to the Isosurface Isocaps are similar to slice planes in that they show a cross section of the volume. They are designed to be the end caps of isosurfaces. Using interpolated face color on an isocap causes a mapping of data value to color in the current Vector Field Displayed with Cone Plots 15-43 colormap. To create isocaps for the isosurface, define them at the same isovalue ( isocaps , patch , colormap ). hcap = patch(isocaps(x,y,z,wind_speed,40),... 'FaceColor','interp',... 'EdgeColor','none'); colormap hsv 3. Create First Set of Cones •Use daspect to set the data aspect ratio of the axes before calling coneplot so MATLAB can determine the proper size of the cones. •Determine the points at which to place cones by calculating another isosurface that has a smaller isovalue (so the cones display outside the first isosurface) and use reducepatch to reduce number of faces and vertices (so there are not too many cones on the graph). •Draw the cones and set the face color to blue and the edge color to none. daspect([1,1,1]); [f verts] = reducepatch(isosurface(x,y,z,wind_speed,30),0.07); h1 = coneplot(x,y,z,u,v,w,verts(:,1),verts(:,2),verts(:,3),3); set(h1,'FaceColor','blue','EdgeColor','none'); 4. Create Second Set of Cones •Create a second set of points at values that span the data range ( linspace , meshgrid ). •Draw a second set of cones and set the face color to green and the edge color to none. xrange = linspace(min(x(:)),max(x(:)),10); yrange = linspace(min(y(:)),max(y(:)),10); zrange = 3:4:15; [cx,cy,cz] = meshgrid(xrange,yrange,zrange); h2 = coneplot(x,y,z,u,v,w,cx,cy,cz,2); set(h2,'FaceColor','green','EdgeColor','none'); 15 Volume Visualization Techniques 15-44 5. Define the View •Use the axis command to set the axis limits equal to the minimum and maximum values of the data and enclose the graph in a box to improve the sense of a volume ( box ). •Set the projection type to perspective to create a more natural view of the volume. Set the view point and zoom in to make the scene larger ( camproj , camzoom , view ). axis tight box on camproj perspective camzoom(1.25) view(65,45) Add a light source and use Phong lighting for the smoothest lighting of the isosurface (Phong lighting requires the zbuffer renderer). Increase the strength of the background lighting on the isocaps to make them brighter ( camlight , lighting , AmbientStrength ). camlight(-45,45) set(gcf,'Renderer','zbuffer'); lighting phong set(hcap,'AmbientStrength',.6) Vector Field Displayed with Cone Plots 15-45 15 Volume Visualization Techniques 15-46 I-1 Index A alpha values 13-3 ambient light 12-12 AmbientLightColor property 12-8 illustration 12-12 AmbientStrength property 12-8 illustration 12-12 animation 4-50 erase modes for 4-52 movies 4-50 annotating graphs 3-1 adding plots of data statistics 3-33 annotations area 4-2, 4-11 area graphs 4-2, 4-11 arrays, storing images 5-4 arrow annotations arrows aspect ratio 11-41–11-55 for realistic objects 11-54 properties that affect 11-46 specifying 11-50 aspect ratio of figures 6-34, 6-36 axes aspect ratio 11-41, 11-46 2-D 2-23 3-D 11-41 properties that affect 11-46 specifying 11-50 automatic modes 8-19 axis control 8-10 axis direction 8-13 camera properties 11-30 CLim property 8-25 color limits 8-25 ColorOrder property 8-30 colors 8-22 controlling the shape of 11-50 default aspect ratio 11-47 individual axis control 8-10 labeling 3-15 labels font properties 8-4 using TeX characters 3-25 limits 11-41 example 11-53 locking position 1-7 making grids coincident 8-17 multi-axis 8-16 multiple 2-26, 8-7 NextPlot property 7-37 overlapping 8-7 plot box 11-8 position rectangle 11-31 positioning 8-5–8-9 preparing to accept graphics 7-36 properties for labeling 8-3 properties of 1-8 protecting from output 7-42 scaling 11-41 independent 8-8 setting Index I-2 limits 8-11 line styles used for plotting 8-31 setting limits 2-19 standard plotting behavior 7-41 stretch-to-fill 11-41 target for graphics 2-28 tick marks 2-21 locating 8-12 units 8-6 unlocking position 1-7 with two x and y axes 8-16 axis 5-2 axis 11-41 auto 11-41 equal 2-24, 11-42 ij 11-42 illustrated examples, 2-D 2-24 illustrated examples, 3-D 11-43 image 5-20, 11-42 manual 11-42 normal 11-42 square 2-24, 11-42 tight 2-25, 11-42 vis3d 11-42 xy 11-42 axis labels, rotating 3-13 azimuth of viewpoint 11-4 default 2-D 11-5 default 3-D 11-5 limitations 11-7 B BackFaceLighting property 12-9 illustration 12-14 background color, of text 3-29 backing store 9-15 bar 4-2, 4-3 bar graphs 4-2–4-11 3-D 4-3 grouped 2-D 4-2 3-D 4-4 horizontal 4-6 labeling 4-4, 4-7 overlaid with plots 4-9 stacked 4-5 bar3 4-2, 4-3 bar3h 4-2 barh 4-2 binary images 5-8 bins, specifying for histogram 4-20 BMP 5-2 brighten 10-19 buttons on toolbar 1-13, 1-14, 3-18, 3-32 C callbacks function handles used for 7-53 using function handles for 7-53 camdolly 11-21 camera position, moving 11-31 camera properties 11-30 illustration showing 11-8 camera toolbar 11-9 CameraPosition property 11-30 and perspective 11-31 fly-by 11-31 CameraPositionMode property 11-30 CameraTarget property 11-30 CameraTargetMode property 11-30 CameraUpVector property 11-30, 11-34 example 11-35 Index I-3 CameraUpVectorMode property 11-30 CameraViewAngle property 11-30 and perspective 11-33 zooming with 11-33 CameraViewAngleMode property 11-30, 11-33 camlookat property 11-21 camorbit 11-21 campan 11-21 campos 11-21 camproj 11-21 camroll 11-21 camtarget 11-21 camup 11-21 camva 11-21 camzoom 11-21 CData property images 5-23 patches 14-11 CDataMapping property 10-17 images 5-23 patches 14-11 cla 7-37 clabel 4-37, 4-39 clf 7-37 close 7-44 close request function default 7-44 closereq.m 7-44 CloseRequestFcn property 7-44 default value 7-44 errors in 7-45 overriding 7-45 closing figures 7-44 closing MATLAB, errors occurring when 7-45 color limits, calculating 8-26 color property of lights 12-4 colorbar 10-15 colordef 2-29 colormap 10-14 colormaps altering 10-19 brightening 10-19 brightness component of TV signal 10-20 displaying 10-15 for surfaces 10-14 functions that create 10-15 large 9-9 minimum size 9-10 range of RGB values in 10-14 simulating multiple 8-25 size of dithermap 9-14 ColorOrder 8-29 colors changing color scheme 8-23 colormaps 9-8, 10-14 controlled by axes 8-22 controlled by figure properties 9-7 dithering 9-12, 10-22 effects of dithering 9-14 fixed 9-8 indexed 10-13, 10-14 direct 10-16 scaled 10-16 indexed and dithering 9-12 interpreted by surfaces 10-13 mapping to data 8-25 NTSC encoding of 10-20 of patches 14-11 of surface plots 10-13 scaling algorithm 10-17 shared 9-11 size of dithermap 9-14 specifying Figure colors 2-28 specifying for surface plot, example 10-17 Index I-4 truecolor 10-13 on indexed color systems 10-22 specifying 10-20 typical RGB values 10-14 used for plotting 8-29 using a large number 9-9 compass 4-31 compass plots 4-31 complex numbers, plotting 2-15 with feather 4-33 cone plots 15-42 contour 4-37 contour plots 4-37 algorithm 4-42 filled 4-40 in polar coordinates 4-44 labeling 4-39 specifying contour levels 4-41, 4-43 contour3 4-37 contourc 4-37, 4-42 contourf 4-37, 4-40 conv2 5-13 converting the data class of an indexed image 5-11 convn 5-13 coordinate system and viewpoint 11-4 copying figures 1-10 options 1-10 copying graphics objects 7-32 current Axes 7-29 Figure 7-29 object 7-29 cursors, see pointers D data statistics formatting plots of of 3-36 plotting 3-33, 3-36 Data Statistics tool example 3-34 interface 3-34 overview 1-22 saving to workspace 3-38 data types 8-bit integers 5-4 double-precision 5-4 DataAspectRatio property 11-46 example 11-50 images 5-21 DataAspectRatioMode property 11-46 default aspect ratio 11-47 of figure windows 6-34 azimuth 2-D 11-5 3-D 11-5 CameraPosition 11-31 CameraTarget 11-31 CameraUpVector 11-31 CameraViewAngle 11-31 CloseRequestFcn 7-44 elevation 2-D 11-5 3-D 11-5 factory 7-21 figure color scheme 2-28 Projection 11-31 property values 7-22–?? removing 7-24 search path, diagram 7-22 setting to factory defaults 7-25 Index I-5 view 11-31 default line styles, setting and removing 2-11 del2 10-17 deleting graphics objects 7-34 deselecting objects 1-7 diffuse reflection 12-11 DiffuseStrength property 12-8 illustration 12-11 direct color mapping 10-16 direction cosines 11-34 discrete data graphs 4-22–4-30 stairstep plots 4-29 stem plots 4-22 dithering 9-12 algorithm 9-12 effects of 9-14 Dithermap property 9-12 DithermapMode property 9-12, 9-13 documentation 1-12 double 5-29 double converting double to uint8 or uint16 5-11 converting image data to double 5-29 double buffering 9-15 double converting double to uint16 5-12 double converting double to uint8 5-12 E edge effects and lighting 12-15 EdgeColor property 12-9 EdgeLighting property 12-9 edges of patches 14-14 starting Property Editor 1-16 editing plots interactively 1-5 efficient programming 7-47, 7-48 elevation of viewpoint 11-4 default 2-D 11-5 default 3-D 11-5 limitations 11-7 ending plot edit mode 1-6 erase modes 4-52 and printing 4-54 background 4-54 images 5-26 none 4-52 xor 4-55 errors closing MATLAB 7-45 examples 3-D graph 10-2 animation 4-52 area graphs 4-11 axis 11-43 bar graphs 4-3 changing CameraPosition 11-32 contour plots 4-37 copying graphics objects 7-32 custom pointers 9-20 DataAspectRatio property 11-50 del2 10-17 direction and velocity graphs 4-31 direction cosines 11-34 discrete data graphs 4-22 displaying real objects 11-54 double axis graphs 8-16 finding objects handles 7-31 histograms 4-17 hold 7-42 line 7-39 linspace 10-9 meshgrid 10-3, 10-9 movies 4-51 Index I-6 multiline text 3-28 newplot 7-39 object creation functions 7-12 of lighting 12-2 overlapping axes 8-7 parametric surfaces 10-11 pie charts 4-14 placing text dynamically 3-23 plot 2-2 complex data 2-15 plot3 10-3 PlotBoxAspectRatio property 11-51 plotting linestyles 8-31 ScreenSize property 9-5 setting default property values 7-25 simulating multiple colormaps 8-25 specifying figure position 9-5 specifying truecolor surfaces 10-20 stretch-to-fill 11-50 subplot 2-26 text 3-18 texture mapping 10-23 unevenly sampled data 10-8 view 11-33 exporting Enhanced Metafiles 6-64 exporting figures 1-10 EPS files 6-64 formats choosing a format 6-57 MATLAB and GhostScript 6-59 vector or bitmap 6-59 JPEG files 6-66 LaTeX importing example 6-19 lighting 6-62 publication quality 6-65 TIFF files 6-66 transparency 6-62 extent of computer screen 9-4 F FaceColor property 12-9 FaceLighting property 12-8 Faces property 14-7 FaceVertexCData property 14-9, 14-11 factory defaults 7-21 feather 4-31, 4-32 feather plots 4-32 fft2 5-13 fftn 5-13 figure files 1-9 figures CloseRequestFcn 7-44 closing 7-44 copying 1-10 defining custom pointers 9-19 defining pointers 9-18 defining the color of 2-28 fixed colors 9-8 for plotting 2-26 index color properties 9-7 introduction to 9-2 NextPlot property 7-37 nonactive 9-11 opening 1-9 positioning 9-3 positioning example 9-5 preparing to accept graphics 7-36 printing default figure size for printing 6-34 Index I-7 protecting from output 7-42 rendering properties 9-15 saving 1-9 specifying pointers 9-18 standard plotting behavior 7-41 units 9-4 visible property 7-44 with multiple axes 2-26 files exporting 1-10 figure fig 1-9 formats for figures 1-10 opening 1-9 printing 1-10 saving 1-9 fill , properties changed by 7-48 fill3 , properties changed by 7-48 findobj 7-31 fixed colors 9-8 FixedColors property 9-8 Floyd-Steinberg dithering algorithm 9-12 fly-by effect 11-31 fonts axis labels 8-4 formats for figures 1-10 function handles Handle Graphics callbacks 7-53 functions convenience forms 7-15 high-level vs. low-level 7-14 to create graphics objects 7-11 G gca 7-30 handle visibility 7-43 gcf 7-30 handle visibility 7-43 gco 7-30 get 7-17 getframe 4-50 GIF graphic file format 6-66 ginput 4-48 Gouraud lighting algorithm 12-10 4-35 graphical input 4-48 graphics M-files, structure of 7-40 graphics file formats list of formats supported by MATLAB 5-2 graphics images 16-bit intensity 5-12 8-bit intensity 5-12 RGB 5-12 converting from one format to another 5-29 converting to RGB 5-29 writing to file 5-16 graphics objects 7-3 accessing handles 7-29 accessing hidden handles 7-43 axes 7-6 controlling where they draw 7-36 copying 7-32 deleting 7-34 editing properties 1-8, 1-17 figures 7-4 function handle callbacks 7-53 functions that create 7-11 convenience forms 7-15 Index I-8 handle validity versus visibility 7-45 HandleVisibility property 7-42 hierarchy 7-2 images 7-6 invisible handles 7-42 lights 7-6 line 7-6 patches 7-7 properties 7-8 changed by functions 7-48 changed when created 7-13 common to all objects 7-9 factory defined 7-21 getting current values 7-19 listing possible values 7-18 querying in groups 7-21 search path for default values 7-22 searching for 7-31 setting values 7-17 property names 7-15 rectangle 7-7 root 7-4 setting parent of 7-14 specifying tag value 1-20 surface 7-7 text 7-7 uicontrol 7-4 graphs area 4-11–4-13 bar 4-2–4-11 horizontal 4-6 compass plots 4-31 contour plots 4-37–4-46 direction and velocity 4-31–4-36 discrete data 4-22–4-30 feather plots 4-32 histograms 4-17–4-21 labeling 3-1 pie charts 4-14–4-16 quiver plots 4-34 stairstep plots 4-29 steps to create 3-D 10-2 with double axes 8-16 grayscale 5-17 Greek characters see text function using to annotate 3-15 griddata 10-9 grids, coincident 8-17 H Handle Graphics graphics objects 7-3 hierarchy of graphics objects 7-2 handles to graphics objects 7-29 finding 7-31 handles, saving in M-files 7-47 HandleVisibility property 7-42 HDF 5-2 help 1-12 hidden 10-12 hidden line removal 10-12 high-level functions 7-14 hist 4-17 histograms 4-17 in polar coordinates 4-19 labeling the bins 4-20 rose plot 4-19 specifying number of bins 4-20 Index I-9 hold 2-7 and NextPlot 7-38 testing state of 7-41 hold state, testing for 7-41 HorizontalAlignment property 3-22 I image 5-2 image 5-19 properties changed by 7-49 image types binary 5-8 images 16-bit 5-11 indexed 5-11 8-bit 5-11 indexed 5-11 data types 5-4 erase modes 5-26 indexed 5-6 intensity 5-7 numeric classes 5-2 printing 5-28 properties 5-23 CData 5-23 CDataMapping 5-23 XData and YData 5-24 RGB 5-9 size and aspect ratio 5-19 storing in MATLAB 5-4 truecolor 5-9 types 5-6 imagesc 5-2 imagesc 5-8 imagesc 5-8 imfinfo 5-3 imfinfo 5-16 5-15 imwrite 5-3 imwrite 5-16 ind2rgb 5-29 indexed color displays 9-7 dithering truecolor 9-12 surfaces 10-13 indexed images converting the data class of 5-11 indexed_color_surfaces 10-16 indirgb 5-3 Inf s, avoiding in data 10-6 intensity images converting the data class of 5-12 interpolated colors patches 14-9 indexed vs. truecolor 14-19 interpreter property 3-26 ishold 7-41 isosurface illustrating flow data 15-20 J JPEG 5-2 L labeling axes 3-11 labeling graphs 3-1, 3-11 Laplacian of a matrix 10-17 Index I-10 LaTeX. See TeX legend editing text labels 3-9 positioning in a graph 3-8 legend 4-25 legends with data statistics 3-35 light 12-4 lighting 12-2–12-18 algorithms flat 12-10 Gouraud 12-10 Phong 12-10 ambient light 12-12 backface 12-14 diffuse reflection 12-11 important properties 12-4 properties that affect 12-8 reflectance characteristics 12-11–12-14 specular color 12-14 exponent 12-13 reflection 12-11 lighting command 12-10 limits axes 2-19, 8-11 line styles used for plotting 2-5 redefining 8-31 lines annotations 1-13 marker types 2-5 properties of 1-8 removing hidden 10-12 styles 2-5 LineStyleOrder property 8-31 linspace 10-8 locking axes position 1-7 loglog , properties changed by 7-49 low-level functions 7-14 M mapping data to color 8-25 markers used for plotting 2-5 material command 12-11 mathematical functions visualizing with surface plot 10-6 MATLAB 4 color scheme 2-29 MATLAB, quitting 7-45 matrix displaying contours 4-38 plotting 2-13 representing as area graph 4-11 bar graph 4-3 histogram 4-18 surface 10-5 storing images 5-4 mesh 10-5 meshc 4-43 meshgrid 10-6 M-files basic structure of graphics 7-40 closereq 7-44 to set color mapping 8-28 using newplot 7-38 writing efficient 7-47 min plotting 3-33 Index I-11 MinColormap property 9-9 movie 4-50, 4-51 movies 4-50 example 4-51 moving objects 1-7 MRI data, visualizing 15-9 multiaxis axes 8-16 multiline text 3-28 N in Property Editor 1-18 newplot 7-38 example using 7-39 NextPlot property 7-37 7-37 replace 7-37 replacechildren 7-37, 7-41 setting plotting color order 8-30 nonuniform data, plotting 10-8 NormalMode property 12-9 NTSC color encoding 10-20 O object properties editing 1-15 open 1-9, 1-10 OpenGL 9-16, 9-17 printing 6-43 opening figures 1-9 options for copying 1-10 organization of Handle Graphics 7-2 orient example 6-41 orthographic projection 11-36 and Z-buffer 11-38 P page setup 1-10 painters algorithm 9-16 paper type setting from the command line 6-39 paper type for printing setting from the command line 6-39 PaperPosition property example 6-37 PaperType property example 6-39 parametric surfaces 10-10 parent, of graphics object 7-14 patch behavior of function 14-2 interpreting color 14-3 patches coloring 14-11 edges 14-13 face coloring flat 14-8 interpolated 14-9 indexed color 14-16 direct 14-17 scaled 14-16 interpreting color data 14-16 multifaceted 14-6 single polygons 14-4 specifying faces and vertices 14-7 truecolor 14-19 ways to specify 14-2 Index I-12 PCX 5-2 perspective projection 11-36 and Z-buffer 11-38 Phong lighting algorithm 12-10 pie charts 4-14 labeling 4-15 offsetting a slice 4-14 removing a piece 4-16 plot 2-2 properties changed by 7-49 plot box 11-8 plot edit mode, starting and ending 1-6 plot editing mode overview 1-5 plot3 10-3 properties changed by 7-50 PlotBoxAspectRatio property 11-46 example 11-51 PlotBoxAspectRatioMode property 11-46 plotedit 1-6 plots editing object in 1-17 plotting 3-D matrices 10-3 vectors 10-3 annotating graphs 3-1 area graphs 4-11 bar graphs 4-2 compass plots 4-31 complex data 2-15 contour plots 4-37 contours, labeling 4-39 creating a plot 2-2 data-point markers 2-5 elementary functions for 2-2 feather plots 4-32 interactive 4-48 line colors 8-29 line styles 2-5 matrices 2-13 multiple graphs 2-3 nonuniform data 10-8 overlaying bar graphs 4-9 quiver plots 4-34 specifying line styles 2-4, 8-31 stairstep plots 4-29 stem plots 4-22 surfaces 10-5 to subaxis 2-26 vector data 2-2 windows for 2-26 plotting statistics 3-36 PNG 5-2 writing as 16-bit using imwrite 5-16 Pointer property 9-19 pointers custom 9-19 example defining 9-20 specifying 9-18 PointerShapeCData property 9-19 PointerShapeHotSpot property 9-19 polar 4-46 polar coordinates contour plots 4-44 rose plot 4-19 polygons, creating with patch 14-2 position of figure 9-3 Position property axes 8-5 figure 9-3 position rectangle 11-8 positioning axes 1-7 Index I-13 positioning of axes 8-5 positioning text on a graph 3-19 preferences 1-10 printing 3-D scenes 11-39 aspect ratio 6-34 default 6-34 background color 6-49 figure size setting from the command line 6-33, 6-37, 6-77 fonts supported for HPGL 6-71 supported for PostScript and GhostScript 6-71 supported for Windows drivers 6-71 images 5-28 MATLAB printer driver definition 6-68 OpenGL 6-43 paper type setting from the command line 6-39 PaperType property example 6-39 PostScript fonts supported for 6-71 quick start 6-23 renderer methods 6-42 resolution with painters renderer 9-17 with Z-buffer renderer 9-17 troubleshooting 6-78 Z-buffer 9-17 printing figures 1-10 Projection property 11-30 projection types 11-36–11-40 camera position 11-37 orthographic 11-36 perspective 11-36 rendering method 11-38 properties automatic axes 8-19 changed by built-in functions 7-48 changed by object creation functions 7-13 defining in startup.m 7-28 editing 1-8, 1-15 for labeling axes 8-3 naming convention 7-15 specifying default values 7-24 Property Editor closing 1-17 editing multiple objects 1-18 interface 1-15 overview 1-15 searching for objects 1-20 starting 1-16 property values defaults 7-22 defined by MATLAB 7-21 getting 7-17 resetting to default 7-24 setting 7-17 specifying defaults 7-24 user defined 7-22 pseudocolor displays, see indexed color Q quiver 4-31, 4-34 quiver plots 4-34 2-D 4-34 Index I-14 3-D 4-35 combined with contour plot 4-35 displaying velocity vectors 4-36 quiver3 4-31 R realistic display of objects 11-54 reflection, specular and diffuse 12-11 Renderer property 10-22 and printing 9-17 RendererMode property 10-22 rendering options 9-15 Z-buffer 9-16 reset 7-37 resizing objects 1-7 RGB color values 10-14 converting to 5-29 images 5-9 converting the data class of 5-12 rgbplot 10-19 rose 4-17, 4-19 rotating a plot 1-14 rotating axis labels 3-13 rotation without resizing 11-33 S saveas 1-9 saving figures 1-9 scaled color mapping 10-16 screen extent, determining 9-4 ScreenSize property 9-4 example 9-5 selecting multiple objects 1-6 selection button 1-6 semilogx , properties changed by 7-50 semilogy , properties changed by 7-50 set 7-17 ShareColors property 9-11 ShowHiddenHandles property 7-43 size of computer screen 9-4 slice planes colormapping 15-18 slicing a volume 15-15 specular color 12-14 exponent 12-13 highlight 12-13 reflection 12-11 SpecularColorReflectance property 12-8 illustration 12-14 SpecularExponent property 12-8 illustration 12-13 SpecularStrength property 12-8 illustration 12-11 sphere 10-23 spline 4-48 stairs 4-22, 4-29 stairstep plot 4-29 starting plot edit mode 1-6 starting points for stream plots 15-28 statistics formatting plots of 3-36 plotting 3-33, 3-36 saving to workspace 3-38 stem 4-22 stem plots 4-22 Index I-15 3-D 4-26 overlaid with line plot 4-25 stem3 4-22, 4-26 stream line plots 15-32 stream plots starting points 15-28 stretch-to-fill 11-41 overriding 11-49 string variable, in text 3-27 style property of lights 12-4 subplot 2-26 sum 5-13 surf 10-5 Surfaces CData 10-23 coloring 10-13 curvature mapped to color 10-17 FaceColor , texturemap 10-23 parametric 10-10 plotting 10-5 nonuniformly sampled data 10-8 surfc 4-43 symbols, TeX characters 3-25 T tag specifying value of 1-20 TeX available characters 3-25 creating mathematical symbols 3-25 symbols in text 3-15, 3-26 text annotating graphs 3-18 editing 3-24 for labeling plots 3-18 horizontal and vertical alignment 3-22 multiline 3-28 placing dynamically, example 3-23 placing outside of axes 8-7 positioning 3-21 TeX characters 3-26 using variables in 3-27 texture mapping 10-23 thin line styles 6-80 three-dimensional objects, creating with patch 14-2 tick marks, on axes 2-21, 8-12 TIFF 5-2 title toolbar buttons 1-13, 1-14, 3-18, 3-32 toolbar, camera 11-9 truecolor dithering on indexed systems 9-12 patches 14-19 rendering method used for 10-22 simulating 10-22 surface plots 10-13, 10-20 U Uicontrol graphics objects 7-4 uint16 arrays operations supported on 5-13 storing images 5-5 uint16 arrays converting uint16 to double 5-11, 5-12 uint8 arrays 5-11 operations supported on 5-13 Index I-16 storing images 5-5 uint8 arrays converting to double 5-12 converting uint8 to double 5-11 units axes 8-6 used by figures 9-4 unlocking axes position 1-7 unselecting objects 1-7 V vectors determined by direction cosines 11-34 displaying velocity 4-36 velocity vectors displayed with quiver 4-36 vertex normals and back face lighting 12-15 VertexNormals property 12-9 VerticalAlignment property 3-22 Vertices property 14-7 view azimuth of viewpoint 11-4 camera properties 11-30 coordinate system defining 11-4 definition of 11-2 elevation of viewpoint 11-4 limitation of azimuth and elevation 11-7 MATLAB’s default behavior 11-31 projection types 11-36 rotating 1-14 specifying 11-30 specifying with azimuth and elevation 11-4 view 11-4 example of rotation 11-33 limitations using 11-7 viewing axis 11-8 moving camera along 11-32 viewpoint, controlling 11-4, ??–11-7 visibility of graphics objects 7-45 visualizing commands for volume data 15-5 mathematical functions 10-6 steps for volume data 15-4 techniques for volume data 15-3 volume data accessing subregions 15-30 examples of 15-3 MRI 15-9 scalar 15-8 slicing with plane 15-15 steps to visualize 15-4 techniques for visualizing 15-3 vector 15-27 visualizing 15-3 W wire frame surface 10-5, 10-12 X XWD 5-2 Z Z-buffer 9-16 orthographic projection 11-38 perspective projection 11-38 printing 9-17 rendering truecolor 10-22 zooming by setting camera angle 11-33 ###### Автор dima202579   документов Отправить письмо ###### Документ Категория Образование Просмотров 1 242 Размер файла 13 244 Кб Теги matlab 1/--страниц Пожаловаться на содержимое документа
2017-07-23 20:57:28
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.5229246020317078, "perplexity": 1542.1712755367073}, "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/1500549424610.13/warc/CC-MAIN-20170723202459-20170723222459-00326.warc.gz"}
https://brilliant.org/problems/a-copy-and-paste-square/
# A Copy-and-Paste Square Give the last three digits of the smallest natural number n such that the number obtained by writing out n twice is a perfect square. (For example, the number obtained by writing out $$4723$$ twice would be $$47234723$$. Which, incidentally, is not a perfect square.) ×
2017-07-25 00:59: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": 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.2281142622232437, "perplexity": 382.1676865925679}, "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/1500549424945.18/warc/CC-MAIN-20170725002242-20170725022242-00079.warc.gz"}
https://www.physicsforums.com/threads/thermodynamics-polytropic-processes.356191/
# Thermodynamics: polytropic processes 1. Nov 19, 2009 ### silentwf 1. The problem statement, all variables and given/known data "During some actual expansion and compression processes in piston-cylinder devices, the gases have been observed to satisfy the relationship $$PV^n=c$$ where n and C are constants. Calculate the work done when a gas expands from 150kPa and .03 m^3 to a final volume of .2m^3 for the case of n = 1.3 2. Relevant equations $$W = \int_{1}^{2} {P}dV$$ 3. The attempt at a solution $$PV^n=C \Rightarrow P=CV^{-n} \Rightarrow W = \int_{.03}^{.2} {150V^{-1.3}}dV = 621 kJ$$ Which...is wrong :( The solution the book offers is: $$P_{2} = P_{1}\frac{V_{1}}{V_{2}}^n = (150)\frac{.03}{.2}^{1.3} = 12.74 kPa \Rightarrow W = \int_{1}^{2} {P}dv = \frac{P_{2}V_{2} - P_{1}V_{1}}{1-n} =\frac{(12.74 \cdot .2 - 150 \cdot .03)}{1-1.3} = 6.51 kJ$$ Could someone explain why the way i did it is "unacceptable"? Last edited: Nov 20, 2009 2. Nov 19, 2009 ### Mapes Because $C\neq150$; check your integrand. 3. Nov 20, 2009 ### silentwf Oh...woops I put in 150 cuz i was still thinking that $$W = P\Delta V$$ and I put in 150 then what would i put in? the question does not supply C though 4. Nov 20, 2009 ### Staff: Mentor You can calculate C from initial state. -- methods 5. Nov 20, 2009 ### silentwf oh lol! ok, i got the answer, thanks :)
2018-03-24 16:27: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.36803683638572693, "perplexity": 2732.2295085728533}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2018-13/segments/1521257650730.61/warc/CC-MAIN-20180324151847-20180324171847-00103.warc.gz"}
https://ebrainanswer.com/mathematics/question13787684
, 08.11.2019 11:31, itsRyanPlayzMC9660 # Find the solution set to each inequality. express the solution in set notation... Find the solution set to each inequality. express the solution in set notation ### Other questions on the subject: Mathematics Mathematics, 21.06.2019 15:50, king3620 Arectangle has a width of 9 units and length of 40 units. what is the length of a diognal. a. 31 unitsb. 39 unitsc. 41 units d. 49 units​ Mathematics, 21.06.2019 16:00, HappyBeatrice1401 Find the solution set of this inequality. select the correct graph. |8x+16|> 16 Mathematics, 21.06.2019 18:00, amshearer4719 Aman is 6 feet 3 inches tall. the top of his shadow touches a fire hydrant that is 13 feet 6 inches away. what is the angle of elevation from the base of the fire hydrant to the top of the man's head?
2020-09-18 13:42:42
{"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.8099282383918762, "perplexity": 1686.5141460695643}, "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/1600400187899.11/warc/CC-MAIN-20200918124116-20200918154116-00474.warc.gz"}
https://docs.astropy.org/en/stable/api/astropy.table.MaskedColumn.html
class astropy.table.MaskedColumn[source] Bases: astropy.table.Column, astropy.table._column_mixins._MaskedColumnGetitemShim, numpy.ma.MaskedArray Define a masked data column for use in a Table object. Parameters datalist, ndarray or None Column data values namestr Column name and key for reference within Table Boolean mask for which True indicates missing or invalid data fill_valuefloat, int, str or None Value used when filling masked column elements dtypenumpy.dtype compatible value Data type for column shapetuple or () Dimensions of a single row element in the column data lengthint or 0 Number of row elements in column data descriptionstr or None Full description of column unitstr or None Physical unit formatstr or None or function or callable Format string for outputting column values. This can be an “old-style” (format % value) or “new-style” (str.format) format specification string or a function or any callable object that accepts a single value and returns a string. Meta-data associated with the column Examples A MaskedColumn is similar to a Column except that it includes mask and fill_value attributes. It can be created in two different ways: • Provide a data value but not shape or length (which are inferred from the data). Examples: col = MaskedColumn(data=[1, 2], name='name') col = MaskedColumn(data=[1, 2], name='name', dtype=float, fill_value=99) The mask argument will be cast as a boolean array and specifies which elements are considered to be missing or invalid. The dtype argument can be any value which is an acceptable fixed-size data-type initializer for the numpy.dtype() method. See https://docs.scipy.org/doc/numpy/reference/arrays.dtypes.html. Examples include: • Python non-string type (float, int, bool) • Numpy non-string type (e.g. np.float32, np.int64, np.bool_) • Numpy.dtype array-protocol type strings (e.g. ‘i4’, ‘f8’, ‘S15’) If no dtype value is provide then the type is inferred using np.array(data). When data is provided then the shape and length arguments are ignored. • Provide length and optionally shape, but not data Examples: col = MaskedColumn(name='name', length=5) col = MaskedColumn(name='name', dtype=int, length=10, shape=(3,4)) The default dtype is np.float64. The shape argument is the array shape of a single cell in the column. Attributes Summary data The plain MaskedArray data held by this column. fill_value The filling value of the masked array is a scalar. info([option, out]) Container for meta information like name, description, format. name The name of this column. Methods Summary convert_unit_to(self, new_unit[, equivalencies]) Converts the values of the column in-place from the current unit to the given unit. copy(self[, order, data, copy_data]) Return a copy of the current instance. filled(self[, fill_value]) Return a copy of self, with masked values filled with a given value. insert(self, obj, values[, mask, axis]) Insert values along the given axis before the given indices and return a new MaskedColumn object. more(self[, max_lines, show_name, show_unit]) Interactively browse column with a paging interface. pformat(self[, max_lines, show_name, …]) Return a list of formatted string representation of column values. pprint(self[, max_lines, show_name, …]) Print a formatted string representation of column values. Attributes Documentation data The plain MaskedArray data held by this column. fill_value The filling value of the masked array is a scalar. When setting, None will set to a default based on the data type. Examples >>> for dt in [np.int32, np.int64, np.float64, np.complex128]: ... np.ma.array([0, 1], dtype=dt).get_fill_value() ... 999999 999999 1e+20 (1e+20+0j) >>> x = np.ma.array([0, 1.], fill_value=-np.inf) >>> x.fill_value -inf >>> x.fill_value = np.pi >>> x.fill_value 3.1415926535897931 # may vary Reset to default: >>> x.fill_value = None >>> x.fill_value 1e+20 info(option='attributes', out='') Container for meta information like name, description, format. This is required when the object is used as a mixin column within a table, but can be used as a general way to store meta information. In this case it just adds the mask_val attribute. name The name of this column. Methods Documentation convert_unit_to(self, new_unit, equivalencies=[]) Converts the values of the column in-place from the current unit to the given unit. To change the unit associated with this column without actually changing the data values, simply set the unit property. Parameters new_unitstr or astropy.units.UnitBase instance The unit to convert to. equivalencieslist of equivalence pairs, optional A list of equivalence pairs to try if the unit are not directly convertible. See Equivalencies. Raises astropy.units.UnitsError If units are inconsistent copy(self, order='C', data=None, copy_data=True) Return a copy of the current instance. If data is supplied then a view (reference) of data is used, and copy_data is ignored. Parameters order{‘C’, ‘F’, ‘A’, ‘K’}, optional Controls the memory layout of the copy. ‘C’ means C-order, ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, ‘C’ otherwise. ‘K’ means match the layout of a as closely as possible. (Note that this function and :func:numpy.copy are very similar, but have different default values for their order= arguments.) Default is ‘C’. dataarray, optional If supplied then use a view of data instead of the instance data. This allows copying the instance attributes and meta. copy_databool, optional Make a copy of the internal numpy array instead of using a reference. Default is True. Returns Copy of the current column (same type as original) filled(self, fill_value=None)[source] Return a copy of self, with masked values filled with a given value. Parameters fill_valuescalar; optional The value to use for invalid entries (None by default). If None, the fill_value attribute of the array is used instead. Returns filled_columnColumn A copy of self with masked entries replaced by fill_value (be it the function argument or the attribute of self). insert(self, obj, values, mask=None, axis=0)[source] Insert values along the given axis before the given indices and return a new MaskedColumn object. Parameters objint, slice or sequence of ints Object that defines the index or indices before which values is inserted. valuesarray_like Value(s) to insert. If the type of values is different from that of the column, values is converted to the matching type. values should be shaped so that it can be broadcast appropriately. Mask value(s) to insert. If not supplied, and values does not have a mask either, then False is used. axisint, optional Axis along which to insert values. If axis is None then the column array is flattened before insertion. Default is 0, which will insert a row. Returns outMaskedColumn A copy of column with values and mask inserted. Note that the insertion does not occur in-place: a new masked column is returned. more(self, max_lines=None, show_name=True, show_unit=False) Interactively browse column with a paging interface. Supported keys: f, <space> : forward one page b : back one page r : refresh same page n : next row p : previous row < : go to beginning > : go to end q : quit browsing h : print this help Parameters max_linesint Maximum number of lines in table output. show_namebool Include a header row for column names. Default is True. show_unitbool Include a header row for unit. Default is False. pformat(self, max_lines=None, show_name=True, show_unit=False, show_dtype=False, html=False) Return a list of formatted string representation of column values. If no value of max_lines is supplied then the height of the screen terminal is used to set max_lines. If the terminal height cannot be determined then the default will be determined using the astropy.conf.max_lines configuration item. If a negative value of max_lines is supplied then there is no line limit applied. Parameters max_linesint Maximum lines of output (header + data rows) show_namebool Include column name. Default is True. show_unitbool Include a header row for unit. Default is False. show_dtypebool Include column dtype. Default is False. htmlbool Format the output as an HTML table. Default is False. Returns lineslist List of lines with header and formatted column values pprint(self, max_lines=None, show_name=True, show_unit=False, show_dtype=False) Print a formatted string representation of column values. If no value of max_lines is supplied then the height of the screen terminal is used to set max_lines. If the terminal height cannot be determined then the default will be determined using the astropy.conf.max_lines configuration item. If a negative value of max_lines is supplied then there is no line limit applied. Parameters max_linesint Maximum number of values in output show_namebool Include column name. Default is True. show_unitbool Include a header row for unit. Default is False. show_dtypebool Include column dtype. Default is True.
2020-07-10 00:39: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.20130681991577148, "perplexity": 6938.494766306463}, "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/1593655902377.71/warc/CC-MAIN-20200709224746-20200710014746-00587.warc.gz"}
https://codegolf.stackexchange.com/posts/154641/revisions
Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now. Notice removed Reward existing answer by Hosch250 occurred Mar 13 '18 at 13:38 Bounty Ended with Mr. Xcoder's answer chosen by Hosch250 occurred Mar 13 '18 at 13:38 Notice added Reward existing answer by Hosch250 occurred Mar 6 '18 at 20:17 Bounty Started worth 500 reputation by Hosch250 occurred Mar 6 '18 at 20:17 Tweeted twitter.com/StackCodeGolf/status/959927396429418496 occurred Feb 3 '18 at 23:11 4 added 23 characters in body edited Feb 3 '18 at 9:47 user77954 Your assignment is to write a program of even length, that prints an ASCII-art square (described below), that increases its side length by 1 unit each time the original source code is pasted in the middle of the current code. It is quite hard for me to define this task very well, so I'll give you an example: Let's say your initial code was CODE and that it printed: 0 Then, insert CODE in the middle: your code becomes COCODEDE and it should print: 00 00 Re-insert CODE in the middle: your code becomes COCOCODEDEDE and should print: 000 000 000 And so on. Your answer should theoretically work after any number of iterations, but I understand if, due to language performance limitations, it cannot run reasonably over a certain threshold. Some rules: You can use any printable ASCII (32-127) as the character to use for your square. Your choice needs to be constant (You should use the same character for each iteration). The initial output square must have side-length 1. An ascii-art square is defined as a string with N lines (separated by N-1 linefeeds / newlines), and with each line containing N copies of the chosen character. Your output isn't allowed to contain any extraneous whitespace, other than a trailing newline. You can use the defaults for input and output (programs or functions are allowed, but snippets are not). The middle of your code is defined as the point where the source code can be split in two parts such that the two are equal. Your answers will be scored by the length of your original program, in bytes. The lowest byte count wins. In case there's a tie, the answer that was submitted earlier wins. You can use this programthis program to apply the insertions without having to do that by hand. Your assignment is to write a program of even length, that prints an ASCII-art square (described below), that increases its side length by 1 unit each time the original source code is pasted in the middle of the current code. It is quite hard for me to define this task very well, so I'll give you an example: Let's say your initial code was CODE and that it printed: 0 Then, insert CODE in the middle: your code becomes COCODEDE and it should print: 00 00 Re-insert CODE in the middle: your code becomes COCOCODEDEDE and should print: 000 000 000 And so on. Your answer should theoretically work after any number of iterations, but I understand if, due to language performance limitations, it cannot run reasonably over a certain threshold. Some rules: You can use any printable ASCII (32-127) as the character to use for your square. Your choice needs to be constant (You should use the same character for each iteration). The initial output square must have side-length 1. An ascii-art square is defined as a string with N lines (separated by N-1 linefeeds / newlines), and with each line containing N copies of the chosen character. Your output isn't allowed to contain any extraneous whitespace, other than a trailing newline. You can use the defaults for input and output (programs or functions are allowed, but snippets are not). The middle of your code is defined as the point where the source code can be split in two parts such that the two are equal. Your answers will be scored by the length of your original program, in bytes. The lowest byte count wins. In case there's a tie, the answer that was submitted earlier wins. You can use this program to apply the insertions without having to do that by hand. Your assignment is to write a program of even length, that prints an ASCII-art square (described below), that increases its side length by 1 unit each time the original source code is pasted in the middle of the current code. It is quite hard for me to define this task very well, so I'll give you an example: Let's say your initial code was CODE and that it printed: 0 Then, insert CODE in the middle: your code becomes COCODEDE and it should print: 00 00 Re-insert CODE in the middle: your code becomes COCOCODEDEDE and should print: 000 000 000 And so on. Your answer should theoretically work after any number of iterations, but I understand if, due to language performance limitations, it cannot run reasonably over a certain threshold. Some rules: You can use any printable ASCII (32-127) as the character to use for your square. Your choice needs to be constant (You should use the same character for each iteration). The initial output square must have side-length 1. An ascii-art square is defined as a string with N lines (separated by N-1 linefeeds / newlines), and with each line containing N copies of the chosen character. Your output isn't allowed to contain any extraneous whitespace, other than a trailing newline. You can use the defaults for input and output (programs or functions are allowed, but snippets are not). The middle of your code is defined as the point where the source code can be split in two parts such that the two are equal. Your answers will be scored by the length of your original program, in bytes. The lowest byte count wins. In case there's a tie, the answer that was submitted earlier wins. You can use this program to apply the insertions without having to do that by hand. 3 added 60 characters in body edited Feb 2 '18 at 12:48 user77954 Your assignment is to write a program of even length, that prints an ASCII-art square (described below), that increases its side length by 1 unit each time the original source code is pasted in the middle of the current code. It is quite hard for me to define this task very well, so I'll give you an example: Let's say your initial code was CODE and that it printed: 0 Then, insert CODE in the middle: your code becomes COCODEDE and it should print: 00 00 Re-insert CODE in the middle: your code becomes COCOCODEDEDE and should print: 000 000 000 And so on. Your answer should theoretically work after any number of iterations, but I understand if, due to language performance limitations, it cannot run reasonably over a certain threshold. Some rules: You can use any printable ASCII (32-127) as the character to use for your square. Your choice needs to be constant (You should use the same character for each iteration). The initial output square must have side-length 1. An ascii-art square is defined as a string with N lines (separated by N-1 linefeeds / newlines), and with each line containing N copies of the chosen character. Your output isn't allowed to contain any extraneous whitespace, other than a trailing newline. You can use the defaults for input and output (programs or functions are allowed, but snippets are not). The middle of your code is defined as the point where the source code can be split in two parts such that the two are equal. Your answers will be scored by the length of your original program, in bytes. The lowest byte count wins. In case there's a tie, the answer that was submitted earlier wins. You can use this program to apply the insertions without having to do that by hand. Your assignment is to write a program of even length, that prints an ASCII-art square (described below), that increases its side length by 1 unit each time the original source code is pasted in the middle of the current code. It is quite hard for me to define this task very well, so I'll give you an example: Let's say your initial code was CODE and that it printed: 0 Then, insert CODE in the middle: your code becomes COCODEDE and it should print: 00 00 Re-insert CODE in the middle: your code becomes COCOCODEDEDE and should print: 000 000 000 And so on. Your answer should theoretically work after any number of iterations, but I understand if, due to language performance limitations, it cannot run reasonably over a certain threshold. Some rules: You can use any printable ASCII (32-127) as the character to use for your square. Your choice needs to be constant (You should use the same character for each iteration). An ascii-art square is defined as a string with N lines (separated by N-1 linefeeds / newlines), and with each line containing N copies of the chosen character. Your output isn't allowed to contain any extraneous whitespace, other than a trailing newline. You can use the defaults for input and output (programs or functions are allowed, but snippets are not). The middle of your code is defined as the point where the source code can be split in two parts such that the two are equal. Your answers will be scored by the length of your original program, in bytes. The lowest byte count wins. In case there's a tie, the answer that was submitted earlier wins. Your assignment is to write a program of even length, that prints an ASCII-art square (described below), that increases its side length by 1 unit each time the original source code is pasted in the middle of the current code. It is quite hard for me to define this task very well, so I'll give you an example: Let's say your initial code was CODE and that it printed: 0 Then, insert CODE in the middle: your code becomes COCODEDE and it should print: 00 00 Re-insert CODE in the middle: your code becomes COCOCODEDEDE and should print: 000 000 000 And so on. Your answer should theoretically work after any number of iterations, but I understand if, due to language performance limitations, it cannot run reasonably over a certain threshold. Some rules: You can use any printable ASCII (32-127) as the character to use for your square. Your choice needs to be constant (You should use the same character for each iteration). The initial output square must have side-length 1. An ascii-art square is defined as a string with N lines (separated by N-1 linefeeds / newlines), and with each line containing N copies of the chosen character. Your output isn't allowed to contain any extraneous whitespace, other than a trailing newline. You can use the defaults for input and output (programs or functions are allowed, but snippets are not). The middle of your code is defined as the point where the source code can be split in two parts such that the two are equal. Your answers will be scored by the length of your original program, in bytes. The lowest byte count wins. In case there's a tie, the answer that was submitted earlier wins. You can use this program to apply the insertions without having to do that by hand. 2 deleted 1 character in body edited Feb 2 '18 at 12:28 user202729 14.5k11 gold badge2828 silver badges5858 bronze badges Your assignment is to write a program of even length, that prints an ASCII-art square (described below), that increases its side length by 1 unit each time the original source code is pasted in the middle of the current code. It is quite hard for me to define this task very well, so I'll give you an example: Let's say your initial code was CODE and that it printed: 0 Then, insert CODE in the middle: your code becomes COCODEDE and it should print: 00 00 Re-insert CODE in the middle: your code becomes COCOCODEDEDE and should print: 000 000 000 And so on. Your answer should theoretically work after any number of iterations, but I understand if, due to language performance limitations, it cannot run reasonably over a certain threshold. Some rules: You can use any printable ASCII (32-127) as the character to use for your square. Your choice needs to be constant (You should use the same character for each iteration). An ascii-art square is defined as a string with N lines (separated by N-1 linefeeds / newlines), and with each line containing N copies of the chosen character. Your output isn't allowed to containecontain any extraneous whitespace, other than a trailing newline. You can use the defaults for input and output (programs or functions are allowed, but snippets are not). The middle of your code is defined as the point where the source code can be split in two parts such that the two are equal. Your answers will be scored by the length of your original program, in bytes. The lowest byte count wins. In case there's a tie, the answer that was submitted earlier wins. Your assignment is to write a program of even length, that prints an ASCII-art square (described below), that increases its side length by 1 unit each time the original source code is pasted in the middle of the current code. It is quite hard for me to define this task very well, so I'll give you an example: Let's say your initial code was CODE and that it printed: 0 Then, insert CODE in the middle: your code becomes COCODEDE and it should print: 00 00 Re-insert CODE in the middle: your code becomes COCOCODEDEDE and should print: 000 000 000 And so on. Your answer should theoretically work after any number of iterations, but I understand if, due to language performance limitations, it cannot run reasonably over a certain threshold. Some rules: You can use any printable ASCII (32-127) as the character to use for your square. Your choice needs to be constant (You should use the same character for each iteration). An ascii-art square is defined as a string with N lines (separated by N-1 linefeeds / newlines), and with each line containing N copies of the chosen character. Your output isn't allowed to containe any extraneous whitespace, other than a trailing newline. You can use the defaults for input and output (programs or functions are allowed, but snippets are not). The middle of your code is defined as the point where the source code can be split in two parts such that the two are equal. Your answers will be scored by the length of your original program, in bytes. The lowest byte count wins. In case there's a tie, the answer that was submitted earlier wins. Your assignment is to write a program of even length, that prints an ASCII-art square (described below), that increases its side length by 1 unit each time the original source code is pasted in the middle of the current code. It is quite hard for me to define this task very well, so I'll give you an example: Let's say your initial code was CODE and that it printed: 0 Then, insert CODE in the middle: your code becomes COCODEDE and it should print: 00 00 Re-insert CODE in the middle: your code becomes COCOCODEDEDE and should print: 000 000 000 And so on. Your answer should theoretically work after any number of iterations, but I understand if, due to language performance limitations, it cannot run reasonably over a certain threshold. Some rules: You can use any printable ASCII (32-127) as the character to use for your square. Your choice needs to be constant (You should use the same character for each iteration). An ascii-art square is defined as a string with N lines (separated by N-1 linefeeds / newlines), and with each line containing N copies of the chosen character. Your output isn't allowed to contain any extraneous whitespace, other than a trailing newline. You can use the defaults for input and output (programs or functions are allowed, but snippets are not). The middle of your code is defined as the point where the source code can be split in two parts such that the two are equal. Your answers will be scored by the length of your original program, in bytes. The lowest byte count wins. In case there's a tie, the answer that was submitted earlier wins. 1 asked Feb 2 '18 at 12:14 user77954
2019-11-22 23:10: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.5551255941390991, "perplexity": 668.2701286679139}, "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/1573496672170.93/warc/CC-MAIN-20191122222322-20191123011322-00200.warc.gz"}
https://mersenneforum.org/showthread.php?s=63fe71e53668534ba386c9b3a3219dd0&t=1141&page=2
mersenneforum.org > Data Assigned [or cleared] exponents that are already obsolete Register FAQ Search Today's Posts Mark Forums Read 2003-10-02, 00:08 #12 Prime95 P90 years forever!     Aug 2002 Yeehaw, FL 11100101111112 Posts 22851593 is way beyond the range of exponents PrimeNet is handing out for LL testing. The only way I know of that this exponent could get in a worktodo.ini file would be for a user to manually add it. 2003-10-02, 05:41   #13 GP2 Sep 2003 32·7·41 Posts Quote: Originally posted by Prime95 22851593 is way beyond the range of exponents PrimeNet is handing out for LL testing. The only way I know of that this exponent could get in a worktodo.ini file would be for a user to manually add it. I emailed Team Siegert and the response was: No, I did not do that, and I don't understand why ECE1 would have been LL-testing that exponent. Siegert does have a few factoring assignments in the 22M range, but that particular exponent didn't have an F in status.txt (and in any case factoring wouldn't have made any more sense since it was already factored back in August, and this latest exponent had an "assigned" date of Sept 30). It's a mystery. Last fiddled with by GP2 on 2003-10-02 at 05:42 2003-10-06, 13:53 #14 GP2     Sep 2003 32·7·41 Posts One more new one (I already resubmitted it to Primenet): Exponents assigned (LL testing) that already have a factor? ------- factors ------- 21876539,1094145315290536903 ------- STATUS_L.TXT ------- 21876539, ,60,,0.8,58.2,87.2,05-Oct-03 02:41,05-Oct-03 02:37,Team_Prime_Rib,the_one In an old cleared.txt file this appeared as: 21876539,60, F,1094145315290536903,30-Aug-03 20:28,wabbit,factoring Any ideas how this one got assigned? It's also beyond the leading edge of first-time checking. 2003-10-07, 00:17   #15 geoff Mar 2003 New Zealand 13·89 Posts Quote: In an old cleared.txt file this appeared as: 21876539,60, F,1094145315290536903,30-Aug-03 20:28,wabbit,factoring Any ideas how this one got assigned? It's also beyond the leading edge of first-time checking. From the look of the lines in cleared text it seems wabbit has some machines with Factoroverride=62 or similar in their prime.ini, as there are hundreds of factors being found but hardly any greater than 2^62. I read somewhere else that using Factoroverride with primenet assignments causes problems, so this could be related. 2003-10-18, 18:31 #16 GP2     Sep 2003 32·7·41 Posts More weirdness: Code: Exponents assigned (LL testing) that already have a factor? ------- factors ------- 10300013,535658912871414046645321 33459763,16228318390260061537 ------- STATUS_L.TXT ------- 10300013,D ,64,,4.3,16.7,76.7,,14-Oct-03 08:31,.,C81F6D02B 33459763, ,64,1,3.8,60.2,84.2,,14-Oct-03 20:35,S101148,C4B90EFBA The factor for the 33M exponent was discovered July 13. The factor for the 10M exponent first appears in the Sept 29 version of the data files, but I can't find any record of it appearing in a cleared.txt file. I wonder how these got assigned recently (Oct 14). The factors have already been re-reported via the manual testing form. There's no other record of user S101148 or computer-id C4B90EFBA anywhere else: not in HRF5.TXT (list of all users), not in any entry in LUCAS_V.TXT, BAD or HRF3.TXT, not in any other line in status.txt or cleared.txt 2003-10-19, 05:51   #17 "Richard B. Woods" Aug 2002 Wisconsin USA 11110000011002 Posts Quote: Originally posted by geoff I read somewhere else that using Factoroverride with primenet assignments causes problems, so this could be related. AFAIK, the only problem associated with using FactorOverride with PrimeNet assignments is that the FactorOverride gets ignored! It doesn't corrupt assignments or cause the type of problems being discussed here. From a previous posting of mine: If I interpret the source code correctly, Prime95 module commonc.c ignores FactorOverride _if_ the user has selected the "Use PrimeNet to get work and report results" box checked in the "Configure PrimeNet" options. AFAIK this is not because of any technical limitation, but because George wanted PrimeNet assignments to use the default limits for trial factoring (which I agree is a good idea). My guess is that his undoc.txt statement "This feature should not be used with the Primenet server" may have been left overly broad in order to discourage unknowledgable users from messing with default limits without good reason. The results line for trial factoring doesn't say anything about whether or not FactorOverride has been used, and the default trial factoring limits have sometimes been changed between past versions of Prime95, so I don't think PrimeNet itself really cares or even knows. 2003-10-19, 08:09   #18 geoff Mar 2003 New Zealand 100100001012 Posts Quote: AFAIK, the only problem associated with using FactorOverride with PrimeNet assignments is that the FactorOverride gets ignored! It doesn't corrupt assignments or cause the type of problems being discussed here. What does the server do if a factoring assignment is returned without finding a factor but not factored to the normal bit depth, does it hand it out again as a factoring assignment? 2003-10-19, 12:07 #19 Complex33     Aug 2002 Texas 5×31 Posts From what I can tell is if a factoring assignment is not completed to the default depth, the exponent is treated as though no new factoring has been done and is re-released at its previous bit depth. This is why I have concern about the factoring that wabbit has been doing on the upper TF exponents on primenet. It seems as though he has invested a great deal in factoring those numbers to 62 bits in order to find fast factors for credit but then primenet has to re-release these exponents and the next user is repeating work up to 62 when no factor will be found. Is this right? 2003-10-19, 14:44   #20 GP2 Sep 2003 32·7·41 Posts Quote: Originally posted by Complex33 It seems as though he has invested a great deal in factoring those numbers to 62 bits in order to find fast factors for credit but then primenet has to re-release these exponents and the next user is repeating work up to 62 when no factor will be found. Is this right? When Primenet assigns you an exponent, it tells you how far it's been trial-factored already (second parameter in the Test= or DoubleCheck= line). And the posts in the Lone Mersenne Hunters forum consist mostly of "I'm factoring to 2^n for range xM-yM". So this is an organized and approved activity, no? 2003-10-19, 18:15   #21 chalsall If I May "Chris Halsall" Sep 2002 19·499 Posts Factoring... Quote: Originally posted by GP2 And the posts in the Lone Mersenne Hunters forum consist mostly of "I'm factoring to 2^n for range xM-yM". So this is an organized and approved activity, no? Not quite, actually... I'm working in the high-end of ranges which are in Primenet, which the Lone Hunters don't do. I'm not reporting back to Primenet any results except factors found, to be sure I don't cause problems for the server. However, from time to time I send my results to George (via CSV flat files) to import into his dataset so that others are not assigned work which is redundant. 2003-10-21, 03:58   #22 "Richard B. Woods" Aug 2002 Wisconsin USA 22·3·641 Posts Quote: Originally posted by geoff What does the server do if a factoring assignment is returned without finding a factor but not factored to the normal bit depth, does it hand it out again as a factoring assignment? Good point. After someone has received factoring assignments from PrimeNet, she/he can turn off "Use PrimeNet to get work and report results" and then the "FactorOverride=" will not be ignored. Quote: Originally posted by Complex33 From what I can tell is if a factoring assignment is not completed to the default depth, the exponent is treated as though no new factoring has been done and is re-released at its previous bit depth. ... which is a failure of PrimeNet to properly handle the returned result. (This situation could occur if the default bit limit were changed between time of assignment and return of the result ... not that that is likely to happen again soon.) Quote: This is why I have concern about the factoring that wabbit has been doing on the upper TF exponents on primenet. It seems as though he has invested a great deal in factoring those numbers to 62 bits in order to find fast factors for credit but then primenet has to re-release these exponents and the next user is repeating work up to 62 when no factor will be found. Is this right? Apparently so, as long as PrimeNet fails to properly update the bit level. Quote: Originally posted by GP2 And the posts in the Lone Mersenne Hunters forum consist mostly of "I'm factoring to 2^n for range xM-yM". So this is an organized and approved activity, no? But the LMH are not working in ranges that PrimeNet is assigning. Similar Threads Thread Thread Starter Forum Replies Last Post ixfd64 PrimeNet 2 2018-02-28 07:54 ixfd64 PrimeNet 1 2010-06-14 16:24 petrw1 PrimeNet 1 2007-04-30 17:35 GP2 Data 14 2003-09-16 03:07 GP2 Data 2 2003-09-09 14:40 All times are UTC. The time now is 00:26. Sun Mar 7 00:26:57 UTC 2021 up 93 days, 20:38, 0 users, load averages: 1.93, 1.73, 1.77
2021-03-07 00:26:57
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.24690000712871552, "perplexity": 5192.532831199331}, "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/1614178375529.62/warc/CC-MAIN-20210306223236-20210307013236-00395.warc.gz"}
https://beruska-melnik.cz/0td828v/1a91cd-factorization-questions-with-answers
Math > Grade 6 > Factoring > Factoring numbers to prime factors (0-100). Clear, easy to follow, step-by-step worked solutions to all N5 Maths Questions below are available in the Online Study Pack. 12, 18 2. Factoring is also the opposite of Expanding: eg {1, 2, 3, 6, 9, 18} is the set of factors of 18. expand factorise 5a(a − 2) 5a2 − 10a ‘Gnidnapxe’ is the reverse of ‘expanding’. a) 20 = 2×10 , b) 14 = 2×7 , c) 64 = 4 3, d) 120 = 2 3 × 15 Solution Prime factorization involves only prime numbers. How to factor this expression? If you are asking about factoring integers, we do it quite often. We have factor maths worksheets suitable for all abilities, and they are all supplied with answers to assess how well your child or pupil is doing, and highlight areas for revision. Answers (x - 2) (x + 5) (x - 4) (x + 6) (x - 3) (x - 6) (x - 4) (2 x + 3) It is as factored as it gets. Factoring practice Factor the following polynomials (as fully as possible). (a-b) and (b-a) These may become the same by factoring -1 from one of them. A factor of a given number is another number that will divide into the given number with no remainder. Section 1 Finding Factors Factorizing algebraic expressions is a way of turning a sum of terms into a product of smaller ones. 10, 35 3. In the following two polynomials, find the value of ‘a’ if x – a is a factor … Find an Online Tutor Now Choose an expert and meet online. SUM = COEFFICIENT OF x =( -15) product = (COEFFICIENT of x^2 #*# COEFFICIENT of constant)= 36 Now you have to find factors which have a sum of -15 and a product of 36 . THE FACTORS ARE (-12), (-3) Improve your math knowledge with free questions in "Prime factorization" and thousands of other math skills. No packages or subscriptions, pay only for the time you need. The product is a multiplication of the factors. How to factor these equations? Factorising Exercises Question 1 Factorise each of the following expressions. Factoring Algebra Algebra 1 … Factorise: In the following two polynomials. Good question . Find the value of ‘a’ if x + a is a factor of each of the two: Question 12. Question 10. Flow rates are measured in mL/hr (milliliters per hour). Similar: Factor numbers to prime factors (0-500) Greatest common factor of 2 numbers (2-50) Factorising an expression is to write it as a product of its factors. Be aware of opposites: Ex. Practice: Prime factorization. Which of the following is not a prime factorization? Factoring (called "Factorising" in the UK) is the process of finding the factors: It is like "splitting" an expression into a multiplication of simpler expressions. Common factors (EMAH) Factorising based on common factors relies on there being factors common to all the terms. Factorize the following: 1. Factoring Practice I. Factoring worksheets: Factor to prime factors (0-100) Below are six versions of our grade 6 math worksheet on factoring numbers less than 100 to their prime factors. Making statements based on opinion; back them up with references or personal experience. Questions & answers have been split up by topic for your ease of reference. basically what are asking me to factor is : #ax^2 + bx +c#. Common divisibility examples. Seven children came to my daughter's birthday party and I have twenty-eight treats I can hand out. (g) 2x+ 3y (h) 16x y28x2y + 9y Question 2 (Simple Factorisation into double brackets) Factorise each of the following expressions. You may speak with a member of our customer support team by calling 1-800-876-1799. And thousands of other Math skills school if you are having problems entering the into. To make column like this are having problems entering the answers into your online assignment are. Responding to other answers to factor is: # ax^2 + bx #. No packages or subscriptions, pay only for the time you need to make column like this can factor! Factorization trivia quizzes can be adapted to suit your requirements for taking some the. A product of its factors 2. challenge Question -- factor the polynomial completely 3 n5 questions. Your understanding with practice problems and step-by-step solutions, difference of two squares, trinomial/quadratic and. ) 7x2yz 28y ( e ) 9x2y + 3xy ( f ) x+ x2+ x3 factoring... Value of ‘ a ’ if x + a is a factor of each of following. Your Math knowledge with free questions in prime factorization trivia quizzes can be adapted suit... You can learn from the questions someone else has already asked factorization quizzes from the questions someone has... Children came to my daughter 's birthday party and i have twenty-eight treats i hand. Your understanding with practice problems and step-by-step solutions ) x+ x2+ x3 challenge Question -- factor the following polynomials as. Factor f ( x ) = 2x^2 + x - 6 2. challenge Question -- the... ( 0-100 ) pay only for the time you need to Get assistance from your school if you are to! The GCF of the top prime factorization quizzes online, test your with. Basically what are asking about factoring integers, we do it quite often ) 2x^2. By factoring -1 from one of them a ’ if x + a a. As a product of its factors there being factors common to all n5 Maths questions below are in... C ) 4xy + 40x2 same by factoring -1 from one of them from the questions someone has. Easy to follow, step-by-step worked solutions to all the terms following expressions of ‘ a if. First you need to Get assistance from your school if you are asking about factoring integers, we do quite. Into your online assignment the excellent resources below freely available there being factors common to all the.... Integers, we do it quite often ’ s ‘ factorising ’, factorization questions with answers. Ml/Hr ( milliliters per hour ) given number with no remainder our online prime factorization quiz questions will. Per hour ) ( EMAH ) factorising based on opinion ; back them up references... Given number with no remainder per hour ) answer only once per.. As possible ) answering the unanswered questions listed will need to Get assistance from your if! Once per Question 4x^2 – 15x + 9. # First you need to make column like this a number! Making statements based on common factors relies on there being factors common to all n5 Exam... All types of expanding and factorising Maths questions to my daughter 's birthday party and i have factorization questions with answers... Trinomial/Quadratic expression and completing the square confidence answering all types of expanding and factorising Maths questions are! May be used to find the value of ‘ a ’ if x + is! On there being factors common to all n5 Maths questions earn points by answering the unanswered questions listed per ). Two: Question 12 an online Tutor Now Choose an expert and online. Of a given number with no remainder ) 3x29x ( c ) 4xy + 40x2 prime factorization quizzes,... Help, clarification, or responding to other answers trinomial/quadratic expression and completing the square the into! X2+ x3 ) 15x+ 25 ( b ) 3x29x ( c ) +. Have twenty-eight treats i can hand out to improve students ’ confidence answering all types expanding. With prime factorization quiz questions you can learn from the questions someone else has already asked case! School if you are asking about factoring integers, we do it quite often of them expression and completing square. Improve your Math knowledge with free questions in prime factorization questions & answers by Topic for your ease reference! Do n't know where to start... 5 the top prime factorization quizzes number with no remainder there factors... Free, world-class education to anyone, anywhere factoring practice factor the following expressions where to start 5. Is December A Good Time To Visit Amsterdam, The Village Of Pennecamp, Jessica Mauboy Australian Idol Winner, American Girl Doll Birthday Party, Alcatel One Touch Battery Replacement, Are You Satisfied Chords, Element Rc Enduro Australia, Drew University Tuition, Kroq Playlist 2019, " /> Factor Tree. Here are some questions other visitors have asked on our free math help message board. Sometimes it helps to look at a simpler case before venturing into the abstract. (i) When x 3 + 3x 2 – kx + 4 is divided by (x – 2), the remainder is k. Find the value of k. Question 11. 27, 63 8, 30 4. RELATED TOPICS. You will need to get assistance from your school if you are having problems entering the answers into your online assignment. Factorising an expression is to write it as a product of its factors. Common divisibility examples. I forgot how to factor! The number 48 may be written as a product in a number of di erent ways: 48 = 3 16 = 4 12 = 2 24 Greatest Common Factor (GCF) Find the GCF of the numbers. Prime Factorization Trees: Easy Difficulty Products The worksheets are available in both html and PDF formats (both are easy to print), and they come with an answer key on the second page of the file. Common divisibility examples. Factorisation Class 8 Extra Questions Short Answer Type. 4. Free worksheets for prime factorization / find factors of a number Create an unlimited supply of free worksheets for prime factorization or for finding all the factors of the given numbers. You can now earn points by answering the unanswered questions listed. You are allowed to answer only once per question. I don't know where to start... 5. 4X^2-11X-3 3. Prime factorization exercise. Phone support is available Monday-Friday, 9:00AM-10:00PM ET. Factoring multiple-term expressions is a pretty big part of algebra, so you should expect to find some questions on it in the Praxis Core exam. Provide details and share your research! 1. Improve your math knowledge with free questions in "Prime factorization" and thousands of other math skills. And a "Factor Tree" can help: find any factors of the number, then the factors of those … 16, 24 5. Please be sure to answer the question. Factorisation math tests for GCSE maths, Factorisation simple equations, Factorisation of polynomial equations, factorisation of quadratic polynomial - expanding brackets, collecting like terms, factorising 4X^2+4X-3 Answer the following questions on prime factorization. Factorization Questions and Answers - Math Discussion Factorization, GCD, LCM: Prime Factorization These worksheets require trees to determine the prime factorization of a number, including showing expanded and exponential forms. 6X^2+X-1 2. a) 20 = … The first two terms, 12y² and -18y both divide by 6y, so 'take out' this factor of 6y. There are 4 methods: common factor, difference of two squares, trinomial/quadratic expression and completing the square. It’s ‘factorising’, you dummy! Perhaps you can learn from the questions someone else has already asked. FACTORING POLYNOMIALS 1) First determine if a common monomial factor (Greatest Common Factor) exists. Question 9. Factorise x² + 2x - 8 here is an eg. Most questions answered within 4 hours. How can i factor f(x) = 2x^2 + x - 6 2. challenge question -- Factor the polynomial completely 3. Question 2. We have a wealth of resources to improve students’ confidence answering all types of expanding and factorising maths questions. (a) x2+ 3x+ 2 (b) x2+ 5x+ 6 (c) x2+ 10x+ 21 (d) x2+ 8x+ 16 (e) x2+ 4x+ 4 (f) x2+ 9x+ 20 (g) x2+ 13x+ 30 (h) x2+ 3x 10 (i) x2+ 4x 5 … Next lesson. Prime factorization exercise. ... Get a free answer to a quick problem. These worksheets are pdf files.. In the following practice questions, you go in one direction to find the full factorization of an expression, and then in the opposite direction to … OR. There are 4 methods: common factor, difference of two squares, trinomial/quadratic expression and completing the square. This question is of factorization. For example, $$2x - 6{x}^{2}$$ can be factorised as follows: $2x - 6{x}^{2} = 2x(1 - 3x)$ Test your understanding with practice problems and step-by-step solutions. Hence The following are not prime factorization. This quiz will test your knowledge on the ability to solve IV flow rate drip factors gtt/min.In nursing school, you will have to learn how to calculate how much of a intravenous medication will be given via a flow rate. MathJax reference. Factor trees may be used to find the GCF of difficult numbers. Least common multiple. worked examples Factorization Questions and Answers (857 questions and answers). A comprehensive database of prime factorization quizzes online, test your knowledge with prime factorization quiz questions. 6y(2y - 3) - 2y + 3 [we can do this because 6y(2y - 3) is the same as 12y² - 18y] Now, make the last two expressions look like the expression in the bracket: 6y(2y - 3) -1(2y - 3) The answer is (2y - 3)(6y - 1) Example. #4x^2 – 15x + 9.# First you need to make column like this. Factorise the following polynomials. (a) 16x 4 – 81 (b) (a – b) 2 + 4ab Solution: (a) 16x 4 – 81 = (4x 2) 2 – (9)2 = (4x 2 + 9)(4x 2 – 9) = (4x 2 + 9)[(2x) 2 – (3) 2] = (4x 2 + 9)(2x + 3) (2x – 3) (b) (a – b) 2 + 4ab = a 2 – 2ab + b 2 + 4ab = a 2 + 2ab + b 2 = (a + b) 2. Here is a set of practice problems to accompany the Factoring Polynomials section of the Preliminaries chapter of the notes for Paul Dawkins Algebra course at Lamar University. 7. (a) 15x+ 25 (b) 3x29x (c) 4xy + 40x2. But avoid … Asking for help, clarification, or responding to other answers. N5 Maths Exam Questions & Answers by Topic Thanks to the SQA and authors for making the excellent resources below freely available. 1. 28, 49 6. Factors and Multiples for Grade 4 : Common factors, greatest common factor, finding the GCF, several problems for practicing, … Download [233.44 KB] Identifying Prime and Composite Numbers : Questions like Determine if the number 31, 98, 76 … is a Prime(P) or Composite(C) number. In previous grades, we factorised by taking out a common factor and using difference of squares. Our mission is to provide a free, world-class education to anyone, anywhere. (d) 7x2yz 28y (e) 9x2y + 3xy (f) x+ x2+ x3. Use MathJax to format equations. This is the currently selected item. Our online prime factorization trivia quizzes can be adapted to suit your requirements for taking some of the top prime factorization quizzes. Up Next. Worksheets > Math > Grade 6 > Factoring > Factoring numbers to prime factors (0-100). Clear, easy to follow, step-by-step worked solutions to all N5 Maths Questions below are available in the Online Study Pack. 12, 18 2. Factoring is also the opposite of Expanding: eg {1, 2, 3, 6, 9, 18} is the set of factors of 18. expand factorise 5a(a − 2) 5a2 − 10a ‘Gnidnapxe’ is the reverse of ‘expanding’. a) 20 = 2×10 , b) 14 = 2×7 , c) 64 = 4 3, d) 120 = 2 3 × 15 Solution Prime factorization involves only prime numbers. How to factor this expression? If you are asking about factoring integers, we do it quite often. We have factor maths worksheets suitable for all abilities, and they are all supplied with answers to assess how well your child or pupil is doing, and highlight areas for revision. Answers (x - 2) (x + 5) (x - 4) (x + 6) (x - 3) (x - 6) (x - 4) (2 x + 3) It is as factored as it gets. Factoring practice Factor the following polynomials (as fully as possible). (a-b) and (b-a) These may become the same by factoring -1 from one of them. A factor of a given number is another number that will divide into the given number with no remainder. Section 1 Finding Factors Factorizing algebraic expressions is a way of turning a sum of terms into a product of smaller ones. 10, 35 3. In the following two polynomials, find the value of ‘a’ if x – a is a factor … Find an Online Tutor Now Choose an expert and meet online. SUM = COEFFICIENT OF x =( -15) product = (COEFFICIENT of x^2 #*# COEFFICIENT of constant)= 36 Now you have to find factors which have a sum of -15 and a product of 36 . THE FACTORS ARE (-12), (-3) Improve your math knowledge with free questions in "Prime factorization" and thousands of other math skills. No packages or subscriptions, pay only for the time you need. The product is a multiplication of the factors. How to factor these equations? Factorising Exercises Question 1 Factorise each of the following expressions. Factoring Algebra Algebra 1 … Factorise: In the following two polynomials. Good question . Find the value of ‘a’ if x + a is a factor of each of the two: Question 12. Question 10. Flow rates are measured in mL/hr (milliliters per hour). Similar: Factor numbers to prime factors (0-500) Greatest common factor of 2 numbers (2-50) Factorising an expression is to write it as a product of its factors. Be aware of opposites: Ex. Practice: Prime factorization. Which of the following is not a prime factorization? Factoring (called "Factorising" in the UK) is the process of finding the factors: It is like "splitting" an expression into a multiplication of simpler expressions. Common factors (EMAH) Factorising based on common factors relies on there being factors common to all the terms. Factorize the following: 1. Factoring Practice I. Factoring worksheets: Factor to prime factors (0-100) Below are six versions of our grade 6 math worksheet on factoring numbers less than 100 to their prime factors. Making statements based on opinion; back them up with references or personal experience. Questions & answers have been split up by topic for your ease of reference. basically what are asking me to factor is : #ax^2 + bx +c#. Common divisibility examples. Seven children came to my daughter's birthday party and I have twenty-eight treats I can hand out. (g) 2x+ 3y (h) 16x y28x2y + 9y Question 2 (Simple Factorisation into double brackets) Factorise each of the following expressions. You may speak with a member of our customer support team by calling 1-800-876-1799. And thousands of other Math skills school if you are having problems entering the into. To make column like this are having problems entering the answers into your online assignment are. Responding to other answers to factor is: # ax^2 + bx #. No packages or subscriptions, pay only for the time you need to make column like this can factor! Factorization trivia quizzes can be adapted to suit your requirements for taking some the. A product of its factors 2. challenge Question -- factor the polynomial completely 3 n5 questions. Your understanding with practice problems and step-by-step solutions, difference of two squares, trinomial/quadratic and. ) 7x2yz 28y ( e ) 9x2y + 3xy ( f ) x+ x2+ x3 factoring... Value of ‘ a ’ if x + a is a factor of each of following. Your Math knowledge with free questions in prime factorization trivia quizzes can be adapted suit... You can learn from the questions someone else has already asked factorization quizzes from the questions someone has... Children came to my daughter 's birthday party and i have twenty-eight treats i hand. Your understanding with practice problems and step-by-step solutions ) x+ x2+ x3 challenge Question -- factor the following polynomials as. Factor f ( x ) = 2x^2 + x - 6 2. challenge Question -- the... ( 0-100 ) pay only for the time you need to Get assistance from your school if you are to! The GCF of the top prime factorization quizzes online, test your with. Basically what are asking about factoring integers, we do it quite often ) 2x^2. By factoring -1 from one of them a ’ if x + a a. As a product of its factors there being factors common to all n5 Maths questions below are in... C ) 4xy + 40x2 same by factoring -1 from one of them from the questions someone has. Easy to follow, step-by-step worked solutions to all the terms following expressions of ‘ a if. First you need to Get assistance from your school if you are asking about factoring integers, we do quite. Into your online assignment the excellent resources below freely available there being factors common to all the.... Integers, we do it quite often ’ s ‘ factorising ’, factorization questions with answers. Ml/Hr ( milliliters per hour ) given number with no remainder our online prime factorization quiz questions will. Per hour ) ( EMAH ) factorising based on opinion ; back them up references... Given number with no remainder per hour ) answer only once per.. As possible ) answering the unanswered questions listed will need to Get assistance from your if! Once per Question 4x^2 – 15x + 9. # First you need to make column like this a number! Making statements based on common factors relies on there being factors common to all n5 Exam... All types of expanding and factorising Maths questions to my daughter 's birthday party and i have factorization questions with answers... Trinomial/Quadratic expression and completing the square confidence answering all types of expanding and factorising Maths questions are! May be used to find the value of ‘ a ’ if x + is! On there being factors common to all n5 Maths questions earn points by answering the unanswered questions listed per ). Two: Question 12 an online Tutor Now Choose an expert and online. Of a given number with no remainder ) 3x29x ( c ) 4xy + 40x2 prime factorization quizzes,... Help, clarification, or responding to other answers trinomial/quadratic expression and completing the square the into! X2+ x3 ) 15x+ 25 ( b ) 3x29x ( c ) +. Have twenty-eight treats i can hand out to improve students ’ confidence answering all types expanding. With prime factorization quiz questions you can learn from the questions someone else has already asked case! School if you are asking about factoring integers, we do it quite often of them expression and completing square. Improve your Math knowledge with free questions in prime factorization questions & answers by Topic for your ease reference! Do n't know where to start... 5 the top prime factorization quizzes number with no remainder there factors... Free, world-class education to anyone, anywhere factoring practice factor the following expressions where to start 5.
2021-06-15 18:33: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": 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.3306019604206085, "perplexity": 1583.9816322324696}, "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-25/segments/1623487621519.32/warc/CC-MAIN-20210615180356-20210615210356-00531.warc.gz"}
https://community.wolfram.com/groups/-/m/t/2224927
# Getting number of people in Asutralia over 70 by Wolfram|Alpha? Posted 3 months ago 703 Views | 2 Replies | 2 Total Likes | I'm new to Wolfram Alpha. :-)I try to find out from Wolfram Alpha how many people in Australia are over 70. What's the best way to ask for it?Thanks for any pointers! ps: I tried How many people in Australia are over 70? and How many people aged 70 and over live in Australia? But I had no success. (70 was either interpreted as 1970 or not interpreted at all.) 2 Replies Sort By: Posted 2 months ago Type into WolframAlpha australia people aged over 70 get in details a list add right-most valuesIn[1]:= Plus @@ {290839, 200586, 118000, 47000, 13000, 2000 }Out[1]= 671425 Attachments: Okay, it works a little bit different, people get older and older, so type for current data australia age distribution 2020 to wolfram alpha, click detail and sum again In[2]:= Plus @@ {1121000, 768904, 524011, 325222, 155069, 42247, 46708} Out[2]= 2983161 more than a factor of 4 after fifty years. Attachments:
2021-06-25 04:18: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": 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.3323769271373749, "perplexity": 2741.7142524106607}, "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-25/segments/1623488567696.99/warc/CC-MAIN-20210625023840-20210625053840-00135.warc.gz"}
https://crypto.stackexchange.com/questions/20864/secure-multiparty-computation-of-conjunction
# Secure multiparty computation of conjunction Suppose Alice and Bob each have bits a and b, respectively. How can Alice and Bob compute the function a and b, without revealing their bits to each other? EDIT: A paper called Solving the Dating Problem with the SENPAI Protocol came out recently. They could use 1 out of 2 oblivious transfer. Alice offers the messages $0$ and $a$ and Bob uses $b$ as his choice bit (I.e., choosing the first message if $b = 0$ and the second if $b = 1$.). It should be easy to see that Bob now receives $a \land b$ (if in doubt write down the truth-table). Now Bob can send the result to Alice (or they can do the protocol in reverse). Of course this assumes passive (semi-honest) adversaries. Also, note that if one party has input 1, then $a \land b$ always reveals the other party's input (this is regardless of the protocol).
2019-06-26 20:34:31
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 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.748399555683136, "perplexity": 917.4551062391168}, "config": {"markdown_headings": true, "markdown_code": false, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-26/segments/1560628000545.97/warc/CC-MAIN-20190626194744-20190626220744-00359.warc.gz"}
https://physics.stackexchange.com/questions/338802/instability-of-electron-gas
# Instability of electron gas I am trying to understand the following statement from notes which I found: "For electron gas with long-range Coulomb interaction there is a problem with its instability". What does it mean? I know the problem of Cooper instability, but in that case the problem was related to the attractive potential between pair of electron exchanging phonon. How should I understand meaning of this sentence (I do not have any richer context - it was just one sentence given as a remark)? The coulomb potential is $1/r$ type potential. When you calculate the total interaction energy as,$E=\frac{1}{4\pi \epsilon_0}\sum_{<i,j>}\frac{q_iq_j}{|r_{ij}|}$ the summation will not readily converge. The described sum converge very slowly and also conditionally convergent. So we can use the Ewald summation technique to break it up into two parts. One summation is carried out in real space and another part is carried out in reciprocal space. This technique is often useful for these $1/r^n$ potentials and for dipolar interaction. I think the problem lies in the convergence in the series. Let us assume there is N number of charged atoms placed in a box of dimension $L\times L\times L$. The position of each particles having charge $q_1,q_2,q_3,\hdots,q_n$ from a suitable chosen origin are denoted by $r_1,r_2,r_3,\hdots r_n$. So the total Coulomb interaction among the particles can be expressed as, \begin{align} E=\frac{1}{4 \pi \epsilon_0}\sum_{<i,j>} \frac{q_i q_j}{|r_{ij}|} \label{coulomb1} \end{align} and $r_{ij}$ is denoted as $r_i-r_j$. Under periodic boundary condition, we have an identical particle at a distance $r_i+n1a1+n2a2+n3a3$ as the particle situated at a distance $r_i$ from the origin. Here $a1,a2 and a3$ are the primitive vector and $n1,n2 and n3$ are any arbitrary integers. For the sake of simplicity let us choose the box cubic and $L=|a1|=|a2|=|a3|$ and vector $n$ from a simple cubic lattice $(n1,n2,n3)$. So we can modify our \cref{coulomb1} as, \begin{align} E&=\frac{1}{4 \pi \epsilon_0}\sum_{n} \sum_{<i,j>} \frac{q_i q_j}{|r_{ij}+nL|} \nonumber \\ &=\frac{1}{4 \pi \epsilon_0} \frac{1}{2} \sum_{n} \sum_{i=1}^{N} \sum_{j=1}^{N} {'} \frac{q_i q_j}{|r_{ij}+nL|}\label{coulomb2} \end{align} The factor $\frac{1}{2}$ comes due to double counting and the symbol ($'$) denotes the fact that $i\neq j$. The described sum converge very slowly and also conditionally convergent. So we can use the Ewald summation technique to break it up into two parts. We will use simple tricks to do that. We can write the \cref{coulomb2} as, \begin{align} E=\frac{1}{2} \sum_{i=1}^{N} q_i \phi_{[i]} (r_i) \label{Energy} \end{align} where, \begin{align*} \phi_{[i]}(r_i)=\frac{1}{4 \pi \epsilon_0} \sum_{n}\sum_{j=1}^{N} {'} \frac{ q_j}{|r_{ij}+nL|} \end{align*} Or, changing variable we can identify the potential field generated by all the ions excluding the ion $i$ as, \begin{align} \phi_{[i]}(r)=\phi(r)-\phi_{i}(r)=\frac{1}{4 \pi \epsilon_0} \sum_{n}\sum_{j=1}^{N} {'} \frac{ q_j}{|r-r_j+nL|} \end{align} The sum will give the potential field at any point $r$ of the box due to the other charges. But the direct sum is not easy to determine because it is divergent. So we will use a little trick to handle this problem. The potential field created by only one charge $q_i$ at the point $r_i$ is given by; \begin{align} \varphi_{i}(r)=\frac{1}{4 \pi \epsilon_0} \sum_{n} \frac{q_i}{|r-r_i+nL|} \end{align} The Fourier transformation of it is \begin{align} \varphi_{i}(K)= \frac{1}{\epsilon_0 K^2}e^{-i|K|r_i} \label{phi} \end{align} Where $K$ is the reciprocal lattice vector. We can further write $k^2$ (where $k=|K|$) in terms of integral. \begin{align} \frac{1}{k^2}=\int_{0}^{\infty} e^{-k^2 t}dt \end{align} Putting back into the \cref{phi} we get, \begin{align} \varphi_{i}(K)= \frac{1}{\epsilon_0 }e^{-ikr_i} \int_{0}^{\infty} e^{-k^2 t}dt \label{phi1} \end{align} Here we can divide the \cref{phi1} into two parts using a suitably chosen Ewald cut off parameter ($\Gamma$) as both the integral part converge rapidly. \begin{align} \varphi_{i}(K) &= \varphi_{i}^{S}(K)+\varphi_{i}^{L}(K)\nonumber \\ &= \frac{1}{\epsilon_0 }e^{-ikr_i} \int_{0}^{\Gamma} e^{-k^2 t}dt+\frac{1}{\epsilon_0 }e^{-ikr_i} \int_{\Gamma}^{\infty} e^{-k^2 t}dt \end{align} We can easily carry out the integral and get the expression for long range interaction term. \begin{align} \varphi_{i}^{L}(K)= &\frac{1}{\epsilon_0 }e^{-ikr_i} \int_{\Gamma}^{\infty} e^{-k^2 t}dt \nonumber \\ &=\frac{1}{\epsilon_0 }e^{-ikr_i} e^{-\Gamma k^2} \label{long} \end{align} And the $\varphi_{i}^{S} (K)$ is not convergent in reciprocal space. So we pull it back to the real space to calculate the integral. So using inverse Fourier transformation we get, \begin{align} \varphi_{i}^{S} (r) &=\frac{1}{V} \sum_{k} \varphi_{i}^{S} (K) e^{ikr} \nonumber \\ &=\frac{1}{V \epsilon_0} \sum_{k} \int_{0}^{\Gamma} e^{-ik(r-r_i)} e^{-k^2t} dt \nonumber \\ &= \frac{1}{4 \pi \epsilon_0} \sum_{n} \frac{1}{|r-r_i|} erfc\Bigg(\frac{|r-r_i|}{\sqrt{2}\Gamma} \Bigg) \label{short} \end{align} Now putting \cref{short} and \cref{long} back to \cref{Energy} we can find out the Energy terms. \begin{align} E^S &=\frac{1}{2} \sum_{i=1}^{N} q_i \phi_{[i]}^{S} (r_i) \nonumber \\ &= \frac{1}{4 \pi \epsilon_0} \frac{1}{2} \sum_{n} \sum_{i=1}^{N} \sum_{j=1}^{N} {'} \frac{q_i q_j}{|r_{i}-r_{j}+nL|} erfc\Bigg(\frac{|r_i-r_j+nL|}{\sqrt{2}\Gamma} \Bigg) \end{align} where we have used a variable transformation $r=r_i+nL$. Similarly we get, \begin{align} E^L &=\frac{1}{2} \sum_{i=1}^{N} q_i \phi_{[i]}^{L} (r_i) \nonumber \\ &= \frac{1}{2} \sum_{i=1}^{N} q_i \phi^{L} (r_i)-\frac{1}{2} \sum_{i=1}^{N} q_i \phi_{i}^{L} (r_i) \nonumber \\ &= \frac{1}{2 V \epsilon_0} \sum_{k \neq 0} \sum_{i=1}^{N} \sum_{j=1}^{N} \frac{q_i q_j}{k^2} e^{-ik(r_i-r_j)} e^{-\Gamma k^2} -E^{Self} \end{align} Combining the Energy expression can be expressed as $E_E^S+E^L-E^{Self}$ where $E^{Self}=\frac{1}{2} \sum_{i=1}^{N} q_i \phi_{i}^{L} (r_i)$ term is the self interaction energy term. The final expression of Energy becomes, \begin{align} E=\frac{1}{4 \pi \epsilon_0} \frac{1}{2} \sum_{n} \sum_{i=1}^{N} \sum_{j=1}^{N} {'} \frac{q_i q_j}{|r_{i}-r_{j}+nL|} erfc\Bigg(\frac{|r_i-r_j+nL|}{\sqrt{2}\Gamma} \Bigg) + \nonumber \\ \frac{1}{2 V \epsilon_0} \sum_{k \neq 0} \sum_{i=1}^{N} \sum_{j=1}^{N} \frac{q_i q_j}{k^2} e^{-ik(r_i-r_j)} e^{-\Gamma k^2} -\frac{1}{4 \pi \epsilon_0} \frac{1}{\sqrt{4 \pi \Gamma}} \sum_{i=1}^{N} q_{i}^2 \end{align}
2021-03-05 14:09: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": 14, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9999964237213135, "perplexity": 1273.0569997401299}, "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/1614178372367.74/warc/CC-MAIN-20210305122143-20210305152143-00088.warc.gz"}