NEST main@caf0ae8
 
Loading...
Searching...
No Matches
beta_normalization_factor.h
Go to the documentation of this file.
1/*
2 * beta_normalization_factor.h
3 *
4 * This file is part of NEST.
5 *
6 * Copyright (C) 2004 The NEST Initiative
7 *
8 * NEST is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * NEST is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with NEST. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23#ifndef BETA_NORMALIZATION_FACTOR_H
24#define BETA_NORMALIZATION_FACTOR_H
25
26#include <cmath>
27#include <limits>
28
29// Includes from libnestutil
30#include "numerics.h"
31
32namespace nest
33{
34
73inline double
74beta_normalization_factor( const double tau_rise, const double tau_decay )
75{
76 const double tau_difference = tau_decay - tau_rise;
77 double peak_value = 0;
78 if ( std::abs( tau_difference ) > std::numeric_limits< double >::epsilon() )
79 {
80 // peak time
81 const double t_peak = tau_decay * tau_rise * std::log( tau_decay / tau_rise ) / tau_difference;
82 // another denominator is computed here to check that it is != 0
83 peak_value = std::exp( -t_peak / tau_decay ) - std::exp( -t_peak / tau_rise );
84 }
85 if ( std::abs( peak_value ) < std::numeric_limits< double >::epsilon() )
86 {
87 // if rise time == decay time use alpha function
88 return numerics::e / tau_decay;
89 }
90 else
91 {
92 // if rise time != decay time use beta function
93 return ( 1. / tau_rise - 1. / tau_decay ) / peak_value;
94 }
95}
96
97} // of namespace nest
98
99
100#endif /* BETA_NORMALIZATION_FACTOR_H */
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
double beta_normalization_factor(const double tau_rise, const double tau_decay)
Computes the normalization constant for the beta function.
Definition beta_normalization_factor.h:74
const double e
Definition numerics.cpp:32