Multiplying large numbers

G = 6e-11

When I multiply 2 times G, I get:

Answer = 25.261879591643662

The answer should be 1.2e-10

Why is it 25.261879591643662?

It works on the Calculators, why doesn’t it work in CL?

Activity Link

CODE:
G=numericValue(“6*10^{-11}”)

ans=numericValue(“2*${G}”)

content: "G = ${G}

When I multiply 2 times G, I get:

Answer = ${ans}

The answer should be 1.2e-10

Why is it 25.261879591643662?

It works on the Calculators, why doesn’t it work in CL?
"

This comes up every now and again. It’s because numericValue is interpreting the e as the constant e (2.71…). It’s better to use simplefunction to avoid this. For example:

f = simpleFunction("6 \times 10^{x}", "x")
G = f.evaluateAt(-11)
prod = simpleFunction("x \times y","x","y")
ans = prod.evaluateAt(2,G)
1 Like

Awesome! Thank you!!!

1 Like