diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..331263815ad187c7de09dd6685fd33044ac3a63c --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.prob diff --git a/Physics/MovingParticles.mch b/Physics/MovingParticles.mch new file mode 100644 index 0000000000000000000000000000000000000000..a0aa6feaebaf1883c2601a367aa81c2af6bffaaf --- /dev/null +++ b/Physics/MovingParticles.mch @@ -0,0 +1,32 @@ +MACHINE MovingParticles +DEFINITIONS + MASS == FLOAT; + POS == FLOAT; + SPEED == FLOAT; + OBJ == 1..n +ABSTRACT_CONSTANTS sum_vec +CONSTANTS mass, n +PROPERTIES + n : 1..10 & + mass : OBJ --> MASS & + + sum_vec = %(v1,v2).(v1:OBJ-->REAL & v2:OBJ-->REAL | %i.(i:OBJ| v1(i)+v2(i))) + + & n = 3 & mass = [1.0, 100.0, 2.0] +VARIABLES xpos, ypos, xspeed, yspeed +INVARIANT + xpos : OBJ --> POS & + ypos : OBJ --> POS & + xspeed : OBJ --> SPEED & + yspeed : OBJ --> SPEED +INITIALISATION xpos := [ -1.0, 0.0 , 1.0 ] || + ypos := [ 0.0, 0.0, 0.0 ] || + xspeed := [ 0.0, 0.0, 0.0 ] || + yspeed := [ 1.0, 0.0, -1.0 ] +OPERATIONS + Move = BEGIN + xpos := sum_vec(xpos,xspeed) || + ypos := sum_vec(ypos,yspeed) + END +END + diff --git a/Physics/three_bodies.json b/Physics/three_bodies.json new file mode 100644 index 0000000000000000000000000000000000000000..ee027a0083da301690087b30b37f1c0f5f4cf47f --- /dev/null +++ b/Physics/three_bodies.json @@ -0,0 +1,32 @@ +{ + "svg": "three_bodies.svg", + "items": [ + { + "for": {"from":1, "to":3}, + "id": "body%0", + "attr": "cx", + "value" : "10.0*xpos(%0)" + }, + { + "for": {"from":1, "to":3}, + "id": "body%0", + "attr": "cy", + "value" : "10.0*ypos(%0)" + }, + { + "for": {"from":1, "to":3}, + "id": "body%0", + "attr": "r", + "value" : "2.0+mass(%0)/10.0" + } + ], + "events": [ + { + "for": {"from":1, "to":3}, + "id": "body%0", + "event": "Move", + "hovers": [{ "attr":"stroke-width", "enter":"6", "leave":"1"}, + { "attr":"opacity", "enter":"0.8", "leave":"1.0"}] + } + ] +} diff --git a/Physics/three_bodies.svg b/Physics/three_bodies.svg new file mode 100644 index 0000000000000000000000000000000000000000..0127f1b114d53a982b2c11fbb9614cacea2d8cc7 --- /dev/null +++ b/Physics/three_bodies.svg @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns="http://www.w3.org/2000/svg" + height="400" width="400" + viewBox="-100 -100 200 200" + > + + <circle id="body1" cx="45" cy="15" r="25" + stroke="black" stroke-width="1" fill="green" /> + + <circle id="body2" cx="5" cy="15" r="5" + stroke="black" stroke-width="1" fill="red" /> + + <circle id="body3" cx="35" cy="45" r="20" + stroke="black" stroke-width="1" fill="blue" /> + +</svg>