• Home
  • Textbooks
  • Computer science with Mathematica: theory and practice for science, mathematics, and engineering
  • Theory of Computation

Computer science with Mathematica: theory and practice for science, mathematics, and engineering

Roman Maeder

Chapter 12

Theory of Computation - all with Video Answers

Educators


Chapter Questions

01:01

Problem 1

Give the proof mentioned at the end of Section 12.1.2 that the recursion 12.1-5 defines a total function.

Raj Bala
Raj Bala
Numerade Educator

Problem 2

We saw that recursive functions are programmable. Give a practical proof by showing how they can be programmed in Mathematica.
1. Show in detail how each function defined strictly by primitive recursion (Section 12.1.2) can be programmed in Mathematica. Show that the computation terminates for each value of the arguments.
2. Show how the $\mu$ schema can be programmed in Mathematica.

Check back soon!

Problem 3

Show that integer division, $a$ div $b$, and remainder, $a \bmod b$, are primitive recursive. For two integers $a$ and $b$, with $b>0$, the so-called div-mod identity holds:
$$
a=(a \operatorname{div} b) b+(a \bmod b) .
$$
Furthermore, we have
$$
0 \leq(a \bmod b)<b .
$$
(In Mathematica these two functions are Quotient $[a, b]$ and Mod $[a, b]$.)

Check back soon!
02:25

Problem 4

This exercise will show you that programs constructed strictly according to the schema of primitive recursion are usually very inefficient.
1. Generate the instructions for addition according to the schema of primitive recursion (see Sections 12.4 and 12.1.2.) How many instructions do you get? How many steps does the program take to add 1 and 1 ?
2. Find a much simpler and faster program for adding two numbers.

WM
William Mead
Numerade Educator
02:41

Problem 5

Write a macro $\operatorname{mu}[n, f, g]$, that generates the Turing program for the $\mu$ schema
$$
h\left(m_1, \ldots, m_n\right)=f\left(\mu k\left[g\left(m_1, \ldots, m_n, k\right)\right]\right) .
$$
See Section 12.4.

Chris Trentman
Chris Trentman
Numerade Educator