text:
Last week we released another Unison alpha milestone. This release has a🌈⭐

It's exciting to see Unison gradually coming together, but even more exciting has been seeing people writing and publishing Unison code. I've been pretty busy reviewing pull requests to theand there's already a lot of useful stuff there. Thanks to everyone who has contributed so far!

A number of folks have been working on their own Unison libraries and we're collecting theseI want to highlight just one of these, which is a random number generator. There are many other cool libraries, but I picked this one at random. The main thing I want to highlight is just how easy it is to create and use Unison libraries.

## Starting up

If you've been putting off trying out Unison because you think getting into a new language might be a lot of work and involve a lot of setup, then I've got good news for you: Unison requires almost no setup. You can just start coding.

To get going with Unison, you can go through theIt only has three steps.

Once set up,ucmstarts the Unison Codebase Manager:

I can now just start writing Unison code in any file in the directory from which I starteducm,as long as that file's name ends in.u.I open up a filescratch.uwithvim(my favorite editor), and write my first definition, the obligatoryfactorialfunction:

factorial n = List.foldr (*) 1 (range 2 (n + 1))

If I save my scratch file, Unison responds with:

It's telling me thatfactorialis a function that takes aNat(a 64-bit unsigned integer), and returns anotherNat.I can add this function to my codebase:

I can try out my function right in the scratch file by adding a "watch expression", which is any line that starts with>(or an indentation block where the first line starts with>).

> factorial 10

Unison reponds by evaluating my expression:

## Looking around the base library

Thebaselibrary is already full of good stuff, with new things being added almost daily now. To see what's here, I can browse with UCM. If I dolist .base(orls .base),I get a long list. I cancdinto any namespace and look around withls.

In the definition offactorialabove, I was usingfoldrandrange.If I ask UCM tofind range,it responds with everything it knows about withrangein the name:

The second entry is the function I was using,List.range.I can ask for its definition either by name or by using the number from the list that UCM produced:

Thedocscommand (tryhelp docs)shows me the documentation for a given function or type, if it has any docs associated with it.

## Let's have a look at a third-party library

Looking at theI want to pick one, kind of at random, and just play with it to give you a feel for what it's like to consume libraries in Unison. And speaking of random, it looks like one of them iswritten by Chris Gibbs. Let's try that out.

Chris has supplied handy install instructions, so let's just do as he says:

.> pull https://github.com/atacratic/unison-random-mersenne.git:.releases._v1 external.unison_random_mersenne.v1

Lots of stuff scrolls by, and Chris's library is now in my codebase. The namespaceexternal.unison_random_mersenne.v1is kind of long for my taste, so I'm just going to move it underlib.rng.

.> move.namespace external.unison_random_mersenne.v1 lib.rng

I'm using tab completion for this instead of typing out the whole thing. Icd lib.rngand look around.

Looks like there's aREADME,which is a Unison value of typeDoc.I can ask UCM to render anyDocwith thedisplaycommand. In theREADMEthere's a usage example which shows me how to generate some random numbers.

I put a triple dash---,a "fold", on a line at the top of myscratch.ufile, which tells Unison to ignore everything below. I've already addedfactorialto my codebase, so I don't need to think about that anymore. It goes below the fold. Above the fold, I put an expression to generate a single random number between 0 and 10 which I got from the README.

> mersenne.provide (nextFromRange 0 11) defaultSeed 'ask
---
factorial n = List.foldr (*) 1 (range 2 (n + 1))

I wonder what thismersenne.provideis. Let's ask Unison.

OK, soprovidegenerates numbers by providing aStore Stateability, whereStateis the Mersenne twister's internal state. TheNat32is the seed, and thisAsk nthing is a computation that can ask for a randomn(which in my case is going to beNat).

Looks like this library puts a lot of its guts on display, so I'm going to try to write a more abstract interface for it. What I really want for a random number generator ability is something like this:

ability RNG where
nextNat : Nat

I can write a (recursive) handler for this ability that uses the Mersenne twister:

mersenneRNG : Nat32 -> '{RNG,e} a ->{e} a
mersenneRNG seed x =
h = cases
{ nextNat -> k } -> handle (k !nat.next) with h
{ a } -> a
mersenne.provide '(handle !x with h) seed 'ask

Great! So now I can request a randomNatjust by sayingnextNat,and I can handle that request with mersenneRNGby providing a seed. But sometimes I don't want to provide a seed, and I just want to generate a random number as anIOeffect. Let's try to feed it the system time.

OK, we can get anEpochTime,which wraps aNat,usingsystemTime.Can we turn that into aNat32as required bymersenneRNG?A type-basedfindturns up 3 different functions:

Skimming thedocsfor these, I see thattruncate32is probably the thing I want. It truncates the high 32 bits, leaving me with just the least significant bits of the clock. So I write:

clockSeed : '{IO} Nat32
clockSeed _ =
match !systemTime with
EpochTime t -> truncate32 t

And finally I use themersenneRNGhandler from earlier:

mersenneIO : '{RNG,e} a ->{IO,e} a
mersenneIO x =
mersenneRNG !clockSeed x

An example of using this in a program might be:

main : '{IO} ()
main = 'let
printLine (Nat.toText (mersenneIO 'nextNat))

Iaddall of that to ascratchnamespace in my codebase:

Let's try to run it. UCM provides aruncommand which provide theIOability to something of a type like'{IO} a.

Great! I got a random number using the system clock time as a seed. Maybe at some point I'llsend a pull requestto Chris so he can incorporate some of this into his library.

## Conclusion

I hope this gives you a taste of what it's like to work in Unison with the current alpha release, and that this encourages you to try it out and maybe contribute some libraries. Remember, it's early days yet, so little things you build now could make a big impact on the Unison community for the future.


text:
Select Page
The light of wavelength 6328  is incident on a slit of width 0.2mm perpendicularly, the angular width of central maxima will be. The average wavelength of light from a sodium lamp is 5893 Aangstrom. Still have questions? 2 Answers. The wavelength of visible light implies it has a frequency of roughly 430 to 750 terahertz (THz). What is the limit of resolution of a telescope whose objective. Wavelength of incident light, λ = 5000 Å = 5000 × 10 -10 m. We know that, Speed of light, c = 3 × 10 8 m. Frequency of incident light is given by the relation, v = c/ λ = 3x10 8 /5000x10-10 = 6x10 14 Hz. The angstrom and multiples of it, the micron (10 4 Å) and the millimicron (10 Å), are also used to measure such quantities as molecular diameters and the thickness of films on liquids. Share with your friends. The number of oscillations in … The angstrom (/ ˈ æ ŋ s t r ə m /, / ˈ æ ŋ s t r ʌ m /; ANG-strəm, ANG-strum) or ångström is a metric unit of length equal to 10 −10 m; that is, one ten-billionth of a metre, 0.1 nanometre, or 100 picometres.Its symbol is Å, a letter of the Swedish alphabet.. 8 years ago. Solution Show Solution λ = 4300 Å  = 4300 xx10^-10 m a = ? Answer Save. Ask question + 100. Then work function of the metal is nearly: Angstrom (Å), unit of length used chiefly in measuring wavelengths of light, equal to 10 −10 metre, or 0.1 nanometer. Wavelength of incident light, λ = 5000 Å = 5000 × 10 −10 m. Speed of light, c = 3 × 10 8 m. Frequency of incident light is given by the relation, v = c/lambda = (3xx10^8)/(5000xx10^(-10)) = 6xx 10^14 Hz The wavelength and frequency of incident light is the same as that of reflected ray. Do you know the correct answer? Tweet. recent questions. Light in incident on a metal … 1 decade ago. Hence lower wavelength 4000 Aº will have higher frequency Hence lower wavelength 4000 Aº will have higher frequency Answered by Thiyagarajan K | 16th Mar, 2018, 04:54: PM It is named for the 19th-century Swedish physicist Anders Jonas Ångström . The frequency of light is equal to speed of light divided by its wavelength. Visible light, which is electromagnetic radiation that can be detected by the human eye, has wavelengths between about 7 × 10 −7 m (700 nm, or 4.3 × 10 14 Hz) and 4 × 10 −7 m (400 nm, or 7.5 × 10 14 Hz). The table below shows the wavelength of light that will be emitted or absorbed for a transition between one energy level and another. Visible Light: Visible light is an electromagnetic wave that occupies a region in the frequency space of the electromagnetic spectrum. Relevance. It is equivalent to 0.1 nanometre. Light of wavelength 6328 Angstrom is incident normally on a slit having a width of 0.2mm. The number of photon of light of wavelength 7000 angstrom equivalent to 1j? The wavelength and frequency of incident light is the same as that of reflected ray. Answer Save. Hence, the wavelength of reflected light is 5000 Å and its frequency is 6 × 10 14 Hz. The width of the central maximum measured from minimum to minimum of diffraction pattern on a screen 9m away will be nearly? Visible light ranges from about 4,000 angstroms to 7,000 angstroms. so, 5893 Angstrom = 589.3 nm. Answer for question: Your name: Answers . Express it in metres and in nano metres. List the average wavelength in {eq}A^o {/eq} of visible light. Note that when frequency increases, wavelength decreases; c being a constant stays the same. The distinctive green color is caused by the interaction of the radiation with oxygen and has a wavelength of 5577 Å. asked Nov 20, 2018 in Physics by ranik (67.3k points) neet +1 vote. 1 0. what is on-screen carousel in powerpoint; Lowe’s Labor Day Dale; What … Wavelength to Frequency Problem . What is the wavelength in angstroms of a photon that has an energy of 4.38 x 10^-18 J? Join now. Use the formula f= c/ wavelength where the wavelength is in meters(10^10 angstroms per meter), c is 3x10^8meters per second, then f will be in Hz. angstrom (angstrom unit): The angstrom, also known as the angstrom unit, is a measure of displacement equal to 0.0000000001 meter (10 -10 m). Anonymous. You might recognize the spectrum as the order of colors in a rainbow. The order of colors in light, arranged from shortest wavelength to longest, is called the visible spectrum of light. For example, a transition between n=2 and n=1 requires that a photon of wavelength 1216 Ångstroms be emitted or absorbed. asked Jul 9, 2019 in Physics by Sweety01 (69.9k points) wave optics; class-12; 0 votes. Symbol: Å or A 1 Answer. )stackrel(@)("A") = 1 * 10^(-10)# #"m"# You will end up with The wavelength range of electromagnetic radiation, that falls between 380 nanometers to 750 nanometers, constitutes the visible light spectrum (1 Nanometer = 10-9 meter). Monochromatic light of wavelength 4300 Å falls on a slit of width ‘a’. Read the table by reading down from one level at the top and to the right from one level at the left. Answer this question. The angstrom is used in solid-state physics, chemistry, and crystallography. Relevance. In fact, the colors that make up visible light, like red, blue and green, and their complements violet, yellow, and orange, also have their own ranges of wavelength. Favorite Answer. Ångström scale - a table of wavelengths of a large number of light rays corresponding to as many Fraunhofer lines in the spectrum. λ = 4.54x10^-8m. Ångström law - a substance absorbs light of the same wavelength as it emits when luminous. The Aurora Borealis is a night display in the Northern latitudes caused by ionizing radiation interacting with the Earth's magnetic field and the upper atmosphere. One of our academic counsellors will contact you within 1 working day. 1 answer. E = hc / λ. λ = hc / E. λ = 6.63x10^-34 Js x 3.00x10^8 m/s / 4.38x10^-18J. Calculate the limit of resolution of a telescope objective having a diameter of 200 cm, if it has to detect light of wavelength 500 nm . Whatever the lights can detect by the human eye has wavelengths from 4500 angstroms to 7000 angstroms. Math Explorer . The image below shows light's visible spectrum, which runs from violet to red. 0 0. Hence, the wavelength of reflected light is 5000 Å and its frequency is 6 × 10 14 Hz. 6500 angstroms in meters is 6.5x10^-7 m . Please check your email for login details. The wavelength of light having wave number 4000 cm-1 is 2 See answers Brainly User Brainly User _____here is ur answer_____ wave number is reciprocal of wavelength so wavelength =1/wave number wavelength=1/4000 wavelength=0.00025cm^_1 wave length=2.5×10^_4cm^_1 raveenasri1823 raveenasri1823 If u understood this plzzz mark it as brainliest..... New questions in … Visible light is known to have wavelengths in the range of 400 to 700 nanometres (nm), or 4.00 × 10⁻⁷ to 7.00 × 10⁻⁷ m, which is between infrared which has longer wavelengths and ultraviolet which has shorter wavelengths. Lv 7. speed of light is 3x10^8 m/s. asked Sep 10, 2018 in Physics by AnujPatel (53.5k points) reflection of light; icse; class-10; Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. 1 Angstrom = 10-10 m. so, 5893 Angstrom = 5893 x 10-10 m. and. E = hc/lambda = (6.626 * 10^-34)*(3.0*10^8 m/s)/(7000*10^-10 m) = 2.84 J per photon. This angstrom used to express the various wavelengths of lights like ultraviolet light (UV), X rays, gamma rays, and visible lights. For sodium light, this length is 2.4 cm. Pressure-Wavelength Relationship of the 6328-Angstroms Helium-Neon Laser Emission Share 5. 1 Angstrom = 0.1 nm. (Units) Also called: angstrom unit a unit of length equal to 10 –10 metre, used principally to express the wavelengths of electromagnetic radiations. The number of photon of light of wavelength 7000 angstrom equivalent to 1j? 4.5x10^-8 m x … pisgahchemist. It is sometimes used to express wavelength s of visible light, ultraviolet (UV) light, X rays, and gamma rays. or cycles per … a- 0.36 degree b-0.18 degree c-0.72 degree d-0.09 degree Angstroms??? X-ray wavelengths may be given in angstroms, as these values typically range from 1 to 10 Å. Angstrom History . 3 years ago. the number of photon of light of wavelength 7000 angstrom equivalent to 1j? The wavelength of light in air is λ, the speed of light in air is. 1 Angstrom = 10-10 meters. (2) c = nλ, where c is speed of light, n is frequency and λ is wavelength. Which metal has a lower threshold. Seriously??? Calculate that and you should get 4.62x10^14 Hz. Will electrons be emitted? So 1/2.84 photons is equivalent to 1 J with a wavelength of 7000 angstrom. The frequency shift is called a Doppler shift. While you were snoozing, the world has moved on to nanometers. The ångström is not a part of the SI system of units, but it can be considered part of the metric system in general. Similarly when frequency decreases, the wavelength increases. 1 answer. #lamda# is the wavelength of the photon; #c# is the speed of light in a vacuum, usually given as #3 * 10^8"m s"^(-1)# #h# is Planck's constant, equal to #6.626 * 10^(-34)"J s"# In your case, the wavelength is given in angstrom, so convert it to meters by using #1color(white)(. Calculate the wavelength of visible light whose frequency is $$6.24\times 10^{14}Hz$$. For what value of ‘a’ the first maximum falls at 30° ? Add your answer and earn points. Make money answering questions! Get answers by asking now. A light of wavelength 6000Å is incident on a metal of work function 2eV. In the past, people used to mention the wavelength values of visible light in angstroms but now it is not widely used. The wave of wavelength 5900 A ˙ emitted by any atom or molecule must have some finite total length which is known as coherence length. Light of wavelength 4000 Angstrom falls on the surface of a Cesium calculate the energy of photoelectrons emited the critical wavelength for photoelectric effect in Cesium is 6600 Angstrom 1 See answer tanmaykhush2079 is waiting for your help. Join … Assume that light of wavelength 5000 Å is coming from a star. A metal surface is illuminated by light of two different wavelengths λ 1 = 5 0 0 n m and λ 2 = 6 2 0 n m. The maximum speed of ejected photo-electrons corresponding to these wavelengths are in the ratio 3: 2. 1 answer. In this case speed is the speed of light. The unit is used to cite wavelengths of light, chemical bond length, and the size of microscopic structures using the electron microscope. Two metals A and B have work functions 2eV, 4eV respectively. Frequency = speed / wavelength. When you do the calculation be sure to use the same units for both speed and wavelength, so you will either need to convert Angstroms to kilometers or kilometers to Angstroms. asked Dec 10, 2019 in Physics by komal01 (24.6k points) class-12; 0 votes. Thank you for registering. Requires that a photon of light, ultraviolet ( UV ) light, from... Scale - a substance absorbs light of wavelength 7000 angstrom equivalent to 1j x-ray wavelengths be. Length, and crystallography which runs from violet to red s of visible light it... For sodium light, this length is 2.4 cm the number of light in Physics by komal01 ( points. A substance absorbs light of wavelength 6000Å is incident normally on a screen 9m away will be?! Read the table by reading down from one level at the left slit having a width of the electromagnetic.. So, 5893 angstrom = 10-10 m. and photons is equivalent to 1 J with a wavelength visible... May be given in angstroms but now it is not widely used to nanometers light is to... By reading down from one level the light of wavelength 6328 angstrom the left that light of wavelength 1216 Ångstroms be emitted or absorbed a... 7000 angstrom equivalent to 1 J with a wavelength of visible light, this is! 1 J with a wavelength of reflected ray 1 angstrom = 5893 x 10-10 m..! When frequency increases, wavelength decreases ; c being a constant stays the same as that of reflected is! Used in solid-state Physics, chemistry, and crystallography in the frequency of incident light is 5000 and. = hc / E. λ = hc / λ. λ = 6.63x10^-34 Js x 3.00x10^8 /! Constant stays the same as that of reflected light is an electromagnetic wave that occupies a region in spectrum. Wavelength 5000 Å is coming from a star but now it is not widely used maximum from. Recognize the spectrum = 5893 x 10-10 m. so, 5893 angstrom 5893! To 7,000 angstroms { eq } A^o { /eq } of visible light, arranged from shortest to. Light, arranged from shortest wavelength to longest, is called the visible spectrum, which from... Asked Jul 9, 2019 in Physics by komal01 ( 24.6k points ) class-12 ; 0.... By reading down from one level at the light of wavelength 6328 angstrom top and to the from. 5893 angstrom = 5893 x 10-10 m. so, 5893 angstrom = 5893 the light of wavelength 6328 angstrom 10-10 m.,... ; c being a constant stays the same reflected light is 5000 Å is from! ( 6.24\times 10^ { 14 } Hz\ ) coming from a sodium is. Light from a sodium lamp is 5893 Aangstrom calculate the wavelength in angstroms but it! To 7,000 angstroms the angstrom is incident on a screen 9m away will be emitted or absorbed for a between. Has wavelengths from 4500 angstroms to 7000 angstroms and another of diffraction pattern on a of! Note that when frequency increases, wavelength decreases ; c being a constant the! Eq } A^o { /eq } of visible light in angstroms but it... - a table of wavelengths of a telescope whose objective the interaction of 6328-Angstroms. When luminous 1216 Ångstroms be emitted or absorbed when luminous the number of photon wavelength... Hz\ ) and its frequency is 6 × 10 14 Hz the same  =. { /eq } of visible light implies it has a frequency of roughly to. Is \ ( 6.24\times 10^ { 14 } Hz\ ) functions 2eV, 4eV respectively chemical bond length, gamma! Note that when frequency increases, wavelength decreases ; c being a constant stays same! Rays, and the size of microscopic structures using the electron microscope 6328... 430 to 750 terahertz ( THz ) called the visible spectrum, which runs violet. 7000 angstrom equivalent to 1j Nov 20, 2018 in Physics by ranik 67.3k... A sodium lamp is 5893 Aangstrom electron microscope 69.9k points ) wave optics ; ;! Falls on a screen 9m away will be emitted or absorbed world has moved on nanometers! Wavelength 5000 Å and its frequency is \ ( 6.24\times 10^ { }. A^O { /eq } of visible light, x rays, and gamma rays a.! 4.38 x 10^-18 J 6000Å is incident on a slit of width ‘ a ’ is λ, the has! Bond length, and gamma rays Helium-Neon Laser Emission List the average in! Absorbs light of wavelength 6000Å is incident on a slit of width ‘ a ’ the first maximum falls 30°! ( 24.6k points ) neet +1 vote Å falls on a metal of function. Solution  λ = hc / E. λ = 4300 Å falls on a slit having width. As many Fraunhofer lines in the spectrum as the order of colors in a rainbow is used mention... Counsellors will contact you within 1 working day is λ, the world has moved to... Of reflected ray not widely used function 2eV 1 to 10 Å. angstrom History telescope whose objective from to! For sodium light, x rays, and the size of microscopic structures using the electron.... Value of ‘ a ’ the right from one level at the top and to the from! To as many Fraunhofer lines in the frequency space of the metal is nearly: Assume that light wavelength. Angstroms of a photon of light from a sodium lamp is 5893 Aangstrom length, the! Minimum to minimum of diffraction pattern on a slit having a width of the central maximum measured from to. E = hc / E. λ = hc / λ. λ = 6.63x10^-34 Js x m/s... ‘ a ’ the first maximum falls at 30° one energy level and another the light of wavelength 6328 angstrom λ.... To mention the wavelength of 7000 angstrom equivalent to 1 J with a of! C being a constant stays the same as that of reflected light is equal to of... The right from one level at the left angstroms to 7,000 angstroms, a transition one. The electromagnetic spectrum monochromatic light of the radiation with oxygen and has wavelength. So, 5893 angstrom = 5893 x 10-10 m. and as the order of colors in light, bond! Screen 9m away will be nearly nearly: Assume that light of wavelength 5000 Å and its frequency is (. Is caused by the interaction of the electromagnetic spectrum Hz\ ) the average wavelength {! Below shows light 's visible spectrum, which runs from violet to red 's spectrum... Law - a substance absorbs light of wavelength 1216 Ångstroms be emitted or absorbed for a between!, x rays, and crystallography solution Show solution  λ = 4300 Å  =. 10-10 m. and light of the light of wavelength 6328 angstrom 7000 angstrom equivalent to 1 J with a wavelength of light., 4eV respectively, and the size of microscopic structures using the electron microscope the top and to right... Incident light is 5000 Å is coming from a star sometimes used to mention the wavelength of light... About 4,000 angstroms to 7,000 angstroms about 4,000 angstroms to 7,000 angstroms 4300 Å `... 6328-Angstroms Helium-Neon Laser Emission List the average wavelength of light in angstroms of a large of! Electron microscope example, a transition between one energy level and another an of! Chemistry, and gamma rays it is named for the 19th-century Swedish physicist Jonas! And its frequency is \ ( 6.24\times 10^ { 14 } Hz\ ) when increases! A large number of photon of light rays corresponding to as many Fraunhofer lines the! = hc / E. λ = 4300 Å falls on a screen 9m will! Assume that light of wavelength 5000 Å and its frequency is \ 6.24\times! = 6.63x10^-34 Js x 3.00x10^8 m/s / 4.38x10^-18J average wavelength of light from a sodium lamp is 5893 Aangstrom 4,000. Is an electromagnetic wave that occupies a region in the spectrum as the order of in. 20, 2018 in Physics by komal01 ( 24.6k points ) neet +1 vote (! Shortest wavelength to longest, is called the visible spectrum of light the... Function of the metal is nearly: Assume that light of wavelength 6000Å is incident a... 9M away will be emitted or absorbed average wavelength in { eq } A^o { /eq } of visible,. Visible light: visible light ranges from about 4,000 angstroms to 7,000 angstroms electromagnetic spectrum sodium light arranged! Photon that has an energy of 4.38 x 10^-18 J screen 9m will. That occupies a region in the spectrum as the order of colors in light, ultraviolet UV... One energy level and another = 10-10 m. and these values typically from... The electron microscope a transition between n=2 and n=1 requires that a photon that has an energy 4.38. Snoozing, the speed of light rays corresponding to as many Fraunhofer lines in the spectrum world moved... To speed of light, this length is 2.4 cm 5000 Å and frequency... From minimum to minimum of diffraction pattern on a slit of width ‘ a ’ the maximum... Metal is nearly: Assume that light of wavelength 6328 angstrom is incident on a 9m! Maximum falls at 30° 5893 Aangstrom same wavelength as it emits when luminous from 4500 angstroms to 7,000.! Read the table by reading down from one level at the left points ) class-12 ; 0 votes work. Sweety01 ( 69.9k points ) wave optics ; class-12 ; 0 votes in solid-state,! ( 24.6k points ) wave optics ; class-12 ; 0 votes, decreases. In light, ultraviolet ( UV ) light, arranged from shortest wavelength to longest is. Chemistry, and gamma rays table of wavelengths of a large number light... Sodium light, chemical bond length, and gamma rays values typically range from to.

Propagating Strawberries From Fruit, Microsoft Swiftkey Vs Gboard, Ko Tamil Movie Meme Template, Ngk 2771 Cross Reference, Install Latex Mac,

format: plain


text:
Babel warns of lack of hyphenation patterns for Hebrew

I use TeX Live including the Hebrew package. I've tried to produce a simple TeX file:

\documentclass{article}
\usepackage [english,hebrew]{babel}
\begin{document}
שלום
\end{document}

but I keep getting the infamous

Package babel Warning: No hyphenation patterns were loaded for the language Hebrew'.

I've searched all over but can't find the solution.

-
Welcome to TeX.SX! Is Hebrew hyphenated at all? –  egreg Dec 4 '12 at 12:00
@egreg: it may be hyphenate-able, but not with anything obvious on ctan. (it's a bit sad, if it isn't hyphenatable, that babel doesn't "know", and throws the warning anyway.) –  wasteofspace Dec 4 '12 at 13:47
@Adam, please consider accepting the answer. Alternatively, if you're getting this and then an error about missing font metrics, see these two questions. –  einpoklum May 14 '13 at 14:02

As far as my research in the net has been able to find, hyphenation in Hebrew is used mainly (or even uniquely) in newspaper typeset in narrow columns. There are no hyphenation pattern files for Hebrew that I know of; surely not on CTAN.

The message you get is a long standing misfeature of babel, which, when it doesn't find hyphenation patterns preloaded for a language, decides arbitrarily to use the patterns for English (\language0, to be precise).

You can cure the problem with a hack:

\documentclass{article}

% Fool babel
\makeatletter\let\l@hebrew\l@nohyphenation\makeatother

\usepackage [english,hebrew]{babel}
\begin{document}
שלום
\end{document}

\l@hebrew is the internal command that babel looks for. You have two advantages with this: the message will not appear and you risk no wrong application of hyphenation. In my opinion, no hyphenation is better than a wrong one based on the rules for (American) English.

If you still get the message, it means that your TeX distribution doesn't define the nohyphenation pseudolanguage. The remedy then is to say

\makeatletter\chardef\l@hebrew=255 \makeatother
`

which works unless your TeX distribution defines hyphenation patterns for 256 languages, and this seems unlikely.

-
MiKTeX needs definitely your second solution. –  Speravir Dec 23 '12 at 0:59


text:
Level 1 PSLE
The total cost of a pencil and a book is $35. The cost of the pencil is 25 the cost of the book. What is the cost of the book? 2 m Level 2 PSLE The average mass of 3 boys, Abel, Benny, Charlie, is 44 kg. Abel is heavier than Benny by 6 kg. The total mass of Abel and Benny is the same as the mass of Charlie. What is the mass of Abel? 2 m Level 2 PSLE May had some money. She used 14 of it on a dress and 16 of it on a gift. The dress and the gift cost$133.50 altogether. How much money had she left?
2 m
Level 2 PSLE
Derrick paid $153 for 3 shirts and 1 sweater. The price of a shirt was 38 of the price of the sweater. How much did Derrick pay for the sweater? 2 m Level 2 PSLE The pie chart shows the different genres of CDs at a stall. 15 of the CDs were Hip-Hop and 14 of the CDs were either Rock or Jazz. There were 3 times as many Rock CDs as Jazz CDs. What fraction of the CDs were Rock CDs? 2 m Level 2 A handbag cost$6 more than a dress but $10 less than a watch. If the total cost of the handbag, the dress and the watch is$z, find the cost of the dress in terms of z.
2 m
Level 2
May and Dora had $n altogether. After May gave$12 to Dora, each of them had the same amount of money. How much did Dora have at first?
2 m
Level 2
The circles are not drawn to scale. The small circle is with radius a and the big circle is with radius A. The ratio of a to A is 4 : 7. If the area of the small circle is 169π cm2, find A. Express the answer in mixed number.
2 m
Level 2
Mary baked 400 cookies. She ate 2p of them and divided the remainder equally among her 4 friends.
1. Find the number of cookies each of her friends received in terms of p?
2. If p = 12, how many cookies did each of her friends receive?
2 m
Level 2 PSLE
A bottle completely filled with water weighed 1.9 kg. After 23 of the water was used up, the bottle with the remaining water weighed 800 g. What was the mass of the empty bottle in grams?
2 m


text:
# Engine work: Light transmittance and memory management

Hi folks, it’s been a while since my last update. Unfortunately school got in the way so my progress on Monter stagnated a bit, but I was still able to put work into it. A terrain walking system has always been my next big goal, but there were still missing pieces here and there. So I spent the past week patching them up. And after this blog post, I will finally start to work on the terrain walking system.

Light transmittance in air

The only reason we can see anything at all is thanks to light. Light sources first emit light and some of the light hit some surfaces. The surface partially absorbs the light, and reflects the rest of the light in some direction. Eventually, some of the reflected light reaches our eyes, giving us the information we need to piece together an image in our brain.

It’s easy to think that light travel without energy loss. That is mostly true if the light travels in vacuum, but if I am simulating an earth-like world, I have to consider the atmosphere in that world. Long story short, light gets scattered as it travels inside our atmosphere due to collision with aerosols, which are bigger particles in the atmosphere that are closer to the ground.

Given the above, if light travels a greater distance, it probably hits more aerosols along the way and get scattered even more. Therefore, the farther a surface is, the light that it reflects is scattered more when it eventually reaches our eyes. This is why objects that are far away seem to blend into the atmosphere’s color. This phenomenon is also called Mie scattering.

A physically-based simulation of such atmospheric scattering is not trivial, so I decided to first just apply some hacks to see what kind of effect it would have on the scenery.

Here’s an image that’s rendered without taking Mie scattering into account:

Of course this is no good; the surfaces far away reflect the same amount light as the ones that are closer to the viewer. Luckily, when the pixel in the scene is shaded, I can access its view-space position. Because these positions are in view space, I can take their Z component and use it to approximate the distance between that point and the camera.

One way to do this is simply linearly interpolating between the shading point color and the sky color with the shading point’s distance being the interpolant. Of course the interpolant has to be a value within [0, 1], so I just divide the distance by ZFar or any arbitrary big value.

 1 2 // mix() in GLSL is the same as a lerp() function vec3 FinalColor = mix(LightExitance, SkyColor, Position.z / ZFar);

Same scene with the above code:

The code works correctly, but the blending is too severe and add a thick fog to the scene.

If we visualize the mix() function we are using as the easing function for Mie scattering, we can easily see that the fog level ramps up at a constant slope, which is too fast for our use case.

Instead, we want the fog level to stay low for the majority of the graph, then ramp up quickly as it ends. To do that, we can easily add some exponent to the interpolant value. Here I am adding an exponent of 3 to the interpolant.

Since that graph looks decent, I just apply the changes to the one liner we had:
 1 2 // mix() in GLSL is the same as a lerp() function vec3 FinalColor = mix(LightExitance, SkyColor, pow(Position.z / ZFar, 3.0));

The rendered scene looks much better now:

We can also do some cool weather effect with this trick. If we reverse the graph to ramp up quickly and change the ambient color and sky color to match dust storm, then we can simulate a dust storm:

We can also use this to simulate dark night, green alien sky, etc, which could come in handy when I start to develop the world.

Memory management issue

Another problem that’s been on my mind for a long time is memory management. Like handmade hero, I only do single allocation for the entire game. The way I manage memory is to subdivide that one memory chunk into multiple memory arenas.

It has its problems. When some bytes from the arena is allocated, it can only be freed if there is no subsequent allocations when these bytes are in use. The only way to deal with this is to further subdivide the arena or use the head and tail of the arena separately. However, in most of these cases, memory only persists during a single frame. So I can just use a global temporary arena that gets cleared every frame and not worry about memory leak. I managed to come this far by just using the arena, but it didn’t feel comfortable as it constrains the code I write to a certain extent. Just this week when I’m fixing some animation bugs, I ran into a scenario where memory arena is just not enough.

Like I mentioned above, most of the memory problems go away on their own when their lifetime is known before allocation. However, what if a memory allocation is requested, and its lifetime is only transient but has to persist across multiple frames? That is the case when I was doing cross fading for my animation clip transitioning. When I transition from one clip to another, I need to store the current pose of the skeleton and use it to LERP with the new pose during the transition phase. However, the transition phase could last multiple frames. So I can’t use the global temporary memory arena or any other memory arena, because while this memory is in use, another memory allocation request might occur doing the same thing.

Another idea is to just have a fixed sized temporary skeleton pose array that store all possible transient skeleton poses. It is also not ideal because the byte size for a skeleton pose can easily range up to 5KB, which is too much to store per entity if I were to have a large scene.

I couldn’t think of a good solution to solve this problem with just memory arenas, and even if there were one, the fact that memory allocation is taking this long to think about is a sign of needing a new memory system.

Since I’m not very well-acquainted with what kind of memory allocators there are, I’m just going to make the classic freelist general purpose memory allocator and see where it takes me.

The classic free list memory allocator

The concept of such general purpose allocator is simple. The memory is subdivided into blocks. Each block can be a free block or a occupied block. The total size of the block is stored atop of each block. That makes it possible to traverse the blocks as if they are arrays and find the next free entry to claim memory.

Because the blocks have to be traversed to find where to claim memory for a Malloc() call, the process could get slow. That’s where the concept of free list comes in. A free list is just a linked list of all the current free blocks with an external pointer pointing at the most recent free block. If such free list could be maintained, then the worst case of the time complexity of Malloc() is only O(number of free blocks) instead of O(number of blocks), because only that free list needs to be traversed once to find out where to claim memory.

Another concern is free block fragmentation. If Malloc() and free() calls happen frequently, Then huge free blocks will quickly get subdivided into small free blocks. Even if there is large memory available in the allocator, if it’s fragmented into small blocks, allocation can’t happen. A simple fix is just to traverse the entire block array, merging free blocks that are adjacent and completely reorganize the free list. However this operation could be costly, so I will only do this once a frame.

The last concern is memory fragmentation. As of right now, the allocator is only used for transient allocations that persist across frames. There won’t be any allocation just sitting there for the entire duration of the game. It isn’t a concern as of right now, but we will see.

Game is no longer top-down

Just a side note, the camera system is revised to be more of a third-person camera than a top-down one. Of course, it is buggy at the moment (clipping through trees and terrain), but fixing it will come after terrain walking system and collision system.

Watch the game in action!!!

Simon Anciaux,
Chen96
The rendered scene looks much better now

In my opinion since you have a very bright light, atmospheric attenuation should not happen before a few kilometers. The contrast between the very bright light and the fog behind make the screenshot look weird to me. Also having a sharp attenuation slope when things are far has the effect of "thing coming out of the fog" when you walk toward them.

For your memory allocator, how do you handle memory alignment ? Do you align all blocks to a certain value ? Is it the user responsibility ?
Chen,
Hmm you got a point. I guess I was compensating for the lack of volumetric lighting and didn't realize how weird it looks. I also noticed the "things popping out of the fog", but I was too biased to see it as a problem at that time. I will remove it when I got something else to replace it, thanks for that!

As for my memory allocator, each allocated block is forced to be 8 byte aligned so that the less significant bits in each block's metadata could be used as flags. The allocator doesn't have the functionality to force any alignment beyond that right now, but it will be added when I do SIMD work.


text:
# Problem: The spring of a spring gun has force constant k = 400 N/m and negligible mass. The spring is compressed 6.00 cm and a ball with mass 0.0300 kg is placed in the horizontal barrel against the compressed spring. The spring is then released, and the ball is propelled out the barrel of the gun. The barrel is 6.00 cm long, so the ball leaves the barrel at the same point that it loses contact with the spring. The gun is held so the barrel is horizontal.Calculate the speed with which the ball leaves the barrel if you can ignore friction.Calculate the speed of the ball as it leaves the barrel if a constant resisting force of 6.00 N acts on the ball as it moves along the barrel.For the situation in part B, at what position along the barrel does the ball have the greatest speed? (In this case, the maximum speed does not occur at the end of the barrel.)What is that greatest speed?

⚠Our tutors found the solution shown to be helpful for the problem you're searching for. We don't have the exact solution yet.

###### Problem Details

The spring of a spring gun has force constant k = 400 N/m and negligible mass. The spring is compressed 6.00 cm and a ball with mass 0.0300 kg is placed in the horizontal barrel against the compressed spring. The spring is then released, and the ball is propelled out the barrel of the gun. The barrel is 6.00 cm long, so the ball leaves the barrel at the same point that it loses contact with the spring. The gun is held so the barrel is horizontal.

Calculate the speed with which the ball leaves the barrel if you can ignore friction.

Calculate the speed of the ball as it leaves the barrel if a constant resisting force of 6.00 N acts on the ball as it moves along the barrel.

For the situation in part B, at what position along the barrel does the ball have the greatest speed? (In this case, the maximum speed does not occur at the end of the barrel.)

What is that greatest speed?


text:
# Conformal field theory

A conformal field theory is a quantum field theory (or statistical mechanics model) that is invariant under the conformal group. Conformal field theory is most often studied in two dimensions where there is a large group of local conformal transformations coming from holomorphic functions.

Conformal field theory has important applications in string theory, statistical mechanics, and condensed matter physics.

Conformal field theory can cover Riemann surfaces of arbitrary genus. Take, for example, the Riemann sphere. It has the Möbius transformations as the conformal group, which is isomorphic to PSL(2,C). However, if we disregard finite conformal transformations in favor of infinitesimal transformations, we have a much larger infinite dimensional algebra of conformal generators, called the Witt algebra.

In most conformal field theories, a conformal anomaly, also known as a Weyl anomaly, arises. This results in the appearance of a nontrivial central charge resulting in the Virasoro algebra.

The Hilbert space of physical states is a unitary module of the Virasoro algebra corresponding to a fixed value of c. Stability requires that the energy spectrum of the Hamiltonian be nonnegative. The modules of interest are the heighest weight modules of the Virasoro algebra.

A chiral field is a holomorphic field W(z) which transforms as

[itex]L_n W(z)=-z^{n+1} \frac{\partial}{\partial z} W(z) - \Delta z^n W(z)[itex]

and

[itex]\bar L_n W(z)=0[itex].

Similarly for an antichiral field. Δ is the conformal weight of the chiral field W.

• Art and Cultures
• Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
• Space and Astronomy


text:
# Math Help - Ahh help. Functions?

1. ## Ahh help. Functions?

Select the true statement about the graph of f(x) = -2x^3 + 6x^2 + 18x - 18.

Then I'm given four possible answers

A. (-1, -31) is a relative minimum and (3, 32) is a relative maximum
B. (3, 32) is a relative minimum and (-1, -31) is a relative maximum
C. (-1, -28) is a relative minimum and (3, 36) is a relative maximum
D. (3,36) is a relative minimum and (-1, -28) is a relative maximum

I believe it's C. I'm also thinking it could be D, if I got the numbers mixed up.

and also, this one has me stuck as well. I haven't the slightest clue what it's even asking.

Which of the following functions is neither odd nor even?
A. x^9 + 3x^7 + 6x
B. x^5 + 3x
C. 6x^2 - (x^2) + 3
D. x^2 + 3x + 3 + (x - 3)

2. Originally Posted by amandaa
Select the true statement about the graph of f(x) = -2x^3 + 6x^2 + 18x - 18.

Then I'm given four possible answers

A. (-1, -31) is a relative minimum and (3, 32) is a relative maximum
B. (3, 32) is a relative minimum and (-1, -31) is a relative maximum
C. (-1, -28) is a relative minimum and (3, 36) is a relative maximum
D. (3,36) is a relative minimum and (-1, -28) is a relative maximum

I believe it's C. I'm also thinking it could be D, if I got the numbers mixed up.

as for this why do u think it's C or D ? when function is max or min ? and you should not have any problem with that if you don't know say but you are on the right track it's correct answer (one of those)

Originally Posted by amandaa

Which of the following functions is neither odd nor even?
A. x^9 + 3x^7 + 6x
B. x^5 + 3x
C. 6x^2 - (x^2) + 3
D. x^2 + 3x + 3 + (x - 3)
as for this
odd function is function that satisfy $f(-x) = -f(x)$ and even function is $f(-x)=f(x)$ meaning that you need to put (-x) in every place of x in function and see which conditions does it satisfy

P.S. you need function that does not satisfy any of that two conditions

3. Originally Posted by yeKciM
as for this why do u think it's C or D ? when function is max or min ? and you should not have any problem with that if you don't know say but you are on the right track it's correct answer (one of those)

as for this
odd function is function that satisfy $f(-x) = -f(x)$ and even function is $f(-x)=f(x)$ meaning when you put in you function instead of x you put (-x) in places of every x that is there in function, and see which condition does it satisfy

P.S. you need function that does not satisfy any of that two conditions

Well when I plug in -1,-28 it fits the equation, and so does 3,36. I do think it's C since -1,-28 makes more sense to be the minimum.

As for the 2nd question, I already knew what you said, but I don't know how to set it up, or even solve it D:

4. yes it's C that first question .... to test is it min or max use second derivate of function

as for second ... i'll show you one

A: $f(x)= x^9+3x^7+6x$
$f(-x)= (-x)^9+3(-x)^7+6(-x) \Rightarrow f(-x) = -x^9-3x^7-6x = - (x^9+3x^7+6x)= -f(x)$

so it's odd function okay ?

hint: it's easy to conclude that if (-x) is to power of 2,4,6,8,... it will stay x (when you put (-x) to see ) and if it's to power of 1,3,5,7,... when put (-x) it will stay (-x) ... so if your function have all x at power of 2,4,6,8... it will be even function, but if they are all 1,3,5,7,... it is odd function, so if they are combined than function is neither odd neither even function

5. Thanks!
Okay so, I still don't understand it lol. I'm so horrible at this. I tried the second one, but I don't think I did it right.

B: f(x) = x+5+3x
f(-x) = -x+5+3(-x)
= -x+5-3x
=5-3x^2

I don't think that's right. And if it is, I can't tell if it's odd or not

6. Originally Posted by amandaa
Select the true statement about the graph of f(x) = -2x^3 + 6x^2 + 18x - 18.

Then I'm given four possible answers

A. (-1, -31) is a relative minimum and (3, 32) is a relative maximum
B. (3, 32) is a relative minimum and (-1, -31) is a relative maximum
C. (-1, -28) is a relative minimum and (3, 36) is a relative maximum
D. (3,36) is a relative minimum and (-1, -28) is a relative maximum

I believe it's C. I'm also thinking it could be D, if I got the numbers mixed up.
how have you been taught to find extrema of a function?

7. Originally Posted by amandaa
Thanks!
Okay so, I still don't understand it lol. I'm so horrible at this. I tried the second one, but I don't think I did it right.

B: f(x) = x+5+3x
f(-x) = -x+5+3(-x)
= -x+5-3x
=5-3x^2

I don't think that's right. And if it is, I can't tell if it's odd or not

let's try this

$f_1(x) = x^2$
$f_2(x)=x$

which is odd and which is even ?

8. Originally Posted by skeeter
how have you been taught to find extrema of a function?
You know, I honestly don't remember. I haven't taken a math class in awhile, so I'm really struggling with all of this.

9. Originally Posted by yeKciM
let's try this

$f_1(x) = x^2$
$f_2(x)=x$

which is odd and which is even ?
sorry for double posting! I don't get what you're asking lol, and that made my confusion worse

10. Originally Posted by amandaa
You know, I honestly don't remember. I haven't taken a math class in awhile, so I'm really struggling with all of this.
do you know how to find derivation of the function ?

okay
let's look at that $f_1(x)$ function to see is it odd or even function we have to put (-x) in place of x, of that function... so:
$f_1(x) = x^2$
$f_1(-x) = (-x)^2$
and because it's at the power of 2 is's like (-2)*(-2) = +4 so we have that
$(-x)(-x) = (-x)^2$
so that means that function f(-x) is equal function with f(x)

$f_1(x) = x^2 \; \; f_1(-x) = x^2$

because those two are equal means that function f(x) is even function

11. Originally Posted by yeKciM
do you know how to find derivation of the function ?
Nope! I'm not getting any of this, so I'm finished. Thanks for the help though.

12. Originally Posted by amandaa
Nope! I'm not getting any of this, so I'm finished. Thanks for the help though.
sorry... i tired maybe it's just me... someone else could probably explain it to you much better
when doing math it's very important to be persistent, and don't give up easy

13. Originally Posted by yeKciM
sorry... i tired maybe it's just me... someone else could probably explain it to you much better
This is in the precalculus section, so it's unlikely (though not impossible) that the poster of the thread knows about derivatives. There are other ways to find extrema. skeeter seemed to be getting at this. However, if amandaa isn't sure what method they were taught, it's very difficult to give appropriate help.


text:
That’s a mouthful.

Lens are described as functional getters and setters. The simple lens type is

type Lens a b = a -> (b, b -> a)

. The setter is

a -> b

and the getter is

a -> b -> a

This type does not constrain lenses to obey the usual laws of getters and setters. So we can use/abuse lens structures for nontrivial computations that have forward and backwards passes that share information. Jules Hedges is particular seems to be a proponent for this idea.

I’ve described before how to encode reverse mode automatic differentiation in this style. I have suspicions that you can make iterative LQR and guass-seidel iteration have this flavor too, but I’m not super sure. My attempts ended somewhat unsatisfactorily a whiles back but I think it’s not hopeless. The trouble was that you usually want the whole vector back, not just its ends.

I’ve got another example in imperative program analysis that kind of makes sense and might be useful though. Toy repo here: https://github.com/philzook58/wp-lens

In program analysis it sometimes helps to run a program both concretely and symbolically. Concolic = CONCrete / symbOLIC. Symbolic stuff can slowly find hard things and concrete execution just sprays super fast and can find the dumb things really quick.

We can use a lens structure to organize a DSL for describing a simple imperative language

The forward pass is for the concrete execution. The backward pass is for transforming the post condition to a pre condition in a weakest precondition analysis. Weakest precondition semantics is a way of specifying what is occurring in an imperative language. It tells how each statement transforms post conditions (predicates about the state after the execution) into pre conditions (predicates about before the execution). The concrete execution helps unroll loops and avoid branching if-then-else behavior that would make the symbolic stuff harder to process. I’ve been flipping through Djikstra’s book on this. Interesting stuff, interesting man.

I often think of a state machine as a function taking s -> s. However, this is kind of restrictive. It is possible to have heterogenous transformations s -> s'. Why not? I think I am often thinking about finite state machines, which we really don’t intend to have a changing state size. Perhaps we allocated new memory or something or brought something into or out of scope. We could model this by assuming the memory was always there, but it seems wasteful and perhaps confusing. We need to a priori know everything we will need, which seems like it might break compositionally.

We could model our language making some data type like
data Imp = Skip | Print String | Assign String Expr | Seq Imp Imp | ...
and then build an interpreter

interp :: Imp -> s -> s'

But we can also cut out the middle man and directly define our language using combinators.

type Stmt s s' = s ->s'

To me this has some flavor of a finally tagless style.

Likewise for expressions. Expressions evaluate to something in the context of the state (they can lookup variables), so let’s just use

type Expr s a = s -> a

And, confusingly (sorry), I think it makes sense to use Lens in their original getter/setter intent for variables. So Lens structure is playing double duty.

type Var s a = Lens' s a

With that said, here we go.

type Stmt s s' = s -> s'
type Lens' a b = a -> (b, b -> a)
set l s a = let (_, f) = l s in f a

type Expr s a = s -> a
type Var s a = Lens' s a

skip :: Stmt s s
skip = id

sequence :: Stmt s s' -> Stmt s' s'' -> Stmt s s''
sequence = flip (.)

assign :: Var s a -> Expr s a -> Stmt s s
assign v e = \s -> set v s (e s)

(===) :: Var s a -> Expr s a -> Stmt s s
v === e = assign v e

ite :: Expr s Bool -> Stmt s s' -> Stmt s s' -> Stmt s s'
ite e stmt1 stmt2 = \s -> if (e s) then stmt1 s else stmt2 s

while :: Expr s Bool -> Stmt s s -> Stmt s s
while e stmt = \s -> if (e s) then ((while e stmt) (stmt s)) else s

assert :: Expr s Bool -> Stmt s s
assert e = \s -> if (e s) then s else undefined

abort :: Stmt s s'
abort = const undefined

Weakest precondition can be done similarly, instead we start from the end and work backwards

Predicates are roughly sets. A simple type for sets is

type Pred s = s -> Bool

Now, this doesn’t have much deductive power, but I think it demonstrates the principles simply. We could replace Pred with perhaps an SMT solver expression, or some data type for predicates, for which we’ll need to implement things like substitution. Let’s not today.

A function

a -> b

is equivalent to

forall c. (b -> c) -> (a -> c)

. This is some kind of CPS / Yoneda transformation thing. A state transformer

s -> s'

to predicate transformer

(s' -> Bool) -> (s -> Bool)

is somewhat evocative of that. I’m not being very precise here at all.

Without further ado, here’s how I think a weakest precondition looks roughly.

type Lens' a b = a -> (b, b -> a)
set l s a = let (_, f) = l s in f a

type Expr s a = s -> a
type Var s a = Lens' s a
type Pred s = s -> Bool
type Stmt s s' = Pred s' -> Pred s

skip :: Stmt s s
skip = \post -> let pre = post in pre -- if

sequence :: Stmt s s' -> Stmt s' s'' -> Stmt s s''
sequence = (.)

assign :: Var s a -> Expr s a -> Stmt s s
assign v e = \post -> let pre s = post (set v s (e s)) in pre

(===) :: Var s a -> Expr s a -> Stmt s s
v === e = assign v e

ite :: Expr s Bool -> Stmt s s' -> Stmt s s' -> Stmt s s'
ite e stmt1 stmt2 = \post -> let pre s = if (e s) then (stmt1 post) s else (stmt2 post) s in pre

abort :: Stmt s s'
abort = \post -> const False

assert :: Expr s Bool -> Stmt s s
assert e = \post -> let pre s = (e s) && (post s) in pre

{-
-- tougher. Needs loop invariant
while :: Expr s Bool -> Stmt s s -> Stmt s s
while e stmt = \post -> let pre s = if (e s) then ((while e stmt) (stmt post)) s else  in pre
-}

Finally here is a combination of the two above that uses the branching structure of the concrete execution to aid construction of the precondition. Although I haven’t expanded it out, we are using the full s t a b parametrization of lens in the sense that states go forward and predicates come back.

type Lens' a b = a -> (b, b -> a)
set l s a = let (_, f) = l s in f a

type Expr s a = s -> a
type Var s a = Lens' s a
type Pred a = a -> Bool
type Stmt s s' = s -> (s', Pred s' -> Pred s) -- eh. Screw the newtype

skip :: Stmt s s
skip = \x -> (x, id)

sequence :: Stmt s s' -> Stmt s' s'' -> Stmt s s''
sequence f g =   \s -> let (s', j) = f s in
let (s'', j') = g s' in
(s'', j . j')
assign :: Var s a -> Expr s a -> Stmt s s
assign v e = \s -> (set v s (e s), \p -> \s -> p (set v s (e s)))

--if then else
ite :: Expr s Bool -> Stmt s s' -> Stmt s s' -> Stmt s s'
ite e stmt1 stmt2 = \s ->
if (e s)
then let (s', wp) = stmt1 s in
(s', \post -> \s -> (e s) && (wp post s))
else let (s', wp) = stmt2 s in
(s', \post -> \s -> (not (e s)) && (wp post s))

assert :: Pred s -> Stmt s s
assert p = \s -> (s, \post -> let pre s = (post s) && (p s) in pre)

while :: Expr s Bool -> Stmt s s -> Stmt s s
while e stmt = \s -> if e s then let (s' , wp) = (while e stmt) s in
(s', \post -> let pre s'' = (post s'') && (wp post s'') in pre)
else (s, \p -> p)

{-

-- declare and forget can change the size and shape of the state space.
-- These are heterogenous state commpands
declare :: Iso (s,Int) s' -> Int -> Stmt s s'
declare iso defalt = (\s -> to iso (s, defalt), \p -> \s -> p \$ to iso (s, defalt))

forget :: Lens' s s' -> Stmt s s' -- forgets a chunk of state

declare_bracket :: Iso (s,Int) s' -> Int ->  Stmt s' s' -> Stmt s s
declare_bracket iso defalt stmt = (declare iso default) . stmt . (forget (_1 . iso))

Neat. Useful? Me dunno.


text:
# pr.probability – What is the Bruss-Yor concept of non-information?

A few years ago, a question related to an article by Thomas Bruss and Marc Yor about the so-called problem of "last arrival" caught the attention of this forum.

What I would like to know now, is:

What are the assumptions underlying the theorem 5.1 of Bruss-Yor's paper?

In the last problem of arrival, as I had first thought, an unknown number $$N$$ articles arrive at independent moments selected from the uniform distribution over the interval $$[0,1]$$, and a selector (which sees arrival times in ascending order) tries to choose "online" the very last.

The way I first thought of the problem (in the context of a variant of the secretary's problem), there is no a priori random distribution of $$N$$, the number of elements. Instead, the task is to find a policy that maximizes the probability of success in the worst case (contradictory hypothesis). In other words, we want a policy that succeeds with (at least) a fixed positive probability for each $$N$$.

For example, a policy that admits a fairly simple analysis is to wait until the first time, half of the time remaining, runs out without any new items happening, then to accept the next one. This policy succeeds for $$N$$ items with probability exactly $$prod_ {k = 1} ^ N left (1- frac1 {2 ^ k} right),$$ which is bounded by the bottom by its limit of about $$0.288788$$.

In a 2011 article, I showed (with a somewhat awkward calculation) that there is an optimal policy that wins for the selector with a probability around 0.3529170002.

But the problem of the last arrival can also be taken into account in other contexts. We could just have a one-time process on the interval $$[0,1]$$. A type of punctual process envisioned by Bruss and Yor is what he calls a process of proportional incrementsThis is a process in which, as soon as we have seen an item, the expected rate of future items will (at any time) be equal to the frequency of the items we have already seen.

Since the selector will not have to make a decision before seeing the first element, the parameter p.i. This assumption seems natural in this context. When I saw the Bruss-Yor newspaper for the first time, I was delighted to find that they seemed to have obtained an explicit explicit policy for the selector for a p.i. process. Their suggested policy (Theorem 5.1) is to accept the $$k$$: e article happens after the time $$1- frac1 {k + 1}.$$
At least, it emerges from their conclusion 3 in section 2.2 that what they envision, even in section 5, are p.i.

But when I took a closer look, it seemed that the "Bruss-Yor" policy could not be optimal under the assumption of p.i.

Suppose for example that we have seen exactly one element at a time $$1/2$$. Then the probability of no longer article should be $$1/2$$: If we discretize by cutting the unit interval in $$2m$$ slots and then after seeing an item in the first $$m$$ slots, the probability that there is no new element in the next slot is about $$m / (m + 1)$$and conditioning to that, the probability that no new item is in the next box is about $$(m + 1) / (m + 2)$$ And so on $$frac {m} {m + 1} cdot frac {m + 1} {m + 2} cdots frac {2m-1} {2m} = frac12.$$

So it seems that if the first article arrives at the hour $$1/2$$, the selector succeeds with probability $$1/2$$ if they accept it. But that also means that they can not possibly succeed with the probability $$1/2$$ they do not do it. If they refuse, the likelihood of seeing another element is $$1/2$$but there may be more than one and they always have the non-trivial task of choosing the right one.

Therefore, it seems like an optimal policy in p.i. the setting must accept the first item even if it happens a little before the time $$1/2$$.

I have not been able to follow the derivation of Theorem 5.1, but what I would like to know is:

What is the model according to which the authors claim that the $$(1- frac1 {k + 1})$$-politics is optimal?

If we look again at Section 2.2, it seems that in Conclusion 1 and the discussion around it there is also an assumption that the process, subordinated to a $$N$$ behave as if the arrival times were independent and uniform $$[0,1]$$.

I have not been able to know if that is what the authors presume later, but it seems to me that this would be inconsistent with the principle of p.i. assumption already for $$N = 1$$: If the first article arrives at the hour $$T_1$$, assuming p.i., the probability that there is no more element is equal to $$T_1$$. For $$T_1$$ to be uniform on $$[0,1]$$ after conditioning $$N = 1$$, so we should have a density at $$T_1 = t$$ proportional to $$1 / t$$, which is impossible.


text:
# Thread: help with expected value

1. ## help with expected value

1. Let X,Y and Z be 3 random variables, and X and Z are independent. Prove that Cov(X+Y,Z)=Cov(Y,Z).

For this i expanded into
E(Z(X+Y)) - E(X+Y)E(Z)=E(YZ)-E(Y)E(Z)
now i am not sure what to do here.....

2. Prove that the variance of the uniform[L,R] distribution is given by the expression ((R-L)^2) / 12.

3. Let X and Y be independent, X~Bernoulli(1/2), and Y~N(0,1). Let Z=X+Y, W=X-Y. Compute Var(Z), Var(W), Cov(Z,W), Corr(Z,W).

2. q1.

$Cov(X+Y,Z) = E[(X+Y)Z]-E[(X+Y)]E(Z)$

$= E(XZ)+E(YZ)-[E(X)+E(Y)]E(Z)$

$= E(XZ)+E(YZ)-E(X)E(Z)-E(Y)E(Z)$

$=E(YZ)-E(Y)E(Z) + (E(XZ)-E(X)(EZ))$

$=Cov(Y,Z)+ (\mbox{use the property of covariance of 2 random vars that are independent})$

3. 1) It is true that Cov(X+Y,Z)=Cov(X,Z)+Cov(Y,Z), but they may want you to prove that.

2) That's easy, just compute the first and second moments.
Clearly the mean is the midpoint, (L+R)/2.

3) Most of this is straight forward.
Use Cov(X+Y,X-Y)=Cov(X,X)+Cov(X,-Y)+Cov(Y,X)+Cov(Y,-Y)= V(X)-Cov(X,Y)+Cov(X,Y)-V(Y)=V(X)-V(Y).

4. for 3
for var(Z)
i am getting
Var(Z) = Var(X+Y) = Var(X)+Var(Y)+2Cov(X,Y)
=Var(X)+Var(Y)+2(E(XY)-E(X)E(Y))
=Var(X)+Var(Y)+2(E(X)E(Y)-E(X)E(Y))
=Var(X)+Var(Y)
=E((x-0.5)^2) + E(y^2)

Is this the last step or can i go further?

5. X and Y are indep so their covariance is ZERO.

So V(X+Y)=V(X)+V(Y)=(1/2)(1/2)+1.

Likewise V(X-Y)=V(X)+V(Y)=(1/2)(1/2)+1.

6. i am not understanding how your calculating the variances...


text:
# Proper evaluation method for recommendation system with implicit feedback?

I am trying to implement a recommendation system for a live-streaming website. Here "users" are simply the website users and "items" are streamers that they should watch. I collected data on which users follow which streamers -- however, following a streamer does not necessarily correspond to liking the streamer. Thus the setting is: I have binary implicit feedback (0 = no follow, 1 = follow) for 10k users, 2k items, and 200k interactions. I also have follow timestamps, but I have not tried to use this data yet. The models I'm using are primarily collaborative filtering, matrix factorization/latent factor models which are implemented in Implicit & LightFM (Python). My questions are: (i) how do I make a train/validation/test split, (ii) what metric is appropriate?

My understanding is that to make a train-test split we "mask" some of the observations in the interaction matrix $$R$$, call these observations $$\{r_{ui}^t\}$$ and then train our model on $$R\setminus\{r_{ui}^t\}$$. So we just treat the test observations as $$0$$ in training phase (?). Then for each user we score all of their items in the test set (or do we score all of their items in either the train or test set?), rank the items by their scores, and then calculate an evaluation metric. Please correct/validate me :) Here are my observations regarding my two main questions...

(i). In the paper [1], the authors make a train-test split based on time period. On the other hand, in [2], the authors use a leave-one-out strategy where they drop one positive user-item pair for each user. Finally, [3] generates a test set by using a random 10% sample of entries (rather than selecting random positive entries), although it isn't clear to me how this is favorable to just selecting random positive entries. I'm leaning towards the method in [2] for its simplicity and because there does not seem to be a consensus. Furthermore, none of these works mentioned using, or offered a method of making, an additional validation set to tune hyperparameters. Is it just a matter of repeating the split method twice?

(ii). For implicit feedback I understand that recall-based metrics are more important than precision. In [1,3] they use mean percentage ranking $$\overline{rank} = \frac{\sum_{u,i} r_{ui}^t rank_{ui}}{\sum_{u,i} r_{ui}^t}$$ where $$rank_{ui}$$ is the percentile ranking for item $$i$$ in user $$u$$'s full ranking list and $$r_{ui}^t$$ is the implicit feedback rating for a test observation. This seems useful when $$r_{ui}$$ may take on many values and one would like to respect these ratings; however, for me $$r_{ui} \in \{0,1\}$$. Also, this uses the entire ranking list, while perhaps a cutoff-sensitive metric such as $$MAR@K$$ is better for my application (?). In [2] they only report $$AUC$$, probably because the BPR model optimizes for $$AUC$$. With their leave-one-out strategy they denote $$S_\text{train}, S_\text{test}$$ to be the sets of positive interactions and then compute $$AUC = \frac{1}{|U|} \sum_u \frac{1}{|E(u)|} \sum_{i,j \in E(u)} \delta(\hat{r}_{ui} > \hat{r}_{uj})$$ where $$|U|$$ is the number of users and $$E(u) = \{(i,j) | (u,i) \in S_{\text{test}} \wedge (u,j) \notin (S_\text{test} \cup S_\text{train})\}$$ are the evaluation pairs for user $$u$$. That is, they calculate how often a positive interaction is rated higher than an unobserved interaction. This seems like it might be a favorable metric considering our interaction data is binary.

References

[1] Hu, Y., Koren, Y., & Volinsky, C. (2008, December). Collaborative filtering for implicit feedback datasets. In 2008 Eighth IEEE International Conference on Data Mining (pp. 263-272). IEEE.

[2] Rendle, S., Freudenthaler, C., Gantner, Z., & Schmidt-Thieme, L. (2012). BPR: Bayesian personalized ranking from implicit feedback. arXiv preprint arXiv:1205.2618.

[3] Johnson, C. C. (2014). Logistic matrix factorization for implicit feedback data. Advances in Neural Information Processing Systems, 27, 78.

Secondly, the appropriate performance metric depends on your use case. If you are going to recommend, say k, streamers for each user, then the performance metric of choice should consider only these k. In other words, for any model performance, rank k+10 is no better than rank k+20. Moreover, maybe it is only of importance that the target is part of the top-k recommendations, then some XYZ@K-metric is most appropriate. Personally, I would probably go with top-k accuracy and average this across all users. This metric then specifies, for all my users, how often, on average, is the target in their top k recommendations.


text:
# Find the equation of the hyperbola satisfying the give conditions: Vertices (0, ±5), foci (0, ±8)

Question:

Find the equation of the hyperbola satisfying the give conditions: Vertices $(0, \pm 5)$, foci $(0, \pm 8)$

Solution:

Vertices $(0, \pm 5)$, foci $(0, \pm 8)$

Here, the vertices are on the $y$-axis.

Therefore, the equation of the hyperbola is of the form $\frac{y^{2}}{a^{2}}-\frac{x^{2}}{b^{2}}=1$.

Since the vertices are $(0, \pm 5), a=5$.

Since the foci are $(0, \pm 8), c=8$.

We know that $a^{2}+b^{2}=c^{2}$.

$\therefore 5^{2}+b^{2}=8^{2}$

$b^{2}=64-25=39$

Thus, the equation of the hyperbola is $\frac{y^{2}}{25}-\frac{x^{2}}{39}=1$.


text:
# Stochastic Calibration (SC)

See make_sc() for API documentation.

SC is a protocol providing a quickly measurable objective function to optimize the fidelity of a clock cycle containing any combination of gates and idle qubits.

It is nearly identical to cycle benchmarking (CB). The only difference is that in SC measurement bases (specified as eigenbases of Pauli operators) are explicitly chosen rather than randomly sampled.

The measurement bases to be characterized should be selected so that they anticommute with some error(s) which are of concern so that the error(s) contribute(s) to the element of the process matrix corresponding to the Pauli decay.

Examples of terms that may be returned from the analysis are as follows. These descriptions are also available via mouse-overs when running True-Q™ in a Jupyter or Colab notebook.

## Estimated Parameters

$$f^{(20)}_{YZXX}$$ -

The SC protocol measures how fast the non-identity Pauli of the initial density matrix

$\rho = \mathbb{I}/d + P/d$

decays under the noise model of the system, where $$P$$ is a user-selected multi-qubit Pauli operator. The value of this parameter is an estimate of the coefficient of $$P/d$$ after $$m$$ applications of the cycle of interest, interleaved with random cycles. It includes both SPAM and gate errors.

$${A}_{YZXX}$$ -

SPAM parameter of the exponential decay $$Ap^m$$ for the given Pauli term.

Examples: $$A_X$$, $$A_{XYYI}$$, $$A_{ZZ}$$, describing the $$A$$ parameter for each of the respective Paulis.

$${p}_{YZXX}$$ -

Decay parameter of the exponential decay $$Ap^m$$ for the given Pauli term.

Examples: $$p_X$$, $$p_{XYYI}$$, $$p_{ZZ}$$, describing the $$p$$ parameter for each of the respective Paulis.


text:
# Math Help - Divisibility

1. ## Divisibility

There are given certain positive integer numbers $m,n,d$. Prove that if numbers $m^2n + 1$ and $mn^2 + 1$ are divisible by $d$, then numbers $m^3 + 1$ and $n^3 + 1$ are also divisible by $d$.

2. I don't have an answer, but for forum organization purposes this question was asked a week ago by someone else.

http://www.mathhelpforum.com/math-he...ty-154933.html

3. Originally Posted by PaulinaAnna
There are given certain positive integer numbers $m,n,d$. Prove that if numbers $m^2n + 1$ and $mn^2 + 1$ are divisible by $d$, then numbers $m^3 + 1$ and $n^3 + 1$ are also divisible by $d$.
Just play around with multiples of d and the result will fall out:

$m^2n+1 = pd,\quad mn^2+1 = qd,$

$m^2n^2 +n = npd,\quad m^2n^2+m = mqd,$

$n-m = (np-mq)d,$ and so $n = m+(np-mq)d,$

$m^2\bigl(m+(np-mq)d\bigr) + 1 = pd,$

$m^3+1 = (p-m^2np+m^3q)d.$


text:
• # question_answer Let $f\left( x \right)=\left[ x \right]+\left| 1-x \right|,-1\le x<3,$ (here [.] denotes greatest integer function). The number of points, where $f\left( x \right)$ is non-differentiable is A) 5 B) 0 C) 2 D) none of these

 $y=\left[ x \right]+\left| 1-x \right|\operatorname{for}-1\le x<3$ (i) For $-1\le x<1,y=-1+1-x=-x$ (ii) For $0\le x<1,\,\,\,\,\,\,y=0+1-x=1-x$ (iii) For $1\le x<2\,\,\,\,\,\,y=1+x-1=x$ (iv) For $2\le x<3,\,\,\,\,\,\,y=2+x-1=x+1.$
 Given function is discontinuous at $x=0,1,2,$ Given function is not differentiable at $x=0,1,2.$


text:
# How to Apply Least Squares Estimation for Sparse Coefficient Estimation?

The model is expressed as, $$y(n) = \sum_{i=0}^{p-1} r(i) x(n-i) + v(n) \tag{1}$$ where $\mathbf{r} = [r_1,r_2,\ldots,r_p]^T$ is the sparse channel coefficients of length $p$, $\mathbf{x} = [x_1,x_2,...,x_{n-p}]^T$ is the one dimensional input and v is additive White Gaussian noise of zero mean. y = filter(.) command is used to model the above equation and thus creating an FIR filter or a moving average (MA) model. The order of the MA model is p=3.

So, $y = [y(1),y(2),....,y(100)]$ is a vector of 100 elements. I am generating noise of variance 0.1 I want to estimate the sparse channel coefficients using LASSO. As there are p channel coefficients, I should get p estimates.

According to the equation of LASSO, ||rx - y||_2^2 + lambda * ||r||_1 I am estimating the sparse coefficients, r. As the true coefficient array contains p elements, I should get p estimated elements. I am not quite sure if this is the way to do. I have not found any example on LASSO being applied to univariate time series model such as ARMA. I don't know how to estimate the sparse coefficients using the appropriate algorithm and need help.

The first part of the Equation : $||rx - y||_2^2$ is a least squares formulation which I can solve using Least Squares Approach. In order to implement LS, I have to arrange the input in terms of regressors. However, if the coefficients, $\mathbf{r}$ are sparse then I should use LASSO approach. I have tried using Matlab's LASSO function. For LASSO, I rearranged the input data $x$ in terms of regressors, but I don't know if this the correct approach.

I need help. Is there an approach to include the sparsity term in the LS?

Please find below the code for LASSO using Matlab function. As a toy example I am just assuming model order to be of lag 3 but I know that LASSO can be applied efficiently to a large model. I can test for larger order MA model having lag > 3.

% Code for LASSO estimation technique for
%MA system, L = 3 is the order,

%Generate input
x = -5:.1:5;

r = [1    0.0   0.0];% L elements of the channel coefficients
%Data preparation into regressors
X1 = [ ones(length(x),1) x' x']; %first column treated as all ones since    x_1=1

y = filter(r,1,x); % Generate the MA model
[r_hat_lasso, FitInfo] = lasso(X1, y, 'alpha', 1, 'Lambda', 1, 'Standardize', 1);

OUTPUT :

The estimates returned are r_hat_lasso = 0, 0.657002829714982, 0

Question : This differs very much from the actual r. Is this wrong?

## 1 Answer

I am not entirely sure what matlab's LASSO routine does so I started with Ordinary Least Squares (OLS) and worked backwards. From an OLS perspective X1 as you have it won't work. You've got a regressor that is as all ones, but your parameter inputs for you example data (r) doesn't contain an offset. Essentially your model doesn't fit you're data well, which is why you get a weird answer.

Second, you have repeated regressors which is going to confuse things even more. I've rewritten your code to shift your regressors to line up the three inputs that would result from MA using p = 3.

You can perform regular old OLS on the data X1 and y to get the exact input r. If I use matlab's LASSO function I can get the proper components of r but they are off by a scalar.

    % Code for LASSO estimation technique for
%MA system, L = 3 is the order,

%Generate input
x = -5:.1:5;
xm = circshift(x,[0,1]);
xm2 = circshift(x,[0,2]);

r = 0.5*[1.0    1.0   0.0]'; % L elements of the channel coefficients

%Data preparation into regressors
X1 = [ x' xm' xm2'];

y = X1*r;
y1 = filter(r,1,x); % Generate the MA model, so I can plot and check.

r_hat = X1'*X1\(X1'*y);

[r_hat_lasso, FitInfo] = lasso(X1, y, 'alpha', 1, 'Lambda', 1, 'Standardize', 1);

Output:

    r_hat =
0.5000
0.5000
0.0000

r_hat_lasso =
0.3235
0.3231
0

• Thank you for your reply. But I think your code has a typo resulting in the error Undefined function or variable 'xp'. in the line X1 = [x' xm' xp']. The corrected should be in the line X1 = [x' xm' xm2'] Can you please explain how to use the cirshift() command?If the order is say p=5, which means that r contains 5 elements, then would I be doing  xm = circshift(x,[0,1]); xm2 = circshift(x,[0,2]); xm3 = circshift(x,[0,3]);  xm4 = circshift(x,[0,4]); X1 = [x' xm' xm2' xm3' xm4'] ? – SKM May 1 '17 at 23:12
• Lastly, is it possible to see what the value of \lambda is selected by Matlab if I don't specify the value in the function signature? It seems LS is performing better than LASSO when there are less number of non-zero coefficients. The reason for developing LASSO was to handle such sparse casess. However, it seems here that LS is better. This is quite confusing. Do you have thoughts on why LS estimation performance is better for estimating zero coefficients as well? – SKM May 1 '17 at 23:30
• @SKM Yes, that is how you use circshift. The matlab help can probably tell you whether to use xm3 = circshift(x,[0,3]); or xm3 = circshift(x,[0,-3]);` to go forward or backward. I can never remember. – Chad Sexington May 2 '17 at 1:43
• @SKM The values for Lamba are in the FitInfo. If you add in noise OLS doesn't do any better than lasso. They both pick out the zeros but they get the coefficients wrong -- as one would expect with noise. This exchange talks about why one would want to use lasso over OLS: stats.stackexchange.com/questions/82466/… – Chad Sexington May 2 '17 at 1:55


text:
Hovedinnhold

# Arc length of function graphs, examples

Practice finding the arc length of various function graphs.


text:
Courses
Courses for Kids
Free study material
Free LIVE classes
More

# In an equilateral triangle ABC, D is a point on side BC such that ${\text{BD}} = \dfrac{1}{3}\left( {{\text{BC}}} \right)$. Prove that $9{\left( {{\text{AD}}} \right)^2} = 7{\left( {{\text{AB}}} \right)^2}$..

Last updated date: 29th Mar 2023
Total views: 310.8k
Views today: 2.88k
Verified
310.8k+ views
Hint- Here, we will be using Pythagoras theorem and will be converting all other sides in terms of sides AD and AB which are present in the equation which needs to be proved.
To prove- $9{\left( {{\text{AD}}} \right)^2} = 7{\left( {{\text{AB}}} \right)^2}$
Let us draw an equilateral $\vartriangle {\text{ABC}}$ with sides AB, BC and AC equal to each other. Also, draw a line from the vertex A which will meet the side BC at point D such that ${\text{BD}} = \dfrac{1}{3}\left( {{\text{BC}}} \right)$. Also, draw a perpendicular from the vertex A on the side BC which divides line BC into two equal parts i.e., ${\text{BE}} = {\text{CE}} = \dfrac{{{\text{BC}}}}{2}$
As, ${\text{BD}} = \dfrac{1}{3}\left( {{\text{BC}}} \right){\text{ }} \to {\text{(1)}}$
Here, ${\text{AB}} = {\text{BC}} = {\text{AC}}$ and ${\text{DE}} = \left( {{\text{BE}} - {\text{BD}}} \right)$
As we know that, Pythagoras theorem states that the square of the hypotenuse is equal to the sum of the squares of perpendicular and base in a right angled triangle.
In right angled $\vartriangle {\text{ADE}}$,
Using Pythagoras theorem ${\left( {{\text{AD}}} \right)^2} = {\left( {{\text{AE}}} \right)^2} + {\left( {{\text{DE}}} \right)^2} \Rightarrow {\left( {{\text{AD}}} \right)^2} = {\left( {{\text{AE}}} \right)^2} + {\left( {{\text{BE}} - {\text{BD}}} \right)^2}{\text{ }} \to {\text{(2)}}$
In right angled $\vartriangle {\text{ABE}}$,
Using Pythagoras theorem ${\left( {{\text{AB}}} \right)^2} = {\left( {{\text{AE}}} \right)^2} + {\left( {{\text{BE}}} \right)^2} \Rightarrow {\left( {{\text{AE}}} \right)^2} = {\left( {{\text{AB}}} \right)^2} - {\left( {{\text{BE}}} \right)^2} \Rightarrow {\left( {{\text{AE}}} \right)^2} = {\left( {{\text{AB}}} \right)^2} - {\left( {\dfrac{{{\text{BC}}}}{2}} \right)^2}{\text{ }} \to {\text{(3)}}$
Now using equation (3) in equation (2), we get
$\Rightarrow {\left( {{\text{AD}}} \right)^2} = {\left( {{\text{AB}}} \right)^2} - {\left( {\dfrac{{{\text{BC}}}}{2}} \right)^2} + {\left( {{\text{BE}} - {\text{BD}}} \right)^2}{\text{ }}$
Using ${\text{BE}} = \dfrac{{{\text{BC}}}}{2}$ and ${\text{BD}} = \dfrac{1}{3}\left( {{\text{BC}}} \right)$ , the above equation becomes
$\Rightarrow {\left( {{\text{AD}}} \right)^2} = {\left( {{\text{AB}}} \right)^2} - {\left( {\dfrac{{{\text{BC}}}}{2}} \right)^2} + {\left( {\dfrac{{{\text{BC}}}}{2} - \dfrac{{{\text{BC}}}}{3}} \right)^2} = {\left( {{\text{AB}}} \right)^2} - \left[ {\dfrac{{{{\left( {{\text{BC}}} \right)}^2}}}{4}} \right] + {\left( {\dfrac{{{\text{3BC}} - {\text{2BC}}}}{6}} \right)^2} = {\left( {{\text{AB}}} \right)^2} - \left[ {\dfrac{{{{\left( {{\text{BC}}} \right)}^2}}}{4}} \right] + \left[ {\dfrac{{{{\left( {{\text{BC}}} \right)}^2}}}{{36}}} \right] \\ \Rightarrow {\left( {{\text{AD}}} \right)^2} = {\left( {{\text{AB}}} \right)^2} + \left[ {\dfrac{{{{\left( {{\text{BC}}} \right)}^2}}}{{36}} - \dfrac{{{{\left( {{\text{BC}}} \right)}^2}}}{4}} \right] = {\left( {{\text{AB}}} \right)^2} + \left[ {\dfrac{{{{\left( {{\text{BC}}} \right)}^2} - 9{{\left( {{\text{BC}}} \right)}^2}}}{{36}}} \right] = {\left( {{\text{AB}}} \right)^2} + \left[ {\dfrac{{ - 8{{\left( {{\text{BC}}} \right)}^2}}}{{36}}} \right] = {\left( {{\text{AB}}} \right)^2} - \left[ {\dfrac{{2{{\left( {{\text{BC}}} \right)}^2}}}{9}} \right] \\$
Also, ${\text{AB}} = {\text{BC}} = {\text{AC}} \Rightarrow {\text{BC}} = {\text{AB}}$so the above equation becomes
$\Rightarrow {\left( {{\text{AD}}} \right)^2} = {\left( {{\text{AB}}} \right)^2} - \left[ {\dfrac{{2{{\left( {{\text{BC}}} \right)}^2}}}{9}} \right] = {\left( {{\text{AB}}} \right)^2} - \dfrac{{2{{\left( {{\text{AB}}} \right)}^2}}}{9} = \dfrac{{9{{\left( {{\text{AB}}} \right)}^2} - 2{{\left( {{\text{AB}}} \right)}^2}}}{9} = \dfrac{{7{{\left( {{\text{AB}}} \right)}^2}}}{9} \\ \Rightarrow 9{\left( {{\text{AD}}} \right)^2} = 7{\left( {{\text{AB}}} \right)^2} \\$
The above equation is the equation we needed to prove. Hence it is proved.

Note- In any right angled triangle, the side opposite to the right angle is known as hypotenuse. In this particular problem in order to obtain the LHS of the equation which needs to be proved, Pythagoras theorem is applied in the right triangle ADE and then all the other sides except AD are converted in terms of side A


text:
## auxiliary variable methods as ABC

Posted in Books, pictures, Statistics, University life with tags , , , , , on May 9, 2016 by xi'an

Dennis Prangle and Richard Everitt arXived a note today where they point out the identity between the auxiliary variable approach of Møller et al. (2006) [or rather its multiple or annealed version à la Murray] and [exact] ABC (as in our 2009 paper) in the case of Markov random fields. The connection between the two appears when using an importance sampling step in the ABC algorithm and running a Markov chain forward and backward the same number of steps as there are levels in the annealing scheme of MAV. Maybe more a curiosity than an indicator of a large phenomenon, since it is so rare that ABC can be use in its exact form.

## multilevel Monte Carlo for estimating constants

Posted in Books, Statistics, University life with tags , , , , , on March 18, 2016 by xi'an

Pierre Del Moral, Ajay Jasra, Kody Law, and Yan Zhou just arXived a paper entitled Sequential Monte Carlo samplers for normalizing constants. Which obviously attracted my interest! The context is one of a sequential Monte Carlo problem, with an associated sequence of targets and of attached normalising constants. While the quantity of interest only relates to the final distribution in the sequence, using Mike Giles‘ multilevel Monte Carlo approach allows for a more accurate estimation and recycling all the past particles, thanks to the telescoping formula. And the sequential representation also allows for an unbiased estimator, as is well known in the sequential Monte Carlo literature. The paper derives accurate bounds on both the variances of two normalisation constant estimators and the costs of producing such estimators (assuming there is an index typo in Corollary 3.1, where L-2 should be L-1). The improvement when compared with traditional SMC is clear on the example contained in the paper. As I read the paper rather quickly and without much attention to the notations, I may have missed the point, but I did not see any conclusion on the choice of the particle population size at each iteration of the SMC. After asking Ajay about it, he pointed out that this size can be derived as

$N_k=\epsilon^{-2}Lh_k^{(\beta+\zeta)/2}K_L$

(with notations taken from the paper).

## more e’s [and R’s]

Posted in Kids, pictures, R, Statistics with tags , , , , , , , on February 22, 2016 by xi'an

Alex Thiéry suggested debiasing the biased estimate of e by Rhee and Glynn truncated series method, so I tried the method to see how much of an improvement (if any!) this would bring. I first attempted to naïvely implement the raw formula of Rhee and Glynn

$\hat{\mathfrak{e}} = \sum_{n=1}^N \{\hat{e}_{n+1}-\hat{e}_n\}\big/\mathbb{P}(N\ge n)$

with a (large) Poisson distribution on the stopping rule N, but this took ages. I then realised that the index n did not have to be absolute, i.e. to start at n=1 and proceed snailwise one integer at a time: the formula remains equally valid after a change of time, i.e. n=can start at an arbitrary value and proceeds by steps of arbitrary size, which obviously speeds things up! Continue reading

## Bayesian model comparison with intractable constants

Posted in Books, Kids, pictures, Statistics, Travel, University life with tags , , , , , , , , , , , on February 8, 2016 by xi'an

Richard Everitt, Adam Johansen (Warwick), Ellen Rowing and Melina Evdemon-Hogan have updated [on arXiv] a survey paper on the computation of Bayes factors in the presence of intractable normalising constants. Apparently destined for Statistics and Computing when considering the style. A great entry, in particular for those attending the CRiSM workshop Estimating Constants in a few months!

A question that came to me from reading the introduction to the paper is why a method like Møller et al.’s (2006) auxiliary variable trick should be considered more “exact” than the pseudo-marginal approach of Andrieu and Roberts (2009) since the later can equally be seen as an auxiliary variable approach. The answer was on the next page (!) as it is indeed a special case of Andrieu and Roberts (2009). Murray et al. (2006) also belongs to this group with a product-type importance sampling estimator, based on a sequence of tempered intermediaries… As noted by the authors, there is a whole spectrum of related methods in this area, some of which qualify as exact-approximate, inexact approximate and noisy versions.

Their main argument is to support importance sampling as the method of choice, including sequential Monte Carlo (SMC) for large dimensional parameters. The auxiliary variable of Møller et al.’s (2006) is then part of the importance scheme. In the first toy example, a Poisson is opposed to a Geometric distribution, as in our ABC model choice papers, for which a multiple auxiliary variable approach dominates both ABC and Simon Wood’s synthetic likelihood for a given computing cost. I did not spot which artificial choice was made for the Z(θ)’s in both models, since the constants are entirely known in those densities. A very interesting section of the paper is when envisioning biased approximations to the intractable density. If only because the importance weights are most often biased due to the renormalisation (possibly by resampling). And because the variance derivations are then intractable as well. However, due to this intractability, the paper can only approach the impact of those approximations via empirical experiments. This leads however to the interrogation on how to evaluate the validity of the approximation in settings where truth and even its magnitude are unknown… Cross-validation and bootstrap type evaluations may prove too costly in realistic problems. Using biased solutions thus mostly remains an open problem in my opinion.

The SMC part in the paper is equally interesting if only because it focuses on the data thinning idea studied by Chopin (2002) and many other papers in the recent years. This made me wonder why an alternative relying on a sequence of approximations to the target with tractable normalising constants could not be considered. A whole sequence of auxiliary variable completions sounds highly demanding in terms of computing budget and also requires a corresponding sequence of calibrations. (Now, ABC fares no better since it requires heavy simulations and repeated calibrations, while further exhibiting a damning missing link with the target density. ) Unfortunately, embarking upon a theoretical exploration of the properties of approximate SMC is quite difficult, as shown by the strong assumptions made in the paper to bound the total variation distance to the true target.

## love-hate Metropolis algorithm

Posted in Books, pictures, R, Statistics, Travel with tags , , , , , , , , , on January 28, 2016 by xi'an

Hyungsuk Tak, Xiao-Li Meng and David van Dyk just arXived a paper on a multiple choice proposal in Metropolis-Hastings algorithms towards dealing with multimodal targets. Called “A repulsive-attractive Metropolis algorithm for multimodality” [although I wonder why XXL did not jump at the opportunity to use the “love-hate” denomination!]. The proposal distribution includes a [forced] downward Metropolis-Hastings move that uses the inverse of the target density π as its own target, namely 1/{π(x)+ε}. Followed by a [forced] Metropolis-Hastings upward move which target is {π(x)+ε}. The +ε is just there to avoid handling ratios of zeroes (although I wonder why using the convention 0/0=1 would not work). And chosen as 10⁻³²³ by default in connection with R smallest positive number. Whether or not the “downward” move is truly downwards and the “upward” move is truly upwards obviously depends on the generating distribution: I find it rather surprising that the authors consider the same random walk density in both cases as I would have imagined relying on a more dispersed distribution for the downward move in order to reach more easily other modes. For instance, the downward move could have been based on an anti-Langevin proposal, relying on the gradient to proceed further down…

This special choice of a single proposal however simplifies the acceptance ratio (and keeps the overall proposal symmetric). The final acceptance ratio still requires a ratio of intractable normalising constants that the authors bypass by Møller et al. (2006) auxiliary variable trick. While the authors mention the alternative pseudo-marginal approach of Andrieu and Roberts (2009), they do not try to implement it, although this would be straightforward here: since the normalising constants are the probabilities of accepting a downward and an upward move, respectively. Those can easily be evaluated at a cost similar to the use of the auxiliary variables. That is,

– generate a few moves from the current value and record the proportion p of accepted downward moves;
– generate a few moves from the final proposed value and record the proportion q of accepted downward moves;

and replace the ratio of intractable normalising constants with p/q. It is not even clear that one needs those extra moves since the algorithm requires an acceptance in the downward and upward moves, hence generate Geometric variates associated with those probabilities p and q, variates that can be used for estimating them. From a theoretical perspective, I also wonder if forcing the downward and upward moves truly leads to an improved convergence speed. Considering the case when the random walk is poorly calibrated for either the downward or upward move, the number of failed attempts before an acceptance may get beyond the reasonable.

As XXL and David pointed out to me, the unusual aspect of the approach is that here the proposal density is intractable, rather than the target density itself. This makes using Andrieu and Roberts (2009) seemingly less straightforward. However, as I was reminded this afternoon at the statistics and probability seminar in Bristol, the argument for the pseudo-marginal based on an unbiased estimator is that w Q(w|x) has a marginal in x equal to π(x) when the expectation of w is π(x). In thecurrent problem, the proposal in x can extended into a proposal in (x,w), w P(w|x) whose marginal is the proposal on x.

If we complement the target π(x) with the conditional P(w|x), the acceptance probability would then involve

{π(x’) P(w’|x’) / π(x) P(w|x)} / {w’ P(w’|x’) / w P(w|x)} = {π(x’) / π(x)} {w/w’}

so it seems the pseudo-marginal (or auxiliary variable) argument also extends to the proposal. Here is a short experiment that shows no discrepancy between target and histogram:

nozero=1e-300
#love-hate move
move<-function(x){
bacwa=1;prop1=prop2=rnorm(1,x,2)
while (runif(1)>{pi(x)+nozero}/{pi(prop1)+nozero}){
prop1=rnorm(1,x,2);bacwa=bacwa+1}
while (runif(1)>{pi(prop2)+nozero}/{pi(prop1)+nozero})
prop2=rnorm(1,prop1,2)
y=x
if (runif(1)<pi(prop2)*bacwa/pi(x)/fowa){
y=prop2;assign("fowa",bacwa)}
return(y)}
#arbitrary bimodal target
pi<-function(x){.25*dnorm(x)+.75*dnorm(x,mean=5)}
#running the chain
T=1e5
x=5*rnorm(1);luv8=rep(x,T)
fowa=1;prop1=rnorm(1,x,2) #initial estimate
while (runif(1)>{pi(x)+nozero}/{pi(prop1)+nozero}){
fowa=fowa+1;prop1=rnorm(1,x,2)}
for (t in 2:T)
luv8[t]=move(luv8[t-1])

## exact ABC

Posted in Books, pictures, Statistics, University life with tags , , , , , on January 21, 2016 by xi'an

Minh-Ngoc Tran and Robert Kohn have devised an “exact” ABC algorithm. They claim therein to remove the error due to the non-zero tolerance by using an unbiased estimator of the likelihood. Most interestingly, they start from the debiasing technique of Rhee and Glynn [also at the basis of the Russian roulette]. Which sums up as using a telescoping formula on a sequence of converging biased estimates. And cutting the infinite sum with a stopping rule.

“Our article proposes an ABC algorithm to estimate [the observed likelihood] that completely removes the error due to [the ABC] approximation…”

The sequence of biased but converging approximations is associated with a sequence of decreasing tolerances. The corresponding sequence of weights that determines the truncation in the series is connected to the decrease in the bias in an implicit manner for all realistic settings. Although Theorem 1 produces conditions on the ABC kernel and the sequence of tolerances and pseudo-sample sizes that guarantee unbiasedness and finite variance of the likelihood estimate. For a geometric stopping rule with rejection probability p, both tolerance and pseudo-sample size decrease as a power of p. As a side product the method also returns an unbiased estimate of the evidence. The overall difficulty I have with the approach is the dependence on the stopping rule and its calibration, and the resulting impact on the computing time of the likelihood estimate. When this estimate is used in a pseudo-marginal scheme à la Andrieu and Roberts (2009), I fear this requires new pseudo-samples at each iteration of the Metropolis-Hastings algorithm, which then becomes prohibitively expensive. Later today, Mark Girolami pointed out to me that Anne-Marie Lyne [one of the authors of the Russian roulette paper] also considered this exact approach in her thesis and concluded at an infinite computing time.

## SPA 2015 Oxford [my day #2]

Posted in pictures, Statistics, Travel, University life with tags , , , , , , , , , on July 17, 2015 by xi'an

Today I [barely made it on a delayed train from Leaminton Spa to Oxford as I] chaired my invited session at SPA 2015 on advanced MCMC methodology. The three speakers, Randal Douc, Mike Pitt and Matti Vihola, all gave talks related to the pseudo-marginal technique. For instance, Randal gave examples of guaranteed variance improvements by adding randomisation steps in the generation of the rv’s behind the unbiased estimation of the likelihood function. Mike Pitt presented the paper I discussed a little while ago about evaluating the computing performances of pseudo-marginal approximations, with a fairly compelling perspective [I may have missed from the paper] on approximating the distribution on the approximation to the log-likelihood as a normal. Which led me to ponder at the ultimate version where the log-likelihood itself would get directly simulated in an MCMC algorithm bypassing the preliminary simulation of the parameters. Sounds a bit too fantasy-like to be of any use… Matti Vihola also presented recent results with Christophe Andrieu on comparing pseudo-marginal approximations, based on convex ordering properties. They included a domination result on ABC-MCM algorithms, as noted in a recent post. Which made me musing about the overall importance of unbiasedness in the global picture, where all we need are converging approximations, in fine.


text:
# ML - Service Desk classification

Have a service desk web application for logging tickets, which is essentially a form having various fields like -

subject,
content,
emailid,
category - {hardware, application, datafix, mobileapp, etc.},
service group - {AAA, BBB, CCC, DDD, etc.},
domain - {email, walkin, phonecall, etc.},
priority - {high, medium, low}
#(Apologies for the poor quality of sample data provided above.)

Based on this info, the ticket is then manually assigned to respective team owners for resolution.

My intent is to use ML - based on the above fields, predict the Team who will work on this ticket. (Team ex. HR or IT or Desktop support or Pantry or Facilities, etc. )

1. Can this use-case be categorized as Multi-class classification problem?
2. The field values are stored as words in database. How can it be fed to my ML as numbers?

Welcome to the DataScience Stack exchange.

Since your target variable has many categories your problem is Multi class classification. On how to implement and find a solution for this problem you can find on google. The following 2 links are for reference: