forked from SciML/ModelingToolkitWorkshop_JuliaCon2024
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSymbolicNumericMTK.jl
More file actions
2733 lines (2224 loc) · 106 KB
/
SymbolicNumericMTK.jl
File metadata and controls
2733 lines (2224 loc) · 106 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
### A Pluto.jl notebook ###
# v0.19.43
using Markdown
using InteractiveUtils
# ╔═╡ a2117e3a-3d10-11ef-1481-214230309bd1
using Symbolics
# ╔═╡ 1ca9b97e-1514-4dff-a1d5-aacfedd748ca
using OrdinaryDiffEq
# ╔═╡ ce1cc859-1720-4fde-8c68-38225a2ef188
using ModelingToolkit
# ╔═╡ 9970c51b-5b33-4bc8-82bb-d32d609dc593
using ModelingToolkit: t_nounits as t, D_nounits as D
# ╔═╡ 5166cf38-d593-42d4-9efd-ec02c706673a
using Plots
# ╔═╡ 9e2b6759-c9e1-4960-9c54-1208bfe0a708
md"""
# Symbolic-Numeric Model Definitions with ModelingToolkit.jl
ModelingToolkit.jl is a symbolic system for interfacing with Julia's SciML numerical solver suite. In this tutorial we will walk you through the basics of building mathematical models using the symbolic system.
## Introduction to Julia Symbolics.jl
Before we dive into ModelingToolkit.jl, we should get familiar with Symbolics.jl. Symbolics is a Computer Algebra System (CAS) designed and written in the Julia programming language. You can think of it as similar to Mathematica, Maple, or SymPy, but it's fully written in Julia and is thus uniquely flexible and extendable through normal Julia code!
The importance of Symbolics.jl in this context is that ModelingToolkit is a symbolic-numeric system, where its underlying symbolic definitions are handled via the Symbolics.jl library. Thus, every ModelingToolkit expression is simply a Symbolics.jl expression but with more context ("these equations describe an ODE") around it. Therefore, let's get familiar with building Symbolics expressions.
To start, we define variables using the @variables macro.
"""
# ╔═╡ 8df49897-5b8e-47c8-bd08-5e889d003618
@variables x y
# ╔═╡ 41979a26-2e4a-48cc-9c62-e2c86144eee6
md"""
Now we can use our symbolic variables to define expressions like as follows:
"""
# ╔═╡ 42d7a88f-d8b9-4d33-9792-1a0ed8e2de17
x + y
# ╔═╡ d6dc876d-b2c2-4416-8547-20687100d1b0
x / y
# ╔═╡ 3b063863-d5b9-4fbe-9d72-c47e4c498a96
(sin(x^2) + sin(y^2)) / 2
# ╔═╡ f8b6c266-6f27-47e2-b5f6-d4998e5957f1
md"""
In this Pluto notebook we see that Symbolics.jl is setup with pretty printing to Latex, as in it will automatically generate nice representations of the expression, isn't that cool?
As you can see, Symbolic expressions are "lazy", or in other words, it does not act like a traditional programming expression in that it does not evaluate the expression immediately. Instead, it builds a represention of the expression itself for further manipulation. These expressions can be any Julia expression that is symbolically-representable, i.e. things that have a well-defined mathematical representation (so not things like a solution that is solved to a tolerance)
"""
# ╔═╡ cd30c22f-a827-4090-9c65-13facb82e2af
sqrt(x^2 + y^2)
# ╔═╡ c63bb3da-47c7-4536-8e7d-591d2b30cfa1
md"""
So you think, okay you set that up with built-in Julia functions? No, Symbolics works by having its variable be `Num <: Number`, and so it acts like a number type in Julia. So you can define your own functions and use them with Symbolics as well:
"""
# ╔═╡ 2d3e7ec7-04d8-4607-82ee-cc00762f0245
my_expression(x,y) = sqrt(x^2 + y^2)
# ╔═╡ 91c167e2-608d-445e-b891-74b89d34831e
my_expression(x,y)
# ╔═╡ a83a2753-016b-4df1-9229-0e295f459f28
md"""
And this can get complicated. Here's a few examples. For example, let's define a matrix in Julia and then compute its inverse:
"""
# ╔═╡ 68cda7d4-ee90-4d45-b503-24eeec988230
A = [x y
y x]
# ╔═╡ 28d83dba-d8b0-4e9e-b4f4-502811165c98
md"""
Notice this is simply a "Julia matrix with numbers", so we can call standard computations on it, like compute the inverse:
"""
# ╔═╡ 17e974ab-c449-4bf3-a1cf-09b3da0fee9c
inv(A)
# ╔═╡ adba1f93-9724-48ce-8fd0-c729acbf73f9
md"""
I want to note that this requires no special code in Symbolics, instead the existance of the `inv` function in Julia for generic matrices of numbers gives us this functionality!
As a party trick, let's show what happens on an RK4 integrator:
"""
# ╔═╡ 85133a24-8276-44dc-82b7-43ad9d689bb4
function my_ode(x,p,t)
sin(x^2)
end
# ╔═╡ 77f3698b-8173-4e60-abc2-9488c64d611d
symprob = ODEProblem(my_ode, x, (0.0,1.0))
# ╔═╡ 06eaf852-aca8-4d94-b578-a9c94dc06cba
symsol = solve(symprob, RK4(), adaptive=false, dt = 0.25)
# ╔═╡ 7470fee9-5795-4d3d-8bd8-a065b660eea9
print(symsol[end])
# ╔═╡ 290d82ae-f2b9-47fd-8de0-49d8f5632bba
md"""
Notice that it gives the exact symbolic expression that is used to compute the outputs of the RK4 integrator on this given ODE! Nobody setup the differential equation solvers to be compatible with the symbolic library to do this, this is simply a showcase that the symbolic variables work with any sufficiently generic code (that is representable in a static compute graph, a property we refer to as quasi-static and will completely skip over for now)
"""
# ╔═╡ 2c35072e-45da-4d9c-b66e-e1a25f9c353c
md"""
So back to our regularly scheduled show, why do we want a lazy symbolic representation of mathematical expressions? The reason is because this gives us the ability to pass the full information of what we are modeling and, importantly, manipulate it. Manipulations like this include things like, simplifying the expression, taking its derivative, calculating Groebner basis, or anything else you can think of doing mathematically. Symbolics.jl is a growing library of expression manipulation tools.
So let's start to play with that a bit. Let's start with the common manipulation, taking the derivative of the expression. There is a quick way which is to call the Symbolics.derivative function:
"""
# ╔═╡ 650a6516-1666-4e12-9f9d-f9a48280a7be
Symbolics.derivative(x + x^2, x)
# ╔═╡ 4a8a03c3-541c-479d-9a5a-fa124d7dccae
md"""
However, let's dive a little bit deeper. How does this function work? What it's doing is defining a differential operator Dx which is a symbolic representation of d/dx
"""
# ╔═╡ cf814d55-e9d0-4fc1-b85d-4b4a5ff015f5
Dx = Differential(x)
# ╔═╡ 62b8bb6e-a32a-40ff-b6e2-08076ba3d02a
md"""
And now we apply this operator to our expression:
"""
# ╔═╡ e3361a7f-3712-4193-a177-e016d5bced55
Dx(x + x^2)
# ╔═╡ 08959012-04ca-4973-b3b7-f2ffe94b645d
md"""
But wait, that didn't do anything!
I know I know... remember, we're building symbolic representations! This is the symbolic representation of the expression that is taking the derivative of x + x^2. If you want to compute the derivative, you need to then do `expand_derivatives`
"""
# ╔═╡ c965031c-6481-45a7-a574-6697e8d7b787
expand_derivatives(Dx(x + x^2))
# ╔═╡ 6cee846c-d632-439a-9eb2-4263a6ab3c8a
md"""
When writing differential equations, this distinction will become very important, because we will want to write expressions which have derivatives in them, which of course requires a symbolic representation of the derivative! So keep this bit in mind as a helpful little tool.
Note that it will simplify everything it can and leave undefined values untouched. This is important when dealing with symbolic functions. For example, take a look at the following
"""
# ╔═╡ ac27c29a-d70c-4039-8f5d-e986c82f927c
@variables z(x)
# ╔═╡ fe35b243-1238-437a-8d9b-2df1fc65c719
myderiv = expand_derivatives(Dx(x^2 + z^2))
# ╔═╡ b9c2a07c-2894-4c47-ad13-c8437b64530e
md"""
Because the variable `z` is declared to be a function of x, dz/dx can be a non-trivial quantity, and it generates the symbolic expression for the simplified derivative down to expressions that include dz/dx. You can then use other expression manipulation tools to handle this. For example, let's say we wanted to substitute the value 2 in for dz/dx:
"""
# ╔═╡ 5f3f735d-933c-4de2-996f-83339a75c160
substitute(myderiv, Dict(Dx(z) => 2))
# ╔═╡ e1aa3880-20bc-490f-8ac3-c2dbc89a42f0
md"""
Note that substitution can be used for interpretation if all values are defined:
"""
# ╔═╡ bfa26186-c64b-419b-a424-ff4478fb3fed
Symbolics.value(substitute(myderiv, Dict(x => 1, z => 3, Dx(z) => 2)))
# ╔═╡ 3e54b860-593a-47ed-a2de-39bd0d9e57ba
md"""
There are of course many other tools to make use of, like equation simplification:
"""
# ╔═╡ 3700a04e-1379-4502-bcde-0f4de5e2087d
simplify.([x + x^2 + x + x^2 2x + 4x
x + y + y + 2x x^2 - x^2 + y^2])
# ╔═╡ 3359bfc6-54da-4918-ab4a-a21a8ce30af7
md"""
But for the sake of brevity we will skip over all of the others. Thus many other ways to build and play with symbolic expressions are documented as part of Symbolics.jl. The world is your oyster (and this is developed in Boston where the oysters are great, highly recommended, 10/10, but don't do the tourist trap, instead come contact us for discussions of symbolics over oysters).
"""
# ╔═╡ 1511ab4e-20d5-4c52-a52e-08d56873dc21
md"""
Finally, before moving on we wish to show the function generation tools in Symbolics. While we showed above that substitution can be used for expression evaluation, interpretation is not a very fast way to "run" expressions. Instead, you want to compile these functions to Julia so it JIT compiles something speedy for you, right?
To do this you use `Symbolics.build_function`. It takes in a symbolic expression and then the symbolic arguments, in the order and form, and constructs a Julia expression to that form.
For example, let's look at the following:
"""
# ╔═╡ f836e549-2437-4918-b7c0-775ef6f696d4
myexpr = sin(x^2 + y^2) / cos(z)
# ╔═╡ 66d6353b-800a-4907-ba80-f1b06f724b8e
Base.remove_linenums!(build_function(myexpr, [x,y], z))
# ╔═╡ 85951b69-6ce9-4611-9e61-47bcd1c061ed
md"""
[Base.remove_linenums! is only there to make the printing look nicer!]
Notice that we told it to build a function for `myexpr` where the first argument is the array of values for `[x,y]` and the second argument is the scalar `z`. We can instead tell it to generate function where there is one argument, the array of `[x,y,z]`
"""
# ╔═╡ a2c8d095-4d68-4902-89b0-fc17f12463ee
Base.remove_linenums!(build_function(myexpr, [x,y,z]))
# ╔═╡ f4ec6fb1-a641-47f6-a59a-561ef5d155fb
md"""
That is what is meant by "the symbolic arguments, in the order and form". It is very expressive too, you can tell it to use arrays of arrays, or sparse matrices, etc. as input arguments defining complex Julia functions which then gets optimized on-demand.
But okay, enough about Symbolics.jl for now, onto our main course.
## Building Models with ModelingToolkit.jl
Now we're ready to start building models with ModelingToolkit. Let's use ModelingToolkit to specify the Lotka-Volterra equations, a classic first example in the SciML ecoystem. The equations of this system are:
"""
# ╔═╡ 0323f817-9483-421b-8fd4-bb7939ba087d
@variables 🐰(t) 🐺(t) tot(t)
# ╔═╡ 1044f777-1dad-491a-9ecd-455ed88d0ecf
@parameters α=1.5 β=1.0 γ=3.0 δ=1.0
# ╔═╡ 1e8736bf-16ee-4096-8791-b985e1fdc9c9
eqs = [D(🐰) ~ α * 🐰 - β * 🐰 * 🐺
D(🐺) ~ -γ * 🐺 + δ * 🐰 * 🐺
tot ~ 🐰 + 🐺]
# ╔═╡ e71fd5c6-8e90-4335-868b-9f3dd43209fa
md"""
Yes, I used Symbolics to generate the latex for the equations because that's easier than writing the Latex itself, gotta love it!
But okay, let's talk about a few details. First of all, just like any other Julia project, variables can have any unicode name, including emojis. Now the expression `t_nounits as t` is simplify defining the variable t to be "the standard t", and D as "the standard d/dt".
[We want to make sure we use the same exact variable because symbolic variables can have specific information like metadata, so naming a new variable with the same name as another does not necessarily make them equal!]
In this equation, we wrote out the differential equation using the derivative expressions. Note that we introduced a new operator, `~`, which means equality in symbolic expressions. We do not use `=` because `a = 2` is already defined in (all) computer programming languages to be "assignment". `a = 2; a = 3` is a valid Julia assignment that says "first assign a to be 2, then assign a to be 3". Programming languages generally use `=` to mean assignment, which is distinctly different from equality.
Yes, they did it wrong, but since they are more powerful they can keep their `=` and we will use `~` to represent symbolic equalities.
So up until this point, we still have not effectively used ModelingToolkit at all. Those are simply Symbolics expressions. Next, we impart context to it by defining an ODESystem:
"""
# ╔═╡ b157ae07-48eb-4452-ac00-0ede838aef51
@mtkbuild sys = ODESystem(eqs,t)
# ╔═╡ c3e8dd58-5f6b-41d5-9c32-b0a9b6dc9943
display(sys)
# ╔═╡ f7bdc0a1-8790-413f-bf94-4c7250105657
md"""
In the Pluto notebook it will show a nice representation of the differential equation system, but we included the standard REPL display to show what that's like for completeness. It gives you information about what's in the model, which can be queried for more information:
"""
# ╔═╡ c6b4d7a3-4a24-465f-99a8-382df4ef18a6
equations(sys)
# ╔═╡ 2f940987-15e9-49f2-bd80-35f31b5c78f2
unknowns(sys)
# ╔═╡ c5bf7626-9902-4762-b641-c72ea42f8cd3
parameters(sys)
# ╔═╡ 48da1688-14fa-434c-811e-cb38049aefd3
ModelingToolkit.dump_unknowns(sys)
# ╔═╡ a684a6b2-a61a-4fb8-a115-4c14d3fe97bd
ModelingToolkit.dump_parameters(sys)
# ╔═╡ 6f646d2a-ea87-46f9-9c80-4be640731d17
md"""
Wait a second, where did `tot ~ 🐰 + 🐺` go? ModelingToolkit realized that it does not necessarily need to be computed since it can be reconstructed via the other variables, so during its simplification process it moved it to define an observed quantity based on its equation:
"""
# ╔═╡ ef55083e-0104-4801-bd17-ee4c08966375
observed(sys)
# ╔═╡ 29a59411-b314-4aed-88c8-475a8350151a
md"""
We will see in a second how and why this is important. So now, let's solve this ODE! To do this, we use the ODEProblem constructor. It's just like DifferentialEquations.jl, but instead of taking `ODEProblem(f,u0,tspan,p)`, it takes the system information instead of `f`, it takes a mapping from symbolic values to initial conditions instead of `u0`, tspan is the same, and a mapping for `p`. This looks like:
"""
# ╔═╡ ea59bf7c-33b8-4b08-b166-e8f245ca0bdb
prob = ODEProblem(sys, [🐰 => 1.0, 🐺 => 1.0], (0.0,10.0))
# ╔═╡ d22c73d9-8138-432c-a364-3dfd4a7ecba3
md"""
which we can solve:
"""
# ╔═╡ fa601d68-7a23-488a-9a0d-eb8490b6375d
sol = solve(prob)
# ╔═╡ 5ecb4293-51f9-475f-8e00-05716b4e3bd8
md"""
and tada! We've successfully computed the numerical solution to the symbolically-defined ODEs. But what happened to `tot`? Notice that the solution object has retained full information about the underlying symbolic representation of the problem. This means we can use our symbolic representations instead of indexing in order to query for information. For example:
"""
# ╔═╡ 31547b63-6145-473f-bc42-f275f02f7838
sol[🐰]
# ╔═╡ 7f172342-6385-4e7e-91e2-b1b89ab3289a
md"""
gives the time series for the rabbits, in terms of the solver's time steps. But we can also query it on any observed quantity
"""
# ╔═╡ 6549b3f1-a0b6-4247-9351-ac93ab0635a7
sol[tot]
# ╔═╡ e814b14a-aaf7-4adb-aea0-865752f40c15
md"""
and it will generate the solution on-demand. In fact, it will do this for any symbolic expression:
"""
# ╔═╡ f8642a80-b3a3-4997-8329-6c1320ab4b01
sol[🐰^2 + 🐺^2]
# ╔═╡ ff60566d-5df1-4133-a156-f5fdc53a9064
md"""
This also works with the standard plotting recipe system
"""
# ╔═╡ da989bb3-66ca-4afa-af55-424c1fc6060b
continuous_sol
# ╔═╡ db1386ac-78bf-4c82-95f0-5db89d97d6ec
plot(sol; idxs = [tot, 🐰^2 + 🐺^2])
# ╔═╡ 7daec71f-bc8e-4e04-a185-356f247ac159
md"""
Anywhere that SciML uses an index, you can replace it with a symbolic quantity and it will generate the expression to handle it on-demand. See the SymbolicIndexingInterface.jl for more details on how to use symbolic indexing performantly, and also how to setup your libraries to be similarly compatible with the symbolic indexing interface.
[Note that the plotting library does not like using emojis for its label names. Sad. Someone should really fix that, super high priority for real-world science.]
One other piece not mentioned, how come I didn't specify the parameters in `prob = ODEProblem(sys, [🐰 => 1.0, 🐺 => 1.0], (0.0,10.0))`? That's because the parameters all had default values, i.e. `α=1.5`, which then means that if you don't specify a value at construction it will use that default value. But you can override it at the construction time:
"""
# ╔═╡ 5c812d1c-4167-4bf6-b4f8-6dff91612677
prob2 = ODEProblem(sys, [🐰 => 1.0, 🐺 => 1.0], (0.0,10.0), [α => 3.0])
# ╔═╡ c0098a90-9364-4b7f-a05f-e3c6f76af233
sol2 = solve(prob2)
# ╔═╡ 22491529-7c36-455a-a037-5cc6a0b5a06a
plot(sol2)
# ╔═╡ c33ce529-a200-4193-b5fe-56d6092eb6e4
md"""
Late overrides are a nice tool for interactive evaluation of a solution at different parameters. Note that the same defaulting behavior applies to initial conditions as well.
## Steady State Systems
Before we end, let's show how we can use the same features to define the steady state systems. Well, it's pretty much the same as the ODE constructor:
"""
# ╔═╡ 17622a5d-239d-4734-8112-2d14edbb3185
ssprob = SteadyStateProblem(sys, [🐰 => 1.0, 🐺 => 1.0])
# ╔═╡ a0fcfea1-ca39-43d5-9842-1cb06bf0c778
ss_sol = solve(NonlinearProblem(ssprob))
# ╔═╡ 7bd065bb-67ab-459b-a5f9-0cf454b878b0
md"""
Here, the initial value is the guess for the steady state. The steady state is calculated and it's... zero. Rabbits and wolves only at peace when they are all dead. That's a very deep philisophical statement generated for you by symbolic-numerics.
There are of course a billion ways to solve the ODE / steady state problem, each with many trade-offs. For example, this method used a Newton method to find the zeros of the system, but you can use dynamic time stepping methods (which would fail on this equation because it oscillates indefinitely), and so on. See the documentation for DifferentialEquations.jl and NonlinearSolve.jl respectively for a full treatment of the numerical solvers.
## Conclusion
ModelingToolkit is a symbolic-numeric system, meaning it bridges symbolically-defined equation systems to numerical solvers in order to allow for generating the most robust and efficient code. We briefly saw one optimization where it removed an equation, but that was only scratching the surface. In the next notebooks we will go into a bit more detail as to the more advanced simplifications it can provide.
"""
# ╔═╡ 00000000-0000-0000-0000-000000000001
PLUTO_PROJECT_TOML_CONTENTS = """
[deps]
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
[compat]
ModelingToolkit = "~9.24.0"
OrdinaryDiffEq = "~6.85.0"
Plots = "~1.40.4"
Symbolics = "~5.33.0"
"""
# ╔═╡ 00000000-0000-0000-0000-000000000002
PLUTO_MANIFEST_TOML_CONTENTS = """
# This file is machine-generated - editing it directly is not advised
julia_version = "1.10.4"
manifest_format = "2.0"
project_hash = "abfeaf40a600f92700bbba128d6a9185724540c5"
[[deps.ADTypes]]
git-tree-sha1 = "7a6b285f217ba92b5b474b783b4c2e8cf8218aaa"
uuid = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
version = "1.5.3"
weakdeps = ["ChainRulesCore", "EnzymeCore"]
[deps.ADTypes.extensions]
ADTypesChainRulesCoreExt = "ChainRulesCore"
ADTypesEnzymeCoreExt = "EnzymeCore"
[[deps.AbstractTrees]]
git-tree-sha1 = "2d9c9a55f9c93e8887ad391fbae72f8ef55e1177"
uuid = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
version = "0.4.5"
[[deps.Accessors]]
deps = ["CompositionsBase", "ConstructionBase", "Dates", "InverseFunctions", "LinearAlgebra", "MacroTools", "Markdown", "Test"]
git-tree-sha1 = "c0d491ef0b135fd7d63cbc6404286bc633329425"
uuid = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
version = "0.1.36"
[deps.Accessors.extensions]
AccessorsAxisKeysExt = "AxisKeys"
AccessorsIntervalSetsExt = "IntervalSets"
AccessorsStaticArraysExt = "StaticArrays"
AccessorsStructArraysExt = "StructArrays"
AccessorsUnitfulExt = "Unitful"
[deps.Accessors.weakdeps]
AxisKeys = "94b1ba4f-4ee9-5380-92f1-94cde586c3c5"
IntervalSets = "8197267c-284f-5f27-9208-e0e47529a953"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
StructArrays = "09ab397b-f2b6-538f-b94a-2f83cf4a842a"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
[[deps.Adapt]]
deps = ["LinearAlgebra", "Requires"]
git-tree-sha1 = "6a55b747d1812e699320963ffde36f1ebdda4099"
uuid = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
version = "4.0.4"
weakdeps = ["StaticArrays"]
[deps.Adapt.extensions]
AdaptStaticArraysExt = "StaticArrays"
[[deps.AliasTables]]
deps = ["PtrArrays", "Random"]
git-tree-sha1 = "9876e1e164b144ca45e9e3198d0b689cadfed9ff"
uuid = "66dad0bd-aa9a-41b7-9441-69ab47430ed8"
version = "1.1.3"
[[deps.ArgTools]]
uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"
version = "1.1.1"
[[deps.ArnoldiMethod]]
deps = ["LinearAlgebra", "Random", "StaticArrays"]
git-tree-sha1 = "d57bd3762d308bded22c3b82d033bff85f6195c6"
uuid = "ec485272-7323-5ecc-a04f-4719b315124d"
version = "0.4.0"
[[deps.ArrayInterface]]
deps = ["Adapt", "LinearAlgebra", "SparseArrays", "SuiteSparse"]
git-tree-sha1 = "5c9b74c973181571deb6442d41e5c902e6b9f38e"
uuid = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
version = "7.12.0"
[deps.ArrayInterface.extensions]
ArrayInterfaceBandedMatricesExt = "BandedMatrices"
ArrayInterfaceBlockBandedMatricesExt = "BlockBandedMatrices"
ArrayInterfaceCUDAExt = "CUDA"
ArrayInterfaceCUDSSExt = "CUDSS"
ArrayInterfaceChainRulesExt = "ChainRules"
ArrayInterfaceGPUArraysCoreExt = "GPUArraysCore"
ArrayInterfaceReverseDiffExt = "ReverseDiff"
ArrayInterfaceStaticArraysCoreExt = "StaticArraysCore"
ArrayInterfaceTrackerExt = "Tracker"
[deps.ArrayInterface.weakdeps]
BandedMatrices = "aae01518-5342-5314-be14-df237901396f"
BlockBandedMatrices = "ffab5731-97b5-5995-9138-79e8c1846df0"
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
CUDSS = "45b445bb-4962-46a0-9369-b4df9d0f772e"
ChainRules = "082447d4-558c-5d27-93f4-14fc19e9eca2"
GPUArraysCore = "46192b85-c4d5-4398-a991-12ede77f4527"
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"
[[deps.ArrayLayouts]]
deps = ["FillArrays", "LinearAlgebra"]
git-tree-sha1 = "ce2ca959f932f5dad70697dd93133d1167cf1e4e"
uuid = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
version = "1.10.2"
weakdeps = ["SparseArrays"]
[deps.ArrayLayouts.extensions]
ArrayLayoutsSparseArraysExt = "SparseArrays"
[[deps.Artifacts]]
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
[[deps.Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
[[deps.Bijections]]
git-tree-sha1 = "95f5c7e2d177b7ba1a240b0518038b975d72a8c0"
uuid = "e2ed5e7c-b2de-5872-ae92-c73ca462fb04"
version = "0.1.7"
[[deps.BitFlags]]
git-tree-sha1 = "0691e34b3bb8be9307330f88d1a3c3f25466c24d"
uuid = "d1d4a3ce-64b1-5f1a-9ba4-7e7e69966f35"
version = "0.1.9"
[[deps.BitTwiddlingConvenienceFunctions]]
deps = ["Static"]
git-tree-sha1 = "f21cfd4950cb9f0587d5067e69405ad2acd27b87"
uuid = "62783981-4cbd-42fc-bca8-16325de8dc4b"
version = "0.1.6"
[[deps.Bzip2_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "9e2a6b69137e6969bab0152632dcb3bc108c8bdd"
uuid = "6e34b625-4abd-537c-b88f-471c36dfa7a0"
version = "1.0.8+1"
[[deps.CPUSummary]]
deps = ["CpuId", "IfElse", "PrecompileTools", "Static"]
git-tree-sha1 = "5a97e67919535d6841172016c9530fd69494e5ec"
uuid = "2a0fbf3d-bb9c-48f3-b0a9-814d99fd7ab9"
version = "0.2.6"
[[deps.CSTParser]]
deps = ["Tokenize"]
git-tree-sha1 = "0157e592151e39fa570645e2b2debcdfb8a0f112"
uuid = "00ebfdb7-1f24-5e51-bd34-a7502290713f"
version = "3.4.3"
[[deps.Cairo_jll]]
deps = ["Artifacts", "Bzip2_jll", "CompilerSupportLibraries_jll", "Fontconfig_jll", "FreeType2_jll", "Glib_jll", "JLLWrappers", "LZO_jll", "Libdl", "Pixman_jll", "Xorg_libXext_jll", "Xorg_libXrender_jll", "Zlib_jll", "libpng_jll"]
git-tree-sha1 = "a2f1c8c668c8e3cb4cca4e57a8efdb09067bb3fd"
uuid = "83423d85-b0ee-5818-9007-b63ccbeb887a"
version = "1.18.0+2"
[[deps.Calculus]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "f641eb0a4f00c343bbc32346e1217b86f3ce9dad"
uuid = "49dc2e85-a5d0-5ad3-a950-438e2897f1b9"
version = "0.5.1"
[[deps.ChainRulesCore]]
deps = ["Compat", "LinearAlgebra"]
git-tree-sha1 = "71acdbf594aab5bbb2cec89b208c41b4c411e49f"
uuid = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
version = "1.24.0"
weakdeps = ["SparseArrays"]
[deps.ChainRulesCore.extensions]
ChainRulesCoreSparseArraysExt = "SparseArrays"
[[deps.CloseOpenIntervals]]
deps = ["Static", "StaticArrayInterface"]
git-tree-sha1 = "05ba0d07cd4fd8b7a39541e31a7b0254704ea581"
uuid = "fb6a15b2-703c-40df-9091-08a04967cfa9"
version = "0.1.13"
[[deps.CodecZlib]]
deps = ["TranscodingStreams", "Zlib_jll"]
git-tree-sha1 = "b8fe8546d52ca154ac556809e10c75e6e7430ac8"
uuid = "944b1d66-785c-5afd-91f1-9de20f533193"
version = "0.7.5"
[[deps.ColorSchemes]]
deps = ["ColorTypes", "ColorVectorSpace", "Colors", "FixedPointNumbers", "PrecompileTools", "Random"]
git-tree-sha1 = "4b270d6465eb21ae89b732182c20dc165f8bf9f2"
uuid = "35d6a980-a343-548e-a6ea-1d62b119f2f4"
version = "3.25.0"
[[deps.ColorTypes]]
deps = ["FixedPointNumbers", "Random"]
git-tree-sha1 = "b10d0b65641d57b8b4d5e234446582de5047050d"
uuid = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
version = "0.11.5"
[[deps.ColorVectorSpace]]
deps = ["ColorTypes", "FixedPointNumbers", "LinearAlgebra", "Requires", "Statistics", "TensorCore"]
git-tree-sha1 = "a1f44953f2382ebb937d60dafbe2deea4bd23249"
uuid = "c3611d14-8923-5661-9e6a-0046d554d3a4"
version = "0.10.0"
weakdeps = ["SpecialFunctions"]
[deps.ColorVectorSpace.extensions]
SpecialFunctionsExt = "SpecialFunctions"
[[deps.Colors]]
deps = ["ColorTypes", "FixedPointNumbers", "Reexport"]
git-tree-sha1 = "362a287c3aa50601b0bc359053d5c2468f0e7ce0"
uuid = "5ae59095-9a9b-59fe-a467-6f913c188581"
version = "0.12.11"
[[deps.Combinatorics]]
git-tree-sha1 = "08c8b6831dc00bfea825826be0bc8336fc369860"
uuid = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
version = "1.0.2"
[[deps.CommonMark]]
deps = ["Crayons", "JSON", "PrecompileTools", "URIs"]
git-tree-sha1 = "532c4185d3c9037c0237546d817858b23cf9e071"
uuid = "a80b9123-70ca-4bc0-993e-6e3bcb318db6"
version = "0.8.12"
[[deps.CommonSolve]]
git-tree-sha1 = "0eee5eb66b1cf62cd6ad1b460238e60e4b09400c"
uuid = "38540f10-b2f7-11e9-35d8-d573e4eb0ff2"
version = "0.2.4"
[[deps.CommonSubexpressions]]
deps = ["MacroTools", "Test"]
git-tree-sha1 = "7b8a93dba8af7e3b42fecabf646260105ac373f7"
uuid = "bbf7d656-a473-5ed7-a52c-81e309532950"
version = "0.3.0"
[[deps.CommonWorldInvalidations]]
git-tree-sha1 = "ae52d1c52048455e85a387fbee9be553ec2b68d0"
uuid = "f70d9fcc-98c5-4d4a-abd7-e4cdeebd8ca8"
version = "1.0.0"
[[deps.Compat]]
deps = ["TOML", "UUIDs"]
git-tree-sha1 = "b1c55339b7c6c350ee89f2c1604299660525b248"
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
version = "4.15.0"
weakdeps = ["Dates", "LinearAlgebra"]
[deps.Compat.extensions]
CompatLinearAlgebraExt = "LinearAlgebra"
[[deps.CompilerSupportLibraries_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae"
version = "1.1.1+0"
[[deps.CompositeTypes]]
git-tree-sha1 = "bce26c3dab336582805503bed209faab1c279768"
uuid = "b152e2b5-7a66-4b01-a709-34e65c35f657"
version = "0.1.4"
[[deps.CompositionsBase]]
git-tree-sha1 = "802bb88cd69dfd1509f6670416bd4434015693ad"
uuid = "a33af91c-f02d-484b-be07-31d278c5ca2b"
version = "0.1.2"
weakdeps = ["InverseFunctions"]
[deps.CompositionsBase.extensions]
CompositionsBaseInverseFunctionsExt = "InverseFunctions"
[[deps.ConcreteStructs]]
git-tree-sha1 = "f749037478283d372048690eb3b5f92a79432b34"
uuid = "2569d6c7-a4a2-43d3-a901-331e8e4be471"
version = "0.2.3"
[[deps.ConcurrentUtilities]]
deps = ["Serialization", "Sockets"]
git-tree-sha1 = "ea32b83ca4fefa1768dc84e504cc0a94fb1ab8d1"
uuid = "f0e56b4a-5159-44fe-b623-3e5288b988bb"
version = "2.4.2"
[[deps.ConstructionBase]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "260fd2400ed2dab602a7c15cf10c1933c59930a2"
uuid = "187b0558-2788-49d3-abe0-74a17ed4e7c9"
version = "1.5.5"
weakdeps = ["IntervalSets", "StaticArrays"]
[deps.ConstructionBase.extensions]
ConstructionBaseIntervalSetsExt = "IntervalSets"
ConstructionBaseStaticArraysExt = "StaticArrays"
[[deps.Contour]]
git-tree-sha1 = "439e35b0b36e2e5881738abc8857bd92ad6ff9a8"
uuid = "d38c429a-6771-53c6-b99e-75d170b6e991"
version = "0.6.3"
[[deps.CpuId]]
deps = ["Markdown"]
git-tree-sha1 = "fcbb72b032692610bfbdb15018ac16a36cf2e406"
uuid = "adafc99b-e345-5852-983c-f28acb93d879"
version = "0.3.1"
[[deps.Crayons]]
git-tree-sha1 = "249fe38abf76d48563e2f4556bebd215aa317e15"
uuid = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f"
version = "4.1.1"
[[deps.DataAPI]]
git-tree-sha1 = "abe83f3a2f1b857aac70ef8b269080af17764bbe"
uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a"
version = "1.16.0"
[[deps.DataStructures]]
deps = ["Compat", "InteractiveUtils", "OrderedCollections"]
git-tree-sha1 = "1d0a14036acb104d9e89698bd408f63ab58cdc82"
uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
version = "0.18.20"
[[deps.DataValueInterfaces]]
git-tree-sha1 = "bfc1187b79289637fa0ef6d4436ebdfe6905cbd6"
uuid = "e2d170a0-9d28-54be-80f0-106bbe20a464"
version = "1.0.0"
[[deps.Dates]]
deps = ["Printf"]
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
[[deps.DelimitedFiles]]
deps = ["Mmap"]
git-tree-sha1 = "9e2f36d3c96a820c678f2f1f1782582fcf685bae"
uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab"
version = "1.9.1"
[[deps.DiffEqBase]]
deps = ["ArrayInterface", "ConcreteStructs", "DataStructures", "DocStringExtensions", "EnumX", "EnzymeCore", "FastBroadcast", "FastClosures", "ForwardDiff", "FunctionWrappers", "FunctionWrappersWrappers", "LinearAlgebra", "Logging", "Markdown", "MuladdMacro", "Parameters", "PreallocationTools", "PrecompileTools", "Printf", "RecursiveArrayTools", "Reexport", "SciMLBase", "SciMLOperators", "Setfield", "SparseArrays", "Static", "StaticArraysCore", "Statistics", "Tricks", "TruncatedStacktraces"]
git-tree-sha1 = "d1e8a4642e28b0945bde6e2e1ac569b9e0abd728"
uuid = "2b5f629d-d688-5b77-993f-72d75c75574e"
version = "6.151.5"
[deps.DiffEqBase.extensions]
DiffEqBaseCUDAExt = "CUDA"
DiffEqBaseChainRulesCoreExt = "ChainRulesCore"
DiffEqBaseDistributionsExt = "Distributions"
DiffEqBaseEnzymeExt = ["ChainRulesCore", "Enzyme"]
DiffEqBaseGeneralizedGeneratedExt = "GeneralizedGenerated"
DiffEqBaseMPIExt = "MPI"
DiffEqBaseMeasurementsExt = "Measurements"
DiffEqBaseMonteCarloMeasurementsExt = "MonteCarloMeasurements"
DiffEqBaseReverseDiffExt = "ReverseDiff"
DiffEqBaseTrackerExt = "Tracker"
DiffEqBaseUnitfulExt = "Unitful"
[deps.DiffEqBase.weakdeps]
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9"
GeneralizedGenerated = "6b9d7cbe-bcb9-11e9-073f-15a7a543e2eb"
MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195"
Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7"
MonteCarloMeasurements = "0987c9cc-fe09-11e8-30f0-b96dd679fdca"
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
[[deps.DiffEqCallbacks]]
deps = ["DataStructures", "DiffEqBase", "ForwardDiff", "Functors", "LinearAlgebra", "Markdown", "NonlinearSolve", "Parameters", "RecipesBase", "RecursiveArrayTools", "SciMLBase", "StaticArraysCore"]
git-tree-sha1 = "c959cfd2657d16beada157a74d52269e8556500e"
uuid = "459566f4-90b8-5000-8ac3-15dfb0a30def"
version = "3.6.2"
[deps.DiffEqCallbacks.weakdeps]
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Sundials = "c3572dad-4567-51f8-b174-8c6c989267f4"
[[deps.DiffResults]]
deps = ["StaticArraysCore"]
git-tree-sha1 = "782dd5f4561f5d267313f23853baaaa4c52ea621"
uuid = "163ba53b-c6d8-5494-b064-1a9d43ac40c5"
version = "1.1.0"
[[deps.DiffRules]]
deps = ["IrrationalConstants", "LogExpFunctions", "NaNMath", "Random", "SpecialFunctions"]
git-tree-sha1 = "23163d55f885173722d1e4cf0f6110cdbaf7e272"
uuid = "b552c78f-8df3-52c6-915a-8e097449b14b"
version = "1.15.1"
[[deps.DifferentiationInterface]]
deps = ["ADTypes", "Compat", "DocStringExtensions", "FillArrays", "LinearAlgebra", "PackageExtensionCompat", "SparseArrays", "SparseMatrixColorings"]
git-tree-sha1 = "695217e97ee1ce0248f4a56c14af88ba33c585fd"
uuid = "a0c0ee7d-e4b9-4e03-894e-1c5f64a51d63"
version = "0.5.7"
[deps.DifferentiationInterface.extensions]
DifferentiationInterfaceChainRulesCoreExt = "ChainRulesCore"
DifferentiationInterfaceDiffractorExt = "Diffractor"
DifferentiationInterfaceEnzymeExt = "Enzyme"
DifferentiationInterfaceFastDifferentiationExt = "FastDifferentiation"
DifferentiationInterfaceFiniteDiffExt = "FiniteDiff"
DifferentiationInterfaceFiniteDifferencesExt = "FiniteDifferences"
DifferentiationInterfaceForwardDiffExt = "ForwardDiff"
DifferentiationInterfacePolyesterForwardDiffExt = "PolyesterForwardDiff"
DifferentiationInterfaceReverseDiffExt = "ReverseDiff"
DifferentiationInterfaceSymbolicsExt = "Symbolics"
DifferentiationInterfaceTapirExt = "Tapir"
DifferentiationInterfaceTrackerExt = "Tracker"
DifferentiationInterfaceZygoteExt = ["Zygote", "ForwardDiff"]
[deps.DifferentiationInterface.weakdeps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Diffractor = "9f5e2b26-1114-432f-b630-d3fe2085c51c"
Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9"
FastDifferentiation = "eb9bf01b-bf85-4b60-bf87-ee5de06c00be"
FiniteDiff = "6a86dc24-6348-571c-b903-95158fe2bd41"
FiniteDifferences = "26cc04aa-876d-5657-8c51-4c34ba976000"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
PolyesterForwardDiff = "98d1487c-24ca-40b6-b7ab-df2af84e126b"
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
Tapir = "07d77754-e150-4737-8c94-cd238a1fb45b"
Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
[[deps.Distributed]]
deps = ["Random", "Serialization", "Sockets"]
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"
[[deps.Distributions]]
deps = ["AliasTables", "FillArrays", "LinearAlgebra", "PDMats", "Printf", "QuadGK", "Random", "SpecialFunctions", "Statistics", "StatsAPI", "StatsBase", "StatsFuns"]
git-tree-sha1 = "9c405847cc7ecda2dc921ccf18b47ca150d7317e"
uuid = "31c24e10-a181-5473-b8eb-7969acd0382f"
version = "0.25.109"
[deps.Distributions.extensions]
DistributionsChainRulesCoreExt = "ChainRulesCore"
DistributionsDensityInterfaceExt = "DensityInterface"
DistributionsTestExt = "Test"
[deps.Distributions.weakdeps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
DensityInterface = "b429d917-457f-4dbc-8f4c-0cc954292b1d"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
[[deps.DocStringExtensions]]
deps = ["LibGit2"]
git-tree-sha1 = "2fb1e02f2b635d0845df5d7c167fec4dd739b00d"
uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
version = "0.9.3"
[[deps.DomainSets]]
deps = ["CompositeTypes", "IntervalSets", "LinearAlgebra", "Random", "StaticArrays"]
git-tree-sha1 = "490392af2c7d63183bfa2c8aaa6ab981c5ba7561"
uuid = "5b8099bc-c8ec-5219-889f-1d9e522a28bf"
version = "0.7.14"
[deps.DomainSets.extensions]
DomainSetsMakieExt = "Makie"
[deps.DomainSets.weakdeps]
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
[[deps.Downloads]]
deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"]
uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
version = "1.6.0"
[[deps.DualNumbers]]
deps = ["Calculus", "NaNMath", "SpecialFunctions"]
git-tree-sha1 = "5837a837389fccf076445fce071c8ddaea35a566"
uuid = "fa6b7ba4-c1ee-5f82-b5fc-ecf0adba8f74"
version = "0.6.8"
[[deps.DynamicPolynomials]]
deps = ["Future", "LinearAlgebra", "MultivariatePolynomials", "MutableArithmetics", "Pkg", "Reexport", "Test"]
git-tree-sha1 = "30a1848c4f4fc35d1d4bbbd125650f6a11b5bc6c"
uuid = "7c1d4256-1411-5781-91ec-d7bc3513ac07"
version = "0.5.7"
[[deps.DynamicQuantities]]
deps = ["Compat", "PackageExtensionCompat", "Tricks"]
git-tree-sha1 = "412b25c7d99ec6b06967d315c7b29bb8e484f092"
uuid = "06fc5a27-2a28-4c7c-a15d-362465fb6821"
version = "0.13.2"
[deps.DynamicQuantities.extensions]
DynamicQuantitiesLinearAlgebraExt = "LinearAlgebra"
DynamicQuantitiesMeasurementsExt = "Measurements"
DynamicQuantitiesScientificTypesExt = "ScientificTypes"
DynamicQuantitiesUnitfulExt = "Unitful"
[deps.DynamicQuantities.weakdeps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7"
ScientificTypes = "321657f4-b219-11e9-178b-2701a2544e81"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
[[deps.EnumX]]
git-tree-sha1 = "bdb1942cd4c45e3c678fd11569d5cccd80976237"
uuid = "4e289a0a-7415-4d19-859d-a7e5c4648b56"
version = "1.0.4"
[[deps.EnzymeCore]]
git-tree-sha1 = "3a3177ba05b4763234819060fb6c2e1613379ca6"
uuid = "f151be2c-9106-41f4-ab19-57ee4f262869"
version = "0.7.6"
weakdeps = ["Adapt"]
[deps.EnzymeCore.extensions]
AdaptExt = "Adapt"
[[deps.EpollShim_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "8e9441ee83492030ace98f9789a654a6d0b1f643"
uuid = "2702e6a9-849d-5ed8-8c21-79e8b8f9ee43"
version = "0.0.20230411+0"
[[deps.ExceptionUnwrapping]]
deps = ["Test"]
git-tree-sha1 = "dcb08a0d93ec0b1cdc4af184b26b591e9695423a"
uuid = "460bff9d-24e4-43bc-9d9f-a8973cb893f4"
version = "0.1.10"
[[deps.Expat_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "1c6317308b9dc757616f0b5cb379db10494443a7"
uuid = "2e619515-83b5-522b-bb60-26c02a35a201"
version = "2.6.2+0"
[[deps.ExponentialUtilities]]
deps = ["Adapt", "ArrayInterface", "GPUArraysCore", "GenericSchur", "LinearAlgebra", "PrecompileTools", "Printf", "SparseArrays", "libblastrampoline_jll"]
git-tree-sha1 = "8e18940a5ba7f4ddb41fe2b79b6acaac50880a86"
uuid = "d4d017d3-3776-5f7e-afef-a10c40355c18"
version = "1.26.1"
[[deps.ExprTools]]
git-tree-sha1 = "27415f162e6028e81c72b82ef756bf321213b6ec"
uuid = "e2ba6199-217a-4e67-a87a-7c52f15ade04"
version = "0.1.10"
[[deps.FFMPEG]]
deps = ["FFMPEG_jll"]
git-tree-sha1 = "b57e3acbe22f8484b4b5ff66a7499717fe1a9cc8"
uuid = "c87230d0-a227-11e9-1b43-d7ebe4e7570a"
version = "0.4.1"
[[deps.FFMPEG_jll]]
deps = ["Artifacts", "Bzip2_jll", "FreeType2_jll", "FriBidi_jll", "JLLWrappers", "LAME_jll", "Libdl", "Ogg_jll", "OpenSSL_jll", "Opus_jll", "PCRE2_jll", "Zlib_jll", "libaom_jll", "libass_jll", "libfdk_aac_jll", "libvorbis_jll", "x264_jll", "x265_jll"]
git-tree-sha1 = "466d45dc38e15794ec7d5d63ec03d776a9aff36e"
uuid = "b22a6f82-2f65-5046-a5b2-351ab43fb4e5"
version = "4.4.4+1"
[[deps.FastBroadcast]]
deps = ["ArrayInterface", "LinearAlgebra", "Polyester", "Static", "StaticArrayInterface", "StrideArraysCore"]
git-tree-sha1 = "bd19de6fe8a3b18888f35e79832f97544684caa7"
uuid = "7034ab61-46d4-4ed7-9d0f-46aef9175898"
version = "0.3.4"
[[deps.FastClosures]]
git-tree-sha1 = "acebe244d53ee1b461970f8910c235b259e772ef"
uuid = "9aa1b823-49e4-5ca5-8b0f-3971ec8bab6a"
version = "0.3.2"
[[deps.FastLapackInterface]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "cbf5edddb61a43669710cbc2241bc08b36d9e660"
uuid = "29a986be-02c6-4525-aec4-84b980013641"
version = "2.0.4"
[[deps.FileWatching]]
uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"
[[deps.FillArrays]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "0653c0a2396a6da5bc4766c43041ef5fd3efbe57"
uuid = "1a297f60-69ca-5386-bcde-b61e274b549b"
version = "1.11.0"
weakdeps = ["PDMats", "SparseArrays", "Statistics"]
[deps.FillArrays.extensions]
FillArraysPDMatsExt = "PDMats"
FillArraysSparseArraysExt = "SparseArrays"
FillArraysStatisticsExt = "Statistics"
[[deps.FindFirstFunctions]]
git-tree-sha1 = "e90fef90f7d75e6a5b435b0fd65609759f99717a"
uuid = "64ca27bc-2ba2-4a57-88aa-44e436879224"
version = "1.2.0"
[[deps.FiniteDiff]]
deps = ["ArrayInterface", "LinearAlgebra", "Requires", "Setfield", "SparseArrays"]
git-tree-sha1 = "2de436b72c3422940cbe1367611d137008af7ec3"
uuid = "6a86dc24-6348-571c-b903-95158fe2bd41"
version = "2.23.1"
[deps.FiniteDiff.extensions]
FiniteDiffBandedMatricesExt = "BandedMatrices"
FiniteDiffBlockBandedMatricesExt = "BlockBandedMatrices"
FiniteDiffStaticArraysExt = "StaticArrays"
[deps.FiniteDiff.weakdeps]