text:
Non-Programmer's Tutorial for Python 2.6/Boolean Expressions

Here is a little example of boolean expressions (you don't have to type it in):

With the output being:

1 True 2 False 3 True 4 False 5 True 6 True 7 False 8 True 9 False

What is going on? The program consists of a bunch of funny looking  statements. Each  statement prints a number and an expression. The number is to help keep track of which statement I am dealing with. Notice how each expression ends up being either  or. In Python, false can also be written as 0 and true as 1.

The lines:

print out a  and a   respectively just as expected since the first is true and the second is false. The third print,, is a little different. The operator  means if both the statement before and the statement after are true then the whole expression is true otherwise the whole expression is false. The next line,, shows how if part of an   expression is false, the whole thing is false. The behavior of  can be summarized as follows:

Notice that if the first expression is false Python does not check the second expression since it knows the whole expression is false.

The next line,, uses the   operator. just gives the opposite of the expression. (The expression could be rewritten as ). Here is the table:

The two following lines,  and , use the   operator. The  operator returns true if the first expression is true, or if the second expression is true or both are true. If neither are true it returns false. Here's the table:

Notice that if the first expression is true Python doesn't check the second expression since it knows the whole expression is true. This works since  is true if at least one half of the expression is true. The first part is true so the second part could be either false or true, but the whole expression is still true.

The next two lines,  and , show that parentheses can be used to group expressions and force one part to be evaluated first. Notice that the parentheses changed the expression from false to true. This occurred since the parentheses forced the  to apply to the whole expression instead of just the   portion.

Here is an example of using a boolean expression:

And here is the output:

First Match: Jill

This program works by continuing to check for match. When either  is greater than the last index of   or a match has been found the   is no longer true so the loop exits. The  simply checks to make sure that the   exited because a match was found.

The other "trick" of  is used in this example. If you look at the table for  notice that the third entry is "false and won't check". If  (in other words   is false) then   is never looked at. This is because Python knows that if the first is false then they can't both be true. This is known as a short circuit and is useful if the second half of the  will cause an error if something is wrong. I used the first expression to check and see if   was a valid index for. (If you don't believe me remove the matches "Jill" and "Life", check that it still works and then reverse the order of  to  .)

Boolean expressions can be used when you need to check two or more different things at once.

A note on Boolean Operators
A common mistake for people new to programming is a misunderstanding of the way that boolean operators works, which stems from the way the python interpreter reads these expressions. For example, after initially learning about "and " and "or" statements, one might assume that the expression  would check to see if the variable   was equivalent to one of the strings   or. This is not so. To see what I'm talking about, start an interactive session with the interpreter and enter the following expressions:

>>> 'a' == ('a' or 'b') >>> 'b' == ('a' or 'b') >>> 'a' == ('a' and 'b') >>> 'b' == ('a' and 'b')

And this will be the unintuitive result:

>>> 'a' == ('a' or 'b') True >>> 'b' == ('a' or 'b') False >>> 'a' == ('a' and 'b') False >>> 'b' == ('a' and 'b') True

At this point, the  and   operators seem to be broken. It doesn't make sense that, for the first two expressions,  is equivalent to   or   while   is not. Furthermore, it doesn't make any sense that 'b' is equivalent to  and. After examining what the interpreter does with boolean operators, these results do in fact exactly what you are asking of them, it's just not the same as what you think you are asking.

When the Python interpreter looks at an  expression, it takes the first statement and checks to see if it is true. If the first statement is true, then Python returns that object's value without checking the second statement. This is because for an  expression, the whole thing is true if one of the values is true; the program does not need to bother with the second statement. On the other hand, if the first value is evaluated as false Python checks the second half and returns that value. That second half determines the truth value of the whole expression since the first half was false. This "laziness" on the part of the interpreter is called "short circuiting" and is a common way of evaluating boolean expressions in many programming languages.

Similarly, for an  expression, Python uses a short circuit technique to speed truth value evaluation. If the first statement is false then the whole thing must be false, so it returns that value. Otherwise if the first value is true it checks the second and returns that value.

One thing to note at this point is that the boolean expression returns a value indicating  or , but that Python considers a number of different things to have a truth value assigned to them. To check the truth value of any given object, you can use the function   to see its truth value. Below is a table with examples of the truth values of various objects:

Now it is possible to understand the perplexing results we were getting when we tested those boolean expressions before. Let's take a look at what the interpreter "sees" as it goes through that code:

First case: >>> 'a' == ('a' or 'b') # Look at parentheses first, so evaluate expression "('a' or 'b')" # 'a' is a nonempty string, so the first value is True # Return that first value: 'a' >>> 'a' == 'a'          # the string 'a' is equivalent to the string 'a', so expression is True True

Second case: >>> 'b' == ('a' or 'b') # Look at parentheses first, so evaluate expression "('a' or 'b')" # 'a' is a nonempty string, so the first value is True # Return that first value: 'a' >>> 'b' == 'a'          # the string 'b' is not equivalent to the string 'a', so expression is False False

Third case: >>> 'a' == ('a' and 'b') # Look at parentheses first, so evaluate expression "('a' and 'b')" # 'a' is a nonempty string, so the first value is True, examine second value # 'b' is a nonempty string, so second value is True # Return that second value as result of whole expression: 'b' >>> 'a' == 'b'          # the string 'a' is not equivalent to the string 'b', so expression is False False

Fourth case: >>> 'b' == ('a' and 'b') # Look at parentheses first, so evaluate expression "('a' and 'b')" # 'a' is a nonempty string, so the first value is True, examine second value # 'b' is a nonempty string, so second value is True # Return that second value as result of whole expression: 'b' >>> 'b' == 'b'          # the string 'b' is equivalent to the string 'b', so expression is True True

So Python was really doing its job when it gave those apparently bogus results. As mentioned previously, the important thing is to recognize what value your boolean expression will return when it is evaluated, because it isn't always obvious.

Going back to those initial expressions, this is how you would write them out so they behaved in a way that you want:

>>> 'a' == 'a' or 'a' == 'b'  True >>> 'b' == 'a' or 'b' == 'b'  True >>> 'a' == 'a' and 'a' == 'b'  False >>> 'b' == 'a' and 'b' == 'b' False

When these comparisons are evaluated they return truth values in terms of True or False, not strings, so we get the proper results.

Examples
password1.py

Sample runs

What is your name? Josh What is the password? Friday Welcome Josh

What is your name? Bill What is the password? Money I don't know you.

Exercises
Write a program that has a user guess your name, but they only get 3 chances to do so until the program quits.


text:
Using Firefox

This book is designed to help you get the most out of your installation of. Don't have Firefox? You can download it from Mozilla's website.

Contents

 * 1) /Introduction/
 * 2) /Installation/
 * 3) /Browsing with Tabs/
 * 4) Searching and finding within documents
 * 5) User preferences
 * 6) /Extensions/
 * 7) /Plug-ins/
 * 8) /Mouse shortcuts/
 * 9) /Keyboard shortcuts/
 * 10) /Privacy/
 * 11) Advanced configuration
 * 12) Developers tools
 * 13) Creating an extension

 * 1) External Links

Note
While we, the maintainers of this book, strive to future-proof our texts, things can change, and in the software industry, change happens often and quickly before writers have a chance to catch up. For example, this book was written when Firefox was still on Windows XP, an operating system Firefox no longer supports (along with Vista and all operating systems haven't received Firefox updates since August 2018). If you're still on Windows XP or Vista, Mozilla recommends that you upgrade to Windows 7, 8, 10 or 11. Alternatively, you can switch to a Linux distribution.

Edit: On Mozilla Firefox Mozilla Firefox Firefox Mozilla Firefox שימוש בפיירפוקס Firefox Mozilla Firefox คู่มือการใช้ไฟร์ฟอกซ์ Mozilla Firefox January 14th, 2020, Microsoft Stopped Windows 7 Updates. On January 10th, 2023, Microsoft Stopped Windows 8.1 Updates. It Is HIGHLY Recommended To Upgrade To Windows 10 Or 11 Or Switch To A Linux Distro. This Will Let You Keep Getting Updates From Mozilla For Firefox.

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

title: Using Firefox


text:
German/Appendices/Names

Names
This is a list of common, modern German names. Please add to it.

First Names
German names have undergone a drastic change in the last 60 years. Older, "typical" German names like Hans, Fritz, Heinrich, Karl or Wilhelm are now uncommon in contemporary Germany. Today many parents give their children names like (ten most popular names 2005):

(Source: Gesellschaft für deutsche Sprache)

Typical for young people
older names:

 * Alfi, Alfred
 * Adolf (Historically a common name in aristocratic circles; rarely given to newborn boys today due to negative associations with Nazi figures such as Hitler and Eichmann.)
 * Albert, Bert, Kunibert
 * Anton
 * Achim, Joachim
 * Adam
 * Aaron
 * Armin
 * Björn
 * Bernard
 * Bennedikt
 * Bruno
 * Bodo
 * Boris
 * Berthold
 * Benjamin
 * Clemens
 * Carlo, Karlo, Karl
 * Carsten
 * Dieter, Dietrich
 * Daniel
 * Domian, Damian
 * Detlev
 * Dirk
 * Erik
 * Erwin
 * Emil
 * Eberhard
 * Eckart
 * Edmund
 * Ernst
 * Ewald
 * Franz, Frank
 * Fritz
 * Fridolin
 * Fred, Frederik
 * Friedrich, Friedhelm
 * Falko
 * Gustav
 * Gerhardt
 * Gert
 * Günther
 * Gregor
 * Gunnar
 * Hans, Hans-Jürgen, Hannes
 * Harald
 * Heinz
 * Heinrich, Heiner
 * Hugo
 * Hektor
 * Helge
 * Heiko
 * Hartmut
 * Herbert
 * Holger
 * Ingo, Ingolf
 * Jürgen, Jörg
 * Jens
 * Janosch
 * Jakob
 * Johann
 * Karl
 * Klaus
 * Knut
 * Kurt
 * Konrad
 * Kaspar
 * Ludwig
 * Leif
 * Manfred
 * Malte
 * Norbert
 * Nils
 * Olaf
 * Oliver
 * Otto, Ottfried
 * Paul
 * Peter
 * Rudi, Rüdiger, Rudolph
 * Roman
 * Robert
 * Rex
 * Reinhard, Rainer, Reiner
 * Sören
 * Siegfried
 * Sönke
 * Thomas
 * Till
 * Torsten
 * Ulf
 * Ulli
 * Uwe
 * Udo
 * Viktor
 * Werner
 * Wolfgang, Wolf, Welf
 * Wilhelm, Willi

Girls' Names
young ones:

 * Anna, Anne, Annika
 * Amelie
 * Angelina
 * Bianca
 * Christina, Christine
 * Daniela
 * Elea
 * Eva
 * Elisa
 * Emma
 * Emely, Emily
 * Franziska
 * Finja
 * Hannah, Hanna
 * Isabell, Isabelle
 * Julia, Jule, Juliane
 * Jana
 * Janine, Janina
 * Johanna
 * Jasmin
 * Klara
 * Katharina
 * Kim
 * Kira
 * Lena
 * Lara
 * Luise, Luisa
 * Lea
 * Lina
 * Larissa
 * Lisa
 * Lina
 * Leonie
 * Liv
 * Maike, Meike, Mareike
 * Melissa
 * Merle
 * Mercedes
 * Marie
 * Maja
 * Marlene, Marleen
 * Martina
 * Nina
 * Nicole
 * Nora
 * Petra
 * Paula
 * Pia
 * Ronja
 * Svenja
 * Sarah
 * Sofie, Sophie, Sophia
 * Samantha
 * Stella
 * Susie
 * Tabea
 * Tamara
 * Vivien
 * Vanessa

older ones:

 * Angela
 * Anita
 * Andschana
 * Antonia
 * Birgit
 * Brigitte
 * Berta
 * Christa, Christel
 * Doris
 * Diana
 * Fanny
 * Frieda
 * Gerta
 * Gisela
 * Gutrun
 * Hannelore
 * Helga
 * Heidi, Heide
 * Inga, Inge
 * Iris
 * Ilse
 * Ingrid
 * Josephine
 * Karin, Karen
 * Linda
 * Lydia
 * Marta
 * Monika
 * Nadja
 * Olivia
 * Roswitha
 * Renate
 * Susanne
 * Sabine
 * Sissi
 * Simone
 * Silke
 * Tina, Tine
 * Ursula
 * Ulla
 * Vera
 * Veronika
 * Winnifried
 * Wanda
 * Wilhelma

Last Names
The 51. most popular last names in Germany:
 * 1) Müller
 * 2) Schmidt
 * 3) Schneider
 * 4) Fischer
 * 5) Meyer
 * 6) Weber
 * 7) Wagner
 * 8) Becker
 * 9) Schulz
 * 10) Hoffmann
 * 11) Schäfer
 * 12) Koch
 * 13) Bauer
 * 14) Richter
 * 15) Klein
 * 16) Wolf
 * 17) Schröder
 * 18) Neumann
 * 19) Schwarz
 * 20) Zimmermann
 * 21) Braun
 * 22) Krüger
 * 23) Hofmann
 * 24) Hartmann
 * 25) Lange
 * 26) Schmitt
 * 27) Werner
 * 28) Schmitz
 * 29) Krause
 * 30) Meier
 * 31) Lehmann
 * 32) Schmid
 * 33) Schulze
 * 34) Maier
 * 35) Köhler
 * 36) Herrmann
 * 37) König
 * 38) Walter
 * 39) Mayer
 * 40) Huber
 * 41) Kaiser
 * 42) Fuchs
 * 43) Peters
 * 44) Lang
 * 45) Scholz
 * 46) Möller
 * 47) Weiß
 * 48) Jung
 * 49) Hahn
 * 50) Schubert
 * 51) Zächer

title: German/Appendices/Names


text:
User:Perl~enwikibooks/Ellen Foster/art

I have chosen Eugène Delecroix's Orphan Girl in a Cemetery to represent Ellen Foster. This piece of artwork is a perfect illustration of the novel as both the girl in the painting and Ellen are orphans who have spent time in a cemetery. In addition, the girl seems to have just finished crying. After Ellen's mother dies, Ellen must have been in a similar situation. The girl in the painting has an expression of fear (This is similar to the feeling that Ellen experiences she runs away from her father) and seems to be looking at an object, or perhaps a person, who is outside the painting. Perhaps this is representative of her looking into her future wondering what her new life will be like. Ellen was in the same situation. Perhaps Ellen would be looking towards her grandmother (of whom she was very afraid).

External link

 * WebMuseum: Delacroix, Eugène

<< | >>

title: User:Perl~enwikibooks/Ellen Foster/art


text:
User:Perl~enwikibooks/Ellen Foster/poem

 The Street by Octavio Paz

A long and silent street.

I walk in blackness and I stumble and fall

and rise, and I walk blind, my feet

stepping on silent stones and dry leaves.

Someone behind me also stepping on stones, leaves:

if I slow down, he slows:

if I run, he runs. I turn: nobody.

Everything dark and doorless.

Turning and turning among these corners

which lead forever to the street

where I pursue a man who stumbles

and rises and says when he sees be: nobody Octavio Paz's poem The Street is thematically similar to the ideas present in Ellen Foster. In this poem, the narrator describes a long and silent street that he is traversing at night. He adds that he stumbles and falls. In these two lines, the theme of being lost and lonely is very prevalent. This is similar to the feeling that Ellen has after her mother dies. In the next line, the narrator says that he gets back up. The idea that this presents can be equated to the theme of perseverance in Ellen Foster. Soon, the reader becomes aware that the narrator is running away from someone. Ellen spent a great deal of time hiding and running away from her father and his cronies.

<< | >>

title: User:Perl~enwikibooks/Ellen Foster/poem


text:
User talk:Maxpower

Want to work on Electronics:
 * Thevenin and Norton Equivalent Circuits
 * Diodes
 * CMOS (Logic!)

title: User talk:Maxpower


text:
Talk:UK Constitution and Government/Parliament

I am confused by the term "Minister of the Crown". How many of these ministers are there? Do they sit in the Houses of Parliament along with MPs and Lords? I see that the Lord Chancellor is a Minister of the Crown, but who else?

 * There are 90-odd ministers, some more senior than others. They are almost always members of the House of Commons or the House of Lords, and the vast majority are in the House of Commons (so they have to be elected there first).  It is always possible to appoint someone to the House of Lords if necessary.

The section on Speakership in the House of Lords is now wrong; the law was recently ammended, and there is now a speaker of the House of Lords. The Lord Chancellor, whilst still technically holding the title, is usually referred to as 'Secretary of State for Constitutional Affairs' by the Government.

Use of "sovereign"
The use of the word sovereign in this is very confused. The monarch is not the sovereign - the Parliament, including the monarch, is. Although sovereign is indeed a common term used for monarchy, this is not a legally accurate use of the word: in addition, when discussing both sovereignty in terms of the person(s) who are sovereign and in terms of the concept of sovereignty as in the first paragraph, it would be sensible to use an alternative word to describe the former, in order to avoid confusion.


text:
User:Perl~enwikibooks/Ellen Foster/timeline

 * 1) Ellen's mother dies from a self imposed overdose of medication. Ellen's father refuses to take his wife to the hospital making him partly to blame for the death.
 * 2) Ellen is repeatedly sexually and physically abused by her father and his cronies. This forces Ellen to frequently seek refuge in the house of Starletta and her family.
 * 3) Ellen's teacher finds signs of physical abuse on Ellen's arm and she reports this. As a result, Ellen is sent to live with the art teacher Julia and her husband Roy, who are both hippies.
 * 4) Ellen's grandmother sucessfully battles for and gains custody of Ellen in court and Ellen goes to live with this cruel and bitter woman.
 * 5) While Ellen is staying at her grandmother's house, she learns of her father's death but she is not very sad. Her grandmother is angry at this and tells Ellen never to cry again.
 * 6) After Ellen's grandmother dies, Ellen is sent to live with her aunt Nadine, and her cousin Dora who are condescending and rude to Ellen.
 * 7) Ellen arrives at her "new mama's" house where she has good food and positive relationships with the other members of the family.
 * 8) Starletta comes to visit Ellen and Ellen tells Starletta that she loves her and she is sorry that she judged her by her the color of her skin.

These are my predictions for Ellen's future:
 * 1) Ellen graduates high school and goes to college (paid for by her foster parents).
 * 2) At college, Ellen falls in love with a man who is an African American.
 * 3) After Ellen graduates from college, she gets a job as a social worker.
 * 4) She has a child and she names it Starletta.

<< | >>


text:
Electronics/Thevenin/Norton Equivalents

Source Transformation
Any linear time invariant network of impedances can be reduced to one equivalent impedance. In particular, any network of sources and resistors can be reduced to one ideal source and one resistor, in either the Thevenin or Norton configurations. In this way, a complicated network attached to a load resistor can be reduced to a single voltage divider (Thevenin) or current divider (Norton).

Thevenin and Norton equivalents allow a voltage source in series with a resistor to be replaced by a current source in parallel with that exact same resistor (or vice versa.) This is called a source transformation.

The point to be noted is that the block that is replaced with such an equivalent should be linear and time invariant, i.e. a linear change in the electrical source in that block produces a linear change in the equivalent source, and the behavior can be replicated if the initial conditions are replicated. '''The above shown transformation figures are true only if the circuit contains at least one independent voltage or current source. If the circuit comprises only dependent sources then Thevenin (and also Norton) equivalent consists of RTh alone'''

Thevenin Equivalents
The Thevenin equivalent circuit of a (two-terminal) network consists of a voltage source in series with a resistor. The Thevenin equivalent will have the same output voltage and current regardless of what is attached to the terminals.

Techniques For Finding Thevenin Equivalents

 * Network contains no sources (only resistors): The Thevenin resistance is equal to the equivalent resistance of the network. The Thevenin voltage is zero.

 * Basic: Works for any network except one with no independent sources. Find the voltage across the terminals (with positive reference at terminal A) when they are open-circuited.  Find the current from terminal A to terminal B when they are short-circuited.  Then
 * $$R_{th}=\frac{V_{oc}}{I_{sc}}$$

The Thevenin voltage source value is equivalent to the open-circuit voltage.

If the network has no dependent sources, the independent sources can be zeroed, and the Thevenin resistance is equal to the equivalent resistance of the network with zeroed sources. Then, find $$V_{oc}$$.

 * Only Dependent Sources:

If the network has only dependent sources, either attach a test voltage source to the terminal points and measure the current that passes from the positive terminal, or attach a test current source to the terminal points and measure the voltage difference across the terminals. In both cases you will have values for $$V_{oc}$$ and $$I_{sc}$$, allowing you to use the $$R_{th}=\frac{V_{oc}}{I_{sc}}$$ relation to find the Thevenin resistance.

Norton Equivalents
Norton equivalents can be found by performing a source transformation on the Thevenin equivalent. The Norton Equivalent of a Thevenin Equivalent consists of a current source, $$I_N= \frac {V_{th}}{R_{th}}$$ in parallel with $$R_{th}$$.

Thevenin and Norton Equivalent

The steps for creating the Equivalent are:
 * 1. Remove the load circuit.
 * 2. Calculate the voltage, V, at the output from the original sources.
 * 3. Now replace voltage sources with shorts and current sources with open circuits.
 * 4. Replace the load circuit with an imaginary ohm meter and measure the total resistance, R, looking back into the circuit, with the sources removed.
 * 5. The equivalent circuit is a voltage source with voltage V in series with a resistance R in series with the load.

The Thevenin Equivalent is determined with $$R_2$$ as the load as shown in Figure 1. The first step is to open circuit $$R_2$$. Then the voltage v is calculated with $$R_2$$ open circuited must be calculated. The voltage across $$R_2$$ is $$V_1$$ this is because no current flows in the circuit so the voltage across $$R_2$$ must be $$V_1$$ by KVL.

Since this circuit does not contain any dependent sources, all that needs to be done is for all the Independent Voltage sources to be shorted and for all Independent Current Sources to be open circuited. This results in the circuit shown in Figure 2.

Now the Thevenin Resistance is calculated looking into the two nodes. The Thevenin resistance is clearly $$R_1 + R_3 | | R_4 $$. The Thevenin Equivalent is shown in Figure 3 and $$R_{th}$$ and $$V_{th}$$ have the values shown below.
 * $$R_{th}=R_1 + R_3 | | R_4 \,$$ (1)
 * $$V_{th}=V_1\,$$

The Norton Equivalent is created by doing a source transformation using $$I_{N}=\frac {V_{th}}{R_{th}} \,$$.(2)

If $$R_2=R_1=6k \Omega$$ and $$R_3=R_4=2k \Omega$$ and $$V_1=15 V$$ then
 * $$R_{th}=1k + 4k | | 4k \,$$
 * $$R_{th}=6k \Omega \,$$

As a final note if the voltage across $$R_2$$ is calculate by Voltage Divider Rule using the Thevenin Equivalent circuit in Figure 3.
 * $$V_{R2}=\frac {V_{th}R_2}{R_{th}+R_2}$$ (3)

If the value of $$R_{th}$$ form equation 1 is substituted into equation 3.
 * $$V_{R2}=\frac {V_{th}R_2}{R_1 + R_3 | | R_4+R_2}$$ (4)

Now look at Figure 1 and calculate $$V_{R2}$$ by voltage divider rule it has the same value as equation 4. If the current through $$R_2$$ is calculated in Figure 4 by current divider rule.
 * $$I_{R2}=\frac {I_NR_{th}}{R_{th}+R_2}(5)$$

Substituting equation 2 into 5.
 * $$I_{R2}=\frac {V_{th}}{R_{th}+R_2}(4)$$

If equation 4 and Ohm's Law are used to get the voltage across $$R_2$$ equation 3 is reached.

Please note: The "||", a symbol that is used as an operator here, holds higher precedence than the "+" operator. As such, it is evaluated before a sum.

See Norton's theorem and Thevenin's theorem for more examples.

title: Electronics/Thevenin/Norton Equivalents


text:
Electronics/Phasors

Phasors
Phasors provide a simple means of analyzing linear circuits. At the heart of phasor analysis lies Euler's formula:
 * $$Ae^{j({\omega}t+\theta)}=A\cos({\omega}t+\theta)+jA\sin({\omega}t+\theta) \,$$

A complex exponential can also be expressed as
 * $$Ae^{j({\omega}t+\theta)}=Ae^{j \theta} \cdot e^{j \omega t}$$

$$\tilde{A}=Ae^{j\theta}$$ is called a phasor. It contains information about the magnitude and phase of a sinusoidal signal, but not the frequency or time. This simplifies use in circuit analysis, since most of the time, all quantities in the circuit will have the same frequency. (For circuits with sources at different frequencies, the principle of superposition must be used.)

A shorthand phasor notation is: $$\tilde{A}=A\angle\theta$$

Note that this is simply a polar form, and can be converted to rectangular notation by (see figure one):
 * $$\tilde{A}=Ae^{j \theta}=A\angle\theta=A\cos\theta+jA\sin\theta$$

and back again by (see figure two):
 * $$\tilde{A}=X+jY=\sqrt{X^2+Y^2}\angle{\tan^{-1}{\frac{Y}{X}}}=\sqrt{X^2+Y^2}e^{j \tan^{-1}{\frac{Y}{X}}}$$. Let us understand how this process works, even though a phasor causes circuits to heat up steady flow in current will explain on a basis that disallows overheating. Since according to the formula the outcome will be there is a time in  duration which the current usage stays the same.

Sinusoidal Signals
To begin, we must first understand what sinusoidal signals are. Sinusoidal signals can be represented as
 * $$A\cos({\omega}t+\theta)\!$$

where A is the amplitude, $$\omega$$ is the frequency in radians per second, and $$\theta$$ is the phase angle in degrees(phase shift). We can return to the sinusoidal signal by taking the real part of Euler's formula:
 * $$ A\cos({\omega}t+\theta)=\mathfrak{Re}(Ae^{j({\omega}t+\theta)})$$

For the moment, consider single-frequency circuits. Every steady state current and voltage will have the same basic form:
 * $$\tilde{A_i}e^{j{\omega}t}$$ where $$\tilde{A_i}$$ is a phasor. So we can "divide through" by $$e^{j{\omega}t}\!$$ to get phasor circuit equations.  We can solve these equations for some phasor circuit quantity $$\tilde{Y}$$, multiply by $$e^{j{\omega}t}\!$$, and convert back to the sinusoidal form to find the time-domain sinusoidal steady-state solution.

Example
We have three sinusoidal signals with the same frequency added together:
 * $$v(t) = 5\cos(200t+30^\circ)+2\cos(200t+45^\circ)+\cos(200t-60^\circ)\!$$

In phasor notation, this is:
 * $$\tilde{V} = 5e^{j30^\circ}+2e^{j45^\circ}+e^{-j60^\circ} = 5\angle30+2\angle45+\angle-60$$

We can combine these terms to get one phasor notation. This is done first by separating the real and imaginary components:
 * $$\text{X: }5\cos(30^\circ) + 2\cos(45^\circ)+\cos(-60^\circ)\approx 6.2443\!$$
 * $$\text{Y: }5\sin(30^\circ) + 2\sin(45^\circ)+\sin(-60^\circ)\approx 3.04819\!$$

The phasor notation can be written as:
 * $$\tilde{V}=6.2443+j3.04819=\sqrt{6.2443^2+3.04819^2}\angle{\tan^{-1}{\frac{3.04819}{6.2443}}}$$
 * $$\tilde{V}=6.94861\angle{26.0194}$$

Back to the time domain, we get the answer:
 * $$v(t)=6.94861\cos(200t+26.0194^\circ)$$

title: Electronics/Phasors


text:
Electronics/Impedance

Definition
Impedance, $$\tilde{Z}$$, is the quantity that relates voltage and current in the frequency domain. (The tilde indicates a phasor. An overscore or arrow may also be used.)

 * $$\tilde{Z}=\frac{\tilde{V}}{\tilde{I}}=\frac{V\angle\phi_V}{I\angle\phi_I}=\frac{V}{I}\angle{\phi_V-\phi_I}$$.

In rectangular form,

 * $$\tilde{Z}=R+jX$$

where R is the resistance and X is the reactance. Impedance is generally a function of frequency, i.e.

 * $$\tilde{Z}(\omega)=R(\omega)+jX(\omega)$$

NOTE: ω = 2 π f
 * where f is the frequency in cycles per second (f=50 or 60 Hertz usually, depending on the country concerned. Aircraft systems often use 400 Hertz.)

Reactance
Reactance (symbol $$X$$) is the resistance to current flow of a circuit element that can store energy (i.e. a capacitor or an inductor), and is measured in ohms.

The reactance of an inductor of inductance $$L$$ (in Henries), through which an alternating current of angular frequency $$w$$ flows is given by:

 * $$X_L = \omega L$$

The reactance of a capacitor of capacitance $$C$$ (in Farads) is given similarly:

 * $$X_C = 1 /(\omega C)$$

The two formulae for inductive reactance and capacitive reactance create interesting counterpoints. Notice that for inductive reactance, as the frequency of the AC increases, so does the reactance. Hence, higher frequencies result in lower current. The opposite is true of capacitive reactance: The higher the frequency of AC, the less reactance a capacitor will present.

Similarly, a more inductive inductor will present more reactance, while a capacitor with more capacitance will yield less reactance.

Resistors
Resistors have zero reactance, since they do not store energy, so their impedance is simply
 * $$\tilde{Z}=R$$.

Capacitors
Capacitors have zero resistance, but do have reactance. it is stored in the power of a circuit or it can be also stored in a motor running off a AC current. Their impedance is

 * $$\tilde{Z}=\frac{1}{j{\omega}C}$$

where C is the capacitance in farads. The reactance of one microfarad at 50 Hz is -3183 ohms, and at 60 Hz it is -2653 ohms. In much more basic terms storing energy would be equivalent to a battery the power source is active and stays in this manner without any loss of power, this is what is regarded as a means for reversing electricity in the process of keeping that current.

.

Inductors
Like capacitors, inductors have zero resistance, but have reactance. Their impedance is

 * $$\tilde{Z}=j{\omega}L$$

where L is the inductance in henries. The reactance of one henry at 50 Hz is 314 ohms, and at 60 Hz it is 377 ohms.

Circuit Analysis Using Impedance
Analysis in the frequency domain proceeds exactly like DC analysis, but all currents and voltages are now phasors (and so have an angle). Impedance is treated exactly like a resistance, but is also a phasor (has an imaginary component/angle depending on the representation.)

(In the case that a circuit contains sources with different frequencies, the principle of superposition must be applied.)

Note that this analysis only applies to the steady state response of circuits. For circuits with transient characteristics, circuits must be analyzed in the Laplace domain, also known as s-domain analysis.

title: Electronics/Impedance


text:
User talk:Meitnerium~enwikibooks

Bonjour, Je trouve ce site très intéressant. J'espère que le contenu la section des sciences exactes augmentera rapidement. En attendant, j'utiliserais cette page pour tester la syntaxe de wikibooks.

Voici quelques équations d'intégrations: $$ \int \cos (ax) dx = 1 \ over a \sin (ax) +K $$ Hi, This site is very interesting! I searh a wiki engine, like the one used for this site, including the latex language. Creating formula directly in html is very impressive:

$$ \Psi(x)=e^{(x-x_0)^2} \[ \int_a^b f(x)\,dx.\] $$

Your account will be renamed
Hello,

The developer team at Wikimedia is making some changes to how accounts work, as part of our on-going efforts to provide new and better tools for our users like cross-wiki notifications. These changes will mean you have the same account name everywhere. This will let us give you new features that will help you edit and discuss better, and allow more flexible user permissions for tools. One of the side-effects of this is that user accounts will now have to be unique across all 900 Wikimedia wikis. See the announcement for more information.

Unfortunately, your account clashes with another account also called Meitnerium. To make sure that both of you can use all Wikimedia projects in future, we have reserved the name Meitnerium~enwikibooks that only you will have. If you like it, you don't have to do anything. If you do not like it, you can pick out a different name.

Your account will still work as before, and you will be credited for all your edits made so far, but you will have to use the new account name when you log in.

Sorry for the inconvenience.

Yours, Keegan Peterzell Community Liaison, Wikimedia Foundation 23:26, 17 March 2015 (UTC)

Renamed
 This account has been renamed as part of single-user login finalisation. If you own this account you can |log in using your previous username and password for more information. If you do not like this account's new name, you can choose your own using this form after logging in: . -- Keegan (WMF) (talk) 05:15, 19 April 2015 (UTC)

title: User talk:Meitnerium~enwikibooks


text:
User:Meitnerium~enwikibooks

Bonjour,

$$ \int \cos (ax) dx = 1 \over a \sin (ax) $$

title: User:Meitnerium~enwikibooks


text:
Non-Programmer's Tutorial for Python 2.6/Dictionaries

This chapter is about dictionaries. If you open a dictionary, you should notice every entry consists of two parts, a word and the word's definition. The word is the key to finding out what a word means, and what the word means is considered the value for that key. In Python, dictionaries have keys and values. Keys are used to find values. Here is an example of a dictionary in use:

And here is my output:

1. Print Dictionary 2. Add definition 3. Remove word 4. Lookup word 5. Quit Type in a number (1-5): 2 Add definition Word: Python Definition: A snake, a programming language, and a British comedy. Type in a number (1-5): 2 Add definition Word: Dictionary Definition: A book where words are defined. Type in a number (1-5): 1 Definitions: Python: A snake, a programming language, and a British comedy. Dictionary: A book where words are defined. Type in a number (1-5): 4 Lookup Word Word: Python The definition of Python is: A snake, a programming language, and a British comedy. Type in a number (1-5): 3 Remove Word Word: Dictionary Dictionary was removed. Type in a number (1-5): 1 Definitions: Python: A snake, a programming language, and a British comedy. Type in a number (1-5): 5

This program is similar to the name list from the earlier chapter on lists (note that lists use indexes and dictionaries don't). Here's how the program works:

 * First the function  is defined.   just prints a menu that is later used twice in the program.
 * Next comes the funny looking line .  All that line does is tell Python that   is a dictionary.
 * The next few lines just make the menu work.

 * This goes through the dictionary and prints all the information. The function  returns a list that is then used by the   loop.  The list returned by   is not in any particular order so if you want it in alphabetic order it must be sorted.  Similar to lists the statement   is used to access a specific member of the dictionary.  Of course in this case   is a string.
 * Next the line  adds a word and definition to the dictionary.  If   is already in the dictionary   replaces whatever was there before.

 * See if name is in words and remove it if it is. The expression   returns true if   is a key in   but otherwise returns false.  The line   removes the key   and the value associated with that key.

 * Check to see if words has a certain key and if it does prints out the definition associated with it.
 * Lastly if the menu choice is invalid it reprints the menu for your viewing pleasure.

A recap: Dictionaries have keys and values. Keys can be strings or numbers. Keys point to values. Values can be any type of variable (including lists or even dictionaries (those dictionaries or lists of course can contain dictionaries or lists themselves (scary right? :-) )). Here is an example of using a list in a dictionary:

and here is a sample output:

1. Add student 2. Remove student 3. Print grades 4. Record grade 5. Print Menu 6. Exit Menu Choice (1-6): 3 hw ch 1        hw ch 2         quiz            hw ch 3         test Menu Choice (1-6): 5 1. Add student 2. Remove student 3. Print grades 4. Record grade 5. Print Menu 6. Exit Menu Choice (1-6): 1 Student to add: Bill Menu Choice (1-6): 4 Record Grade Student: Bill Type in the number of the grade to record Type a 0 (zero) to exit 1  hw ch 1     2   hw ch 2     3   quiz        4   hw ch 3     5   test 0              0               0               0               0  Change which Grade: 1 Grade: 25 Change which Grade: 2 Grade: 24 Change which Grade: 3 Grade: 45 Change which Grade: 4 Grade: 23 Change which Grade: 5 Grade: 95 Change which Grade: 0 Menu Choice (1-6): 3 hw ch 1        hw ch 2         quiz            hw ch 3         test Bill   25              24              45              23              95 Menu Choice (1-6): 6
 * 1) Max   25              25              50              25              100
 * 1) Max   25              25              50              25              100

Here's how the program works. Basically the variable  is a dictionary with the keys being the name of the students and the values being their grades. The first two lines just create two lists. The next line  creates a new dictionary with the key { } and the value is set to be, since thats what   was when the assignment is made (I use the key   since   is sorted ahead of any alphabetic characters). Next  is defined. Next the  function is defined in the lines:

Notice how first the keys are gotten out of the  dictionary with the   function in the line. is a list so all the functions for lists can be used on it. Next the keys are sorted in the line  since it is a list. is used to go through all the keys. The grades are stored as a list inside the dictionary so the assignment  gives   the list that is stored at the key. The function  just prints a list and is defined a few lines later.

The later lines of the program implement the various options of the menu. The line  adds a student to the key of their name. The notation  just creates a list of 0's that is the same length as the   list.

The remove student entry just deletes a student similar to the telephone book example. The record grades choice is a little more complex. The grades are retrieved in the line  gets a reference to the grades of the student. A grade is then recorded in the line. You may notice that  is never put back into the students dictionary (as in no  ). The reason for the missing statement is that  is actually another name for   and so changing   changes.

Dictionaries provide a easy way to link keys to values. This can be used to easily keep track of data that is attached to various keys.


text:
Non-Programmer's Tutorial for Python 2.6/Using Modules

Here's this chapter's typing exercise (name it cal.py). actually looks for a file named calendar.py and reads it in. If the file is named calendar.py and it sees an "import calendar" it tries to read in itself which works poorly at best.)):

And here is part of the output I got:

Type in the year number: 2001 2001                                         January                  February                    March Mo Tu We Th Fr Sa Su     Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su 1  2  3  4  5  6  7                1  2  3  4                1  2  3  4 8 9 10 11 12 13 14       5  6  7  8  9 10 11       5  6  7  8  9 10 11 15 16 17 18 19 20 21      12 13 14 15 16 17 18      12 13 14 15 16 17 18      22 23 24 25 26 27 28      19 20 21 22 23 24 25      19 20 21 22 23 24 25      29 30 31                  26 27 28                  26 27 28 29 30 31

(I skipped some of the output, but I think you get the idea.) So what does the program do? The first line  uses a new command. The command  loads a module (in this case the   module). To see the commands available in the standard modules either look in the library reference for python (if you downloaded it) or go to http://docs.python.org/library/. If you look at the documentation for the calendar module, it lists a function called  that prints a calendar for a year. The line  uses this function. In summary to use a module  it and then use   for functions in the module. Another way to write the program is:

This version imports a specific function from a module. Here is another program that uses the Python Library (name it something like clock.py) (press Ctrl and the 'c' key at the same time to terminate the program):

With some output being:

The time is: Sun Aug 20 13:40:04 2000 The time is: Sun Aug 20 13:40:05 2000 The time is: Sun Aug 20 13:40:06 2000 The time is: Sun Aug 20 13:40:07 2000 Traceback (innermost last): File "clock.py", line 5, in ? the_time = ctime(time) KeyboardInterrupt

The output is infinite of course so I canceled it (or the output at least continues until Ctrl+C is pressed). The program just does a infinite loop ( is always true, so   goes forever) and each time checks to see if the time has changed and prints it if it has. Notice how multiple names after the import statement are used in the line.

The Python Library contains many useful functions. These functions give your programs more abilities and many of them can simplify programming in Python.

Exercises
Rewrite the High_low.py program from section Decisions to use a random integer between 0 and 99 instead of the hard-coded 78. Use the Python documentation to find an appropriate module and function to do this.


text:
Non-Programmer's Tutorial for Python 2.6/More on Lists

We have already seen lists and how they can be used. Now that you have some more background I will go into more detail about lists. First we will look at more ways to get at the elements in a list and then we will talk about copying them.

Here are some examples of using indexing to access a single element of a list:

>>> some_numbers = ['zero', 'one', 'two', 'three', 'four', 'five'] >>> some_numbers[0] 'zero' >>> some_numbers[4] 'four' >>> some_numbers[5] 'five'

All those examples should look familiar to you. If you want the first item in the list just look at index 0. The second item is index 1 and so on through the list. However what if you want the last item in the list? One way could be to use the  function like. This way works since the  function always returns the last index plus one. The second from the last would then be. There is an easier way to do this. In Python the last item is always index -1. The second to the last is index -2 and so on. Here are some more examples:

>>> some_numbers[len(some_numbers) - 1] 'five' >>> some_numbers[len(some_numbers) - 2] 'four' >>> some_numbers[-1] 'five' >>> some_numbers[-2] 'four' >>> some_numbers[-6] 'zero'

Thus any item in the list can be indexed in two ways: from the front and from the back.

Another useful way to get into parts of lists is using slicing. Here is another example to give you an idea what they can be used for:

>>> things = [0, 'Fred', 2, 'S.P.A.M.', 'Stocking', 42, "Jack", "Jill"] >>> things[0] 0 >>> things[7] 'Jill' >>> things[0:8] [0, 'Fred', 2, 'S.P.A.M.', 'Stocking', 42, 'Jack', 'Jill'] >>> things[2:4] [2, 'S.P.A.M.'] >>> things[4:7] ['Stocking', 42, 'Jack'] >>> things[1:5] ['Fred', 2, 'S.P.A.M.', 'Stocking']

Slicing is used to return part of a list. The slicing operator is in the form. Slicing cuts the list before the  and before the   and returns the parts inbetween. You can use both types of indexing:

>>> things[-4:-2] ['Stocking', 42] >>> things[-4] 'Stocking' >>> things[-4:6] ['Stocking', 42]

Another trick with slicing is the unspecified index. If the first index is not specified the beginning of the list is assumed. If the last index is not specified the whole rest of the list is assumed. Here are some examples:

>>> things[:2] [0, 'Fred'] >>> things[-2:] ['Jack', 'Jill'] >>> things[:3] [0, 'Fred', 2] >>> things[:-5] [0, 'Fred', 2]

Here is a (HTML inspired) program example (copy and paste in the poem definition if you want):

with the output being:

Bold [ 1 : 4 ] ['Jack', 'and', 'Jill'] Bold [ 11 : 15 ] ['fetch', 'a', 'pail', 'of'] Bold [ 20 : 23 ] ['down', 'and', 'broke'] Bold [ 28 : 30 ] ['Jill', 'came']

The  function takes in a list that is broken into words and tokens. The tokens that it looks for are  which starts the bold text and  which ends bold text. The function goes through and searches for the start and end tokens.

The next feature of lists is copying them. If you try something simple like:

>>> a = [1, 2, 3] >>> b = a >>> print b [1, 2, 3] >>> b[1] = 10 >>> print b [1, 10, 3] >>> print a [1, 10, 3]

This probably looks surprising since a modification to resulted in   being changed as well. What happened is that the statement  makes   a reference to. This means that  can be thought of as another name for. Hence any modification to  changes   as well. However some assignments don't create two names for one list:

>>> a = [1, 2, 3] >>> b = a * 2 >>> print a [1, 2, 3] >>> print b [1, 2, 3, 1, 2, 3] >>> a[1] = 10 >>> print a [1, 10, 3] >>> print b [1, 2, 3, 1, 2, 3]

In this case  is not a reference to   since the expression  creates a new list. Then the statement gives  a reference to   rather than a reference to. All assignment operations create a reference. When you pass a list as an argument to a function you create a reference as well. Most of the time you don't have to worry about creating references rather than copies. However when you need to make modifications to one list without changing another name of the list you have to make sure that you have actually created a copy.

There are several ways to make a copy of a list. The simplest that works most of the time is the slice operator since it always makes a new list even if it is a slice of a whole list:

>>> a = [1, 2, 3] >>> b = a[:] >>> b[1] = 10 >>> print a [1, 2, 3] >>> print b [1, 10, 3]

Taking the slice  creates a new copy of the list. However it only copies the outer list. Any sublist inside is still a references to the sublist in the original list. Therefore, when the list contains lists, the inner lists have to be copied as well. You could do that manually but Python already contains a module to do it. You use the  function of the   module:

>>> import copy >>> a = 1, 2, 3], [4, 5, 6 >>> b = a[:] >>> c = copy.deepcopy(a) >>> b[0][1] = 10 >>> c[1][1] = 12 >>> print a 1, 10, 3], [4, 5, 6 >>> print b 1, 10, 3], [4, 5, 6 >>> print c 1, 2, 3], [4, 12, 6

First of all notice that  is a list of lists. Then notice that when  is run both   and   are changed, but  is not. This happens because the inner arrays are still references when the slice operator is used. However with was fully copied.

So, should I worry about references every time I use a function or ? The good news is that you only have to worry about references when using dictionaries and lists. Numbers and strings create references when assigned but every operation on numbers and strings that modifies them creates a new copy so you can never modify them unexpectedly. You do have to think about references when you are modifying a list or a dictionary.

By now you are probably wondering why are references used at all? The basic reason is speed. It is much faster to make a reference to a thousand element list than to copy all the elements. The other reason is that it allows you to have a function to modify the inputted list or dictionary. Just remember about references if you ever have some weird problem with data being changed when it shouldn't be.


text:
Cookbook:Yeasted Cornbread

| Bread

Ingredients

 * 1 cup warm water
 * 1 tablespoon active dry yeast
 * 4 tablespoons white granulated sugar
 * 1 cup yellow cornmeal
 * ½ cup white flour
 * ½ cup whole wheat flour
 * 1 teaspoon salt
 * Additional water, as necessary

Procedure

 * 1) Mix water, yeast, and sugar. Let this sit for a few minutes until it bubbles.
 * 2) Stir in the rest of the ingredients, adding water until it is pourable.
 * 3) Bake in a greased 9×9-inch pan at 350°F (175°C, gas mark 4) for 25 minutes or until the edges turn golden brown.

title: Cookbook:Yeasted Cornbread


text:
Non-Programmer's Tutorial for Python 2.6/Revenge of the Strings

And now presenting a cool trick that can be done with strings:

And the output is:

Gimme a L 'L' Gimme a o 'o' Gimme a s 's' Gimme a e 'e' The middle character is: d The middle character is: r The middle character is: a

What these programs demonstrate is that strings are similar to lists in several ways. The  function shows that   loops can be used with strings just as they can be used with lists. The  procedure shows that that strings can also use the   function and array indexes and slices. Most list features work on strings as well.

The next feature demonstrates some string specific features:

with the output being:

THIS IS TEXT

This works because the computer represents the characters of a string as numbers from 0 to 255. Python has a function called  (short for ordinal) that returns a character as a number. There is also a corresponding function called  that converts a number into a character. With this in mind the program should start to be clear. The first detail is the line:  which checks to see if a letter is lower case. If it is then the next lines are used. First it is converted into a location so that a = 0, b = 1, c = 2 and so on with the line:. Next the new value is found with. This value is converted back to a character that is now upper case.

Now for some interactive typing exercise:

>>> # Integer to String >>> 2 2 >>> repr(2) '2' >>> -123 -123 >>> repr(-123) '-123' >>> `123` '123' >>> # String to Integer >>> "23" '23' >>> int("23") 23 >>> "23" * 2 '2323' >>> int("23") * 2 46 >>> # Float to String >>> 1.23 1.23 >>> repr(1.23) '1.23' >>> # Float to Integer >>> 1.23 1.23 >>> int(1.23) 1 >>> int(-1.23) -1 >>> # String to Float >>> float("1.23") 1.23 >>> "1.23" '1.23' >>> float("123") 123.0 >>> `float("1.23")` '1.23'

If you haven't guessed already the function  can convert a integer to a string and the function   can convert a string to an integer. The function  can convert a string to a float. The  function returns a printable representation of something. converts almost everything into a string, too. Here are some examples of this:

>>> repr(1) '1' >>> repr(234.14) '234.14' >>> repr([4, 42, 10]) '[4, 42, 10]' >>> `[4, 42, 10]` '[4, 42, 10]'

The  function tries to convert a string (or a float) into a integer. There is also a similar function called  that will convert a integer or a string into a float. Another function that Python has is the  function. The  function takes a string and returns data of the type that python thinks it found. For example:

>>> v = eval('123') >>> print v, type(v) 123  >>> v = eval('645.123') >>> print v, type(v) 645.123  >>> v = eval('[1, 2, 3]') >>> print v, type(v) [1, 2, 3]

If you use the  function you should check that it returns the type that you expect.

One useful string function is the  method. Here's an example:

>>> "This is a bunch of words".split ['This', 'is', 'a', 'bunch', 'of', 'words'] >>> text = "First batch, second batch, third, fourth" >>> text.split(",") ['First batch', ' second batch', ' third', ' fourth']

Notice how  converts a string into a list of strings. The string is split by whitespace by default or by the optional argument (in this case a comma). You can also add another argument that tells  how many times the separator will be used to split the text. For example:

>>> list = text.split(",") >>> len(list) 4 >>> list[-1] ' fourth' >>> list = text.split(",", 2) >>> len(list) 3 >>> list[-1] ' third, fourth'

Slicing strings (and lists)
Strings can be cut into pieces — in the same way as it was shown for lists in the previous chapter — by using the slicing "operator". The slicing operator works in the same way as before: text[first_index:last_index] (in very rare cases there can be another colon and a third argument, as in the example shown below).

In order not to get confused by the index numbers, it is easiest to see them as clipping places, possibilities to cut a string into parts. Here is an example, which shows the clipping places (in yellow) and their index numbers (red and blue) for a simple text string:

Note that the red indexes are counted from the beginning of the string and the blue ones from the end of the string backwards. (Note that there is no blue -0, which could seem to be logical at the end of the string. Because, (-0 means "beginning of the string" as well.)  Now we are ready to use the indexes for slicing operations:

gives us all of the  string between clipping places 1 and 4, " ". If you omit one of the [first_index:last_index] arguments, you get the beginning or end of the string as default:  gives " ". For both  and   we can use both the red and the blue numbering schema:   gives the same as , because the index -1 is at the same place as 5 in this case. If we do not use an argument containing a colon, the number is treated in a different way:  gives us one character following the second clipping point, " ". The special slicing operation  means "from the beginning to the end" and produces a copy of the entire string (or list, as shown in the previous chapter).

Last but not least, the slicing operation can have a second colon and a third argument, which is interpreted as the "step size":  is   from beginning to the end, with a step size of -1. -1 means "every character, but in the other direction". " " backwards is " " (test a step length of 2, if you have not got the point here).

All these slicing operations work with lists as well. In that sense strings are just a special case of lists, where the list elements are single characters. Just remember the concept of clipping places, and the indexes for slicing things will get a lot less confusing.

Examples
The output is:

2 23445 -23445 14234 12345 -3512


text:
Non-Programmer's Tutorial for Python 2.6/File I/O

Here is a simple example of file I/O (input/output):

The output and the contents of the file  are:

This Text is going to out file Look at it and see!

Notice that it wrote a file called  in the directory that you ran the program from. The  in the string tells Python to put a newline where it is.

A overview of file I/O is:
 * Get a file object with the  function.
 * Read or write to the file object (depending on how it was opened)
 * Close it

The first step is to get a file object. The way to do this is to use the  function. The format is   where   is the variable to put the file object,   is a string with the filename, and   is   to read a file or   to write a file (and a few others we will skip here). Next the file objects functions can be called. The two most common functions are  and. The  function adds a string to the end of the file. The  function reads the next thing in the file and returns it as a string. If no argument is given it will return the whole file (as done in the example).

Now here is a new version of the phone numbers program that we made earlier:

Notice that it now includes saving and loading files. Here is some output of my running it twice:

1. Print Phone Numbers 2. Add a Phone Number 3. Remove a Phone Number 4. Lookup a Phone Number 5. Load numbers 6. Save numbers 7. Quit Type in a number (1-7): 2 Add Name and Number Name: Jill Number: 1234 Type in a number (1-7): 2 Add Name and Number Name: Fred Number: 4321 Type in a number (1-7): 1 Telephone Numbers: Name: Jill    Number: 1234 Name: Fred    Number: 4321 Type in a number (1-7): 6 Filename to save: numbers.txt Type in a number (1-7): 7 Goodbye

1. Print Phone Numbers 2. Add a Phone Number 3. Remove a Phone Number 4. Lookup a Phone Number 5. Load numbers 6. Save numbers 7. Quit Type in a number (1-7): 5 Filename to load: numbers.txt Type in a number (1-7): 1 Telephone Numbers: Name: Jill    Number: 1234 Name: Fred    Number: 4321 Type in a number (1-7): 7 Goodbye

The new portions of this program are:

First we will look at the save portion of the program. First it creates a file object with the command. Next it goes through and creates a line for each of the phone numbers with the command. This writes out a line that contains the name, a comma, the number and follows it by a newline.

The loading portion is a little more complicated. It starts by getting a file object. Then it uses a  loop to keep looping until a   statement is encountered. Next it gets a line with the line. The  function will return a empty string when the end of the file is reached. The  statement checks for this and  s out of the   loop when that happens. Of course if the  function did not return the newline at the end of the line there would be no way to tell if an empty string was an empty line or the end of the file so the newline is left in what   returns. Hence we have to get rid of the newline. The line  does this for us by dropping the last character. Next the line  splits the line at the comma into a name and a number. This is then added to the  dictionary.

Exercises
Now modify the grades program from section ../Dictionaries/ so that it uses file I/O to keep a record of the students.


text:
Non-Programmer's Tutorial for Python 2.6/Dealing with the imperfect

...or how to handle errors
So you now have the perfect program, it runs flawlessly, except for one detail, it will crash on invalid user input. Have no fear, for Python has a special control structure for you. It's called  and it tries to do something. Here is an example of a program with a problem:

Notice how when you enter  it outputs something like:

Traceback (innermost last): File "try_less.py", line 4, in ? number = int(raw_input("Enter a number: ")) ValueError: invalid literal for int: @#&

As you can see the  function is unhappy with the number   (as well it should be). The last line shows what the problem is; Python found a. How can our program deal with this? What we do is first: put the place where the errors occurs in a  block, and second: tell Python how we want  s handled. The following program does this:

Now when we run the new program and give it  it tells us "That was not a number." and continues with what it was doing before.

When your program keeps having some error that you know how to handle, put code in a  block, and put the way to handle the error in the   block.

Here is a more complex example of Error Handling.

The program above uses concepts from previous lessons as well as the current lesson. Let's look at the above program in sections.

After we define the function called "main", we tell it that we want to "try" function named "epact". It does so "while" there is no "success". The interpreter then goes to the line. The interpreter takes the value entered by the user and stores it in the variable named "year".

If the value entered is not an integer or a floating point number (which would be converted to an integer by the interpreter), an exception would be raised, and execution of the  block ends, just before   is assigned the value 1.

Let's look at some possible exceptions. the program above does not have an  clause for every possible exception, as there are numerous types or exceptions.

If the value entered for year is an alphabetical character, a  exception is raised. In the program above, this is caught by the  line, and the interpreter executes the print statement below the , then it sets the value of "year" to 0 as a precaution, clearing it of any non-numeric number. The interpreter then jumps back to the first line of the  loop, and the process restarts.

The process above would be the same for the other exceptions we have. If an exception is raised, and there is an except clause for it in our program, the interpreter will jump to the statements under the appropriate except clause, and execute them.

The  statement, is sometimes used in exception handling as well. Think of it as the trump card. Statements underneath the  clause will be executed regardless of if we raise and exception or not. The  statement will be executed after any   or   clauses prior to it.

Below is a simpler example where we are not looped, and the  clause is executed regardless of exceptions.

If we were to enter an alphabetic value for, the output would be as follows:

Please enter a number. t Error. I am executing the finally clause.

Exercises
Update at least the phone numbers program (in section ../File IO/) so it doesn't crash if a user doesn't enter any data at the menu.


text:
Non-Programmer's Tutorial for Python 2.6/The End

For the moment I recommend looking at The Python 2 Tutorial by Guido van Rossum for more topics. If you have been following this tutorial, you should be able to understand a fair amount of it. If you want to get deeper into Python, Learn Python the Hard Way is a nice on-line textbook, although targeted at people with a more solid programming background. The Python Programming wikibook can be worth looking at, too.

This tutorial is very much a work in progress. Thanks to everyone who has sent me emails about it. I enjoyed reading them, even when I have not always been the best replier.

Happy programming, may it change your life and the world.


text:
Non-Programmer's Tutorial for Python 2.6/FAQ

 * Question: Can't use programs with input. : Answer: If you are using IDLE then try using command line. This problem seems to be fixed in IDLE 0.6 and newer.  If you are using an older version of IDLE try upgrading to Python 2.0 or newer.
 * Is there a printable version? : Yes, see the next question.
 * Is there a PDF or zipped version? : Yes, go to http://www.honors.montana.edu/~jjc/easytut for several different versions. Note that this will not always be up to date with the Wikibooks version. The Wikibook can be printed from the print version.
 * What is the tutorial written with? : Originally, LaTeX, see the  file.
 * I can't type in programs of more than one line. : If the programs that you type in run as soon as you are typing them in, you need to edit a file instead of typing them in interactive mode. (Hint: interactive mode is the mode with the  prompt in front of it.)
 * My question is not answered here. : Ask on the talk page. Please post source code if at all relevant (even, (or maybe especially) if it doesn't work). Helpful things to include are what you were trying to do, what happened, what you expected to happen, error messages, version of Python, Operating System, and whether or not your cat was stepping on the keyboard. (The cat in my house has a fondness for space bars and control keys.)
 * I want to read it in a different language. : There are several translations that I know of. One is in Korean and is available at http://home.hanmir.com/~johnsonj/easytut/easytut.html. Another is in Spanish and at http://www.honors.montana.edu/~jjc/easytut/easytut_es/.  Another is in Italian and is available at http://www.python.it/doc/tut_begin/index.html. Another is in Greek and available at http://www.honors.montana.edu/~jjc/easytut/easytut_gr/. Several people have said they are doing a translation in other languages such as French, but I never heard back from them.  If you have done a translation or know of any translations, please either send it to me or send me a link.
 * How do I make a GUI in Python? : You can use either TKinter at http://www.python.org/topics/tkinter/ or WXPython at http://www.wxpython.org/
 * How do I make a game in Python? : The best method is probably to use PYgame at http://pygame.org/
 * How do I make an executable from a Python program? : Short answer: Python is an interpreted language so that is impossible. Long answer is that something similar to an executable can be created by taking the Python interpreter and the file and joining them together and distributing that. For more on that problem see http://www.python.org/cgi-bin/faqw.py?req=all#4.28. A project that does make executable python files is py2exe - see http://www.py2exe.org.
 * I need help with the exercises : Hint, the password program requires two variables, one to keep track of the number of times the password was typed in, and another to keep track of the last password typed in. Also you can download solutions from http://www.honors.montana.edu/~jjc/easytut/
 * What and when was the last thing changed?

 * 2000-Dec-16, added error handling chapter.
 * 2000-Dec-22, Removed old install procedure.
 * 2001-Jan-16, Fixed bug in program, Added example and data to lists section.
 * 2001-Apr-5, Spelling, grammar, added another how to break programs, url fix for PDF version.
 * 2001-May-13, Added chapter on debugging.
 * 2001-Nov-11, Added exercises, fixed grammar, spelling, and hopefully improved explanations of some things.
 * 2001-Nov-19, Added password exercise, revised references section.
 * 2002-Feb-23, Moved 3 times password exercise, changed l to list in list examples question. Added a new example to Decisions chapter, added two new exercises.
 * 2002-Mar-14, Changed abs to my_abs since python now defines a abs function.
 * 2002-May-15, Added a faq about creating an executable. Added a comment from about the list example.  Fixed typos from Axel Kleiboemer.
 * 2002-Jun-14, Changed a program to use while true instead of while 1 to be more clear.
 * 2002-Jul-5, Rewrote functions chapter. Modified fib program to hopefully be clearer.
 * 2003-Jan-3, Added average examples to the decisions chapter.
 * 2003-Jan-19, Added comment about value of a_var. Fixed mistake in average2.py program.
 * 2003-Sep-5, Changed idle instruction to Run->Run Module.
 * 2004-Jun-1, Put on Wikibooks
 * Since then all changes are visible through the Wikibooks version keeping system.


text:
Non-Programmer's Tutorial for Python 2.6

For Python 3, see Non-Programmer's Tutorial for Python 3.

Contents

 * /Authors/
 * Contributors to this book

 * Front matter
 * Initial remarks

 * Intro
 * Installing and using Python – where to get help

 * Hello, World
 * The famous first program – screen output – numbers and calculations

 * Who Goes There?
 * Interactive input – strings

 * Count to 10
 * while loops

 * Decisions
 * if statements

 * Debugging
 * Finding out what goes wrong

 * Defining Functions
 * Structuring programs with the use of functions

 * Advanced Functions Example
 * (Almost) mind-blowing example of how programmers can think

 * Lists
 * Variables containing more than one value

 * For Loops
 * A second kind of loop

 * Boolean Expressions
 * Computer logic – true and false – and and or – not

 * Dictionaries
 * Variables containing key/value pairs

 * Using Modules
 * Extensions to the standard set of functionality

 * More on Lists
 * Using elements or parts of lists

 * Revenge of the Strings
 * Advanced text manipulation

 * File IO
 * Reading from files and writing to files

 * Dealing with the imperfect
 * How to handle errors

 * The End
 * How to go further

 * FAQ
 * Some frequently asked questions

Tutorial Python untuk bukan pengatur cara


text:
Civ/Sid Meier's Alpha Centauri/Secret Project Index

Ascent to Transcendence

 * Prerequisite: Threshold of Transcendence
 * The Voice of Planet must also have been built by any faction

Build this and win a Transcendence Victory. A no-brainer unless you have a faster way to win.

Ascetic Virtues

 * Prerequisite: Planetary Economics
 * Increases base population limit by 2, gives +1 Police

Handy for everyone, of course, but Lal gets a real booster out of it, enabling him to get obscenely large bases well before Hab-Domes. For Morgan, it's a kicker too, all but eliminating his small base problem. The Spartans too, benefit greatly, as it enhances their existing police rating. Everybody else benefits, but not as much as these three.

In Alien Crossfire, this plus a Brood Pit brings you to the magic +3 Police rating where police effect is doubled (unless your faction has an inherent police penalty). However, Brood Pits come fairly late at Centauri Genetics.

Bulk Matter Transmitter

 * Prerequisite: Matter Transmission
 * Increases every base's production by 50%.

Despite its in-game description, the Bulk Matter Transmitter seems to increase every base's production by 50%. By the time you can build this, ecodamage will be a serious problem. An unexpected 50% jump in your production will cause rampant fungal pops and global warming. If you anticipate its effect, however, the boost in production can be very nice, though of course it comes very late in the game.

Citizen's Defense Force

 * Prerequisite: Intellectual Integrity
 * Free Perimeter Defense in every base.

If Perimeter Defenses had an upkeep cost, this project would rank right up there with the others that provided free facilities, but since Perimeter Defense works are free (no maintenance cost), the value of this project is somewhat reduced. Still, it does save you time, especially if you have a large number of exposed bases, and so is fairly important, but non-critical, though you might expect a Momentum player to run for it as part of a denial strategy. Yang also doesn't need this because he already has its benefits, so for him it is useful mostly as a pre-build or for denial.

Clinical Immortality

 * Prerequisite: Matter Editation
 * +1 talent at every base. Doubles your votes in elections for Planetary Governor and Supreme Leader.

Talents = Drone control, and at this point in the game, you've probably got a sprawling empire and this is just the thing! It's certainly not crucial (not even for Zakharov by this stage), but very nice to have if you can free up a base for it.

Cloning Vats

 * Prerequisite: Biomachinery
 * All bases are in a state of population boom.

We can't think of a single reason not to build this project, except perhaps for the fact that it will make you the target of envy and, in all probability, attack...but hey, enjoy it while you got it!

Cloudbase Academy

 * Prerequisite: Mind/Machine Interface
 * Free Aerospace Complex in every base.
 * Alien Crossfire only

If you want to get and keep air superiority, get this project! If you plan to make use of satellites in your game, get this project! If someone else gets this project, get that base! If you can't do that, nuke it. It's that important. Note though, that if you get this project, people will gang up on you, and if they don't, you almost can't help but win. Not only do you get two extra points of movement for all your aircraft, but you get a morale boost, make it harder for people to use drop teams on you, and your satellites automatically have their maximum impact at all your bases. Simply too good to pass on.

Cyborg Factory

 * Prerequisite: Mind/Machine Interface
 * Free Bioenhancement Center in every base.

In the Alien Crossfire world, Mind/Machine Interface is probably the most desired tech in the game. Not only does it give you choppers and thinkers, but it also gives you TWO secret projects! Awesome ones at that! Bio-enhancement centers are expensive from an upkeep standpoint, and they improve morale of ALL your units, making this project a must have, no matter who you are!

Command Nexus

 * Prerequisite: Doctrine: Loyalty
 * Free Command Center in every base.

Another project that provides free facilities, this too, will be highly sought after by a number of players, regardless of style. Builders will likely spend long periods of time running Wealth, and the presence of this project will enable them to perfectly counter Wealth's singular negative. Also, Builders will want this project badly as part of a denial strategy against Momentum players, forcing the Momentum gang to take the time to build Command Centers if they want those morale upgrades. Momentum and Hybrid folk will also count this as a high priority, for obvious reasons. Their standing forces become 25% more lethal with its completion. More bang for your buck!

Dream-Twister

 * Prerequisite: The Will to Power
 * +50% to psi attack

Even if you have no intention of making use of Psi attackers, you need this project so that the Worm lovers don't come over and pay you an unwelcome visit. About the only time you don't need this one is if you have the Neural Amplifier, but even then, it might be good to pick it up for denial. Also, if you're into Navy at all, grab this one! Your Isles of the Deep, which are already awesome, will be all but unbeatable!

Empath Guild

 * Prerequisite: Centauri Empathy
 * Builder gets commlinks for and infiltration of every faction.
 * Builder gets 50% more votes in Council elections

From a defensive perspective, the most important element of the game is to take what steps you can to ensure that your datalinks are not infiltrated, and as this project grants infiltration access to whomever completes it, it is easily one of the most despised projects in the game. I have seen coalitions formed solely on the basis of eliminating the player who builds this project, which speaks volumes about the scope of its power. Build it if at all possible, just to deny anyone else access to it, and, if it appears later that someone will take it from you, don't hesitate to burn the base to the ground to prevent it from falling into enemy hands! It really is that important!

Human Genome Project

 * Prerequisite: Biogenetics
 * +1 talents in every base. Prevents Prometheus Virus outbreaks.

Another fantastic early game project! Talents are so vital to drone control, and this puts an extra talent at each base. If you favor Domai or Lal, with their fewer drones or higher number of talents, this project alone will enable you to forego the building of drone control facilities almost to the middle game, and if you're playing a drone-sensitive faction like Zak's researchers, the project will go a long way in undoing your chronic drone problems. Other factions will benefit greatly from it as well, though some may want it purely as part of a denial strategy (I'm specifically thinking Yang and Santiago here, who can easily control all their drones via police), still, no matter what the reasonings behind it, the fact is, this is a project that will be quite high on a number of people's lists!

Hunter-Seeker Algorithm

 * Prerequisite: Pre-Sentient Algorithms
 * Destroys incoming probe teams
 * Alien Crossfire only: Probe teams with Algorithmic Enhancement are not destroyed.

Even in the Alien Crossfire world, where the power of this project has been weakened, it should still be considered critical to every player in the game. Even those factions who have probe-immunity will want it from a purely denial standpoint, making this one of the most sought after secret projects out there.

Living Refinery

 * Prerequisite: Advanced Spaceflight
 * Gives +2 Support.

At this point in the game, support is usually only an issue if you're running Thought Control, and even then, with Clean Reactors it's not that big a deal. Nonetheless, clean reactors are expensive, and if you're running Social Engineering choices that lend you support anyway, this is a good way to be able to build large numbers of "non-clean" troops — which means that the ability slot formerly occupied by "clean" can be filled in with something else. For that reason alone it's quite handy, and if you're playing Miriam, mark it down as a must-have!

Longevity Vaccine

 * Prerequisite: Bioengineering
 * +50% Economy at this base for Free Market economics
 * -2 Drones at every base for Planned economics
 * -1 Drone at every base for Simple or Green economics

The Clean Reactor tech also gives you a cash cow. If you have the Merchant Exchange someplace, toss this onto the pile as well, and you'll have a base that can single-handedly pay for the infrastructure at a lot of your bases. If not, it's fairly useful, but certainly not critical, though for Zak (when he's not running Market) the Drone control is nice.

Manifold Harmonics

 * Prerequisite: Secrets of the Manifolds
 * Increases monolith and fungus production according to your Planet rating:
 * 0 Planet: +1 energy
 * 1 Planet: +1 nutrient, +1 energy
 * 2 Planet: +1 nutrient, +1 mineral, +1 energy
 * 3+ Planet: +1 nutrient, +1 mineral, +2 energy

Alien Crossfire only

This project makes fungus the best terrain in the game. Unfortunately, if you're like most players, you've just spent the entire game minimizing the amount of fungus in your empire. It's a good project, don't get me wrong, but unless you're playing one of the Native lovers, it's not a great project.

Maritime Control Center

 * Prerequisite: Doctrine: Initiative
 * Free Naval Yard in every base.

Comes a bit later in the early game, and is another project that provides free facilities. It's importance is directly tied to two things: What other factions are in the game (if the Pirates are playing, then you need this!), and how important a strong Naval presence is to your game. If Naval power is relatively unimportant to you, then skip this project, but note that whoever builds it will have ships with two (2) extra movement points, making Marine strikes of coastal bases that much harder to spot!

Merchant Exchange

 * Prerequisite: Industrial Base
 * +1 energy every square at this base.

A good project, but not a great project. For certain factions, it can be a godsend (Yang, Deirdre, and Cha'Dawn especially) but for others, it's almost a waste of time until energy restrictions come off (Example: Morgan: Running wealth gives him +1 energy per square anyway, and with a maximum of 2r pre-restriction lifting, a good portion of the power of the ME will be lost in the early game). Combine that with the fact that its impact is limited to one base, and you have a project which is useful in the early game, extremely useful in the middle game, but non-critical at any point.

Nano-Factory

 * Prerequisite: Industrial Nanorobotics
 * Allows units to be fully repaired when not in a base.

Anybody who has a standing army of any size at all (and you'd better, by this point in the game) will want this project! Not only does it dramatically lower your upgrade costs, but it also (and more importantly) allows your forces to fully recover in the field in a single turn. You just can't get any better than that!

Net-Hack Terminus
Alien Crossfire only
 * Prerequisite: Self-Aware Machines
 * +1 morale to all Probe Teams.
 * -25% cost of Probe Team actions.
 * Probe teams with Fusion Reactor or higher automatically have Algorithmic Enhancement.

Again, the probe bonus comes too late in the game to do you much good, as you would really have to try hard not to have elite Probe Teams, but if you missed the Hunter-Seeker Algorithm, this one's not bad to get.

(As a side note: what's with the name of this Project? Have your Probe Teams ascended so often in NetHack that they consider enemy security measures to be below their skills?)

Network Backbone

 * Prerequisite: Digital Sentience
 * Eliminates penalties for Cybernetic model
 * +1 research for each point of Commerce at this base.
 * +1 research for every Network Node in the game.

For the money, it's not as good as it should be, because its value is too much tied to world size, which in turn, helps determine overall number of bases. Nonetheless, because it helps research, it should be fairly high on your list. Cyborgs don't need it, because they're already immune to the negatives of Cybernetic society, but it's still nice for the research kick.

Neural Amplifier

 * Prerequisite: Neural Grafting
 * +50% Psi defense.

Another project that comes later on in the early game, and one of the best defensive projects in the entire game. Essentially, this gives every unit you ever build the equivalent of "Trance" ability, and can be further enhanced by actually building "Trance" units. For Marketeers, this one is highly prized, and for players pursuing a heavy Native strategy, it's equally highly prized as part of a denial strategy. Non-native based Momentum players (and some Hybrids) will generally consider this project of only secondary importance and will seldom pursue it with much vigor.

Pholus Mutagen

 * Prerequisite: Centauri Genetics
 * +1 Ecology at every base
 * Your units gain combat advantages in fungus normally reserved for native life.
 * +1 lifecycle for any native units you breed

Unless you're one of the "Native" factions (and to a lesser extent, Morgan), this one's only marginally useful, though the ecology bonus will help you jack your mineral counts up slightly higher, but once you hit somewhere around 40, you really don't need that. Still, if you're playing Gaian, Cult, or Morgan, I'd put it fairly high on the list, and if you're playing against one of them, you'll want to pick it up just so they can't.

Planetary Datalinks

 * Prerequisite: Cyberethics
 * You automatically learn any tech discovered by three factions you have contact with.

Seldom even built in multiplayer games, unless it's a free-for-all with six players. Good one to deny the AI though.

Planetary Energy Grid
Alien Crossfire only
 * Prerequisite: Adaptive Economics
 * Free Energy Bank at every base.
 * +25% returns from Stockpile Energy

Even if you never plan to stockpile energy at any of your bases, the fact that it gives you a cash enhancing facility for free (no maintenance cost) at every base is an enormous boon. This project is everything that the Merchant Exchange is not, and is much more valuable because of it.

Planetary Transit System

 * Prerequisite: Industrial Automation
 * -1 Drones at all bases size 3 and under
 * Any bases you found start at size 3
 * Upon completion, bases size 2 or smaller immediately grow to size 3.

Even if you have no immediate plans to expand, this project is a must have from a denial standpoint! If you don't snag it, someone could quite easily "Borg" their way to dominance!

Self-Aware Colony

 * Prerequisite: Self-Aware Machines
 * Halves maintenance costs for facilities
 * If your Police rating allows use of police, counts as an extra police unit in every base.

The influx of cash you get when your maintenance costs are halved makes this project one of the fastest to pay for itself. If you're going for the economic win, this is crucial, and it's pretty important in general, because by this stage of the game, you've got a lot of maintenance every turn. A good investment, no matter how you slice it.

Singularity Inductor

 * Prerequisite: Controlled Singularity
 * Free Quantum Converter in every base.

Comes too late in the game to really be useful. By this point, you've got more mineral production than you need anyway. This is an average project, at best, and too expensive for the relatively short lifespan it has.

Space Elevator

 * Prerequisite: Super Tensile Solids
 * Allows units with Drop Pods to perform Orbital Insertions anywhere on the planet.
 * Doubles production in any bases producing orbital improvements.

If you're planning to make heavy use of Satellites to enhance your factors of production, or if you entered the space race late and want to play catch up, this project will be a huge boon! Otherwise, even as a denial project, its only average.

Supercollider

 * Prerequisite: Applied Relativity
 * Doubles Lab output of this city.

If your middle game is not energy based, then it should be. Research and technology are so vital to the middle game, and a project like this — one that doubles lab outputs at a given base — how can you not start drooling over the prospect! No matter what your faction or pre-disposition, build it before someone else does!

Telepathic Matrix

 * Prerequisite: Eudaimonia
 * Your bases never riot.
 * +2 Probe Team morale.

Most people stopped having drone problems a long time ago, and this project comes too late to really be of outstanding benefit for the money, but it does cut down on the need to micromanage your bases. The probe bonus is an utterly useless feature of this project, as by this point, your probes are elite anyway. They can't get any higher. Average at best, but handy if you're tired of micromanagement.

Theory of Everything

 * Prerequisite: Unified Field Theory
 * Doubles Lab output of this city.

Another lab-doubler, and every bit as important as the one that comes before it. Get it. You need it. Trust me.

Universal Translator

 * Prerequisite: Homo Superior
 * Two free technology advances upon completion.

Did somebody say free techs?! If you don't go for this one, you erode your tech position, allowing others to catch up, and if you're behind in tech, and happen to get to Homo-Superior first (thanks to your path up the tech-tree), this may be just the thing that enables you to catch up!

Virtual World

 * Prerequisite: Planetary Networks
 * All Network Nodes count as free Hologram Theatres

Any project that gives you a free facility which would normally require an upkeep cost if you had to actually build the facility it gives is automatically an important project, and even if drone control is not high on your list of concerns, building network nodes probably is, so why not have those net nodes serve two purposes, rather than just one? All in all, this is one of the most powerful early game projects around, both in terms of money saved by not having to build infrastructure, and in terms of control all the way through to the mid-game. Even more important to Zakharov to control his drones and he already has the nodes, for free.

Voice of Planet

 * Prerequisite: Threshold of Transcendence
 * Allows construction of the Ascent to Transcendence Secret Project and the Temple of Planet facility. Any alien lifeforms you breed get a +1 Lifecycle bonus.

Building this allows you to build the Ascent of Transcendence, although it may sometimes be best to wait for somebody else to build the Voice. Alien lifeforms you breed also get a +1 lifecycle bonus. If you must build the Voice yourself, start building it in your second-most productive base, then a few turns later in the most productive base, making sure it will finish in the former base first. Then when the Voice is built, switch your best base to building the Ascent!

This must also be built before you can build Temple of Planet facilities, but this is nearly inconsequential because the construction of the Voice of Planet marks the beginning of the end — if that hadn't begun already.

Weather Paradigm

 * Prerequisite: Centauri Ecology
 * Cuts terraforming times in half, and gives you access to all of the advanced terraforming techniques short of Soil Enrichment.

This project will help you enormously no matter what faction you play! The ability to begin construction of Condensers and Boreholes inside the first hundred turns of play is....simply too huge to pass on! No matter what your style or faction of choice, this project should be very high on your list, and in MP games, whoever gets it will be far ahead of every other player in that game from the moment resource restrictions begin to come off.

Xenoempathy Dome

 * Prerequisite: Centauri Meditation
 * All fungus squares are treated as roads. The rate at which your formers plant and remove fungus is doubled.  All native lifeforms you breed gain a +1 lifecycle bonus.

Anyone who plans on pursuing a "Native" strategy, or anyone who is completely hemmed in by fungus in the early game really, really, really needs this project. Otherwise, skip it for something more essential. Another unstated effect of this project is that units in fungus can fully heal.

''Some of this information was originally written by Velociryx in his SMAC FAQ. Used with permission.''


text:
General Mechanics/Statics

If a rigid body is initially at rest, it will remain at rest if and only if the sum of all the forces and the sum of all the torques acting on the body are zero. As an example, a mass balance with arms of differing length is shown in figure above.

The balance beam is subject to three forces pointing upward or downward, the tension T in the string from which the beam is suspended and the weights M1g and M2g exerted on the beam by the two suspended masses. The parameter g is the local gravitational field and the balance beam itself is assumed to have negligible mass. Taking upward as positive, the force condition for static equilibrium is

 * $$T-M_1 g - M_2 g = 0 \quad \mbox{Zero net force}$$

Defining a counterclockwise torque to be positive, the torque balance computed about the pivot point in figure 10.7 is

 * $$\tau=M_1 g d_1 - M_2 g d_2 = 0 \quad \mbox{Zero torque}$$

where d1 and d2 are the lengths of the beam arms.

The first of the above equations shows that the tension in the string must be

 * $$T=\left( M_1 +M_2 \right) g$$

while the second shows that

 * $$\frac{M_1}{M_2}=\frac{d_2}{d_1} $$

Thus, the tension in the string is just equal to the weight of the masses attached to the balance beam, while the ratio of the two masses equals the inverse ratio of the associated beam arm lengths.

title: General Mechanics/Statics