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.

Prolog language We would like to define a predicate that calculates the

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!