~ubuntu-branches/debian/sid/octave3.0/sid

« back to all changes in this revision

Viewing changes to doc/interpreter/HTML/Inline-Functions.html

  • Committer: Bazaar Package Importer
  • Author(s): Rafael Laboissiere
  • Date: 2007-12-23 16:04:15 UTC
  • Revision ID: james.westby@ubuntu.com-20071223160415-n4gk468dihy22e9v
Tags: upstream-3.0.0
ImportĀ upstreamĀ versionĀ 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<html lang="en">
 
2
<head>
 
3
<title>Inline Functions - Untitled</title>
 
4
<meta http-equiv="Content-Type" content="text/html">
 
5
<meta name="description" content="Untitled">
 
6
<meta name="generator" content="makeinfo 4.11">
 
7
<link title="Top" rel="start" href="index.html#Top">
 
8
<link rel="up" href="Function-Handles-Inline-Functions-and-Anonymous-Functions.html#Function-Handles-Inline-Functions-and-Anonymous-Functions" title="Function Handles Inline Functions and Anonymous Functions">
 
9
<link rel="prev" href="Anonymous-Functions.html#Anonymous-Functions" title="Anonymous Functions">
 
10
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
 
11
<meta http-equiv="Content-Style-Type" content="text/css">
 
12
<style type="text/css"><!--
 
13
  pre.display { font-family:inherit }
 
14
  pre.format  { font-family:inherit }
 
15
  pre.smalldisplay { font-family:inherit; font-size:smaller }
 
16
  pre.smallformat  { font-family:inherit; font-size:smaller }
 
17
  pre.smallexample { font-size:smaller }
 
18
  pre.smalllisp    { font-size:smaller }
 
19
  span.sc    { font-variant:small-caps }
 
20
  span.roman { font-family:serif; font-weight:normal; } 
 
21
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
 
22
--></style>
 
23
</head>
 
24
<body>
 
25
<div class="node">
 
26
<p>
 
27
<a name="Inline-Functions"></a>
 
28
Previous:&nbsp;<a rel="previous" accesskey="p" href="Anonymous-Functions.html#Anonymous-Functions">Anonymous Functions</a>,
 
29
Up:&nbsp;<a rel="up" accesskey="u" href="Function-Handles-Inline-Functions-and-Anonymous-Functions.html#Function-Handles-Inline-Functions-and-Anonymous-Functions">Function Handles Inline Functions and Anonymous Functions</a>
 
30
<hr>
 
31
</div>
 
32
 
 
33
<h4 class="subsection">11.9.3 Inline Functions</h4>
 
34
 
 
35
<p>An inline function is created from a string containing the function
 
36
body using the <code>inline</code> function. The following code defines the
 
37
function f(x) = x^2 + 2.
 
38
 
 
39
<pre class="example">     f = inline("x^2 + 2");
 
40
</pre>
 
41
   <p class="noindent">After this it is possible to evaluate f at any x by
 
42
writing <code>f(x)</code>.
 
43
 
 
44
   <p><a name="doc_002dinline"></a>
 
45
 
 
46
<div class="defun">
 
47
&mdash; Built-in Function:  <b>inline</b> (<var>str</var>)<var><a name="index-inline-612"></a></var><br>
 
48
&mdash; Built-in Function:  <b>inline</b> (<var>str, arg1, <small class="dots">...</small></var>)<var><a name="index-inline-613"></a></var><br>
 
49
&mdash; Built-in Function:  <b>inline</b> (<var>str, n</var>)<var><a name="index-inline-614"></a></var><br>
 
50
<blockquote><p>Create an inline function from the character string <var>str</var>. 
 
51
If called with a single argument, the arguments of the generated
 
52
function are extracted from the function itself. The generated
 
53
function arguments will then be in alphabetical order. It should
 
54
be noted that i, and j are ignored as arguments due to the
 
55
ambiguity between their use as a variable or their use as an inbuilt
 
56
constant. All arguments followed by a parenthesis are considered
 
57
to be functions.
 
58
 
 
59
        <p>If the second and subsequent arguments are character strings,
 
60
they are the names of the arguments of the function.
 
61
 
 
62
        <p>If the second argument is an integer <var>n</var>, the arguments are
 
63
<code>"x"</code>, <code>"P1"</code>, <small class="dots">...</small>, <code>"P</code><var>N</var><code>"</code>.
 
64
        <pre class="sp">
 
65
     
 
66
     </pre>
 
67
     <strong>See also:</strong> argnames, formula, vectorize. 
 
68
</p></blockquote></div>
 
69
 
 
70
   <p><a name="doc_002dargnames"></a>
 
71
 
 
72
<div class="defun">
 
73
&mdash; Built-in Function:  <b>argnames</b> (<var>fun</var>)<var><a name="index-argnames-615"></a></var><br>
 
74
<blockquote><p>Return a cell array of character strings containing the names of
 
75
the arguments of the inline function <var>fun</var>.
 
76
        <pre class="sp">
 
77
     
 
78
     </pre>
 
79
     <strong>See also:</strong> inline, formula, vectorize. 
 
80
</p></blockquote></div>
 
81
 
 
82
   <p><a name="doc_002dformula"></a>
 
83
 
 
84
<div class="defun">
 
85
&mdash; Built-in Function:  <b>formula</b> (<var>fun</var>)<var><a name="index-formula-616"></a></var><br>
 
86
<blockquote><p>Return a character string representing the inline function <var>fun</var>. 
 
87
Note that <code>char (</code><var>fun</var><code>)</code> is equivalent to
 
88
<code>formula (</code><var>fun</var><code>)</code>.
 
89
        <pre class="sp">
 
90
     
 
91
     </pre>
 
92
     <strong>See also:</strong> argnames, inline, vectorize. 
 
93
</p></blockquote></div>
 
94
 
 
95
   <p><a name="doc_002dvectorize"></a>
 
96
 
 
97
<div class="defun">
 
98
&mdash; Built-in Function:  <b>vectorize</b> (<var>fun</var>)<var><a name="index-vectorize-617"></a></var><br>
 
99
<blockquote><p>Create a vectorized version of the inline function <var>fun</var>
 
100
by replacing all occurrences of <code>*</code>, <code>/</code>, etc., with
 
101
<code>.*</code>, <code>./</code>, etc. 
 
102
</p></blockquote></div>
 
103
 
 
104
   </body></html>
 
105