My age is a third of my father’s age, but in 10 years my father will only be two times as old as I will be. What is my age today?
To translate this problem into a mathematical formulation, it is necessary to proceed in steps (see [1]) :
Understanding the problem: What are we looking for? What do we known? What are the conditions? Are the data sufficient, are some data contradictory, irrelevant or redundant? Draw a figure! Introduce a suitable notation. Write it down. IF you are stuck: begin again.
Design a plan: Do you know a similar problem? Find the connection between the data and the unknowns! Maybe you need to design auxiliary problems and intermediary steps! Look at the unknowns! Go back to the definitions! Decompose the problems and solve the parts! Did you use all data? Did you use all conditions?
Carry out a plan: Write it down step by step! Can you show that each step is correct? Make plausibility tests in each step.
Looking back: Examine the solution. Can you check the result or the argument? Can you derive the result differently? Does the result make sense? Why? Why not?
Let’s look at our problem now :
What are we looking for in our problem? “my age today”. This is unknown, so let us introduce the symbol a for “my age today”. The symbol a stands for a positive number.
In the same way, let us introduce the symbol b for “my father’s age today”. the symbol c for “my age in ten year”, and the symbol d for “my father’s age in ten years”.
Draw a figure (see Figure 1
Connect the data with the unknown. It is clear from the statement that
Furthermore: “My age is a third of my father’s age” means that
Finally: “in 10 years my father will only be two times as old as I will be” gives:
Did we use all data and all conditions? I guess, yes!
We wrote down the complete problem in mathematics. Now implement it:
model exercise3 "A Simple Modeling Example";
variable a "my age today";
b "my father's age today";
c "my age in ten years";
d "my father's age in ten years";
constraint
A: c = a+10 "in ten year my age will be c";
B: d = b+10 "in ten years my father's age will be d";
C: a = b/3 "my age today is a third of my father's age";
D: d = 2*c "in ten years my father will be two times other than I";
solve;
Write('My age is %d' n', a);
Write('My father' 's age is %d' n', b);
Write('My age in ten years is %d' n', c);
Write('My father' 's age in ten years is %d' n', d);
end
Looking back: My age is 10, in ten years I am 20, my father’s age is 30, and in ten years he is 40. My father is three times older. Correct! But in ten years he is 40 and I am 20, so he is only two times older. Also correct! Everything is matching. So we are done.
[1] Polya G. How To Solve It. Penguin Books 1990, London, 1957.
[2] MatMod. Homepage for Learning Mathematical Modeling : https://matmod.ch.
[3] Hürlimann T. Reference Manual for the LPL Modeling Language, most recent version. https://matmod.ch/lpl/doc/manual.pdf.