| Alternative 1 | |
|---|---|
| Error | 0.1 |
| Cost | 19712 |
\[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right)
\]
(FPCore (re im) :precision binary64 (* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))
(FPCore (re im) :precision binary64 (/ (/ (sin re) -2.0) (/ (exp im) (- -1.0 (exp (+ im im))))))
double code(double re, double im) {
return (0.5 * sin(re)) * (exp((0.0 - im)) + exp(im));
}
double code(double re, double im) {
return (sin(re) / -2.0) / (exp(im) / (-1.0 - exp((im + im))));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * sin(re)) * (exp((0.0d0 - im)) + exp(im))
end function
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (sin(re) / (-2.0d0)) / (exp(im) / ((-1.0d0) - exp((im + im))))
end function
public static double code(double re, double im) {
return (0.5 * Math.sin(re)) * (Math.exp((0.0 - im)) + Math.exp(im));
}
public static double code(double re, double im) {
return (Math.sin(re) / -2.0) / (Math.exp(im) / (-1.0 - Math.exp((im + im))));
}
def code(re, im): return (0.5 * math.sin(re)) * (math.exp((0.0 - im)) + math.exp(im))
def code(re, im): return (math.sin(re) / -2.0) / (math.exp(im) / (-1.0 - math.exp((im + im))))
function code(re, im) return Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(0.0 - im)) + exp(im))) end
function code(re, im) return Float64(Float64(sin(re) / -2.0) / Float64(exp(im) / Float64(-1.0 - exp(Float64(im + im))))) end
function tmp = code(re, im) tmp = (0.5 * sin(re)) * (exp((0.0 - im)) + exp(im)); end
function tmp = code(re, im) tmp = (sin(re) / -2.0) / (exp(im) / (-1.0 - exp((im + im)))); end
code[re_, im_] := N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[(0.0 - im), $MachinePrecision]], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[re_, im_] := N[(N[(N[Sin[re], $MachinePrecision] / -2.0), $MachinePrecision] / N[(N[Exp[im], $MachinePrecision] / N[(-1.0 - N[Exp[N[(im + im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right)
\frac{\frac{\sin re}{-2}}{\frac{e^{im}}{-1 - e^{im + im}}}
Results
Initial program 0.1
Simplified0.1
[Start]0.1 | \[ \left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right)
\] |
|---|---|
rational.json-simplify-13 [=>]0.1 | \[ \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + e^{im}\right)
\] |
Applied egg-rr0.1
Applied egg-rr0.1
Simplified0.1
[Start]0.1 | \[ \frac{\frac{\sin re}{-2}}{\frac{-e^{im}}{1 + e^{im + im}}}
\] |
|---|---|
rational.json-simplify-17 [=>]0.1 | \[ \frac{\frac{\sin re}{-2}}{\frac{-e^{im}}{\color{blue}{e^{im + im} - -1}}}
\] |
rational.json-simplify-50 [<=]0.1 | \[ \frac{\frac{\sin re}{-2}}{\color{blue}{\frac{e^{im}}{-1 - e^{im + im}}}}
\] |
Final simplification0.1
| Alternative 1 | |
|---|---|
| Error | 0.1 |
| Cost | 19712 |
| Alternative 2 | |
|---|---|
| Error | 0.8 |
| Cost | 13312 |
| Alternative 3 | |
|---|---|
| Error | 1.2 |
| Cost | 6464 |
| Alternative 4 | |
|---|---|
| Error | 31.2 |
| Cost | 64 |
herbie shell --seed 2023074
(FPCore (re im)
:name "math.sin on complex, real part"
:precision binary64
(* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))