The error type is a common one - so here is how to quickly spot where the error is in a program.
Run it in DrRacket. Notice that this expression is colored red:
(
(/
(sqrt (-
1 (expt (cos z) 2)))
(cos z)))
The error message says: "expected a procedure that can be applied to arguments given". The last part implies that Racket expected ( ... )
to be an application of a procedure (function). However the first argument is : (/ ...)
and the result of a division is a number.
That is: When you get this error always look at the first expression.
Here the problem is an extra layer of parentheses ( (/ ...) )
should be (/ ...)
. In other cases use display to print out the result of the first expression in order to see what went wrong.
Note: In can be helpful to use the following indentation convention when dealing with arithmetical operations:
(operation argument1
argument2
...)
In this example:
(atan (/ (sqrt (- 1
(expt (cos z) 2)))
(cos z))))