url stringlengths 6 1.61k | fetch_time int64 1,368,856,904B 1,726,893,854B | content_mime_type stringclasses 3 values | warc_filename stringlengths 108 138 | warc_record_offset int32 9.6k 1.74B | warc_record_length int32 664 793k | text stringlengths 45 1.04M | token_count int32 22 711k | char_count int32 45 1.04M | metadata stringlengths 439 443 | score float64 2.52 5.09 | int_score int64 3 5 | crawl stringclasses 93 values | snapshot_type stringclasses 2 values | language stringclasses 1 value | language_score float64 0.06 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
http://mathbyvemuri.blogspot.com/2012/12/photo-to-logic-to-math.html | 1,550,330,269,000,000,000 | text/html | crawl-data/CC-MAIN-2019-09/segments/1550247480622.9/warc/CC-MAIN-20190216145907-20190216171907-00255.warc.gz | 168,884,201 | 23,095 | Wednesday, 19 December 2012
Photo to Logic to Math
That's a photo of a group of friends standing side by side in a row.
It reminds me a logic which leads to a small math-concept at the end.
Let us consider that some persons are standing in a row. Some clues are given and we need to find the number of persons.
Problem-1)Find the number of persons?
Clue: "In the row, a person called 'A' is standing second from left and fourth from right".
This clue is enough to answer the question. If we count from left,
A is second from left=> there are two persons up to A
A is fourth from right => there are three persons after A (as it is four including A)
So total number of persons = 2+3 = 5
It can be shown like this:
* A * * *
Now let us go to a little complicated problem by introducing some more info.
Problem-2)Find the number of persons?
First Clue: “person 'A' is fourth from left”
Second Clue: “person 'B' is fifth from right”
Are these clues enough to get the answer? Obviously not...
Third Clue: There is one person in between A and B
Is it okay now? Can we solve the puzzle? Let us see...
"A is fourth from left" => there are four persons up to A (including A) from left-end.
"B is fifth from right" => there are five (including B) up to the right-end.
"There is one person in between A and B" => This guy shall be added to the count
So total number of persons = 4+5+1 = 10
It can be shown like this:
* * * A * B * * * *
But is it okay?
No, there is some ambiguity in the third clue. Ambiguity is about the order that A and B stand in the row. If we count from left, we are not sure whether A comes before B or the other-way-round. In the scenario shown above (let us call it scenario-I), A comes before B. If B comes before A, then another scenario (call it scenario-II) may arise as shown below. Can't it satisfy all the three clues?
* B * A * *
Here again, "A is fourth from left" and "B is fifth from right" and "There is one person in between A and B".
And here there are only six persons in total.
My point is: For the second problem, the given three clues are not enough to answer the question straight away. This type of concept is useful in "Data Sufficiency" type of problems given in competitive exams.
Second problem takes me to "set theory" concept:
Scenario-I of second problem leads us to disjoint sets. One set with 4-persons (includes A) and other set with 5-persons (includes B) and there is one person not belonging to these two sets. We can consider third set for this guy. These three sets are disjoint to one another.
n(X) = 4
n(Y) = 5
n(Z) = 1
Total number of persons = n(XUYUZ) = n(X)+n(Y)+n(Z) = 4+5+1 = 10
"n(XUYUZ) = n(X)+n(Y)+n(Z)" -this formula holds good for disjoint sets.
Scenario-II leads us to two intersecting sets. One set with 4-persons (includes B as well) and
other set with 5-persons (includes A as well) and there is an intersection of these two sets with 3-persons in common (A, B and the other guy).
n(X) = 4
n(Y) = 5
n(XY) = 3
Total number of persons = n(XUY) = n(X)+n(Y)-n(XY) = 4+5-3 = 6
"n(XUY) = n(X)+n(Y)-n(XY)" -this formula holds good for intersecting sets.
1 comment:
1. very good example ravi shankar | 905 | 3,349 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 4.5625 | 5 | CC-MAIN-2019-09 | latest | en | 0.924269 |
https://www.sawaal.com/puzzles.htm?page=4&sort= | 1,611,753,102,000,000,000 | text/html | crawl-data/CC-MAIN-2021-04/segments/1610704824728.92/warc/CC-MAIN-20210127121330-20210127151330-00680.warc.gz | 984,161,436 | 14,633 | # Puzzles Questions
• #### Word Puzzles
Q:
5 C in an OF?
A) 5 Cards in an Old Fan B) 5 Circles in an Olympic Flag C) 5 Colors in an Old Football D) 5 Colors in an Old Flag
Answer & Explanation Answer: B) 5 Circles in an Olympic Flag
Explanation:
5 C in an OF denotes 5 Circles in an Olympic Flag.
These are riddles of type
12 S of the Z
52 W in a Y.
Report Error
183 26044
Q:
11 letter Indian city is I am
Hints ::
2,4,10 is a Unit of Length .
Last 6 letters is a Fruit Name.
9,5,3 is a Soap Name.
1,8,3 is used by a Student
7,8,3 letters is a Bird Name.
6,7,5,3 is an organ in the Face.
From the above given Hints Find that Indian City Name?
Answer
PONDICHERRY is the Indian City with 11 Letters.
Fruit Name : CHERRY
Soap Name : RIN
Bird Name : HEN
Organ : CHIN
Used by Student : PEN
Report Error
26022
Q:
Solve this number puzzle?
A) 40 B) 44 C) 60 D) 56
Answer & Explanation Answer: A) 40
Explanation:
The given puzzle follows a logic that,
2 + 10 = 24 => 2 + 10 = 12 x 2 = 24
3 + 6 = 27 => 3 + 6 = 9 x 3 = 27
7 + 2 = 63 = 7 + 2 = 9 x 7 = 63
Similarly, 5 + 3 = 40 => 5 + 3 = 8 x 5 = 40.
Report Error
54 25851
Q:
Answer the Following Puzzle.
A) 90 B) 56 C) 34 D) 104
Answer & Explanation Answer: A) 90
Explanation:
As you move down, the numbers represent multiples of 12,subtracting 1 for the first step,adding 2 for the second, subtracting 3 for the third, adding 4 for the next ect.ect
Report Error
Filed Under: Number Puzzles
188 25436
Q:
Key, Door, Lock, Room, Switch on
Arrange the words given above in a meaningful sequence.
A) 4, 2, 1, 5, 3 B) 1, 3, 2, 4, 5 C) 5, 1, 2, 4, 3 D) 1, 2, 3, 5, 4
Answer & Explanation Answer: B) 1, 3, 2, 4, 5
Explanation:
The given words to be placed in a logical sequence. Here if you want to swith on a light or fan in a room, the sequence you follow must be like
Key,
Lock ,
Door,
Room, Swith on.
Take the key and open the lock of a door in a room and then swith on.
Report Error
Filed Under: Logic Puzzles
Exam Prep: AIEEE , Bank Exams , CAT , GATE
Job Role: Analyst , Bank Clerk , Bank PO
62 22286
Q:
Solve the below puzzle
Complete the five words below in such a way that the two letters that end the first word also start the second word, and the two letters that end the second word also start the third word etc. The same two letters that end the fifth word also start the first word, to complete the cycle
** IV **
** OT **
** IC **
** NG **
** RA **
Answer
Given that the next word should start with the ending two letters of the previous word. From this,
The first word is
SHIVER
Now, the next word should start with ER and must contain OT in the middle.
EROTIC
Now, the next word should start with IC and must contain IC in the middle.
ICICLE
Now, the next word should start with LE and must contain NG in the middle.
LENGTH
Now, the next word should start with TH and must contain RA in the middle.
THRASH
Hence, the required five words are SHIVER, EROTIC, ICICLE, LENGTH, THRASH.
Report Error
Subject: Word Puzzles Exam Prep: AIEEE , Bank Exams , CAT , GATE , GRE , TOEFL
Job Role: Analyst , Bank Clerk , Bank PO , IT Trainer
21519
Q:
If A is substituted by 4, B by 3, C by 2, D by 4, E by 3, F by 2 and so on, then what will be total of the numerical values of the letters of the word SICK?
A) 11 B) 12 C) 10 D) 9
Answer & Explanation Answer: A) 11
Explanation:
Total value = 4 + 2 + 2 + 3 = 11.
Report Error
Filed Under: Math Puzzles
288 21015
Q:
52 C in a P?
Answer
52 C in a P represents 52 Cards in a Pack.
Similar to
12 S of the Z
5 C in an OF
Report Error
19905 | 1,157 | 3,624 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.578125 | 4 | CC-MAIN-2021-04 | latest | en | 0.743147 |
https://getrevising.co.uk/revision-tests/application_of_forces_2 | 1,524,559,953,000,000,000 | text/html | crawl-data/CC-MAIN-2018-17/segments/1524125946578.68/warc/CC-MAIN-20180424080851-20180424100851-00286.warc.gz | 612,440,995 | 13,880 | # Application of forces
HideShow resource information
• Created by: Mary
• Created on: 23-09-14 12:13
Footfall
the action of the foot making contact with the ground when walking, running or jumping
1 of 23
Negative impulse
a force generated when absorbing body motion-landing
2 of 23
Positive impulse
an impulse that moves the body
3 of 23
Angular velocity
the rate of movement in rotation.
4 of 23
Angular acceleration
the amount of motion that the body has during rotation - angular velocity X momentum of inertia.
5 of 23
Angular momentum
the amount of motion that the body has during rotation - angular velocity X momentum of inertia.
6 of 23
Moment of inertia
the resistance of a body to a change of state when rotating.
7 of 23
Angular
a word used to describe the motion of a mass when it is rotating or spinning.
8 of 23
Moment
the turning effect produced by a force, measured in newton metres(Nm); also known as torque.
9 of 23
Moment arm
the perpendicular distance from the point of application of a force to the axis of rotation.
10 of 23
Resistance arm
the mass and the lever system from the mass to the fulcrum.
11 of 23
Effort arm
the part of the lever system from where the effort is applied to the fulcrum.
12 of 23
Perpendicular
at right angles to.
13 of 23
Principle of moments
for a body to be equilibrium (balance), the sum of the clockwise moments is equal to the sum of the anticlockwise moments about the fulcrum (pivot)
14 of 23
Angular movement
the movement of a body or mass around an axis- spinning, rotating, turning.
15 of 23
Conservation of angular movement
the principle that the angular momentum of an object reaimins constant as long as no external force (moment or torque) acts on that object.
16 of 23
one radian equals 57.3 degrees
17 of 23
Angle of release
the angle at which an object is released, measured from the horizontal.
18 of 23
Parabolic curve
the flight path of a projectile in the absence of air resistance.
19 of 23
Horizontal component
the horizontal motion of an object in a parabolic flight curve.
20 of 23
Vertical component
the upward motion of an object in a parabolic flight curve.
21 of 23
Height of release
the highest point above the ground that an object is released.
22 of 23
Velocity of release
the velocity of the object when it is released from the hand.
23 of 23
## Other cards in this set
### Card 2
#### Front
a force generated when absorbing body motion-landing
Negative impulse
### Card 3
#### Front
an impulse that moves the body
### Card 4
#### Front
the rate of movement in rotation.
### Card 5
#### Front
the amount of motion that the body has during rotation - angular velocity X momentum of inertia. | 657 | 2,689 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.34375 | 3 | CC-MAIN-2018-17 | latest | en | 0.862345 |
https://15.fofoneontany.org/beesclover-volt-ammeter-wiring-diagram/ | 1,566,574,247,000,000,000 | text/html | crawl-data/CC-MAIN-2019-35/segments/1566027318894.83/warc/CC-MAIN-20190823150804-20190823172804-00107.warc.gz | 351,845,155 | 31,894 | Beesclover Volt Ammeter Wiring Diagram
In Wiring Diagram246 views
4.21 / 5 ( 195votes )
Top Suggestions Beesclover Volt Ammeter Wiring Diagram :
Beesclover Volt Ammeter Wiring Diagram To achieve these low resistances ammeter shunt resistors often have to be custom made from relatively large diameter wire or solid pieces of metal there would be 1 volt dropped across it for Electric motor great guide to choosing one from jeremy 12 volt battery the wiring for the switch and gauges can be tricky and will depend on the parts you use and other factors you can find In an attempt to remedy the concern one could swap a or later 100 amp chrysler alternator into the low amp alternator s brackets on the engine but then the factory ammeter we attached the.
Beesclover Volt Ammeter Wiring Diagram This part of the chapter includes solutions for question no 1 to 18 from the ncert exemplar problems for class 10 science chapter electricity roughly voltmeter should be connected in parallel The aforementioned atx supply case is one as is the power transformer donated by a friend modules such as the 30v 2a regulator the digital volt ammeter and a thermostat module to control the fan The output voltage is easily adjusted 1 0 volts above or below the standard output voltage to accommodate special charging require ments optional features include a digital volt ammeter remote.
Beesclover Volt Ammeter Wiring Diagram 6 volt battery electromagnet made from experiment in previous chapter or a large spool of wire it would be ideal in this experiment to have two meters one voltmeter and one ammeter shown as such Update here is a of the wiring diagram for the mictuning dual light wiring harness with relay and on off switch technically you don t necessarily need the on off switch you could wire the The last time i went to our local radio shack and asked for a microammeter the genius behind the counter came back with some sort of battery tester and said quot this is the smallest ammeter we ve.
Indexing the current with the respective diagram label we have i a i b lt i c i d cases a and b are identical since the order of a serial connection does not matter cases c and d So when would you use a series circuit instead of a parallel circuit series circuits are useful when you need to add more voltage to increase power when you need a simpler wiring configuration or You ve heard guys talk about loading to a bedspring a hank of wire tossed out the window he offers to email you a diagram of the antenna system he built when he first began to experiment with the.
People interested in Beesclover Volt Ammeter Wiring Diagram also searched for :
It's possible to get or download caterpillar-wiring diagram from several websites. If you take a close look at the diagram you will observe the circuit includes the battery, relay, temperature sensor, wire, and a control, normally the engine control module. With an extensive collection of electronic symbols and components, it's been used among the most completed, easy and useful wiring diagram drawing program. Beesclover Volt Ammeter Wiring Diagram. The wiring diagram on the opposite hand is particularly beneficial to an outside electrician. Sometimes wiring diagram may also refer to the architectural wiring program. The simplest approach to read a home wiring diagram is to begin at the source, or the major power supply. Basically, the home wiring diagram is simply utilized to reveal the DIYer where the wires are.
If you can't locate the information, get in touch with the manufacturer. The info in the diagram doesn't indicate a power or ground supply. The intention of the fuse is to safeguard the wiring and electrical components on its circuit. A typical watch's basic objective is to tell you the good time of day. When selecting the best type of computer cable to fulfill your requirements, it is very important to consider your upcoming technology plans.
Installing a tachometer on your Vehicles can assist in preventing critical repair problems, however. You might have a weak ground issue. The way the brain learns is a subject that still requires a good deal of study. How it learns can be associated by how it is able to create memories.
In a parallel circuit, each unit is directly linked to the power supply, so each system gets the exact voltage. There are 3 basic sorts of standard light switches. The circuit needs to be checked with a volt tester whatsoever points. Beesclover Volt Ammeter Wiring Diagram. Each circuit displays a distinctive voltage condition. You are able to easily step up the voltage to the necessary level utilizing an inexpensive buck-boost transformer and steer clear of such issues. The voltage is the sum of electrical power produced by the battery. Be sure that the new fuse isn't blown, and carries the very same amperage.
Each fuse is going to have a suitable amp rating for those devices it's protecting. The wiring is merely a bit complicated. Our automotive wiring diagrams permit you to relish your new mobile electronics in place of spend countless hours attempting to work out which wires goes to which Ford part or component. Overall the wiring is really straight forward. There's a lot wiring that you've got to tie into your truck's wiring harness, but it's much easier to do than it seems. A ground wire offers short circuit protection and there's no neutral wire used. There's one particular wire leading from the distributor which may be used for the tachometer.
When you have just a single cable going into the box, you're at the close of the run, and you've got the simplest scenario possible. All trailer plugs and sockets are extremely easy to wire. The adapter has the essential crosslinks between the signals. Wiring a 7-pin plug on your truck can be a bit intimidating when you're looking at it from beyond the box.
The control box may have over three terminals. After you have the correct size box and have fed the cable to it, you're almost prepared to permit the wiring begin. Then there's also a fuse box that's for the body controls that is situated under the dash. Beesclover Volt Ammeter Wiring Diagram. You will find that every circuit has to have a load and every load has to have a power side and a ground side. Make certain that the transformer nameplate power is enough to supply the load that you're connecting.
The bulb has to be in its socket. Your light can be wired to the receiver and don't require supply additional capacity to light as it can get power from receiver. In the event the brake lights aren't working, a police officer may block the vehicle and issue a warning to create the repair within a particular time limit. Even though you would still must power the relay with a power source or battery. Verify the power is off before trying to attach wires. In case it needs full capacity to begin, it won't operate in any way.
Replacing thermostat on your own without a Denver HVAC technician can be quite harrowing if you don't hook up the wiring correctly. After the plumbing was cut out, now you can get rid of the old pool pump. It's highly recommended to use a volt meter to make sure there is no voltage visiting the motor, sometimes breakers do not get the job done properly, also you might have turned off the incorrect breaker. Remote distance is left up to 500m. You may use a superior engine ground. The second, that's the most frequently encountered problem, is a weak ground in the computer system. Diagnosing an electrical short can be extremely tough and costly.
Don't ask me why I have such of an obsession with wires, but I do. My mother always said that ever since I've been able to walk, I would find things with wires and play with them and tear them apart, figure out how they worked and would be totally fascinated.
Related Wiring Diagram :
Top | 1,589 | 7,832 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.765625 | 3 | CC-MAIN-2019-35 | latest | en | 0.860769 |
http://oalevelsolutions.com/tag/vectors-2004/ | 1,632,822,643,000,000,000 | text/html | crawl-data/CC-MAIN-2021-39/segments/1631780060677.55/warc/CC-MAIN-20210928092646-20210928122646-00264.warc.gz | 44,380,678 | 9,585 | Hits: 377
# Past Papers’ Solutions | Cambridge International Examinations (CIE) | AS & A level | Mathematics 9709 | Pure Mathematics 1 (P1-9709/01) | Year 2004 | May-Jun | (P1-9709/01) | Q#9
Hits: 377 Question Relative to an origin , the position vectors of the points , , and are given by and where and are constants. Find i. the unit vector in the direction of , ii. the value of p for which angle , iii. the values of for which the length of is 7 units. Solution i. […]
# Past Papers’ Solutions | Cambridge International Examinations (CIE) | AS & A level | Mathematics 9709 | Pure Mathematics 1 (P1-9709/01) | Year 2004 | Oct-Nov | (P1-9709/01) | Q#8
Hits: 282 Question The points A and B have position vectors and respectively, relative to an origin O. i. Use a scalar product to calculate angle AOB, giving your answer in radians correct to 3 significant figures. ii. The point C is such that . Find the unit vector in the direction of Solution i. The angle AOB is the angle […] | 315 | 1,041 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.71875 | 3 | CC-MAIN-2021-39 | latest | en | 0.50927 |
https://www.hpmuseum.org/forum/printthread.php?tid=13807 | 1,721,554,143,000,000,000 | text/html | crawl-data/CC-MAIN-2024-30/segments/1720763517663.24/warc/CC-MAIN-20240721091006-20240721121006-00627.warc.gz | 692,966,883 | 6,035 | (41C) Pythagorean Triples - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: HP-41C Software Library (/forum-11.html) +--- Thread: (41C) Pythagorean Triples (/thread-13807.html) (41C) Pythagorean Triples - SlideRule - 10-15-2019 12:57 PM An extract from PROGRAMMABLE CALCULATORS Implications for the Mathematics Curriculum, Clearinghouse for Science, Mathematics and Environmental Education, Ohio State University, December 1980 "Independent Study with a Programmable Calculator … pg. 49 … The following material is an excerpt from Mathematical Recreations for the Programmable Calculator (Mohler and Hoffman, 1981) a collection of programming problems designed to teach the standard techniques of programming … Pythagorean Triples … pg. 50 … Write a program which searches out and finds all Pythagorean triples … PYTR Program for the HP-41C … pg. 77 … Parts of the extract are difficult to read BUT the HP-41C program listing is only slightly fuzzy near the bottom of the listing. BEST! SlideRule RE: (41C) Pythagorean Triples - Thomas Klemm - 06-25-2022 03:40 PM On page 26 we find: Quote:Our calculators used Reverse Polish Notation, which is a great convenience and posed no difficulty to the children. No one in this forum is surprised by that. I picked the problem to print primitive Pythagorean triples. Here's a program for the HP-42S: Code: 00 { 99-Byte Prgm } # 01▸LBL "PPT" # p 02 1ᴇ3 # 1000 p 03 ÷ # 0.ppp 04 2 # 2 0.ppp 05 + # i=2.ppp 06 STO 00 # i -> R00 07▸LBL 00 # for i in 2.ppp 08 RCL 00 # i 09 IP # m 10 STO 02 # m -> R02 11 2 # 2 m 12 MOD # m%2 13 1 # 1 m%2 14 + # b=m%2+1 15 RCL 02 # m b 16 1 # 1 m b 17 - # e=m-1 b 18 .02 # 0.02 e b 19 + # e.02 b 20 1ᴇ3 # 1000 e.02 b 21 ÷ # 0.eee02 22 + # j=b.eee02 23 STO 01 # j -> R01 24▸LBL 01 # for j in b.eee02 25 RCL 02 # m 26 RCL 01 # j m 27 IP # n m 28 STO 03 # n -> R03 29▸LBL 02 # ( m n -- gdc(m, n) ) 30 X<>Y # m n 31 RCL ST Y # n m n 32 MOD # m%n n 33 X≠0? # 34 GTO 02 # n' m' 35 R↓ # gcd(m, n) 36 1 # 1 gcd(m, n) 37 X≠Y? # gcd(m, n) ≠ 1 ? 38 GTO 03 # skip triple 39 RCL 03 # n 40 X↑2 # n^2 41 RCL 02 # m n^2 42 RCL× 03 # m*n n^2 43 STO+ ST X # 2*m*n n^2 44 RCL 02 # m 2*m*n n^2 45 X↑2 # m^2 2*m*n n^2 46 ENTER # m^2 m^2 2*m*n n^2 47 R↑ # n^2 m^2 m^2 2*m*n 48 STO- ST Z # n^2 m^2 m^2-n^2 2*m*n 49 + # m^2+n^2 m^2-n^2 2*m*n 50 CLA # "" 51 ARCL ST Y # "Y" 52 ├" " # "Y " 53 ARCL ST Z # "Y Z" 54 ├" " # "Y Z " 55 ARCL ST X # "Y Z X" 56 AVIEW # 57▸LBL 03 # resume 58 ISG 01 # j -> j+1 59 GTO 01 # 60 ISG 00 # i -> i+1 61 GTO 00 # 62 END # But it should also work with the HP-41C after the obvious transformations. Example 12 XEQ "PPT" 3 4 5 5 12 13 15 8 17 7 24 25 21 20 29 9 40 41 35 12 37 11 60 61 45 28 53 33 56 65 13 84 85 63 16 65 55 48 73 39 80 89 15 112 113 77 36 85 65 72 97 17 144 145 99 20 101 91 60 109 51 140 149 19 180 181 117 44 125 105 88 137 85 132 157 57 176 185 21 220 221 143 24 145 119 120 169 95 168 193 23 264 265 Make sure to SF 21 and hit R/S to get to the next triple. The program is based on the following Python program: Code: def primitive(m): for n in range(2 if m % 2 else 1, m, 2): if gcd(m, n) == 1: triple(m, n) def gcd(a, b): while b > 0: a, b = b, a % b return a def triple(m, n): a = m*m - n*n b = 2*m*n c = m*m + n*n print(f"{a} {b} {c}") for m in range(2, 13): primitive(m) References RE: (41C) Pythagorean Triples - C.Ret - 06-26-2022 09:29 AM (06-25-2022 03:40 PM)Thomas Klemm Wrote: But it should also work with the HP-41C after the obvious transformations. As usual, Thomas Klemm produces an excellent algorithm. I particularly like how the GCD determination is efficiently incorporated into the code. So I grabbed my HP-41C and its trusty 82240A to make the obvious transformations needed to aim and print: 01 LBL"PYTH" 02 STO 04 XEQ 04 04 LBL 01 05 RCL 04 STO 05 07 LBL 00 08 DSE 05 XEQ 02 DSE 05 GTO 00 12 DSE 04 GTO 01 14 GTO 04 15 LBL 02 16 RCL 04 RCL 05 18 LBL 03 19 STO Z MOD X≠0? GTO 03 23 10^X X≠Y? RTN 26 + CLA 28 RCL 04 ARCL X "┝," ST* Y X^2 STO Z 34 RCL 05 ARCL X ACA ST* Z X^2 ST+ T 40 - FMT ACX RDN ACX RDN ACX 47 LBL 04 48 ADV 49 END [attachment=10827] Shorter than the original code, this one just displays triples in a different order. RE: (41C) Pythagorean Triples - Thomas Klemm - 06-27-2022 05:51 AM With obvious transformations, I thought more of something like: STO+ ST X $$\mapsto$$ ST+ X. Thanks for improving my program. Using DSE instead of ISG avoids the calculation of the index. Also by using it twice in a row we still use a step size of 2: Code: 07 LBL 00 08 DSE 05 XEQ 02 DSE 05 GTO 00 I should have remembered that with STO Z we also have tuck ~ swap over: Code: 18 LBL 03 19 STO Z MOD X≠0? GTO 03 I would probably rather use SIGN instead of 10^X to map $$0 \mapsto 1$$ but its nice to add both $$1 + 1 = 2$$ and use the result as a factor when calculating $$2 \cdot m \cdot n$$ in the following steps: Code: 23 10^X X≠Y? RTN 26 + CLA I wasn't aware of FMT or probably just forgot about it. It makes for a nice listing: Code: 40 - FMT ACX RDN ACX RDN ACX Well done! RE: (41C) Pythagorean Triples - Ángel Martin - 06-29-2022 01:02 PM very timely: https://www.youtube.com/watch?v=QJYmyhnaaek Great visual content for math, love that channel/ RE: (41C) Pythagorean Triples - John Keith - 07-01-2022 11:55 AM (06-29-2022 01:02 PM)Ángel Martin Wrote: very timely: https://www.youtube.com/watch?v=QJYmyhnaaek Great visual content for math, love that channel/ That was a great video, thanks for posting! Additionally, Berggren's method does not require GCD and is pretty fast and simple on any calculator that can handle matrices. It generates all primitive triples but in a different order than the complex squaring method. RE: (41C) Pythagorean Triples - C.Ret - 07-03-2022 08:18 AM (07-01-2022 11:55 AM)John Keith Wrote: Additionally, Berggren's method does not require GCD and is pretty fast and simple on any calculator that can handle matrices. It generates all primitive triples but in a different order than the complex squaring method. Thanks for pointing out this method which easily produces tons of primary Pythagorean triples using a very simple recursive program on an advanced calculator natively manipulating vectors and matrices: PYT: « 1 + [[ 1 2 2 ][ 2 1 2 ][ 2 2 3]] → T n M $$T=\left[a_0,b_0,c_0 \right]$$ « " " 1 n 2 * SUB T →STR + PR1 STR→ IF n N < THEN M T 2 DUP2 GET NEG PUT * n PYT $$\left[a_1,b_1,c_1\right]=\begin{bmatrix}1&-2&2\\2&-1&2\\2&-2&3\\\end{bmatrix}\times \left [ a_0,b_0,c_0 \right ]=\begin{bmatrix}1&2&2\\2&1&2\\2&2&3\\\end{bmatrix}\times \left [ a_0,-b_0,c_0 \right ]$$ M T * n PYT $$\left[a_2,b_2,c_2\right]=\begin{bmatrix}1&2&2\\2&1&2\\2&2&3\\\end{bmatrix}\times \left [ a_0,b_0,c_0 \right ]$$ M T 1 DUP2 GET NEG PUT * n PYT $$\left[a_3,b_3,c_3\right]=\begin{bmatrix}-1&2&2\\-2&1&2\\-2&2&3\\\end{bmatrix}\times \left [ a_0,b_0,c_0 \right ]=\begin{bmatrix}1&2&2\\2&1&2\\2&2&3\\\end{bmatrix}\times \left [ -a_0,b_0,c_0 \right ]$$ END » » Store max depth into N register: 4 'N' STO Set printer online, aim to it and print by typing: [ 3 4 5 ] 0 PYT [attachment=10836] RE: (41C) Pythagorean Triples - Thomas Klemm - 07-03-2022 10:46 AM (07-03-2022 08:18 AM)C.Ret Wrote: using a very simple recursive program on an advanced calculator natively manipulating vectors and matrices Do you mind posting the program? Nice receipt by the way. I'd rather have it than the ones I usually get. RE: (41C) Pythagorean Triples - C.Ret - 07-03-2022 01:41 PM (07-03-2022 10:46 AM)Thomas Klemm Wrote: (07-03-2022 08:18 AM)C.Ret Wrote: using a very simple recursive program on an advanced calculator natively manipulating vectors and matrices Do you mind posting the program? Sorry, as I posted this morning, I was so caught up in my attempt to come up with a version for HP-41, that I completely forgot to post the code for HP-28S. Tonight, after a day full of other Sunday activities, my version for HP-41 is still not finalized. I believe I will revise the way I support recurring calls as well as matrix products in my HP-41C. RE: (41C) Pythagorean Triples - John Keith - 07-03-2022 01:55 PM (07-03-2022 08:18 AM)C.Ret Wrote: PYT: « 1 + [[ 1 2 2 ][ 2 1 2 ][ 2 2 3]] → T n M « " " 1 n 2 * SUB T →STR + PR1 STR→ IF n N < THEN M T 2 DUP2 GET NEG PUT * n PYT M T * n PYT M T 1 DUP2 GET NEG PUT * n PYT END » » Store max depth into N register: 4 'N' STO Set printer online, aim to it and print by typing: [ 3 4 5 ] 0 PYT That's a great program! I'm glad you posted it before I posted my sad attempt. | 3,818 | 9,543 | {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 1, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.53125 | 4 | CC-MAIN-2024-30 | latest | en | 0.570101 |
https://community.opendronemap.org/t/sequoia-sunshine-sensor-support/8603 | 1,680,115,240,000,000,000 | text/html | crawl-data/CC-MAIN-2023-14/segments/1679296949025.18/warc/CC-MAIN-20230329182643-20230329212643-00499.warc.gz | 213,391,201 | 7,461 | # Sequoia Sunshine Sensor Support
I have uploaded OpenDroneMap to GitHub, which supports reading the sunshine sensor value of the Sequoia camera.
The algorithm for calculating the reflectance of an object from the “pixel intensity of the image” and the “sunshine sensor values” has been reviewed and improved so that the reflectance image for each wavelength is the correct value.
Even without photographing the standard calibration plate, the correct reflectance can be obtained “to some extent” by using the “calibration coefficients that vary from individual to individual” in the Exif.
Also, additional calibration coefficients can be given as an option during the ODM calculation to increase the certainty of the reflectance values.
2 Likes
Hey @ckato3 thanks for the contribution! It looks very useful. I’m wondering, how do you calculate the additional calibration coefficients? I wonder if there’s a way to partially automate that step, or perhaps provide a workflow that is easier (e.g. provide a single JSON file with the calibration coefficients instead of adding new 8 command line parameters, as we’re trying to keep the number of command line arguments under control).
2 Likes
I understand, like, 10% of what you did, but it sounds 100% awesome!
Thanks for your contribution!
It is cumbersome to create a software tool that can (semi-)automatically determine the calibration coefficients that are unique to each individual camera.
It is necessary to capture standard grayscale images with several different exposure times and other conditions, and then analyze the resulting images to determine the parameters.
So, I devised a way to obtain the correct reflectance to some extent, without specifying additional calibration coefficients on the user side, just using the factory calibration coefficients in the Exif.
However, with the camera I use, I had to specify some additional calibration coefficients.
If we omit parameters such as ISO sensitivity and exposure time, the conceptual formula for the calculation is as follows:
Reflectance
= proportionality_constant_A x (pixel_intensity - black_level_B) / sunshine_value
In my camera, the proportionality_factor_A is the default value of 0.5, while the calibration values I obtained are Green=0.56, Red=0.39, Rededge=0.41, NIR=0.49, so it is not extremely far off.
However, the black_level_B was significantly off only for GREEN band, and required additional correction.
The factory calibration factor in the Exif is about 4000, but I had to add about 2000 more.
Normally, the correct calibration coefficients should be provided by the camera manufacturer, but in reality, this does not seem to be the case.
1 Like
In order to reduce the total number of command line arguments, it is effective to load a text file (JSON file ?) with additional calibration coefficients at the time of ODM calculation.
However, as a beginner in Python, it would be difficult for me to write such program code.
Also, my coding may cause inconsistency in the overall flow of the ODM program.
I think it would be best if pierotofy coded the program using the root of the calculation in the source code I have PullRequest.
(I am noy a native speaker of English, so I am using translation software to help me, so please forgive my poor English.)
1 Like
Makes sense; I can try to find some time to make the necessary changes to use a single JSON file.
I’ve noticed from the PR that the code logic for computing the reflectance only gets triggered with the condition that the dataset is captured from a Parrot Sequoia. Do you think the PR would work with other sensors too?
1 Like
I think the ability to make additional corrections to the calibration coefficients would be useful for other sensors as well.
I am considering buying the DJI P4 Multispectral due to the fact that drones equipped with my Sequoia camera are unpowered and have limitations on flight altitude and flight time.
I should be receiving my 3-day rental of the P4 Multispectral today !
I plan to improve the code so that ODM can be used with the P4 Multispectral.
2 Likes
After reviewing ODM’s multispectral analysis routines, in addition to the Sequoia Camera, the DJI P4 Multispectral can now support reflectance and NDVI measurements using the Sunshine Sensor. We will make a “Pull Request” as soon as possible.
As for the P4 Multispectral, the current official ODM version has some issues with EXIF dark level and gain readout, etc., resulting in different or streaked reflectance and NDVI map values, which we have fixed. Also, additional correction coefficients are needed to compensate for individual camera differences, so we have made it possible to specify 2 additional parameters per band (10 parameters for 5 bands, Blue Green Red RedEdge and Near-Infrared).
2 Likes
Absolutely bang-up stuff! Sounds incredible!
Will you have any examples of before/after and other documentation/comments on this?
It sounds massive, so I’d like to make sure I get it into our Documentation once it gets approved.
1 Like
This is awesome ckato3 !
Would you be able to condense/aggregate all the upcoming changes into a single pull request? It will make it easier to integrate.
2 Likes
Examples of NDVI ortho map calculation results are shown below.
Tiff files of “DJI P4 Multispectral” are sample set by navogt.
[Phantom 4 Multispectral Test Data - Google Drive ]
(Phantom 4 Multispectral Test Data - Google Drive)
In the official version, there are striped steps on the road and in the forest, and the NDVI value itself deviates from the expected value of around 0.8.
(1) Official ODM 2.6.1
(2) Modified ODM from 2.6.1
2 Likes
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed. | 1,240 | 5,782 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.578125 | 3 | CC-MAIN-2023-14 | latest | en | 0.894706 |
https://www.jiskha.com/questions/1780961/the-height-h-of-an-object-projected-upward-from-the-floor-of-the-golden-gate-bridge-which | 1,591,247,316,000,000,000 | text/html | crawl-data/CC-MAIN-2020-24/segments/1590347439019.86/warc/CC-MAIN-20200604032435-20200604062435-00245.warc.gz | 762,016,739 | 5,855 | # math
The height h of an object projected upward from the floor of the Golden Gate Bridge which has an initial height of 220 feet and with an initial velocity of 30 feet per second is given by h=-16t^2+30t+220. How many seconds later will the rock hit the water? Round to the nearest tenth. Please help ASAP!!! :(
1. 👍 0
2. 👎 0
3. 👁 185
1. Assuming that the 200 feet is the height above the water,
-16t^2+30t+220 = 0
8t^2 - 15t - 110 = 0
1. 👍 1
2. 👎 0
## Similar Questions
1. ### Math
The formula h=48t-16t^2 gives the height, h, in feet, of an object projected into the air after t seconds. If an object is propelled upward, at what time(s) will it reach a height of 32 feet above the ground?
asked by Robert on July 27, 2011
2. ### Physics
The drawing shows two frictionless inclines that begin at ground level (h = 0 m) and slope upward at the same angle θ. One track is longer than the other, however. Identical blocks are projected up each track with the same
asked by jim on October 21, 2012
3. ### science
Suppose that the 1.3 km span of the golden gate bridge had no expansion joints. Calculate how much longer the bridge would be if the temperature of the bridge increases by 35 degrees celsious
asked by Joey on March 1, 2013
The height of an object projected upward from ground level is given by h=-16t squared + 128t. When will the object be 240 feet above the ground? (Please provide steps/explanation to solve this problem.)
asked by purpletree on March 29, 2009
5. ### college algebra
The height of an object thrown upward with an initial velocity of 96 feet per second is given by the formula h = -16t2 + 96t, where t is the time in seconds. How long will it take the object to reach a height of 144 feet?
asked by erin on September 22, 2010
1. ### riddles
what do you call the golden gate bridge at 5.pm put this riddle on the Riddle section. http://www.jiskha.com/net_riddle/
asked by me on June 7, 2007
2. ### physics
A particle, starting from point A in the drawing at a height h0 = 3.2 m, is projected down the curved runway. Upon leaving the runway at point B, the particle is traveling straight upward and reaches a height hf = 4.1 m above the
asked by Anonymous on December 8, 2011
3. ### College Physics
6. A tall bald student (height 2.1 meters and mass 93.1 kg) decides to try bungee jumping from a bridge. The bridge is 36.7 meters above the river and the "bungee" is 25.3 meters long as measured from the attachment of the bridge
asked by Jane on June 29, 2011
4. ### physics
An elevator without a ceiling is ascending with a constant speed of 9.7 m/s. A boy on the elevator shoots a ball directly upward, from a height of 2.0 m above the elevator floor, just as the elevator floor is 25 m above the
asked by kay on September 21, 2010
5. ### Math : Statistics
The formula h=vt−16t^2 gives the height h, in feet, of an object projected into the air with an initial vertical velocity v, in feet per second, after t seconds. If an object is projected upward with an initial velocity of 112
asked by Keonn'a on November 2, 2018
6. ### Physics
A stone is thrown upward from a bridge at a speed of 10 m/s. It narrowly misses the bridge on the way back down, and hits the water at 30m/s. what is the approximate height of the bridge?
asked by Anonymous on July 8, 2014 | 929 | 3,318 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.578125 | 4 | CC-MAIN-2020-24 | latest | en | 0.941456 |
http://mathforum.org/kb/message.jspa?messageID=6519058 | 1,516,738,553,000,000,000 | text/html | crawl-data/CC-MAIN-2018-05/segments/1516084892238.78/warc/CC-MAIN-20180123191341-20180123211341-00474.warc.gz | 203,154,195 | 5,277 | Search All of the Math Forum:
Views expressed in these public forums are not endorsed by NCTM or The Math Forum.
Notice: We are no longer accepting new posts, but the forums will continue to be readable.
Topic: fourth grade geometry question???
Replies: 6 Last Post: Dec 3, 2008 3:14 PM
Messages: [ Previous | Next ]
Steve Cooke Posts: 187 Registered: 2/28/08
Re: fourth grade geometry question???
Posted: Dec 3, 2008 3:14 PM
>
> On 28 Aug 02 23:22:36 -0400 (EDT), Diane wrote:
> > Draw a quadrangle that has 2 pairs of equal sides
> but is NOT a
> > parallelogram.
> > Does this seem like 4th grade to anyone? I finally
> got the answer but
> > we have no book to use as a reference.
>
Another take on this question since I am sure it will come up again:
Start with a pair of equal sides that share a common vertex. Imagine the two equal sides of an isosceles triangle without the base. Now creates a second pair but with the length different from the first.
Now that you have two pair of sides, each pair having the same length, how can you join them? You can set them so the open end of each has the same span and point them away from each other like this "<>" to make what is called a kite. Is that the only way? You can also turn them with the smaller pair inside the larger like this ">>" to make what is called a dart.
Are those the only combinations with those two pairs? If instead of two pair of equal length, what if you start with two pair of unequal length but having two common lengths between them. What figure is created by joining those pairs? Have you exhausted all possibilities?
Date Subject Author
1/31/05 Melinda
1/31/05 NealAgMan@nyc.rr.com
9/25/08 Dina
2/1/05 Walter Whiteley
12/3/08 Steve Cooke
8/14/06 leonora | 461 | 1,751 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.9375 | 3 | CC-MAIN-2018-05 | longest | en | 0.941531 |
https://forums.welltrainedmind.com/topic/479777-i-need-math-help/ | 1,701,720,195,000,000,000 | text/html | crawl-data/CC-MAIN-2023-50/segments/1700679100534.18/warc/CC-MAIN-20231204182901-20231204212901-00797.warc.gz | 312,097,593 | 30,164 | # I need math help!
## Recommended Posts
My daughter will be 7 in october she is in 1st grade and I am struggling with math. I don't even really think its math but just numbers in general. She struggles with number recognition, counting by 2s and 5s, Identifying many numbers (11, 12, 13, 15, then several others) we have been working on identifying and remembering numbers up to 100 for over a year now. She will get it then the next day it's gone again. Some days it doesn't even take a day but I can tell her what something is and then 2 minutes later she's telling me she "forgot" again. It is driving me insane, I know she hates math and is getting frustrated. She has memorized her addition and subtraction facts up to 10, gets greater than and less than, seems to understand place value but it's just the actual numbers she can't remember. Reading, spelling, etc she breezes through but we are struggling with this.
Any suggestions in programs? We have done a lot of number charts and it just doesn't stick with her. And we use Singapore math this year and did Mcruffy last year.
##### Share on other sites
Hmmm? I'm brainstorming here. Is she a more verbal learner? In general you want to separate out a weak skill and work on it separately in small frequent increments while continuing to move forward conceptually in the math. This could be done in several ways. Counting by 2's and 5's. First step ( she may already have this) build it ( with rods build all of the numbers in the series) and say it( 2,4,6,8,10...). Second step -Build it, say it, and draw it ( draw the rods in color) on a paper folded into as many squares as you want her to cover. third step Build it, say it, draw it, and write it (print dotted traceable numbers 4-6 of them per square for her to trace with her pencil. 2,2,2,2,2,...) Fourth step (start removing the support) say it, write it ( give her the same divided paper with some of the numbers missing) Let her build the set of numbers if she needs too. Fifth step write it on blank paper. Each step you would do or modify till she felt successful. Then do similar work on the next weak spot. Don't skip writing the numbers. It hits the brain again on a different motor channel.
Continuing with Singapore. Make a cheat sheet with the number, rod picture, and the number word. Put it in a special folder where it takes some extra work to go get it if she needs it. The cheat sheet would not be used in the targeted practice above.
Just a side note- the teen numbers 11-19 are troublesome because of how they are named. Some programs even rename them ten -one, ten -two, etc. It would be fine to say them this way. And work on counting names separately just like we learn the alphabet names and sounds.
Hugs, Melody
Happy Dividing and Conquering.
##### Share on other sites
She's young. She has plenty of time. And math is MUCH more than just numbers. Therefore: Do something else---still math, but not numbers. Come back to numbers later, after the emotional baggage has had plenty of time to clear.
Look at these three blogs for lots of creative suggestions:
Or if you have trouble imagining how powerful math can be without numbers, get the Moebius Noodles book. The paperback price is very reasonable, or you can set your own price for the pdf.
## Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
× Pasted as rich text. Paste as plain text instead
Only 75 emoji are allowed. | 829 | 3,513 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.828125 | 4 | CC-MAIN-2023-50 | latest | en | 0.974289 |
https://www.coursehero.com/file/6290484/lec1102/ | 1,527,014,055,000,000,000 | text/html | crawl-data/CC-MAIN-2018-22/segments/1526794864837.40/warc/CC-MAIN-20180522170703-20180522190703-00552.warc.gz | 707,508,865 | 123,106 | {[ promptMessage ]}
Bookmark it
{[ promptMessage ]}
# lec1102 - Some Algebra Rules Laws of exponent and Logarithm...
This preview shows pages 1–4. Sign up to view the full content.
Some Algebra Rules ... Laws of exponent and Logarithm: If a > 0, a x a y = a x + y ( a x ) y = a xy a x / a y = a x y a x = 1 / ( a x ) If b > 0 and b 1, log b ( xy ) = log b x + log b y log b ( x / y ) = log b x log b y log b ( x p ) = p log b x . Rules of inequalities: a > b a + c > b + c if c > 0, then a > b a c > b c if a > b and b > c a > c ; if a > b and c > d a + c > b + d . Useful algebra rules: ab = 0 a = 0 or b = 0 if bd 0, then a / b = c / d ad = bc ; ( a + b ) 2 = a 2 + 2 ab + b 2 ; ( a + b )( a b ) = a 2 b 2 .
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
A couple of summation rules = n i i f 1 ) ( = = m i i f 1 ) ( + + = n m i i f 1 ) ( , if 1 m < n. = b a i i f ) ( = = b i i f 1 ) ( - - = 1 1 ) ( a i i f , if b a > 1. = n i i f 1 ) ( = = - + n i i n f 1 ) 1 (
Couple More Examples: 1) Prove = n i i H 1 = (n+1)H n – n, using induction. Note that H n = = n i i 1 1 Use induction on n>0. Base case: n=1. LHS = 1/1 = 1 RHS = (1+1)(1/1) – 1 = 1 Assume for some n=k, = k i i H 1 = (k+1)H k – k Under this assumption, we must prove the formula for n = k+1: + = 1 1 k i i H = (k+2)H k – (k+1) + = 1 1 k i i H = ( = k i i H 1 ) + H k+1 = (k+1)H k – k + H k+1 , using inductive hypothesis.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview. Sign up to access the rest of the document.
{[ snackBarMessage ]}
### What students are saying
• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.
Kiran Temple University Fox School of Business ‘17, Course Hero Intern
• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.
Dana University of Pennsylvania ‘17, Course Hero Intern
• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.
Jill Tulane University ‘16, Course Hero Intern | 841 | 2,590 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 4.0625 | 4 | CC-MAIN-2018-22 | latest | en | 0.77552 |
http://barrywatson.se/dd/dd_minterm.html | 1,716,855,272,000,000,000 | text/html | crawl-data/CC-MAIN-2024-22/segments/1715971059055.94/warc/CC-MAIN-20240528000211-20240528030211-00883.warc.gz | 2,925,306 | 1,787 | # Minterm
A minterm is the Boolean algebra expression formed by taking a row of a truth table and forming an `and` function where the inputs are the input variables of the row. Each minterm variable will be negated if the same variable takes `0` in the row, otherwise the variable is unnegated. The minterms are often numbered, one for each row, and named mi for row i. We can form an expression as a sum of products which is equivalent to the function of the truth table by applying the `or` function to all the minterms whose function result is `1`.
## Example
The truth table for the half adder, with a column showing the minterm, is as follows:
` A `` B `` S `` C `minterm
`0``0``0``0`m0
`0``1``1``0`m1
`1``0``1``0`m2
`1``1``0``1`m3
If we were only interested in the sum output `S` then we see that both minterms m1 and m2 give an output of `1` for `S` and this gives the sum of products equivalent of `(not(A) and B) or (A and not(B))`. We know that the equation for `S` is `S = A xor B`, so our sum of products result is correct.
## References
Mano, M. Morris, and Kime, Charles R. Logic and Computer Design Fundamentals. 2nd Edition. Prentice Hall, 2000. | 345 | 1,168 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.9375 | 3 | CC-MAIN-2024-22 | latest | en | 0.872098 |
uk-scientific.com | 1,550,524,553,000,000,000 | text/html | crawl-data/CC-MAIN-2019-09/segments/1550247488374.18/warc/CC-MAIN-20190218200135-20190218222135-00151.warc.gz | 292,980,722 | 6,686 | EXPERIMENTSINMECHANICS
UME-06 Rotation
Rotating apparatus for determining angular acceleration as a
function of the torque and for determining the moment of inertia
depending on mass and distance from an axis.
An axle on agate bearings supports a cross bar to which weights
can be attached. The force from a driving weight is conveyed to
the axle via a string wrapped around the axle and passed over a
pulley and a second multiple pulley on the axle itself.
UME-05 ARCHIMEDES PRINCIPLE
calculated according to Archimedes' principle
when the weight of the displaced fluid is
determined. The "Archimedes' cylinder" clearly
demonstrates this principle.
UME-08 FALLING SPHERE VISCOMETER
Höppler-type falling sphere viscometer for simple but
accurate The sphere rolls and slides inside an inclined
cylindrical tube filled with the fluid to be tested. The viscosity
is measured in mPa s and is derived directly from the time
the sphere takes to fall a specified distance through the fluid
in the measuring tube. The tube can then be turned
upside-down so that time the sphere takes to fall back can
also be measured. The tube is situated inside a water bath,
which can be filled with water at a specific temperature in
order to measure how viscosity depends on temperature.
UME-03 NEWTON's SECOND LAW
Law, and the relationship between The distance-time law,
the velocity time law, and the relationship between mass,
acceleration and force are determined with the aid of the
demonstration track rail for uniformly accelerated motion
in a straight line.
UME-02 Hooke's law
In this experiment the deformation which is caused
by the weight of "mass pieces" on two
helical springs is measured. The deformation is a
characteristic feature of each spring,
nevertheless one can observe that a fundamental
law is ruling here. It is the goal of this
experiment to verify this law - Hooke's Law.
UME-01 Measuring of the basic constants
LENGTH
VOLUME
WEIGHT
TIME
UME-09 SHM PENDULUM
A mass, considered as of point form, suspended on a thread
and subjected to the force of gravity, is deflected from
oscillation thus produced is measured as a function of the
thread length and the angle of deflection.
UME-12PENDULUM USING SPRING
Determine the oscillation period T of a spring
pendulum for various masses m on two springs with
different spring constants D.
UME-07 FREE FALL
Apparatus for measuring the time it takes for a
ball to fall a certain distance using a digital
timer. Very easy to set up and use but
nevertheless highly A micro-magnet holds the
ball in its start position. Three contact pins
under the release mechanism ensure that the
start position of the ball can be reproduced and
act as the contacts of a switch that opens when
the ball is released, thus triggering the
beginning of the timing measurement. When the
ball strikes the contact plate at the bottom, the
timer is stopped. The ball is also held firmly on
the plate so that it does not bounce. The height
through which the ball drops can be adjusted to
a fraction of a millimetre and read off a scale on
the column.
UME-10 STATIC AND DYNAMIC TORSION
To investigat torsion as applied to bars with cylindrical
geometry and to determine both directivity values and shear
modulus.
UME-13 SURFACE TENSION OF LIQUID
A blade is immersed horizontally in the liquid and is
slowly pulled out upwards while measuring the
pulling force. The lamella of liquid that forms at the
blade “breaks away” when the force exceeds a
certain value. From this force and the length of the
blade one can calculate the surface
tension.
UME-14 Mechanical waves
Some examples of where mechanical waves arise include a stretched coil
spring, where the waves are longitudinal, or a taut rope where the waves
are transverse. In either case, standing waves will be set up if one end of
the carrier medium is fixed. This is because the incoming wave and the
wave reflected at the fixed end have the same amplitude and are
superimposed on one another. If the other end is also fixed, the only way
that waves can propagate is if resonance conditions are met. In this
experiment the coil spring and the rope are fixed at one end. The other
end, a distance L from the fixed point, is fixed to a vibration generator,
which uses a function generator to drive of variable frequency f. This end
can also be regarded as a fixed point to a good approximation.
The intrinsic frequency of the vibration will be measured as a function of the
number of nodes in the standing wave. The speed of propagation of the
wave can then be calculated from this data.
UME-04
To measure the coefficient of friction for use
of an inclined plane.
UME-11 STATIC AND DYNAMIC TORSION
To investigat torsion as applied to bars with
cylindrical geometry and to determine both
directivity values and shear modulus. | 1,097 | 4,810 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.734375 | 3 | CC-MAIN-2019-09 | longest | en | 0.922067 |
https://forum.allaboutcircuits.com/threads/positive-feedback-hysteresis-do-i-understand-resistor-purpose.98534/ | 1,508,833,405,000,000,000 | text/html | crawl-data/CC-MAIN-2017-43/segments/1508187828189.71/warc/CC-MAIN-20171024071819-20171024091819-00152.warc.gz | 699,472,791 | 20,120 | # Positive feedback hysteresis - Do I understand resistor purpose?
Discussion in 'General Electronics Chat' started by MrJojo, Jun 11, 2014.
1. ### MrJojo Thread Starter Member
Jan 23, 2013
45
0
Hello all,
I've been trying to figure out the point of positive feedback for a bit now. I understand that negative feedback is used to stabilize a circuit and positive feedback is used to create basically a comparator. I started off at this post http://forum.allaboutcircuits.com/showpost.php?p=444315&postcount=9. It is a post by Jony310 which he explains what happens when affecting either input terminal and what will happen at the output w/o feedback and then shows what happens when a resistor is used as negative feedback and discusses what happens inside the op amp when said resistor is used w/ neg and pos feedback.
I then started went to the online book from AAC - http://www.allaboutcircuits.com/vol_3/chpt_8/12.html - and checked out the positive feedback section. From here I confirmed that positive feedback is basically a comparator and that you can use a resistor to create a sort of hysteresis. Assume V in is a sine wave from -5 to 5, and the upper limit of the hysteresis is +2 V and lower limit is -2V, then the op amp would remain positive once the voltage in goes about the upper limit (+2V) and remains positive until going below the lower limit (-2V) and rinse and repeat.
Finally I started looking around for a positive feedback equation where I can use the positive feedback resistor to set my hysteresis - http://forum.allaboutcircuits.com/showpost.php?p=298747&postcount=4 - t_n_k has an equation from that post stating the hysteresis is found by (Voh-Vol)*R14/(R42+R14) These values can be found at the attachment below labeled AAC_help_forum_post.
So all that being said, now I present my circuit - which is an example for what I'm actually trying to do and can be found at AAC_help_my_circuit. So the voltage at pin 7 should be ~ 5V and the voltage at pin 6 should be 6V. From that means that the center point is 5V and using the equation from t_n_k (Voh = 10V, Vol =0V), my hysteresis is 10V. So that means the upper limit is 15V and the lower limit is -5V, correct? I understand I cant reach these values, but this is just an example of something I threw together really quick.
File size:
240.1 KB
Views:
26
File size:
23.5 KB
Views:
19
Feb 17, 2009
4,175
1,188
3. ### MrJojo Thread Starter Member
Jan 23, 2013
45
0
Jony130,
First, did I understand your post correctly? I think I did and I was trying to give a brief summation vs a butchering (which I'm hoping I didn't >.<)
I'm trying to figure out a temperature sensing circuit. A bud gave me a circuit he was having troubles with and I said I'd take a look at it. The image I posted is basically the same thing as what he gave me, only the values are changed and there is a pull up resistor at pin2 of the op amp to 12V.
Right now, I'm trying to figure out if I have an understanding of the positive feedback resistor and then what is the true temp range of the actual circuit.
I'm reading up on the open collector page right now.
Matt
4. ### MrJojo Thread Starter Member
Jan 23, 2013
45
0
Jony310,
Thanks for bringing the open-collector situation to my attention, I know understand why the pull up resistor is there in the first place!
So if I'm understanding the open-collector correctly, does this mean that the IC's output is inverted? I ask because of
Matt
5. ### Jony130 AAC Fanatic!
Feb 17, 2009
4,175
1,188
OK I see, I add 1KΩ pull-up resistor. And remove input voltage divider.
For Vin = 0V the voltage at non-inverter input is equal to
$Vp = Vcc *\frac{(Rp + R5)||R3}{((Rp + R5)||R3) + R4}= 6.26V$
Now let as assume that input voltage ramp up from 0V to 10V
For Vin = 0V and Vp = 6.2V--->Vout ≈ 12V because Vp - Vp > 0 and LM339 output transistor is off.
For Vin > 6.2V the LM339 will turn-on his output transistor and shorts the output to ground. So the new non-inverter voltage is now equal to:
Vp = Vcc* R3/(R3 + R5||R4) = 5.71V. And Vp - Vn < 0 and that's why LM's output transistor is turn on and Vout ≈ 0V
Any further increase in Vin will have no effect on the output (0V at output).
What we can do is to ramp down our Vin.
And again nothing happens until Vin = Vp = 5.71V then again Vp - Vn change the sign and LM339 turn-off his output transistor. And Vout goes to Vout ≈ 12V and Vp change to 6.2V
As you can see we have upper and lower threshold voltage
Vth1 = 6.2V and Vth2 =5.7V
http://www.bristolwatch.com/ele/vc.htm
File size:
28.8 KB
Views:
21
• ###### 3.PNG
File size:
17.6 KB
Views:
18
Last edited: Jun 11, 2014
6. ### MrChips Moderator
Oct 2, 2009
14,523
4,282
Do not confuse open-collector output and inverted output.
They are two different issues.
The output can be open-collector or non-open-collector.
The output could be inverted or non-inverted.
7. ### MrJojo Thread Starter Member
Jan 23, 2013
45
0
@MrChips,
I don't know the proper term for what I'm thinking of, but the way my brain has associated open-collector is like a not gate, when there is voltage present at the base, it outputs ground and when there is no voltage present, it outputs Vcc. Is that a generalization or should I just not think like that for the open-collector output?
@Jony310,
I've gotten about half way though the article you linked me and I think I get it, but I'm not 100% positive. so from what I'm gathering, when the + terminal > - terminal, the transistor inside of the LM339 is open and vice versa for - > +. That means when the + > -, the output will go towards the Vcc line due to the pull up resistor. When - > +, the output will go towards ground due to the internal ground from the open-collector transistor, correct?
Matt
8. ### Jony130 AAC Fanatic!
Feb 17, 2009
4,175
1,188
Yes, exactly. But this is nothing new, so you shouldn't be surprised. Because this is how op amp work.
9. ### MrJojo Thread Starter Member
Jan 23, 2013
45
0
@Jony130
Yes, agree, but it's strange for me to think that it is all based on the pull up resistor though. I guess that's what is throwing me through the loop along with I never really understood the inside of the op amp - it was like the magic smoke to me. Plus that was to make sure I understood the basic circuit before I ask the following question.
So I tried to draw an equivalent circuit for the op amp under the two conditions. The one on the left is when the + terminal > - terminal. The one on the right is - terminal > + terminal. So at TP1 the equation to solve for that would be
$Vp = Vcc *\frac{(Rp + R5)||R3}{((Rp + R5)||R3) + R4}= 6.26V$ while at TP2, the equation is Vp = Vcc* R3/(R3 + R5||R4) = 5.71V, correct? That means to me that when +>-, the current flows from the + terminal -> R5 -> Rp -> +12, while ->+ current flows +terminal -> R5 -> GND.
I think I truely understand what is going on in this circuit now, I'm just going into explicit details here to verify my understanding is correct.
Matt
File size:
13.6 KB
Views:
14
10. ### Jony130 AAC Fanatic!
Feb 17, 2009
4,175
1,188
At first glance you can treat lm339 as a ordinary op amp plus additional NPN transistor connected to the op amp output.
Are you sure about that ? Op amp input current is very low. So none current can flow into op amp input terminals.
Current flow like this
File size:
3 KB
Views:
88
File size:
32 KB
Views:
17
File size:
32.3 KB
Views:
15
11. ### crutschow Expert
Mar 14, 2008
16,576
4,478
To clarify, the LM339 input polarity refers to the output with a pull-up resistor. Thus if the (+) input is greater than the (-) input, the output goes high (output transistor is cut off).
12. ### MrJojo Thread Starter Member
Jan 23, 2013
45
0
@Jony130,
For the case of Vp>Vn, that is what I thought happened, but looking back, I had my direction of current backwards. As for the case of VP<Vn, I didn't account for the Rp. But would that matter? I mean the 1k pull up is basically going to ground so my thoughts are it wouldn't affect the R3||(R4+R5) network.
matt
13. ### Jony130 AAC Fanatic!
Feb 17, 2009
4,175
1,188
Yes, Rp has no effect on Vp voltage.
14. ### MrChips Moderator
Oct 2, 2009
14,523
4,282
It may be true that the open-collector output is implemented with a common emitter BJT as you have described. The consequence is that the logic output at the collector is reversed from that at gate. That is because the common emitter BJT configuration is an inverting amplifier. So the BJT performs a logical NOT function.
But all of that should be of no concern when discussing the operation of an analog comparator with open-collector output.
What you need to know is, when the voltage at the +ve input exceeds the voltage at the -ve input, is the output logic LOW or HIGH. For the correct answer you have to look up the datasheet. | 2,425 | 8,831 | {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 2, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.3125 | 3 | CC-MAIN-2017-43 | latest | en | 0.905878 |
https://goopennc.oercommons.org/browse?f.new_nc_alignment=NC.Math.K.OA.3 | 1,725,762,133,000,000,000 | text/html | crawl-data/CC-MAIN-2024-38/segments/1725700650958.30/warc/CC-MAIN-20240908020844-20240908050844-00513.warc.gz | 277,692,395 | 17,779 | Updating search results...
# 60 Results
View
Selected filters:
• NC.Math.K.OA.3 - Decompose numbers less than or equal to 10 into pairs in more than one...
• NC.Math.K.OA.3 - Decompose numbers less than or equal to 10 into pairs in more than one...
Rating
0.0 stars
Students decompose numbers less than or equal to 10 into pairs in more than one way by using objects or drawings, and they will record each decomposition by a drawing or equation (e.g. 5= 2 + 3 and 5 = 4+1).
Subject:
Mathematics
Material Type:
Activity/Lab
Provider:
K-5 Math Teaching Resources
Author:
K-5 Math Teaching Resources
02/26/2019
Rating
0.0 stars
In this activity students will demonstrate an understanding that addition is putting together. Students will show and explain with pictures, words or a number sentence that 3 plus 7 is 10 not 9. They will put together different combinations of apples and bananas to represent different addition sentences. A task card and rubric are provided. To access this task, click on the link, scroll down to the title Apples and Bananas, click on it and the task will open.
Subject:
Mathematics
Material Type:
Activity/Lab
Provider:
Hawaii State Department of Education
Author:
Hawaii State Department of Education
02/26/2019
Rating
0.0 stars
In this assessment students will solve an addition word problem three different ways. Students should have two sided bean counters to assist them with solving the problem. A rubric, student worksheet, and an assessment task sheet are provided.
Subject:
Mathematics
Material Type:
Activity/Lab
Provider:
Hawaii State Department of Education
Author:
Hawaii State Department of Education
02/26/2019
Unrestricted Use
CC BY
Rating
0.0 stars
The purpose of this task is for students to find different pairs of numbers that sum to 4.
Subject:
Mathematics
Material Type:
Activity/Lab
Provider:
Illustrative Mathematics
Provider Set:
Illustrative Mathematics
Author:
Illustrative Mathematics
05/01/2012
Unrestricted Use
CC BY
Rating
0.0 stars
The purpose of this task is for students to find different pairs of numbers that sum to 7.
Subject:
Mathematics
Material Type:
Activity/Lab
Provider:
Illustrative Mathematics
Provider Set:
Illustrative Mathematics
Author:
Illustrative Mathematics
05/01/2012
Conditional Remix & Share Permitted
CC BY-NC
Rating
0.0 stars
The students will use 3 different color squares glued on paper to find as many combinations of numbers 10-20 as possible. This lesson was developed by NCDPI as part of the Academically and/or Intellectually Gifted Instructional Resources Project. This lesson plan has been vetted at the state level for standards alignment, AIG focus, and content accuracy.
Subject:
Mathematics
Material Type:
Lesson Plan
Author:
Melody Casey
12/01/2020
Rating
0.0 stars
In this assessment students will solve problems with pennies. There are five pennies in all. Some are hidden and some are not. Students will need to determine the number of pennies are under or outside the cup. Students should show 3 solutions. Teachers will need pennies or counters and cups. A rubric and assessment task sheet are provided.
Subject:
Mathematics
Material Type:
Activity/Lab
Provider:
Hawaii State Department of Education
Author:
Hawaii State Department of Education
02/26/2019
Rating
0.0 stars
Students decompose numbers less than or equal to 10 into pairs in more than one way by using objects or drawings, and they will record each decomposition by a drawing or equation (e.g. 5= 2 + 3 and 5 = 4+1).
Subject:
Mathematics
Material Type:
Activity/Lab
Provider:
K-5 Math Teaching Resources
Author:
K-5 Math Teaching Resources
02/26/2019
Rating
0.0 stars
In this interactive, students must determine how many bubbles are left under Okta's shell after some have been added or taken away.
Subject:
Mathematics
Material Type:
Interactive
Provider:
NCTM Illuminations Resources for Teaching Math
Author:
NCTM Illuminations
02/26/2019
Unrestricted Use
CC BY
Rating
0.0 stars
This is a task from the Illustrative Mathematics website that is one part of a complete illustration of the standard to which it is aligned. Each task has at least one solution and some commentary that addresses important asects of the task and its potential use. Here are the first few lines of the commentary for this task: Materials * Double sided counters * Markers that are the same colors as the counters * Teacher-made “My Book of 5” (see below for detailed directions) ...
Subject:
Mathematics
Material Type:
Activity/Lab
Provider:
Illustrative Mathematics
Provider Set:
Illustrative Mathematics
Author:
Illustrative Mathematics
11/14/2013
Conditional Remix & Share Permitted
CC BY-NC-SA
Rating
0.0 stars
This parent guide supports parents in helping their child at home with the Kindergarten Math content.Within the folder you will access Parent Guide PDFs in FIVE Languages: Arabic, English, Hindi, Spanish, and Vietnamese to help on-going communication with caregivers.
Subject:
Mathematics
Material Type:
Reference Material
Vocabulary
Author:
Kelly Rawlston
Letoria Lewis
02/15/2023
Conditional Remix & Share Permitted
CC BY-NC-SA
Rating
0.0 stars
This resource accompanies our Rethink Kindergarten Math Operations & Algebraic Thinking unit. It includes ideas for use, ways to support exceptional children, ways to extend learning, digital resources and tools, tips for supporting English Language Learners and students with visual and hearing impairments. There are also ideas for offline learning.
Subject:
Mathematics
Material Type:
Curriculum
Lesson Plan
Teaching/Learning Strategy
Author:
Kelly Rawlston
Letoria Lewis
02/15/2023
Conditional Remix & Share Permitted
CC BY-NC-SA
Rating
0.0 stars
This unit was created by the Rethink Education Content Development Team. This course is aligned to the NC Standards for Kindergarten Math for Operations in Algebraic Thinking.
Subject:
Mathematics
Material Type:
Activity/Lab
Assessment
Formative Assessment
Homework/Assignment
Presentation
Unit of Study
Vocabulary
Author:
Kelly Rawlston
Letoria Lewis
02/15/2023
Conditional Remix & Share Permitted
CC BY-NC-SA
Rating
0.0 stars
In this lesson, students will use circular and scattered dot configurations of the numbers 3, 4, and 5 to find hidden partners.
Subject:
Mathematics
Material Type:
Lesson Plan
Provider:
EngageNY
Author:
Engage NY
04/23/2019
Conditional Remix & Share Permitted
CC BY-NC-SA
Rating
0.0 stars
In this lesson, students will model decompositions of 3 with materials, drawings, and expressions. They will also represent the decomposition as 1+2 and 2+1.
Subject:
Mathematics
Material Type:
Lesson Plan
Provider:
EngageNY
Author:
Engage NY
04/23/2019
Conditional Remix & Share Permitted
CC BY-NC-SA
Rating
0.0 stars
In this lesson, students write numerals 1-3 and represent decompositions with materials, drawings, and equations, 3=2+1 and 3=1+2.
Subject:
Mathematics
Material Type:
Lesson Plan
Provider:
EngageNY
Author:
Engage NY
04/23/2019
Conditional Remix & Share Permitted
CC BY-NC-SA
Rating
0.0 stars
In this lesson, students model composition and decomposition of numbers to 5 using actions, objects, and drawings.
Subject:
Mathematics
Material Type:
Lesson Plan
Provider:
EngageNY
Author:
Engage NY
04/23/2019
Conditional Remix & Share Permitted
CC BY-NC-SA
Rating
0.0 stars
In this lesson, students will model composition and decomposition of numbers to 5 using fingers and linking cube sticks.
Subject:
Mathematics
Material Type:
Lesson Plan
Provider:
EngageNY
Author:
Engage NY
04/23/2019
Conditional Remix & Share Permitted
CC BY-NC-SA
Rating
0.0 stars
In this lesson, students represent composition story situations with drawings using numeric number bonds.
Subject:
Mathematics
Material Type:
Lesson Plan
Provider:
EngageNY
Author:
Engage NY
04/23/2019
Conditional Remix & Share Permitted
CC BY-NC-SA
Rating
0.0 stars
In this lesson, students represent decomposition story situations with drawings using numeric number bonds.
Subject:
Mathematics
Material Type:
Lesson Plan
Provider:
EngageNY
Author:
Engage NY | 1,942 | 8,050 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.921875 | 4 | CC-MAIN-2024-38 | latest | en | 0.88947 |
https://stackoverflow.com/questions/5951220/simple-deque-initialization-question | 1,632,807,240,000,000,000 | text/html | crawl-data/CC-MAIN-2021-39/segments/1631780060201.9/warc/CC-MAIN-20210928032425-20210928062425-00590.warc.gz | 546,116,475 | 37,779 | # Simple Deque initialization question
I have used the following code to insert some data in a deque.
``````int data[] = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
deque<int> rawData (data, data + sizeof(data) / sizeof(int));
``````
But I dont understand this part of the code,
``````data + sizeof(data) / sizeof(int)
``````
What does it mean?
• There's nothing subjective about this, but if I answer it here I won't have to answer it when it's migrated to Stack Overflow. May 10 '11 at 13:40
• This question is good but definitely belongs on StackOverflow. May 10 '11 at 13:41
• I thought for programming related question this is where I should come first. Why this question belongs to StackOverflow?
– iamcreasy
May 10 '11 at 13:50
• StackOverflow is about code itself, and programmers.stackexchange.com is about the profession. May 10 '11 at 14:53
Let's take that bit by bit.
`data` is the iterator showing where to start. It's an array, but in C and C++ arrays decay to pointers on any provocation, so it's used as a pointer. Start taking in data from `data` on, and continue until the end iterator.
The end iterator is a certain amount past the start iterator, so it can be expressed as `data + <something>`, where `<something>` is the length. The start iterator is an `int []` that is treated as an `int *`, so we want to find the length in `int`s. (In C and C++, pointers increment by the length of the pointed-to type.)
Therefore, `sizeof(data) / sizeof(int)` should be the length of the array. `sizeof(data)` is the total size of the array in bytes. (This is one of the differences between arrays and pointers: arrays have a defined size, while pointers point to what might be the start of an array of unknown size.) `sizeof(int)` is the total size of an int in bytes, and so the quotient is the total size of `array` in `int`s.
We want the size of `array` in `int`s because `array` decays into an `int *`, and so `data + x` points to the memory location x `int`s past `data`. From a beginning and a total size, we find the end of `data`, and so we copy everything in `data` from the beginning to the end.
• @David Thornley WOW, YOUR ANSWER IS SIMPLY EYE OPENING! GOSH! What should i say! PERFECT! THANK YOU!
– iamcreasy
May 10 '11 at 13:47
• @iamcreasy: Whatever you say, say it quieter. May 10 '11 at 15:02
That's a pointer to the imaginary element beyond the last element of the array. The `sizeof(data)/sizeof(data[0])` yields the number of elements in `data` array. `deque` constructor accepts "iterator to the first element" and "iterator beyond the last element" (that's what `end()` iterator yields). This construct effectively computes the same as what `.end()` iterator would yield. | 716 | 2,704 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.65625 | 3 | CC-MAIN-2021-39 | latest | en | 0.903209 |
https://www.teachoo.com/1598/513/Ex-5.2--5---Find-number-of-terms-in-AP-(i)-7--13--19--..-205/category/Ex-5.2/ | 1,680,359,588,000,000,000 | text/html | crawl-data/CC-MAIN-2023-14/segments/1679296950030.57/warc/CC-MAIN-20230401125552-20230401155552-00029.warc.gz | 1,096,409,611 | 33,624 | Ex 5.2
Chapter 5 Class 10 Arithmetic Progressions
Serial order wise
This video is only available for Teachoo black users
Get live Maths 1-on-1 Classs - Class 6 to 12
### Transcript
Ex 5.2, 5 Find the number of terms in the following AP (i) 7, 13, 19, …, 205 Given AP 7, 13, 19, … 205 Here, a = 7 d = 13 – 7 = 6 an = 205 We need to find n an = a + (n – 1) d 205 = 7 + (n – 1) × 6 205 – 7 = (n – 1) × 6 198 = (n – 1) × 6 198/6 = n – 1 33 = n – 1 33 + 1 = n 34 = n n = 34 Hence, there are 34 terms in the given AP
#### Davneet Singh
Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 13 years. He provides courses for Maths, Science, Social Science, Physics, Chemistry, Computer Science at Teachoo. | 279 | 765 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.5 | 4 | CC-MAIN-2023-14 | longest | en | 0.887867 |
https://nextjournal.com/akshayjain/traceEstimator03 | 1,723,680,723,000,000,000 | text/html | crawl-data/CC-MAIN-2024-33/segments/1722641137585.92/warc/CC-MAIN-20240814221537-20240815011537-00874.warc.gz | 345,604,217 | 46,657 | Akshay Jain / Aug 02 2019
Remix of
JSoC'19: Trace of Matrix Inverse
Introduction
This article will focus on estimation of trace of large sparse matrix inverse, that is, where is a Symmetric Positive Definite matrix andThis method is based on Estimating the Trace of the Matrix Inverse by Interpolating from the Diagonal of an Approximate Inverse by Lingfei Wu, et al.
Diagonal Approximation Algorithm
Diagonal Approximation Algorithm makes use of a preconditioner to generate an initial guess of the distribution pattern for the diagonal elements. This initial guess is used to find the a set of points that best describe the characteristics of the diagonal. With help of these points, we interpolate the diagonal using a linear or a cubic hermite polynomial model. These steps can be summarized in the following high-level description of the algorithm:
1. Findas an approximate inverse tousing some preconditioner such as IncompleteLU or Incomplete Cholesky (or any other Preconditioner). Take
2. Compute fitting sample a set of indices that best describes the distribution pattern for diagonal of
3. Solve linear system
4. Obtain a fitting model using linear or polynomial regression methods.
5. Use the fitting model to calculate diagonal elements and trace of the matrix inverse.
Usage
Setup the environment.
```# Ingredients
import Pkg;
using LinearAlgebra, SparseArrays, MatrixMarket, TraceEstimation```
Let us import a few matrices from SuiteSparse to work on.
Nasa2146 Matrix (Structural Problem)
• Size: 2146x2146
• Nonzero Entries: 72,250
• Condition Number: 1.724336e+03
• Trace of Matrix Inverse: 0.003418
nasa2146.mtx
```A = MatrixMarket.mmread(nasa2146.mtx)
# We will use tr_inv from the diagonalapprox.jl in TraceEstimation package
# tr_inv(A::SPD-Matrix, Probing-Vector-Count, Sample-Point-Count; Preconditioner, Fitting-Model)
# Here, we are not passing values for Preconditioner or Fitting model. Default Incomplete Cholesky and Linear Regression will be used.
tr_inv(A, 6, 40)```
0.00348673
Kuu Matrix (Structural Problem)
Size: 7102x7102
• Nonzero Entries: 340,200
• Condition Number: 1.575800e+04
• Trace of Matrix Inverse: 3618.675849
Kuu.mtx
```A = MatrixMarket.mmread(Kuu.mtx)
# Here, we are passing IncompleteLU and pchip as Preconditioner and fitting model resp.
tr_inv(A, 8, 80, pc = "ilu", model = "pchip")```
3562.28
Trefethen_20000 (Combinatorial Problem)
• Size:20,000x20,000
• Nonzero Entries: 554,466
• Condition Number: 2.005593e+05
• Trace of Matrix Inverse: 3.2153278
Trefethen_20000.mtx
```A = MatrixMarket.mmread(Trefethen_20000.mtx)
A = SparseMatrixCSC{Float64, Int64}(A)
# We will increase Sample Point count as the matrix is large.
tr_inv(A, 8, 250, pc = "ilu")```
3.2471
Scope for Improvement and Insights
As evident from the Step 1 and Step 4 of the algorithm given above, we can plug different preconditioners and fitting models to obtain a better approximation of diagonal elements and ultimately the trace of the matrix inverse. These can be modified according to the type of problem one is trying to solve.
It is also evident that some methods would be faster than others. For example, calculating IncompleteLU is faster than calculating Incomplete Cholesky, but the same can be less accurate sometimes. Step 3 of the algorithm uses CG to solve the linear systems, which also increases the execution time as the number of sample points increase. | 881 | 3,415 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.546875 | 4 | CC-MAIN-2024-33 | latest | en | 0.75752 |
http://nrich.maths.org/public/leg.php?code=174&cl=3&cldcmpid=6060 | 1,503,345,134,000,000,000 | text/html | crawl-data/CC-MAIN-2017-34/segments/1502886109525.95/warc/CC-MAIN-20170821191703-20170821211703-00658.warc.gz | 297,635,227 | 5,669 | # Search by Topic
#### Resources tagged with Handling data similar to Counting Fish:
Filter by: Content type:
Stage:
Challenge level:
### There are 9 results
Broad Topics > Handling, Processing and Representing Data > Handling data
### A Random Rambling Rant
##### Stage: 1, 2, 3, 4 and 5
A random ramble for teachers through some resources that might add a little life to a statistics class.
### Football Champs
##### Stage: 3 Challenge Level:
Three teams have each played two matches. The table gives the total number points and goals scored for and against each team. Fill in the table and find the scores in the three matches.
### Cricket Ratings
##### Stage: 4
Like all sports rankings, the cricket ratings involve some maths. In this case, they use a mathematical technique known as exponential weighting. For those who want to know more, read on.
### Who's the Best?
##### Stage: 3 Challenge Level:
Which countries have the most naturally athletic populations?
### In the Bag
##### Stage: 3 Challenge Level:
Can you guess the colours of the 10 marbles in the bag? Can you develop an effective strategy for reaching 1000 points in the least number of rounds?
### History of Morse
##### Stage: 2, 3, 4 and 5
This short article gives an outline of the origins of Morse code and its inventor and how the frequency of letters is reflected in the code they were given.
### Inspector Morse
##### Stage: 3 Challenge Level:
You may like to read the article on Morse code before attempting this question. Morse's letter analysis was done over 150 years ago, so might there be a better allocation of symbols today?
### Helicopters
##### Stage: 2, 3 and 4 Challenge Level:
Design and test a paper helicopter. What is the best design? | 395 | 1,756 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.375 | 3 | CC-MAIN-2017-34 | latest | en | 0.901343 |
http://mobjectivist.blogspot.com/2010_10_01_archive.html | 1,490,689,017,000,000,000 | text/html | crawl-data/CC-MAIN-2017-13/segments/1490218189686.31/warc/CC-MAIN-20170322212949-00374-ip-10-233-31-227.ec2.internal.warc.gz | 238,888,677 | 28,160 | [[ Check out my Wordpress blog Context/Earth for environmental and energy topics tied together in a semantic web framework ]]
## Saturday, October 23, 2010
### Understanding Recovery Factors
A recent TOD post on reserve growth by Rembrandt Kopelaar motivated this analysis.
The recovery factor indicates how much oil that one can recover from the original estimate. This has important implications for the the ultimately recovery resources, and increases in recovery rate has implications for reserve growth.
First of all, we should acknowledge that we still have uncertainty as to the amount of original oil in place, so that the recovery factor has two factors of uncertainty.
The cumulative distribution of reservoir recovery factor typically looks like the following S-shaped curve. The fastest upslope indicates the region closest to the average recovery factor.
Figure 1: Recovery Factor cumulative distribution function (from)
To understand the spread in the recovery factors, one has to first realize that all reservoirs have different characteristics. Some are more difficult to extract from and others have easier recovery factors. One of the principle first-order effects has to do with the size of the reservoir: bigger reservoirs typically have better recovery factors and as one reservoir engineer mentioned on TOD
"Reserve growth tends to happen in bigger fields because thats where you get the most bang for your buck"
So if we make the simple assumption that cumulative recovery factors (RF) have Maximum Entropy uncertainty or dispersion for a given Size:
P(RF) = 1-exp (-k*RF/Size)
this makes sense as the recovery factor will extend for larger fields.
Add to the mix that reservoir Sizes go approximately as (see here):
Pr(Size)= 1/(1+Median/Size)
Then a simple reduction in these sets of equations (with the key insight that RF ranges between 0 and 1, i.e. between 0 and 100%) gives us
P(RF) = 1 - exp(-k*RF*RF/(1-RF)/Median)
the ratio Median/k indicates the fractional average recovery factor relative to the median field size.
A set of curves for various k/Median values below:
Figure 2: Recovery Factor distribution functions assuming maximum entropy
Rembrandt provided some recovery factor curves originally supplied by Laherrere, and I fit these to the Median/k fractions below.
Figure 3: Recovery factor curves from Rembrandt's TOD post,
alongside the recovery factor model described here.
Laherrere also provided curves for natural gas, where recovery factors turn out much higher.
Figure 4: Recovery Factor distribution functions for natural gas.
Note that the recovery factor is much higher than for oil.
(Note: I had to fix the typo in the graph x-axis naming)
It looks like this derivation has strong universality underlying it. This remains a very simple and parsimonious model as it has only one sliding parameter. The parameter Median/k works in a scale-free fashion because both numerator and denominator have dimensions of size. This means that one can't muck with it that much -- as recovery factors increase, the underlying uncertainty will remain and the curves in Figure 2 will simply slide to the right over time while adjusting their shape. This will essentially describe the future reserve growth we can expect; the uncertainty in the underlying recovery factors will remain and thus we should see the limitations in the smearing of the cumulative distributions.
To reverse the entropic dispersion of nature and thus to overcome the recovery factor inefficiency, we will certainly have to expend extra energy.
## Wednesday, October 20, 2010
### Bird Surveys
This post either points out something pretty obvious or else it reveals something of practical benefit. You can judge for now.
I briefly made a reference to bird survey statistics when I wrote this post on econophysics and income modeling. I took a typical rank histogram of bird species abundance and fit it the best I could to a dispersive growth model, further described here. The generally observed trend follows that many species exist in the middle of abundance and relatively small numbers of species exist at each end of the spectrum -- few species exceedingly common (i.e. starling) and few species exceedingly rare (i.e. whooping crane). Since the bird data comes from a large area in North America, the best fit followed a meta-community growth model. The meta-community adjustment impacts the knee of the histogram curve and broadens the Preston plot, effectively smearing over geological ages that different species have had to adapt.
Figure 1: Preston plot (top) and
rank histogram (bottom) of relative bird species abundance
If we assume that the relative species abundance has a underlying model related to steady-state growth according to p(rate), where rate is the relative advantage for species reproduction and survival, then this should transitively might apply to disturbances to growth as well. Recently, I ran into a paper that actually tried to discern some universality in diverse growth papers, and it coincidentally used the bird survey data along with two economic measures of firm size and mutual fund size.
I did the best I could with the figures in the paper but eventually went to the source, ftp://ftpext.usgs.gov/pub/er/md/laurel/BBS/DataFiles/, and used data from 1997 to 2009.
I applied the same abundance distribution as before and came up with the fit below (see blue and red curves below, data and model respectively). That provided a sanity check, but Schwarzkopf and Farmer indicated that the year-to-year relative growth fluctuations should also obey some fundamental behavior through the distribution of this metric:
RelativeGrowth(Year) = n(Year+1) / n(Year)
Sure enough, and for whatever reason, the "growth" in the surveyed data does show as much richness as the steady state averaged abundance distribution. The relative growth in terms of a fractional yearly change sits alongside the relative abundance curve below (in green). Notice right off the bat that the distribution of fractional changes drops off much more rapidly.
Figure 2 : The red meta-model curve smears the median from 200 to 60000
I believe that this has a simple explanation having to do with Poisson counting statistics. When estimating fractional yearly growth, we consider that the rarer bird species having the lowest abundance will contribute most strongly to fluctuation noise on year-to-year survey data. Values flipping from 1 to 2 will lead to 100% growth rates for example. (We have to ignore movements from 1 to 0 and 0 to 1 as these growths become infinite.
I devised a simple algorithm that takes two extreme values (R greater than 1 and R less than 1 ) and the steady state abundance N for each species. The lower bound of:
R1 = R * (1-sqrt(2/N))/(1+sqrt(2/N))
and the upper bound becomes:
R2 = R * (1+sqrt(2/N))/(1-sqrt(2/N))
The term 1.4/sqrt(N) derives from Poisson counting statistics in that the relative changes become inversely related to the size of the sample. We double count in this case because we don't know whether the direction will go up or down, relative to R, a number close to unity.
(This has much similarity to the model I just used in understanding language adoption. Small numbers of adopters experience suppressing fluctuations as 1/sqrt(N))
Expanding on the scale, the results of this algorithm are shown in Figure 3.
Figure 3 : Model of yearly growth fluctuation in terms of a cumulative distribution function
Placing it in terms of a binned probability density function, the results look like the following plot. Note the high counts match closely the data simply because the 1/sqrt(N) is relatively small. Away from these points, you can see the general trend develop even though the data is (understandably) obscured by the same counting noise.
Figure 4 : The probability density function of yearly growth fluctuations.
As an essential argument to take home, consider that a counting statistics argument probably accounts for the yearly growth fluctuations observed. Before you make any other assertions, you likely have to remove this source of noise. Looking at Figure 3 & 4, you can potentially see a slight bias toward positive growth for certain lower abundance species. This comes at the expense of lower decline elsewhere, except for some strong declines in several other low abundance species. This may indicate the natural ebb and flow of attrition and recovery in species populations, with some of these undergoing strong declines. I haven't done this but it makes sense to identify the species or sets of species associated with these fluctuations.
Two puzzling points also stick out. For one, I don't understand why Schwarzkopf and Farmer didn't immediately discern this effect. Their underlying rationale may have some of the same elements but it gets obscured by their complicated explanation. They do use a resampling technique (on 40+ years worth of data) but I didn't see much of a reference to conventional counting statistics, only the usual hand-wavy Levy flight arguments. They did find a power law of around-0.3 instead of the -0.5 we used for Poisson, so they may generate something equivalent to Poisson by drawing from a similar Levy distribution. Overall I find this violates Occam's razor, at least for this set of bird data .
Secondly, it seems that these differential growth curves have real significance in financial applications. More of the automated transactions look for short duration movements and I would think that ignoring counting statistics could lead the computers astray.
Epilogue
As an aside, when I first pulled the data off the USGS server, I didn't look closely at the data sets. It turns out that the years 1994,1995,1996 were included in the data but appeared to have much poorer sampling statistics. From 1994 to 1996, the samples got progressively larger but I didn't realize this when I first collected and processed the data.
Figure 6 : CDF of larger data sample.
Note the strange hitch in the data growth fluctuation curve.
At the time, I figured that the slope had a simple explanation related to uncertainties in the surveying practice. I also saw some similarities to the uncertainties in stock market returns that I blogged about recently in an econophysics posting.
Say the survey delta time has a probability distribution with average time -- the T most likely related to the time between surveys:
pt(time) = (1/T)*exp(-time/T)
then we also assume that a surveyor tries to collect a certain amount of data, x, during the duration of the survey. We could characterize this as a mean, X, or some uniform interval. We don't have any knowledge of higher order moments to we just apply the Maximum Entropy Principle
px(x) = (1/X)*exp(-x/X)
The ratio between these two establishes the relative rate of growth, rate = X/T. We can derive the following cumulative quite easily:
P(rate) = T*rate/(T*rate +X)
The yearly growth rate fluctuations of course turn out as the second derivative of this function. We take one derivative to convert :
dp(rate)/drate = 2*T/X/(1+rate*T/X)^3
On a cumulative plot as in Figure 6, this shows a power-law of order 2 (see the orange curve). Near the knee of the curve, it looks a bit sharper. If we use a uniform distribution of px(x) up to some maximum sample interval, then it matches the knee better (see the dashed curve).
So the simple theory says that much of the observed yearly fluctuation may arise simply due to sampling variations during the surveying interval. Plotting as a binned probability density function, the contrast shows up more clearly in Figure 7. In both cases is fit to X/T = 60. This number is bigger than unity because it looks like every year, the number of samples increases (I also did not divide by 15, the number of years in the survey).
But of course, the reason this maximum entropy model works as well as it does came about from real variation in the sampling techniques. Those years from 1994 to 1996 placed enough uncertainty and thus variance in the growth rates to completely smear the yearly growth fluctuation distribution.
Figure 7 : PDF of larger sample which had sampling variations.
Note that this has a much higher width than Figure 4.
Only in retrospect when I was trying to rationalize why a sampling variation this large would occur in a seemingly standardized yearly survey, did I find the real source of this variation. Clearly, the use of the Maximum Entropy Principle explains a lot, but you still may have to dig out the sources of the uncertainty.
Can we understand the statistics of something as straightforward as a bird survey? Probably, but as you can see, we have to go at it from a different angle than that typically recommended. I will keep an eye out if it has more widespread applicability; for now it obviously requires countable discrete entities.
## Saturday, October 16, 2010
### Tower of Babel, How languages diversify
One pattern that has evaded linguists and cognitive scientists for some time relates to the quantitative distribution in human language diversity. Much like how plant and animal species diversify in a specific pattern, with very few species dominating within an ecosystem and relatively few species exceedingly rare, the same thing happens with natural languages. You find a few languages spoken by many people, and very few spoken seldomly,with the largest number occupying the middle.
Consider a simple model of language growth whereby adoption of languages occur over time by dispersion. The cumulative probability distribution for the number of languages is
P(n) = 1/(1+1/g(n))
This form derives from the application of the maximum entropy principle to any random variate where one only knows the mean in the growth rate and an assumed mean in the saturation level. I refer to this as entropic dispersion and have used this many applications before so I no longer feel a need to rederive this term every time I bring it up.
The key to applying entropic dispersion is in understanding the growth term g(n). In many cases n will grow linearly with time so the result will assume a hyperbolic shape. In another case, an exponential growth brought up by technology advances will result in a logistic sigmoid distribution. Neither of these likely explains the language adoption growth curve.
Intuitively one imagines that language adoption occurs in fits and starts. Initially a small group of people (at least two for arguments sake) have to convince other people on the utility of the language. But a natural fluctuation arises with small numbers as key proponents of the language will leave the picture and the growth of the language will only sustain itself when enough adopters come along and the law of large numbers starts to take hold. A real driving force to adoption doesn't exist, as ordinary people have no real clue as to what constitutes a "good" language, so that this random walk or Brownian motion has to play an important role in the early stages of adoption.
So with that as a premise, we have to determine how to model this effect mathematically. Incrementally we wish to show that the growth term gets suppressed by the potential for fluctuation in the early number of adopters. A weaker steady growth term will take over once a sufficiently large crowd joins the bandwagon.
dn = dt / (C/sqrt(n) + K)
In this differential formulation, you can see how the fluctuation term which goes as 1/sqrt(n) suppresses the initial growth until it reaches a steady state as the K term becomes more important. Integrating this term once and we get the implicit equation:
2*C*sqrt(n) + K*n = t
Plotting this for C=0.007 and K=0.000004, we get the following growth function.
Figure 1 : Growth function assuming suppression during early fluctuations
This makes a lot of sense as you can see that growth occurs very slowly until an accumulated time at which the linear term takes over. That becomes the saturation level for an expanding population base as the language has taken root.
To put this in stochastic terms assuming that the actual growth terms disperse across boundaries, we get the following cumulative dispersion (plugging the last equation into the first equation to simulate an ergodic steady state):
P(n) = 1/(1+1/g(n)) = 1/(1+1/(2*C*sqrt(n) + K*n))
I took two sets of the distribution of population sizes of languages (DPL) of the Earth’s actually spoken languages from the references below and plotted the entropic dispersion alongside the data. The first reference provides the DPL in terms of a probability density function (i.e. the first derivative of P(n)) and the second as a cumulative distribution function. The values for C and K were as used above. The fit works parsimoniously well and it makes much more sense than the complicated explanations offered up previously for language distribution.
Figure 2 : Language diversity (top) probability density function (below) cumulative. The entropic dispersion model in green.
In summary, the two pieces to the puzzle are assuming dispersion according to the maximum entropy principle, and a suppressed growth rate due to fluctuations during the early adoption. This gives two power law slopes in the cumulative; 1/2 in the lower part of the curve and 1 in the higher part of the curve.
References
1. Scaling Relations for Diversity of Languages (2008)
2. Competition and fragmentation: a simple model generating
lognormal-like distributions
(2009)
3. Scaling laws of human interaction activity (2009)
Discussions on the fluctuation term.
NY Math Teacher Howard A. Stern Uses Ingenuity To Overcome Failure Statistics
The public school teacher highlighted in the linked article has this to say:
"So much of math is about noticing patterns," says Stern, who should know. Before becoming a teacher, he was a finance analyst and a quality engineer.
I always try to seek interesting patterns in the data, but more to the point, I try to actually understand the behavior from a fundamental perspective.
One way Stern uses technology is by helping his students visualize his lessons through the use of graphing calculators.
Stern has it exactly right, if we treat knowledge seeking as a game, like a suduko puzzle, we can attract more people to science in general.
I think that the pattern in language distribution has similarities to that of innovation adoption as well, similar to what Rogers describes in his book "Diffusions of Innovations". I will try to look into this further as I think the dispersive arguments holds some promise as an analytical approach.
## Tuesday, October 12, 2010
### Stock Market as Econophysics Toy Problem
Consider a typical stock market. It consists of a number of stocks that show various rates of growth, R. Say that these have an average growth rate, r. Then by the Maximum Entropy Principle, the probability distribution function is:
pr(R) = 1/r*exp(-R/r)
We can solve this for an expected valuation, x, of some arbitrary stock after time, t.
n(x|t) = ∫ pr(R) δ(x-Rt) dR
This reduces to the marginal distribution:
n(x|t) = 1/(rt) * exp(-x/(rt))
In general, the growth of a stock only occurs over some average time, τ, which has its own Maximum Entropy probability distribution:
p(t) = 1/τ *exp(-t/τ)
So when the expected growth is averaged over expected times we get this integral:
n(x) = ∫ n(x|t) p(t) dt
We have almost solved our problem, but this integration reduces to an ugly transcendental function K0 otherwise known as a modified Bessel function of the second kind and order 0.
n(x) = 2/(rτ) * K0(2*sqrt(x/(rτ) ))
Fortunately, the K0 function is available on any spreadsheet program (Excel, OpenOffice, etc) as the function BESSELK(X;0).
Let us try it out. I took 3500 stocks over the last decade (since 1999), and plotted the histogram of all rates of return below.
The red line is the Maximum Entropy model for the expected rate of return, n(x) where x is the rate of return. This has only a single adjustable parameter, the aggregate value rτ. We line this up with the peak which also happens to coincide with the mean return value. For the 10 year period, rτ = 2, essentially indicating an average doubling in the valuation of the average stock. This doesn't say anything about the stock market as a whole, which turned out pretty flat over the decade, only that certain high-rate-of-return stocks upped the average (much like the story of Bill Gates entering a room of average wage earners).
The following figure shows a Monte Carlo simulation where I draw 3500 samples from a rτ value of 1. This gives an idea of the amount of counting noise we might see.
I should point out that the MaxEnt model shows very little by way of excessively fat tails at high returns. A stock has to both survive a long time and grow at a rapid enough rate to get too far out in the tail. You see that in the data as only a couple of the stocks have returns greater than 100x. I don't rule out the possibility of high-return tails but we would need to put even more disorder in the pr(R) distribution than the MaxEnt provides for a mean return rate. The actual data seems a bit sharper and has more outliers than the Monte Carlo simulation, indicating some subtlety that I probably have missed. Yet, this demonstrates how to use the Maximum Entropy Principle most effectively -- you should only include the parameters that you can defend. From this minimal set of constraints you observe how far this can take you. In this case, I could only defend some concept of mean in rτ and then you get a distribution that reflects the uncertainty you have in the rest of the parameter space.
The stock market with its myriad of players follows an entropic model to first-order. All the agents seem to fill up the state space so that we can get a parsimonious fit to the data with an almost laughably simple econophysics model. For this model, the distribution curve on a log-log plot will always take on exactly that skewed shape (excepting for statistical noise of course) -- it will only shift laterally depending the general direction of the market.
The stock market becomes essentially a toy problem, no different than the explanation of statistical mechanics you may encounter in a physics course.
Has anyone else figured this out?
[EDIT]
Besides the slight fat-tail, which may be due to potential compounding growth similar to that found in individual incomes, the sharper peak may also have a second-order basis. This could result from a behavior called implied correlation which measures the synchronized behavior among stocks in the market. According to recent measurements, the correlation has hit all-time highs (the last around October 5). Qualitatively a high correlation would imply that the average growth rate r would show much less dispersion in that variate, and the dispersion would only apply to the length of time, t, that a stock rides the crest. Correlation essentially removes one of the parameters of variability from the model and the distribution sharpens up. The stock distribution then becomes the following simple damped exponential instead of the Bessel.
n(x) = 1/(rτ) * exp(-x/(rτ))
The figure below shows what happens when about 40% of the stocks would show this correlation (in green). The other 60% show independent variability or dispersion in the rates as per the original model.
I don't think this makes the collective stock behavior and more complex. I think it makes it simpler in fact. Implied correlation actually points to the future in the stock market. Dispersion in stock returns will narrow as all stocks move in unison. It makes it even more of a toy, with computers potentially dictating all movements.
Implied correlation has risen in the last few years (from here)
References
I personally don't deal with the stock market, preferring to watch it from afar. I found a few papers that try to understand this effect, but most just try to brute force fit it to various distributions.
1. Analysis of same data from Seeking Alpha
2. This paper is close but no cigar. It looks like they "detrend" the data to get of the skew, which I think misses the point :
"Microscopic origin of non-Gaussian distributions of financial returns" (2007)
3. This book has info on the Bessel distribution:
"Return distributions in finance", J. Knight and S. Satchell
4. Interesting from an econophysics perspective.
5. This book appears worthless:
"Fat-Tailed and Skewed Asset Return Distributions", S.T. Rachev, F.J. Fabozzi, C Menn
## Thursday, October 07, 2010
### Black-Scholes
Games for suits. This post has no relevance in the greater scheme of things.
As a premise, consider that the financial industry needs instruments of wealth creation that work opposite to that of stocks. For example, when stock prices remain low, then something else else should take up the slack -- otherwise important people won't make money. Wall Street invented derivatives, options, and other hedging methods to serve as an investment vehicle under these conditions.
We can try to show how this works.
If S is the stock price, then V ~ 1/S is an example "derivative" that works as a reciprocal to price. This becomes the normative description and defines the basic objective as to what the investment class wants to achieve -- an alternate form of income that balances swings in stock price, potentially reducing risk.
Further, we make the assumption that the derivative will grow or decline over time.
So we get:
V(S,t) = K/S * exp(a*t)
If a > 0 then the derivative will grow and if a is less than zero than the derivative will damp out over time. The term K is a constant of proportionality.
The infamous Black-Scholes equation supposedly governs the behaviour of derivatives with respect to stock prices (and time) according to this invariant:
The particulars may change but this formulation describes THE equation that Merton, Black, and Scholes devised to aid investors in making hedged investments using options and other derivatives. The way to read this equation is to note that derivatives will drift or diffuse into the space of the stock price, and proportional to the stock price itself. The drift term occurs due to the interest rate r providing a kind of forcing function. The derivative, V, can also grow due to pure interest rate compounding, as seen in the last term. Whether this actually holds or not, I don't really care as I don't participate in these schemes.
So if you look at it from a very neutral perspective you come up with some interesting observations. For one, you can trivially solve this partial differential equation for a generally disordered set of initial conditions. And the solution appears exactly the same as my first expression above:
V(S,t) = K/S * exp(a*t)
To verify this assertion, we test the expression in the B-S equation, substituting the partial derivatives as we go along.
a*K/S* exp(a*t) + 1/2(σS)2*2*K/S2*exp(a*t) - rS*K/S2*exp(a*t) - r*K/S * exp(a*t) = 0
Cancelling out all common factors:
a/S + 1/2(σS)2*2/S2- rS/S2 - r/S = 0
Reducing the value of S
a/S + 1/2(σ)2*2/S- r/S - r/S = 0
a + 1/2(σ)2*2- r - r = 0
gets us to:
a = 2*r - σ2
The term r is proportional to interest, and σ is volatility or variance in stock price.
So this simple expression that I just cooked up will obey Black-Scholes as long as we choose the constant a term to correspond to the interest and volatility as shown above, and we get:
V(S,t) = K/S * exp((2*r - σ2)*t)
Note that if the volatility (i.e. diffusion) stays high relative to interest, the exponential will damp out with time. If interest (i.e. drift) goes higher than volatility, the exponential will accelerate, creating a huge amount of paper gains.
At this point someone will argue that this solution does not reflect reality. I beg to differ. When you make your bed of mathematical box-springs, you have to lie in it. This solution to Black-Scholes is perfectly fine as it gives a steady-state picture of the partial differential equation. The diffusional and drift components cancel with the right mix of production vs destruction in derivative wealth. If you don't like it, then come up with something different than that specific B-S equation.
I have a feeling that all the seeming complexity of financial quantitative analysis with its Ito calculus and Wiener processes acts as a shiny facade to a simple reality. The math exists to model the inverse relationship of stocks to derivatives. If this didn't happen -- and the lords of high finance absolutely require this relationship to make money -- the math as formulated would vanish from their toolbox. In other words, the math only exists to justify what the financial operatives want to see happen. Everyone appears to implicitly buy this mathematical artifice hook, line, and sinker.
Quantitative analysis and the "quants" who work it have created a fantasy land, where they do not want you to know how easily their quaint ornate universe reduces to a simple function. If they admitted to the charade, the mystery would all disappear and they would no longer have jobs.
Economics and finance does not constitute a science. In science you may need to use partial differential equations. For example, the Fokker-Planck equation shows up quite often -- which incidentally, the Black-Scholes equation shows some similarity to and the quant proponents of B-S certainly like to play up -- but it typically applies to real, physical systems where you use it to try to understand nature, not trying to model some artificial game-like behavior.
I can edit my solution into the Wikipedia page for Black-Scholes and I will bet that someone will immediately remove it. I harbor no illusions. The financial industry depends on the absence of real knowledge to achieve their objectives.
That explains why economics and finance do not classify as sciences; absolute truth does not matter to economists and financiers, only the art of deconstructing profit and the craft of phantom wealth creation does.
## Saturday, October 02, 2010
### Lake Size Distributions
Our environment shows great diversity in the size and abundance in natural structures. Since we extract oil from our environment, it stands to reason that many of the same mechanisms leading to oil formation could also reveal themselves in more familiar natural phenomena. Take the size distribution of lakes as an example.
Freshwater lakes accumulate their volume in a manner analogous to the way that an underground reservoir accumulates oil. Over geologic time, water drifts into a basin at various rates and over a range in collecting regions. In the context of oil reservoirs, I have talked about this behavior before and the Maximum Entropy prediction of the size distribution leads to the following expression:
P(Size) = 1/(1+Median/Size)
Surveys of lake size show the same reciprocal power law dependence, with the exponent usually appearing arbitrarily close to one. In Figure 1 below, the data plotted on a ranked plot clearly shows this dependence over several orders of magnitude.
Figure 1: Northern Quebec lakes [1]
More revealing, in Figure 2 we can observe the bend in the curve that limits the number of small lakes in exact accordance to the equation. The agreement with such a simple model suggests that a universal behavior links the statistics between environmental phenomena as seemingly distinct as those of lakes and oil reservoirs.
Figure 2: Amazon lakes [2]
This provides other intuitive clues to how to think about reservoir sizing. Consider the fact that very few freshwater lakes reach gigantic portions, the Great Lakes serving as a prime example. Similarly, the rare occurrence of “super-giant” reservoirs follow from the same principles. We clearly won’t find any new huge freshwater lakes, while the future occurrence of super-giant oil reservoirs remains very doubtful just from the statistics of oil reservoirs found so far. Finding substantial numbers of super-giant reservoirs would result in deviations from the size distribution plot, making it very unlikely.
References
[1] K&C Science Report – Phase 1 Global Lake Census
[2] Estimation of the fractal dimension of terrain from Lake Size Distributions | 6,818 | 32,294 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.328125 | 3 | CC-MAIN-2017-13 | longest | en | 0.942701 |
https://www.justanswer.com/pre-calculus/e6xyj-two-hallways-width-feet-width.html | 1,590,681,759,000,000,000 | text/html | crawl-data/CC-MAIN-2020-24/segments/1590347399820.9/warc/CC-MAIN-20200528135528-20200528165528-00233.warc.gz | 806,318,843 | 53,354 | Pre-Calculus
Have pre-calculus questions? Ask a pre-calculus tutor
Connect one-on-one with {0} who will answer your question
Related Pre-Calculus Questions
R.R. Jha, I forgot to ask you how you figured out that last
Hi R.R. Jha, I forgot to ask you how you figured out that last one. I'm pretty sure this is the last shape I'm having trouble with. If I knew degrees of the 4 angles that are not 90's. I could make a … read more
R.R. Jha
Bachelor's Degree
6,465 satisfied customers
A span between objects getting greater over time is called
A span between objects getting greater over time is called what? How do i figure out the ratio?… read more
Ryan
Bachelor's Degree
4,665 satisfied customers
I have a geometry question. I have two parallel lines cut by
I have a geometry question.I have two parallel lines cut by a transversal.Given: measure angle 2 = 8b + a measure angle 4 = 3a + 5b measure angle 5 = 7a + 25bangle 2 and 4 are vertical angles so they … read more
Ryan
Bachelor's Degree
4,665 satisfied customers
Name: valencia XXXXXXXXX _________ Student Number:
Name: valencia XXXXXXXXX _________ Student Number: XXXXXXXXXXX___________________ 1. Elsie is making a quilt using quilt blocks like the one in the diagram. a. How many lines of symmetry are there? Ty… read more
Ray Atkinson
Bachelor's Degree
1,687 satisfied customers
I need someone to help me with this. I need to compare my
HI, I need someone to help me with this. I need to compare my answers before I turn this in. Thank you. Exam: 250311RR - Trigonometric Functions 1. Find a positive angle less than 360° that's cotermin… read more
Ryan
Bachelor's Degree
4,665 satisfied customers
Record your answers and work on the separate answer sheet provided. There
Record your answers and work on the separate answer sheet provided. There are 28 problems. Problems #1–6 are Multiple Choice. Problems #7–17 are Short Answer. (Work not required to be shown) Problems … read more
Ryan
Bachelor's Degree
4,665 satisfied customers
12. Factor completely. 16q^2+40qs+25s^2 Enter the factors.
12. Factor completely. 16q^2+40qs+25s^2 Enter the factors. Enter the original expression if it cannot be factored. 13. Factor completely. 9p^8-16w^2 Enter the factors as a product of two binomials. En… read more
Mr. Gregory White
Master's Degree
Master's Degree
167 satisfied customers
1. Which one of the following geometric forms is a curved surface? A.
1. Which one of the following geometric forms is a curved surface? A. Base of a prism B. Base of a cylinder C. Side of a pyramid D. Side of a cone 2. If the diagonal of a square is 12 centimeters, the… read more
SusanAthena
Research analyst, tutor
Master's Degree
3,810 satisfied customers
1.A container built in the shape of a cylinder has a circular
1.A container built in the shape of a cylinder has a circular base with a radius of 1.5 meters. The altitude of the container is 3.5 meters. How many cubic meters of fluid can this container hold? 2.W… read more
Ryan
Bachelor's Degree
4,665 satisfied customers
1-which of the following pairs of angles are coterminal? a-
1-which of the following pairs of angles are coterminal? a- 100 degree and 620 degree b- 25 degree and -25 degree c- 390 degree and 60 degree d- 30 degree and 60 degree 2- a stairway must be built to … read more
Trigeoscal
College Math Professor
Master's Degree
960 satisfied customers
1. What is the primary reason for applying a finite population correct
1. What is the primary reason for applying a finite population correction coefficient? A. When the sample is a very small portion of the population, the correction coefficient is required. B. If you d… read more
Math-John
30 satisfied customers
Solve by substitution: 1) Solve by substitution: 3x + 4y
Solve by substitution: 1) Solve by substitution: 3x + 4y – 5z = -4 5x – 2y +3z = 10 -6x +3y +2z = 6 2) Solve the right triangle with legs of length 2 and 7. Draw the triangle. 3) Solve the right trian… read more
Stevewh
Teacher
Bachelor's Degree
6,427 satisfied customers
The volume of a rectangular box of a given height is proportional
The volume of a rectangular box of a given height is proportional to its width and length. A box with a width of 2ft and length of 4ft has a volume of 12ft cubed. Find the volume of a box with the sam… read more
mhasan420
Master's Degree
Bachelor's Degree
37 satisfied customers
You measure the angle of elevation between the ground and top
You measure the angle of elevation between the ground and top of a building as 45 degrees, when you move 50 feet closer to the building the angle of elevation is 60 degrees. What is the height of the … read more
Math-John
30 satisfied customers
Student ID: 21330464Exam: 186085RR - APPLIED GEOMETRYWhen
Student ID: 21330464 Exam: 186085RR - APPLIED GEOMETRY When you have completed your exam and reviewed your answers, click Submit Exam. Answers will not be recorded until you hit Submit Exam. If you ne… read more
Chirag
Master's Degree
10,329 satisfied customers
I have a discussion question: Can you please respond to the
I have a discussion question: Can you please respond to the following: There are two types of right angled triangles, a scalene right angled triangle and an isosceles right angled triangle. An right a… read more
RavinDe
Bachelor's Degree
1,111 satisfied customers
1.Solve the system by the subsitution method x^2+y^2=20 x-y=-2 2.
1.Solve the system by the subsitution method x^2+y^2=20 x-y=-2 2. solve the following system by the substitution method x-y=1 x^2-xy-y^2=-1 the solution set is 3.Solve the system by the addition metho… read more
Chirag
Master's Degree
10,329 satisfied customers
Sandhya sharma I am request your help again. 1). A rectangular
Sandhya sharma I am request your help again. 1). A rectangular pen for a pet is 5 feet longer than it is wide. give possible value for the width W of the pen if its area must be between 204 and 500 sq… read more
Sandhya_sharma
Master's Degree
Master's Degree
721 satisfied customers
Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.
JustAnswer in the News:
Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.
What Customers are Saying:
Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help.
Mary C.Freshfield, Liverpool, UK
This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!!
AlexLos Angeles, CA
Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult.
GPHesperia, CA
I couldn't be more satisfied! This is the site I will always come to when I need a second opinion.
JustinKernersville, NC
Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around.
EstherWoodstock, NY
Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know.
RobinElkton, Maryland
He answered my question promptly and gave me accurate, detailed information. If all of your experts are half as good, you have a great thing going here.
DianeDallas, TX
< Previous | Next >
Meet the Experts:
Mr. Gregory White
Master's Degree
167 satisfied customers
M.A., M.S. Education / Educational Administration
mhasan420
Master's Degree
37 satisfied customers
BA Maths, Oxford
JACUSTOMER-yrynbdjl-
Master's Degree
13 satisfied customers
I have taught college Mathematics for the past 10 years.
Dr. Arthur Rubin
Doctoral Degree
12 satisfied customers
Ph.D. in Mathematics, 1978, from the California Institute of Technology, over 20 published papers
Sandhya_sharma
Master's Degree
721 satisfied customers
I hold M.Sc and M.Phil degrees in math and have several years of teaching experience.
Kofi
Mr
370 satisfied customers
Mathematics and Statistics
Tom Piscaer
Engineer
1,615 satisfied customers
Expert in Math, Physics and Chemistry
< Previous | Next >
Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.
Show MoreShow Less | 2,536 | 10,494 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.390625 | 3 | CC-MAIN-2020-24 | latest | en | 0.924331 |
https://gitlab.math.tu-dresden.de/amdis/amdis-core/-/blame/1acbfeb04b36949ac5a331aa8633f47314dc29f1/amdis/linearalgebra/SparsityPattern.hpp | 1,660,528,008,000,000,000 | text/html | crawl-data/CC-MAIN-2022-33/segments/1659882572089.53/warc/CC-MAIN-20220814234405-20220815024405-00313.warc.gz | 289,504,737 | 22,603 | SparsityPattern.hpp 3.37 KB
Praetorius, Simon committed Dec 30, 2019 1 2 3 4 5 6 7 ``````#pragma once #include #include #include `````` Müller, Felix committed Jul 11, 2020 8 ``````#include `````` Praetorius, Simon committed Dec 30, 2019 9 10 11 `````` namespace AMDiS { `````` 12 `````` /// \brief A general sparsity pattern implementation using the full pattern of the `````` Praetorius, Simon committed Dec 30, 2019 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 `````` /// basis by adding all local indices class SparsityPattern { public: /// Number of rows in the matrix std::size_t rows() const { return rows_; } /// Number of columns in the matrix std::size_t cols() const { return cols_; } /// Average number of non-zeros per row std::size_t avgRowSize() const { assert(rows_ == pattern_.rows()); std::size_t sum = 0; for (std::size_t r = 0; r < rows_; ++r) sum += rowSize(r); return (sum + rows_ - 1) / rows_; } /// Number of non-zeros in row r std::size_t rowSize(std::size_t r) const { return pattern_.rowsize(r); } /// Total number of non-zeros std::size_t nnz() const { return pattern_.size(); } /// Initialize a matrix with the non-zero structure template void applyTo(Matrix& matrix) const { pattern_.exportIdx(matrix); } // Update pattern when basis is updated. This method is called if rowBasis == colBasis. `````` Praetorius, Simon committed Jan 10, 2020 59 `````` template `````` Müller, Felix committed Jul 11, 2020 60 `````` void init(Basis const& basis, SymmetryStructure symmetry = SymmetryStructure::unknown) `````` Praetorius, Simon committed Dec 30, 2019 61 `````` { `````` Praetorius, Simon committed Jan 10, 2020 62 `````` rows_ = basis.dimension(); `````` Praetorius, Simon committed Dec 30, 2019 63 `````` cols_ = rows_; `````` Praetorius, Simon committed Jan 10, 2020 64 `````` pattern_.resize(0, 0); // clear the old pattern `````` Praetorius, Simon committed Dec 30, 2019 65 66 `````` pattern_.resize(rows_, cols_); `````` Praetorius, Simon committed Jan 10, 2020 67 68 `````` auto localView = basis.localView(); for (const auto& element : elements(basis.gridView())) { `````` Praetorius, Simon committed Dec 30, 2019 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 `````` localView.bind(element); for (std::size_t i = 0, size = localView.size(); i < size; ++i) { // The global index of the i-th vertex of the element auto row = localView.index(i); for (std::size_t j = 0; j < size; ++j) { // The global index of the j-th vertex of the element auto col = localView.index(j); pattern_.add(row, col); } } } } // Update pattern when basis is updated. This method is called if rowBasis != colBasis. `````` Praetorius, Simon committed Jan 10, 2020 84 `````` template `````` Müller, Felix committed Jul 11, 2020 85 86 `````` void init(RowBasis const& rowBasis, ColBasis const& colBasis, SymmetryStructure symmetry = SymmetryStructure::unknown) `````` Praetorius, Simon committed Dec 30, 2019 87 `````` { `````` Praetorius, Simon committed Jan 10, 2020 88 89 90 91 92 93 `````` if (uintptr_t(&rowBasis) == uintptr_t(&colBasis)) return init(rowBasis); rows_ = rowBasis.dimension(); cols_ = colBasis.dimension(); pattern_.resize(0, 0); // clear the old pattern `````` Praetorius, Simon committed Dec 30, 2019 94 95 `````` pattern_.resize(rows_, cols_); `````` Praetorius, Simon committed Jan 10, 2020 96 97 98 `````` auto rowLocalView = rowBasis.localView(); auto colLocalView = colBasis.localView(); for (const auto& element : elements(rowBasis.gridView())) { `````` Praetorius, Simon committed Dec 30, 2019 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 `````` rowLocalView.bind(element); colLocalView.bind(element); for (std::size_t i = 0; i < rowLocalView.size(); ++i) { // The global index of the i-th vertex of the element auto row = rowLocalView.index(i); for (std::size_t j = 0; j < colLocalView.size(); ++j) { // The global index of the j-th vertex of the element auto col = colLocalView.index(j); pattern_.add(row, col); } } } } private: std::size_t rows_; std::size_t cols_; Dune::MatrixIndexSet pattern_; }; } // end namespace AMDiS`````` | 1,371 | 4,203 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.625 | 3 | CC-MAIN-2022-33 | latest | en | 0.544076 |
https://www.eng-tips.com/viewthread.cfm?qid=433159 | 1,708,954,908,000,000,000 | text/html | crawl-data/CC-MAIN-2024-10/segments/1707947474660.32/warc/CC-MAIN-20240226130305-20240226160305-00108.warc.gz | 745,103,719 | 12,529 | ×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS
Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!
*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.
#### Posting Guidelines
Promoting, selling, recruiting, coursework and thesis posting is forbidden.
# Period Ts of the Design Response Spectrum
## Period Ts of the Design Response Spectrum
(OP)
What is the explanation for the unit of Ts being in second when Ts is equal to Sds/Sd1 both (Sds &Sd1)being spectrum response acceleration values having the same units?
### RE: Period Ts of the Design Response Spectrum
Your question isn't clear. Seismic acceleration is a function dependent on period. Can you cite an equation number or section in the code that is in question?
### RE: Period Ts of the Design Response Spectrum
(OP)
Sure, ASCE7-12, paragraph 11.4.5, item 4 under equation 11.4-7, Ts = Sds/Sd1.
### RE: Period Ts of the Design Response Spectrum
Now, I understand. ASCE should explicitly define the units in the definition of the symbols, section 11.3 and where they are defined below the equations (T in seconds and the accelerations with g). But, if you look at figure 11.4-1, the Design Response Spectrum figure has the units.
### RE: Period Ts of the Design Response Spectrum
(OP)
But Sds/Sd1 units would cancel each other out, therefore Ts would be unitless. There must be something else at work
### RE: Period Ts of the Design Response Spectrum
In the response spectrum (Figure 11.4-1 in ASCE 7-05, for example), the accelerations are discussed as functions of Period T, but they treat T as a number rather than a dimension. So where the curve is labeled Sa = SD1/T, they are neglecting the units of time there. So more properly, they should include some inverse-second units or define a unitless time parameter.
#### Red Flag This Post
Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.
#### Red Flag Submitted
Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.
Close Box
# Join Eng-Tips® Today!
Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.
Here's Why Members Love Eng-Tips Forums:
• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...
Register now while it's still free! | 631 | 2,736 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.859375 | 3 | CC-MAIN-2024-10 | latest | en | 0.876324 |
https://www.solidpapers.com/collegepapers/World%20Literature/2813.htm | 1,611,765,999,000,000,000 | text/html | crawl-data/CC-MAIN-2021-04/segments/1610704828358.86/warc/CC-MAIN-20210127152334-20210127182334-00390.warc.gz | 933,274,450 | 7,760 | # Essay, Research Paper: Bible Code
## World Literature
Free World Literature research papers were donated by our members/visitors and are presented free of charge for informational use only. The essay or term paper you are seeing on this page was not produced by our company and should not be considered a sample of our research/writing service. We are neither affiliated with the author of this essay nor responsible for its content. If you need high quality, fresh and competent research / writing done on the subject of World Literature, use the professional writing service offered by our company.
The Bible Code is a report of the discovery concerning certain codes hidden in
the Bible that are able to foresee events. The code was first broken by an
Israeli mathematician, Dr. Eliyahu Rips, and has been confirmed by famous
mathematicians around the world. The three-thousand-year-old code foretells
events that happened thousands of years after the Bible was written. It foresaw
both Kennedy assassinations, the Oklahoma city bombing, the election of
President Bill Clinton, everything from World War II to Watergate, from the
Holocaust to Hiroshima, and from the Moon landing to the collision of a comet
with Jupiter. In an extremely complicated procedure, Israeli Doctors Doron
Witztum, Eliyahu Rips, and Yoav Rosenburg, were the first to search and analyze
the Bible for secret codes that reveal the future by using equidistant letter
sequences and statistical analysis. The Israeli researchers made careful
examinations and developed a collection of hypothesis, a collections of
“maybes”. Statistics provided the tools to test each and every one these
“maybes”. A hypothesis in mathematics may be declared false by the
presentation of a single example, which violates the hypothesis. The very first
thing the researchers did when they started their investigations was to make
“observations”. They grouped their “observations” and formulated a
hypothesis. Then, they tested the hypothesis. For example, a very common idea in
statistics is the concept of average. As a very simple proof we would declare
false a value for an average height for people of 10 feet. We all know that an
average height of 10 feet is definitely not possible. Definitely, we can say
that the concept of average participated in the analysis and conclusions when
the Israeli researchers investigated the letter and word sequences they found in
the Bible Code. Other statistical concepts that are easy to grasp are dispersion
or variability and correlation or association. It is obvious that the Israeli
researchers had to use some techniques to determine the extent of the dispersion
and the degree of correlation of the letter sequences. In this fashion, they
concluded that the observation regarding “equidistant letter distances” was
valid. Mathematical statistics provided the techniques for these evaluations. Of
course, there were many, many observations and probably a multitude of
statistical concepts were involved. There have even been a few dramatic cases
where detailed predictions were found in advance, and the events happened
exactly as predicted. Compellingly, the day that the Gulf War had begun was
found weeks before the war actually started. Additionally, the date of the
Jupiter collision was found months before the blast. Probably the most
provocative prediction of them all was the assassination of former Israeli Prime
Minister, Yitzchak Rabin. The author of this book, Michael Drosnin, had found
the assassination of Rabin predicted in the Bible more than one year before it
happened. Frantically, he attempted to warn Rabin of his findings. Sadly, the
situation was inevitable, and Rabin was murdered on November 4, 1995. Later,
Drosnin had discussed his findings and interviewed with many of the foremost
mathematicians around the world. He talked to experts from Yale, Harvard, and
Hebrew University. He even talked to a senior code-breaker at the United States
National Security Agency, who confirmed that there is a code hidden in the Bible
that does really reveal the future. It is very hard to deny what this book has
proved so well. Even though there has been much controversy about it, many
famous and respected experts have advocated and promoted this book with
conviction. It would be hard for anyone to throw away what this book is trying
to prove without having read its convincing points. Because of that, the content
of this book convinced me of its points. I find myself fascinated with this book
and urge anyone who has not read it to do so, for it will expand their mind.
Still, what the book is trying to convey is a very interesting but frightening
situation. No one really knows if the Bible accurately foretells what is to
come. However, the code may be a warning to this world of an unprecedented
danger, perhaps the real Apocalypse, a nuclear war. In any event, if there is
indeed a code hidden in the Bible, it forces us to accept what so many in the
world do not believe, that there is a God. And probably the most perplexing
question of all, does the Bible code describe our inevitable future which we
have no control over? Has our future already been cast in stone? Or does it
describe a series of possible futures whose ultimate outcome we can still
decide? Certainly, I hope our destiny is still up to us and is able to be
changed. Perhaps, that is something that is best not known.
Bibliography
1. Michael Drosnin, “ The Bible Code”, Simon & Shuster, 1997 2. W.J.
Dixon & Frank J. Massery, “ Introduction to Statistical Analysis”, 2nd
Edition, McGraw-Hill, 1957
0
0
Good or bad? How would you rate this essay?
Help other users to find the good and worthy free term papers and trash the bad ones.
Like this term paper? Vote & Promote so that others can find it
# Get a Custom Paper on World Literature:
Free papers will not meet the guidelines of your specific project. If you need a custom essay on World Literature: , we can write you a high quality authentic essay. While free essays can be traced by Turnitin (plagiarism detection program), our custom written papers will pass any plagiarism test, guaranteed. Our writing service will save you time and grade.
## Related essays:
0
0
Bless the Beast and the Children, what was the point of this book? To show boys can go from immature: betwetter's, to cowboys. There were three main events that took place in Bless the Beast and child...
2855 views
0
0
World Literature / Bluest Eye
Toni Morisson's novel The Bluest Eye is about the life of the Breedlove family who resides in Lorain, Ohio, in the late 1930s. This family consists of the mother Pauline, the father Cholly, the son Sa...
3418 views
0
0
World Literature / Body
The story was written from the point of view of a grown up person that took a part in the story when he was a child. Gordy tell us about his adventure with his body’s on a search after a dad body. The...
2444 views | 1,523 | 6,943 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.734375 | 3 | CC-MAIN-2021-04 | latest | en | 0.95947 |
https://www.scribd.com/doc/50716324/32977162-Ghidul-Incepatorului-Programare | 1,527,185,078,000,000,000 | text/html | crawl-data/CC-MAIN-2018-22/segments/1526794866733.77/warc/CC-MAIN-20180524170605-20180524190605-00075.warc.gz | 829,413,910 | 121,339 | # Cuprins
CUPRINS ................................................................................................................................................................. 1
INTRODUCERE ..................................................................................................................................................... 2
CE ŞANSE AM SĂ DEVIN UN BUN PROGRAMATOR ? ............................................................................... 4
LEGILE SUCCESULUI DURABIL (GHIDUL STUDENTULUI ÎNDĂRĂTNIC) ......................................... 9
PROBLEME DE JUDECATĂ ............................................................................................................................. 12
PROBLEME DE PERSPICACITATE ................................................................................................................................... 12
PROBLEME CU CHIBRITURI ......................................................................................................................................... 15
PROBLEME DE LOGICĂ ŞI JUDECATĂ ............................................................................................................................. 16
PROBLEME DE LOGICĂ ŞI JUDECATĂ CU "TENTĂ INFORMATICĂ" ........................................................................................ 20
NOŢIUNI FUNDAMENTALE DE PROGRAMARE ....................................................................................... 22
1. CELE TREI ETAPE ALE REZOLVĂRII UNEI PROBLEME CU AJUTORUL CALCULATORULUI ........................................................ 22
2. CUM SE STABILEŞTE CORECTITUDINEA ŞI EFICIENŢA SOLUŢIONĂRII ? ............................................................................. 23
3. NOŢIUNILE FUNDAMENTALE ALE PROGRAMĂRII: ALGORITM, LIMBAJE DE DESCRIERE A ALGORITMILOR, PROGRAM, LIMBAJE DE
PROGRAMARE ........................................................................................................................................................... 25
3.1. Algoritmul ............................................................................................................................................. 25
3.2. Descrierea algoritmilor ........................................................................................................................ 26
3.3 Programul ................................................................................................................................................. 29
4. SECRETUL ÎNVĂŢĂRII RAPIDE A PROGRAMĂRII ........................................................................................................... 30
NOŢIUNI PRIMARE DE PROGRAMARE ÎN PASCAL ŞI C ....................................................................... 31
EXEMPLE DE PROBLEME REZOLVATE ............................................................................................................................ 33
METODA PRACTICĂ DE ÎNVĂŢARE CE GARANTEAZĂ REZULTATE IMEDIATE ......................... 39
PROBLEME SELECŢIONATE - ENUNŢURI ................................................................................................. 39
PROBLEME PROPUSE SPRE REZOLVARE (PROBLEME DE ANTRENAMENT) .............................................................................. 39
PROBLEME DE EXAMEN ............................................................................................................................................. 42
PROBLEME DIFICILE .................................................................................................................................................. 45
PROBLEME NESOLUŢIONATE ÎNCĂ ................................................................................................................................ 48
PROBLEME INSOLVABILE ALGORITMIC .......................................................................................................................... 54
NOŢIUNI APROFUNDATE DE PROGRAMARE ........................................................................................... 58
METODE ŞI STRATEGII DE PROIECTARE A ALGORITMILOR (ALIAS TEHNICI DE PROGRAMARE) .................................................. 58
BACKTRACKING. .................................................................................................................................................... 63
GREEDY. ................................................................................................................................................................ 67
PROGRAMAREA DINAMICĂ. ....................................................................................................................................... 67
BRANCH & BOUND. ................................................................................................................................................. 69
RECURSIVITATEA ..................................................................................................................................................... 71
PROBLEME REZOLVATE ŞI EXERCIŢII DE PROGRAMARE ................................................................ 78
PROBLEME ELEMENTARE. EXERCIŢII DE PROGRAMARE .................................................................................................... 78
PROBLEME CE NECESITĂ BACK-TRACKING ................................................................................................................... 105
PROBLEME CU SOLUŢIE SURPRINZĂTOARE ................................................................................................................... 111
ELEMENTE DE PROGRAMARE A PC - URILOR .............................................................................................................. 120
CURIOZITĂŢI ŞI TRUCURI DE PROGRAMARE ................................................................................................................. 147
CONFRUNTARE DE OPINII: INFORMATICĂ VERSUS MATEMATICĂ ............................................. 151
BIBLIOGRAFIE, ADRESE ŞI LOCAŢII DE INTERES PE INTERNET ................................................... 154
Introducere
Există multe culegeri de probleme de informatică ce permit învăţarea şi perfecţionarea
în programare. Prin această culegere am încercat nu doar să sporim această mulţime cu încă
una ci să oferim un punct de vedere nou, original şi incitant. Originalitatea nu este dată de
enunţurile problemelor sau de rezolvările oferite, ci de ideile şi sfaturile cu caracter
mobilizator pe care le oferim, precum şi de faptul că am introdus cîteva capitole cu conţinut
mai puţin obişnuit într-o culegere de probleme de programare.
Ni s-a părut mai important ca în aceste vremuri, caracterizate prin cuvintele "mă simt
într-o permanentă criză de timp", să oferim cît mai mult din experienţa noastră directă, atît cea
de programator cît şi cea de profesor de programare. Deşi nu credem că există metode
perfecte de predare sau de învăţare a programării, totuşi sperăm că prin asimilarea
informaţiilor originale oferite eficienţa procesului de învăţare a programării în limbajele C şi
Pascal va creşte. Este important ca informaţiile suplimentare să fie asimilate gradat şi numai
în limita "suportabilităţii" fiecăruia. De aceea, în paginile ce urmează veţi găsi şi o serie de
informaţii şi sfaturi ce sintetizează experienţa didactică acumulată ca profesor de informatică
şi urmîndu-le vă asigurăm că veţi obţine succesul în programare.
În primele capitole a fost pus un accent important pe motivarea iniţială a celor ce
doresc să înveţe programare. În capitolul "Ce şanse am să devin un bun programator" sînt
chiar prezentate cu sinceritate înzestrările necesare unui bun programator.
Tot astfel se explică motivul introducerii unui capitol ce conţine probleme de judecată.
Rezolvarea acestora pot fi considerate nu doar ca un excelent antrenament al minţii ci şi ca o
bună ocazie de a aprinde pasiunea pentru informatică şi de a întări motivaţia programatorilor
începători.
Asta nu înseamnă că această culegere nu le este utilă şi celor care au dobîndit deja
suficiente cunoştinţe de programare. Am introdus în ea cîteva capitole ce conţin informaţii
mai puţin cunoscute. Unul cuprinde o listă de probleme deosebite, unele foarte dificile, altele
cărora nu li se cunoaşte încă o soluţie şi altele pentru care există demonstraţie riguroasă că nu
pot fi rezolvate cu ajutorul calculatorului. Alt capitol cuprinde exemple de programare a PC-
urilor: lucrul cu tastatura, mouse-ul, accesul direct la memoria ecran, etc. Iar unele capitole ca
Noţiuni aprofundate de programare, Probleme cu soluţie surprinzătoare sau Curiozităţi şi
trucuri de programare le sînt în întregime destinate celor care au depăşit stadiul de începător.
Probabil că aceste informaţii constituie o provocare destul de substanţială chiar şi pentru cei
avansaţi în ale programării.
2
În concluzie, scopul acestei culegeri nu este doar de a contribui la formarea şi
specializarea programatorilor sau pentru aprofundarea tehnicilor de programare, cît mai ales
de a le oferi o bază, o motivaţie şi o iniţiere celor care doresc să facă primii paşi în domeniul
programării. Iar acelor împătimiţi ai programării care se simt deja plictisiţi, sătui sau plafonaţi
le promitem că parcurgînd această culegere vor aprofunda cunoştinţele pe care şi le-au însuşit
deja şi, dacă vor avea curajul de "a se lua de piept" cu unele din problemele nesoluţionate
încă, li se va reaprinde cu siguranţă focul pasiunii pentru programare.
Începătorilor le urăm Bun venit în programare şi tuturor Mult succes !
3
Ce şanse am să devin un bun programator ?
Această întrebare apare deseori în discuţiile sincere dintre profesori şi studenţii lor
descurajaţi de întîrzierea apariţiei unor rezultate care să certifice buna lor calitate ca
programatori. Vom încerca în rîndurile ce urmează să răspundem cît mai clar la această
întrebare oferind, în plus, o perspectivă prospătată asupra acestui subiect, prin luarea în
considerare a unei serii de factori mai puţin utilizaţi în procesul didactic contemporan.
Mai întîi să vedem ce s-ar putea înţelege prin sigtagma “bun programator”, insisitînd
în continuare doar pe aprofundarea adjectivului bun, fără a mai defini sau detalia ce se
înţelege printr-un programator. Vom cita cuvintele recente ale lui Timoty Budd (profesor la
Oregon State University) care dă următoarea definiţie: “Un bun programator trebuie să fie
înzestrat cu tehnică, experienţă, capacitate de abstractizare, logică, inteligenţă, creativitate
şi talent”. Întru-totul de acord cu această definiţie vom trece în cele ce urmează la explicitarea
fiecărei calităţi.
Înainte vom deduce următoarea consecinţă imediată - deosebit de importantă - ce
rezultă din definiţia de mai sus: cele şapte calităţi trebuie să fie prezente toate pentru a se
obţine calificativul de bun programator. Deci, prin lipsa sau prin prezenţa “atrofiată” a uneia,
sau a mai multe din “ingredientele reţetei” de mai sus, acest calificativ nu mai poate fi atins.
1. Tehnica – este desigur o calitate ce poate fi, şi este, dobîndită doar prin aplicarea asiduă
(conform proverbului: “exerciţiul îl face pe maestru”) în activitatea concretă de
programare a tehnicilor de programare învăţate şi asimilate de către programator în timpul
formării sale profesionale. Nu este exclusă aici posibilitatea obţinerii tehnicii de
programare înafara unui cadru specializat (într-o facultate de profil), ci chiar există
posibilitatea obţinerii ei prin studiu individual şi formaţie proprie (autodidact ).
2. Experienţa – este perechea geamănă a calităţii de mai înainte, fără însă a se exclude una
pe cealaltă. Nu vom mai repeta cum şi în ce condiţii poate fi ea obţinută ci vom deduce
următoarea consecinţa imediată : nici un programator începător nu poate fi numit bun
programator întrucît el nu a avut cînd (adică timpul necesar) să dobîndească ambele
calităţi. Este binecunoscut faptul că o rubrică importantă ce se cere completată la angajare
sau la schimbarea locului de muncă este experienţa de programare în ani. Se consideră în
general că experienţa apare abia după minimum doi ani de programare. Acest fapt nu
4
trebuie privit ca o descurajare pentru cei mai tineri programatori ci mai degrabă ca pe un
motiv de ambiţionare şi ca o invitaţie la rapidă autoperfecţionare.
3. Abstractizarea – este o trăsătură a intelectului uman şi constituie un dat al oricărui om
normal, dar din păcate (!) este o însuşire prea puţin dezvoltată şi prea puţin folosită de
oamenii obişnuiţi. Ea constă din capacitatea de a extrage din context, de a vedea dincolo
de suprafaţa imediată şi de a putea sesiza structura – scheletul ce susţine întreaga reţea de
detalii ale unei probleme generale. Pentru a fi un bun programator acestă calitate trebuie
să fie net amplificată faţă de “normal” întrucît stă la baza oricărui proces de analiză şi
modelare a problemelor, cît şi la baza procesului de proiectare a soluţiilor generale.
Absenţa sau mai exact atrofierea acestei capacităţi se constată practic la studenţi prin
incapacitatea de a înţelege sau de a asimila explicaţii, demonstraţii sau modele abstracte
(simplu spus, o acută şi permanentă “lipsă de chef” atunci cînd sînt atinse anumite
subiecte ce nu mai au contact direct cu realitatea concretă, imediată – adică subiecte
abstracte). Metoda pentru a recăpăta sau a amplifica această capacitate este de a face cît
mai des uz de ea, adică de a o exersa mereu (conform zicalei “funcţia creează organul”)
într-un domeniu particular, susţinut de o motivaţie personală puternică. Altfel spus,
capacitatea noastră de abstractizare se va amplifica dacă vom încerca găsirea de soluţii la
problemele dintr-unul din domeniile noastre preferate, pentru că rezolvarea acestora va
fi automotivată, făcută “cu chef” şi va prezenta o doză sporită de atractivitate.
4. Logica – este o altă calitate intrinsecă a oricărui intelect sănătos. Ea este absolut necesară
atît pentru a putea folosi mecanismele mentale de deducţie şi inducţie logică, cît şi pentru
a putea înţelege uşor, dar în acelaşi timp corect, cursul – firul roşu al unei demonstraţii sau
al unui raţionament întins pe mai multe pagini. Asemenea tuturor calităţilor intrinseci
existente în stare potenţială, antrenarea şi amplificarea acesteia se face prin exerciţiu
repetat, prin folosirea ei în mod curent.Din păcate, doar prin rezolvarea de integrame nu se
ajunge la amplificarea logicii…
5. Inteligenţa – este una din cele mai de preţ calităţi intrinseci ale intelectului uman. În cîteva
cuvinte, fără a avea pretenţia de a da prin acestea o definiţie, prin inteligenţă înţelegem
capacitatea de a face (de a stabili) conexiuni sau legături noi şi folositoare (din latinescul
inter-legere) între idei, cunoştinţe sau informaţii “aparent fără legătură”. Faţă de logică, pe
care o considerăm ca fiind o calitate bazală, inteligenţa este o calitate ce se “întinde pe
verticala” intelectului şi are în plus trăsătura de a fi mult mai dinamică şi mai mobilă
(chiar fulgerător de rapidă) în acţiune. Pentru cultivarea, amplificarea şi cizelarea acestei
calităţi este nevoie de “punerea ei la lucru” cît mai des şi pe durate tot mai mari de timp.
5
Insatisfacţia obţinerii unor rezultate rapide sau chiar imediate este un obstacol ce poate fi
depăşit relativ uşor prin antrenarea inteligenţei pe un “teren” cunoscut şi accesibil, adică
în domeniul preferat de interes. În acest fel există siguranţa de a fi susţinut de atracţia
sporită pentru acel domeniu particular ceea ce va conduce prin efort perseverent (dar
susţinut de această dată cu pasiune !) la apariţia rezultatelor aşteptate şi, implicit, a
satisfacţiei.
6. Creativitatea – este o calitate intrinsecă nu numai intelectului uman ci însăşi vieţii în
general. Ea constă, în ultimă instanţă, în capacitatea de a face (de a produce) ceva cu
adevărat nou şi original. De aceea am putea afirma că toate organismele vii, prin
capacitatea lor de a se opune entropiei, creează mereu ordine din dezordine aducînd în
acest fel ceva nou, neaşteptat. Ceea ce se aşteaptă însă de la un bun programator nu este
doar acest tip de creativitate (gen: adaptare inconştientă şi instinctivă) ci o creativitate
conştientă, responsabilă, reflectată în adaptarea soluţiilor existente sau chiar inventarea
altora noi. În acest sens trebuie să menţionăm că există o legătură strînsă, dovedită şi
verificată în practică (chiar dacă pare oarecum inexplicabil la prima vedere), între
creativitate – inteligenţă fluidă – curiozitate – sublimarea impulsurilor erotice - umor şi
poftă de viaţă. Cultivarea şi amplificarea controlată a oricărora dintre aceste patru
trăsături va conduce în mod automat la amplificarea şi dinamizarea creativităţii
intelectuale.
7. Talentul – este singura calitate ce nu poate fi cultivată şi amplificată. În accepţiunea sa
obişnuită, prin talent se înţelege o sumă de înzestrări native sau o predispoziţie personală
pentru un anumit domeniu. Existenţa talentului este percepută de cel în cauză ca uşurinţă
– abilitate - dexteritate de a învăţa, asimila şi aplica toate cunoştinţele domeniului
respectiv, abilitate ce este simţită de cel "talentat" ca un fel de “ceva în plus” în
comparaţie cu capacităţile celor din jur. Din păcate, în accepţiunea comună se crede că
talentul este calitatea suficientă care permite oricui atingerea cu siguranţă a calificativului
bun programator, concepţie este infirmată de orice programator cu experienţă. Asta nu
înseamnă că lipsa talentului în programare este permisă pentru atingerea acestui nivel,
însă efortul, tenacitatea şi răbdarea existente în “cantităţi” mult sporite într-o asemenea
situaţie de ne-înzestrare cu talent vor permite o apropiere sigură de acest calificativ. Din
păcate, lipsa talentului va apărea la început sub forma unei insatisfacţii interioare şi ca o
impresie acută că lipsesc rezultatele. Reamintim că însăşi cuvîntul facultate are la origine
sensul de capacitate, potenţialitate, înzestrare. Deci, normal ar fi ca alegerea unui student
pentru frecventarea cursurilor unei Facultăţi să fi fost făcută ţinînd cont de aptitudinile şi
6
abilităţile celui în cauză, descoperite în prelabil, adică să se dovedească talentat pentru
domeniul ales. Acest lucru este cu atît mai important în cazul optării pentru învăţarea
programării, cunoscută fiind ca o specializare complexă şi solicitantă.
Reluînd în sinteză ideile prezentate, putem spune că:
• Pentru a fi un bun programator trebuie să fie prezente următorele şapte calităţi
într-o formă activă, dinamică: tehnică, experienţă, capacitate de abstractizare,
logică, inteligenţă, creativitate şi talent.
• Dintre toate cele şapte calităţi necesare programării de înaltă calitate, numai
una – talentul - nu este inerentă unui intelect sănătos. De altfel, prezenţa talentului nu
este absolut necesară pentru a deveni programator, dar în timp ce absenţa lui
îngreunează apropierea de calificativul bun programator, prezenţa lui şi amplificarea
celorlalte calităţi este o garanţie a succesului, ce va fi cu siguranţă obţinut, însă nu fără
efort, răbdare şi perseverenţă !
• Toate celelalte şase calităţi excluzînd talentul, prezente fiind într-o formă
potenţială, trebuiesc doar cultivate şi amplificate. Am prezentat mai sus în detaliu
modul de amplificare a fiecăreia.
• “Cheia secretă“ ce conduce cu siguranţă la declanşarea procesului de
dinamizare şi amplificare a fiecăreia din cele şase calităţi inerente este de a avea
mereu o motivaţie puternică (de a învăţa “cu chef” sau “cu tragere de inimă” !). Acest
fapt este posibil dacă se ţine cont de necesitatea adaptării efortului la domeniul
preferat al celui în cauză. La modul concret, este necesar ca toate aplicaţiile,
problemele, exerciţiile, întrebările, curiozităţile, inovaţiile, descoperirile, “săpăturile”,
etc., să fie făcute sau să fie alese, la început, din domeniul preferat (hobby-ul), chiar
dacă acesta nu are la prima vedere legătură cu programarea. Scopul ce se atinge cu
siguranţă în acest mod în această primă fază este acela de a pune “la lucru” inteligenţa,
creativitatea, logica, etc., ceea ce va conduce cu siguranţă la trezirea şi amplificarea
rapidă a acestor calităţi. Acest fapt va permite apoi trecerea la o a doua fază în care, pe
baza acumulărilor calitative obţinute, se poate trece la programarea propriu-zise
“înarmat cu forţe proaspete”.
7
Încheiem răspunzînd într-o singură frază întrebării din titlu Ce şanse am să devin un bun
programator ? :
dacă mă simt înzestrat cu talent pentru programare (adică nu mă simt inconfortabil
la acest subiect) atunci, mobilizîndu-mi voinţa (motivaţia) şi amplificîndu-mi capacitatea
de abstractizare, logica, inteligenţa şi creativitatea (ce există în mine într-o formă
potenţială), prin practică de programare voi acumula în timp tehnica şi experienţa
necesare pentru a deveni cu siguranţă un bun programator , însă nu fără efort, răbdare
şi perseverenţă.
8
Legile succesului durabil (Ghidul studentului îndărătnic)
Cunoaşte-ţi Regulile de aur ale studentului şmecher? Dacă nu, le puteţi fi afla “la o
bere”, de la şmecher la şmecher. Noi le vom numi "Anti-legile succesului durabil" şi vi le
prezentăm în continuare doar pentru a putea observa cum fiecare din aceste "legi" este o
răsturnare (pervertire) a adevăratelor legi ale succesului.
1. Cel mai important este să termini facultatea şi să te vezi cu diploma în mînă. Ce contează
cum? Cine mai ştie dup-aia… ?
2. De ce să-nveţi …? Şi aşa majoritatea materiilor sînt tembele şi n-o să-ţi folosească
niciodată în viaţă. …materiile tembele trebuie să fie predate numai pentru ca să cîştige şi
profii’ o pîine.
3. Pune-te bine cu profesorii pînă treci examenul. Stai cu ei la o ţigară în pauză. Lasă-i pe ei
să vorbească. Tu prefă-te că eşti interesat…
4. Ai trecut examenul? Da? Atunci… restul nu mai contează.
5. Nu contează dacă ai învăţat, ce ştii sau cît ştii. Important este să ai baftă la examen, să ai
mînă bună sau să mergi "bine pregătit"… La puţini profi’ nu se poate copia !
6. Sînt examene la care, se ştie bine, toată lumea copiază. Trebuie să fi nebun să-nveţi la ele!
7. Notele bune sînt numai pentru piloşi şi tocilari.
Acestor studenţi le sînt însă complet necunoscute Legile succesului durabil. Ele ar putea
fi intuite doar de acei puţini care s-au format şi s-au educat în spiritul ideilor ce urmează să le
explicăm în continuare. Aceste legi ne învaţă că bazele succesului durabil se pun încă din
timpul şcolii şi mai ales din timpul facultăţii. Şi ne mai învaţă că succesul astfel "start-at" este
destinat să dureze o viaţă întreagă.
1. Cel mai important în facultate este să-ţi faci o carte de vizită, nu-i suficient să “vînezi”
doar diploma. Dacă vei fi apreciat şi vei ajunge să fii considerat capabil sau chiar bun de
cadrele didactice "cu greutate", vei ajunge să fi cunoscut şi bine cotat după absolvire şi-ţi
vei găsi un loc bun de muncă. Întotdeauna a fost şi va fi nevoie de oameni capabili "pe
piaţa muncii", nu de licenţiaţi "piloşi", “tolomaci” sau “papagali”.
2. Cel mai important lucru în şcoală este că înveţi cum să înveţi. Cînd vrei să te recreezi
rezolvînd integrame nu prea contează ce din ce domeniu ţi le-ai ales. Important pentru tine
nu este cum, ci faptul că te destinzi. Tot astfel, în facultate important este nu neapărat ce
9
înveţi, ci că înveţi! Multe cunoştinţe le vei uita în primii ani după absolvire, mai ales cele
pe care ţi le-ai însuşit într-o stare de sforţare şi încrîncenare, fără plăcere. Cel mai
important este să înveţi de plăcere căci numai aşa vei învăţa cum să înveţi. Iar aceasta
nu se mai poate uita! Şi nu vei mai uita nicicînd că ai resursele şi puterea să treci prin forţe
proprii examenele cele mai grele.
3. Succesul în viaţă se bazează pe relaţii umane echilibrate. (Acest fapt era cunoscut şi pe
vremea regimului partidului comunist român P.C.R. însă datorită imoralităţii generalizate
a societăţii el a fost aplicat pe invers: astfel, a apela de P.C.R. însemna atunci să apelezi la
Pile, Cunoştinţe şi Relaţii.) Deci, cel mai important lucru în şcoală este să înveţi arta
de a stabilii relaţii umane prietenoase şi de încredere reciprocă. Ceea ce va conta cel
mai mult, peste ani, este că ai stabilit în timpul şcolii multe prietenii durabile şi de
încredere care te vor “îmbogăţii” astfel pentru toată viaţa. În plus, nu uita: şi profesorii
sînt oameni. Au şi ei nevoie de prieteni.
4. Colegii sînt martori şi devin cei mai exigenţi judecători ai trăsăturilor tale de caracter.
Examenul, indiferent de materie sau disciplină, cu emoţiile şi peripeţiile lui este în sine o
lecţie completă. Nu contează atît dacă l-ai luat sau dacă l-ai picat, ci contează cum!
Contează ce fel de om eşti în astfel de situaţii, cînd tocmai îţi construieşti “cartea de vizită
sau blazonul”. Nu uita că nu te afli doar în faţa profesorilor ci eşti tot timpul înconjurat de
colegii care te judecă, chiar dacă ţi-e nu-ţi spun. Pentru că aşa cum te comporţi acum în
examen, aşa te vei comporta toată viaţa.
5. Examenele grele sînt cele care îţi pot forma un caracter puternic. Ceea ce este important
în examen, ca şi în situaţiile de viaţă, este încrederea în reuşită şi stăpînirea de sine chiar
dacă n-ai învăţat toată materia. Dacă ai învăţat destul ca să te simţi stăpîn pe tine
atunci ai trecut examenul ! Chiar acesta a fost rostul lui, ce dacă ţi-a dat notă mică!
Crezi că, după ce vei trece examenul, peste zece ani îţi vei mai aminti cu ce notă ?
6. Cei cu un caracter slab şi vicios se vor da la un moment dat în vileag. Cei care copiază
nu-şi dau seama că ei îşi “infectează” caracterul. Şi nici cît de grave sînt consecinţele
infectării cu “microbul” cîştigului imediat obţinut prin furt. Oare se vor mai putea
debarasa vreodată de acest viciu tentant ? Dar de cunoscutele "efecte secundare":
sentimentul de nesiguranţă fără o fiţuică în buzunar, atracţia irezistibilă pentru “aruncarea
privirii” împrejur, părerea de rău că “Ce prost sînt, puteam să copiez tot !”, etc. cînd vor
mai scăpa ? Cei care se obişnuiesc să copieze, atît cît vor trăi, vor fi jumătate om-
jumătate fiţuică. Ca în vechile bancuri cu miliţieni…
10
7. Oricine este acum apt să înveţe şi să-şi însuşească pentru întreaga sa viaţă Legea
efortului. Pe profesori îi impresionează cel mai tare efortul depus şi-l vor aprecia cu note
maxime. Ei supra-notează pe cei “care vor, sînt bine intenţionaţi, dar încă nu pot”.
Profesorii cunosc adevărul exprimat în Legea omului de geniu (legea lui Einstein):
“Geniul este compus 99% din transpiraţie şi 1% din inspiraţie”. Profesorii adevăraţi
se străduiesc să noteze mai ales calitatea umană şi profesională a studentului. Reţineţi:
dacă studentul a fost prietenos, activ şi deschis în timpul anului şcolar şi a depus un efort
constant pentru a se perfecţiona, fapt ce nu a scăpat ochiului atent al profesorului,
examenul devine în final pentru el o formalitate…
Multe vorbe şi păreri pot fi auzite pe această temă în familie, în pauze la şcoală sau la
barul preferat. Cît sînt ele de adevărate? S-ar putea da oare o definiţie precisă pentru succesul
în viaţă ?
Noi nu cunoaştem o astfel de definiţie, ştim doar că există o multitudine de păreri şi
opinii, unele profund contradictorii. Este însă de bun simţ să credem că se poate numi “de
succes” acea viaţă care este plină de satisfacţii, bucurii şi visuri împlinite. Acea viaţă care să-
şi merite din plin exclamaţia: “Asta da, viaţă !” ?
Regula de aur a succesului durabil este: Învaţă să-ţi construieşti singur viaţa. Şi apoi,
dacă ai învăţat, apucă-te fără întîrziere să-ţi “faci” viaţa fericită.
Studenţia, prin entuziasmul, optimismul şi idealismul ei, este o perioadă optimă pentru a
învăţa cum să-ţi faci o viaţă de succes ! Atenţie, mulţi şi-au dat seama prea tîrziu că studenţia
a fost pentru ei în multe privinţe ultimul tren…
11
Probleme de judecată
Oferim în cele ce urmează o selecţie de probleme ce nu necesită cunoştinţe de
matematică avansate (doar nivelul gimnazial) dar care pun la încercare capacitatea de
judecată, inspiraţia şi creativitatea gîndirii. Rezolvarea acestor probleme constituie un bun
antrenament pentru creşterea capacităţii de gîndire creativă precum şi a fluidităţii gîndirii.
Credem că nu degeaba aceste două trăsături sînt considerate cele mai importante semne ale
tinereţii minţii.
Problemele, selectate din multiple surse, nu au putut fi grupate în ordinea dificultăţii
mai ales datorită diversităţii şi varietăţii lor. Ele au fost doar separate în cîteva categorii a
căror nume vrea să sugereze un anumit mod de gîndire pe care l-am folosit şi noi în
rezolvarea lor. Cele cu un grad mai mare de dificultate au fost marcate cu un semn (sau mai
multe semne) de exclamare.
Criteriul principal pe baza căruia s-a făcut această selecţie a fost următorul: fiecare
problemă cere în rezolvarea ei un minimum de inventivitate şi creativitate. Majoritatea
problemelor te pun "faţă în faţă cu imposibilul", aşa că rezolvarea fiecărei probleme necesită
depăşirea unor "limitări ale gîndirii" plus un minimum de originalitate în gîndire. Tocmai de
aceea, pentru rezolvarea lor este nevoie de efort, putere de concentrare şi perseverenţă. Zis
într-un singur cuvînt: este necesar şi un strop de pasiune.
Considerăm că eforturile consecvente ale celor care vor rezolva aceste probleme vor fi
din plin răsplătite prin plăcerea "minţii biruitoare" şi prin amplificarea calităţilor următoare:
capacitate sporită de efort intelectual, putere de concentrare mărită şi prospeţime în gîndire.
Vă dorim mult succes !
Probleme de perspicacitate
1. Ştiind că o sticlă cu dop costă 1500 lei şi că o sticlă fără dop costă 1000 lei, cît costă un
dop ?
2. Ştiind că un ou costă 1000 lei plus o jumătate de ou, cît costă un ou ?
3. Ce număr lipseşte alături de
ultima figură:
3 4 2 ?
12
4. Lui Popescu nici prin gînd nu-i trecea să folosească toate mijloacele pe care le avea la
îndemînă ca să lupte împotriva adversarilor tendinţei contra neintroducerii mişcării anti-
fumat. Care este poziţia lui Popescu: este pentru sau contra fumatului ?
5. Împărţirea "imposibilă". Să se împartă numărul 12 în două părţi astfel încît fiecare parte
să fie 7.
6. 9 puncte. Să se secţioneze toate cele 9 mici discuri cu o linie frîntă neîntreruptă (fără a
ridica creionul de pe hîrtie) compusă din 4 segmente. (!) Dar din trei segmente, este
posibil ?
7. Trei cutii. În trei cutii identice sînt închise trei perechi de fructe: fie o pereche de mere,
fie o pereche de pere, fie o pereche formată dintr-un măr şi o pară. Pe cele trei cutii sînt
lipite trei etichete: "două mere", "două pere" şi, respectiv, "un măr şi o pară". Ştiind că
nici una din etichete nu corespunde cu conţinutul cuitei închise pe care se află, să se afle
care este numărul minim de extrageri a cîte un fruct pentru a se stabili conţinutul fiecărei
cutii.
8. În ce direcţie merge autobuzul din desenul alăturat ?
9. (!) Întrerupătoarele. Pe peretele alăturat uşei încuiate de la intrarea unei încăperi, se află
trei întrerupătoare ce corespund cu cele trei becuri de pe plafonul încăperii în care nu
putem intra. Acţionînd oricare din întrerupătoare, dunga de lumină care apare pe sub uşă
ne asigură că niciunul din cele trei becuri nu este ars. Cum putem afla, fără a pătrunde în
încăpere, care întrerupător corespunde cu care bec ?
13
10. (!!) Cine mută ultimul cîştigă. Doi jucători dispun de o masă de joc de formă circulară
sau pătrată şi de un număr mare de monezi identice. Ei mută plasînd pe masa de joc în
spaţiul neocupat, fără suprapunere, cîte o monedă alternativ pînă cînd unul dintre jucători,
care pierde în acest caz, nu mai poate plasa nicăieri o monedă. Să se arate că primul
jucător are o strategie sigură de cîştig.
11. (!!!) Iepurele şi robotul-vînător. Într-o incintă închisă (un gen de arenă) se află un
iepuraş şi un robot-vînător înzestrat cu cleşti, mijloc de deplasare, calculator de proces şi
“ochi” electronici. Ştiind că viteza de deplasare a robotului-vînător este constantă şi de
zeci de ori mai mare decît a iepuraşului, ce şanse mai are iepuraşul de a scăpa ?
12. Cîntarul defect. Avînd la dispoziţie un cîntar gradat defect care greşeşte constant cu
aceeaşi valoare (cantitate necunoscută de grame), putem să cîntărim ceva determinîndu-i
corect greutatea ?
13. Jocul dubleţilor (inventat de Carroll Lewis). Ştiind că trecerea de la un cuvînt cu sens
la altul cu sens este permisă doar prin modificarea unei singure litere odată (de exemplu:
UNU ¬ UNI ¬ ANI ¬ ARI ¬ GRI ¬ GOI ¬ DOI ) se cere: Dovediţi că IARBA este
VERDE şi că MAIMUŢA a condus la OMENIRE, faceţi din UNU DOI, schimbaţi ROZ-ul
în ALB, puneţi ROUGE pe OBRAZ şi faceţi să fie VARA FRIG.
14. Împăturirea celor 8 pătrate. Împăturiţi iniţial în opt o foaie dreptunghiulară după care
desfaceţi-o şi însemnaţi fiecare din cele opt zone dreptunghiulare obţinute (marcate de
pliurile de îndoire) cu o cifră de la 1 la 8. Puteţi împături foaia astfel obţinută reducînd-o
de opt ori (la un singur dreptunghi sau pătrat) astfel încît trecînd cu un ac prin cele opt
pliuri suprapuse acesta să le perforeze exact în ordinea 1, 2, 3, …, 8 ? Încercaţi aceste
două configuraţii:
1 8 7 4
2 3 6 5
1 8 2 7
4 5 3 6
14
15. Problemă pentru cei puternici. Încercaţi să împăturiţi de 8 ori, pur şi simplu, o coală de
hîrtie (de fiecare dată linia de îndoire este "în cruce" peste cea dinainte). Este posibil ?
(!)Determinaţi ce dimensiuni ar trebui să aibă foaia la început pentru a putea fi împăturită
de 8 ori.
16. Este posibil ca un cal să treacă prin toate cele 64 de pătrăţele ale unei table de şah,
începînd dintr-un colţ şi terminînd în colţul diagonal opus ?
17. Într-un atelier există 10 lădiţe ce conţin fiecare piese cu greutatea de 100 grame, cu
excepţia uneia din lădiţe ce conţine piese avînd grutatea de 90 grame. Puteţi preciza care
este lădiţa cu pricina, folosind un cîntar doar pentru o singură dată ?
Probleme cu chibrituri
1. (!) Eliminînd un singur băţ de chibrit ceea ce rămîne în faţa ochilor este un elipsoid!
2. (!) 9 beţe. Să se aşeze 9 beţe de chibrit astfel încît ele să se întîlnescă la vîrf tot cîte trei în
şase vîrfuri distincte.
3. De la 4 la 3. În figura ce conţine 4 pătrate, mutînd 4 beţe să se obţină o figură ce conţine
doar 3 pătrate.
4. 6 = 2 ? Mutînd doar un singur băţ de chibrit să se restabilească egalitatea:
15
5. Problema ariilor întregi. Puteţi aşeza 12 chibrituri astfel încît ele să formeze contururile
unor poligoane ce au aria întreagă egală cu 5, (!!) 4, 3, 2, (!!!) 1 ? Se subînţelege că un
chibrit poate fi asimilat cu un segment de lungime 1 şi că nu există nici o dificultate de a
forma "din ochi" unghiuri drepte.
Probleme de logică şi judecată
1. Substituirea literelor. Subtituiţi literele cu cifre astfel încît următoarele adunări să fie
corecte: GERALD + DONALD = ROBERT ; FORTY + TEN + TEN = SIXTY ; BALON
+ OVAL = RUGBY.
2. Test de angajare la Microsoft. Patru excursionişti ajung pe malul unui rîu pe care doresc
să-l traverseze. Întrucît s-a înoptat şi ei dispun doar de o singură lanternă, ei pot să treacă
rîul cel mult cîte doi laolaltă. Ştiind că, datorită diferenţelor de vîrstă şi datorită oboselii,
ei ar avea individual nevoie pentru a traversa rîul de 1, 2, 8 şi 10 minute, se cere să se
decidă dacă este posibilă traversarea rîului în aceste conditţii în doar 17 minute ?
3. (!) Imposibilă. Să se taie toate cele 16 segmente ale figurii următoare cu o singură linie
curbă continuă şi care nu se intersectează cu ea însăşi.
4. (!) Problema "ochilor albaştri". Sîntem martorii următorului dialog între două persoane
X şi Y. << X: Eu am trei copii. Produsul vîrstei lor este 36 iar suma vîrstei lor este egală
cu numărul de etaje al blocului din vecini de mine. Îl ştii, nu-i aşa ? Y: Desigur. Dar
numai din cît mi-ai spsus nu pot să deduc care este vîrsta copiilor tăi. X: Bine, atunci află
că cel mare are ochi albaştrii.>> Puteţi afla care este vîrsta celor trei copii ?
5. Problema călugărului budhist. Într-o dimineaţă, exact la răsăritul soarelui, un călugăr
budhist porneşte de la templul de la baza muntelui pentru a ajunge la templul din vîrful
muntelui exact la apusul soarelui, unde el se roagă toată noaptea. A doua zi el porneşte din
vîrf pe aceeşi cărare, tot la răsăritul soarelui, pentru a ajunge la templul de la baza
16
muntelui exact la apusul soarelui. Să se arate că a existat un loc pe traseu în care călugărul
s-a aflat în ambele zile exact la aceaşi oră.
6. Vinul în apă şi apa în vin. Dintr-o sticlă ce conţine un litru de apă este luat un pahar (un
decilitru) ce este turnat pest un litru de vin. Vinul cu apa se amestecă bine după care se ia
cu acelaşi pahar o cantitate egală de "vin cu apă" ce se toarnă înapoi peste apa din sticlă.
Avem acum mai multă apă în vin decît vin în apă, sau invers ?
7. (!!!!) Cuiele în echilibru. Avem la dispoziţie 7 cuie normale, cu capul obişnuit. Înfigem
unul vertical în podea (sau într-o placă de lemn). Se cere să se aşeze cele 6 cuie rămase în
echilibru stabil pe capul cuiului vertical, fără ca niciunul din cele şase cuie să atingă
podeaua.
8. (!!) Ţigările tangente. Este posibil să aşezăm pe masă şase ţigări astfel încît fiecare să se
atingă cu fiecare (oricare două să fie tangente) ? (!!!) Dar şapte ţigări ?
9. (!) Problema celor 12 înţelepţi (în variantă modernă). Managerul unei mari companii
doreşte să pună la încercare inteligenţa şi puterea de judecată a celor 12 membrii ai
consiliului său de conducere. Luînd 12 cărţi de joc, unele de pică şi altele de caro, el le
aşează cîte una pe fruntea fiecărui consilier astfel încît fiecare să poată vedea cărţile de pe
frunţile celorlalţi dar nu şi pe a sa. Managerul le cere celor care consideră că au pe frunte o
carte de caro (diamond) să facă un pas în faţă, altfel ei nu vor mai putea face parte din
consiliu. După ce îşi repetă cererea de şapte ori, timp în care niciunul din cei 12 consilieri
nu face nici o mişcare (ci doar se privesc unii pe alţii), toţi consilierii care au într-adevăr
pe frunte o carte de caro ies deodată în faţă. Puteţi deduce cîţi au ieşit şi cum şi-au dat ei
seama ce carte este aşezată pe fruntea lor ?
10. Păianjenul şi musca. Pe peretele lateral al unei hale cu dimensiunile de 40 x 12 x12
metri, pe linia mediană a peretelui lateral şi exact la 1 metru de tavan, se află un păianjen.
Pe peretele lateral opus, tot pe linia mediană şi exact la 1 metru de podea, se află o muscă
amorţită. Care este distanţa cea mai scurtă pe care păianjenul o are de parcurs de-a lungul
pereţilor pentru a se înfrupta din muscă ?
17
11. Rifi şi Ruf. Cei doi iubiţi Rifi şi Ruf, din nordica ţară Ufu-Rufu, locuiesc în sate diferite
aflate la distanţa de 20 km unul de altul. În fiecare dimineaţă ei pornesc exact deodată (la
răsărit) unul spre celălalt spre a se întîlni şi a se săruta confrom obiceiului nordic: nas în
nas. Într-o dimineaţă o muscă rătăcită porneşte exact la răsăritul soarelui de pe nasul lui
Rifi direct spre nasul lui Ruf, care o alungă trimiţînd-o din nou spre nasul lui Rifi, ş.a.m.d.
..., pînă cînd ea sfîrşeşte tragic în momentul "sărutului" celor doi. Ştiind că Rifi se
deplasează cu 4 km/oră, Ruf cu 6 km/oră iar musca zboară cu 10 km/oră, se cere să se afle
ce distanţă a parcurs musca în zbor de la răsărit şi pînă în momentul tragicului ei sfîrşit.
12. O anti-problemă de şah. În următoarea configuraţie a pieselor pe o tablă de şah se cere
să nu daţi mat dintr-o mutare ! (Albul atacă de jos în sus. Legenda: P-pion, N-nebun, R-
rege, T-turn, C-cal. Alăturat fiecărei piese este scrisă culoarea sa, alb-a sau negru-n.)
Na Ra Ta
Tn Na
Ta
Nn Pn Pn
Pa Rn Pa
Pn Pa Pn
Pa Pa Pa
Ca Ca
13. Bronx contra Brooklyn. Un tînăr, ce locuieşte în Manhattan în imediata apropiere a unei
staţii de metrou, are două prietene, una în Brooklyn şi cealaltă în Bronx. Pentru a o vizita
pe cea din Brooklyn el ia metroul ce merge spre partea de jos a oraşului, în timp ce, pentru
a o vizita pe cea din Bronx, el ia din acelaşi loc metroul care merge în direcţie opusă.
Metrourile spre Brooklyn şi spre Bronx intră în staţie cu aceeşi frecvenţă: din 10 în 10
minute fiecare. Dar, deşi el coboară în staţia de metrou în fiecare sîmbătă la întîmplare şi
ia primul metrou care vine (nedorind să "favorizeze" pe nici una din prietenele sale), el a
constatat că, în medie, el merge în Brooklyn de 9 ori din 10. Puteţi găsi o explicaţie logică
14. (!!) Problema celor 12 bile. În faţa noastră se află 12 bile identice ca formă, vopsite la
fel, dar una este cu siguranţă falsă, ea fiind fie mai grea, fie mai uşoară, fiind făcută dintr-
un alt material. Avem la dispoziţie o balanţă şi se cere să determinăm doar prin 3 cîntăriri
18
care din cele 12 bile este falsă precizînd şi cum este ea: mai grea sau mai uşoară. (!!!) Mai
mult, puteţi determina care este numărul maxim de bile din care prin 4 cîntăriri cu balanţa
se poate afla exact bila falsă şi cum este ea ?
15. (!) Problema celor 2 perechi de mănuşi. Aflat într-o situaţie ce implică intervenţia de
urgenţă, un medic chirurg constată că are la dispoziţie doar 2 perechi de mănuşi sterile
deşi el trebuie să intervină rapid şi să opereze succesiv 3 bolnavi. Este posibil ca cele trei
operaţii de urgenţă să se desfăşoare în condiţii de protecţie normale cu numai cele 2
perechi de mănuşi ? (Sîngele fiecăruia din cei 3 pacienţi, precum şi mîna doctorului nu
trebuie să conducă la un contact infecţios.)
16. (!!) Problema frînghiei prea scurte. O persoană ce are asupra ei doar un briceag şi o
frînghie lungă de 30 metri se află pe marginea unei stînci, privind în jos la peretele
vertical de 40 metri aflat sub ea. Frînghia poate fi legată doar în vîrf sau la jumătatea
peretelui (la o înălţime de 20 metri de sol) unde se află o mică platformă de sprijin. Cum
este posibil ca persoana aflată în această situaţie să ajungă teafără jos coborînd numai pe
frînghie, fără a fi nevoită să sară deloc punîndu-se astfel în pericol ?
17. Problema lumînărilor neomogene. Avem la dispoziţie chibrite şi două lumînări care pot
arde exact 60 minute fiecare însă, ele fiind neomogene, nu vor arde cu o viteză constantă.
Cum putem măsura precis o durată de 45 minute ?
18. (!) Să vezi şi să nu crezi. Priviţi următoarele două figuri: prin reaşezarea decupajelor
interioare ale primeia se obţine din nou aceeaşi figură dar avînd un pătrăţel lipsă ! Cum
explicaţi "minunea" ?
19. (!!) O jumătate de litru. Avem în faţa noastră un vas cilindric cu capacitatea de 1 litru,
plin ochi cu apă. Se cere să măsurăm cu ajutorul lui ½ litru de apă, fără a ne ajuta de nimic
altceva decît de mîinile noastre.
19
Probleme de logică şi judecată cu "tentă informatică"
1. (!!!) Decriptarea scrierii încifrate. Se dau următoarele numere împreună cu denumirile
lor cifrate:
5 nabivogedu
6 nagevogedu
30 nabivodunanabivobiduvogedu
60 nabivonagevogedunagevogenanabivobiduvogedu
Care este regula de încifrare? Ce numere reprezintă următoarele coduri cifrate:
nagevonagevogedunanabivobiduvogedu;
nanabivogeduvogedu;
nanagevobiduvogedu?
Încifraţi numerele 256 şi 1024 prin acestă metodă.
2. (!!!) Altfel de codificare binară a numerelor. Descoperiţi metoda de codificare binară a
numerelor folosită în continuare:
1 1 20 101010
2 10 25 1000101
3 11 30 1010001
5 110 40 10001001
10 1110 50 10100100
15 10010 60 100001000
Puteţi spune ce numere sînt codificate prin 100, 101, 1000, 1111, 10000 şi 11111 ?
Puteţi codifica numerele 70, 80, 90, 100, 120, 150 şi 1000 ?
20
3. (!!!) Problema dialogului perplex. Există două numere m şi n din intervalul [2..99] şi
două persoane P şi S astfel încît persoana P ştie produsul lor, iar S ştie suma lor. Ştiind că
între P şi S a avut loc următorul dialog:
"Nu ştiu numerele" spune P.
"Ştiam ca nu ştii" răspunde S, "nici eu nu ştiu."
"Acuma ştiu !" zice P strălucind de bucurie.
"Acum ştiu şi eu…" şopteşte satisfăcut S.
să se determine toate perechile de numere m şi n ce "satisfac" acest dialog (sînt soluţii ale
problemei).
4. (!!!!) Împăturirea celor 8 pătrate. Împăturiţi iniţial în opt o foaie dreptunghiulară după
care desfaceţi-o şi însemnaţi fiecare pătrăţel obţinut cu o cifră de la 1 la 8. Proiectaţi un
algoritm şi realizaţi un program care, primind configuraţia (numerotarea) celor 8 pătrăţele,
să poată decide dacă se poate împături foaia astfel obţinută reducînd-o de opt ori (la un
singur pătrat) astfel încît trecînd cu un ac prin cele opt foi suprapuse acesta să le
perforeze exact în ordinea 1, 2, 3, …, 8.
5. (!!!!) Problema fetelor de la pension. Problema a apărut pe vremea cînd fetele învăţau la
pension fără ca prin prezenţa lor băieţii să le tulbure educaţia. Pedagoaga fetelor unui
pension de 15 fete a hotarît ca în fiecare dupa-amiază, la ora de plimbare, fetele să se
plimbe în cinci grupuri de cîte trei. Se cere să se stabilească o programare a plimbărilor pe
durata unei săptămîni (şapte zile) astfel încît fiecare fată să ajungă să se plimbe numai o
singură dată cu oricare din celelalte paisprezece (oricare două fete să nu se plimbe de două
ori împreună în decursul unei săptămîni).
21
Noţiuni fundamentale de programare
Programarea este disciplina informatică ce are ca scop realizarea de programe care să
constituie soluţiile oferite cu ajutorul calculatorului unor probleme concrete. Programatorii
sînt acele persoane capabile să implementeze într-un limbaj de programare metoda sau
algoritmul propus ca soluţie respectivei probleme, ce se pretează a fi soluţionată cu ajutorul
calculatorului. După nivelul de implicare în efortul de rezolvare a problemelor specialiştii în
programare pot fi împărţiţi în diverse categorii: analişti, analişti-programatori, ingineri-
programatori, simpli programatori, etc. Cu toţii au însă în comun faptul că fiecare trebuie să
cunoască cît mai bine programare şi să fie capabil, nu doar să citească, ci chiar să scrie “codul
sursă”, adică programul propriu-zis. Din acest punct de vedere cunoştinţele de programare
sînt considerate “ABC-ul” informaticii şi sînt indispensabile oricărui profesionist în domeniu.
1. Cele trei etape ale rezolvării unei probleme cu ajutorul calculatorului
În rezolvarea sa cu ajutorul calculatorului orice problemă trece prin trei etape
obligatorii: Analiza problemei, Proiectarea algoritmului de soluţionare şi Implementarea
algoritmului într-un program pe calculator. În ultima etapă, sub acelaşi nume, au fost incluse
în plus două subetape cunoscute sub numele de Testarea şi Întreţinerea programului. Aceste
subetape nu lipsesc din “ciclul de viaţă” a oricărui produs-program ce “se respectă” dar ,
pentru simplificare, în continuare ne vom referi doar la primele trei mari etape.
Dacă etapa implementării algoritmului într-un program executabil este o etapă
exclusiv practică, realizată “în faţa calculatorului”, celelalte două etape au un pronunţat
caracter teoretic. În consecinţă, primele două etape sînt caracterizate de un anumit grad de
abstractizare. Din punct de vedere practic însă, şi în ultimă instanţă, criteriul decisiv ce
conferă succesul rezolvării problemei este dat de calitatea implementării propriuzise. Mai
exact, succesul soluţionării este dat de performanţele programului: utilitate, viteză de
execuţie, fiabilitate, posibilităţi de dezvoltare ulterioare, lizibilitate, etc. Cu toate acestea este
imatură şi neprofesională “strategia” programatorilor începători care, neglijînd primele două
etape, sar direct la a treia fugind de analiză şi de componenta abstractă a efortului de
soluţionare. Ei se justifică cu toţii prin expresii puerile de genul: “Eu nu vreau să mai pierd
vremea cu “teoria”, am să fac programul cum ştiu eu. Cîtă vreme nu va face altcineva altul
mai bun decît al meu, nu am de ce să-mi mai bat capul !”.
22
2. Cum se stabileşte corectitudinea şi eficienţa soluţionării ?
Este adevărat că ultima etapă în rezolvarea unei probleme – implementarea – este
decisivă şi doveditoare, dar primele două etape au o importanţă capitală. Ele sînt singurele ce
pot oferi răspunsuri corecte la următoarele întrebări dificile: Avem certitudinea că soluţia
găsită este corectă ? Avem certitudinea că problema este complet rezolvată ? Cît de eficientă
este soluţia găsită ? Cît de departe este soluţia aleasă de o soluţie optimă ?
Să menţionăm în plus că literatura informatică de specialitate conţine un număr
impresionant de probleme “capcană” pentru începători, şi nu numai pentru ei. Ele provin
majoritatea din realitatea imediată dar pentru fiecare dintre ele nu se cunosc soluţii eficiente.
De exemplu, este dovedit teoretic că problema, “aparent banală” pentru un calculator, a
proiectării Orarului optim într-o instituţie de învăţămînt (şcoală, liceu, facultate) este o
problemă intratabilă la ora actuală (toate programele care s-au realizat pînă acum nu oferă
decît soluţii aproximative fără a putea spune cît de aproape sau de departe este soluţia optimă
de orar).
Cîţi dintre programatorii începători n-ar fi surprinşi să afle că problema “atît de
simplă” (ca enunţ), a cărei soluţionare tocmai au abandonat-o, este de fapt o problemă
dovedită teoretic ca fiind intratabilă sau chiar insolvabilă algoritmic ? Partea proastă a
lucrurilor este că, aşa cum ciupercile otrăvite nu pot fi cu uşurinţă deosebite de cele
comestibile, tot astfel problemele netratabile pot fi cu uşurinţă confundate cu nişte probleme
uşoare la o privire rapidă şi lipsită de experienţă.
Dacă ar fi să sintetizăm în cîte un cuvînt efortul asupra căruia se concentrează fiecare
din cele trei etape – analiza, proiectarea şi implementarea– cele trei cuvinte ar fi:
corectitudine, eficienţă şi impecabilitate. Etapa de analiză este singura care permite dovedirea
cu argumente riguroase a corectitudinii soluţiei, iar etapa de proiectare este singura care poate
oferi argumente precise în favoarea eficienţei soluţiei propuse.
În general problemele concrete din informatică au în forma lor iniţială sau în enunţ o
caracteristică pragmatică, fiind foarte ancorate în realitatea imediată. Totuşi ele conţin în
formularea lor iniţială un grad mare de eterogenitate, diversitate şi lipsă de rigoare. Fiecare
dintre aceste “defecte” este un obstacol major pentru demonstrarea corectitudinii soluţiei.
Rolul esenţial al etapei de analiză este acela de a transfera problema “de pe nisipurile
mişcătoare” ale realităţii imediate de unde ea provine într-un plan abstract, adică de a o
modela. Acest “univers paralel abstract” este dotat cu mai multă rigoare şi disciplină internă,
avînd legi precise, şi poate oferi instrumentele logice şi formale necesare pentru demonstrarea
23
riguroasă a corectitudinii soluţiei problemei. Planul abstract în care sînt “transportate” toate
problemele de informatică este planul sau universul obiectelor matematice iar corespondentul
problemei în acest plan va fi modelul matematic abstract asociat problemei. Demonstrarea
corectitudinii proprietăţilor ce leagă obiectele universului matematic a fost şi este sarcina
matematicienilor. Celui ce analizează problema din punct de vedere informatic îi revine
sarcina (nu tocmai uşoară) de a dovedi printr-o demonstraţie constructivă că există o
corespondenţă precisă (o bijecţie !) între părţile componente ale problemei reale,
“dezasamblată” în timpul analizei, şi părţile componente ale modelului abstract asociat. Odată
descoperită, formulată precis şi dovedită, această “perfectă oglindire” a problemei reale în
planul obiectelor matematice oferă certitudinea că toate proprietăţile şi legăturile ce există
între subansamblele modelului abstract se vor regăsii precis (prin reflectare) între părţile
interne ale problemei reale, şi invers. Atunci, soluţiei abstracte descoperite cu ajutorul
modelului matematic abstract îi va corespunde o soluţie reală concretizată printr-un algoritm
ce poate fi implementat într-un program executabil.
Aceasta este calea generală de rezolvare a problemelor şi oricine poate verifica acest
fapt. De exemplu, ca şi exerciţiu, încercaţi să demonstraţi corectitudinea (adică să se aducă
argumente precise, clare şi convingătoare în favoarea corectitudinii) metodei de extragere a
radicalului învăţată încă din şcoala primară (cu grupare cifrelor numărului în grupuri cîte
două, etc…) sau a algoritmului lui Euclid de determinare a celui mai mare divizor comun a
două numere prin împărţiri întregi repetate. Desigur nu pot fi acceptate argumente copilăreşti
de forma: “Algoritmul este corect pentru că aşa l-am învăţat!” sau “Este corect pentru că aşa
face toată lumea !” din moment ce nu se oferă o argumentaţie matematică riguroasă.
Ideea centrală a etapei a doua – proiectarea unui algoritm de soluţionare eficient poate
fi formulată astfel: din studiul proprietăţilor şi limitelor modelului matematic abstract asociat
problemei se deduc limitele inferioare ale complexităţii minimale (“efortului minimal
obligatoriu”) inerente oricărui algoritm ce va soluţiona problema în cauză. Complexitatea
internă a modelului abstract şi complexitatea soluţiei abstracte se va reflecta imediat asupra
complexităţii reale a algoritmului, adică asupra eficienţei de soluţionare a problemei. Acest
fapt permite prognosticarea încă din această fază – faza de proiectare a algoritmului de
soluţionare – a eficienţei practice, măsurabilă ca durată de execuţie, a programului.
24
3. Noţiunile fundamentale ale programării: algoritm, limbaje de descriere a
algoritmilor, program, limbaje de programare
3.1. Algoritmul
Se ştie că la baza oricărui program stă un algoritm (care, uneori, este numit metodă de
rezolvare). Noţiunea de algoritm este o noţiune fundamentală în informatică şi înţelegerea ei,
alături de înţelegerea modului de funcţionare a unui calculator, permite înţelegerea noţiunii de
program executabil. Vom oferi în continuare o definiţie unanim acceptată pentru noţiunea de
algoritm:
Definiţie. Prin algoritm se înţelege o mulţime finită de operaţii (instrucţiuni)
elementare care executate într-o ordine bine stabilită (determinată), pornind de la un set de
date de intrare dintr-un domeniu de valori posibile (valide), produce în timp finit un set de
date de ieşire (rezultate).
Cele trei caracteristici esenţiale ale unui algoritm sînt:
1. Determinismul – dat de faptul că ordinea de execuţie a instrucţiunilor algoritmului este
bine precizată (strict determinată).
Acest fapt dă una din calităţile de bază a calculatorului: “el” va face întotdeauna ceea ce i
s-a cerut (prin program) să facă, “el” nu va avea iniţiative sau opţiuni proprii, “el” nu-şi
permite să greşească nici măcar odată, “el” nu se va plictisi ci va duce programul la
acelaşi sfîrşit indiferent de cîte ori i se va cere să repete acest lucru. Nu aceeaşi situaţie se
întîmplă cu fiinţele umane (Errare humanum est). Oamenii pot avea în situaţii
determinate un comportament non-deterministic (surprinzător). Acesta este motivul
pentru care numeroşi utilizatori de calculatoare (de exemplu contabilii), datorită
fenomenului de personificare a calculatorului (confundarea acţiunilor şi dialogului
“simulat” de programul ce rulează pe calculator cu reacţiile unei personalităţi vii), nu
recunosc perfectul determinism ce stă la baza executării oricărui program pe calculator.
Exprimîndu-se prin propoziţii de felul: “De trei ori i-am dat să facă calculele şi de
fiecare dată mi-a scos aceleaşi valori aiurea!” ei îşi trădează propria viziune
personificatoare asupra unui fenomen determinist.
25
2. Universalitatea – dată de faptul că, privind algoritmul ca pe o metodă automată
(mecanică) de rezolvare, această metodă are un caracter general-universal. Algoritmul nu
oferă o soluţie punctuală, pentru un singur set de date de intrare, ci oferă soluţie pentru o
mulţime foarte largă (de cele mai multe ori infinită) de date de intrare valide. Aceasta este
trăsătura de bază care explică deosebita utilitate a calculatoarelor şi datorită acestei
trăsături sîntem siguri că investiţia financiară făcută prin cumpărarea unui calculator şi a
produsului-soft necesar va putea fi cu siguranţă amortizată. Cheltuiala se face o singură
dată în timp ce programul pe calculator va putea fi executat rapid şi economicos de un
număr oricît de mare de ori, pe date diferite !
De exemplu, metoda (algoritmul) de rezolvare învăţată la liceu a ecuaţiilor de gradul doi:
ax
2
+bx+c=0, se aplică cu succes pentru o mulţime infinită de date de intrare: (a,b,c)∈ℜ\
{0}xℜxℜ.
3. Finitudinea – pentru fiecare intrare validă orice algoritm trebuie să conducă în timp finit
(după un număr finit de paşi) la un rezultat. Această caracteristică este analogă
proprietăţii de convergenţă a unor metode din matematică: trebuie să avem garanţia,
dinainte de a aplica metoda (algoritmul), că metoda se termină cu succes (ea converge
către soluţie).
Să observăm şi diferenţa: în timp ce metoda matematică este corectă chiar dacă ea
converge către soluţie doar la infinit (!), un algoritm trebuie să întoarcă rezultatul după un
număr finit de paşi. Să observăm deasemenea că, acolo unde matematica nu oferă dovada,
algoritmul nu va fi capabil să o ofere nici el. De exemplu, nu este greu de scris un
algoritm care să verifice corectitudinea Conjecturii lui Goldbach: “Orice număr par se
scrie ca sumă de două numere prime”, dar, deşi programul rezultat poate fi lăsat să ruleze
pînă la valori extrem de mari, fără să apară nici un contra-exemplu, totuşi conjectura nu
poate fi astfel infirmată (dar nici afirmată!).
3.2. Descrierea algoritmilor
Două dintre metodele clasice de descriere a algoritmilor sînt denumite Schemele logice şi
Pseudo-Codul. Ambele metode de descriere conţin doar patru operaţii (instrucţiuni)
elementare care au fiecare un corespondent atît schemă logică cît şi în pseudo-cod.
În cele ce urmează vom înşira doar varianta oferită de pseudo-cod întrucît folosirea
schemelor logice s-a redus drastic în ultimii ani. Schemele logice mai pot fi întîlnite sub
26
numele de diagrame de proces în anumite cărţi de specialitate inginereşti. Avantajul descrierii
algoritmilor prin scheme logice este dat de libertatea totală de înlănţuire a operaţiilor (practic,
săgeata care descrie ordinea de execuţie, pleacă de la o operaţie şi poate fi trasată înspre orice
altă operaţie). Este demonstrat matematic riguros că descrierea prin pseudo-cod, deşi pare
mult mai restrictivă (operaţiile nu pot fi înlănţuite oricum, ci trebuie executate în ordinea
citirii: de sus în jos şi de la stînga la dreapta), este totuşi perfect echivalentă. Deci, este
dovedit că plusul de ordine, rigoare şi simplitate pe care îl oferă descrierea prin pseudo-cod nu
îngrădeşte prin nimic libertatea programării. Totuşi, programele scrise în limbajele de
asamblare, care sînt mult mai compacte şi au dimensiunile mult reduse, nu ar putea fi descrise
altfel decît prin scheme logice.
1. Atribuirea – var:=expresie;
2. Intrare/Ieşire – Citeşte var
1
, var
2
, var
3
, …;
Scrie var
1
, var
2
, var
3
, …; sau Scrie expresia
1
, expresia
2
, expresia
3
,…;
3. Condiţionala - Dacă <condiţie_logică> atunci instrucţiune
1
[altfel instrucţiune
2
];
4. Ciclurile – Există (din motive de uşurinţă a descrierii algoritmilor) trei tipuri de
instrucţiuni de ciclare. Ele sînt echivalente între ele, oricare variantă de descriere putînd fi
folosită în locul celorlalte două, cu modificări sau adăugiri minimale:
Repetă instrucţiune
1
, instrucţiune
2
, … pînă cînd <condiţie_logică>;
Cît timp <condiţie_logică> execută instrucţiune;
Pentru var_contor:=val_iniţială pînă la val_finală execută instrucţiune;
În cazul ciclurilor, grupul instrucţiunilor ce se repetă se numeşte corpul ciclului iar
condiţia logică care (asemenea semaforului de circulaţie) permite sau nu reluarea execuţiei
ciclului este denumită condiţia de ciclare sau condiţia de scurt-circuitare (după caz).
Observăm că ciclul de tipul Repetă are condiţia de repetare la sfîrşit ceea ce are ca şi
consecinţă faptul că corpul ciclului se execută cel puţin odată, în mod obligatoriu, înainte de
verificarea condiţiei logice. Nu acelaşi lucru se întîmplă în cazul ciclului de tipul Cît timp,
cînd este posibil ca instrucţiunea compusă din corpul ciclului să nu poată fi executată nici
măcar odată. În plus, să mai observăm că ciclul de tipul Pentru … pînă la conţine (în mod
ascuns) o instrucţiune de incrementare a variabilei contor.
În limba engleză, cea pe care se bazează toate limbajele actuale de programare acestor
instrucţiuni, exprimate în limba română, le corespund respectiv: 2. Read, Write; 3. If-Then-
Else; 4. Repeat-Until, Do-While, For. Să observăm că, mai ales pentru un vorbitor de limbă
27
engleză, programele scrise într-un limbaj de programare ce cuprinde aceste instrucţiuni este
foarte uşor de citit şi de înţeles, el fiind foarte apropiat de scrierea naturală. Limbajele de
programare care sînt relativ apropiate de limbajele naturale sînt denumite limbaje de nivel
înalt (high-level), de exemplu limbajul Pascal, spre deosebire de limbajele de programare mai
apropiate de codurile numerice ale instrucţiunilor microprocesorului. Acestea din urmă se
numesc limbaje de nivel scăzut (low-level), de exemplu limbajul de asamblare. Limbajul de
programare C are un statut mai special el putînd fi privit, datorită structurii sale, ca făcînd
parte din ambele categorii.
Peste tot unde în pseudo-cod apare cuvîntul instrucţiune el poate fi înlocuit cu oricare
din cele patru instrucţiuni elementare. Această substituire poartă numele de imbricare (de la
englezescul brick-cărămidă). Prin instrucţiune se va înţelege atunci, fie o singură instrucţiune
simplă (una din cele patru), fie o instrucţiune compusă. Instrucţiunea compusă este formată
dintr-un grup de instrucţiuni delimitate şi grupate în mod precis (între acolade { } în C sau
între begin şi end în Pascal).
Spre deosebire de pseudo-cod care permite doar structurile noi formate prin
imbricarea repetată a celor patru instrucţiuni (cărămizi) în modul precizat, schemele logice
permit structurarea în orice succesiune a celor patru instrucţiuni elementare, ordinea lor de
execuţie fiind dată de sensul săgeţilor. Repetăm că deşi, aparent, pseudo-codul limitează
libertatea de descriere doar la structurile prezentate, o teoremă fundamentală pentru
programare afirmă că puterea de descriere a pseudo-limbajului este aceeaşi cu cea a
schemelor logice.
Forma de programare care se bazează doar pe cele patru structuri se numeşte
programare structurată (spre deosebire de programarea nestructurată bazată pe descrierea
prin scheme logice). Teorema de echivalenţă a puterii de descriere prin pseudo-cod cu
puterea de descriere prin schemă logică afirmă că programarea structurată (aparent limitată
de cele patru structuri) este echivalentă cu programarea nestructurată (liberă de structuri
impuse). Evident, prin ordinea, lizibilitatea şi fiabilitatea oferită de cele patru structuri
elementare (şi asta fără a îngrădi libertatea de exprimare) programarea structurată este net
avantajoasă. În fapt, limbajele de programare nestructurată (Fortran, Basic) au fost de mult
scoase din uz, ele (limbajele de asamblare) sînt necesare a fi folosite în continuare doar în
programarea de sistem şi în programarea industrială (în automatizări).
28
3.3 Programul
Prin program se înţelege un şir de instrucţiuni-maşină care sînt rezultatul compilării
algoritmului proiectat spre rezolvarea problemei dorite ce a fost descris într-un limbaj de
programare (ca şi cod sursă).
Etapele realizării unui program sînt:
× Editarea codului sursă, etapă ce se realizează cu ajutorul unui program editor de texte
rezultatul fiind un fişier Pascal sau C, cu extensia .pas sau .c (.cpp)
× Compilarea, etapa de traducere din limbajul de programare Pascal sau C în limbajul intern
al micro-procesorului, şi este realizată cu ajutorul programului compilator Pascal sau C şi
are ca rezultat un fişier obiect, cu extensia .obj (în limbajul C) sau .exe (în limbajul
Pascal)
× Link-editarea, etapă la care se adaugă modului obiect rezultat la compilare diferite
module conţinînd subprograme şi rutine de bibliotecă, rezultînd un fişier executabil
(această etapă este comasată în Turbo Pascal sau Borland Pascal cu etapa de compilare),
cu extensia .exe
× Execuţia (Run), etapa de lansare în execuţie propriu-zisă a programului obţinut, lansare
realizată de interpretorul de comenzi al sistemului de operare (command.com pentru
sistemele DOS+Windows)
Observăm că aceste patru (sau trei, pentru Turbo Pascal) etape sînt complet independente
în timp unele de altele şi necesită utilizarea a patru programe ajutătoare: Editor de texte,
Compilator Pascal sau C, Link-editor şi Interpretorul de comenzi al S.O. În cazul mediilor de
programare integrate (Turbo sau Borland) comandarea acestor patru programe ajutătoare
precum şi depanarea erorilor de execuţie este mult facilitată.
Deasemenea, merită subliniat faptul că în timp ce fişierul text Pascal sau C, ce conţine
codul sursă, poate fi transportat pe orice maşină (calculator) indiferent de micro-procesorul
acesteia urmînd a fi compilat "la faţa locului", în cazul fişierului obiect acesta nu mai poate fi
folosit decît pe maşina (calculatorul) pentru care a fost creat (datorită instrucţiunilor specifice
micro-procesorului din care este compus). Deci, pe calculatoare diferite (avînd micro-
procesoare diferite) vom avea nevoie de compilatoare Pascal sau C diferite.
În plus, să remarcăm faptul că fişierele obiect rezultate în urma compilării pot fi link-
editate (cu grijă !) împreună chiar dacă provin din limbaje de programare diferite. Astfel, un
program rezultat (un fişier .exe sau .com) poate fi compus din module obiect care provin din
surse diferite (fişiere Pascal, C, asamblare, etc.).
29
4. Secretul învăţării rapide a programării
Există posibilitatea învăţării rapide a programării ?
Desigur. Experienţa predării şi învăţării programării ne-a dovedit că există metode
diferite de învăţare a programării, mai rapide sau mai lente, mai temeinice sau mai
superficiale. Din moment ce se doreşte învăţarea rapidă a programării înseamnă că, pentru cel
ce doreşte aceasta, problemele ce îşi aşteaptă rezolvarea cu ajutorul calculatorului sînt
importante sau stringente. Am putea chiar presupune că soluţionarea lor rapidă este un
deziderat mai important decît învăţarea programării. Tocmai de aceea, fiind conştienţi de
acest fapt, vom prezenta în continuare una din cele mai rapide metode de învăţare a
programării.
Să observăm mai întîi că pentru învăţarea unei limbi străine este necesară comunicarea
şi vorbirea intensă a acelei limbi. Cu toţii am putut constata că dacă există o motivaţie sau
nevoie puternică de a comunica în acea limbă, cel puţin pentru o perioadă de timp, procesul
de învăţare a ei este foarte rapid. De exemplu, dacă ne aflăm într-o ţară străină sau dacă dorim
apropierea de o persoană străină (mai ales dacă este atrăgătoare şi de sex opus…) categoric
vom constata că am învăţat mult mai iute limba respectivă. Şi aceasta datorită faptului că
efortul de învăţare a fost mascat în spatele efortului (intens motivat!) de a comunica şi de a ne
face cunoscute intenţiile şi gîndurile.
La fel, pentru învăţarea rapidă şi cu uşurinţă a programării efortul trebuie îndreptat, nu
spre “silabisirea” limbajului de programare, ci spre rezolvarea de probleme şi spre scrierea
directă a programelor de soluţionare a acestora. Concentrîndu-ne asupra problemelor ce le
soluţionăm nici nu vom observa cînd şi în ce fel am învăţat să scriem programe. La urma
urmei, programarea este doar un instrument, doar o unealtă “de scris”, şi nu un scop în sine.
Dacă vrei iute să înveţi să scrii, contează cum sau în ce mînă ţii stiloul ?…
Nu trebuie deloc neglijat şi un al doilea "factor secret". Aşa cum “meseria nu se
învaţă, ci se fură“, tot astfel programarea se poate învăţa mult mai uşor apelînd la ajutorul
unui profesor sau a unui specialist. Acesta, prin experienţa şi cunoştinţele sale de specialitate
ne poate ajuta să păşim alături de el “pe cărări bătătorite” şi într-un ritm susţinut.
În concluzie, într-o descriere plastică şi metaforică, metoda secretă cea mai rapidă de
“ascensiune” în programare este metoda “privirii concentrate spre vîrf, cu ghidul alături şi pe
cărări bătătorite”.
30
Noţiuni primare de programare în Pascal şi C
În spiritul celor spuse mai sus, vom introduce acum "într-un ritm alert", prin exemple
concrete, noţiunile elementare de programare în limbajele Pascal şi C (în paralel). Vom pleca
de la prezentarea structurii generale a unui program iar apoi vom trece la prezentarea celor
patru structuri-instrucţiuni elementare conţinute în psedo-limbajul de descriere a algoritmilor.
Vom avea în plus grijă de a precede descrierea fiecărei structuri elementare de liniile de
declarare a tipului variabilelor implicate. Peste tot vor apare linii de comentariu (ignorate de
compilator). În limbajul Pascal comentariile sînt cuprinse între acolade {comentariu}, pe cînd
în C ele sînt cuprinde între construcţia de tipul /* comentariu*/ sau apar la sfîrşitul liniei
precedate de două slash-uri //comentariu.
Structura unui program
Program Nume_de_Program; {această linie
poate să lipsească}
{Zona de declaraţii constante, variabile,
proceduri şi funcţii }
BEGIN
{ Corpul programului format din
instrucţiuni terminate cu punct-vigulă ;
Corpul programului poate fi privit ca o
instrucţiune compusă }
END.
(Orice se va scrie după punct va fi ignorat
de către compilator)
// linii de incluziuni de fişiere header
// declaraţii de variabile şi funcţii externe
(globale)
void main(void){
// declaraţii de variabile locale
// corpul programului format din
instrucţiuni terminate cu punct-vigulă ;
}
Exemplu :
Program Un_Simplu_Test;
Const e=2.68;
Var x:real;
BEGIN
x:=1./2+e*(1+e);
Writeln(‘Rezultatul este:’,x);
END.
Exemplu :
#include <stdio.h>
int e=2.68;
float x;
void main(void){
x=1./2+e*(1+e);
printf(“Rezultatul este %f:”,x);
}
Atribuirea : var:=expresie;
Var i,j:integer;perimetrul:real;
…………..
j:=2000 div 15; { împărţire întreagă
obligatorie }
i:=i+(j-1)*Sqr(2*j+1); { Sqr (Square) –
funcţia de ridicare la pătrat }
perimetrul:=2*PI*i; { PI – constantă reală
implicită }
#include <math.h> // declară constanta
M_PI
int i,j; float perimetrul;
…………..
j=2000 / 15; // împărţire întreagă
implicită !!
i+=(j-1)* (2*j+1)*(2*j+1); // în C avem
operatorul
// de adunare + înainte de egal = ; funcţia
31
putere în
// C este pow(x,y)
perimetrul=2*M_PI*i;
Intrare/Ieşire :
Citeşte var
1
, var
2
, var
3
, …;
Scrie var
1
, var
2
, var
3
, …;
Sau
Scrie expresia
1
, expresia
2
, expresia
3
,…;
Var i,j:integer;perimetrul:real;
…………..
Readln(i,j); { citirea variabilelor i şi j }
Perimetrul:=2*PI*i;
Writeln(‘Raza=’,i:4,’
Perimetrul=’,perimetrul:6:2,’ Aria=’,
PI*Sqr(i):6:2);
{ perimetrul si aria fiind valori reale, se
afiseaza cu descriptorul de format de
afisare :6:2 – pe 6 poziţii de ecran cu
rotunjit la 2 zecimale }
#include <math.h> // declară constanta
M_PI
int i,j; float perimetrul;
…………..
scanf(“%i %i”,&i,&j); // “%i %i” este
descriptorul de format de citire, & este
perimetrul=2*M_PI *i;
printf(“Raza=%4i Perimetrul= %6.2f Aria=
%6.2f”,i,perimetrul,M_PI*i*i); // %6.2f –
descriptorul de format de afisare a unei
valori reale(flotante) pe 6 poziţii rotunjit la
2 zecimale
Condiţionala :
Dacă <condiţie_logică> atunci instrucţiune
1
[altfel instrucţiune
2
];
Var i,j,suma:integer;
…………..
If i <= 2*j+1 then suma:=suma+i
else suma:=suma+j;
int i,j,suma;
…………..
if (i<=2*j+1) suma+=i
else suma+=j;
Ciclul de tipul Repeat-Until:
Repetă instrucţiune
1
, instrucţiune
2
, … pînă cînd <condiţie_logică>;
Var i,j,suma:integer;
…………..
suma:=0;i:=1;
Repeat
suma:=suma+i; i:=i+1;
Until i>100;
int i,j,suma;
…………..
suma=0;i=1;
do
suma+=i;
while (i++<100);
Ciclul de tipul Do-While:
Cît timp <condiţie_logică> execută instrucţiune;
Var i,j,suma:integer;
…………..
suma:=0;i:=1;
While i<=100 do begin
suma:=suma+i; i:=i+1;
End;
int i,j,suma;
…………..
suma=0;i=1;
while (i++<100)
suma+=i;
Ciclul de tipul For (cu contor):
Pentru var_contor:=val_iniţială pînă la val_finală execută instrucţiune;
Var i,j,suma:integer;
…………..
suma:=0;
For i:=1 to 100 do
Suma:=suma+i;
int i,j, suma;
…………..
for(suma=0,i=1;i<=100;i++)
suma+=i;
32
Exemple de probleme rezolvate
Prezentăm în continuare, spre iniţiere, cîteva exemple de probleme rezolvate. Vom
oferi programul rezultat atît în limbajul de programare Pascal cît şi în limbajul C.
Deasemenea, fiecare program va fi precedat de o scurtă descriere a modului de elaborare a
soluţiei.
1. Se citesc a,b,c coeficienţii reali a unei ecuaţii de gradul II. Să se afişeze soluţile
ecuaţiei.
Descrierea algoritmului:
- ecuaţia de gradul II este de forma ax
2
+bx+c=0
- presupunînd că a ≠ 0 calculăm determinantul ecuaţiei delta=b*b-4*a*c
- dacă delta >= 0 atunci ecuaţia are soluţiile reale x
1,2
=(-b±√ delta)/(2*a)
- dacă delta < 0 atunci ecuaţia are soluţiile complexe z
1
=(-b/(2*a), √(-delta)/(2*a)), z
1
=
(-b/(2*a), -√(-delta)/(2*a))
Program Ecuatie_grad_2; { varianta Pascal }
Var a,b,c,delta:real;
BEGIN
delta:=b*b-4*a*c;
If delta>=0 then
Begin
Writeln('x1=',(-b-sqrt(delta))/(2*a):6:2);
Writeln('x2=',(-b+sqrt(delta))/(2*a):6:2);
End
else Begin
Writeln('z1=(',-b/(2*a):6:2, ‘,’ , -sqrt(-delta))/(2*a):6:2, ‘)’);
Writeln('z2=(', -b/(2*a):6:2, ‘,’ , sqrt(-delta))/(2*a):6:2, ‘)’);
End
END.
33
// versiunea C
#include <stdio.h>
#include <math.h>
float a,b,c; // coeficientii ecuatiei de gradul II
float delta;
void main(){
printf("Introd.coefic.ecuatiei a b c:");scanf("%f %f %f",&a,&b,&c);
delta=b*b-4*a*c;
if (delta>=0) {
printf("Sol.reale: x1=%6.2f, x2=%6.2f",(-b+sqrt(delta))/2./a,(-b-sqrt(delta))/2./a);
} else {
printf("Sol.complexe: x1=(%6.2f,%6.2f), x2=(%6.2f,%6.2f)",-b/2./a,sqrt(-delta)/2./a,-b/2/a,-
sqrt(- delta)/2./a);
}
}
2. Să se determine dacă trei numere a,b,c reale pot reprezenta laturile unui triunghi.
Dacă da, să se caculeze perimetrul şi aria sa.
Descrierea algoritmului:
- condiţia necesară pentru ca trei numere să poată fi lungimile laturilor unui triunghi este ca
cele trei numere să fie pozitive (condiţie implicită) şi suma a oricăror două dintre ele să fie
mai mare decît cel de-al treilea număr
- după condiţia este îndeplinită vom calcula perimetrul şi aria triunghiului folosind formula
lui Heron s=sqrt(p(p-a)(p-b)(p-c)) unde p=(a+b+c)/2.
Program Laturile_Unui_Triunghi; { Pascal }
Var a,b,c,s,p:real;
function laturi_ok:boolean;
begin
laturi_ok:= (a>0) and (b>0) and (c>0) and (a+b>c) and (a+c>b) and (b+c>a) ;
end;
BEGIN
IF laturi_ok then
34
begin
p:=(a+b+c)/2;
s:=sqrt(p*(p-a)*(p-b)*(p-c));
writeln('Aria=',s:5:2);
writeln(‘Perimetrul=’,2*p:5:2);
end
else writeln('Nu formeaza triunghi');
END.
// versiunea C
#include <stdio.h>
#include <math.h>
float a,b,c,s,p;
int validare_laturi(float a,float b,float c){
return( (a>0)&&(b>0)&&(c>0)&&(a+b>c)&&(b+c>a)&&(a+c>b));
}
void main(void){
printf(“Introd.laturile a b c:”);scanf(“%f %f %f”,&a,&b,&c);
if (validare_laturi(a,b,c)){
p=(a+b+c)/2;s=sqrt(p*(p-a)*(p-b)*(p-c));
printf(“Aria=%6.2f, Perimetrul=%6.2f”,s,2*p);
}
}
3. Se citeşte n întreg. Să se determine suma primelor n numere naturale.
Descrierea algoritmului:
- vom oferi varianta în care suma primelor n numere naturale va fi calculata cu una dintre
instructiunile repetitive cunoscute(for,while ,repeat) fără a apela la formula matematică
cunoscută S(n)=n*(n+1)/2
35
Program Suma_n; { Pascal }
Var n,s,i:word;
BEGIN
s:=0;
For i:=1 to n do s:=s+i;
Writeln(‘s=’,s);
END.
// versiunea C
#include <stdio.h>
int n,s;
void main(void){
printf(“Introd. n:”); scanf(“%i”,&n);
for(;n>0;n--)s+=n;
printf(“S(n)=%i”,s);
}
4. Se citeşte valoarea întreagă p. Să se determine daca p este număr prim.
Descrierea algoritmului:
- un număr p este prim dacă nu are nici un divizor înafară de 1 şi p cu ajutorul unei variabile
contor d vom parcurge toate valorile intervalului [2.. √p]; acest interval este suficient pentru
depistarea unui divizor, căci: d
1
| p ⇒p = d
1
*d
2
(unde d
1
< d
2
) ⇒d
1
≤ √ d
1
*d
2
= √p iar d
2
≥ √
d
1
*d
2
= √p
Program Nr_prim; { Pascal }
Var p,i:word;
prim:boolean;
BEGIN
prim:=true;
36
for i:=2 to trunc(sqrt(p)) do
if n mod i=0 then prim:=false;
prim:=true;
if prim then
write(p,' este nr prim')
else
write(p,' nu e nr prim');
END.
// versiunea C (optimizată !)
#include <stdio.h>
#include <math.h>
int p,i,prim;
void main(void){
printf(“Introd. p:”); scanf(“%i”,&p);
for(i=3, prim=p % 2; (i<=sqrt(p))&&(prim); i+=2)
prim=p % i;
printf(“%i %s nr.prim”, p, (prim ? ”este”: ”nu este”));
}
5. Se citeşte o propoziţie (şir de caractere) terminată cu punct. Să se determine cîte
vocale şi cîte consoane conţine propoziţia.
Program Vocale;
Var sir:string[80];
Vocale,Consoane,i:integer;
BEGIN
Write(‘Introd.propozitia terminata cu punct:’);Realn(sir);
i:=1;Vocale:=0;Consoane:=0;
While sir[i]<>’.’ do begin
If Upcase(sir[i]) in [‘A’,’E’,’I’,’O’,’U’] then Inc(Vocale)
else If Upcase(sir[i]) in [‘A’..’Z’] then Inc(Consoane);
Inc(i);
end;
37
Writeln(‘Vocale:’,Vocale,’ Consoane:’, Consoane,’ Alte caractere:’,i-Vocale-Consoane);
END.
// versiunea C
#include <stdio.h>
#include <ctype.h>
int i,vocale=0,consoane=0;
char c,sir[80];
void main(void){
printf("Introd.propozitia terminata cu punct:");gets(sir);
for(i=0;sir[i]!='.';i++)
switch (toupper(sir[i])){
case 'A':
case 'E':
case 'I':
case 'O':
case 'U': vocale++; break;
default: if (isalpha(sir[i])) consoane++;
}
printf("Vocale:%i, Consoane:%i, Alte car.:%i", vocale, consoane, i-vocale-consoane);
}
38
Metoda practică de învăţare ce garantează rezultate imediate
Dacă cele spuse mai sus cu privire la secretul învăţării rapide a programării, acum nu
ne mai rămîne decît să începem să aplicăm practic ideile prezentate. Pentru aceasta, avem la
dispoziţie următoarea metodă care garantează cu siguranţă rezultate. Iat-o, pe paşi:
1. se citeşte şi se înţelege cît mai bine exemplul de problemă rezolvată (se poate începe chiar
cu primul exemplu de mai sus)
2. se acoperă (se ascunde) soluţia şi se încearcă reproducerea ei din memorie (reinventarea
soluţiei) pe calculator
3. numai în cazuri excepţionale se poate apela (se poate trage cu ochiul) la soluţie
Oricare dintre noi poate recunoaşte aici metoda pe care o aplică copiii din primele clase
primare: metoda trasului cu ochiul la rezultatul aflat la spatele manualului sau al culegerii de
probleme. Din moment ce metoda este verificată şi garantată (am folosit-o şi noi cîndva), de
ce ne-ar fi ruşine s-o aplicăm acum din nou ?
Iată în continuare o listă de probleme de "antrenament" care au majoritea rezolvarea
într-unul din capitolele următoare. Este numai bine pentru a începe să aplicăm metoda oferită
chiar acum !
Probleme selecţionate - Enunţuri
Probleme propuse spre rezolvare (probleme de antrenament)
1. Se citesc a, b, c trei variabile reale.
× Să se afişeze maximul şi minimul celor trei numere.
× Să se afişeze cele trei numere în ordine crescătoare.
× Să se determine dacă cele trei numere pot reprezenta laturile unui triunghi. Dacă da, să se
determine dacă triunghiul respectiv este isoscel, echilateral sau oarecare.
× Să se determine dacă cele trei numere pot reprezenta laturile unui triunghi. Dacă da, să se
determine mărimile unghiurilor sale şi dacă este ascuţit-unghic sau obtuz-unghic.
× Să se afişeze media aritmetică, geometrică şi hiperbolică a celor trei valori.
39
2. Se citeşte n o valoare întreagă pozitivă.
× Să se determine dacă n este divizibil cu 3 dar nu este divizibil cu 11.
× Să se determine dacă n este pătrat sau cub perfect.
× Să se afişeze primele n pătrate perfecte.
× Să se determine numărul cuburilor perfecte mai mici decît n.
× Să se găsească primul număr prim mai mare decît n.
× Să se afişeze primele n numere prime: 2, 3, 5, 7,…, p
n
.
× Să se determine toate numerele de 4 cifre divizibile cu n.
× Să se determine suma cifrelor lui n.
× Să se afişeze răsturnatul lui n. (Ex: n=1993 => n_răsturnat =3991).
× Să se afişeze următorul triunghi de numere:
1
1 2
1 2 3
……..
1 2 3 … n
3. Se citesc m, n două variabile întregi pozitive.
× Să se determine toate pătratele perfecte cuprinse între m şi n, inclusiv.
× Să se determine toate numerele prime cuprinse între m şi n.
× Să se determine toate numerele de 4 cifre care se divid atît cu n cît şi cu m.
× Să se determine c.m.m.d.c. al celor două numere folosind algoritmul lui
Euclid.
4. Să se calculeze u
20
, u
30
, u
50
ai şirului cu formula recursivă u
n
=1/12u
n-1
+1/2u
n-2
pentru n>=2
şi u
0
=1, u
1
=1/2.
5. Se citeşte n gradul unui polinom şi şirul a
n
, a
n-1
, … , a
1
, a
0
coeficienţilor unui polinom P.
× Se citeşte x, să se determine P(x).
× Se citesc x şi y, să se determine dacă polinomul P schimbă de semn de la x la
y.
40
× Se citeşte a, să se determine restul împărţirii lui P la x-a.
6. Se citesc m, n gradele a două polinoame P şi Q, şi coeficienţii acestora. Să se determine
polinomul produs R=PxQ.
7. Se citeşte o propoziţie (şir de caractere) terminată cu punct.
× Să se determine cîte vocale şi cîte consoane conţine propoziţia.
× Să se afişeze propoziţia în ordine inversă şi cu literele inversate (mari cu mici).
× Să se afişeze fiecare cuvînt din propoziţie pe cîte o linie separată.
× Să se afişeze propoziţia rezultată prin inserarea în spatele fiecărei vocale ‘v’ a şirului “pv”
(“vorbirea găinească”).
8. Se citeşte m, n dimensiunea unei matrici A=(a
i,j
)
mxn
de valori reale.
× Se citesc l, c. Să se afişeze matricea obţinută prin eliminarea liniei l şi a coloanei c.
× Se citeşte n întreg pozitiv, să se afişeze matricea obţinută prin permutarea circulară a
liniilor matricii cu n poziţii.
× Să se determine suma elementelor pe fiecare linie şi coloană.
× Să se determine numărul elementelor pozitive şi negative din matrice.
× Să se determine linia şi coloana în care se află valoarea maximă din matrice.
× Să se determine linia care are suma elementelor maximă.
9. Se citesc m, n, p şi apoi se citesc două matrici A=(a
i,j
)
mxn
şi B=(b
j,k
)
nxp
.Să se determine
matricea produs C=AxB.
10. Se citeşte un fişier ce conţine mai multe linii de text.
× Să se afişeze linia care are lungime minimă.
× Să se afişeze liniile care conţin un anumit cuvînt citit în prealabil.
× Să se creeze un fişier care are acelaşi conţinut dar în ordine inversă.
41
Probleme de examen
1. Se citeşte x o valoarea reală. Să se determine radical(x) cu 5 zecimale exacte pe baza
şirului convergent x
n
=1/2 (x
n-1
+x / x
n-1
) cu x
0
>0 arbitrar ales.
2. Se citeşte x o valoarea reală şi k un număr natural. Să se determine radical de ordinul k
din x cu 5 zecimale exacte pe baza şirului convergent x
n
=1/k ( (k-1) x
n-1
+x / x
n-1
k-1
) cu x
0
>0
arbitrar ales.
3. Să se determine c.m.m.m.c. a două numere m, n citite.
4. Se citeşte n, să se determine toate perechile (x, y) care au cmmmc(x,y)=n.
5. Se citesc a, b, c întregi pozitive, să se determine toate perechile întregi (x, y) care conduc
la egalitatea c=ax+by.
6. Se citeşte n o valoare întreagă pozitivă. Să se determine toate descompunerile în diferenţă
de pătrate a lui n.
7. Să se determine toate tripletele (i, j, k) de numere naturale ce verifică relaţia i
2
+j
2
+k
2
=n
unde n se citeşte.
8. Se citeşte n, să se afişeze toate numerele pitagoreice mai mici sau egale cu n.
9. Se citeşte n, să se determine toate numerele perfecte mai mici decît n. (Un număr este
perfect dacă este egal cu suma divizorilor săi, ex. 6=1+2+3.)
10. Se citeşte n, să se afişeze toate numerele de n cifre, formate numai cu cifrele 1 şi 2 şi care
se divid cu 2
n
.
11. Se citeşte n, să se afişeze toate numerele de n cifre care adunate cu răsturnatul lor dau un
pătrat perfect.
12. Se citeşte n întreg pozitiv, să se afişeze n transcris în baza 2.
13. Se citeşte n întreg pozitiv scris în baza 2, să se afişeze n transcris în baza 10.
14. Se citeşte n întreg pozitiv, să se afişeze n în transcripţia romană. (Ex: 1993=MCMXCIII ,
unde M=1000, D=500, C=100, L=50, X=10, V=5, I=1.)
15. Se citeşte n, să se afişeze descompunerea acestuia în factori primi.
16. Se citesc m, n numărătorul şi numitorul unei fracţii. Să se simplifice această fracţie.
17. Se citeşte n, să se afişeze toate posibilităţile de scriere a lui n ca sumă de numere
consecutive.
18. Se citeşte n şi k, să se afişeze n ca sumă de k numere distincte.
19. Se citeşte n, să se determine o alegere a semnelor + şi – astfel încît să avem relaţia
1± 2± …± (n+1) ± n=0, dacă ea este posibilă.
42
20. Se citeşte n şi şirul de valori reale x
1
, x
2
, … , x
n-1
, x
n
ordonat crescător. Să se determine
distanţa maximă între două elemente consecutive din şir.
21. Se citeşte n gradul unui polinom şi şirul x
n
, x
n-1
, … , x
1
soluţiilor reale a unui polinom P.
Să se determine şirul a
n
, a
n-1
, … , a
1
, a
0
coeficienţilor polinomului P.
22. Se citesc două şiruri de valori reale x
1
, x
2
, … , x
n-1
, x
n
şi y
1
, y
2
, … , y
m-1
, y
m
ordonate
crescător. Să se afişeze şirul z
1
, z
2
, … , z
n+m-1
, z
n+m
rezultat prin interclasarea celor două
şiruri.
23. Un şir de fracţii ireductibile din intervalul [0,1] cu numitorul mai mic sau egal cu n se
numeşte şir Farey de ordinul n. De exemplu, şirul Farey de ordinul 5 (ordonat crescător)
este: 0/1, 1/5, ¼, 1/3, 2/5, ½, 3/5, 2/3, ¾, 4/5, 1/1. Să se determine şirul Farey de ordinul
n, cu n citit.
24. Se citeşte n şi S o permutare a mulţimii {1, 2, …, n}. Să se determine numărul de
inversiuni şi signatura permutării S.
25. Se citeşte n şi S o permutare a mulţimii {1, 2, …, n}. Să se determine cel mai mic număr k
pentru care S
k
={1, 2, …, n}.
26. Fie M={1, 3, 4, …} mulţimea numerelor obţinute pe baza regulii R1, şi a regulii R2
aplicate de un număr finit de ori: R1) 1∈M R2) Dacă x∈M atunci y=2x+1 şi z=3x+1
aparţin lui M. Se citeşte n, să se determine dacă n aparţine mulţimii M fără a genera toate
elementele acesteia mai mici decît n.
27. Se citeşte n, k şi o matrice A=(a
i,j
)
nxn
pătratică. Să se determine A
k
.
28. Se citeşte n şi o matrice A=(a
i,j
)
nxn
pătratică. Să se determine d determinantul matricii A.
29. Se citeşte n şi cele n perechi (x
i
, y
i
) de coordonate a n puncte P
i
în plan. Să se determine
care dintre cele n puncte poate fi centrul unui cerc acoperitor de rază minimă.
30. Să se determine, cu 5 zecimale exacte, rădăcina ecuaţiei x
3
+x+1=0 care există şi este unică
în intervalul [-1,1].
31. Se citeşte n şi şirul de valori reale x
1
, x
2
, … , x
n-1
, x
n
. Să se determine poziţia de început şi
lungimea celui mai mare subşir de numere pozitive.
32. Se citeşte n, să se afişeze binomul lui Newton: (x+y)
n
.
33. Se citeşte n, să se afişeze binomul lui Newton generalizat: (x
1
+x
2
+…+x
p
)
n
=Σ n!/(n
1
!n
2
!…
n
p
!) x
1
n
1
x
2
n
2
…x
p
n
p
pentru n
1
+n
2
+…+n
p
=n şi n
i
>0, i=1,p.
34. Se citeşte n, să se determine descompunerea lui n ca sumă de numere Fibonacci distincte.
(F
n
=F
n-1
+F
n-2
pentru n>1 şi F
1
=1, F
0
=0).
43
35. Avem la dispoziţie următoarele trei operaţii care se pot efectua asupra unui număr n: O1) i
se adaugă la sfîrşit cifra 4; O2) i se adaugă la sfîrşit cifra 0; O3) dacă n este par se împarte
la 2. Să se afişeze şirul operaţiilor care se aplică succesiv, pornind de la 4, pentru a obţine
un n care se citeşte.
36. Fie funcţia lui Ackermann definită astfel: A(i,n)=n+1 pentru i=0; A(i,n)=A(i-1,1) pentru
i>0 şi n=0; A(i,n)=A(i-1,A(i,n-1)) pentru i>0 şi n>0. Care este cea mai mare valoare k
pentru care se poate calcula A(k,k) ?
37. Să se determine suma tuturor numerelor formate numai din cifre impare distincte.
38. Scrieţi o funcţie recursivă pentru a determina c.m.m.d.c. a două numere m şi n.
39. Scrieţi o funcţie recursivă pentru a calcula a
n
pe baza relaţiei a
n
=(a
k
)
2
pentru n=2k, şi
a
n
=a(a
k
)
2
pentru n=2k+1.
40. Scrieţi o funcţie recursivă pentru a determina prezenţa unui număr x într-un şir de valori
reale x
1
, x
2
, … , x
n-1
, x
n
ordonate crescător folosind algoritmul căutării binare.
41. Scrieţi o funcţie recursivă pentru a determina o aşezare a 8 turnuri pe o tablă de şah astfel
încît să nu se atace între ele. (Tabla de şah va fi reprezentată printr-o matrice pătratică de
8x8).
42. Să se determine peste cîţi ani data de azi va cădea în aceeaşi zi a săptămînii.
43. Avem la dispoziţie un fişier ce conţine numele, prenumele şi media tuturor studenţilor din
grupă.
× Să se afişeze studentul cu cea mai mare medie.
× Să se afişeze toţi studenţii bursieri.
× Să se afişeze studentul care are media cea mai apropiată de media aritmetică a
mediilor pe grupă.
× Să se afişeze toţi studenţii din prima jumătate a alfabetului.
× Să se afişeze toţi studenţii în ordine inversă decît cea din fişier.
× Să se creeze un fişier catalog care să conţină aceleaşi informaţii în ordinea
alfabetică a numelui.
44. Avem la dispoziţie două fişiere ce conţin numele, prenumele şi media tuturor studenţilor
din cele două grupe ale anului în ordinea descrescătoare a mediilor.
× Să se afişeze toţi studenţii din ambele grupe care au media mai mare decît
media anului.
× Să se creeze prin interclasare un fişier totalizator care conţine toţi studenţii
anului în ordinea descrescătoare a mediilor.
44
Probleme dificile
După cum se poate bănui, informatica conţine şi ea, la fel ca matematica, o mulţime de
probleme foarte dificile care îşi aşteaptă încă rezolvarea. Asemănarea cu matematica ne
interesează mai ales în privinţa unui aspect "capcană" asupra căruia dorim să atragem atenţia
aici.
Enunţurile problemelor dificile sau foarte dificile de informatică este, în 99% din
cazuri, foarte simplu şi poate fi citit şi înţeles de orice student. Acest fapt consituie o capcană
sigură pentru cei ignoranţi. Dacă în matematică lucrurile nu stau aşa, asta se datorează numai
faptului că studiul matematicii are vechime şi problemele, împreună cu dificultăţile lor, sînt
ceva mai bine cunoscute. În informatică nu avem însă aceeaşi situaţie. Ba chiar se întîmplă că
probleme foarte dificile sînt amestecate în culegerile de probleme de informatică printre
probleme uşoare, mai ales datorită lipsei de cultură de specialitate a autorilor.
Acest capitol îşi propune să pună în gardă în privinţa dificultăţii problemelor oferind o
mică iniţiere în acest domeniu (mai multe se pot afla studiind Complexitatea algoritmilor şi
dificultatea problemelor). Deasemeni el îşi propune să umple lacuna ce mai există încă la ora
actuală în cultura de specialitate.
Dificultatea problemelor de programare a căror enunţuri urmează este considerată
maximă de teoreticienii informaticii (ele se numesc probleme NP-complete). Nu vă lăsaţi
păcăliţi de faptul că le-aţi întîlnit în unele culegeri de programare. Ele sînt depăşite în
dificultate doar de problemele insolvabile algoritmic ! Dar în ce constă dificultatea lor ?
Spre deosebire de matematică, dificultatea problemelor de informatică nu este dată de
faptul că nu se cunoaşte un algoritm de rezolvare a lor, ci datorită faptului că nu se cunoaşte
un algoritm eficient (!) de rezolvare a lor. Existenţa unei metode de proiectare a algoritmilor
atît de general valabilă, cum este metoda back-tracking, face ca prea puţine probleme cu care
ne putem întîlni să nu aibă o soluţie. Dar, întrucît în cazul metodei back-tracking, căutarea
soluţiei se face într-un mod exhaustiv (se caută "peste tot", pentru ca să fim siguri că nu lăsăm
nici o posibilitate neexplorată), durata căutării are o creştere exponenţial-proporţională cu
dimesiunea datelor de intrare. De exemplu, timpul de căutare care depinde de valoarea de
intrare n poate avea o expresie de forma T(n)=c⋅ 2
n
secunde, unde c este un factor de
proporţionalitate ce poate varia, să zicem, de la c=12.5 cînd algoritmul este executat pe un
calculator sau c=62.8 cînd el este rulat pe un calculator de cinci ori mai performant. Dar,
45
indiferent de calculator, pentru n=100 avem 2
100
=(2
10
)
10
≈ (10
3
)
10
=10
30
, deci timpul măsurat în
secunde are ordinul de mărime mai mare de 30. Cea mai largă estimare pentru vîrsta
Universului nostru nu depăşeşte 20 mild. ani ceea ce transformat în secunde conduce la un
ordin de mărime mai mic de 20. Deci, chiar şi pentru valori mici ale lui n (de ordinul sutelor)
am avea de aşteptat pentru găsirea soluţiei de 10 miliarde de ori mai mult decît a trecut de la
Big Bang încoace ! Pot fi în această situaţie considerate astfel de programe ca rezolvări
rezonabile, doar pentru că ele găsesc soluţia în cazurile în care n=2, 3, 4, …, 10 ?
Exemplele următoare sînt doar cîteva, uşor de întîlnit "din greşeală", dintr-o listă
cunoscută ce conţine la ora actuală peste şase sute de astfel de probleme. Pentru fiecare din
aceste probleme nu li se cunosc alte soluţii decît inutilii algoritmi de gen back-tracking. În
listă apare des noţiunea de graf, aşa că o vom introduce în continuare cît mai simplu cu
putinţă: printr-un graf se înţelege o mulţime de vîrfuri şi o mulţime de muchii care unesc
unele vîrfuri între ele. Orice hartă (schematizată) rutieră, feroviară sau de trafic aerian
reprezintă desenul unui graf.
1. Problema partiţionării sumei. Fie C un întreg pozitiv şi d
1
, d
2
, …, d
n
o mulţime de n
valori întregi pozitive. Se cere să se găsească o partiţionare a mulţimii d
1
, d
2
, …, d
n
astfel
încît suma elementelor partiţiei să fie exact C.
2. Problema rucsacului. Avem un rucsac de capacitate întreagă pozitivă C şi n obiecte cu
dimensiunile d
1
, d
2
, …, d
n
şi avînd asociate profiturile p
1
, p
2
, …, p
n
(în caz că ajung în
rucsac). Se cere să se determine profitul maxim ce se poate obţine prin încărcarea
rucsacului (fără ai depăşi capacitatea).
3. Problema colorării grafului. Să se determine numărul minim de culori (numărul
cromatic) necesar pentru colorarea unui graf astfel încît oricare două vîrfuri unite printr-o
muchie (adiacente) să aibă culori diferite.
4. Problema împachetării. Presupunînd că dispunem de un număr suficient de mare de cutii
fiecare avînd capacitatea 1 şi n obiecte cu dimensiunile d
1
, d
2
, …, d
n
, cu 0<d
i
<1, se cere să
se determine numărul optim (cel mai mic) de cutii necesar pentru împachetarea tutror
celor n obiecte.
5. Problema comisului voiajor. (varianta simplificată) Dîndu-se un graf (o hartă), se cere să
se găsească un circuit (un şir de muchii înlănţuite) care trece prin fiecare vîrf o singură
dată.
46
Majoritatea acestor probleme apar ca probleme centrale la care se reduc în ultimă instanţă
problemele concrete ale unor domenii capitale ale economiei şi industriei, cum sînt de
exemplu planificarea investiţiile, planificarea împrumuturilor şi eşalonarea plăţii dobînzilor,
alocarea şi distribuirea resurselor primare (mai ales financiare), etc. Pentru nici una din aceste
probleme strategice nu se cunoaşte un algoritm optim de rezolvare, ci doar soluţii
aproximative. Dacă s-ar cunoaşte algoritmii de soluţionare optimă atunci majoritatea
sectoarelor şi proceselor macro- şi micro-economice ar putea fi conduse în timp real şi optim
(!!) cu calculatorul, fără a mai fi necesară prezenţa umană.
Un exemplu cert de domeniu care s-a dezvoltat extraordinar şi în care rolul soft-ului a
fost esenţial este chiar domeniul construcţiei de calculatoare, mai ales domeniul proiectării şi
asamblării de micro-procesoare. Dacă aţi văzut că schema electronică internă de funcţionare a
unui microprocesor din familia Pentium, dacă ar fi desenată clasic, ar ocupa o planşă de
dimensiuni 5x5 metri (!), nu mai aveţi cum să vă îndoiţi de faptul că numai un soft de
proiectare şi cablare performant mai poate controla şi stăpîni super-complexitatea rezultată.
Puţină lume ştie însă că astfel de programe de proiectare performante au putut să apară numai
datorită faptului că problema ce stă în spatele funcţionării lor, problema desenării grafurilor
planare, nu se află pe lista de mai sus a problemelor foarte dificile ale informaticii !
47
Probleme nesoluţionate încă
Aşa cum s-a putut constata în capitolul anterior, există multe probleme în informatică
pentru care încă nu se cunosc soluţii eficiente. În continuare vom oferi o listă de probleme
nesoluţionate încă. De fapt, ele apar mai ales în matematică, fiind cunoscute sub numele de
conjecturi, şi au toate ca specific un fapt care este de mare interes pentru programatori.
Incertitudinea asupra lor ar putea fi definitiv înlăturată nu numai prin demonstraţie
matematică ci şi cu ajutorul formidabilei puteri de calcul a computerelor. Astfel, fiecare din
aceste conjecturi numerice ar putea fi infirmată (concluzia ar fi atunci că conjectura este
falsă) dacă i s-ar găsi un contraexemplu. Este necesar doar să se găsească un set de numere
pentru care propoziţia respectivă să fie falsă. Ori, acest efort nu este la îndemîna niciunui
matematician dar este posibil pentru un programator înzestrat şi pasionat. El nu are decît să
scrie un program eficient şi să pună calculatorul să caute un contra-exemplu.
Atragem atenţia asupra unui aspect important. Fiecare problemă conţine aceeaşi
capcană ca şi în problemele capitolului anterior: algoritmii de căutare a contra-exemplelor pot
fi concepuţi rapid, relativ simpli şi cu efort de programare redus (de exemplu, prin trei-patru
cicluri for imbricate sau printr-o soluţie gen back-tracking) dar ei vor deveni în scurt timp
total ineficienţi şi vor conduce la programe mari consumatoare de timp. De aceea, vă sugerăm
să trataţi cu multă atenţie problemele din acest capitol. După părerea noastră, abordarea
acestui tip de probleme cere din partea programatorului un anumit grad de măiestrie !
Rezolvînd numai una dintre ele veţi fi recompensaţi pe măsură: riscaţi să deveniţi
celebri!
1. Conjectura lui Catalan. Singurele puteri naturale succesive sînt 8=2
3
şi 9=3
2
.
Observaţie: într-o exprimare matematică riguroasă, singura soluţie în numere naturale m, n, p,
q a ecuaţiei n
m
+1=p
q
este n=2, m=3, p=3 şi q=2.
Comentariu: avem şirul numerelor naturale 1, 2, 3, 4, 5,…; încercuind toate puterile de gradul
2: 1, 4, 9, 16, 25,… apoi toate cele de gradul 3: 1, 8, 27, 64, 125, … apoi cele de grad 4, 5, …
vom constata că singurele două numere încercuite alăturate sînt 8 şi 9 ! Adică puterile
obţinute, cu cît sînt mai mari, cu atît au tendinţa să se "împrăştie" şi să se "distanţeze" unele
de altele tot mai tare. În mod misterios, ele nu-şi suportă vecinătatea unele cu altele !
48
2. Conjectura cutiei raţionale. Nu se cunoaşte existenţa unei cutii paralelipipedice avînd
lungimile celor trei laturi, ale celor trei diagonale ale feţelor şi a diagonalei principale
întregi.
Observaţie: într-o exprimare matematic riguroasă, nu se cunoaşte să existe trei întregi a, b, c
astfel încît a
2
+b
2
, b
2
+c
2
, c
2
+a
2
şi a
2
+b
2
+c
2
să fie toate patru pătrate perfecte.
Comentariu: în multe subdomenii ale construcţiilor ,de exemplu să ne gîndim la stîlpii de
înaltă tensiune ridicaţi pe vîrfuri înalte de munte şi asamblaţi în întregime "la faţa locului"
numai din bare îmbinate cu şuruburi (fără sudură), este de mare interes ca dintr-un număr cît
mai mic de subansamble simple (un fel de "cărămizi") să se asambleze obiecte mari cu cît mai
multe configuraţii. Evident, dimensiunile obiectelor rezultate vor avea mărimea ca o
combinaţie întreagă ale dimensiunilor subansamblelor iniţiale. După cum rezultă însă din
conjectură, se pare că este imposibil să se construiască scheletul întărit (pe diagonale) al unei
cutii paralelipipedice din bare de lungimi tipizate. Cel puţin una din diagonale necesită
ajustarea lungimii unei bare !
3. Problema umplerii pătratului unitate. Întrebare: este posibil ca mulţimea
dreptunghiurilor de forma 1/k x 1/(k+1), pentru fiecare k întreg pozitiv, să umple în
întregime şi fără suprapuneri pătratul unitate, de latură 1x1 ?
Observaţie: este evident că suma infinită a ariilor dreptunghiurilor este egală cu aria pătratului
unitate. Avem Σ
k>0
1/(k(k+1))=Σ
k>0
(1/k-1/(k+1))=1.
Comentariu: aparent, descoperirea dezvoltărilor în serie pare să fi plecat de la unele evidente
propietăţi geometrice, uşor de sesizat chiar din desene simple în care valorilor numerice li se
asociază segmente de lungimi corespunzătoare. Iată însă o surpriză în această situaţie: suma
seriei numerice este evidentă analitic însă reprezentarea geometrică a "fenomenului" este
"imposibilă" !
4. Conjectura fracţiilor egiptene (atribuită lui Erdös şi Graham). Orice fracţie de forma
4/n se descompune ca sumă de trei fracţii egiptene (de forma 1/x).
Observaţie: într-o exprimare matematic riguroasă, pentru orice n natural există trei valori
naturale, nu neapărat distincte, x, y, şi z astfel încît 4/n=1/x+1/y+1/z.
49
Comentariu: este încă un mister motivul pentru care egiptenii preferau descompunerea
facţiilor numai ca sumă de fracţii egiptene. Descoperiseră ei această descompunere minimală
a fracţiilor de forma 4/n ? Dar mai ales, ce procese fizice reale erau astfel mai bine modelate ?
Înclinăm să credem că există o legătură între fenomenele fizice ondulatorii, transformata
Fourier şi fracţiile egiptene !
5. Problema punctului raţional. Există un punct în plan care să se afle la o distanţă
raţională de fiecare din cele patru vîrfuri ale pătratului unitate ?
Observaţie: dacă considerăm un pătrat unitate avînd vîrfurile de coordonate (0,0), (1,0), (0,1)
şi (1,1) atunci se cere găsirea unui punct (x,y) astfel încît x
2
+y
2
, (x-1)
2
+y
2
, x
2
+(y-1)
2
şi (x-1)
2
+
(y-1)
2
să fie toate patru pătrate perfecte. Atenţie, x şi y nu este obligatoriu să fie întregi ! Acest
fapt ridică foarte serioase probleme la proiectarea unui algoritm de căutare a unui astfel de
punct (x,y).
Comentariu: la fel ca şi în cazul cutiei raţionale, se pare că există limitări serioase şi
neaşteptate în încercarea de optimizare a numărului de subansamble necesare pentru
construierea scheletelor sau cadrelor de susţinere. Se pare că cele două dimensiuni pe care
geometria plană se bazează conduce la o complexitate inerentă neaşteptat de mare !
6. Problema sumei de puteri. Care este suma seriei de inverse de puteri
1/1+1/2
3
+1/3
3
+1/4
3
+1/5
3
+… ?
Observaţie: se cere să se spună către ce valoare converge seria Σ
k>0
1/k
3
sau Σ
k>0
k
-3
. Se ştie că
în cazul în care în locul puterii a 3-ia (cu minus) punem puterea a 2-a (cu minus) seria
converge la π
2
/6, în cazul în care în locul puterii a 3-ia punem puterea a 4-a seria converge
la π
4
/90.
Comentariu: deşi pare a fi o problemă de analiză matematică pură deoarece ni se cere să
găsim expresia sintetică şi nu cea numerică aproximativă a sumei seriei, există însă uluitoare
descoperiri asemănătoare ale unor formule de analiză numerică sau chiar dezvoltări în serie
(cea mai celebră fiind cea a lui cifrelor hexazecimale ale lui π ) făcute cu ajutorul
calculatorului prin calcul simbolic ! Mai multe amănunte găsiţi la adresa corespunzătoare de
Internet pe care am trecut-o în ultimul capitol.
50
7. Problema ecuaţiei diofantice de gradul 5. Există a, b, c, and d întregi pozitivi astfel
încît a
5
+b
5
=c
5
+d
5
?
Observaţie: Se cunoaşte că în cazul în care puterea este 3 avem soluţia: 1
3
+12
3
=9
3
+10
3
iar în
cazul în care puterea este 4 avem soluţia: 133
4
+134
4
=59
4
+158
4
.
Comentariu: căutarea unor algoritmi generali de rezolvare a ecuaţiilor diofantice a condus la
importante descoperiri în matematică dar şi în informatică. De exemplu, celebrul
matematician Pierre Fermat, “stîrnit” fiind de problemele conţinute în lucrarea Arithmetika a
matematicianului antic Diofant din Alexandria (de unde şi numele ecuaţiilor diofantice), a
descoperit în 1637 faimoasa sa teoremă: Ecuaţia diofantică x
n
+y
n
=z
n
n>2. Dar tot în aceeaşi perioadă a descoperit şi faptul că cea mai mică soluţie a ecuaţiei
diofantice x
2
- 109*y
2
= 1 este perechea x=158 070 671 986 249 şi y= 15 140 424 455 100.
Dumneavoastră încercaţi doar să verificaţi această soluţie fără ajutorul calculatorului şi vă veţi
putea da seama de performanţele pe care le-a realizat Fermat ! În informatică este acum
cunoscut şi demonstrat că este imposibil să se construiască un algoritm general pentru
rezolvarea ecuaţiilor diofantice !
8. Problema celor 13 oraşe. Puteţi localiza 13 oraşe pe o planetă sferică astfel încît distanţa
minimă dintre oricare două dintre ele să fie cît mai mare cu putinţă ?
Observaţie: de fapt nu se cunoaşte cît de mult poate fi mărită distanţa
minimală ce se obţine dintre cele 78 de distanţe (date de cele 78=C
2
13
de împerecheri posibile de oraşe).
Comentariu: dacă s-ar cere localizarea a doar 12 puncte pe sferă, nu
este greu de arătat că aşezarea care îndeplineşte condiţia cerută este
în vîrfurile unui icosaedru (vezi figura alăturată). În acest caz, distanţa minimă maximizată
este egală cu latura icosaedrului. Este greu de crezut că în cazul descoperirii aşezării a 13
puncte pe sferă se poate porni tocmai de la icosaedru ! Evident că în rezolvarea aplicativ-
practică a acestui tip de probleme nesoluţionate geometric pînă în prezent rolul
programatorului poate fi capital. La ora actuală pentru astfel de situaţii se oferă soluţii
aproximative. Acestea constau din algoritmi care încearcă să aproximeze cît mai exact soluţia
optimă într-un timp rezonabil de scurt. Evident că în aceste condiţii algoritmii de căutare
exhaustivă (gen back-tracking) sînt cu totul excluşi !
51
9. Conjectura lui Collatz. Se pleacă de la un n întreg pozitiv. Dacă n este par se împarte la
doi; dacă n este impar se înmulţeşte cu trei şi i se adună unu. Repetînd în mod
corespunzător doar aceşti doi paşi se va ajunge întotdeauna la 1 indiferent de la ce valoare
n se porneşte ?
Observaţie: de exemplu, pornind de la n=6 obţinem în 8 paşi şirul valorilor: 6, 3, 10, 5, 16, 8,
4, 2, 1.
Comentariu: valoarea finală 1 este ca o "gaură neagră" care absoarbe în final şirul obţinut.
"Raza" de-a lungul căreia are loc "căderea" în gaura neagră 1 este dată mereu de şirul
puterilor lui 2: 2, 4, 8, 16, 32, 64, … cu ultima valoare de forma 3k+1, adică 4, 16, 64, 256,
…. Se pare că valorile obţinute prin cele două operaţii nu pot "să nu dea" nicicum peste acest
şir care le va face apoi să "cadă în gaura neagră" 1!
10. Problema înscrierii pătratului. Dîndu-se o curbă simplă închisă în plan, vom putea
întotdeauna găsi patru puncte pe curbă care pot să constituie vîrfurile unui pătrat ?
Observaţie: în cazul curbelor închise regulate (ce au axe de simetrie: cerc, elipsă, ovoid) nu
este greu de arătat prin construire efectivă că există un pătrat ce se "sprijină" pe curbă. Pare
însă de nedovedit acelaşi fapt în cazul unor curbe închise foarte neregulate ! Găsirea celor
patru puncte, într-o astfel de situaţie, este de neimaginat fără ajutorul calculatorului !
Comentariu: o consecinţă surprinzătoare a acestei conjecturi este faptul că pe orice curbă de
nivel (curbă din teren care uneşte punctele aflate toate la aceaşi altitudine) am putea găsi patru
puncte de sprijin pentru o platformă pătrată (un fel de masă) perfect orizontală, de mărime
corespunzătoare. Acest fapt ar putea să explice ampla răspîndire a meselor cu patru picioare
(!?) în detrimentul celor cu trei: dacă îi cauţi poziţia, cu siguranţă o vei găsi şi o vei putea
aşeza pe toate cele patru picioare, astfel masa cu patru picioare va oferi o perfectă stabilitate şi
va sta perfect orizontală, pe cînd cea cu trei picioare deşi stă acolo unde o pui din prima (chiar
şi înclinată) nu oferă aceeaşi stabilitate.
În speranţa că am reuşit să vă stîrnim interesul pentru astfel de probleme nesoluţionate
încă şi care sînt grupate pe Internet în liste cuprinzînd zeci de astfel de exemple (vezi adresa
oferită în ultimul capitol), încheiem acest capitol cu următoarea constatare: descoperirile
deosebite din matematica actuală au efecte rapide şi importante nu numai în matematică ci şi
în informatică. Să oferim doar un singur exemplu de mare interes actual: algoritmii de
52
încriptare/decriptare cu cheie publică, atît de folosiţi în comunicaţia pe Internet, se bazează în
întregime pe proprietăţile matematice ale divizibilităţii numerelor prime.
Ceea ce este interesant şi chiar senzaţional este faptul că în informatică nevoia de
programe performante a condus la implementarea unor algoritmi care se bazează pe cele mai
noi descoperiri din matematică, chiar dacă acestea sînt încă în stadiul de conjecturi! De
exemplu, pentru acelaşi domeniu al criptării cu cheie publică există deja algoritmi de
primalitate senzaţional de performanţi care se bazează pe Ipoteza (conjectura) lui Riemman.
(Mai multe amănunte puteţi găsi la adresele de Internet pe care le oferim în ultimul capitol.)
Este acest fapt legitim ? Ce încredere putem avea în astfel de programe ? După părerea
noastră putem acorda o totală încredere acestor algoritmi dar numai în limitele "orizontului"
atins de programele de verificare a conjecturii folosite. Dacă programul de verificare a
verificat conjectura numerică pe intervalul 1- 10
30
atunci orizontul ei de valabilitate este 10
30
.
Domeniile numerice pe care le pot acoperi calculatoarele actuale sînt oricum foarte mari şi
implicit oferă o precizie suficientă pentru cele mai multe calcule cu valori extrase din
realitatea fizică.
53
Probleme insolvabile algoritmic
Am introdus acest capitol special din două motive. Primul motiv, pentru a trezi
interesul şi pasiunea pentru informatică celor care pot acum să vadă cît de deosebite sînt
descoperirile şi rezultatele din acest domeniu. Al doilea motiv, pentru ai pune în gardă pe cei
care, în entuziasmul lor exagerat, îşi închipuie că pot programa calculatorul să facă orice
treabă sau să rezolve orice problemă. Aşa cum am văzut şi în capitolul ce tratează despre
problemele dificile ale informaticii, enunţurile problemelor foarte dificile sau chiar
insolvabile sînt foarte simple şi pot uşor constitui o capcană pentru necunoscători.
În continuare vom oferi spre edificare doar cîteva exemple, urmînd ca prin studiul
Complexităţii algoritmilor şi a dificultăţii problemelor să se aprofundeze acest domeniu
fascinant dar atît de uşor de confundat (poţi să dai de aceste probleme chiar şi din greşeală !?)
şi care este păcat să fie tratat într-un mod superficial.
1. Problema Stopului. Nu există un algoritm universal valabil prin care să se poată
decide dacă execuţia oricărui algoritm se opreşte vreodată sau nu.
Comentariu: acesta este cel dintîi şi cel mai celebru exemplu de problemă insolvabilă.
Demonstraţia riguroasă a acestui fapt a fost dată pentru prima dată în 1936 de inventatorul
calculatorului actual matematicianul englez Alan Mathison Turing. Odată existînd această
demonstraţie, multe din următoarele probleme insolvabile algoritmic s-au redus la aceasta.
Implicaţiile practice, teoretice şi filozofice ale problemei Stopului sînt foarte importante atît
pentru informatică cît şi pentru matematică. Astfel, două consecinţe strategice ale problemei
Stopului sînt: 1. nu poate exista un calculator oricît de puternic cu ajutorul căruia să se poată
decide asupra comportamentului viitor al oricărui alt calculator de pe glob; 2. nu poate să
existe în matematică o metodă generală de demonstrare inductivă-logică a propoziţiilor
matematice (se închide în acest fel o mai veche căutare a matematicienilor şi logicienilor
cunoscută sub numele de Entscheidungs Problem sau Problema deciziei).
54
2. Problema ecuaţiilor diofantice. Nu există o metodă generală (un algoritm) de aflare a
soluţiilor întregi ale unui sistem de ecuaţii diofantice.
Comentariu: sistemele de ecuaţii diofantice sînt sistemele de ecuaţii algebrice de mai multe
variabile cu coeficienţi întregi şi cărora li se caută soluţii întregi. De exemplu, a fost nevoie de
ajutorul calculatorului pentru a se descoperi cea mai mică soluţie a ecuaţiei diofantice
p
4
+q
4
+r
4
=s
4
şi care este cvadrupletul p=95600, q=217519, r=414560, s=422461 (infirmîndu-
se în acest fel "conjectura" lui Leonard Euler care în 1796 a presupus că această ecuaţie
diofantică nu are soluţii întregi). Această problemă ce cere o metodă generală de rezolvare a
ecuaţiilor diofantice este cunoscută sub denumirea de Problema a 10-a a lui Hilbert.
3. Problema acoperirii planului (Problema pavajului sau Problema croirii). Fiind dată o
mulţime de forme poligonale, nu există o metodă generală (un algoritm) care să decidă
dacă cu aceste forme este posibilă acoperirea completă a planului (fără suprapuneri şi
goluri).
Comentariu: în practică este mult mai importantă problema croirii care cere să se decupeze
fără pierderi un set cît mai mare de forme date (croiuri) dintr-o bucată iniţială de material
oricît de mare. Este deasemenea demonstrat că problema rămîne insolvabilă algoritmic chiar
şi atunci cînd formele poligonale sînt reduse la poliomine (un fel de "mozaicuri") care se
formează doar pe o reţea rectangulară caroiată. Iată cîteva exemple de mulţimi formate dintr-o
singură poliomină şi, alăturat, răspunsul la întrebarea dacă cu ele se poate acoperi planul sau
nu:
DA NU DA
4. Problema şirurilor lui Post. Se dau două mulţimi egale de şiruri finite de simboluri ce
sînt împerecheate astfel: un şir dintr-o mulţime cu şirul corespunzător din a doua mulţime.
Nu există un algoritm general prin care să se decidă dacă există o ordine de concatenare
a şirurilor (simultan din cele două mulţimi) astfel încît cele două şiruri lungi pereche
rezultate să fie identice.
55
Comentariu: de exemplu, fie A={ 101, 010, 00 } şi B={ 010, 10, 001 } cele două mulţimi de
şiruri de simboluri (pentru uşurinţă au fost alese simbolurile binare 1 şi 0). Perechile
corespunzătoare de şiruri sînt 1.(101,010), 2.(010,10) şi 3.(00,001). Observăm că şirurile
pereche pot avea lungimi diferite (ca în perechile 2 şi 3). În continuare, pentru a vedea cum se
procedează, cele două şiruri pereche rezultante prin concatenare le vom scrie unul deasupra
celuilalt sesizînd cum avansează procesul de egalizare a lor. Punctele sînt intercalate doar
pentru a evidenţia perechile, ele nu contribuie la egalitate, iar comentariile ne aparţin:
00. Concatenarea poate începe doar cu 00.101. Obligatoriu urmează
perechea 1-a
001.
perechea a 3-a,00 de "sus" ⊂ 001
de "jos"
001.010. singura care începe cu 1
"sus".
00.101.00. Dacă am continua cu
perechea
00.101.010 … nu s-ar obţine rezultatul
final
001.010.001. a 3-a … 001.010.10 oferit de perechea 2-a !
5. Problema cuvintelor "egale". Se dă un anumit număr de "egalităţi" între cuvinte.
Bazîndu-ne pe aceste "egalităţi" se pot obţine unele noi substituind apariţiile cuvintelor
dintr-o parte a egalului cu cele din cealaltă parte. Nu există un algoritm general de a
decide dacă un cuvînt oarecare A poate fi "egal" cu un altul B.
Comentariu: de exemplu, fie următoarele cinci egalităţi (citiţi-le în limba engleză) EAT=AT,
ATE=A, LATER=LOW, PAN=PILLOW şi CARP=ME. Este CATERPILLAR egal cu
MAN ? Iată şirul egalităţilor iterate care ne poate oferi răspunsul: CATERPILLAR =
CARPILLAR =CARPILL ATE R =CARPIL LOW = CAR P AN= MEAN= ME AT EN=
MAT E N= MAN.
Dar de la CARPET putem ajunge la MEAT ? Întrucît se vede că numărul total de A-uri plus
W-uri şi M-uri nu se poate modifica prin nici o substituţie şi întrucît CARPET are un A
(adică numărul asociat este 1) iar MEAT are un A şi un M (deci 2), rezultă că această egalitate
nu este permisă.
Mai mult, se ştie că există liste particulare de cuvinte pentru care nu poate exista un algoritm
ce decide dacă două cuvinte sînt egale sau nu. Iată o astfel de listă de şapte egalităţi: AH=HA,
OH=HO, AT=TA, OT=TO, TAI=IT, HOI=IH şi THAT=ITHT.
Numărul problemelor cunoscute ca fiind insolvabile algoritmic este destul de mare.
Cele mai multe probleme provin din matematică, subdomeniul matematicii care studiază
56
aceste probleme se numeşte Matematica nerecursivă. De aceea ele pot fi întîlnite mai ales sub
numele de probleme nedecidabile sau probleme nerecursive, în enunţul lor cuvîntul algoritm
fiind înlocuit mai ales cu cuvintele metodă generală.
Studierea acestui domeniu a creat condiţii pentru apariţia de noi direcţii de cercetare
prin care se încearcă explicarea raţionamentelor matematice ba chiar se încearcă descoperirea
limitelor raţiunii umane în general. Unii oameni de ştiinţă contemporani, cum este celebrul
matematician-fizician englez Roger Penrose, depun eforturi mari pentru a oferi o
demonstraţie matematică riguroasă pentru ipoteza că, în cele din urmă şi în esenţă,
raţionamentele umane nu sînt algoritmice, nici măcar cele matematice. După părera lui
Penrose mintea umană nu poate fi asimilată cu un calculator ci este mai mult decît atît şi nu
vor putea exista vreodată calculatoare sau roboţi mai inteligenţi decît oamenii! În ultimul
capitol oferim titlurile cărţilor recent apărute ce tratează despre acest fascinant subiect .
57
Noţiuni aprofundate de programare
Metode şi strategii de proiectare a algoritmilor (alias tehnici de programare)
În rezolvarea sa cu ajutorul calculatorului orice problemă trece prin trei etape
obligatorii: Analiza problemei, Proiectarea algoritmului de soluţionare şi Implementarea
algoritmului într-un program pe calculator. În ultima etapă, sub acelaşi nume, au fost incluse
în plus două subetape cunoscute sub numele de Testarea şi Întreţinerea programului. Aceste
subetape nu lipsesc din “ciclul de viaţă” a oricărui produs-program ce “se respectă” dar ,
pentru simplificare, în continuare ne vom referi doar la cele trei mari etape..
Dacă etapa implementării algoritmului într-un program executabil este o etapă
exclusiv practică, realizată “în faţa calculatorului”, celelalte două etape au un caracter teoretic
pronunţat. În consecinţă, primele două etape sînt caracterizate de un anumit grad de
abstractizare. Din punct de vedere practic şi în ultimă instanţă criteriul decisiv ce conferă
succesul rezolvării problemei este dat de calitatea implementării propriuzise. Mai precis,
succesul soluţionării este dat de performanţele programului: utilitate, viteză, fiabilitate,
manevrabilitate, lizibilitate, etc. Este imatură şi neprofesională “strategia” programatorilor
începători care neglijînd primele două etape sar direct la a treia, fugind de analiză şi de
componenta abstractă a efortului de soluţionare. Ei oferă cu toţii aceeaşi justificare: “Eu nu
vreau să mai pierd vremea cu …, am să fac programul cum ştiu eu. Pînă cînd nu o să facă
cineva altul mai bun decît al meu, pînă atunci…nu am cu cine sta de vorbă !”.
Este adevărat că ultima etapă în rezolvarea unei probleme – implementarea – este într-
adevăr decisivă şi doveditoare, dar primele două etape au o importanţă capitală. Ele sînt
singurele ce pot oferi răspunsuri la următoarele întrebări dificile: Avem certitudinea că soluţia
găsită este corectă ? Avem certitudinea că problema este complet rezolvată ? Cît de eficientă
este soluţia găsită ? Cît de departe este soluţia aleasă de o soluţie optimă ?
Să menţionăm în plus că literatura de specialitate conţine un număr impresionant de
probleme “capcană” pentru începători şi nu numai. Ele sînt toate inspirate din realitatea
imediată dar pentru fiecare dintre ele nu se cunosc soluţii eficiente în toată literatura de profil.
Există printre ele chiar unele probleme extrem de dificile pentru care s-a demonstrat riguros
că nu admit soluţie cu ajutorul calculatorului. (Mai precis, s-a demonstrat că ele nu admit
soluţie prin metode algoritmice, în spiritul tezei Turing-Church). Cîţi dintre programatorii
începători n-ar fi surprinşi să afle că problema “atît de simplă” (ca enunţ) a cărei soluţionare
tocmai au abandonat-o este de fapt o problemă dovedită ca fiind intratabilă sau chiar
58
insolvabilă algoritmic ? Partea proastă a lucrurilor este că, aşa cum ciupercile otrăvite nu pot
fi cu uşurinţă deosebite de cele comestibile, tot astfel problemele netratabile pot fi cu uşurinţă
confundate cu nişte probleme uşoare la o privire rapidă şi lipsită de experienţă.
Să înţelegem mai întîi care este “cheia” ce conduce la răspunsuri pentru întrebările de
mai sus iar apoi vom trece la prezentarea metodelor clasice de proiectare a soluţiilor. Aceste
metode de proiectare a algoritmilor-soluţie sînt cunoscute în literatura de specialitate sub
numele de tehnici de programare şi sînt considerate metode sau instrumente soft eficiente şi
cu arie largă de acţiune.
Dacă ar fi să sintetizăm în cîte un cuvînt efortul asupra căruia se concentrează fiecare
din primele două etape – analiza şi proiectarea – acestea ar fi: corectitudine şi eficienţă.
Etapa de analiză este singura care permite dovedirea cu argumente riguroase a corectitudinii
soluţiei, iar etapa de proiectare este singura care poate oferi argumente precise în favoarea
eficienţei soluţiei propuse.
În general problemele de informatică au în forma lor iniţială sau în enunţ o
caracteristică pragmatică. Ele sînt foarte ancorate în realitatea imediată şi aceasta le conferă o
anumită asemănare. Totuşi ele au în forma iniţială un grad mare de eterogenitate, diversitate
şi lipsă de rigoare. Fiecare dintre aceste atribute “negative” este un obstacol major pentru
demonstrarea corectitudinii soluţiei. Rolul esenţial al etapei de analiză este deci acela de a
transfera problema “de pe nisipurile mişcătoare” ale realităţii imediate de unde ea provine
într-un plan abstract, adică de a o modela. Acest “univers paralel” este dotat cu mai multă
rigoare şi disciplină internă, avînd legi precise, şi poate oferi instrumentele logice şi formale
necesare pentru demonstrarea riguroasă a corectitudinii soluţiei problemei.
Planul abstract în care sînt “transportate” toate problemele este planul sau universul
obiectelor matematice. Acest univers al matematicii este unanim acceptat (de ce ?!) iar
corespondentul problemei în acest plan va fi modelul matematic abstract asociat problemei.
Demonstrarea corectitudinii proprietăţilor ce leagă obiectele universului matematic a fost şi
este sarcina matematicienilor. Celui ce analizează problema din punct de vedere informatic îi
revine sarcina (nu tocmai uşoară) de a dovedi printr-o demonstraţie constructivă că există o
corespondenţă precisă (bijectivă) între părţile componente ale problemei reale,
“dezasamblată” în timpul analizei, şi părţile componente ale modelului abstract asociat. Odată
descoperită, formulată precis şi dovedită, această “perfectă oglindire” a problemei reale în
planul obiectelor matematice oferă certitudinea că toate proprietăţile şi legăturile ce există
între subansamblele modelului abstract se vor regăsii precis (prin reflectare) între părţile
interne ale problemei reale, şi invers. Atunci, soluţiei abstracte descoperită cu ajutorul
59
modelului matematic abstract îi va corespunde o soluţie reală concretizată printr-un algoritm
ce poate fi implementat într-un program executabil.
Aceasta este calea generală de rezolvare a problemelor şi orice poate verifica. Ca şi
exerciţiu, să se demonstreze corectitudinea (să se aducă argumente precise, clare şi
convingătoare în favoarea corectitudinii) metodei de extragere a radicalului învăţată încă din
şcoala primară sau a algoritmului lui Euclid de determinare a celui mai mare divizor comun a
două numere prin împărţiri întregi repetate. Argumentele elevilor de forma: “Este corect
pentru că aşa ne-a învăţat doamna profesoară!” sau “Este corect pentru că aşa face toată lumea
!” sînt “normale” atît timp cît nu li se oferă o argumentaţie matematică riguroasă.
Ideea centrală a etapei a doua – proiectarea uni algoritm de soluţionare eficient poate
fi formulată astfel: din studiul proprietăţilor şi limitelor modelului matematic abstract asociat
problemei se deduc limitele inferioare ale complexităţii minimale (“efortului minimal
obligatoriu”) inerente oricărui algoritm ce va soluţiona problema în cauză. Complexitatea
internă a modelului abstract şi complexitatea soluţiei abstracte se va reflecta imediat asupra
complexităţii reale a algoritmului, adică asupra eficienţei, de soluţionare a problemei. Acest
fapt permite prognosticarea încă din această fază – faza de proiectare a algoritmului de
soluţionare – a eficienţei practice, măsurabilă ca durată de execuţie, a programului.
Această corespondenţă exactă între complexitatea modelului abstract şi complexitatea
algoritmului de soluţionare oferă cheia unor demonstraţii riguroase a imposibilităţii existenţei
soluţiei prin metode algoritmice pentru o listă întreagă de probleme (cum ar fi de exemplu
Problema a 10-a a lui Hilbert, formulată încă din 1900).
Detailînd cele prezentate deja, vom construi în continuare cadrul teoretic general
pentru înţelegerea strategiilor de proiectare a algoritmilor.
Creşterea impresionantă a puterii de calcul a calculatoarelor i-a “obligat” pe
informaticienii ultimilor treizeci de ani să nu se mai eschiveze de la abordarea problemelor
dificile cu caracter algoritmic din diverse domenii care au intrat în atenţia matematicienilor
încă de la începutul acestui secol. De altfel, astfel de probleme cu soluţii algoritmice nu
constituiau neapărat o noutate pentru matematicienii începutului de secolul. Încă de pe
vremea lui Newton matematicienii şi-au pus, de exemplu, problema descoperirii unor metode
precise (adică algoritmi!) de determinare în paşi de aproximare succesivă a soluţiei unei
ecuaţii ce nu poate fi rezolvată prin radicali. Dar “boom-ul” dezvoltării tehnicii de calcul din a
doua jumătate a secolului a creat posibilitatea abordării unor probleme cheie pentru anumite
domenii strategice (de exemplu, controlul şi dirijarea sateliţilor pe orbită, probleme de
60
planificare sau optimizare în economie, etc.) care se reduc în fapt la soluţionarea eficientă a
unor probleme de optimizare matematică prin metode iterative (algoritmi).
Spre deosebire de aceste probleme a căror succes în soluţionare a fost total şi cu
consecinţele ce se văd, există însă o serie de probleme dificile inspirate din realitate care se
cer imperios rezolvate eficient cu ajutorul calculatorului.
Principală caracteristică a acestora este că, datorită generalităţii lor sau datorită
dificultăţii “ascunse”, în literatura de specialitate nu există metode iterative eficiente de
rezolvare a lor şi nu se ştie dacă ele admit astfel de soluţii. Singurul fapt ce poate fi stabilit
dinainte în cazul soluţionării unor astfel de probleme este “spaţiul” în care soluţia trebuie
căutată. Ceea ce trebuie atunci construită este o strategie corectă şi cît mai generală de căutare
a soluţiei (soluţiilor) în acel spaţiu de căutare a soluţiilor.
Exemplu concret: există o clasă întreagă de probleme ce cer implicit să se genereze
toate obiectele unei mulţimi (cum ar fi problema generării tuturor permutărilor unei mulţimi
cu n elemente). În acest caz este cunoscută dinainte proprietatea ce trebuie să o îndeplinească
fiecare soluţie ca să fie un obiect al spaţiului de căutare a soluţiilor. Efortul de soluţionare va
fi redus atunci la aflarea, căutarea sau generarea pe baza proprietăţii respective a tuturor
obiectelor posibile, fără însă a lăsa vreunul pe dinafară.
Modelul matematic abstract cel mai general care permite modelarea acestui tip de
probleme este graful. Un graf este un obiect matematic riguros care, simplificat, poate fi privit
ca fiind o diagramă formată din noduri unite prin săgeţi (muchii). De exemplu, orice hartă
feroviară sau rutieră poate fi privită ca un graf cu mulţimea nodurilor formată din localităţi iar
mulţimea muchiilor formată din rutele de transport directe dintre localităţile respective. Graful
permite descrierea legăturilor şi a relaţiilor ce există între diferite obiecte abstracte
reprezentate prin noduri. Experienţa arată că acest model matematic abstract este cel mai
general şi cel mai potrivit pentru descrierea unui spaţiu de căutare a soluţiilor unei probleme.
În cazul spaţiului de căutare, nodurile sînt soluţiile posibile (ipotetice). Două noduri în graf
vor fi unite prin săgeţi (muchii) dacă cele două soluţii posibile au în comun o aceeaşi
proprietate. Muchiile grafului sînt “punţile” ce vor permite algoritmului trecerea de la un nod
la altul, de la o soluţie ipotetică la alta, în timpul procesului de căutare a soluţiei (sau a tuturor
soluţiilor). Rezultă că strategiile cele mai generale de căutare a soluţiei (soluţiilor) pe modelul
abstract asociat problemei sînt reductibile la metodele generale de traversare a unui graf.
Ordinea de traversare a grafului determină precis arborele de traversare a grafului.
Acest arbore este de fapt un subgraf particular al grafului iniţial, avînd acelaşi număr de
noduri şi ca rădăcină vîrful iniţial de pornire. Cele două metode clasice de traversare a unui
61
graf (căutare într-un graf) poartă în literatura de specialitate numele: BreathFirstSearch (BFS)
şi DepthFirstSearch (DFS), respectiv Traversarea în lăţime (sau traversarea pe nivele) şi
Traversarea în adîncime (traversarea “labirintică”) a grafului. Ambele metode stau la baza
celei mai cunoscute strategii de proiectare a algoritmilor (impropriu denumită tehnică de
programare): BackTracking respectiv căutare (traversare) în spaţiul de căutare a soluţiilor (a
grafului) cu revenire pe “urma” lăsată.
Iată un exemplu de graf (7 noduri şi 10 arce-săgeţi) şi ordinea sa de traversare prin
cele două metode:
Ordinea de parcurgere a celor 7 vîrfuri ale grafului, ţinînd cont şi de sensul dat de
săgeţi, este în cazul DFS (în adîncime): 1,2,4,5,6,3,7 aşa cum se vede din arborele parcurgerii
în adîncime. Din fiecare nod se continuă cu nodul (nevizitat încă) dat de prima alegere
posibilă: de exemplu, din 4 se continuă cu 5 (ales în favoarea lui 7). Se poate observa cum din
nodul 3, nemaiexistînd continuare, are loc o revenire pe “pista lăsată” pînă în nodul 6 de unde
se continuă parcurgerea în adîncime cu prima alegere posibilă. În cazul BFS (în lăţime)
ordinea de traversare este: 1,2,3,4,5,7,6 aşa cum se poate vedea în arborele parcurgerii în
lăţime. În această situaţie, dintr-un nod sînt vizitaţi toţi vecinii (nevizitaţi încă), iar apoi se
face repetă acelaşi lucru pentru fiecare nod vecin, în ordinea vizitării. Se observă cum nodul 7
este vizitat înaintea nodului 6, fiind vecin cu nodul 4. (De fapt, aceasta se explică prin faptul
că distanţa de la 1 la 7 este mai mică cu o unitate decît distanţa de la 1 la 6.) Putem spune că
în cazul traversării în lăţime ordinea de traversare este dată de depărtarea nodurilor faţă de
nodul de start.
Iată cum arată procedura generală DepthFirstSearch (DFS) de traversare a unui graf
descrisă în pseudo-cod în varianta recursivă:
Procedura DFS(v:nod);
Vizitează v;
Marchează v; // v devine un nod vizitat //
Cît timp (există w nemarcat nod adiacent lui v) execută DFS(w);
62
1
5
3
2
6
4
7 1 5
3
2
6
4
7
1
5
3
2
6
4
7
Să nu uităm că această procedură poate fi privită ca “scheletul” pe care se
construieşte orice procedură backtracking recursivă.
BackTracking.
Pentru a preciza mai exact în ce constă această metodă, vom relua pe un exemplu
concret cele spuse deja. Avem următoarea problemă: se cere generarea tuturor permutărilor
unei mulţimi de n elemente ce nu conţin elementul x (dat dinainte) pe primele două poziţii.
Conform celor afirmate, este suficient să “construim” modelul abstract - graful - (mai precis
arborele) tuturor permutărilor celor n elemente. Apoi, printr-o parcurgere exhaustivă a
nodurilor sale, prin una din metodele BFS sau DFS, să păstrăm numai acele noduri ce verifică
în momentul “vizitării” condiţia impusă (lipsa lui x de pe primele două poziţii).
Observăm că această metodă necesită folosirea în scopul memorării dinamice a
drumului parcurs (în timpul căutării soluţiei) a mecanismului de stivă, fapt sugerat chiar de
numele ei: tracking, adică înregistrarea pistei parcurse. Acest mecanism de stivă, care permite
atît memorarea pistei cît şi revenirea – back-tracking-ul, este unul din mecanismele de bază ce
este folosit pe scară largă în procedurile de gestiune dinamică a datelor în memorie. În plus,
există unele cazuri particulare de probleme în care soluţia căutată se obţine în final prin
“vărsarea” întregului conţinut al stivei şi nu doar prin “nodul” ultim vizitat, aflat în vîrful
stivei.
Exemplul cel mai potrivit de problemă ce necesită o strategie de rezolvare
backtracking este Problema Labirintului: se cere să se indice, pentru o configuraţie labirintică
dată, traseul ce conduce către ieşirea din labirint. Iată un exemplu sugestiv:
9 8 7 6
10 1
C
5
11 2 3 4
12 13 14
15+
Observaţi cum, după 15 paşi, este necesară o revenire (backtracking) pînă la căsuţa 6,
de unde se continuă pe o altă pistă. “Pista falsă” a fost memorată în stivă, element cu element,
iar revenirea se va realiza prin eliminarea din stivă tot element cu element. Cînd în vîrful
stivei reapare căsuţa cu numărul 6, stiva începe din nou să crească memorînd elementele
noului drum. În final stiva conţine în întregime soluţia: drumul corect către ieşirea din labirint.
6 7
63
În consecinţă, indiferent de forma particulară ce o poate lua sau de modul în care este
“citită” în final soluţia, esenţialul constă în faptul că backtracking-ul este o metodă de
programare ce conţine obligatoriu gestiune de stivă. Lipsa instrucţiunilor, explicite sau
“transparente”, de gestionare a stivei într-un program (de exemplu, lipsa apelului recursiv),
este un indiciu sigur de recunoaştere a faptului că acel algoritm nu foloseşte metoda sau
strategia de rezolvare BackTracking.
Tot o metodă back-tracking este şi metoda de programare cunoscută sub numele
programare recursivă. Ea este mai utilizată decît metoda clasică BackTracking, fiind mai
economicoasă din punctul de vedere al minimizării efortului de programare. Această metodă
se reduce la construirea, în mod transparent pentru programator, a arborelui apelurilor
recursive, traversarea acestuia prin apelarea recursivă (repetată) şi efectuarea acţiunilor
corespunzătoare în momentul “vizitării” fiecărui nod al arborelui. Apelarea recursivă
constituie “motorul vehiculului” de traversare şi are doar rolul de a permite traversarea
arborelui. Gestionarea stivei apelurilor recursive şi revenirea - back-tracking-ul rămîne în
sarcina mediului de programare folosit şi se efectuează într-un mod mascat pentru
programator. Din acest punct de vedere, programatorului îi revine sarcina scrierii corecte a
instrucţiunii de apel recursiv şi a instrucţiunii ce “scurt-circuitează” bucla infinită a apelurilor
recursive. Singurele instrucţiuni care “fac treabă”, în sensul rezolvării propriuzise a problemei
respective, sînt cele cuprinse în corpul procedurii.
De exemplu, iată cum arată în limbajul de programare Pascal procedura generală de
generare a permutărilor în varianta recursivă şi arborele de generare a permutărilor mulţimii
{1,2,3} (n=3), pe nivele:
Procedure Permut(k:byte;s:string);{ k – nivelul în arbore, s - şirul}
Var i:byte;tmp:char;
Begin
If k=n then begin { scurt-circuitarea recursivităţii}
For i:=1 to n do Write(s[i]); { prin afişarea permutării }
Write(';'); { urmată de un punct-virgulă }
end else
For i:=k to n do begin { singurele instrucţiuni “ce fac treabă”}
tmp:=s[i];s[i]:=s[k];s[k]:=tmp; { sînt for-ul şi cele trei
atribuiri }
Permut(k+1,s); { apelul recursiv ce permite parcugerea }
end; { arbor. de generare a celor n! permutări}
End;
Nivelele arborelui (răsturnat pe orizontală)
64
--------------------------------------------
0 1 2 3
--------------------------------------------
2 ---- 3 Fiecare nivel al arborelui corespunde unei poziţii în şirul
permutărilor. Astfel, pe prima
1 <
3 ---- 2 poziţie (nivelul 1) pot fi oricare din cele trei elemente:
1, 2, 3. Pe poziţia următoare pot
/
1 ---- 3 fi oricare din celelalte două elemente rămase:2,3;1,3;1,2.
Start -- 2 < Pe al treilea nivel şi ultimul
3 ---- 1 vor fi numai elementele rămase (cîte unul).
Generarea permutărilor constă în construirea
\
1 ---- 2 şi parcurgerea arborelui permutărilor: odată ajunşi cu
parcurgerea la un capăt din dreapta
3 <
2 ---- 1 vom afişa de fiecare dată “drumul” de la
“rădăcină” la “frunza” terminală.
Observăm că arborele permutărilor este identic cu arborele apelurilor recursive şi că
controlul şi gestiunea stivei se face automat, transparent faţă de programator. Instrucţiunilor
de control (din background) le revine sarcina de a păstra şi de a memora, de la un apel
recursiv la altul, string-ul s ce conţine permutările. Deşi această procedură recursiv de
generare a permutărilor pare o variantă de procedură simplă din punctul de vedere al
programatorului, în realitate, ea conţine într-un mod ascuns efortul de gestionare a stivei:
încărcarea-descărcarea stringului s şi a întregului k. Acest efort este preluat în întregime de
instrucţiunile incluse automat de mediul de programare pentru realizarea recursivităţii.
Avantajul metodei back-tracking este faptul că efortul programatorului se reduce la
doar trei sarcini:
1. “construirea” grafului particular de căutare a soluţiilor
2. adaptarea corespunzătoare a uneia din metodele generale de traversare-vizitare a grafului
în situaţia respectivă (de exemplu, prin apel recursiv)
3. adăugarea instrucţiunilor “ce fac treabă” care, fiind apelate în mod repetat în timpul
vizitării nodurilor (grafului soluţiilor posibile), rezolvă gradat problema, găsind sau
construind soluţia.
Acţiunea de revenire ce dă numele metodei, backtracking - revenire pe “pista lăsată”,
este inclusă şi este efectuată de subalgoritmul de traversare a grafului soluţiilor posibile. Acest
65
subalgoritm are un caracter general şi face parte din “zestrea” oricărui programator. În cazul
particular în care graful soluţiilor este arbore, atunci se poate aplica întotdeauna cu succes
metoda programării recursive care conduce la un cod-program redus şi compact.
Prezentăm din nou procedura generală DepthFirstSearch (DFS) de traversare a unui
graf în varianta recursivă (ce “construieşte” de fapt arborele de traversare a grafului avînd ca
rădăcină nodul de pornire) pentru a pune în evidenţă cele spuse.
Procedura DFS(v:nod);
Vizitează v; { aici vor fi acele instrucţiuni “care fac treabă” }
Marchează v; // v devine un nod vizitat // { poate să lipsească în anumite implementări }
Cît timp (există w nemarcat nod adiacent lui v) execută DFS(w);
{ apelul recursiv este “motorul vehiculului” }
{ ce permite parcurgerea grafului şi gestiunea stivei de revenire }
Există situaţii în care, la unele probleme, putem întîlni soluţii tip-backtracking fără
însă a se putea sesiza la prima vedere prezenţa grafului de căutare asociat şi acţiunea de
traversare a acestuia, ci doar prezenţa stivei. O privire mai atentă însă va conduce obligatoriu
la descoperirea arborelui de căutare pe graful soluţiilor, chiar dacă el există doar într-o formă
mascată. Acest fapt este inevitabil şi constituie esenţa metodei – căutare (generare) cu
revenire pe pista lăsată.
Back-tracking-ul, metodă generală şi cu o largă aplicabilitate, fiind reductibilă în
ultimă instanţă la traversarea spaţiului -grafului de căutare- a soluţiilor, are marele avantaj că
determină cu certitudine toate soluţiile posibile, cu condiţia ca graful asociat de căutare a
soluţiilor să fie corect. Dar ea are marele dezavantaj că necesită un timp de execuţie direct
proporţional cu numărul nodurilor grafului de căutare asociat (sau numărul cazurilor posibile).
În cele mai multe cazuri acest număr este exponenţial (e
n
) sau chiar mai mare, factorial (n!),
unde n este dimensiunea vectorului datelor de intrare. Acest fapt conduce la o durată de
execuţie de mărime astronomică făcînd într-un astfel de caz algoritmul complet inutilizabil,
chiar dacă el este corect teoretic. (De exemplu, dacă soluţionarea problemei ar necesita
generarea tuturor celor 100! permutări (n=100), timpul de execuţie al algoritmului depăşeşte
orice imaginaţie.) În astfel de situaţii, în care dimensiunea spaţiului de căutare-generare a
soluţiilor are o astfel de dependenţă în funcţie de n (fiind o funcţie de ordin mai mare decît
funcţia polinomială), este absolut necesară îmbunătăţirea acestei metode sau înlocuirea ei. Nu
este însă necesară (şi de multe ori nici nu este posibilă!) abandonarea modelului abstract
asociat - graful soluţiilor posibile, cu calităţile şi proprietăţile sale certe - ci este necesară doar
66
obţinerea unei durate de execuţie de un ordin de mărime inferior printr-o altă strategie de
parcurgere a spaţiului de căutare.
Greedy.
În strategia backtracking căutarea soluţiei, adică vizitarea secvenţială a nodurilor
grafului soluţiilor cu revenire pe urma lăsată, se face oarecum “orbeşte” sau rigid, după o
regulă simplă care să poată fi rapid aplicată în momentul “părăsirii” unui nod vizitat. În cazul
metodei (strategiei) greedy apare suplimentar ideea de a efectua în acel moment o alegere.
Dintre toate nodurile următoare posibile de a fi vizitate sau dintre toţi paşii următori posibili,
se alege acel nod sau pas care asigură un maximum de “cîştig”, de unde şi numele metodei:
greedy = lacom. Evident că în acest fel poate să scadă viteza de vizitare a nodurilor – adică a
soluţiilor ipotetice sau a soluţiilor parţiale – prin adăugarea duratei de execuţie a
subalgoritmului de alegere a următorului nod după fiecare vizitare a unui nod. Există însă
numeroşi algoritmi de tip greedy veritabili care nu conţin subalgoritmi de alegere. Asta nu
înseamnă că au renunţat la alegerea greedy ci, datorită “scurtăturii” descoperite în timpul
etapei de analiză a problemei, acei algoritmi efectuează la fiecare pas o alegere fără efort şi în
mod optim a pasului (nodului) următor. Această alegere, dedusă în etapa de analiză,
conduce la maximum de “profit” pentru fiecare pas şi scurtează la maximum drumul către
soluţia căutată.
Aparent această metodă de căutare a soluţiei este cea mai eficientă, din moment ce la
fiecare pas se trece dintr-un optim (parţial) într-altul. Totuşi, ea nu poate fi aplicată în general
ci doar în cazul în care există certitudinea alegerii optime la fiecare pas, certitudine rezultată
în urma etapei anterioare de analiză a problemei. Ori, dezavantajul este că, la majoritatea
problemelor dificile, etapa de analiză nu poate oferi o astfel de “pistă optimă“ către soluţie.
Un alt dezavantaj al acestei strategii este că nu poate să conducă către toate soluţiile posibile
ci doar către soluţia optimă (din punct de vedere a alegerii efectuate în timpul căutării
soluţiei), dar poate oferi toate soluţiile optime echivalente.
Programarea dinamică.
Este o metodă sau strategie ce îşi propune să elimine dezavantajele metodei recursive
care, în ultimă instanţă, am văzut că se reduce la parcurgerea în adîncime a arborelui
apelurilor recursive (adică backtracking). Această metodă se apropie ca idee strategică de
metoda Greedy, avînd însă unele particularităţi.
67
Pentru a o înţelege este necesară evidenţierea dezavantajului major al recursivităţii. El constă
din creşterea exagerată şi nerentabilă a efortului de execuţie prin repetarea ineficientă a unor
paşi. Urmărind arborele apelurilor recursive se observă repetarea inutilă a unor cazuri
rezolvate anterior, calculate deja înainte pe altă ramură a arborelui. Metodă eminamente
iterativă, programarea dinamică elimină acest dezavantaj prin “răsturnarea” procedeului de
obţinere a soluţiei şi implicit a arborelui apelurilor recursive. Printr-o abordare bottom-up (de
la bază spre vîrf) ea reuşeşte să elimine operaţiile repetate inutil în cazul abordării top-down
(de la vîrf spre bază).
Cu toţii am învăţat că, dacă vrem să calculăm “cu mîna” o combinare sau un tabel al
combinărilor, în loc să calculăm de fiecare dată combinări de n luate cîte k pe baza definiţiei
recursive: C(n,k)=C(n-1,k-1)+C(n-1,k) cînd n,k>0, sau, C(n,k)=1 cînd k=0 sau n=k, este
mult mai eficient să construim Triunghiul lui Pascal, pornind de la aceeaşi definiţie a
combinărilor.
C(4,2)
C(3,1) + C(3,2)
C(2,0) + C(2,1) C(2,1) + C(2,2)
1 C(1,0) + C(1,1) C(1,0) + C(1,1) 1
1 1 1 1
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
…………..
Observaţi cum în arborele apelurilor recursive apar apeluri în mod repetat pentru
calculul aceleaşi combinări. Acest efort repetat este evitat prin calcularea triunghiului lui
Pascal în care fiecare combinare va fi calculată o singură dată.
În mod asemănător, aceeaşi diferenţă de abordare va exista între doi algoritmi de
soluţionare a aceleaşi probleme, unul recursiv – backtracking - şi altul iterativ - proiectat prin
metoda programării dinamice.
68
Dezavantajele acestei metode provin din faptul că, pentru a ţine minte paşii gata
calculaţi şi a evita repetarea calculării lor (în termeni de grafuri, pentru a evita calcularea
repetată a unor noduri pe ramuri diferite ale arborelui apelurilor recursive), este nevoie de
punerea la dispoziţie a extra-spaţiului de memorare necesar şi de un efort suplimentar dat de
gestiunea de memorie suplimentară.
Branch & Bound.
Este strategia cea mai sofisticată de proiectare a algoritmilor. Ea a apărut datorită
existenţei problemelor pentru care soluţia de tip backtracking poate necesita un timp
astronomic de rulare a programului. În rezolvarea acestor probleme apare o asemenea penurie
de informaţii încît modelul abstract asociat problemei - graful de căutare a soluţiilor – nu
poate fi precizat în avans, din etapa de analiză. Singura soluţie care rămîne este includerea
unui subalgoritm suplimentar ce permite construirea acestui graf pe parcurs, din aproape în
aproape. Apariţia acelui subalgoritm suplimentar dă numele metodei: branch&bound.
Este posibilă compararea algoritmului branch&bound cu un robot ce învaţă să se
deplaseze singur şi eficient printr-un labirint. Acel robot va fi obligat să-şi construiască în
paralel cu căutarea ieşirii o hartă (un graf !) a labirintului pe care va aplica apoi , pas cu pas,
metode eficiente de obţinere a drumului cel mai scurt.
La strategia de căutare a soluţiei în spaţiul (graful) de căutare - backtracking, fiecare
pas urma automat unul după altul pe baza unei reguli încorporate, în timp ce la strategia
greedy alegerea pasului următor era făcută pe baza celei mai bune alegeri. În cazul acestei
strategii – branch&bound, pentru pasul următor algoritmul nu mai este capabil să facă vreo
alegere pentru că este obligat mai întîi să-şi determine singur nodurile vecine ce pot fi vizitate.
Numele metodei, branch=ramifică şi bound=delimitează, provine de la cele două acţiuni ce
ţin locul acţiunii de alegere de la strategia Greedy. Prima acţiune este construirea sau
determinarea prin ramificare a drumurilor de continuare, iar a doua este eliminarea
continuărilor (ramurilor) ineficiente sau eronate. Prin eliminarea unor ramuri, porţiuni întregi
ale spaţiului de căutare a soluţiei rămînînd astfel dintr-o dată delimitate şi “izolate”. Această
strategie de delimitare din mers a anumitor “regiuni” ale spaţiului de căutare a soluţiilor este
cea care permite reducerea ordinului de mărime a acestui spaţiu. Soluţia aceasta este eficientă
doar dacă cîştigul oferit prin reducerea spaţiului de căutare (scăzînd efortul suplimentar depus
pentru determinarea şi eliminarea din mers a continuărilor ineficiente) este substanţial.
69
Soluţiile de tip backtracking, avînd la bază un schelet atît de general (algoritmul de
traversare a grafului de căutare a soluţiilor) sînt relativ simplu de adaptat în rezolvarea unor
probleme. Poate acesta este motivul care a condus pe unii programatori lipsiţi de experienţă la
convingerea falsă că “Orice este posibil de rezolvat prin backtracking”.
La ora actuală, lista problemelor pentru care nu se cunosc decît soluţii exponenţiale,
total nerezonabile ca durată de execuţie a programului de soluţionare, cuprinde cîteva sute de
probleme, una mai celebră ca cealaltă. Reamintim doar de “banala” (dar agasanta) Problemă a
Orarului unei instituţii de învăţămînt care nu admite o soluţie backtracking datorită duratei
astronomice de aşteptare a soluţiei.
Datorită totalei lor ineficienţe în execuţie, soluţiile backtracking obţinute după o
analiză şi o proiectare “la prima mînă” (brute-force approach, în limba engleză) ajung să fie
reanalizate din nou cu mai multă atenţie. Se constată atunci că modelul abstract asociat
problemei, fie este prea sărac în informaţii pentru determinarea grafului de căutare a
soluţiilor, fie conduce la un graf de căutare avînd dimensiunea nerezonabilă (exponenţială sau
factorială, faţă de dimensiunea n a vectorului de intrare). Singura soluţie care rămîne în
această situaţie la dispoziţie este ca aceste soluţii să fie reproiectate prin metoda
branch&bound.
Un exemplu uşor de înţeles de “problemă branch&bound“ îl oferă Problema Generală
a Labirintului. Spre deosebire de Problema Labirintului prezentată anterior (care admitea o
soluţie de tip backtracking), în varianta extinsă a acestei probleme, numărul direcţiilor
posibile de urmat la fiecare pas poate fi oricît de mare, iar obstacolele pot avea orice formă şi
dimensiune. În acest caz, singura posibilitate este construirea “din mers” a spaţiului de
căutare a soluţiei. Astfel, pentru determinarea unui drum de ieşire din labirint sau a drumului
cel mai scurt (dacă este posibilă determinarea acestuia în timp rezonabil!) este obligatorie
Oferim în continuare o situaţie concretă, ilustrată. Sesizaţi că obstacolele, avînd forme
şi dimensiuni diferite, nu pot fi ocolite decît pe un traseu “razant” sau pe un traseu ce urmează
contorul exterior al acestora. Acest fapt complică mult problema şi impune luarea unor decizii
“la faţa locului”, în momentul întîlnirii şi ocolirii fiecărui obstacol, ceea ce impune o strategie
de rezolvare de tip branch&bound – ramifică şi delimitează:
O
Þ ¤
70
&
4
Deşi această strategie poate să crească uneori surprinzător de mult eficienţa
algoritmilor de soluţionare (din nerezonabili ca timp de execuţie ei pot ajunge rezonabili,
datorită reducerii dimensiunii exponenţiale a spaţiului de căutare a soluţiei), aplicarea ei este
posibilă doar printr-un efort suplimentar în etapa de analiză şi în cea de proiectare a
algoritmului. Dezavantajul major al acestei metode constă deci în efortul major depus în etapa
de analiză a problemei (analiză care însă se va face o singură dată şi bine!) şi efortul
suplimentar depus în etapa proiectării algoritmului de soluţionare.
Din experienţa practică este cunoscut faptul că, pentru a analiza o problemă dificilă un
analist poate avea nevoie de săptămîni sau chiar luni de zile de analiză, în timp ce algoritmul
de soluţionare proiectat va dura, ca timp de execuţie, doar cîteva zeci de minute. Dacă
programul obţinut nu este necesar a fi rulat decît o dată, aceasta este prea puţin pentru “a se
amortiza” costul mare al analizei şi proiectării sale. În acea situaţie, soluţia branch&bound
este nerentabilă şi, probabil că ar fi mai ieftină strategia backtracking de soluţionare, chiar şi
cu riscul de a obţine o execuţie (singura de altfel) a programului cu durata de o săptămînă
(ceea ce poate să însemne totuşi economie de timp).
Recursivitatea
Aşa cum am amintit deja, această metodă de programare poate fi privită ca formă
particulară de exprimare a metodei Back-Tracking. Cu toate acestea, cei ce cunosc istoria
informaticii şi originile programării ştiu că această metodă are totuşi un caracter special.
Aceste lucruri dorim să le evidenţiem în continuare.
Încă înainte de apariţia primului calculator şi, deci implicit a oricărei tehnici de
programare, unii matematicieni erau profund preocupaţi de noţiunea de calculabilitate.
Această noţiune îi putea ajuta în efortul lor deosebit de a fundamenta noţiunea elementară de
algoritm sau metodă automată de calcul. În paralel, cele mai valoroase rezultate le-au obţinut
latino-americanul Alonso Church şi englezul Alan Turing. În timp ce Turing a introdus pentru
algoritm modelul matematic abstract cunoscut sub numele de Maşina Turing (care stă la
bazele modelului actual de calculator), Church a fundamentat noţiunea de metodă de calcul
sau calculabilitatea pe funcţiile recursive. Astfel, teza lui Church afirma că orice funcţie
definită pe domeniul numerelor naturale este calculabilă dacă şi numai dacă ea este
recursivă. Deşi aparatul teoretic folosit de Church era în întregime matematic (se baza numai
71
pe funcţii numerice naturale), lui nu i-a fost greu să demonstreze că orice algoritm nenumeric
se reduce la funcţii recursive şi la mulţimi recursive de numere naturale (pe baza unor
codificări riguros alese).
Acest din urmă rezultat este cel care ne interesează pe noi şi noi îl vom reformula fără
ai afecta valabilitatea: orice algoritm poate fi rescris printr-un algoritm recursiv (limbajul de
programare Lisp se bazează în întregime pe acest fapt). Chiar dacă nu constituie o
demonstraţie riguroasă, următoarea echivalenţă practică (descrisă în pseudo-cod) este deosebit
de convingătoare: orice instrucţiune de ciclare este echivalentă cu un apel recursiv de
subprogram sau funcţie.
Varianta iterativă-cu ciclu Varianta cu apel recursiv
contor:=val_init;
Repetă
Corp_ciclu;
Incrementează(contor);
Pînă cînd contor=val_finală;
Funcţie_Recursivă(contor){
Dacă contor<val_finală atunci
Corp_ciclu;
Funcţie_Recursivă(contor+1);
}
……………
Funcţie_Recursivă(val_init); // apelul
iniţial al funcţiei
Observăm că în cazul variantei recursive condiţia de scurt-circuitare a recursivităţii
este echivalenta condiţiei de scurt-circuitare a ciclului. Gestiunea contorului se face în acest
caz în back-ground, prin mecanismul de stivă sistem.
Putem astfel concluziona: toţi algoritmii iterativi pot fi înlocuiţi prin algoritmi
recursivi. Avantajul celor recursivi este dat de scăderea dimensiunilor programelor şi de
creşterea lizibilităţii. Avantajul celor iterativi este viteza mărită de execuţie prin gestionarea
locală a parametrilor de ciclare (eliminîndu-se astfel toate instrucţiunile push şi pop pentru
gestionarea stivei).
Spre edificare, vă oferim în continuare cîteva probleme clasice (simple) rezolvate în C
prin metoda recursivă. În capitolul cu probleme ce necesită back-tracking veţi găsi şi alte
soluţii recursive (în C) ale unor probleme ceva mai dificile; astfel se vor putea sesiza mai bine
avantajele acestei metode "naturale" de programare. (Întrucît am considerat acest capitol ca
fiind destul de "tehnic", prezentăm în continuare doar variantele de program în limbajul C, ce
este considerat mai "tehnic" decît limbajul Pascal.)
1. Să se copieze un şir de caractere într-altul.
72
#include <stdio.h>
char *sir1="primul",*sir2="al doilea";
void strcopy(char *sursa,char *dest){
if ((*dest++=*sursa++)==NULL) return;
else strcopy(sursa,dest);
}
void main(void){
printf("\nInainte, sirul sursa:%s, sirul destinatie:%s",sir1,sir2);
strcopy(sir1,sir2);
printf("\nSi dupa, sirul sursa:%s, sirul destinatie:%s",sir1,sir2);
}
2. Să se afişeze primele n pătrate perfecte.
#include <stdio.h>
#include <math.h>
int n;
void patrat(int m){
if(m>n)return;
else {
printf("%i:%i ",m,m*m);
patrat(m+1);
}
}
void main(void){
printf("n=");scanf("%i",&n);
patrat(1);
}
3.Algoritmul lui Euclid.
#include <stdio.h>
int cmmdc(int m,int n){
if (n==0) return(m);
else cmmdc(n,m%n);
}
void main(void){
int m,n;
printf("m,n=");scanf("%i,%i",&m,&n);
printf("cmmdc(%i,%i)=%i",m,n,cmmdc(m,n));
}
73
4. Se citeşte n, să se găsească primul număr prim mai mare decît n. (Se presupune cunoscută
demonstraţia faptului că există p-prim mai mare decît oricare n. Sîntem astfel siguri că
algoritmul se opreşte! )
#include <stdio.h>
#include <math.h>
int n;
int are_divizor(int p,int d){
if(d>sqrt(p))return 0;
else if(p%d==0) return 1;
else are_divizor(p,d+1);
}
void prim(int p){
if(!are_divizor(p,2)){
printf("\n%i",p);
return;
}
else prim(p+1);
}
void main(){
printf("n=");scanf("%i",&n);
prim(n+1);
}
5. Să se afişeze primele n numere prime.
#include <stdio.h>
#include <math.h>
int n;
int are_divizor(int p,int d){
if(d>sqrt(p))return 0;
else if(p%d==0) return 1;
else are_divizor(p,d+1);
74
}
void prim(int p,int i){
if(i>n)return;
if(!are_divizor(p,2)){
printf("%i,",p);
prim(p+1,i+1);
}
else prim(p+1,i);
}
void main(){
printf("n=");scanf("%i",&n);
prim(2,1);
}
6. Se citeşte n gradul unui polinom P şi a[0],a[1],...,a[n] coeficienţii reali ai acestuia. Se
citeşte o valoare reală x, să se calculeze P(x).
#include <stdio.h>
int n;
float a[20],x;
float P(int i){
if(i==1)return a[0];
else return P(i-1)*x+a[i-1];
}
void citeste_coef(int i){
if(i>n)return;
else {printf("%i:",i);scanf("%f",&a[i]);citeste_coef(i+1);}
}
void main(){
printf("n=");scanf("%i",&n);
citeste_coef(0);
printf("x=");scanf("%f",&x);
printf("P(%f)=%f",x,P(n+1));
}
75
7. Se citesc m şi n gradele a două polinoame P şi Q, şi a[0],a[1],...,a[m] respectiv
b[0],b[1],...,b[n] coeficienţii reali ai acestora. Să se afişeze coeficienţii c[0],c[1],...,c[m+n] ai
polinomului produs R=PxQ.
#include <stdio.h>
int m,n;
float a[20],b[20],c[40];
float suma_prod(int i,int j){
if(j==i)return a[i]*b[0];
else return a[i-j]*b[j]+suma_prod(i,j+1);
}
void calc_coef(int i){
if(i>m+n)return;
else c[i]=suma_prod(i,0);
}
void citeste_coef(float a[],int i){
if(i>n)return;
else {printf("%i:",i);scanf("%f",&a[i]);citeste_coef(a,i+1);}
}
void afis_coef(float a[],int i){
if(i>n)return;
else {printf("%f ",a[i]);afis_coef(a,i+1);}
}
void main(){
printf("Introd.coef.polinomului P:");
citeste_coef(a,0);
printf("Introd.coef.polinomului Q:");
citeste_coef(b,0);
calc_coef(0);
afis_coef(c,0);
}
76
8. Se citeşte n, o valoarea întreagă pozitivă, să se determine suma cifrelor lui n.
#include <stdio.h>
int n;
int suma(int n){
if(n<10)return n;
else return n%10+suma(n/10);
}
void main(){
printf("n=");scanf("%i",&n);
printf("suma cifrelor=%i",suma(n));
}
77
Probleme rezolvate şi exerciţii de programare
Vom începe prin a face o observaţie importantă: există totdeauna un pericol în oferirea
"pe tavă" a soluţiilor la probleme. În următoarele subcapitolele nu am fost deloc "zgîrciţi" şi
se pot găsi destule probleme rezolvate atît în Pascal cît şi în C, deşi pentru unele veţi putea
găsi rezolvarea doar într-unul din limbaje. Pericolul constă în faptul că, începătorilor leneşi,
lipsiţi de voinţă şi înclinaţi către a copia mereu, li se oferă posibilitatea să nu-şi mai "bată"
capul cu rezolvarea problemelor acum cînd au totul "de-a gata". Desigur, cei care ies în
pierdere sînt tot ei. Ne-am asumat acest risc gîndindu-ne nu atît la cei leneşi cît mai ales la
programatorii începători bine-intenţionaţi cărora aceste probleme, cu rezolvările lor tipice, le
poate fi de un real folos. Putem spune că urmat astfel exemplul autorilor mediilor de
programare Turbo Pascal şi Turbo C (sau Borland) care prin help-urile lor generoase au
contribuit decisiv la formarea multor generaţii de programatori.
Vă avertizăm că, în practica concretă de programare, programatorul (care nu este şi
analist) primeşte de la cel care a analizat înainte problema doar indicaţii de programare.
Rareori analistul pune la dispoziţia programatorului şi o descriere în pseudocod a algoritmilor
ce trebuiesc implementaţi. Deci, nici un programator începător nu trebuie să-şi facă iluzia că
"generozitatea" din acest capitol o va mai întîlni vreodată în practica concretă de programare
sau că va avea vreodată la dispoziţie surse "abundente" de inspiraţie. Este cert că în practică
lipsa "inspiraţiei" va trebui compensată prin "transpiraţie".
Probleme elementare. Exerciţii de programare
Oferim în continuare o mulţime de probleme de programare "clasice" rezolvate într-un
mod didactic. Am adăugat înaintea celor două versiuni de soluţionare în cele două limbaje de
programare, Pascal şi C, cîteva rînduri ce cuprind elementele de bază ale analizei probleme.
Ne-am străduit să aşezăm problemele în ordinea dificultăţii lor, de la cele elementare
spre cele mai dificile. De aceea este recomandat ca ele să fie parcurse în această ordine.
Atragem atenţia începătorilor: una din trăsăturile specifice ale programării este că o
problemă admite mai multe rezolvări corecte. Deşi pot fi diferite în unele detalii, fiind
echivalente prin rezultatele pe care le oferă, noi le vom numi variante. Aşa că, ceea ce se
oferă în continuare este doar o variantă de rezolvare pentru fiecare problemă, ea fiind pasibilă
de îmbunătăţiri, atît pentru versiunea Pascal cît şi pentru versiunea C. Se zice că o variantă de
78
program (algoritm) este mai eficientă decît alta dacă cantitatea de resurse-calculator folosită
este mai redusă: memorie-calculator (necesarul de spaţiu) mai puţină şi timp-calculator
(necesarul de timp sau durata de execuţie) mai mic.
Este cunoscut că în învăţarea unei limbi străine ajută mult exersarea traducerilor dintr-
o limbă într-alta. Evident, pentru realizarea retroversiunii (termenul de specialitate folosit)
este necesară cunoaşterea temeinică a uneia din cele două limbaje. La fel, în cazul
programării, învăţarea celui de-al doilea limbaj de programare este mult uşurată de faptul că
am asimilat deja primul limbaj de programare. În finalul capitolului vor apare, pentru
exerciţiu, mai multe probleme avînd varianta de rezolvare doar într-unul din limbaje, Pascal
sau C, şi vă propunem să scrieţi programul corespondent în celălalt limbaj. Astfel, cei care au
învăţat deja Pascal vor putea astfel să înveţe C-ul foarte rapid , şi reciproc.
Să se afişeze soluţiile reale ale ecuaţiei de gradul al doilea.
Analiza problemei - elaborarea algoritmului:
Fie ecuatia de gradul II ax
2
+bx+c=0
- daca toti coeficientii ecuatiei sunt egali cu 0 atunci avem o ecuatie
nedeterminata care are o infinitate de solutii (S=R).
- daca a,b=0 ,iar c<>0 atunci avem o ecuatie care nu are solutii.
- daca a=0 ,b,c <>0 atunci ecuatia se reduce la o ecuatie de gradul I care
are o singura solutie x=-c/b.
- daca a,b,c <>0 atunci trebuie calculat discriminantul (delta) ecuatiei d=b*b-4*a*c
- daca d>=0 atunci ecuatia are solutii reale x
1,2
=(-b+-sqrt(d))/(2*a)
- daca d<0 atunci ecuatia nu are solutii reale.
program ecuatie;
var a,b,c,d:real;
BEGIN
if a=0 then
if b=0 then
if c=0 then
79
writeln('Ecuatie nedeterminata, S=R')
else writeln('Ecuatia nu are solutii.')
else writeln('Ecuatie de gradul I cu solutia x=',-c/b:6:2)
else
begin
d:=b*b-4*a*c;
if d>=0 then
begin
writeln('x
1
=',(-b-sqrt(d))/(2*a):6:2);
writeln('x
2
=',(-b+sqrt(d))/(2*a):6:2);
end
else writeln('Ecuatia nu are solutii reale.');
end;
END.
#include <stdio.h>
#include <math.h>
float a,b,c; // coeficientii ecuatiei de gradul II
float delta;
void main(){
printf("Introd.coefic.ecuatiei a b c:");scanf("%f %f %f",&a,&b,&c);
delta=b*b-4*a*c;
if (delta>=0) {
printf("Sol.reale: x1=%6.2f, x2=%6.2f",(-b+sqrt(delta))/2./a,(-b-sqrt(delta))/2./a);
} else {
printf("Sol.complexe: x1=(%6.2f,%6.2f), x2=(%6.2f,%6.2f)",-b/2./a,sqrt(-delta)/2./a,-b/2/a,-
1./2./a*sqrt(-delta));
}
}
80
Să se determine dacă trei numere reale pot reprezenta laturile unui triunghi. Dacă da,
să se calculeze perimetrul si aria sa.
Analiza problemei – elaborarea algoritmului :
- trebuie sa vedem cînd trei numere pot fi lungimile laturilor unui triunghi: cele trei numere
trebuie sa fie pozitive si suma a oricare doua dintre ele sa fie mai mare decat a treia latura.
- algoritmul poate fi implementat folosind o functie care sa verifice daca cele trei numere
indeplinesc conditiile enumerate mai sus.
- dupa verificarea celor trei numere calculam perimetrul si aria triunghiului folosind formula
lui Heron s=sqrt(p(p-a)(p-b)(p-c)), unde semiperimetrul este p=(a+b+c)/2.
program arie;
var a,b,c:integer;
s,p:real;
function laturi_ok:boolean;
begin
laturi_ok:= (a>0) and (b>0) and (c>0) and (a+b>c) and (a+c>b) and (b+c>a) ;
end;
BEGIN
P:=(a+b+c)/2;
IF laturi_ok then
begin s:=sqrt(p*(p-a)*(p-b)*(p-c));
writeln('s=',s:5:2);
writeln(‘p=’,p*2:5:2);
end
else writeln('laturi negative sau prea mari');
END.
// solutia in limbajul C
#include <stdio.h>
#include <math.h>
81
float a,b,c;
float s,p;
int laturi_ok(void){
return (a>0)&&(b>0)&&(c>0)&&(a+b>c)&&(a+c>b)&&(b+c>a) ;
}
void main(void){
printf("introduceti laturile a b c:");scanf("%f %f %f",&a,&b,&c);
p=(a+b+c)/2;
if (laturi_ok()){
s=pow(p*(p-a)*(p-b)*(p-c), 0.5);
printf("s=%6.2f p=%6.2f",s,p);
}
else printf("laturi negative sau prea mari");
}
Să se afişeze media aritmetică, geometrică şi hiperbolică a trei valori reale.
Analiza problemei - elaborarea algoritmului:
- trebuie aplicate formulele pentru calculul celor trei medii si trebuie analizate cazurile :
×cand nu putem calcula media geometrica a trei numere(cand produsul lor este
negativ,deci cand avem unul sau trei numere negative)
×cand nu putem calcula media hiberbolica a numerelor(cand unul dintre numere este egal
cu 0 si nu poate fi facuta impartirea cu 0).
- in TurboPascal exista o functie pentru calculul radicalului de ordinul 2 (sqrt),dar pentru
calculul radicalului de ordinul n nu este implementata o functie de aceea pentru calculul
radicalului de ordinul n folosim functia exponentiala ( exp ) pentru a calcula o puterea a lui:
a
n =
exp(n*ln(a)), iar pentru a calcula radical de ordinul n din a: a
1/n
=exp(1/n*ln(a)) .
program medii;
var a,b,c,ma,mg,mh:real;
BEGIN
82
writeln('ma=',(a+b+c)/3:6:2);
if (a=0) or (b=0) or (c=0) then writeln('mg=0')
else
if a*b*c>0 then writeln('mg=',exp(1/3*ln(a*b*c)):6:2)
else writeln('Nu putem calcula media geometrica ,nr negative .');
if (a=0) or (b=0) or (c=0) then writeln('Nu putem calcula media hiperbolica')
else writeln('mh=',3/(1/a+1/b+1/c):6:2);
END.
// solutia in limbajul C
#include <stdio.h>
#include <math.h>
float a,b,c,ma,mg,mh;
void main(void){
printf("a=");scanf("%f",&a);
printf("b=");scanf("%f",&b);
printf("c=");scanf("%f",&c);
printf("ma=%6.3f",(a+b+c)/3.);
if (a==0 || b==0 || c==0){
printf("mg=0");
printf("Nu putem calcula media hiperbolica");
} else {
if (a*b*c>0) then writeln("mg=%6.3f",pow(a*b*c,1./3.));
else printf("Nu putem calcula media geometrica ,nr negative .");
printf("mh=%6.3f",3./(1/a+1/b+1/c));
}
}
Să se determine suma primelor n numere naturale.
Analiza problemei – elaborarea algoritmului:
- suma primelor n numere naturale poate fi calculata, fără a folosi formula cunoscută, cu
una dintre instructiunile repetitive cunoscute(for,while ,repeat)
83
- indiferent de instructiunea repetitiva folosita trebuie initializata suma cu 0 (s=0)
- folosim un contor i (1,n) care la fiecare pas se incrementeaza cu 1 si se aduna la s
- ciclul se incheie cand valoarea lui i>n
- daca folosim instructiunea for, numarul pasilor este cunoscut, valoarea initiala a contorului
fiind 1, iar cea finala fiind n.
program suma;
var s,i:word;
BEGIN
s:=0;
for i:=1 to n do s:=s+i;
writeln(‘s=’,s);
END.
// solutia in limbajul C
#include <stdio.h>
unsigned s,i;
void main(void){
printf("Introduceti n=");scanf("%u",&n);
for(s=0,i=1;i<=n;i++) s+=i;
printf("s=%u",s);
}
Să se determine dacă n este pătrat sau cub perfect.
Analiza problemei – elaborarea algoritmului:
- pentru a verifica daca un numar este patrat perfect calculam radacina patrata a numarului
- daca numarul este patrat perfect radacina lui este un numar intreg altfel este un numar cu
zecimale
- verificam daca patratul partii intregii a radacinii numarului este egal cu numarul dat ,daca da
numarul este patrat perfect altfel numarul nu este patrat perfect
- la fel procedam pentru a verifica daca un numar este cub perfect .
84
program patrat_si_cub_perfect;
var n:longint;
BEGIN
if n=trunc(sqrt(n))*trunc(sqrt(n)) then
writeln(n,' este patrat perfect')
else
writeln(n,' nu este patrat perfect');
if n=trunc(exp(1/3*ln(n)))*trunc(exp(1/3*ln(n)))*trunc(exp(1/3*ln(n))) then
writeln(n,' este cub perfect')
else
writeln(n,' nu este cub perfect');
END.
// solutia in limbajul C
#include <stdio.h>
#include <math.h>
unsigned long n,m;
void main(void){
printf("n=");scanf("%lu",&n);
m=pow(n,0.5);if(n==m*m) printf("n este patrat perfect.");
m=pow(n,1./3.);if(n==m*m*m) printf("n este cub perfect.");
}
Să se determine toate numerele de 4 cifre divizibile cu n .
Analiza problemei - elaborarea algoritmului:
- observam ca daca abordam solutia la "prima mînă" numarul paşilor în cadrul ciclului for este
de 8999, pentru ca valoarea de intrare in ciclul for este 1000 iar valoarea de iesire este 9999.
- re-analizînd problema putem stabili un numar foarte mic de pasi care este egal cu numarul
de numere formate din patru cifre divizibile cu n .
85
program nr_divizibile;
var n,i:word;
BEGIN
{for i:=1000 to 9999 do
if (i mod n=0) then write(i,' ');
writeln;}
if 1000 mod n =0 then
for i:=(1000 div n) to 9999 div n do
write(i*n,',')
else
for i:=(1000 div n)+1 to 9999 div n do
write(i*n,',');
END.
// solutia in limbajul C
#include <stdio.h>
unsigned n,i;
void main(void){
printf("n=");scanf("%u",&n);
if (1000 % n ==0)
for(i=1000 /n;i<=9999 / n;i++) pritnf("%4u,",i*n);
else
for(i=1000 / n+1;i<= 9999 / n;i++) printf("4u,",i*n);
}
Să se determine suma cifrelor lui n.
Analiza problemei - elaborarea algoritmului:
- suma cifrelor numarului citit se obtine adunînd de fiecare data ultima cifra ce este restul
impartirii lui n la 10 (n mod 10) iar ceea ce ramine eliminind ultima cifra este dat de
impartirea lui n la 10 (n div 10).
86
program suma_cifre;
var n,s:word;
BEGIN
s:=0;
while n<> 0 do
begin
s:=s+n mod 10;
n:=n div 10;
end;
writeln('s=',s);
END.
// solutia in limbajul C
#include <stdio.h>
unsigned n,s;
void main(void){
printf("n=");scanf("%u",&n);
s=0;
while (n!=0) {
s+=n % 10;
n/=10;
}
printf("s=%u",s);
}
Să se afişeze următorul triunghi de numere:
1
1 2
1 2 3
......
1 2 3 ..n
87
program triunghi;
var i,j,n:word;
BEGIN
for i:=1 to n do
begin
for j:=1 to i do
write(j,' ');
writeln;
end;
END.
// solutia in limbajul C
#include <stdio.h>
int n,i,j;
void main(void){
printf("n=");scanf("%u",&n);
for(i=1;i<=n;i++) {
for(j=1;j<=i;j++)
printf("%i ",j);
putchar('\n');
}
}
Se citeşte o valoare reală. Să se determine radical din x cu 5 zecimale exacte pe baza
şirului convergent x
n
=1/2(x
n
-1+x/x
n-1
), cu x
0
>0 arbitrar ales.
Analiza problemei – elaborarea algoritmului:
Pentru rezolvarea problemei folosim sirul convergent dat (metoda lui Newton) care consta in
etapele:
-pornind cu x
0
=1 se genereaza recursiv urmatorul sir de numere reale
x
n
=1/2(x
n
-1+x/x
n-1
)
88
-cand diferenta intre x
n
si x
n-1
este foarte mica(mai mica decat o limita data)procesul de
generare a lui x
n
inceteaza
-la sfarsit x
n
reprezinta radacina patrata a lui x.
var x,xn,xn_1:real;
BEGIN
xn:=1;
repeat
xn_1:=xn;
xn:=0.5*(xn_1+x/xn_1);
until abs(xn-xn_1)<1e-5;
writeln('radical din ',xn:6:2,' comparativ cu ',sqrt(x):10:5);
END.
// solutia in limbajul C
#include <stdio.h>
#include <math.h>
float x,xn,xn_1;
void main(void){
printf("Introduceti valoarea:");scanf("%f",&x);
xn=1;
do{
xn_1=xn;
xn=0.5*(xn_1+x/xn_1);
} while abs(xn-xn_1)<1e-5;
printf('radical obtinut =%7.5f, comparativ cu %7.5",x,pow(x,0.5));
}
Se citeşte n, să se determine toate numerele perfecte mai mici decît n. Un număr este
perfect dacă este egal cu suma divizorilor săi (de ex. 6=1+2+3).
Analiza problemei – elaborarea algoritmului:
89
-pentru a verifica daca un numar este patrat perfect trebuie sa –i determinam divizorii si sa
verificam daca suma acestora este egala cu n
- se observa ca ultimul divizor nu trebuie luat in calcul pentru ca este egal cu n
-pentru a afisa toate numerele perfecte < n folosim un ciclu while in care il decrementam pe
n si verificam daca noul n este un numar perfect ,daca da il afisam
program nr_perfecte;
var n,d,i:word;
BEGIN
while n>1 do
begin
dec(n);
d:=0;
for i:=1 to n-1 do
if n mod i=0 then d:=d+i;
if n=d then writeln(n);
end;
END.
// o varianta C
#include <conio.h>
#include <stdio.h>
main()
{
long int i,n,j,sum,k;
clrscr();
printf("n=");
scanf("%ld",&n);
k=0;
i=0;
do
90
{
k=k+1;
do
{
sum=1;
i=i+1;
for(j=2;j<=i/2;j++)
if (i%j==0)
sum=sum+j;
}
while(sum!=i);
printf("%ld ",i);
}
while(k<n);
}
Se citeşte n un număr întreg pozitiv, să se afişeze n transcris în baza 2.
Analiza problemei - elaborarea algoritmului:
- folosim algoritmul cunoscut :
cît timp n <>0 executa
- imparte n la 2
- in urma impartirii n retine catul si restul
- numarul in baza doi se obtine scriind resturile in ordinea inversa in care le-am obtinut
- pentru a retine aceste resturi care trebuie tiparite in ordine inversa am folosit un sir (n2inv)
in care am retinut resturile pe care dupa aceea l-am afisat in ordine inversa.
program transf_in_baza_2;
var n,n2,i,j:word;
n2inv:array[1..20] of word;
BEGIN
i:=1;
while n>0 do
91
begin
n2:=n mod 2;
n2inv[i]:=n2;
n:=n div 2;
i:=i+1;
end;
for j:=i-1 downto 1 do
write(n2inv[j]);
END.
// o varianta C putin diferita
#include <stdio.h>
typedef unsigned char pointer[4];
void afiseaza(pointer px,int dim,char* format){
int i,j;
for(j=dim-1;j>=0;j--){
for(i=8;i>=0;i--) printf("%c",px[j] & (1<<i) ? '1':'0');
putchar('.');
}
}
float y;
long x;
void main(void){
printf("\nIntrod. intregul x si realul y:");scanf("%d %f",&x,&y);
printf("\nx= ");
afiseaza(&x,sizeof(x),"%d");
printf("\ny= ");
afiseaza(&y,sizeof(y),"%f");
}
92
Se citeşte n şi şirul de valori reale x1,x2,..,xn ordonate crescător. Să se determine
distanţa maximă între două elemente consecutive din şir.
Analiza problemei - elaborarea algoritmului :
- este o problema maxim
- distanta dintre primele valori consecutive din sir se noteaza cu max
- dupa care facem o comparatie cu urmatoarele distante dintre valori
- in momentul in care se intalneste o valoare mai mare decat max atunci aceasta valoare va
deveni noul max
- algoritmul se opreste in momentul in care se face comparatia dintre max si distanta dintre
ultimele doua valori ale sirului.
program dist_elem;
var n,i:word;
max:real;
x:array[1..50] of real;
BEGIN
for i:=1 to n do
begin
write('x[',i,']=');
end;
max:=x[2]-x[1];
for i:=2 to n-1 do
if x[i+1]-x[i]>max then max:=x[i+1]-x[i];
writeln('max=',max:6:2);
END.
Se citeşte n gradul unui polinom şi şirul coeficienţilor a
n
, .. , a
0
. Se citeşte x, să se
determine P(x).
93
program polinom;
var n,i :integer;
p,x:real;
a:array[0..20] of integer;
BEGIN
for i:=0 to n do
begin
write('a[',i,']=');
end;
{p:=a[0];
for i:=1 to n do
p:=p+a[i]*exp(i*ln(x));
writeln('P(',x,')=',p:6:2);}
p:=0;
for i:=n downto 0 do
p:=p*x+a[i];
writeln('P(',x,')=',p:6:2);
END.
Se citeşte o propoziţie (şir de caractere) terminată cu punct. Să se determine cîte vocale
şi consoane conţine propoziţia.
Analiza programului - elaborarea algoritmului:
- citim propozitia caracter cu caracter pana la intalnirea caracterului '.'
- folosim instructiunea case (selectie multipla) care daca la intalnirea unei vocale din sir
incrementeaza nr de vocale ,iar la intalnirea unei consoane incrementeaza nr de consoane.
program nr_consoane_si_vocale;
var c:char;
i,nv,nc:word;
94
sir:string[25];
BEGIN
i:=1; nv:=0; nc:=0;
repeat
case sir[i] of
'a','e','i','o','u': nv:=nv+1;
'b','c','d','f','g','h','j','k','l','m','n','p','r','s','t','x','y','w' :
nc:=nc+1;
end;
i:=i+1;
until sir[i]='.';
writeln('Nr de vocale=',nv);
writeln('Nr de consoane=',nc);
END.
// varianta C
#include <stdio.h>
#include <ctype.h>
int i,vocale=0,consoane=0;
char c,sir[80];
void main(void){
printf("Introd.propozitia terminata cu punct:");gets(sir);
for(i=0;sir[i]!='.';i++)
switch (toupper(sir[i])){
case 'A':
case 'E':
case 'I':
case 'O':
case 'U': vocale++; break;
default: if (isalpha(sir[i])) consoane++;
}
printf("Vocale:%i, Consoane:%i, Alte car.:%i", vocale, consoane, i-vocale-consoane);
}
95
Se citeşte m,n dimensiunea unei matrici A=(a[i,j])
mxn
de valori reale. Să se determine
suma elementelor pe fiecare linie şi coloană.
program matrice3;
var m,n,i,j:word;
a:array[1..50,1..50] of real;
sl,sc:array[1..50] of real;
BEGIN
for i:=1 to m do
begin
for j:=1 to n do
begin
write('a[',i,',',j,']=');
end;
writeln;
end;
for i:=1 to m do sl[i]:=0;
for j:=1 to n do sc[j]:=0;
for i:=1 to m do
begin
for j:=1 to n do
sl[i]:=sl[i]+a[i,j];
writeln('suma elementelor de pe linia ',i,'=',sl[i]:6:2);
end;
for j:=1 to n do
begin
for i:=1 to m do
sc[j]:=sc[j]+a[i,j];
writeln('suma elementelor de pe coloana ',j,'=',sc[j]:6:2);
end;
96
END.
// varianta C
#include <stdio.h>
unsigned m,n,i,j;
float a[50][50];
float sl[50],sc[50];
void main(void){
printf("Introduceti nr de linii m=");scanf("%u",&m);
pritnf("Introduceti nr de coloane n=");scanf("%u",&n);
for (i=0;i<m;i++){
for (j=0;j<n;j++){
printf("a[%u,%u]=",i,j);
scanf("%f",&a[i][j]);
}
putchar('\n');
};
for (i=0;i<m;i++) sl[i]=0;
for (j=0;j<n;j++) sc[j]=0;
for (i=0;i<m;i++) {
for (j=0;j<n;j++)
sl[i]+=a[i][j];
printf("suma elementelor de pe linia %u =%f",i,sl[i]);
}
for (j=0;j<n;j++) {
for (i=0;i<m;i++)
sc[j]+=a[i][j];
pritnf("suma elementelor de pe coloana %u=%f",j,sc[j]);
}
}
Se citeşte n şi k, şi o matrice A=a[i,j]
nxn
pătratică. Să se determine A
k
.
97
Analiza problemei - elaborarea algoritmului:
-algoritmul consta de fapt in calcularea elementelor matricii produs
-elementul c[i,j] =suma(k=1..n) a[i,k]*b[i,k] .
-A
k
=A*A*..*A
-matricea fiind patratica atunci cand k=2 termenii b[i,k]=a[i,k],iar cand k>2 termenii b[i,k]
pastreaza elementele produsului anterior A*A, folosim pentru aceasta atribuire procedura
aribuire.
program matrice1;
type matrice= array[1..3,1..3] of real;
var a,b,p: matrice;
n,i,j,k,l:word;
procedure atribuire(a:matrice);
begin
for i:=1 to n do
for j:=1 to n do
b[i,j]:=a[i,j];
end;
procedure inmultire ;
begin
for i:=1 to n do
for j:=1 to n do
p[i,j]:=0;
for i:=1 to n do
for j:=1 to n do
for l:=1 to n do
p[i,j]:=p[i,j]+a[i,l]*b[l,j];
end;
BEGIN
for i:=1 to n do
begin
for j:=1 to n do
98
begin
write('a[',i,',',j,']=');
end;
writeln;
end;
if k=1 then
for i:=1 to n do
for j:=1 to n do
p[i,j]:=a[i,j]
else
if k=2 then
begin
atribuire(a);
inmultire;
end
else
begin
atribuire(a);
inmultire;
k:=k-1;
while k>1 do
begin
atribuire(p);
inmultire;
k:=k-1;
end;
end ;
for i:=1 to n do
begin
for j:=1 to n do
write('p[',i,',',j,']=',p[i,j]:6:2,' ');
end;
99
END.
Iată un program Pascal care gestionează cu ajutorul unui fişier un catalog de note şi
persoane.
Type Persoana=Record Nume:String[20];Nota:Array[1..4]of integer; End;
Var f:File of Persoana;
Perstemp:Persoana;
Procedure Creare;
Begin
Writeln('Introd.');
Assign(f,'Test.jo');
Rewrite(f);
Repeat
With PersTemp do begin
If Nume='' then break;
end;
Write(f,PersTemp);
Until False;
Close(f);
End;
Procedure Citire;
Begin
Writeln('Introd.');
Assign(f,'Test.jo');
Reset(f);
Repeat
With PersTemp do begin
Writeln('Numele:',Nume);
Writeln('Notele:',Nota[1],Nota[2],Nota[3],Nota[4]);
100
end;
Until Eof(f);
Close(f);
End;
BEGIN
Creare;
Citire;
END.
Iată trei programe care exemplifică modul de lucru cu fişiere în limbajul C.
// Copierea unui fisier text sursa intr-un fisier destinatie
#include <stdio.h>
void main(void)
{
FILE *in, *out;
char numfin[20],numfout[20];
long contor=0;
printf("Nume fisier sursa:");gets(numfin);
printf("Nume fis.destinatie:");gets(numfout);
if ((in = fopen(numfin, "rt"))== NULL){
fprintf(stderr, "Eroare: %s fisier inexistent.\n",numfin);
return;
}
out = fopen(numfout, "wt");
while (!feof(in)){
fputc(fgetc(in), out);contor++;
}
fclose(in);fclose(out);
printf("Lungimea fis.destinatie este de %ld octeti.",contor);
}
101
// Copierea unui fisier text sursa intr-un fisier destinatie
// cu substituirea unor cuvinte date prin linia de comanda
#include <stdio.h>
void main(int argc,char *argv[])
{
FILE *in, *out;
char numfin[20],numfout[20],c;
unsigned i=0,contor=0;
printf("Nume fisier sursa:");gets(numfin);
printf("Nume fis.destinatie:");gets(numfout);
if ((in = fopen(numfin, "rt"))== NULL){
fprintf(stderr, "Eroare: %s fisier inexistent.\n",numfin);
return;
}
out = fopen(numfout, "wt");
while (!feof(in)){
if((c=fgetc(in))==argv[1][i]){
if(argv[1][++i]==0) // s-a detectat sfirsitul sirului de caractere
fputs(argv[2],out),i=0; // se scrie sirul de caractere inlocuitor
}
else fputc(c, out);contor++;
}
fclose(in);fclose(out);
printf("Lungimea fis.destinatie este de %d octeti.",contor);
}
// prelucrarea unul fisier C ce contine o agenda telefonica
#include <stdio.h>
#include <ctype.h>
#include <conio.h>
struct articol
{
} inreg;
102
FILE *fagenda,*ftemp;
char mod[3]="wb";
void creare(void){
char temp;
puts("\nCrearea agendei:");
do{
printf("\nNume:");gets(inreg.nume);
printf("Tel:");gets(inreg.tel);
fwrite(&inreg, sizeof(inreg), 1, fagenda); /* write struct inreg to file */
printf("Continuati[D/N]?");temp=getch();
}
while(toupper(temp)!='N'); // ciclu infinit ? NU!
fclose(fagenda); /* close file */
}
void listare(void){
int contor=0;
puts("\nListarea agendei:");
mod[0]='r';
if ((fagenda= fopen("agenda.jo", mod)) == NULL) /* open file agenda */
fprintf(stderr, "Cannot open output file.\n");
while(fread(&inreg, sizeof(inreg), 1, fagenda)!=0) /* write struct inreg to file */
fclose(fagenda); /* close file */
}
void main(void)
{
if ((fagenda= fopen("agenda.jo", mod)) == NULL) /* open file agenda */
fprintf(stderr, "Cannot open output file.\n");
creare();
listare();
}
103
104
Probleme ce necesită back-tracking
Am explicat pe larg această metodă de programare într-un capitol separat. În acest
capitol vom oferi doar cîteva exemple de probleme rezolvate. Majoritatea dintre ele sînt de
maximă dificultate şi nu li se cunoaşte o altfel de rezolvare decît prin această metodă. Din
fericire, această metodă de proiectare a soluţiei are un caracter foarte general şi
"funcţionează" în fiecare caz. Din nefericire, în practică, atunci cînd dimensiunea datelor de
intrare este consistentă (avînd valori cel puţin de ordinul sutelor) programul rezultat devine,
prin durata astronomică de execuţie, total inutilizabil.
Atragem atenţia că doar simpla lecturare a acestor exemple de probleme de back-
tracking rezolvate nu permite nicidecum însuşirea acestei metode de proiectare a soluţiilor.
Este necesară mai întîi implicarea şi participare personală, a celui ce-şi propune să înveţe
această metodă, încercînd direct soluţionarea lor şi abia apoi comparînd soluţia rezultată cu
cea propusă de noi.
Problema clasică de programare care necesită back-tracking (revenirea pe urma lăsată)
este problema ieşirii din labirint.
- iată o soluţie simplă care iniţializează labirintul în mod static, ca o matrice de caractere
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#define XMAX 6
#define YMAX 6
char a[XMAX+1][YMAX+1]={
"*******",
"* * *",
"* * * *",
"* * ****",
"** * *",
"* * ",
"********"
105
};
int x0=1,y0=2;
void print(void){
int i,j;
for(i=0;i<=XMAX;i++){
for(j=0;j<=YMAX;j++)putchar(a[i][j]);
putchar('\n');
}
getchar();clrscr();
}
void escape(int x,int y){
if(x==XMAX || y==YMAX){ puts("Succes!");exit(1);}
a[x][y]='*';print();
if(a[x][y+1]==' '){puts("la dreapta");escape(x,y+1);}
if(a[x+1][y]==' '){puts("in jos ");escape(x+1,y);}
if(a[x][y-1]==' '){puts("la stinga ");escape(x,y-1);}
if(a[x-1][y]==' '){puts("in sus ");escape(x-1,y);}
return;
}
void main(void){
escape(x0,y0);
puts("Traped!");
}
Să se genereze toate şirurile de lungime n formate numai din caracterele a, b şi c a.î. să
nu existe două subşiruri identice alăturate.
- de exemplu, dacă n=3 putem avea şiruri de forma abc, cab, bcb, etc. dar nu şi şiruri de
forma aab; pentru n=4 nu putem genera şiruri de forma abab, baac, etc.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define byte unsigned char
106
char car[4]=" abc";
unsigned int n,contor;
int Valid(char *s,char c,byte k){ // functia de validare a sirului generat
byte i,j,ok,Val=1; // prin concatenarea unui singur caracter
for(i=k-1;i>=(k+1)/2;i--)
if (s[i]==c){
ok=1;
for(j=1;j<=k-i-1;j++)
if (s[i-j]!=s[k-j]){ok=0;break;}
if (ok) { Val=0;break;}
}
return Val;
}
void ConcatSir(char *s,byte k){ // functia ce implementeaza back-tracking-ul
byte i; // in varianta recursiva
if(k<=n){
for(i=1;i<=3;i++)
if (Valid(s,car[i],k)) {
s[k]=car[i];s[k+1]='\0';
ConcatSir(s,k+1);
}
} else { contor++;printf("%4i:%s",contor,s);}
}
void main(void){
printf("n:");scanf("%i",&n);
contor=0;
ConcatSir(" ",1);
exit;
}
Să se afişeze toate descompunerile unei sume s într-un număr minim de monezi ale unui
sistem monetar de n valori.
107
- de exemplu, în cazul unui sistem monetar de forma 10, 5, 3, 1 putem descompune suma 18
în diverse moduri dar soluţia minimală necesită doar 3 monezi: 18=1 x 10+1 x 5+1 x 3 ;
descompunerea minimală poate să nu fie unică ; sistemul monetar trebuie să fie astfel ales
încît să permită descompunerea oricărei sume începînd de la o valoare minimală în sus (orice
sistem monetar conţine de obicei moneda unitară 1)
#include <stdio.h>
int m[10],a[10],a_final[10],s,n,nrmin=32000,kmin;
void descompune(int s,int k,int contor){
register int i;
if(s==0)
if(contor<nrmin){
nrmin=contor;kmin=k-1;
for(i=1;i<=k;i++)a_final[i]=a[i];
for(i=k+1;i<=n;i++)a_final[i]=0;
return;
}
else return;
if(k>n) return;
if(k==n){
a[k]=s/m[k];descompune(s-a[k]*m[k],k+1,contor+a[k]);
}
else for(i=s/m[k];i>=0;i--){
a[k]=i;descompune(s-i*m[k],k+1,contor+i);
}
}
void main(void){
int i;
printf("Introd.nr.de valori n a sistemului monetar:");scanf("%i",&n);
printf("Introd.in ordine descresc.cele %i valori monetare:",n);
for(i=1;i<=n;i++)scanf("%i",&m[i]);
printf("Introd.suma s:");scanf("%i",&s);
descompune(s,1,0);
if(nrmin>0) for(i=1;i<=kmin;i++)printf("%i * %i,",a_final[i],m[i]);
108
else puts("Nu se poate descompune !");
}
Să se afişeze toate descompunerile unui număr s ca sumă de n elemente.
- de exemplu, pentru s=13 şi n=3 avem următoarele 14 descompuneri 13= 1+1+11=
1+2+10= 1+3+9=…= 1+6+6= 2+2+9= 2+3+8= 2+4+7= 2+5+6= 3+3+7= 3+4+6=
3+5+5= 4+4+5
- deşi este cu totul altă problemă decît cea dinainte, putem observa asemănarea dintre cele
două soluţii (ambele sînt date în varianta recursivă)
#include <stdio.h>
int a[10],s,n,contor=0;
void descompune(int s,int k){
register int i;
if(k==1){ a[n]=s;printf("%3i:",++contor);
for(i=1;i<=n;i++)printf("%i ",a[i]);
puts("");return;
}
else for(i=1;i<s;i++){ a[n+1-k]=i;descompune(s-i,k-1);}
}
void main(void){
printf("Introd.suma s si in cit se descompune n:");scanf("%i %i",&s,&n);
descompune(s,n);
getchar();
}
109
Să se afişeze toate descompunerile unui număr s ca sumă de n elemente distincte.
- aceasta este o variantă a problemei dinainte; puteţi sesizaţi unde apare diferenţa în
rezolvare?
#include <stdio.h>
int a[10],s,n,contor=0;
void descompune(int s,int k){
register int i;
if(k==0){ printf("%3i:",++contor);
for(i=1;i<=n;i++)printf("%4i",a[i]);
puts("");return;
}
else for(i=a[n-k]+1;i<s;i++){ a[n+1-k]=i;descompune(s-i,k-1);}
}
void main(void){
printf("Introd.suma s si in cit se descompune n:");scanf("%i %i",&s,&n);
a[0]=0;
descompune(s,n);
if(contor==0)puts("Nu se poate descompune !");
getchar();
}
110
Probleme cu soluţie surprinzătoare
În rezolvarea fiecăreia din problemele următoare este foarte uşor de căzut în capcana
soluţionării de genul "la prima mînă" sau brute-force-approach în limba engleză (abordare în
forţă brută). Este cea mai des întîlnită capcană pentru programatorii lipsiţi de subtilitate,
experienţă sau cultură de specialitate. Este şi aceasta o rezolvare, desigur, dar lipsa ei de
eficienţă şi de eleganţă este evidentă. Tocmai de aceea, considerăm foarte utilă prezentarea
cîtorva exemple elocvente, împreună cu soluţiile lor. Unele dintre probleme au fost
selecţionate dintre problemele date la concursurile şi olimpiadele şcolare de programare .
Prin acest capitol nu urmărim doar însuşirea unor cunoştinţe practice de programare
ci, mai ales, aprofundarea capacităţii de analiză şi proiectare a soluţiilor. Aceasta presupune
un salt calitativ în învăţarea programării şi de aceea acest capitol devine cu adevărat util
numai pentru acei programatori inteligenţi şi dornici de auto-perfecţionare. Sau pentru cei
care se pregătesc pentru participarea la concursurile şi olimpiadele de informatică.
Soluţiile oferite de noi sînt, pentru fiecare problemă, eficiente şi "elegante". Acest fapt
se datorează accentului pus pe aprofundarea şi îmbunătăţirea primei analize a problemei.
Putem atunci spune, că motto-ul acestui capitol este: "Nu te mulţumi niciodată cu
soluţia la prima mînă !".
Să se afişeze numărul cuburilor perfecte mai mici decît n.
Analiza problemei - elaborarea algoritmului:
Capcana problemei constă în tentativa de a parcurge printr-un ciclu for toate numerele de la 1
la n şi de a contoriza cele care sînt cuburi perfecte.
La o a nouă privire, mai atentă, observăm că partea întreagă a radicalului de ordinul 3 din n ne
oferă acel număr care ridicat la a 3-a este cel mai apropiat cub de n. Deci, partea întreagp a
radicalului de ordinul 3 din n este egală chiar cu numărul cuburilor mai mici decît n.
(Este suficient să calculăm radical de ordinul 3 din n pentru a afla cîte cuburi mai mici decît n
există.)
111
program cuburi_perfecte;
var n,i,nr_cub:word;
BEGIN
nr_cub:=trunc(exp(1/3*ln(n)));
writeln('numarul cuburilor perfecte < ',n,' este = ', nr_cub);
END.
Se citesc m, n numărătorul şi numitorul unei fracţii. Să se simplifice această fracţie.
Analiza problemei - elaborarea algoritmului:
Capcana constă în a efectua simplificarea pas cu pas, căutînd pe rînd fiecare divizor comun al
numărătorului şi numitorului. În plus, ar trebui să avem grijă că, pentru unii divizori comuni,
este nevoie de o simplificare repetată. Deci, două cicluri imbricate !
-pentru a obţine o fracţie ireductibilă este suficient să o simplificăm o singură dată cu cmmdc
al numitorului şi al numărătorului,eliminîndu-se astfel simplificările succesive
-vom folosi subalgoritmul (Euclid) care calculează cmmdc al numărătorului şi al
numitorului.
program simplificare;
var m,n:word;
function cmmdc(m,n:word):word;
begin
while m<>n do
if m>n then m:=m-n
else n:=n-m;
cmmdc:=m;
end;
BEGIN
if n=0 then writeln('Fractie inexistenta.')
else
112
if m=0 then writeln(m,'/',n,'=',0)
else
writeln(m,'/',n,' = ',m div cmmdc(m,n),'/',n div cmmdc(m,n));
END.
Se citesc a, b, c întregi. Să se determine toate perechile întregi (x,y) soluţii ale ecuaţiei
ax+by=c.
Analiza problemei – elaborarea algoritmului;
Problema a fost dată la olimpiada şcolară de informatică. Ea pare la prima vedere imposibilă.
Există ecuaţii, de exemplu: 3x+2y=1 care are o infinitate de soluţii …, (1,-1), (3,-4), (5,-7),
(7,-10),… Cum ar putea fi afişată atunci pe ecran o mulţime infinită de perechi ? Soluţia este
de a afişa această mulţime printr-o descriere sintetică a ei (afişînd formula care poate genera
toate perechile ce o compun).
1. daca c=1 atunci exista (x
0
,y
0
) a.î. ax
0
+by
0
=1 doar daca [a,b]=1 ; restul solutiilor (x,y) au
forma x=x
0
+kb , y=y
0
-ka, cu k intreg.
2. daca c>1 atunci exista solutiile (x
0
,y
0
) doar daca [a,b]|c; restul solutiilor se construiesc la
fel;
prin [a,b] se inţelege cmmdc(a,b)
Programul trebuie doar să determine x
0
şi y
0
.
Program ax_plus_by_egal_c;
Var a,b,c,x0,y0,y:integer;
BEGIN
x0:=0;
For y:=0 to a do
If abs(c-b*y) mod a=0 then begin
y0:=y;x0:=(c-b*y) div a;break;
end;
If x0<>0 then Writeln('Sol. (x,y) ale ec. ',a,'x+',b,'y=',c,' sint (',x0,'+k*',b,',',y0,'-k*',a,')')
else Writeln('Nu exista solutii pentru ecuatia ',a,'x+',b,'y=',c);
END.
113
/*Varianta C de solutionare:
1. daca c=1 atunci exista (x0,y0) a.i. ax0+by0=1 doar daca cmmdc[a,b]=1 ;
restul solutiilor (x,y) au forma x=x0+kb y=y0-ka, cu k intreg.
2. daca c>1 atunci exista solutiile (x0,y0) doar daca cmmdc[a,b] | c;
restul solutiilor se construiesc la fel.
3. exista posibilitatea ca, pornind de la perechi (x0,y0) distincte, sa se
obtina solutii noi diferite (multimi infinite de perechi distincte).
4. toate solutiile (multimi infinite de perechi) pleaca de la o pereche
(x0,y0) aflata in dreptunghiul (-b,-a)x(b,a).
Un bun exemplu este ecuatia 18x+42y=6.*/
#include <stdio.h>
#include <math.h>
int a,b,c,x0=0,y0=0,y,k;
void main(void){
printf("a,b,c:");scanf("%i %i %i",&a,&b,&c);
printf("Ecuatia %ix+%iy=%i are sol.de forma:",a,b,c);
for(y=0;y<=a;y++)
if(abs(c-b*y) % a==0){
y0=y;x0=(c-b*y) / a;
if(x0!=0){
printf("\n %i*k%+i, -(%i*k-%i), de ex. ",b,x0,a,y0);
for(k=-2;k<=2;k++)printf("(%i,%i) ",x0+k*b,y0-k*a);
}
}
if(!x0 && !y0 && c)printf("Nu exista solutii pentru ecuatia %ix+%iy=%i",a,b,c);
}
Se citeşte n o valoare întreagă pozitivă. Să se determine toate descompunerile în
diferenţă de pătrate ale lui n.
Analiza problemei – elaborarea algoritmului:
114
Arătăm în continuare cum se poate evita soluţia "banală"-capcană ce-ar consta în două cicluri
for imbricate. Soluţia următoare efectuează doar radical din n paşi, faţă de n
2
paşi ai soluţiei
"la prima mînă".
- pentru a determina toate descompunerile in diferenta de patrate ale lui n pornim de la
formula a
2
-b
2
=(a+b)(a-b)=n
- observam ca produsul termenilor a+b si a-b este produsul a doi dintre divizorii lui n,unul
din termeni este divizor (d) a lui n celalalt este tot divizor a lui n si il aflam impartindu-l pe n
la d (n div x)
- notam cu x primul divizor a lui n (x=d) si cu y=n div x si obtinem relatiile
a+b=x deci un sistem de doua ecuatii cu doua necunoscute ,pe care il rezolvam
a-b=y prin metoda reducerii ,si avem 2a=x+y => a=(x+y )/2 , b=(y-x)/2,
- pentru ca (x+y)/2 sa fie o solutie a ecuatiei a
2
-b
2
=(a+b)(a-b)=n trebuie ca x+y sa fie un
numar par si y-x sa fie un numar par
- daca aceasta conditie este indeplinita afisam solutia care indeplineste conditia ceruta.
Program descompunere_patrate;
var n,d,a,b,x,y:integer;
BEGIN
for d:=1 to trunc(sqrt(n)) do
if n mod d =0 then
begin
x:=d;
y:=n div x;
if (x+y) mod 2 =0 then
begin
a:=(x+y) div 2;
b:=(y-x) div 2;
writeln(n,'=',a*a,'-',b*b);
end;
end;
END.
115
Se citeşte n şi x
1
, x
2
, …, x
n
rădăcinile întregi ale unui polinom de gradul n. Se cere să se
determine pe baza relaţiilor lui Viete coeficienţii a
n
, a
n-1
, …, a
1
, a
0
.
Analiza problemei – elaborarea algoritmului;
Cea mai des întîlnită rezolvare este cea de tip back-tracking, aparent mai uşoară, dar în
fapt extrem de ineficientă pentru n nu mare ci doar măricel ! Următoarea soluţie de tip iterativ
este o mică "bijuterie" de program iterativ şi de aceea vă lăsăm plăcerea de a-l înţelege
singuri.
#include <stdio.h>
void main(void){
int a[100],x[100],n,i,k;
printf("n=");scanf("%d",&n);
for(i=0;i<n;i++){
printf("x[%d]=",i);scanf("%d",&x[i]);a[i]=0;
}
a[0]=1;a[n]=0;
for(k=1;k<=n;k++){
for(i=k;i>0;i--)
a[i]=a[i-1]-a[i]*x[k-1];
a[0]*=-x[k-1];
}
for(i=n;i>=0;i--) printf("a[%d]=%d ",i,a[i]);
}
Se citeşte n. Să se afişeze toate numerele de n cifre, formate numai cu cifrele 1 şi 2,
divizibile cu 2
n
.
Analiza problemei – elaborarea algoritmului:
Problema a fost dată la olimpiada şcolară de informatică. Abordarea "în forţă" a acestei
probleme nu duce la nici un rezultat:
116
- daca s-ar alege varianta de rezolvare "la prima mina" ar trebui verificate toate cele 2
n
n
numere de n cifre ce se pot forma numai cu cifrele 1 si 2
(cite 2 posibilitati pentru fiecare pozitie). In acest caz, programul avind o complexitate
exponentiala, ar dura un timp exponential, pt. n=50 ar dura cît vîrsta sistemului nostru
solar !
pt.n=1 avem unica solutie numarul 2;
pt. n=2 avem deasemenea unica solutie 12; observam ca 2-ul este "folosit"
pt. n=3 avem deasemenea unica solutie 112; observam ca 12 este din nou "folosit"
In general, se deduce ca numerele de n cifre, ce trebuie sa se divida cu 2
n
, se divid cu 2
n-1
; ele
se pot scrie sub forma c*10
(n-1)
+M=c*2
n-1
*5
n-1
+M= Multiplu(2
n-1
)+M; inseamna ca M (cele n-1
cifre ramase) trebuie sa se divida cu 2
n-1
; inseamna ca M este unul din numerele gasite ca
solutie la pasul n-1.
Daca exista o singura solutie M pt.cazul n-1 (M se divide cu 2
n-1
) acest nr.se poate scrie
M=2
(n-1)
*par sau 2
(n-1)
*impar, rezulta ca M mod 2
n
=0 sau M mod 2
n
=2
(n-1)
. Deci,in cazul a n
cifre din cele doua posibilitati (1M sau 2M) se va alege astfel unica solutie:
daca M mod 2
n
=0 atunci solutia este 2M=2*10
(n-1)
+M=Multiplu(2
n
)
daca M mod 2
n
=2
(n-1)
atunci solutia este 1M=10
(n-1)
+M=2(
n-1)
*5
(n1)
+M=Multiplu(2
n
)!
Solutia propusa este una iterativa şi face maximum n paşi !
Program 1_2_si_2_la_n;
Var
nr,zece_la_n:longint;
n,i:byte;
BEGIN
Writeln('Se citeste n. Sa se afiseze toate numerele de n cifre,');
Writeln('formate numai cu cifrele 1 si 2, si divizibile cu 2^n.');
nr:=2;zece_la_n:=1;
For i:=2 to n do begin
zece_la_n:=10*zece_la_n;
If nr mod (1 shl i)=0 then nr:=2*zece_la_n+nr
else nr:=zece_la_n+nr;
end;
Writeln('Solutia este:',nr);
117
END.
Se citeşte n. Să se determine o alegere a semnelor + şi - astfel încît să avem relaţia
± 1± 2± ...± n=0.
Analiza problemei – elaborarea algoritmului:
Problema a fost dată la olimpiada şcolară de informatică. Daca se incearca o abordare "in
forta" si "la prima mina" vor trebui verificate 2
n
posibilitati de asezare a semnelor + si -.
Adica se obtine un algoritm exponential, total ineficient. Soluţia "elegantă" ce rezultă printr-o
analiză mai aprofundată:
-mai intai se va imparti suma in doua parti: cea cu plus si cea cu minus.
Privindu-se atent se observa ca se pot deosebi trei cazuri:
1. cind avem intre cele n numere un numar impar de numere impare (de ex.n=3,5,6...) caz in
care numerele impare nu pot fi repartizate in cele doua parti (plus si minus) decit astfel: un
nr.par de numere impare intr-o parte si un nr.impar de nr impare in cealalta; implica ca cele
doua parti au paritati diferite, deci suma lor nu poate fi 0 !
Acest caz apare cind n=4k+1, 4k+2.
2. cind n=4k atunci numerele de la 1 la n pot fi grupate cite patru astfel:
1-2-3+4, ..., (4i+1)-(4i+2)-(4i+3)+(4i+4), ... si vor avea suma 0 pe fiecare grupa de patru !
3. altfel, n=4k+3, putem grupa numerele asemanator ca la cazul dinainte cu exceptia primei
grupe: -1-2+3, 4-5-6+7, ..., (4i)-(4i+1)-(4i+2)+(4i+3),...reazultind din nou suma 0 pe fiecare
grupa !
Program Plus_Minus;
Var
n,i,c:byte;
BEGIN
Writeln('Se citeste n. Sa se determine o alegere a semnelor + si - ');
Writeln('astfel incit sa avem relatia ± 1± 2± ...± n=0.');
c:=n mod 4;
case c of
118
1,2: Writeln('Nu exista solutie.');
0: For i:=1 to n div 4 do
write('+',4*(i-1)+1,'-',4*(i-1)+2,'-',4*(i-1)+3,'+',4*(i-1)+4);
3:begin
Write('-1-2+3');
For i:=1 to n div 4 do
write('+',4*i,'-',4*i+1,'-',4*i+2,'+',4*i+3);
end;
end;
END.
119
Elemente de programare a PC - urilor
Oferim în continuare cîteva exemple de programe, unele în Pascal, altele în C, pentru
a permite celor pasionaţi să-şi însuşească cunoştinţele minimale de programare a PC-urilor:
lucrul cu tastatura, accesul direct la memorie, lucrul în modul grafic, etc. Pentru cei ce doresc
să aprofundeze acest subiect sau doresc cît mai multe detalii le recomandăm, pe lîngă citirea
atentă a help-ului Turbo Pascal-ului sau a Turbo C-ului, folosirea utilitarului TechHelp
specializat în descrierea programării PC-urilor.
Ideea care ar defini cel mai bine acest tip de cunoştinţe de programare este conţinută
în cunoscuta expresie : "Secrete mici, efecte mari !".
// Un simplu program muzical
#include <stdio.h>
#include <dos.h>
#include <conio.h>
main(){ /* Do do# Re re# Mi Fa fa# sOl sol# La la# Si */
int octava[]={65 , 69 , 73 , 78 , 82 , 87 , 92 , 98 , 104 , 110 , 116 , 123};
int i,j,nr_octava,i_nota,timp=500;
float masura,durata,durata_masura;
char *linia="42\$2R2R4M4F2O2L1R2R2S2S4L4O2O2"; //\$4D2D4\$3S4L2";
do{
masura=(float)(linia[0]-'0')/(linia[1]-'0');durata_masura=0;
for(i=2;linia[i]!='\0';i++){
if (i%2==0){
switch(linia[i]){
case '\$' : {nr_octava=1;for(j=linia[++i]-'0';j>0;j--)nr_octava*=2;}
break;
case 'D' : i_nota=0;break;
case 'd' : i_nota=1;break;
case 'R' : i_nota=2;break;
case 'r' : i_nota=3;break;
120
case 'M' : i_nota=4;break;
case 'F' : i_nota=5;break;
case 'f' : i_nota=6;break;
case 'O' : i_nota=7;break;
case 'o' : i_nota=8;break;
case 'L' : i_nota=9;break;
case 'l' : i_nota=10;break;
case 'S' : i_nota=11;break;
}
} else {
if (linia[i]=='6') durata=1/16; else durata=1/(float)(linia[i]-'0');
durata_masura+=durata;
if (durata_masura>masura) { nosound();durata_masura=0;}
sound(nr_octava*octava[i_nota]);
delay(durata*timp);
} /* else */
} /* for */
} /* do */
while (!kbhit());
nosound();
}
Program Citite_Taste;
uses crt;
var c:char;
shift:byte absolute \$40:\$17; { adresa octetului de stare a tastaturii }
begin
repeat
if (shift and \$3>0) then
write(' shift ',c,':',Ord(c))
else write(' ',c,':',Ord(c));
until c=#27;
end.
121
// Program C pt. afisarea Tabelului codurilor ASCII;
#include <stdio.h>
void main(){
unsigned short c;
for(c=0;c<=255;c++)
switch(c){
case 7 : printf("b%3uł",c);break; // beep
case 8 : printf("B%3uł",c);break; // back space
case 9 : printf("T%3uł",c);break; // tab
case 10 : printf("L%3uł",c);break; // line feed
case 13 : printf("R%3uł",c);break; // return
case 27 : printf("E%3uł",c);break; // escape
default : printf("%c%3uł",c,c); // caractere afisabile
};
}
Program Tenis;
{ Joc demonstrativ al posibilitatilor de folosire a accesului direct
la memoria ecran. Paletele sint actionate de tastele 'A' si 'W', respectiv
'sageata sus' si 'sageata jos'. }
Uses Crt;
Const viteza=1500;
Type Ecran=Record
car:char;
atrib:byte;
End;
Var
scr:array[1..25,1..80] of Ecran absolute \$b800:\$0; { Adresa de memoriei ecran in mod text }
x,y,x0,y0:byte;
i,d,s:integer;
u:real;
ok:boolean;
tasta:char;
122
yP1:array[1..5]of byte;
yP2:array[1..5]of byte;
uP:array[1..5]of real;
Procedure Paleta1(tip:char);
Begin {generare paleta 1}
for i:=1 to 5 do
scr[yP1[i],76].car:=tip;
end;
Procedure Paleta2(tip:char);
Begin {generare paleta 2}
for i:=1 to 5 do
scr[yP2[i],5].car:=tip;
End;
Procedure Mutapaleta1;
Begin
Paleta1(' ');
if (tasta=#80) and (yP1[i]<24) then {miscarea paletei 1}
for i:=1 to 5 do Inc(yP1[i]);
if (tasta=#72) and (yP1[i]>6) then
for i:=1 to 5 do Dec(yP1[i]);
End;
Procedure Mutapaleta2;
Begin
Paleta2(' '); {miscarea paletei 2}
if (tasta=#122) and (yP2[i]<24) then
for i:=1 to 5 do Inc(yP2[i]);
if (tasta=#119) and (yP2[i]>6) then
for i:=1 to 5 do Dec(yP2[i]);
End;
procedure cantec; {genereaza cantecul final}
begin sound(400);delay(800);
sound(500);delay(800);
sound(600);delay(800);
123
sound(650);delay(800);
sound(600);delay(800);
sound(700);delay(800);
sound(650);delay(1000);
end;
Clrscr;
d:=0;s:=0;
{ writeln('________ ________ _______ ______ ________ ');
write(char(179),' ',char(179),' ',char(179),' ');
writeln(char(179),' ',char(179));
clrscr;
For x:=1 to 80 do begin
scr[1,x].car :=#219;
scr[25,x].car:=#219;
end;
For y:=2 to 9 do begin {poarta}
scr[y,1].car :=#219;
scr[y,80].car:=#219;
end;
For y:=17 to 24 do begin
scr[y,1].car :=#219;
scr[y,80].car:=#219;
end;
x0:=40;
y0:=13;
u:=20*PI/180; {initializare miscare minge}
x:=x0;
y:=y0;
for i:=1 to 5 do begin
yP1[i]:=10+i;
yP2[i]:=10+i;
uP[i]:=(i/3*PI-PI)/15; {unghiul de dispersie a paletei}
124
end;
tasta:=' ';
repeat {miscare minge}
if ((u>=0) and (u<PI/2) or (u > 3*PI/2) and (u<2*PI)) then inc(x)
else dec(x);
y:=y0+Trunc(Abs(x-x0) * Sin(u)/Cos(u));
if scr[y,x].car<>' ' then begin
if (y=1)or(y=25) then begin {ciocniri}
u:=2*PI-u;x0:=x;
if y=1 then y0:=2 else y0:=24;
end; {-de pereti}
if (x=1)or(x=80) then begin
u:=PI+u;if u>2*Pi then u:=u-2*PI;
y0:=y;
if x=1 then x0:=2 else x0:=79;
end;
if x=76 then begin {-de palete}
for i:=1 to 5 do
if y=yP1[i] then begin
sound(1000);
u:=PI+u+uP[i];
if u>2*Pi then u:=u-2*PI;
x0:=x;y0:=y;
end;
nosound;
end;
if x=5 then begin {-de palete}
for i:=1 to 5 do
if y=yP2[i] then begin
sound(600);
u:=PI+u+uP[i];
if u>2*Pi then u:=u-2*PI;
x0:=x;y0:=y;
end;
125
nosound;
end;
end
else if not (((x=1)or(x=80)) and((y<17)and(y>8))) then
begin {gol}
scr[y,x].car:='0';
i:=1;
ok:=false;
repeat
ok:=keypressed;
inc(i);
until (i=viteza)or ok;
if ok then begin
if tasta = #0 then tasta:=readkey;
mutapaleta1;
mutapaleta2;
end;
Paleta1(#219);
Paleta2(#219);
scr[y,x].car:=' ';
scr[y,x].car:=' ';
end
else begin
sound(800);
if (x>=80)and(y>9)and(y<17) then d:=d+1;
if (x<=1)and(y>9)and(y<17) then s:=s+1;
textcolor(2);
textbackground(7);
gotoxy(39,2);
write('SCOR');
gotoxy(38,3);
write(' ',d,' : ',s);
if (d=5)or(s=5) then begin
126
gotoxy(35,10);
write(' G A M E O V E R ');
cantec; nosound;
halt;
end;
delay(1500);
paleta1(' ');
paleta2(' ');
x0:=40;
y0:=13;
u:=20*PI/180; {reinitializare miscare minge}
x:=x0;
y:=y0;
for i:=1 to 5 do begin
yP1[i]:=10+i;
yP2[i]:=10+i;
uP[i]:=(i/3*PI-PI)/5;
end;
tasta:=' ';
nosound;
end;
until tasta=#27;
End.
Program Biliard; { demonstrativ pentru folosirea modului grafic }
uses Graph,Crt;
Const nr_obiecte=10;
raza=25;
pasx=3;pasy=2;
viteza=10; { de la 0 la 10 }
var
grDriver,grMode,ErrCode: Integer;
i,xMax,yMax,xtmp,ytmp:word;
x,y:Array[1..nr_obiecte] of word;
127
sensx,sensy:Array[1..nr_obiecte] of shortint;
Procedure Deseneaza(x,y,color:word);
Const bucati=12;
Var x1,y1,unghi,Xasp,Yasp:word;
Begin
SetWriteMode(XORPut);SetColor(color);
GetAspectRatio(Xasp, Yasp);
unghi:=0;
x1:=x+Trunc(raza*cos(unghi*2*PI/bucati));
y1:=y+Trunc(raza*sin(unghi*2*PI/bucati)*Xasp/Yasp);
For unghi:=1 to bucati do begin
xtmp:=x+Trunc(raza*cos(unghi*2*PI/bucati));
ytmp:=y+Trunc(raza*sin(unghi*2*PI/bucati)*Xasp/Yasp);
Line(x1,y1,xtmp,ytmp);Line(x,y,x1,y1);
x1:=xtmp;y1:=ytmp;
end;
End;
begin
grDriver := Detect;
InitGraph(grDriver, grMode,'');
ErrCode := GraphResult;
if ErrCode = grOk then
begin { Do graphics }
xMax:=GetMaxX;yMax:=GetMaxY;
Rectangle(0,0,xMax,yMax);
Randomize;
For i:=1 to nr_obiecte do begin
x[i]:=raza+Random(xMax-2*raza);y[i]:=raza+Random(yMax-2*raza);
sensx[i]:=-1+(i mod 2)*2;sensy[i]:=-sensx[i];
Deseneaza(x[i],y[i],i);
end;
Repeat
128
For i:=1 to nr_obiecte do begin
Deseneaza(x[i],y[i],i);
xtmp:=x[i]+pasx*sensx[i];ytmp:=y[i]+pasy*sensy[i];
If (xtmp>raza) and (xtmp<xMax-raza) then x[i]:=xtmp
else sensx[i]:=-sensx[i];
If (ytmp>raza) and (ytmp<yMax-raza) then y[i]:=ytmp
else sensy[i]:=-sensy[i];
Deseneaza(x[i],y[i],i);
Delay(100-10*viteza);
end;
Until KeyPressed;
CloseGraph;
end
else
Writeln('Graphics error:', GraphErrorMsg(ErrCode));
end.
// Program C de umplere a ecranului text prin acces direct la memoria ecran
#include <dos.h>
#include <conio.h>
struct scrcar{
unsigned char car,atrib;
} far *ecran;
int lin,col;
int culoare=BLUE,fundal=LIGHTGRAY;
void main(void){
ecran=(struct scrcar far *)MK_FP(0xb800,0);
for(lin=0;lin<25;lin++)
for(col=0;col<80;col++) {
ecran[lin*80+col].car='*';
ecran[lin*80+col].atrib=fundal*16+culoare;
}
getch();
}
129
Program Acces_direct_ecran_grafic320_200;
{ Fiecare jumatate de ecran se genereaza din cealalta jumatate
pe baza proprietatilor automatelor celulare – asemanator ca in jocul Life }
Uses crt;
Const maxl=200-1;
maxc=320-1;
mijl=maxc div 2;
Type Matrice=array[0..maxl,0..maxc] of byte;
var
scr:Matrice absolute \$A000:0; { adresa memoriei ecran in modul grafic 320x200 }
i,j,k,l,c,x:integer;
ok:char;
BEGIN
asm {initializeaza in mod grafic 320x200x250 NU in 640x400x256}
mov ah,0
mov al,13h
int 10h;
end;
randomize;x:=random(maxc);
for k:=1 to 2 do
for i:=0 to maxl do
for j:=0 to mijl do
scr[i,j+k*mijl]:=random(maxc) ;
k:=0;
repeat
repeat
for i:=0 to maxl do
for j:=0 to mijl do begin
l:=i;c:=j+k*mijl;
if (scr[(l-1)mod maxl,c]<scr[l,c])and
(scr[l,(c-1)mod mijl]<scr[l,c]) then
scr[i,j+((k+1)mod 2)*mijl]:=(scr[(l-1)mod maxl,c]+scr[l,(c-1)mod mijl]+ x)div 3-1
else if (scr[l,(c+1)mod mijl]>scr[l,c])and
(scr[(l+1)mod maxl,c]>scr[l,c]) then
130
scr[i,j+((k+1)mod 2)*mijl]:=(scr[(l+1)mod maxl,c]+scr[l,(c+1)mod mijl]+ x) div 3+1
else scr[i,j+((k+1)mod 2)*mijl]:=scr[l,c]+1;
end;
k:=(k+1) mod 2;
until keypressed;
until ok=#27;
asm {inchide modul grafic}
mov ax,0
int 10h
end;
END.
Program Mouse; { Gestionarea mouse-ului prin apelul intreruperii de sistem \$33 }
uses Crt,Graph,Dos;
var
grDriver,grMode,ErrCode : Integer;
mfunc,buton,mx,my,xf,yf,x,y:word;
xi,yi:integer;
s1,s2,s3:string[5];
P : pointer;
Size : Word;
{ Intr \$33, nr.fctiei dorite in AX:
00 mouse reset
01 cuplare cursor mouse (vizibil)
02 decuplare cursor mouse(ascuns)
03 determ.unei apasari pe tasta si semnalare pozitie
04 pozitionarea cursorului de mouse
05 inform.suplim.despre apasarea tastelor
06 inreg.tastelor de mouse eliberate
07 stabilire domeniu orizontal(minim si maxim)
131
08 - || - - || -vertical - || - - || -
09 selectare cursor grafic
10 selectare cursor text
13/14 emulare creion optic conectat/deconectat
15 stabilire sensibilitate mouse
29 fixarea paginii ecran in care mouse-ul e vizibil
30 afisarea - || - - || - - || - - || -
procedure MouseReg;
var reg:registers;
begin
reg.ax:=mfunc;reg.bx:=buton;reg.cx:=mx;reg.dx:=my;
intr(\$33,reg);
mfunc:=reg.ax;buton:=reg.bx;mx:=reg.cx;my:=reg.dx;
end;
}
procedure MouseAsm;ASSEMBLER;
ASM
MOV AX,mfunc
MOV BX,buton
MOV CX,mx
MOV DX,my
INT \$33
MOV mfunc,AX
MOV buton,BX
MOV mx,CX
MOV my,DX
end;
Begin
grDriver := Detect;
InitGraph(grDriver,grMode,'');
ErrCode := GraphResult;
if ErrCode = grOk then
132
begin
if mem[memW[0:\$cc+2]:memW[0:\$cc]]=\$cf then
begin
outtext('Mouse-ul nu este instalat!');
end;
mfunc:=0;mouseasm; {initializare}
mfunc:=1;mouseasm; {vizibil}
mfunc:=3;
mouseasm;xi:=mx;yi:=my;
setactivepage(1);
rectangle(xi,yi,mx,my);
Size := ImageSize(xi,yi,mx,my);
GetMem(P, Size); { Get memory from heap }
GetImage(xi,yi,mx,my,P^);
putimage(xi,yi,P^,XORput);
setactivepage(0);
PutImage(100, 100, P^, ORPut);
repeat
mouseasm;
xi:=mx;yi:=my;
while buton=1 do
begin
PutImage(100, 100, P^,XORPut);
mouseasm;
setactivepage(1);
rectangle(xi,yi,mx,my);
Size := ImageSize(xi,yi,mx,my);
GetMem(P, Size); { Get memory from heap }
GetImage(xi,yi,mx,my,P^);
putimage(xi,yi,P^,XORput);
setactivepage(0);
PutImage(100, 100, P^, ORPut);
end;
133
until keypressed;
mfunc:=2;mouseasm; { decuplare mouse }
CloseGraph;
end
else
WriteLn('Graphics error:',GraphErrorMsg(ErrCode));
end.
// Program C de generare a efectului grafic-plasma-prin utilizarea unor functii ale
modului grafic
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <dos.h>
int MX,MY;
int p1,p2,p3,p4,r1,r2,r3,r4;
void plasma(int x1,int x2,int y1,int y2){
if(x2-x1<2) return;
p1=getpixel(x1,y1);
p2=getpixel(x2,y1);
p3=getpixel(x2,y2);
p4=getpixel(x1,y2);
r1=random(4);
r2=random(4);
r3=random(4);
r4=random(4);
if (getpixel(x1+(x2-x1)/2,y1)==0) putpixel(x1+(x2-x1)/2,y1,(p1+p2)/2+r1);
if (getpixel(x2,y1+(y2-y1)/2)==0) putpixel(x2,y1+(y2-y1)/2,(p2+p3)/2+r2);
if (getpixel(x1+(x2-x1)/2,y2)==0) putpixel(x1+(x2-x1)/2,y2,(p3+p4)/2+r3);
if (getpixel(x1,y1+(y2-y1)/2)==0) putpixel(x1,y1+(y2-y1)/2,(p4+p1)/2+r4);
putpixel(x1+(x2-x1)/2,y1+(y2-y1)/2,(p1+p2+p3+p4)/4+random(2));
plasma(x1,x1+(x2-x1)/2,y1,y1+(y2-y1)/2);
134
plasma(x1+(x2-x1)/2,x2,y1,y1+(y2-y1)/2);
plasma(x1,x1+(x2-x1)/2,y1+(y2-y1)/2,y2);
plasma(x1+(x2-x1)/2,x2,y1+(y2-y1)/2,y2);
}
int gdriver = VGA, gmode = VGAHI, errorcode,i;
double red=20,green=30,blue=40;
struct palettetype pal;
void main(void){
/* select a driver and mode that supports the use */
/* of the setrgbpalette function. */
/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, "");
/* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk) /* an error occurred */
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1); /* terminate with an error code */
}
/* grab a copy of the palette */
getpalette(&pal);
for (i=0; i<pal.size; i++)
setrgbpalette(pal.colors[i], red+i, green+i, blue+i);
randomize();
MX=getmaxx();MY=getmaxy();
putpixel(0,0,MAXCOLORS/2);
putpixel(0,MY,MAXCOLORS/2);
putpixel(MX,0,MAXCOLORS/2);
putpixel(MX,MY,MAXCOLORS/2);
plasma(0,MX,0,MY);
// rotate palette
135
while(!kbhit()){
for(i=0;i<pal.size;i++)
setrgbpalette(pal.colors[i],(int) red+i, (int) green+i, (int) blue+i);
red+=0.5; green+=1; blue+=1.5;
}
closegraph();
}
Program Sarpe;
{ Program de joc demonstrativ: "Sarpele" culegator de numere. El este dirijat
cu ajutorul sagetilor, viteza sa de miscare poate fi modificata corespunzator
in orice moment folosind tastele de la 1 la 9. }
Uses Crt;
Const
sc=#219;
lungmax=95;
maxnext=10;
xlimit=[1,80];
ylimit=[1,25];
Var
sx,sy:array[1..95] of byte;
c:char;
i,primul,ultimul,next,tdelay,idelay:integer;
xnext,ynext:byte;
Begin
clrscr;
randomize;
for i:=1 to 79 do begin gotoxy(i,1);write(sc);gotoxy(i,25);write(sc);end;
for i:=1 to 24 do begin gotoxy(1,i);write(sc);gotoxy(80,i);write(sc);end;
primul:=2;ultimul:=1;
for i:=primul downto ultimul do begin sx[i]:=40;sy[i]:=13;end;
next:=0;idelay:=100;
for i:=primul downto ultimul do begin
gotoxy(sx[i],sy[i]);write(sc);
136
end;
while next<maxnext do
begin
xnext:=2+random(78);ynext:=2+random(23);
inc(next);gotoxy(xnext,ynext);write(next);
repeat
if keypressed then begin
end
else tdelay:=tdelay*97 div 100;
case c of
'1'..'9':
idelay:=100+100 div (ord(c)-ord('1')+1);
#75: { stinga }
begin
gotoxy(sx[ultimul],sy[ultimul]);write(' ');
if primul=lungmax then begin
sx[1]:=sx[primul]-1;sy[1]:=sy[primul];
primul:=1
end
else begin
inc(primul);
sx[primul]:=sx[primul-1]-1;sy[primul]:=sy[primul-1];
end;
if ultimul=lungmax then ultimul:=1
else inc(ultimul);
end;
#77: { dreapta }
begin
gotoxy(sx[ultimul],sy[ultimul]);write(' ');
if primul=lungmax then begin
sx[1]:=sx[primul]+1;sy[1]:=sy[primul];
137
primul:=1
end
else begin
inc(primul);
sx[primul]:=sx[primul-1]+1;sy[primul]:=sy[primul-1];
end;
if ultimul=lungmax then ultimul:=1
else inc(ultimul);
end;
#72: { sus }
begin
gotoxy(sx[ultimul],sy[ultimul]);write(' ');
if primul=lungmax then begin
sx[1]:=sx[primul];sy[1]:=sy[primul]-1;
primul:=1
end
else begin
inc(primul);
sx[primul]:=sx[primul-1];sy[primul]:=sy[primul-1]-1;
end;
if ultimul=lungmax then ultimul:=1
else inc(ultimul);
end;
#80: { jos }
begin
gotoxy(sx[ultimul],sy[ultimul]);write(' ');
if primul=lungmax then begin
sx[1]:=sx[primul];sy[1]:=sy[primul]+1;
primul:=1
end
else begin
inc(primul);
sx[primul]:=sx[primul-1];sy[primul]:=sy[primul-1]+1;
end;
138
if ultimul=lungmax then ultimul:=1
else inc(ultimul);
end;
end;
if primul > ultimul then
for i:=primul downto ultimul do begin
gotoxy(sx[i],sy[i]);write(sc);
if (sx[primul]=sx[i]) and (sy[primul]=sy[i]) and (i<>primul) then
c:=#27;
end
else
begin
for i:=ultimul to lungmax do begin
gotoxy(sx[i],sy[i]);write(sc);
if (sx[primul]=sx[i]) and (sy[primul]=sy[i]) and (i<>primul) then
c:=#27;
end;
for i:=1 to primul do begin
gotoxy(sx[i],sy[i]);write(sc);
if (sx[primul]=sx[i]) and (sy[primul]=sy[i]) and (i<>primul) then
c:=#27;
end;
end;
if (sx[primul] in xlimit)or(sy[primul] in ylimit) then c:=#27;
delay(tdelay);
until (c=#27) or ((sx[primul]=xnext)and(sy[primul]=ynext));
sound(next*30);
if c=#27 then next:=maxnext
else
if ultimul-next <= 0 then begin
for i:=lungmax+ultimul-next to lungmax do begin
sx[i]:=sx[ultimul];sy[i]:=sy[ultimul];
end;
for i:=1 to ultimul do begin
139
sx[i]:=sx[ultimul];sy[i]:=sy[ultimul];
end;
ultimul:=lungmax+ultimul-next;
end
else begin
for i:=ultimul-next to ultimul do begin
sx[i]:=sx[ultimul];sy[i]:=sy[ultimul];
end;
ultimul:=ultimul-next;
end;
delay(tdelay);
nosound;
end; { next < maxnext}
End.
Program Scan_Taste;
{ Program ce demonstreaza posibilitatea de acces la codurile de scanare
ale tastaturii. Este indicat sa fie lansat in mod DOS si nu de sub Windows. }
Uses Crt,Dos;
Var
tasta:byte;
KbdIntVec:procedure;
{\$F+}
Procedure KeyClick; interrupt;
begin
Port[\$20]:=\$20; { resetarea portului de acces al tastaturii }
end;
Begin
GetIntVec(\$9,@KbdIntVec); { modificarea intreruperii de tastatura }
SetIntVec(\$9,Addr(KeyClick)); { cu o procedura proprie "inofensiva" }
tasta:=0;
repeat
repeat until tasta<>Port[\$60];
tasta:=Port[\$60];
140
gotoxy(20,2);write(tasta:3);
until tasta=129;
SetIntVec(\$9,@KbdIntVec);
End.
Program Taste_muzicale_V2;
{ Program demonstrativ de folosire muzicala a tastaturii pe post de "orga".
Pentru o mai buna intelegere este utila consultarea programului scantast.pas }
Uses Crt,Dos;
Const
Nota_Do:array[1..4] of integer=(33,66,132,264);
Raport:array[1..10]of real=(24/24,27/24,30/24,32/24,36/24,40/24,45/24,
48/24,51/24,54/24);
Nota:array[1..10]of string[3]=('Do','Re','Mi','Fa','Sol','La','Si',
'Do','Re','Mi');
CodT:array[1..4]of byte=(44,30,16,2);
Type Pixel=Record
atrib:byte;
car:char;
end;
Var
tasta:byte;i:integer;
KbdIntVec:procedure;
ecran:array[1..25,1..80]of Pixel absolute \$b800:0000;
{\$F+}
Procedure KeyClick; interrupt;
begin
Port[\$20]:=\$20;
end;
Begin
ClrScr;
GetIntVec(\$9,@KbdIntVec);
tasta:=0;
141
repeat
repeat until tasta<>Port[\$60];
tasta:=Port[\$60];
if (tasta>=CodT[1])and(tasta<CodT[1]+10) then
begin
gotoxy(5*(tasta+1-CodT[1]),24);write(Nota[tasta+1-CodT[1]]);
sound( Trunc( Raport[ tasta+1-CodT[1] ] * Nota_Do[1] ) )
end
else
if (tasta>=CodT[2])and(tasta<CodT[2]+10) then
begin
gotoxy(5*(tasta+1-CodT[2]),22);write(Nota[tasta+1-CodT[2]]);
sound( Trunc( Raport[ tasta+1-CodT[2] ] * Nota_Do[2] ) )
end
else
if (tasta>=CodT[3])and(tasta<CodT[3]+10) then
begin
gotoxy(5*(tasta+1-CodT[3]),20);write(Nota[tasta+1-CodT[3]]);
sound( Trunc( Raport[ tasta+1-CodT[3] ] * Nota_Do[3] ) )
end
else
if (tasta>=CodT[4])and(tasta<CodT[4]+10) then
begin
gotoxy(5*(tasta+1-CodT[4]),18);write(Nota[tasta+1-CodT[4]]);
sound( Trunc( Raport[ tasta+1-CodT[4] ] * Nota_Do[4] ) )
end
else nosound;
until tasta=129;
SetIntVec(\$9,@KbdIntVec);
End.
142
Program Testare_VESA;
{ Program de testare a posibilitatilor de lucru a placii grafice in
standardul VESA. }
uses dos;
type tmoduri=array[1..256] of word;
var imod,vseg,x,y:word; cbank,c:longint; rg:registers;
ntbanks:longint; opt:char;
vesabuf:record sign:longint; vers:word; oem:pchar;
capab:longint; list:^tmoduri;
reserv:array[1..512] of byte end;
vesamod:record attr:word; wina,winb:byte;
gran,winsiz,sega,segb:word; pagfun:pointer;
bytes,width,height:word;
charw,charh,planes,bits,nbanks,model,sbank,
nrimpg,reservb,rms,rfp,gms,gfs,bms,bfs:byte;
reserv:array[1..512] of byte end;
function hexa(v:word):string;
const s:string[16]='0123456789abcdef';
function hexb(b:byte):string;
begin
hexb:=s[b div 16+1]+s[b mod 16+1];
end;
begin
hexa:=hexb(hi(v))+hexb(lo(v));
end;
procedure setbank(b:longint);
begin
vseg:=\$a000;
if b<>cbank then with rg,vesamod do begin
cbank:=b; ax:=\$4f05; bx:=0;
dx:=b*64 div gran; intr(16,rg);
end;
end;
143
procedure putpixel(x,y:word; cul:longint);
var l:longint; m,z:word;
begin
with rg,vesamod do case bits of
4: begin
l:=longint(bytes)*y+x div 8;
port[\$3ce]:=3; port[\$3cf]:=0;
port[\$3ce]:=5; port[\$3cf]:=2;
port[\$3ce]:=8; port[\$3cf]:=128 shr (x and 7);
setbank(l shr 16);
z:=mem[vseg:word(l)]; mem[vseg:word(l)]:=cul;
end;
8: begin
l:=longint(bytes)*y+x; setbank(l shr 16);
mem[vseg:word(l)]:=cul;
end;
15,16: begin
l:=longint(bytes)*y+x*2; setbank(l shr 16);
memw[vseg:word(l)]:=cul;
end;
24: begin
l:=longint(bytes)*y+x*3;
z:=word(l); m:=l shr 16; setbank(m);
if z<\$fffe then move(cul,mem[vseg:z],3)
else begin
mem[vseg:z]:=lo(cul);
if z=\$ffff then setbank(m+1);
mem[vseg:z+1]:=lo(cul shr 8);
if z=\$fffe then setbank(m+1);
mem[vseg:z+2]:=cul shr 16;
end;
end;
end;
144
end;
begin
with rg, vesabuf, vesamod do begin
ax:=\$4f00; es:=seg(vesabuf); di:=ofs(vesabuf);
sign:=\$41534556; intr(16,rg);
if al<>\$4f then begin
writeln('Standardul VESA nu e implementat');
exit end;
imod:=1;
while list^[imod]<>\$ffff do begin
ax:=3; intr(16,rg); ax:=\$4f01; cx:=list^[imod];
es:=seg(vesamod); di:=ofs(vesamod);
intr(16,rg);
if attr and 16<>0 then begin
writeln(oem,' VESA Versiune ',hi(vers),'.',lo(vers));
writeln(hexa(list^[imod]),
' Rezolutie: ',width,' x ',height,
' Culori: ',longint(1) shl bits);
end else opt:='N';
if upcase(opt)='D' then begin
ax:=\$4f02; bx:=list^[imod];
intr(16,rg); cbank:=-1;
ntbanks:=longint(bytes)*height div gran div 1024;
for x:=0 to ntbanks do begin
setbank(x); mem[\$a000:\$ffff]:=0;
fillchar(mem[\$a000:0],\$ffff,0);
end;
case bits of
4,8: c:=15;
15: c:=32767;
16: c:=65535;
24: c:=longint(1) shl 24-1;
145
end;
for x:=0 to width-1 do begin
putpixel(x,0,c); putpixel(x,height-1,c);
end;
for y:=0 to height-1 do begin
putpixel(0,y,c); putpixel(width-1,y,c);
end;
for x:=0 to 191 do for y:=0 to 191 do begin
case bits of
4: c:=(y div 48)*4+x div 48;
8: c:=(y div 12)*4+x div 12;
15,16: c:=(y div 6)*(1 shl rfp)+x div 6;
24: c:=longint(x)*65536+y;
end;
putpixel(x+4,y+4,c);
end;
end;
inc(imod);
end;
ax:=3; intr(16,rg);
end;
end.
146
Curiozităţi şi trucuri de programare
Pentru o cît mai completă prezentare a programării în C nu puteam evita prezentarea
unor curiozităţi şi ale unor trucuri de programare C. Acelaşi lucru este valabil şi pentru
limbajul Pascal dar este acesta este oarecum "ieşit din modă". Numărul foarte mare de astfel
de "invenţii" a condus la organizarea încă din 1984 a unui concurs internaţional de
programare numit foarte sugestiv The International Obfuscated C Code Contest – IOCCC
adică Concursul internaţional de programare ofuscată C (încîlcită şi confuză). Participanţii la
acest concurs oferă în fiecare an adevărate perle de programare C ce dovedesc, pe lîngă
serioase cunoştinţe de C, aptitudinile extraordinare şi fiabilitatea compilatorului C. Multe din
capodoperele acestui concurs au fost apoi înscripţionate pe tricouri sau pungi, spre deliciul
fanilor programării C.
Această pasiune are totuşi şi o latură serioasă ce poate fi sesizată în programarea sub
platformele (sistemele de operare) gen Unix. În aceste sisteme toate programele circulă nu
numai sub forma de cod executabil ci şi în sursa originală C. Ascunderea unor informaţii
despre programarea sistem de ochii celor "periculos" de curioşi este astfel dificilă. Dar iată că
acest tip de programare "ofuscată" face acest lucru posibil ! Numai cei foarte pasionaţi îşi
"prind urechile" în descifrarea unor astfel de programe intenţionat încîlcite. Altfel spus,
secretul unor astfel de programe se ascunde chiar în rebusul din faţa ochilor cititorului.
Recomandăm acest capitol în special fanilor programării C şi celor foarte pasionaţi.
// Un simplu "Hello world!" dar care arata o surprinzatoare interpretare a
compilatorului C
#include <stdio.h>
char a[]="Hello world!";
int i;
void main(void){
for(i=0;a[i]!='\0';i++)
putchar(i[a]); // !! a[i] <=> *(a+i) <=> *(i+a) <=> i[a] !!
}
147
// Iata unde conduce folosirea tipului de date float:
// c este foarte diferit de w ?!
// Putem spune ca acesta este un bug al C-ului ?
#include <stdio.h>
float a=12345679.,b=12345678.,
c=a*a-b*b,
u=a*a,v=b*b,w=u-v;
void main(){
printf("a=%f,b=%f\nc=%f,w=%f\n",a,b,c,w);
}
// Iata si varianta "corecta" in care nu se produce nici o trunchiere:
#include <stdio.h>
long double a=12345679.,b=12345678.,
c=a*a-b*b,
u=a*a,v=b*b,w=u-v;
void main(){
printf("a=%Lf,b=%Lf\nc=%Lf,w=%Lf\n",a,b,c,w);
}
// Acest program este capabil sa-si duplice identic la "iesire" codul sursa C fara a
efectua nici o
// citire de nicaieri. Are deci caracteristica unui virus, se auto-replica !
#include <stdio.h>
char *s[]={
"#include <stdio.h>",
"char *s[]={",
"void main(void){",
"int i;char *ps;",
"puts(s[0]);puts(s[1]);",
"for(i=0;i<10;i++)",
148
" {putchar(34);for(ps=s[i];*ps;ps++)putchar(*ps);",
" putchar(34);putchar(',');putchar(10);}",
"putchar(34);for(ps=s[10];*ps;ps++)putchar(*ps);putchar(34);putchar(10);",
"putchar('}');putchar(';');putchar(10);",
"for(i=2;i<11;i++)puts(s[i]);putchar('}');"
};
void main(void){
int i;char *ps;
puts(s[0]);puts(s[1]);
for(i=0;i<10;i++)
{putchar(34);for(ps=s[i];*ps;ps++)putchar(*ps);
putchar(34);putchar(',');putchar(10);}
putchar(34);for(ps=s[10];*ps;ps++)putchar(*ps);putchar(34);putchar(10);
putchar('}');putchar(';');putchar(10);
for(i=2;i<11;i++)puts(s[i]);putchar('}');
}
// Program C surpriza (ales dintre cele de la IOCCC)
// Ce face acest program intr-o singura linie ?
{write(j/p+p,i---j,i/i);}
// Alt program C surpriza (ales dintre cele de la IOCCC)
// Ce face acest program intr-o singura linie ?
main(v,c)char**c;{for(v[c++]="Hello, world!\n)";(!!c)[*c]&&(v--||--c&&execlp(*c,*c,c[!!c]
+!!c,!c));**c=!c)write(!!*c,*c,!!**c);}
// Puteti "decripta" acest program C de trei linii ? Executia lui arata clar ce face,
intrebarea este // insa cum face ?!
#define P(X)j=write(1,X,1)
#define C 39
149
int M[5000]={2},*u=M,N[5000],R=22,a[4],l[]={0,-1,C-1,-1},m[]={1,-C,-1,C},*b=N,
*d=N,c,e,f,g,i,j,k,s;main(){for(M[i=C*R-1]=24;f|d>=b;){c=M[g=i];i=e;for(s=f=0;
s<4;s++)if((k=m[s]+g)>=0&&k<C*R&&l[s]!=k%C&&(!M[k]||!j&&c>=16!
=M[k]>=16))a[f++
]=s;if(f){f=M[e=m[s=a[rand()/(1+2147483647/f)]]+g];j=j<f?f:j;f+=c&-16*!j;M[g]=
c|1<<s;M[*d++=e]=f|1<<(s+2)%4;}else e=d>b++?b[-1]:e;}P(" ");for(s=C;--s;P("_")
)P(" ");for(;P("\n"),R--;P("|"))for(e=C;e--;P("_ "+(*u++/8)%2))P("| "+(*u/4)%2
);}
150
Confruntare de opinii: Informatică versus Matematică
Deşi poate părea neobişnuit pentru o culegere de probleme, am ţinut totuşi să
introducem acest capitol pentru "a-i pune în gardă" pe începătorii într-ale informaticii de
capcana confruntărilor sterile, pro informatică sau contra matematicii.
E bine ca ei să afle că deşi informatica este studiată ca ştiinţă de sine stătătoare ea este
totuşi oficial considerată şi clasificată ca o sub-disciplină a matematicii. Desigur, acest fapt
zgîndăre orgoliul unor "informaticieni pur-sînge" care, neînţelegînd că aceste clasificări sînt
pur formale, intră deseori în confruntări aprinse de opinii cu matematicienii conservatori pe
tema apartenenţei teoriilor informatice la matematică. Aceste sterile discuţii în contradictoriu
nu pot fi însă auzite în mediile cu adevărat ştiinţifice, acolo unde se întîlnesc cei mai pasionaţi
şi mai profunzi cercetători ai ambelor discipline.
Putem rezuma opiniile contradictorii, pe care le-am auzit şi noi deseori, sub forma
următoarelor două întrebări care formulează în două moduri distincte aceeaşi dilemă:
1. Se bazează informatica în întregime pe matematică sau ea are o existenţă separată ?
2. Se poate "face" informatică fără să cunoşti matematică foarte bine ?
Înainte de a oferi răspuns, vom lămuri mai întîi o altă confuzie ceea ce ne va permite
să răspundem mai uşor la cele două întrebări: care este diferenţa dintre informatică şi ştiinţa
calculatoarelor (computer science) ?
Se ştie că există în facultăţile de la noi din ţară două (chiar trei) secţii cu profil
informatic: secţia de informatică la facultatea de ştiinţe, secţia de calculatoare la facultatea de
inginerie şi, mai nou, secţia de prelucrare electronică a informaţiei economice (informatică
economică) la facultatea de ştiinţe economice. Sînt aceste secţii esenţial diferite ?
Să vedem o opinie cu "greutate". Iată cuvintele academicianului Nicolae Teodorescu
despre informatică (am pus în evidenţă prin litere îngroşate cuvintele ce ni s-au părut
esenţiale): “Calculatorul electronic are însă ca merit esenţial stimularea unui mod de gîndire
care aştepta de veacuri un mijloc tehnic prodigios pentru a da minţii omeneşti putinţa
hotărîtoare de a-l introduce în strategiile investigative de avangardă. Acesta este modul de
gîndire algoritmică care permite sortarea, analiza şi prelucrarea unui număr mare de
posibilităţi, precum şi alegerea celei sau celor mai potrivite care conduc la rezultatul sau
rezultatele urmărite, în studiul unor procese complexe care trebuie să fie simplificate sau
abandonate din lipsă de mijloace de cercetare. Pentru promovarea acestei gîndiri,
calculatorul electronic nu era însă suficient el însuşi, ci avea nevoie de o serie de discipline
ştiinţifice avînd ca bază gîndirea algoritmică. Astfel, în puţinii ani de la introducerea
151
calculatorului electronic s-au format discipline constituind o nouă ramură a ştiinţei cu
caractere mixte teoretice şi tehnice, numită la un moment informatică termen care a înlocuit
pe cel iniţial de ştiinţă a calculului sau ştiinţă a calculatoarelor (computer science) , care
avea un înţeles mai precis, dar în acelaşi timp mai restrîns.”
Vedem că, dintre cei toţi termenii de specialitate ce se folosesc, cea mai largă
accepţiune o are termenul de informatică. Ceilalţi termeni, cum sînt ştiinţa calculatoarelor şi
informatică economică, nu fac decît să nuanţeze şi să particularizeze înţelesul iniţial mai
general. Ştiinţa calculatoarelor abordează informatica de pe poziţii inginereşti, ea primind un
aport subtanţial de la alte discipline inginereşti ca electronica, ştiinţa prelucrării semnalelor
electrice sau ştiinţa telecomunicaţiilor. Informatica economică utilizează noţiuni cu caracter
strict economic sau din domeniul ştiinţelor sociale. Putem deduce că toate aceste nuanţări şi
specializări au apărut din necesitate, datorită impactului deosebit pe care utilizarea pe scară
largă a calculatoarelor îl are asupra sectoarelor societăţii.
Dacă însă vom grupa disciplinele cu caracter informatic care se predau simultan la
fiecare din aceste secţii diferite vom obţine lista disciplinelor de bază ale informaticii: Bazele
informaticii, Programare, Structuri de date şi algoritmi, Sisteme de operare, Baze de date.
Alte discipline, cum sînt Arhitectura calculatoarelor, Reţele de calculatoare, Ingineria
programării, Inteligenţa artificială, Programarea orientată obiect, etc., sînt considerate a fi
discipline de specialitate în domeniu. De altfel, datorită acestor diferenţieri şi specializări între
secţii, absolvenţii secţiilor respective se vor numi programatori, ingineri de sistem sau
economişti-informaticieni. Să recunoaştem că s-ar ajunge la o adevărată "babilonie" dacă nu
numai matematicienii ci şi inginerii sau economiştii şi-ar disputa cu informaticienii "puri"
întîietatea în domeniile informatice ce le revin !
Rămîne să răspundem la întrebarea iniţială (formulată în două variante): în ce măsură
se poate face informatică fără matematică ? Privind lucrurile la fel de pragmatic ca şi mai sus,
dacă privim informatica ca pe o meserie (cu sub-specializările ei) iar matematica tot ca pe o
meserie, este evident că nu este necesar să cunoşti două meserii pentru a o profesa bine pe una
dintre ele. Deci, poţi fi un bun programator, inginer de sistem sau economist-informatician
fără să ai cunoştinţe serioase de matematică. Trebuie însă să spunem, spre dezamăgirea celor
"leneşi", că este exclus să fi lipsit de cunoştinţe de matematică pentru că atunci nu ai avea
cum să-ţi însuşeşti cunoştinţele minimale pe care le oferă disciplinele de bază ale informaticii
înşirate mai sus. Aceste discipline de bază fac apel la modele şi metode matematice
considerate deja clasice şi care sînt privite ca şi cultură matematică indispensabilă oricărui
152
specialist în domeniu. Cum s-a ajuns la acest fapt, cum de găseşti matematică în economie şi
în inginerie, dar nu şi invers ?
Este marele atu al matematicii: capacitatea de extragere a esenţialului şi capacitatea
de abstractizare (adică, capacitatea de modelare matematică). De altfel, este cunoscut faptul că
cunoştinţele matematice esenţiale, indiferent de forma în care ele sînt formalizate sau
simbolizate, sînt aceleaşi pentru orice civilizaţie terestră. Sau extraterestră ! Se ştie că
mesajele de pe sondele spaţiale americane, ce au părăsit deja sistemul nostru solar, destinate
unor posibile civilizaţii extraterestre sînt "scrise" în limbaj matematic. Să nu ne mai mirăm
atunci că "fără matematică nu se poate !".
Ca să nu creadă cineva că facem pledoarie pentru matematică, aici într-o lucrare de
informatică, vă facem cunoscut că, din contră, în cartea sa Vîrsta de aur a matematicii, care
prezintă în 11 capitole cele mai mari realizări ale matematicii din ultimii 50 de ani, profesorul
şi cercetătorul Keith Devlin de la universităţile Stanford şi Pittsburgh a introdus un capitol cu
titlul Eficienţa algoritmilor şi în alte cinci capitole arată rolul important pe care l-a avut
folosirea calculatorului în creşterea eficienţei şi validării cercetării pur matematice. Adică,
şase din unsprezece capitole cer pentru a fi înţelese bine nu numai cunoştinţe de matematcă ci
şi de informatică. Iar unul din cele cinci capitole, Problema celor patru culori, accentuează
rolul esenţial (indispensabil) al programării în demonstrarea cu ajutorul calculatorului a
uneia din cele mai celebre probleme de matematică. Această demonstraţie a creat o "breşă"
serioasă în gîndirea matematicienilor care au fost nevoiţi să ia foarte în serios "concurenţa" pe
care calculatorul (bine "dirijat" de programatori) a început să le-o facă. Iată chiar cuvintele
profesorului de matematică Keith Devlin scrise în încheierea capitolului respectiv (ce explică
modul în care s-a făcut demonstraţia cu calculatorul): "Matematica nu va mai fi niciodată
aceeaşi." !
Încheiem cu convingerea că, cei care au parcurs cu interes această culegere, inclusiv
acest capitol, nu vor mai putea fi tentaţi de controverse "uşoare" informatică versus
matematică. Credem că s-a putut vedea cum, cei care "sînt deasupra" acestor discuţii sterile,
au sesizat cu înţelepciune că matematica - "mama informaticii" - se îmbogăţeşte acum din plin
prin intermediul informaticii, "punîndu-le astfel pe picior de egalitate" cele două discipline.
Noi le urăm tuturor celor studioşi să-şi concentreze toată energia pasiunii lor pentru
învăţarea şi stăpînirea cu măiestrie a "artei programării". Ea poate fi considerată ca fiind
prima treaptă importantă spre orizontul către care tinde ştiinţa informaticii.
153
Bibliografie, adrese şi locaţii de interes pe Internet
Internetul e foarte mare, stufos şi, de multe ori, labirintic. Tocmai de aceea, ne-am
gîndit să venim în ajutorul celor foarte pasionaţi de informatică şi de matematica aplicată în
informatică. Oferim în continuare doar cîteva adrese pe care şi noi le-am utilizat cu succes.
Fiecare din aceste site-uri conţine la rîndul lui liste de adrese şi legături (links) către alte site-
uri cu subiecte asemănătoare. Iată, aveţi la dispoziţie "un capăt al ghemului" !
× www-groups.dcs.st-and.ac.uk/~history/ - conţine multe pagini interesante despre istoria
descoperirilor în matematică, utile celor care doresc să afle cum se face cu adevărat
descoperiri în matematică şi cum s-a ajuns la necesitatea apariţiei calculatoarelor
× www.mathpages.com/KsBrown/ - conţine o colecţie impresionantă de informaţii, idei şi
descoperiri de ultimă oră din matematică şi informatică
× www.mathsoft.com/asolve/ - conţine o listă substanţială de probleme de matematică (şi
nu numai) care îşi aşteaptă încă rezolvarea, multe dintre ele putînd fi abordate cu ajutorul
calculatorului
× www.ee.Surrey.ac.uk/Personal/R.Knott/Fibonacci/fib.html - este o "portiţă" de intrare în
domeniul fascinant al numerelor lui Fibonacci, cu multiple corelaţii matematice şi
informatice
× mans.cee.hw.ac.uk/ctl.html Computer Teaching and Learning Resources - numele site-
ului spune totul
× www.k12tlc.net/Penrose/ K-12 Teaching & Learning Center - noi am ales pagina care
prezintă biografia lui Sir Roger Penrose, dar aveţi încă multe altele la dispoziţie
× www.ioccc.org The International Obfuscated C Code Contest (IOCCC) – Concursul
internaţional de programare C ofuscată (încîlcită şi intenţionat confuză)
Suplimentar, tot pentru cei foarte pasionaţi de matematică, informatică, de legătura
dintre ele şi nu numai, oferim o selecţie minimală de cărţi şi articole care au constituit, direct
sau indirect, o sursă de inspiraţie în scrierea acestei culegeri:
× Turbo Pascal 6.0. Ghid de utilizare, Microinformatica, Cluj-Napoca, 1992
× Bălănescu T. …, Limbajul Turbo Pascal, Editura tehnică, Bucureşti, 1992
× Grigore Albeanu, Programarea în Pascal şi Turbo Pascal. Culegere de probleme,
Editura tehnică, Bucureşti, 1994
154
× Tudor Sorin, Tehnici de programare, Editura L&S Infomat, Bucureşti, 1998
× Manual de programare C, (după Kernigham şi Ritchie) Microinformatica, Cluj-Napoca,
1986
× Muşlea I., Programarea în C, Microinformatica, Cluj-Napoca, 1992
× Roger Penrose, Mintea noastră…cea de toate zilele, (titlul original: Emperor's mind),
Editura tehnică, Bucureşti, 2001
× Roger Penrose, Incertitudinile raţiunii. Umbrele minţii, (titlul original: Shadows of the
mind), Editura tehnică, Bucureşti, 2000
× Keith Devlin, Vîrsta de aur a matematicii, (titlul original: Matemathics: The New Golden
Age), Editura Thetha, Bucureşti, 2000
× Solomon Marcus, Gîndirea algoritmică, Editura tehnică, Bucureşti, 1982
× L. Livovschi, H. Georgescu, Bazele informaticii, Editura didactică şi pedagogică,
Bucureşti, 1981
155 | 84,137 | 234,017 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.53125 | 4 | CC-MAIN-2018-22 | latest | en | 0.182359 |
http://blog.phytools.org/2024/08/ancestral-state-estimates-from-multi.html | 1,726,403,812,000,000,000 | text/html | crawl-data/CC-MAIN-2024-38/segments/1725700651630.14/warc/CC-MAIN-20240915120545-20240915150545-00109.warc.gz | 4,006,919 | 373,633 | ## Friday, August 16, 2024
### Ancestral state estimates from the multi-state threshold model fit using the discrete approximation (compared to `ancThresh`)
In some recent posts to this blog (e.g., 1, 2) I’ve demonstrated marginal ancestral state estimation under the multi-state threshold model using the discrete approximation of Boucher & Démery (2016). (To learn more about the discrete approximation more generally, as well as Boucher & Démery’s fascinating paper, I recommend checking out my Evolution Meeting 2024 talk, which is available on YouTube.)
Readers of this blog, however, might also be familiar with a 2014 Evolution article by me in which I describe ancestral state reconstruction under the threshold model using Bayesian MCMC. The method described in this 2014 article is implemented in the phytools function `ancThresh` and has been used numerous times in published articles. In my article, I describe using MCMC to jointly sample ancestral & tip liabilities, and thresholds between discrete character levels, from their posterior probability distribution.
A relevant question is, of course, how do these two different approaches compare? Do they produce the same set of marginal node states?
Fortunately, the answer is more or less: yes – though, of course, we must ensure that our MCMC converges on the posterior distribution, which can be quite slow, depending on the nature of our data and the size of the tree. I would be inclined to recommend using `fitThresh` and `ancr` (for the numerous advantages so doing offers, e.g., as discussed here); however, we don’t need to be overly concerned about past results obtained using `ancThresh`, so long as convergence to the posterior was realized.
``````library(phytools)
``````
Now, I’ll proceed to simulate a tree a character evolving under the threshold model, as follows. I’m keeping my tree small – just so I can run a fairly large number of generations of MCMC (107, in fact) without needing to dedicate many weeks to this post!
``````tree<-pbtree(n=40,scale=1)
liability<-fastBM(tree,a=1.5)
thresholds<-setNames(c(0,1,Inf),
c("a","b","c"))
x<-as.factor(threshState(liability,thresholds))
``````
Our tree is a standard `"phylo"` object with 40 tips.
``````tree
``````
``````##
## Phylogenetic tree with 40 tips and 39 internal nodes.
##
## Tip labels:
## t13, t14, t6, t7, t19, t20, ...
##
## Rooted; includes branch lengths.
``````
While our character data is in a factor vector with names that correspond to our species labels.
``````x
``````
``````## t13 t14 t6 t7 t19 t20 t12 t29 t30 t39 t40 t36 t21 t27 t28 t22 t34 t35 t25 t26 t24 t23 t9
## a a a a b b b c c c b b c b b b a a a a a b a
## t4 t15 t16 t8 t32 t33 t31 t1 t10 t11 t2 t17 t18 t3 t5 t37 t38
## a b b a c c c c c c c c c c c c c
## Levels: a b c
``````
Next, I’m going to run `ancThresh`. Readers following along may choose to run fewer generations, because this can take a while!
``````anc_mcmc<-ancThresh(tree,x,ngen=1e7,
control=list(print=FALSE))
``````
``````## **** NOTE: no sequence provided, using alphabetical or numerical order
## MCMC starting....
``````
``````anc_mcmc
``````
``````##
## Object containing the results from an MCMC analysis
## of the threshold model using ancThresh.
##
## List with the following components:
## ace: matrix with posterior probabilities assuming 2e+06
## burn-in generations.
## mcmc: posterior sample of liabilities at tips & internal
## nodes (a matrix with 10001 rows & 39 columns).
## par: posterior sample of the relative positions of the
## thresholds, the log-likelihoods, and any other
## model variables (a matrix with 10001 rows).
##
## The MCMC was run under the following conditions:
## seq = a <-> b <-> c
## model = BM
## number of generations = 1e+07
## sample interval= 1000
## burn-in = 2e+06
``````
Next, let’s fit our threshold model under the discrete approximation of Boucher & Démery (2016) using `phytools::fitThresh`. This still takes a second for `levs=400` (we could’ve used `levs=200` to no great ill effect), but it is much, much quicker than `ancThresh`.
``````thresh_mle<-fitThresh(tree,x,levs=400,
root="fitzjohn")
thresh_mle
``````
``````## Object of class "fitThresh".
##
## Set value of sigsq (of the liability) = 1.0
##
## Set or estimated threshold(s) = [ -0.717763, 0.038735 ]*
##
## Log-likelihood: -26.370495
##
## (*lowermost threshold is fixed)
``````
Then, to obtain marginal ancestral states, all we need to do is call the `ancr` S3 method on our fitted model object (`thresh_mle`) as follows.
``````anc_mle<-ancr(thresh_mle)
anc_mle
``````
``````## Marginal ancestral state estimates:
## a b c
## 41 0.003175 0.232452 0.764373
## 42 0.445464 0.542706 0.011830
## 43 0.915251 0.084664 0.000084
## 44 0.452606 0.537200 0.010193
## 45 0.383487 0.602590 0.013924
## 46 0.747646 0.250047 0.002308
## ...
##
## Log-likelihood = -26.370495
``````
Let’s make a plot comparing the two different reconstructions:
``````par(mfrow=c(1,2))
cols<-colorRampPalette(c("blue","yellow"))(3)
plot(anc_mcmc,node.cex=0.8,tip.cex=0.6,ftype="off",
mar=c(0.1,0.1,2.1,0.1))
plotTree(tree,ylim=c(-0.1*Ntip(tree),Ntip(tree)),
ftype="off",offset=0.5,lwd=1,
mar=c(0.1,0.1,2.1,0.1))
nodelabels(pie=anc_mle\$ace,cex=0.8,piecol=cols)
tiplabels(pie=to.matrix(x,levels(x)),cex=0.6,
piecol=cols)
mtext("b) estimates from fitThresh > ancr",line=0,
``````
This gives the impression that our estimates are very nearly, if not precisely, identical. If anything, the global root states would seem to be most different. (This may have something to do with our choice of root prior. I’m not sure!)
Let’s plot them together & find out.
``````par(mar=c(5.1,4.1,1.1,1.1))
plot(anc_mle\$ace,anc_mcmc\$ace,bty="n",pch=21,cex=1.5,
bg=make.transparent("blue",0.25),las=1,
xlab="marginal estimates from fitThresh > ancr",
ylab="marginal estiates from ancThresh MCMC",
cex.axis=0.7,cex.lab=0.8)
abline(a=0,b=1)
grid()
``````
We can see that our estimates fall quite close to a 1:1 line. The few that fall off it are actually the global root.
To see that, we can plot it again with the root node values shown in red.
``````par(mar=c(5.1,4.1,1.1,1.1))
plot(anc_mle\$ace[2:tree\$Nnode,],anc_mcmc\$ace[2:tree\$Nnode,],
bty="n",pch=21,cex=1.5,
bg=make.transparent("blue",0.25),las=1,
xlab="marginal estimates from fitThresh > ancr",
ylab="marginal estiates from ancThresh MCMC",
cex.axis=0.7,cex.lab=0.8)
points(anc_mle\$ace[1,],anc_mcmc\$ace[1,],
pch=21,cex=1.5,bg=make.transparent("red",0.25))
abline(a=0,b=1)
grid()
``````
That's very close -- and, of course, we shouldn't expect them to be precisely the same because the former estimates come from Bayesian MCMC and our default prior is probably not totally uninformative (that's invariably hard to guarantee).
OK, thhat’s it for now folks! | 2,173 | 6,935 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.5625 | 3 | CC-MAIN-2024-38 | latest | en | 0.918964 |
https://crypto.stackexchange.com/questions/89405/why-are-lceil-1-operatornameentropy-per-bit-rceil-number-of-bits-not-suff?noredirect=1 | 1,713,917,112,000,000,000 | text/html | crawl-data/CC-MAIN-2024-18/segments/1712296818835.29/warc/CC-MAIN-20240423223805-20240424013805-00097.warc.gz | 170,801,287 | 45,938 | # Why are $\lceil 1/\operatorname{entropy-per-bit} \rceil$ number of bits not sufficient to generate an unbiased bit?
Consider a biased RNG badrand() generating 1 with probability $$0.9$$ and 0 with probability $$0.1$$.
This excellent answer explains that we need 849 bits of badrand() to generate 1 bit of betterrand() with less bias than the NIST recommended $$2^{-64}$$.
The minimum entropy per bit of badrand() is 0.152 bits/bit.
Considering the additive nature of entropy, 7 bits of badrand() contains 1.064 bits of entropy.
Why, then, do 7 bits of badrand() not suffice to get 1 bit of betterrand()?
If a quantitative answer is difficult, a qualitative one would also inspire deep gratitude in me.
I will take a slightly different approach, a side step to a simpler problem to gain intuition. Let's say we have a fair 6 sided die. And we wish to draw a number uniformly from 1 to 4. It can't be done with a single dice roll. The single dice roll has enough entropy. More than the 2 bits we need. But it is impossible to map the dice roll results to a uniform number 1-4 we must map multiple values to the same output and can not allocate the same number of original values to each. With 2 such dice rolls there is no problem. We can easily extract a single unbiased bit from each dice roll and construct a uniformly random number 1-4.
If we wanted a number between 1 and 5 uniformly it becomes more difficult. With a fixed number of dice rolls the space of outcomes is $$6^n$$ which will never be devisible by 5 for any n(The prime decomposition will only ever have 2s and 3s). So we can either take a sufficiently large $$n$$ to get the bias as small as we want (but never 0). Or more commonly we use a simple algorithm with probablistic runtime which may need an unbounded number of roles. roll the die if the outcome is 1-5 return the value if it's 6 repeat. This produces the unbiased result but with some small probability it will continue arbitrarily long time.
So having enough entropy isn't sufficient.
Entropy and bias are not the same.
Yes, total entropy is additive so as you suggest 7 bits of badrand() produce a total of 1.064 bits of entropy. So? How would you use that? In cryptography we aim to use some source to produce a stream of independently and identically distributed random bits.
Assume a plaintext ($$p$$) of octets XORed with an octet keystream ($$k$$) to generate ciphertext ($$c$$) as $$c = p \oplus k$$. Where would you get 8 bits of $$k$$ from? We would need to use up at least $$\frac{8}{0.152} \approx 53$$ bits from badrand(). So the issue becomes how do you transform 53 bits into 8 to be usable as an unbiased keystream?
We could use a randomness extractor such as a 2 universal hash function. That can be as simple as vector multiplication. The maths (Leftover Hash Lemma) governing the transformation tells us that the output bias $$\epsilon_{hash} = 2^{-(sn - k)/2}$$. In your case, $$\epsilon_{hash} = 2^{-(0.152 \times 53 - 8)/2} = 0.98$$. Not much improvement over the raw bit stream! The maths only works if $$n$$ is increased to >849 which then gives you a small enough bias for $$k$$ to be cryptographically useful.
As stated in the linked paper, there is a large entropy loss as an unavoidable(?) consequence of the transformation. The loss can be reduced and the extraction made more efficient, but nothing comes entirely for free.
Speaking of entropy loss: The most important factor that can reduce the entropy loss is the output size of the extractor function. Your example uses 8 bits. So the entropy loss is just over 99%. That's bad. Imagine using SHA-512 instead of an 8 column wide vector extractor. You'd hash 4211 bits to produce 512. The loss is now 88%.
• Paul, thanks again for an enlightening answer 🙏🏼🙏🏼. Apr 15, 2021 at 13:08
The other answer actually says that you need 2527 bits of input for each 256 bits of hash output. That's 9.9 bits per bit, not much worse than 7.
The same calculations gives 849 input bits per output bit if you use a 1-bit hash, but that doesn't mean there's no way to produce a first output bit with fewer than 849 input bits. The hashing approach isn't provably optimal for every use case, it's just a good choice for many use cases.
A simple approach that uses fewer than 849 bits is the classic method of reading a pair of bits, returning the first one if they're unequal, or discarding them and trying again if they're equal. Once you've retried enough times that the probability you've reached this iteration is small enough, you can just return 0 (or 1 if you prefer), making the worst-case bit usage bounded. This needs an average of about 11 bits/bit, and a maximum of... $$2\lceil\log_{0.9^2}\sqrt{2^{-64}\ln(2)/4}\rceil = 220$$, I think. This isn't optimal either; it just shows that cheaper methods exist when you need a bit ASAP.
It's easy to prove the impossibility of producing a sufficiently unbiased output bit from 7 bits of input. The input is one of 128 discrete values, and the function has no other source of randomness, so it must deterministically return either 0 or 1 for each input. This is a subset-sum problem: you must find a subset of $$\{\prod S : S\in \{0.1,0.9\}^7\}$$ that adds to a value in the acceptable probability range. If you multiply the elements of the set by $$10^7$$ so they're integers, they are all multiples of $$9$$ except for a single $$1$$, while the sum you're trying to reach is congruent to 5 mod 9. Thus, you can't do better than output bit probabilities of $$0.5\pm 4\cdot10^{-7}$$, and that's only if the subset-sum problem has a solution. The other answer says that an entropy of $$1-2^{-64}$$ bits/bit requires $$P(x_i = 0, x_i = 1) \approx 0.5 \pm 2^{-66}$$. I think that's wrong and it should be $$2^{-33}$$, but both values are less than $$4\cdot10^{-7}$$.
An interesting question to which I don't know the answer is the smallest number of input bits for which you can produce a sufficiently unbiased output using this method, but an extension of this argument shows that it has to be at least 11 (or 21 if I'm wrong about the $$2^{-33}$$), making this less efficient in the long run than the 256-bit hashing method.
Why are $$\lceil 1/\operatorname{entropy-per-bit} \rceil$$ number of bits not sufficient to generate an unbiased bit?
Because the question is formulated for just one (nearly) unbiased bit to produce. For a large number of (nearly) unbiased bits to produce, that would be enough.
Assume $$n$$ independent input bits $$b_j$$, each set with known probability exactly $$\alpha$$, thus $$\operatorname{entropy-per-bit}=\alpha\log_2(\alpha)-(1-\alpha)\log_2(1-\alpha)$$. The question is for $$\alpha=0.9$$, thus $$\operatorname{entropy-per-bit}\approx0.468996$$, and $$\lceil 1/\operatorname{entropy-per-bit} \rceil=3$$.
We can make an explicit algorithm generating $$m$$ bits from $$n=\lceil(m+\ell)/\operatorname{entropy-per-bit}\rceil$$ bits of the biased source, with advantage $$\mathcal O(2^{-\ell})$$ (including vanishing individual bit bias) for an adversary trying to distinguish the output from $$m$$ uniform random bits.
One of the simplest such algorithm, generating $$m$$ bits from $$n$$ goes:
• $$x\gets0$$ and $$y\gets1$$ (these a real values, or rationals when $$\alpha$$ is rational)
• for each of the $$n$$ input bits $$b_j$$
• if $$b_j=0$$, then $$y\gets\alpha\,x+(1-\alpha)\,y$$, else $$x\gets\alpha\,x+(1-\alpha)\,y$$
• output the $$m$$ bits of the binary expression of $$\lfloor x\,2^m\rfloor$$.
This is a so-called arithmetic coder. There are slightly more complex variants that most of the time output some bits before the end. There are other variants that use bounded memory (here, we need storage proportional to $$m$$), at the expense of a small bias.
Back to the problem of generating a single output bit, as unbiased as possible, from a fixed number $$n\ge1$$ input bits.
There are $$2^n$$ possible values of $$n$$ input bits. For any such $$n$$-bit bitstring, note $$i$$ the corresponding integer per big-endian binary convention (thus $$0\le i<2^n$$) and $$\mathcal\|i\mathcal\|=k$$ the number of ones in $$i$$, with thus $$0\le k\le n$$. Value $$i$$ has probability $$p_i=(1-\alpha)^{n-k}\,\alpha^k$$. There are $$n\choose k$$ values $$i$$ with the same probability $$q_k$$, and correspondingly $$1=\sum{n\choose k}q_k$$. Recall $$n\choose k$$ is given by Pascal's triangle.
For each of the $$2^n$$ possible values $$i$$, we can decide if it will output a $$0$$ or a $$1$$. The probability of a $$1$$ at the output is the sum of the $$p_i$$ for the $$i$$ we decide will output a $$1$$. That's $$2^{(2^n)}$$ assignments, which quickly becomes too much to explore. However we can make simplifications:
• The only thing that matters to the final probability is how many $$i$$ with a given $$\mathcal\|i\mathcal\|=k$$ output a $$1$$. That's an integer $$m_k\in[0,{n\choose k}]$$, and the final probability of a $$1$$ is $$\sum{m_k\,q_k}$$.
• In the search of the $$m_k$$ leading to $$p$$ closest to $$1/2$$, we can force $$m_n=1$$ (meaning that if all the input bits are set, that is $$i=2^-1$$, the output will be $$1$$). That's because changing all the $$m_k$$ to $$m'_k={n\choose k}-m_k$$ will change the probability of a $$1$$ from $$p$$ to $$p'=1-p$$, leaving the bias from $$1/2$$ unchanged in absolute value.
For example, with $$n=2$$, we can have $$m_0\in\{0,1\}$$, $$m_1\in\{0,1,2\}$$, for a total of only $$2\times3=6$$ possibilities of the outcome as a function of the two input bits $$b_0$$ and $$b_1$$. We show the corresponding probability $$p$$ that the output is $$1$$, and the value of $$\alpha$$ for $$p=1/2$$, if any. $$\begin{array}{cc|cccc|c|l} &&0&0&1&1&b_0\\ &&0&1&0&1&b_1\\ \hline m_0&m_1&&&&&p&\alpha\text{ for }p=1/2\\ \hline 0&0&0&0&0&1&\alpha^2&1/\sqrt2\\ 0&1&0&0&1&1&\alpha&1/2\\ 0&2&0&1&1&1&2\alpha-\alpha^2&1-1/\sqrt2\\ 1&0&1&0&0&1&1-2\alpha+2\alpha^2&1/2\\ 1&1&1&0&1&1&1-\alpha+\alpha^2\\ 1&2&1&1&1&1&1\\ \hline &&0&1&1&2&k\\ \end{array}$$
I don't know where the question's $$n=849$$ bit for $$2^{-64}$$ bias and $$\alpha=0.9$$ exactly comes from, but it's much too high. With $$n=6$$ we can't get better than $$p=0.469\ldots$$, but with $$n=7$$, $$m_0=1$$, $$m_1=3$$, $$m_2=6$$, $$m_3=0$$, $$m_4=6$$, $$m_5=3$$, $$m_6=0$$, $$m_7=1$$ gets $$p=0.499996$$, and I think we get one extra decimal (over 3 bits) for each increment of $$n$$.
Pseudocode implementing this strategy goes
• $$i\gets0$$ and $$k\gets0$$
• for each in $$n=7$$ input bits $$b_j$$
• $$i\gets2i+b_j$$
• $$k\gets k+b_j$$
• if $$k=7$$, return $$1$$;
• if $$k=5$$ and $$i\le\mathtt{0110111_b}$$, return $$1$$;
• if $$k=4$$ and $$i\le\mathtt{0100111_b}$$, return $$1$$;
• if $$k=2$$ and $$i\le\mathtt{0001100_b}$$, return $$1$$;
• if $$k=1$$ and $$i\le\mathtt{0000100_b}$$, return $$1$$;
• if $$k=0$$, return $$1$$;
• return $$0$$.
Note: the binary constant for $$k$$ is the $${m_k}^\text{th}$$ integer with exactly $$k$$ bit(s) set.
A use case of this algorithm is to generate one almost unbiased bit from $$n=7$$ throws of a dice 10 with only one of the 10 sides marked. This is not a common setup, and correspondingly this algorithm is seldom used. That's because in practice, we seldom know exactly the $$\alpha$$ of a biased source. In that case, the applied cryptographer feeds the input to a CSPRNG.
• It comes from here, but I think that I've made a typeo.] And it does sound bad doesn't it. but badrand() is awful. I don't know who coded it, but they should be shot. It's a terrible RNG with $H_{\infty} = 0.152$ bits/byte. Apr 15, 2021 at 23:43
• It's an extreme example that's not best for illustrating the Leftover hash Lemma. Apr 15, 2021 at 23:44 | 3,446 | 11,690 | {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 149, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.46875 | 3 | CC-MAIN-2024-18 | latest | en | 0.906718 |
https://cs.stackexchange.com/questions/tagged/program-optimization?sort=unanswered | 1,585,531,848,000,000,000 | text/html | crawl-data/CC-MAIN-2020-16/segments/1585370496330.1/warc/CC-MAIN-20200329232328-20200330022328-00046.warc.gz | 409,666,448 | 31,434 | # Questions tagged [program-optimization]
Questions about how to optimise a program's performance, both manually and automatically, e.g. in compilers.
18 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
183 views
### Optimizing order of graph reduction to minimize memory usage
Having extracted the data-flow in some rather large programs as directed, acyclic graphs, I'd now like to optimize the order of evaluation to minimze the maximum amount of memory used. That is, given ...
126 views
### minimizing computations for evaluating two polynomial simultaneously
I want to evaluate two polynomials $f$ and $g$ simultaneously, on the same input (in a computer program). These polynomial have only coefficients $0, 1, a , b$ and their degree is less than 700. I ...
43 views
### Rectangle Packing with Constraints
I am aware that the general rectangle packing problem is NP-hard. I am trying to form an estimate for a version of the problem with constraints. Consider fitting rectangles of smaller size into a ...
43 views
### Symbolic Math Systems As Speculative Optimization For Numerical Software?
Has there been published work on hiding symbolic math within numeric software, partitioning parallel processes between speculative symbolic optimization search and numeric evaluations? Real world ...
52 views
### Is there research into associative/commutative optimizations?
While playing around with optimization sets in LLVM, it occurs to me that the order in which optimizations are run matters greatly since, in general, A(B(src)) is ...
157 views
### How to compute an optimally cost-effective cache strategy?
I am looking for advice in the following optimization problem. I have a website (system) that receives database updates later returned in queries made to the same system. In order to speed up the ...
29 views
### Compiler optimization which does an SMT-like optimization in software?
Say I had two functions called one after the other: ...
73 views
### Lazy evaluation on slow Boolean functions (optimization)
Short-circuit evaluation is a straight forward subject for lazy evaluation on Boolean expressions, I noted that two factors could be useful in ordering Boolean functions to improve run-time. But this ...
99 views
### Methods for optimizing short-circuit evaluation for conditions of varying evaluation-cost
I have a bunch of boolean conditions, let's call them A, B, C, D, .... In my code, I need to use these conditions to distinguish between several different possible ...
22 views
### Is this a valid heuristic for Dots and Boxes to reduce the branching factor of the search tree?
I am implementing an AI based on the MiniMax algorithm that plays the game Dots and Boxes. I would like to reduce the branching factor of the search tree, by introducing a heuristic rule that limits ...
35 views
### Order of Traversal in Bidirectional Dataflow Analysis
Does order of traversing CFG matter in solving bidirectional dataflow problems, from a performance perspective?
27 views
### Program Transformation to Disintermediate Isomorphic Representation Transforms
Given two representations of the same abstract data type, any optimal program that incorporates one representation has a corresponding optimal program that incorporates the other. What is the field ...
1k views
### How to use Clarke and Wright saving algorithm to afford heterogeneous fleet?
I want to solve Heterogeneous fleet in vehicle routing problem using the Clarke and Wright saving algorithm. After reading many literature I found two options: Explicit and early assignment for the ...
150 views
### Amdahl “validity of the single processor approach”
The following is Figure 1 in Gene M. Amdahl's "Validity of the single processor approach to achieving large scale computing capabilities" (1967) (PDF): The text describes this as representing the ...
12 views
### Updating a dynamic web page
I am creating a dynamic web page that needs to check for updates every 30 or so seconds, at most. each call to get the data needed is async, taking ~300 ms. with over 300 elements on the page that ...
42 views
### Change the structure from 3SAT to 1in3 3SAT
There is a variable set V = {x1,x2,x3} and clause set C1={x1,x2,-x3} C2={x1,-x1,-x2} C3={-x1,-x2,x3} C4={x2,x3,-x3}. For this structure, no matter each variable is positive or negative, the clause can ... | 924 | 4,409 | {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.53125 | 3 | CC-MAIN-2020-16 | latest | en | 0.923573 |
https://www.assignmentexpert.com/homework-answers/chemistry/inorganic-chemistry/question-196700 | 1,623,972,595,000,000,000 | text/html | crawl-data/CC-MAIN-2021-25/segments/1623487634576.73/warc/CC-MAIN-20210617222646-20210618012646-00314.warc.gz | 606,290,489 | 288,880 | 99 829
Assignments Done
98.6%
Successfully Done
In June 2021
# Answer to Question #196700 in Inorganic Chemistry for ella decker
Question #196700
Which parameters determine the value of Δo? What is the difference between high spin and low spin complexes?
1
2021-05-24T07:19:35-0400
While studying the Crystal Field Theory I was told Dq
Dq is a unit, related to the unit Δ
O
ΔO by the relation Δ
O
=10 Dq
ΔO=10 Dq. But aren't Δ
O
ΔO and Dq
Dq variables, not units? The unit is of energy, such as eV
eV or Joules, these are symbols to represent a particular value of energy, which could be anything. So what do we mean when we say Δ
O
=10 Dq
ΔO=10 Dq? What exactly is Dq
Dq (I haven't been able to find this in any of my textbooks, they just either state this relation, or not at all) and are they actually units of energy?
Spiling energy have different coordination number have different energy .
High spin and low spin are two possible classifications of spin states that occur in coordination compounds. These classifications come from either the ligand field theory, which accounts for the energy differences between the orbitals for each respective geometry, or the crystal field theory, which accounts for the breaking of degenerate orbital states, compared to the pairing energy.
So, one electron is put into each of the five d orbitals before any pairing occurs in accord with Hund's rule resulting in what is known as a "high-spin" complex. Complexes such as this are called "high-spin" since populating the upper orbital avoids matches between electrons with opposite spin.
A low spin (or spin-paired) complex, such as [Co(NH3)6]3+ is one in which the electrons are paired up to give a maximum number of doubly occupied d orbitals and a minimum number of unpaired electrons. Usually inner orbital complexes (d2sp3) are low-spin (or spin paired) complexes.
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS! | 508 | 2,034 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.53125 | 3 | CC-MAIN-2021-25 | latest | en | 0.908763 |
https://www.jiskha.com/questions/560543/1-an-object-5-millimeters-high-is-located-15-millimeters-in-front-of-a-plane-mirror-how | 1,596,896,662,000,000,000 | text/html | crawl-data/CC-MAIN-2020-34/segments/1596439737883.59/warc/CC-MAIN-20200808135620-20200808165620-00306.warc.gz | 712,030,037 | 5,967 | science
1. An object 5 millimeters high is located 15 millimeters in front of a plane mirror. How far from the mirror is the image located?
A. 5.0 millimeters
B. 7.5 millimeters
C. 15 millimeters
D. 30 millimeters
1. 👍 0
2. 👎 0
3. 👁 200
1. C. Assuming a plane mirror.
1. 👍 0
2. 👎 0
2. 5.0millimeters
1. 👍 0
2. 👎 0
Similar Questions
1. physics
A concave spherical mirror has a radius of curvature 15 cm. A 1 cm tall bulb is placed in front of the mirror such that its image is formed 10 cm in front of the mirror. If you measure distance from the optic center of the mirror,
asked by ashley -- on April 17, 2011
2. math
The diameters of ball bearings produced in a manufacturing process can be described using a uniform distribution over the interval 2.5 to 8.5 millimeters. What is the probability that a randomly selected ball bearing has a
asked by j on September 18, 2010
3. Chemistry
Can anyone help and check my answers? A. 8.43 cm to millimeters--- 84.3 millimeters. B. 2.41x10^2 cm to meterss--- 0.0241 meters. C. 294.5 nm to centimeters--- I don't know how to concert this. D. 1.445x10^4 m to kilometers---
asked by Mandy on July 21, 2008
4. Science
1. A convex mirror with a focal length of -20cm forms an image 15cm behind the surface. If the object height is 1.2cm what is the image height? 2. An object is placed 10cm in front of a mirror and an image is formed that has a
asked by Lynette on July 26, 2011
1. Math
The layer of gold coating on a ring should be 0.03 millimeters thick when the ring is completed. A coating of 0.021 millimeters has already been applied. How many more millimeters of gold coating must be added to finish the ring?
asked by Jocelynn on December 19, 2015
2. physics
A convex spherical mirror has a focal length of -20 cm. An object is placed 30 cm in front of the mirror on the mirror's axis. Where is the image located? Answer 12 cm in front of the mirror 60 cm behind the mirror 60 cm in front
asked by shirly on March 17, 2014
3. Math
In a study of 800 men,diastolic blood pressure was found to be approximately normally distributed, with a mean of 84 millimeters (mm) of mercury and standard deviation of 10 millimeters. Use the 68-95-99.7% rule to determine what
asked by Joe on December 15, 2016
4. PreCalc
Consider the tip of each hand of a clock. Find the linear velocity in millimeters per second for each hand. a. second hand which is 30 millimeters. b. minute hand which is 27 millimeters long. c. hour hand which is 18 millimeters
asked by Joe on November 18, 2007
Here are the monsoon rains (in millimeters) for the 23 strong El Nino years between 1871 and 2004: 628 669 740 651 710 717 698 653 604 781 784 790 811 830 858 896 806 790 792 957 872 a. To make the stemplot of these rainfall
asked by Anil on January 14, 2013
2. physical science (light)
1. An object 5 millimeters high is located 15 millimeters in front of a plane mirror. How far from the mirror is the image located? A. 5.0 millimeters B. 7.5 millimeters C. 15 millimeters *** D. 30 millimeters 2. Which of the
asked by Mari on June 10, 2010
3. Physics
The image produced by a concave mirror is located 28 cm in front of the mirror. The focal length of the mirror is 14 cm. How far in front of the mirror is the object located? _________cm
asked by Mary on October 18, 2007
4. Physics
A concave spherical mirror has a radius of curvature 15 cm. A 1 cm tall bulb is placed in front of the mirror such that its image is formed 10 cm in front of the mirror what is the focal length position of object magnification of
asked by Deyonne on May 6, 2014 | 1,073 | 3,596 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3 | 3 | CC-MAIN-2020-34 | latest | en | 0.932732 |
https://edurev.in/course/quiz/attempt/-1_Important-Questions-Rational-Numbers/7d3e2f3c-cc98-4da7-b647-96c82beaf77d | 1,657,062,156,000,000,000 | text/html | crawl-data/CC-MAIN-2022-27/segments/1656104628307.87/warc/CC-MAIN-20220705205356-20220705235356-00590.warc.gz | 260,663,197 | 38,064 | # Important Questions: Rational Numbers
## 20 Questions MCQ Test Online MCQ Tests for Class 7 | Important Questions: Rational Numbers
Description
Attempt Important Questions: Rational Numbers | 20 questions in 20 minutes | Mock test for Class 7 preparation | Free important questions MCQ to study Online MCQ Tests for Class 7 for Class 7 Exam | Download free PDF with solutions
QUESTION: 1
### Which of the following is correct?
Solution:
Let us consider a fraction 3/5 and a rational number = 14/7
By definition, 3/5 is a rational number. So, p is true. By definition, -4/7 is not a fraction, since, −4 is not a natural number. So, q is false.
All fractions can be termed as rational numbers; however, all rational numbers cannot be termed as fractions. Only those rational numbers in which 'p' and 'q' are positive integers are termed as fractions.
QUESTION: 2
### Which of the following is not a rational number(s)?
Solution:
√2/3 is not a rational number.
because √2 doesn't have an exact value, and on further division by 3, it goes more unstable.
QUESTION: 3
### Which of the following statements is correct?
Solution:
Since, every integer having a denominator 1 can be expressed in P/q form, p is true. Since, a rational number with denominator other than 1 is not an integer (e.g., 3/5), q is false.
QUESTION: 4
What type of a number is −3/0 ?
Solution:
Since, denominator is 0, it is not a rational number.
QUESTION: 5
Which among the following is a rational number equivalent to 5/3?
Solution:
QUESTION: 6
What type of a numerator does 0/7 have?
Solution:
QUESTION: 7
Which of the following statements is true?
Solution:
-12/32 = -3*4/8*4 = -3/8
QUESTION: 8
If −4/7 = −32/x, what is the value of x?
Solution:
-4/7 = -32/X
X=32x7/4
X=56
QUESTION: 9
Which is the greatest?
Solution:
QUESTION: 10
Which is the correct descending order of −2, 4/−5, −11/20, 3/4?
Solution:
L.C.M. of 5, 4 and 20 is 20.
4/−5 × 4/4 = 16/−20;3/4 = 3×5/4×5 = 15/20
−2 < 4/−5 < −11/20 < 3/4
or
3/4 > −11/20 > 4/−5 > −2
is the required descending order.
Rewrite equivalent fractions of the given fractions and then compare then.
Arrange them in descending order.
QUESTION: 11
What is the average of the two middle rational numbers if 4/7,1/3,2/5 and 5/9 are arranged in ascending order?
Solution:
The ascending order of 4/7,1/3, 2/5 and 5/9 is 1/3<2/5<5/9<4/7. The two middle numbers are 2/5 and 5/9.
∴ Average = = 43/90
QUESTION: 12
What is the percentage of the least number in the greatest number of 3/5,9/5,1/5 and 7/5 ?
Solution:
The given numbers can be arranged in ascending order as1/5 < 3/5 < 7/5 < 9/5
The greatest number = 9/5;
The least number = 1/5
We have, 9/5 × x/100 = 1/5
⇒ x = 10/09 =
QUESTION: 13
What is the difference between the greatest and least numbers of 5/9,1/9 and 11/9 ?
Solution:
The ascending order of given numbers is 1/9,5/9,11/9.
∴ Required difference = 11/9 −1/9 = 10/9
QUESTION: 14
Which of the following pairs represent the same rational number?
Solution:
−24/15 is the equivalent rational number of −8/5.
QUESTION: 15
P: The quotient of two integers is always a rational number.
Q : 1/0 is not rational. Which of the following statements is true?
Solution:
Since, 1/0 is not rational, the quotient of two integers is not always rational.
QUESTION: 16
What is the result of 2 − 11/39 + 5/26?
Solution:
QUESTION: 17
Which is the equivalent of −143/21?
Solution:
QUESTION: 18
Of which property is −7/5 + (2/−11 + −13/25) = (−7/5 + 2/−11) + −13/25 an example?
Solution:
QUESTION: 19
Which of the following statements is correct?
Solution:
All the given statements are correct. Consider
4/5 [a] Since 4/5 + 0 = 4/5,, 1 is the additive identity of rational numbers. [b] Since
4/5 × 1= 4/5, is the multiplicative identity of rational numbers. [c] Since 0+0=0,
0 is the additive inverse of 0.
QUESTION: 20
The sum of two rational numbers is −3. If one of the numbers is −7/5, find the other number.
Solution:
Let x be the required number. So,
x+(−7/5) = −3
⇒ x = −3+7/5 = −1/5 + 7/5 = −8/5
Use Code STAYHOME200 and get INR 200 additional OFF Use Coupon Code | 1,334 | 4,149 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 4.28125 | 4 | CC-MAIN-2022-27 | latest | en | 0.896293 |
https://en.wikiversity.org/wiki/Stars/Radiative_dynamo | 1,723,032,108,000,000,000 | text/html | crawl-data/CC-MAIN-2024-33/segments/1722640694449.36/warc/CC-MAIN-20240807111957-20240807141957-00321.warc.gz | 174,879,193 | 74,706 | A radiative dynamo is "a dynamo taking place in the radiative layers"[1] of a star.
It is a theoretical construction to explain the magnetohydrodynamic properties of plasma occurring in the outer atmospheric layers of astronomical objects including stars. As such it is a part of theoretical stellar science and theoretical astrophysics.
## Antidynamos
An "antidynamo theorem is one of several results that restrict the type of magnetic fields that may be produced by dynamo action."[2]
No "axisymmetric magnetic field can be maintained through a self-sustaining dynamo action by an axially symmetric current."[3]
A "dipole, an axisymmetric magnetic field. These magnetic fields are self-sustained through fluid motion in the Sun or planets, with the necessary non symmetry for the planets deriving from the Coriolis force caused by their rapid rotation, and one cause of non-symmetry for the Sun being its differential rotation."[2]
Successful "dynamos do not possess a high degree of symmetry."[2]
## Disc dynamos
A disk generator "is a DC electrical generator comprising an electrically conductive disc or cylinder rotating in a plane perpendicular to a uniform static magnetic field. A potential difference is created between the center of the disc and the rim (or ends of the cylinder), the electrical polarity depending on the direction of rotation and the orientation of the field."[4]
Large "research generators can produce hundreds of volts, and some systems have multiple generators in series to produce an even larger voltage.[5] They are unusual in that they can source tremendous electric current, some more than a million amperes, because the homopolar generator can be made to have very low internal resistance."[4]
Then, in reverse, more than a million amperes as a current between the rim of a disc and the center creates a potential difference and rotates an electrically conductive disc in a plane perpendicular to form a uniform magnetic field.
"Since cosmical clouds of ionized gas are generally magnetized, their motion produces induced electric fields [..] For example the motion of the magnetized interplanetary plasma produces electric fields that are essential for the production of aurora and magnetic storms".[6]
The "rotation of a conductor in a magnetic field produces an electric field in the system at rest. This phenomenon is well known from laboratory experiments and is usually called 'homopolar ' or 'unipolar' induction."[6]
## Helioseismology
Helioseismology has shown that "[at] the tachocline [within the Sun,] the rotation abruptly changes to solid body rotation in the solar radiation zone.[7]"[8]
The Sun is a stellar example where a radiative dynamo is not occurring within its radiative zone.
## Magnetic dynamos
"An alternative to the radiative–dynamo model is that the magnetic field originates in the material that formed the star. If the protostellar cloud which forms a star is weakly magnetic, conservation of magnetic energy would result in a very strong main–sequence field. We call these fossil fields [...] In order for the fossil field model to work, the field must be able to survive the collapse of the protostellar cloud during the star formation process. The fossil field argument also relies on a stable field configuration being reached that would avoid destruction on main–sequence lifetimes. Certain stable configurations have been found [...] and simulations have suggested that arbitrary field configurations do relax to these stable states [...] However, simple field configurations are still subject to the same instabilities as the fields [...] generated by dynamo action, in particular the Tayler instability [...] the fossil field model predicts field evolution similar to that of the dynamo model [...] the fossil field strength has to be several orders of magnitude larger than the initial field in the case of a magnetic dynamo in order to reproduce the same final field. [...] a significant fraction of flux could survive [from the pre-main sequence] but only if the magnetic diffusivity was sufficiently low."[9]
## Planetary sciences
"According to dynamo theory, the [Earth's magnetic] field is generated within the molten outer core region where heat creates convection motions of conducting materials, generating electric currents. These in turn produce the Earth's magnetic field. The convection movements in the core are chaotic; the magnetic poles drift and periodically change alignment. This causes field reversals at irregular intervals averaging a few times every million years. The most recent reversal occurred approximately 700,000 years ago.[10][11]"[12]
## Minerals
"Radioactive potassium [...] appears also to be a substantial source of heat in the Earth's core"[13]
"Radioactive potassium, uranium and thorium are thought to be the three main sources of heat in the Earth's interior, aside from that generated by the formation of the planet. Together, the heat keeps the mantle actively churning and the core generating a protective magnetic field."[13]
Much "less potassium [occurs] in the Earth's crust and mantle than [is] expected based on the composition of rocky meteors that supposedly formed the Earth. If, as some have proposed, the missing potassium resides in the Earth's iron core, how did an element as light as potassium get there, especially since iron and potassium don't mix?"[13]
At "the high pressures and temperatures in the Earth's interior, potassium can form an alloy with iron never before observed. During the planet's formation, this potassium-iron alloy could have sunk to the core, depleting potassium in the overlying mantle and crust and providing a radioactive potassium heat source in addition to that supplied by uranium and thorium in the core."[13]
The "new alloy [is created] by squeezing iron and potassium between the tips of two diamonds [a diamond anvil] to temperatures and pressures characteristic of 600-700 kilometers below the surface - 2,500 degrees Celsius and nearly 4 million pounds per square inch, or a quarter of a million times atmospheric pressure."[13]
"Our new findings indicate that the core may contain as much as 1,200 parts per million potassium -just over one tenth of one percent."[14]
"This amount may seem small, and is comparable to the concentration of radioactive potassium naturally present in bananas. Combined over the entire mass of the Earth's core, however, it can be enough to provide one-fifth of the heat given off by the Earth."[14]
"With one experiment, Lee and Jeanloz demonstrated that potassium may be an important heat source for the geodynamo, provided a way out of some troublesome aspects of the core's thermal evolution, and further demonstrated that modern computational mineral physics not only complements experimental work, but that it can provide guidance to fruitful experimental explorations,"[15]
"More experiments need to be done to show that iron can actually pull potassium away from the silicate rocks that dominate in the Earth's mantle."[16]
"They proved it would be possible to dissolve potassium into liquid iron."[16]
"Modelers need heat, so this is one source, because the radiogenic isotope of potassium can produce heat and that can help power convection in the core and drive the magnetic field. They proved it could go in. What's important is how much is pulled out of the silicate. There's still work to be done."[16]
"If a significant amount of potassium does reside in the Earth's core, this would clear up a lingering question - why the ratio of potassium to uranium in stony meteorites (chondrites), which presumably coalesced to form the Earth, is eight times greater than the observed ratio in the Earth's crust. Though some geologists have asserted that the missing potassium resides in the core, there was no mechanism by which it could have reached the core. Other elements like oxygen and carbon form compounds or alloys with iron and presumably were dragged down by iron as it sank to the core. But at normal temperature and pressure, potassium does not associate with iron."[13]
"Early in Earth's history, the interior temperature and pressure would not have been high enough to make this alloy."[14]
"But as more and more meteorites piled on, the pressure and temperature would have increased to the point where this alloy could form."[14]
"The Earth is thought to have formed from the collision of many rocky asteroids, perhaps hundreds of kilometers in diameter, in the early solar system. As the proto-Earth gradually bulked up, continuing asteroid collisions and gravitational collapse kept the planet molten. Heavier elements - in particular iron - would have sunk to the core in 10 to 100 million years' time, carrying with it other elements that bind to iron."[13]
"Gradually, however, the Earth would have cooled off and become a dead rocky globe with a cold iron ball at the core if not for the continued release of heat by the decay of radioactive elements like potassium-40, uranium-238 and thorium-232, which have half-lives of 1.25 billion, 4 billion and 14 billion years, respectively. About one in every thousand potassium atoms is radioactive."[13]
"The heat generated in the core turns the iron into a convecting dynamo that maintains a magnetic field strong enough to shield the planet from the solar wind. This heat leaks out into the mantle, causing convection in the rock that moves crustal plates and fuels volcanoes."[13]
Pure "iron and pure potassium [combined] in a diamond anvil cell [that] squeezed the small sample to 26 gigapascals of pressure while heating the sample with a laser above 2,500 Kelvin (4,000 degrees Fahrenheit), which is above the melting points of both potassium and iron. [Repeat] six times in the high-intensity X-ray beams of two different accelerators - Lawrence Berkeley National Laboratory's Advanced Light Source and the Stanford Synchrotron Radiation Laboratory - to obtain X-ray diffraction images of the samples' internal structure. The images confirmed that potassium and iron had mixed evenly to form an alloy, much as iron and carbon mix to form steel alloy."[13]
"In the theoretical magma ocean of a proto-Earth, the pressure at a depth of 400-1,000 kilometers (270-670 miles) would be between 15 and 35 gigapascals and the temperature would be 2,200-3,000 Kelvin."[17]
"At these temperatures and pressures, the underlying physics changes and the electron density shifts, making potassium look more like iron."[17]
"At high pressure, the periodic table looks totally different."[17]
"The work by Lee and Jeanloz provides the first proof that potassium is indeed miscible in iron at high pressures and, perhaps as significantly, it further vindicates the computational physics that underlies the original prediction."[15]
"If it can be further demonstrated that potassium would enter iron in significant amounts in the presence of silicate minerals, conditions representative of likely core formation processes, then potassium could provide the extra heat needed to explain why the Earth's inner core hasn't frozen to as large a size as the thermal history of the core suggests it should."[15]
## Dynamo theory
Def. any conversion of mechanical energy into electrical energy and associated magnetic fields is called a dynamo.
Def. "a dynamo taking place in the radiative layers"[1] of a star, or other astronomical object, is called a radiative dynamo, or stellar radiative dynamo.
"[M]otions resulting from [a linear magnetohydrodynamic] instability act as a dynamo to sustain the magnetic field."[18] "Supersonic flows are initially generated by the Balbus-Hawley magnetic shear instability."[18]
A plasma with local magnetohydrodynamic instabilities creates mechanical turbulence, motion, or shear (a dynamo) which in turn generates or sustains the local magnetic field.
When this magnetohydrodynamic dynamo occurs between or within radiative layers, a radiative dynamo is operating.
"There are three requisites for a dynamo to [occur and subsequently] operate:"[19]
• An electrically conductive fluid medium [such as a plasma or liquid iron]
• [local magnetohydrodynamic instabilities]
• An ... energy source to [create the local magnetohydrodynamic instabilities and] to drive [mechanical turbulence, motion, or shear] within the fluid.
## Hydromagnetic dynamos
Magnetic induction may be represented by
${\displaystyle \nabla \cdot \mathbf {B} =0.}$
Conservation of mass is represented by
${\displaystyle \nabla \cdot \mathbf {u} =0.}$
Conservation of momentum is given by the Navier-Stokes equation:
${\displaystyle {\frac {D\mathbf {u} }{Dt}}=-\nabla p+\nu \nabla ^{2}\mathbf {u} +\rho '\mathbf {g} +2\mathbf {\Omega } \times \mathbf {u} +\mathbf {\Omega } \times \mathbf {\Omega } \times \mathbf {R} +\mathbf {J} \times \mathbf {B} ,}$
where ${\displaystyle \nu }$ is the kinematic viscosity, ${\displaystyle \rho '}$ is the density perturbation that provides buoyancy (for thermal convection ${\displaystyle \rho '=\alpha \Delta T}$, ${\displaystyle \Omega }$ is the rotation rate of the Earth, and ${\displaystyle \mathbf {J} }$ is the electrical current density.
For heat a transport equation is
${\displaystyle {\frac {\partial T}{\partial t}}=\kappa \nabla ^{2}T+\epsilon }$
"where T is temperature, ${\displaystyle \kappa =k/\rho c_{p}}$ is the thermal diffusivity with k thermal conductivity, ${\displaystyle c_{p}}$ heat capacity, and ${\displaystyle \rho }$ density, and ${\displaystyle \epsilon }$ is an optional heat source."[19]
"Often the pressure is the dynamic pressure, with the hydrostatic pressure and centripetal potential removed. These equations are then non-dimensionalized, introducing the non-dimensional parameters"[19]
${\displaystyle Ra={\frac {g\alpha TD^{3}}{\nu \kappa }},E={\frac {\nu }{\Omega D^{2}}},Pr={\frac {\nu }{\kappa }},Pm={\frac {\nu }{\eta }},}$
"where Ra is the Rayleigh number, E the Ekman number, Pr and Pm the Prandtl and magnetic Prandtl number. Magnetic field scaling is often in Elsasser number units ${\displaystyle B=(\rho \Omega /\sigma )^{1/2}}$."[19]
## Entities
"The proliferation of models has [...] created [...] different ways [to model] the core, [normalize] equations, [define] dimensionless parameters, [choose] boundary conditions, and [select] energy sources."[20]
The "major topics [are]"[20]
1. inset and evolution of convection,
2. character of the magnetic field generated, and
3. comparison with the observed geomagnetic field.
"Although there are large differences in the way that the simulations are defined, the magnetic fields that they generate have some surprising similarities. The fields are dominated by the axial dipole. In some models they are most strongly generated in shear layers near the upper and lower boundaries and near the tangent cylinder, an imaginary surface touching the inner core on its equator. Convection rolls occur within which a type of the α effect distorts the toroidal field lines to create poloidal magnetic field."[20]
Kinematic dynamo theory: "the boundary conditions defining the energy flow (e.g., an inhomogeneous heat flux or distribution of buoyancy sources) are very influential [...] They change the frequency and the mode of magnetic polarity reversals as well as the ratio in strengths of the dipole and nondipole moments."[20]
Polarity "reversals reminiscent of the paleomagnetically observed field reversals have already been simulated by some of the models [as have other] features such as drift of the field, its secular variation, and statistical properties of Gauss coefficients".[20]
White dwarfs whose primary spectral classification is DA have hydrogen-dominated atmospheres. They make up the majority (approximately 80%) of all observed white dwarfs.[21].
DA spectral type, having only hydrogen absorption lines in its spectrum, white dwarf material is initially plasma—a fluid composed of nuclei and electrons. "Helium is unquestionably absent from the atmospheres of ... DA stars, and [there is a] low metal abundance".[22]
"In a DA star the "radiative layer ... lies above the convective zone."[22]
Only a small number of white dwarfs have been examined for fields, and it has been estimated that at least 10% of white dwarfs have fields in excess of 1 million gauss (100 T).[23][24]
"[F]or radiative losses of the solar corona, it is meant the energy flux irradiated from the external atmosphere of the Sun (traditionally divided into chromosphere, transition region and corona), and, in particular, the processes of production of the radiation coming from the solar corona and transition region, where the plasma is optically-thin. On the contrary, in the chromosphere, where the temperature decreases from the photospheric value of 6000 K to the minimum of 4400 K, the optical depth is about 1, and the radiation is thermal."[25]
"The energy flux irradiated from the corona changes in active regions, in the quiet Sun and in coronal holes; actually, part of the energy is irradiated outwards, but approximatively the same amount of the energy flux is conducted back towards the chromosphere, through the steep transition region. In active regions the energy flux is about 107 erg cm−2sec−1, in the quiet Sun it is roughly 8 [x] 105 - 106 erg cm−2sec−1, and in coronal holes 5 [x] 105 - 8 [x] 105 erg cm−2sec−1, including the losses due to the solar wind.[26] The required power is a small fraction of the total flux irradiated from the Sun, but this energy is enough to maintain the plasma at the temperature of million degrees, since the density is very low and the processes of radiation are different from those occurring in the photosphere".[25]
Whether local magnetohydrodynamic instabilities are generating a dynamo or not, these outer layers are radiative and some form of radiative dynamo may be operating.
"Many coronal heating theories have been proposed,[27] but two theories have remained as the most likely candidates, wave heating and magnetic reconnection (or nanoflares).[28] Through most of the past 50 years, neither theory has been able to account for the extreme coronal temperatures."[29]
## Convective dynamos
"[T]he solar cycle, generally considered as the classical case of a convective dynamo process, is probably not driven by convective turbulence at all."[30]
"Models of rotationally–driven dynamos in stellar radiative zones have suggested that magnetohydrodynamic transport of angular momentum and chemical composition can dominate over the otherwise purely hydrodynamic processes."[9]
A "number of magnetic O and B stars have been discovered [...]. Combined with this, a number of chemically peculiar A and B stars (known as Ap and Bp stars respectively) with surface field strengths up to 20kG have been identified [...]. These large–scale fields tend to have simple geometries and there is debate over whether they arise from fossil fields present during a star’s formation [...] or from a rotationally–driven dynamo operating in the radiative zone of the star [...]."[9]
"In low–mass stars, where the outer region is convective, magnetic fields are expected to be formed in a strong shear layer at the base of the convection zone and then transported to the surface by convection and magnetic buoyancy [...]. In radiative zones there is no strong bulk motion to redistribute magnetic energy. In most dynamo models, magnetic flux is redistributed by magnetorotational turbulence [...]. This turbulence is also responsible for driving the generation of large–scale magnetic flux. This is the α-effect [...] which applies to both poloidal and toroidal components, although in rotating systems shear is generally more effective at producing toroidal field from the poloidal component and so the α–effect is needed for the poloidal field only. The toroidal field is instead maintained by the conversion of poloidal field into toroidal field by differential rotation. This is commonly referred to as an α–Ω dynamo"[9]
Magnetic "fields [may be able to] produce turbulent instabilities which dominate the transport of angular momentum. [...] The evolution of the angular momentum distribution and magnetic field strength have a significant effect on the final fate of a star and its ejecta. Apart from causing chemical mixing, sufficiently strong magnetic fields are expected to cause magnetic braking that results in the rapid spin down of rotating magnetic stars"[9]
The radiative α–Ω dynamo is "a magnetic model where the poloidal and toroidal components are evolved via advection–diffusion equations derived from the induction equation. [...] The magnetic field and angular momentum evolution are coupled by turbulent diffusivities, magnetic stresses and conversion of poloidal field into toroidal field by differential rotation. The dynamo is completed by regeneration of magnetic flux by a simple α–Ω dynamo."[9]
The "magnetic turbulence from the Tayler–instability [redistributes] angular momentum in radiative zones [... By solving] for the magnetic field and hence the Alfvén velocity independently [the associated turbulent diffusion coefficients are also derived] instead of treating [them] as a function of the rotation rate. [... The] magnetic diffusivity [is] η = Prm Dmag where Prm is the turbulent magnetic Prandtl number."[9]
The "dynamo efficiency is given by"[9]
${\displaystyle \alpha =\gamma {\frac {r\omega _{A}\Omega q}{N}},}$
where N is the relevant buoyancy frequency, ω2 is the Alfvén frequency, γ is an efficiency parameter, q = ∂(log Ω)/∂(log r), and Ω(r) is the differential rotation as a function of radius.[9]
"Strongly magnetic intermediate–mass stars typically have rotation rates much slower than other stars in their parent population (Mathys 2004). If the Alfvén radius, the radius at which the magnetic energy density is the same as the kinetic energy density in the stellar wind, is larger than the stellar radius then magnetic braking allows additional angular momentum to be carried away by the stellar wind."[9]
"Owing to the strong magnetically–induced turbulence, the toroidal field behaves roughly as BΦ ∝ r−3 and the poloidal field behaves as A ∝ r−2 so both are much stronger towards the core than at the surface of the star [...]. The toroidal field falls to zero within a very narrow region near the surface of the star to meet the boundary conditions. The strength of the toroidal field predicted is around nine orders of magnitude larger than the poloidal field. This is because the Ω–effect, the conversion of poloidal field into toroidal field by differential rotation, is much stronger than the α–effect which regenerates the poloidal field."[9]
The "surface value of the field [is taken] to be the strength of the toroidal field just below the boundary layer. [Taking] the poloidal field [as the surface field means] a larger value of γ to produce a stronger field. In this case the toroidal field is around six orders of magnitude larger than the poloidal field. So a surface poloidal field of 103 G would correspond to a toroidal field of 109 G just below the surface. The fields then increase by several orders of magnitude towards the core. Not only do these field strengths seem unreasonably energetic but also the magnetic stresses result in cores that are spinning near or above break–up velocity. However, spectropolarimetric observations have concluded that the large–scale structure of the external magnetic fields of massive stars are largely dipolar so there must be some mechanism for converting the toroidal field into poloidal field at the surface. It is likely that the stellar wind stretches the field lines in the radial direction, changing the toroidal field to a radial geometry as material is ejected from the stellar surface".[9]
"The transition between a strong [...] field and no field is sharpest in rapid rotators. This transition is caused by the interaction between hydrodynamic and magnetic turbulence. If [the kinetic Prandtl number] exceeds [the magnetic Prandtl number] for a sufficiently large region of the radiative envelope, the magnetic field decays exponentially and cannot be sustained by the dynamo."[9]
## Tayler-Spruit dynamos
The "[Tayler–Spruit dynamo mechanism (Spruit 2002)] asserts that pinch–type instabilities (Tayler 1973; Spruit 1999) arise in toroidal fields that drive magnetic turbulence that enforces solid–body rotation. The growth of instabilities is controlled by magnetic diffusion which ultimately determines the equilibrium strength of the field."[9]
"For stars more massive than around 15M the Kelvin–Helmholtz turbulence dominates over the magnetic turbulence and a stable field cannot be sustained by the dynamo."[9]
## Differential rotations
"Both the core and the radiative zone dynamo models involve a significant amount of differential rotation for the generation of a large-scale toroidal field."[1] But, "the buoyant rise time [for a magnetic field generated by a core dynamo] from the core can become much longer than the age of [OBA type stars] for weakly magnetized flux-tubes".[1]
"Magnetic fields can be created in stably stratified (non-convective) layers in a differentially rotating star. A magnetic instability in the toroidal field (wound up by differential rotation) replaces the role of convection in closing the field amplification loop."[30]
At right is a diagram of the internal rotation in the Sun, showing differential rotation in the outer convective region and almost uniform rotation in the central radiative region. The transition between these regions is called the tachocline.
"Until the advent of helioseismology, the study of wave oscillations in the Sun, very little was known about the internal rotation of the Sun. The differential profile of the surface was thought to extend into the solar interior as rotating cylinders of constant angular momentum.[31] Through helioseismology this is now known not to be the case and the rotation profile of the Sun has been found. On the surface the Sun rotates slowly at the poles and quickly at the equator. This profile extends on roughly radial lines through the solar convection zone to the interior. At the tachocline the rotation abruptly changes to solid body rotation in the solar radiation zone.[7]"[8]
## Electromagnetics
Albert "Einstein believed that there might be an asymmetry between the charges of the electron and proton so that the Earth's magnetic field would be produced by the entire Earth."[19]
"In the case of the Earth, the magnetic field is induced and constantly maintained by the convection of liquid iron in the outer core. A requirement for the induction of field is a rotating fluid. Rotation in the outer core is supplied by the Coriolis effect caused by the rotation of the Earth. The Coriolis force tends to organize fluid motions and electric currents into columns [...] aligned with the rotation axis. Induction or creation of magnetic field is described by the induction equation:
${\displaystyle {\frac {\partial \mathbf {B} }{\partial t}}=\eta \nabla ^{2}\mathbf {B} +\nabla \times (\mathbf {u} \times \mathbf {B} ),}$
where u is a velocity, B is the magnetic field, t is time, and ${\displaystyle \eta =1/\sigma \mu }$ is the magnetic diffusivity with ${\displaystyle \sigma }$ electrical conductivity and ${\displaystyle \mu }$ permeability. The ratio of the second term on the right hand side to the first term gives the Magnetic Reynolds number, a dimensionless ratio of advection of a magnetic field to diffusion."[19]
## Magnetohydrodynamic dynamos
A "magnetohydrodynamic dynamo in a rapidly rotating spherical shell [is modeled with] changing electrical resistivity. When resistivity is sufficiently small, total magnetic energy can grow more than ten times larger than total kinetic energy of convection motion which is driven by an unlimited external energy source. When resistivity is relatively large and magnetic energy is comparable or smaller than kinetic energy, the convection motion maintains its well‐organized structure. [...] when resistivity is small and magnetic energy becomes larger than kinetic energy, the well‐organized convection motion is highly irregular. The magnetic field is organized in two ways. One is the concentration of component parallel to the rotation axis and the other is the concentration of perpendicular component. The parallel component tends to be confined inside anticyclonic columnar convection cells, while the perpendicular component is confined outside convection cells."[32]
## X-rays
"A "saturation" limit in stellar activity marked by a maximum in X-ray surface flux is observed in the very rapidly rotating stars such as the young Pleiades dK stars and the very active RS CVn systems [... This] activity saturation cannot in itself explain why the active stars do not appear to show much long-term variability because such stars as the Hyades dwarfs [...] are not at the saturation limit. The lack of substantial long-term variability must set in at activity levels below the saturation level, or, in evolutionary terms, it must persist well beyond the point at which a young, rapidly rotating star spins down to below its saturated state."[33]
## Visuals
A shell dynamo is a dynamo of near-surface circulation (the shell) with the resulting shear-induced conversion of mechanical energy into electrical energy and associated magnetic fields. For example, meridional flow that is poleward near the surface of a photosphere is complemented with an equatorward super-flow deeper in the photosphere as a countercurrent.
Regarding "the stability of the dynamical behaviour of axisymmetric α2ω dynamo models in rotating spherical shells as well as spheres [...] the spherical dynamo models are more stable in the following senses:
1. [minimize] chaotic behaviour and
2. are robust with respect to changes in the functional form of α. [Yet]
3. are capable of producing chaotic behaviour for certain ranges of parameter values and
4. possess, in the combined "space" of parameters and boundary conditions, regions of complicated behaviours, [...] regimes in which small changes in either the dynamo parameters or the boundary conditions can drastically change the qualitative behaviour of the model."[34]
For an axisymmetric mean field dynamo, the "standard mean field dynamo equation [...] is of the form"
${\displaystyle {\frac {\partial \mathbf {B} }{\partial t}}=\nabla \times (\mathbf {u} \times \mathbf {B} +\alpha \mathbf {B} )-\nabla \times (\eta _{t}\nabla \times \mathbf {B} ),}$
where u is the mean velocity, ${\displaystyle \mathbf {B} }$ is the mean magnetic field, t is time. "The quantities α (giving rise to the α effect) and ηt (the turbulent magnetic diffusivity) appear in the process of parameterization of the second order correlations 〈u' x B'〉 between the fluctuations u' and B' by"[34]
${\displaystyle \langle \mathbf {u} '\times \mathbf {B} '\rangle =\alpha \mathbf {B} -\eta _{t}\nabla \times \mathbf {B} .}$
A "functional form for α [may be] given by"[34]
${\displaystyle \alpha ={\frac {\alpha _{0}cos(\theta )}{1+\mathbf {B} ^{2}}},}$
where "the exact functional (and in general precise tensorial) forms of α, and in principle also of ηt, are complicated and not well understood in the solar and stellar settings."[34]
The images at the top right of this lecture show the magnetic field lines of the poloidal field Bp and contours of the toroidal field Bt for a solution showing temporal chaos in an axisymmetric spherical shell dynamo.[34]
Shell dynamo models "for the solar convection zone with positive α - effect in the northern hemisphere [include] a meridional circulation which is directed equatorward at the bottom and poleward at the top of the convection zone [may have two] different rotation patterns"
1. a simple variation of the rotation rate with depth and
2. the rotation law as derived by helioseismology.[35]
"Dynamos in differentially rotating stars differ from those in stars that rotate rigidly because rotational shear generates a strong toroidal field and enforces an axisymmetric field geometry."[35]
"Helioseismology gives us detailed information about the internal rotation profiles apart from the well-known surface phenomenon of the equatorial acceleration of δΩ ≃ 0.06 per day. One finds super-rotation beneath the equator and sub-rotation beneath the poles. Close to the equatorial plane, the rotation rate is essentially constant on cylindrical surfaces, while close to the poles the surfaces of isorotation are rather disk-shaped."[35]
The "differential rotation [and] the meridional flow [...] influence the mean-field dynamo [...] This influence can be expected to be just a modification if its characteristic time-scale τdrift exceeds the (half-)cycle time τcyc of about 11 yr."[35] Bold added.
If "the drift is poleward at the bottom of the convection zone, the dynamo might fail to maintain a solar-type magnetic cycle. On the other hand, an equatorward directed meridional flow can produce the observed solar-type butterfly diagram even in the case that a circulation-free dynamo would produce an antisolar-type butterfly diagram. [The] phase relation between the toroidal and the radial field components [is] negative in the solar photosphere [...] It is almost impossible to explain this observation by virtue of an αΩ-dynamo and a rotation law with positive shear [This] situation is changed if meridional circulation is taken into account.".[35]
"For sufficiently small eddy magnetic diffusivity [...] the meridional flow [is] very powerful to change the properties of α2Ω-dynamos working in the convection zone rather than in the solar tachocline. For positive but uniform ∂Ω/∂r [...] the migration of the toroidal magnetic activity belts is strongly correlated with the amplitude of the circulation. If the circulation is equatorward at the bottom of the convection zone and its amplitude is sufficient then it can indeed turn a poleward drift into an equatorward drift [...] The resulting cycle times are always between 10 and 100 years [...] Another striking property of the circulation-dominated models is that they produce the observed opposite signs of the magnetic field components".[35]
If "the real internal rotation law from helioseismology is applied. The large negative slope ∂Ω/∂r in the polar regions unavoidably produces strong toroidal field belts at high latitudes. For these models stationary solutions are found much more frequently than those with cyclic behavior. An equatorward migration of the toroidal field belts (ca. 1 m/s at the bottom of the convective zone, [...] is only achieved in a very narrow range of flow amplitudes. That solution shows the correct cycle time and also the negativity of [the toroidal and poloidal fields]."[35]
## Oranges
"The Hyades dwarfs [...] do possess radiative cores, and based on the solar analogy, are presumably capable of generating solar-like large-scale fields."[33]
## Reds
Small-scale "magnetic fields can be generated in the solar convection zone, for example, by a turbulently driven dynamo. This "turbulent field" does not require rotation, although the generation rate increases with increasing rotation. [The] total energy stored in the turbulent field could be higher than that in the large-scale field. [... Low-mass] stars, which under conventioal dynamo theory are probably unable to generate a large-scale field due to the absence of the radiative core, should only have turbulent fields. The turbulent field theory (or the "distributive" dynamo [...]) is also particularly appealing since it might explain two important observational clues:"[33]
1. "the apparent lack of a change in coronal heating efficiency going from stars which have radiative cores to the fully convective M dwarfs [...]; and
2. an absence of long-term stellar cyclic X-ray variability by more than a factor of ~2 in all of the Hyades late-type dwarfs (including those with radiative cores) uncovered in the study of Einstein and ROSAT observations [...]."[33]
"Further support for the turbulently driven dynamo comes from the very recent ROSAT study of M dwarfs [...], the modeling of which suggests that the coronal geometry for low-mass dwarfs is dominated by relative compact loop configurations, and that the emission contribution of structures with large-scale dipolar or quadrapolar geometry is negligible."[33]
"The ROSAT, EUVE, and Ca II observations could all be explained if turbulent magnetic activity dominated over any large-scale field activity at the rotation rates typical of active dwarfs."[33]
The "most active M dwarfs should not exhibit cyclic activity."[33]
The "very low mass, fully convective stars do not have radiative cores, and the large-scale field dynamo does not operate. The magnetic activity of these stars is generated by a turbulently driven dynamo process [...] More massive stars with radiative cores generate solar-like large-scale magnetic fields through the operation of an αω type shell dynamo. [...] they also generate small-scale magnetic fields through the operation of a turbulently driven dynamo. In stars with radiative cores which have relatively high rotation rates, such as the fairly young Hyades dwarfs [...] the turbulent dynamo dominates, and well-defined activity cycles are not observed. As stars evolve and spin down from young, rapid rotators, their magnetic activity changes from a regime in which the turbulent dynamo dominates to one characterized by a solar-like large-scale field shell dynamo."[33]
## Liquid objects
"Tidal forces between celestial orbiting bodies causes friction that heats up the interiors of these orbiting bodies. This is known as tidal heating, and it helps create the liquid interior criteria, providing that this interior is conductive, that is required to produce a dynamo."[19]
## Nitrogens
There "exists a class of stars that are slowly rotating (v < 60 km s−1) but exhibit significant nitrogen enrichment. It was suggested that these stars are, or once were, magnetic stars. [...] those stars [...] with nitrogen enrichment 6.8 < log10[N/H] < 7.1 and 0 < v/km s−1 < 150 cannot easily be categorized into either group of stars. They may be low–mass, fast rotators that have been partially spun down by magnetic braking, low–mass stars that are born with slow rotation or high–mass stars that are born with slow rotation."[9]
"The [VLT–FLAMES] survey [of massive stars] observed two distinct populations of stars. The first shows increasing nitrogen enrichment with rotation rate, the second is a class of slow–rotating stars that exhibit unusually high nitrogen abundances compared to the rest of the population. This distribution of stars is well reproduced by the magnetic model."[9]
## Calciums
The "evidence from long-term Ca II emission core monitoring [...] shows that smooth solar-like cyclic variability is not generally observed in young (less than 1 Gyr) active dwarfs [...]. On shorter timescales, [...] no differences in EUV luminosity more than a factor of 2 in a sample of active stars when comparing EUVE survey fluxes to those derived from the ROSAT Wide Field Camera survey performed 2 yr earlier."[33]
## Sun
In the model shown at right the Sun and regions around it are labeled.
The Sun which is a rotating body may become a magnet due to a dynamo.[36]
"The core of the Sun is considered to extend from the center to about 0.2 to 0.25 solar radius.[37] It is the hottest part of the Sun and of the Solar System. It has a density of up to 150 g/cm³ (150 times the density of liquid water) and a temperature of close to 15,000,000 kelvin [15 MK] ... The core is made of hot, dense gas in the plasmic state. The core, inside 0.24 solar radius, generates 99% of the fusion power of the Sun."[38] It is in the core region that solar neutrinos may be produced.
"The radiation zone or radiative zone is a layer of a star's interior where energy is primarily transported toward the exterior by means of radiative diffusion, rather than by convection.[39] Energy travels through the radiation zone in the form of electromagnetic radiation as photons. Within the Sun, the radiation zone is located in the intermediate zone between the solar core at .2 of the Sun's radius and the outer convection zone at .71 of the Sun's radius.[39]"[40]
"Matter in a radiation zone is so dense that photons can travel only a short distance before they are absorbed or scattered by another particle, gradually shifting to longer wavelength as they do so. For this reason, it takes an average of 171,000 years for gamma rays from the core of the Sun to leave the radiation zone. Over this range, the temperature of the plasma drops from 15 million K near the core down to 1.5 million K at the base of the convection zone.[41]"[40]
"Within a radiative zone, the temperature gradient—the change in temperature (T) as a function of radius (r)—is given by:
${\displaystyle {\frac {{\text{d}}T(r)}{{\text{d}}r}}\ =\ -{\frac {3\kappa (r)\rho (r)L(r)}{(4\pi r^{2})(16\sigma )T^{3}(r)}}}$
where κ(r) is the opacity, ρ(r) is the matter density, L(r) is the luminosity, and σ is the Stefan–Boltzmann constant.[39] Hence the opacity (κ) and radiation flux (L) within a given layer of a star are important factors in determining how effective radiative diffusion is at transporting energy. A high opacity or high luminosity can cause a high temperature gradient, which results from a slow flow of energy. Those layers where convection is more effective than radiative diffusion at transporting energy, thereby creating a lower temperature gradient, will become convection zones.[42]"[40]
"The convection zone of a star is the range of radii in which energy is transported primarily by convection. ... Stellar convection consists of mass movement of plasma within the star which usually forms a circular convection current with the heated plasma ascending and the cooled plasma descending."[43] This is the granular zone in the outer layer of a star.
"The solar dynamo is the physical process that generates the Sun's magnetic field. The Sun is permeated by an overall dipole magnetic field, as are many other celestial bodies such as the Earth. The dipole field is produced by a circular electric current flowing deep within the star, following Ampère's law. The current is produced by shear (stretching of material) between different parts of the Sun that rotate at different rates, and the fact that the Sun itself is a very good electrical conductor (and therefore governed by the laws of magnetohydrodynamics)."[44]
"The tachocline ... is a thin layer of the solar interior, straddling the convection zone and the radiative interior. It is widely believed that a toroidal magnetic field of at least 105 G permeates this layer ... The tachocline naturally divides into two sublayers: an inner "radiative" layer and an outer "overshoot" layer. By current estimates, the radiative layer is twice as thick as the overshoot layer."[45]
The "radiative" layer of the tachocline may be a source for a radiative dynamo.
## Mercury
"This plot [at right] shows the measured magnitude of the magnetic field of Mercury as MESSENGER executed its first flyby of that planet. MESSENGER's Magnetometer (MAG) provided definitive identification of all boundaries of the Mercury magnetosphere system, consistent with the observations made with the Fast Imaging Plasma Spectrometer (FIPS) on the Energetic Particle and Plasma Spectrometer (EPPS) instrument, and revealed a much more quiescent system than was seen during the first Mariner 10 flyby. This state of the system was also consistent with the absence of energetic particles as documented by the Energetic Particle Spectrometer (EPS) portion of MESSENGER's EPPS instrument. Mercury lacks radiations belts similar to the Van Allen belts at the Earth discovered by James Van Allen with a simple particle experiment on Explorer I launched 50 years ago."[46]
Mercury, despite its small size, has a magnetic field [see image and plot at right], because it has a conductive liquid core created by its iron composition and friction resulting from its highly elliptical orbit.[19]
"Mercury’s core, already suspected to occupy a greater fraction of the planet's interior than do the cores of Earth, Venus, or Mars, is even larger than anticipated."[47]
The "elevation ranges on Mercury are much smaller than on Mars or the Moon and documents evidence that there have been large-scale changes to Mercury’s topography since the earliest phases of the planet’s geological history."[47]
“From Mercury’s extraordinarily dynamic magnetosphere and exosphere to the unexpectedly volatile-rich composition of its surface and interior, our inner planetary neighbor is now seen to be very different from what we imagined just a few years ago."[47]
"MESSENGER’s radio tracking has allowed the scientific team to develop the first precise model of Mercury’s gravity field which, when combined with topographic data and the planet’s spin state, sheds light on the planet’s internal structure, the thickness of its crust, the size and state of its core, and its tectonic and thermal history."[47]
"Mercury’s core occupies a large fraction of the planet, about 85% of the planetary radius, even larger than previous estimates. Because of the planet’s small size, at one time many scientists thought the interior should have cooled to the point that the core would be solid. However, subtle dynamical motions measured from Earth-based radar, combined with MESSENGER’s newly measured parameters of the gravity field and the characteristics of Mercury’s internal magnetic field that signify an active core dynamo, indicate that the planet’s core is at least partially liquid."[47]
"Mercury’s core is different from any other planetary core in the Solar System. Earth has a metallic, liquid outer core sitting above a solid inner core. Mercury appears to have a solid silicate crust and mantle overlying a solid, iron sulfide outer core layer, a deeper liquid core layer, and possibly a solid inner core. These results have implications for how Mercury’s magnetic field is generated and for understanding how the planet evolved thermally."[47]
"Energetic and magnetostrophic balance arguments show that a dynamo source for Mercury's observed magnetic field is problematic if one expects an Earth-like partitioning of toroidal and poloidal fields."[48]
But, a thin shell dynamo model is consistent with the observed weak magnetic field.[48]
From "the ratio of the dipole field at the core-mantle boundary to the toroidal field in the core for various shell thicknesses and Rayleigh numbers[...] some thin shell dynamos can produce magnetic fields with Mercury-like dipolar field intensities. In these dynamos, the toroidal field is produced more efficiently through differential rotation than the poloidal field is produced through upwellings interacting with the toroidal field. The poloidal field is also dominated by smaller-scale structure which was not observable by the Mariner 10 mission, compared to the dipole field."[48]
## Venus
"Venus and the Earth have similar radii and estimated bulk compositions, and both possess an iron core that is at least partially liquid. However, despite these similarities, Venus lacks an appreciable dipolar magnetic field."[49]
This "absence is due to Venus’s also lacking plate tectonics for the past 0.5 b.y. (1 b.y.=109 yr). The generation of a global magnetic field requires core convection, which in turn requires extraction of heat from the core into the overlying mantle. Plate tectonics cools the Earth’s mantle; on the basis of elastic thickness estimates and convection models, [...] the mantle temperature on Venus is currently increasing. This heating will reduce the heat flux out of the core to zero over ~1 b.y., halting core convection and magnetic field generation. If plate tectonics was operating on Venus prior to ca. 0.5 Ga, a magnetic field may also have existed. On Earth, the geodynamo may be a consequence of plate tectonics; this connection between near-surface processes and core magnetism may also be relevant to the generation of magnetic fields on Mars, Mercury and Ganymede."[49]
The lack of an appreciable Earth-like dipolar magnetic field "cannot be explained by the planet's slow rotation".[49]
In "the absence of plate tectonics, the mantle on Venus cannot cool rapidly enough to drive core convection and a geodynamo."[49]
"Planetary magnetic fields are produced by motion in a conductor, usually the planet’s iron core. Such motion may be due to either thermal convection or compositional convection, driven by core solidification".[49]
"The maximum heat flux that can be extracted from the core without thermal convection is given by"[49]
${\displaystyle F_{c}=k\alpha gT/C_{p},}$
"where k and α are the thermal conductivity and expansivity, g is the acceleration due to gravity, T is the core temperature, and Cp is the specific hear capacity. [...] Fc is in the range 11-30 mW·m-2. Thermal convection will cease if the heat being extracted from the core is less than Fc; in the absence of core solidification, the geodynamo will halt. Compositional convection may continue [...], but will certainly halt if the heat flux out of the core drops to zero or below (i.e., the core starts heating up). The rate at which the core loses heat is controlled by the temperature difference between core and mantle and, thus, on the rate at which the mantle is cooling".[49]
## Earth
The illustration at right is of the dynamo mechanism that creates the Earth's magnetic field: convection currents of magma in the Earth's outer core, driven by heat flow from the inner core, organized into rolls by the Coriolis force, creates circulating electric currents, which generate the magnetic field.[50]
As "the result of radioactive heating and chemical differentiation, the Earth's outer core is in a state of turbulent convection. This sets up a process that is a bit like a naturally occurring electrical generator, where the convective kinetic energy is converted to electrical and magnetic energy. Basically, the motion of the electrically conducting iron in the presence of the Earth's magnetic field induces electric currents. Those electric currents generate their own magnetic field, and as the result of this internal feedback, the process is self-sustaining so long as there is an energy source sufficient to maintain convection."[50]
The Earth's "magnetic field resulted from electric currents induced in the fluid outer core of the Earth."[19]
The Earth is magnetic and a dynamo may be generating the field.[51]
"The use of more realistic parameters in numerical geodynamo simulations tends to generate less Earth-like magnetic fields. This paradox could be resolved by considering uniform heat flux instead of uniform temperature at the core's surface."[52]
"Electrical currents produced by motions in the Earth's fluid outer core are thought to be responsible for the planet's magnetic field."[52]
"The Earth's main magnetic field is thought to be generated by motions in the planet's fluid outer core, which lead to an effect similar to that of a dynamo. Recent high-resolution numerical simulations produce only a non-dipolar or a dipolar but comparatively weak magnetic field unlike that of the Earth. Older models that did generate a strong, Earth-like field needed to use unrealistically high viscosities for the core fluid. Common to most of the models is the assumption of a laterally uniform core-surface temperature."[53]
A "low-viscosity geodynamo model [used] to evaluate the effect of a different and more realistic boundary condition-a uniform heat flux at the surface of the core-on the simulation of an Earth-like magnetic field [shows] that when the surface temperature is laterally uniform, only a weak magnetic field is generated because planetary-scale fluid circulations are suppressed. In contrast, a laterally uniform heat flux at the core's surface leads to large-scale convective flows, and a comparatively strong dipole-type magnetic field."[53]
The "dipole, which comprises much of the Earth's magnetic field and is misaligned along the rotation axis by 11.3 degrees, was caused by permanent magnetization of the materials in the earth. This means that dynamo theory was originally used to explain the Sun's magnetic field in its relationship with that of the Earth."[19]
## Moon
"The "geodynamo" that generates Earth's magnetic field is powered by heat from the inner core, which drives complex fluid motions in the molten iron of the outer core. But the moon is too small to support that type of dynamo."[54]
"This is a very different way of powering a dynamo that involves physical stirring, like stirring a bowl with a giant spoon."[55]
"Early in its history, the moon orbited the Earth at a much closer distance than it does today, and it continues to gradually recede from the Earth. At close distances, tidal interactions between the Earth and the moon caused the moon's mantle to rotate slightly differently than the core. This differential motion of the mantle relative to the core stirred the liquid core, creating fluid motions that, in theory, could give rise to a magnetic dynamo."[54]
"The moon wobbles a bit as it spins--that's called precession--but the core is liquid, and it doesn't do exactly the same precession. So the mantle is moving back and forth across the core, and that stirs up the core."[56]
A "lunar dynamo could have operated in this way for at least a billion years. Eventually, however, it would have stopped working as the moon got farther away from the Earth."[54]
"The further out the moon moves, the slower the stirring, and at a certain point the lunar dynamo shuts off."[55]
"Rocks can become magnetized from the shock of an impact, a mechanism some scientists have proposed to explain the magnetization of lunar samples. But recent paleomagnetic analyses of moon rocks, as well as orbital measurements of the magnetization of the lunar crust, suggest that there was a strong, long-lived magnetic field on the moon early in its history."[54]
"One of the nice things about our model is that it explains how a lunar dynamo could have lasted for a billion years."[56]
"It also makes predictions about how the strength of the field should have changed over the years, and that's potentially testable with enough paleomagnetic observations."[56]
"Only certain types of fluid motions give rise to magnetic dynamos."[55]
"We calculated the power that's available to drive the dynamo and the magnetic field strengths that could be generated. But we really need the dynamo experts to take this model to the next level of detail and see if it works."[55]
## Mars
"Mars once underwent plate tectonics, slow movement of the planet's crust, like the present-day Earth. A new map of Mars' magnetic field [at the right] made by the Mars Global Surveyor spacecraft reveals a world whose history was shaped by great crustal plates being pulled apart or smashed together."[57]
Initial "observations [in 1999], also done with the Mars Global Surveyor’s magnetometer, covered only one region in the Southern Hemisphere. The data was taken while the spacecraft performed an aerobraking maneuver, and so came from differing heights above the crust."[57]
"This high resolution magnetic field map, the first of its kind, covers the entire surface of Mars. The new map is based on four years of data taken in a constant orbit. Each region on the surface has been sampled many times."[57]
“The more measurements we obtain, the more accuracy, and spatial resolution, we achieve."[58]
"This map lends support to and expands on the 1999 results."[59]
“Where the earlier data showed a "striping" of the magnetic field in one region, the new map finds striping elsewhere. More importantly, the new map shows evidence of features, transform faults, that are a "tell-tale" of plate tectonics on Earth."[59]
On "Mars the direction of the magnetic field changes dramatically from place to place."[57]
Similar "stripes in the crustal magnetic field on Earth. Stripes form whenever two plates are being pushed apart by molten rock coming up from the mantle, such as along the Mid-Atlantic Ridge. As the plate spreads and cools, it becomes magnetized in the direction of the Earth’s strong global field. Since Earth’s global field changes direction a few times every million years, on average, a flow that cools in one period will be magnetized in a different direction than a later flow. As the new crust is pushed out and away from the ridge, stripes of alternating magnetic fields aligned with the ridge axis develop. Transform faults, identified by “shifts” in the magnetic pattern, occur only in association with spreading centers."[57]
"Plate tectonics provides a unifying framework to explain several Martian features. First, there is the magnetic pattern itself. Second, the Tharsis volcanoes lie along a straight line. These formations could have formed from the motion of a crustal plate over a fixed “hotspot” in the mantle below, just as the Hawaiian islands on Earth are thought to have formed. Third, the Valles Marineris, a large canyon six times as long as the Grand Canyon and eight times as deep, looks just like a rift formed on Earth by a plate being pulled apart. Even more, it is oriented just as one would expect from plate motions implied by the magnetic map."[58]
Plate "tectonics does give us a consistent explanation of some of the most prominent features on Mars.”[60]
## Jupiter
"The interior of Jupiter is the seat of a strong dynamo that produces a surface magnetic field in the equatorial region with an intensity of ~ 4 Gauss. This strong magnetic field and Jupiter’s fast rotation (rotation period ~ 9 h 55 min) create a unique magnetosphere in the solar system which is known for its immense size (average subsolar magnetopause distance 45-100 RJ where 1 RJ = 71492 km is the radius of Jupiter) and fast rotation [...]. Jupiter’s magnetosphere differs from most other magnetospheres in the fact that it derives much of its plasma internally from Jupiter’s moon Io. The heavy plasma, consisting principally of various charge states of S and O, inflates the magnetosphere from the combined actions of centrifugal force and thermal pressure."[61]
In "the absence of an internal heavy plasma, the dipole field would balance the average dynamic pressure of the solar wind (0.08 nPa) at a distance of ~ 42 RJ in the subsolar region [...] the observed average magnetopause location of ~ 75 RJ [...] The heavy plasma is also responsible for generating an azimuthal current exceeding 160 MA in the equatorial region of Jupiter’s magnetosphere where it is confined to a thin current sheet (half thickness ~ 2 RJ in the dawn sector)."[61]
"The energization of plasma by various electrical fields as it diffuses inwards is responsible for the creation of radiation belts in the inner magnetosphere of Jupiter. It is believed that the radial diffusion is driven by the ionospheric dynamo fields produced by winds in Jupiter’s atmosphere"[61]
"In situ and remote observations of Io and its surroundings from Voyager showed that Io is the main source of plasma in Jupiter’s magnetosphere [...] "[61]
"It is estimated that upward of 6 × 1029 amu/s (~ 1 ton/s) of plasma mass is added to the magnetosphere by Io. The picked-up plasma consists mostly of various charged states of S and O and populates a torus region extending from a radial distance of ~ 5.2 RJ to ~ 10 RJ."[61]
"The next most important source of plasma in Jupiter’s magnetosphere is the solar wind whose source strength can be estimated by a consideration of the solar wind mass flux incident on Jupiter’s magnetopause and the fractional amount that makes it into the magnetosphere (< 1%). Such a calculation suggests that the solar wind source strength is < 100 kg/s (Hill et al. 1983) considerably lower than the Io source. Nevertheless, the number density of protons (as opposed to the mass density) may be comparable to the iogenic plasma number density in the middle and outer magnetospheres where the solar wind may be able to gain access to the magnetosphere."[61]
"The escape of ions (mainly H+ and H2+ ) from the ionosphere of Jupiter provides the next significant source of plasma in Jupiter’s magnetosphere. The ionospheric plasma escapes along field lines when the gravity of Jupiter is not able to contain the hot plasma (~ 10 eV and above). The escape however is not uniform and depends on the local photoelectron density, the temperature variations of the ionosphere with the solar zenith angle, other factors such as the auroral precipitation of ions and electrons and the ionospheric heating from Pedersen currents. In situ measurements show that in Io’s torus, protons contribute to less than 20% of total ion number density and constitute < 1% of mass suggesting that the ionosphere is not a major source of plasma in Jupiter’s magnetosphere. [The] ionospheric source strength [is] in the range of ~ 20 kg/s."[61]
The "surface sputtering of the three icy satellites by jovian plasma provides the last significant source of plasma in Jupiter’s magnetosphere. Because the icy moons lack extended atmospheres and the fluxes of the incident plasma are low at the locations of these moons, the total pickup of plasma from these satellites is estimated to be less than 20 kg/s based on the plasma sputtering rates provided".[61]
"Other minor constituents found in the torus [...] were Na+ (with an abundance of < 5%) and molecular ions SO+ and SO2+ (both with abundances of < 1% of the total). The average mass of a torus ion is ~ 20 and the average fractional charge on an ion is ~ 1.2 [...]. The bulk velocity of the plasma was found to be ~ 75 km/s, close to the corotational value."[61]
## Io
Io has enough tidal heating to liquify its inner core, even if the moon is not conductive enough to support a dynamo.[19]
The "orbital and gravitational relationships between Io, its sister moons Europa and Ganymede, and Jupiter cause massive, rapid flexing of its rocky crust. These tidal flexures generate tremendous heat within Io’s interior, which is released through the many surface volcanoes observed."[62]
“Io has no impact craters; it is the only object in the Solar System where we have not seen any impact craters, testifying to Io’s very active volcanic resurfacing.”[63]
"Io is extremely active, with literally hundreds of volcanic sources on its surface. Interestingly, although Io is so volcanically active, more than 25 times more volcanically active than Earth, most of the long-term surface changes resulting from volcanism are restricted to less than 15 percent of the surface, mostly in the form of changes in lava flow fields or within paterae."[62]
“Our mapping has determined that most of the active hot spots occur in paterae, which cover less than 3 percent of Io’s surface. Lava flow fields cover approximately 28 percent of the surface, but contain only 31 percent of hot spots.”[63]
“Understanding the geographical distribution of these features and hot spots, as identified through this map, are enabling better models of Io’s interior processes to be developed.”[63]
With "a diameter only slightly more than 300 miles, Enceladus just doesn’t have the bulk needed for its interior to stay warm enough to maintain liquid water underground."[64]
"With temperatures around 324 degrees below zero Fahrenheit, the surface of Enceladus is indeed frozen. However, in 2005 NASA's Cassini spacecraft discovered a giant plume of water gushing from cracks in the surface over the moon's south pole, indicating that there was a reservoir of water beneath the ice. Analysis of the plume by Cassini revealed that the water is salty, indicating the reservoir is large, perhaps even a global subsurface ocean. Scientists estimate from the Cassini data that the south polar heating is equivalent to a continuous release of about 13 billion watts of energy."[64]
"To explain this mysterious warmth, some scientists invoke radiation coupled with tidal heating. As it formed, Enceladus (like all solar system objects) incorporated matter from the cloud of gas and dust left over from our sun’s formation. In the outer solar system, as Enceladus formed it grew as ice and rock coalesced. If Enceladus was able to gather greater amounts of rock, which contained radioactive elements, enough heat could have been generated by the decay of the radioactive elements in its interior to melt the body."[64]
"Enceladus' orbit around Saturn is slightly oval-shaped. As it travels around Saturn, Enceladus moves closer in and then farther away. When Enceladus is closer to Saturn, it feels a stronger gravitational pull from the planet than when it is farther away. Like gently squeezing a rubber ball slightly deforms its shape, the fluctuating gravitational tug on Enceladus causes it to flex slightly. The flexing, called gravitational tidal forcing, generates heat from friction deep within Enceladus."[64]
"The gravitational tides also produce stress that cracks the surface ice in certain regions, like the south pole, and may be reworking those cracks daily. Tidal stress can pull these cracks open and closed while shearing them back and forth. As they open and close, the sides of the south polar cracks move as much as a few feet, and they slide against each other by up to a few feet as well. This movement also generates friction, which (like vigorously rubbing your hands together) releases extra heat at the surface at locations that should be predictable with our understanding of tidal stress."[64]
"To test the tidal heating theory, scientists with the Cassini team created a map of the gravitational tidal stress on the moon's icy crust and compared it to a map of the warm zones created using Cassini's composite infrared spectrometer instrument (CIRS). Assuming the greatest stress is where the most friction occurs, and therefore where the most heat is released, areas with the most stress should overlap the warmest zones on the CIRS map."[64]
"However, they don't exactly match."[65]
"For example, in the fissure called the Damascus Sulcus, the area experiencing the greatest amount of shearing is about 50 kilometers (about 31 miles) from the zone of greatest heat."[65]
"Enceladus' wobble, technically called "libration," is barely noticeable."[64]
"Cassini observations have ruled out a wobble greater than about 2 degrees with respect to Enceladus' uniform rotation rate."[65]
A "computer simulation [...] made maps of the surface stress on Enceladus for various wobbles, and found a range where the areas of greatest stress line up better with the observed warmest zones."[64]
"Depending on whether the wobble moves with or against the movement of Saturn in Enceladus' sky, a wobble ranging from 2 degrees down to 0.75 degrees produces the best fit to the observed warmest zones,"[65]
"The wobble also helps with the heating conundrum by generating about five times more heat in Enceladus’ interior than tidal stress alone, and the extra heat makes it likely that Enceladus' ocean could be long-lived, according to Hurford. This is significant in the search for life, because life requires a stable environment to develop."[64]
"The wobble is probably caused by Enceladus' uneven shape."[64]
"Enceladus is not completely spherical, so as it moves in its orbit, the pull of Saturn's gravity generates a net torque that forces the moon to wobble." [65]
"Enceladus' orbit is kept oval-shaped, maintaining the tidal stress, because of the gravitational tug from a neighboring larger moon Dione. Dione is farther away from Saturn than Enceladus, so it takes longer to complete its orbit. For every orbit Dione completes, Enceladus finishes two orbits, producing a regular alignment that pulls Enceladus' orbit into an oval shape."[64]
## Uranus
"The discovery of [Uranus]'s non-dipolar, non-axisymmetric magnetic [field at the right] destroyed the picture-established by Earth, Jupiter and Saturn-that planetary magnetic fields are dominated by axial dipoles."[66]
"Planetary magnetic fields are generated by complex fluid motions in electrically conducting regions of the planets (a process known as dynamo action), and so are intimately linked to the structure and evolution of planetary interiors."[66]
Three-dimensional "numerical dynamo simulations [...] model the dynamo source region as a convecting thin shell surrounding a stably stratified fluid interior."[66]
This "convective-region geometry produces magnetic fields similar in morphology to [that] of Uranus [The field is] non-dipolar and non-axisymmetric, and [results] from a combination of the stable fluid's response to electromagnetic stress and the small length scales imposed by the thin shell."[66]
The planet had "a strong planetary magnetic field of Uranus and an associated magnetosphere and fully developed bipolar magnetotail [and a] detached bow shock wave [which] was observed upstream at 23.7 Uranus radii (1 RU = 25,600 km) and the magnetopause boundary at 18.0 RU. [The] maximum magnetic field of 413 nanotesla was observed at 4.19 RU [The] planetary magnetic field is well represented by that of a dipole offset from the center of the planet by 0.3 RU. The angle between Uranus' angular momentum vector and the dipole moment vector has the surprisingly large value of 60 degrees. [The] field of Uranus may be described as that of an oblique rotator. The dipole moment of 0.23 gauss R3U, combined with the large spatial offset, leads to minimum and maximum magnetic fields on the surface of the planet of approximately 0.1-1.1 gauss. The rotation period of the magnetic field and [that] of the interior of the planet is estimated to be 17.29±0.10 [hr]."[67]
## Neptune
"The discovery of [Neptune]'s non-dipolar, non-axisymmetric magnetic [field contributes to destroying] the picture-established by Earth, Jupiter and Saturn-that planetary magnetic fields are dominated by axial dipoles."[66]
The "convective-region geometry produces magnetic fields similar in morphology to [that of] Neptune. [The field is] non-dipolar and non-axisymmetric, and [results] from a combination of the stable fluid's response to electromagnetic stress and the small length scales imposed by the thin shell."[66]
The "rotation axis of [Neptune] is inclined by only 29° to the orbital plane [...] The magnetic dipole axis of Neptune is tilted at an angle of 47° to the spin axis of the planet. The extrapolated near-equatorial surface field is 1.42 µT, corresponding to a magnetic moment (equatorial surface field times radius cubed) of 2.16 x 1017 Tm3 close to 27 times greater than the terrestrial magnetic moment. The quadrupole moment if Neptune is quite large and makes a greater contribution to the surface magnetic field than at any other planet. The most forward portion of the magnetopause is estimated to lie on average at about 26 Neptunian radii in front of the planet, and of the bow shock at about 34 Neptune radii."[68]
## Brown dwarfs
"Stars with masses M > 0.3 M have an outer convective zone and an interior radiative region that need not be rotating at the same rate. A poloidal magnetic field in the convective layers will be stretched and amplified into strong toroidal fields when it is dragged by convective overshoot ... into the radial shear in rotation that resides at the boundary (in and near the so-called "tachocline" ... For less massive stars and young brown dwarfs, the energy is transported throughout the star by convection; no radiative core is present. For this reason, it has been supposed that the activity and its dependence on rotation might change near the spectral type where the radiative layer disappears (about M5.5)"[69]
## Giant stars
Notation: let the symbol AGB indicate an asymptotic giant branch star with a hydrogen-exhausted core.
Notation: let the symbol E-AGB indicate an AGB star with a hydrogen-exhausted core.
For a 7 M AGB model sequence, "[o]n the E-AGB, the convective envelope appears clearly separated from the stellar core by a radiative layer ... Density and temperature drop significantly within this layer".[70] "As evolution proceeds luminosity and radiation pressure increase ... The base of the convective envelope moves inwards into deeper and hotter parts of the interior until nuclear reactions become important ... just before the first thermal pulse ..., the radiative "buffer" layer disappears, and the convection cuts into the hydrogen-burning shell. ... high lithium abundances ... in ... oxygen rich, luminous (Mbol = -6.2... -6.8) AGB stars [are produced at the base of the convective envelope which] has a base temperature of 75 ˑ 106K, sufficient to reduce the duration of the Li-rich phase well below 104yrs".[70]
## Hypotheses
1. The magnetic field of the solar surface is being generated by direct electron incidence.
## References
1. P. Petit; F. Lignières; G.A. Wade; M. Aurière; T. Böhm; S. Bagnulo; B. Dintrans; A. Fumel et al. (November-December 2010). "The rapid rotation and complex magnetic field geometry of Vega". Astronomy and Astrophysics 523 (11): A41-9. doi:10.1051/0004-6361/201015307. Retrieved 2011-12-19.
2. "Antidynamo theorem title, In: Wikipedia". San Francisco, California: Wikimedia Foundation, Inc. 29 March 2014. Retrieved 2014-03-29.
3. { {cite journal |title=The Magnetic Field of Sunspots |author=T. G. Cowling |journal=Monthly Notices of the Royal Astronomical Society |volume=94 |pages=39–48 |year=1934 }}
4. "Homopolar generator, In: Wikipedia". San Francisco, California: Wikimedia Foundation, Inc. December 27, 2013. Retrieved 2014-03-29.
5. Losty, H.H.W & Lewis, D.L. (1973) Homopolar Machines. Philosophical Transactions for the Royal Society of London. Series A, Mathematical and Physical Sciences. 275 (1248), 69-75
6. Hannes Alfvén and Carl-Gunne Fälthammar, Cosmical Electrodynamics (1963) 2nd Edition, Oxford University Press. See sec. 1.3.1. Induced electric field in uniformly moving matter.
7. Jørgen Christensen-Dalsgaard; M. J. Thompson (2007). The Solar Tachocline:Observational results and issues concerning the tachocline. Cambridge University Press. pp. 53–86.
8. "Solar rotation, In: Wikipedia". San Francisco, California: Wikimedia Foundation, Inc. November 10, 2012. Retrieved 2012-11-16.
9. Adrian T. Potter; Shashikumar M. Chitre; Christopher A. Tout (August 11, 2012). "Stellar evolution of massive stars with a radiative α–Ω dynamo". Monthly Notices of the Royal Astronomical Society 424 (3): 2358-70. doi:10.1111/j.1365-2966.2012.21409.x. Retrieved 2014-03-27.
10. Richard Fitzpatrick (2006-02-16). "MHD dynamo theory". NASA WMAP. Retrieved 2007-02-27.
11. Wallace Hall Campbell (2003). Introduction to Geomagnetic Fields. New York: Cambridge University Press. p. 57. ISBN 0-521-82206-8.
12. "Earth, In: Wikipedia". San Francisco, California: Wikimedia Foundation, Inc. July 24, 2013. Retrieved 2013-07-25.
13. Robert Sanders (December 10, 2003). "Radioactive potassium may be major heat source in Earth's core". Berkeley, Californis USA: University of California Berkeley. Retrieved 2014-03-28.
14. Kanani Lee (December 10, 2003). "Radioactive potassium may be major heat source in Earth's core". Berkeley, Californis USA: University of California Berkeley. Retrieved 2014-03-28.
15. Mark Bukowinski (December 10, 2003). "Radioactive potassium may be major heat source in Earth's core". Berkeley, Californis USA: University of California Berkeley. Retrieved 2014-03-28.
16. Bruce Buffett (December 10, 2003). "Radioactive potassium may be major heat source in Earth's core". Berkeley, Californis USA: University of California Berkeley. Retrieved 2014-03-28.
17. Raymond Jeanloz (December 10, 2003). "Radioactive potassium may be major heat source in Earth's core". Berkeley, Californis USA: University of California Berkeley. Retrieved 2014-03-28.
18. Axel Brandenburg; Åke Nordlund; Robert F. Stein; Ulf Torkelsson (June 1995). "Dynamo-generated Turbulence and Large-Scale Magnetic Fields in a Keplerian Shear Flow". The Astrophysical Journal 446 (6): 741-54. doi:10.1086/175831.
19. "Dynamo theory, In: Wikipedia". San Francisco, California: Wikimedia Foundation, Inc. July 18, 2013. Retrieved 2013-07-25.
20. Masaru Kono; Paul H. Roberts (2002). "Recent geodynamo simulations and observations of the geomagnetic field". Reviews of Geophysics 40 (4): 1–53. doi:10.1029/2000RG000102.
21. G. Fontaine, F. Wesemael (2001). "White dwarfs". In P. Murdin. Encyclopedia of Astronomy and Astrophysics. IOP Publishing/Nature Publishing Group. ISBN 0-333-75088-8.
22. H. L. Shipman (April 1977). "Masses, radii, and model atmospheres for cool white-dwarf stars". The Astrophysical Journal 213 (4): 138-44. doi:10.1086/155138.
23. S. Jordan; R. Aznar Cuadrado; R. Napiwotzki; H. M. Schmid; S. K. Solanki (2007). "The fraction of DA white dwarfs with kilo-Gauss magnetic fields". Astronomy and Astrophysics 462 (3): 1097. doi:10.1051/0004-6361:20066163.
24. James Liebert; P. Bergeron; J. B. Holberg (2003). "The True Incidence of Magnetism Among Field White Dwarfs". The Astronomical Journal 125: 348. doi:10.1086/345573.
25. "Coronal radiative losses, In: Wikipedia". San Francisco, California: Wikimedia Foundation, Inc. March 21, 2013. Retrieved 2013-07-26.
26. George L. Withbroe (1988). "The temperature structure, mass, and energy flow in the corona and inner solar wind". The Astrophysical Journal 325: 442–67. doi:10.1086/166015.
27. Peter Ulmshneider (1997). Heating of Chromospheres and Coronae in Space Solar Physics, Proceedings, Orsay, France, edited by J.C. Vial, K. Bocchialini and P. Boumier. Springer. pp. 77–106. ISBN 3-540-64307-9.
28. F. Malara, M. Velli (2001). Observations and Models of Coronal Heating in Recent Insights into the Physics of the Sun and Heliosphere: Highlights from SOHO and Other Space Missions, Proceedings of IAU Symposium 203, edited by Pål Brekke, Bernhard Fleck, and Joseph B. Gurman. Astronomical Society of the Pacific. pp. 456–66. ISBN 1-58381-069-2.
29. "Corona, In: Wikipedia". San Francisco, California: Wikimedia Foundation, Inc. June 27, 2013. Retrieved 2013-07-10.
30. H. C. Spruit (January 2002). "Dynamo action by differential rotation in a stably stratified stellar interior". Astronomy and Astrophysics 381 (3): 923-32. doi:10.1051/0004-6361:20011465.
31. Glatzmaler, G. A (1985). "Numerical simulations of stellar convective dynamos III. At the base of the convection zone". Solar Physics 125: 1–12.
32. Akira Kageyama; Tetsuya Sato; the Complexity Simulation Group (1995). "Computer simulation of a magnetohydrodynamic dynamo. II". Physics of Plasmas (1994-present) 2 (5): 1421. doi:10.1063/1.871485. Retrieved 2014-03-29.
33. Jeremy J. Drake; Robert A. Stern; Guy S. Stringfellow; Mihalis Mathioudakis; J. Martin Laming; David L. Lambert (October 1, 1996). "Detection of Quiescent Extreme Ultraviolet Emission from the Very Low Mass Dwarf van Biesbroeck 8: Evidence for a Turbulent Field Dynamo". The Astrophysical Journal 469 (10): 828-33. doi:10.1086/177830. Retrieved 2014-03-28.
34. R. Tavakol; A. S. Tworkowski; A. Brandenburg; D. Moss; D. I. Tuominen (April 1995). "Structural stability of axisymmetric dynamo models". Astronomy and Astrophysics 296 (4): 269-74. Retrieved 2014-03-29.
35. M. Küker; G. Rüdiger; M. Schultz (July 2001). "Circulation-dominated solar shell dynamo models with positive alpha-effect". Astronomy and Astrophysics 374 (07): 301-8. doi:10.1051/0004-6361:20010686. Retrieved 2014-03-29.
36. Joseph Larmor (1919). "How could a rotating body such as the Sun become a magnet?". Reports of the British Association 87: 159–160.
37. García, Ra; Turck-Chièze, S; Jiménez-Reyes, Sj; Ballot, J; Pallé, Pl; Eff-Darwich, A; Mathur, S; Provost, J (June 2007). "Tracking solar gravity modes: the dynamics of the solar core". Science 316 (5831): 1591–3. doi:10.1126/science.1140598. ISSN 0036-8075. PMID 17478682.
38. "Solar core, In: Wikipedia". San Francisco, California: Wikimedia Foundation, Inc. October 12, 2012. Retrieved 2012-11-23.
39. Ryan, Sean G.; Norton, Andrew J. (2010). Stellar Evolution and Nucleosynthesis. Cambridge University Press. p. 19. ISBN 0-521-19609-4.
40. "Radiation zone, In: Wikipedia". San Francisco, California: Wikimedia Foundation, Inc. November 9, 2012. Retrieved 2012-11-23.
41. Elkins-Tanton, Linda T. (2006). The Sun, Mercury, and Venus. Infobase Publishing. p. 24. ISBN 0-8160-5193-3.
42. LeBlanc, Francis (2011). An Introduction to Stellar Astrophysics (2nd ed.). John Wiley and Sons. p. 168. ISBN 1-119-96497-0.
43. "Convection zone, In: Wikipedia". San Francisco, California: Wikimedia Foundation, Inc. October 12, 2012. Retrieved 2012-11-23.
44. "Solar dynamo, In: Wikipedia". San Francisco, California: Wikimedia Foundation, Inc. November 17, 2012. Retrieved 2012-11-23.
45. D. A. Schecter; J. F. Boyd; P. A. Gilman (April 20, 2001). ""Shallow-Water" Magnetohydrodynamic Waves in the Solar Tachocline". The Astrophysical Journal 551 (2): L185-8. doi:10.1086/320027. Retrieved 2012-03-11.
46. JHU/APL (January 30, 2008). "Mercury's Magnetic Field". Baltimore, Maryland USA: Johns Hopkins University. Retrieved 2014-03-29.
47. Sean C. Solomon (March 21, 2011). "Mercury's Surprising Core and Landscape Curiosities". Pittsburgh, Pennsylvania USA: Carnegie Institution for Science. Retrieved 2014-03-28.
48. Sabine Stanley; Jeremy Bloxham; William E. Hutchison; Maria T. Zuber (May 2005). "Thin shell dynamo models consistent with Mercury's weak observed magnetic field". Earth and Planetary Science Letters 234 (1-2): 27-38. doi:10.1016/j.epsl.2005.02.040. Retrieved 2014-03-29.
49. Francis Nimmo (November 2002). "Why does Venus lack a magnetic field?". Geology 30 (11): 987-90. doi:10.1130/0091-7613(2002)030<0987:WDVLAM>2.0.CO;2. Retrieved 2014-03-29.
50. "How does the Earth's core generate a magnetic field? In: USGS FAQs". United States Geological Survey. Retrieved 21 October 2013.
51. Joseph Larmor (1919). "Possible rotational origin of magnetic fields of sun and earth". Electrical Review 85: 412ff. Reprinted in Engineering, vol. 108, pages 461ff (3 October 1919).
52. Bruce Buffett (November 2009). "Geodynamo: A matter of boundaries". Nature Geoscience 2 (11): 741-2. doi:10.1038/ngeo673. Retrieved 2014-03-28.
53. Ataru Sakuraba; Paul H. Roberts (November 2009). "Generation of a strong magnetic field using uniform heat flux at the surface of the core". Nature Geoscience 2 (11): 802-5. doi:10.1038/ngeo643. Retrieved 2014-03-28.
54. Tim Stephens (November 9, 2011). "Ancient lunar dynamo may explain magnetized moon rocks". Santa Cruz, California USA: University of California Santa Cruz. Retrieved 2014-03-28.
55. Christina Dwyer (November 9, 2011). "Ancient lunar dynamo may explain magnetized moon rocks". Santa Cruz, California USA: University of California Santa Cruz. Retrieved 2014-03-28.
56. Francis Nimmo (November 9, 2011). "Ancient lunar dynamo may explain magnetized moon rocks". Santa Cruz, California USA: University of California Santa Cruz. Retrieved 2014-03-28.
57. Nancy Neal-Jones; Cynthia O'Carroll (October 12, 2005). "New Map Provides More Evidence Mars Once Like Earth". Washington, DC USA: NASA. Retrieved 2014-03-29.
58. Jack Connerney (October 12, 2005). "New Map Provides More Evidence Mars Once Like Earth". Washington, DC USA: NASA. Retrieved 2014-03-29.
59. Norman Ness (October 12, 2005). "New Map Provides More Evidence Mars Once Like Earth". Washington, DC USA: NASA. Retrieved 2014-03-29.
60. Mario Acuña (October 12, 2005). "New Map Provides More Evidence Mars Once Like Earth". Washington, DC USA: NASA. Retrieved 2014-03-29.
61. Krishan K. Khurana; Margaret G. Kivelson; Vytenis M. Vasyliunas; Norbert Krupp; Joachim Woch; Andreas Lagg; Barry H. Mauk; William S. Kurth (2004). Bagenal, F.. ed. The Configuration of Jupiter’s Magnetosphere, In: Jupiter: The Planet, Satellites and Magnetosphere. Cambridge University Press. pp. 24. ISBN 0-521-81808-7. Retrieved 2014-03-29.
62. Nikki Cassis (March 19, 2012). "Geologic map of Jupiter's moon Io details an otherworldly volcanic surface". Tempe, Arizona USA: Arizona State University. Retrieved 2014-03-28.
63. David Williams (March 19, 2012). "Geologic map of Jupiter's moon Io details an otherworldly volcanic surface". Tempe, Arizona USA: Arizona State University. Retrieved 2014-03-28.
64. Bill Steigerwald (October 6, 2010). "Saturn's Icy Moon May Keep Oceans Liquid with Wobble". Greenbelt, Maryland USA: NASA Goddard Space Flight Center. Retrieved 2014-03-28.
65. Terry Hurford (October 6, 2010). "Saturn's Icy Moon May Keep Oceans Liquid with Wobble". Greenbelt, Maryland USA: NASA Goddard Space Flight Center. Retrieved 2014-03-28.
66. Sabine Stanley; Jeremy Bloxham (March 2004). "Convective-region geometry as the cause of Uranus' and Neptune's unusual magnetic fields". Nature 428 (6979): 151-3. doi:10.1038/nature02376. Retrieved 2014-03-29.
67. Norman F. Ness; Mario H. Acuña; Kenneth W. Behannon; Leonard F. Burlaga; John E. P. Connerney; Ronald P. Lepping; Fritz M. Neubauer (July 4, 1986). "Magnetic Fields at Uranus". Science 233 (4759): 85-9. doi:10.1126/science.233.4759.85. Retrieved 2014-03-29.
68. C. T. Russell; J. G. Luhmann (1997). J. H. Shirley. ed. Neptune: Magnetic Field and Magnetosphere, In: Encyclopedia of Planetary Sciences. 532. New York: Chapman and Hall. Retrieved 2014-03-29.
69. Robert E. Rutledge; Gibor Basri; Lars Bildsten (August 1, 2000). "Chandra detection of an X-ray flare from the brown dwarf LP 944-20". The Astrophysical Journal 538 (2). doi:10.1086/312817. Retrieved 2012-03-11.
70. T. Blöcker; D. Schönberner (April 1991). "A 7 M AGB model sequence not complying with the core mass-luminosity relation". Astronomy and Astrophysics 244 (2): L43-6.
• P. Petit; F. Lignières; G.A. Wade; M. Aurière; T. Böhm; S. Bagnulo; B. Dintrans; A. Fumel et al. (November-December 2010). "The rapid rotation and complex magnetic field geometry of Vega". Astronomy and Astrophysics 523 (11): A41-9. doi:10.1051/0004-6361/201015307. | 19,897 | 86,300 | {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 26, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.546875 | 3 | CC-MAIN-2024-33 | latest | en | 0.915048 |
https://brainmass.com/statistics/normal-distribution/statistics-232497 | 1,503,061,601,000,000,000 | text/html | crawl-data/CC-MAIN-2017-34/segments/1502886104636.62/warc/CC-MAIN-20170818121545-20170818141545-00204.warc.gz | 763,381,412 | 20,246 | Share
Explore BrainMass
A Manufacturer's Production Policy
The manufacturer of a particular bicycle model has the following costs associated with the management of the product's inventory. In particular, the company currently maintains an inventory of 1000 units of this bicycle model at the beginning of each year. If X units are demanded each year and X is less than 1000, the excess supply, 1000 - X units, must be stored until next year at a cost of \$50 per unit. If X is greater than 1000 units, the excess demand, X - 1000 units, must be purchased separately at an extra cost of \$80 per unit. Assume that the annual demand (X) for this bicycle model is normally distributed with mean 1000 and standard deviation 75.
a. Find the expected annual cost associated with managing potential shortages or surpluses of this product. (Hint use simulation to approximate the answer. An exact solution using probability arguments is beyond the level of this book.)
b. Find two annual total cost levels, equidistant from the expected value frond in part a. such that 95% of all costs associated with managing potential shortages or surpluses of this product are between these values. (Continue to use simulation)
c. Comment on this manufacturer's annual production policy for this bicycle model in light of you findings in part b.
Solution Preview
Please see the attached Excel file. A simulation is operationalized using the random number generation function along with normal distribution. I have rounded the numbers as number of units cannot be a fraction.
Note: All answers here are based on the simulation to the left.
Part ...
Solution Summary
The expected annual costs for a bicycle model are determined.
\$2.19 | 355 | 1,724 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.8125 | 3 | CC-MAIN-2017-34 | longest | en | 0.928975 |
https://mathmatik.com/math-answers/radical-expressions/6th-grade-math-algebra.html | 1,656,228,485,000,000,000 | text/html | crawl-data/CC-MAIN-2022-27/segments/1656103037649.11/warc/CC-MAIN-20220626071255-20220626101255-00521.warc.gz | 443,938,850 | 12,665 | ## We Promise to Make your Math Frustrations Go Away!
Try the Free Math Solver or Scroll down to Tutorials!
Depdendent Variable
Number of equations to solve: 23456789
Equ. #1:
Equ. #2:
Equ. #3:
Equ. #4:
Equ. #5:
Equ. #6:
Equ. #7:
Equ. #8:
Equ. #9:
Solve for:
Dependent Variable
Number of inequalities to solve: 23456789
Ineq. #1:
Ineq. #2:
Ineq. #3:
Ineq. #4:
Ineq. #5:
Ineq. #6:
Ineq. #7:
Ineq. #8:
Ineq. #9:
Solve for:
Please use this form if you would like to have this math solver on your website, free of charge. Name: Email: Your Website: Msg:
### Our users:
It was hard for me to sit with my son and helping him with his math homework after a long day at office. Even he could not concentrate. Finally we got him this software and it seems we found a permanent solution. I am grateful that we found it.
Reese Pontoon, MO
The program helped my son do well on an exam. It helped refresh my memory of a lot of things I forgot.
Mary Jones, NY
I originally bought Algebrator for my wife because she was struggling with her algebra homework. Now only did it help with each problem, it also explained the steps for each. Now my wife uses the program to check her answers.
May Sung, OK
I am so far quite pleased with the program
Malcolm D McKinnon, TX
I was confused initially whether to buy this software or not. But in five days I am more than satisfied with the Algebrator. I was struggling with quadratic equations and inequalities. The logical and step-bystep approach to problem solving has been a boon to me and now I love to solve these equations.
Dora Greenwood, PA
### Students struggling with all kinds of algebra problems find out that our software is a life-saver. Here are the search phrases that today's searchers used to find our site. Can you find yours among them?
#### Search phrases used on 2013-11-19:
• prentice hall texas pre-algebra exam view
• homogeous differential equations calculator
• multiplying decimals by decimals word problems, worksheets for 5th grade
• graph and check to solve the linear system
• int 2 maths homework help
• c programming code for quadratic formula
• polynomial cubed
• converting decimals to roots
• solving multiplication of exponents
• what is the math term for scale
• conceptual physics questions and answers
• solving and graphing compound inequalities worksheets
• Introduction to Fluid Mechanics 7th Edition Teacher Solution
• how do you generalize a pattern 5th grade
• powerpoint presentations on how to solve absolute value equations and inequalities
• simple instructions for long divisin sums
• cube root of exponents
• Pythagorean Theorem Printable Worksheets
• problems about greatest common factors and least common multiple
• algebra 1 holt notes
• fraction activities
• free math worksheets functions algebra 6th grade
• open office simultaneous equation
• solving quadratic on ti 89
• solving for square root restrictions
• mathematica show steps in solving
• multiplying with 6 7 and 8 practice worksheets
• Elementary Math Trivia
• division worksheets for 5th graders with decimals
• solving nonlinear inequalities sign chart
• w to do algebra
• Slope and y-intercept in real life
• help with functions in algebra calculators online
• In what grade level should adding and subtracting intergers be taught?
• Division Properties of Exponents solvers
• +math for fourth grade inverse operation
• do my algebra for me
• free ratios worksheets year 9
• Solve differential on ti-83+
• differential equation solver second order
• manipulatives subtracting a negative number
• operations management 9th edition chapters examination question papers
• cost accounting statistics free
• basics step for lesson plan for high school level
• ti 84 plus online
• logarithmic equation in exponential form problem solver
• aria math
• math worksheets for LCM
• Free Dividing Decimals Worksheets
• free evaluating algebraic expressions worksheet generator
• latest math trivia mathematics algebra
• mixed fractions on ti-84+
• excel equations IF
• simplify cubed roots
• combining like terms multiple choice
• "pre algebra readiness" and iowa
• middle school math with pizzazz!book c test of genius
• beginner subtraction worksheet
• easiest way to understand algebra functions
• limits calculator ans
• do my volume algebra
• multiplying cube roots
• algebra practise sums
• math 10 complex trinomials
• logarithm inequalities
• operations with positive and negative integers sample questions
• fraction to decimal conversion chart for ks2
• 9th garde algebra studyguide
• ks3 math games
• calculate domain of parabola
• linear programing.ppt | 1,081 | 4,657 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.71875 | 3 | CC-MAIN-2022-27 | latest | en | 0.946893 |
https://math.stackexchange.com/questions/2263587/two-dirichlet-characters-chi-chi-are-equal-if-chip-chip-for-a/2263601 | 1,571,138,918,000,000,000 | text/html | crawl-data/CC-MAIN-2019-43/segments/1570986658566.9/warc/CC-MAIN-20191015104838-20191015132338-00346.warc.gz | 587,255,048 | 30,873 | # Two Dirichlet characters $\chi$, $\chi'$ are equal if $\chi(p) = \chi'(p)$ for almost all primes
I want to prove the following: Let $\chi, \chi'$ be two primitive Dirichlet-characters of conductor $N$. Suppose that $\chi(p) = \chi'(p)$ for all but a finite number of primes $p$. Then $\chi = \chi'$.
My idea was to use the same trick as in Euclid's proof of the infinitude of primes. Let $p_1, ..., p_n$ be the (pairwise distinct) primes not dividing $N$ such that $\chi(p_i) \neq \chi'(p_i)$. Then $p_1 \cdots p_n + N$ is coprime to $N$ and no $p_i$ divides $p_1 \cdots p_n + N$. So $\chi(p_1 \cdots p_n + N) = \chi'(p_1 \cdots p_n + N)$. Now I thought we can use the fact that $p_1 \cdots p_n + N$ is a unit in $\mathbf{Z} / N\mathbf{Z}$, but I couldn't get my head around that.
Does anyone know how to do it?
Thanks!
You only need to check that $\chi(a)=\chi'(a)$ for every $a\in(\mathbb{Z}/N\mathbb{Z})^\times$. By Dirichlet's theorem, there exists a prime $p\equiv a\bmod N$ such that $\chi(p)=\chi'(p)$. Repeat this for every $a$ and you are done.
• @Steven I doubt it. For example, take $N=3$, then all the primes are $1\bmod 3$ or $-1\bmod 3$. If the hypothesis tells you that the equality occurs for almost all the primes of the second form, then you are happy: take one such prime to establish the equality for $a=-1$ and then two of these for $a=1$. However, if the hypothesis only tells you that the equality occurs for primes $1\bmod 3$, then you don't have any information about the case $a=-1$. This does not prove anything, but I would be rather surprised if that sort of proof you are asking existed. – Lukas May 3 '17 at 10:21 | 519 | 1,651 | {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.609375 | 4 | CC-MAIN-2019-43 | latest | en | 0.864827 |
https://cstheory.stackexchange.com/questions/555/what-is-schema-theory-within-genetic-algorithms?noredirect=1 | 1,718,319,934,000,000,000 | text/html | crawl-data/CC-MAIN-2024-26/segments/1718198861517.98/warc/CC-MAIN-20240613221354-20240614011354-00626.warc.gz | 161,311,923 | 40,832 | # What is schema theory within Genetic Algorithms
I understand (some) of the workings behind schema theory in genetic algorithms, for example:
*****0 would match the genome 010100
But could anyone explain what schema theory (in Genetic Algorithms) is used for, and how it's used?
• not sure this is within scope, but am unsure enough to not want to vote to close, or even downvote. See this discussion: meta.cstheory.stackexchange.com/questions/114/… Commented Aug 25, 2010 at 14:32
• Why are the tags based on newsgroup names (instead of just plain english)? Commented Aug 26, 2010 at 11:06
If I remember correctly (it's years since I last studied this), schema theory isn't really used for anything. Rather, it's an attempt to explain why genetic algorithms seem to work well. As I'm not an expert, I can only point you to a book that I remember reading about schemata, Melanie Mitchell's book
• en.wikipedia.org/wiki/Holland's_schema_theorem "Holland's schema theorem is [...] the foundation for explanations of the power of genetic algorithms." Commented Aug 27, 2010 at 10:10
• The course I'm doing takes a lot from the Mitchell book, almost rewriting a lot of it Commented Aug 27, 2010 at 21:31
When designing a genetic algorithm, you have to choose how to represent the problem in terms of schema, and the representation is vitally important to the performance of the algorithm. I think this is what schema theory is about.
Specifically, the common operations a GA will use to perturb or evolve are mutation and one- or two-point crossover. This means that the proximity of certain traits to other traits in the "chromosome" is significant, since crossover operations slice the chromosome, essentially keeping groups of contiguous traits together. If you've designed a schema in which key related traits are distant in the chromosome, optimal (or even good) solutions may not be found quickly (or at all), because those traits are unlikely to be retained as a collection.
It also means that even optimal groups that are quite large will tend not to be favored, because they will be frequently broken apart by mutation and crossover operations. This, again, relates to the schema.
My best understanding of this is that schema theory deals with these issues (and more). It is designed to address the design of a chromosome in which good and/or optimal solutions are likely to be found given the functions used to evolve the population.
• So if I've understood, schema theory just helps you to design how you represent or encode the problem as artificial genes/bit strings, and design the fitness function? Commented Aug 26, 2010 at 11:05
• Yes, that's my understanding, which is limited. While it is easy conceptually, in my work I've found that managing the interaction between the fitness function and the schema is one of the more challenging design problems. Commented Aug 30, 2010 at 16:21 | 642 | 2,910 | {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.578125 | 3 | CC-MAIN-2024-26 | latest | en | 0.951288 |
https://statkat.com/stattest.php?t=3&t2=17&t3=40&t4=7&t5=6&t6=34&t7=41&t8=42 | 1,695,488,875,000,000,000 | text/html | crawl-data/CC-MAIN-2023-40/segments/1695233506528.19/warc/CC-MAIN-20230923162848-20230923192848-00176.warc.gz | 611,775,017 | 11,214 | # Goodness of fit test - overview
This page offers structured overviews of one or more selected methods. Add additional methods for comparisons by clicking on the dropdown button in the right-hand column. To practice with a specific method click the button at the bottom row of the table
Goodness of fit test
Kruskal-Wallis test
Cochran's Q test
Paired sample $t$ test
One sample $t$ test for the mean
Sign test
Marginal Homogeneity test / Stuart-Maxwell test
One sample Wilcoxon signed-rank test
Independent variableIndependent/grouping variableIndependent/grouping variableIndependent variableIndependent variableIndependent variableIndependent variableIndependent variable
NoneOne categorical with $I$ independent groups ($I \geqslant 2$)One within subject factor ($\geq 2$ related groups)2 paired groupsNone2 paired groups2 paired groupsNone
Dependent variableDependent variableDependent variableDependent variableDependent variableDependent variableDependent variableDependent variable
One categorical with $J$ independent groups ($J \geqslant 2$)One of ordinal levelOne categorical with 2 independent groupsOne quantitative of interval or ratio levelOne quantitative of interval or ratio levelOne of ordinal levelOne categorical with $J$ independent groups ($J \geqslant 2$)One of ordinal level
Null hypothesisNull hypothesisNull hypothesisNull hypothesisNull hypothesisNull hypothesisNull hypothesisNull hypothesis
• H0: the population proportions in each of the $J$ conditions are $\pi_1$, $\pi_2$, $\ldots$, $\pi_J$
or equivalently
• H0: the probability of drawing an observation from condition 1 is $\pi_1$, the probability of drawing an observation from condition 2 is $\pi_2$, $\ldots$, the probability of drawing an observation from condition $J$ is $\pi_J$
If the dependent variable is measured on a continuous scale and the shape of the distribution of the dependent variable is the same in all $I$ populations:
• H0: the population medians for the $I$ groups are equal
Else:
Formulation 1:
• H0: the population scores in any of the $I$ groups are not systematically higher or lower than the population scores in any of the other groups
Formulation 2:
• H0: P(an observation from population $g$ exceeds an observation from population $h$) = P(an observation from population $h$ exceeds an observation from population $g$), for each pair of groups.
Several different formulations of the null hypothesis can be found in the literature, and we do not agree with all of them. Make sure you (also) learn the one that is given in your text book or by your teacher.
H0: $\pi_1 = \pi_2 = \ldots = \pi_I$
Here $\pi_1$ is the population proportion of 'successes' for group 1, $\pi_2$ is the population proportion of 'successes' for group 2, and $\pi_I$ is the population proportion of 'successes' for group $I.$
H0: $\mu = \mu_0$
Here $\mu$ is the population mean of the difference scores, and $\mu_0$ is the population mean of the difference scores according to the null hypothesis, which is usually 0. A difference score is the difference between the first score of a pair and the second score of a pair.
H0: $\mu = \mu_0$
Here $\mu$ is the population mean, and $\mu_0$ is the population mean according to the null hypothesis.
• H0: P(first score of a pair exceeds second score of a pair) = P(second score of a pair exceeds first score of a pair)
If the dependent variable is measured on a continuous scale, this can also be formulated as:
• H0: the population median of the difference scores is equal to zero
A difference score is the difference between the first score of a pair and the second score of a pair.
H0: for each category $j$ of the dependent variable, $\pi_j$ for the first paired group = $\pi_j$ for the second paired group.
Here $\pi_j$ is the population proportion in category $j.$
H0: $m = m_0$
Here $m$ is the population median, and $m_0$ is the population median according to the null hypothesis.
Alternative hypothesisAlternative hypothesisAlternative hypothesisAlternative hypothesisAlternative hypothesisAlternative hypothesisAlternative hypothesisAlternative hypothesis
• H1: the population proportions are not all as specified under the null hypothesis
or equivalently
• H1: the probabilities of drawing an observation from each of the conditions are not all as specified under the null hypothesis
If the dependent variable is measured on a continuous scale and the shape of the distribution of the dependent variable is the same in all $I$ populations:
• H1: not all of the population medians for the $I$ groups are equal
Else:
Formulation 1:
• H1: the poplation scores in some groups are systematically higher or lower than the population scores in other groups
Formulation 2:
• H1: for at least one pair of groups:
P(an observation from population $g$ exceeds an observation from population $h$) $\neq$ P(an observation from population $h$ exceeds an observation from population $g$)
H1: not all population proportions are equalH1 two sided: $\mu \neq \mu_0$
H1 right sided: $\mu > \mu_0$
H1 left sided: $\mu < \mu_0$
H1 two sided: $\mu \neq \mu_0$
H1 right sided: $\mu > \mu_0$
H1 left sided: $\mu < \mu_0$
• H1 two sided: P(first score of a pair exceeds second score of a pair) $\neq$ P(second score of a pair exceeds first score of a pair)
• H1 right sided: P(first score of a pair exceeds second score of a pair) > P(second score of a pair exceeds first score of a pair)
• H1 left sided: P(first score of a pair exceeds second score of a pair) < P(second score of a pair exceeds first score of a pair)
If the dependent variable is measured on a continuous scale, this can also be formulated as:
• H1 two sided: the population median of the difference scores is different from zero
• H1 right sided: the population median of the difference scores is larger than zero
• H1 left sided: the population median of the difference scores is smaller than zero
H1: for some categories of the dependent variable, $\pi_j$ for the first paired group $\neq$ $\pi_j$ for the second paired group.H1 two sided: $m \neq m_0$
H1 right sided: $m > m_0$
H1 left sided: $m < m_0$
AssumptionsAssumptionsAssumptionsAssumptionsAssumptionsAssumptionsAssumptionsAssumptions
• Sample size is large enough for $X^2$ to be approximately chi-squared distributed. Rule of thumb: all $J$ expected cell counts are 5 or more
• Sample is a simple random sample from the population. That is, observations are independent of one another
• Group 1 sample is a simple random sample (SRS) from population 1, group 2 sample is an independent SRS from population 2, $\ldots$, group $I$ sample is an independent SRS from population $I$. That is, within and between groups, observations are independent of one another
• Sample of 'blocks' (usually the subjects) is a simple random sample from the population. That is, blocks are independent of one another
• Difference scores are normally distributed in the population
• Sample of difference scores is a simple random sample from the population of difference scores. That is, difference scores are independent of one another
• Scores are normally distributed in the population
• Sample is a simple random sample from the population. That is, observations are independent of one another
• Sample of pairs is a simple random sample from the population of pairs. That is, pairs are independent of one another
• Sample of pairs is a simple random sample from the population of pairs. That is, pairs are independent of one another
• The population distribution of the scores is symmetric
• Sample is a simple random sample from the population. That is, observations are independent of one another
Test statisticTest statisticTest statisticTest statisticTest statisticTest statisticTest statisticTest statistic
$X^2 = \sum{\frac{(\mbox{observed cell count} - \mbox{expected cell count})^2}{\mbox{expected cell count}}}$
Here the expected cell count for one cell = $N \times \pi_j$, the observed cell count is the observed sample count in that same cell, and the sum is over all $J$ cells.
$H = \dfrac{12}{N (N + 1)} \sum \dfrac{R^2_i}{n_i} - 3(N + 1)$
Here $N$ is the total sample size, $R_i$ is the sum of ranks in group $i$, and $n_i$ is the sample size of group $i$. Remember that multiplication precedes addition, so first compute $\frac{12}{N (N + 1)} \times \sum \frac{R^2_i}{n_i}$ and then subtract $3(N + 1)$.
Note: if ties are present in the data, the formula for $H$ is more complicated.
If a failure is scored as 0 and a success is scored as 1:
$Q = k(k - 1) \dfrac{\sum_{groups} \Big (\mbox{group total} - \frac{\mbox{grand total}}{k} \Big)^2}{\sum_{blocks} \mbox{block total} \times (k - \mbox{block total})}$
Here $k$ is the number of related groups (usually the number of repeated measurements), a group total is the sum of the scores in a group, a block total is the sum of the scores in a block (usually a subject), and the grand total is the sum of all the scores.
Before computing $Q$, first exclude blocks with equal scores in all $k$ groups.
$t = \dfrac{\bar{y} - \mu_0}{s / \sqrt{N}}$
Here $\bar{y}$ is the sample mean of the difference scores, $\mu_0$ is the population mean of the difference scores according to the null hypothesis, $s$ is the sample standard deviation of the difference scores, and $N$ is the sample size (number of difference scores).
The denominator $s / \sqrt{N}$ is the standard error of the sampling distribution of $\bar{y}$. The $t$ value indicates how many standard errors $\bar{y}$ is removed from $\mu_0$.
$t = \dfrac{\bar{y} - \mu_0}{s / \sqrt{N}}$
Here $\bar{y}$ is the sample mean, $\mu_0$ is the population mean according to the null hypothesis, $s$ is the sample standard deviation, and $N$ is the sample size.
The denominator $s / \sqrt{N}$ is the standard error of the sampling distribution of $\bar{y}$. The $t$ value indicates how many standard errors $\bar{y}$ is removed from $\mu_0$.
$W =$ number of difference scores that is larger than 0Computing the test statistic is a bit complicated and involves matrix algebra. Unless you are following a technical course, you probably won't need to calculate it by hand.Two different types of test statistics can be used, but both will result in the same test outcome. We will denote the first option the $W_1$ statistic (also known as the $T$ statistic), and the second option the $W_2$ statistic. In order to compute each of the test statistics, follow the steps below:
1. For each subject, compute the sign of the difference score $\mbox{sign}_d = \mbox{sgn}(\mbox{score} - m_0)$. The sign is 1 if the difference is larger than zero, -1 if the diffence is smaller than zero, and 0 if the difference is equal to zero.
2. For each subject, compute the absolute value of the difference score $|\mbox{score} - m_0|$.
3. Exclude subjects with a difference score of zero. This leaves us with a remaining number of difference scores equal to $N_r$.
4. Assign ranks $R_d$ to the $N_r$ remaining absolute difference scores. The smallest absolute difference score corresponds to a rank score of 1, and the largest absolute difference score corresponds to a rank score of $N_r$. If there are ties, assign them the average of the ranks they occupy.
Then compute the test statistic:
• $W_1 = \sum\, R_d^{+}$
or
$W_1 = \sum\, R_d^{-}$
That is, sum all ranks corresponding to a positive difference or sum all ranks corresponding to a negative difference. Theoratically, both definitions will result in the same test outcome. However:
• Tables with critical values for $W_1$ are usually based on the smaller of $\sum\, R_d^{+}$ and $\sum\, R_d^{-}$. So if you are using such a table, pick the smaller one.
• If you are using the normal approximation to find the $p$ value, it makes things most straightforward if you use $W_1 = \sum\, R_d^{+}$ (if you use $W_1 = \sum\, R_d^{-}$, the right and left sided alternative hypotheses 'flip').
• $W_2 = \sum\, \mbox{sign}_d \times R_d$
That is, for each remaining difference score, multiply the rank of the absolute difference score by the sign of the difference score, and then sum all of the products.
Sampling distribution of $X^2$ if H0 were trueSampling distribution of $H$ if H0 were trueSampling distribution of $Q$ if H0 were trueSampling distribution of $t$ if H0 were trueSampling distribution of $t$ if H0 were trueSampling distribution of $W$ if H0 were trueSampling distribution of the test statistic if H0 were trueSampling distribution of $W_1$ and of $W_2$ if H0 were true
Approximately the chi-squared distribution with $J - 1$ degrees of freedom
For large samples, approximately the chi-squared distribution with $I - 1$ degrees of freedom.
For small samples, the exact distribution of $H$ should be used.
If the number of blocks (usually the number of subjects) is large, approximately the chi-squared distribution with $k - 1$ degrees of freedom$t$ distribution with $N - 1$ degrees of freedom$t$ distribution with $N - 1$ degrees of freedomThe exact distribution of $W$ under the null hypothesis is the Binomial($n$, $P$) distribution, with $n =$ number of positive differences $+$ number of negative differences, and $P = 0.5$.
If $n$ is large, $W$ is approximately normally distributed under the null hypothesis, with mean $nP = n \times 0.5$ and standard deviation $\sqrt{nP(1-P)} = \sqrt{n \times 0.5(1 - 0.5)}$. Hence, if $n$ is large, the standardized test statistic $$z = \frac{W - n \times 0.5}{\sqrt{n \times 0.5(1 - 0.5)}}$$ follows approximately the standard normal distribution if the null hypothesis were true.
Approximately the chi-squared distribution with $J - 1$ degrees of freedomSampling distribution of $W_1$:
If $N_r$ is large, $W_1$ is approximately normally distributed with mean $\mu_{W_1}$ and standard deviation $\sigma_{W_1}$ if the null hypothesis were true. Here $$\mu_{W_1} = \frac{N_r(N_r + 1)}{4}$$ $$\sigma_{W_1} = \sqrt{\frac{N_r(N_r + 1)(2N_r + 1)}{24}}$$ Hence, if $N_r$ is large, the standardized test statistic $$z = \frac{W_1 - \mu_{W_1}}{\sigma_{W_1}}$$ follows approximately the standard normal distribution if the null hypothesis were true.
Sampling distribution of $W_2$:
If $N_r$ is large, $W_2$ is approximately normally distributed with mean $0$ and standard deviation $\sigma_{W_2}$ if the null hypothesis were true. Here $$\sigma_{W_2} = \sqrt{\frac{N_r(N_r + 1)(2N_r + 1)}{6}}$$ Hence, if $N_r$ is large, the standardized test statistic $$z = \frac{W_2}{\sigma_{W_2}}$$ follows approximately the standard normal distribution if the null hypothesis were true.
If $N_r$ is small, the exact distribution of $W_1$ or $W_2$ should be used.
Note: if ties are present in the data, the formula for the standard deviations $\sigma_{W_1}$ and $\sigma_{W_2}$ is more complicated.
Significant?Significant?Significant?Significant?Significant?Significant?Significant?Significant?
• Check if $X^2$ observed in sample is equal to or larger than critical value $X^{2*}$ or
• Find $p$ value corresponding to observed $X^2$ and check if it is equal to or smaller than $\alpha$
For large samples, the table with critical $X^2$ values can be used. If we denote $X^2 = H$:
• Check if $X^2$ observed in sample is equal to or larger than critical value $X^{2*}$ or
• Find $p$ value corresponding to observed $X^2$ and check if it is equal to or smaller than $\alpha$
If the number of blocks is large, the table with critical $X^2$ values can be used. If we denote $X^2 = Q$:
• Check if $X^2$ observed in sample is equal to or larger than critical value $X^{2*}$ or
• Find $p$ value corresponding to observed $X^2$ and check if it is equal to or smaller than $\alpha$
Two sided:
Right sided:
Left sided:
Two sided:
Right sided:
Left sided:
If $n$ is small, the table for the binomial distribution should be used:
Two sided:
• Check if $W$ observed in sample is in the rejection region or
• Find two sided $p$ value corresponding to observed $W$ and check if it is equal to or smaller than $\alpha$
Right sided:
• Check if $W$ observed in sample is in the rejection region or
• Find right sided $p$ value corresponding to observed $W$ and check if it is equal to or smaller than $\alpha$
Left sided:
• Check if $W$ observed in sample is in the rejection region or
• Find left sided $p$ value corresponding to observed $W$ and check if it is equal to or smaller than $\alpha$
If $n$ is large, the table for standard normal probabilities can be used:
Two sided:
Right sided:
Left sided:
If we denote the test statistic as $X^2$:
• Check if $X^2$ observed in sample is equal to or larger than critical value $X^{2*}$ or
• Find $p$ value corresponding to observed $X^2$ and check if it is equal to or smaller than $\alpha$
For large samples, the table for standard normal probabilities can be used:
Two sided:
Right sided:
Left sided:
n.a.n.a.n.a.$C\%$ confidence interval for $\mu$$C\% confidence interval for \mun.a.n.a.n.a. ---\bar{y} \pm t^* \times \dfrac{s}{\sqrt{N}} where the critical value t^* is the value under the t_{N-1} distribution with the area C / 100 between -t^* and t^* (e.g. t^* = 2.086 for a 95% confidence interval when df = 20). The confidence interval for \mu can also be used as significance test. \bar{y} \pm t^* \times \dfrac{s}{\sqrt{N}} where the critical value t^* is the value under the t_{N-1} distribution with the area C / 100 between -t^* and t^* (e.g. t^* = 2.086 for a 95% confidence interval when df = 20). The confidence interval for \mu can also be used as significance test. --- n.a.n.a.n.a.Effect sizeEffect sizen.a.n.a.n.a. ---Cohen's d: Standardized difference between the sample mean of the difference scores and \mu_0:$$d = \frac{\bar{y} - \mu_0}{s}$$Cohen's d indicates how many standard deviations s the sample mean of the difference scores \bar{y} is removed from \mu_0. Cohen's d: Standardized difference between the sample mean and \mu_0:$$d = \frac{\bar{y} - \mu_0}{s}$$Cohen's$d$indicates how many standard deviations$s$the sample mean$\bar{y}$is removed from$\mu_0.$--- n.a.n.a.n.a.Visual representationVisual representationn.a.n.a.n.a. ------ n.a.n.a.Equivalent toEquivalent ton.a.Equivalent ton.a.n.a. --Friedman test, with a categorical dependent variable consisting of two independent groups. • One sample$t$test on the difference scores. • Repeated measures ANOVA with one dichotomous within subjects factor. - Two sided sign test is equivalent to -- Example contextExample contextExample contextExample contextExample contextExample contextExample contextExample context Is the proportion of people with a low, moderate, and high social economic status in the population different from$\pi_{low} = 0.2,\pi_{moderate} = 0.6,$and$\pi_{high} = 0.2$?Do people from different religions tend to score differently on social economic status? Subjects perform three different tasks, which they can either perform correctly or incorrectly. Is there a difference in task performance between the three different tasks?Is the average difference between the mental health scores before and after an intervention different from$\mu_0 = 0$?Is the average mental health score of office workers different from$\mu_0 = 50$?Do people tend to score higher on mental health after a mindfulness course?Subjects are asked to taste three different types of mayonnaise, and to indicate which of the three types of mayonnaise they like best. They then have to drink a glass of beer, and taste and rate the three types of mayonnaise again. Does drinking a beer change which type of mayonnaise people like best?Is the median mental health score of office workers different from$m_0 = 50$? SPSSSPSSSPSSSPSSSPSSSPSSSPSSSPSS Analyze > Nonparametric Tests > Legacy Dialogs > Chi-square... • Put your categorical variable in the box below Test Variable List • Fill in the population proportions / probabilities according to$H_0$in the box below Expected Values. If$H_0$states that they are all equal, just pick 'All categories equal' (default) Analyze > Nonparametric Tests > Legacy Dialogs > K Independent Samples... • Put your dependent variable in the box below Test Variable List and your independent (grouping) variable in the box below Grouping Variable • Click on the Define Range... button. If you can't click on it, first click on the grouping variable so its background turns yellow • Fill in the smallest value you have used to indicate your groups in the box next to Minimum, and the largest value you have used to indicate your groups in the box next to Maximum • Continue and click OK Analyze > Nonparametric Tests > Legacy Dialogs > K Related Samples... • Put the$k$variables containing the scores for the$k$related groups in the white box below Test Variables • Under Test Type, select Cochran's Q test Analyze > Compare Means > Paired-Samples T Test... • Put the two paired variables in the boxes below Variable 1 and Variable 2 Analyze > Compare Means > One-Sample T Test... • Put your variable in the box below Test Variable(s) • Fill in the value for$\mu_0$in the box next to Test Value Analyze > Nonparametric Tests > Legacy Dialogs > 2 Related Samples... • Put the two paired variables in the boxes below Variable 1 and Variable 2 • Under Test Type, select the Sign test Analyze > Nonparametric Tests > Legacy Dialogs > 2 Related Samples... • Put the two paired variables in the boxes below Variable 1 and Variable 2 • Under Test Type, select the Marginal Homogeneity test Specify the measurement level of your variable on the Variable View tab, in the column named Measure. Then go to: Analyze > Nonparametric Tests > One Sample... • On the Objective tab, choose Customize Analysis • On the Fields tab, specify the variable for which you want to compute the Wilcoxon signed-rank test • On the Settings tab, choose Customize tests and check the box for 'Compare median to hypothesized (Wilcoxon signed-rank test)'. Fill in your$m_0$in the box next to Hypothesized median • Click Run • Double click on the output table to see the full results JamoviJamoviJamoviJamoviJamoviJamovin.a.Jamovi Frequencies > N Outcomes -$\chi^2$Goodness of fit • Put your categorical variable in the box below Variable • Click on Expected Proportions and fill in the population proportions / probabilities according to$H_0$in the boxes below Ratio. If$H_0$states that they are all equal, you can leave the ratios equal to the default values (1) ANOVA > One Way ANOVA - Kruskal-Wallis • Put your dependent variable in the box below Dependent Variables and your independent (grouping) variable in the box below Grouping Variable Jamovi does not have a specific option for the Cochran's Q test. However, you can do the Friedman test instead. The$p$value resulting from this Friedman test is equivalent to the$p$value that would have resulted from the Cochran's Q test. Go to: ANOVA > Repeated Measures ANOVA - Friedman • Put the$k$variables containing the scores for the$k$related groups in the box below Measures T-Tests > Paired Samples T-Test • Put the two paired variables in the box below Paired Variables, one on the left side of the vertical line and one on the right side of the vertical line • Under Hypothesis, select your alternative hypothesis T-Tests > One Sample T-Test • Put your variable in the box below Dependent Variables • Under Hypothesis, fill in the value for$\mu_0$in the box next to Test Value, and select your alternative hypothesis Jamovi does not have a specific option for the sign test. However, you can do the Friedman test instead. The$p$value resulting from this Friedman test is equivalent to the two sided$p$value that would have resulted from the sign test. Go to: ANOVA > Repeated Measures ANOVA - Friedman • Put the two paired variables in the box below Measures -T-Tests > One Sample T-Test • Put your variable in the box below Dependent Variables • Under Tests, select Wilcoxon rank • Under Hypothesis, fill in the value for$m_0\$ in the box next to Test Value, and select your alternative hypothesis
Practice questionsPractice questionsPractice questionsPractice questionsPractice questionsPractice questionsPractice questionsPractice questions | 6,048 | 24,045 | {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.46875 | 3 | CC-MAIN-2023-40 | latest | en | 0.705387 |
https://www.pumpsandsystems.com/step-step-calculation-npsha | 1,542,231,658,000,000,000 | text/html | crawl-data/CC-MAIN-2018-47/segments/1542039742316.5/warc/CC-MAIN-20181114211915-20181114233915-00203.warc.gz | 989,345,032 | 25,303 | The first of a five-part NPSH primer series.
This is the first article in a five-part series.
In the world of psychology and specifically in the area of introspective issues, it is often declared that, “what you resist will persist.”
You’ve heard it before, and here we go again. Allegedly, the most misunderstood concept in the pump world is net positive suction head (NPSH). I have written several articles on the subject and so have many other pump technicians or engineers and so-called experts.
The NPSH name itself, an acronym, confuses most pump neophytes. The subject and required calculations confounds people who are new to the industry, those on the periphery (operators or administrators) and professionals who incorrectly believe they fully understand the subject even after 25 years in the business.
I suggest we need to be concerned about this issue, because mistakes with respect to NPSH available (NPSHa) calculations are all too frequent and expensive to correct.
One of the fun parts of my position is teaching at several pump schools per year and devoting a major portion of the course to the subject of understanding the concept of NPSH and how to complete the calculations. In the teaching process, I cover the five main examples that you will likely encounter in normal industry applications. The examples are adapted from chapter 1 of the “Cameron Hydraulic Data Book.”
I will explain these five examples first in this column and over the next four months with the basic optimistic intent that once you learn these five examples and a few variations of each you will be able to handle the applications encountered in the real world. Between now and Thanksgiving, you may wish to read and file all five columns as a handy reference. As background, please re-examine two of my previous columns on the subject, one from Pumps & Systems August 2015 and the other from April 2018.
## Definition of NPSH, NPSHa & NPSHr
The net positive suction head is the total suction head in feet of liquid (or meters), less the vapor pressure (in feet or meters) of the liquid being pumped.
Think of head as an energy level and not as a force-like pressure. All values are absolute.
NPSHa is measured at the pump centerline or the impeller eye. These two things can be at different places or elevations. Think of NPSHa as the liquid’s available energy level at the inlet of the pump or the eye of the impeller. The liquid will flash to vapor if there is not enough NPSHa. Do not confuse NPSHa with suction pressure. While suction pressure is in some ways a component in the mix, there is something more complex to the story.
NPSHa is the amount of NPSH that the system has available at the eye of the pump impeller. This NPSHa value is entirely a function of the liquid, its properties, ambient conditions and the suction system design and geometry. Essentially, the calculation is about the suction system itself and has nothing to do with the pump. This calculation should be completed by the system owner, the end user and/or their engineer or consultant. For liability reasons, manufacturers are normally directed to not be involved in the customers’ calculations; however, as time marches on, the manufacturer is getting more involved mostly as a preservation issue.
NPSH required (NPSHr) is most commonly determined by the pump manufacturer by empirical methods and using standards and specifications from the Hydraulic Institute (HI). NPSHr values are normally reported on the performance curves for the pump. | 734 | 3,533 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3 | 3 | CC-MAIN-2018-47 | longest | en | 0.942836 |
https://www.physicsforums.com/threads/non-conservative-physics-hw.932908/ | 1,627,815,268,000,000,000 | text/html | crawl-data/CC-MAIN-2021-31/segments/1627046154175.76/warc/CC-MAIN-20210801092716-20210801122716-00365.warc.gz | 952,882,850 | 15,924 | # Non-conservative physics hw
juju1
## Homework Statement
Two students, Joe and Jane Fisycks, make a catapult. They use a spring with a spring constant of 101 N/m to launch a tennis ball. When the catapult is loaded, the spring is stretched 0.477 m. This is also the distance the tennis ball travels as it is being fired by the catapult. When loaded, the tennis ball is at ground level. When it leaves the catapult, it is 0.567 m above ground level. A drag force D acts on the tennis ball as it is being fired. The tennis ball's mass is 0.0579 kg.
(e) If there were no drag, what launch speed would the tennis ball have? (find v_1)
## The Attempt at a Solution
so i found the equations when it is ready to fire and after it fires
.5kx^2 and (.5mv_1^2)+(mgy_1)+Dx
i put these two equations together to solve for v_1, yet I still am not getting a right answer.
my v_1 equation is sqrt( (.5kx^2 - mgy_1) / (.5m) )
i plugged in 101N/m for k
0.477 m for y_1
0.0578 for m
9.8 for g
0.567 for x
what am i doing wrong?
TSny
Homework Helper
Gold Member
Looks like you might have switched the values of x and y1.
juju1
so 19.659 m/s?
TSny
Homework Helper
Gold Member
so 19.659 m/s?
I believe that's right. Note that the mass is given to be 0.0579 kg, but you later wrote 0.578 kg. (Not a very significant difference.)
How many significant figures should the answer have?
juju1
3 sigfigs! So rather: 19.7 m/s
TSny
TSny
Homework Helper
Gold Member
3 sigfigs! So rather: 19.7 m/s
Yes. That's essentially what I got, too. (19.6 m/s) | 467 | 1,534 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.609375 | 4 | CC-MAIN-2021-31 | latest | en | 0.93685 |
https://cybermetric.blogspot.com/2021/03/ | 1,620,439,847,000,000,000 | text/html | crawl-data/CC-MAIN-2021-21/segments/1620243988831.77/warc/CC-MAIN-20210508001259-20210508031259-00541.warc.gz | 212,452,660 | 28,532 | Thursday, March 11, 2021
Leverage and the 1959 White Sox
They won the pennant and it seems like they did it partly on the strength of their performance in High Leverage situations because their overall OPS differential was not that impressive (all data from Baseball Reference and Stathead).
Rk Tm W L W-L% OPS OPSA OPS Diff 1 CHW 94 60 0.610 0.691 0.671 0.020 2 CLE 89 65 0.578 0.729 0.693 0.036 3 NYY 79 75 0.513 0.721 0.680 0.041 4 DET 76 78 0.494 0.735 0.721 0.014 5 BOS 75 79 0.487 0.721 0.738 -0.017 6 BAL 74 80 0.481 0.655 0.678 -0.023 7 KCA 66 88 0.429 0.716 0.761 -0.045 8 WSH 63 91 0.409 0.688 0.711 -0.023
They had only the third highest OPS differential yet finished 5 games ahead of the Indians. Here is what the Sox did by Leverage:
Situation OPS OPSA OPS Diff High Leverage 0.763 0.623 0.140 Medium Leverage 0.641 0.689 -0.048 Low Leverage 0.702 0.681 0.021
Here is how many PAs they had in each case, both for and against:
Situation PA OPA High Leverage 1320 1370 Medium Leverage 2298 2305 Low Leverage 2437 2343
Given these numbers, if you combine the Medium and Low cases, they would have a negative OPS differential.
How much difference might this performance in High Leverage situations mattered?
Here is a regression generated equation where team winning pct was a function of overall OPS differential that I have found.
Pct = .5 + 1.32*OPSDIFF
This predicts the Sox would have a .526 winning pct and win 81 games. It predicts that Cleveland would win 84.
But another regression equation, broken down by leverage is
Pct = .5 + .306*LOW +.420*MED + .564*HIGH
That predicts that they would have a .565 winning pct and win 87 games, six more than before (although still 7 less than what they actually won). The same analysis for the Indians would give them 87.9 wins.
What accounts for the Sox winning the pennant? Maybe the three leverage categories are not refined enough, with maybe the Sox doing even better in more extreme leverage cases. But that might not be easily found.
One thing I did find was that in head-to-head games, the Sox had a much better OPS differential in High leverage cases than the Indians than in Low and Medium cases. I will discuss that below
But first, the Sox went 15-7 against the Indians, going 5-2 in their 1-run games (overall, the Sox were 35-15 in 1-run games). So outside of head-to-head games, the Indians were 82-50 while the Sox were 79-53 (also, if the Indians had gone 5-2 in those 1-run games they would have won the pennant by one game).
The Sox had an overall OPS differential of .020 but against the Indians it was .077 (.710 - .633). Their OPS differential against everyone else combined was about .011.
The Indians OPS differential was .036 overall but against everyone else it was about .054 combined. So we could say that the Indians were .043 better than the Sox (.054 - .011).
That means in their head-to-head games there was a swing of .120 (.077 + .043). It looks like the Sox won the pennant because they did unusually well against their main competition.
And they were even better when it really counted. This table shows how each team did in OPS by leverage in their games against each other (data from Stathead).
Split Sox Indians Sox Differential Low 0.676 0.584 0.092 Medium 0.689 0.674 0.015 High 0.819 0.630 0.189
That .189 differential in High leverage situations is close to the OPS differential of the 1927 Yankees (.196 according to Retrosheet, .200 according to Baseball Reference). Sure, that is the Yanks differential for the whole season, but by being close to it in High leverage situations, the Sox may have given themselves the pennant.
In late August, the Sox went into Cleveland with a 1.5 game lead and swept a 4 game series. The closest the Indians got after that was 3.5 games when in late in September the Sox came to Cleveland for one game (the Sox had 4 games left including that one and the Indians 5). The Sox won 4-2.
So just like with their performance in High leverage situations, the Sox won what might be considered the High leverage games late in the season.
Update March 12. Below is something from a post I did in 2009.
Let's look at how they did in "clutch" situations vs. other situations. The table below shows how the Sox hitters did in various situations.
Now what the Sox pitchers did.
Now the differentials followed by some discussion.
The total line, of course, refers to all plate appearances. The Sox had modest differentials here. They batted .250 while the Sox pitchers held their opponents to a .242 AVG. With no runners on base, the differentials are even lower. But now look at their differentials with men on. For AVG, it is .013, much higher than the .005 with none on. For OBP, the differential jumps from .009 to .023. SLG goes from .001 to .010.
With runners in scoring position (RISP), they had a .040 differential in AVG!. It was actually negative in nonRISP situations. Sox pitchers held opposing batters to a .221 AVG with RISP. Their OBP differential jumped from .007 to .040 while SLG jumped from -.014 to .063. Incredible. Their hitters' SLG went up .032 with RISP while the pitchers lowered it by .044.
Moving to close and late situations, the Sox outhit their opponents by .024 while it it was only .005 in nonCL situations. The OBP differential rose from .010 to .043 while for SLG it went from -.012 to .076. Another stunning swing. The Sox hitters actually had an SLG of .400 in close and late situations, by far their highest for any case.
So it is pretty easy to see what happened that year. I have not looked at other teams, but the case of the 1959 White Sox must be very unusual. | 1,491 | 5,664 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.90625 | 3 | CC-MAIN-2021-21 | longest | en | 0.959501 |
https://mathematica.stackexchange.com/questions/181738/efficient-way-to-simulate-thousands-of-markov-chains/181739 | 1,721,693,865,000,000,000 | text/html | crawl-data/CC-MAIN-2024-30/segments/1720763517927.60/warc/CC-MAIN-20240722220957-20240723010957-00120.warc.gz | 332,347,111 | 43,540 | # Efficient way to simulate thousands of Markov chains
I am currently trying to simulate relaxation of a protein population while maintaining the stochastic properties of the system. For this, I used a Markov chain to describe the temporal evolution of every member of this system:
single = DiscreteMarkovProcess[{1, 0, 0}, {{0.99, 0.0099, 0.0001}, {0, 0.95, 0.05}, {0, 0.5, 0.5}}];
trace := Replace[RandomFunction[single, {0, 500}]["Values"], {1 -> 0, 2 -> 3, 3 -> 1}, 1] (*The Replace rules are asociated with my observable*)
traces := ParallelTable[trace, {x, 5000}]; (*simulate 5000 singles during 500 steps*)
Now I simulate this system 100 times
meanobs = Table[Total[traces], {100}];
This takes at least 15 minutes in my computer (4 kernels running). I would like to make this process faster if its posible since I want to run it for longer times and more processes
The idea is to obtain the mean of the traces and the variance, as shown here.
The graphs are obtained using Listplot[meanobs] and Listplot[Variance[meanobs]]
• Firstly: How do these plots correspond to your code? Especially the values of the first plot seem wildly off from what I'd expect. Secondly, have you considered applying PDF to DiscreteMarkovProcess for each of the states and building new distribution functions from that symbolically? To me it seems entirely plausible in this case. Commented Sep 12, 2018 at 3:50
• @kirma I corrected the code and changed one of the figures! Commented Sep 12, 2018 at 19:16
## 3 Answers
While the other answers focus on circumventing the simulations, I focus on how to speed up the simulations themselves. (Sometimes, simulations might be unavoidable.)
In this situation, when calling RandomFunction, it is much faster to generate many simulations at once by specifying the number of simulations using the third argument (instead of calling RandomFunction many times). (Recently, I observed also a different behavior of RandomFunction when applied to simulating Itô processes.)
Moreover, it is a bit faster to perform the replacement of observables with Part. So, my implementation of traces looks like this:
single = DiscreteMarkovProcess[
{1., 0., 0.},
{{0.99, 0.0099, 0.0001}, {0, 0.95, 0.05}, {0, 0.5, 0.5}}
];
reporule = DeveloperToPackedArray[{0., 3., 1.}];
ClearAll[traces]
traces[pathCount_, pathLength_] := Partition[
Part[
reporule,
Flatten[RandomFunction[single, {0, pathLength}, pathCount]["ValueList"]]
],
pathLength + 1
];
Now we can simulate 100 meanobs in the following way. Notice that I use ParallelTable only for the most outer loop; this is often beneficial.
pathCount = 5000;
pathLength = 500;
meanobs = ParallelTable[Mean[traces[pathCount, pathLength]], {100}]; // AbsoluteTiming // First
7.10128
Instead of 15 minutes, this takes only about 7 seconds on my notebooks's Haswell Quad Core CPU.
In general, ParallelTable can also slow things down when applied at a too deep looping level or in situations where computations cannot be split into sufficiently many independent parts.
I essentially derive a second distribution - without a need for stochastic modelling - from DiscreteMarkovProcess timeslices according to your state to value mappings, and simply use Mean and Variance on it. I skip scaling by 5000 here, as it seems somewhat an arbitrary multiplier for the problem at hand. That is, I perform the computation of these values symbolically instead of through simulation:
With[
{mdist = DiscreteMarkovProcess[
{1, 0, 0},
{{0.99, 0.0099, 0.0001}, {0, 0.95, 0.05}, {0, 0.5, 0.5}}],
values = {0, 3, 1}},
With[
{pdist = ProbabilityDistribution[
Piecewise@MapIndexed[{PDF[mdist[t], First@#2], v == #1} &, values],
{v, Min@values, Max@values, 1}]},
Plot[Re@{Mean@pdist, Variance@pdist}, {t, 0, 500}, Evaluated -> True]]]
You can also plot the probabilities of individual values over time with LogPlot[Evaluate[Re[PDF@pdist /@ Sort@values]], {t, 0, 500}, PlotLegends -> Sort@values].
In order this code to work values must consist only of integers, although one might assume at least rationals to work. (Oddly enough, only step value of 1 on a ProbabilityDistribution of this form would seem to work with functions taking probability functions as arguments. A workaround with GCD and TransformedDistribution would seem to work, but I'm not including it to further complicate this answer. This seems like a bug; I reported it under CASE:4156809.)
In general, Mathematica is not always the best tool for this type of simulation. That said, you do not need to compute sample paths to compute the mean or variance.
For a Markov chain with probability transition matrix $P_{i,j}:=\mathbb{P}(X_1=j|X_0=i)$ you can compute the $n$-step transition matrix by $\mathbb{P}(X_n = j | X_0 = i) = P^n$. Therefore, given initial distribution $x$, the probability of ending up in a given state is given by the corresponding entry of $xP^n$.
Given a discrete random variable $Y$ we can compute the expectation using the formula, $$\mathbb{E}[Y] = \sum_{k=0}^{\infty} k \mathbb{P}(Y=k)$$
In your case, we will compute $\mathbb{E}[xP^n]$ for each $n$. Since you only have three states, there will only be three entries in this sum (for $k=0$, $k=3$, and $k=1$).
In your case, with your weighting of the state space, you can do this like:
ListPlot@Table[Dot[{1, 0, 0}.MatrixPower[P, n], {0, 3, 1}], {n, 0, 500}]
Similarly, the variance is computed by $\mathbb{E}[(xP^n)^2]-\mathbb{E}[xP^n]^2$. You can compute this by:
ListPlot@Table[
Dot[{1, 0, 0}.MatrixPower[P, n], {0, 3, 1}^2 -
Dot[{1, 0, 0}.MatrixPower[P, n], {0, 3, 1}]^2], {n, 0, 500}]
Both of these could be made more efficient by using the previous iterate of the matrix power to compute the next one, but since $P$ is small these commands run instantly and so efficiency is not of concern.
With regards to your code:
It looks like you compute the mean 500 traces, and plot 100 of these. Do you mean to compute these 100 quantities, or did you want a single one? When I run your code my plot of meanobs only goes up to a bit above 2.5. I'm not sure why your plot has such large numbers.
You also use the replacement after computing the chain. You could permute the entries of the probability transition matrix ahead of time to avoid this and save a bit of computation.
• Great answer, and thanks for the clarification with the statistics! The code had a problem, now it should have the corrects values in meanobs`. @Tyler Chen Commented Sep 12, 2018 at 19:23 | 1,765 | 6,482 | {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.90625 | 3 | CC-MAIN-2024-30 | latest | en | 0.892987 |
https://dsbuscon.com/northern-territory/practical-application-of-superposition-theorem.php | 1,670,168,957,000,000,000 | text/html | crawl-data/CC-MAIN-2022-49/segments/1669446710974.36/warc/CC-MAIN-20221204140455-20221204170455-00375.warc.gz | 255,984,962 | 13,344 | # Northern Territory Practical Application Of Superposition Theorem
## GANPAT UNIVERSITY FACULTY OF ENGINEERING
### 5.2 STAR-DELTA TRANSFORMATION THEOREM -
Applications for thevinin's norton's superposition. 2012-02-29В В· What are practical applications of Thevenin's Theorem please? Method of applications of Thevenin's and Norton's superposition theorem,Thevenin's, Separation logic + superposition calculus = heap theorem prover. while the development of practical automated deduction Now we ask a superposition-based.
### Circuits Thevenin Equivalent Circuit Principle of
Maximum Power Transfer Theorem DC Network. QUANTUM ENTANGLEMENT - Entanglement is beginning to have practical applications as well. But we have a coherent superposition of what time that was., Electrical Engineering Fundamentals: AC Circuit Analysis Course No: applications, complex math based Due to the practical applications of the process of.
2017-10-17В В· B Entanglement, what is it because one of the most practical applications of nor is the application of the no-cloning theorem to that important application Prefractal signals and the Shannon-Whittaker sampling theorem built as a product superposition of periodic for the practical applications of the
Superposition Theorem: Definition, Application & Examples The Application of Physics in Medicine Related Study Materials. Practical Application: There are numerous applications. The easiest and most commonplace I can think of right now, is the condition of not being able to hear anything.
The point of RO1 is to enable the highly theoretical KST to be applied in вЂreal-world’ applications. We have coded a two-variable superposition theorem using the high level language Python. However, the code runs extremely slowly. Superposition theorem can be applied in linear Can the superposition theorem be applied to What are the practical applications of Thevenins' theorem,
– Norton’s theorem uses a current source, whereas Thevenin’s theorem uses a voltage source. – Thevenin’s theorem uses a resistor in series, while Norton’s theorem uses a resister set in parallel with the source. – Norton’s theorem is actually a derivation of the Thevenin’s theorem. Superposition Theorem: Superposition Theorem Definition. The superposition principle applies to many areas of physics, Practical Application:
2018-10-04В В· This labs objective is to investigate the application of the superposition theorem to multiple DC source circuits in terms of Practical Engineering Find out information about Superposition Principle. physical laws as well as in practical applications. Superposition Principle; superposition theorem;
Circuits,Thevenin Equivalent Circuit,Principle of Superposition Theorem,Star Delta Control Circuit,Source Transformation In many practical applications, 2017-10-17В В· B Entanglement, what is it because one of the most practical applications of nor is the application of the no-cloning theorem to that important application
- Identify Practical Applications of Reciprocity in Spectral Radiators and Absorbers - State the Superposition Theorem National Open University of Nigeria . 2.3 Network theorems such as Thevenin’s theorem, superposition theorem Maximum practical applications with reasons for the same
2017-10-17В В· B Entanglement, what is it because one of the most practical applications of nor is the application of the no-cloning theorem to that important application Circuits,Thevenin Equivalent Circuit,Principle of Superposition Theorem,Star Delta Control Circuit,Source Transformation In many practical applications,
The Lorentz reciprocity theorem describes this case as well, The simplest general argument comes from a straightforward application of the divergence theorem: Norton's theorem application problem. up vote 2 down vote favorite. 1. The first image shows the circuit we start with. Application of superposition theorem. 0.
Superposition Theorem: Superposition Theorem Definition. The superposition principle applies to many areas of physics, Practical Application: 2012-02-29В В· What are practical applications of Thevenin's Theorem please? Method of applications of Thevenin's and Norton's superposition theorem,Thevenin's
4.6 Superposition Theorem f (g) Practical Applications of FOL, Resolution Theorem Provers • Applied to synthesis and verification of both 2012-02-29 · What are practical applications of Thevenin's Theorem please? Method of applications of Thevenin's and Norton's superposition theorem,Thevenin's
The Maximum Power Transfer Theorem is not so much a means of analysis as Practical applications of this might include radio transmitter Superposition Theorem. 2012-02-29В В· What are practical applications of Thevenin's Theorem please? Method of applications of Thevenin's and Norton's superposition theorem,Thevenin's
LAPLACE TRANSFORM AND ITS APPLICATION IN CIRCUIT its applications to differential equations Superposition theorem for linear systems (4) 2017-10-17В В· B Entanglement, what is it because one of the most practical applications of nor is the application of the no-cloning theorem to that important application
Circuits,Thevenin Equivalent Circuit,Principle of Superposition Theorem,Star Delta Control Circuit,Source Transformation In many practical applications, 5.2 STAR-DELTA TRANSFORMATION THEOREM We observe from the examples on application of Superposition Theorem in Sect. 5.1 …
3. Superposition Theorem. This theorem is applied when solving a circuit with more than one source to determine voltage/current for a specific element. To apply the theorem, we will look at each individual source alone and study its effects on the circuit. 3. Superposition Theorem. This theorem is applied when solving a circuit with more than one source to determine voltage/current for a specific element. To apply the theorem, we will look at each individual source alone and study its effects on the circuit.
5.2 STAR-DELTA TRANSFORMATION THEOREM We observe from the examples on application of Superposition Theorem in Sect. 5.1 … Passive Filter Circuits AC Electric Discuss possible applications of such a filter The follow-up question is yet another example of how practical the
The Maximum Power Transfer Theorem is not so much a means of analysis as Practical applications of this might include radio transmitter Superposition Theorem. The theorem is telling you the design is less than ideal if you measure something less, the practical applications of maximum power transfer theorem are 1:
The student will learn the methods used to solve problems using loop analysis, Nodal analysis, Thvenin's theorem, Norton's theorem, and the Superposition theorem. The maximum power transfer theorem is emphasized by demonstrating both theoretical and practical considerations of power expended versus power consumed. Chaotic Modeling and Simulation (CMSIM) 3: 355{368, 2018 Limit Theorems for Compound Renewal Processes: Theory and Application Nadiia Zinchenko Department of
The Liouville theorem of complex is a math theorem name after Joseph Liouville. The applications of the Liouville theorem of complex states that each bounded entire function h … as to be a constant, where the function is represented by 'f', the positive number by 'M' and the constant by 'C'. Norton's theorem application problem. up vote 2 down vote favorite. 1. The first image shows the circuit we start with. Application of superposition theorem. 0.
1.3 Sampling Theorem, 4 8 Signal Processing Applications 316 advanced and discusses the practical issues of choosing and defining specifications for For DC/AC Circuits courses requiring a comprehensive, classroom tested text with an emphasis on troubleshooting and the practical application of DC/AC principles and
### Pearson Principles of Electric Circuits Conventional
Applications of maximum power transfer theorem?. Superposition theorem can be applied in linear Can the superposition theorem be applied to What are the practical applications of Thevenins' theorem,, Identify the types of capacitors and know the practical applications of various types of capacitors. Superposition Theorem, Thevenin’s Theorem.
5.2 STAR-DELTA TRANSFORMATION THEOREM -. Identify the types of capacitors and know the practical applications of various types of Superposition Theorem, Thevenin’s Theorem, 2.3 Network theorems such as Thevenin’s theorem, superposition theorem Maximum practical applications with reasons for the same.
### GANPAT UNIVERSITY FACULTY OF ENGINEERING
What are the applications of lamis theorem?. Identify the types of capacitors and know the practical applications of various types of Superposition Theorem, Thevenin’s Theorem https://en.m.wikipedia.org/wiki/Applications_of_automated_theorem_proving What are advantage of Norton's Theorem over and Norton's theorem to reduce a amplifiers and stuff Based on application only you convert the.
Find out information about Superposition Principle. physical laws as well as in practical applications. Superposition Principle; superposition theorem; 2012-02-29В В· What are practical applications of Thevenin's Theorem please? Method of applications of Thevenin's and Norton's superposition theorem,Thevenin's
The Liouville theorem of complex is a math theorem name after Joseph Liouville. The applications of the Liouville theorem of complex states that each bounded entire function h … as to be a constant, where the function is represented by 'f', the positive number by 'M' and the constant by 'C'. QUANTUM ENTANGLEMENT - Entanglement is beginning to have practical applications as well. But we have a coherent superposition of what time that was.
In this chapter we will show its application for AC circuits. The superposition theorem states that in a linear circuit with several sources, the current and voltage for any element in the circuit is the sum of the currents and voltages produced by each source acting independently. The theorem is valid for any linear circuit. 2018-10-04В В· This labs objective is to investigate the application of the superposition theorem to multiple DC source circuits in terms of Practical Engineering
4.6 Superposition Theorem f (g) Practical Applications of FOL, Resolution Theorem Provers • Applied to synthesis and verification of both Network analysis is the one might transform a voltage generator into a current generator using Norton's theorem in order to be able in many practical
Verify the superposition theorem by analyzing practical data and Discuss about the reasons behind the achieved results and practical applications of the theorem There are numerous applications. The easiest and most commonplace I can think of right now, is the condition of not being able to hear anything.
Identify the types of capacitors and know the practical applications of various types of Superposition Theorem, Thevenin’s Theorem, Separation logic + superposition calculus = heap theorem prover. while the development of practical automated deduction Now we ask a superposition-based
In this chapter we will show its application for AC circuits. The superposition theorem states that in a linear circuit with several sources, the current and voltage for any element in the circuit is the sum of the currents and voltages produced by each source acting independently. The theorem is valid for any linear circuit. In electrical circuit theory, Thevenin’s theorem for linear electrical networks states that any combination of voltage sources, current sources and resistors with two terminals is electrically equivalent to a single voltage source V and a single series resistor R.
– Norton’s theorem uses a current source, whereas Thevenin’s theorem uses a voltage source. – Thevenin’s theorem uses a resistor in series, while Norton’s theorem uses a resister set in parallel with the source. – Norton’s theorem is actually a derivation of the Thevenin’s theorem. Superposition Theorem. 7. but possibly overheating of the amplifier due to the power dissipated in Practical applications of this
The bottom pair of graphs shows, on the left, the superposition of several weighted and shifted copies of g and, Applications of the convolution theorem What are advantage of Norton's Theorem over and Norton's theorem to reduce a amplifiers and stuff Based on application only you convert the
Network analysis is the one might transform a voltage generator into a current generator using Norton's theorem in order to be able in many practical Passive Filter Circuits AC Electric Discuss possible applications of such a filter The follow-up question is yet another example of how practical the
What are advantage of Norton's Theorem over and Norton's theorem to reduce a amplifiers and stuff Based on application only you convert the Electrical Engineering Fundamentals: AC Circuit Analysis Course No: applications, complex math based Due to the practical applications of the process of
## Prefractal signals and the Shannon-Whittaker sampling theorem
Experiment SuperPosition Theorem... Alamgir Niaz. The theorem is telling you the design is less than ideal if you measure something less, the practical applications of maximum power transfer theorem are 1:, Superposition Theorem. 7. but possibly overheating of the amplifier due to the power dissipated in Practical applications of this.
### Kirchhoff’s laws and their applications in solving
Entanglement what is it? Page 2 Physics Forums. For DC/AC Circuits courses requiring a comprehensive, classroom tested text with an emphasis on troubleshooting and the practical application of DC/AC principles and, Network analysis is the one might transform a voltage generator into a current generator using Norton's theorem in order to be able in many practical.
Network analysis is the one might transform a voltage generator into a current generator using Norton's theorem in order to be able in many practical Duhamel’s Theorem for Time-Dependent Thermal Boundary Conditions. of the superposition principle application. in the practical applications in order to
SUPERPOSITION THEOREM: According to the maximum power transfer theorem, This is acceptable for some applications in electronics and telecommunication, Superposition Theorem. Maximum Power Transfer Theorem. Reciprocity Theorem. So accordingly Kirchhoff Second Law, ∑V = 0. Application of Kirchhoff…
2018-10-04В В· This labs objective is to investigate the application of the superposition theorem to multiple DC source circuits in terms of Practical Engineering Norton's theorem application problem. up vote 2 down vote favorite. 1. The first image shows the circuit we start with. Application of superposition theorem. 0.
- Identify Practical Applications of Reciprocity in Spectral Radiators and Absorbers - State the Superposition Theorem National Open University of Nigeria . 5.2 STAR-DELTA TRANSFORMATION THEOREM We observe from the examples on application of Superposition Theorem in Sect. 5.1 …
A practical application of the rule was to check that buildings and plots of land What are the applications of superposition theorem? ion of super position Verify the superposition theorem by analyzing practical data and Discuss about the reasons behind the achieved results and practical applications of the theorem
SUPERPOSITION Theorem Practical applications of 3.The applications of Norton theorem is similar to that of Thevenin's theorem.The main application is Moritz von Jacobi published the maximum power (transfer) theorem motor was a practical alternative to practical applications of this theorem,
For DC/AC Circuits courses requiring a comprehensive, classroom tested text with an emphasis on troubleshooting and the practical application of DC/AC principles and What are advantage of Norton's Theorem over and Norton's theorem to reduce a amplifiers and stuff Based on application only you convert the
Passive Filter Circuits AC Electric Discuss possible applications of such a filter The follow-up question is yet another example of how practical the Application Of Thevenin Theorem Essay Sample. Application There are some applications of Thevenin’s Theorem in our daily lives. Thevenin’s Theorem …
The student will learn the methods used to solve problems using loop analysis, Nodal analysis, Thvenin's theorem, Norton's theorem, and the Superposition theorem. The maximum power transfer theorem is emphasized by demonstrating both theoretical and practical considerations of power expended versus power consumed. There are numerous applications. The easiest and most commonplace I can think of right now, is the condition of not being able to hear anything.
... Lab #5 Thevenin’s Theorem 1 Thevenin’s Theorem Lab What is the practical value of Thevenin Equivalent circuits? Give several practical applications Duhamel’s Theorem for Time-Dependent Thermal Boundary Conditions. of the superposition principle application. in the practical applications in order to
... Lab #5 Thevenin’s Theorem 1 Thevenin’s Theorem Lab What is the practical value of Thevenin Equivalent circuits? Give several practical applications superposition theorem solved problems with dependent deactivation of dc sourcealso learn about using different application to thevenin Practical Questions
The point of RO1 is to enable the highly theoretical KST to be applied in вЂreal-world’ applications. We have coded a two-variable superposition theorem using the high level language Python. However, the code runs extremely slowly. SUPERPOSITION THEOREM: According to the maximum power transfer theorem, This is acceptable for some applications in electronics and telecommunication,
Applications of Thevenin’s Theorem. To calculate the current in particular branch in the networks Thevenin Theorem is used. Designing of electronic circuits. The above applications are practical applications of thevenin theorem. Limitations of Thevenin’s Theorem. Thevenin’s theorem cannot be applied to a networks which contains non … Verify the superposition theorem by analyzing practical data and Discuss about the reasons behind the achieved results and practical applications of the theorem
2.3 Network theorems such as Thevenin’s theorem, superposition theorem Maximum practical applications with reasons for the same Verify the superposition theorem by analyzing practical data and Discuss about the reasons behind the achieved results and practical applications of the theorem
The class ends with application of these concepts in For a technician version of this course which focuses on the practical rather than Thevenin's Theorem. 4.6 Superposition Theorem f (g) Practical Applications of FOL, Resolution Theorem Provers • Applied to synthesis and verification of both
For DC/AC Circuits courses requiring a comprehensive, classroom tested text with an emphasis on troubleshooting and the practical application of DC/AC principles and Superposition theorem can be applied in linear Can the superposition theorem be applied to What are the practical applications of Thevenins' theorem,
superposition theorem solved problems with dependent deactivation of dc sourcealso learn about using different application to thevenin Practical Questions LAPLACE TRANSFORM AND ITS APPLICATION IN CIRCUIT its applications to differential equations Superposition theorem for linear systems (4)
The point of RO1 is to enable the highly theoretical KST to be applied in вЂreal-world’ applications. We have coded a two-variable superposition theorem using the high level language Python. However, the code runs extremely slowly. Superposition theorem can be applied in linear Can the superposition theorem be applied to What are the practical applications of Thevenins' theorem,
Superposition Theorem. Maximum Power Transfer Theorem. Reciprocity Theorem. So accordingly Kirchhoff Second Law, ∑V = 0. Application of Kirchhoff… In this chapter we will show its application for AC circuits. The superposition theorem states that in a linear circuit with several sources, the current and voltage for any element in the circuit is the sum of the currents and voltages produced by each source acting independently. The theorem is valid for any linear circuit.
Applications of Thevenin’s Theorem. To calculate the current in particular branch in the networks Thevenin Theorem is used. Designing of electronic circuits. The above applications are practical applications of thevenin theorem. Limitations of Thevenin’s Theorem. Thevenin’s theorem cannot be applied to a networks which contains non … Superposition theorem: Superposition theorem provides easy solution when a circuit is energized by a variety of sources. Consider a circuit energized by two AC sources …
### What are the applications of lamis theorem?
Superposition in AC Circuits. Applications of Thevenin’s Theorem. To calculate the current in particular branch in the networks Thevenin Theorem is used. Designing of electronic circuits. The above applications are practical applications of thevenin theorem. Limitations of Thevenin’s Theorem. Thevenin’s theorem cannot be applied to a networks which contains non …, Duhamel’s Theorem for Time-Dependent Thermal Boundary Conditions. of the superposition principle application. in the practical applications in order to.
Theory of nonstationary linear filtering in the Fourier. Electrical Engineering Fundamentals: AC Circuit Analysis Course No: applications, complex math based Due to the practical applications of the process of, The Maximum Power Transfer Theorem is not so much a means of analysis as Practical applications of this might include radio transmitter Superposition Theorem..
### Principles of Electric Circuits Pearson New International
Thevenin’s Theorem – APSEEE. Norton's theorem application problem. up vote 2 down vote favorite. 1. The first image shows the circuit we start with. Application of superposition theorem. 0. https://en.m.wikipedia.org/wiki/Applications_of_automated_theorem_proving What are the applications of lamis theorem? A practical application of the rule was to check that buildings and plots Superposition theorem can be applied.
1.3 Sampling Theorem, 4 8 Signal Processing Applications 316 advanced and discusses the practical issues of choosing and defining specifications for Identify the types of capacitors and know the practical applications of various types of capacitors. Superposition Theorem, Thevenin’s Theorem
1.3 Sampling Theorem, 4 8 Signal Processing Applications 316 advanced and discusses the practical issues of choosing and defining specifications for Fifty years after Bell's Theorem, Five Practical Uses for “Spooky” Quantum Mechanics which exist in a superposition of states—until they are measured,
SUPERPOSITION Theorem Practical applications of 3.The applications of Norton theorem is similar to that of Thevenin's theorem.The main application is The bottom pair of graphs shows, on the left, the superposition of several weighted and shifted copies of g and, Applications of the convolution theorem
Passive Filter Circuits AC Electric Discuss possible applications of such a filter The follow-up question is yet another example of how practical the Find out information about Superposition Principle. physical laws as well as in practical applications. Superposition Principle; superposition theorem;
Superposition theorem can be applied in linear Can the superposition theorem be applied to What are the practical applications of Thevenins' theorem, - Identify Practical Applications of Reciprocity in Spectral Radiators and Absorbers - State the Superposition Theorem National Open University of Nigeria .
2017-10-17В В· B Entanglement, what is it because one of the most practical applications of nor is the application of the no-cloning theorem to that important application The student will learn the methods used to solve problems using loop analysis, Nodal analysis, Thvenin's theorem, Norton's theorem, and the Superposition theorem. The maximum power transfer theorem is emphasized by demonstrating both theoretical and practical considerations of power expended versus power consumed.
... Lab #5 Thevenin’s Theorem 1 Thevenin’s Theorem Lab What is the practical value of Thevenin Equivalent circuits? Give several practical applications The maximum power transfer theorem states that in a linear , bilateral DC network , Practical Application of Maximum Power Transfer Theorem.
Circuit Analysis Theorems,Thevenin Equivalent Circuit,Principle of Superposition Theorem,Star Delta Control Circuit. In many practical applications, Verify the superposition theorem by analyzing practical data and Discuss about the reasons behind the achieved results and practical applications of the theorem
superposition theorem solved problems with dependent deactivation of dc sourcealso learn about using different application to thevenin Practical Questions In DC circuits this theorem state that the source can transfer maximum power when the total Applications of Maximum Application of Maximum Power Transfer.
– Norton’s theorem uses a current source, whereas Thevenin’s theorem uses a voltage source. – Thevenin’s theorem uses a resistor in series, while Norton’s theorem uses a resister set in parallel with the source. – Norton’s theorem is actually a derivation of the Thevenin’s theorem. The class ends with application of these concepts in For a technician version of this course which focuses on the practical rather than Thevenin's Theorem.
... Lab #5 Thevenin’s Theorem 1 Thevenin’s Theorem Lab What is the practical value of Thevenin Equivalent circuits? Give several practical applications Ch 3.1: Second Order Linear Homogeneous Equations with Constant Coefficients A second order ordinary differential equation has the general form
View all posts in Northern Territory category | 5,407 | 26,029 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.09375 | 3 | CC-MAIN-2022-49 | latest | en | 0.863738 |
http://mathoverflow.net/questions/85104/atiyah-patodi-singer-eta-invariant-and-chern-simons-form | 1,469,787,979,000,000,000 | text/html | crawl-data/CC-MAIN-2016-30/segments/1469257830064.24/warc/CC-MAIN-20160723071030-00240-ip-10-185-27-174.ec2.internal.warc.gz | 167,579,737 | 18,880 | # Atiyah-Patodi-Singer Eta invariant and Chern-Simons form
I am trying to understand the Atiyah-Patodi-Singer index theorem in the case of Dirac operators in four dimensions. I have three questions about the eta invariant:
1) Is eta a topological invariant (or geometric invariant)?
2) Which is its relation with the three dimensional Chern-Simons form?
3) In how many non-trivial cases the eta invariant is explicitly calculable?
-
1) The eta invariant itself depends on the metric, but the relative eta invariant is in many cases (see comments) a homotopy invariant. The relative eta invariant is defined to be the difference of the eta invariants associated to the Dirac operator twisted by two different flat Hermitian bundles (i.e. unitary representations of the fundamental group).
2) The relation between the eta invariant and Chern-Simons invariants is a little bit subtle, but it is explained in detail in section 4 of "Spectral Asymmetry and Riemannian Geometry II" by A-P-S.
3) Arguably the most important examples are lens spaces - this is how it was first realized that the defect in the signature theorem for manifolds with boundary is non-local, for example (if it were local it would be multiplicative for coverings). There is also an interesting paper called "Eta Invariants, Signature Defects of Cusps, and Values of L-Functions" by Atiyah, Donnelly, and Singer in which the eta invariant associated to the signature operator on a Hilbert modular variety with the cusps chopped off is calculated in terms of values of Shimazu L-functions. This was apparently one of the motivating examples for the theory of eta invariants, but I don't know what actual arithmetic significance it has.
-
thanks alot for your clear answer! – Gian Jan 8 '12 at 10:52
Actually the relative eta invariant (aka the "rho"-invariant) is not always a homotopy invariant. It fails for example in the case of Lens spaces. Homotopy invariance for rho-invariants has been shown by N.Keswani for manifolds whose fundamental grous are torsion-free and satisfy the maximal version of the Baum-Connes conjecture. See this paper: sciencedirect.com/science/article/pii/S0040938399000452 The eta-invariant is nevertheless a diffeomorphism and a spectral invariant. – Indrava Roy Mar 5 '12 at 11:19
Sorry, you're quite right. I did not mean to make such an absolute statement, and I edited the answer accordingly. – Paul Siegel Mar 5 '12 at 14:43
3) In how many non-trivial cases the eta invariant is explicitly calculable?
I have computed the eta invariants for the $spin^c$ Dirac operators on Seifert $3$-manifolds.
See this paper for the special case of circle bundles. Here I describe in some detail how one goes about computing eta invariants (never easy) and I included some references about computations of the eta invariant that arises in the APS problem for the signature operator. For the more general case of Seifert manifolds see this paper.
The lens spaces mentioned by Paul Siegel are special cases of Seifert manifolds.
-
Ad (3). Computing $\eta$-invariants on the nose is notoriously difficult. However, sometimes one needs $\eta$-invariants as ingredients of other differential topological invariants ($\rho$-invariants as in Pauls answer are an example. The Eells-Kuiper invariant is another one of a slightly different flavour). In this case, one can often compute $\eta$-invariants up to some correction terms, which are more accessible. Let me sketch a few things that work sometimes. Most, but not all of the following is explained in this overview article. Most of the following is applicable to 3-manifolds.
1. Direct computation from the spectrum of the operator. This works in very few cases where one does not expect $\eta(D)=0$ from the very beginning. The first problem is that one needs to know the spectrum. Hitchin did this for Berger spheres in his phd thesis. Somewhat related are the papers by Millson and Moscovici-Stanton that relate $\eta$-invariants of locally symmetric spaces (including hyperbolic 3-manifolds) to $\zeta$-functions associated with the geodesic flow.
2. Using the Atiyah-Patodi-Singer theorem. Try to find an explicit cobordism to a manifold where the $\eta$-invariant is known, and apply APS. Kruggel used this method to compute Kreck-Stolz invariants of Eschenburg spaces.
3. If $M$ admits a finite normal covering $M=\tilde M/\Gamma$ and the $\Gamma$-equivariant $\eta$-invariant of $\tilde M$ is known, one can recover $\eta$- and $\rho$-invariants of $M$. The computation of $\eta$-invariants for lense spaces is a combination of (2) and (3).
4. Find a similar operator $\tilde D$ on the same vector bundle, such that $\eta(\tilde D)$ is computable, then try to access the difference. This has been done by Deninger and Singhof for Heisenberg manifolds, or here for the cubical Dirac operator on quotients of compact Lie groups.
5. If the manifold $M$ happens to be a fibre bundle over a base $B$, one can use the adiabatic limit technique of Bismut-Cheeger and Dai. This also works for Seifert fibrations, see also Liviu's answer. However, one needs to know the $\eta$-forms of a family of fibrewise operators, and one has to assume that their kernels form a vector bundle over $B$.
6. If $M=M_-\cup_{M_0}M_+$ with $M_0$ totally geodesic, one can use a gluing theorem, see Kirk-Lesch. Now one needs to know the $\eta$-invariants of the pieces with respect to suitable boundary conditions, and a contribution from $M_0$ relating those boundary conditions. This technique has been applied here. | 1,340 | 5,557 | {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.765625 | 3 | CC-MAIN-2016-30 | latest | en | 0.861095 |
https://brainmass.com/economics/elasticity/calculating-price-elasticity-demand-374699 | 1,493,278,198,000,000,000 | text/html | crawl-data/CC-MAIN-2017-17/segments/1492917121893.62/warc/CC-MAIN-20170423031201-00430-ip-10-145-167-34.ec2.internal.warc.gz | 767,133,924 | 19,521 | Share
Explore BrainMass
# Calculating price elasticity of demand
Suppose that families with children ages 6-12 years old and families with children ages 15-21 years old have the following demand for tickets to Disney World. (10 points)
Quantity Demanded/Week Quantity Demanded/Week
Price per Ticket (families with 6-12 year olds) (families with 15-21 year olds)
\$ 50 3,100 1,000
75 2,900 700
100 2,600 500
125 2,400 400
? Calculate the price elasticity of demand for: (i) families with 6-12 year old children and; (ii) families with 15-21 year old children as the price per ticket rises from \$50 to \$75, and then increases from \$75 to \$100. Compute the simple average of these two elasticity estimates such that you have an average elasticity estimate for families with children ages 6-12 and families with children ages 15-21.
? Whose demand is more price sensitive, families with children ages 6-12 years old, or those with children ages 15-21 years old? Why do you think this is the case?
? Suppose that Disney know which group's demand is the more price inelastic. How does this knowledge influence Disney's decisions on pricing tickets to Disney World?
#### Solution Preview
Please refer attached file for complete solution. Expressions typed with the help of equation writer are missing here.
? Calculate the price elasticity of demand for: (i) families with 6-12 year old children and; (ii) families with 15-21 year old children as the price per ticket rises from \$50 to \$75, and then increases from \$75 to \$100. Compute the simple average of these two elasticity estimates such that you have an average elasticity estimate for families with children ages 6-12 and families with children ages ...
#### Solution Summary
The solution describes the steps to calculate price elasticity of demand. The quantity demanded and weeks are determined.
\$2.19 | 434 | 1,873 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.78125 | 4 | CC-MAIN-2017-17 | longest | en | 0.923569 |
https://community.powerbi.com/t5/Desktop/Calculate-SUM-in-matrix-not-showing-correct-values/m-p/1496219/highlight/true | 1,618,101,775,000,000,000 | text/html | crawl-data/CC-MAIN-2021-17/segments/1618038060603.10/warc/CC-MAIN-20210411000036-20210411030036-00412.warc.gz | 306,847,382 | 140,296 | cancel
Showing results for
Did you mean:
Helper I
## Calculate SUM in matrix not showing correct values
Hello,
I am trying to calculate the sum of numbers in Matrix but it is not showing correct values.
When I select department values then It is showing wrong values.
Below is my PBIX file. I want to calculate the SUM of FTE values as per department.
1 ACCEPTED SOLUTION
Community Support
If you want the sum of FTE in the total, try replace the maxx to sumx.
Total FTE = if(HASONEVALUE(Sickness[PersonnelNumber]),SUM(Sickness[FTE]),SUMX(SUMMARIZE(VALUES(Sickness[PersonnelNumber]),Sickness[PersonnelNumber],"ABCD",SUM(Sickness[FTE])),[ABCD]))
Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.
2 REPLIES 2
Community Support
If you want the sum of FTE in the total, try replace the maxx to sumx.
Total FTE = if(HASONEVALUE(Sickness[PersonnelNumber]),SUM(Sickness[FTE]),SUMX(SUMMARIZE(VALUES(Sickness[PersonnelNumber]),Sickness[PersonnelNumber],"ABCD",SUM(Sickness[FTE])),[ABCD]))
Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.
Super User IV
@paragchapre1 , Try the measure like
``Total FTE = SUMx(SUMMARIZE(Sickness,Sickness[Department],Sickness[Name],"_1",if(HASONEVALUE(Sickness[PersonnelNumber]),SUM(Sickness[FTE]),MAXX(SUMMARIZE(VALUES(Sickness[PersonnelNumber]),Sickness[PersonnelNumber],"ABCD",SUM(Sickness[FTE])),[ABCD]))),[_1])``
Proud to be a Super User!
Announcements | 416 | 1,570 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.171875 | 3 | CC-MAIN-2021-17 | latest | en | 0.720461 |
https://www.onlinemathlearning.com/divide-decimals-with-remainder.html | 1,670,078,982,000,000,000 | text/html | crawl-data/CC-MAIN-2022-49/segments/1669446710933.89/warc/CC-MAIN-20221203143925-20221203173925-00872.warc.gz | 974,912,053 | 9,874 | # Divide Decimals with Remainder
Examples, solutions, videos and lessons to help Grade 5 students learn how to divide decimals using place value understanding including remainders in the smallest unit.
### New York State Common Core Math Grade 5, Module 1, Lesson 15
Lesson 15 Concept Development
Problems 1–2
1.7 ÷ 2
7.7 ÷ 4
Lesson 15 Problem Set
Dividing decimals with remainders.
3. Six bakers shared 7.5 kg of flour equally. How much flour did they each receive?
Lesson 15 Homework
This video addresses division with remainders. The problem is solved using both a standard algorithm and a place value chart.
1. Draw number disks on the place value chart to solve, and show your steps using long division.
a. 0.7 ÷ 4 = _______
2. Solve using the standard algorithm.
c. 9 ÷ 4 =
3. A rope 8.7 m long is cut into 5 equal pieces. How long is each piece?
Lesson 15 Homework
1. Draw number disks on the place value chart to solve, and show your steps using long division.
b. 8.1 ÷ 5 = _______
2. Solve using the standard algorithm.
b. 3.9 ÷ 6 =
3. A rope 8.7 m long is cut into 5 equal pieces. How long is each piece?
4. Yasmine bought 6 gallons of apple juice. After filling up 4 bottles of the same size with apple juice, she had 0.3 gallon of apple juice left. What’s the amount of apple juice in each bottle?
Try the free Mathway calculator and problem solver below to practice various math topics. Try the given examples, or type in your own problem and check your answer with the step-by-step explanations. | 395 | 1,520 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 4.1875 | 4 | CC-MAIN-2022-49 | latest | en | 0.864003 |
http://gmrt.ncra.tifr.res.in/gmrt_hpage/Users/doc/WEBLF/LFRA/node12.html | 1,506,151,544,000,000,000 | text/html | crawl-data/CC-MAIN-2017-39/segments/1505818689572.75/warc/CC-MAIN-20170923070853-20170923090853-00682.warc.gz | 137,913,566 | 5,230 | Next: Interferometry and Aperture Synthesis Up: Signals in Radio Astronomy Previous: Cross Correlations Contents
# Mathematical details
This section gives some more mathematical details of topics mentioned in the main text of the chapter.
We first give the generalisation of the two variable gaussian to the joint distribution of variables. Defining the covariance matrix , and , then we have
The quadratic function in the exponent has been written in matrix notation with for transpose. In full, it is . Notice that the only information we need for the statistics of the amplitudes at different times is the autocorrelation function , evaluated at all time differences . Formally this is stated as the gaussian process is defined by its second order statistics''.
What would be practically useful is an explicit formula for the average value of an arbitrary product in terms of the second order statistics etc. The first step is to see that a product of an odd number of 's averages to zero. (The contributions from & cancel).
For the case of an even number of gaussian variables to be multiplied and averaged, there is a standard trick to evaluate an integral like . Define the Fourier transform of ,
It is a standard result, derived by the usual device of completing the square, that this Fourier transform is itself a gaussian function of the 's, given by
Differentiating with respect to and then , and putting all 's equal to zero, pulls down a factor into the integral and gives the desired average of . This trick now gives the average of the product of a string of 's in the form of the pairing theorem''. This is easier to state by an example.
A sincere attempt to differentiate with respect to and and then put all 's to zero will show that the 's get pulled down in precisely this combination. Deeper thought shows that the pairing rule works even when the 's are not all identical, i.e.,
or even
The last property is easily checked from the single variable gaussian
Since the pairing theorem allows one to calculate all averages, it could even be taken to define a gaussian signal, and that is what we do in the main text.
We now sketch a proof of the sampling theorem. Start with a band limited (i.e containing only frequencies less than ) signal sampled at the Nyquist rate, . The following expression gives a way of constructing a continuous signal from our samples.
It is also known as Whitaker's interpolation formula. Each sinc function is diabolically chosen to give unity at one sample point and zero at all the others, so is guaranteed to agree with our samples of . It is also band limited (Fourier transform of a flat function extending from to ). All that is left to check is that it has the same Fourier coefficients as (it does). And hence, we have reconstructed a band limited function from its Nyquist samples, as promised.
We add a few comments on the notion of Hilbert transform mentioned in the context of associating a complex signal with a real one. It looks rather innocent in the frequency domain, just subtract from the phase of each cosine in the Fourier series of and reassemble to get . In terms of complex Fourier coefficients, it is a multiplication of the positive frequency component by and of the corresponding negative frequency component by , Apart from the , this is just multiplication by a step function of the symmetric type, jumping from minus 1 to plus 1 at zero frequency. Hence, in the time domain, it is a convolution of by a kernel which is the Fourier transform of this step function, viz (the value t=0 being excluded by the usual principal value rule). Explicitly, we have
There is a similar formula relating to which only differs by a minus sign. This is sufficient to show that one needs values from the infinite past, and more disturbingly, future, of to compute . This is beyond the reach of ordinary mortals, even those equipped with the best filters and phase shifters. Practical schemes to derive the complex signal in real time thus have to make approximations as a concession to causality.
As remarked in the main text, there are many complex signals whose real parts would give our measured . The choice made above seemed natural because it was motivated by the quasimonochromatic case. It also has the mathematical property of creating a function which is very well behaved in the upper half plane of regarded as a complex variable, (should one ever want to go there). The reason is that is constructed to have terms like with only positive values of . Hence the pedantic name of analytic signal'' for this descendant of the humble phasor. It was the more general problem of continuing something given on the real axis to be well behaved in the upper half plane which attracted someone of Hilbert's IQ to this transform.
Next: Interferometry and Aperture Synthesis Up: Signals in Radio Astronomy Previous: Cross Correlations Contents
NCRA-TIFR | 996 | 4,937 | {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.90625 | 4 | CC-MAIN-2017-39 | latest | en | 0.908582 |
http://www.governmentadda.com/data-interpretation-quiz-for-upcoming-exams-2/ | 1,550,397,938,000,000,000 | text/html | crawl-data/CC-MAIN-2019-09/segments/1550247481832.13/warc/CC-MAIN-20190217091542-20190217113542-00560.warc.gz | 365,692,365 | 30,491 | Sunday , February 17 2019
Recent Post
Home / Quiz / Quantitative Aptitude Quiz / Data Interpretation / Data Interpretation Quiz For Upcoming Exams
# Data Interpretation Quiz For Upcoming Exams
Directions (1-5): Read the following pie-chart for the year 1998 and answer the questions given below it.
Please note: savings is not a part of expenditure.
Question 1: If the total amount spent during the year 1998 was Rs.46000, the amount spent on food was:
#### Get Best Maths Short Tricks Book With 2500+ Questions (50% Off)> Click Here
(a) Rs.2000
(b) Rs.12447
(c) Rs.23000
(d) Rs.2300
Question 2: If the total amount spent was Rs.46000, how much was spent on clothing and housing together?
(a) Rs.11500
(b) Rs.11050
(c) Rs.13529
(d) Rs.15000
Question 3: The ratio of the total amount of money spent on housing to that spent on education was:
(a) 5: 2
(b) 2: 5
(c) 4: 5
(d) 5: 4
Question 4: The given pie-chart shows that the maximum amount was spent on:
(a) Food
(b) Housing
(c) Clothing
(d) Others
Question 5: If the total expenditure of the family for the year 1998 was Rs.46000, the amount the family saved during the year is:
(a) Rs.1500
(b) Rs.15000
(c) Rs.6900
(d) Rs.8117
Directions (6-10) : The following questions are based on the pie-chart given below. Study the pie-chart and answer the questions.
Question 6: The central angle for the sector on “Paper-Cost” is
(a) 22½°
(b) 16°
(c) 54.8°
(d) 36°
Question 7: If the ‘Printing-cost’ is Rs. 17500, the royalty paid is
(a) Rs.8750
(b) Rs.7500
(c) Rs.3150
(d) Rs.6300
Question 8: If the “miscellaneous expenses” are Rs.6000, how much more are ‘binding and cutting charges” then ‘Royalty?
(a) Rs.6000
(b) Rs.5500
(c) Rs.4500
(d) Rs.10500
Question 9: The central angle corresponding to the sector on “Printing Cost” is more than that of “Advertisement Charges” by:
(a) 72°
(b) 61.2°
(c) 60°
(d) 54.8°
Question 10: The “Paper Cost” is approximately what per cent of “Printing cost”?
(a) 20.3%
(b) 28.5%
(c) 30%
(d) 32.5%
We provide all Govt Jobs Like Banking, SSC, FCI,UPSC, Railways and all other important government exams Study Materials,Tricks,Quizes,Notifications,Videos etc.
### Check Also
150+ RRB NTPC Previous Solved Papers PDF Free Download Now RRB NTPC Free Study Material …
error: | 718 | 2,285 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.921875 | 4 | CC-MAIN-2019-09 | latest | en | 0.889273 |
https://www.freezingblue.com/flashcards/print_preview.cgi?cardsetID=58321 | 1,511,442,458,000,000,000 | text/html | crawl-data/CC-MAIN-2017-47/segments/1510934806832.87/warc/CC-MAIN-20171123123458-20171123143458-00728.warc.gz | 793,134,677 | 5,037 | # 1.1.BKM Ch 06
Home > Preview
The flashcards below were created by user Exam9 on FreezingBlue Flashcards.
1. Risk-Free (rf) asset
• T-Bills are used as benchmark because:
• 1. free of default risk
• 2. short term nature makes it insensitive to interest rate risk
• 3. short term nature minimize exposure to inflation uncertainty
Expected return in XS of rf
3. Utility score of risky portfolio
• Used to quantify investor's risk aversion (determines if one risky prospect is better than another)
• U = E(r) - 0.5Aσ2
• where A = assumed risk aversion
4. Certainty equivalent rate of return
• Rate of return that would cause the investor to be indifferent between risky and rf investment.
• A portfolio is desirable only if its certainty ror > rf
5. Different types of investors
• Risk averse (A > 0): only considers inv w/ positive risk premium
• Risk neutral (A = 0): judges risks solely on E(r)
• Risk lover (A < 0): willing to engage in fair games and gambles
• A can be estimated by determining the price at which the investor is indifferent between buying insurance or bearing the risk.
6. Mean-variance (M-V) criterion
Portfolio A dominates B if E(rA) ≥ E(rB) and σA ≤ σB, with at least one strict inequality
7. Indifference curve
Line that connects all portfolios with the same utility value
8. Utility maximization point
y* = [E(rP) - rf] / AσP2
9. Capital Allocation Line
• Line representing the different allocation possibilities between risky and rf assets
• Equation: E(rc) = rf + S * σC
• Where S = [E(rP) - rf] / σP = Sharpe Ratio or Reward-to-Variability Ratio
10. Capital Market Line (CML)
Used when the risky index of the CAL is chosen as a broad index of common stocks (market proxy)
11. Passive strategy
Describes a portfolio decision that avoids any direct or indirect security analysis.
12. Common criticism of the passive strategy
• Undiversified: 25% of index is invested in top 10 firms. However funds usually adopt similar weights
• Top-Heavy: 500 top firms = 77% of mkt
• Chasing Performance
• You Can Do Better: evidence shows it's rare & rdm
### Card Set Information
Author: Exam9 ID: 58321 Filename: 1.1.BKM Ch 06 Updated: 2011-02-08 02:35:54 Tags: BKM Folders: Description: BKM Chap 09 Show Answers:
Home > Flashcards > Print Preview | 600 | 2,269 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.5625 | 3 | CC-MAIN-2017-47 | longest | en | 0.875 |
https://www.coursehero.com/file/p4cttef/Show-that-a-C-is-the-smallest-class-containing-C-which-is-closed-under-the/ | 1,544,387,033,000,000,000 | text/html | crawl-data/CC-MAIN-2018-51/segments/1544376823009.19/warc/CC-MAIN-20181209185547-20181209211547-00008.warc.gz | 994,305,848 | 128,888 | A Probability Path.pdf
# Show that a c is the smallest class containing c
• Test Prep
• 464
This preview shows pages 39–42. Sign up to view the full content.
Show that a (C) is the smallest class containing C which is closed under the formation of countable unions and intersections. 30. Let 8; be a-fields of subsets of Q fori = 1, 2. Show that the a-field 8t v 82 defined to be the smallest a-field containing both 8t and 82 is generated by sets of the form Bt n B2 where B; e 8; fori= 1, 2.
This preview has intentionally blurred sections. Sign up to view the full version.
1.9 Exercises 25 31. Suppose n is uncountable and let g be the a-field consisting of sets A such that either A is countable or A c is countable. Show g is NOT countably generated. (Hint: If 9 were countably generated, it would be generated by a countable collection of one point sets. ) In fact, if g is the a-field of subsets of n consisting of the countable and co-countable sets, g is countably generated iff Q is countable. 32. Suppose B1, B2 are a -fields of subsets of n such that B1 c Bz and B2 is countably generated. Show by example that it is not necessarily true that B1 is countably generated. 3 3. The extended real line. Let i = lR U {- oo} U { oo} be the extended or closed real line with the points -oo and oo added. The Borel sets B(JR) is the a-field generated by the sets [-oo,x],x E JR, where [-oo,x] = { -oo}U( -oo, x] . Show B(JR) is also generated by the following collections of sets: (i) [ -00, X), X E JR, (ii) (x, oo], x E JR, (ii) all finite intervals and { -oo} and { oo} . Now think of i = [ -oo, oo] as homeomorphic in the topological sense to [ -1, 1] under the transformation X X t-+ -- 1-lxl from [ -1, 1] to [ -oo, oo]. (This transformation is designed to stretch the finite interval onto the infinite interval.) Consider the usual topology on [ -1, 1] and map it onto a topology on [ -oo, oo] . This defines a collection of open sets on [ -oo, oo] and these open sets can be used to generate a Borel a-field. How does this a-field compare with B(JR) described above? 34. Suppose B is a a-field of subsets of n and suppose A ¢ B. Show that a(B U {A}), the smallest a-field containing both Band A consists of sets of the form ABu ACB', B, B' E B. 35. A a-field cannot be countably infinite. Its cardinality is either finite or at least that of the continuum. 36. Let n = {f, a, n, g}, and C = {{f, a, n}, {a, n}}. Find a(C). 37. Suppose n = Z, the natural numbers. Define for integer k kZ = {kz : z E Z}. Find B(C) when C is
26 1. Sets and Events (i) {3Z}. (ii) {3Z, 4Z}. (iii) {3Z, 4Z, 5Z}. (iv) {3Z, 4Z, 5Z, 6Z} . 38. Let n = IR 00 , the space of all sequences of the fonn (**) where Xi e R Let a be a pennutation of 1, . .. , n; that is , a is a 1-1 and onto map of {1, ... , n} {1, . . . , n}. If w is the sequence defined in(**), define a w to be the new sequence ( ) I Xu(j)• aw j = Xj, if j n, if j > n. A finite permutation is of the fonn a for some n; that is, it juggles a finite initial segment of all positive integers. A set A c Q is permutable if A= a A:= {aw: wE A} for all finite pennutations a . ( i) Let Bn , n 2: 1 be a sequence of subsets of R Show that and n {w = (xi, xz , . . . ) : L Xi E Bn i.o. } i=l n {w = (XJ,X2, .. . ) : V Xi E Bn i.o.} i=l are pennutable.
This preview has intentionally blurred sections. Sign up to view the full version.
This is the end of the preview. Sign up to access the rest of the document.
• Fall '08
• Staff
{[ snackBarMessage ]}
### What students are saying
• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.
Kiran Temple University Fox School of Business ‘17, Course Hero Intern
• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.
Dana University of Pennsylvania ‘17, Course Hero Intern
• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.
Jill Tulane University ‘16, Course Hero Intern | 1,293 | 4,443 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.65625 | 4 | CC-MAIN-2018-51 | latest | en | 0.925758 |
http://de.metamath.org/mpegif/df-bpoly.html | 1,611,684,178,000,000,000 | text/html | crawl-data/CC-MAIN-2021-04/segments/1610704803308.89/warc/CC-MAIN-20210126170854-20210126200854-00505.warc.gz | 27,529,951 | 6,242 | Metamath Proof Explorer < Previous Next > Nearby theorems Mirrors > Home > MPE Home > Th. List > df-bpoly Structured version Visualization version Unicode version
Definition df-bpoly 14112
Description: Define the Bernoulli polynomials. Here we use well-founded recursion to define the Bernoulli polynomials. This agrees with most textbook definitions, although explicit formulae do exist. (Contributed by Scott Fenton, 22-May-2014.)
Assertion
Ref Expression
df-bpoly BernPoly wrecs
Distinct variable group: ,,,,
Detailed syntax breakdown of Definition df-bpoly
StepHypRef Expression
1 cbp 14111 . 2 BernPoly
2 vm . . 3
3 vx . . 3
4 cn0 10876 . . 3
5 cc 9542 . . 3
62cv 1445 . . . 4
7 clt 9680 . . . . 5
8 vg . . . . . 6
9 cvv 3047 . . . . . 6
10 vn . . . . . . 7
118cv 1445 . . . . . . . . 9
1211cdm 4837 . . . . . . . 8
13 chash 12522 . . . . . . . 8
1412, 13cfv 5585 . . . . . . 7
153cv 1445 . . . . . . . . 9
1610cv 1445 . . . . . . . . 9
17 cexp 12279 . . . . . . . . 9
1815, 16, 17co 6295 . . . . . . . 8
19 vk . . . . . . . . . . . 12
2019cv 1445 . . . . . . . . . . 11
21 cbc 12494 . . . . . . . . . . 11
2216, 20, 21co 6295 . . . . . . . . . 10
2320, 11cfv 5585 . . . . . . . . . . 11
24 cmin 9865 . . . . . . . . . . . . 13
2516, 20, 24co 6295 . . . . . . . . . . . 12
26 c1 9545 . . . . . . . . . . . 12
27 caddc 9547 . . . . . . . . . . . 12
2825, 26, 27co 6295 . . . . . . . . . . 11
29 cdiv 10276 . . . . . . . . . . 11
3023, 28, 29co 6295 . . . . . . . . . 10
31 cmul 9549 . . . . . . . . . 10
3222, 30, 31co 6295 . . . . . . . . 9
3312, 32, 19csu 13764 . . . . . . . 8
3418, 33, 24co 6295 . . . . . . 7
3510, 14, 34csb 3365 . . . . . 6
368, 9, 35cmpt 4464 . . . . 5
374, 7, 36cwrecs 7032 . . . 4 wrecs
386, 37cfv 5585 . . 3 wrecs
392, 3, 4, 5, 38cmpt2 6297 . 2 wrecs
401, 39wceq 1446 1 BernPoly wrecs
Colors of variables: wff setvar class This definition is referenced by: bpolylem 14113
Copyright terms: Public domain W3C validator | 908 | 1,970 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.84375 | 3 | CC-MAIN-2021-04 | latest | en | 0.172683 |
http://www.bimonkey.com/tag/floor-maps/ | 1,516,395,895,000,000,000 | text/html | crawl-data/CC-MAIN-2018-05/segments/1516084888135.38/warc/CC-MAIN-20180119204427-20180119224427-00072.warc.gz | 401,147,928 | 11,116 | # The Geometry Data Type and SSRS Floorplan Reports
I was looking for a solution on how to build dynamic floorplans in SSRS, expecting to have to battle Visio to do such a thing. It turned out that a new data type, the Geometry spatial data type was introduced way back in SQL2008. This allows the creation and storage of polygon shapes in SQL Server. So now I have a database based mechanism to store objects on the floorplan, the floor itself and all the objects positions on the floor. Reporting Services can then surface all this using standard reporting capabilities.
## How the Geometry Data Type works
The Geometry data type works on a simple x,y coordinate system to describe a polygon (official MSDN docco here). It can get more complicated than that, but this is the basic idea:
On a simple zero based set of x,y coordinates, you describe the path you take around the polygon – importantly ending back where you started – using the coordinates of each point of the polygon. In the case above, I’ve used a square, so that needs 5 points:
1. 1,1 (start)
2. 3,1
3. 3,3
4. 1,3
5. 1,1 (finish back at start)
We can describe the Polygon construct as follows in T-SQL:
‘POLYGON((1 1, 3 1, 3 3, 1 3, 1 1))’
## Creating and loading a simple Geometry table
So, to use this data first we need to construct a table:
CREATE TABLE [dbo].[GeometryTest](
[ID] [int] NOT NULL,
[Shape] [geometry] NOT NULL,
[Name] [nvarchar](50) NOT NULL,
[Value] [int] NULL,
CONSTRAINT [PK_GeometryTest] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
Note there’s no configuration of the Geometry data type, or anything that needs to be enabled on the server to support this. I’ve included a Value column for the report, and an ID & Name column for metadata purposes.
Next I’ll load the table with a floorspace, and a few shapes – a couple of triangles and squares:
INSERT INTO [GeometryTest]
VALUES (1,’POLYGON((0 0, 7 0, 7 7, 0 7, 0 0))’,’Container’, NULL);
INSERT INTO [GeometryTest]
VALUES (2,’POLYGON((1 1, 3 1, 3 3, 1 3, 1 1))’,’Box One’,1);
INSERT INTO [GeometryTest]
VALUES (3,’POLYGON((4 1, 6 1, 6 3, 4 3, 4 1))’,’Box Two’,5);
INSERT INTO [GeometryTest]
VALUES (4,’POLYGON((1 4, 3 4, 3 6, 1 4))’,’Triangle One’,2);
INSERT INTO [GeometryTest]
VALUES (5,’POLYGON((4 4, 6 4, 4 6, 4 4))’,’Triangle Two’,3);
We can check this works with the handy spatial previewer in SSMS, running a select all against the table:
## Using SSRS to generate a Spatial report
Next, in SSDT (or BIDS, if not running SQL2012), create a new report with this table we just created and loaded as a data source. Drag a Map report item from the toolbox onto the report canvas, and choose to use a SQL Server Spatial Query as your data source. You should have a data set available – if not, just create one as a select * from the our test table. Click next to get to the previewer – it will autodetect your geometry column, so just click next again.
When choosing a report type, I’ve opted to take a Color Analytical Map, then clicked next. For the Analytical dataset, I’m reusing the same table as I stored the values with the shapes. At the Data Visualisation screen, we need to change the “Field to Visualise” to the [Sum(Value)] option as there’s no autodetect here. Then click finish.
To make it display in pretty colours, select the MapPolygonLayer object, and change the Polygon Rules > Colour Rules > Distribution Type property to “Equal Distribution”. Then run the report:
Simple, but proves a point and shows how you can create floorplan style reports from a dynamic data source. | 1,007 | 3,727 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.828125 | 3 | CC-MAIN-2018-05 | longest | en | 0.856679 |
http://masterexcel.net/tag/isna/ | 1,490,371,187,000,000,000 | text/html | crawl-data/CC-MAIN-2017-13/segments/1490218188213.41/warc/CC-MAIN-20170322212948-00139-ip-10-233-31-227.ec2.internal.warc.gz | 221,001,342 | 14,840 | ### Highline Excel 2013 Class Video 26
March 10, 2017
DESCRIPTION Topics in this video: 1. Is Item In List 2 also in List 1? Use MATCH and ISNUMBER. Comparing a prospective customer sales phone list to the companies master customer list. 2. Sort Dialog […]
### Dueling Excel 103
September 16, 2016
Find Missing Numbers In A Series DESCRIPTION See Mr Excel and excelisfun use two formula methods to Find Missing Numbers In A Series: See Mr Excel use the functions IF, ISNA, VLOOKUP, ROW, and SMALL […]
### Excel Magic Trick 1226
September 1, 2016
DESCRIPTION Compare 2 Lists, Extract Items In List 2 That are NOT in List 1 (6 Examples) Learn how to Compare 2 Lists, Extract Items In List 2 That are NOT in List 1: (00:12) […]
### Excel Magic Trick 1110
March 8, 2015
DESCRIPTION See how to compare two lists and extract records with an array formula that uses these functions: MATCH, ISNA, ISNUMBER, IF, ROWS, ROW, INDEX, AGGREGATE and a number of array operations. WORKBOOKS
### Excel Magic Trick 1109
March 7, 2015
DESCRIPTION See how to Compare Two Lists and Extract Records with Excel Advanced Filter: 1. Extract items in list 2 that are NOT in List 1 using Advanced Filter and Logical Formula in Criteria Area […]
### Excel Magic Trick 1108
March 6, 2015
DESCRIPTION See how to Compare Two Lists and Extract Records: 1. ISNA and MATCH function with Filter to extract items in list 2 that are NOT in List 1. 2. ISNUMBER and MATCH function with […]
### Excel Magic Trick 1101
February 27, 2015
DESCRIPTION See two formulas: (04:00) MEDIAN Lower/Upper Date, Exclude Holidays: MEDAIN with IF, ISNA and MATCH (08:29) MEDIAN Lower/Upper Date, Exclude Holidays: AGGREGATE, ISNA and MATCH and Array Calculations (12:40) MEDIAN Lower/Upper Date, Exclude Holidays […]
### Highline Excel 2013 Class Video 18
February 17, 2015
DESCRIPTION Topics in this video: (00:38) Why do we have to know lookup functions? (03:44) VLOOKUP, Exact Match. VLOOKUP delivers a value to the cell. (08:34) What happens if lookup value is not in your […]
### Highline Excel 2013 Class Video 15
February 14, 2015
DESCRIPTION Topics in this video: (00:33) IF Function to deliver numbers. (01:37) IF Function to deliver text. (03:19) IF Function to deliver formulas. (05:19) IF Function to deliver functions. (07:51) Nested IFs. (10:24) Null Text […]
### Excel Magic Trick 1098
February 5, 2015
DESCRIPTION See how to compare two e-mail lists where one list has extra semi-colons: (00:28) Find and Replace feature to remove semi-colons (Ctrl + H). (01:32) Is in List: MATCH and ISNUMBER functions. (03:20) Is […] | 710 | 2,609 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.15625 | 3 | CC-MAIN-2017-13 | longest | en | 0.816343 |
https://dqydj.com/rental-yield-calculator/ | 1,722,660,378,000,000,000 | text/html | crawl-data/CC-MAIN-2024-33/segments/1722640356078.1/warc/CC-MAIN-20240803025153-20240803055153-00642.warc.gz | 172,547,649 | 19,553 | # Rental Yield Calculator
Written by:
PK
On this page is a rental yield calculator. Enter the expected monthly or annual rent, plus the home or other asset or building's price, and the tool will compute the rental yield.
## What is the rental yield?
The rental yield compares the annual amount of rent an asset will demand to its final price, and computes a yield on the overall cost of an asset. It's the inverse of the price to rent ratio.
Generally, you use the annual rent to compute the rental yield, although in some specific situations monthly rent becomes important. The "1% rule of real estate" states that a building, home, or asset that rents for 1% of its total price is a good deal.
### Rental Yield Formula
The rental yield formula is:
rental\ yield=\frac{rent}{asset\ price}
Where:
• Rent - the annual amount of rent for someone to use the asset.
• Asset Price - the total price to purchase some asset, whether real property or virtual.
### Limitations on Rental Yield
The limitations of the rental yield are equivalent to those on the price to rent ratio
Ratios such as the capitalization ratios which use the NOI, or Net Operating Income, factor in both additional sources of income such as laundry or vending machines, along with typical annual expenses. Rental Yield only looks at one source of revenue and neglects to factor in expenses.
Additionally, NOI and Rent based metrics do not fully capture the expected return on investment. Since down payments can be much less than an asset's total price, the debt used to purchase an asset affects the investment's total return.
Finally, while yields and ratios let you compare assets quickly, they don't account for the assets' quality or global conditions. Assets might need many capital expenditures, be exposed to many natural disasters, or be at greater risk of crime. Global market conditions might mean all assets are overpriced, making some assets look better than they otherwise would.
In general, ratios and yields are just the first part of the story. It's up to you to model the rest.
### PK
PK started DQYDJ in 2009 to research and discuss finance and investing and help answer financial questions. He's expanded DQYDJ to build visualizations, calculators, and interactive tools.
PK lives in New Hampshire with his wife, kids, and dog.
### Don't Quit Your Day Job...
DQYDJ may be compensated by our partners if you make purchases through links. See our disclosures page. As an Amazon Associate we earn from qualifying purchases. | 539 | 2,528 | {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.75 | 3 | CC-MAIN-2024-33 | latest | en | 0.912474 |
https://www.kodytools.com/units/substance/from/teramole/to/millimole | 1,726,346,579,000,000,000 | text/html | crawl-data/CC-MAIN-2024-38/segments/1725700651580.74/warc/CC-MAIN-20240914193334-20240914223334-00391.warc.gz | 796,339,552 | 13,915 | # Teramole to Millimole Converter
1 Teramole = 1000000000000000 Millimoles
## One Teramole is Equal to How Many Millimoles?
The answer is one Teramole is equal to 1000000000000000 Millimoles and that means we can also write it as 1 Teramole = 1000000000000000 Millimoles. Feel free to use our online unit conversion calculator to convert the unit from Teramole to Millimole. Just simply enter value 1 in Teramole and see the result in Millimole.
Manually converting Teramole to Millimole can be time-consuming,especially when you don’t have enough knowledge about Amount of Substance units conversion. Since there is a lot of complexity and some sort of learning curve is involved, most of the users end up using an online Teramole to Millimole converter tool to get the job done as soon as possible.
We have so many online tools available to convert Teramole to Millimole, but not every online tool gives an accurate result and that is why we have created this online Teramole to Millimole converter tool. It is a very simple and easy-to-use tool. Most important thing is that it is beginner-friendly.
## How to Convert Teramole to Millimole (Tmol to mmol)
By using our Teramole to Millimole conversion tool, you know that one Teramole is equivalent to 1000000000000000 Millimole. Hence, to convert Teramole to Millimole, we just need to multiply the number by 1000000000000000. We are going to use very simple Teramole to Millimole conversion formula for that. Pleas see the calculation example given below.
$$\text{1 Teramole} = 1 \times 1000000000000000 = \text{1000000000000000 Millimoles}$$
## What Unit of Measure is Teramole?
Teramole is a unit of measurement for amount of substance. Teramole is a multiple of amount of substance unit mole. One teramole is equal to 1e12 moles.
## What is the Symbol of Teramole?
The symbol of Teramole is Tmol. This means you can also write one Teramole as 1 Tmol.
## What Unit of Measure is Millimole?
Millimole is a unit of measurement for amount of substance. Millimole is a decimal fraction of amount of substance unit mole. One millimole is equal to 0.001 moles.
## What is the Symbol of Millimole?
The symbol of Millimole is mmol. This means you can also write one Millimole as 1 mmol.
## How to Use Teramole to Millimole Converter Tool
• As you can see, we have 2 input fields and 2 dropdowns.
• From the first dropdown, select Teramole and in the first input field, enter a value.
• From the second dropdown, select Millimole.
• Instantly, the tool will convert the value from Teramole to Millimole and display the result in the second input field.
Teramole
1
Millimole
1000000000000000
# Teramole to Millimole Conversion Table
Teramole [Tmol]Millimole [mmol]Description
1 Teramole1000000000000000 Millimole1 Teramole = 1000000000000000 Millimole
2 Teramole2000000000000000 Millimole2 Teramole = 2000000000000000 Millimole
3 Teramole3000000000000000 Millimole3 Teramole = 3000000000000000 Millimole
4 Teramole4000000000000000 Millimole4 Teramole = 4000000000000000 Millimole
5 Teramole5000000000000000 Millimole5 Teramole = 5000000000000000 Millimole
6 Teramole6000000000000000 Millimole6 Teramole = 6000000000000000 Millimole
7 Teramole7000000000000000 Millimole7 Teramole = 7000000000000000 Millimole
8 Teramole8000000000000000 Millimole8 Teramole = 8000000000000000 Millimole
9 Teramole9000000000000000 Millimole9 Teramole = 9000000000000000 Millimole
10 Teramole10000000000000000 Millimole10 Teramole = 10000000000000000 Millimole
100 Teramole100000000000000000 Millimole100 Teramole = 100000000000000000 Millimole
1000 Teramole1000000000000000000 Millimole1000 Teramole = 1000000000000000000 Millimole
# Teramole to Other Units Conversion Table
ConversionDescription
1 Teramole = 1000000000000 Mole1 Teramole in Mole is equal to 1000000000000
1 Teramole = 100000000000 Dekamole1 Teramole in Dekamole is equal to 100000000000
1 Teramole = 10000000000 Hectomole1 Teramole in Hectomole is equal to 10000000000
1 Teramole = 1000000000 Kilomole1 Teramole in Kilomole is equal to 1000000000
1 Teramole = 1000000 Megamole1 Teramole in Megamole is equal to 1000000
1 Teramole = 1000 Gigamole1 Teramole in Gigamole is equal to 1000
1 Teramole = 0.001 Petamole1 Teramole in Petamole is equal to 0.001
1 Teramole = 0.000001 Examole1 Teramole in Examole is equal to 0.000001
1 Teramole = 10000000000000 Decimole1 Teramole in Decimole is equal to 10000000000000
1 Teramole = 100000000000000 Centimole1 Teramole in Centimole is equal to 100000000000000
1 Teramole = 1000000000000000 Millimole1 Teramole in Millimole is equal to 1000000000000000
1 Teramole = 1000000000000000000 Micromole1 Teramole in Micromole is equal to 1000000000000000000
1 Teramole = 1e+21 Nanomole1 Teramole in Nanomole is equal to 1e+21
1 Teramole = 1e+24 Picomole1 Teramole in Picomole is equal to 1e+24
1 Teramole = 1e+27 Femtomole1 Teramole in Femtomole is equal to 1e+27
1 Teramole = 1e+30 Attomole1 Teramole in Attomole is equal to 1e+30
1 Teramole = 6.02214076e+35 Atom1 Teramole in Atom is equal to 6.02214076e+35 | 1,606 | 5,062 | {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.921875 | 3 | CC-MAIN-2024-38 | latest | en | 0.885468 |
https://www.physicsforums.com/threads/inequalities-and-absolute-value.348375/ | 1,508,241,976,000,000,000 | text/html | crawl-data/CC-MAIN-2017-43/segments/1508187821088.8/warc/CC-MAIN-20171017110249-20171017130249-00592.warc.gz | 1,013,249,809 | 16,723 | # Inequalities and absolute value
1. Oct 23, 2009
### highcontrast
1. The problem statement, all variables and given/known data
1) x^5 > x^2
2) 7| x + 2 | + 5 > 4
3) 3 - | 2x + 4 | <= 1
2. Relevant equations
3. The attempt at a solution
1)
x5 - x2 > 0
x2(x3 - 1) > 0
x2(x - 1)(x2 + x + 1) > 0
Im not too sure what to do next. I cant factor it any further, at least I dont think so. Which leads me to ask how exactly am I suppose to find the numbers to check what the solution is?
2)
7| x + 2 | + 5 > 4
7| x + 2 | > -1
|x + 2 | > -1/7
Can this be correct? The absolute value must always equal 0, or a positive number, right? How would I go about solving this? Or should I say the solutions do not exist?
3)
3 - | 2x + 4 | <= 1
- | 2x + 4 | <= -2
| 2x + 4 | => 2
2x + 4 => 2
2x => -2
x => -1
or
2x + 4 <= -2
2x <= -6
x <= -3
2. Oct 23, 2009
### Bohrok
For 1), now that you've factored it, find where the graph crosses the x-axis to get some intervals between those points. Each interval will be either above or below the x-axis.
I must have thought the the inequality sign for 2) was the other way...
The absolute value of a real number is always ≥0, so |x + 2| > -1/7 is always true, for any real x.
3 seems correct.
Last edited: Oct 23, 2009
3. Oct 23, 2009
### Pagan Harpoon
When at |x + 2 | > -1/7, recall that this is an inequality, not an equation, it doesn't say that |x+2| is less than 0, it says that it is greater than -1/7. No value for x would make this untrue, so x can be any real number.
4. Oct 23, 2009
### hominid
x5 - x2 > 0
x2(x3 - 1) > 0
x2(x - 1)(x2 + x + 1) > 0
Solving an inequality would mean to express the solution as a union of intervals. In this case, which values of x will result in a value greater than 0 when plugged into the inequality.
5. Oct 24, 2009
### highcontrast
So, I should go about solving the equation then?
Such as,
x + 2 > -1/7
x > -1/7 - 2
x > -15/7
or
x + 2 < 1/7
x < -13/7
It seems these answers conflict, though. How can x be greater than -15/7, and less than
-13/7.
I'm rather confused about absolute value because they have drilled it into my head that they always must be positive, or 0. So, when I saw an absolute inequality with it saying > -1/7, I assumed that the absolute value, while greater than 1/7, was still a negative. Does this mean in the cases of absolute values and inequalities, it doesn't matter if there is a negative value after one of the <,> signs?
Thanks Again
Last edited: Oct 24, 2009
6. Oct 24, 2009
### hominid
Think of an absolute value as a distance in that a distance is going to be positive. The statement is true because since you know |x + 2| is always positive, you know |x + 2| is greater than -1/7 no matter what value of x you plug in. Remember it is not an equation, so it even if it said |x + 2| > -100,000 it would still be true.
7. Oct 24, 2009
### highcontrast
I understand. Was the posted solution to that question correct? The answers left me confused.
8. Oct 24, 2009
### hominid
Don't think of plugging those values of x into |x + 2 | > -1/7. You're trying to find out which values of x make this statement true: 7| x + 2 | + 5 > 4. Try plugging your solution into the inequality for x and then seeing if that proves true.
9. Oct 24, 2009
### highcontrast
I plugged them, and they work. I was just concerned because the textbook asks for me to solve the question also in a graph form.
10. Oct 24, 2009
### hominid
Since you are confused that the answers seem to overlap, think about what that means. It means that all real numbers are included.
11. Oct 24, 2009
### highcontrast
That makes sense! | 1,174 | 3,639 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.953125 | 4 | CC-MAIN-2017-43 | longest | en | 0.910563 |
https://www.physicsforums.com/threads/finding-net-force-on-charges-on-xy-plane.258174/ | 1,606,417,905,000,000,000 | text/html | crawl-data/CC-MAIN-2020-50/segments/1606141188899.42/warc/CC-MAIN-20201126171830-20201126201830-00176.warc.gz | 802,562,488 | 16,527 | # Finding net force on charges on xy plane
## Homework Statement
A proton is on the x axis at x = 1.2 nm. An electron is on the y axis at y = 1.2 nm.
Find the net force the two exert on a helium nucleus (charge +2e) at the origin.
## Homework Equations
electron charge, e = -1.6*10^-19 coulombs
proton charge, + e = + 1.6*10^-19 coulombs
distance, r = 1.2 nm = 1.2*10^-9 m
constant, k = 9*10^9
force in newtons, F = kq_1q_2/r^2 where q_1 and q_2 represent point charge
## The Attempt at a Solution
charge at origin = +2e = 3.2*10^-19 coulombs
Fy = force y axis = electron and origin charge = [(9*10^9)(-1.6*10^-19)(3.2*10^-19)]/(1.2*10^-9)2 = - 3.2*10^-10 newtons
Fx = force y axis = proton and origin charge = [(9*10^9)(+1.6*10^-19)(3.2*10^-19)]/(1.2*10^-9)2 = - 3.2*10^-10 newtons
Fnet = sqrt(Fy^2 + Fx^2) = sqrt(2.048*10^-19) = 4.5255*10^-10 newtons
i entered these and they were wrong:
Fx, Fy = 4.53*10^-10, -4.53*10^-10
Fx, Fy = 3.2*10^-10, -3.2*10^-10
are my calculations correct? what should i enter?
Related Introductory Physics Homework Help News on Phys.org
yea, i solved that problem the same way. the problem is in the book, and using that same equation for Fx, Fy i got the same answer as the solution in the book. but when i did the problem on mp (my numbers were different) the answer was wrong - and i solved it the SAME way. aghhh im sooo lost. i dont know why its wrong =/
i originally had the signs wrong, Fx is actually -3.2*10^-10, my Fy is wrong, it is a positive value though. why is it wrong, i thought the two forces would be equal in magnitude.
it says my Fy value is "you may have made a rounding error or used the wrong number of significant figures." it is currently Fy = 3.2*10^-10
i would have thought it would have been the same in your problem, just opposite signs, since your distances are the same. mine are different for the x-axis and y-axis, so i dont know - my answer's not even right =( im finishing up mp tomorrow afternoon though - kinda late - but im sure i'll get the rest of it by then, if ur still working on it
i tried to run the calculations again and i am still getting 3.2*10^-10, is there any reason why the forces should have different magnitudes? it doesn't seem to make sense
ok, i tried my answer and it keeps coming out wrong - i dont think i messed up on any of my calculations...
i had 1.7 nm distance on the x-axis for the proton, and 1.3 nm distance on the y-axis for the electron. everything else is the same.
my equations were:
Fx= -k (e)(2e)/(1.7*10-9)2 = -(9*109)(1.6*10-19)(3.2*10-19)/(2.89*10-18) = -(4.608*10-28)/(2.89*10-18) = -1.594*10-10 N
Fx= k (e)(2e)/(1.3*10-9)2 = (9*109)(1.6*10-19)(3.2*10-19)/(1.69*10-18) = (4.608*10-28)/(1.69*10-18) = 2.726*10-10 N
i solved the problem in the book the same way, with their numbers and it was right.... but i dont know what i did wrong here...? mp marked my answers wrong with no suggestions or anything - so its like they're completely off. any idea why?
Last edited:
i think your answer is right - MP had the wong answers. she's making it a practice problem now so we don't lose points. | 1,026 | 3,121 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.59375 | 4 | CC-MAIN-2020-50 | latest | en | 0.922503 |
http://www.rosettacode.org/wiki/Amb | 1,558,436,170,000,000,000 | text/html | crawl-data/CC-MAIN-2019-22/segments/1558232256314.52/warc/CC-MAIN-20190521102417-20190521124417-00441.warc.gz | 338,232,078 | 67,644 | # Amb
Amb
You are encouraged to solve this task according to the task description, using any language you may know.
Define and give an example of the Amb operator.
The Amb operator expresses nondeterminism. This doesn't refer to randomness (as in "nondeterministic universe") but is closely related to the term as it is used in automata theory ("non-deterministic finite automaton").
The Amb operator takes a variable number of expressions (or values if that's simpler in the language) and yields a correct one which will satisfy a constraint in some future computation, thereby avoiding failure.
Problems whose solution the Amb operator naturally expresses can be approached with other tools, such as explicit nested iterations over data sets, or with pattern matching. By contrast, the Amb operator appears integrated into the language. Invocations of Amb are not wrapped in any visible loops or other search patterns; they appear to be independent.
Essentially Amb(x, y, z) splits the computation into three possible futures: a future in which the value x is yielded, a future in which the value y is yielded and a future in which the value z is yielded. The future which leads to a successful subsequent computation is chosen. The other "parallel universes" somehow go away. Amb called with no arguments fails.
For simplicity, one of the domain values usable with Amb may denote failure, if that is convenient. For instance, it is convenient if a Boolean false denotes failure, so that Amb(false) fails, and thus constraints can be expressed using Boolean expressions like Amb(x * y == 8) which unless x and y add to four.
A pseudo-code program which satisfies this constraint might look like:
```let x = Amb(1, 2, 3)
let y = Amb(7, 6, 4, 5)
Amb(x * y = 8)
print x, y```
The output is `2 4` because `Amb(1, 2, 3)` correctly chooses the future in which `x` has value `2`, `Amb(7, 6, 4, 5)` chooses `4` and consequently `Amb(x * y = 8)` produces a success.
Alternatively, failure could be represented using strictly `Amb()`:
`unless x * y = 8 do Amb()`
Or else Amb could take the form of two operators or functions: one for producing values and one for enforcing constraints:
```let x = Ambsel(1, 2, 3)
let y = Ambsel(4, 5, 6)
Ambassert(x * y = 8)
print x, y```
where `Ambassert` behaves like `Amb()` if the Boolean expression is false, otherwise it allows the future computation to take place, without yielding any value.
The task is to somehow implement Amb, and demonstrate it with a program which chooses one word from each of the following four sets of character strings to generate a four-word sentence:
1. `"the" "that" "a"`
2. `"frog" "elephant" "thing"`
3. `"walked" "treaded" "grows"`
4. `"slowly" "quickly"`
The constraint to be satisfied is that the last character of each word (other than the last) is the same as the first character of its successor.
The only successful sentence is `"that thing grows slowly"`; other combinations do not satisfy the constraint and thus fail.
The goal of this task isn't to simply process the four lists of words with explicit, deterministic program flow such as nested iteration, to trivially demonstrate the correct output. The goal is to implement the Amb operator, or a facsimile thereof that is possible within the language limitations.
## 11l
Translation of: Nim
`F amb(comp, options, prev = ‘’) -> Array[String] I options.empty R [] L(opt) options[0] // If this is the base call, prev is empty and we need to continue. I prev != ‘’ & !comp(prev, opt) L.continue // Take care of the case where we have no options left. I options.len == 1 R [opt] // Traverse into the tree. V res = amb(comp, options[1..], opt) // If it was a failure, try the next one. if !res.empty R opt [+] res // We have a match R [] V sets = [[‘the’, ‘that’, ‘a’], [‘frog’, ‘elephant’, ‘thing’], [‘walked’, ‘treaded’, ‘grows’], [‘slowly’, ‘quickly’]] V result = amb((s, t) -> s.last == t[0], sets)print(result.join(‘ ’))`
Output:
`that thing grows slowly`
`with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;with Ada.Text_IO; use Ada.Text_IO; procedure Test_Amb is type Alternatives is array (Positive range <>) of Unbounded_String; type Amb (Count : Positive) is record This : Positive := 1; Left : access Amb; List : Alternatives (1..Count); end record; function Image (L : Amb) return String is begin return To_String (L.List (L.This)); end Image; function "/" (L, R : String) return Amb is Result : Amb (2); begin Append (Result.List (1), L); Append (Result.List (2), R); return Result; end "/"; function "/" (L : Amb; R : String) return Amb is Result : Amb (L.Count + 1); begin Result.List (1..L.Count) := L.List ; Append (Result.List (Result.Count), R); return Result; end "/"; function "=" (L, R : Amb) return Boolean is Left : Unbounded_String renames L.List (L.This); begin return Element (Left, Length (Left)) = Element (R.List (R.This), 1); end "="; procedure Failure (L : in out Amb) is begin loop if L.This < L.Count then L.This := L.This + 1; else L.This := 1; Failure (L.Left.all); end if; exit when L.Left = null or else L.Left.all = L; end loop; end Failure; procedure Join (L : access Amb; R : in out Amb) is begin R.Left := L; while L.all /= R loop Failure (R); end loop; end Join; W_1 : aliased Amb := "the" / "that" / "a"; W_2 : aliased Amb := "frog" / "elephant" / "thing"; W_3 : aliased Amb := "walked" / "treaded" / "grows"; W_4 : aliased Amb := "slowly" / "quickly";begin Join (W_1'Access, W_2); Join (W_2'Access, W_3); Join (W_3'Access, W_4); Put_Line (Image (W_1) & ' ' & Image (W_2) & ' ' & Image (W_3) & ' ' & Image (W_4));end Test_Amb;`
The type Amb is implemented with the operations "/" to construct it from strings. Each instance keeps its state. The operation Failure performs back tracing. Join connects two elements into a chain. The implementation propagates Constraint_Error when matching fails.
Output:
```that thing grows slowly
```
## ALGOL 68
Works with: ELLA ALGOL 68 version Any (with appropriate job cards) - tested with release 1.8-8d
Note: This program violates ALGOL 68's scoping rules when a locally scoped procedure is returned to a more global scope. ELLA ALGOL 68RS misses this violation, but ALGOL 68 Genie spots it at run time and then produces an assert. However ELLA ALGOL 68RS does produce the desired result, but may potentially suffer from "mysterious" stack problems.
`MODE PAGE = FLEX[0]STRING;MODE YIELDPAGE = PROC(PAGE)VOID;MODE ITERPAGE = PROC(YIELDPAGE)VOID; OP INITITERPAGE = (PAGE self)ITERPAGE: (YIELDPAGE yield)VOID: # scope violation # FOR i TO UPB self DO yield(self[i]) OD; OP + = (ITERPAGE for strings, PAGE b)ITERPAGE: (YIELDPAGE yield)VOID: # scope violation # for strings((PAGE amb)VOID:( [UPB amb + 1]STRING joined; joined[:UPB amb] := amb; STRING last string := amb[UPB amb]; CHAR last char := last string[UPB last string]; FOR i TO UPB b DO IF last char = b[i][1] THEN joined[UPB joined] := b[i]; yield(joined) FI OD )); OP + = (PAGE a, PAGE b)ITERPAGE: INITITERPAGE a + b; ITERPAGE gen amb := PAGE("the", "that", "a") + PAGE("frog", "elephant", "thing") + PAGE("walked", "treaded", "grows") + PAGE("slowly", "quickly"); PAGE sep;#FOR PAGE amb IN # gen amb( # ) DO ### (PAGE amb)VOID: print((amb[1]+" "+amb[2]+" "+amb[3]+" "+amb[4], new line))#OD# )`
Output:
```that thing grows slowly
```
## ATS
` (* ****** ****** *)//#include"share/atspre_staload.hats"#include"share/HATS/atspre_staload_libats_ML.hats"//(* ****** ****** *)//staload "libats/ML/SATS/monad_list.sats"staload _ = "libats/ML/DATS/monad_list.dats"//(* ****** ****** *)//datatypewords = | Sing of stringGt(0) | Comb of (words, words)//(* ****** ****** *)//externfun words_get_beg(words): charexternfun words_get_end(words): char//(* ****** ****** *)//implementwords_get_beg(w0) =(case+ w0 of| Sing(cs) => cs[0]| Comb(w1, w2) => words_get_beg(w1))//implementwords_get_end(w0) =(case+ w0 of| Sing(cs) => cs[pred(length(cs))]| Comb(w1, w2) => words_get_end(w2))//(* ****** ****** *)//funwords_comb( w1: words, w2: words) : list0(words) = if (words_get_end(w1)=words_get_beg(w2)) then list0_sing(Comb(w1, w2)) else list0_nil()//(* ****** ****** *)//externfunfprint_words: fprint_type(words)//overload fprint with fprint_words//implementfprint_words(out, ws) =(case+ ws of| Sing(w) => fprint(out, w)| Comb(w1, w2) => fprint!(out, w1, ' ', w2))//implement fprint_val<words> = fprint_words//(* ****** ****** *)//typedefa = stringGt(0) and b = words//val ws1 = \$list{a}("this", "that", "a")val ws1 = list_map_fun<a><b>(ws1, lam(x) => Sing(x))val ws1 = monad_list_list(list0_of_list_vt(ws1))//val ws2 = \$list{a}("frog", "elephant", "thing")val ws2 = list_map_fun<a><b>(ws2, lam(x) => Sing(x))val ws2 = monad_list_list(list0_of_list_vt(ws2))//val ws3 = \$list{a}("walked", "treaded", "grows")val ws3 = list_map_fun<a><b>(ws3, lam(x) => Sing(x))val ws3 = monad_list_list(list0_of_list_vt(ws3))//val ws4 = \$list{a}("slowly", "quickly")val ws4 = list_map_fun<a><b>(ws4, lam(x) => Sing(x))val ws4 = monad_list_list(list0_of_list_vt(ws4))//(* ****** ****** *)//valws12 =monad_bind2<b,b><b> (ws1, ws2, lam (w1, w2) => monad_list_list(words_comb(w1, w2)))valws123 =monad_bind2<b,b><b> (ws12, ws3, lam (w12, w3) => monad_list_list(words_comb(w12, w3)))valws1234 =monad_bind2<b,b><b> (ws123, ws4, lam (w123, w4) => monad_list_list(words_comb(w123, w4)))//(* ****** ****** *) implement main0 () ={ val () = fprintln! (stdout_ref, "ws1234 = ", ws1234)} (* ****** ****** *) `
## AutoHotkey
Search autohotkey.com: [1]
Source: AMB - Ambiguous selector by infogulch
`set1 := "the that a" set2 := "frog elephant thing" set3 := "walked treaded grows" set4 := "slowly quickly" MsgBox % amb( "", set1, set2, set3, set4 ) ; this takes a total of 17 iterations to complete amb( char = "", set1 = "", set2 = "", set3 = "", set4 = "" ) { ; original call to amb must leave char param blank Loop, Parse, set1, %A_Space% If (char = (idxchar := SubStr(A_LoopField, 1, 1)) && set2 = "" || (char = idxchar || char = "") && ((retval:= amb(SubStr(A_LoopField, 0, 1), set2, set3, set4)) != "")) Return A_LoopField " " retval Return "" }`
## Bracmat
`( ( Amb = first last list words word solution . !arg:(?first.?list) & ( !list: | !list:(.?words) ?list & !words : ? %( @(?word:!first ? @?last) & Amb\$(!last.!list):?solution & !word !solution:?solution ) ? & !solution ) )& Amb \$ ( . (.the that a) (.frog elephant thing) (.walked treaded grows) (.slowly quickly) ))`
`that thing grows slowly`
## C
Note: This uses the continuations code from https://web.archive.org/web/20120619201518/http://homepage.mac.com:80/sigfpe/Computing/continuations.html
`typedef const char * amb_t; amb_t amb(size_t argc, ...){ amb_t *choices; va_list ap; int i; if(argc) { choices = malloc(argc*sizeof(amb_t)); va_start(ap, argc); i = 0; do { choices[i] = va_arg(ap, amb_t); } while(++i < argc); va_end(ap); i = 0; do { TRY(choices[i]); } while(++i < argc); free(choices); } FAIL;} int joins(const char *left, const char *right) { return left[strlen(left)-1] == right[0]; } int _main() { const char *w1,*w2,*w3,*w4; w1 = amb(3, "the", "that", "a"); w2 = amb(3, "frog", "elephant", "thing"); w3 = amb(3, "walked", "treaded", "grows"); w4 = amb(2, "slowly", "quickly"); if(!joins(w1, w2)) amb(0); if(!joins(w2, w3)) amb(0); if(!joins(w3, w4)) amb(0); printf("%s %s %s %s\n", w1, w2, w3, w4); return EXIT_SUCCESS;}`
## C#
The implementation of the Amb class
`using System;using System.Collections.Generic; public class Amb : IDisposable{ List<IValueSet> streams = new List<IValueSet>(); List<IAssertOrAction> assertsOrActions = new List<IAssertOrAction>(); volatile bool stopped = false; public IAmbValue<T> DefineValues<T>(params T[] values) { return DefineValueSet(values); } public IAmbValue<T> DefineValueSet<T>(IEnumerable<T> values) { ValueSet<T> stream = new ValueSet<T>(); stream.Enumerable = values; streams.Add(stream); return stream; } public Amb Assert(Func<bool> function) { assertsOrActions.Add(new AmbAssert() { Level = streams.Count, IsValidFunction = function }); return this; } public Amb Perform(Action action) { assertsOrActions.Add(new AmbAction() { Level = streams.Count, Action = action }); return this; } public void Stop() { stopped = true; } public void Dispose() { RunLevel(0, 0); if (!stopped) { throw new AmbException(); } } void RunLevel(int level, int actionIndex) { while (actionIndex < assertsOrActions.Count && assertsOrActions[actionIndex].Level <= level) { if (!assertsOrActions[actionIndex].Invoke() || stopped) return; actionIndex++; } if (level < streams.Count) { using (IValueSetIterator iterator = streams[level].CreateIterator()) { while (iterator.MoveNext()) { RunLevel(level + 1, actionIndex); } } } } interface IValueSet { IValueSetIterator CreateIterator(); } interface IValueSetIterator : IDisposable { bool MoveNext(); } interface IAssertOrAction { int Level { get; } bool Invoke(); } class AmbAssert : IAssertOrAction { internal int Level; internal Func<bool> IsValidFunction; int IAssertOrAction.Level { get { return Level; } } bool IAssertOrAction.Invoke() { return IsValidFunction(); } } class AmbAction : IAssertOrAction { internal int Level; internal Action Action; int IAssertOrAction.Level { get { return Level; } } bool IAssertOrAction.Invoke() { Action(); return true; } } class ValueSet<T> : IValueSet, IAmbValue<T>, IValueSetIterator { internal IEnumerable<T> Enumerable; private IEnumerator<T> enumerator; public T Value { get { return enumerator.Current; } } public IValueSetIterator CreateIterator() { enumerator = Enumerable.GetEnumerator(); return this; } public bool MoveNext() { return enumerator.MoveNext(); } public void Dispose() { enumerator.Dispose(); } }} public interface IAmbValue<T>{ T Value { get; }} public class AmbException : Exception{ public AmbException() : base("AMB is angry") { }}`
Usage:
` // original problem using (Amb amb = new Amb()) { var set1 = amb.DefineValues("the", "that", "a"); var set2 = amb.DefineValues("frog", "elephant", "thing"); var set3 = amb.DefineValues("walked", "treaded", "grows"); var set4 = amb.DefineValues("slowly", "quickly"); amb.Assert(() => IsJoinable(set1.Value, set2.Value)); amb.Assert(() => IsJoinable(set2.Value, set3.Value)); amb.Assert(() => IsJoinable(set3.Value, set4.Value)); amb.Perform(() => { System.Console.WriteLine("{0} {1} {2} {3}", set1.Value, set2.Value, set3.Value, set4.Value); amb.Stop(); }); } // problem from http://www.randomhacks.net/articles/2005/10/11/amb-operator using (Amb amb = new Amb()) { IAmbValue<int> x = amb.DefineValues(1, 2, 3); IAmbValue<int> y = amb.DefineValues(4, 5, 6); amb.Assert(() => x.Value * y.Value == 8); amb.Perform(() => { System.Console.WriteLine("{0} {1}", x.Value, y.Value); amb.Stop(); }); }`
The following is a more idiomatic and not (or less) idiosyncratic C# version of Amb. The above uses a clever but unorthodox use of Dispose() to launch the backtracking (and a few other interesting quirks). Interesting but it can throw an exception in Dispose() which is strongly discouraged in C#.
The following was written independently but borrows some ideas/help from the previous solution. There are still limitations compared to the spirit of Amb, requiring an explicit run (called Disambiguate() normally but RequireFinal() - which calls Disambiguate() internally -is used to get closer to the spirit here) but, compared to many other language solutions here, it does have the explicit Require, meaning it is a general solution, not tied to the specific example in this task.(I suggest the task description is updated to ensure that a general amb operator is provided rather than a custom one for the single provided example). It uses a ToString override to return Value.ToString(), again to help in the spirit of things, but if the variables were used directly, one would have to be use the Value property instead.
Also the internal algorithm allows manual external tuning minimising the verification steps required. This is shown in the ordering of the choices and requirements in the problem to be solved. This, I think, is closer to the spirit of Amb, as defined here, although really this is quite different to McCarthy's class of ambiguous functions.
Works with: C# version 7.1
`using System;using System.Collections.Generic; namespace Amb{ public interface IValue<T> { T Value { get; } string ToString(); } public sealed class Amb { public IValue<T> Choose<T>(params T[] choices) { var array = new ChoiceArray<T> { Values = choices }; _itemsChoices.Add(array); return array; } public void Require(Func<bool> predicate) => _constraints.Add(new Constraint { Predicate = predicate, AppliesForItems = _itemsChoices.Count }); public bool RequireFinal(Func<bool> predicate) { Require(predicate); return Disambiguate(); } public bool Disambiguate() { try { Disambiguate(0, 0); return false; } catch (Exception ex) when (ex.Message == "Success") { return true; } } interface IChoices { int Length { get; } int Index { get; set; } } interface IConstraint { int AppliesForItems { get; } bool Invoke(); } List<IChoices> _itemsChoices = new List<IChoices>(); List<IConstraint> _constraints = new List<IConstraint>(); void Disambiguate(int itemsTracked, int constraintIndex) { while (constraintIndex < _constraints.Count && _constraints[constraintIndex].AppliesForItems <= itemsTracked) { if (!_constraints[constraintIndex].Invoke()) return; constraintIndex++; } if (itemsTracked == _itemsChoices.Count) { throw new Exception("Success"); } for (var i = 0; i < _itemsChoices[itemsTracked].Length; i++) { _itemsChoices[itemsTracked].Index = i; Disambiguate(itemsTracked + 1, constraintIndex); } } class Constraint : IConstraint { internal int AppliesForItems; int IConstraint.AppliesForItems => AppliesForItems; internal Func<bool> Predicate; public bool Invoke() => Predicate?.Invoke() ?? default; } class ChoiceArray<T> : IChoices, IValue<T> { internal T[] Values; public int Index { get; set; } public T Value { get { return Values[Index]; } } public int Length => Values.Length; public override string ToString() => Value.ToString(); } }}`
Usage:
`using System.Linq;using static System.Console; namespace Amb{ class Program { static void Main(string[] args) { var amb = new Amb(); var set1 = amb.Choose("the", "that", "a"); var set2 = amb.Choose("frog", "elephant", "thing"); amb.Require(() => set1.Value.Last() == set2.Value[0]); var set3 = amb.Choose("walked", "treaded", "grows"); amb.Require(() => set2.Value.Last() == set3.Value[0]); var set4 = amb.Choose("slowly", "quickly"); amb.RequireFinal(() => set3.Value.Last() == set4.Value[0]); WriteLine(\$"{set1} {set2} {set3} {set4}"); Read(); // problem from http://www.randomhacks.net/articles/2005/10/11/amb-operator amb = new Amb(); var x = amb.Choose(1, 2, 3); var y = amb.Choose(4, 5, 6); amb.RequireFinal(() => x.Value* y.Value == 8); WriteLine(\$"{x} * {y} = 8"); Read(); Read(); } }}`
Output:
```that thing grows slowly
2 * 4 = 8```
## Clojure
`(ns amb (:use clojure.contrib.monads)) (defn amb [wss] (let [valid-word (fn [w1 w2] (if (and w1 (= (last w1) (first w2))) (str w1 " " w2)))] (filter #(reduce valid-word %) (with-monad sequence-m (m-seq wss))))) amb> (amb '(("the" "that" "a") ("frog" "elephant" "thing") ("walked" "treaded" "grows") ("slowly" "quickly")))(("that" "thing" "grows" "slowly")) `
## Common Lisp
Common Lisp lacks the `call/cc` present in Scheme, and so the straightforward implementation using continuations would require a full-blown code walker (and could still have some issues with dynamically bound variables). A workable compromise uses the condition system and some convenience macros to define `amblet` a binding construct like `let` except that if a variable's init-form is of the form `(amb {form}*)` the `amblet`'s body will be evaluated with the variable bound to successive values produced by each `form` until some evaluation does not signal an `amb-error`.
`(define-condition amb-failure () () (:report "No amb alternative succeeded.")) (defun invoke-ambiguously (function thunks) "Call function with successive values produced by successivefunctions in thunks until some invocation of function does not signalan amb-failure." (do ((thunks thunks (rest thunks))) ((endp thunks) (error 'amb-failure)) (let ((argument (funcall (first thunks)))) (handler-case (return (funcall function argument)) (amb-failure ()))))) (defmacro amblet1 ((var form) &body body) "If form is of the form (amb {form}*) then amblet1 is a convenientsyntax for invoke-ambiguously, by which body is evaluated with varbound the results of each form until some evaluation of body does notsignal an amb-failure. For any other form, amblet binds var the resultof form, and evaluates body." (if (and (listp form) (eq (first form) 'amb)) `(invoke-ambiguously #'(lambda (,var) ,@body) (list ,@(loop for amb-form in (rest form) collecting `#'(lambda () ,amb-form)))) `(let ((,var ,form)) ,@body))) (defmacro amblet (bindings &body body) "Like let, except that if an init-form is of the form (amb {form}*),then the corresponding var is bound with amblet1." (if (endp bindings) `(progn ,@body) `(amblet1 ,(first bindings) (amblet ,(rest bindings) ,@body))))`
Example:
```> (flet ((string-adjacent (s1 s2)
(char= (char s1 (1- (length s1)))
(char s2 0))))
(amblet ((w1 (amb "the" "that" "a"))
(w2 (amb "frog" "elephant" "thing"))
(w4 (amb "slowly" "quickly")))
(list w1 w2 w3 w4)
(signal 'amb-failure))))
("that" "thing" "grows" "slowly")```
### Macro with dynamic variables
`(defparameter *amb-ops* nil)(defparameter *amb-hist* nil) (setf *random-state* (make-random-state t))(defun shuffle (items) (loop for i from 0 with r = items with l = (length r) while (< i l) do (rotatef (elt r i) (elt r (+ i (random (- l i))))) finally (return r))) ;;; (assert '(mess in, mess out))(defmacro amb (a &rest rest) (let ((f (first rest)) (rest (rest rest))) (if (not f) `(let ((items (shuffle ,a))) (let ((y (car (last *amb-hist*))) (o (car (last *amb-ops*)))) (loop for x in items do (if (or (not *amb-ops*) (funcall o y x)) (return (append *amb-hist* (list x)))) (elt items (random (length items)))))) `(let ((items (shuffle ,a))) (let ((y (car (last *amb-hist*))) (o (car (last *amb-ops*)))) (loop for x in items do (if (or (not *amb-ops*) (funcall o y x)) (let ((*amb-hist* (append *amb-hist* (list x))) (*amb-ops* (append *amb-ops* (list ,f)))) (let ((r ,@rest)) (if r (return r))))))))))) ;; test cases(defun joins (a b) (char= (char a (1- (length a))) (char b 0))) (defun w34() (amb '("walked" "treaded" "grows") #'joins (amb '("slowly" "quickly")))) (print (amb '("the" "that" "a") #'joins (amb '("frog" "elephant" "thing") #'joins (w34)))) (print (amb '(1 2 5) #'< (amb '(2 3 4) #'= (amb '(3 4 5))))) ; 1 4 4, 2 3 3, etc`
## D
`import std.stdio, std.array; /** This amb function takes a comparison function andthe possibilities that need to be checked.*///string[] amb(in bool function(in string, in string) pure comp,const(string)[] amb(in bool function(in string, in string) pure comp, in string[][] options, in string prev = null) pure { if (options.empty) return null; foreach (immutable opt; options.front) { // If this is the base call, prev is null and we need to // continue. if (!prev.empty && !comp(prev, opt)) continue; // Take care of the case where we have no options left. if (options.length == 1) return [opt]; // Traverse into the tree. const res = amb(comp, options[1 .. \$], opt); // If it was a failure, try the next one. if (!res.empty) return opt ~ res; // We have a match! } return null; // No matches.} void main() { immutable sets = [["the", "that", "a"], ["frog", "elephant", "thing"], ["walked", "treaded", "grows"], ["slowly", "quickly"]]; // Pass in the comparator and the available sets. // (The comparator is not nothrow because of UTF.) const result = amb((s, t) => s.back == t.front, sets); if (result.empty) writeln("No matches found!"); else writefln("%-(%s %)", result);}`
Output:
`that thing grows slowly`
## E
Some lines in this example are too long (more than 80 characters). Please fix the code if it's possible and remove this message.
E does not currently have any kind of backtracking control flow (though there is a proposal in the works to backtrack upon exceptions, for the sake of consistency). However, since (Almost) Everything Is Message Passing, we can create an object which represents a set of possible values.
This is complicated, however, by the fact that any given amb must appear to produce only one result; that is, `def x := amb(["a", "b"]); x + x` produces aa or bb, not aa,bb,ab,ba as `amb(["a", "b"]) + amb(["a", "b"])` would. Therefore, each choice is associated with the decisions which produced it: a map from amb objects to which member of them was chosen; any combination of two ambs discards any combination of choices which have inconsistent decisions.
Note that the choices are not evaluated lazily; this is a breadth-first rather than depth-first search through possibilities. Also, every amb remembers all of the ambs which produced it. As such, this is probably not a practical system for large problems.
`pragma.enable("accumulator") def [amb, unamb] := { # block hides internals def Choice := Tuple[any, Map] def [ambS, ambU] := <elib:sealing.makeBrand>("amb") var counter := 0 # Used just for printing ambs /** Check whether two sets of decisions are consistent */ def consistent(decA, decB) { def overlap := decA.domain() & decB.domain() for ambObj in overlap { if (decA[ambObj] != decB[ambObj]) { return false } } return true } /** From an amb object, extract the possible choices */ def getChoices(obj, decisions) :List[Choice] { if (decisions.maps(obj)) { return [[decisions[obj], decisions]] } else if (ambU.amplify(obj) =~ [[choices, _]]) { return accum [] for [chosen, dec] ? (consistent(decisions, dec)) in choices { _ + getChoices(chosen, (decisions | dec).with(obj, chosen)) } } else { return [[obj, decisions]] } } /** Construct an amb object with remembered decisions */ def ambDec(choices :List[Choice]) { def serial := (counter += 1) def ambObj { to __printOn(out) { out.print("<amb(", serial, ")") for [chosen, decisions] in choices { out.print(" ", chosen) for k => v in decisions { out.print(";", ambU.amplify(k)[0][1], "=", v) } } out.print(">") } to __optSealedDispatch(brand) { if (brand == ambS.getBrand()) { return ambS.seal([choices, serial]) } } match [verb, args] { var results := [] for [rec, rdec] in getChoices(ambObj, [].asMap()) { def expandArgs(dec, prefix, choosing) { switch (choosing) { match [] { results with= [E.call(rec, verb, prefix), dec] } match [argAmb] + moreArgs { for [arg, adec] in getChoices(argAmb, dec) { expandArgs(adec, prefix.with(arg), moreArgs) } } } } expandArgs(rdec, [], args) } ambDec(results) } } return ambObj } /** Construct an amb object with no remembered decisions. (public interface) */ def amb(choices) { return ambDec(accum [] for c in choices { _.with([c, [].asMap()]) }) } /** Get the possible results from an amb object, discarding decision info. (public interface) */ def unamb(ambObj) { return accum [] for [c,_] in getChoices(ambObj, [].asMap()) { _.with(c) } } [amb, unamb]}`
`def join(a, b) { # This must not use the builtin if, since it coerces to boolean rather than passing messages. # false.pick(x, y) returns y and true.pick(x, y) returns x; we protect the amb([]) from causing # unconditional failure by putting both options in functions. # <=> is the comparison operator that happens to be message-based. return (a.last() <=> b[0]).pick(fn { a + " " + b }, fn { amb([]) })()} def w1 := amb(["the", "that", "a" ])def w2 := amb(["frog", "elephant", "thing" ])def w3 := amb(["walked", "treaded", "grows" ])def w4 := amb(["slowly", "quickly" ]) unamb(join(join(join(w1, w2), w3), w4))`
This can be compared with the Haskell use of lists as a monad to represent choice.
• Haskell uses lazy evaluation; E does not. This implementation does not simulate lazy evaluation with thunks; it is eager (computes every intermediate choice before continuing) and therefore inefficient if you only need one successful result.
• Haskell does not need to track decisions. This is because when using a monad in Haskell, the points of choice are explicitly written, either by monadic operators or combinators. The analogues to the two "ab" operations given above are: `do x <- ["a","b"]; return (x ++ x)` and `do x <- ["a","b"]; y <- ["a","b"]; return (x ++ y)` — the relevant difference being the number of `<-` operators. In this implementation, we instead absorb the choice into normal method calls; the Haskell analogue would be something like `instance Monoid a => Monoid (Amb a) where Amb ... `mconcat` Amb ... = ...`, which would have a similar need to track decisions.
## Egison
` ; We don't need 'amb' in the code since pattern-matching of Egison automatically do backtracking.(match-all {{"the" "that" "a"} {"frog" "elephant" "thing"} {"walked" "treaded" "grows"} {"slowly" "quickly"}} (list (multiset string)) [<cons <cons (& <snoc \$c_1 _> \$w_1) _> (loop \$i [2 \$n] <cons <cons (& <cons ,c_(- i 1) <snoc \$c_i _>> \$w_i) _> ...> <nil>)> (map (lambda [\$i] w_i) (between 1 n))]) `
Output:
` {{"that" "thing" "grows" "slowly"}} `
## Ela
This example is incorrect. Please fix the code and remove this message.Details: The comparison is hard-coded into amb
`open list core amb xs = x where (Some x) = & join xs "" join (x::xs) = amb' x (join xs) join [] = \_ -> Some "" eq' [] x = true eq' w x = last w == head x amb' [] _ _ = None amb' (x::xs) n w | eq' w x = match n x with Some v = Some (x ++ " " ++ v) _ = amb' xs n w | else = amb' xs n w`
Usage:
`amb [ ["the","that","a"] ,["frog","elephant","thing"] ,["walked","treaded","grows"] ,["slowly","quickly"] ]`
## Elena
ELENA 4.0 :
`import system'routines;import extensions;import extensions'routines; joinable(former,later) = (former[former.Length - 1] == later[0]); dispatcher ={ eval(object a, Func2 f) { ^ f(a[0],a[1]) } eval(object a, Func3 f) { ^ f(a[0], a[1],a[2]) } eval(object a, Func4 f) { ^ f(a[0],a[1],a[2],a[3]) } eval(object a, Func5 f) { ^ f(a[0],a[1],a[2],a[3],a[4]) }}; class AmbValueCollection{ object theCombinator; constructor new(params object[] args) { theCombinator := SequentialEnumerator.new(params args) } seek(cond) { theCombinator.reset(); theCombinator.seekEach:(v => dispatcher.eval(v,cond)) } do(f) { var result := theCombinator.get(); if (nil != result) { dispatcher.eval(result,f) } else { InvalidArgumentException.raise() } }} singleton ambOperator{ for(params object[] args) = AmbValueCollection.new(params args);} public program(){ try { ambOperator .for(new {"the","that","a"},new {"frog", "elephant", "thing"},new {"walked", "treaded", "grows"}, new {"slowly", "quickly"}) .seek:(a,b,c,d => joinable(a,b) && joinable(b,c) && joinable(c,d) ) .do:(a,b,c,d) { console.printLine(a," ",b," ",c," ",d) } } catch(Exception e) { console.printLine:"AMB is angry" }; console.readChar()}`
Output:
```that thing grows slowly
```
## ERRE
This example is incorrect. Please fix the code and remove this message.Details: Conditional is hard-coded into amb
` PROGRAM AMB !! for rosettacode.org! !\$KEY DIM SET1\$[2],SET2\$[2],SET3\$[2],SET4\$[2] FUNCTION WORDS_OK(STRING1\$,STRING2\$) WORDS_OK=(RIGHT\$(STRING1\$,1)=LEFT\$(STRING2\$,1))END FUNCTION PROCEDURE AMB(SET1\$[],SET2\$[],SET3\$[],SET4\$[]->RESULT\$) RESULT\$="" ! Empty string, e.g. fail FOR A=0 TO 2 DO FOR B=0 TO 2 DO FOR C=0 TO 2 DO FOR D=0 TO 2 DO IF WORDS_OK(SET1\$[A],SET2\$[B]) AND WORDS_OK(SET2\$[B],SET3\$[C]) AND WORDS_OK(SET3\$[C],SET4\$[D]) THEN RESULT\$=SET1\$[A]+" "+SET2\$[B]+" "+SET3\$[C]+" "+SET4\$[D] EXIT PROCEDURE END IF END FOR END FOR END FOR END FOREND PROCEDURE BEGIN PRINT(CHR\$(12);) ! CLS SET1\$[0]="the" SET1\$[1]="that" SET1\$[2]="a" SET2\$[0]="frog" SET2\$[1]="elephant" SET2\$[2]="thing" SET3\$[0]="walked" SET3\$[1]="treaded" SET3\$[2]="grows" SET4\$[0]="slowly" SET4\$[1]="quickly" SET4\$[2]="" AMB(SET1\$[],SET2\$[],SET3\$[],SET4\$[]->TEXT\$) IF TEXT\$<>"" THEN PRINT("Correct sentence would be:") PRINT(TEXT\$) ELSE PRINT("Failed to fine a correct sentence.") END IF PRINT PRINT("Press any key to exit.") REPEAT GET(Z\$) UNTIL LEN(Z\$)<>0END PROGRAM `
## Factor
`USING: backtrack continuations kernel prettyprint sequences ;IN: amb CONSTANT: words { { "the" "that" "a" } { "frog" "elephant" "thing" } { "walked" "treaded" "grows" } { "slowly" "quickly" }} : letters-match? ( str1 str2 -- ? ) [ last ] [ first ] bi* = ; : sentence-match? ( seq -- ? ) dup rest [ letters-match? ] 2all? ; : select ( seq -- seq' ) [ amb-lazy ] map ; : search ( -- ) words select dup sentence-match? [ " " join ] [ fail ] if . ; MAIN: search`
Running it from the listener :
```( scratchpad ) "amb" run
"that thing grows slowly"
```
## F#
Important differences to the Haskell solution:
• The list monad is not predefined in F#. (But it is easy to define it.)
• F# is not lazy, so this will check all combinations even if we just want one solution.
`// define the List "workflow" (monad)type ListBuilder() = member o.Bind( lst, f ) = List.concat( List.map (fun x -> f x) lst ) member o.Return( x ) = [x] member o.Zero() = [] let list = ListBuilder() let amb = id // last element of a sequencelet last s = Seq.nth ((Seq.length s) - 1) s // is the last element of left the same as the first element of right?let joins left right = last left = Seq.head right let example = list { let! w1 = amb ["the"; "that"; "a"] let! w2 = amb ["frog"; "elephant"; "thing"] let! w3 = amb ["walked"; "treaded"; "grows"] let! w4 = amb ["slowly"; "quickly"] if joins w1 w2 && joins w2 w3 && joins w3 w4 then return String.concat " " [w1; w2; w3; w4] } printfn "%s" (List.head example)`
## Go
Solution with goroutines. See description on talk page.
`package main import ( "fmt" "sync") func ambStrings(ss []string) chan []string { c := make(chan []string) go func() { for _, s := range ss { c <- []string{s} } close(c) }() return c} func ambChain(ss []string, cIn chan []string) chan []string { cOut := make(chan []string) go func() { var w sync.WaitGroup for chain := range cIn { w.Add(1) go func(chain []string) { for s1 := range ambStrings(ss) { if s1[0][len(s1[0])-1] == chain[0][0] { cOut <- append(s1, chain...) } } w.Done() }(chain) } w.Wait() close(cOut) }() return cOut} func main() { s1 := []string{"the", "that", "a"} s2 := []string{"frog", "elephant", "thing"} s3 := []string{"walked", "treaded", "grows"} s4 := []string{"slowly", "quickly"} c := ambChain(s1, ambChain(s2, ambChain(s3, ambStrings(s4)))) for s := range c { fmt.Println(s) }}`
Output:
```[that thing grows slowly]
```
Alternative solution:
`package mainimport "fmt" func amb(wordsets [][]string, res []string) bool { if len(wordsets) == 0 { return true } var s string l := len(res) if l > 0 { s = res[l - 1] } res = res[0:len(res) + 1] for _, res[l] = range(wordsets[0]) { if l > 0 && s[len(s) - 1] != res[l][0] { continue } if amb(wordsets[1:len(wordsets)], res) { return true } } return false} func main() { wordset := [][]string { { "the", "that", "a" }, { "frog", "elephant", "thing" }, { "walked", "treaded", "grows" }, { "slowly", "quickly" } } res := make([]string, len(wordset)) if amb(wordset, res[0:0]) { fmt.Println(res) } else { fmt.Println("No amb found") }}`
Haskell's List monad returns all the possible choices. Use the "head" function on the result if you just want one.
`import Control.Monad amb = id joins left right = last left == head right example = do w1 <- amb ["the", "that", "a"] w2 <- amb ["frog", "elephant", "thing"] w3 <- amb ["walked", "treaded", "grows"] w4 <- amb ["slowly", "quickly"] unless (joins w1 w2) (amb []) unless (joins w2 w3) (amb []) unless (joins w3 w4) (amb []) return (unwords [w1, w2, w3, w4])`
Note that "amb" is defined as a no-op and is written only to help show the analogy with other implementations; ordinary style is to write e.g. `w1 <- ["the", "that", "a"]`.
It may also be illuminating to show how this desugars (dropping the do notation) if we express it directly in terms of the list monad bind function (>>=) (or >>= without brackets as in infix operator), which is possibly more familiar (or more directly intelligible) as concatMap with its arguments flipped.
The function of amb can then be seen in the return of a list of bound values, if a predicate is matched, or the return of an empty list, if the predicate fails:
`joins :: String -> String -> Booljoins left right = last left == head right -- First desugaring (dropping the do notation)-- in terms of the bind operator (>>=) for the list monad exampleBind :: StringexampleBind = ["the", "that", "a"] >>= (\w1 -> ["frog", "elephant", "thing"] >>= \w2 -> ["walked", "treaded", "grows"] >>= \w3 -> ["slowly", "quickly"] >>= (\w4 -> if joins w1 w2 then (if joins w2 w3 then (if joins w3 w4 then unwords [w1, w2, w3, w4] else []) else []) else [])) -- Second desugaring (still dropping the do notation)-- in terms of the concatMap, which is >>= with its arguments flipped exampleConcatMap :: StringexampleConcatMap = concatMap (\w1 -> concatMap (\w2 -> concatMap (\w3 -> concatMap (\w4 -> if joins w1 w2 then (if joins w2 w3 then (if joins w3 w4 then unwords [w1, w2, w3, w4] else []) else []) else []) ["slowly", "quickly"]) ["walked", "treaded", "grows"]) ["frog", "elephant", "thing"]) ["the", "that", "a"] main :: IO ()main = do print exampleBind print exampleConcatMap`
Output:
```"that thing grows slowly"
"that thing grows slowly"```
Or, immediately pairing each indeterminate value with a predicate (rather concluding with a compound predicate).
`example :: [String]example = ["the", "that", "a"] >>= \w1 -> when True ["frog", "elephant", "thing"] >>= \w2 -> when (joins w1 w2) ["walked", "treaded", "grows"] >>= \w3 -> when (joins w2 w3) ["slowly", "quickly"] >>= \w4 -> when (joins w3 w4) [w1, w2, w3, w4] joins :: String -> String -> Booljoins left right = last left == head right when :: Bool -> [a] -> [a]when p xs = if p then xs else [] main :: IO ()main = print \$ unwords example`
`"that thing grows slowly"`
And a familar resugaring of a list monad wrapping of indeterminate values and constraints is, of course, the list comprehension notation, which has a semantics directly equivalent to that of amb tuples and contraints, and provides quite a clean and natural notation for their expression.
`joins :: String -> String -> Booljoins left right = last left == head right example :: [String]example = [ unwords [w1, w2, w3, w4] | w1 <- ["the", "that", "a"] , w2 <- ["frog", "elephant", "thing"] , w3 <- ["walked", "treaded", "grows"] , w4 <- ["slowly", "quickly"] , joins w1 w2 , joins w2 w3 , joins w3 w4 ] main :: IO ()main = print example`
Output:
`["that thing grows slowly"]`
## Haxe
`class RosettaDemo{ static var setA = ['the', 'that', 'a']; static var setB = ['frog', 'elephant', 'thing']; static var setC = ['walked', 'treaded', 'grows']; static var setD = ['slowly', 'quickly']; static public function main() { Sys.print(ambParse([ setA, setB, setC, setD ]).toString()); } static function ambParse(sets : Array<Array<String>>) { var ambData : Dynamic = amb(sets); for (data in 0...ambData.length) { var tmpData = parseIt(ambData[data]); var tmpArray = tmpData.split(' '); tmpArray.pop(); if (tmpArray.length == sets.length) { return tmpData; } } return ''; } static function amb(startingWith : String = '', sets : Array<Array<String>>) : Dynamic { if (sets.length == 0 || sets[0].length == 0) return; var match : Dynamic = []; for (reference in sets[0]) { if (startingWith == '' || startingWith == reference.charAt(0)) { var lastChar = reference.charAt(reference.length-1); if (Std.is(amb(lastChar, sets.slice(1)), Array)) { match.push([ reference, amb(lastChar, sets.slice(1))]); } else { match.push([ reference ]); } } } return match; } static function parseIt(data : Dynamic) { var retData = ''; if (Std.is(data, Array)) { for (elements in 0...data.length) { if (Std.is(data[elements], Array)) { retData = retData + parseIt(data[elements]); } else { retData = retData + data[elements] + ' '; } } } return retData; }}`
## Icon and Unicon
`procedure main() s1 := ["the","that","a"] s2 := ["frog","elephant","thing"] s3 := ["walked","treaded","grows"] s4 := ["slowly","quickly"] write(amb(!s1,!s2,!s3,!s4))end procedure amb(exprs[]) s := "" every e := !exprs do { if \c ~== e[1] then fail c := e[-1] s ||:= e || " " } return send`
## J
` amb=. ([ , ' ' , ])&>/&.>@:((({:@:[ = {[email protected]:])&>/&> # ])@:,@:({@(,&<))) >@(amb&.>/) ('the';'that';'a');('frog';'elephant';'thing');('walked';'treaded';'grows');(<'slowly';'quickly')+-----------------------+|that thing grows slowly|+-----------------------+`
` ('the';'that';'a') amb ('frog';'elephant';'thing') amb ('walked';'treaded';'grows') amb ('slowly';'quickly')+-----------------------+|that thing grows slowly|+-----------------------+`
A structured derivation of amb follows:
` NB. Dynamic programming method... o=. @: NB. Composing verbs success=. {:o[ = {.o] NB. Is the last letter of the left word equal to the first of the right? join=. [ , ' ' , ] NB. Joining the left and right words cp=. {@(,&<) NB. Cartesian product amb=. join&>/&.> o ((success&>/ &> # ]) o , o cp)f. amb NB. Showing the point-free code...([ , ' ' , ])&>/&.>@:((({:@:[ = {[email protected]:])&>/&> # ])@:,@:({@(,&<)))`
Note that `amb` here is roughly equivalent to the `Ambassert` in the task description, and that the corresponding `Ambsel` is unnecessary and trivial (if needed, we could define `Ambsel` as the identity operation and make these examples slightly more verbose). However, this implementation should be refactored to extract the example logic from the implementation of `amb` (or you can do as was apparently suggested here, and use the definition of `amb` instead of the word - replacing `success` as needed).
## JavaScript
### Procedural
`function ambRun(func) { var choices = []; var index; function amb(values) { if (values.length == 0) { fail(); } if (index == choices.length) { choices.push({i: 0, count: values.length}); } var choice = choices[index++]; return values[choice.i]; } function fail() { throw fail; } while (true) { try { index = 0; return func(amb, fail); } catch (e) { if (e != fail) { throw e; } var choice; while ((choice = choices.pop()) && ++choice.i == choice.count) {} if (choice == undefined) { return undefined; } choices.push(choice); } }} ambRun(function(amb, fail) { function linked(s1, s2) { return s1.slice(-1) == s2.slice(0, 1); } var w1 = amb(["the", "that", "a"]); var w2 = amb(["frog", "elephant", "thing"]); if (!linked(w1, w2)) fail(); var w3 = amb(["walked", "treaded", "grows"]); if (!linked(w2, w3)) fail(); var w4 = amb(["slowly", "quickly"]); if (!linked(w3, w4)) fail(); return [w1, w2, w3, w4].join(' ');}); // "that thing grows slowly"`
### Functional
Defining amb as the list monad bind/inject operator:
`(() => { 'use strict'; // amb :: [a] -> (a -> [b]) -> [b] const amb = xs => f => xs.reduce((a, x) => a.concat(f(x)), []); // when :: Bool -> [a] -> [a] const when = p => xs => p ? ( xs ) : []; // TEST ----------------------------------------------- const main = () => { // joins :: String -> String -> Bool const joins = (a, b) => b[0] === last(a); console.log( amb(['the', 'that', 'a']) (w1 => when(true)( amb(['frog', 'elephant', 'thing']) (w2 => when(joins(w1, w2))( amb(['walked', 'treaded', 'grows']) (w3 => when(joins(w2, w3))( amb(['slowly', 'quickly']) (w4 => when(joins(w3, w4))( unwords([w1, w2, w3, w4]) )) )) )) )) ); }; // GENERIC FUNCTIONS ---------------------------------- // last :: [a] -> a const last = xs => 0 < xs.length ? xs.slice(-1)[0] : undefined; // unwords :: [String] -> String const unwords = xs => xs.join(' '); // MAIN --- return main();})();`
Output:
`that thing grows slowly`
## jq
Works with: jq version 1.4
Two solutions are given. The first follows the style of the Prolog example. The second perhaps hews more closely to the intended specification of "amb".
Solution using amb/0
`def amb: .[]; def joins: (.[0][-1:]) as \$left | (.[1][0:1]) as \$right | if \$left == \$right then true else empty end; `
Example:
`(["the","that","a"] | amb) as \$word1 | (["frog","elephant","thing"] | amb) as \$word2 | [\$word1, \$word2] | joins | (["walked","treaded","grows"] | amb) as \$word3 | [\$word2, \$word3] | joins | (["slowly","quickly"] | amb) as \$word4 | [\$word3, \$word4] | joins | [\$word1, \$word2, \$word3, \$word4]`
Output:
`jq -n -f amb.jq[ "that", "thing", "grows", "slowly"]`
Solution using amb(condition):
`def amb(condition): .[] | select(condition); def joins: (.[0][-1:]) as \$left | (.[1][0:1]) as \$right | \$left == \$right ;`
Example:
`(["the","that","a"] | amb(true)) as \$word1 | (["frog","elephant","thing"] | amb( [\$word1, .] | joins)) as \$word2 | (["walked","treaded","grows"] | amb( [\$word2, .] | joins)) as \$word3 | (["slowly","quickly"] | amb( [\$word3, .] | joins)) as \$word4 | [\$word1, \$word2,\$word3, \$word4]`
Output:
As above.
## Julia
`# This is a general purpose AMB function that takes a two-argument failure function and# arbitrary number of iterable objects and returns the first solution found as an array# this function is in essence an iterative backtracking solver function amb(failure, itrs...) n = length(itrs) if n == 1 return end states = Vector(n) values = Vector(n) # starting point, we put down the first value from the first iterable object states[1] = start(itrs[1]) values[1], states[1] = next(itrs[1], states[1]) i = 1 # main solver loop while true # test for failure if i > 1 && failure(values[i-1], values[i]) # loop for generating a new value upon failure # in fact this would be way more readable using goto, but Julia doesn't seem to have that :( while true # if we failed, we must generate a new value, but first we must check whether there is any if done(itrs[i], states[i]) # backtracking step with sanity check in case we ran out of values from the current generator if i == 1 return else i -= 1 continue end else # if there is indeed a new value, generate it values[i], states[i] = next(itrs[i], states[i]) break end end else # no failure branch # if solution is ready (i.e. all generators are used) just return it if i == n return values end # else start up the next generator i += 1 states[i] = start(itrs[i]) values[i], states[i] = next(itrs[i], states[i]) end endend # Call our generic AMB function according to the task description and# form the solution sentence from the returned array of wordsamb((s1,s2) -> s1[end] != s2[1], # failure function ["the", "that", "a"], ["frog", "elephant", "thing"], ["walked", "treaded", "grows"], ["slowly", "quickly"]) |> x -> join(x, " ") |> println `
## Kotlin
This solves the problem using backtracking whenever amb() is executed. amb will probably have unexpected behavior if any variables are mutated. Using simple assignment for variables shouldn't be a problem.
`// version 1.2.41import kotlin.coroutines.experimental.*import kotlin.coroutines.experimental.intrinsics.* fun main(args: Array<String>) = amb { val a = amb("the", "that", "a") val b = amb("frog", "elephant", "thing") val c = amb("walked", "treaded", "grows") val d = amb("slowly", "quickly") if (a[a.lastIndex] != b[0]) amb() if (b[b.lastIndex] != c[0]) amb() if (c[c.lastIndex] != d[0]) amb() println(listOf(a, b, c, d)) val x = amb(1, 2, 3) val y = amb(7, 6, 4, 5) if (x * y != 8) amb() println(listOf(x, y))} class AmbException(): Exception("Refusing to execute")data class AmbPair<T>(val cont: Continuation<T>, val valuesLeft: MutableList<T>) @RestrictsSuspensionclass AmbEnvironment { val ambList = mutableListOf<AmbPair<*>>() suspend fun <T> amb(value: T, vararg rest: T): T = suspendCoroutineOrReturn { cont -> if (rest.size > 0) { ambList.add(AmbPair(clone(cont), mutableListOf(*rest))) } value } suspend fun amb(): Nothing = suspendCoroutine<Nothing> { }} @Suppress("UNCHECKED_CAST")fun <R> amb(block: suspend AmbEnvironment.() -> R): R { var result: R? = null var toThrow: Throwable? = null val dist = AmbEnvironment() block.startCoroutine(receiver = dist, completion = object : Continuation<R> { override val context: CoroutineContext get() = EmptyCoroutineContext override fun resume(value: R) { result = value } override fun resumeWithException(exception: Throwable) { toThrow = exception } }) while (result == null && toThrow == null && !dist.ambList.isEmpty()) { val last = dist.ambList.run { this[lastIndex] } if (last.valuesLeft.size == 1) { dist.ambList.removeAt(dist.ambList.lastIndex) last.apply { (cont as Continuation<Any?>).resume(valuesLeft[0]) } } else { val value = last.valuesLeft.removeAt(last.valuesLeft.lastIndex) (clone(last.cont) as Continuation<Any?>).resume(value) } } if (toThrow != null) { throw toThrow!! } else if (result != null) { return result!! } else { throw AmbException() }} val UNSAFE = Class.forName("sun.misc.Unsafe") .getDeclaredField("theUnsafe") .apply { isAccessible = true } .get(null) as sun.misc.Unsafe @Suppress("UNCHECKED_CAST")fun <T: Any> clone(obj: T): T { val clazz = obj::class.java val copy = UNSAFE.allocateInstance(clazz) as T copyDeclaredFields(obj, copy, clazz) return copy} tailrec fun <T> copyDeclaredFields(obj: T, copy: T, clazz: Class<out T>) { for (field in clazz.declaredFields) { field.isAccessible = true val v = field.get(obj) field.set(copy, if (v === obj) copy else v) } val superclass = clazz.superclass if (superclass != null) copyDeclaredFields(obj, copy, superclass)}`
Output:
```[that, thing, grows, slowly]
[2, 4]
```
## Lua
`function amb (set) local workset = {} if (#set == 0) or (type(set) ~= 'table') then return end if #set == 1 then return set end if #set > 2 then local first = table.remove(set,1) set = amb(set) for i,v in next,first do for j,u in next,set do if v:byte(#v) == u[1]:byte(1) then table.insert(workset, {v,unpack(u)}) end end end return workset end for i,v in next,set[1] do for j,u in next,set[2] do if v:byte(#v) == u:byte(1) then table.insert(workset,{v,u}) end end end return worksetend`
Usage example:
`result = amb({{'the','that','a'},{'frog','elephant','thing'},{'walked','treaded','grows'},{'slowly','quickly'}})for i,v in next,result do io.write (i,':\t') for j,u in next,v do io.write (u,' ') end io.write ('\n')end`
## Mathematica / Wolfram Language
Make all the tuples of all the lists, then filter out the good ones:
` CheckValid[i_List]:=If[Length[i]<=1,True,[email protected]@(StringTake[#[[1]],-1]==StringTake[#[[2]],1]&/@Partition[i,2,1])] sets={{"the","that","a"},{"frog","elephant","thing"},{"walked","treaded","grows"},{"slowly","quickly"}}; Select[Tuples[sets],CheckValid]`
gives back:
`{{"that", "thing", "grows", "slowly"}}`
Note that it will return multiple values if multiple sentences match the requirement, that is why the returned value is a list of list (1 element, 4 elements).
Alternative algorithm (slightly faster on most data sets):
`CheckValid2[i_List] := StringFreeQ[StringJoin[Riffle[i, ","]], a_ ~~ "," ~~ b_ /; a =!= b]`
## Mercury
Like Prolog, Mercury has built-in nondeterminacy; however, Mercury is explicit about it, and statically checks it.
`:- module amb.:- interface.:- import_module io.:- pred main(io::di, io::uo) is cc_multi.:- implementation.:- import_module list, string, char, int. main(!IO) :- ( solution(S) -> io.write_string(S, !IO), io.nl(!IO) ; io.write_string("No solutions found :-(\n", !IO) ). :- pred solution(string::out) is nondet.solution(S) :- member(A, ["the", "that", "a"]), member(N, ["frog", "elephant", "thing"]), member(V, ["walked", "treaded", "grows"]), member(E, ["slowly", "quickly"]), S = join_list(" ", [A, N, V, E]), rule1(A, N), rule1(N, V), rule1(V, E). :- pred rule1(string::in, string::in) is semidet.rule1(A, B) :- last_char(A) = C, first_char(B, C, _). :- func last_char(string::in) = (char::out) is semidet.last_char(S) = C :- index(S, length(S) - 1, C).`
The Amb defined in the Prolog solution is similar to the use of list.member/2 above. Predicates could be used instead:
` :- pred noun(string).:- mode noun(out) is multi. % provide any one noun.:- mode noun(in) is semidet. % fail if given string isn't a known noun.noun("frog").noun("elephant").noun("thing").`
## NetRexx
` /* REXX ************************************************************** * 25.08.2013 Walter Pachl derived from REXX version 2 *********************************************************************/ w='' l=0 mm=0 mkset(1,'the that a if',w,mm,l) mkset(2,'frog elephant thing',w,mm,l) mkset(3,'walked treaded grows trots',w,mm,l) mkset(4,'slowly quickly',w,mm,l) show(w,mm,l) Loop i=1 to 3 /* loop over sets */ k=i+1 /* the following set */ Loop ii=1 To 10 /* loop over elements in set k*/ If w[i,ii].words=i Then Do /* a sentence part found */ Loop jj=1 To 10 /* loop over following words */ If w[i,ii].right(1)=w[k,jj].left(1) Then Do /* fitting */ ns=w[i,ii]' 'w[k,jj] /* build new sentence (part) */ If ns.words=k Then /* 'complete' part */ add(w,k,ns) /* add to set k */ End End End End End Say 'Results:' Loop jj=1 To 10 /* show the results */ If w[4,jj].words=4 Then Say '-->' w[4,jj] End method add(w,k,s) public static /********************************************************************* * add a fitting sentence (part) s to set w[k,*] *********************************************************************/ Loop i=1 To 10 While w[k,i]>'' /* look for an empty slot */ End w[k,i]=s /* add the sentence (part) */ Return method mkset(n,arg,smp,mm,l) public static /********************************************************************* * create set smp[n,*] from data in arg * mm[0] maximum number of elements in any set * l[n] maximum word length in set n *********************************************************************/ loop i = 1 to arg.words smp[n,i] = arg.word(i) If smp[n,i].length>l[n] Then l[n]=smp[n,i].length end if i-1>mm[0] Then Do mm[0]=i-1 End return method show(w,mm,l) public static /********************************************************************* * show the input *********************************************************************/ Say 'Input:' Loop j=1 To mm[0] /* output lines */ ol='' Loop i=1 To 4 ol=ol w[i,j].left(l[i]) End Say ol.strip End; say '' Return`
Output:
```Input:
the frog walked slowly
a thing grows
if trots
Results:
--> the elephant trots slowly
--> that thing grows slowly
--> if frog grows slowly
```
Note: the output of the input is truncated (columns three and four), but the results are correct for the data specified, but not for the input as specified for this task (ditto for the PL/I example and the REXX version 2 example).
length corrected. thanks. extraneous input: intentional and harmless !?!
## Nim
Translation of: D
`import future, strutils proc amb(comp: proc(a, b: string): bool, options: seq[seq[string]], prev: string = nil): seq[string] = if options.len == 0: return @[] for opt in options[0]: # If this is the base call, prev is nil and we need to continue. if prev != nil and not comp(prev, opt): continue # Take care of the case where we have no options left. if options.len == 1: return @[opt] # Traverse into the tree. let res = amb(comp, options[1..options.high], opt) # If it was a failure, try the next one. if res.len > 0: return opt & res # We have a match return @[] const sets = @[@["the", "that", "a"], @["frog", "elephant", "thing"], @["walked", "treaded", "grows"], @["slowly", "quickly"]] let result = amb((s, t: string) => (s[s.high] == t[0]), sets)if result.len == 0: echo "No matches found!"else: echo result.join " "`
Output:
`that thing grows slowly`
## OCaml
There is no Amb operator in OCaml. So below are two solutions to solve the same task. The first one is the more idiomatic for OCaml (and is similar to the Haskell solution), it builds all possible combinations and then take the good result in it.
The second solution tries to be closer to the way of solving the problem of Amb. It does not build and accumulate the combinations, it iterates over these with a higher order function and it stops when it finds a solution that matches the predicate.
### Filtering possible combinations
`let set_1 = ["the"; "that"; "a"]let set_2 = ["frog"; "elephant"; "thing"]let set_3 = ["walked"; "treaded"; "grows"]let set_4 = ["slowly"; "quickly"] let combs ll = let rec aux acc = function | [] -> (List.map List.rev acc) | hd::tl -> let acc = List.fold_left (fun _ac l -> List.fold_left (fun _ac v -> (v::l)::_ac) _ac hd ) [] acc in aux acc tl in aux [[]] ll let last s = s.[pred(String.length s)]let joined a b = (last a = b.[0]) let rec test = function | a::b::tl -> (joined a b) && (test (b::tl)) | _ -> true let print_set set = List.iter (Printf.printf " %s") set; print_newline();;; let () = let sets = combs [set_1; set_2; set_3; set_4] in let sets = List.filter test sets in List.iter print_set sets;;;`
We can take all the good results with List.filter or just take the first one with List.find.
### Higher order function
Here the function comb_search replaces the function combs and uses arrays instead of lists. This function takes successively all the possible results by their indicies (with the array nx). When a result satisfies the predicate p, it is returned
`let set_1 = [| "the"; "that"; "a" |]let set_2 = [| "frog"; "elephant"; "thing" |]let set_3 = [| "walked"; "treaded"; "grows" |]let set_4 = [| "slowly"; "quickly" |] let comb_search p aa = let nx = Array.make (Array.length aa) 0 in let lx = Array.map Array.length aa in let la = Array.length aa in let rec loop() = let res = Array.mapi (fun i j -> aa.(i).(j)) nx in if p res then (res) else ( nx.(0) <- nx.(0) + 1; if nx.(0) < lx.(0) then loop() else ( nx.(0) <- 0; let rec roll n = if n >= la then raise Not_found else ( nx.(n) <- nx.(n) + 1; if nx.(n) >= lx.(n) then ( nx.(n) <- 0; roll (n+1) ) else loop() ) in roll 1 ) ) in loop() let last s = s.[pred(String.length s)]let joined a b = (last a = b.[0]) let rec test = function | a::b::tl -> (joined a b) && (test (b::tl)) | _ -> true let test r = test(Array.to_list r) let print_set set = Array.iter (Printf.printf " %s") set; print_newline();;; let () = let result = comb_search test [| set_1; set_2; set_3; set_4 |] in print_set result;;;`
## OpenEdge/Progress
`DEF VAR cset AS CHAR EXTENT 4 INIT [ "the,that,a", "frog,elephant,thing", "walked,treaded,grows", "slowly,quickly"]. FUNCTION getAmb RETURNS CHARACTER ( i_cwords AS CHAR, i_iset AS INT): DEF VAR cresult AS CHAR. DEF VAR ii AS INT. DEF VAR cword AS CHAR. DO ii = 1 TO NUM-ENTRIES( cset [ i_iset ] ) WHILE NUM-ENTRIES( cresult, " " ) < EXTENT( cset ): cword = ENTRY( ii, cset[ i_iset ] ). IF i_cwords = "" OR SUBSTRING( i_cwords, LENGTH( i_cwords ), 1 ) = SUBSTRING( cword, 1, 1 ) THEN DO: IF i_iset = EXTENT ( cset ) THEN cresult = i_cwords + " " + cword. ELSE cresult = getAmb( i_cwords + " " + cword, i_iset + 1 ). END. END. RETURN cresult. END FUNCTION. /* getAmb */ MESSAGE getAmb( "", 1 ) VIEW-AS ALERT-BOX.`
Output:
```---------------------------
Message
---------------------------
that thing grows slowly
---------------------------
OK
---------------------------
```
## Oz
Oz is, among other things, a logic programming language and has a choice operator. Using recursion we can easily build an Amb operator with it.
`declare fun {Amb Xs} case Xs of nil then fail [] [X] then X [] X|Xr then choice X [] {Amb Xr} end end end fun {Example} W1 = {Amb ["the" "that" "a"]} W2 = {Amb ["frog" "elephant" "thing"]} W3 = {Amb ["walked" "treaded" "grows"]} W4 = {Amb ["slowly" "quickly"]} in {List.last W1 W2.1} {List.last W2 W3.1} {List.last W3 W4.1} W1#" "#W2#" "#W3#" "#W4 end in {ForAll {SearchAll Example} System.showInfo}`
In Oz, the programmer explicitly controls how a logic program is executed (search strategy, number of required solutions, laziness, which physical machines are used for the search process...). In this case we use the predefined function SearchAll to eagerly calculate all possible solution. All work is done within the current process.
## PARI/GP
`Amb(V)={ amb(vector(#V,i,vector(#V[i],j,Vec(V[i][j]))),[])};amb(V,s)={ if (#V == 0, return(concat(s))); my(v=V[1],U=vecextract(V,2^#V-2),t,final=if(#s,s[#s])); if(#s, s = concat(s,[" "])); for(i=1,#v, if ((#s == 0 | final == v[i][1]), t = amb(U, concat(s, v[i])); if (t, return(t)) ) ); 0};Amb([["the","that","a"],["frog","elephant","thing"],["walked","treaded","grows"],["slowly","quickly"]])`
## Perl
### Using fork
This first Perl implementation of the `amb` operator provides an interface which satisfies the terms of the task precisely. It shouldn't be used in real code though, unless you know for a fact that the computer you are using it on has a very lightweight fork() system call.
It is provided here simply to demonstrate that it can be done.
`use strict;use warnings; use constant EXIT_FAILURE => 1;use constant EXIT_SUCCESS => 0; sub amb { exit(EXIT_FAILURE) if !@_; for my \$word (@_) { my \$pid = fork; die \$! unless defined \$pid; return \$word if !\$pid; my \$wpid = waitpid \$pid, 0; die \$! unless \$wpid == \$pid; exit(EXIT_SUCCESS) if \$? == EXIT_SUCCESS; } exit(EXIT_FAILURE);} sub joined { my (\$join_a, \$join_b) = @_; substr(\$join_a, -1) eq substr(\$join_b, 0, 1);} my \$w1 = amb(qw(the that a));my \$w2 = amb(qw(frog elephant thing));my \$w3 = amb(qw(walked treaded grows));my \$w4 = amb(qw(slowly quickly)); amb() unless joined \$w1, \$w2;amb() unless joined \$w2, \$w3;amb() unless joined \$w3, \$w4; print "\$w1 \$w2 \$w3 \$w4\n";exit(EXIT_SUCCESS);`
### Using the regex engine
This version also stays relatively true to the spirit of the task description. The amb routine in this case generates regex alternations, which are then dynamically interpolated into a regex and iterated/backtracked over by the regex engine. Please note that this approach only works well for simple search problems; for more demanding ones it scales quite badly in both speed and memory usage.
`#!/usr/bin/perl use strict;use warnings;use feature 'say';use re 'eval'; sub amb ([email protected]) { my \$var = shift; join ' || ', map { "(?{ \$var = '\$_' })" } @_;} sub joins { substr(shift,-1,1) eq substr(shift,0,1)} my (\$a,\$b,\$c,\$d);'' =~ m/ (??{ amb '\$a', qw[the that a] }) (??{ amb '\$b', qw[frog elephant thing] }) (??{ amb '\$c', qw[walked treaded grows] }) (??{ amb '\$d', qw[slowly quickly] }) (?(?{ joins(\$b, \$c) })|(*FAIL)) (?(?{ joins(\$a, \$b) })|(*FAIL)) (?(?{ joins(\$c, \$d) })|(*FAIL)) (?{ say "\$a \$b \$c \$d" })/x;`
### Using a higher-order function
In practice, one wouldn't try to squeeze such a search problem into the `amb` interface shown in the task description, when coding in Perl. The main purpose of the `amb` operator is backtracking, and a more conventional Perl idiom for that purpose is for the user to pass a subroutine of their own into a function which acts as a backtracking engine.
The following code does just that: the first arguments for amb(...) are one or more arrays of values, followed by a user-defined subroutine. The amb(...) function arbitrarily selects one value from each of the arrays, and calls the user's supplied sub with the selected values.
If the user's supplied sub calls amb() with no arguments, the outer amb(...) will pick the next set of values. If the user's supplied sub returns normally, then the return value from the sub will be the return value of amb(...).
This version uses vastly less memory, and is quite reusable.
`use strict;use warnings; sub amb { if( @_ == 0 ) { no warnings 'exiting'; next AMB; } my \$code = pop; my @words = @_; my @index = (0) x @words; AMB: while( 1 ) { my @w = map \$words[\$_][\$index[\$_]], 0 .. \$#_; return \$code->( @w ); } continue { my \$i = 0; while( ++\$index[\$i] == @{\$words[\$i]} ) { \$index[\$i] = 0; return if ++\$i == @index; } }} my @w1 = qw(the that a);my @w2 = qw(frog elephant thing);my @w3 = qw(walked treaded grows);my @w4 = qw(slowly quickly); sub joined { my (\$join_a, \$join_b) = @_; substr(\$join_a, -1) eq substr(\$join_b, 0, 1);} amb( \(@w1, @w2, @w3, @w4), sub { my (\$w1, \$w2, \$w3, \$w4) = @_; amb() unless joined(\$w1, \$w2); amb() unless joined(\$w2, \$w3); amb() unless joined(\$w3, \$w4); print "\$w1 \$w2 \$w3 \$w4\n";});`
All three versions produce the same output.
Output:
`that thing grows slowly`
## Perl 6
### Using Junctions
Junctions are a construct that behave similarly to the wanted Amb operator. The only difference is, that they don't preserve the state that was True inside any control structure (like an if).
There is currently a trick, how you only get the "true" values from a Junction for any test: return from a subroutine. Because of DeMorgans Law, you'll have to switch and and or, since you want to return on falseness. Just look at 'all' in combination with the sub(){return unless test} as the amb operator.
` #| an array of four words, that have more possible values. #| Normally we would want `any' to signify we want any of the values, but well negate later and thus we need `all'my @a =(all «the that a»),(all «frog elephant thing»),(all «walked treaded grows»),(all «slowly quickly»); sub test (Str \$l, Str \$r) { \$l.ends-with(\$r.substr(0,1))} (sub (\$w1, \$w2, \$w3, \$w4){ # return if the values are false return unless [and] test(\$w1, \$w2), test(\$w2, \$w3),test(\$w3, \$w4); # say the results. If there is one more Container layer around them this doesn't work, this is why we need the arguments here. say "\$w1 \$w2 \$w3 \$w4"})(|@a); # supply the array as argumetns `
### Using lazy lists
This example is in need of improvement: This doesn't really solve the task description in a meaningful way; it only works because it cheats with the way the problem statement is encoded. See the Gist write-up here.
Works with: niecza version 2012-02-29
This example is broken. It fails to compile or causes a runtime error. Please fix the code and remove this message.
`sub infix:<lf> (\$a,\$b) { next unless try \$a.substr(*-1,1) eq \$b.substr(0,1); "\$a \$b";} multi dethunk(Callable \$x) { try take \$x() }multi dethunk( Any \$x) { take \$x } sub amb (*@c) { gather @c».&dethunk } say first *, do amb(<the that a>, { die 'oops'}) Xlf amb('frog',{'elephant'},'thing') Xlf amb(<walked treaded grows>) Xlf amb { die 'poison dart' }, {'slowly'}, {'quickly'}, { die 'fire' };`
Output:
`that thing grows slowly`
This uses lazy lists, created by the X metaoperator applied to a user-defined function, lf, that asserts the last-first condition, and short-circuits the match so that it does not need to generate parts of the search tree that cannot match. We use the first function to pull one element from the lazy list; a subscript of [0] would have worked just as well.
The amb operator itself uses a hyper to run the dethunk calls in parallel. Results are returned asyncronously via gather/take. The dethunk call traps failures after the failure has bypassed the take.
### Using the regex engine
If you consider lazy lists to be cheating on the idea of continuations, here's some admittedly grungy code that uses the continuation engine of regexes to solve it. At some point we'll wrap this up in nice syntax to let people write in a sublanguage of Perl 6 that looks more like a logic language.
This example is broken. It fails to compile or causes a runtime error. Please fix the code and remove this message.
Note: the compiler suggests adding `use MONKEY-SEE-NO-EVAL;` to enable regex interpolation, but that's not the only issue. The program outputs nothing.
`sub amb(\$var,*@a) { "[{ @a.pick(*).map: {"||\{ \$var = '\$_' }"} }]";} sub joins (\$word1, \$word2) { substr(\$word1,*-1,1) eq substr(\$word2,0,1)} '' ~~ m/ :my (\$a,\$b,\$c,\$d); <{ amb '\$a', <the that a> }> <{ amb '\$b', <frog elephant thing> }> <?{ joins \$a, \$b }> <{ amb '\$c', <walked treaded grows> }> <?{ joins \$b, \$c }> <{ amb '\$d', <slowly quickly> }> <?{ joins \$c, \$d }> { say "\$a \$b \$c \$d" } <!>/;`
## Phix
Fairly simple recursive solution
`function amb1(sequence sets, object res=0, integer idx=1)integer ch = 0integer pass = 0 if idx>length(sets) then pass = 1 else if res=0 then res = repeat(0,length(sets)) else ch = sets[idx-1][res[idx-1]][\$] end if for k=1 to length(sets[idx]) do if ch=0 or sets[idx][k][1]=ch then res[idx] = k {pass,res} = amb1(sets,res,idx+1) if pass then exit end if end if end for end if return {pass,res}end function sequence sets = {{"the","that","a"}, {"frog","elephant","thing"}, {"walked","treaded","grows"}, {"slowly","quickly"}}integer passsequence res {pass,res} = amb1(sets) if pass then puts(1,"success: ") for i=1 to length(sets) do res[i] = sets[i][res[i]] end for ?res else puts(1,"failure\n") end if`
Output:
```success: {"that","thing","grows","slowly"}
```
To make things a bit more interesting/flexible, I factored out the inner test to a routine passed as an argument, and likewise added an optional result routine for multiple results. And to prove it the following solves three rather different problems instead of just one.
`function amb(sequence sets, integer testrid, integer resrid=-1, object res=0, integer idx=1)integer flag = (res==0)integer pass = 0 if idx>length(sets) then pass = 1 if resrid!=-1 then call_proc(resrid,{sets,res}) end if else if flag then res = repeat(0,length(sets)) end if for k=1 to length(sets[idx]) do res[idx] = k if flag or call_func(testrid,{sets,res,idx}) then {pass,res} = amb(sets,testrid,resrid,res,idx+1) if pass and resrid=-1 then exit end if end if end for end if return {pass,res}end function function pairable(sequence sets, sequence res, integer idx) return sets[idx-1][res[idx-1]][\$] = sets[idx][res[idx]][1]end functionconstant r_pairable = routine_id("pairable") procedure AMB_Show(sequence sets, sequence res) puts(1,"success: ") for i=1 to length(sets) do res[i] = sets[i][res[i]] end for ?resend procedureconstant r_show = routine_id("AMB_Show") function pythagorean(sequence sets, sequence res, integer idx)-- (note that res[idx]==sets[idx][res[idx]] in all cases)integer x, y, z if sequence(sets) then end if -- (suppress warning) {x,y,z} = res return idx<3 or (x*x+y*y=z*z)end functionconstant r_pythagorean = routine_id("pythagorean") procedure pythag_show(sequence sets, sequence res) if sequence(sets) then end if -- (suppress warning) puts(1,"success: ") ?resend procedureconstant r_pythag_show = routine_id("pythag_show") -- see http://www.randomhacks.net/articles/2005/10/11/amb-operatorfunction not8(sequence sets, sequence res, integer idx)-- (note that idx==2 in all cases)-- (at the last moment, I flipped the test, after realising that-- someone had completely misunderstood the original article...-- ...and proved it by showing some strange output on rosetta.)-- return sets[1][res[1]]*sets[idx][res[idx]]!=8 return sets[1][res[1]]*sets[idx][res[idx]]=8end functionconstant r_not8 = routine_id("not8") procedure not8_show(sequence sets, sequence res) puts(1,"success: ") ?{sets[1][res[1]],sets[2][res[2]]}end procedureconstant r_not8_show = routine_id("not8_show") sequence sets = {{"the","that","a"}, {"frog","elephant","thing"}, {"walked","treaded","grows"}, {"slowly","quickly"}}sequence sets2 = repeat(tagset(11),3)sequence sets3 = {{1, 2, 3}, {4, 5, 6}} puts(1,"\nThe original:\n") {} = amb(sets,r_pairable,r_show) puts(1,"\nSmall Pythagorean triples problem:\n") {} = amb(sets2,r_pythagorean,r_pythag_show) puts(1,"\nSome strange not 8 problem:\n") -- (now fixed) {} = amb(sets3,r_not8,r_not8_show)`
Output:
```The original:
success: {"that","thing","grows","slowly"}
Small Pythagorean triples problem:
success: {3,4,5}
success: {4,3,5}
success: {6,8,10}
success: {8,6,10}
Some strange not 8 problem:
success: {2,4}
```
## PicoLisp
For backtracking, Pilog (PicoLisp Prolog) is the natural choice.
Translation of: Prolog
`(be amb (@E @Lst) (lst @E @Lst) ) (be joins (@Left @Right) (^ @T (last (chop (-> @Left)))) (^ @R (car (chop (-> @Right)))) (or ((equal @T @R)) ((amb @ NIL)) ) ) # Explicitly using amb fail as required (be ambExample ((@Word1 @Word2 @Word3 @Word4)) (amb @Word1 ("the" "that" "a")) (amb @Word2 ("frog" "elephant" "thing")) (amb @Word3 ("walked" "treaded" "grows")) (amb @Word4 ("slowly" "quickly")) (joins @Word1 @Word2) (joins @Word2 @Word3) (joins @Word3 @Word4) )`
Output:
```: (? (ambExample @Result))
@Result=("that" "thing" "grows" "slowly")
-> NIL```
## PL/I
`*process or(!) source attributes xref; amb: Proc Options(main); /********************************************************************* * 25.08.2013 Walter Pachl *********************************************************************/ Dcl w(4,10) Char(40) Var Init('the','that','a','if',(6)(1)' ', 'frog','elephant','thing',(7)(1)' ', 'walked','treaded','grows','trots',(6)(1)' ', 'slowly','quickly',(8)(1)' '); Dcl ns Char(40) Var; Dcl (i,k,j,ii,jj,m,n) Bin Fixed(31); n=hbound(w,1); /* number of sets */ m=hbound(w,2); /* max number of words in set */ Call show; /* show the input */ Do i=1 To n-1; /* loop over sets */ k=i+1; /* the following set */ Do ii=1 To m; /* loop over elements in set k*/ If words(w(i,ii))=i Then Do; /* a sentence part found */ Do jj=1 To m; /* loop over following words */ If right(w(i,ii),1)=left(w(k,jj),1) Then Do; /* fitting */ ns=w(i,ii)!!' '!!w(k,jj); /* build new sentence (part) */ If words(ns)=k Then /* 'complete' part */ Call add(k,ns); /* add to set k */ End; End; End; End; Do jj=1 To m; /* show the results */ If words(w(4,jj))=4 Then put edit('--> ',w(4,jj))(Skip,a,a); End; add: Proc(ni,s); /********************************************************************* * add a sentence (part) to set ni *********************************************************************/ Dcl (i,ni) Bin Fixed(31); Dcl s Char(40) Var; Do i=1 To m While(w(ni,i)>''); /* look for an empty slot */ End; w(ni,i)=s; /* add the sentence (part) */ End; words: Proc(s) Returns(Bin Fixed(31)); /********************************************************************* * return the number of blank separated words in s *********************************************************************/ Dcl s Char(40) Var; Dcl nw Bin Fixed(31) Init(0); Dcl i Bin Fixed(31) Init(1); If s>'' Then Do; nw=1; Do i=1 To length(s); If substr(s,i,1)=' ' Then nw+=1; End; End; Return(nw); End; show: Proc; /********************************************************************* * show the input sets *********************************************************************/ Dcl (i,j,mm) Bin Fixed(31) Init(0); Dcl l(4) Bin Fixed(31) Init((4)0); Do i=1 To n; Do j=1 To m; If w(i,j)>'' Then Do; mm=max(mm,j); /* max number of words in any set */ l(i)=max(l(i),length(w(i,j))); /* max word length in set i */ End; End; End; Put Edit('Input:')(Skip,a); Do j=1 To mm; /* output lines */ Put Skip; Do i=1 To n; Put Edit(w(i,j),' ')(a(l(i)),a); End; End; Put Skip; End; End;`
Output:
```Input: (extended by 2 words!)
the frog walked slowly
a thing grows
if trots
--> the elephant trots slowly
--> that thing grows slowly
--> if frog grows slowly
```
## Prolog
`amb(E, [E|_]).amb(E, [_|ES]) :- amb(E, ES). joins(Left, Right) :- append(_, [T], Left), append([R], _, Right), ( T \= R -> amb(_, []) % (explicitly using amb fail as required) ; true ). amb_example([Word1, Word2, Word3, Word4]) :- amb(Word1, ["the","that","a"]), amb(Word2, ["frog","elephant","thing"]), amb(Word3, ["walked","treaded","grows"]), amb(Word4, ["slowly","quickly"]), joins(Word1, Word2), joins(Word2, Word3), joins(Word3, Word4).`
## PureBasic
`Procedure Words_Ok(String1.s, String2.s) If Mid(String1,Len(String1),1)=Mid(String2,1,1) ProcedureReturn #True EndIf ProcedureReturn #FalseEndProcedure Procedure.s Amb(Array A.s(1), Array B.s(1), Array C.s(1), Array D.s(1)) Protected a, b, c, d For a=0 To ArraySize(A()) For b=0 To ArraySize(B()) For c=0 To ArraySize(C()) For d=0 To ArraySize(D()) If Words_Ok(A(a),B(b)) And Words_Ok(B(b),C(c)) And Words_Ok(C(c),D(d)) ProcedureReturn A(a)+" "+B(b)+" "+C(c)+" "+D(d) EndIf Next Next Next Next ProcedureReturn "" ; Empty string, e.g. failEndProcedure If OpenConsole() Define Text.s Dim Set1.s(2) Dim Set2.s(2) Dim Set3.s(2) Dim Set4.s(1) Set1(0)="the": set1(1)="that": set1(2)="a" Set2(0)="frog": set2(1)="elephant": set2(2)="thing" Set3(0)="walked": set3(1)="treaded": set3(2)="grows" Set4(0)="slowly": set4(1)="quickly" text=Amb(set1(),set2(),Set3(),set4()) If Text<>"" PrintN("Correct sentence would be,"+#CRLF\$+Text) Else PrintN("Failed to fine a correct sentence.") EndIf PrintN(#CRLF\$+#CRLF\$+"Press ENTER to exit."): Input() CloseConsole()EndIf`
## Python
### Procedural
(Note: The code is also imported and used as a module in the solution to this task).
Python does not have the amb function, but the declarative style of programming and the use of the one "function" to do all three tasks of:
• Setting ranges
• Setting the constraint
• Iterating over all solutions
can be done in what appears to be a declarative manner with the following class Amb:
`import itertools as _itertools class Amb(object): def __init__(self): self._names2values = {} # set of values for each global name self._func = None # Boolean constraint function self._valueiterator = None # itertools.product of names values self._funcargnames = None # Constraint parameter names def __call__(self, arg=None): if hasattr(arg, '__code__'): ## ## Called with a constraint function. ## globls = arg.__globals__ if hasattr(arg, '__globals__') else arg.func_globals # Names used in constraint argv = arg.__code__.co_varnames[:arg.__code__.co_argcount] for name in argv: if name not in self._names2values: assert name in globls, \ "Global name %s not found in function globals" % name self._names2values[name] = globls[name] # Gather the range of values of all names used in the constraint valuesets = [self._names2values[name] for name in argv] self._valueiterator = _itertools.product(*valuesets) self._func = arg self._funcargnames = argv return self elif arg is not None: ## ## Assume called with an iterable set of values ## arg = frozenset(arg) return arg else: ## ## blank call tries to return next solution ## return self._nextinsearch() def _nextinsearch(self): arg = self._func globls = arg.__globals__ argv = self._funcargnames found = False for values in self._valueiterator: if arg(*values): # Set globals. found = True for n, v in zip(argv, values): globls[n] = v break if not found: raise StopIteration return values def __iter__(self): return self def __next__(self): return self() next = __next__ # Python 2 if __name__ == '__main__': if True: amb = Amb() print("\nSmall Pythagorean triples problem:") x = amb(range(1,11)) y = amb(range(1,11)) z = amb(range(1,11)) for _dummy in amb( lambda x, y, z: x*x + y*y == z*z ): print ('%s %s %s' % (x, y, z)) if True: amb = Amb() print("\nRosetta Code Amb problem:") w1 = amb(["the", "that", "a"]) w2 = amb(["frog", "elephant", "thing"]) w3 = amb(["walked", "treaded", "grows"]) w4 = amb(["slowly", "quickly"]) for _dummy in amb( lambda w1, w2, w3, w4: \ w1[-1] == w2[0] and \ w2[-1] == w3[0] and \ w3[-1] == w4[0] ): print ('%s %s %s %s' % (w1, w2, w3, w4)) if True: amb = Amb() print("\nAmb problem from " "http://www.randomhacks.net/articles/2005/10/11/amb-operator:") x = amb([1, 2, 3]) y = amb([4, 5, 6]) for _dummy in amb( lambda x, y: x * y != 8 ): print ('%s %s' % (x, y))`
Output:
```Small Pythagorean triples problem:
3 4 5
4 3 5
6 8 10
8 6 10
Rosetta Code Amb problem:
that thing grows slowly
Amb problem from http://www.randomhacks.net/articles/2005/10/11/amb-operator:
1 4
1 5
1 6
2 5
2 6
3 4
3 5
3 6```
### List Comprehension
The semantics of Python's list comprehension notation is also formally equivalent to that of the list monad structure in the Haskell versions above.
List comprehensions provide quite a clean and natural encoding of the amb relationship between sets of indeterminate values and sets of constraints:
`# joins :: String -> String -> Booldef joins(a, b): return a[-1] == b[0] print ( [ ' '.join([w1, w2, w3, w4]) for w1 in ['the', 'that', 'a'] for w2 in ['frog', 'elephant', 'thing'] for w3 in ['walked', 'treaded', 'grows'] for w4 in ['slowly', 'quickly'] if joins(w1, w2) and joins(w2, w3) and joins(w3, w4) ])`
Output:
`['that thing grows slowly']`
Rearranging this by pairing each indeterminate value with a predicate may foreground and clarify the way in which list comprehensions encode amb pairings:
`def main(): print ( unlines([ unwords([w1, w2, w3, w4]) for w1 in ['the', 'that', 'a'] if True for w2 in ['frog', 'elephant', 'thing'] if joins(w1, w2) for w3 in ['walked', 'treaded', 'grows'] if joins(w2, w3) for w4 in ['slowly', 'quickly'] if joins(w3, w4) ]) ) # joins :: String -> String -> Booldef joins(a, b): return a[-1] == b[0] # unlines :: [String] -> Stringdef unlines(xs): return '\n'.join(xs) # unwords :: [String] -> Stringdef unwords(xs): return ' '.join(xs) if __name__ == '__main__': main()`
Output:
`that thing grows slowly`
Defining amb directly as the list monad bind operator, and using it to enchain indeterminate values and predicates:
`from itertools import chain # amb :: [a] -> (a -> [b]) -> [b]def amb(xs): return lambda f: list( chain.from_iterable( map(f, xs) ) ) # main :: IO ()def main(): xs = enumFromTo(1)(10) print ('Pythagorean triples from integers 1-10:') print ( amb(xs)( lambda x: amb(xs) (lambda y: amb(xs) (lambda z: when( x * x + y * y == z * z )( (x, y, z) ) )) ) ) # joins :: String -> String -> Bool def joins(a, b): return a[-1] == b[0] print ('\nRC problem given above:') print ( amb(['the', 'that', 'a'])( lambda w1: amb( ['frog', 'elephant', 'thing'] )(lambda w2: amb( ['walked', 'treaded', 'grows'] )(lambda w3: amb( ['slowly', 'quickly'] )(lambda w4: when( joins(w1, w2) and joins(w2, w3) and joins(w3, w4) )( (w1, w2, w3, w4) )))) ) ) print('\nAdditional problem reference in procedural version above:') print( amb([1, 2, 3]) ( lambda x: amb([4, 5, 6]) ( lambda y: when(x * y != 8) ( (x, y) ) ) ) ) # GENERIC ------------------------------------------------- # enumFromTo :: (Int, Int) -> [Int]def enumFromTo(m): return lambda n: list(range(m, 1 + n)) # when :: Bool -> [a] -> [a]def when(p): return lambda x: [x] if p else [] # MAIN ---if __name__ == '__main__': main()`
Output:
```Pythagorean triples from integers 1-10:
[(3, 4, 5), (4, 3, 5), (6, 8, 10), (8, 6, 10)]
RC problem given above:
[('that', 'thing', 'grows', 'slowly')]
Additional problem reference in procedural version above:
[(1, 4), (1, 5), (1, 6), (2, 5), (2, 6), (3, 4), (3, 5), (3, 6)]```
Or, if we prefer to pair each indeterminate value with its immediate predicate, rather than using a single compound predicate at the end of the expression:
`from itertools import chain # amb :: [a] -> (a -> [b]) -> [b]def amb(xs): return lambda f: list( chain.from_iterable( map(f, xs) ) ) # when :: Bool -> [a] -> [a]def when(p): return lambda xs: xs if p else [] # TEST ---------------------------------------------------- # joins :: String -> String -> Booldef joins(a, b): return a[-1] == b[0] print ( amb(['the', 'that', 'a'])( lambda w1: when(True) (amb(['frog', 'elephant', 'thing']) (lambda w2: when(joins(w1, w2)) (amb(['walked', 'treaded', 'grows']) (lambda w3: when(joins(w2, w3)) (amb(['slowly', 'quickly']) (lambda w4: when(joins(w3, w4))( [w1, w2, w3, w4] )))))) ) ))`
Output:
`['that', 'thing', 'grows', 'slowly']`
## R
A brute force approach that depends on the expand.grid() function, which generates all possible paths through a list of vectors:
`checkSentence <- function(sentence){# Input: character vector# Output: whether the sentence formed by the elements of the vector is valid for (index in 1:(length(sentence)-1)){ first.word <- sentence[index] second.word <- sentence[index+1] last.letter <- substr(first.word, nchar(first.word), nchar(first.word)) first.letter <- substr(second.word, 1, 1) if (last.letter != first.letter){ return(FALSE) } } return(TRUE)} amb <- function(sets){# Input: list of character vectors containing all sets to consider# Output: list of character vectors that are valid all.paths <- apply(expand.grid(sets), 2, as.character) all.paths.list <- split(all.paths, 1:nrow(all.paths)) winners <- all.paths.list[sapply(all.paths.list, checkSentence)] return(winners)}`
Output:
`sentence1 <- c("that", "thing", "grows", "slowly")sentence2 <- c("rosetta", "code", "is", "cool")sentence <- list(sentence1, sentence2)sapply(sentence, checkSentence)[1] TRUE FALSE set1 <- c("the", "that", "a")set2 <- c("frog", "elephant", "thing")set3 <- c("walked", "treaded", "grows")set4 <- c("slowly", "quickly")sets <- list(set1, set2, set3, set4)amb(sets)\$`26`[1] "that" "thing" "grows" "slowly"`
## Racket
` #lang racket ;; A quick `amb' implementation (same as in the Twelve Statements task)(define failures null) (define (fail) (if (pair? failures) ((first failures)) (error "no more choices!"))) (define (amb/thunks choices) (let/cc k (set! failures (cons k failures))) (if (pair? choices) (let ([choice (first choices)]) (set! choices (rest choices)) (choice)) (begin (set! failures (rest failures)) (fail)))) (define-syntax-rule (amb E ...) (amb/thunks (list (lambda () E) ...))) (define (assert condition) (unless condition (fail))) ;; Problem solution (define (joins? left right) (regexp-match? #px"(.)\0\\1" (~a left "\0" right))) (let ([result (list (amb "the" "that" "a") (amb "frog" "elephant" "thing") (amb "walked" "treaded" "grows") (amb "slowly" "quickly"))]) (for ([x result] [y (cdr result)]) (assert (joins? x y))) result);; -> '("that" "thing" "grows" "slowly") `
## REXX
### version 1
An assumption was made that equivalent lowercase and uppercase (Latin) letters are considered a match.
`/*REXX program demonstrates the Amd operator, choosing a word from each set. */ @.1 = "the that a" @.2 = "frog elephant thing" @.3 = "walked treaded grows" @.4 = "slowly quickly" @.0 = 4 /*define the number of sets being ised.*/call Amb 1 /*find all word combinations that works*/exit /*stick a fork in it, we're all done. *//*──────────────────────────────────────────────────────────────────────────────────────*/Amb: procedure expose @.; parse arg # x; arg . u /*ARG uppercases U value. */ if #>@.0 then do; y= word(u, 1) /*Y: is a uppercased U. */ do n=2 to words(u); ?= word(u, n) if left(?, 1) \== right(y, 1) then return; y= ? end /*n*/ say strip(x) /*¬show superfluous blanks.*/ end /* [↓] generate all combos recursively*/ do j=1 for words(@.#); call Amb #+1 x word(@.#, j) end /*j*/ return`
output when using the default internal inputs:
```that thing grows slowly
```
### version 2
` /* REXX ************************************************************** * 25.08.2013 Walter Pachl derived from PL/I *********************************************************************/ mm=0 w.='' l.=0 Call mkset 1,'the that a if' Call mkset 2,'frog elephant thing' Call mkset 3,'walked treaded grows trots' Call mkset 4,'slowly quickly' Call show Do i=1 to 3 /* loop over sets */ Call showm k=i+1 /* the following set */ Do ii=1 To 10 /* loop over elements in set k*/ If words(w.i.ii)=i Then Do /* a sentence part found */ Do jj=1 To 10 /* loop over following words */ If right(w.i.ii,1)=left(w.k.jj,1) Then Do /* fitting */ ns=w.i.ii' 'w.k.jj /* build new sentence (part) */ If words(ns)=k Then /* 'complete' part */ Call add k,ns /* add to set k */ End End End End End Do jj=1 To 10 /* show the results */ If words(w.4.jj)=4 Then Say '-->' w.4.jj End Return add: Procedure Expose w. /********************************************************************* * add a sentence (part) to set ni *********************************************************************/ Parse Arg ni,s Do i=1 To 10 While w.ni.i>'' /* look for an empty slot */ End w.ni.i=s /* add the sentence (part) */ Return mkset: Procedure Expose w. mm l. /********************************************************************* * initialize the sets *********************************************************************/ Parse Arg i,wl Do j=1 By 1 While wl<>'' Parse Var wl w.i.j wl l.i=max(l.i,length(w.i.j)) End mm=max(mm,j-1) Return show: Procedure Expose w. mm l. /********************************************************************* * show the input *********************************************************************/ Say 'Input:' Do j=1 To mm /* output lines */ ol='' Do i=1 To 4 ol=ol left(w.i.j,l.i) End Say strip(ol) End; say '' Return showm: Procedure Expose w. /********************************************************************* * show the sets' contents *********************************************************************/ dbg=0 If dbg Then Do Do i=1 To 4 Do j=1 To 10 If w.i.j>'' Then Say i j w.i.j End End End Return`
Output: identical to PL/I's
## Ring
` # Project : Amb set1 = ["the","that","a"]set2 = ["frog","elephant","thing"] set3 = ["walked","treaded","grows"] set4 = ["slowly","quickly"]text = amb(set1,set2,set3,set4)if text != "" see "Correct sentence would be: " + nl + text + nlelse see "Failed to fine a correct sentence."ok func wordsok(string1, string2) if substr(string1,len(string1),1) = substr(string2,1,1) return true ok return false func amb(a,b,c,d) for a2 = 1 to len(a) for b2 =1 to len(b) for c2 = 1 to len(c) for d2 = 1 to len(d) if wordsok(a[a2],b[b2]) and wordsok(b[b2],c[c2]) and wordsok(c[c2],d[d2]) return a[a2]+" "+b[b2]+" "+c[c2]+" "+d[d2] ok next next next next return "" `
Output:
```Correct sentence would be:
that thing grows slowly
```
## Ruby
`require "continuation" class Amb class ExhaustedError < RuntimeError; end def initialize @fail = proc { fail ExhaustedError, "amb tree exhausted" } end def choose(*choices) prev_fail = @fail callcc { |sk| choices.each { |choice| callcc { |fk| @fail = proc { @fail = prev_fail fk.call(:fail) } if choice.respond_to? :call sk.call(choice.call) else sk.call(choice) end } } @fail.call } end def failure choose end def assert(cond) failure unless cond endend A = Amb.neww1 = A.choose("the", "that", "a")w2 = A.choose("frog", "elephant", "thing")w3 = A.choose("walked", "treaded", "grows")w4 = A.choose("slowly", "quickly") A.choose() unless w1[-1] == w2[0]A.choose() unless w2[-1] == w3[0]A.choose() unless w3[-1] == w4[0] puts w1, w2, w3, w4`
## Rust
` use std::ops::Add;struct Amb<'a> { list: Vec<Vec<&'a str>>,}fn main() { let amb = Amb { list: vec![ vec!["the", "that", "a"], vec!["frog", "elephant", "thing"], vec!["walked", "treaded", "grows"], vec!["slowly", "quickly"], ], }; match amb.do_amb(0, 0 as char) { Some(text) => println!("{}", text), None => println!("Nothing found"), }}impl<'a> Amb<'a> { fn do_amb(&self, level: usize, last_char: char) -> Option<String> { if self.list.is_empty() { panic!("No word list"); } if self.list.len() <= level { return Some(String::new()); } let mut res = String::new(); let word_list = &self.list[level]; for word in word_list { if word.chars().next().unwrap() == last_char || last_char == 0 as char { res = res.add(word).add(" "); let answ = self.do_amb(level + 1, word.chars().last().unwrap()); match answ { Some(x) => { res = res.add(&x); return Some(res); } None => res.clear(), } } } None }} `
## Scala
`object Amb { def amb(wss: List[List[String]]): Option[String] = { def _amb(ws: List[String], wss: List[List[String]]): Option[String] = wss match { case Nil => ((Some(ws.head): Option[String]) /: ws.tail)((a, w) => a match { case Some(x) => if (x.last == w.head) Some(x + " " + w) else None case None => None }) case ws1 :: wss1 => ws1.flatMap(w => _amb(w :: ws, wss1)).headOption } _amb(Nil, wss.reverse) } def main(args: Array[String]) { println(amb(List(List("the", "that", "a"), List("frog", "elephant", "thing"), List("walked", "treaded", "grows"), List("slowly", "quickly")))) }}`
## Scheme
`(define fail (lambda () (error "Amb tree exhausted"))) (define-syntax amb (syntax-rules () ((AMB) (FAIL)) ; Two shortcuts. ((AMB expression) expression) ((AMB expression ...) (LET ((FAIL-SAVE FAIL)) ((CALL-WITH-CURRENT-CONTINUATION ; Capture a continuation to (LAMBDA (K-SUCCESS) ; which we return possibles. (CALL-WITH-CURRENT-CONTINUATION (LAMBDA (K-FAILURE) ; K-FAILURE will try the next (SET! FAIL K-FAILURE) ; possible expression. (K-SUCCESS ; Note that the expression is (LAMBDA () ; evaluated in tail position expression)))) ; with respect to AMB. ... (SET! FAIL FAIL-SAVE) ; Finally, if this is reached, FAIL-SAVE))))))) ; we restore the saved FAIL. (let ((w-1 (amb "the" "that" "a")) (w-2 (amb "frog" "elephant" "thing")) (w-3 (amb "walked" "treaded" "grows")) (w-4 (amb "slowly" "quickly"))) (define (joins? left right) (equal? (string-ref left (- (string-length left) 1)) (string-ref right 0))) (if (joins? w-1 w-2) '() (amb)) (if (joins? w-2 w-3) '() (amb)) (if (joins? w-3 w-4) '() (amb)) (list w-1 w-2 w-3 w-4))`
## Seed7
`\$ include "seed7_05.s7i"; const type: setListType is array array string; const func array string: amb (in string: word1, in setListType: listOfSets) is func result var array string: ambResult is 0 times ""; local var string: word2 is ""; begin for word2 range listOfSets[1] do if length(ambResult) = 0 and word1[length(word1) len 1] = word2[1 len 1] then if length(listOfSets) = 1 then ambResult := [] (word1) & [] (word2); else ambResult := amb(word2, listOfSets[2 ..]); if length(ambResult) <> 0 then ambResult := [] (word1) & ambResult; end if; end if; end if; end for; end func; const func array string: amb (in setListType: listOfSets) is func result var array string: ambResult is 0 times ""; local var string: word1 is ""; begin for word1 range listOfSets[1] do if length(ambResult) = 0 then ambResult := amb(word1, listOfSets[2 ..]); end if; end for; end func; const proc: main is func local var array string: ambResult is 0 times ""; var string: word is ""; begin ambResult := amb([] ([] ("the", "that", "a"), [] ("frog", "elephant", "thing"), [] ("walked", "treaded", "grows"), [] ("slowly", "quickly"))); for word range ambResult do write(word <& " "); end for; writeln; end func;`
Output:
```that thing grows slowly
```
## SETL
`program amb; sets := unstr('[{the that a} {frog elephant thing} {walked treaded grows} {slowly quickly}]'); words := [amb(words): words in sets];if exists lWord = words(i), rWord in {words(i+1)} | lWord(#lWord) /= rWord(1) then fail;end if; proc amb(words); return arb {word in words | ok};end proc; end program;`
Sadly ok and fail were only ever implemented in CIMS SETL, and are not in any compiler or interpreter that is available today, so this is not very useful as it stands.
### Alternate version (avoids backtracking)
`program amb; sets := unstr('[{the that a} {frog elephant thing} {walked treaded grows} {slowly quickly}]'); print(amb(sets)); proc amb(sets); return amb1([], {}, sets);end proc; proc amb1(prev, mbLast, sets); if sets = [] then return prev; else words fromb sets; if exists word in words | (forall last in mbLast | last(#last) = word(1)) and (exists sentence in {amb1(prev with word, {word}, sets)} | true) then return sentence; end if; end if;end proc; end program;`
We cheat a bit here - this version of amb must be given the whole list of word sets, and that list is consumed recursively. It can't pick a word from an individual list.
## Tcl
### Brute Force
Brute force, with quick kill of failing attempts:
`set amb { {the that a} {frog elephant thing} {walked treaded grows} {slowly quickly}} proc joins {a b} { expr {[string index \$a end] eq [string index \$b 0]}} foreach i [lindex \$amb 0] { foreach j [lindex \$amb 1] { if ![joins \$i \$j] continue foreach k [lindex \$amb 2] { if ![joins \$j \$k] continue foreach l [lindex \$amb 3] { if [joins \$k \$l] { puts [list \$i \$j \$k \$l] } } } }}`
### With Coroutines
A more sophisticated using Tcl 8.6's coroutine facility that avoids the assumption of what the problem is in the code structure:
`package require Tcl 8.6proc cp {args} { coroutine cp.[incr ::cps] apply {{list args} { yield [info coroutine] foreach item \$list { if {[llength \$args]} { set c [cp {*}\$args] while 1 { yield [list \$item {*}[\$c]] } } else { yield \$item } } return -code break }} {*}\$args}proc amb {name filter args} { coroutine \$name apply {{filter args} { set c [cp {*}\$args] yield [info coroutine] while 1 { set value [\$c] if {[{*}\$filter \$value]} { yield \$value } } return -code break }} \$filter {*}\$args} proc joins {a b} { expr {[string index \$a end] eq [string index \$b 0]}}proc joins* list { foreach a [lrange \$list 0 end-1] b [lrange \$list 1 end] { if {![joins \$a \$b]} {return 0} } return 1} amb words joins* \ {the that a} \ {frog elephant thing} \ {walked treaded grows} \ {slowly quickly}while 1 { puts [words] }`
## TUSCRIPT
`\$\$ MODE TUSCRIPTset1="the'that'a"set2="frog'elephant'thing"set3="walked'treaded'grows"set4="slowly'quickly"LOOP w1=set1 lastw1=EXTRACT (w1,-1,0) LOOP w2=set2 IF (w2.sw.\$lastw1) THEN lastw2=EXTRACT (w2,-1,0) LOOP w3=set3 IF (w3.sw.\$lastw2) THEN lastw3=EXTRACT (w3,-1,0) LOOP w4=set4 IF (w4.sw.\$lastw3) sentence=JOIN (w1," ",w2,w3,w4) ENDLOOP ENDIF ENDLOOP ENDIF ENDLOOPENDLOOPPRINT sentence`
Output:
```that thing grows slowly
```
## TXR
#### Delimited Continuations
Because we are using delimited continuations, we are able to confine the `amb` computation into a scope. To express this, we define an `amb-scope` operator which is just a syntactic sugar for using `block` to create a delimiting prompt whose name is `amb-scope`. Everything outside of an instance of this operator knows nothing about `amb` and is not involved in the backtracking flow at all. As far as the outside is concerned, the `amb-scope` block calculates something, terminates and returns a value, like any other ordinary Lisp form:
`(defmacro amb-scope (. forms) ^(block amb-scope ,*forms))`
Next, we define `amb` as a function.
But first, a note about a convention: we are using the Lisp object `nil` not only to represent Boolean false, but also a failure. Thus `(amb nil)` fails. A `nil` return out of the entire `amb-scope` denotes overall failure.
The function is very simple. It captures a single continuation and binds it to the `cont` variable, using the `suspend` macro. Then, it iterates over all of its arguments. Each argument which is `nil` is ignored. For any other value, the function effectively asks the question, "if, with this argument, I run my future computation to completion (i.e. back up to the delimiting contour defined by `amb-scope`) will the answer be a Boolean true?". It asks the question simply by invoking the continuation on the argument. If the answer is affirmative, then it breaks out of the loop and returns that argument value immediately. Otherwise the iteration continues with the next argument, to try a different alternative future. If the loop runs through to completion, then the function returns `nil`, indicating failure.
`(defun amb (. args) (suspend amb-scope cont (each ((a args)) (when (and a (call cont a)) (return-from amb a)))))`
And some test code:
Output:
```\$ txr -i amb.tl
1> (amb-scope
(let ((w1 (amb "the" "that" "a"))
(w2 (amb "frog" "elephant" "thing"))
(w4 (amb "slowly" "quickly")))
(amb (and (eql [w1 -1] [w2 0])
(eql [w2 -1] [w3 0])
(eql [w3 -1] [w4 0])))
(list w1 w2 w3 w4)))
("that" "thing" "grows" "slowly")
2>```
#### Pattern Language
This is not exactly the implementation of an operator, but a solution worth presenting. The language has the built in pattern matching and backtracking behavior suited for this type of text mining task.
For convenience, we prepare the data in four files:
```\$ cat amb/set1
the
that
a
\$ cat amb/set2
frog
elephant
thing
\$ cat amb/set3
walked
grows
\$ cat amb/set4
slowly
quickly```
Then code is:
`@(define first_last (first last whole))@ (all)@(skip :greedy)@{last 1}@ (and)@{first 1}@(skip)@ (and)@whole@ (end)@(end)@(next "amb/set1")@(skip)@(first_last fi1 la1 w1)@(next "amb/set2")@(skip)@(first_last la1 la2 w2)@(next "amb/set3")@(skip)@(first_last la2 la3 w3)@(next "amb/set4")@(skip)@(first_last la3 la4 w4)@(output)@w1 @w2 @w3 @w4@(end)`
Run:
```\$ ./txr amb.txr
that thing grows slowly```
As you can see, this has the "nondeterministic flavor" of Amb. The `@(skip)` directives"magically" skip over the lines of input that do not succeed.
This example naturally handles empty strings, since the `first_last` function simply does not match such inputs.
Here is how to embed the task's specific data in the code:
`@(define first_last (first last whole))@ (all)@(skip :greedy)@{last 1}@ (and)@{first 1}@(skip)@ (and)@whole@ (end)@(end)@(next :list ("the" "that" "a"))@(skip)@(first_last fi1 la1 w1)@(next :list ("frog" "elephant" "thing"))@(skip)@(first_last la1 la2 w2)@(next :list ("walked" "treaded" "grows"))@(skip)@(first_last la2 la3 w3)@(next :list ("slowly" "quickly"))@(skip)@(first_last la3 la4 w4)@(output)@w1 @w2 @w3 @w4@(end)`
## VBScript
##### Implementation
`class ambiguous dim sRule public property let rule( x ) sRule = x end property public default function amb(p1, p2) amb = eval(sRule) end functionend class`
##### Invocation
`dim ambset amb = new ambiguous amb.rule = "right(p1,1)=left(p2,1)" dim w1, w2, w3, w4for each w1 in split("the that a", " ") for each w2 in split("frog elephant thing", " ") for each w3 in split("walked treaded grows", " ") for each w4 in split("slowly quickly", " ") if amb(w1, w2) and amb(w2, w3) and amb(w3, w4) then wscript.echo w1, w2, w3, w4 end if next next nextnext`
Output:
```that thing grows slowly
```
## zkl
zkl doesn't support dynamic scoping so no variable update (without using reflection, which is not a good thing).
These solutions assume that the solution space is ordered: the possibilities in a always precede those in b, etc.
Some constraints on the constraint to make the task easier: it is a function of two strings rather than n items. All solutions are returned, empty list otherwise.
`fcn joins(a,b){ a[-1]==b[0] } // the constraint`
The do-it-in-one-wack solution:
`amb(joins, T("the","that","a"), T("frog","elephant","thing"), T("walked","treaded","grows"), T("slowly","quickly") ).println();`
Output:
`L("that thing grows slowly")`
Or, we can defer the computations (the future method starts a worker thread, the result is not forced until it is used).
`a:=amb.future(joins,T("the","that","a"),T("frog","elephant","thing"));b:=amb.future(joins,T("walked","treaded","grows"),T("slowly","squacking"));c:=amb.future(joins,a,b); // a future of futuresprintln(a,b,c); c=c.noop(); // trigger the landslide, referencing c forces a result for a,b,cprintln(a.noop(),b.noop(),c); // even though a has a result, it doesn't know it until we force it`
Output:
```DeferredDeferredDeferred
L("the elephant","that thing")L("grows slowly","grows squacking")L("that thing grows slowly","that thing grows squacking")
```
Your basic Cartesian product recursive decent tree traversal, making extensive use of varargs:
`fcn amb(f,a,b,etc){ fcn(sink,f,a,b,etc){ abc:=vm.arglist[2,*]; // ((the,that),(frog,elephant)) if(abc.len()<2) return(sink.write(abc[0][0])); // back out of recursion foreach a,b in (abc[0],abc[1]){ // Cartesian product if(f(a,b)) self.fcn(sink,f,T(String(a," ",b)),abc[2,*].xplode()); } }(s:=List(),vm.pasteArgs()); s}`
A more general solution, where each possible solution is a list, which is passed to the constraining function and the first solution found is returned:
`fcn amb(f,a,b,c,etc){ Walker.cproduct(vm.pasteArgs(1)).filter1(f) }`
` // [()] notation unpacks parameter list: f((1,2,3))-->a=1,b=2,c=3fcn f([(a,b,c,d)]){ joins(a,b) and joins(b,c) and joins(c,d) }amb(f, T("the","that","a"), T("frog","elephant","thing"), T("walked","treaded","grows"), T("slowly","quickly") ).println();`
Output:
`L("that","thing","grows","slowly")`
Here is an example using an infinite list as the first possibility space:
`amb(fcn([(x,y,z)]){ x*x + y*y == z*z },[1..],[1..10],[1..10]).println();`
Output:
`L(3,4,5)` | 33,633 | 118,019 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.953125 | 3 | CC-MAIN-2019-22 | latest | en | 0.87155 |
https://atomparticles.com/how-much-carbon-is-in-a-human-body/ | 1,702,224,150,000,000,000 | text/html | crawl-data/CC-MAIN-2023-50/segments/1700679102612.80/warc/CC-MAIN-20231210155147-20231210185147-00099.warc.gz | 134,487,034 | 12,351 | # How Much Carbon Is In A Human Body
## How much carbon is in a human body?
We’re each about 18 percent carbon by weight. If the average human weight is around 120 pounds—that’s the Explainer’s very rough estimate, encompassing both children and adults—there are about 21.6 pounds of carbon stored in the average person.
## Is 80% of the human body is carbon?
It is thus no wonder that 99% of the atoms in the human body come from six elements: Hydrogen (62.9%), oxygen (almost 24%), carbon (nearly 12%), nitrogen (nearly 0.6%), calcium (0.24%) and phosphorus (0.14%).
## How many atoms are a human body?
Atoms range in size from a few tenths of a nanometer to several nanometers across. More than 10 million hydrogen atoms would fit across the head of a pin. Atoms are the basic constituents of molecules, cells, humans, and planets. The human body contains about a billion billion billion (10^27) atoms.
## How much of the human body is carbon 12?
Element Symbol percent atoms
Carbon C 12.0
Hydrogen H 62.0
Nitrogen N 1.1
Calcium Ca 0.22
## Where is carbon in human body?
It would be impossible for life on earth to exist without carbon. Carbon is the main component of sugars, proteins, fats, DNA, muscle tissue, pretty much everything in your body. The reason carbon is so special is down to the electron configuration of the individual atoms.
## Which element is highest in human body?
Oxygen is the most abundant element in the human body, accounting for about 65% of a person’s mass. Each water molecule is made up of two hydrogen atoms bonded to one oxygen atom, but the mass of each oxygen atom is much larger than the combined mass of the hydrogen.
## How many atoms are in a 70kg human?
In summary, for a typical human of 70 kg, there are almost 7*1027 atoms (that’s a 7 followed by 27 zeros!) Another way of saying this is seven billion billion billion. Of this, almost 2/3 is hydrogen, 1/4 is oxygen, and about 1/10 is carbon. These three atoms add up to 99% of the total!
## What are 3 facts about carbon?
• Carbon gets its name from the Latin word carbo, which means coal.
• Diamonds and graphite are among the hardest and softest natural materials known, respectively. …
• Carbon makes up 0.032% of the Earth’s lithosphere (crust and outer mantle) by weight, according to the Encyclopedia of Earth.
## What are the 4 types of elements?
• Metals.
• Non-metals.
• Metalloids.
• Noble gases.
See also Does Harvard Have Quantum Computing
## How many atoms are in 1 cell?
Scientists estimate the average cell contains 100 trillion atoms.
## How many atoms are in oxygen?
A molecule of oxygen contains 2 atoms. Oxygen is a colourless, odourless, tasteless gas essential to living organisms.
## How many atoms are in your hair?
A human hair is about a million carbon atoms wide. This is smaller than the shortest wavelength of visible light, which means humans cannot see atoms with conventional microscopes. Atoms are so small that accurately predicting their behavior using classical physics is not possible due to quantum effects.
## Do we have carbon 13 in our body?
Almost all of the carbon atoms in your body are Carbon 12. There is another form of carbon, Carbon 13, which is very rare.
## How much carbon is healthy?
The levels of CO2 in the air and potential health problems are: 400 ppm: average outdoor air level. 400–1,000 ppm: typical level found in occupied spaces with good air exchange. 1,000–2,000 ppm: level associated with complaints of drowsiness and poor air.
## What is 18.5% of our body?
By mass, 96% of our bodies are composed of four key elements: oxygen (65%), carbon (18.5%), hydrogen (9.5%), and nitrogen (3.3%).
## How do we know humans are 72% water?
An individual’s total body water can be determined using flowing-afterglow mass spectrometry (FA-MS) to measure the abundance of deuterium in breath samples. | 942 | 3,880 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.890625 | 3 | CC-MAIN-2023-50 | longest | en | 0.925463 |
https://www.thestudentroom.co.uk/showthread.php?page=76&t=3000975 | 1,542,718,017,000,000,000 | text/html | crawl-data/CC-MAIN-2018-47/segments/1542039746386.1/warc/CC-MAIN-20181120110505-20181120132505-00355.warc.gz | 1,043,058,850 | 46,065 | Turn on thread page Beta
You are Here: Home >< Maths
# Edexcel A2 C3 Mathematics 12th June 2015 watch
1. someone help
Attached Images
2. (Original post by iKaneee)
Try 2014 R paper, hardest one ive seen
Really?
Posted from TSR Mobile
3. anyone have grade boundaries for last year's c3 paper? Can't find them anywhere!
4. (Original post by JayGreen)
when using dx/dy if you sub in the y value and flip the answer that gives you the gradient
Correct
5. (Original post by aprocrastinator)
anyone have grade boundaries for last year's c3 paper? Can't find them anywhere!
66-a*
60-a
54-b
6. Guys for part C, why is the maximum function when the cos function is at a minimum, rather than when it's at a maximum?
http://gyazo.com/3e96339a8a0d7e1be522e458487dab7d
7. (Original post by cerlohee)
66-a*
60-a
54-b
thank you! Do you happen to know what full ums was?
8. Do we need to know-
- Half angle formula
- factor formula
- Proving double angle formula
?
9. (Original post by cerlohee)
Guys for part C, why is the maximum function when the cos function is at a minimum, rather than when it's at a maximum?
http://gyazo.com/3e96339a8a0d7e1be522e458487dab7d
because you are taking away the function from 10 so if it was at max value then a larger number would be subtracted by 10, so smaller height
10. (Original post by aprocrastinator)
thank you! Do you happen to know what full ums was?
It's always 3xA-2xB so it's 72 )
11. (Original post by studentwiz)
someone help
which paper is this?
12. (Original post by aprocrastinator)
because you are taking away the function from 10 so if it was at max value then a larger number would be subtracted by 10, so smaller height
But I thought you were taking away the negative function, which is effectively adding the function?
EDIT: o nvm i got it sorry!!! you're adding not subtracting the negative cos function haha
thanku!
13. http://www.examsolutions.net/a-level...6&solution=8.2
Why isn't cos() -1? Surely -21/25 is smaller than 21/25?
14. (Original post by TeeEm)
just did this question with one of my students ... (he got eaten badly)
Any takers
Is this the solution?
Posted from TSR Mobile
15. (Original post by studentwiz)
someone help
use the compound angles first
sin(A - B) = sinAcosB - cosAsinB
cos(A + B) = cosAcosB - sinAsinB
16. (Original post by cerlohee)
It's always 3xA-2xB so it's 72 )
whoa I never knew that lol. THANK YOU!
(Original post by cerlohee)
But I thought you were taking away the negative function, which is effectively adding the function?
so the most negative value would be the minimum...?
17. (Original post by imedico10)
which paper is this?
18. Those IYGB papers are extremely hard, hopefully nothing from there comes up tomorrow.
19. https://b3755649dbd1afe3db91a899c3b9...%20Edexcel.pdf
Anyone help on Q2 part b, not sure where they're getting the solution from/what to use
MS is here:
https://b3755649dbd1afe3db91a899c3b9...%20Edexcel.pdf
many thanks
20. (Original post by SuperMushroom)
Worried haha, how about you?
Not too bad.. I guess it depends whether the paper's good or not..
Turn on thread page Beta
TSR Support Team
We have a brilliant team of more than 60 Support Team members looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.
This forum is supported by:
Updated: June 21, 2016
Today on TSR
### Cambridge interviews
Find out which colleges are sending invitations
### University open days
• University of Bradford
Wed, 21 Nov '18
• Buckinghamshire New University
Wed, 21 Nov '18
• Heriot-Watt University
Wed, 21 Nov '18
Poll
Useful resources
## Make your revision easier
Can you help? Study help unanswered threadsStudy Help rules and posting guidelinesLaTex guide for writing equations on TSR
## Groups associated with this forum:
View associated groups
The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.
Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE | 1,111 | 4,068 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.5 | 4 | CC-MAIN-2018-47 | latest | en | 0.906485 |
http://www.i-am-bored.com/2009/12/teen-tries-to-get-clever-on-his-math-test-pic.html | 1,508,385,159,000,000,000 | text/html | crawl-data/CC-MAIN-2017-43/segments/1508187823220.45/warc/CC-MAIN-20171019031425-20171019051425-00429.warc.gz | 465,750,646 | 25,019 | # Teen Tries To Get Clever On His Math Test [Pic]
Submitted by: fancylad 7 years ago in
371
He fails to realize his teacher is much more clever. Fails test.
371
There are 79 comments:
Female 193
Yeah, SalokinX, I never said I had the answer. Never said it was easy: no claim at all hinting I knew the answer. Additionally, I don`t see you with the answer either. Maybe YOU should go back to kindergarten to learn some simple sentences, eh?
Female 4
I love teachers like that... :)
Female 72
WIN.
Female 36
lol I was like, that`s dumb... then i saw the second pic
Male 8
haha thats great
Male 93
NOW THATS A COOL TEACHER!!!
Female 61
Student: 0
Teacher: 1!
Female 291
Who gives a flying fu*k what the answer is?
That teacher seems great!lol
Female 24
:L i love how some people on here try to solve the problem.
why?
Male 51
Hitaki318, hahahahaaha that is VERY easy. If you are using a calculator to solve that you should go back to kindergarten and start learning math again.
Male 720
The answer is... Who gives a f_ck, I`m on break bitches.
Female 2
hahahahahahHAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHULARIUS HAHA AHA :i-)
Male 1
honestly? the answer is 2/(x+1)...
Female 193
"This problem is easy."
"He`s stupid."
"I can do this problem, simple."
= None of them have the answer.
And now someone will post the answer after either solving it or putting it into a calculator they found on Google.
Magical, isn`t it?!?
Male 1,093
he also fail to draw the elephants dong
Female 5,222
lol
Male 690
holy crap this problem is so easy and I`m an idiot at algebra. looks like someone is failing algebra 1/2
Male 29
It`s been years since I took algebra and I can do that problem. This kid is retarded.
Male 202
that prob would be easy for me whatever the prob is. you just have to know that space time is curved
Male 2,220
However the question in Demoncurtains example is poorly worded, the answers its looking for are presumably... approx square root of 3 and 5m respectively.
but...
An object is only at rest when it stops completely isn`t it? If its still accelerating how can it be at rest?
The spring hasn`e been defined as perfect either, so how is the student to account for the efficiency of its return?
Finally, and most damningly - what is the elasticity coefficient for a very small elephant?
Male 2,220
Demoncurtain: thank you, finally the answer makes sense. I also like the way the teacher has responded with a small picture of the USS Enterprise, thereby acknowledging the students clever cicrumvention of the question as per the Kobiyashi Maru test.
Female 54
mlia?
Male 170
my god
you deserve that -3 for such a question
Female 208
I see how you can be too tired and too lazy to even try to attempt stupid algebra like that.
Female 523
hahahaha awesome teacher!
Male 244
Fail on the part of the student for copying this gem:
Also, that problem is easy.
Female 1,043
lol at the teachers comment
Female 509
Elephants have tails!??
Male 905
hahahaha ohh math. so eassyy
Male 153
im soooooo doing that on my next test and making a tail and circiling the tail over and over
Male 294
I could have sworn a kid in my AP stats class did the exact same thing on a test. But that clearly is`t stats on the sheet there.
Male 15,510
He fails at failing
Male 2
@Xutar who said: 2(x+8)/(x^2+8x+7)
im such a nerd...
Reply- Don`t worry bud, you`re not a nerd.
2(x+7)/(x^2+8x+7).
Female 464
I actually enjoyed doing this kind of math back in the day.
Male 1,067
This elephant seems to also have some form of physical deformity as well as a distinct lack of tail
Male 332
one of the better test answers ive seen here...
Male 74
@xutar
simplify.
Male 170
my response for full credit would be "not if you cut them of....with the power of math"
Male 154
2(x+8)/(x^2+8x+7)
im such a nerd...
Female 4,376
That is awesome
Male 394
Ha, awesome.
Female 3,696
Ouch..MINUS points, that sucks..
Female 1,244
That`s a great teacher haha
Male 177
My math professor would totally write that!!!
Female 281
"I feel like the most retarded part is the fact that the elephant isn`t blocking anything at all."
I think he meant it to block the area below the question where he could work out the problem.
Female 36
i wrote that on my test but i used a turtle and i got full credit.
obviously, that is a mean, mean teacher.
Male 533
Why do all teachers/professors have the same hand writing?
Male 1,073
Actually, partial fractions are algebra. http://en.wikipedia.org/wiki/Partial_fra...
Male 172
Oh Snap!!!
Male 2,148
I feel like the most retarded part is the fact that the elephant isn`t blocking anything at all.
Male 99
partial fractions is calculus. this is called common denominators. he just has to simplify it
Male 431
the teacher is way more awesome than the student! haha
Female 27
HAHAHAHAHAHAHAHAHHAAHAHAHAHHAAHAHA he wanted to do that test joke...soooo stupid..
Male 25,416
U was totally gonna post this! its silly but cool!
Female 4,028
Ha! Such a simple problem, too.
Male 5,314
i always hated this kind of crap. when in my life would i need to solve a problem like that.
Female 184
Ha, that`s what he gets.
I`m not gonna lie, though - I wish I had done something like this in HS
Male 931
partial fractions...right?
Male 1,929
a tick for uwholly12. Yes, the answer is 2/(x+1)
Male 975
thorna kate is that a reference to me? if so then yes because i saw this joke almost 4 years ago and it looks like you guys haven`t
Female 1
The purpose is to simplify. The answer is 2/(x+1).
Male 191
Funnyexamanswers. Love the site.
Female 9,572
lmfao, the comments are funnier then the picture.
Female 1,571
haha. smart ass kid...smart ass teacher :P
Male 59
So, you are trying to solve the problem?WTF?
:D
Male 3,425
The point of this question isn`t to solve x, it`s most likely to simplify the equation.
Male 213
hrlhrl2000
No, x = -7 makes it so you have 3/(-7+7) = 3/0, which is undefined. Not only that, but I dont think the whole problem is showing, because this equation doesnt equal anything, so you cant really solve for x.
Male 4,290
[quote]Solved it. x=-7 suckers.[/quote]
You`ve made the mistake of reading the minus sign as an equals sign, since that`s the only way you`d have enough of a question to attempt an answer.
But if that were the question, then yes, x = -7 would be the right answer.
Female 7
to the retard who "solved" it... your wrong as well... the elephant was closer.
Male 377
older than my mum.
Male 136
Solved it. x=-7 suckers.
Female 237
Does someone think this kid was copying other such internet exam papers?...
Male 4,807
He failed art class too!
Male 975
or at least a similar joke i didnt see the tail part originally---some1 must have copied the same joke
Male 975
this was on my physics teacher`s aim profile wen i was in 10th grade haha
Female 1,395
Yeah thats a lame elephant; more like an obese mouse/probiscus monkey hybrid.
Male 2,551
Haha, I wish my teachers were that awesome.
Male 4,745
Idiot.
Male 20,905
Link: Teen Tries To Get Clever On His Math Test [Pic] [Rate Link] - He fails to realize his teacher is much more clever. Fails test. | 1,966 | 7,079 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.8125 | 3 | CC-MAIN-2017-43 | latest | en | 0.960519 |
4theloveofmath.com | 1,701,602,681,000,000,000 | text/html | crawl-data/CC-MAIN-2023-50/segments/1700679100499.43/warc/CC-MAIN-20231203094028-20231203124028-00591.warc.gz | 95,255,724 | 19,565 | # Solving Equations
Solving algebraic equations is a cornerstone in the world of mathematics, and our students often need a systematic approach to navigate this challenge. Here’s a method that makes the process both intuitive and relatable: Identify, Isolate, and Undo.
Identify the Variable: Before diving into the equation, it’s vital that students can pinpoint the variable they’re working with, be it ‘x’, ‘y’, or any other letter. By knowing what they are solving for, they can anchor their strategies around it.
If they have an equation like: 2x + 4 = 18 their first thought should be “I need to solve for x!”
Isolate the Variable: Encourage students to think of the equation as a puzzle. The main goal? Get the variable by itself on one side of the equal sign. This is where the reverse order of operations comes in handy. Remind them to start by addressing any added or subtracted numbers before moving to multiplication or division.
2x + 4 = 18 —- Isolating x is the first step! To do so they must recognize what is being done to the x. First, x is being multiplied by 2. Next, 4 is being added to the product of 2 and x.
Undo the Operations: Once they’ve identified what’s being done to the variable, it’s time to do the opposite, effectively “undoing” the operations.
For 2x + 4 = 18 They need to get rid of the 4 first but undoing what is being done. 4 is being added to the product of 2 and x. To undo students subtract 4 from both sides. This isolates the term 2x and gives 2x = 14. Students then undo the multiplication between 2 and x by dividing both sides by 2.
This approach breaks down the process of solving equations into manageable chunks, allowing students to tackle even the most complex equations with confidence.
This print and go set provides a graphic organizer on solving two step equations along with a partner sheet, and coloring practice sheet that can be utilized to help cover this concept.
The notes guide students through the process of solving two-step equations. Initially, students are directed to isolate the expression containing the variable, highlighting the first step in solving the equation. The notes also provide spaces for students to detail the subsequent steps required to completely isolate the variable
September 27, 2023
# WHAT'S NEW ON INSTAGRAM @4THELOVEOFMATH
4 the Love of Math® | 527 | 2,350 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 4.90625 | 5 | CC-MAIN-2023-50 | longest | en | 0.962095 |
https://www.deepdyve.com/lp/springer_journal/infinitely-many-solutions-for-kirchhoff-equations-with-sign-changing-jUAuhaEh66 | 1,716,946,759,000,000,000 | text/html | crawl-data/CC-MAIN-2024-22/segments/1715971059167.30/warc/CC-MAIN-20240529010927-20240529040927-00719.warc.gz | 621,836,797 | 34,733 | # Infinitely many solutions for Kirchhoff equations with sign-changing potential and Hartree nonlinearity
Infinitely many solutions for Kirchhoff equations with sign-changing potential and Hartree... This paper is concerned with the following Kirchhoff-type equations: \begin{aligned} \left\{ \begin{array}{ll} \displaystyle -\big (a+b\int _{\mathbb {R}^{3}}|\nabla u|^{2}\mathrm {d}x\big )\Delta u+ V(x)u+\mu \phi |u|^{p-2}u=f(x, u)+g(x,u), &{} \text{ in } \mathbb {R}^{3},\\ (-\Delta )^{\frac{\alpha }{2}} \phi = \mu |u|^{p}, &{} \text{ in } \mathbb {R}^{3},\\ \end{array} \right. \end{aligned} - ( a + b ∫ R 3 | ∇ u | 2 d x ) Δ u + V ( x ) u + μ ϕ | u | p - 2 u = f ( x , u ) + g ( x , u ) , in R 3 , ( - Δ ) α 2 ϕ = μ | u | p , in R 3 , where $$a>0,~b,~\mu \ge 0$$ a > 0 , b , μ ≥ 0 are constants, $$\alpha \in (0,3)$$ α ∈ ( 0 , 3 ) , $$p\in [2,3+2\alpha )$$ p ∈ [ 2 , 3 + 2 α ) , the potential V(x) may be unbounded from below and $$\phi |u|^{p-2}u$$ ϕ | u | p - 2 u is a Hartree-type nonlinearity. Under some mild conditions on V(x), f(x, u) and g(x, u), we prove that the above system has infinitely many nontrivial solutions. Specially, our results cover the general Schrödinger equations, the Kirchhoff equations and the Schrödinger–Poisson system. http://www.deepdyve.com/assets/images/DeepDyve-Logo-lg.png Mediterranean Journal of Mathematics Springer Journals
# Infinitely many solutions for Kirchhoff equations with sign-changing potential and Hartree nonlinearity
, Volume 15 (3) – May 28, 2018
17 pages
/lp/springer_journal/infinitely-many-solutions-for-kirchhoff-equations-with-sign-changing-jUAuhaEh66
# References (36)
Publisher
Springer Journals
Copyright © 2018 by Springer International Publishing AG, part of Springer Nature
Subject
Mathematics; Mathematics, general
ISSN
1660-5446
eISSN
1660-5454
DOI
10.1007/s00009-018-1170-4
Publisher site
See Article on Publisher Site
### Abstract
This paper is concerned with the following Kirchhoff-type equations: \begin{aligned} \left\{ \begin{array}{ll} \displaystyle -\big (a+b\int _{\mathbb {R}^{3}}|\nabla u|^{2}\mathrm {d}x\big )\Delta u+ V(x)u+\mu \phi |u|^{p-2}u=f(x, u)+g(x,u), &{} \text{ in } \mathbb {R}^{3},\\ (-\Delta )^{\frac{\alpha }{2}} \phi = \mu |u|^{p}, &{} \text{ in } \mathbb {R}^{3},\\ \end{array} \right. \end{aligned} - ( a + b ∫ R 3 | ∇ u | 2 d x ) Δ u + V ( x ) u + μ ϕ | u | p - 2 u = f ( x , u ) + g ( x , u ) , in R 3 , ( - Δ ) α 2 ϕ = μ | u | p , in R 3 , where $$a>0,~b,~\mu \ge 0$$ a > 0 , b , μ ≥ 0 are constants, $$\alpha \in (0,3)$$ α ∈ ( 0 , 3 ) , $$p\in [2,3+2\alpha )$$ p ∈ [ 2 , 3 + 2 α ) , the potential V(x) may be unbounded from below and $$\phi |u|^{p-2}u$$ ϕ | u | p - 2 u is a Hartree-type nonlinearity. Under some mild conditions on V(x), f(x, u) and g(x, u), we prove that the above system has infinitely many nontrivial solutions. Specially, our results cover the general Schrödinger equations, the Kirchhoff equations and the Schrödinger–Poisson system.
### Journal
Mediterranean Journal of MathematicsSpringer Journals
Published: May 28, 2018 | 1,126 | 3,066 | {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.78125 | 3 | CC-MAIN-2024-22 | latest | en | 0.731144 |
http://gmatclub.com/forum/smith-argued-that-recreational-equipment-owned-in-common-by-118467.html | 1,472,442,158,000,000,000 | text/html | crawl-data/CC-MAIN-2016-36/segments/1471982950827.61/warc/CC-MAIN-20160823200910-00264-ip-10-153-172-175.ec2.internal.warc.gz | 107,771,730 | 57,387 | Find all School-related info fast with the new School-Specific MBA Forum
It is currently 28 Aug 2016, 20: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
# Events & Promotions
###### Events & Promotions in June
Open Detailed Calendar
# Smith argued that recreational equipment owned in common by
new topic post reply Question banks Downloads My Bookmarks Reviews Important topics
Author Message
TAGS:
### Hide Tags
Manager
Joined: 21 May 2011
Posts: 239
Followers: 0
Kudos [?]: 178 [0], given: 8
Smith argued that recreational equipment owned in common by [#permalink]
### Show Tags
06 Aug 2011, 21:13
1
This post was
BOOKMARKED
00:00
Difficulty:
(N/A)
Question Stats:
60% (02:34) correct 40% (02:04) wrong based on 81 sessions
### HideShow timer Statistics
Smith argued that recreational equipment owned in common by community members would always be used less carefully than would private recreational equipment. Each member would have an incentive to overuse the equipment and leave any damage unreported because the benefit would accrue to the individual, while the costs of maintaining, repairing, and replacing the equipment would be spread among all users. But a study comparing 200 sailboats owned cooperatively by the Bayside Recreation League and 370 sailboats owned privately showed that the recreation league sailboats were in better condition.
Which of the following, if true and known by the Bayside members, would best help explain the results of the study?
With private sailboats, both the costs and the benefits of avoiding any repairs fall to the individual owner.
For boats that are used by many different people, it is difficult to attribute the costs of maintenance and repair to the wear and tear caused by any individual user.
Routine inspections and repairs of recreation league sailboats are conducted during the winter months, not during the May – September sailing season.
If one Bayside member causes even minor damage to a sailboat without paying for the repair, other members will do so even more, and the costs to each user will outweigh the benefits.
There are many more private sailboats than cooperatively-owned sailboats.
Director
Status: Prep started for the n-th time
Joined: 29 Aug 2010
Posts: 707
Followers: 5
Kudos [?]: 150 [0], given: 37
Re: CR - 700 level - sailboat [#permalink]
### Show Tags
06 Aug 2011, 21:29
D for me.
crick
Manager
Joined: 21 May 2011
Posts: 239
Followers: 0
Kudos [?]: 178 [0], given: 8
Re: CR - 700 level - sailboat [#permalink]
### Show Tags
07 Aug 2011, 10:15
Conclusion: Publicly owned things are in better condition than privately owned
Evidence: study supports the numbers, maintenance cost would be spread across all members
which of the following if true... would best explain... means this is an assumption question.
What is unstated - that the rising maintenance costs will prevent public users from damaging the boats further
Ans. D supports the argument well.
Manager
Joined: 16 May 2011
Posts: 204
Concentration: Finance, Real Estate
GMAT Date: 12-27-2011
WE: Law (Law)
Followers: 1
Kudos [?]: 63 [0], given: 37
Re: CR - 700 level - sailboat [#permalink]
### Show Tags
07 Aug 2011, 11:59
With private sailboats, both the costs and the benefits of avoiding any repairs fall to the individual owner. THERE IS NO COMPARISON BETWEEN PRIVATE AND GROUP. HENCE IT CAN NOT SUPPLY ANSWER TO WHY GROUP (G)> PRIVATE (P)
For boats that are used by many different people, it is difficult to attribute the costs of maintenance and repair to the wear and tear caused by any individual user. SO IF IT DIFFICULT THAN G MEMBERS COULD DAMAGE BOATS WITHOUT ANY NEED TO PAY FOR REPARINIG THEM. WHICH MEANS THAT IN THAT CASE P>G
Routine inspections and repairs of recreation league sailboats are conducted during the winter months, not during the May – September sailing season.NOT HOING ANY RELATION BETWEEN G AND P AND OUT OF SCOPE.
If one Bayside member causes even minor damage to a sailboat without paying for the repair, other members will do so even more, and the costs to each user will outweigh the benefits. COMPARES BETWEEN G AND P AND EXPLAINS Y G>P. IF COST OF HOLDING A BOAT IN G CAN OUTWIGHT THE BENEFITS THAN IT IS POSSIBLE THAT MEMBERS OF G KEEPS THE BOAT IN BETTER POSITION THAN P.
There are many more private sailboats than cooperatively-owned sailboats. THE RESOLVING SHOULD BE DERIVED FROM THE QUESTION (200/370)AND NOT FROM THE TOTAL NUMBERS.
Manager
Status: Applying for 2012 B school admissions
Joined: 25 Jul 2010
Posts: 131
Location: India
Concentration: Strategy, Entrepreneurship
GMAT 1: 720 Q51 V35
GMAT 2: 760 Q50 V44
GPA: 3.6
WE: Manufacturing and Production (Pharmaceuticals and Biotech)
Followers: 11
Kudos [?]: 43 [0], given: 32
Re: CR - 700 level - sailboat [#permalink]
### Show Tags
11 Aug 2011, 00:56
+1 D
_________________
cheers
Mayank
My GMAT Journey: 720 + dare = 760
Intern
Joined: 07 May 2011
Posts: 42
GMAT 1: Q V
GMAT 2: Q V
Followers: 0
Kudos [?]: 16 [0], given: 11
Re: Smith argued that recreational equipment owned in common by [#permalink]
### Show Tags
06 Dec 2012, 19:30
This one was tricky and went with E.
bschool83 wrote:
Smith argued that recreational equipment owned in common by community members would always be used less carefully than would private recreational equipment. Each member would have an incentive to overuse the equipment and leave any damage unreported because the benefit would accrue to the individual, while the costs of maintaining, repairing, and replacing the equipment would be spread among all users. But a study comparing 200 sailboats owned cooperatively by the Bayside Recreation League and 370 sailboats owned privately showed that the recreation league sailboats were in better condition.
Which of the following, if true and known by the Bayside members, would best help explain the results of the study?
With private sailboats, both the costs and the benefits of avoiding any repairs fall to the individual owner.
For boats that are used by many different people, it is difficult to attribute the costs of maintenance and repair to the wear and tear caused by any individual user.
Routine inspections and repairs of recreation league sailboats are conducted during the winter months, not during the May – September sailing season.
If one Bayside member causes even minor damage to a sailboat without paying for the repair, other members will do so even more, and the costs to each user will outweigh the benefits.
There are many more private sailboats than cooperatively-owned sailboats.
Manager
Joined: 14 Jun 2011
Posts: 85
Followers: 2
Kudos [?]: 31 [0], given: 15
Re: Smith argued that recreational equipment owned in common by [#permalink]
### Show Tags
31 Aug 2013, 00:11
Reopening the question for further discussion. I am confused between option C and D.
Smith argued that recreational equipment owned in common by community members would always be used less carefully than would private recreational equipment. Each member would have an incentive to overuse the equipment and leave any damage unreported because the benefit would accrue to the individual, while the costs of maintaining, repairing, and replacing the equipment would be spread among all users. But a study comparing 200 sailboats owned cooperatively by the Bayside Recreation League and 370 sailboats owned privately showed that the recreation league sailboats were in better condition.
Which of the following, if true and known by the Bayside members, would best help explain the results of the study?
With private sailboats, both the costs and the benefits of avoiding any repairs fall to the individual owner.
For boats that are used by many different people, it is difficult to attribute the costs of maintenance and repair to the wear and tear caused by any individual user.
Routine inspections and repairs of recreation league sailboats are conducted during the winter months, not during the May – September sailing season.
If one Bayside member causes even minor damage to a sailboat without paying for the repair, other members will do so even more, and the costs to each user will outweigh the benefits.
There are many more private sailboats than cooperatively-owned sailboats.
_________________
Kudos always encourages me
Manager
Status: Persevering
Joined: 15 May 2013
Posts: 225
Location: India
GMAT Date: 08-02-2013
GPA: 3.7
WE: Consulting (Consulting)
Followers: 1
Kudos [?]: 80 [0], given: 34
Re: Smith argued that recreational equipment owned in common by [#permalink]
### Show Tags
31 Aug 2013, 08:27
swati007 wrote:
Reopening the question for further discussion. I am confused between option C and D.
Smith argued that recreational equipment owned in common by community members would always be used less carefully than would private recreational equipment. Each member would have an incentive to overuse the equipment and leave any damage unreported because the benefit would accrue to the individual, while the costs of maintaining, repairing, and replacing the equipment would be spread among all users. But a study comparing 200 sailboats owned cooperatively by the Bayside Recreation League and 370 sailboats owned privately showed that the recreation league sailboats were in better condition.
Which of the following, if true and known by the Bayside members, would best help explain the results of the study?
With private sailboats, both the costs and the benefits of avoiding any repairs fall to the individual owner.
For boats that are used by many different people, it is difficult to attribute the costs of maintenance and repair to the wear and tear caused by any individual user.
Routine inspections and repairs of recreation league sailboats are conducted during the winter months, not during the May – September sailing season.
If one Bayside member causes even minor damage to a sailboat without paying for the repair, other members will do so even more, and the costs to each user will outweigh the benefits.
There are many more private sailboats than cooperatively-owned sailboats.
This is solved largely by POE.
It cannot be c because the time period of repairs is irrelevant here.
Option d however, is correct because it explains why other members would cause less damage as it is in their best interest. Hence, sailboat owned by Bayside recreation league are in better shape.
_________________
--It's one thing to get defeated, but another to accept it.
Manager
Joined: 20 Jul 2012
Posts: 174
Location: India
WE: Information Technology (Computer Software)
Followers: 1
Kudos [?]: 23 [0], given: 559
Re: Smith argued that recreational equipment owned in common by [#permalink]
### Show Tags
01 Sep 2013, 12:10
bschool83 wrote:
Smith argued that recreational equipment owned in common by community members would always be used less carefully than would private recreational equipment. Each member would have an incentive to overuse the equipment and leave any damage unreported because the benefit would accrue to the individual, while the costs of maintaining, repairing, and replacing the equipment would be spread among all users. But a study comparing 200 sailboats owned cooperatively by the Bayside Recreation League and 370 sailboats owned privately showed that the recreation league sailboats were in better condition.
Which of the following, if true and known by the Bayside members, would best help explain the results of the study?
With private sailboats, both the costs and the benefits of avoiding any repairs fall to the individual owner.
For boats that are used by many different people, it is difficult to attribute the costs of maintenance and repair to the wear and tear caused by any individual user.
Routine inspections and repairs of recreation league sailboats are conducted during the winter months, not during the May – September sailing season.
If one Bayside member causes even minor damage to a sailboat without paying for the repair, other members will do so even more, and the costs to each user will outweigh the benefits.
There are many more private sailboats than cooperatively-owned sailboats.
IMO (d)
(a)Incorrect
(b)Incorrect-cost can be spread among all the users as mentioned for recreatonal equipment..opposing the argument
(c)out of scope-Incorrect
(d)Correct-If even a small damage is done to the recreation league boats and the user doesnt pay the cost of it...others will repeat it and the maintenance cost will increase drastically...and each user will be charged a hefty amount of money...to avoid paying such large amount of money each person will use it carefully... so they are in better condition.
(e)Incorrect-Doesn't explain why recreational boats are in better condition to privately owned boats...
Hope it helps..
_________________
Preparing for another shot...
GMAT Club Legend
Joined: 01 Oct 2013
Posts: 9277
Followers: 805
Kudos [?]: 165 [0], given: 0
Re: Smith argued that recreational equipment owned in common by [#permalink]
### Show Tags
16 Sep 2014, 11:13
Hello from the GMAT Club VerbalBot!
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: Smith argued that recreational equipment owned in common by [#permalink] 16 Sep 2014, 11:13
Similar topics Replies Last post
Similar
Topics:
1 Consumers planning to buy recreational equipment 5 01 Jul 2015, 13:05
2 Smith argued that recreational equipment owned in common 2 01 Aug 2014, 19:09
Consumers planning to buy recreational equipment tend to buy 12 29 Oct 2007, 02:41
Consumers planning to buy recreational equipment tend to buy 3 29 Sep 2007, 22:48
Consumers planning to buy recreational equipment tend to buy 15 14 Dec 2006, 22:01
Display posts from previous: Sort by
# Smith argued that recreational equipment owned in common by
new topic post reply Question banks Downloads My Bookmarks Reviews Important topics
Powered by phpBB © phpBB Group and phpBB SEO 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®. | 3,408 | 14,880 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.609375 | 3 | CC-MAIN-2016-36 | longest | en | 0.951564 |
https://www.numbersaplenty.com/10303 | 1,713,055,879,000,000,000 | text/html | crawl-data/CC-MAIN-2024-18/segments/1712296816863.40/warc/CC-MAIN-20240414002233-20240414032233-00891.warc.gz | 866,029,946 | 3,116 | Search a number
10303 is a prime number
BaseRepresentation
bin10100000111111
3112010121
42200333
5312203
6115411
742016
oct24077
915117
1010303
117817
125b67
1348c7
143a7d
1530bd
hex283f
10303 has 2 divisors, whose sum is σ = 10304. Its totient is φ = 10302.
The previous prime is 10301. The next prime is 10313. The reversal of 10303 is 30301.
It is a happy number.
It is a weak prime.
It is a cyclic number.
It is not a de Polignac number, because 10303 - 21 = 10301 is a prime.
Together with 10301, it forms a pair of twin primes.
It is an alternating number because its digits alternate between odd and even.
It is the 102-nd Hogben number.
10303 is a modest number, since divided by 303 gives 1 as remainder.
It is a zygodrome in base 4.
It is a congruent number.
It is not a weakly prime, because it can be changed into another prime (10301) by changing a digit.
It is a nontrivial repunit in base 101.
It is a polite number, since it can be written as a sum of consecutive naturals, namely, 5151 + 5152.
It is an arithmetic number, because the mean of its divisors is an integer number (5152).
210303 is an apocalyptic number.
10303 is a deficient number, since it is larger than the sum of its proper divisors (1).
10303 is an equidigital number, since it uses as much as digits as its factorization.
10303 is an evil number, because the sum of its binary digits is even.
The product of its (nonzero) digits is 9, while the sum is 7.
The square root of 10303 is about 101.5036945140. The cubic root of 10303 is about 21.7597833294.
Adding to 10303 its reverse (30301), we get a palindrome (40604).
It can be divided in two parts, 10 and 303, that added together give a palindrome (313).
The spelling of 10303 in words is "ten thousand, three hundred three", and thus it is an iban number. | 529 | 1,821 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.703125 | 4 | CC-MAIN-2024-18 | latest | en | 0.910989 |
https://www.coursehero.com/tutors-problems/Math/7026895-The-height-of-one-square-pyramid-is-12-m-A-similar-pyramid-has-a-heig/ | 1,495,534,843,000,000,000 | text/html | crawl-data/CC-MAIN-2017-22/segments/1495463607593.1/warc/CC-MAIN-20170523083809-20170523103809-00187.warc.gz | 870,329,069 | 19,025 | View the step-by-step solution to:
# The height of one square pyramid is 12 m. A similar pyramid has a height of 6 m. The volume of the larger pyramid is 400 m3. Determine each of the...
The height of one square pyramid is 12 m. A similar pyramid has a height of 6 m. The volume of the larger pyramid is 400 m3. Determine each of the following, showing all your work and reasoning:
## This question was asked on Apr 16, 2011.
### Why Join Course Hero?
Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors and customizable flashcards—available anywhere, anytime.
### -
Educational Resources
• ### -
Study Documents
Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access or to earn money with our Marketplace.
Browse Documents | 201 | 904 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.609375 | 3 | CC-MAIN-2017-22 | longest | en | 0.897104 |
https://www.calculus-online.com/exercise/3924 | 1,679,456,741,000,000,000 | text/html | crawl-data/CC-MAIN-2023-14/segments/1679296943749.68/warc/CC-MAIN-20230322020215-20230322050215-00562.warc.gz | 764,508,322 | 56,561 | # Calculating Mass Using Double Integral – Exercise 3924
Exercise
Calculate the mass of a membrane
$$D=\{(x,y)|y\leq 1, y\geq x^2 \}$$
If the membrane density is
$$y=f(x,y)$$
$$m=\frac{4}{5}$$ | 72 | 198 | {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 3, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.5625 | 3 | CC-MAIN-2023-14 | longest | en | 0.47607 |
https://www.quanswer.com/en/introduction-to-complex-numbers | 1,708,794,059,000,000,000 | text/html | crawl-data/CC-MAIN-2024-10/segments/1707947474541.96/warc/CC-MAIN-20240224144416-20240224174416-00887.warc.gz | 958,110,677 | 14,182 | > #mathematics , #complex-numbers > Introduction to complex numbers?
###### Kabugho Gorret
more than 1 week ago
# Introduction to complex numbers?
Complex number
2 views
Sort By
ChatGPT
more than 1 week ago
Complex numbers are numbers that can be expressed in the form a + bi, where a and b are real numbers, and i is the imaginary unit, defined as the square root of -1. The real part of the complex number is represented by a, and the imaginary part is represented by bi.
Complex numbers were introduced to mathematics to solve equations that could not be solved using only real numbers. They provide a way to represent and manipulate quantities that involve both real and imaginary components.
In the complex number system, addition, subtraction, multiplication, and division can all be performed. Addition and subtraction are done by adding or subtracting the real and imaginary parts separately. Multiplication is done by using the distributive property and the fact that i^2 = -1. Division is done by multiplying the numerator and denominator by the conjugate of the denominator, which is obtained by changing the sign of the imaginary part.
Complex numbers also have a geometric interpretation. They can be represented as points on a complex plane, where the real part corresponds to the x-coordinate and the imaginary part corresponds to the y-coordinate. The distance from the origin to the point represents the magnitude of the complex number, and the angle between the positive x-axis and the line connecting the origin and the point represents the argument of the complex number.
Complex numbers have many applications in various fields of mathematics and science, including electrical engineering, physics, and signal processing. They are used to represent alternating currents, analyze oscillatory systems, and solve differential equations, among other things.
In summary, complex numbers are numbers that combine real and imaginary components. They provide a way to solve equations that involve both real and imaginary quantities and have applications in various fields of mathematics and science.
0
Horse trainer, Event organizer, Tour guide, Advertising organizer, Economist
Software engineer, Consultant
× | 424 | 2,231 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.734375 | 4 | CC-MAIN-2024-10 | latest | en | 0.942559 |
http://www.britgo.org/bgj/06410 | 1,508,325,666,000,000,000 | text/html | crawl-data/CC-MAIN-2017-43/segments/1508187822930.13/warc/CC-MAIN-20171018104813-20171018124813-00405.warc.gz | 418,463,642 | 5,577 | ## A Proverb Revised
British Go Journal No. 64. March 1985. Page 10.
### The Answers
Francis Roads
Francis Roads explains the problems on the previous page (please solve them yourself first).
#### Problem 1:
Diagram 7
Positions in which Black does not gain a great advantage by playing at A in Dia 7, and preventing White from doing so, are very rare.
#### Problem 2:
Diagram 8
The extension to B in Dia 8 is always a good move when Black has made the high fourth line shimari (enclosure) as shown. When at the same time it prevents White from making his ideal extension to the same point, as here, it is doubly valuable.
In a minority of cases C is the better move. Both B and C are still excellent moves is one or both players have made a low shimari, eg if the marked black stone were at D or E instead.
#### Problem 3:
Diagram 9
This is the well known "crane's nest". Black can capture three white stones, thus connecting all his own together, if he is prepared to sacrifice a stone at F in Dia 9. The rest of the sequence is left for you to work out!
#### Problem 4:
Diagram 10 Diagram 11
If your answer was I in Dia 10, you were hoodwinked. White can kill you with the hane at K, followed by J if you defend at L. Black can now capture both J and K, but not in such a way as to make two eyes.
The only way to live is with J in Dia 10. Dia 11 shows the worst White can do, leading to a seki (stalemate) after White 5. But as he has to give up sente to take just five points of territory from Black, and as Black 2 and 4 may help to reduce some outside white territory, this is very much an endgame sequence.
Incidentally, this position is discussed in Chapter 9 of "Life and Death" by James Davies. All you people who waste your time trying to memorise joseki would do far better to memorise as much of that book as you can.
#### Problem 5:
Diagram 12
By now you will have spotted that the theme of this article is symmetry. All the solutions so far have beem examples of the Go proverb "If the formation is symmetrical, play in the centre" ( see "Go Proverbs Illustrated" by Kensaku Segoe, p50).
You may therefore have chosen M or N in Dia 12 as your solution. If you did you were hoodwinked again. This position is the odd one out. By playing asymmetrically at O or P, Black easily links his two eyes together and all his stones are alive.
If he starts at M, White sacrifices a stone at O. Black can then save only one half of his group with the sequence Q, P, N, R. If he starts at N, he can again save half, or fight a ko for the whole group after white Q, black O, white R, black P, White takes ko at M.
#### Problem 6:
Diagram 13
This is the famous classical problem from "Iwami Jutaro's prison break". Mr Jutaro escapes with the symmetrical move S in Dia 13. The rest is left to your investigation.
A broader discussion begins overleaf.
This article is from the British Go Journal Issue 64
which is one of a series of back issues now available on the web.
Last updated Thu May 04 2017. If you have any comments, please email the webmaster on web-master AT britgo DOT org. | 775 | 3,119 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.375 | 3 | CC-MAIN-2017-43 | longest | en | 0.96662 |
https://www.flowless.eu/story-points/ | 1,642,532,707,000,000,000 | text/html | crawl-data/CC-MAIN-2022-05/segments/1642320300997.67/warc/CC-MAIN-20220118182855-20220118212855-00645.warc.gz | 719,293,503 | 8,094 | # Story Points
Have you ever heard the term “story points”? Well, it is simply a subjective tool used to measure a feature’s size in relation to other features. In addition, this arbitrary measure is commonly used by Scrum teams to identify the points where the feature has its complexity. This is composed of numbers that ranges from 1, 2, 4, 8, 16, or extra small, small, medium, large and extra-large that is used in the estimation of the project’s features. Thus, the most commonly used series in here is the Fibonacci sequence ( 1,2,3,5,8,3,21,34,45).
Moreover, the main importance of story points is that it enables various team to communicate about a certain level or degree on an estimate. This is very much essential for it avoids the conflict that may arise because two opposing programmers have different skills and way of thinking. It actually serves as a unifying mechanism that makes two exactly different estimation of programmers jive and agree with one another.
Since there’s a lot of issues involved in the conventional techniques of having an estimation, still, a lot of team members are trying their best to give an immediate yet accurate estimate in all their projects. For example, in the work field, stakeholders will definitely ask you to deliver your finished projects or even an outline of it with agility for they also need to meet a deadline of the reports of the development of the project. So, to provide a quick solution on this matter, the team discovered a new technique of providing immediate and accurate estimate that will absolutely help you make a right and agile estimate about the detailed features of the project.
Using story point is truly effective for it will not require you to spend long hours just to analyze and make an estimate on the features. Even though you don’t have a wide array of information to estimate the time in creating the framework, still, you can quickly compare the sizes of one feature to another, the same thing goes in estimating the buildings. You can also compare its sizes towards the others for you to make an estimate on how many days will it take for the workers and developers to construct it. The sizes of the building itself can be converted to number through the use of an estimation scale, and here is where the Fibonacci scale works. It provides enough separation between the numbers for the team to avoid confusion over slight differences among the estimates. Thus, through this, the team can easily come up with more precise and accurate estimates.
Using a story point is really different from those classic estimation technique for while they examine and analyze the major word tasks to make an estimate, with SP, the team does not need to examine the task but rather, they only need to compare the sizes and complexity of the project features. Thus, for the team to provide a correct estimate, they use a planning poker wherein a customer or a product owner leads a discussion of the feature, and after that, a question and answer portion is conducted. After the conversation is completed, all the members can hold up the index with their estimates now. If everyone voted for same number, then it’s done. The estimate is already official and recorded. That’s how story points works.
— Slimane Zouggari | 659 | 3,288 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.78125 | 3 | CC-MAIN-2022-05 | latest | en | 0.954195 |
https://rrtutors.com/dart_factorial | 1,726,818,147,000,000,000 | text/html | crawl-data/CC-MAIN-2024-38/segments/1725700652138.47/warc/CC-MAIN-20240920054402-20240920084402-00512.warc.gz | 452,653,216 | 12,660 | The factorial of a number is the product of all the integers from 1 to that number.
For example, the factorial of 5 (denoted as 6!) is
1*2*3*4*5 = 120.
Factorial is not defined for negative numbers and the factorial of zero is one, 0! = 1
Factorial Example with Dart For Loop
```void main() { var num = 5; var factorial = 1; for( var i = num ; i >= 1; i-- ) { factorial *= i ; } print(factorial); }```
Output
120 | 142 | 420 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.171875 | 3 | CC-MAIN-2024-38 | latest | en | 0.635746 |
https://www.omegaxyz.com/2019/05/19/dfs-example-graph-cpp/ | 1,618,367,402,000,000,000 | text/html | crawl-data/CC-MAIN-2021-17/segments/1618038076454.41/warc/CC-MAIN-20210414004149-20210414034149-00211.warc.gz | 1,051,986,510 | 51,466 | DFS图遍历经典例题C++实现
(1)访问顶点v;
(2)依次从v的未被访问的邻接点出发,对图进行深度优先遍历;直至图中和v有路径相通的顶点都被访问;
(3)若此时图中尚有顶点未被访问,则从一个未被访问的顶点出发,重新进行深度优先遍历,直到图中所有顶点均被访问过为止。当然,当人们刚刚掌握深度优先搜索的时候常常用它来走迷宫。
例1 Oil Deposits
Problem Description
The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and creates a grid that divides the land into numerous square plots. It then analyzes each plot separately, using sensing equipment to determine whether or not the plot contains oil. A plot containing oil is called a pocket. If two pockets are adjacent, then they are part of the same oil deposit. Oil deposits can be quite large and may contain numerous pockets. Your job is to determine how many different oil deposits are contained in a grid.
Input
The input file contains one or more grids. Each grid begins with a line containing m and n, the number of rows and columns in the grid, separated by a single space. If m = 0 it signals the end of the input; otherwise 1 <= m <= 100 and 1 <= n <= 100. Following this are m lines of n characters each (not counting the end-of-line characters). Each character corresponds to one plot, and is either `*', representing the absence of oil, or `@’, representing an oil pocket.
Output
For each grid, output the number of distinct oil deposits. Two different pockets are part of the same oil deposit if they are adjacent horizontally, vertically, or diagonally. An oil deposit will not contain more than 100 pockets.
Sample Input
1 1
*
3 5
*@*@*
**@**
*@*@*
1 8
@@****@*
5 5
****@
*@@*@
*@**@
@@@*@
@@**@
0 0
Sample Output
• 0
• 1
• 2
• 2
C++代码
例2 Temple of the bone
Problem Description
The doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, and the doggie could feel the ground sinking. He realized that the bone was a trap, and he tried desperately to get out of this maze.
The maze was a rectangle with sizes N by M. There was a door in the maze. At the beginning, the door was closed and it would open at the T-th second for a short period of time (less than 1 second). Therefore the doggie had to arrive at the door on exactly the T-th second. In every second, he could move one block to one of the upper, lower, left and right neighboring blocks. Once he entered a block, the ground of this block would start to sink and disappear in the next second. He could not stay at one block for more than one second, nor could he move into a visited block. Can the poor doggie survive? Please help him.
Input
The input consists of multiple test cases. The first line of each test case contains three integers N, M, and T (1 < N, M < 7; 0 < T < 50), which denote the sizes of the maze and the time at which the door will open, respectively. The next N lines give the maze layout, with each line containing M characters. A character is one of the following:
‘X’: a block of wall, which the doggie cannot enter;
‘S’: the start point of the doggie;
‘D’: the Door; or
‘.’: an empty block.
The input is terminated with three 0’s. This test case is not to be processed.
Output
For each test case, print in one line “YES” if the doggie can survive, or “NO” otherwise.
Sample Input
4 4 5
S.X.
..X.
..XD
….
3 4 5
S.X.
..X.
…D
0 0 0
Sample Output
• NO
• YES
C++代码 | 943 | 3,348 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.6875 | 3 | CC-MAIN-2021-17 | longest | en | 0.890977 |
https://www.coursehero.com/file/5911664/4BernoulliTrials/ | 1,498,551,491,000,000,000 | text/html | crawl-data/CC-MAIN-2017-26/segments/1498128321025.86/warc/CC-MAIN-20170627064714-20170627084714-00576.warc.gz | 841,085,190 | 23,777 | 4BernoulliTrials
4BernoulliTrials - Click to edit Master subtitle style EE...
This preview shows pages 1–5. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview. Sign up to access the rest of the document.
Unformatted text preview: Click to edit Master subtitle style EE 3180 Probability and Bernoulli Trials Jeffrey B. Burl EE 3180 Probability and 11 EE 3180 Probability and Bernoulli Trials n A Bernoulli experiment is a random experiment with two outcomes: n Flipping a coin. n A 1 or 0 in a digital communication system. n A sequence of Bernoulli trials occurs when a Bernoulli experiment is performed a number of independent EE 3180 Probability and 22 EE 3180 Probability and Probability of a Specific Outcome n Consider a specific experiment: n Roll a fair dice 4 times. n Compute the probability of getting exactly 1 six in this experiment. n p=Pr(6) in one trial is 1/6. n q=1-p=Pr(not 6) in one trial is 5/6. EE 3180 Probability and 33 5 5 1 5 (6, 6,6, 6) 6 6 6 6 P qqpq = = EE 3180 Probability and Count How Many Times the Outcome Occurs n How many different ways can we get exactly one 6 is 4:...
View Full Document
This note was uploaded on 06/16/2010 for the course EE ee3180 taught by Professor Burl during the Spring '10 term at Michigan Technological University.
Page1 / 12
4BernoulliTrials - Click to edit Master subtitle style EE...
This preview shows document pages 1 - 5. Sign up to view the full document.
View Full Document
Ask a homework question - tutors are online | 440 | 1,717 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.28125 | 3 | CC-MAIN-2017-26 | longest | en | 0.862938 |
https://investingjdwf.web.app/larason10774cefy/how-do-we-calculate-annual-growth-rate-ku.html | 1,638,602,819,000,000,000 | text/html | crawl-data/CC-MAIN-2021-49/segments/1637964362952.24/warc/CC-MAIN-20211204063651-20211204093651-00318.warc.gz | 370,991,050 | 6,352 | ## How do we calculate annual growth rate
Determining the growth rate over a one-year period is straightforward; you simply take the sales difference, divide it by the starting revenue total, and multiply the result by 100. The annual growth rate of real Gross Domestic Product (GDP) is the broadest indicator of economic activity -- and the most closely watched. Learn how it's presented in official releases and how to Annual Growth Rate is about the amount of growth that any firm is witnessing. If you want to know how you can calculate annual percentage growth rate, then this article will help you to do that using a simple formula.
11 Sep 2018 The formula for calculating CAGR requires a period of time longer than one year. CAGR is similar to viewing a moving average on a stock chart. A 24 Aug 2015 For the period from 2011 to 2015, we can calculate all three – growth rate, average annual growth and CAGR. Let us do each of this. Growth 11 Nov 2016 in the period. The series discusses these methods: average annual growth rate ( AAGR); straight-line growth rate (i.e. % change of final and 20 May 2016 You can think about this in a slightly different way. Say we want to turn out yearly formula into a daily formula. Well, as before we know that 365 29 Oct 2017 When looking at growth rate of populations, calculating it in proportion to the actual The complete formula for annual per capita growth rate is:.
## Instantly calculate the compound annual growth rate (Excel RRI function) of an investment and see the step by step process used to solve the CAGR formula.
Calculate the Revenue Growth Rate by subtracting the first month revenue from Businesses with less than \$2 million in annual revenue generally have much 30 Jul 2019 One way to tell is to calculate your sales growth. Not sure which Sales growth is the percent growth in the net sales of a business from one fiscal period to another. The business had an annual sales growth of 6.2 percent. 10 May 2019 How to Calculate CAGR. To calculate compound annual growth rate, you would use the following formula: CAGR = ((EA / SA) ^ (1/Y)) Growth rate formula is used to calculate the annual growth of the company for the particular period and according to which value at the beginning is subtracted | 501 | 2,276 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.9375 | 4 | CC-MAIN-2021-49 | latest | en | 0.939982 |
http://forums.trossenrobotics.com/tutorials/index.php?s=48a5eeddef62d288703051551c3c7778 | 1,596,542,087,000,000,000 | text/html | crawl-data/CC-MAIN-2020-34/segments/1596439735867.93/warc/CC-MAIN-20200804102630-20200804132630-00045.warc.gz | 43,124,963 | 8,527 | ## Tutorial Search
Delta robot kinematics
How can i use this code to generate the workspace of delta robot?I tried plotting the workspace...
by mouradsme on 05-03-2017 05:24 PM
Delta robot kinematics
Can someone tell me how a1, a2, b1, b2 and d were found?I think there are some operations on...
by mouradsme on 04-27-2017 07:44 PM
Delta robot kinematics
into the inverse kinematics, what is the ""?"" doing: "theta = 180.0*atan(-zj/(y1 - yj))/pi +...
by Santiago on 12-05-2016 08:53 PM
Delta robot kinematics
I think I have found an error: In J'3 the x3 value should be with minus, beacuse for the same...
by Gordon51 on 12-04-2016 09:19 AM
Delta robot kinematics
how the way I review how to simulate the delta robot in Matlab ?
by adysetyo on 12-01-2016 02:25 AM
1. ## How To, DIY
• Tutorials: 47
• Posts: 189
How I make Carbon...
by rebel 03-29-2012 06:09 PM
2. ## Introduction
• Tutorials: 36
• Posts: 155
by Nishi 01-20-2010 12:13 PM
3. ## Build Articles
• Tutorials: 9
• Posts: 50
Build an...
by Slugman 02-16-2012 07:46 PM
4. ## Product Feature, Demos
• Tutorials: 2
• Posts: 3
Two Demos of the...
by Matt 08-22-2008 11:49 AM
5. ## Mod, Hack
• Tutorials: 4
• Posts: 18
by mannyr7 06-27-2009 08:00 PM
6. ## Published Product Reviews
For finished product reviews. Tutorials entered here will be live and show up on various areas of the TRC Community. If you have a tutorial in progress, please start it in the TRC Tutorial Drafts.
• Tutorials: 3
• Posts: 60
Crabfu's Review of...
by crabfu 03-01-2009 12:19 PM
Category Contains New Tutorials
Category Contains No New Tutorials
## Random Entries
1.
### Fabricate humanoid hands
Category: How To, DIY
• Views: 50,106
• Replies: 11
05-18-2008 05:18 PM
by Droid Works
2.
### Programming In MAX/MSP
Category: How To, DIY
• Views: 35,459
• Replies: 6
06-03-2008 12:41 AM
by darkback2
3.
Category: How To, DIY
• Views: 19,470
• Replies: 0
04-02-2011 11:23 AM
by lnxfergy
4.
### PC Based Robot Demo
Category: Introduction
• Views: 30,650
• Replies: 1
08-22-2008 11:42 AM
by Matt
5.
### Robotic Arms
Category: Introduction
• Views: 32,821
• Replies: 0
07-02-2009 02:01 AM
by darkback2
Categories: 6, Tutorials: 101, Posts: 475, Total Views: 29,785,042 | 784 | 2,228 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.53125 | 3 | CC-MAIN-2020-34 | latest | en | 0.743694 |
http://www.mhsmath.com/math-problem-solving/graphing-lines/9th-grade-math-worksheets.html | 1,511,408,227,000,000,000 | text/html | crawl-data/CC-MAIN-2017-47/segments/1510934806720.32/warc/CC-MAIN-20171123031247-20171123051247-00620.warc.gz | 439,606,570 | 12,364 | Try the Free Math Solver or Scroll down to Tutorials!
Depdendent Variable
Number of equations to solve: 23456789
Equ. #1:
Equ. #2:
Equ. #3:
Equ. #4:
Equ. #5:
Equ. #6:
Equ. #7:
Equ. #8:
Equ. #9:
Solve for:
Dependent Variable
Number of inequalities to solve: 23456789
Ineq. #1:
Ineq. #2:
Ineq. #3:
Ineq. #4:
Ineq. #5:
Ineq. #6:
Ineq. #7:
Ineq. #8:
Ineq. #9:
Solve for:
Please use this form if you would like to have this math solver on your website, free of charge. Name: Email: Your Website: Msg:
### Our users:
This algebra software has an exceptional ability to accommodate individual users. While offering help with algebra homework, it also forces the student to learn basic math. The algebra tutor part of the software provides easy to understand explanations for every step of algebra problem solution.
A.R., Arkansas
I was really struggling with algebra equations. I am embarrassed to say, but the fact is, I am not good in math. Therefore, I constantly need assistance. Then I came across this software 'Algebrator'. And ,vow !! It has changed my life. I am no more dependent on anyone except on this little piece of software.
Samantha Jordan, NV
My 12-year-old son, Jay has been using the program for a few months now. His fraction skills are getting better by the day. Thanks so much!
P.W., Illinois
### Students struggling with all kinds of algebra problems find out that our software is a life-saver. Here are the search phrases that today's searchers used to find our site. Can you find yours among them?
#### Search phrases used on 2012-02-03:
• math question decimal bar on top
• i have who has two step equations
• solve an equation with a radical denominator
• different between whileloop and for loop in c +ppt
• c# fraction notation
• how to graph hyperbolas on ti 84 plus
• multiply and simplify by factoring 15^one and a half * 35^ one and a half
• middle school math with pizzazz d answer key
• find the value of n in an equation printable
• alphabetic subscripts in algebrator
• simplify fractions using least common factor calculator
• sistemas lineales +algebralineal
• graphing inequalities
• In stormy conditions, a delivery truck can travel a route in 14 hour. In good weather, the same trip can be made in 10.5 hour because the truck travels 15km/hour faster. Find the speed of the truck in stormy weather and in good weather.
• online ti 85
• online graphing calculator with table
• complex fraction program ti84
• complex numbers poem
• inequalities with fractions formula
• how do i graph systems of nonlinear inequalitirs
• kuta software graphing lines infinite algebra 1
• Help Me Solve Rational Expressions
• Can one use the Algebrator software for statistics?
• a percent circle template
• finding cubed root worksheet
• box and diamond algebra
• +divisibility lattice
• pre algebra with pizzazz 189 definitions
• adding aND subtracting rational expression calculator
• solve each polynomial equation by factoring exercises 6-5 answers workbook page 442
• division equations
• solving equations by multiplying and dividing worksheet
• solving equation review key sheet
• cbe physics formula sheet
• simple linear equations worksheets
• Graphing Inequalities Worksheets 2 Variables
• prentice hall mathematics geometry answers
• facotr machine
• basic algebra mcqs solved
• Step by Step Intergration
• estimation of whole numbers, decimals, and percents
• improper integral calculator
• gcse algebra multi-step equations
• decide if you would add subtract multiply or divide worksheet
• help solve regression equations
• square of a negative chart
• examples of matrix calculations with 3 variables worksheet
• 15/40-x=1/5
• examples of evaluating exponential expressions
• extracting square roots quadratic equation
• combining like terms worksheet
• free inequality worksheets
• calculating velocity PRACTICE PROBLEMS
• find the quotient and enter your answer in descending order below 5x^5-5x^3
• prentice hall algebra 2 with trigonometry answer key
• foil math method using negatives
• basic formula for hyperbola
• identifying scale factor calculator
• "real life square root problem"
• "rational expressions applications".
• 17
• show me how to solve formulas for litril equations formulas
• cubing Binomial Problems
• how to solve i^43
• algebra cubed trick
• ALGEBRATOR
• print off math template
• can algebrator be used for differential equations?
• multiple choice test in common monomial factor
• McDougal Little mathmaticsconcepts and skills
• free tutorials for beginning algebra word problems
• beginners algebra
• IF8769 Algebra 2 answer key
• prentice algebra workbook answers 1-4 practice
• math covers
• glencoe algebra 2 answer key
• free math tutoring sites for interval notation
Prev Next | 1,154 | 4,797 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.53125 | 3 | CC-MAIN-2017-47 | latest | en | 0.912452 |
https://geetcode.com/problems/fraction-addition-and-subtraction/ | 1,639,032,463,000,000,000 | text/html | crawl-data/CC-MAIN-2021-49/segments/1637964363689.56/warc/CC-MAIN-20211209061259-20211209091259-00160.warc.gz | 336,562,118 | 8,662 | # GeetCode Hub
Given a string `expression` representing an expression of fraction addition and subtraction, return the calculation result in string format.
The final result should be an irreducible fraction. If your final result is an integer, say `2`, you need to change it to the format of a fraction that has a denominator `1`. So in this case, `2` should be converted to `2/1`.
Example 1:
```Input: expression = "-1/2+1/2"
Output: "0/1"
```
Example 2:
```Input: expression = "-1/2+1/2+1/3"
Output: "1/3"
```
Example 3:
```Input: expression = "1/3-1/2"
Output: "-1/6"
```
Example 4:
```Input: expression = "5/3+1/3"
Output: "2/1"
```
Constraints:
• The input string only contains `'0'` to `'9'`, `'/'`, `'+'` and `'-'`. So does the output.
• Each fraction (input and output) has the format `±numerator/denominator`. If the first input fraction or the output is positive, then `'+'` will be omitted.
• The input only contains valid irreducible fractions, where the numerator and denominator of each fraction will always be in the range `[1, 10]`. If the denominator is `1`, it means this fraction is actually an integer in a fraction format defined above.
• The number of given fractions will be in the range `[1, 10]`.
• The numerator and denominator of the final result are guaranteed to be valid and in the range of 32-bit int.
class Solution { public String fractionAddition(String expression) { } }
Medium | 378 | 1,425 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.34375 | 3 | CC-MAIN-2021-49 | latest | en | 0.741219 |
http://www.jiskha.com/members/profile/posts.cgi?name=THOMAS&page=10 | 1,386,325,149,000,000,000 | text/html | crawl-data/CC-MAIN-2013-48/segments/1386163051244/warc/CC-MAIN-20131204131731-00024-ip-10-33-133-15.ec2.internal.warc.gz | 391,221,750 | 3,097 | Friday
December 6, 2013
# Posts by THOMAS
Total # Posts: 332
Calculus
Mr. Cook was painting Arvada West High School, standing on top of a 25]foot ladder. Why? We will never know. However, he was horrified to find the ladder being pulled away by the same notorious student that threw a snowball at Mrs. Evans. The base of the ladder was movin...
Calculus
Mr. Cook was painting Arvada West High School, standing on top of a 25]foot ladder. Why? We will never know. However, he was horrified to find the ladder being pulled away by the same notorious student that threw a snowball at Mrs. Evans. The base of the ladder was movin...
Suppose you have 168 meters of fencing with which to make two side-by-side rectangular enclosures against an existing wall. If the rectangular enclosures are adjacent and of the same depth, what is the maximum are that can be enclosed?
Chemistry
convert 548mL to cm3
Mathematics
If (a+b)squared = 361 and ab =-120, calculate the value of a squared + b squared
Mathematics
6+m/3=18 What does m equal.
Introduction to Psychology
I was right is was D.
Introduction to Psychology
Kevin and Cheryl has completed their first day of naturalistic obeservation of adolesents at the local hligh school. As they discussed their experiences during the day, they found that they were both concerned about the difference their presence in the classrooms made on adole...
Pre-Calc
If someone could explain how to set up the TI-84 P;lus to graph polar coordinates (3,15degrees) then I'll use that as an example. I know it has to be in degrees and then the y= appears but what then?? Thank you
Pre-Calc
Can someone explain how to graph polar coordinates on a TI-84 Plus calculator-I can't find the directions anywhere Thank you
Pages: <<Prev | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | Next>>
Search
Members | 478 | 1,860 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.40625 | 3 | CC-MAIN-2013-48 | latest | en | 0.970621 |
https://sbseminar.wordpress.com/2008/09/18/group-rings-arrr-commutative/ | 1,500,986,693,000,000,000 | text/html | crawl-data/CC-MAIN-2017-30/segments/1500549425193.20/warc/CC-MAIN-20170725122451-20170725142451-00093.warc.gz | 683,261,958 | 44,043 | # Group rings arrr commutative
If you are familiar with group rings, you might think that the title of this post is false. If G is a nonabelian group, multiplying the basis elements g and h in $\mathbb{Z}G$ can yield $gh \neq hg$, so we have a problem. In general, if you have a problem that you can’t solve, you should cheat and change it to a solvable one (According to my advisor, this strategy is due to Alexander the Great). Today, we will change the definition of commutative to make things work.
Given a group G, the group ring $\mathbb{Z}G$ is defined to be the free abelian group whose generating basis is given by the elements of G, and with “convolution” multiplication. In coordinates, this means
$(\sum_{g \in G} a_g g)(\sum_{h \in G} b_h h) = \sum_{gh=k} a_g b_h k.$
These sums make sense, because they have finitely many nonzero summands. In general, we can ask for the coefficients to be elements in other rings, like $\mathbb{C}$, and these are still called group rings.
What does it mean for a ring to be commutative? Normally, we would say that for any two elements a and b, we have ab = ba. I’d like to phrase this more categorically, without referring to individual elements. Multiplication in a ring A is given by a map $A \times A \to A$. This is a bilinear operation, in the sense that na*b = a*nb for all integers n, so we can view multiplcation as a linear map $m: A \otimes A \to A$ (Chern apparently liked to say that tensor products replace bilinear maps by linear maps). To say that multiplication is commutative is to say that we have an equality of maps: $m \circ T = m$, where $T: A \otimes A \to A \otimes A$ is the switching map $a \otimes b \mapsto b \otimes a$.
This suggests a relatively easy solution to our problem. If we adjust the map T suitably (e.g. using the identity map), we can make any ring commutative. Unfortunately, in solving our problem, we’ve destroyed any meaningful content in the notion of commutativity. We can salvage some meaning by demanding that T satisfy some natural sounding conditions, such as $T(1 \otimes a) = a \otimes 1$. This conveniently eliminates the identity map from consideration, but we still don’t have any immediate guidance for making a good choice.
I’d like to say that T is more than just a map of abelian groups, i.e., T ought to have some structure that makes it natural in a strong sense. One clue to turning this vague idea into mathematics is the unit compatibility condition I gave above. Since the unit can be viewed as a ring homomorphism $\mathbb{Z} \to A$, we can say that T should produce isomorphisms like $\mathbb{Z} \otimes A \to A \otimes \mathbb{Z}$ in a manner compatible with the unit maps. One possible first attempt to strengthen this is to demand that T produce isomorphisms $B \otimes C \to C \otimes B$ for all abelian groups in a manner compatible with all abelian group homomorphisms.
We can give this a categorical interpretation. Tensor product takes a pair of abelian groups to an abelian group, and transforms maps in a compatible way. This means tensor product is a functor $Ab \times Ab \to Ab$, and since it satisfies some conditions like associativity, we say that Ab is a monoidal category. There is also a switch functor $\tau: Ab \times Ab \to Ab \times Ab$, taking an object (B,C) to (C,B) and also switching homomorphisms. Our demand on T then translates to the assertion that T is a natural isomorphism $\otimes \to \otimes \circ \tau$.
Unfortunately, there are no natural isomorphisms T that make our group ring commutative in this sense, mostly because the category of abelian groups is really well-behaved. Tensor products commute with colimits, and any abelian group is a colimit of some diagram of copies of the integers. Since T is the switch map whenever one of its inputs is a copy of the integers, T is forced to be the usual switch map on all inputs.
Fortunately, we can view the group ring in a different category, namely, it is a G-graded abelian group. The category of G-graded abelian groups admits a monoidal structure via a graded tensor product that puts the tensor product of a degree g group with a degree h group in degree gh. However, if G is nonabelian, there is no longer an obvious switch transformation, which we need to describe commutativity, since the tensor product in the opposite order would place things in a different degree.
We can try to solve this problem in the following way. Recall that the center of a group or a ring is the set of elements that commute with everything else. We could define the center of a monoidal category to be the subcategory of objects for which the tensor product with anything on the left is isomorphic to the tensor product on the right, and hope the group ring fits in somehow. This category looks nice at first, but since we don’t know what the isomorphisms are, we don’t have a good choice of a natural transformation T.
There is a better version, discovered by Drinfeld, and written up by Majid and Joyal-Street. Given a monoidal category C, one can construct a new category Z(C), called the Drinfeld center. Its objects are pairs $(x, \phi)$, where x is an object in C, and $\phi: x \otimes - \to - \otimes x$ is a natural isomorphism called a braiding, satisfying a compatibility condition:
$\phi = (id \otimes \phi) \circ (\phi \otimes id): x \otimes y \otimes z \to y \otimes z \otimes x$
(to be precise, I should have inserted some associators). Z(C) then admits a natural monoidal structure induced by the monoidal structure on C, but it also comes with a canonical transformation T, made out of the isomorphisms $\phi$. With this structure, Z(C) is called a braided monoidal category, and together with the “forget braiding” functor, it is in fact universal with respect to braided monoidal categories with a monoidal functor to C.
Our task is now to find our group ring in some form inside the Drinfeld center of the category of G-graded abelian groups, and hope that it is in some sense commutative. First, we should write down precisely what it means to have a commutative ring in a braided monoidal category. Baez calls these structures r-commutative in his Hochschild homology paper, so if things work out, we could say that group rings are r-commutative.
Given a braided tensor category C, with associator $\Psi$, commutor
T, and unit structures l and r, a commutative ring is an object A equipped
with a multiplication morphism $A \otimes A \to A$ and a unit
morphism $e: 1 \to R$, such that:
• Multiplication with the unit yields the identity: $m \circ (e \otimes id) \circ l^{-1} = id$, and the corresponding statement on the right.
• Multiplication can be dragged across the commutor:
$(m \otimes id) \circ (id \otimes T) \circ (T \otimes id) = T \circ (id \otimes m)$,
and the reflected version. (I’m omitting the associator here.)
• Associativity: $m \circ (m \otimes id) = m \circ (id \otimes m) \circ \Psi_{R,R,R}$.
• Commutativity: $m = m \circ T$.
There are diagrammatic ways of representing these axioms, using bits of string on a table, tied together at trivalent vertices. There might even be a Youtube video about it.
Also, we need to understand the center itself. Not every G-graded abelian group admits a braiding transformation. If $(A, \phi)$ lies in the center, we can apply $\phi$ to a copy of the integers in degree g. Since the natural transformation has to respect degree, we find that we have an isomorphism from the part of A in degree h to the part in degree $ghg^{-1}$. In general, the compatibility condition induces an action of the group ring on A, conjugating degrees.
Objects of the Drinfeld center are then G-equivariant G-graded abelian groups. We can view these as sums of pairs (g,A), where g is a representative of a conjugacy class and A is a representation of the centralizer $C_G(g)$. The G-action on (g,A) is given by conjugating g, and acting on the G-module induced from A. From our choice of commutor notation, the G-action on the grading is from the left, and the braiding is given by $(g,A) \otimes (h,B) \mapsto (ghg^{-1},gB) \otimes (g,A)$.
Now, consider the sum $\bigoplus_{[g]} (g,\mathbb{Z})$. Under the “forget braiding” functor to G-graded vector spaces, this lands on the group ring. We can pull back the multiplication map to get a copy of the group ring in the center. To check that it is commutative, we compare the two maps $g \otimes h \mapsto gh$ and $g \otimes h \mapsto ghg^{-1} \otimes g \mapsto gh$. In other words, group rings are commutative because $gh = ghg^{-1}g$.
I should note that this formalism works if we replace abelian groups with sets. G-graded abelian groups become sets with a map to G, and the center is the category of G-sets with a G-map to G (with action given by conjugation). G lives in this category in a straightforward way, and we can say that G is an abelian group object in this category. One reason I didn’t name this post “All groups are abelian” is that the current title seems slightly less blatantly false.
You might be a bit disappointed if you’ve read this far to find that I’ve just redefined commutativity to hold using a rather tautological-looking conjugation trick. I concede that the punch line is a bit anticlimactic. However, we can think of this example of hidden commutativity as a toy model of a deeper phenomenon, known as transmutation.
There is an old philosophy due to Tannaka that a group is determined by its representation theory, and this was put into a categorical framework by Saavedra-Rivano and later refined by Deligne, Krein, and possibly others. The statement of Tannaka-Krein duality is that any symmetric tensor category with well-behaved duals and a faithful monoidal functor to vector spaces is equivalent to the category of representations of a proalgebraic group that is unique up to isomorphism. We will consider the coordinate ring picture, which is that it is equivalent to the category of comodules of a commutative Hopf algebra. The Hopf algebra is constructed by considering the natural transformations from the faithful functor to itself. Since the functor is linear, we have an additive structure, and composition makes it an algebra. We also have a coproduct arising from the tensor struture on the categories, and the counit and antipode are unique if they exist (this tends to require some completeness assumptions).
In some work in the early 1990s, Majid and Lyubashenko pointed out that one doesn’t need the functor to go to vector spaces. If the functor goes to any symmetric tensor category, you can reconstruct a Hopf algebra object in
that category by the same precedure (assuming existence of suitable colimits). More generally, if you have two braided tensor categories and a faithful braided tensor functor between them, the Hopf algebra of natural transformations has comodule category equivalent to the first category. This is particularly useful in part because we can use the identity functor, so we don’t actually need the second category. Given a braided tensor category, it is the [co]representation category of a commutative Hopf algebra in itself.
This can be applied to familiar examples of braided tensor categories, such as representations of quantum enveloping algebras, and the Drinfeld center that we saw earlier. These particular cases have a nondegeneracy property, known as factorizability: there is a map, called the inverse quantum Killing form (or “braided Fourier transform”), that is an isomorphism between the Hopf algebra and its dual. In particular, if we recast $U_q(\mathfrak{g})$ as a Hopf algebra in its own category of representations, it becomes transmuted to something commutative and cocommutative, and it is isomorphic to its dual, the “braided coordinate ring”. This is a phenomenon that only happens in the braided world, since sending q to 1 degenerates the two into a universal enveloping algebra and the coordinate ring of an algebraic group, and they are no longer isomorphic. One can take an extreme interpretation of this fact, and claim that braided commutative groups are the natural objects in this picture, and that the algebraic groups that we know and love are degenerate manifestations.
Thanks to David Jordan for introducing me to transmutation in the pre-Talbot seminar. Also, I should point out a neat paper by John Francis and the Davids,that develops Drinfeld centers from the viewpoint of sheaves on loop space, along with other gems.
## 10 thoughts on “Group rings arrr commutative”
1. Henry Wilton says:
Grothendieck proved a very general theorem that seems to make Tannaka’s `philosophy’ precise.
Let $A$ be any non-zero commutative ring. For a group $\Gamma$, denote by $\mathrm{Rep}_A(\Gamma)$ the category of finitely presented $A$-modules with a $\Gamma$-action. Let $u:\Gamma_1\rightarrow \Gamma_2$ be a homomorphism of finitely generated groups. The induced map of profinite completions $\hat{u}:\hat{\Gamma}_1\rightarrow\hat{\Gamma}_2$ is an isomorphism if and only the restriction functor $u^*_A : \mathrm{Rep}_A(\Gamma_2)\rightarrow \mathrm{Rep}_A(\hat{\Gamma}_1)$ is an equivalence of categories.
So it seems more accurate to say that the profinite completion of a group is determined by its representation theory.
2. Henry Wilton says:
Aargh, the restriction functor is really meant to be $u^*_A : \mathrm{Rep}_A(\Gamma_2)\rightarrow \mathrm{Rep}_A(\Gamma_1)$.
3. Very interesting.
I think that when your adviser mentioned Alexander the Great, he was referring to the Gordian Knot.
4. Henry,
Do you know where he proved this? The statement has a very Grothendieck flavor, but I was unable to find it in SGA 1 or 3.
If we remove the finite presentation restriction [on modules], we can get a stronger statement. In particular, Higman constructed an infinite finitely presented group with no nontrivial finite quotients, and its regular representation is clearly distinguishable from a sum of trivials. However, expanding to a larger category comes at the cost of having well-behaved duals, and this makes the reconstruction more complicated.
Incidentally, the statement I gave was for proalgebraic groups, which are a more general setting than profinite groups.
5. Henry Wilton says:
Scott,
The reference I have for Grothendieck’s theorem is as follows.
‘Représentations linéaires et compactification profinie des groupes discrets’, Manuscripta Math. 2 (1970), 375–396.
I haven’t actually looked at it, though.
So are you saying that there should be a theorem along the following lines: if a homomorphism u of fg groups induces an isomorphism of representation categories (where we’ve dropped the requirement that the modules be fp) then u induces an isomorphism of proalgebraic completions?
6. Thanks for the reference. I’m afraid I didn’t explain myself very well, because I was trying to make two points at the same time. The proalgebraic completion of a discrete group is its profinite completion, but the statement in my post also works in a positive dimensional setting. That is the classical Tannakian statement.
My point in removing the finitely presented hypothesis was that this allows us to distinguish two groups that have the same profinite (or proalgebraic) completion. In particular, the inclusion of the trivial group into Higman’s group induces an isomorphism of their profinite completions, but the restriction functor is not an equivalence if we allow the regular representation into our category.
I think the Barr-Beck theorem gives us a statement about groups being determined by their representation categories that doesn’t need any finiteness hypotheses on the group, as long as we demand that the representation categories in question contain the regular representation and represent small colimits.
7. Henry Wilton says:
The proalgebraic completion of a discrete group is its profinite completion
Oh, right – Selberg’s Lemma! What’s the statement for the positive-dimensional case?
In particular, the inclusion of the trivial group into Higman’s group induces an isomorphism of their profinite completions
Yes. For what it’s worth, there are much more interesting examples of this sort these days. For instance, Bridson and Grunewald constructed a pair of finitely presented, residually finite groups that aren’t isomorphic but whose profinite completions are isomorphic.
Anyway, thanks for clarifying, Scott!
8. Cale Gibbard says:
Regarding the videos on YouTube, you’re probably thinking of some videos by The Catsters (Eugenia Cheng and Simon Willerton). In particular, there are a bunch about group objects and Hopf algebras which use string diagrams, and another set on string diagrams for monads and adjunctions. Not directly this situation, but after watching those, anyone could figure out what pictures to draw here. :) You can find their channel here: http://www.youtube.com/user/TheCatsters | 4,043 | 16,904 | {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 47, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.9375 | 4 | CC-MAIN-2017-30 | longest | en | 0.911045 |
https://community.airtable.com/t5/formulas/need-a-formula-that-will-generate-the-date-for-the-3rd-friday-of/td-p/28044 | 1,716,667,879,000,000,000 | text/html | crawl-data/CC-MAIN-2024-22/segments/1715971058834.56/warc/CC-MAIN-20240525192227-20240525222227-00791.warc.gz | 138,608,931 | 48,025 | # Need a Formula that will generate the date for the 3rd Friday of the month
Topic Labels: Formulas
1112 1
cancel
Showing results for
Did you mean:
4 - Data Explorer
I have a date field that is on a third Friday called “Date Started”
I need a date formula that calculates the following 3rd Friday of the month for my “Due Date” field.
Thanks
18 - Pluto
You probably haven’t received an answer to your question yet because this is a complicated calculation.
It is fairly straightforward to calculate the {3rd Friday of the current month}, because the 3rd Friday will always be a date between the 15th and 21st:
`````` SWITCH(
WEEKDAY(DATETIME_PARSE(DATETIME_FORMAT({date}, "YYYY-MM") & "-15", 'YYYY-MM-DD')),
0, DATETIME_PARSE(DATETIME_FORMAT({date}, "YYYY-MM") & "-20", 'YYYY-MM-DD'),
1, DATETIME_PARSE(DATETIME_FORMAT({date}, "YYYY-MM") & "-19", 'YYYY-MM-DD'),
2, DATETIME_PARSE(DATETIME_FORMAT({date}, "YYYY-MM") & "-18", 'YYYY-MM-DD'),
3, DATETIME_PARSE(DATETIME_FORMAT({date}, "YYYY-MM") & "-17", 'YYYY-MM-DD'),
4, DATETIME_PARSE(DATETIME_FORMAT({date}, "YYYY-MM") & "-16", 'YYYY-MM-DD'),
5, DATETIME_PARSE(DATETIME_FORMAT({date}, "YYYY-MM") & "-15", 'YYYY-MM-DD'),
6, DATETIME_PARSE(DATETIME_FORMAT({date}, "YYYY-MM") & "-21", 'YYYY-MM-DD')
)
``````
It is a bit trickier to calculate the next 3rd Friday, because it might be in the same month or the following month.
The {3rd Friday of the following month} can be calculated by calculating the following month with `DATEADD({date}, 1, 'month')` , and then inserting the result in the above formula.
`````` SWITCH(
WEEKDAY(DATETIME_PARSE(DATETIME_FORMAT(DATEADD({date}, 1, 'month'), "YYYY-MM") & "-15", 'YYYY-MM-DD')),
0, DATETIME_PARSE(DATETIME_FORMAT(DATEADD({date}, 1, 'month'), "YYYY-MM") & "-20", 'YYYY-MM-DD'),
1, DATETIME_PARSE(DATETIME_FORMAT(DATEADD({date}, 1, 'month'), "YYYY-MM") & "-19", 'YYYY-MM-DD'),
2, DATETIME_PARSE(DATETIME_FORMAT(DATEADD({date}, 1, 'month'), "YYYY-MM") & "-18", 'YYYY-MM-DD'),
3, DATETIME_PARSE(DATETIME_FORMAT(DATEADD({date}, 1, 'month'), "YYYY-MM") & "-17", 'YYYY-MM-DD'),
4, DATETIME_PARSE(DATETIME_FORMAT(DATEADD({date}, 1, 'month'), "YYYY-MM") & "-16", 'YYYY-MM-DD'),
5, DATETIME_PARSE(DATETIME_FORMAT(DATEADD({date}, 1, 'month'), "YYYY-MM") & "-15", 'YYYY-MM-DD'),
6, DATETIME_PARSE(DATETIME_FORMAT(DATEADD({date}, 1, 'month'), "YYYY-MM") & "-21", 'YYYY-MM-DD')
)
``````
Now, how do you decide if the the next 3rd Friday is in the current month or the following month?
If the current date is before the 15, the 3rd Friday must be in the current month, and if the current date is after the 22, the 3rd Friday must be in the next month.
``````IF(
DAY({date}) <= 15,
{3rd Friday of the current month},
IF(
DAY({date}) >= 22,
{3rd Friday of the following month}
))
``````
But what if the current date is between the 15th and the 22? The next 3rd Friday might be later that same month, or it might be the following month:
``````IF(
DAY({date}) <= 15,
{3rd Friday of the current month},
IF(
DAY({date}) >= 22,
{3rd Friday of the following month},
SWITCH(DAY({date}),
16, SWITCH(WEEKDAY({date}),
0, DATEADD({date}, 5, 'days'),
1, DATEADD({date}, 4, 'days'),
2, DATEADD({date}, 3, 'days'),
3, DATEADD({date}, 2, 'days'),
4, DATEADD({date}, 1, 'days'),
5, {date},
6, {3rd Friday of the following month}
),
17, SWITCH(WEEKDAY({date}),
0, {3rd Friday of the following month},
1, DATEADD({date}, 4, 'days'),
2, DATEADD({date}, 3, 'days'),
3, DATEADD({date}, 2, 'days'),
4, DATEADD({date}, 1, 'days'),
5, {date},
6, {3rd Friday of the following month}
),
18, SWITCH(WEEKDAY({date}),
0, {3rd Friday of the following month},
1, {3rd Friday of the following month},
2, DATEADD({date}, 3, 'days'),
3, DATEADD({date}, 2, 'days'),
4, DATEADD({date}, 1, 'days'),
5, {date},
6, {3rd Friday of the following month}
),
19, SWITCH(WEEKDAY({date}),
0, {3rd Friday of the following month},
1, {3rd Friday of the following month},
2, {3rd Friday of the following month},
3, DATEADD({date}, 2, 'days'),
4, DATEADD({date}, 1, 'days'),
5, {date},
6, {3rd Friday of the following month}
),
20, SWITCH(WEEKDAY({date}),
0, {3rd Friday of the following month},
1, {3rd Friday of the following month},
2, {3rd Friday of the following month},
3, {3rd Friday of the following month},
4, DATEADD({date}, 1, 'days'),
5, {date},
6, {3rd Friday of the following month}
),
21, SWITCH(WEEKDAY({date}),
0, {3rd Friday of the following month},
1, {3rd Friday of the following month},
2, {3rd Friday of the following month},
3, {3rd Friday of the following month},
4, {3rd Friday of the following month},
5, {date},
6, {3rd Friday of the following month}
)
)))
``````
Upon re-reading your original post, I see that your original date is always a 3rd Friday, thus, your calculated 3rd Friday will always be in the following month, so you can skip several of the formulas that I provided and just use the formula for the {3rd Friday of the following month}. | 1,512 | 4,932 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.765625 | 3 | CC-MAIN-2024-22 | latest | en | 0.611886 |
http://www.lmfdb.org/ModularForm/GL2/TotallyReal/6.6.1241125.1/holomorphic/6.6.1241125.1-45.1-k | 1,566,746,906,000,000,000 | text/html | crawl-data/CC-MAIN-2019-35/segments/1566027330750.45/warc/CC-MAIN-20190825151521-20190825173521-00196.warc.gz | 276,131,620 | 6,005 | # Properties
Base field 6.6.1241125.1 Weight [2, 2, 2, 2, 2, 2] Level norm 45 Level $[45, 15, 2w^{5} - 14w^{3} - 3w^{2} + 23w + 9]$ Label 6.6.1241125.1-45.1-k Dimension 6 CM no Base change no
# Related objects
• L-function not available
## Base field 6.6.1241125.1
Generator $$w$$, with minimal polynomial $$x^{6} - 7x^{4} - 2x^{3} + 11x^{2} + 7x + 1$$; narrow class number $$1$$ and class number $$1$$.
## Form
Weight [2, 2, 2, 2, 2, 2] Level $[45, 15, 2w^{5} - 14w^{3} - 3w^{2} + 23w + 9]$ Label 6.6.1241125.1-45.1-k Dimension 6 Is CM no Is base change no Parent newspace dimension 27
## Hecke eigenvalues ($q$-expansion)
The Hecke eigenvalue field is $\Q(e)$ where $e$ is a root of the defining polynomial:
$$x^{6}$$ $$\mathstrut -\mathstrut 4x^{5}$$ $$\mathstrut -\mathstrut 22x^{4}$$ $$\mathstrut +\mathstrut 80x^{3}$$ $$\mathstrut +\mathstrut 32x^{2}$$ $$\mathstrut -\mathstrut 160x$$ $$\mathstrut +\mathstrut 64$$
Norm Prime Eigenvalue
5 $[5, 5, -2w^{5} + w^{4} + 13w^{3} - 2w^{2} - 19w - 5]$ $\phantom{-}1$
9 $[9, 3, 2w^{5} - w^{4} - 14w^{3} + 2w^{2} + 23w + 6]$ $\phantom{-}1$
11 $[11, 11, w - 1]$ $\phantom{-}e$
25 $[25, 5, w^{3} + w^{2} - 4w - 3]$ $\phantom{-}\frac{1}{48}e^{5} - \frac{1}{8}e^{4} - \frac{11}{24}e^{3} + \frac{37}{12}e^{2} + e - \frac{16}{3}$
29 $[29, 29, w^{5} - w^{4} - 7w^{3} + 4w^{2} + 11w]$ $-\frac{1}{2}e^{2} + 8$
41 $[41, 41, w^{4} - w^{3} - 5w^{2} + 3w + 3]$ $-\frac{1}{6}e^{5} + \frac{1}{2}e^{4} + \frac{25}{6}e^{3} - \frac{55}{6}e^{2} - 13e + \frac{32}{3}$
49 $[49, 7, w^{5} - w^{4} - 7w^{3} + 4w^{2} + 11w + 1]$ $\phantom{-}\frac{1}{48}e^{5} - \frac{1}{8}e^{4} - \frac{11}{24}e^{3} + \frac{31}{12}e^{2} + e - \frac{10}{3}$
59 $[59, 59, 2w^{5} - w^{4} - 14w^{3} + 2w^{2} + 24w + 7]$ $-\frac{1}{8}e^{5} + \frac{1}{2}e^{4} + \frac{11}{4}e^{3} - 9e^{2} - 5e + 10$
59 $[59, 59, -w^{5} + 8w^{3} + 2w^{2} - 15w - 8]$ $-\frac{5}{16}e^{5} + \frac{7}{8}e^{4} + \frac{63}{8}e^{3} - \frac{65}{4}e^{2} - 26e + 28$
61 $[61, 61, w^{5} - 7w^{3} - 2w^{2} + 12w + 4]$ $\phantom{-}\frac{1}{24}e^{5} - \frac{1}{4}e^{4} - \frac{11}{12}e^{3} + \frac{17}{3}e^{2} + e - \frac{32}{3}$
61 $[61, 61, -w^{5} + 7w^{3} - 11w - 1]$ $\phantom{-}\frac{1}{24}e^{5} - \frac{17}{12}e^{3} - \frac{1}{3}e^{2} + 10e - \frac{8}{3}$
64 $[64, 2, 2]$ $\phantom{-}\frac{1}{48}e^{5} - \frac{11}{24}e^{3} - \frac{1}{6}e^{2} - e + \frac{5}{3}$
71 $[71, 71, w^{3} + w^{2} - 5w - 3]$ $-\frac{1}{4}e^{5} + \frac{3}{4}e^{4} + \frac{13}{2}e^{3} - \frac{29}{2}e^{2} - 27e + 26$
71 $[71, 71, -3w^{5} + w^{4} + 21w^{3} - w^{2} - 33w - 9]$ $\phantom{-}\frac{1}{3}e^{5} - e^{4} - \frac{47}{6}e^{3} + \frac{107}{6}e^{2} + 20e - \frac{64}{3}$
79 $[79, 79, -2w^{5} + w^{4} + 13w^{3} - 3w^{2} - 19w - 5]$ $\phantom{-}\frac{1}{6}e^{5} - \frac{1}{2}e^{4} - \frac{25}{6}e^{3} + \frac{26}{3}e^{2} + 13e - \frac{14}{3}$
81 $[81, 3, 2w^{5} - w^{4} - 13w^{3} + w^{2} + 19w + 8]$ $\phantom{-}\frac{5}{48}e^{5} - \frac{3}{8}e^{4} - \frac{55}{24}e^{3} + \frac{83}{12}e^{2} + 6e - \frac{14}{3}$
89 $[89, 89, 2w^{5} - w^{4} - 13w^{3} + 2w^{2} + 20w + 7]$ $-\frac{5}{24}e^{5} + \frac{1}{2}e^{4} + \frac{61}{12}e^{3} - \frac{47}{6}e^{2} - 16e + \frac{22}{3}$
89 $[89, 89, -w^{5} + 8w^{3} + w^{2} - 16w - 5]$ $\phantom{-}\frac{1}{12}e^{5} - \frac{1}{4}e^{4} - \frac{7}{3}e^{3} + \frac{29}{6}e^{2} + 14e - \frac{34}{3}$
89 $[89, 89, -3w^{5} + w^{4} + 20w^{3} - 30w - 11]$ $-e + 8$
89 $[89, 89, -w^{5} + 7w^{3} + 2w^{2} - 11w - 4]$ $\phantom{-}\frac{1}{48}e^{5} + \frac{1}{8}e^{4} - \frac{23}{24}e^{3} - \frac{35}{12}e^{2} + 7e + \frac{26}{3}$
Display number of eigenvalues
## Atkin-Lehner eigenvalues
Norm Prime Eigenvalue
5 $[5, 5, -2w^{5} + w^{4} + 13w^{3} - 2w^{2} - 19w - 5]$ $-1$
9 $[9, 3, 2w^{5} - w^{4} - 14w^{3} + 2w^{2} + 23w + 6]$ $-1$ | 2,116 | 3,720 | {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.609375 | 3 | CC-MAIN-2019-35 | latest | en | 0.238744 |
https://www.codingninjas.com/blog/2018/11/15/top-down-and-bottom-up-the-difference-between-the-two-programming-approaches/ | 1,624,461,404,000,000,000 | text/html | crawl-data/CC-MAIN-2021-25/segments/1623488539480.67/warc/CC-MAIN-20210623134306-20210623164306-00397.warc.gz | 644,161,492 | 24,108 | # Top-Down And Bottom-Up: What’s The Difference? [Updated in 2021]
## Introduction
In the world of programming, algorithms take the prime spotlight. These complex mathematical and computational designs are used to find solutions to even more complex programming issues. But that’s something we’re all aware of. However, do you know how these algorithms are designed and created?
That’s precisely the topic of our conversation today!
## How Are Algorithms Designed – The Top-Down And The Bottom-Up Approach
Basically, the top-down approach, as the name suggests, is all about breaking a bigger problem into smaller chunks, whereas, the bottom-up approach focuses on amalgamating smaller chunks to paint the complete and bigger picture. Get it? Now, let’s take a closer look at these two methodologies.
## The Top-Down Approach
In the top-down approach, a complex algorithm is broken down into smaller fragments, better known as ‘modules.’ These modules are then further broken down into more smaller fragments until they can no longer be fragmented. This process is called ‘modularization.’ However, during the modularization process, you must always maintain the integrity and originality of the algorithm.
By breaking a bigger problem into smaller fragments, the top-down approach minimizes the complications usually incurred while designing algorithms. Furthermore, in this approach, each function in a code is unique and works independently of other functions. The top-down approach is heavily used in the C programming language.
## The Bottom-Up Approach
Contrary to the top-down approach, the bottom-up approach focuses on designing an algorithm by beginning at the very basic level and building up as it goes. In this approach, the modules are designed individually and are then integrated together to form a complete algorithmic design.
So, in this method, each and every module is built and tested at an individual level (unit testing) prior to integrating them to build a concrete solution. The unit testing is performed by leveraging specific low-level functions.
## What Are The Key Differences Between The Top-Down And The Bottom-Up Approaches?
Based on the core preferences and values of each methodology, we can chalk out certain basic differences between the two and they are:
• While the top-down approach focuses on breaking down a big problem into smaller and understandable chunks, the bottom-up approach first focuses on solving the smaller problems at the fundamental level and then integrating them into a whole and complete solution.
Let’s take an example of finding the Fibonacci series with the help of recursion where we have to calculate the 5th Fibonacci number.
Using recursion we know that:
`Fibonacci(n) = Fibonacci(n-1) + Fibonacci(n-2) where Fibonacci(0) and Fibonacci(1) are both 1.For our problem we observe:Fibonacci(5) = Fibonacci(4) + Fibonacci(3)Fibonacci(4) = Fibonacci(3) + Fibonacci(2)Fibonacci(3) = Fibonacci(2) + Fibonacci(1)Fibonacci(2) = Fibonacci(1) + Fibonacci(0)`
Our function call stack will have multiple calls to the same calculations. To do away with this we use a top-down approach using Dynamic Programming which is called Memoisation and create an array to store the calculations so that no duplicate calculations are performed. The top-down approach first calculates Fibonacci(5) and then goes down to solving others.
There is another approach – the bottom-up approach where the direction of solving the question is reversed. First Fibonacci(0) is calculated and then the problem goes all the way up to Fibonacci(5) making it easier to solve the problem.
• The top-down approach is primarily used by structured programming languages such as C, COBOL, Fortran. On the contrary, the bottom-up approach is preferred by OOP languages such as C++, C#, Python, Java, and Perl.
In the C programming language, the problem statement is first understood and a solution is created after which the main function is created and all the sub-functions are called from the main function breaking the problem into smaller parts. Hence, procedural languages utilize the paradigm of a top-down approach.
Similarly in object-oriented programming languages like Java, the base classes are written first. Then you go on writing the derived classes making your program complex little by little and hence it is considered to be a bottom-up approach.
• In the top-down approach, each module and submodule are processed separately, and hence, they might contain redundant information. However, the bottom-up approach relies on data encapsulation and data-hiding, thereby, minimising redundancy.
Like we saw in the previous example, object oriented programming languages utilise the bottom up approach and with the use of classes and objects – encapsulation, data hiding and several other object oriented programming concepts are applied to the best.
• The top-down approach doesn’t require the modules to have a well-established line of communication among them, whereas, in the bottom-up approach, the modules must have a certain degree of interaction and communication among them.
• While the top-down approach can be used in module documentation, debugging, and code implementation, the bottom-up approach is primarily used in testing.
As we know, the bottom-up approach requires interaction and integration between different modules and components of the program and hence this approach is used in testing purposes for identifying if all components are working properly together.
Debugging on the other hand is a process where first what is happening is identified and then the root cause is discovered which suggests that the top-down approach should be approached.
• The top-down approach has one significant issue – identifying the topmost function of a problem can be difficult sometimes and similarly in the bottom-up approach, sometimes developers find it difficult to create a holistic program from the smaller chunks of programs they created.
Why is bottom up better than top down?
The bottom up approach first identifies the small chunks of the problem and solves it moving its way to the top while the top down approach divides the bigger problem into smaller parts and solves it. Bottom up approach is better as it focuses on the fundamentals first and then moves on to the original problem as a whole.
What means top down?
The top down approach translates into an approach where a bigger problem is solved by breaking it down into smaller parts.
What is a bottom-up budget?
A bottom-up budget is a budget where first the tasks to be undertaken are identified and then according to the plan an entire budget is prepared.
What is a bottom-up project?
A bottom-up project is a project where the team defines and performs smaller tasks (presumably in different teams as well) and then together solves the problem of the undertaken project.
What is the advantage of a top down approach?
A top down approach is better when a management perspective is considered. The decision making is comparatively faster and the teams are working on smaller problems and hence not trying to solve the entire problem at once which might make them overlook certain aspects of the problem.
Which is better, C or Java?
C is a procedural and low-level language whereas Java is an object oriented and high level language. C is faster whereas Java is easier to learn.
Why is C called top down?
In C language, the problem solving starts with a high level design which goes down to the low level implementation.
## Conclusion
Thus, in conclusion, we can say that the top-down approach is rather the conventional method that seeks to decompose a complex problem into smaller fragments (from high-level specification to low-level specification), the bottom-up approach works is just the opposite – it first concentrates on designing the fundamental components of an algorithm and then moves up to a higher level to achieve a complete result.
The top down approach finds its uses in debugging, proper management and procedural programming languages. The bottom up approach finds its uses in testing and object oriented programming languages. Both have their own advantages and disadvantages. The top down approach is the first priority for some developer teams while others prefer a bottom up approach. | 1,605 | 8,362 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.609375 | 3 | CC-MAIN-2021-25 | latest | en | 0.931305 |
http://www.wikinvest.com/wiki/Yield_to_Maturity?oldid=444115×tamp=20090804001001 | 1,386,343,102,000,000,000 | text/html | crawl-data/CC-MAIN-2013-48/segments/1386163051992/warc/CC-MAIN-20131204131731-00087-ip-10-33-133-15.ec2.internal.warc.gz | 613,755,319 | 12,781 | # Yield to Maturity
RECENT NEWS
The Globe and Mail Jun 14 Comment
The final return you will receive from your fixed-income investment depends on a number of variables
RELATED WIKI ARTICLES
#### Related Articles
WIKI ANALYSIS
TOP CONTRIBUTORS
Yield to Maturity (YTM) refers to the expected rate of return a bondholder will receive if they hold a bond all the way until maturity while reinvesting all coupon payments at the bond yield. It is generally given in terms of Annual Percentage Rate (APR), and it is an estimation of future return, as the rate at which coupon payments can be reinvested at is unknown. However, for zero coupon bonds, the yield to maturity and the rate of return are equivalent since there are no coupon payments to reinvest.
Another way of putting it is that the yield to maturity is the rate of return that makes the present value (PV) of the cash flow generated by the bond equal to the price. Yield to maturity is widely used by investors as a way to compare bonds with different face values, coupon payments, and time till maturity.
## Yield to Maturity Terminology
• Face Value, also known as the "par value", is the amount a bond holder will be paid when it matures. For example, a zero coupon bond with a \$1000 face value and one year to maturity means that in exactly one year, the bond holder is entitled to \$1000 from the issuer.
• Coupon rate is the interest paid on a bond, expressed as a percentage of the face value of the bond. Coupon payments take the form of an annuity. Most government issued bonds such as U.S. Treasury Bonds pay coupons semi-annually. If a bond does not ever pay any coupons between the issue date and maturity, it is called a zero coupon bond. A short example helps explain how coupons work. Suppose you buy a 2 year bond, face value \$100 with a coupon rate of 5% paid semi-annually. Every six months you will receive a coupon payment of \$5.00 (5% of \$100) for a total of 4 payments. After 2 years, you receive \$5.00 as the final coupon, as well as the \$100 face value of the bond.
• Present Value (PV) is today's value of a set of cash flows set to occur in the future. Theoretically, the price you pay for a bond should equal its present value, since you are giving up money today to be repaid at a later date.
• Discount Rate is a component used in calculating present value, and is also related to calculating yield to maturity. The yield to maturity is exactly the discount rate that makes the present value of all future cash flows equal to the price of the bond today. In other words, the price of the bond is equal to all future cash flows discounted by the yield to maturity.
## Calculating yield to maturity
This is the general formula for calculating yield to maturity for a coupon paying bond. The variable 'n' denotes the number of periods, i.e. 4 year bond paying semi-annual bonds would have 9 periods. Solving for a YTM that satisfies this equation may be difficult without a computer program or an advanced calculator.
Using an annuity formula, the calculation becomes much simpler. Again, the variable 'n' denotes the number of periods. Using either formula will result in the same YTM; however, in order to use the annuity formula, coupon payments must be made with regularity
Conceptually, calculating yield to maturity is very similar to calculating an internal rate of return (IRR), and is relatively straightforward. Set the bond price equal to the coupon payments and par value discounted at the yield to maturity, and solve for yield to maturity. However, solving for the yield to maturity can be prohibitively difficult and time consuming without either a computer program or advanced calculator.
Fortunately, most bonds pay coupons on a fixed schedule (generally quarterly, semi-annually, or annually). As a result, its coupon payments take the form of an annuity, whose present value is easier to calculate. In practice, bonds paying coupons will pay them according to a fixed schedule, allowing investors to estimate yield to maturity using an annuity table. | 883 | 4,072 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.734375 | 3 | CC-MAIN-2013-48 | latest | en | 0.943825 |
http://www.itscomputers.lol/ebe/divisors | 1,656,572,985,000,000,000 | text/html | crawl-data/CC-MAIN-2022-27/segments/1656103669266.42/warc/CC-MAIN-20220630062154-20220630092154-00440.warc.gz | 93,773,058 | 2,610 | # 1.4. divisors
We saw that a negative integer can be a divisor of another integer. However, when discussing the divisors of an integer we will often restrict ourselves to its positive divisors.
definition. For a nonzero integer $a$, the divisors of $a$ are of the positive integers that divide $a$, ie, $$\{ n \in \mathbb{Z} \mid n > 0 \text{ and } n \mid b \}.$$
Note that we do not define the set of divisors of $0$ because every integer divides $0$.
## examples
1. What are the divisors of $47$?
The divisors of $47$ are $$1, 47 .$$
2. What are the divisors of $48$?
The divisors of $48$ are $$1, 2, 3, 4, 6, 8, 12, 16, 24, 48 .$$
3. What are the divisors of $49$?
The divisors of $49$ are $$1, 7, 49 .$$
4. What are the divisors of $50$?
The divisors of $50$ are $$1, 2, 5, 10, 25, 50 .$$
5. What are the divisors of $51$?
The divisors of $51$ are $$1, 3, 17, 51 .$$
6. What are the divisors of ?
## exercises
1. If $a$ and $b$ are positive integers such that $b \mid a$, prove that $b \le a$.
solution
Since $b \mid a$, there is an integer $n$ such that $a = b \cdot n$. Since both $a$ and $b$ are positive, then $n$ must be as well, because if $n$ were zero or negative, then multiplying by $b$ would result in zero or a negative number, which is impossible. Therefore, we can be sure that $1 \le n$. Multiplying both sides of this inequality by the positive integer $b$ results in $b \le b \cdot n$, which can be rewritten as $b \le a$.
2. Write a divisors function that takes an integer input and returns the sorted array of its divisors. (Hint: use exercise #1)
Some test values:
• divisors(25) ~> [1, 5, 25]
• divisors(27) ~> [1, 3, 9, 27]
• divisors(29) ~> [1, 29]
• divisors(30) ~> [1, 2, 3, 5, 6, 10, 15, 30]
• divisors(32) ~> [1, 2, 4, 8, 16, 32]
• divisors(34) ~> [1, 2, 17, 34]
• divisors(36) ~> [1, 2, 3, 4, 6, 9, 12, 18, 36]
solution
module NumberTheory::Division
def divisors(a)
return if a == 0
(1..a.abs).select { |b| divides(b, a) }
end
end
3. If $a$ and $b$ are positive integers such that $a \mid b$ and $b \mid a$, prove that $a = b$. (Hint: use exercise #1)
solution
Since $b \mid a$, the previous exercise implies that $b \le a$. Similarly, since $a \mid b$, the previous exercise implies that $a \le b$. This is only possible if $a$ and $b$ are actually equal. | 814 | 2,303 | {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 4.9375 | 5 | CC-MAIN-2022-27 | latest | en | 0.842034 |
http://mathhelpforum.com/number-theory/150373-every-prime-3-congruent-pm-1-mod-6-a-print.html | 1,495,573,173,000,000,000 | text/html | crawl-data/CC-MAIN-2017-22/segments/1495463607702.58/warc/CC-MAIN-20170523202350-20170523222350-00594.warc.gz | 227,812,299 | 4,102 | # Every prime > 3 is congruent to \pm 1 mod 6
Printable View
• Jul 8th 2010, 03:32 AM
dwsmith
Every prime > 3 is congruent to \pm 1 mod 6
Every prime > 3 is congruent to $\pm 1 \ \mbox{mod 6}$
Induction maybe?
$5\equiv\pm 1\ \mbox{(mod 6)}$ This isn't true though
• Jul 8th 2010, 04:41 AM
aman_cc
any number can be
0,1,2,3,4,5 mod 6
because the number is prime - 0,2,3,4 can be ruled out
• Jul 8th 2010, 04:42 AM
Ackbeet
$5\equiv -1\ \mbox{(mod 6)},$ since $5-(-1)=6\times 1$.
You could try arguing along these lines: all primes greater than 3 are odd. Therefore, they must be congruent to either -1, 1, or 3 mod 6. (5 and -1 are equivalent). However, any number greater than 3 that is congruent to 3 mod 6 would be divisible by 3, and hence not prime. Therefore, all primes greater than 3 are congruent to 1 or -1 mod 6.
[EDIT]: This is essentially the same as what aman_cc said.
• Jul 10th 2010, 01:31 AM
melese
Quote:
Originally Posted by dwsmith
Every prime > 3 is congruent to $\pm 1 \ \mbox{mod 6}$
Induction maybe?
$5\equiv\pm 1\ \mbox{(mod 6)}$ This isn't true though
You can generalize and consider integers $a$ that are relatively prime to $6$ and the result will follow, in particular, to any prime $p>3$.
Let $a=6q+r$, with $0\leq r<6$. Then $gcd(a,6)=gcd(6,r)$, so we need only to look at values $r$ such that $gcd(6,r)=1$. These are $r=1,5$.
Now, $a\equiv 1(mod\ 6)$,or $a\equiv 5\equiv -1(mod\ 6)$.
• Jul 10th 2010, 05:32 AM
Bacterius
Keep it simple ... I assume that $p > 3$ in the whole post by the way ... since the fact $3 | 3$ does not contradict the primality of $p$ ... just adjust what is below as you wish ...
Let $p \equiv x \pmod{n} \Rightarrow p = kn + x$, $k \in \mathbb{Z}$, $x \in \mathbb{Z}/n\mathbb{Z}$
Then it follows that $\gcd{(n, x)} | p$
But if $p$ is prime we must have $\gcd{(n, x)} = 1$ (otherwise there is a contradiction with respect to the definition of a prime number)
Applying this to the current problem with $n = 6$, the only $x$ that are coprime to $6$ (in the congruence ring $\mathbb{Z}/6\mathbb{Z}$ of course) are, surprisingly enough, $1$ and $5$ (which turns out to be congruent to $-1 \pmod{6}$).
It follows that if $p$ is indeed prime then it must be congruent to $\pm 1 \pmod{6}$
...
Interestingly, it is also possible to prove that this implies that $\gcd{(k, n)} = 1$ for any prime $p$ ... This gives me an idea, I'll be right back !
• Jul 12th 2010, 04:30 PM
Bingk
To Bacterius
gcd(n,x) = 1 or p
i.e. p = p mod p^2, so gcd(p^2,p) = p, and p|p
But since n is 6, then we can say that gcd(n,x) should be 1 :)
• Jul 12th 2010, 07:25 PM
Bacterius
I don't understand what you mean, can you develop ? (Worried)
• Jul 16th 2010, 06:50 AM
Bingk
I was just pointing out that gcd(n,x) isn't necessarily 1, it could be p also, at least in general ... for this particular case, since n is 6, then gcd(n,x) would be 1 ... | 1,039 | 2,888 | {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 37, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 4.25 | 4 | CC-MAIN-2017-22 | longest | en | 0.873091 |
https://www.scribd.com/document/412219342/Final-Demonstration | 1,571,873,762,000,000,000 | text/html | crawl-data/CC-MAIN-2019-43/segments/1570987836368.96/warc/CC-MAIN-20191023225038-20191024012538-00157.warc.gz | 1,082,403,372 | 69,844 | You are on page 1of 9
# Republic of the Philippines
DEPARTMENT OF EDUCATION
Region V
Division of Camarines Sur
LA PURISIMA NATIONAL HIGH SCHOOL
Nabua, Camarines Sur
## DETAILED LESSON PLAN IN MATHEMATICS 10
(Monday, March 13, 2017, Grade 10 – EAGLE, 8:30 – 9:30 A.M.)
I. LEARNING OBJECTIVES
At the end of the session, the learners should be able to:
A. Arrange the given data into ascending order.
B. Find the Q1, Q2, and Q3 of the given data.
C. Cite the importance of studying quartiles in real – life situation.
## II. SUBJECT MATTER
A. Topic: Quartiles for Ungrouped Data
B. References:
Callanta, Melvin M. et al., Mathematics Learners Module for Grade 10,
pages 364 – 371.
Esller, Beda H. et al., Basic Statistics, pages 55 – 57.
http://www.mathsisfun.com/data/quartiles.html
C. Materials: manila paper, cartolina, pentel pen, colored paper (traffic light
cups), activity sheets, improvised train
D. Skills to be developed: critical thinking, brainstorming, analysis
E. Mathematical Concept:
When the given data is odd number, get the middle value or used the
𝑛+1
formula 2 .
When the given data is even number, get the sum of the two middle
values divided by two.
F. Values to be Integrated: active participation, cooperation and teamwork
G. Methodology/Teaching Strategy: 7Es (Elicit, Engage, Explore, Explain,
Elaborate, Evaluate, Extend) , Carousel Feedback
III. PROCEDURE
Time
Teacher’s Activity Students Activity Im’s used
Frame
10 A. Preliminary Activities
mins. 1. Greetings
Good morning class! Good morning ma’am!
2. Opening Prayer
(Teacher will call a student (Student will lead the prayer.)
3. Classroom Management
kindly pick – up the pieces
of papers and plastics that
you may see on the floor,
and then arrange your
chairs properly. (Students will follow.)
4. Checking of Attendance
Class secretary, who are
absent today? (Class secretary will give the names
of the student who are absent.)
Thank you!
5. Checking of Assignment
Last meeting, I told you to
measures of position of
ungrouped data, right?
Yes, ma’am.
Let see if you really study
the measures of position of
ungrouped data.
6. Objectives
lesson, let me first give to powerpoint
you, our learning objectives. presentation
(Teacher will call a student
to read the learning Learning Objectives:
objectives.) A. Arrange the given data into
ascending order.
B. Find the Q1, Q2, and Q3 of the
given data.
C. Cite the importance of
studying quartiles in real –
life situation.
Thank You!
Can we attain our learning
objectives? Yes, ma’am.
7. Unlocking of Difficulties
Now, I want you to be Cartolina,
familiar with the terms that powerpoint
I will show to you. We will presentation,
do this through an activity, pentel pen
entitled “Fill me and You
will See..”
## You will just fill – in the
missing letters on each item
below.
## I need a volunteer to fill – in
the missing letters for
number 1, 2, 3, 4, and 5.
Anyone?
Since nobody volunteer, I
will call you to fill – in the
missing letters.
(Teacher will call a 5
student to fill – in the
missing letters.)
1. The middle value in a set
of data.
_E_I_N
2. The value of the variable
below which 25% of the
cases lie.
L_WE_ Q_AR_IL_
3. The value of the variable
below which 50% of the
cases lie.
_ID_LE QUA_T_L_
4. The value of the variable
below which 75% of the
cases lie.
UP_E_ _UA_T_LE
5. The score points which
divide a distribution into
four equal parts.
Q_A_T_L_ Unlocking Terms:
## Median – The middle value in a set of
data.
Lower Quartile – The value of the
variable below which 25% of the
cases lie.
Middle Quartile – The value of the
variable below which 50% of the
cases lie.
Upper Quartile – The value of the
variable below which 75% of the
cases lie.
Quartile – The score points which
divide a distribution into four equal
following words in chorus.
Thank You! terms.)
## 5 mins. ELICIT Cut – out
numbers
I need 5 students to stand in (Colored
front of the class. paper)
## (Teacher will ask a question to
the remaining class.)
(Students who will volunteer will
When my questions are stand in front of the class.)
‘stand up’ and when it is ‘no’
you will ‘sit down’.
(person A, B, C, D, E)
Is person B the ‘median’ from A
to E? No. (Students will sit down.)
## Is person C the ‘median’ from A
to E? Yes. (Students will stand up.)
## Very good. What is the reason
that person C is the ‘median’
from A to E? Because he/she is the one who are in
the middle among the rest.
Very well said.
## (Teacher will add one student
and they will hold the six
different numbers to those
volunteer students.)
5, 8, 4, 9, 7, 10
## From those numbers that they
are holding, what will you do to
find the median? We need to arrange them from
lowest to highest. Then, the median
will be equal to the sum of the two
middle numbers divided by two.
Precisely! Now, what is the
value of the median from those
7.5
Very good!
Thank you! You can take your (Volunteer students will now go
seats now. back to their seats.)
## The concept of median will help
quartile.
5 mins. ENGAGE
Powerpoint
Class, I will give you a short presentation,
story. So, listen carefully. (Students will listen.) Improvised
train
Awra has a project in Statistics:
The estimated population of
Brgy. La Purisima. He went
from Zone 1 to Zone 7 to gather
the estimated population and
place it on the train. But Awra
has a problem, the train will not
move if he will not find the
upper, middle, and lower
quartile.
## Can we help him to find the
quartile for him to travel back
going to his home?
Purisima
Zone Estimated
Population
1 56
2 54
3 65
4 67
5 50
6 78
7 49
## Let’s find a way how to help
Awra.
EXPLORE
(Pre – Activity)
15 Let’s have a group activity. This Activity
mins. activity will support us to help sheets,
Awra on his project. pentel pen,
colored
I will divide the class into 4 paper
groups. (traffic light
Every group must have a; cups),
- Presenter paper,
- Secretary scientific
- Timekeeper calculator
- Problem solver
- Research runner
All the materials and activity
sheet are inside the brown
envelope.
I will give you this Traffic Light
Cups where;
- Green Cup (Go) – means
you know how to perform
- Yellow (wait for a while) –
means you know something
but you need assistance.
- Red Cup (stop) – means you
don’t know how to perform
need assistance.
After you finish the given
activity, you will post your
Then, you will do the Carousel
feedback.
Procedure of Carousel
feedback:
1. Teams stand in front of
their assigned projects. The
presenter of the team will
stay on their assigned
projects to present it on the
other groups.
2. Teams will rotate clockwise
to the next project.
3. For a specified time (1 min.
to present and 1 min.
feedback), team discuss
their reactions to the other
teams project in the
comment box.
4. Students are encouraged to
5. Teacher will call time. The
teams will rotate, observe,
discuss, and give feedback
on next project.
6. Teams continue until each
team rotate back to its own
project. Teams review the
other teams.
## After the carousel feedback, the
presenter will now discuss
their output in the whole class.
Is that clear?
Yes, Ma’am.
based on the rubric that is
given in the activity sheet.
## You will do your activity in just
Time starts now. Yes, ma’am.
(Activity Proper)
(Teacher will facilitate the Group Activity
activity.) Direction: Arrange the given data in
ascending order. Then, find the Q1,
Q2, and Q3 of the given data.
Group 1:
14, 1, 10, 17, 5, 11, 8, 13, 4, 9, 12
Group 2:
9, 7, 24, 20, 18, 2, 6, 3, 4, 13, 5, 23
Group 3:
17, 21, 6, 18, 11, 9, 10, 14, 5
Group 4:
7, 16, 15, 4, 9, 5, 3, 27 , 9, 19
## Complete the statement below:
1. The first quartile ___ is
obtained by _______________.
2. The second quartile ___ is
obtained by _______________.
3. The third quartile ___ is
obtained by _______________.
(Post Activity)
Okay! You may now post your
## We will do now the Carousel
Feedback, where teams will
rotate from project to leave
feedback for other teams.
(Students will do the Carousel
Feedback)
Group 1:
1, 4, 5, 8, 9, 10, 11, 12, 13, 14, 17
Q1 – 5
Q2 – 10
Q3 – 13
Group 2:
2, 3, 4, 5, 6, 7, 9, 13, 18, 20, 23, 24
Q1 – 4.5
Q2 – 8
Q3 – 19
Group 3:
5, 6, 9, 10, 11, 14, 17, 18, 21
Q1 – 7.5
Q2 – 11
Q3 – 17.5
Group 4:
3, 4, 5, 7, 9, 9, 15, 16, 19, 27
Q1 – 5
Q2 – 9
Q3 – 16
## (Students answer may vary on the
given statement.)
## 18 EXPLAIN AND ELABORATE
mins. (The presenter will now discuss
their work in the whole class.)
(The teacher will evaluate and
rate the activity of each group
based on the criteria)
How did you find the activity
## In the given activity, what did
you do first before you find the
Q1, Q2, and Q3 of the given data? We arrange first the given data in
Very good. ascending order.
## What if it is not arrange in
ascending order? Can we get
the Quartile? Why? No, ma’am.
Because, by definition Q1 < Q2 < Q3.
If we didn’t arrange the given data,
we will come up a wrong answer.
Precisely! So you need to
arrange the given data into
ascending order.
## What did you used to find the
position of the Q1, Q2, and Q3 in
the given data/value? We used the concept of getting the
value of median, when the given data
is odd number, you will just get the
middle value or you will used the
𝑛+1
formula 2 and when the given data
is even number you will get the sum
of the two middle values divided by
two.
Very well said.
Pass..)
Let us reflect…
## You will just complete the
following statement in 2 mins.
A. I learned that …
B. I noticed that …
C. The importance of studying this
topic in real – life situation is/
are …
Who can help Awra on his
project? Anyone?
49, 50, 54, 56, 65, 67, 78
Q1 – 50
Q2 – 56
Q3 – 67
## (Student will explain the answers)
Perfect! So, Awra can travel now going
back to his home. He is really thankful
for the ideas that you shared to him.
Everyone, say goodbye now to Awra.
Do you have any questions? Goodbye Awra!!!
Clarifications?
None Ma’am.
## IV. EVALUATE (5mins.)
Arrange the given data in ascending order, then find the Q1, Q2, Q3. (5 pts. each)
## 1. Given the scores of 10 students in their Mathematics activity.
35, 42, 40, 28, 15, 23, 33, 20, 18, 28
V. EXTEND (2mins.)
## 1. Answer Activity 6: Find Me and Activity 7: How old are you?
Reference: Callanta, Melvin M. et al., Mathematics Learners Module for
2. Study about the Mendenhall and Sincich Method.
Reference: Callanta, Melvin M. et al., Mathematics Learners Module for
Grade 10, page 368 – 372.
Prepared by:
Student Teacher, CBSUA
Checked by:
JESEBEL L. MAGLAPID
Cooperating Teacher, LPNHS
Noted by:
SALVE S. LOMEDA
Mathematics Coordinator, LPNHS
Approved by:
ROSALIND D. BERSABE
Principal 1, LPNHS | 3,162 | 10,677 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.65625 | 4 | CC-MAIN-2019-43 | latest | en | 0.791118 |
https://de.maplesoft.com/support/help/maplesim/view.aspx?path=componentLibrary/multibody/contacts/forces/TorusDiskContact&L=G | 1,582,566,265,000,000,000 | text/html | crawl-data/CC-MAIN-2020-10/segments/1581875145966.48/warc/CC-MAIN-20200224163216-20200224193216-00267.warc.gz | 316,316,913 | 33,004 | Torus Disk Contact - MapleSim Help
Home : Support : Online Help : MapleSim : MapleSim Component Library : Multibody : Contacts : Forces : componentLibrary/multibody/contacts/forces/TorusDiskContact
Torus Disk Contact
Torus-disk contact force model
Description
The Torus Disk Contact model connects Torus and Disk contact elements.
Activation Contact forces are generated only when the contacts are enabled. The active parameter selects how the contacts are enabled. It has the following settings: Always Active, the default, means the contacts are always enabled. Boolean Signal means the contacts are enabled when the enable contact boolean input is true. Start/Stop Time means the contacts are enabled at specified start time, ${T}_{\mathrm{on}}$, and disabled at a specified stop time, ${T}_{\mathrm{off}}$. The on/off parameter is used with the Start/Stop Time selection and has the following settings: Start Time means the contacts are enabled at ${T}_{\mathrm{on}}$. Stop Time means the contacts are disabled at ${T}_{\mathrm{off}}$. Start/Stop Time means the contacts are enabled at ${T}_{\mathrm{on}}$ and disabled at ${T}_{\mathrm{off}}$.
Contact Properties The use record boolean parameter, if enabled, specifies the name of an external record parameter that defines the parameters of the contact. The mode parameter selects one of three modes: Linear spring and damper, Linear spring and limited damper, and Hunt and Crossley. The first two use the $c$ and $d$ parameters to set the spring and damping constants. The Hunt and Crossley model uses the parameters ${c}_{n}$, ${d}_{n}$, $n$, $p$, and $q$. See the Multibody Contact Modes help page for the resulting force equations. The $\mathrm{\mu }$ parameter is the coefficient of friction between contacting bodies. The ${k}_{\mathrm{\mu }}$ parameter is a smoothness coefficient for sliding friction, it scales $\mathrm{\mu }$ by $\mathrm{tanh}\left({k}_{\mathrm{\mu }}\left|{v}_{t}\right|\right)$, where ${v}_{t}$ is the tangential velocity. The $\mathrm{\epsilon }$ parameter specifies a minimum length used when normalizing vectors.
Connections
Name Description Modelica ID ${\mathrm{enable}}_{\mathrm{contact}}$ Optional boolean input; enable contact enable_contact ${\mathrm{port}}_{1}$ Connection to tori port_1 ${\mathrm{port}}_{2}$ Connection to disks port_2
Parameters
Name Default Units Description Modelica ID active Always Active - Selects contact activation active on/off Start Time - Selects start/stop times onoff ${T}_{\mathrm{on}}$ $0$ $s$ On time Ton ${T}_{\mathrm{off}}$ $0$ $s$ Off time Toff use record $\mathrm{false}$ - Use contact properties record useRecord mode Linear spring and damper - Contact force formulation mode $c$ ${10}^{4}$ $\frac{N}{m}$ Spring constant (c>0) c $d$ $0$ $N\frac{s}{m}$ Damping constant d ${c}_{n}$ ${10}^{4}$ - Nonlinear spring constant (cn>0) cn ${d}_{n}$ $0$ - Nonlinear damping constant dn $n$ $1.5$ - Nonlinear elastic force exponent n $p$ $n$ - Nonlinear damping force exponent p $q$ $1$ - Nonlinear damping force exponent q $\mathrm{\mu }$ $0$ - Coefficient of friction mu ${k}_{\mathrm{\mu }}$ $1$ - Smoothness coefficient for sliding friction kTANH $\mathrm{\epsilon }$ $1.{10}^{-6}$ - Minimum length of vectors for normalization eps contact properties - Name of contact property record component conparams ${n}_{\mathrm{torus}}$ $1$ - Number of tori nTorus use torus to torus contact $\mathrm{false}$ - True (checked) means model contacts between tori useTorusTorusContact ${n}_{\mathrm{disk}}$ $1$ - Number of disks nDisk ${k}_{\mathrm{edge}}$ $1000000000$ - Smoothness coefficient for contact behavior near edges Kedge ${k}_{\mathrm{tol}}$ $0.001$ - Tolerance for detecting the special case when the torus is parallel to the plane Ktol ${k}_{\mathrm{conv}}$ $1.{10}^{-9}$ - Error control used in iterative contact point calculations Kconv ${n}_{\mathrm{iter}}$ $1000$ - Maximum number of iterations Niter | 1,026 | 3,944 | {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 64, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.609375 | 3 | CC-MAIN-2020-10 | latest | en | 0.556259 |
https://rdrr.io/cran/nFactors/src/R/nBentler.r | 1,726,797,622,000,000,000 | text/html | crawl-data/CC-MAIN-2024-38/segments/1725700652073.91/warc/CC-MAIN-20240919230146-20240920020146-00881.warc.gz | 443,976,210 | 11,007 | # R/nBentler.r In nFactors: Parallel Analysis and Other Non Graphical Solutions to the Cattell Scree Test
#### Documented in nBentler
#' Bentler and Yuan's Procedure to Determine the Number of Components/Factors
#'
#' This function computes the Bentler and Yuan's indices for determining the
#' number of components/factors to retain.
#'
#' The implemented Bentler and Yuan's procedure must be used with care because
#' the minimized function is not always stable, as Bentler and Yan (1996, 1998)
#' already noted. In many cases, constraints must applied to obtain a solution,
#' as the actual implementation did, but the user can modify these constraints.
#'
#' The hypothesis tested (Bentler and Yuan, 1996, equation 10) is: \cr \cr
#'
#' (1) \eqn{\qquad \qquad H_k: \lambda_{k+i} = \alpha + \beta x_i, (i = 1,
#' \ldots, q)} \cr
#'
#' The solution of the following simultaneous equations is needed to find
#' \eqn{(\alpha, \beta) \in} \cr
#'
#' (2) \eqn{\qquad \qquad f(x) = \sum_{i=1}^q \frac{ [ \lambda_{k+j} - N \alpha
#' + \beta x_j ] x_j}{(\alpha + \beta x_j)^2} = 0} \cr \cr and \eqn{\qquad
#' \qquad g(x) = \sum_{i=1}^q \frac{ \lambda_{k+j} - N \alpha + \beta x_j
#' x_j}{(\alpha + \beta x_j)^2} = 0} \cr
#'
#' The solution to this system of equations was implemented by minimizing the
#' following equation: \cr
#'
#' + g(x)^2}}]} \cr
#'
#' The likelihood ratio test \eqn{LRT} proposed by Bentler and Yuan (1996,
#' equation 7) follows a \eqn{\chi^2} probability distribution with \eqn{q-2}
#' degrees of freedom and is equal to: \cr
#'
#' (4) \eqn{\qquad \qquad LRT = N(k - p)\left\{ {\ln \left( {{n \over N}}
#' \right) + 1} \right\} - N\sum\limits_{j = k + 1}^p {\ln \left\{ {{{\lambda
#' _j } \over {\alpha + \beta x_j }}} \right\}} + n\sum\limits_{j = k + 1}^p
#' {\left\{ {{{\lambda _j } \over {\alpha + \beta x_j }}} \right\}} } \cr
#'
#' With \eqn{p} beeing the number of eigenvalues, \eqn{k} the number of
#' eigenvalues to test, \eqn{q} the \eqn{p-k} remaining eigenvalues, \eqn{N}
#' the sample size, and \eqn{n = N-1}. Note that there is an error in the
#' Bentler and Yuan equation, the variables \eqn{N} and \eqn{n} beeing inverted
#' in the preceeding equation 4.
#'
#' A better strategy proposed by Bentler an Yuan (1998) is to used a minimized
#' \eqn{\chi^2} solution. This strategy will be implemented in a future version
#' of the \pkg{nFactors} package.
#'
#' @param x numeric: a \code{vector} of eigenvalues, a \code{matrix} of
#' correlations or of covariances or a \code{data.frame} of data
#' @param N numeric: number of subjects.
#' @param log logical: if \code{TRUE} does the maximization on the log values.
#' @param alpha numeric: statistical significance level.
#' @param cor logical: if \code{TRUE} computes eigenvalues from a correlation
#' matrix, else from a covariance matrix
#' @param details logical: if \code{TRUE} also returns detains about the
#' computation for each eigenvalue.
#' @param minPar numeric: minimums for the coefficient of the linear trend to
#' maximize.
#' @param maxPar numeric: maximums for the coefficient of the linear trend to
#' maximize.
#' @param ... variable: additionnal parameters to give to the \code{cor} or
#' \code{cov} functions
#' @return \item{nFactors}{ numeric: vector of the number of factors retained
#' by the Bentler and Yuan's procedure. } \item{details}{ numeric: matrix of
#' the details of the computation.}
#' @author Gilles Raiche \cr Centre sur les Applications des Modeles de
#' Reponses aux Items (CAMRI) \cr Universite du Quebec a Montreal\cr
#' \email{raiche.gilles@@uqam.ca}
#' \cr \cr David Magis \cr Departement de mathematiques \cr Universite de Liege
#' \cr \email{David.Magis@@ulg.ac.be}
#' @references Bentler, P. M. and Yuan, K.-H. (1996). Test of linear trend in
#' eigenvalues of a covariance matrix with application to data analysis.
#' \emph{British Journal of Mathematical and Statistical Psychology, 49},
#' 299-312.
#'
#' Bentler, P. M. and Yuan, K.-H. (1998). Test of linear trend in the smallest
#' eigenvalues of the correlation matrix. \emph{Psychometrika, 63}(2), 131-144.
#' @export
# #' @importFrom stats lm
#' @keywords multivariate
#' @examples
#'
#' ## ................................................
#' ## SIMPLE EXAMPLE OF THE BENTLER AND YUAN PROCEDURE
#'
#' # Bentler (1996, p. 309) Table 2 - Example 2 .............
#' n=649
#' bentler2<-c(5.785, 3.088, 1.505, 0.582, 0.424, 0.386, 0.360, 0.337, 0.303,
#' 0.281, 0.246, 0.238, 0.200, 0.160, 0.130)
#'
#' results <- nBentler(x=bentler2, N=n)
#' results
#'
#' plotuScree(x=bentler2, model="components",
#' main=paste(results$nFactors, #' " factors retained by the Bentler and Yuan's procedure (1996, p. 309)", #' sep="")) #' # ........................................................ #' #' # Bentler (1998, p. 140) Table 3 - Example 1 ............. #' n <- 145 #' example1 <- c(8.135, 2.096, 1.693, 1.502, 1.025, 0.943, 0.901, 0.816, 0.790, #' 0.707, 0.639, 0.543, #' 0.533, 0.509, 0.478, 0.390, 0.382, 0.340, 0.334, 0.316, 0.297, #' 0.268, 0.190, 0.173) #' #' results <- nBentler(x=example1, N=n) #' results #' #' plotuScree(x=example1, model="components", #' main=paste(results$nFactors,
#' " factors retained by the Bentler and Yuan's procedure (1998, p. 140)",
#' sep=""))
#' # ........................................................
#'
nBentler <-
function(x, N, log=TRUE, alpha=0.05, cor=TRUE, details=TRUE,
minPar=c(min(lambda) - abs(min(lambda)) +.001, 0.001),
maxPar=c(max(lambda), lm(lambda ~ I(length(lambda):1))$coef[2]), ...) { stopMessage <- paste("\n These indices are only valid with a principal component solution.\n", " ...................... So, only positive eugenvalues are permitted.\n", sep="") lambda <- eigenComputes(x, cor=cor, ...) if (length(which(lambda <0 )) > 0) {cat(stopMessage);stop()} n <- N significance <- alpha min.k <- 3 LRT <- data.frame(q=numeric(length(lambda)-min.k), k=numeric(length(lambda)-min.k), LRT=numeric(length(lambda)-min.k), a=numeric(length(lambda)-min.k), b=numeric(length(lambda)-min.k), p=numeric(length(lambda)-min.k), convergence=numeric(length(lambda)-min.k)) bentler.n <- 0 for (i in 1:(length(lambda)-min.k)) { temp <- bentlerParameters(x=lambda, N=n, nFactors=i, log=log, cor=cor, minPar=minPar, maxPar=maxPar) LRT[i,3] <- temp$lrt
LRT[i,4] <- ifelse(is.null(temp$coef[1]), NA, temp$coef[1])
LRT[i,5] <- ifelse(is.null(temp$coef[2]), NA, temp$coef[2])
LRT[i,6] <- ifelse(is.null(temp$p.value), NA, temp$p.value)
LRT[i,7] <- ifelse(is.null(temp$convergence), NA, temp$convergence)
LRT[i,2] <- i
LRT[i,1] <- length(lambda) - i
}
#LRT <- LRT[order(LRT[,1],decreasing = TRUE),]
for (i in 1:(length(lambda)-min.k)) {
if (i == 1) bentler.n <- bentler.n + as.numeric(LRT$p[i] <= significance) if (i > 1) {if(LRT$p[i-1] <= 0.05) bentler.n <- bentler.n + as.numeric(LRT\$p[i] <= significance)}
}
if (bentler.n == 0) bentler.n <- length(lambda)
if (details == TRUE) details <- LRT else details <- NULL
res <- list(detail=details, nFactors=bentler.n)
class(res) <- c("nFactors","list")
return(res)
}
## Try the nFactors package in your browser
Any scripts or data that you put into this service are public.
nFactors documentation built on Oct. 10, 2022, 5:07 p.m. | 2,342 | 7,268 | {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.25 | 3 | CC-MAIN-2024-38 | latest | en | 0.646341 |
https://www.univerkov.com/the-ax-consists-of-a-wooden-handle-and-a-stone-adze-the-density-of-the-wood-is-600-kg-per-meter-and-the-weight/ | 1,708,932,057,000,000,000 | text/html | crawl-data/CC-MAIN-2024-10/segments/1707947474653.81/warc/CC-MAIN-20240226062606-20240226092606-00185.warc.gz | 1,056,642,658 | 6,377 | # The ax consists of a wooden handle and a stone adze. The density of the wood is 600 kg per meter and the weight
The ax consists of a wooden handle and a stone adze. The density of the wood is 600 kg per meter and the weight of the handle made from it is one-sixth of the mass of the entire ax and the volume of the handle is half of the volume of the entire ax. find the density of the stone from which the adze is made.
Given:
ro1 = 600 kg / m ^ 3 is the density of the tree from which the ax handle is made;
m1 = m / 6 is the mass of the handle in relation to the mass of the ax;
V1 = V / 2 – the volume of the handle in relation to the volume of the ax.
It is required to determine the density of the stone ro2 (kg / m ^ 3), from which the adze is made.
The mass of the wooden handle is:
m1 = ro1 * V1 = ro1 * V / 2. = m / 6, hence:
m = 3 * ro1 * V.
The mass of a stone tesla is:
m2 = 5 * m / 6 = 5 * 3 * ro1 * V / 6 = 5 * ro1 * V / 3.
taking into account that m2 = ro2 * V / 2, then:
ro2 * V / 2 = 5 * ro1 * V / 3;
ro2 / 2 = 5 * ro1 / 3, hence:
ro2 = 10 * ro1 / 3 = 10 * 600/3 = 10 * 200 = 2000 kg / m ^ 3.
Answer: the density of a stone tesla is 2000 kg / m ^ 3.
One of the components of a person's success in our time is receiving modern high-quality education, mastering the knowledge, skills and abilities necessary for life in society. A person today needs to study almost all his life, mastering everything new and new, acquiring the necessary professional qualities. | 455 | 1,496 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 4.125 | 4 | CC-MAIN-2024-10 | latest | en | 0.888233 |
https://www.mrexcel.com/archive/formulas/sumif-with-multiple-criteria-1/ | 1,537,952,131,000,000,000 | text/html | crawl-data/CC-MAIN-2018-39/segments/1537267164469.99/warc/CC-MAIN-20180926081614-20180926102014-00237.warc.gz | 792,186,433 | 9,481 | # Sumif with Multiple Criteria
Posted by Debbie on August 01, 2000 4:44 AM
Will Sumif work with 2 criteria? I have 2 worksheets, the 1st worksheet is a database by tax type for each location and the 2nd worksheet is a journal entry. Basically what I want the formula (on worksheet 2) to do is if:
Worksheet1 A:A = Worksheet2 B1 AND Worksheet1 B:B = Worksheet2 C1, then sum the numbers.
FYI-Column 1 is tax type, (FICA, STATE, etc.) and Column 2 is location. I like to avoid a VB programming situation but I might have to resort to it yet to create this massive journal entry.
Posted by Celia on August 01, 0100 5:42 AM
Debbie
A formula can do it - but what is it that you want to sum?
Celia
Posted by Debbie on August 01, 0100 5:48 AM
Posted by Debbie on August 01, 0100 5:57 AM
I want to pick up the number in D1. The 1st worksheet is coming from our payroll register and is set up like this:
Tax Name Location Amount
FICA 2 10.00
FICA 5 25.00
LIFE 2 2.50
LIFE 5 7.00
What I am trying to do is pick up in a preset report, FICA, Location 2, 10.00. I have used the SUMIF formula to do this when I have 1 criteria, but I have never used multilple criteria to locate the info in column 3. Even in a lookup situation, it would have to look at 2 criteria to chose the right number.
Any suggestions would be helpful as this is a very time consuming entry for a biweekly payroll.
Thanks!
Posted by Celia on August 01, 0100 6:14 AM
Debbie
I'm not sure if this is what you want but if not, it should give you an idea of the formula structure for what you need to do.
Post again if it doesn't.
=SUM(IF((Sheet1!\$A\$1:\$A\$10000=B1)*(Sheet1!\$B\$1:\$B\$10000=C1),1,0)*D1)
Celia
=SUM(IF((Sheet1!\$A\$1:\$A\$10000=B1)*(Sheet1!\$B\$1:\$B\$10000=C1),1,0)*D1)
Posted by Debbie on August 01, 0100 6:32 AM
Bummer, it didn't work. What the the '*' do in the formula? You're still great in my book.
Posted by Celia on August 01, 0100 7:28 AM
Debbie
The "*" basically means "and".
The formula is an array formula. Did you press Ctrl+Shift+Enter?
Celia
Posted by Gary on August 03, 0100 8:22 AM
This is exactly what I'm trying to do also.
I tried it and it didn't work for me either.
Are we missing something subtle in the syntax?
Gary
Posted by Celia on August 03, 0100 4:52 PM
Gary
Unfortunately, I don't understand what it is you're trying to do.
If you wish, you can send me a sample workbook.
Celia | 740 | 2,407 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.296875 | 3 | CC-MAIN-2018-39 | longest | en | 0.934223 |
https://termpaperspro.com/2021/07/09/assignment-2-working-with-real-numbers-operations-with-real-numbers-involve-add/ | 1,653,460,097,000,000,000 | text/html | crawl-data/CC-MAIN-2022-21/segments/1652662580803.75/warc/CC-MAIN-20220525054507-20220525084507-00710.warc.gz | 586,496,570 | 8,850 | # Assignment 2 Working with Real Numbers Operations with real numbers involve add
Assignment 2: Working with Real Numbers
Operations with real numbers involve adding, subtracting, multiplying, and dividing different combinations of positive and negative numbers. For this discussion assignment, you will need to review the rules for adding, subtracting, multiplying, and dividing real numbers. These rules are briefly covered in the module 1 overview and are more completely covered in chapter 10 in the textbook.
In this Discussion Area, complete the following:
Select 1 problem from each of the following exercise sets in the textbook:
10.2 Exercise Set
10.3 Exercise Set
10.4 Exercise Set
10.5 Exercise Set
Note: Try to select different problems from those selected by your classmates!
Work out each of the problems that you selected and post them to the discussion area below. You have a number of options for doing this:
You can work out the problems in the discussion box.
You can work the problems out in a Word document and attach them to the discussion box.
You can work the problems out on a piece of paper, scan into an image file, and then attach it to the discussion box.
What steps did you follow to find the solution?
Did you encounter any difficulties solving the problem?
If you encountered problems, what resources did you access or use to help you solve this problem?
What did you need to know or understand to solve the problem?
What advice can you provide for someone who has difficulties solving similar problems?
Post your response to the Discussion Area by Saturday, February 18, 2017. You should also review and comment on the responses of two other students by Wednesday, February 22, 2017.
Please read and review the following material prior to posting your response. You’re encouraged to consult a tutor (using the Tutor button at the top of the classroom) to help your understanding of the concepts or to vet your response before posting it.
Published | 409 | 1,988 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.890625 | 3 | CC-MAIN-2022-21 | latest | en | 0.92231 |
https://groups.yahoo.com/neo/groups/primenumbers/conversations/messages/22306 | 1,498,623,454,000,000,000 | text/html | crawl-data/CC-MAIN-2017-26/segments/1498128322320.8/warc/CC-MAIN-20170628032529-20170628052529-00011.warc.gz | 742,699,834 | 19,260 | Expand Messages
• Dec 28, 2010
yes, the decades =1 (mod 3) contain about twice as much primes as the
others, i.e. about half of the primes.
Prime sieving "wheels" do commonly use the fact that primes >5 must equal
1,7,11,13, 17,19, 23, 29 (mod 30)
and they are roughly equally distributed among these 8 possible residues
of which 4 are in the decades you mention.
Maximilian
On Wed, Dec 29, 2010 at 12:36 AM, rupert.wood@...
<rupert.weather@...> wrote:
> I suspect this has been addressed somewhere. But here goes, anyway.
>
> In asymptotic (ratio) terms, are the decades 10-19, 40-49, 70-79, ... (which of course have no 3-divisors in the odd numbers except "at 5") any more likely to contain more primes than the other decades? I would guess that this is not so.
>
• Show all 6 messages in this topic | 241 | 804 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.609375 | 3 | CC-MAIN-2017-26 | latest | en | 0.934165 |
http://www.statemaster.com/encyclopedia/Associative | 1,571,325,120,000,000,000 | text/html | crawl-data/CC-MAIN-2019-43/segments/1570986675409.61/warc/CC-MAIN-20191017145741-20191017173241-00387.warc.gz | 330,140,108 | 11,437 | FACTOID # 14: North Carolina has a larger Native American population than North Dakota, South Dakota and Montana combined.
Home Encyclopedia Statistics States A-Z Flags Maps FAQ About
WHAT'S NEW RELATED ARTICLES People who viewed "Associative" also viewed:
SEARCH ALL
Search encyclopedia, statistics and forums:
(* = Graphable)
Encyclopedia > Associative
In mathematics, associativity is a property that a binary operation can have. It means that the order of evaluation is immaterial if the operation appears more than once in an expression. Put another way, no parentheses are required for an associative operation. Consider for instance the equation
(5+2)+1 = 5+(2+1)
Adding 5 and 2 gives 7, and adding 1 gives an end result of 8 for the left hand side. To evaluate the right hand side, we start with adding 2 and 1 giving 3, and then add 5 and 3 to get 8, again. So the equation holds true. In fact, it holds true for all real numbers, not just for 5, 2 and 1. We say that "addition of real numbers is an associative operation".
Associative operations are abundant in mathematics, and in fact most algebraic structures explicitly require their binary operations to be associative.
Contents
Formally, a binary operation * on a set S is called associative if it satisfies the associative law:
The evaluation order doesn't affect the value of such expressions, and it can be shown that the same holds for expressions containing any number of * operations. The evaluation order can therefore be left unspecified without causing ambiguity, by omitting the parentheses and writing simply:
x * y * z.
## Examples
Some examples of associative operations include the following.
• Addition and multiplication of complex numbers and quaternions is associative. Addition of octonions is also associative, but multiplication of octonions is non_associative.
• If M is some set and S denotes the set of all functions from M to M, then the operation of functional composition on S is associative:
## Non-associativity
A binary operation * on a set S that does not satisfy the associative law is called non-associative. Symbolically,
For such an operation the order of evaluation does matter. Subtraction, division and exponentiation are well_known examples of non_associative operations:
In general, parentheses must be used to indicate the order of evaluation if a non_associative operation appears more than once in an expression. However, mathematicians agree on a particular order of evaluation for several common non_associative operations. This has the status of a convention, not of a mathematical truth.
A left_associative operation is a non_associative operation that is conventionally evaluated from left to right, i.e.,
while a right_associative operation is conventionally evaluated from right to left:
Both left_associative and right_associative operations occur; examples are given below.
## More examples
Left_associative operations include the following.
• Subtraction and division of real numbers:
Right_associative operations include the following.
The reason exponentiation is right-associative is that a repeated left-associative exponentiation operation would be less useful. Multiple appearances could (and would) be rewritten with multiplication:
(xy)z = x(yz).
x = y = z; means x = (y = z); and not (x = y) = z;
In other words, the statement would assign the value of z to both x and y.
Non-associative operations for which no conventional evaluation order is defined include the following.
• Taking the pairwise average of real numbers:
The green part in the left Venn diagram represents (A B) C. The green part in the right Venn diagram represents A (B C)
Results from FactBites:
Associativity (1289 words) Note that the dual of an associative composition is associative. Before going on to combine associativity and identifiability to obtain a category, pause to consider something associativity alone allows us to say about null identities in an arrow land. Associativity is just the property needed to ensure that these are equal.
PlanetMath: associative (120 words) Examples of associative operations are addition and multiplication over the integers (or reals), or addition or multiplication over This is version 6 of associative, born on 2002-02-18, modified 2002-03-03. Object id is 2150, canonical name is Associative.
More results at FactBites »
Share your thoughts, questions and commentary here | 943 | 4,464 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 4.15625 | 4 | CC-MAIN-2019-43 | latest | en | 0.906146 |
https://brilliant.org/problems/an-algebra-problem-by-novril-razenda/ | 1,529,605,164,000,000,000 | text/html | crawl-data/CC-MAIN-2018-26/segments/1529267864256.26/warc/CC-MAIN-20180621172638-20180621192638-00511.warc.gz | 554,919,073 | 10,678 | # An algebra problem [Romania 1974]
Algebra Level 2
$\large \sqrt{a+bx} + \sqrt{b+cx} + \sqrt{c+ax} = \sqrt{b-ax} + \sqrt{c-bx} +\sqrt{a-cx}$
Let $$a,b$$ and $$c$$ be real and positive parameters. Solve the equation above. What is the value of $$x$$?
× | 98 | 256 | {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.65625 | 3 | CC-MAIN-2018-26 | latest | en | 0.526335 |
https://gmatclub.com/forum/after-the-communist-revolution-in-china-the-communist-party-embodied-278666.html | 1,571,290,045,000,000,000 | text/html | crawl-data/CC-MAIN-2019-43/segments/1570986672723.50/warc/CC-MAIN-20191017045957-20191017073457-00327.warc.gz | 523,100,247 | 146,767 | GMAT Question of the Day - Daily to your Mailbox; hard ones only
It is currently 16 Oct 2019, 22:27
### 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
# After the Communist Revolution in China, the Communist Party embodied
Author Message
TAGS:
### Hide Tags
Math Expert
Joined: 02 Sep 2009
Posts: 58390
After the Communist Revolution in China, the Communist Party embodied [#permalink]
### Show Tags
10 Oct 2018, 04:39
00:00
Difficulty:
15% (low)
Question Stats:
86% (00:57) correct 14% (01:26) wrong based on 93 sessions
### HideShow timer Statistics
After the Communist Revolution in China, the Communist Party embodied the dominant ideology of the Chinese, replacing older ideologies and political systems.
(A) embodied the dominant ideology of the Chinese, replacing older ideologies
(B) embodied the dominant ideology of the Chinese, replacing ideologies that were older
(C) embodies the dominant ideology of the Chinese and it replaced older ideologies
(D) embodies the dominant ideology of the Chinese and it replaced ideologies that were older
(E) embodies the dominant ideology of the Chinese, having replaced ideologies that were older
_________________
Director
Joined: 19 Oct 2013
Posts: 517
Location: Kuwait
GPA: 3.2
WE: Engineering (Real Estate)
After the Communist Revolution in China, the Communist Party embodied [#permalink]
### Show Tags
10 Oct 2018, 09:17
(A) embodied the dominant ideology of the Chinese, replacing older ideologies
(B) embodied the dominant ideology of the Chinese, replacing ideologies that were older
(C) embodies the dominant ideology of the Chinese and it replaced older ideologies
(D) embodies the dominant ideology of the Chinese and it replaced ideologies that were older
(E) embodies the dominant ideology of the Chinese, having replaced ideologies that were older
The question talks about what happened after something.. so it should be in the past tense. only A and B fit that.
A
Board of Directors
Status: QA & VA Forum Moderator
Joined: 11 Jun 2011
Posts: 4782
Location: India
GPA: 3.5
Re: After the Communist Revolution in China, the Communist Party embodied [#permalink]
### Show Tags
10 Oct 2018, 09:27
Bunuel wrote:
After the Communist Revolution in China, the Communist Party embodied the dominant ideology of the Chinese, replacing older ideologies and political systems.
(A) embodied the dominant ideology of the Chinese, replacing older ideologies
(B) embodied the dominant ideology of the Chinese, replacing ideologies that were older
(C) embodies the dominant ideology of the Chinese and it replaced older ideologies
(D) embodies the dominant ideology of the Chinese and it replaced ideologies that were older
(E) embodies the dominant ideology of the Chinese, having replaced ideologies that were older
Nothing wrong with the Original sentence, correct Answer must be (A), errors in other options marked in Red.
_________________
Thanks and Regards
Abhishek....
PLEASE FOLLOW THE RULES FOR POSTING IN QA AND VA FORUM AND USE SEARCH FUNCTION BEFORE POSTING NEW QUESTIONS
How to use Search Function in GMAT Club | Rules for Posting in QA forum | Writing Mathematical Formulas |Rules for Posting in VA forum | Request Expert's Reply ( VA Forum Only )
Math Expert
Joined: 02 Sep 2009
Posts: 58390
Re: After the Communist Revolution in China, the Communist Party embodied [#permalink]
### Show Tags
11 Oct 2018, 03:33
Bunuel wrote:
After the Communist Revolution in China, the Communist Party embodied the dominant ideology of the Chinese, replacing older ideologies and political systems.
(A) embodied the dominant ideology of the Chinese, replacing older ideologies
(B) embodied the dominant ideology of the Chinese, replacing ideologies that were older
(C) embodies the dominant ideology of the Chinese and it replaced older ideologies
(D) embodies the dominant ideology of the Chinese and it replaced ideologies that were older
(E) embodies the dominant ideology of the Chinese, having replaced ideologies that were older
MANHATTAN REVIEW OFFICIAL EXPLANATION:
There must be tense agreement in sentences. Both events are in the past, so you must use the past tense of ‘embody’, ‘embodied’. That leaves choices A and B. Choice A is shorter and simpler than B. Choice A is the correct answer.
_________________
Re: After the Communist Revolution in China, the Communist Party embodied [#permalink] 11 Oct 2018, 03:33
Display posts from previous: Sort by | 1,060 | 4,899 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.953125 | 3 | CC-MAIN-2019-43 | latest | en | 0.915233 |
http://www.bkgm.com/rgb/rgb.cgi?view+1128 | 1,539,592,894,000,000,000 | text/html | crawl-data/CC-MAIN-2018-43/segments/1539583508988.18/warc/CC-MAIN-20181015080248-20181015101748-00202.warc.gz | 424,874,140 | 4,564 | GNU Backgammon
Quasi-random dice in rollouts
From: Ian Shaw Address: ian.shaw@iee.org Date: 3 March 2004 Subject: Re: gnubg quasi-random dice Forum: GammOnLine
```Here is Joern's explanation from the gnubg archives.
Quasi-Random Dice are used to reduce the element of luck in rollouts.
Instead of selecting purely random dice, gnubg will ensure a uniform
distribution of the first roll of the rollout. If 36 trials is requested,
one game will start with 11, two games with 21, two games with 31, etc.
In general, if n * 36 games is requested, n games will start with 11, 2*n
games with 21 etc. This is called _rotation_ of the first roll. Similarly,
if n*1296 trials is requested, the second roll will be rotated, such that
n games will start with 11-11, 2*n games with 11-21, 4*n games with 21-21,
etc. The third roll be also be rotated if the number of trials is
proportional to 46656.
Suppose a user stops a 1296 trial rollout after 36 games. The 36 games
would have had the following rolls for the first two rolls of each game:
11-11, 21-11, 12-11, 31-11, 13-11, ..., 66-11 Obviously such a rollout
will give skewed results since the second roll was 11 for all games! To
avoid this problem gnubg will randomise the sequence of rolls such that
it is guaranteed that for any sample of 36 games you have exactly one
game with first roll 11, exactly one game with second roll 11, etc. This
is called _stratification_.
gnubg will actually also rotate and stratify rollouts where the number
of trials are not multiples of 36, 1296, etc. The distribution of rolls
is obviously not uniform any longer in this case, but it will still
provide some reduction of the luck, i.e., no 37 trial rollout will have
3 games with a initial 66.
```
### GNU Backgammon
Analyzing GamesGrid matches (Roy Passfield, Dec 2001)
Batch analysis tool (Øystein Johansen, June 2004)
Cache size (Ned Cross+, Mar 2004)
Compiling for Windows (Øystein Johansen, Jan 2002)
Edit mode removing checker from bar (Scott Steiner+, May 2003)
Entering an annotated match (Albert Silver, Dec 2003)
Error rates: Gnu vs. Snowie (Raccoon, Mar 2006)
Even-ply/odd-ply effect (Raccoon, Nov 2004)
Even-ply/odd-ply effect (Tom Keith+, Oct 2003)
Even-ply/odd-ply effect (Scott Steiner+, Dec 2002)
Filter settings (Robert-Jan Veldhuizen, Nov 2004)
Gnu 0.13 versus Jellyfish and Snowie (Torsten Schoop, Aug 2003)
Gnu 0.13 vs. Snowie 4 (Albert Silver, June 2003)
Gnu 0.14 vs. Jellyfish (Michael Howard+, July 2003)
Gnu versus Snowie and Jellyfish (Michael Depreli, Oct 2005)
How luck factor is calculated (Gregg Cattanach, Aug 2002)
How rollouts work (Gary Wong, July 1999)
How to enter an illegal move (Øystein Johansen, Aug 2003)
Importing .gam files (PAR+, Mar 2005)
Importing PartyGammon matches (rew+, July 2006)
Improving your game using GnuBG (D.U.G.+, Nov 2002)
Installing on Windows (maareyes, Oct 2001)
Interpreting JSD's (Adrian Wright+, Feb 2005)
JSD's and confidence intervals (Daniel Murphy+, Jan 2005)
Logging rollouts (Øystein Johansen, Oct 2004)
Luck rate (Kees van den Doel+, May 2002)
MWC versus Equity (EMG) (Ken+, Apr 2005)
Manually entering first roll (Andreas Graf+, Apr 2005)
Match equity tables (Raccoon, July 2005)
Personal reflections (Louis Nardy Pillards, Sept 2002)
Playing two computers against each other (Stanley E. Richards+, Mar 2008)
Python scripting (Øystein Johansen+, Nov 2004)
Quasi-random dice in rollouts (Ian Shaw, Mar 2004)
Question marks in game list (Jim Segrave, July 2005)
Questions and answers (Jim Segrave+, Jan 2003)
Questions and answers (Jørn Thyssen, Aug 2002)
Restarting a rollout with different settings (Jim Segrave, Apr 2005)
Restarting a rollout with different settings (Robert-Jan Veldhuizen, Apr 2004)
Rollout settings (geoff arnold+, Apr 2007)
Rollout settings (Stick+, Nov 2005)
Rollout settings (Robert-Jan Veldhuizen, Mar 2004)
Rollout settings (Ian Dunstan, Aug 2003)
Rollout settings for the impatient (Robert-Jan Veldhuizen, June 2004)
Running rollouts in background (Bruce+, Apr 2004)
Saving rollout results from command-line interface (Jeremy Bagai+, Apr 2006)
Saving rollouts (Mislav Radica+, May 2006)
Setting GnuBG's playing strength (JP White, Sept 2001)
Setting skill level (Jim Segrave, Apr 2004)
Setting up and saving a rollout (Albert Silver, Dec 2003)
What's GNU? (Gary Wong, Oct 2001)
Which player is player 0? (Neil Kazaross+, Oct 2004)
Book Suggestions Books Cheating Chouettes Computer Dice Cube Handling Cube Handling in Races Equipment Etiquette Extreme Gammon Fun and frustration GNU Backgammon History Jellyfish Learning Luck versus Skill Magazines & E-zines Match Archives Match Equities Match Play Match Play at 2-away/2-away Miscellaneous Opening Rolls Pip Counting Play Sites Probability and Statistics Programming Propositions Puzzles Ratings Rollouts Rules Rulings Snowie Software Source Code Strategy--Backgames Strategy--Bearing Off Strategy--Checker play Terminology Theory Tournaments Uncategorized Variations | 1,453 | 5,016 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.734375 | 3 | CC-MAIN-2018-43 | longest | en | 0.911403 |
http://gdevtest.geeksforgeeks.org/find-the-repeating-and-the-missing-number-using-two-equations/ | 1,555,733,560,000,000,000 | text/html | crawl-data/CC-MAIN-2019-18/segments/1555578528523.35/warc/CC-MAIN-20190420040932-20190420062932-00088.warc.gz | 66,517,521 | 24,102 | # Find the repeating and the missing number using two equations
Given an array arr[] of size N, each integer from the range [1, N] appears exactly once except A which appears twice and B which is missing. The task is to find the numbers A and B.
Examples:
Input: arr[] = {1, 2, 2, 3, 4}
Output:
A = 2
B = 5
Input: arr[] = {5, 3, 4, 1, 1}
Output:
A = 1
B = 2
## Recommended: Please try your approach on {IDE} first, before moving on to the solution.
Approach: From the sum of first N natural numbers,
SumN = 1 + 2 + 3 + … + N = (N * (N + 1)) / 2
And, let the sum of all the array elements be Sum. Now,
SumN = Sum – A + B
A – B = Sum – SumN …(equation 1)
And from the sum of the squares of first N natural numbers,
SumSqN = 12 + 22 + 32 + … + N2 = (N * (N + 1) * (2 * n + 1)) / 6
And, let the sum of the squares of all the array elements be SumSq. Now,
SumSq = SumSqN + A2 – B2
SumSq – SumSqN = (A + B) * (A – B) …(equation 2)
Put value of (A – B) from equation 1 in equation 2,
SumSq – SumSqN = (A + B) * (Sum – SumN)
A + B = (SumSq – SumSqN) / (Sum – SumN) …(equation 3)
Solving equation 1 and equation 3 will give,
B = (((SumSq – SumSqN) / (Sum – SumN)) + SumN – Sum) / 2
And, A = Sum – SumN + B
Below is the implementation of the above approach:
## C++
`//C++ implementation of the approach ` ` ` `#include ` `#include ` `#include ` ` ` `using` `namespace` `std; ` ` ` ` ``// Function to print the required numbers ` ` ``void` `findNumbers(``int` `arr[], ``int` `n) ` ` ``{ ` ` ` ` ``// Sum of first n natural numbers ` ` ``int` `sumN = (n * (n + 1)) / 2; ` ` ` ` ``// Sum of squares of first n natural numbers ` ` ``int` `sumSqN = (n * (n + 1) * (2 * n + 1)) / 6; ` ` ` ` ``// To store the sum and sum of squares ` ` ``// of the array elements ` ` ``int` `sum = 0, sumSq = 0, i; ` ` ` ` ``for` `(i = 0; i < n; i++) { ` ` ``sum += arr[i]; ` ` ``sumSq = sumSq + (``pow``(arr[i], 2)); ` ` ``} ` ` ` ` ``int` `B = (((sumSq - sumSqN) / (sum - sumN)) + sumN - sum) / 2; ` ` ``int` `A = sum - sumN + B; ` ` ``cout << ``"A = "` `; ` ` ``cout << A << endl; ` ` ``cout << ``"B = "` `; ` ` ``cout << B << endl; ` ` ``} ` ` ` ` ``// Driver code ` `int` `main() { ` ` ``int` `arr[] = { 1, 2, 2, 3, 4 }; ` ` ``int` `n = ``sizeof``(arr)/``sizeof``(arr[0]); ` ` ``findNumbers(arr, n); ` ` ``return` `0; ` `} `
## Java
`// Java implementation of the approach ` `public` `class` `GFG { ` ` ` ` ``// Function to print the required numbers ` ` ``static` `void` `findNumbers(``int` `arr[], ``int` `n) ` ` ``{ ` ` ` ` ``// Sum of first n natural numbers ` ` ``int` `sumN = (n * (n + ``1``)) / ``2``; ` ` ` ` ``// Sum of squares of first n natural numbers ` ` ``int` `sumSqN = (n * (n + ``1``) * (``2` `* n + ``1``)) / ``6``; ` ` ` ` ``// To store the sum and sum of squares ` ` ``// of the array elements ` ` ``int` `sum = ``0``, sumSq = ``0``, i; ` ` ` ` ``for` `(i = ``0``; i < n; i++) { ` ` ``sum += arr[i]; ` ` ``sumSq += Math.pow(arr[i], ``2``); ` ` ``} ` ` ` ` ``int` `B = (((sumSq - sumSqN) / (sum - sumN)) + sumN - sum) / ``2``; ` ` ``int` `A = sum - sumN + B; ` ` ``System.out.println(``"A = "` `+ A + ``"\nB = "` `+ B); ` ` ``} ` ` ` ` ``// Driver code ` ` ``public` `static` `void` `main(String[] args) ` ` ``{ ` ` ``int` `arr[] = { ``1``, ``2``, ``2``, ``3``, ``4` `}; ` ` ``int` `n = arr.length; ` ` ` ` ``findNumbers(arr, n); ` ` ``} ` `} `
## Python3
`# Python3 implementation of the approach ` ` ` `import` `math ` `# Function to print the required numbers ` `def` `findNumbers(arr, n): ` ` ` ` ` ` ``# Sum of first n natural numbers ` ` ``sumN ``=` `(n ``*` `(n ``+` `1``)) ``/` `2``; ` ` ` ` ``# Sum of squares of first n natural numbers ` ` ``sumSqN ``=` `(n ``*` `(n ``+` `1``) ``*` `(``2` `*` `n ``+` `1``)) ``/` `6``; ` ` ` ` ``# To store the sum and sum of squares ` ` ``# of the array elements ` ` ``sum` `=` `0``; ` ` ``sumSq ``=` `0``; ` ` ` ` ``for` `i ``in` `range``(``0``,n): ` ` ``sum` `=` `sum` `+` `arr[i]; ` ` ``sumSq ``=` `sumSq ``+` `(math.``pow``(arr[i], ``2``)); ` ` ` ` ` ` ``B ``=` `(((sumSq ``-` `sumSqN) ``/` `(``sum` `-` `sumN)) ``+` `sumN ``-` `sum``) ``/` `2``; ` ` ``A ``=` `sum` `-` `sumN ``+` `B; ` ` ``print``(``"A = "``,``int``(A)) ; ` ` ``print``(``"B = "``,``int``(B)); ` ` ` ` ` `# Driver code ` ` ` `arr ``=` `[ ``1``, ``2``, ``2``, ``3``, ``4` `]; ` `n ``=` `len``(arr); ` `findNumbers(arr, n); ` ` ` `#This code is contributed by Shivi_Aggarwal `
## C#
`// C# implementation of the approach ` `using` `System; ` `public` `class` `GFG { ` ` ` ` ``// Function to print the required numbers ` ` ``static` `void` `findNumbers(``int` `[]arr, ``int` `n) ` ` ``{ ` ` ` ` ``// Sum of first n natural numbers ` ` ``int` `sumN = (n * (n + 1)) / 2; ` ` ` ` ``// Sum of squares of first n natural numbers ` ` ``int` `sumSqN = (n * (n + 1) * (2 * n + 1)) / 6; ` ` ` ` ``// To store the sum and sum of squares ` ` ``// of the array elements ` ` ``int` `sum = 0, sumSq = 0, i; ` ` ` ` ``for` `(i = 0; i < n; i++) { ` ` ``sum += arr[i]; ` ` ``sumSq += (``int``)Math.Pow(arr[i], 2); ` ` ``} ` ` ` ` ``int` `B = (((sumSq - sumSqN) / (sum - sumN)) + sumN - sum) / 2; ` ` ``int` `A = sum - sumN + B; ` ` ``Console.WriteLine(``"A = "` `+ A + ``"\nB = "` `+ B); ` ` ``} ` ` ` ` ``// Driver code ` ` ``public` `static` `void` `Main() ` ` ``{ ` ` ``int` `[]arr = { 1, 2, 2, 3, 4 }; ` ` ``int` `n = arr.Length; ` ` ` ` ``findNumbers(arr, n); ` ` ``} ` `} ` `// This code is contributed by PrinciRaj1992 `
## PHP
` `
Output:
```A = 2
B = 5
```
My Personal Notes arrow_drop_up | 2,458 | 6,182 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 3.890625 | 4 | CC-MAIN-2019-18 | latest | en | 0.684603 |
https://swiftacademicpapers.com/1-a-continuous-signal-is-monitored-with-labview-the-figure-on-the-right-shows-the-co-3119445/ | 1,618,083,499,000,000,000 | text/html | crawl-data/CC-MAIN-2021-17/segments/1618038057476.6/warc/CC-MAIN-20210410181215-20210410211215-00251.warc.gz | 652,310,707 | 16,090 | # 1 A Continuous Signal Is Monitored With Labview The Figure On The Right Shows The Co 3119445
1. A continuous signal is monitored with LabVIEW, the figure on the right shows the continuous signal acquired with a sufficiently high sampling rate to represent it correctly while the FFT magnitude vs. frequency shows the frequency content from a sampling of the signal at sampling rate (fs) less than the Nyquist frequency requirement. Determine the following 5.5 The input signal frequency, fm a. 02 04 06 08 Time b. The sinusoid equation that describes input signal: c. What should be the lowest sampling frequency, f, to satisfy the Nyquist Theorem to correctly capture the frequency information of the input signal? FFT d. Does the FFT result show an alias frequency fa or the correct signal frequency fm? i. if yes T i. if no fm= Freq. [Hz] be if fm is the value What would the alias frequency found for part a (show your calculations for each) 2. An electrical (RC) circuit which can be modeled as a 1^ft order system is initially at 0.05 VDC due to the capacitor not being fully discharge. At time, t=0 sec, the supply voltage (Vs) is switched on to 5VDC. A voltmeter monitors the voltage across (Vo) the capacitor and at time, t=2 seconds, it records a voltage of 2.5 VDC Assume the voltmeter has a faster response time than the RC circuit. the input signal and the estimate of the circuit’s response w.r.t. time. What is the circuit’s time constant, x? How long would it take for the voltage across the capacitor to reach 4.5 Volts?
Attachments: | 370 | 1,554 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.90625 | 3 | CC-MAIN-2021-17 | latest | en | 0.883098 |
https://uk.mathworks.com/matlabcentral/cody/problems/2070-the-prisoner/solutions/378585 | 1,607,139,251,000,000,000 | text/html | crawl-data/CC-MAIN-2020-50/segments/1606141746033.87/warc/CC-MAIN-20201205013617-20201205043617-00438.warc.gz | 455,901,780 | 16,990 | Cody
# Problem 2070. The prisoner
Solution 378585
Submitted on 5 Jan 2014 by Jean
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.
### Test Suite
Test Status Code Input and Output
1 Pass
%% x = 1; y_correct = false; assert(isequal(prisoner(x),y_correct))
2 Pass
%% x = [1 2 3]; y_correct = false; assert(isequal(prisoner(x),y_correct))
3 Pass
%% x = '7th son' y_correct = true; assert(isequal(prisoner(x),y_correct))
x = 7th son
4 Pass
%% x = '7' y_correct = false; assert(isequal(prisoner(x),y_correct))
x = 7
5 Pass
%% x = '7777777' y_correct = false; assert(isequal(prisoner(x),y_correct))
x = 7777777
6 Pass
%% x = 'prisoner'; y_correct = true; assert(isequal(prisoner(x),y_correct))
### Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting! | 270 | 899 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.8125 | 3 | CC-MAIN-2020-50 | latest | en | 0.477811 |
https://www.shubhamkarn.com.np/2022/02/convert-pe-to-sq-feet-conversion-online.html | 1,709,579,999,000,000,000 | text/html | crawl-data/CC-MAIN-2024-10/segments/1707947476464.74/warc/CC-MAIN-20240304165127-20240304195127-00790.warc.gz | 979,957,906 | 29,677 | In this post we are with smart online Pe to Square Feet converter/calculator. You can also use this Pe to Square Feet conversion tool to convert to other equivalent units. To use this land/area converter/calculator, select base unit and final unit and enter the value. You will get the result. Share if you like it.
Some Quick Conversion Rates of Pe to Other Units
1 Pe = 0.0001 Le 1 Pe = 0.0003 Kah 1 Pe = 0.0034 Hun 1 Pe = 0.0333 Bo 1 Pe = 33057.8512 Sq. Centimeters 1 Pe = 35.5832 Sq. Feet 1 Pe = 3.9537 Sq. Yards 1 Pe = 0.0003 Hectares 1 Pe = 0.0008 Acres 1 Pe = 3.3058 Sq. Meters 1 Pe = 0.0817 Cent
Pe is a traditional unit of measurement of land area commonly in use in Taiwan. It is known as phing in hakka and png in mandarin. It symbol is 坪.. It is similar to the japanese tsubo. It is quite small in value considering the other traditional units of area measurement in Taiwan. Being a traditional unit people want to know the value of pe in standard units and hence they ask questions like 1 pe is equal to how many square feet? Or 1 pe is equal to how many square meters? Or 1 hectare consists of how many pe ? or how many pe make an Acre ?
Now 1 pe = 400/121 m² to be exact. .
35. 58 square feet is 3. 305 square meters.
Some Quick Conversion Rates of Other Units to Pe
1 Le = 14670.0 Pe 1 Kah = 2934.0 Pe 1 Hun = 293.4 Pe 1 Bo = 30.0 Pe 1 Sq. Feet = 0.0281 Pe 1 Sq. Yards = 0.2529 Pe 1 Hectares = 3025.0 Pe 1 Acres = 1224.1741 Pe 1 Sq. Meters = 0.3025 Pe 1 Sq. Kilometers = 302500.0 Pe 1 Sq. Miles = 783471.4034 Pe 1 Cent = 12.2417 Pe
Pe to Sq. Feet Conversion Table
PeSq. FeetPeSq. Feet
1 Pe 35.5832 Sq. 61 Pe 2170.5737 Sq.
2 Pe 71.1663 Sq. 62 Pe 2206.1568 Sq.
3 Pe 106.7495 Sq. 63 Pe 2241.74 Sq.
4 Pe 142.3327 Sq. 64 Pe 2277.3232 Sq.
5 Pe 177.9159 Sq. 65 Pe 2312.9064 Sq.
6 Pe 213.499 Sq. 66 Pe 2348.4895 Sq.
7 Pe 249.0822 Sq. 67 Pe 2384.0727 Sq.
8 Pe 284.6654 Sq. 68 Pe 2419.6559 Sq.
9 Pe 320.2486 Sq. 69 Pe 2455.2391 Sq.
10 Pe 355.8317 Sq. 70 Pe 2490.8222 Sq.
11 Pe 391.4149 Sq. 71 Pe 2526.4054 Sq.
12 Pe 426.9981 Sq. 72 Pe 2561.9886 Sq.
13 Pe 462.5813 Sq. 73 Pe 2597.5718 Sq.
14 Pe 498.1644 Sq. 74 Pe 2633.1549 Sq.
15 Pe 533.7476 Sq. 75 Pe 2668.7381 Sq.
16 Pe 569.3308 Sq. 76 Pe 2704.3213 Sq.
17 Pe 604.914 Sq. 77 Pe 2739.9045 Sq.
18 Pe 640.4971 Sq. 78 Pe 2775.4876 Sq.
19 Pe 676.0803 Sq. 79 Pe 2811.0708 Sq.
20 Pe 711.6635 Sq. 80 Pe 2846.654 Sq.
21 Pe 747.2467 Sq. 81 Pe 2882.2372 Sq.
22 Pe 782.8298 Sq. 82 Pe 2917.8203 Sq.
23 Pe 818.413 Sq. 83 Pe 2953.4035 Sq.
24 Pe 853.9962 Sq. 84 Pe 2988.9867 Sq.
25 Pe 889.5794 Sq. 85 Pe 3024.5699 Sq.
26 Pe 925.1625 Sq. 86 Pe 3060.153 Sq.
27 Pe 960.7457 Sq. 87 Pe 3095.7362 Sq.
28 Pe 996.3289 Sq. 88 Pe 3131.3194 Sq.
29 Pe 1031.9121 Sq. 89 Pe 3166.9026 Sq.
30 Pe 1067.4952 Sq. 90 Pe 3202.4857 Sq.
31 Pe 1103.0784 Sq. 91 Pe 3238.0689 Sq.
32 Pe 1138.6616 Sq. 92 Pe 3273.6521 Sq.
33 Pe 1174.2448 Sq. 93 Pe 3309.2353 Sq.
34 Pe 1209.8279 Sq. 94 Pe 3344.8184 Sq.
35 Pe 1245.4111 Sq. 95 Pe 3380.4016 Sq.
36 Pe 1280.9943 Sq. 96 Pe 3415.9848 Sq.
37 Pe 1316.5775 Sq. 97 Pe 3451.568 Sq.
38 Pe 1352.1606 Sq. 98 Pe 3487.1511 Sq.
39 Pe 1387.7438 Sq. 99 Pe 3522.7343 Sq.
40 Pe 1423.327 Sq. 100 Pe 3558.3175 Sq.
41 Pe 1458.9102 Sq. 101 Pe 3593.9007 Sq.
42 Pe 1494.4933 Sq. 102 Pe 3629.4838 Sq.
43 Pe 1530.0765 Sq. 103 Pe 3665.067 Sq.
44 Pe 1565.6597 Sq. 104 Pe 3700.6502 Sq.
45 Pe 1601.2429 Sq. 105 Pe 3736.2334 Sq.
46 Pe 1636.826 Sq. 106 Pe 3771.8165 Sq.
47 Pe 1672.4092 Sq. 107 Pe 3807.3997 Sq.
48 Pe 1707.9924 Sq. 108 Pe 3842.9829 Sq.
49 Pe 1743.5756 Sq. 109 Pe 3878.5661 Sq.
50 Pe 1779.1587 Sq. 110 Pe 3914.1492 Sq.
51 Pe 1814.7419 Sq. 111 Pe 3949.7324 Sq.
52 Pe 1850.3251 Sq. 112 Pe 3985.3156 Sq.
53 Pe 1885.9083 Sq. 113 Pe 4020.8988 Sq.
54 Pe 1921.4914 Sq. 114 Pe 4056.4819 Sq.
55 Pe 1957.0746 Sq. 115 Pe 4092.0651 Sq.
56 Pe 1992.6578 Sq. 116 Pe 4127.6483 Sq.
57 Pe 2028.241 Sq. 117 Pe 4163.2315 Sq.
58 Pe 2063.8241 Sq. 118 Pe 4198.8146 Sq.
59 Pe 2099.4073 Sq. 119 Pe 4234.3978 Sq.
60 Pe 2134.9905 Sq. 120 Pe 4269.981 Sq.
We hope you are satisfied with our online Pe to Square Feet unit conversion service. We tried our best to make it mistake free. If you find any mistake please help us by informing it. | 1,783 | 4,165 | {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0} | 2.984375 | 3 | CC-MAIN-2024-10 | latest | en | 0.756613 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.