TransWikia.com

Correct way to format numbers

Mathematica Asked on March 30, 2021

I have defined the following function:

randvec[mag_]:= mag Normalize[Table[RandomReal[], {j, 1, 4}]]

I would like to format the numbers in the list so that they are 4 d.p. Trying the following:

randvec[mag_] := NumberForm[mag Normalize[Table[RandomReal[], {j, 1, modes}]], 4]

casts each entry as a string. What is the appropriate way to format the list without changing the type of the entries?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP