/* ** This is a standard problem in physics. If we are to drill ** a shaft through the earth passing from its center and left ** a small ball of mass m from the surface how will it behave? ** This example is not really a problem sovling example; ** it is rather a knowledge representation example to show ** the flexibility of Euclid. ** ** ** (C) Copyright K J Dryllerakis 1993-1995 ** ALL RIGHTS RESERVED ** $Id: earth.eu,v 1.1 1995/06/25 18:47:17 kd Exp kd $ */ /* ** solve(+Density,+Mo,-Xt) ** solve the problem by stating the assumptions */ solve(Density,Mo,Xt):- formula(Xt), reals([Density,Mo,R]), label(R,'Earth_Radius'), Xt@0=R, earth_mass(Mx,Density), Density >=0, R >0, Mo >0, gravity_force_field(Fx,Mx,Mo), Ft=Xt o Fx, newtons_law(Ft,Mo,Xt). /* ** gravity_force_field(?Fx,?Mx,?Mo) ** Fx is the force field given by the earth (mass Mx) probably ** variable, to a particle of mass Mo. ** Note the use of label for the variable introduced as the ** gravity constant */ gravity_force_field(Fx,Mx,Mo):- formulae([Fx,Mx]), reals([Mo,G]), label(G,'G'), Fx= ( (-G*Mo/X^2)//X ) * Mx, G > 0. /* ** earth_mass(-Mx,+Density) ** Calculate the functional relation between the Mass at ** a distance and the distance if the density of the ** earth is Density (real constant). */ earth_mass(Mx,Density):- formula(Mx), real(Density), Mx=( (4*pi*Density/3)*(X^3))//X. /* ** newtons_law(?Ft,?M,?Xt) ** This is the relation between the position of a particle ** at time t, the mass of the object and the sum of forces ** acting on it. ** Note that there are no declaration for the variables ** so the equation is valid for both functions and formulae. */ newtons_law(Ft,M,Xt):- Ft=M*derivative(derivative(Xt)).