## Damsel And Suitor

### April 21, 2017

Since I’m a better programmer than mathematician, I’ll compute the ages with a computer program:

> (list-of (list x y) (x range 1 100) (y range 1 100) (= (+ (* x x x) (* x y y)) (* 4640 y)) (= (- (* x x y) (* y y y)) (* 5376 (/ 10) x))) ((40 16))

The answer is yes, the suitor is too old. You can run the program at http://ideone.com/jaqKZ8.

Advertisements

If you multiply the two left hand equations and the two right hand equations this reduces to: x^4-y^4 = 2494464 or x^4 = y^4 + 2494464

using this we can re can loop through values of y from 1..100 and look for results for which x is an integer…

Solving it 1779 style: the second equation tells us that that x is a multiple of 5, the first, for a given value of x, is just a quadratic in y with the relevant solution being 2320 – sqrt(5382400 – x^4))/x, Mr Napier’s logarithms tell us that the 4th root of 5382400 is 48.1 or thereabouts, so the oldest the man can be is 45. This doesn’t give a correct value for y, so we try the next one down and find that 40 satisfies both equations and gives 16 for the young lady’s age. Smaller values of x rapidly become increasingly unplausible.

Since both persons are most likely between 10 and 100 years of age…. here’s a simple brute-force way

x = 40

y = 16

Using the same logic as James Curtis-Smith, the minimum value of x and y are as below. These values turn out to be the solution.

It is convenient to substitute x=a*y. Excluding the possibility y=0, we can divide through by y. Both equations now only have y^2, which can be eliminated to give the equation

84*a^4-641*a^2+725=0.

This can be solved for a^2 using the quadratic formula. There are two positive solutions for a. Substituting the rational one (a=5/2) into one of the previous equations gives y^2=256 or y=16 and x=40.

The other solution gives y=40*(1.074276)^(1/4), x=y*(1+8/21)^(1/2) or approximately y=40.7 and x=47.8.

The latter ages are not integer, but not creepy.

Several solutions. Mathematica:

Solve[

{

x^3 + x y^2 == 4640 y,

10 x^2 y - 10 y^3 == 5376 x

},

{x, y}

] ~ Cases ~ {

x -> xi_Integer /; xi > 0,

y -> yi_Integer /; yi > 0

}

C11:

#include <iso646.h>

#include <stdbool.h>

#include <stdint.h>

#include <stdio.h>

#include <stdlib.h>

int main(int argc, char **argv) {

const uint32_t maxAge = 200;

puts("Solutions:");

for (uint32_t x = 1; x < maxAge; ++x) {

for (uint32_t y = 1; y < x; ++y) {

if (x*x*x + x*y*y == 4640*y and

10*x*x*y - 10*y*y*y == 5376*x) {

printf(" [ x = %d y = %d ]\n", x, y);

}

}

}

`exit(0);`

}

@Jan: nice solution. Here is the original (from “The Ladies’ Diary”) on Google books:

https://books.google.co.uk/books?id=VPQ3AAAAMAAJ&pg=PA45

The second solution, from Mr. Wm. Reynolds, is like yours. The solution from Mr. Tho. Truswell I don’t entirely follow.

I just brute forced it. In C++.

Which gave:

x = 40 & y = 16

Can’t find lisp/scheme which has list-of and range.

@Steve: The

`list-of`

macro is in my Standard Prelude, and also included in the code on ideone.com.eqa::{(x^3)+(x*(y^2))-(4640*y)}

eqb::{((x^2)*y)-(y^3)+(537.6*x)}

result::{[a list]; a::x; list::y; {:[eqa(a;x)=0; :[eqb(a;x)=0; :[~list?a,x; list::list,,a,x; “”]; “”]; “”]}’1+!100; list}

solve::{[list]; list::[]; {list::result(x;list)}’1+!100; list}

solve()

[[40 16]]

Shorter Klong version:

eqa::{(x^3)+(x*(y^2))-(4640*y)}

eqb::{((x^2)*y)-(y^3)+(537.6*x)}

result::{[a list]; a::x; list::y; {:[eqa(a;x)=0; :[eqb(a;x)=0; list::list,,a,x; “”]; “”]}’1+!100; list}

solve::{[list]; list::[]; {list::result(x;list)}’1+!100; list}

solve()

[[40 16]]

From Cache for Windows (x86-64) 2016.2.1 (Build…)

USER>zl damsel zp

damsel ;New routine

;

; n suitor,damsel

f suitor=1:1:100 d

. f damsel=1:1:100 d

. . i ((suitor**3)+(suitor*(damsel**2))-(4640*damsel))=0 d

. . . s e=((suitor**2)*damsel)

. . . s e2=(damsel**3)

. . . s e3=(537.6*suitor)

. . . i (e-e2-e3)=0 d

. . . . w !,suitor,” “,damsel

q

USER>d ^damsel

40 16