Introduction to Python. Introduction. First Steps in Python. pseudo random numbers. May 2018

Ähnliche Dokumente
Introduction to Python. Introduction. First Steps in Python. pseudo random numbers. May 2016

Weather forecast in Accra

Accelerating Information Technology Innovation

Informatik für Mathematiker und Physiker Woche 7. David Sommer

Ein Stern in dunkler Nacht Die schoensten Weihnachtsgeschichten. Click here if your download doesn"t start automatically

Pascal Schärli

Logik für Informatiker Logic for computer scientists

Erzeugung von Zufallszahlen mit RANUNI()

Informatik - Übungsstunde

Übungsstunde: Informatik 1 D-MAVT

Fachübersetzen - Ein Lehrbuch für Theorie und Praxis

Wer bin ich - und wenn ja wie viele?: Eine philosophische Reise. Click here if your download doesn"t start automatically

Konkret - der Ratgeber: Die besten Tipps zu Internet, Handy und Co. (German Edition)

Minimaleinführung in Python 3

Algorithmik und Programmieren

Informatik für Mathematiker und Physiker Woche 2. David Sommer

Wie man heute die Liebe fürs Leben findet

Kursbuch Naturheilverfahren: Curriculum der Weiterbildung zur Erlangung der Zusatzbezeichnung Naturheilverfahren (German Edition)

Python Einführung. Monica Selva Soto. 24 März Mathematisches Institut

PONS DIE DREI??? FRAGEZEICHEN, ARCTIC ADVENTURE: ENGLISCH LERNEN MIT JUSTUS, PETER UND BOB

Im Fluss der Zeit: Gedanken beim Älterwerden (HERDER spektrum) (German Edition)

Grundlagen MATLAB. Vorlesung Batteriemodellierung mit MATLAB

Algebraische Spezifikation von Software und Hardware II

Reparaturen kompakt - Küche + Bad: Waschbecken, Fliesen, Spüle, Armaturen, Dunstabzugshaube... (German Edition)

Exercise 6. Compound Types and Control Flow. Informatik I für D-MAVT. M. Gross, ETH Zürich, 2017

RECHNUNGSWESEN. KOSTENBEWUßTE UND ERGEBNISORIENTIERTE BETRIEBSFüHRUNG. BY MARTIN GERMROTH

Aufgabe 1.1. Wählen Sie jene Variablendeklarationen mit Initialisierungen aus, die in Java hinsichtlich der Typen korrekt sind:

PONS DIE DREI??? FRAGEZEICHEN, ARCTIC ADVENTURE: ENGLISCH LERNEN MIT JUSTUS, PETER UND BOB

KTdCW Artificial Intelligence 2016/17 Practical Exercises - PART A

Mercedes OM 636: Handbuch und Ersatzteilkatalog (German Edition)

Algorithms for graph visualization

Duell auf offener Straße: Wenn sich Hunde an der Leine aggressiv verhalten (Cadmos Hundebuch) (German Edition)

SFZPy Sj. 17/18. Python Jupyter / Spyder. SFZ 16/17 W.Seyboldt

Privatverkauf von Immobilien - Erfolgreich ohne Makler (German Edition)

Methoden der empirischen Kommunikationsforschung: Eine Einführung (Studienbücher zur Kommunikations- und Medienwissenschaft) (German Edition)

Neue Materialien für einen realitätsbezogenen Mathematikunterricht 1: ISTRON-Schriftenreihe (Realitätsbezüge im Mathematikunterricht) (German Edition)

Intrinsische Motivation und Advanced Nursing Practice: Unterstützungsmöglichkeiten im Unterricht (German Edition)

Die UN-Kinderrechtskonvention. Darstellung der Bedeutung (German Edition)

Killy Literaturlexikon: Autoren Und Werke Des Deutschsprachigen Kulturraumes 2., Vollstandig Uberarbeitete Auflage (German Edition)

Nürnberg und der Christkindlesmarkt: Ein erlebnisreicher Tag in Nürnberg (German Edition)

7. Einführung in C++ Programmieren / Algorithmen und Datenstrukturen 1 Prof. Dr. Bernhard Humm FB Informatik, Hochschule Darmstadt

Im Zeichen der Sonne: Schamanische Heilrituale (German Edition)

WS2017/ Oktober 2017

Betriebliche Anspruchsgruppen. Der Shareholder- Value- und der Stakeholder-Value Ansatz (German Edition)

VGM. VGM information. HAMBURG SÜD VGM WEB PORTAL USER GUIDE June 2016

Handbuch der therapeutischen Seelsorge: Die Seelsorge-Praxis / Gesprächsführung in der Seelsorge (German Edition)

Übung 3: VHDL Darstellungen (Blockdiagramme)

Das Zeitalter der Fünf 3: Götter (German Edition)

Was heißt Denken?: Vorlesung Wintersemester 1951/52. [Was bedeutet das alles?] (Reclams Universal-Bibliothek) (German Edition)

Schule mit Erfolg. Englisch Simple present adverbs time Unit Blatt What time is it? 7.50 Uhr Uhr Uhr Uhr 20.

There are 10 weeks this summer vacation the weeks beginning: June 23, June 30, July 7, July 14, July 21, Jul 28, Aug 4, Aug 11, Aug 18, Aug 25

Der Wetterbericht für Deutschland. Read the weather reports and draw the correct weather symbols for each town.

Freiwilliges Engagement in Sportvereinen. Wandel und Probleme (German Edition)

Programming 101. Carl Herrmann IPMB & DKFZ

Die "Badstuben" im Fuggerhaus zu Augsburg

DAS ZUFRIEDENE GEHIRN: FREI VON DEPRESSIONEN, TRAUMATA, ADHS, SUCHT UND ANGST. MIT DER BRAIN-STATE-TECHNOLOGIE DAS LEBEN AUSBALANCIEREN (GE

Englisch-Grundwortschatz

Die einfachste Diät der Welt: Das Plus-Minus- Prinzip (GU Reihe Einzeltitel)

Warum nehme ich nicht ab?: Die 100 größten Irrtümer über Essen, Schlanksein und Diäten - Der Bestseller jetzt neu!

Web-Apps mit jquery Mobile: Mobile Multiplattform-Entwicklung mit HTML5 und JavaScript (German Edition)

Funktion der Mindestreserve im Bezug auf die Schlüsselzinssätze der EZB (German Edition)

DAS ERSTE MAL UND IMMER WIEDER. ERWEITERTE SONDERAUSGABE BY LISA MOOS

SAMPLE EXAMINATION BOOKLET

Der Topos Mütterlichkeit am Beispiel Bertolt Brechts "Der kaukasische Kreidekreis" und "Mutter Courage und ihre Kinder" (German Edition)

Java Tools JDK. IDEs. Downloads. Eclipse. IntelliJ. NetBeans. Java SE 8 Java SE 8 Documentation

Angewandte Mathematik und Programmierung

ETHISCHES ARGUMENTIEREN IN DER SCHULE: GESELLSCHAFTLICHE, PSYCHOLOGISCHE UND PHILOSOPHISCHE GRUNDLAGEN UND DIDAKTISCHE ANSTZE (GERMAN

Programmier-Befehle - Woche 10

FACHKUNDE FüR KAUFLEUTE IM GESUNDHEITSWESEN FROM THIEME GEORG VERLAG

VGM. VGM information. HAMBURG SÜD VGM WEB PORTAL - USER GUIDE June 2016

EINFÜHRUNG IN DIE PROGRAMMIERUNG

Magic Figures. We note that in the example magic square the numbers 1 9 are used. All three rows (columns) have equal sum, called the magic number.

EINFÜHRUNG IN DIE PROGRAMMIERUNG

1 Eine Einführung in die objektorientierte Programmierung

Aus FanLiebe zu Tokio Hotel: von Fans fã¼r Fans und ihre Band

CNC ZUR STEUERUNG VON WERKZEUGMASCHINEN (GERMAN EDITION) BY TIM ROHR

NOREA Sprachführer Norwegisch: Ein lustbetonter Sprachkurs zum Selbstlernen (German Edition)

Diktat: Viele Geburtstage

Die besten Chuck Norris Witze: Alle Fakten über den härtesten Mann der Welt (German Edition)

1 Berechnung von Summen (ca = 10 Punkte)

DAS E-COMMERCE BUCH: MARKTANALYSEN - GESCHäFTSMODELLE - STRATEGIEN (GERMAN EDITION) BY ALEXANDER GRAF, HOLGER SCHNEIDER

Level 1 German, 2014

Python als praktischer Helfer

Willy Pastor. Click here if your download doesn"t start automatically

Unit 4. The Extension Principle. Fuzzy Logic I 123

Algorithms & Datastructures Midterm Test 1

So schreiben Sie ein Buch: Geld verdienen mit Texten (German Edition)

DAS HUMANISTISCHE MENSCHENBILD AM BEISPIEL CARL ROGERS (GERMAN EDITION) BY ANNA-MARIA SKORA

image.png Die Dokumentation von Python, welche ich so sehr empfehle, findet ihr hier:

Transkript:

to to May 2018

to What is Programming? All computers are stupid. All computers are deterministic. You have to tell the computer what to do. You can tell the computer in any (programming) language) you like.

to What is? is a very powerful, but easy language. Why easy? You can learn it easily. It is like writing down logic in code, only that the code is the real code (Unlike many other programming languages). Why powerful? There is nearly nothing you cannot do: Calculate, Draw, Plot, Read data (from anywhere), Simulate, Analyse data, Web applications, Make real executable programs (GUI), interactive programs,... The best thing: Open Source: Probably somebody in the world has already done what you want to do.

to Workflow Write your code/program. No compiling step necessary Execute your program. Other languages: C,C++, Fortran. You have to compile, after writing your code, before executing.

to Executing python online www.trinket.io Sign up. Write your code. Run it.

to Our first line of code Variable definition CODE: name = value

to Console Output CODE: print name

to Variable types CODE: print type(name)

to Variable types string: sequence of characters ( Hallo ) integer: positive or negative natural number, inclusive zero (..,-2, -1, 0, 1, 2,..) float: floating point number (1,2345) bool: True or False

to Math expressions CODE: a + b a - b a * b a / b a ** b

to Examples CODE: i = 2 j = 5 print i, j, i+j k = 2.5 print k*i print i*k

to Logic operations CODE: if a==1: print "a ist 1" elif a==2: print "a ist 2" else: print "a ist irgendwas."

to Logic operators == < > <= >=!= equal smaller larger smaller or equal larger or equal not equal CODE: if a <= 5 and a >2: print "a ist 3, 4 oder 5"

to Lists CODE: list = [1,2,3,4,5] list = ["ha","he","hi","ho"] print "erstes Element: print "drittes Element: ", list[0] ", list[2]

to Loops CODE: for element in list: print "Listenelement ist ", element for element in range(10): print "Listenelement ist ", element while a <= 5: print a a = a+1

to Functions CODE: def func name(input1, input2): print input1, input2 print input1*input2 return input1**input2

to Libraries CODE: import libraryname as othername common libraries: numpy, matplotlib.pyplot,...

to Using libraries CODE: import libraryname as othername common libraries: numpy, matplotlib.pyplot,... USAGE e.g.: import numpy as np print np.exp(1) array = np.array([1,2,3]) array auto = np.linspace(1,10,10)

to Pseudozufallszahlen Pseudozufallszahlen sind Zahlenfolgen die durch einen deterministischen Algorithmus (Pseudozufallszahlengenerator) berechnet werden (und somit nicht zufällig sind). Für hinreichend kurze Sequenzen sehen sie jedoch zufällig aus. Bei jedem Start der Zufallszahlen-Berechnung mit gleichem Startwert (seed) wird die gleiche Zahlenfolge erzeugt.

to Zufallszahlen in Modul laden: import Zufallszahlengenerator mit seed [x] initialisieren:.seed([x]) Zufallszahl zwischen 0.0 und 1.0 aufrufen:.() Zufallszahl zwischen a und b aufrufen:.uniform(a, b) Ohne.seed([x]) verwendet die Systemzeit um einen Seed zu generieren.

to Aufgabe: Berechnen Sie π. Wählen sie ein geeignetes Koordinatensystem. Rechnen sie zufällige Punkte aus und bestimmen ob diese im Kreis liegen. Das Verhältnis der Flächen von Kreis und Quadrat entspricht dem Verhältnis der Zufallswerte in Kreis und Quadrat.

to Tipps zur Aufgabe KP: Punkte im Kreis QP: Punkte im Quadrat Koordinaten immer von 0 bis 2. KP QP = A Kreis = π 12 A Quadrat 4 π = 4 KP QP Schleife 10 mal ausführen: for i in range(10): (1) (2)

to Lösung der Aufgabe import QP = 0 KP = 0 for i in range(10): x = 2.0 *.() y = 2.0 *.() r = ((x-1.0)**2 + (y-1.0)**2)**0.5 QP = QP+1 if r <= 1.0: KP = KP+1 print Pi:, 4*KP/QP

to Aufgabe 11: Ideales Gas Leiten Sie aus der Zustandssumme für das ideale Gas ihre Zustandsgleichung ab: h λ = 2π mkb T (3) Z = V N N! 1 λ 3N = 1 ( ) V N N! λ 3 (4) a) ( ) ( ) F ln(z) p = = k B T V T,N V T,N = k BT Z ( ) Z V (5) ( λ 3 = k B T N! V ) N } {{ } 1 Z 1 NV N 1 N! λ 3N = k B T 1 V (6)

to Aufgabe 11: Ideales Gas b) Zeigen Sie, dass die Freie Energie des ideales Gases gegeben wird durch: F = k B T ln(z) = k B T ln ( 1 N! ( ) ) V N λ 3 (7) = k B T (N ln(v ) N ln(λ 3 ) ln(n!)) (8) = k B T (N ln(v ) N ln(λ 3 ) N ln(n) + N) }{{} Stirling Formel = Nk B T (1+ln(V ) ln(λ 3 ) ln(n)) = Nk B T ( ) ( F p = = Nk B T V V ( ) ln(v ) = Nk B T V ( ( ) V 1 + ln N λ 3 ) (1 + ln(v ) ln(λ 3 ) ln(n)) = Nk BT V (9)