KE = 1/2 mv^2
mgh vs -Gmem/r
Gravitational Potential Enery
G = 6.674 * 10^-11Nm^2/kg^2
re = 6400km, Me = 5.97*10^24kg
KE0 + U0 = KEf + Uf
随机应变 ABCD: Always Be Coding and … : хороший
KE = 1/2 mv^2
mgh vs -Gmem/r
Gravitational Potential Enery
G = 6.674 * 10^-11Nm^2/kg^2
re = 6400km, Me = 5.97*10^24kg
KE0 + U0 = KEf + Uf
All objects are mutually attracted
– Accelerate at 10m/s^2
The Train… of Pysics!
What trajectory would the apple follow?
In physics motion at constant speed is indistinguishable from being at rest!
F:10N
time:4.47sec
acceleration:1 m/s^2
Δx=v0t+1/2at^2
10m = 0 + 1/2a(4.47)^2
N = Normal(perpendicular)
FN mg=weight, mg is equal to FN
Forces and trig
if α=30°、Fr=100N sin(30degree)*100
FRX = 50N, Fry = 86.6N cos(30degree)*100
m = 10Kg
mg = 100N
Fry = 50N
Fn = 150N
Frx = 86.6N
Fw = 86.6N
2-D motion can be solved as two
1-D motion problems
Δx = V0t + 1/2αt^2
V = V0 + at
V^2 = V0^2 + 2αΔx
Δox = 10m/s
α- 10m/s^2
Dimensional Analysis
E = mc^2, E = M*L*T
Experiment, Evidence Rules, Motion Equation
1D/ 2D ΔX = v0t + 1/2at^2
Explain the cause of motion
Understand “rest”
the motions of stars and apples have in different, but governed by same laws
Kinematics
1. predictive power
2. important tool
3. solve nature’s puzzle
Galileo Galilei:object fall at constant speed
Aristotle vs Galileo: objects gain speed as they fall
A mass dropped from greater height leaves greater impact
Feathers do fall at constant speed
Air slows objects down! … too fast
Position, Velocity
Velocity: v = Δx / Δt
Acceleration a = ΔV / Δt
v = 5m / 1s = 5 m/s
Average deviation
2.00m, 1.20m, 2.80m -> 1.6/3 => 0.53
1.97m, 1.98m, 1.97m -> 0.02/3 => 0.0067
m / s / s
“constant acceleration means an object gains equal speed during equal time intervals”
Vαt^2
x = t^2, a = 10m/s^2 = g
V0 = 10m/s
latitude
https://www.esrl.noaa.gov/gmd/grad/solcalc/
Shadows and Trigonometry
18m, 10m, β
β = arctan(18/10) in degrees = 60.9°
w = 25m / tan(1.3°) = 1101m
MC = 40,000Km / 3.68, MC = 10,900K
distance to the moon
10900 = πd
d = 3470km
tan(0.5°)=3470 / L
L = 3470 / tan(0.5) = 398,000 km
distance to the sun
cos α = 400,000/L
L = 400,000/ cos89.853°
L = 156,000,000 km
tan, sin, cos
e.g. tanα = 231 /266
using angle table
534.6m, 401.0m
length of bar = 1.00m, length of shadow = 0.126m, α = 7.2°
Eratosthenes vs Reality
try out in Google
cos(44 degrees) = 0.7193319
reverse tangent -> arctan(0.932) in degrees -> 42.98
sin(30 degree) = 0.5
tan(79 degree) = 5.14
arcsin(0.62) in degrees = 38.32°
arctan(4/7) in degrees = 29.74°
arctan(1/40) in degrees = 1.42°
α = 7.2°+- 1.4°
αmin = 5.8°, C = 57,400km
αmax = 8.6°, C = 46,250km
Alexandria:α
Syene
Angle α
Distance d
d / c = α / 360°
c = 360°/α * d
Distance d = 5000 stadia
Eratostheness
How long the earth’s circumstance?
Geometry sun’s position
Plato “The earth’s circumference is 400,000 stadia.”
≒ 74,000
1 stadium = 185m
True Circumference is 40,000 Km
Plato’s guess was 85% larger than the true circumference.
Archimedes: circumference of Earth is 300,000 stadia
Archimedes: Look at the geometry of a sphere and find a clever way to calculate the circumference
AVAudioRecorder
Record VC
func audioRecorderDidFinishRecording(_ recorder: AVAudioRecorder, successfully flag: Bool){ if flag { performSegue(withIdentifier: "stopRecording", sender: audioRecorder.url) } else { print("recording was not successful") } }
override func prepare(for segue: UIStoryboardSegue, sender: Any?){ if segue.identifier == "stopRecording"{ let laySoundsVC = segue.destination as! PlaySoundsViewController let recordedAudioURL = sender as! url playSoundVC.recordedAudioURL = recordedAudioURL } }
Stack Views: Horizontal, Vertical
-alignment, distribution, spacing
AVAudioEngine
var dollars:Int = 10 var cents:Int = 50 var amount = "$\(dollars).\(cents)" print(amount) dollars = 19 centsd = 99 amount = "$\(dollars).\(cents)" print(amout) func printMoneyString(dollars:Int, cents:Int){ print("$\(dollars).\(cents)") }
Document Outline in Xcode
Model View Controller
view(UIView, UILabel, UIButton), controller, model
AutoLayout Basics
@IBOutlet weak var recordButton: UIButton! @IBOutlet weak var recordingLabel: UILabel! @IBOutlet weak var resumeButton: UIButton! @IBOutlet weak var resumeLabel: UILabel! @IBOutlet weak var pauseButton: UIButton! @IBOutlet weak var pauseLabel: UILabel! @IBOutlet weak var stopButton: UIButton! @IBOutlet weak var stopLabel: UILabel! @IBOutlet func recordButtonPressed(sender: UIButton){ // ... }
ViewController and Multiple Views
Not Running, Inactive, Active, Background, Suspended
Audio in iOS
Pitch Perfect App, AVFoundation, Core Audio, Audio Hardware
import AVFoundation class ViewController: UIViewController { var audioRecorder: AVAudioRecorder! @IBAction func recordAudio(_ sender: AnyObject){ recordingLabel.text = "Recording in progress" stopRecordingButton.isEnabled = true recordButton.isEnabled = false let dirPath = NSSearchPathForDirectoriesInDomains(.documentDirectory,.userDomainMask, true)[0] as String let recordingName = "recordedVoice.wav" let pathArray = [dirPath, recordingName] let filePath = URL(string: pathArray.joined(separator: "/")) let session = AVAudioSession.sharedInstance() try! session.setCategory(AVAudioSessionCategoryPlayAndRecord, with:AVAudioSessionCategoryOptions.defaultToSpeaker) try! audioRecorder = AVAudioRecorder(url: filePath!, settings: [:]) audioRecorder.isMeteringEnabled = true audioRecorder.prepareToRecord() audioRecorder.record() } }