Changeset 7819:256fb33dd86c


Ignore:
Timestamp:
12/20/07 17:35:04 (5 years ago)
Author:
Robert Miller <rlmillster@…>
Branch:
default
Parents:
7817:e526ad576440 (diff), 7818:b2d99e388e5c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

local merge

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sage/calculus/calculus.py

    r7810 r7819  
    55375537class Function_atanh(PrimitiveFunction): 
    55385538    """ 
    5539     The inverse of the hyperbolic tane function. 
     5539    The inverse of the hyperbolic tangent function. 
    55405540 
    55415541    EXAMPLES: 
     
    55595559_syms['atanh'] = atanh 
    55605560 
     5561class Function_acoth(PrimitiveFunction): 
     5562    """ 
     5563    The inverse of the hyperbolic cotangent function. 
     5564 
     5565    EXAMPLES: 
     5566        sage: acoth(2.) 
     5567        0.549306144334055 
     5568        sage: acoth(2) 
     5569        acoth(2) 
     5570        sage: acoth(1 + I*1.0) 
     5571        0.402359478108525 - 0.553574358897045*I 
     5572    """ 
     5573    def _repr_(self, simplify=True): 
     5574        return "acoth" 
     5575 
     5576    def _latex_(self): 
     5577        return "\\coth^{-1}" 
     5578 
     5579    def _approx_(self, x): 
     5580        return float(pari(float(1/x)).atanh()) 
     5581 
     5582acoth = Function_acoth() 
     5583_syms['acoth'] = acoth 
     5584 
     5585class Function_asech(PrimitiveFunction): 
     5586    """ 
     5587    The inverse of the hyperbolic secant function. 
     5588 
     5589    EXAMPLES: 
     5590        sage: asech(.5) 
     5591        1.316957896924817 
     5592        sage: asech(1/2) 
     5593        asech(1/2) 
     5594        sage: asech(1 + I*1.0) 
     5595        0.530637530952518 - 1.118517879643706*I 
     5596    """ 
     5597    def _repr_(self, simplify=True): 
     5598        return "asech" 
     5599 
     5600    def _latex_(self): 
     5601        return "\\sech^{-1}" 
     5602 
     5603    def _approx_(self, x): 
     5604        return float(pari(float(1/x)).acosh()) 
     5605 
     5606asech = Function_asech() 
     5607_syms['asech'] = asech 
     5608 
     5609class Function_acsch(PrimitiveFunction): 
     5610    """ 
     5611    The inverse of the hyperbolic cosecant function. 
     5612 
     5613    EXAMPLES: 
     5614        sage: acsch(2.) 
     5615        0.481211825059603 
     5616        sage: acsch(2) 
     5617        acsch(2) 
     5618        sage: acsch(1 + I*1.0) 
     5619        0.530637530952518 - 0.452278447151191*I 
     5620    """ 
     5621    def _repr_(self, simplify=True): 
     5622        return "acsch" 
     5623 
     5624    def _latex_(self): 
     5625        return "\\csch^{-1}" 
     5626 
     5627    def _approx_(self, x): 
     5628        return float(pari(float(1/x)).asinh()) 
     5629 
     5630acsch = Function_acsch() 
     5631_syms['acsch'] = acsch 
     5632 
    55615633class Function_acos(PrimitiveFunction): 
    55625634    """ 
     
    56075679atan = Function_atan() 
    56085680_syms['atan'] = atan 
     5681 
     5682class Function_acot(PrimitiveFunction): 
     5683    """ 
     5684    The arccotangent function. 
     5685 
     5686    EXAMPLES: 
     5687        sage: acot(1/2) 
     5688        acot(1/2) 
     5689        sage: RDF(acot(1/2)) 
     5690        1.10714871779 
     5691        sage: acot(1 + I) 
     5692        acot(I + 1) 
     5693    """ 
     5694    def _repr_(self, simplify=True): 
     5695        return "acot" 
     5696 
     5697    def _latex_(self): 
     5698        return "\\cot^{-1}" 
     5699 
     5700    def _approx_(self, x): 
     5701        return math.pi/2 - math.atan(x) 
     5702 
     5703acot = Function_acot() 
     5704_syms['acot'] = acot 
     5705 
     5706class Function_acsc(PrimitiveFunction): 
     5707    """ 
     5708    The arccosecant function. 
     5709 
     5710    EXAMPLES: 
     5711        sage: acsc(2) 
     5712        acsc(2) 
     5713        sage: RDF(acsc(2)) 
     5714        0.523598775598 
     5715        sage: acsc(1 + I) 
     5716        acsc(I + 1) 
     5717    """ 
     5718    def _repr_(self, simplify=True): 
     5719        return "acsc" 
     5720 
     5721    def _latex_(self): 
     5722        return "\\csc^{-1}" 
     5723 
     5724    def _approx_(self, x): 
     5725        return math.asin(1/x) 
     5726 
     5727acsc = Function_acsc() 
     5728_syms['acsc'] = acsc 
     5729 
     5730class Function_asec(PrimitiveFunction): 
     5731    """ 
     5732    The arcsecant function. 
     5733 
     5734    EXAMPLES: 
     5735        sage: asec(2) 
     5736        asec(2) 
     5737        sage: RDF(asec(2)) 
     5738        1.0471975512 
     5739        sage: asec(1 + I) 
     5740        asec(I + 1) 
     5741    """ 
     5742    def _repr_(self, simplify=True): 
     5743        return "asec" 
     5744 
     5745    def _latex_(self): 
     5746        return "\\sec^{-1}" 
     5747 
     5748    def _approx_(self, x): 
     5749        return math.acos(1/x) 
     5750 
     5751asec = Function_asec() 
     5752_syms['asec'] = asec 
    56095753 
    56105754 
  • sage/calculus/calculus.py

    r7818 r7819  
    19971997            There is also a function \code{numerical_integral} that implements 
    19981998            numerical integration using the GSL C library.  It is potentially 
    1999             much faster and applies to arbitrary user defined functions.  
     1999            much faster and applies to arbitrary user defined functions. 
     2000 
     2001            Also, there are limits to the precision that Maxima can compute 
     2002            the integral to due to limitations in quadpack. 
     2003 
     2004            sage: f = x 
     2005            sage: f = f.nintegral(x,0,1,1e-14) 
     2006            Traceback (most recent call last): 
     2007            ... 
     2008            ValueError: Maxima (via quadpack) cannot compute the integral to that precision 
    20002009 
    20012010        EXAMPLES: 
     
    20492058        syntax.  
    20502059        """ 
    2051         v = self._maxima_().quad_qags(var(x), 
     2060        try: 
     2061            v = self._maxima_().quad_qags(var(x), 
    20522062                                      a, b, desired_relative_error, 
    20532063                                      maximum_num_subintervals) 
     2064        except TypeError, err: 
     2065            if "ERROR NUMBER = 6" in str(err): 
     2066                raise ValueError, "Maxima (via quadpack) cannot compute the integral to that precision" 
     2067            else: 
     2068                raise TypeError, err 
     2069             
    20542070        return float(v[0]), float(v[1]), Integer(v[2]), Integer(v[3]) 
    20552071 
     
    24592475            sage: v = 0.004*(9600*e^(-(1200*t)) - 2400*e^(-(300*t))) 
    24602476            sage: v.find_root(0, 0.002) 
    2461             0.0015403270679114178 
     2477            0.001540327067911417... 
    24622478 
    24632479             sage: a = .004*(8*e^(-(300*t)) - 8*e^(-(1200*t)))*(720000*e^(-(300*t)) - 11520000*e^(-(1200*t))) +.004*(9600*e^(-(1200*t)) - 2400*e^(-(300*t)))^2 
     
    24722488        However \code{find_root} works beautifully: 
    24732489            sage: a.find_root(0,0.002) 
    2474             0.00041105140493493411 
     2490            0.0004110514049349341... 
    24752491        """ 
    24762492        a = float(a); b = float(b) 
Note: See TracChangeset for help on using the changeset viewer.