Average Error: 20.7 → 1.8
Time: 22.1s
Precision: 64
$\left(\left(k \gt 1 \land k \lt 20000.0\right) \land 0 \le x\right) \land x \le 1$
$\frac{\sinh \left(k \cdot \left(1 - x\right)\right)}{\sinh k}$
$1 - x$
\frac{\sinh \left(k \cdot \left(1 - x\right)\right)}{\sinh k}
1 - x
double f(double k, double x) {
double r31894630 = k;
double r31894631 = 1.0;
double r31894632 = x;
double r31894633 = r31894631 - r31894632;
double r31894634 = r31894630 * r31894633;
double r31894635 = sinh(r31894634);
double r31894636 = sinh(r31894630);
double r31894637 = r31894635 / r31894636;
return r31894637;
}


double f(double __attribute__((unused)) k, double x) {
double r31894638 = 1.0;
double r31894639 = x;
double r31894640 = r31894638 - r31894639;
return r31894640;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 20.7

$\frac{\sinh \left(k \cdot \left(1 - x\right)\right)}{\sinh k}$
2. Taylor expanded around 0 2.2

$\leadsto \color{blue}{1 - \left(x + \frac{1}{3} \cdot \left(x \cdot {k}^{2}\right)\right)}$
3. Simplified2.2

$\leadsto \color{blue}{\left(1 - x\right) + k \cdot \left(\frac{-1}{3} \cdot \left(k \cdot x\right)\right)}$
4. Taylor expanded around 0 1.8

$\leadsto \color{blue}{1 - x}$
5. Final simplification1.8

$\leadsto 1 - x$

# Reproduce

herbie shell --seed 1
(FPCore (k x)
:name "sinh(k * (1 - x)) / sinh(k)"
:pre (and (and (and (> k 1) (< k 20000.0)) (<= 0 x)) (<= x 1))
(/ (sinh (* k (- 1 x))) (sinh k)))