# Calculator sometimes produces wrong results

The calculator at BiVector.net sometimes gives strange results:

``````~(0.5403 + 0.8414e12) * 0.8414e3 * (0.5403 + 0.8414e12)
``````

produces

``````0.8412974477e3 + 5.4e − 9e123
``````

Which i’m not even sure what that’s supposed to mean, but according to my GA library,
the correct result should be:

``````// calculate ~(a+be12)*(ce3)*(a+be12)
a = 0.5403 // Math.cos(1);
b = 0.8414 // Math.sin(1);
c = b;
`\${a*a*c} + \${b*b*c}e3`; // 0.24562492932600002 + 0.5956724619440001e3
``````

Bracketing doesn’t seem to help. Am I doing something wrong?

There’s definitely something wrong you’re doing, here is what the correct result is

``````julia> using Grassmann; basis"3"
(⟨×××⟩, v, v₁, v₂, v₃, v₁₂, v₁₃, v₂₃, v₁₂₃)

julia> ~exp(v12)*v3*exp(v12)
0.0 + 1.0v₃
``````

As you can see, it’s a just `v3` (multipled by the constant 0.8141 ~ sin(1) if you want to).

In `Grassmann` you can also use `\oslash` for this

``````julia> v3⊘exp(v12)
0.0 + 1.0v₃
``````

The result is a vector because the outermorphism is applied to a vector, so it would not be mixed grade, also `v3` is independent from `exp(v12)`, so it remains unchanged by the transformation.

1 Like

Ah yes, you’re right.
I misread the output of my calculator, it should be:

```````\${a*a*c + b*b*c}e3`; // 0.9998780500000002e3
``````

Still, someone should probably do something about the bivector.net one.

The bivector.net is close to correct, except for the presentation of the output. The number

5.4e -9e123

should be presented as (5.4e-9) e123, and is likely due to floating point precision and evaluation order. The input numbers are not exact trig results for any angle. Note that

``````(0.5403*0.5403 + 0.8414*0.8414) = 0.999878 (approx)
``````

The e3 term should be c*(aa+bb), which is 0.8414*0.999878 = 0.841297 (approx).

The error term will depend on the precision used and the evaluation order, which yields (5.4e-9) e123 for bivector.net, but may evaluate differently for other platforms.

1 Like

Another reason not to use/overload `e` syntax, my `v` notation is better in that regard. That looks like `5.4e - 9e123` which looks like 5.4 minus 9e123. I’ve always recommended against using `e` for basis names as it leads to unnecessary confusion as it does here. People never listen to my suggestion, so I guess people need to discover the experience of `e` being a bad notational choice on their own.