Changeset 7386:9a74afabd367


Ignore:
Timestamp:
11/20/07 07:30:58 (6 years ago)
Author:
William Stein <wstein@…>
Branch:
default
Message:

Fix trac #215 and add asinh, acosh, atanh.

Location:
sage/calculus
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sage/calculus/all.py

    r7385 r7386  
    1111                      sin, cos, sec, csc, cot, tan, log, erf, sqrt, asin, acos, atan, 
    1212                      tanh, sinh, cosh, coth, sech, csch, ln, 
     13                      asinh, acosh, atanh, 
    1314                      ceil, floor, 
    1415                      polylog, 
  • sage/calculus/calculus.py

    r7385 r7386  
    129129        sage: f.diff(x) 
    130130        1/(3*sqrt(x^2/9 + 1)) 
     131 
     132    We compute the length of the parabola from 0 to 2: 
     133        sage: x = var('x') 
     134        sage: y = x^2 
     135        sage: dy = diff(y,x) 
     136        sage: z = integral(sqrt(1 + dy^2), x, 0, 2) 
     137        sage: print z 
     138                             asinh(4) + 4 sqrt(17) 
     139                             --------------------- 
     140                                       4 
     141        sage: n(z,200) 
     142        4.6467837624329358733826155674904591885104869874232887508703 
     143        sage: float(z) 
     144        4.6467837624329356 
    131145 
    132146COERCION EXAMPLES: 
     
    43774391_syms['asin'] = asin 
    43784392 
     4393class Function_asinh(PrimitiveFunction): 
     4394    """ 
     4395    The inverse of the hyperbolic sine function. 
     4396 
     4397    EXAMPLES: 
     4398        sage: asinh(0.5) 
     4399        0.481211825059603 
     4400        sage: asinh(1/2) 
     4401        asinh(1/2) 
     4402        sage: asinh(1 + I*1.0) 
     4403        0.6662394324925153*I + 1.061275061905036 
     4404    """ 
     4405    def _repr_(self, simplify=True): 
     4406        return "asinh" 
     4407 
     4408    def _latex_(self): 
     4409        return "\\sinh^{-1}" 
     4410 
     4411    def _approx_(self, x): 
     4412        return float(pari(float(x)).asinh()) 
     4413 
     4414asinh = Function_asinh() 
     4415_syms['asinh'] = asinh 
     4416 
     4417class Function_acosh(PrimitiveFunction): 
     4418    """ 
     4419    The inverse of the hyperbolic cose function. 
     4420 
     4421    EXAMPLES: 
     4422        sage: acosh(1/2) 
     4423        acosh(1/2) 
     4424        sage: acosh(1 + I*1.0) 
     4425        0.9045568943023813*I + 1.061275061905036 
     4426 
     4427    Warning: If the input is real the output will be real or NaN: 
     4428        sage: acosh(0.5) 
     4429        NaN 
     4430 
     4431    But evaluate where the input is in the complex field yields a complex output: 
     4432        sage: acosh(CC(0.5)) 
     4433        1.04719755119660*I 
     4434         
     4435    """ 
     4436    def _repr_(self, simplify=True): 
     4437        return "acosh" 
     4438 
     4439    def _latex_(self): 
     4440        return "\\cosh^{-1}" 
     4441 
     4442    def _approx_(self, x): 
     4443        return float(pari(float(x)).acosh()) 
     4444 
     4445acosh = Function_acosh() 
     4446_syms['acosh'] = acosh 
     4447 
     4448class Function_atanh(PrimitiveFunction): 
     4449    """ 
     4450    The inverse of the hyperbolic tane function. 
     4451 
     4452    EXAMPLES: 
     4453        sage: atanh(0.5) 
     4454        0.549306144334055 
     4455        sage: atanh(1/2) 
     4456        atanh(1/2) 
     4457        sage: atanh(1 + I*1.0) 
     4458        1.017221967897851*I + 0.4023594781085251 
     4459    """ 
     4460    def _repr_(self, simplify=True): 
     4461        return "atanh" 
     4462 
     4463    def _latex_(self): 
     4464        return "\\tanh^{-1}" 
     4465 
     4466    def _approx_(self, x): 
     4467        return float(pari(float(x)).atanh()) 
     4468 
     4469atanh = Function_atanh() 
     4470_syms['atanh'] = atanh 
     4471 
    43794472class Function_acos(PrimitiveFunction): 
    43804473    """ 
     
    49325025        self._kwds = kwds 
    49335026 
     5027    def __float__(self): 
     5028        return float(maxima(self)) 
     5029     
    49345030    def _is_atomic(self): 
    49355031        return True 
     
    49405036    def keyword_arguments(self): 
    49415037        return self._kwds 
    4942      
     5038 
    49435039    def _repr_(self, simplify=True): 
    49445040        if simplify: 
     
    52345330                nm = msg[i+1:j] 
    52355331 
    5236                 res = re.match(nm + '\s*\(.*\)', s) 
     5332                res = re.match('.*' + nm + '\s*\(.*\)', s) 
    52375333                if res: 
    52385334                    syms[nm] = function(nm) 
Note: See TracChangeset for help on using the changeset viewer.