File: functions.rst

package info (click to toggle)
neuron 8.2.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 34,768 kB
  • sloc: cpp: 149,571; python: 58,449; ansic: 50,329; sh: 3,510; xml: 213; pascal: 51; makefile: 35; sed: 5
file content (160 lines) | stat: -rw-r--r-- 3,390 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160

.. _hoc_math:

Common Math Functions (HOC)
---------------------------

These math functions return a double precision value and take a double 
precision argument. The exception is :hoc:func:`atan2` which has two double precision arguments.

Diagnostics:
    Arguments that are out of range give an argument domain diagnostic. 

    These functions call the library routines supplied by the compiler. 


----

.. hoc:function:: abs

        absolute value 

        see :hoc:meth:`Vector.abs` for the :hoc:class:`Vector` class.


----

.. hoc:function:: int

        returns the integer part of its argument (truncates toward 0). 


----

.. hoc:function:: sqrt

        square root 

        see :hoc:meth:`Vector.sqrt` for the :hoc:class:`Vector` class.


----

.. hoc:function:: exp

    Description:
        returns the exponential function to the base e 
         
        When exp is used in model descriptions, it is often the 
        case that the cvode variable step integrator extrapolates 
        voltages to values which return out of range values for the exp (often used 
        in rate functions). There were so many of these false warnings that it was 
        deemed better to turn off the warning message when Cvode is active. 
        In any case the return value is exp(700). This message is not turned off 
        at the interpreter level or when cvode is not active. 

        .. code-block::
            none

            for i=690, 710 print i, exp(i) 


----

.. hoc:function:: log

        logarithm to the base e 
        see :hoc:meth:`Vector.log` for the :hoc:class:`Vector` class.


----

.. hoc:function:: log10

        logarithm to the base 10 

        see :hoc:meth:`Vector.log10` for the :hoc:class:`Vector` class.


----

.. hoc:function:: cos

    trigonometric function of radian argument. 

    see :hoc:meth:`Vector.sin`


----

.. hoc:function:: sin

    trigonometric function of radian argument. 

    see :hoc:meth:`Vector.sin` for the :hoc:class:`Vector` class.


----

.. hoc:function:: tanh

        hyperbolic tangent. 
        see :hoc:meth:`Vector.tanh` for the :hoc:class:`Vector` class.


----

.. hoc:function:: atan

        returns the arc-tangent of y/x in the range -PI/2 to PI/2. (x > 0) 


----

.. hoc:function:: atan2

    Syntax:
        ``radians = atan2(y, x)``

    Description:
        returns the arc-tangent of y/x in the range -PI < radians <= PI. y and x 
        can be any double precision value, including 0. If both are 0 the value 
        returned is 0. 
        Imagine a right triangle with base x and height y. The result 
        is the angle in radians between the base and hypotenuse 

    Example:

        .. code-block::
            none

            atan2(0,0) 
            for i=-1,1 { print atan2(i*1e-6, 10) } 
            for i=-1,1 { print atan2(i*1e-6, -10) } 
            for i=-1,1 { print atan2(10, i*1e-6) } 
            for i=-1,1 { print atan2(-10, i*1e-6) } 
            atan2(10,10) 
            atan2(10,-10) 
            atan2(-10,10) 
            atan2(-10,-10) 


----

.. hoc:function:: erf

        normalized error function 

        .. math::

            {\rm erf}(z) = \frac{2}{\sqrt{\pi}} \int_{0}^{z} e^{-t^2} dt


----

.. hoc:function:: erfc

        returns ``1.0 - erf(z)`` but on sun machines computed by other methods 
        that avoid cancellation for large z.