Haskel - Taylor de l'exponencial P39383


Warning: Deprecated problem

This problem is marked as deprecated.

Although this problem remains in the system because of historic reasons, it may have some issues and should not be used anymore.

Deprecation indication: This problem has an issue with the precision of real numbers. It is replaced by P39153.

Statement
 

pdf   zip

html

La sèrie de Taylor per calcular l’exponencial és:

ex=
 
i≥ 0
xi
i!
.
  1. Feu una funció exps :: Float -> [Float] que retorni una llista infinita amb els termes del desenvolupament de Taylor de l’exponencial d’un real x.

    Nota: els termes no inclouen el sumatori.

  2. Feu una funció exponencial :: Float -> Float -> Float que, a partir de dos reals x i є aproximi l’exponencial de x sumant tots els termes de la llista infinita anterior superiors o iguals que є.
Public test cases
  • Input

    take 6 $ exps 1.0
    exponencial 1.0 0.00001
    

    Output

    [1.0,1.0,0.5,0.16666667,4.1666668e-2,8.333334e-3]
    2.718279
    
  • Information
    Author
    Jordi Petit, Gerard Escudero
    Language
    Catalan
    Official solutions
    Haskell
    User solutions
    Haskell