g | x | w | all
Bytes Lang Time Link
101APLNARS250125T135439ZRosario
258Mathematica160527T225124ZNoOneIsH

APL(NARS), 101 chars

r←(m g)p;e
r←1v⋄e←÷10*p+6.5v
r×←1.1⋄→2×⍳e<∣m r

S←{(a d)←⍵⋄a⍺⍺∫⍺⍺g d}
f←{⎕fpc+←5×⍵⋄(1⌈⍵)⍕{÷!⍵}S ¯1 ⍵}

//11+18+18+22+32 =101

The function f should calculate integral_[-1,+oo) (1/x!)dx in function of argument=digits. The past function even if more short was bugged not return the right values.

I think today i find the way of calculate integral of one infinite interval, using right approssimation in the interval and the APL NARS function... It is possible I make a big error, one allucination ecc

The integral of a function F in a..∞ with lim_t-->+oo F(t)=0 in NARS APL

a F ∫∞

it seems give the wrong result because the interval a..∞ is too much big and depend in the calculation

  1. of the digits d one has to find in the solution and
  2. to the function F...

So here is my workaround: find one function g with input the function F, and the decimal digits one has to find d, and return one number b, that make the integral

a F ∫b

return the right result of Integral(F, a..∞) until digit d.

  ⍪f¨0..60
2.8                                                            
2.8                                                            
2.81                                                           
2.808                                                          
2.8078                                                         
2.80777                                                        
2.807770                                                       
2.8077702                                                      
2.80777024                                                     
2.807770242                                                    
2.8077702420                                                   
2.80777024203                                                  
2.807770242029                                                 
2.8077702420285                                                
..................
2.8077702420285193652215011865577729323080859209301982912201   
2.80777024202851936522150118655777293230808592093019829122005  
2.807770242028519365221501186557772932308085920930198291220055 

  f 150  
2.80777024202851936522150118655777293230808592093019829122005480
  95971008891219016655101853081681966381418741643429264767860
  73568347830897012446742487765

Mathematica, 44 39 36 25 UTF-8 bytes

Crossed out 44 is still regular 44!!

N[∫1/x!{x,-1,∞},#+1]&

Example:

f=N[∫1/x!{x,-1,∞},#+1]&
f[2]

Outputs 2.81.

Explanation

N[               , # + 1] 
  ∫1/x!{x,-1,∞}

First step takes Numeric of the rest, with # (first parameter) + 1 precision. ! (factorial) does what you'd expect. {x, -1, Infinity} sets the bounds for the (strangely formatted) Integral.