9 views

Uploaded by astrolios

A breve description of Python and computing. Avanzada y metodologías para programar:
1 weasdmskfk sld s
2
3 como seguir instrucciones en programación y mejorar..

- pro lect 2
- Bohm - Knowledge and Insight (Adaptation)
- Rate Allocation & Network Lifetime Problem for Wireless Sensor Networks
- scimakelatex.13278.Genival+Lacerda.Mc+Dononald.Liguri+Brito
- Slide 02 - Algorithm
- IPv7 No Longer Considered Harmful
- Zeroth Review 1
- sss.docx
- Solution Manual for Data Structures and Algorithm Analysis in C 2 E 2nd Edition 201498405
- lesson plan form telling time
- Project Documentation Format07
- 347548464-mollaneda-lesson-plan.doc
- Limba Engleza_Bucsa
- digital application-ppt.pptx
- Lecture 1 - Realfasfsdfas
- telling my story using my pdpq
- Algorithms Project
- wytsma_assignment1
- Materi TOKI
- 10.1.1.80.9471

You are on page 1of 3

problem solving.

We want to understand, what does it mean to think

computationally?

That leads to the philosophical question, so

what's computation?

And like a good philosophical question, that leads to

another, deeper philosophical question.

To answer that question of what's computation, let's

start by asking the question, what is knowledge?

And, as we're going to see, we can divide

knowledge up into 2 parts.

There's declarative knowledge, which we can think of the

statements of fact.

And there's imperative

knowledge, or how to's methods.

Statements of facts give us true, but, as we'll see, they

don't necessarily help us think about how to find new

information.

Imperative knowledge, how to methods or recipes, give us

ways of finding new information, and that's going

to be really valuable to us.

Now, to look at this, let's look at an example.

So, what do we mean by declarative knowledge?

Well, here's a piece of declarative knowledge.

That first statement says, the square root of a number x is a

number y such that y * y = x .

You know that's true from high school algebra.

It's a statement of truth.

It tells us something about how to decide whether a

particular number is a square root or not, but can we use

this to actually find a square root?

And the answer is no.

If we have a number x equal to 25 and we're trying to find

the square root of that, and somebody gives us a guess y =

5, we can use this statement to test to see if 5 * 5 = 25 ,

which it does.

But it doesn't tell us how to find the guess.

So declarative knowledge, which is what much of

knowledge is based on, isn't what we need.

We want a different kind of knowledge, and for that,

fortunately, we have imperative knowledge.

As we said, imperative knowledge is how to kinds of

knowledge, or methods or recipes for finding something,

and here's a recipe for deducing square root.

It's actually attributed to Heron of Alexandria, although

there's some debate as to whether he was the original

creator of this algorithm, but it dates from the first

century AD.

And you can see the description here.

Description says if I want to find the square root of some

number x, I'm going to start with a guess.

I'll call it g.

I'm going to take g and multiply it by itself and look

if that result is close enough to x.

If it is, I'm going to stop, and say that g is the answer.

Otherwise, I'm going to make a new guess by averaging g and

x/g , and using this new guess, which I will call g

again, I'm going to repeat the process until we get something

that's close enough.

basic forms.

Right here there's a test.

It's going to let us know when we're done,

when we're close enough.

If that test isn't satisfied, then there's some simple

calculations, like here, that tells us what to do.

And then, finally, there's a flow of control, or a loop,

that tells us how to keep executing the same sequence of

operations until we get, in fact, to a

place where we're done.

This is something that tells us how to find a square root.

This is imperative knowledge and this is what we want.

OK, let's try it out.

Here's a little description of that.

Let's see what happens if we were actually to do it.

So I'm going to do a simple little simulation.

I want to find the square root of 25.

And, yeah, I know the answer is 5, but let's think about

what might happen here.

I'm going to start with a guess and I'm just going to

initially guess 3.

Heron of Alexandria's algorithm says

multiply 3 by itself.

That, of course, gives me 9.

Is 9 close enough to 25?

I don't think so, so let's get x/g , which is about 8.33.

And now, let's take the average of x/g and g.

So we add g and x/g , take the average of

that, and we get 5.67.

And then our little recipe says take

that and do it again.

So this now becomes my new guess, 5.67.

I multiply those together.

I happen to know that comes out to be about 32.5.

I've gotten closer to 25, but it ain't there yet, so that's

not close enough.

Again, let's take x divided by this g which turns out to be

about 4.41, and then I take g and x/g and I average them,

and I get 5.04.

And my algorithm says, my recipe says, take

this and do it again.

5.04 multiplied by itself is about 25.4, and I'm going to

say, you know what, that's close enough, so my little

recipe says there's the answer.

Not perfect, but close enough.

So, Heron had it right.

This looks like a pretty good algorithm.

This is a way of describing a method for doing something,

and that idea, that notion of a recipe, is something we're

going to use a lot.

So we can think of algorithms as being recipes, sequences of

mechanical steps for doing something.

We put that analogy to a little bit more use, we can

see that recipes have much of the same form, real recipes.

Imagine I want to make some custard.

Here's my recipe.

I'm going to take all the ingredients of the custard,

that mixture, put it into a pot over some heat, and I'm

going to stir it.

the custard, pull it out, and run my finger across the back

of the spoon.

If the spoon is clear, then I'm done and I'm going to

remove the custard from the heat and let it cool.

If not, I'm going to repeat.

And notice what we have here.

Again, we've got a test, right there.

And we've got a way of, in fact,

changing the flow of control.

So, normally, the flow runs this way, but based on that

test, we have a way of going back up and

continuing the path.

And this pattern is something we're going to repeat a lot.

So, you want to capture recipes and we need to figure

out how to get the computer to do that for us, which is what

we're going to talk about next.

- pro lect 2Uploaded byHanani Idris
- Bohm - Knowledge and Insight (Adaptation)Uploaded byallyss
- Rate Allocation & Network Lifetime Problem for Wireless Sensor NetworksUploaded byVinaya Kumar S
- scimakelatex.13278.Genival+Lacerda.Mc+Dononald.Liguri+BritoUploaded byPolipio Saturnio
- Slide 02 - AlgorithmUploaded byEffendyFooad
- IPv7 No Longer Considered HarmfulUploaded byקђเɭเקק
- Zeroth Review 1Uploaded byviveknk
- sss.docxUploaded byLea Mae Anayon
- Solution Manual for Data Structures and Algorithm Analysis in C 2 E 2nd Edition 201498405Uploaded bySadia Ch
- lesson plan form telling timeUploaded byapi-241171126
- Project Documentation Format07Uploaded byapi-3710084
- 347548464-mollaneda-lesson-plan.docUploaded byLyka Arania
- Limba Engleza_BucsaUploaded byJakab Zoltan
- digital application-ppt.pptxUploaded byMohd Salahuddin
- Lecture 1 - RealfasfsdfasUploaded byTruong Cai
- telling my story using my pdpqUploaded byapi-463653994
- Algorithms ProjectUploaded byMostafa Mahmoud
- wytsma_assignment1Uploaded bynking7812
- Materi TOKIUploaded byhotasta
- 10.1.1.80.9471Uploaded byrodda1
- Simulated Anne a Ling With Auxiliary Knowledge for Process PlanningUploaded byVarun Kumar
- BFKV Scheduling.psUploaded byAnonymous 8zlaaWq
- A Recursive Random Search Algorithm 1Uploaded bySatish Naidu
- Examiners Report 2014Uploaded byAnonymous 6bpCxvyrtY
- BAAS Report 1831Uploaded byJames Ungureanu
- c328topic8Uploaded byJunaidArshad
- Scimakelatex.6551.Chili.wagUploaded byOne TWo
- 2002revneurologia Invest BiblioUploaded bymarymenez11
- Interacting Multiple Model Methods in Target Tracking: A SurveyUploaded bynamithdevadiga
- The Rosicrucian Digest - July 1930.pdfUploaded bysauron385

- Carta de MotivaciónUploaded byastrolios
- Presupuesto AsadoUploaded byastrolios
- PNP PrelUploaded byastrolios
- Calculos Avanzados de Una NadaUploaded byastrolios
- Indices Se Originan en 1988 Por La IEEE 1366Uploaded byastrolios
- Trainning PythonUploaded byastrolios
- Estado de Proyectos de Generación a Diciembre de 2012_VFUploaded byastrolios
- Tarea_4-_2o_sem16Uploaded byastrolios
- Bioseguridad y Administración de QuimioterapiaUploaded byastrolios
- Carta miaUploaded byastrolios
- Carta miaUploaded byastrolios
- plano unilineal de un dibujo electricoUploaded byastrolios
- Calculo IUploaded byastrolios
- Calculos avanzadosUploaded byastrolios
- AyudaUploaded byastrolios
- AyudaUploaded byastrolios
- AyudaUploaded byastrolios

- rhyming-monster-lesson-planUploaded byapi-307928085
- 3035_w03_erUploaded bymstudy123456
- Application InsightsUploaded byelpluto
- Cascading Style Sheets (CSS)Uploaded byleexpro
- Cases of Domestication and Foreignization in the Translation of Indonesian Poetry Into English a Preliminary InquiryUploaded byAminuddin Muhammad
- srtol memoUploaded byapi-199459775
- Fbx 2011 2 ConverterUploaded bydenipujin
- HPIT Separation SurvivalGuide v2.7 AUG19Uploaded byGerardoKarlos
- The Mental Status ExaminationUploaded bydra.hadley
- Etas Rta-rte User Guide v6.3.0Uploaded byChethan
- Ibm Util Asu Asu82k Anyos NoarchUploaded byRado Rychvaldsky
- not onlyUploaded byConceição Videira
- Hyperion Provider ServicesUploaded byLarissa Martinez Rutmann
- VBA - Backup IssuesUploaded byBrijith VB
- 124969762-Balibar-The-Nation-Form-History-and-Ideology.pdfUploaded byCenan Alkan
- Au Sendmail on Aix PDFUploaded bysjtu91
- what makes a hero bie pblplanningformUploaded byapi-248940845
- stem strategies that work - fishbowl discussionsUploaded byapi-353255943
- Common Proofreading SymbolsUploaded byCharles Nunez
- Cy TW Gallery_Octavio Paz and John HarveyUploaded byDanai Wizdare
- Magic of Love by Helen FarriesUploaded byjonathan pranata
- DDJ-SX_TRAKTOR2_Import_Guide_E.pdfUploaded byJosé A. Godás
- ManualUploaded byFrancisco Castillo
- Portal Interview QuestionsUploaded byBharadwaz Somavarapu
- Wsn Question Bank 2017-2018Uploaded byKommisetty Murthyraju
- Digital Logic Design AssignmentUploaded byHafiz Usman Mahmood
- Touchstone 2 Workbook Answer KeyUploaded byJosé Arnaldo Fernandes
- Ghostscript User ManualUploaded byAbhishek Mandal
- These Are the FAQUploaded bypraveencisc
- relations and functions worksheetUploaded byapi-294509413