File: evaluate.tex

package info (click to toggle)
sollya 8.0%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 17,592 kB
  • sloc: ansic: 124,655; yacc: 7,543; lex: 2,440; makefile: 888; cpp: 77
file content (87 lines) | stat: -rw-r--r-- 4,228 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
\subsection{evaluate}
\label{labevaluate}
\noindent Name: \textbf{evaluate}\\
\phantom{aaa}evaluates a function at a constant point or in a range\\[0.2cm]
\noindent Library name:\\
\verb|   sollya_obj_t sollya_lib_evaluate(sollya_obj_t, sollya_obj_t)|\\[0.2cm]
\noindent Usage: 
\begin{center}
\textbf{evaluate}(\emph{function}, \emph{constant}) : (\textsf{function}, \textsf{constant}) $\rightarrow$ \textsf{constant} $|$ \textsf{range}\\
\textbf{evaluate}(\emph{function}, \emph{range}) : (\textsf{function}, \textsf{range}) $\rightarrow$ \textsf{range}\\
\textbf{evaluate}(\emph{function}, \emph{function2}) : (\textsf{function}, \textsf{function}) $\rightarrow$ \textsf{function}\\
\end{center}
Parameters: 
\begin{itemize}
\item \emph{function} represents a function
\item \emph{constant} represents a constant point
\item \emph{range} represents a range
\item \emph{function2} represents a function that is not constant
\end{itemize}
\noindent Description: \begin{itemize}

\item If its second argument is a constant \emph{constant}, \textbf{evaluate} evaluates
   its first argument \emph{function} at the point indicated by
   \emph{constant}. This evaluation is performed in a way that the result is a
   faithful rounding of the real value of the \emph{function} at \emph{constant} to
   the current global precision. If such a faithful rounding is not
   possible, \textbf{evaluate} returns a range surely encompassing the real value
   of the function \emph{function} at \emph{constant}. If even interval evaluation
   is not possible because the expression is undefined or numerically
   unstable, NaN will be produced.

\item If its second argument is a range \emph{range}, \textbf{evaluate} evaluates its
   first argument \emph{function} by interval evaluation on this range
   \emph{range}. This ensures that the image domain of the function \emph{function}
   on the preimage domain \emph{range} is surely enclosed in the returned
   range.

\item In the case when the second argument is a range that is reduced to a
   single point (such that $[1;\,1]$ for instance), the evaluation
   is performed in the same way as when the second argument is a constant but
   it produces a range as a result: \textbf{evaluate} automatically adjusts the precision
   of the intern computations and returns a range that contains at most three floating-point
   consecutive numbers in precision \textbf{prec}. This corresponds to the same accuracy
   as a faithful rounding of the actual result. If such a faithful rounding
   is not possible, \textbf{evaluate} has the same behavior as in the case when the
   second argument is a constant.

\item If its second argument is a function \emph{function2} that is not a
   constant, \textbf{evaluate} replaces all occurrences of the free variable in
   function \emph{function} by function \emph{function2}.
\end{itemize}
\noindent Example 1: 
\begin{center}\begin{minipage}{15cm}\begin{Verbatim}[frame=single]
> midpointmode=on!;
> print(evaluate(sin(pi * x), 2.25));
0.70710678118654752440084436210484903928483593768847
> print(evaluate(sin(pi * x), [2.25; 2.25]));
0.707106781186547524400844362104849039284835937688~4/5~
\end{Verbatim}
\end{minipage}\end{center}
\noindent Example 2: 
\begin{center}\begin{minipage}{15cm}\begin{Verbatim}[frame=single]
> print(evaluate(sin(pi * x), 2));
[-3.100365765139897619749121887390789523854170596558e-13490;5.300240158585712760
5350842426029223241500776302528e-13489]
\end{Verbatim}
\end{minipage}\end{center}
\noindent Example 3: 
\begin{center}\begin{minipage}{15cm}\begin{Verbatim}[frame=single]
> print(evaluate(sin(pi * x), [2, 2.25]));
[-5.143390272677254630046998919961912407349224165421e-50;0.707106781186547524400
84436210484903928483593768866]
\end{Verbatim}
\end{minipage}\end{center}
\noindent Example 4: 
\begin{center}\begin{minipage}{15cm}\begin{Verbatim}[frame=single]
> print(evaluate(sin(pi * x), 2 + 0.25 * x));
sin((pi) * 2 + x * (pi) * 0.25)
\end{Verbatim}
\end{minipage}\end{center}
\noindent Example 5: 
\begin{center}\begin{minipage}{15cm}\begin{Verbatim}[frame=single]
> print(evaluate(sin(pi * 1/x), 0));
[-1;1]
\end{Verbatim}
\end{minipage}\end{center}
See also: \textbf{isevaluable} (\ref{labisevaluable})