~ubuntu-branches/ubuntu/karmic/scilab/karmic

« back to all changes in this revision

Viewing changes to macros/elem/tanh.sci

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2002-03-21 16:57:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020321165743-e9mv12c1tb1plztg
Tags: upstream-2.6
ImportĀ upstreamĀ versionĀ 2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function t=tanh(x)
 
2
//Element wise Hyperbolic tangent
 
3
// Copyright INRIA
 
4
if type(x)<>1 then error(53),end
 
5
t1=exp(x);t2=exp(-x);
 
6
t=(t1-t2)./(t1+t2);
 
7
k=find(isnan(t))
 
8
t(k)=sign(real(x(k)))