MatMod logo

How old is Peter (example3a)

Run LPL Code  ,  PDF Document

Problem

The age of Peter is a third of his father’s age, but in 10 years his father will only be two times as old as Peter will be. What is Peter’s age today?

Modeling Steps

y    =   3x y + 10  =   2(x + 10)

HINT: Let x be the age of Peter (I) today, and y be the age of his father today. Can you write down the conditions now? SOLUTION: The age of the father is y, and also 3x (he is three times as old as his son), hence: y = 3x. In ten year, the father is y + 10 year old, but also 2(x + 10), hence: y + 10 = 2(x + 10). Therefore the mathematical model is:

y  =  3x y + 10   =  2(x + 10)

Now it’s easy to solve the model: x = 10 and y = 30.

Listing 1: The Complete Model implemented in LPL [2]

model AgeOfPeter "How old is Peter"; 
  variable x; y; 
  constraint A: y    = 3*x; 
             B: y+10 = 2*(x+10); 
  solve; 
  Write('The age of Peter is: %d' n', x); 
end

References

[1]   MatMod. Homepage for Learning Mathematical Modeling :  https://matmod.ch.

[2]   Hürlimann T. Reference Manual for the LPL Modeling Language, most recent version. https://matmod.ch/lpl/doc/manual.pdf.