2

Consider

a = Table[1, 100]

la = Length[a]

b = ScientificForm[a]

lb = Length[b]

la = 100 and lb = 1. This causes problems in my code. How can I make lb have length of 100? Why does ScientificForm change the length of my list?

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
SPIL
  • 627
  • 3
  • 10

1 Answers1

2

This is not an answer, but a comment far too long to appear in comment box.

The documentation article for ScientificForm asserts

ScientificForm acts as a "wrapper", which affects printing but not evaluation.

The documentation is misleading in this case. The wrapper ScientificForm is not transparent to numerical calculations -- it stops them dead. This means you should only apply it to your final calculations after all the numerical work is done.

Example

u = 4234.567890; v = 4200.0;
ScientificForm[u + v]

result_1

In the above, because the addition is performed before ScientificForm is applied, it succeeds; while in the following, because the addition is attempted after ScientificForm is applied, it fails.

ScientificForm[u] + v

result_2

Note

This discussion applies to all the following wrapper functions.

  • AccountingForm
  • BaseForm
  • DecimalForm
  • EngineeringForm
  • FullForm
  • MatrixForm
  • NumberForm
  • PaddedForm
  • QuantityForm
  • ScientificForm
  • TableForm
m_goldberg
  • 107,779
  • 16
  • 103
  • 257