text:
# C[omp]ute

Welcome to my blog, which was once a mailing list of the same name and is still generated by mail. Please reply via the "comment" links.

Always interested in offers/projects/new ideas. Eclectic experience in fields like: numerical computing; Python web; Java enterprise; functional languages; GPGPU; SQL databases; etc. Based in Santiago, Chile; telecommute worldwide. CV; email.

© 2006-2015 Andrew Cooke (site) / post authors (content).

## [News] 2019: The year revolt went global

From: andrew cooke <andrew@...>

Date: Thu, 12 Dec 2019 19:29:26 -0300

https://thefifthwave.wordpress.com/2019/12/10/2019-the-year-revolt-went-global/

https://www.bloomberg.com/opinion/articles/2019-10-21/protesters-worldwide-are-united-by-something-other-than-politics

Andrew

## Previous Entries

### [Politics] The world's most-surveilled cities

From: andrew cooke <andrew@...>

Date: Thu, 19 Sep 2019 17:23:23 -0300

https://www.comparitech.com/vpn-privacy/the-worlds-most-surveilled-cities

Andrew

### [Bike] Hope Freehub

From: andrew cooke <andrew@...>

Date: Sat, 31 Aug 2019 21:54:18 -0400

Some notes on the Hope specific freehub and related cassettes.  In
general, more force is needed than you might expect when manhandling
these things.

* The two-piece cassette is difficult to separate.  It helps to cool
the entire cassette (since aluminium has a higher thermal expansion
coeff than steel) and then lever them apart with something wooden.

* Putting them back together is similarly fraught.  The spot on the
aluminium spider aligns with the biggest gap in the internal
'teeth' of the steel part.  Aligned correctly you can see all teeth
should be OK (any other alignment and some teeth are 'blocked').
With that, place the alloy side down on a flat wooden surface and
then lean on the steel part (I used some stiff gloves to protect my
hand and a fair amount of weight).

* Removing end-caps on the front hub is easily done by pushing them
out with a pencil from the other side.

* Removing the existing freehub was possibly by clamping it in a
wooden vice and pulling the hub upwards.

* The replacement freehub goes on easily enough - you need to push
the pawls into place - but the green seal again needs a fair amount
of force from a wooden implement before it clicks inside.

* The funny looking endcap is QR; the shorter normal endcap is
12x135; the longer 12x142.

And hope are responsive (if not overly effusive) to enquiries at the

Andrew

### [Restaurant] Mama Chau's (Chinese, Providencia)

From: andrew cooke <andrew@...>

Date: Sat, 31 Aug 2019 21:10:22 -0400

https://www.instagram.com/mamachaus/

Really excellent food.  A refreshing change.

We went here Friday evening, a belated celebration of Paulina's
birthday.  Fairly early, because they close some time around 8pm.
Paulina ordered a selection of dumplings and a bao (stuffed steamed
bread); I ordered a crepe.  Sharing, so that we sampled as much as
possible, there was more than enough for us both.  Relatively healthy
food with plenty of taste that was still solid enough to leave you
contentedly full.

It has a very small eating area, but also does take-aways.  Everyone
else appeared to be half our age.  It was very popular, perhaps
because of this recent review -
http://finde.latercera.com/comer/mama-chaus-chino-providencia/ - or
perhaps because it's damn good.

Service is minimal - you order and receive a pinger.  When the pinger
pings you go collect your tray of food.  There's a fair amount of
packaging, but it's mainly paper-based.

Andrew

### [Politics] Brexit Podcast

From: andrew cooke <andrew@...>

Date: Sat, 31 Aug 2019 21:01:55 -0400

Not dumb.

https://fivethirtyeight.com/features/politics-podcast-is-britain-in-the-middle-of-a-constitutional-crisis/?ex_cid=trump-approval

Andrew

### [Diary] Pneumonia

From: andrew cooke <andrew@...>

Date: Fri, 30 Aug 2019 11:25:00 -0400

I want to make some notes (similar to those on the bike accident) to
help remember the sequence of recent events related to me being
hospitalized for pneumonia.

On Thu Aug 1 we flew to Edinburgh.  The day before (or two days
before?)  Paulina's brother had stayed in our flat, apparently quite
ill, coughing and vomiting.

In Edinburgh we were in good condition, walking a fair amount (I was /
am still recovering from the broken leg and ensuing problems).

On Tue Aug 6 my sister drove me down to my parents (Paulina stayed in
Edinburgh at a conference).  In the car I was coughing a lot.

On Fri Aug 9 I went to meet Paulina at the local train station and
wasn't feeling so good.

The plan was to take the family (including sister) to dinner on Sunday
evening.  I spent most of Sunday in bed, hoping I would be well enough
for the meal to go ahead; in the later afternoon I had a temperature
and we cancelled.

The next few days I thought I had the flu - intermittent temperature,
shivers, coughing, etc.  At one point I noticed that I was coughing up
phlegm that contained some blood.

On Tue Aug 13 the rest of the family insisted I go see a local doctor.
The doctor sent me directly to the local hospital, where I stayed for
two nights.  Initially there was concern I had TB (so I had a
'private' room), but test showed pneumonia (strep).  I was on a drip
for hydration (maybe 24 hours) antibiotics (48 hours).

I had been taking Ibuprofen-based flu medication to help with MS
symptoms, but apparently this raised the chance of Kidney problems so
I was switched to Paracetamol.

On Thu Aug 15 I was released with oral antibiotics (2 kinds, 6 days).

On Fri Aug 16 Paulina flew to Chile.  On the main flight (LHR - GRU)
she had a fever and was placed on a drip in the airport clinic at Sao
Paulo, but later flew on to Santiago.  She saw a local doctor on
Sunday, was diagnosed with pneumonia, and was prescribed antibiotics.

One motivation for Paulina returning (apart from work which was the
original reason for the early flight) was that her brother had
disappeared.  He was later found in a hospital in the South of Chile.
I do not know what his diagnosis was.

Meantime (sorry, don't have exact dates) my parents were also
diagnosed with bronchitis and given antibiotics.  My sister was OK.

I was intending to fly back on Mon Aug 19, but the local doctor felt
until that date.  After some discussion with my doctors in Chile we
decided to delay the flight a week and skip the Betaferon (the risk of
an MS outbreak was low and the drug is not commonly available in the
UK).

I increased the spacing of my final two injections, so the final
injection history was:

August 2019
Mo Tu We Th Fr Sa Su
-  2  -  4
-  6  -  8  - 10  -
12  - 14  -  - 17  -
- 20  -  -  -  -  -
- 27  - 29  - 31

I flew back on the 26th, arriving 27th (injection on arrival).

Currently we are all easily tired, with coughs, but otherwise OK.

Andrew

### [Politics] Britain's Reichstag Fire moment

From: andrew cooke <andrew@...>

Date: Fri, 30 Aug 2019 11:21:39 -0400

https://www.prospectmagazine.co.uk/magazine/britain-proroguing-boris-johnson-parliament-suspension-richard-evans-weimar

Andrew

### [Programming] GCC Sanitizer Flags

From: andrew cooke <andrew@...>

Date: Thu, 16 May 2019 15:35:19 -0400

https://lemire.me/blog/2016/04/20/no-more-leaks-with-sanitize-flags-in-gcc-and-clang/

Andrew

### [GPU, Programming] Per-Thread Program Counters

From: andrew cooke <andrew@...>

Date: Mon, 8 Apr 2019 19:37:14 -0400

https://medium.com/@farkhor/per-thread-program-counters-a-tale-of-two-registers-f2061949baf2

Andrew

### My Bike Accident - Looking Back One Year

From: andrew cooke <andrew@...>

Date: Mon, 11 Mar 2019 09:39:13 -0300

One year ago today, Sunday 11 March 2018, just after breakfast, I was
looking for my favorite cycling shirt, getting ready to ride a route I
hoped to share later in the week with a friend.

That is all I remember.

https://www.strava.com/activities/1458282810/overview

Then, in a warm haze, I am thinking "this could be serious;" "maybe I
should pay attention;" "focus."  Sometime around Tuesday or Wednesday,
in Intermediate Care at Clinica Alemana, with nurses and beeping
machines, and Paulina explaining to me (patiently, every hour or so
for the last few days - I had been "conscious but absent" since Monday
morning) that a car had hit me; that I had been injured and operated
my leg; that I was now OK.

- Fractured right clavicle (collarbone)
- Exposed, fractured left femur (thigh)
- Fractured metatarsal (hand)
- Fractured right ribs (3rd, 4th, and 5th)

I was in hospital for 7 days.  The last few in normal care.  Final day
I asked to have a shower.  When I saw blood running with the water I
fainted.

The ambulance that took me home had the same crew that had taken me
in.  I asked how I had been - the EMT said "in some pain."

Final cost $17.894.596 (CLP - around$30k USD).

Home, Paulina had the bed raised, an extra seat on the toilet, a seat
in the shower, a wheelchair.  I remember my first shower - it was a
huge effort to lift my foot over the (4 inch) shower wall, and I
collapsed, twitching, on the seat.

I was high as a kite - even back home - on opioids for a couple of
weeks.

My recovery was slow but steady.  A physiotherapist came to visit and
taught me some exercises.  After a month or two I was walking with
crutches.

Paulina was exhausted from caring for me while still trying to work.
For a while we had someone visit, a few times a week, to clean and
prepare some food.

On Sundays many roads here are closed to cars, given over to cyclists,
runners, inline skaters.  A week after my accident a friend returned
to the intersection.  He found a witness, someone who flagged when
traffic could or could not pass through the ciclovia, who said I was
hit by a pickup that had run a red light.

I later learned that the driver stopped (to his credit).  Someone
called the police and an ambulance.  I was on the ground, dazed,
trying to stand but unable.  The police asked me where I lived -
apparently I replied "Europa," which is the name of our street, but
also, literally, "Europe."  So they assumed I was a tourist - a
wealthy gringo with travel insurance - and sent me to the best
hospital in town.

An investigation was opened by the police.  My medical records include
a blood test showing no alcohol.  We informed the investigating
magistrate of the witness but later, when called to the police station
to give evidence, they had not received the information.  We gave it
again.  By the time it was investigated video records from street

After the accident my bike was in a police compound; Paulina collected
it and I started repairs.  The front wheel was tacoed, so I bought a
new rim (which Paulina collected - I am so grateful for all the
legwork she has done over the last year) and spokes, and laced it to
the old hub.

Mounting the new wheel on the bike, I realized that the thru-axle was
bent, so I ordered a new axle.  When I received the axle I realized
the hub itself was bent, so I ordered a new hub.  Given how Shimano
thru-axle hubs work, I only needed to replace the inner sleeve (so I
didn't need to rebuild the entire wheel).

Mounting the new wheel again, I realized that the fork was bent, so I
ordered a new fork.  This was delivered to the UK, because mid August
I felt good enough to travel home and see my parents.

I also replaced the handlebars, although the (slight) damage there was
caused by me over-tightening the brakes, not the accident.  In
addition I had to replace the rear light (stolen while in police
custody) and my helmet.

The weekend of September 8/9 I was feeling good enough to travel with
Paulina to La Serena.  We wanted to check on my old flat, where a
friend had been living rent-free, to make sure it was OK for Paulina's
father to move there.

The flat was a mess.  So bad we did not sleep there, but instead
walked into town and stayed at a hotel.  The next day we returned, to
continue cleaning.  By the end of the weekend the place wasn't too
bad, but my leg was painful.

That was the high point of my recovery.

Post operation, my thighs were asymmetric - on the left hand side was
a "bulge" which, clearly visible in the X-rays, enclosed the end of
the rod that held my femur together.  The rod was "too long."  It
appeared to be "rubbing" on the inside of the leg, placing a limit on
how far I could walk.  As it became more inflamed, I could walk less
distance.  The upper limit was around 3,000 steps a day (a few km).

The day after returning from La Serena (Sept 10) I asked the doctor
what could be done.  The answer was: nothing, until the bone had
healed, which takes a year.

On September 11 I attended court.  The police claimed that the driver
had illegally run a red light.  Chilean law is different to UK law -
for a "light" infraction like this (running a red light and not
killing me) the emphasis is on compensating the victim.  In general
terms, either we agree some kind of compensation, or the driver is
prosecuted.  The driver has to balance the amount of compensation
against the inconvenience of being prosecuted, the likelihood of being
convicted, and the possibility of any sanction.

To start negotiations over compensation we needed to know the amount
outstanding after (the driver's) accident and (my) medical insurance,
but we still had not been billed by the hospital.

So the case was postponed and we returned home to chase up the
paperwork.  Once we had the bill Paulina took it to the driver's
insurers, who agreed to pay $5.854.407. Then she went to my medical insurance, who eventually (December 21) agreed to pay$8.327.938,
leaving a balance of $3.712.251. And this is where we stand. The case appears to be stalled pending further police investigation. Since it was difficult to walk I tried cycling again. This was clearly better for my health, and I could manage around 20 minutes without hurting my leg too much. But, perhaps related to this exercise, a new problem surfaced. The rod appeared to get "caught" on something (tendon? muscle?). This hurt, I froze and slowly wiggled my leg to "undo" the blockage. Afraid to walk, I hobbled slowly round the house. Despite my reduced movements this repeated, more severely. Frustrated, and now nearly a year after my operation (February 18, 2019), I returned to the doctor. He was, I think, surprised. The next day I received a call from the hospital - someone had canceled an operation, there was a free slot Fri February 22. I agreed immediately. The operation to remove the rod went smoothly. I entered theater late in the day and was kept for observation overnight. The leg had two dressings - one near the knee (incisions to remove screws) and another on the upper thigh (more screws and the rod itself). These were the usual clear plastic sheets, with external padding for protection, to be left in place as the wound heals. Thursday, February 28, I was feeling good enough to be sat at the computer, working, when I felt a drop of liquid hit my leg. Removing the padding, visible through the dressing, were blisters. One had burst. Back at the hospital, the dressings were removed, the skin wiped clean. I was sent back home with basic antibiotics and anti-histamines. Life with exposed wounds and stitches is boring and uncomfortable (although the anti-histamines meant I slept much of the time). The stitches catch clothing and the wound has to be kept clean and open to the air, so you're either lying in bed or wandering cold and naked through the house. It was uncomfortable to be seated for any length of time, making work difficult (credit to my employers for their support). Monday March 4 I returned to hospital. Although I felt things were improving (no blood / pus stains on the bedsheets on the last night, for example) it still didn't look good (quite frankly, it looked terrifying - red, yellow and blistered - but it was not painful and did not smell). A nurse (a nice nurse - senior and smart and friendly) thought it looked more like an infection than an allergy, and the doctor agreed, changing the antibiotic to something more specific. The next few days, although still boring and uncomfortable, showed real improvement. On Wednesday March 6 my stitches were removed. Since then, the skin has continued to heal. Importantly, the pain from the rod - at least the worst, when it got "hooked" around tendons - has gone. There is still some pain when walking, but it is difficult to know if it the old soreness, or associated with the bruising from the operation. A year after the accident, I still do not know if I will be able to walk, or cycle, as before. Andrew ### [Python] Geographic heights are incredibly easy! From: andrew cooke <andrew@...> Date: Sun, 13 Jan 2019 20:47:20 -0300 Wanted to add heights to bike rides in Choochoo, given the GPS coordinates. At first I considered stealing the data from Strava, but their T&C don't like it and anyway I couldn't find it in the API. Then I considered Google's Elevation Service, but it's$5 for 1,000
values.  Then I considered the free OpenStreetMap equivalent, but that
seemed to be broken.  Then I realised it's pretty damn easy to do by
hand!

Turns out that the Space Shuttle scanned the entire Earth (except the
Poles) at a resolution of one arcsecond (about 30m on the equator) and
the data have been publicly released.

The project is called SRTM, and the 30m data are "v3" or SRTM3.  More
info at https://wiki.openstreetmap.org/wiki/SRTM and

http://dwtkns.com/srtm30m/ and there's an excellent (although buggy)
blog post on how to parse the data at
code at https://github.com/aatishnn/srtm-python

Because the coords are in the file name there's no need for any kind
of RTree or similar index - you just take your coords and infer what
stick it in an array, and return the array value!

My own code to do this is at
https://github.com/andrewcooke/choochoo/blob/master/ch2/sortem/__init__.py
and includes bilinear interpolation (you could cut+paste that code
except for the constructor which is specific to Choochoo - just replace
the messing around w Constant with a literal directory string).

The tests are at
https://github.com/andrewcooke/choochoo/blob/master/tests/test_sortem.py
and from the contours there, which are plotted across 4 tiles, it's
pretty clear that the interpolation is seamless.

So easy!  I thought this would take a week of work and I did it all
this afternoon....

Andrew

From: andrew cooke <andrew@...>

Date: Tue, 25 Dec 2018 17:30:46 -0300

125g butter
1 egg
60g sugar (or more?)
45g cocoa
130g flour (w raising powder)
120g chocolate

Mix butter, egg and sugar.  Sieve in and mix cocoa and flour.  Add a
little water if necessary - want a thick, sticky mix, as solid as
possible, but not powder.

Break the chocolate into pieces and add.

Cool in fridge.  Pre-heat oven to 180C.

Place blobs of dough on lightly greased baking paper on tray.  Cook
for 15m.  Should flatten but not spread much.

Not very sweet, except for the chocolate.  Very cocoay and good
texture.  Good w ice-cream?

Variations: more sugar?  vanilla?

Andrew


text:
m252c7s2sol - Bob Brown CCBC Dundalk Math 252 Calculus 2 Chapter 7 Section 2 Completed 1 Volume of a Solid of Revolution Using the Disk Method Another

# m252c7s2sol - Bob Brown CCBC Dundalk Math 252 Calculus 2...

• Notes
• 6

This preview shows page 1 - 3 out of 6 pages.

Bob Brown Math 252 Calculus 2 Chapter 7, Section 2 Completed 1 CCBC Dundalk Volume of a Solid of Revolution: Using the Disk Method Another application of the definite integral is the computation of the volume of a particular type of three-dimensional solid, called a solid of revolution . A solid of revolution is obtained by revolving a region in the plane about a line. This line is called the axis of revolution . Revolving this rectangle, we get a disk—a hockey puck. Compute the volume of the disk: * cross-sectional area is the area of a = * width = Therefore, volume = Revolving a More General Region The volume of a solid of revolution is approximated by the of the The radius of each disc is R i = for some The width of each disk is The approximate volume of the solid of revolution is The exact volume of the solid of revolution is
Bob Brown Math 252 Calculus 2 Chapter 7, Section 2 Completed 2 CCBC Dundalk Note : In the case that the x -axis is the axis of revolution , then R(x) =

format: plain


text:
A question on Gandy-Jensen system and the rudimentary functions

Let $\mathrm{R}_0,\cdots,\mathrm{R}_8$ be the following functions:

$\mathrm{R}_0(x,y)=\{x,y\}$

$\mathrm{R}_1(x,y)=x-y$

$\mathrm{R}_2(x)=\bigcup x$

$\mathrm{R}_3(x,y)=x\times y$

$\mathrm{R}_4(x)=\mathrm{Dom}(x)$

$\mathrm{R}_5(x)=\{(a,b)\ |\ a\in b\ \wedge\ a\in x\ \wedge\ b\in x\}$

$\mathrm{R}_6(x)=\{(a,b,c)\ |\ (b,a,c)\in x\}$

$\mathrm{R}_7(x)=\{(a,b,c)\ |\ (b,c,a)\in x\}$

$\mathrm{R}_8(x,y)=\{x[\{a\}]\ |\ a\in y\}\ \$ where $x[\{a\}]=\{b\ |\ (a,b)\in x\}$ .

Gandy-Jensen system $\mathsf{GJ}_0$ is the system of which the set-theoretic axioms are the Axiom of Extensionality and the following nine set-existence axioms:

$\mathrm{R}_0(x,y)\in\mathrm{V},\ \cdots,\ \mathrm{R}_8(x,y)\in\mathrm{V}$ .

The class of rudimentary functions is the closure of $\mathrm{R}_0,\cdots,\mathrm{R}_8$ under composition.

It is obvious that if $F$ is a $n$-ary rudimentary function then $\mathsf{GJ}_0\vdash F(x_1,\cdots,x_n)\in\mathrm{V}$ .

My question is that whether the converse of the above proposition is true, i.e. is it true that:

For every class term $A(x_1,\cdots,x_n)$ whose free variables are in $x_1,\cdots,x_n$ , if $\mathsf{GJ}_0\vdash A(x_1,\cdots,x_n)\in\mathrm{V}$ , then $(x_1,\cdots,x_n)\mapsto A(x_1,\cdots,x_n)$ is a $n$-ary rudimentary function.

Edit 1 : I think I should make my terminologies more precise:

Let $\mathsf{T}$ be an axiom system of set theory (such as $\mathsf{GJ}_0,\ \mathsf{ZFC},$ and so on). We say that a function F is a n-ary $\mathsf{T}$-rudimentary function if there is a n-ary rudimentary function G such that $\mathsf{T}\vdash F=G$ .

I actually asked that whether the following statement is true:

For every class term $A(x_1,\cdots,x_n)$ whose free variables are in $x_1,\cdots,x_n$ , if $\mathsf{GJ}_0\vdash A(x_1,\cdots,x_n)\in\mathrm{V}$ , then $(x_1,\cdots,x_n)\mapsto A(x_1,\cdots,x_n)$ is a $n$-ary $\mathsf{ZFC}$-rudimentary function.

Where $\mathsf{ZFC}$ can be replaced by other systems such as $\mathsf{GJ}_0$ and then we have more similar questions.

Edit 2 : The question become trivial if I restrict "rudimentary" to "$\mathsf{T}$-rudimentary" defined in Edit 1 . So I will remove this restriction, and still ask that whether the original proposition (which is weaker than the false proposition in Edit 1 ) is true.

• I think it's high time we have a [fine-structure] tag. But I'd be happy if one of the guys that know more about it will write the tag wiki/excerpt. I feel insufficiently knowledgeable about the topic. – Asaf Karagila Oct 20 '14 at 7:08
• Isn't sufficient to show that these functions produce Godel operators? – Mohammad Golshani Oct 20 '14 at 7:27
• If $A$ is $x\cap B$ and $B$ is $\Delta_0$ , then it is sufficient to show that these functions produce Godel operators. – Sencodian Oct 20 '14 at 13:31

2 Answers

Rudimentary functions can only increase rank by a fixed finite amount. So $$A(x,y) = \begin{cases} x + y & \text{when x,y \in \omega,} \\ 0 & \text{otherwise,} \end{cases}$$ is not rudimentary even if $\mathsf{GJ}_0 \vdash A(x,y) \in V$.

This is true even for nonstandard models of $\mathsf{GJ}_0$ but one has to be careful about the definition of $A(x,y)$. For simplicity, I will use $F(x) = 1+A(x,x) = 1+2x$. Then $F(x) = y$ iff $x \in \omega$ ($\omega$ being understood as a definable class, not necessarily a set) and there is exactly one sequence $s$ with domain $x+1$ such that if $s(0) = 1$ and $s(z+1) = s(z)+2$ whenever $z \lt x$ then $s(x) = y$; otherwise, $F(x) = 0$.

In ill-founded models, $\{x \in \omega : F(x) \neq 0\}$ could be a proper cut in $\omega$ but that doesn't change the fact that this provably total function $F$ is not rudimentary.

• Why $\mathsf{GJ}_0\vdash A(x,y)\in\mathrm{V}$ ? There is no axiom of induction or foundation in $\mathsf{GJ}_0$ . – Sencodian Oct 24 '14 at 11:42
• I think Sencodian is right to ask this: $\mathsf{GJ_0}$ does not prove the graph of addition exists as a set; it cannot even prove that the class of even (von Neumann) natural numbers is a set. – Philip Welch Oct 24 '14 at 19:42
• Yes, this is what I tried to clarify in the addendum. I'm using $\omega$ as a definable class. (Assuming the existence of $\omega$, the constant function with value $\omega$ is an easier example.) The key point is that any model of $\mathsf{GJ}_0$ contains a copy of HF and therefore can represent all primitive recursive functions in the sense that there is a definable total function whose values at standard finite ordinals agree with the real-world primitive recursive function. Almost none of these are rudimentary because they grow too fast. – François G. Dorais Oct 24 '14 at 20:20

I'm not well versed in fine structure, so this may well be wrong:

I think it depends what you mean by a "class term." Since the language of set theory contains no function symbols, there are no terms as usually defined; so you would need to fix a set of function symbols to be used as the language out of which terms can be built. Note that, in this case, your function symbols must be complicated for the answer to be nontrivial, since if your function symbols are expressible in terms of rudimentary functions (e.g., "$x\mapsto \{x\}$" is just $R_0(x, x)$), then the answer to your question is trivially yes.

If on the other hand by "class term" you mean a definable function - that is, a formula $p(\overline{x}, y)$ such that $GJ_0$ (or similar) proves that for every $\overline{x}$ there is exactly one $y$ such that $p(\overline{x}, y)$ - then I think the answer is no, since we can define functions by cases (e.g., "$x\mapsto \{x\}$ if $x=\emptyset$ and $x\mapsto \emptyset$ otherwise"). It seems that in general such "definably piecewise rudimentary" functions need not be rudimentary, but of course $GJ_0$ will prove that each one is total.

Edit: the new phrasing of the question - roughly "if $GJ_0$ proves that F is total, then $ZFC$ proves that $F=G$ for some rudimentary $G$" - yields a very simple negative answer, for the reasons you say. In fact, we can replace $ZFC$ with any reasonable theory $T$: pick some sentence $p$ undecidable in $T$, and let $F: x\mapsto\emptyset$ if $p$ and $\{x\}$ if $\neg p$. It's easy to see that $GJ_0$ proves that $F$ is total, but that $F$ is not $T$-rudimentary.

The question is much more interesting without this restriction, I feel.

(Also, you should still define what you mean by "class term.")

• I think the same with you. But how to prove that "definably piecewise rudimentary functions need not be rudimentary" ? Consider an example such as $x\mapsto x\cap\{x\ |\ \mathrm{CH}\}$ , where $\mathrm{CH}$ means the Continuum Hypothesis. How can we prove this function is not rudimentary(assume our meta-system is ZFC)? – Sencodian Oct 20 '14 at 0:50
• Well, that function actually is rudimentary, provably in ZFC: either CH holds, or it doesn't, and in either case it's a rudimentary function. Which rudimentary function it happens to be is independent, of course, but it is provably rudimentary. The potential counterexamples are definitions by cases where the cases are in terms of $x$. – Noah Schweber Oct 20 '14 at 7:14
• See my new remark above. In this sense, how can we prove $x\mapsto x\cap\{x\ |\ \mathrm{CH}\}$ is $\mathsf{ZFC}$-rudimentary ? Let this function be $F(x)$ , neither $\mathsf{ZFC}\vdash F(x)=x$ nor $\mathsf{ZFC}\vdash F(x)=\varnothing$ is true, since $\mathrm{CH}$ can't be decided in $\mathsf{ZFC}$ . – Sencodian Oct 20 '14 at 13:27
• Noah, as a side remark, you should join us at the sans serif side and start denoting theories with \mathsf. It looks nicer on this side of the board. :-P – Asaf Karagila Oct 20 '14 at 22:02
• Yes, You are right. My question is trivial with this restriction. In fact, for every non-$\Delta_0^{\mathsf{T}}$ sentence $\phi$ , the function $x\mapsto \{x\}\cap\{x\ |\ \phi\}$ is not $\mathsf{T}$-rudimentary, where $\mathsf{GJ}_0\subseteq\mathsf{T}$ . – Sencodian Oct 21 '14 at 1:23


text:
# Relating Age to Name¶

This notebook is inspired by Nate Silver's recent article on How to Tell Someone's Age When All you Know is Her Name. It allows one to (almost) replicate the analysis done in the article, and provides more extensive features. I have done similar work using R, and you can find it here.

## Data¶

We will uses four primary datasets.

In [1]:
%matplotlib inline
import re
import urllib
from zipfile import ZipFile
from path import path
import numpy as np
import pandas as pd
from scipy.interpolate import interp1d
import matplotlib.pyplot as plt
import seaborn as sns
from ggplot import *

/Users/ramnathv/anaconda/lib/python2.7/site-packages/pytz/__init__.py:29: UserWarning: Module argparse was already imported from /Users/ramnathv/anaconda/lib/python2.7/argparse.pyc, but /Users/ramnathv/anaconda/lib/python2.7/site-packages is being added to sys.path
from pkg_resources import resource_stream

### Baby Names¶

In [2]:
urllib.urlretrieve("http://www.ssa.gov/oact/babynames/names.zip", "names.zip")
zf = ZipFile("names.zip")
data['year'] = int(re.findall(r'\d+', f)[0])
return data

bnames = pd.concat([read_names(f) for f in zf.namelist() if f.endswith('.txt')])

Out[2]:
name sex n year
0 Mary F 9217 1884
1 Anna F 3860 1884
2 Emma F 2587 1884
3 Elizabeth F 2549 1884
4 Minnie F 2243 1884

5 rows × 4 columns

### Baby Names by State¶

In [3]:
urllib.urlretrieve("http://www.ssa.gov/oact/babynames/state/namesbystate.zip", "namesbystate.zip")
zf = ZipFile("namesbystate.zip")
return pd.read_csv(zf.open(f), header = None, names = ['state', 'sex', 'year', 'name', 'n'])

bnames_by_state = pd.concat([read_names2(f) for f in zf.namelist() if f.endswith('.TXT')])

Out[3]:
state sex year name n
0 MA F 1910 Mary 988
1 MA F 1910 Helen 473
2 MA F 1910 Margaret 374
3 MA F 1910 Dorothy 331
4 MA F 1910 Alice 313

5 rows × 5 columns

### Cohort Life Tables¶

The next dataset is actuarial cohort life tables provided by SSA. I was unable to figure out how to scrape this data using BeautifulSoup. So I used the R package XML to scrape these lifetables and saved it to lifetables.csv. If you are interested in the R code, you can find it here.

In [4]:
lifetables = pd.read_csv('lifetables.csv')

Out[4]:
x qx lx dx Lx Tx ex sex year
0 0 0.14596 100000 14596 90026 5151511 51.52 M 1900
1 1 0.03282 85404 2803 84003 5061484 59.26 M 1900
2 2 0.01634 82601 1350 81926 4977482 60.26 M 1900
3 3 0.01052 81251 855 80824 4895556 60.25 M 1900
4 4 0.00875 80397 703 80045 4814732 59.89 M 1900

5 rows × 9 columns

You can read the documentation for the lifetables to understand the various parameters. The key column of interest to us is lx, which provides the number of people born in the year year who live upto the age x. Since we are in the year 2014, we are only interested in a subset of the data.

In [5]:
lifetables_2014 = lifetables[lifetables['year'] + lifetables['x'] == 2014]

Out[5]:
x qx lx dx Lx Tx ex sex year
114 114 0.76365 0 0 0 0 0.79 M 1900
234 114 0.75783 0 0 0 0 0.80 F 1900
344 104 0.46882 25 12 19 38 1.54 M 1910
464 104 0.42317 191 81 150 328 1.72 F 1910
574 94 0.26858 3122 838 2703 8656 2.77 M 1920

5 rows × 9 columns

The cohort life tables are provided only for every decade. Since we need the data by year, we will use spline interpolation to fill out the gaps.

In [6]:
def process(d, kind = 'slinear'):
f = interp1d(d.year, d.lx, kind)
year = np.arange(1900, 2011)
lx = f(year)
return pd.DataFrame({"year": year, "lx": lx, "sex": d.sex.iloc[1]})
lifetable_2014 = lifetables_2014.\
groupby('sex', as_index = False).\
apply(process)

Out[6]:
lx sex year
0 0.0 F 1900
1 19.1 F 1901
2 38.2 F 1902
3 57.3 F 1903
4 76.4 F 1904

5 rows × 3 columns

### Census Live Births Data¶

Finally, we need live births data from the census to extrapolate the birth data to account for the correct that not all births were recorded by SSA till around 1930, since it wasn't mandatory.

In [7]:
urllib.urlretrieve("http://www.census.gov/statab/hist/02HS0013.xls", "02HS0013.xls")
dat = pd.read_excel('02HS0013.xls', sheetname = 'HS-13', skiprows = range(14))
tot_births = dat.ix[9:101,:2].reset_index(drop = True)
tot_births.columns = ['year', 'births']
tot_births = tot_births.convert_objects(convert_numeric = True)

Out[7]:
year births
0 1909 2718
1 1910 2777
2 1911 2809
3 1912 2840
4 1913 2869

5 rows × 2 columns

We will now merge this data with the bnames aggregated by year to compute a set of correction factors, which will be used to scale the number of births. I have taken a very naive approach to do this, and there might be better ways to accomplish the same.

In [8]:
cor_factors = bnames.\
groupby('year', as_index = False).\
sum().\
merge(tot_births)
cor_factors['cor'] = cor_factors['births']*1000/cor_factors['n']
cor_factors = cor_factors[['year', 'cor']]

Out[8]:
year cor
0 1909 5.316662
1 1910 4.701138
2 1911 4.360075
3 1912 2.874415
4 1913 2.523176

5 rows × 2 columns

We expand the correction factors data for the years 2002 to 2014 using the correction factor for the year 2001.

In [9]:
cor_new = pd.DataFrame({
'year': range(2002, 2014),
'cor': cor_factors.cor.iloc[-1]
})
cor_factors = pd.concat([cor_factors, cor_new])[['year', 'cor']]

Out[9]:
year cor
0 1909 5.316662
1 1910 4.701138
2 1911 4.360075
3 1912 2.874415
4 1913 2.523176

5 rows × 2 columns

## Analysis¶

Now that we have all the required data, we need a few helper functions to help us with our analysis. The first function we will write is get_data, which takes name, sex and state and returns a data frame with the distribution of number of births and number of people alive by year.

In [10]:
def get_data(name, sex, state = None):
if state is None:
dat = bnames
else:
dat = bnames_by_state[(bnames_by_state["state"] == state)]
data = dat[(dat['name'] == name) & (dat['sex'] == sex)].\
merge(cor_factors).\
merge(lifetable_2014)
data['n_cor'] = data['n']*data['cor']
data['n_alive'] = data['lx']/(10**5)*data['n_cor']
return data

Out[10]:
name sex n year cor lx n_cor n_alive
0 Violet F 945 1909 5.316662 171.9 5024.245779 8.636678
1 Violet F 1037 1910 4.701138 191.0 4875.080412 9.311404
2 Violet F 1183 1911 4.360075 1084.2 5157.968506 55.922695
3 Violet F 1535 1912 2.874415 1977.4 4412.227601 87.247389
4 Violet F 1751 1913 2.523176 2870.6 4418.081208 126.825439

5 rows × 8 columns

Our next helper function is plot_name which accepts the same arguments as get_data, but returns a plot of the distribution of number of births and number alive by year.

In [11]:
def plot_name(name, sex, state = None):
data = get_data(name, sex, state)
return ggplot(data, aes('year', 'n_cor')) +\
geom_line() +\
geom_area(aes(ymin = 0, ymax = 'n_alive'), alpha = 0.5)
plot_name("Joseph", "F")

Out[11]:
<ggplot: (279099421)>
In [12]:
plot_name("Violet", "F", "MA")

Out[12]:
<ggplot: (279096937)>

### Estimate Age¶

We will now write a function that will help us figure out the probability that a person with a certain name is alive, as well as the quantiles of their age distribution. Since we are dealing with weighted data, I will use some code copied from the wquantiles module. The quantile function accepts a data array and a weights array to return a specific quantile

In [13]:
# from the module wquantiles https://github.com/nudomarinero/wquantiles/blob/master/weighted.py
import numpy as np
def quantile_1D(data, weights, quantile):
"""
Compute the weighted quantile of a 1D numpy array.

Parameters
----------
data : ndarray
Input array (one dimension).
weights : ndarray
Array with the weights of the same size of data.
quantile : float
Quantile to compute. It must have a value between 0 and 1.

Returns
-------
quantile_1D : float
The output value.
"""
# Check the data
if not isinstance(data, np.matrix) :
data = np.asarray(data)
if not isinstance(weights, np.matrix) :
weights = np.asarray(weights)
nd = data.ndim
if nd != 1:
raise TypeError("data must be a one dimensional array")
ndw = weights.ndim
if ndw != 1:
raise TypeError("weights must be a one dimensional array")
if data.shape != weights.shape:
raise TypeError("the length of data and weights must be the same")
if ((quantile > 1.) or (quantile < 0.)):
raise ValueError("quantile must have a value between 0. and 1.")
# Sort the data
ind_sorted = np.argsort(data)
sorted_data = data[ind_sorted]
sorted_weights = weights[ind_sorted]
# Compute the auxiliary arrays
Sn = np.cumsum(sorted_weights)
# TODO: Check that the weights do not sum zero
Pn = (Sn-0.5*sorted_weights)/np.sum(sorted_weights)
# Get the value of the weighted median
return np.interp(quantile, Pn, sorted_data)

def quantile(data, weights, quantile):
"""
Weighted quantile of an array with respect to the last axis.

Parameters
----------
data : ndarray
Input array.
weights : ndarray
Array with the weights. It must have the same size of the last
axis of data.
quantile : float
Quantile to compute. It must have a value between 0 and 1.

Returns
-------
quantile : float
The output value.
"""
# TODO: Allow to specify the axis
nd = data.ndim
if nd == 0:
TypeError("data must have at least one dimension")
elif nd == 1:
return quantile_1D(data, weights, quantile)
elif nd > 1:
n = data.shape
imr = data.reshape((np.prod(n[:-1]), n[-1]))
result = np.apply_along_axis(quantile_1D, -1, imr, weights, quantile)
return result.reshape(n[:-1])

We will use the quantile function to write an estimate_age function that will return the living probabilities and quantiles for a given name, sex and state.

In [14]:
def estimate_age(name, sex, state = None):
data = get_data(name, sex, state)
qs = [1, 0.75, 0.5, 0.25, 0]
quantiles = [2014 - int(quantile(data.year, data.n_alive, q)) for q in qs]
result = dict(zip(['q0', 'q25', 'q50', 'q75', 'q100'], quantiles))
result['p_alive'] = round(data.n_alive.sum()/data.n_cor.sum()*100, 2)
result['sex'] = sex
result['name'] = name
return pd.Series(result)

estimate_age('Gertrude', 'F')

Out[14]:
name       Gertrude
p_alive       18.17
q0                4
q100            105
q25              71
q50              82
q75              90
sex               F
dtype: object
In [15]:
estimate_age('Ava', 'F')

Out[15]:
name         Ava
p_alive    95.24
q0             4
q100         105
q25            6
q50            8
q75           10
sex            F
dtype: object

We can now use the estimate_age function to compute the quantiles for the most common names and replicate the plots in the Nate Silver article.

In [16]:
top_100_names = bnames.\
groupby(['name', 'sex'], as_index = False).\
sum().\
sort('n', ascending = False)
top_25_females = top_100_names[(top_100_names["sex"] == "F")]
estimates = pd.concat([estimate_age(name, 'F') for name in top_25_females["name"].iloc[:25].tolist()], axis = 1)
estimates.T.sort('q50').reset_index()

Out[16]:
index name p_alive q0 q100 q25 q50 q75 sex
0 24 Emily 90.62 4 105 12 19 28 F
1 18 Ashley 98.5 4 97 18 24 28 F
2 10 Jessica 97.9 4 105 22 27 32 F
3 9 Sarah 83.63 4 105 19 28 37 F
4 17 Anna 51.81 4 105 17 34 65 F
5 3 Jennifer 96.63 4 98 29 36 42 F
6 1 Elizabeth 70.05 4 105 23 39 58 F
7 23 Michelle 95.92 4 99 29 40 47 F
8 20 Kimberly 95.87 4 81 30 41 48 F
9 15 Lisa 94.48 4 104 40 47 51 F
10 14 Karen 89.12 4 105 48 55 62 F
11 7 Susan 86.52 4 105 50 57 63 F
12 19 Donna 81.85 4 105 52 58 66 F
13 16 Sandra 85.46 4 105 50 59 67 F
14 12 Nancy 76.02 4 105 53 62 70 F
15 2 Patricia 77.8 4 105 53 62 70 F
16 4 Linda 84.87 4 105 55 62 67 F
17 22 Carol 77.49 4 105 56 64 71 F
18 0 Mary 51.35 4 105 53 64 75 F
19 5 Barbara 71.56 4 105 57 65 73 F
20 6 Margaret 45.63 4 105 51 65 76 F
21 21 Ruth 34.23 4 105 57 70 83 F
22 13 Betty 50.7 4 105 65 74 82 F
23 11 Helen 29.38 4 105 61 74 86 F
24 8 Dorothy 34.24 4 105 64 76 85 F

25 rows × 9 columns

We can go a step beyond the article and also use the state parameter to get more specific quantiles, if we know the place of birth of a person.

The final step for me is to convert all of this into an interactive webapp. I have done it with R using the shiny package. I am still getting the hang of web frameworks in python, so it will be a while before I get to doing this.


text:
• # question_answer A charged particle of mass m and charge q is projected into a uniform magnetic field of induction B with speed v which is perpendicular to B. The width of the magnetic field is d. The impulse imparted to fee particle by the field is $\left( d<<\frac{mv}{qB} \right)$ A) $qBv$                          B) $\frac{mv}{qB}$ C) $qBd$              D) $\frac{2\,m{{v}^{2}}}{qB}$

[C]  q more on circular path in B. Whose radius $=\frac{mv}{qB}=r$ In question width of magnetic field region is very small than r. so charge q will exit from B on opposite side of region path of q is shown in figure.
 As $d<\,<\,<\frac{mv}{qB}$ Using $\sin \theta =\frac{d}{r}$ Impulse is change in momentum
 Where $r=\frac{mv}{qB}$ \[\therefore d<<


text:
On the Fattorini criterion for approximate controllability and stabilizability of parabolic systems
ESAIM: Control, Optimisation and Calculus of Variations, Volume 20 (2014) no. 3, p. 924-956
The full text of recent articles is available to journal subscribers only. See the article on the journal's website

In this paper, we consider the well-known Fattorini's criterion for approximate controllability of infinite dimensional linear systems of type y′ = Ay + Bu. We precise the result proved by Fattorini in [H.O. Fattorini, SIAM J. Control 4 (1966) 686-694.] for bounded input B, in the case where B can be unbounded or in the case of finite-dimensional controls. More precisely, we prove that if Fattorini's criterion is satisfied and if the set of geometric multiplicities of A is bounded then approximate controllability can be achieved with finite dimensional controls. An important consequence of this result consists in using the Fattorini's criterion to obtain the feedback stabilizability of linear and nonlinear parabolic systems with feedback controls in a finite dimensional space. In particular, for systems described by partial differential equations, such a criterion reduces to a unique continuation theorem for a stationary system. We illustrate such a method by tackling some coupled Navier-Stokes type equations (MHD system and micropolar fluid system) and we sketch a systematic procedure relying on Fattorini's criterion for checking stabilizability of such nonlinear systems. In that case, the unique continuation theorems rely on local Carleman inequalities for stationary Stokes type systems.

DOI : https://doi.org/10.1051/cocv/2014002
Classification:  93B05,  93D15,  35Q30,  76D05,  76D07,  76D55,  93B52,  93C20
Keywords: approximate controllability, stabilizability, parabolic equation, finite dimensional control, coupled−Stokes and mhd system
@article{COCV_2014__20_3_924_0,
author = {Badra, Mehdi and Takahashi, Tak\'eo},
title = {On the Fattorini criterion for approximate controllability and stabilizability of parabolic systems},
journal = {ESAIM: Control, Optimisation and Calculus of Variations},
publisher = {EDP-Sciences},
volume = {20},
number = {3},
year = {2014},
pages = {924-956},
doi = {10.1051/cocv/2014002},
zbl = {1292.93022},
mrnumber = {3264229},
language = {en},
url = {http://www.numdam.org/item/COCV_2014__20_3_924_0}
}

Badra, Mehdi; Takahashi, Takéo. On the Fattorini criterion for approximate controllability and stabilizability of parabolic systems. ESAIM: Control, Optimisation and Calculus of Variations, Volume 20 (2014) no. 3, pp. 924-956. doi : 10.1051/cocv/2014002. http://www.numdam.org/item/COCV_2014__20_3_924_0/

[1] M. Badra, Feedback stabilization of the 2-D and 3-D Navier-Stokes equations based on an extended system. ESAIM: COCV 15 (2009) 934-968. | Numdam | MR 2567253 | Zbl 1183.35216

[2] M. Badra, Lyapunov function and local feedback boundary stabilization of the Navier-Stokes equations. SIAM J. Control Optim. 48 (2009) 1797-1830. | MR 2516189 | Zbl pre05719723

[3] M. Badra, Abstract settings for stabilization of nonlinear parabolic system with a Riccati-based strategy. Application to Navier-Stokes and Boussinesq equations with Neumann or Dirichlet control. Discrete Contin. Dyn. Syst. - Series A 32 (2011) 1169-1208. | MR 2851895 | Zbl 1235.93200

[4] M. Badra, Local controllability to trajectories of the magnetohydrodynamic equations. J. Math. Fluid Mech. (Sumitted). | MR 3267539

[5] M. Badra and T. Takahashi, Stabilization of parabolic nonlinear systems with finite dimensional feedback or dynamical controllers. Application to the Navier-Stokes system. SIAM J. Control Optim. 49 (2011) 420-463. | MR 2784695 | Zbl 1217.93137

[6] M. Badra and T. Takahashi, Feedback stabilization of a fluid-rigid body interaction system. preprint. | MR 3261920 | Zbl pre06356246

[7] M. Badra and T. Takahashi, Feedback stabilization of a simplified 1d fluid - particle system. Ann. Inst. Henri Poincaré Anal. Non Linéaire (Sumitted). | Zbl pre06347281

[8] V. Barbu and R.L. Triggiani, Internal stabilization of Navier-Stokes equations with finite-dimensional controllers. Indiana Univ. Math. J. 53 (2004) 1443-1494. | MR 2104285 | Zbl 1073.76017

[9] V. Barbu, I. Lasiecka and R. Triggiani, Abstract settings for tangential boundary stabilization of Navier-Stokes equations by high- and low-gain feedback controllers. Nonlinear Anal. 64 (2006) 2704-2746. | MR 2218543 | Zbl 1098.35025

[10] V. Barbu, I. Lasiecka and R. Triggiani, Tangential boundary stabilization of Navier-Stokes equations. Mem. Amer. Math. Soc. 181 (2006) 128. | MR 2215059 | Zbl 1098.35026

[11] V. Barbu, I. Lasiecka and R. Triggiani, Local exponential stabilization strategies of the Navier-Stokes equations, d = 2,3, via feedback stabilization of its linearization, in Control of coupled partial differential equations, vol. 155. Int. Ser. Numer. Math. Birkhäuser, Basel (2007) 13-46. | MR 2328600 | Zbl 1239.93094

[12] A. Bensoussan, G. Da Prato, M.C. Delfour and S.K. Mitter, Representation and control of infinite dimensional systems. Systems & Control: Foundations & Applications. 2nd edition. Birkhäuser Boston Inc., Boston, MA (2007). | MR 2273323 | Zbl 1117.93002

[13] J.-M. Coron and E. Trélat, Global steady-state controllability of one-dimensional semilinear heat equations. SIAM J. Control Optim. 43 (2004) 549-569. | MR 2086173 | Zbl 1101.93011

[14] R.F. Curtain and H. Zwart, An introduction to infinite-dimensional linear systems theory, vol. 21. Texts Appl. Math.. Springer-Verlag, New York (1995). | MR 1351248 | Zbl 0839.93001

[15] R. Dautray and J.-L. Lions, Analyse mathématique et calcul numérique pour les sciences et les techniques. Vol. 5. Spectre des opérateurs. [The operator spectrum], With the collaboration of Michel Artola, Michel Cessenat, Jean Michel Combes and Bruno Scheurer, Reprinted from the 1984 edition. INSTN: Collection Enseignement. [INSTN: Teaching Collection]. Masson, Paris (1988). | MR 944303 | Zbl 0749.35004

[16] E.B. Davies, Pseudo-spectra, the harmonic oscillator and complex resonances. R. Soc. London Proc. Ser. A Math. Phys. Eng. Sci. 455 (1999) 585-599. | MR 1700903 | Zbl 0931.70016

[17] C. Fabre and G. Lebeau, Prolongement unique des solutions de l'equation de Stokes. Commun. Partial Differ. Eqs. 21 (1996) 573-596. | MR 1387461 | Zbl 0849.35098

[18] H.O. Fattorini, Some remarks on complete controllability. SIAM J. Control 4 (1966) 686-694. | MR 202484 | Zbl 0168.34906

[19] H.O. Fattorini, On complete controllability of linear systems. J. Differ. Eqs. 3 (1967) 391-402. | MR 212322 | Zbl 0155.15903

[20] E. Fernández-Cara and S. Guerrero, Local exact controllability of micropolar fluids. J. Math. Fluid Mech. 9 (2007) 419-453. | MR 2336077 | Zbl 1133.35423

[21] E. Fernández-Cara, S. Guerrero, O. Yu. Imanuvilov and J.-P. Puel, Local exact controllability of the Navier-Stokes system. J. Math. Pures Appl. 83 (2004) 1501-1542. | MR 2103189 | Zbl 1267.93020

[22] A.V. Fursikov, Stabilizability of a quasilinear parabolic equation by means of boundary feedback control. Mat. Sb. 192 (2001) 115-160. | MR 1834095 | Zbl 1019.93047

[23] A.V. Fursikov, Stabilizability of two-dimensional Navier-Stokes equations with help of a boundary feedback control. J. Math. Fluid Mech. 3 (2001) 259-301. | MR 1860125 | Zbl 0983.93021

[24] A.V. Fursikov, Stabilization for the 3D Navier-Stokes system by feedback boundary control. Partial differential equations and applications. Discrete Contin. Dyn. Syst. 10 (2004) 289-314. | MR 2026196 | Zbl 1174.93675

[25] G.P. Galdi, An introduction to the mathematical theory of the Navier-Stokes equations. Vol. I. Linearized steady problems, vol. 38. Springer Tracts in Natural Philosophy. Springer-Verlag, New York (1994). | MR 1284205 | Zbl 0949.35004

[26] I.C. Gohberg and M.G. Kreĭn, Introduction to the theory of linear nonselfadjoint operators. Translated from the Russian by A. Feinstein. Vol. 18. Translations of Mathematical Monographs. Amer. Math. Soc., Providence, R.I. (1969). | MR 246142 | Zbl 0181.13504

[27] G.H. Hardy and E.M. Wright, An introduction to the theory of numbers. Oxford University Press, Oxford, 6th edition (2008). Revised by D.R. Heath-Brown and J. H. Silverman, With a foreword by Andrew Wiles. | MR 2445243 | Zbl 1159.11001

[28] M.L.J. Hautus, Controllability and observability conditions of linear autonomous systems. Nederl. Akad. Wetensch. Proc. Ser. A. Vol. 31 of Indag. Math. (1969) 443-448. | MR 250694 | Zbl 0188.46801

[29] A. Henrot and M. Pierre, Variation et optimisation de formes, Une analyse géométrique (A geometric analysis). Vol. 48. Mathématiques & Applications [Mathematics & Applications]. Springer, Berlin (2005). | MR 2512810 | Zbl 1098.49001

[30] L. Hörmander, The analysis of linear partial differential operators I. Classics in Mathematics. Springer-Verlag, Berlin (2003). Distribution theory and Fourier analysis, Reprint of the 2nd edition (1990) [Springer, Berlin; MR1065993 (91m:35001a)]. | MR 1996773 | Zbl 1028.35001

[31] O. Yu. Imanuvilov. Remarks on exact controllability for the Navier-Stokes equations. ESAIM: COCV 6 (2001) 39-72. | Numdam | MR 1804497 | Zbl 0961.35104

[32] O.Y. Imanuvilov and J.-P. Puel, Global Carleman estimates for weak solutions of elliptic nonhomogeneous Dirichlet problems. Int. Math. Res. Not. 16 (2003) 883-913. | MR 1959940 | Zbl 1146.35340

[33] T. Kato, Perturbation theory for linear operators. Classics in Mathematics. Springer-Verlag, Berlin (1995). Reprint of the 1980 edition. | MR 1335452 | Zbl 0836.47009

[34] I. Lasiecka and R. Triggiani, Control theory for partial differential equations: continuous and approximation theories. I, Abstract parabolic systems. Vol. 74. Encyclopedia of Mathematics and its Applications. Cambridge University Press, Cambridge (2000). | MR 1745475 | Zbl 0942.93001

[35] J. Le Rousseau and G. Lebeau, On Carleman estimates for elliptic and parabolic operators. applications to unique continuation and control of parabolic equations. ESAIM: COCV 18 (2012) 712-747. | Numdam | MR 3041662 | Zbl 1262.35206

[36] C.-G. Lefter, On a unique continuation property related to the boundary stabilization of magnetohydrodynamic equations. An. Ştiinţ. Univ. Al. I. Cuza Iaşi. Mat. (N.S.) 56 (2010) 1-15. | MR 2605928 | Zbl 1212.93256

[37] G. Łukaszewicz, Micropolar fluids. Theory and applications. Modeling and Simulation in Science, Engineering and Technology. Birkhäuser Boston Inc., Boston, MA (1999). | MR 1711268 | Zbl 0923.76003

[38] A.J. Meir, The equations of stationary, incompressible magnetohydrodynamics with mixed boundary conditions. Comput. Math. Appl. 25 (1993) 13-29. | MR 1216012 | Zbl 0774.35059

[39] A.M. Micheletti, Perturbazione dello spettro dell'operatore di Laplace, in relazione ad una variazione del campo. Ann. Scuola Norm. Sup. Pisa 26 (1972) 151-169. | Numdam | MR 367480 | Zbl 0234.35073

[40] S. Micu and E. Zuazua, On the controllability of a fractional order parabolic equation. SIAM J. Control Optim. 44 (2006) 1950-1972. | MR 2248170 | Zbl 1116.93022

[41] A. Pazy, Semigroups of linear operators and applications to partial differential equations, vol. 44. Appl. Math. Sci. Springer-Verlag, New York (1983). | MR 710486 | Zbl 0516.47023

[42] J.-P. Raymond, Feedback boundary stabilization of the two-dimensional Navier-Stokes equations. SIAM J. Control Optim. 45 (2006) 790-828. | MR 2247716 | Zbl 1121.93064

[43] J.-P. Raymond and T. Thevenet, Boundary feedback stabilization of the two dimensional Navier-Stokes equations with finite dimensional controllers. Issue in Discrete and Continuous Dynamical Systems A 27 (2010) 1159-1187. | MR 2629581 | Zbl 1211.93103

[44] D.L. Russell and G. Weiss, A general necessary condition for exact observability. SIAM J. Control Optim. 32 (1994) 1-23. | MR 1255956 | Zbl 0795.93023

[45] H. Triebel, Interpolation theory, function spaces, differential operators, 2nd edition. Johann Ambrosius Barth, Heidelberg (1995). | MR 1328645 | Zbl 0830.46028

[46] R. Triggiani, On the stabilizability problem in Banach space. J. Math. Anal. Appl. 52 (1975) 383-403,. | MR 445388 | Zbl 0326.93023

[47] R. Triggiani, Extensions of rank conditions for controllability and observability to Banach spaces and unbounded operators. SIAM J. Control Optim. 14 (1976) 313-338. | MR 479499 | Zbl 0326.93003

[48] R. Triggiani, Boundary feedback stabilizability of parabolic equations. Appl. Math. Optim. 6 (1980) 201-220. | MR 576260 | Zbl 0434.35016

[49] R. Triggiani, Unique continuation from an arbitrary interior subdomain of the variable-coefficient Oseen equation. Nonlinear Anal. 71 (2009) 4967-4976. | MR 2548728 | Zbl 1181.35034

[50] M. Tucsnak and G. Weiss, Observation and control for operator semigroups. Birkhäuser Advanced Texts: Basler Lehrbücher. [Birkhäuser Advanced Texts: Basel Textbooks]. Birkhäuser Verlag, Basel (2009). | MR 2502023 | Zbl 1188.93002


text:
# Kerodon

$\Newextarrow{\xRightarrow}{5,5}{0x21D2}$ $\newcommand\empty{}$

Proposition 4.6.6.10. Let $\operatorname{\mathcal{C}}$ be a differential graded category, so that the differential graded nerve $\operatorname{N}_{\bullet }^{\operatorname{dg}}(\operatorname{\mathcal{C}})$ is an $\infty$-category (Theorem 2.5.3.10). Let $Y$ be an object of $\operatorname{\mathcal{C}}$. The following conditions are equivalent:

$(1)$

The object $Y$ is initial when viewed as an object of the $\infty$-category $\operatorname{N}_{\bullet }^{\operatorname{dg}}(\operatorname{\mathcal{C}})$.

$(2)$

The object $Y$ is final when viewed as an object of the $\infty$-category $\operatorname{N}_{\bullet }^{\operatorname{dg}}(\operatorname{\mathcal{C}})$.

$(3)$

The identity morphism $\operatorname{id}_{Y}: Y \rightarrow Y$ is nullhomologous: that is, there exists a $1$-chain $e \in \operatorname{Hom}_{\operatorname{\mathcal{C}}}(Y,Y)_{1}$ satisfying $\partial (e) = \operatorname{id}_{Y}$.

Proof. We will show that $(1) \Leftrightarrow (3)$; the proof that $(2) \Leftrightarrow (3)$ is similar. If condition $(1)$ is satisfied, then there exists a $2$-simplex of $\operatorname{N}_{\bullet }^{\operatorname{dg}}(\operatorname{\mathcal{C}})$ with boundary as indicated in the diagram

$\xymatrix@R =50pt@C=50pt{ & Y \ar [dr]^{0} & \\ Y \ar [ur]^{0} \ar [rr]^{ \operatorname{id}_ Y } & & Y, }$

which we can identify with a $1$-chain $e \in \operatorname{Hom}_{\operatorname{\mathcal{C}}}(Y,Y)_{1}$ satisfying $\partial (e) = \operatorname{id}_ Y$ (see Example 2.5.3.4). Conversely, suppose that there exists $e \in \operatorname{Hom}_{\operatorname{\mathcal{C}}}(Y,Y)_{1}$ satisfying $\partial (e) = \operatorname{id}_{Y}$. For every object $Z \in \operatorname{\mathcal{C}}$, $e$ determines a chain homotopy from the identity map $\operatorname{id}: \operatorname{Hom}_{\operatorname{\mathcal{C}}}(Y,Z)_{\ast } \rightarrow \operatorname{Hom}_{\operatorname{\mathcal{C}}}(Y,Z)_{\ast }$ to the zero map. It follows that the homology of chain complex $\operatorname{Hom}_{\operatorname{\mathcal{C}}}(Y,Z)_{\ast }$ vanishes, so that the Eilenberg-MacLane space $\mathrm{K}( \operatorname{Hom}_{\operatorname{\mathcal{C}}}(Y,Z)_{\ast } )$ of Construction 2.5.6.3 is a contractible Kan complex. Example 4.6.5.14 supplies an isomorphism of Kan complexes $\operatorname{Hom}^{\mathrm{L}}_{ \operatorname{N}_{\bullet }^{\operatorname{dg}}}(Y,Z) \simeq \mathrm{K}( \operatorname{Hom}_{\operatorname{\mathcal{C}}}(Y,Z)_{\ast } )$. Allowing $Z$ to vary and invoking Remark 4.6.6.6, we conclude that $Y$ is an initial object of the $\infty$-category $\operatorname{N}_{\bullet }^{\operatorname{dg}}(\operatorname{\mathcal{C}})$. $\square$


text:
GMAT Question of the Day - Daily to your Mailbox; hard ones only

 It is currently 19 Sep 2018, 17:42

### GMAT Club Daily Prep

#### Thank you for using the timer - this advanced tool can estimate your performance and suggest more practice questions. We have subscribed you to Daily Prep Questions via email.

Customized
for You

we will pick new questions that match your level based on your Timer History

Track

every week, we’ll send you an estimated GMAT score based on your performance

Practice
Pays

we will pick new questions that match your level based on your Timer History

# If the ratio of the sum of the first 6 terms of a G.P. to the sum of

Author Message
TAGS:

### Hide Tags

Math Expert
Joined: 02 Sep 2009
Posts: 49251
If the ratio of the sum of the first 6 terms of a G.P. to the sum of  [#permalink]

### Show Tags

14 Feb 2016, 05:38
00:00

Difficulty:

55% (hard)

Question Stats:

70% (01:42) correct 30% (01:38) wrong based on 61 sessions

### HideShow timer Statistics

If the ratio of the sum of the first 6 terms of a G.P. to the sum of the first 3 terms of the G.P. is 9, what is the common ratio of the G.P?

A. 3
B. 1/3
C. 2
D. 9
E. 1/9

_________________
Math Expert
Joined: 02 Aug 2009
Posts: 6787
Re: If the ratio of the sum of the first 6 terms of a G.P. to the sum of  [#permalink]

### Show Tags

14 Feb 2016, 21:00
Bunuel wrote:
If the ratio of the sum of the first 6 terms of a G.P. to the sum of the first 3 terms of the G.P. is 9, what is the common ratio of the G.P?

A. 3
B. 1/3
C. 2
D. 9
E. 1/9

Hi,

1) formula way

the sum of n terms in a GP = first term *(1-r^n)/(1-r)..
so sum of 6 terms = first term *(1-r^6)/(1-r)..
and first three terms=first term *(1-r^3)/(1-r)..

therefore the ratio = (1-r^6)/(1-r^3)= (1-r^3)(1+r^3)/(1-r^3)= 1+r^3...
but this is given as 9..
so 1+r^3=9..
r^3=8..
or r=2..

substitution

if we have problem in simplifying after (1-r^6)/(1-r^3), substitute the choices and see when you get 9..
A. 3....
B. 1/3
C. 2
D. 9
E. 1/9
we can eliminate the fractions straightway here..B and E out..
the ratio is 9, so we cannot have r as a multiple of 9 or 3 as the numerator (1-r^6) will become [b]6th power of multiple of 3 - 1,
which will never be a multile of 9..

only C is left[/b]
_________________

1) Absolute modulus : http://gmatclub.com/forum/absolute-modulus-a-better-understanding-210849.html#p1622372
2)Combination of similar and dissimilar things : http://gmatclub.com/forum/topic215915.html
3) effects of arithmetic operations : https://gmatclub.com/forum/effects-of-arithmetic-operations-on-fractions-269413.html

GMAT online Tutor

Manager
Status: Gmat Prep
Joined: 22 Jul 2011
Posts: 74
Re: If the ratio of the sum of the first 6 terms of a G.P. to the sum of  [#permalink]

### Show Tags

14 Feb 2016, 21:19
sum of 6 terms in GP: 1 + $$a$$ + $$a^2$$ + $$a^3$$+ $$a^4$$+ $$a^5$$ == 1 + a + $$a^2$$ + $$a^3$$ * (1 + $$a$$ + $$a^2$$ )
sum of first 3 terms in GP: 1 + $$a$$ + $$a^2$$

x= 1 + $$a$$+ $$a^2$$
given:
(x + $$a^3$$*x)/x = 9

$$a^3$$ = 8
a= 2
Intern
Joined: 11 Nov 2015
Posts: 20
Re: If the ratio of the sum of the first 6 terms of a G.P. to the sum of  [#permalink]

### Show Tags

17 Feb 2016, 14:13
9=(a1+a2+a3+a4+a5+a6)/(a1+a2+a3)
Factorize the same terms
9=1+(a4+a5+a6)/(a1+a2+a3)
Write every term with respect to r
a1=a1
a2=a1*r^1
a3=a1*r^2
.........
9=1+(a1(r^3+r^4+r^5))/(a1(1+r^1+r^2))
8=(r^3 (1+r^1+r^2))/((1+r^1+r^2))
8=r^3
r=2
Non-Human User
Joined: 09 Sep 2013
Posts: 8095
Re: If the ratio of the sum of the first 6 terms of a G.P. to the sum of  [#permalink]

### Show Tags

07 Oct 2017, 00:53
Hello from the GMAT Club BumpBot!

Thanks to another GMAT Club member, I have just discovered this valuable topic, yet it had no discussion for over a year. I am now bumping it up - doing my job. I think you may find it valuable (esp those replies with Kudos).

Want to see all other topics I dig out? Follow me (click follow button on profile). You will receive a summary of all topics I bump in your profile area as well as via email.
_________________
Re: If the ratio of the sum of the first 6 terms of a G.P. to the sum of &nbs [#permalink] 07 Oct 2017, 00:53
Display posts from previous: Sort by

# Events & Promotions

 Powered by phpBB © phpBB Group | Emoji artwork provided by EmojiOne Kindly note that the GMAT® test is a registered trademark of the Graduate Management Admission Council®, and this site has neither been reviewed nor endorsed by GMAC®.


text:
# 10.04 Confidence intervals for sample proportions

Lesson

We see and hear a lot of statistics in the media, published by polls or researchers. However, as we have discovered, these are often taken from samples of a population.

For example, in 2019, The Guardian held its final poll of Australian voters a few days before the Federal Election, and found that in a sample of $1201$1201 voters, $51.5%$51.5% would be voting for Labor on Saturday, 18th May. As we now know, the Federal Election was won by the Liberal Party, not the Labor Party. The true population proportion in a two party preferred voting showed that $p=0.4847$p=0.4847 compared with our $\hat{p}=0.515$^p=0.515.

Does this mean this was a "bad" sample? Should The Guardian have conducted a survey with a larger sample size? Are there other factors that may play a part here?

As we saw in the previous chapter, the distribution of sample proportions is approximately normal when the sample size is large enough (in this case, a sample of $1201$1201 is considered large enough). How can we use this information to interpret our point estimate of the population proportion?

We can use our sample proportion together with the normal approximation to the distribution of sample proportions to calculate a range of values within which we can have a certain level of confidence that the true population proportion is contained. We call this range of values a confidence interval and it provides an interval estimate for the population proportion.

### Calculating a confidence interval

When calculating a confidence interval there are a few considerations and things to remember. Firstly we recall that that the distribution of the sample proportions is modelled by a normal distribution with a mean of $p$p and a standard deviation of $\sqrt{\frac{p\times(1-p)}{n}}$p×(1p)n. Since we don't know $p$p, we will use $\hat{p}$^p to estimate this normal distribution.

Now we choose a level of confidence. Often the level of confidence is either $90%$90%, $95%$95% or $99%$99%. Why don't we choose a confidence level of $100%$100%? Well, the way we calculate our confidence interval is directly related to the normal distribution, and as we saw in our study of the normal distribution, since the tails of the distribution tend to positive and negative infinity, we cannot accurately find interval endpoints that encapsulate $100%$100% confidence, unless we choose them as $0$0 and $1$1, which of course covers all options, but gives us no information to understand what the true population proportion is.

What does it mean to calculate a $90%$90% interval? Visually it looks like this:

So, we are calculating two values, one either side of $\hat{p}$^p that is $k$k standard deviations away from $\hat{p}$^p. How many standard deviations exactly? Well that depends on our confidence level.

For a $90%$90% confidence level, we are using $k=1.6449$k=1.6449 standard deviations from the mean. Since, using the standard normal distribution, $z\approx1.6449$z1.6449 and $z\approx-1.6449$z1.6449 are the $z$z-scores between which $90%$90% of scores lie.

#### Worked example

##### Example 1

Calculate a $90%$90% confidence interval for the true population proportion of voters predicted to vote for Labor in the 2019 election using the Guardian Poll held just before the Federal Election.

Think: Although we now know, after the fact, what the true population proportion was for that election, on the days prior to the event our best bet was to use polling information to understand the true value of $p$p. In this example we will calculate the true value of $p$p with $90%$90% confidence. To do this we need a $\hat{p}$^p, which we know is $0.515$0.515, a sample size, which we know is $1201$1201, and a $z$z score associated with the level of confidence we want, which we know is $1.6449$1.6449.

Do:

 Lower bound of interval $=$= $0.515-1.6449\times\sqrt{\frac{0.515\times(1-0.515)}{1201}}$0.515−1.6449×√0.515×(1−0.515)1201 The mean minus $1.6449$1.6449 standard deviations from the mean $=$= $0.515-1.6449\times0.01442$0.515−1.6449×0.01442 Calculating the standard deviation $=$= $0.4913$0.4913 Calculating the lower bound

 Upper bound of interval $=$= $0.515+1.6449\times\sqrt{\frac{0.515\times(1-0.515)}{1201}}$0.515+1.6449×√0.515×(1−0.515)1201 The mean plus $1.6449$1.6449 standard deviations from the mean $=$= $0.515+1.6449\times0.01442$0.515+1.6449×0.01442 Calculating the standard deviation $=$= $0.5387$0.5387 Calculating the upper bound

We can now say that we are $90%$90% confident that the true population proportion of people voting for Labor is in the interval $(0.4913,0.5387)$(0.4913,0.5387).

We also now know that $p=0.4847$p=0.4847 does not lie in that interval.

What if we increased our confidence level to $95%$95%?

Following the same procedure, this time with a $z$z score of $1.95996$1.95996 we obtain an interval of $(0.4871,0.5437)$(0.4871,0.5437). Once again, the true population proportion is slightly outside this interval.

Calculating a $99%$99% confidence interval, we obtain $(0.4783,0.5525)$(0.4783,0.5525), and this time we see that we do in fact have the true population proportion contained within this confidence interval.

Note: Confidence intervals can be found directly by using our calculators, see the instructions at the end of this lesson.

## What does a confidence interval really mean?

Let's return to a $90%$90% confidence interval.

We say, we are $90%$90% confident that the true population proportion lies within the confidence interval.

And as we saw above, when we increase our confidence level, the more confident we become that $p$p will be contained within the interval. This is because we widen the net of our interval, due to the larger $z$z-score associated with the higher level of confidence.

The three confidence intervals above, and the true proportion $p$p, can be visualised below.

Let's explore this further with the following Geogebra applet.

Set the confidence level to $90%$90%. Then set $n$n to be larger than $50$50. Select a proportion $p$p of around $0.45$0.45.

What do you notice? What do the green lines represent? What do the red lines represent?

 Created with GeogebraSteve Phelps

You should be able to conclude after playing around with the applet awhile that the red lines are the number of confidence intervals that do not contain $p$p and the green lines are the number of confidence intervals that do contain $p$p. When we set the confidence interval at $90%$90% we see that approximately $90%$90% of all confidence intervals do contain $p$p.

## What we can and cannot say about a confidence interval

When considering a $90%$90% confidence interval, or any other confidence interval, it is incorrect to say:

“The probability that the true proportion lies in the interval $\left(\hat{p}-1.6449\times\sqrt{\frac{\hat{p}\times\left(1-\hat{p}\right)}{n}},\hat{p}+1.6449\times\sqrt{\frac{\hat{p}\times\left(1-\hat{p}\right)}{n}}\right)$(^p1.6449×^p×(1^p)n,^p+1.6449×^p×(1^p)n) is $90%$90%."

Why is this incorrect?

The probability that the population proportion is within the interval estimate we created is either $1$1 or $0$0, since it is either within our created interval or it is not. Here are two analogies that may help you understand.

1. What is the probability that the first day of 2017 was a Tuesday?
You may think at first that it is $\frac{1}{7}$17, since there are $7$7 days in a week. However, there is no question of likelihood in this statement–either the first of January 2017 was a Tuesday, or it wasn’t. So we can say that this probability is either $0$0 or $1$1. (In this case it’s $0$0, since it was a Sunday).
2. You pick any real number, and I mark out a finite interval on the real line–as big as I like, but finite. From your perspective, what is the probability that the interval I just marked out contains your number?
Well, as soon as I mark out my interval, you will know for sure whether my guess is correct or not. Either I’m right (so the probability is $1$1), or I’m wrong (so the probability is $0$0).

So what can we say?

We can say that we're $90%$90% confident that $p$p lies within in the $90%$90% confidence interval that we've calculated.

We can also say given numerous samples and their corresponding sample proportions, $\hat{p}$^p, we could create separate $90%$90% confidence intervals for each $\hat{p}$^p and we would expect that approximately $90%$90% of such intervals would contain the population proportion and $10%$10% would not.

As we saw in the Geogebra applet, approximately $90%$90% of the confidence intervals calculated, for various values of $\hat{p}$^p, obtained from various samples, contained $p$p.

#### Practice questions

##### Question 1

$500$500 samples, each of size $250$250, have their two-sided $99%$99% confidence interval calculated. How many of these samples would we expect to contain the true population proportion?

##### Question 2

Ten samples, each of size $150$150, have their two-sided $90%$90% confidence interval calculated. Select the diagram of confidence intervals which best matches our expectation of how many should contain the true population proportion.

1. A

B

C

D

A

B

C

D

##### Question 3

A sample of size $160$160 is taken from the population, and the sample proportion is found to be $0.48$0.48.

1. Calculate the approximate two-sided $95%$95% confidence interval for the true proportion.

Give your answer in the form $\left(a,b\right)$(a,b), and round your answer to two decimal places.

2. Which of the following statements about the confidence interval are correct?

Select all that apply.

There is a $95%$95% probability that the true proportion lies between $0.40$0.40 and $0.56$0.56.

A

We have $95%$95% confidence that the true proportion lies between $0.40$0.40 and $0.56$0.56.

B

The probability that the true proportion lies within $\left(0.40,0.56\right)$(0.40,0.56) is $0$0 or $1$1.

C

The true proportion lies between $0.40$0.40 and $0.56$0.56.

D

There is a $95%$95% probability that the true proportion lies between $0.40$0.40 and $0.56$0.56.

A

We have $95%$95% confidence that the true proportion lies between $0.40$0.40 and $0.56$0.56.

B

The probability that the true proportion lies within $\left(0.40,0.56\right)$(0.40,0.56) is $0$0 or $1$1.

C

The true proportion lies between $0.40$0.40 and $0.56$0.56.

D

## Margin of error

As we saw on the diagram above, the margin of error is the distance from $\hat{p}$^p to one of the interval endpoints. We know from our calculations of a confidence interval that this is obtained by multiplying the standard deviation by the associated $z$z-score.

Confidence intervals and the margin of error

A confidence interval is calculated in the following way:

$(\hat{p}-k\times\sqrt{\frac{\hat{p}\times(1-\hat{p})}{n}},\hat{p}+k\times\sqrt{\frac{\hat{p}\times(1-\hat{p})}{n}})$(^pk×^p×(1^p)n,^p+k×^p×(1^p)n)

Where $\hat{p}$^p is the sample proportion taken from our sample, $n$n is the size of our sample, and $k$k is the $z$z score associated with the level of confidence we wish to achieve.

The margin of error is the distance from $\hat{p}$^p to either end of the confidence interval. This means we can calculate it in a number of ways:

• Using the formula:

$\text{Margin of error}=k\times\sqrt{\frac{\hat{p}\times(1-\hat{p})}{n}}$Margin of error=k×^p×(1^p)n, where $k$k and $n$n are as noted above.

Or if we have already calculated a confidence interval, $\left(a,b\right)$(a,b), the margin of error can be calculated as:

• Half the width of the confidence interval: $\frac{b-a}{2}$ba2
• The distance between our point estimate and an endpoint of the confidence interval: $b-\hat{p}$b^p or $\hat{p}-a$^pa

#### Practice question

##### Question 4

A two-sided $99%$99% confidence interval is calculated for a sample proportion $\hat{p}$^p and $\left(0.672,0.841\right)$(0.672,0.841) is the confidence interval. Calculate the margin of error.

##### question 5

A trout farm will only harvest fish if they are at least $41$41 cm long. $600$600 trout are caught and measured, and $75%$75% were found to be at least the minimum length.

Find the approximate margin of error for a two-sided $95%$95% confidence interval.

1. Round your answer as a percentage correct to two decimal places.

## Size of the interval and margin of error

As you might imagine we often want to know a population proportion within a given level of accuracy. For example, it is not particularly useful to know the population proportion is between $0.25$0.25 and $0.85$0.85, this interval is too wide to provide useful estimate of the population proportion. Consider how the parameters of the margin of error formula influence the size of the margin of error and hence, the width of the confidence interval. To reduce the margin of error and have a relatively small interval estimate for the population proportion we can either reduce the confidence level or increase the sample size.

### Changing the level of confidence

As we increase the level of confidence, we increase the size of the $z$z-score, and we therefore increase the size of the margin of error since we are multiplying the standard deviation by a larger $z$z-value. Thus, as we increase the level of confidence, we need to accept a larger margin of error and wider confidence interval. In reverse we can accept a reduced level of confidence to obtain smaller confidence interval.

### Changing the sample size

As we increase the sample size $n$n, we are decreasing the size of the variance $\frac{\hat{p}\times\left(1-\hat{p}\right)}{n}$^p×(1^p)n and hence decreasing the size of the standard deviation. The smaller the standard deviation, the smaller the margin of error and the smaller the confidence interval.

### Different samples and their different $\hat{p}$^p values

In our investigation on the graphs of the binomial distribution and the mean and standard deviation, we observed the effect of the proportion $p$p on the standard deviation. The standard deviation used to calculate our confidence intervals has very similar properties.

When $\hat{p}=0.5$^p=0.5 our standard deviation is at its maximum. However, when $\hat{p}$^p tends towards $0$0 or $1$1, our standard deviation decreases. Thus, the closer our $\hat{p}$^p value is to $0$0 or $1$1, the smaller our standard deviation and the smaller our margin of error.

### Using the margin of error to calculate the sample size

As we discussed earlier, real life constraints often mean that we cannot collect a large number of samples, so instead we often have to decide on how large our sample should be so that within our level of confidence the margin of error is at a level we are comfortable with. As we noted above, the larger the $n$n value, the smaller the margin of error.

#### Worked example

##### Example 2

(a) Calculate the margin of error for the $90%$90% confidence interval.

Think: Remember that the margin of error is the distance from $\hat{p}$^p to the end of one of the intervals, or half the width of the confidence interval.

Do: Let's find the margin of error by calculating half the width of the confidence interval.

 Margin of Error $=$= $\frac{0.5387-0.4913}{2}$0.5387−0.49132 $=$= $0.0237$0.0237

(b) Determine the size of the sample if the Guardian poll wanted a margin of error less than $0.02$0.02 for a $90%$90% level of confidence.

Think: Using the formula for the margin of error, we'll be able to write an equation that allows us to solve for $n$n.

Do:

 $0.02$0.02 $=$= $1.6449\times\sqrt{\frac{0.515\times(1-0.515)}{n}}$1.6449×√0.515×(1−0.515)n Completing the relevant values of the margin of error formula $n$n $=$= $1689.54$1689.54 Rearrange or solve for $n$n on our CAS

Rounding appropriately to an integer sample size so that margin of error is less than $0.02$0.02, we have $n=1690$n=1690 .

#### Practice questions

##### Question 6

Two samples, $A$A and $B$B, have the same $\hat{p}$^p. Each sample has a two-sided $90%$90% confidence calculated. Sample $A$A is of size $100$100. Sample $B$B is of size $500$500.

1. Which sample will have the larger margin of error?

Sample $A$A

A

Sample $B$B

B

Sample $A$A

A

Sample $B$B

B

##### Question 7

Use technology to determine the minimum sample size required to achieve a margin of error of $3%$3% in an approximate two-sided $95%$95% confidence interval for the proportion $p$p of primary school children in Australia who play competitive sport. The sample proportion $\hat{p}$^p is found to be $0.6$0.6.

### Using CAS to calculate confidence intervals and margins of error

The following show us how to use our CAS to calculate confidence intervals and margins of error.

Casio ClassPad

How to use the CASIO Classpad to complete the following tasks regarding confidence intervals for proportions.

A sample of size $70$70 is taken from a population. The sample proportion is found to be $0.7$0.7.

1. Estimate the standard deviation of the sampling distribution of the sample proportions, to 4 significant figures.

2. Calculate a $90%$90% confidence interval for this sample.

3. Calculate the margin of error for this $90%$90% confidence interval.

4. Estimate the size of the sample required if the margin of error for a $90%$90% confidence interval is to be at most $0.05$0.05.

TI Nspire

How to use the TI Nspire to complete the following tasks regarding confidence intervals for proportions.

A sample of size $70$70 is taken from a population. The sample proportion is found to be $0.7$0.7.

1. Estimate the standard deviation of the sampling distribution of the sample proportions, to 4 significant figures.

2. Calculate a $90%$90% confidence interval for this sample.

3. Calculate the margin of error for this $90%$90% confidence interval.

4. Estimate the size of the sample required if the margin of error for a $90%$90% confidence interval is to be at most $0.05$0.05.

### Outcomes

#### 4.5.3.1

understand the concept of an interval estimate for a parameter associated with a random variable

#### 4.5.3.2

use the approximate confidence interval [ ˆp-√(ˆp(1−ˆp)/n, ˆp+z√(ˆp(1−ˆp)/n), as an interval estimate for p, where z is the appropriate quantile for the standard normal distribution

#### 4.5.3.3

define the approximate margin of error E=z√(ˆp (1−ˆp)/n and understand the trade-off between margin of error and level of confidence


text:
# Returning an element from an array

This topic is 2013 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi there. I hope someone could help me solve this problem.

I suspect this is not the way to do it, but here's the code:

 int tile[210][210]; int Map::getTile(int a, int b) { return tile[a]; }

When I want to return the element in a different class, it returns 0.

Also, I can't make my tilemap (tile[a]) bigger than 212 * 212. The game crashes just after it launches.

##### Share on other sites
If you want the tile to be connected to an instance of the Map class, you need to place the definition of tile inside the class { } body where you define Map. Just sticking it out in no-man's-land makes it a global variable, so every copy of Map will access the same variable.

##### Share on other sites
In addition to what ApochPiQ mentioned, you should use an std::vector if you're going to have a large amount of data, because you're putting too much data on the stack which is why it crashes. This is called a Stack Overflow, apparently (I never knew what it was called until just now ).

Using a std::vector puts the data on the heap instead, which won't crash your program with the amount of data you are using.
(Note: Just because std::vectors are resizable, doesn't mean you have to use that. They are good as for constant sized arrays also. Infact, the new C++ standard even introduced a new type of container: A non-resizable vector. )

This code should give you a good boost-start:
#include <vector> class Map { public: Map(int width, int height) : width(width), height(height) { //Resize the vector to be the size we want (width * height). this->tiles.resize((width * height), 0); //Initialize each tile to 0. } int Map::GetTile(int x, int y) { int index = _GetIndex(x,y); //Make sure this is a valid index. if(_IsValid(index)) { return this->tiles[index]; } return 0; } void Map::SetTile(int x, int y, int tileID) { int index = _GetIndex(x,y); //Make sure this is a valid index. if(_IsValid(index)) { this->tiles[index] = tileID; } } private: int width, height; std::vector<int> tiles; //Converts from a two-dimensional x,y to a one-dimensional index into our vector. int _GetIndex(int x, int y) { return (y * this->width) + x; } //Makes sure that we aren't going out of bounds, which will crash the program. bool _IsValid(int index) { if(index < this->tiles.size()) return true; return false; } }; int main() { const int NOTHING = 0; const int GRASS = 1; const int DIRT = 2; const int DIFFERENT_DIRT = 3; //... const int WATER = 211; const int LAVA = 300; Map map(20, 20); //I want a map that's 20 by 20 tiles. Map largeMap(2000, 5000); //I also want a map that's 2000 by 5000 tiles. largeMap.SetTile(50, 100, DIRT) //Access tile X:50, Y:100, and set it to DIRT. if(largeMap.GetTile(playerTileX, playerTileY) == LAVA) { //...damage the player. } }

If you have any questions about how it works, don't hesitate to ask. Edited by Servant of the Lord

##### Share on other sites
Wow, thanks, I can make the map any size I want.

But, I create the map and do all of this inside my Map class. And when again I want to get the tile in the Player class, it returns 0.

##### Share on other sites
Could you please post the code how the Map instance is passed to the Player? I have the suspicion you are creating a new (uninitialized) Map instance in your Player class.

##### Share on other sites
 class Player { Map m; public: Player(); void Init(); //... }

I set the width and the height inside the Map class.

##### Share on other sites
Are you sure you want every player to have her own map? Because that's what you are doing right now. What you want to do, is pass a reference to your map to the player, like this:

 class Player { Map& m; public: Player(Map& map) : m(map) { ... old constructor code ... } }; in main: set up the map as you did before, then when creating the player: Player player(map); // or largeMap

This way you only have one map for all players, all referencing the same data. If you do it the way you did, you create an empty map for every player, and one in your main, which you never use.

##### Share on other sites

But, I create the map and do all of this inside my Map class. And when again I want to get the tile in the Player class, it returns 0.

Could you show a complete example of code? We need to see what your entire Map class looks like, and your entire Player class, if we're to figure out why your Player class is not interacting with the Map class properly. Also show where your Map or Player is created. Edited by Servant of the Lord

##### Share on other sites
I think SOAL and rnlf are correct, you need every player to have a reference not create its own (though personally I would use a pointer but its all the same)

Make the player class have a reference to a M

Are you sure you want every player to have her own map? Because that's what you are doing right now. What you want to do, is pass a reference to your map to the player, like this:

 class Player { Map& m; public: Player(Map& map) : m(map) { ... old constructor code ... } }; in main: set up the map as you did before, then when creating the player: Player player(map); // or largeMap

This way you only have one map for all players, all referencing the same data. If you do it the way you did, you create an empty map for every player, and one in your main, which you never use.

this is pefect, should easily solve the issue

also SOAL you forgot to include a check inside the isValid function if it is less than 0. I don't know if std::vector does that check or not.

##### Share on other sites

also SOAL you forgot to include a check inside the isValid function if it is less than 0. I don't know if std::vector does that check or not.

Oops, you're right.

The function should be:
bool _IsValid(int index) { if(index < this->tiles.size() && index > 0) return true; return false; }

If it was my own code, I'd just make 'index' be unsigned or a size_t.

##### Share on other sites
Oof; not quite, Servant. 0 is also a valid element.

I try to write it as close to the mathematical notation, [0 size) or 0 <= x < size, as possible:
 bool _IsValid( int index ) const { return 0 <= index && index < tiles.size(); }
I find it's easier to "read" the domain of the condition at a glance. Edited by fastcall22

##### Share on other sites

Oof; not quite, Servant. 0 is also a valid element.

/facepalm

I must be having one of those days. It's a good thing my build environment broke, or I'd probably be wreaking havoc on my code base right now.
Or maybe that's how my build environment broke. Edited by Servant of the Lord

##### Share on other sites

Are you sure you want every player to have her own map? Because that's what you are doing right now. What you want to do, is pass a reference to your map to the player, like this:

 class Player { Map& m; public: Player(Map& map) : m(map) { ... old constructor code ... } }; in main: set up the map as you did before, then when creating the player: Player player(map); // or largeMap

This way you only have one map for all players, all referencing the same data. If you do it the way you did, you create an empty map for every player, and one in your main, which you never use.

I've been struggling with this for a few days now. I do all it says here, but it always returns some kind of an error. The error it returns when I write as it says is: "error: 'map' is not a type" pointing to this line "Player p(map);".

##### Share on other sites
You have to actually create the map somewhere before you can pass it into Player p(map);

Either globally, or preferably, whatever function or class creates and owns "Player p" should also own "Map map".

Example:
Map myMap; Player myPlayer(myMap);

'myMap' is an instance of the 'Map' class type.
'myPlayer' is an instance of the 'Player' class type, and we're passing the 'myMap' instance into the Player constructor to create 'myPlayer'.
Because the Player class takes a reference (the & character) to a Map, it doesn't actually copy the map, but it shares the same map - Changing one changes the other, because Player's 'm' Map is a reference to 'myMap' Map (a different variable but pointing to the same location in memory).

You just have to be sure that "Map myMap" lasts as long or longer than "Player myPlayer"'s 'm' Map reference. Edited by Servant of the Lord

##### Share on other sites
Can you post the code you are trying to compile?

 Ninja'd with actual advice :-) Edited by ApochPiQ

##### Share on other sites
I actually do have the "Map m;" line above the "Player p;" one, just didn't write it in the post. But yeah, it doesn't work.
Here's the code I'm trying to compile:

 class Game { Map map; Player p(map); public: Game(); //... };

... and here is the Player class header file code:

 class Player { Map& m; public: Player(Map& map) : m(map) {} //... };

##### Share on other sites

 class Game { Map map; Player p(map); public: Game(); //... };

This is the source of your problem. The compiler thinks you are trying to create a function called p which takes a parameter of type map with no name, and returns a Player.

Basically, this is because you're trying to create a variable instance inside a class declaration. This is not legal. You need to create variables inside a code block such as a function body:

class Map { /* ... */ }; class Player { public: Player(Map& map) : MyMap(map) { } private: Map& MyMap; }; int main () { Map someMap; Player somePlayer(someMap); // Do stuff! return 0; }

##### Share on other sites
Ah, thank you so much. That part works now But how does the Player constructor look like in the Player code (.cpp) file?

##### Share on other sites
Moving the constructor to a separate .cpp file is pretty simple:

// Map.h class Map { /* ... */ }; // Player.h class Player { public: Player(Map& map); private: Map& MyMap; }; // Player.cpp Player::Player (Map& map) : MyMap(map) { } // Main.cpp int main () { Map someMap; Player somePlayer(someMap); // Do stuff! return 0; }

##### Share on other sites
Hmm.. It compiles now, but the initialization, loop and rendering of the Player all got messed up. None works properly.. Anyone knows why that might have happened? Edited by Toshio

##### Share on other sites
Show us the code that is having problems.

If it's too large to post, consider taking out pieces one by one until you identify the smallest program subset that actually demonstrates the problem you're having, and post that instead.

##### Share on other sites
 void Game::OnInit() { Map map; Player p(map); p.Init(); } void Game::OnLoop() { Map map; Player p(map); p.Move(); }

Nothing compiles as it should.
Here are those two functions:

 void Player::Init() { CSurface c; x = 100; y = 100; texture = c.loadTexture("player.png"); } void Player::Move() { x += xVel * (delta / 1000.0f); y += yVel * (delta / 1000.0f); //... }

##### Share on other sites
If you create a Map or Player within a function, it creates a new Map or Player, not the one you used previously.

You have to create them once, by placing them in the Game declaration.
class Game { public: Game(); //...other stuff. private: Map map; Player player; };

And in the constructor, you need to initialize Player with the Map, in the Game's constructor.
Game::Game() : player(map) //Pass 'map' into the Player constructor. { }

...And then you can use 'map' and 'player' normally, without re-creating them.
void Game::OnInit() { p.Init(); } void Game::OnLoop() { p.Move(); } Edited by Servant of the Lord

##### Share on other sites

#include <vector> class Map { public: [...] private: int width, height; std::vector<int> tiles; //Converts from a two-dimensional x,y to a one-dimensional index into our vector. int _GetIndex(int x, int y) [...] //Makes sure that we aren't going out of bounds, which will crash the program. bool _IsValid(int index) [...] };

Just a note here so people don't get into any bad habits: identifiers starting with an underscore followed by an upper case letter should never be used, as they're reserved for the implementation.

##### Share on other sites
Wow, thank you Servant of the Lord. Everything works now
Thanks ApochPiQ and everyone else who helped


text:
Calculus confusion

Calculus: An Intuitive and Physical Approach by Morris Kline 1977 had something that help me clarify notational issues.  On pg 26 he writes:

$(22) \lim \limits_{\Delta t \to 0}{ \Delta s \over \Delta t} = 178$

Even this notation in (22) is somewhat lengthy.  Hence mathematicians replace it by a still briefer one.  Newton used $\dot s$.  Leibnex used $ds \over dt$.  Still another notation $s'$ was introduced by Lagrange and if Euler’s notation $f(t)$ is used then the limit (22) is denoted $f'(t)$.  Thus

$(22) \lim \limits_{\Delta t \to 0 }{ \Delta s \over \Delta t} = \dot s = {ds \over dt} = s' = f'(t)$

The four notations, are identical in meaning by all fall short of perfection.  Newton’s symbolism is concise but poor because the dot above the $s$ is often overlooked;  moreover it fails to show what the independent variables is.  Leibniz’s notation suggests that the limit is a quotient whereas the limit of average speeds definitely is not a quotient … The notation $f'(t)$ is informative but clumsier than $\dot s$ or $s'$.  … However we shall only use the dot notation when the independent variable is time.


text:
K&K Question 3.5 - Mass and Axle

1. Apr 9, 2014

1. The problem statement, all variables and given/known data

A mass m is connected to a vertical revolving axle by two strings of length l, each making an angle of 45 degrees with the axle, as shown. Both the axle and mass are revolving with constant angular velocity ω. Gravity is directed downward.

(a) Draw a clear force diagram for m
(b) Find the tension in the upper string, $T_{up}$ and the tension in the lower string, $T_{low}$.

2. Relevant equations

$ma=mr\omega^2=ml\omega^2\sin{\varphi}$
Where phi is 45 degrees.

3. The attempt at a solution

Image: http://gyazo.com/8626cda317d6dca7dc1bbe751b643247
FBD: http://postimg.org/image/tez986p19/

The equations for the x and y directions, respectively:
$T_u\sin{\varphi}-T_d\sin{\varphi}=ml\omega^2\sin{\varphi}$
$T_u\cos{\varphi}-mg-T_d\cos{\varphi}=ml\omega^2\sin{\varphi}$

Solving for the tension in the upper cord, I get this:
$T_u=-mg$

Assuming that the tangent of 45 is 1. Am I on the right track or am I making a mistake right now? If it has to do with reference frames, I wouldn't know what to do; I know that:
$F_{apparent}=F_{true}+F_{fictitious}$
I don't know how to apply it though. Should I continue solving for the tension in the lower rope, or do I need to correct something?

Last edited: Apr 9, 2014
2. Apr 9, 2014

haruspex

Check the signs
Check the term on the right hand side. Is this a cut-and-paste error?

3. Apr 9, 2014

You're right. Fixed it and got the equation:
$$T_u=\frac{m\sin{\varphi}(\ell\omega^2+g)}{1+\sin{\varphi}}$$

When I apply this to the hint: If $\ell\omega^2=\sqrt{2}g$ then $T_u=\sqrt{2}mg$.

All that's left is solving for the other tension. Thanks for the help.
It's funny how easy it is to make dumb mistakes :tongue:

4. Apr 9, 2014

Tanya Sharma

This is not the correct value of tension in the upper string.

If you apply the hint i.e ω2l =√2g in the expression of Tu you have obtained,you get mg not √2mg

5. Apr 9, 2014

In fact I get 2mg when using a calculator. I'm currently working on it. Am I off with the forces or the algebra?

6. Apr 9, 2014

Tanya Sharma

Did you fix the errors pointed out by haruspex in post#2 ?

If yes ,what are the two equations you get ?

7. Apr 9, 2014

I did, and here's what I got:
$$T_u\sin{\varphi}+T_d\sin{\varphi}=m\ell\omega^2\sin{\varphi}$$
$$T_u\cos{\varphi}-mg-T_u\cos{\varphi}=0$$

8. Apr 9, 2014

Tanya Sharma

Correct

You have denoted both the tensions by Tu .

9. Apr 9, 2014

Sorry, typing error.
So what am I doing wrong here? There is no centripetal acceleration in the y direction, is there? The mass is rotating in a horizontal plane.

10. Apr 9, 2014

Tanya Sharma

Okay.But what is the correct equation ?

11. Apr 9, 2014

$$T_u\cos{\varphi}-mg-T_d\cos{\varphi}=0$$

12. Apr 9, 2014

Tanya Sharma

Good .

So now you have got two equations .You just need to be more careful while doing algebra . Go slowly .

Replace sinø and cosø with 1/√2 . What is the value of Tu you get?

13. Apr 9, 2014

Here it goes:
$$\frac{T_u}{\sqrt{2}}-mg-\frac{T_d}{\sqrt{2}}=0$$
$$T_d=T_u-mg$$

Substituting $T_d$ into the next equation, we get:
$$\frac{T_u}{\sqrt{2}}+\frac{T_u-mg}{\sqrt{2}}=\frac{m\ell\omega^2}{\sqrt{2}}$$
Solving for $T_u$, I finally get the following:
$$T_u=\frac{m(\ell\omega^2+g)}{2}$$

I still get the wrong answer which is off by 4.
I've tried another way but I get $\sqrt{2}g$ instead of $\sqrt{2}mg$
and another substitution also didn't do the trick.

14. Apr 9, 2014

Tanya Sharma

15. Apr 9, 2014

I got it:
$$T_u=\frac{m(\ell\omega^2+2g)}{(1+\sqrt{2})}$$

This is what I get for not practicing. Thanks for the help!

16. Apr 9, 2014

Tanya Sharma

This is incorrect.

17. Apr 9, 2014

How? I applied the hint using a calculator with the values m = 2 and g = 9.8
I got something around 27.718 which is equal to the root of two times 2 times 9.8.

18. Apr 9, 2014

jbunniii

I just did this problem last week, and looking at my answer vs. yours, I'm having trouble understanding how you got $1 + \sqrt{2}$ in the denominator. I don't think it's right. Can you show your calculation leading up to the final answer?

19. Apr 9, 2014

Tanya Sharma

$$T_u-T_d=\sqrt{2}mg$$

$$T_u+T_d=mω^2l$$

Just add the two equations . What do you get ?

20. Apr 9, 2014

$$\frac{T_u}{\sqrt{2}}-mg-\frac{T_d}{\sqrt{2}}=0$$
$$T_d=T_u-\sqrt{2}mg$$
$$\frac{T_d}{\sqrt{2}}+\frac{T_d}{\sqrt{2}}=\frac{m\ell\omega^2}{\sqrt{2}}$$
$$T_u+\sqrt{2}T_u-2mg=m\ell\omega^2$$
$$T_u(1+\sqrt{2})=m(\ell\omega^2+2g)$$
$$T_u=\frac{m(\ell\omega^2+2g)}{(1+\sqrt{2})}$$