Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2071 | zjchen | 1 | !goto $wims_read_parm |
2 | |||
3 | :def |
||
4 | title=Rational approximation |
||
5 | synonyme=approximation by a rational |
||
6 | input=function |
||
7 | !exit |
||
8 | |||
9 | :proc |
||
10 | |||
11 | cnt=!itemcnt $formula |
||
12 | !if $cnt>1 |
||
13 | error=bad_formula |
||
14 | !exit |
||
15 | !endif |
||
16 | |||
17 | range=!rawmath $range |
||
18 | range=!trim $range |
||
19 | !if $range=$empty |
||
20 | error=empty_data |
||
21 | !exit |
||
22 | !endif |
||
23 | range=$[floor($range)] |
||
24 | !if NaN isin $range or Inf isin $range or $range<2 |
||
25 | error=bad_formula |
||
26 | !exit |
||
27 | !endif |
||
28 | |||
29 | result=!exec pari bestappr($formula,$range) |
||
30 | |||
31 | !exit |
||
32 | |||
33 | :output |
||
34 | |||
35 | Best approximation by a rational number |
||
36 | with denominator at most $range : |
||
37 | <p><center> |
||
38 | !htmlmath $formula |
||
39 | $m_approx $result |
||
40 | </center> |
||
41 | |||
42 | |||
43 | |||
44 | !exit |
||
45 |