|
| 1 | +--- |
| 2 | +author: "Yingbo Ma, Chris Rackauckas" |
| 3 | +title: "Classical Physics Models" |
| 4 | +--- |
| 5 | + |
| 6 | + |
1 | 7 | If you're getting some cold feet to jump in to DiffEq land, here are some handcrafted differential equations mini problems to hold your hand along the beginning of your journey. |
2 | 8 |
|
3 | 9 | ## First order linear ODE |
@@ -229,6 +235,72 @@ sol = solve(double_pendulum_problem, Vern7(), abs_tol=1e-10, dt=0.05); |
229 | 235 | ```` |
230 | 236 |
|
231 | 237 |
|
| 238 | +```` |
| 239 | +retcode: Success |
| 240 | +Interpolation: specialized 7th order lazy interpolation |
| 241 | +t: 302-element Array{Float64,1}: |
| 242 | + 0.0 |
| 243 | + 0.05 |
| 244 | + 0.1223079052234777 |
| 245 | + 0.21763564439678446 |
| 246 | + 0.32592132827555614 |
| 247 | + 0.45428546205171927 |
| 248 | + 0.609957416358271 |
| 249 | + 0.7734779293497827 |
| 250 | + 0.9540060574595153 |
| 251 | + 1.1799033713407105 |
| 252 | + ⋮ |
| 253 | + 48.68829170708072 |
| 254 | + 48.90897270610238 |
| 255 | + 49.074198457665524 |
| 256 | + 49.26762992059672 |
| 257 | + 49.41331132773069 |
| 258 | + 49.58656471302393 |
| 259 | + 49.73635419325158 |
| 260 | + 49.929069338760755 |
| 261 | + 50.0 |
| 262 | +u: 302-element Array{Array{Float64,1},1}: |
| 263 | + [0.0, 1.0471975511965976, 0.0, 1.8849555921538759] |
| 264 | + [0.05276815671595484, 1.071438957072351, 0.09384176137401032, 1.8607344940 |
| 265 | +613866] |
| 266 | + [0.13361722361756873, 1.1748571429557286, 0.2248435889699277, 1.7496025555 |
| 267 | +94999] |
| 268 | + [0.2537554611755441, 1.3400852896072526, 0.38108445951036796, 1.5187573131 |
| 269 | +93717] |
| 270 | + [0.40410119950098694, 1.4024410831505718, 0.5301603161398095, 1.2396279286 |
| 271 | +879397] |
| 272 | + [0.5728649474072226, 1.169954418422348, 0.6718502052458136, 0.985420423048 |
| 273 | +6661] |
| 274 | + [0.7088857697515267, 0.5369386864730226, 0.8084759913872458, 0.77868578782 |
| 275 | +44005] |
| 276 | + [0.7353785982784866, -0.19338512009518283, 0.9169953717631636, 0.529156767 |
| 277 | +0987339] |
| 278 | + [0.6472090513598847, -0.715269349725902, 0.9734453010510711, 0.05435804962 |
| 279 | +99323] |
| 280 | + [0.46935732113951517, -0.7327102879675962, 0.887866370720516, -0.862790816 |
| 281 | +96396] |
| 282 | + ⋮ |
| 283 | + [-0.67975290420246, 0.13973286964103626, -0.6514876665177031, 1.4454143327 |
| 284 | +848226] |
| 285 | + [-0.4549919175434134, 1.9015781454592204, -0.36771741048108453, 1.07270407 |
| 286 | +51077042] |
| 287 | + [-0.08586635119481108, 2.28552090644888, -0.19809628081445166, 1.112713727 |
| 288 | +902364] |
| 289 | + [0.2498746728460613, 1.030480739331191, 0.08577212263454681, 1.84513901689 |
| 290 | +03863] |
| 291 | + [0.3320815110176066, 0.25499621194857525, 0.3793211991189911, 2.0716610618 |
| 292 | +98589] |
| 293 | + [0.39238335257281043, 0.5691064464087552, 0.6955158132179681, 1.4770421393 |
| 294 | +438187] |
| 295 | + [0.5050439638383725, 0.8813133553208242, 0.8649801258453232, 0.79454052641 |
| 296 | +52658] |
| 297 | + [0.6711792406408479, 0.7375180832629122, 0.9459177363546021, 0.09015063400 |
| 298 | +030744] |
| 299 | + [0.7166955252930275, 0.5339053276716273, 0.9454344718959518, -0.0972716375 |
| 300 | +5146666] |
| 301 | +```` |
| 302 | + |
| 303 | + |
232 | 304 |
|
233 | 305 | ````julia |
234 | 306 | #Obtain coordinates in Cartesian Geometry |
@@ -362,6 +434,72 @@ sol = solve(prob, Vern9(), abs_tol=1e-16, rel_tol=1e-16); |
362 | 434 | ```` |
363 | 435 |
|
364 | 436 |
|
| 437 | +```` |
| 438 | +retcode: Success |
| 439 | +Interpolation: specialized 9th order lazy interpolation |
| 440 | +t: 92-element Array{Float64,1}: |
| 441 | + 0.0 |
| 442 | + 0.002767153900836259 |
| 443 | + 0.019390834923504494 |
| 444 | + 0.12119935187168689 |
| 445 | + 0.530301790748649 |
| 446 | + 1.1815820951240696 |
| 447 | + 1.9076818589199944 |
| 448 | + 2.760621588805973 |
| 449 | + 3.605356397694905 |
| 450 | + 4.619986523154658 |
| 451 | + ⋮ |
| 452 | + 91.46207401166643 |
| 453 | + 92.80356604989571 |
| 454 | + 93.85953574845666 |
| 455 | + 95.06904060013457 |
| 456 | + 96.26535461031364 |
| 457 | + 97.42922082465732 |
| 458 | + 98.66129338374192 |
| 459 | + 99.77739539466218 |
| 460 | + 100.0 |
| 461 | +u: 92-element Array{Array{Float64,1},1}: |
| 462 | + [0.0, 0.1, 0.5, 0.0] |
| 463 | + [0.0013835748315707893, 0.09999965542762242, 0.4999977028602053, -0.000249 |
| 464 | +04536251688065] |
| 465 | + [0.00969468838029096, 0.09998307727738429, 0.4998872044881803, -0.00174569 |
| 466 | +51735989768] |
| 467 | + [0.06042185852124362, 0.09933514655181921, 0.49560211524963727, -0.0110343 |
| 468 | +31488800994] |
| 469 | + [0.25058314954625777, 0.08601880052006405, 0.41888733977799825, -0.0574223 |
| 470 | +4854837401] |
| 471 | + [0.4444070725050881, 0.011729989621118292, 0.15861982132709898, -0.1786214 |
| 472 | +7581375334] |
| 473 | + [0.4473066382282281, -0.16320285100673101, -0.13126053699732168, -0.278919 |
| 474 | +260652333] |
| 475 | + [0.2584572479002514, -0.35063663280889906, -0.2790546850571461, -0.0991017 |
| 476 | +7915852485] |
| 477 | + [0.004597212445906916, -0.2765685142768536, -0.312548979741221, 0.26654022 |
| 478 | +206668787] |
| 479 | + [-0.2725985862807251, 0.0888755547420482, -0.17762619800611465, 0.36446229 |
| 480 | +045208195] |
| 481 | + ⋮ |
| 482 | + [-0.2114517878067161, 0.0730906156176862, -0.2152584827559103, 0.395877687 |
| 483 | +0516688] |
| 484 | + [-0.1651820081856587, 0.39689185721893394, 0.3024690065429725, 0.055847135 |
| 485 | +94737721] |
| 486 | + [0.1983089199690154, 0.31747189605713433, 0.2712578251378906, -0.205083319 |
| 487 | +12354352] |
| 488 | + [0.2589198172932789, -0.09448897836357471, -0.1423573171660115, -0.4186496 |
| 489 | +601369496] |
| 490 | + [0.012425073399517497, -0.4034830628308482, -0.22915816033577166, 0.016158 |
| 491 | +45936515269] |
| 492 | + [-0.23244506354682215, -0.08009238032616647, -0.15414702520990145, 0.42836 |
| 493 | +918054426903] |
| 494 | + [-0.18927473635920564, 0.34544617499081803, 0.2560388635086127, 0.20350117 |
| 495 | +082002062] |
| 496 | + [0.1741544372800989, 0.41603304066553226, 0.26940699405279905, -0.07855686 |
| 497 | +343548968] |
| 498 | + [0.2254464439669529, 0.3916330728294025, 0.18834406694149203, -0.141257764 |
| 499 | +88921374] |
| 500 | +```` |
| 501 | + |
| 502 | + |
365 | 503 |
|
366 | 504 | ````julia |
367 | 505 | # Plot the orbit |
@@ -438,6 +576,73 @@ sol2 = solve(prob, KahanLi8(), dt=1/10); |
438 | 576 | ```` |
439 | 577 |
|
440 | 578 |
|
| 579 | +```` |
| 580 | +retcode: Success |
| 581 | +Interpolation: 3rd order Hermite |
| 582 | +t: 1002-element Array{Float64,1}: |
| 583 | + 0.0 |
| 584 | + 0.1 |
| 585 | + 0.2 |
| 586 | + 0.30000000000000004 |
| 587 | + 0.4 |
| 588 | + 0.5 |
| 589 | + 0.6 |
| 590 | + 0.7 |
| 591 | + 0.7999999999999999 |
| 592 | + 0.8999999999999999 |
| 593 | + ⋮ |
| 594 | + 99.29999999999863 |
| 595 | + 99.39999999999863 |
| 596 | + 99.49999999999862 |
| 597 | + 99.59999999999862 |
| 598 | + 99.69999999999861 |
| 599 | + 99.7999999999986 |
| 600 | + 99.8999999999986 |
| 601 | + 99.9999999999986 |
| 602 | + 100.0 |
| 603 | +u: 1002-element Array{RecursiveArrayTools.ArrayPartition{Float64,Tuple{Arra |
| 604 | +y{Float64,1},Array{Float64,1}}},1}: |
| 605 | + [0.5, 0.0][0.0, 0.1] |
| 606 | + [0.497004124813899, -0.009071101031878595][0.049900082497367014, 0.0995482 |
| 607 | +2053953173] |
| 608 | + [0.488065986503409, -0.01856325999777532][0.09920263962777168, 0.098171713 |
| 609 | +8550656] |
| 610 | + [0.4733339415930383, -0.028870094978230895][0.1473200401467506, 0.09580835 |
| 611 | +287880228] |
| 612 | + [0.45305474121099776, -0.040331734000937175][0.1936844146808317, 0.0923591 |
| 613 | +1550101675] |
| 614 | + [0.4275722362076315, -0.0532114683862374][0.2377574398051348, 0.0876946285 |
| 615 | +7458447] |
| 616 | + [0.39732459499168415, -0.06767627591286327][0.279039924450448, 0.081663862 |
| 617 | +02131776] |
| 618 | + [0.36283926518715554, -0.08378216859669584][0.3170810117622551, 0.07410453 |
| 619 | +631898412] |
| 620 | + [0.3247249463611115, -0.10146505675930295][0.35148673325356056, 0.06485472 |
| 621 | +395637552] |
| 622 | + [0.2836600192614762, -0.12053752272622162][0.3819275865822665, 0.053765070 |
| 623 | +97805092] |
| 624 | + ⋮ |
| 625 | + [0.3573608346071073, 0.043775799566172786][0.018901094264629065, 0.4241854 |
| 626 | +6702794857] |
| 627 | + [0.35056546788922516, 0.01917894635581023][0.054352325047751296, 0.4273357 |
| 628 | +603171658] |
| 629 | + [0.3372619546371046, -0.00582469608876845][0.08879705585509527, 0.42800766 |
| 630 | +78341491] |
| 631 | + [0.317723101892544, -0.031415069954177][0.12159668542307678, 0.42615121224 |
| 632 | +761354] |
| 633 | + [0.2923883191107272, -0.057726485993246215][0.15214830714764738, 0.4217005 |
| 634 | +4930538214] |
| 635 | + [0.2618505981512214, -0.0848309469334548][0.17990076750513168, 0.414579396 |
| 636 | +5132324] |
| 637 | + [0.22683770400643935, -0.11272570532234003][0.2043691308538718, 0.40470792 |
| 638 | +450133325] |
| 639 | + [0.1881879739856503, -0.1413256709667938][0.22514698919068493, 0.392010653 |
| 640 | +57989734] |
| 641 | + [0.18818797398508524, -0.14132567096720045][0.2251469891909496, 0.39201065 |
| 642 | +35796987] |
| 643 | +```` |
| 644 | + |
| 645 | + |
441 | 646 |
|
442 | 647 |
|
443 | 648 |
|
@@ -527,63 +732,42 @@ DiffEqTutorials.weave_file("models","01-classical_physics.jmd") |
527 | 732 |
|
528 | 733 | Computer Information: |
529 | 734 | ``` |
530 | | -Julia Version 1.4.0 |
531 | | -Commit b8e9a9ecc6 (2020-03-21 16:36 UTC) |
| 735 | +Julia Version 1.4.2 |
| 736 | +Commit 44fa15b150* (2020-05-23 18:35 UTC) |
532 | 737 | Platform Info: |
533 | | - OS: Windows (x86_64-w64-mingw32) |
534 | | - CPU: Intel(R) Core(TM) i7-4720HQ CPU @ 2.60GHz |
| 738 | + OS: Linux (x86_64-pc-linux-gnu) |
| 739 | + CPU: Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz |
535 | 740 | WORD_SIZE: 64 |
536 | 741 | LIBM: libopenlibm |
537 | | - LLVM: libLLVM-8.0.1 (ORCJIT, haswell) |
| 742 | + LLVM: libLLVM-8.0.1 (ORCJIT, skylake) |
538 | 743 | Environment: |
539 | | - JULIA_EDITOR = "C:\Users\sebastian\AppData\Local\atom\app-1.45.0\atom.exe" -a |
| 744 | + JULIA_DEPOT_PATH = /builds/JuliaGPU/DiffEqTutorials.jl/.julia |
| 745 | + JULIA_CUDA_MEMORY_LIMIT = 536870912 |
| 746 | + JULIA_PROJECT = @. |
540 | 747 | JULIA_NUM_THREADS = 4 |
541 | 748 |
|
542 | 749 | ``` |
543 | 750 |
|
544 | 751 | Package Information: |
545 | 752 |
|
546 | 753 | ``` |
547 | | -Status `~\.julia\dev\DiffEqTutorials\Project.toml` |
548 | | -[2169fc97-5a83-5252-b627-83903c6c433c] AlgebraicMultigrid 0.2.2 |
549 | | -[7e558dbc-694d-5a72-987c-6f4ebed21442] ArbNumerics 1.0.2 |
550 | | -[6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf] BenchmarkTools 0.5.0 |
551 | | -[be33ccc6-a3ff-5ff2-a52e-74243cff1e17] CUDAnative 3.0.1 |
552 | | -[159f3aea-2a34-519c-b102-8c37f9878175] Cairo 1.0.2 |
553 | | -[3a865a2d-5b23-5a0f-bc46-62713ec82fae] CuArrays 2.0.1 |
554 | | -[55939f99-70c6-5e9b-8bb0-5071ed7d61fd] DecFP 0.4.10 |
555 | | -[abce61dc-4473-55a0-ba07-351d65e31d42] Decimals 0.4.1 |
556 | | -[ebbdde9d-f333-5424-9be2-dbf1e9acfb5e] DiffEqBayes 2.1.1 |
557 | | -[eb300fae-53e8-50a0-950c-e21f52c2b7e0] DiffEqBiological 4.2.0 |
558 | | -[459566f4-90b8-5000-8ac3-15dfb0a30def] DiffEqCallbacks 2.12.1 |
559 | | -[f3b72e0c-5b89-59e1-b016-84e28bfd966d] DiffEqDevTools 2.18.0 |
560 | | -[9fdde737-9c7f-55bf-ade8-46b3f136cc48] DiffEqOperators 4.8.1 |
561 | | -[1130ab10-4a5a-5621-a13d-e4788d82bd4c] DiffEqParamEstim 1.13.0 |
562 | | -[055956cb-9e8b-5191-98cc-73ae4a59e68a] DiffEqPhysics 3.5.0 |
563 | | -[0c46a032-eb83-5123-abaf-570d42b7fbaa] DifferentialEquations 6.12.0 |
564 | | -[31c24e10-a181-5473-b8eb-7969acd0382f] Distributions 0.23.1 |
565 | | -[497a8b3b-efae-58df-a0af-a86822472b78] DoubleFloats 1.1.6 |
566 | | -[f6369f11-7733-5829-9624-2563aa707210] ForwardDiff 0.10.9 |
567 | | -[7073ff75-c697-5162-941a-fcdaad2a7d2a] IJulia 1.21.1 |
568 | | -[23fbe1c1-3f47-55db-b15f-69d7ec21a316] Latexify 0.12.3 |
569 | | -[c7f686f2-ff18-58e9-bc7b-31028e88f75d] MCMCChains 3.0.7 |
570 | | -[eff96d63-e80a-5855-80a2-b1b0885c5ab7] Measurements 2.1.1 |
571 | | -[961ee093-0014-501f-94e3-6117800e7a78] ModelingToolkit 1.4.2 |
572 | | -[2774e3e8-f4cf-5e23-947b-6d7e65073b56] NLsolve 4.3.0 |
573 | | -[429524aa-4258-5aef-a3af-852621145aeb] Optim 0.20.1 |
574 | | -[1dea7af3-3e70-54e6-95c3-0bf5283fa5ed] OrdinaryDiffEq 5.32.0 |
575 | | -[65888b18-ceab-5e60-b2b9-181511a3b968] ParameterizedFunctions 5.0.3 |
576 | | -[91a5bcdd-55d7-5caf-9e0b-520d859cae80] Plots 0.29.8 |
577 | | -[d330b81b-6aea-500a-939a-2ce795aea3ee] PyPlot 2.8.2 |
578 | | -[731186ca-8d62-57ce-b412-fbd966d074cd] RecursiveArrayTools 2.1.0 |
579 | | -[47a9eef4-7e08-11e9-0b38-333d64bd3804] SparseDiffTools 1.4.0 |
580 | | -[684fba80-ace3-11e9-3d08-3bc7ed6f96df] SparsityDetection 0.1.2 |
581 | | -[90137ffa-7385-5640-81b9-e52037218182] StaticArrays 0.12.1 |
582 | | -[f3b207a7-027a-5e70-b257-86293d7955fd] StatsPlots 0.14.2 |
583 | | -[c3572dad-4567-51f8-b174-8c6c989267f4] Sundials 3.9.0 |
584 | | -[1986cc42-f94f-5a68-af5c-568840ba703d] Unitful 1.0.0 |
585 | | -[44d3d7a6-8a23-5bf8-98c5-b353f8df5ec9] Weave 0.9.2 |
586 | | -[b77e0a4c-d291-57a0-90e8-8db25a27a240] InteractiveUtils |
| 754 | +Status `/builds/JuliaGPU/DiffEqTutorials.jl/tutorials/models/Project.toml` |
| 755 | +[eb300fae-53e8-50a0-950c-e21f52c2b7e0] DiffEqBiological 4.3.0 |
| 756 | +[f3b72e0c-5b89-59e1-b016-84e28bfd966d] DiffEqDevTools 2.22.0 |
| 757 | +[055956cb-9e8b-5191-98cc-73ae4a59e68a] DiffEqPhysics 3.2.0 |
| 758 | +[0c46a032-eb83-5123-abaf-570d42b7fbaa] DifferentialEquations 6.14.0 |
| 759 | +[31c24e10-a181-5473-b8eb-7969acd0382f] Distributions 0.23.4 |
| 760 | +[587475ba-b771-5e3f-ad9e-33799f191a9c] Flux 0.10.4 |
| 761 | +[f6369f11-7733-5829-9624-2563aa707210] ForwardDiff 0.10.11 |
| 762 | +[23fbe1c1-3f47-55db-b15f-69d7ec21a316] Latexify 0.13.5 |
| 763 | +[961ee093-0014-501f-94e3-6117800e7a78] ModelingToolkit 3.11.0 |
| 764 | +[2774e3e8-f4cf-5e23-947b-6d7e65073b56] NLsolve 4.4.0 |
| 765 | +[8faf48c0-8b73-11e9-0e63-2155955bfa4d] NeuralNetDiffEq 1.6.0 |
| 766 | +[429524aa-4258-5aef-a3af-852621145aeb] Optim 0.21.0 |
| 767 | +[1dea7af3-3e70-54e6-95c3-0bf5283fa5ed] OrdinaryDiffEq 5.41.0 |
| 768 | +[91a5bcdd-55d7-5caf-9e0b-520d859cae80] Plots 1.4.4 |
| 769 | +[731186ca-8d62-57ce-b412-fbd966d074cd] RecursiveArrayTools 2.5.0 |
| 770 | +[789caeaf-c7a9-5a7d-9973-96adeb23e2a0] StochasticDiffEq 6.23.1 |
587 | 771 | [37e2e46d-f89d-539d-b4ee-838fcccc9c8e] LinearAlgebra |
588 | | -[44cfe95a-1eb2-52ea-b672-e2afdf69b78f] Pkg |
| 772 | +[2f01184e-e22b-5df5-ae63-d93ebab69eaf] SparseArrays |
589 | 773 | ``` |
0 commit comments