Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
146 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 0 additions & 58 deletions
58
...hs/models/Ordinary Differential Equations/models/For Advanced Users/ContinuousCurves.gaml
This file was deleted.
Oops, something went wrong.
75 changes: 75 additions & 0 deletions
75
...fferential Equations/models/For Advanced Users/Displays (Continuous, Phase Portrait).gaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/** | ||
* continuous curves | ||
* Author: Tri and Nghi | ||
* Description: | ||
* | ||
* This model illustrates different displays for a Lotka-Volterra model. ABMs usually only require a discrete | ||
* visualization of the results (one value per cycle). EBMs compute a continuous solution, and thus require | ||
* a continuous display. The syntax is shown below. | ||
* | ||
* Phase portraits are very common in mathematics, and can be displayed with the 'type: xy' facet. | ||
*/ | ||
|
||
|
||
model Displays | ||
|
||
|
||
global { | ||
init { | ||
create LV_model with: [x::2.0, y::2.0]; | ||
} | ||
} | ||
|
||
species LV_model { | ||
float t; | ||
float x; | ||
float y; | ||
float h <- 0.1; | ||
float alpha <- 0.8; | ||
float beta <- 0.3; | ||
float gamma <- 0.2; | ||
float delta <- 0.85; | ||
|
||
equation eqLV { | ||
diff(x, t) = x * (alpha - beta * y); | ||
diff(y, t) = -y * (delta - gamma * x); | ||
} | ||
|
||
reflex solving { | ||
solve eqLV method: #rk4 step_size: h; | ||
} | ||
} | ||
|
||
experiment Displays type: gui { | ||
float minimum_cycle_duration <- 0.1#s; | ||
output { | ||
layout #split; | ||
display D1 synchronized:false { | ||
chart 'Time series' type: series background: #white y_label:"pop" x_tick_line_visible: false{ | ||
data "x" value: first(LV_model).x color: rgb(52,152,219); | ||
data "y" value: first(LV_model).y color: rgb(41,128,185); | ||
} | ||
} | ||
display D2 synchronized:false { | ||
chart 'Time series - continuous display' type: series background: #white y_label:"pop" x_tick_line_visible: false{ | ||
// chart 'Time series - continuous display' type: series x_serie: first(LV_model).t[] background: #white y_label:"pop"{ | ||
data "x" value: first(LV_model).x[] color: rgb(52,152,219) marker: false; | ||
data "y" value: first(LV_model).y[] color: rgb(41,128,185) marker: false; | ||
} | ||
} | ||
display D3 name: "Phase Portrait " synchronized:false { | ||
chart 'Phase Portrait' type: xy background: #white x_label: "x" y_label:"y"{ | ||
// Continuous display requires to pass a list of two values x and y | ||
data "y(x(t))" value: [first(LV_model).x,first(LV_model).y] color: rgb(243,156,18); | ||
} | ||
} | ||
display D4 name: "Phase Portrait - continuous display" synchronized:false { | ||
chart 'Phase Portrait - continuous display' type: xy background: #white x_label: "x" y_label:"y"{ | ||
// Continuous display requires to pass a list of two values x and y | ||
data "y(x(t))" value: rows_list(matrix(first(LV_model).x[],first(LV_model).y[])) color: rgb(243,156,18) marker: false; | ||
} | ||
} | ||
|
||
} | ||
|
||
} |
94 changes: 0 additions & 94 deletions
94
...y Differential Equations/models/For Advanced Users/SIR (Simple with advanced charts).gaml
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.