1 | ### erf =====================================================================
|
2 |
|
3 | Tags
|
4 | ----
|
5 | scripting, JS, internal, treenode, general concept
|
6 |
|
7 | Authors
|
8 | -------
|
9 | philippe.billet@noos.fr
|
10 |
|
11 | Parameters
|
12 | ----------
|
13 | x
|
14 |
|
15 | General description
|
16 | -------------------
|
17 | Error function erf(x).
|
18 | erf(-x)=erf(x)
|
19 |
|
20 | ###
|
21 |
|
22 |
|
23 |
|
24 | Eval_erf = ->
|
25 | push(cadr(p1))
|
26 | Eval()
|
27 | yerf()
|
28 |
|
29 | yerf = ->
|
30 | save()
|
31 | yyerf()
|
32 | restore()
|
33 |
|
34 | yyerf = ->
|
35 | d = 0.0
|
36 |
|
37 | p1 = pop()
|
38 |
|
39 | if (isdouble(p1))
|
40 | d = 1.0 - erfc(p1.d)
|
41 | push_double(d)
|
42 | return
|
43 |
|
44 | if (isnegativeterm(p1))
|
45 | push_symbol(ERF)
|
46 | push(p1)
|
47 | negate()
|
48 | list(2)
|
49 | negate()
|
50 | return
|
51 |
|
52 | push_symbol(ERF)
|
53 | push(p1)
|
54 | list(2)
|
55 | return
|
56 |
|