Mathematical Modeling with LPL : Explain and run a Model
Problem Statement
Modeling Description
||
Back to MatMod
model exercise1 "A very simple modeling example"; variable x "my age"; y "my brother's age"; constraint A: y = x-2 "y is two less than x"; B: x+y = 20 "x and y together is twenty"; solve; Write('My age is : %2d\n', x); Write('My brothr\'s age is: %2d\n', y); //--- drawing Draw.Scale(10,-10); Draw.Arrow(0,0,22,0); Draw.Text('x',19,-1); Draw.Text('11',10.2,-1.5); Draw.Arrow(0,0,0,22); Draw.Text('y',-1,19); Draw.Text('9',-1.5,8.5); {i in 1..20} Draw.Line(i,0,i,0.5); {i in 1..20} Draw.Line(0,i,0.5,i); Draw.Line(20.5,-.5,-.5,20.5,3); Draw.Line(1.5,-.5,14,12,3); Draw.DefLine('line.dash',18,7); Draw.Line('#dash',-.5,9,15,9); Draw.Line('#dash',11,-.5,11,15); end
Problem Statement
Modeling Description
Back to model
The solution is as follows:
The LOG-File output of LPL is as follows: