Question: Prolog language We would like to define a predicate that calculates the series $ a_n = rac{1}{2} ( a_{n-1} + rac{9}{a_{n-1}})$ for $n>1$ with $a_0
Prolog language
We would like to define a predicate that calculates the series $ a_n = rac{1}{2} ( a_{n-1} + rac{9}{a_{n-1}})$ for $n>1$ with $a_0 = M$. Use the following head for the rule of the predicate where N is the count for the series and M is the value for $a_0$, while Y is the result.

seriesNM(e,_ seriesNm(N,M,Y) :-N 0, Example Output: ?- seriesNM (20,15,Y) false. ?- seriesNM( 2, 50, Y). Y 12.724354324432044; false
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
