Numerical Patterns
Normalize Values
Scale by the Maximum
Normalization can convert raw values to ratios by dividing each value by a reference such as the maximum.
Program
Play the program to choose the maximum value used for scaling.
normalize_values.f90
program normalize_values_demo
implicit none
real :: raw(3), scaled(3)
real :: max_value
raw = [2.0, 4.0, 8.0]
max_value =
scaled = raw / max_value
print '(F0.2, 1X, F0.2, 1X, F0.2)', scaled(1), scaled(2), scaled(3)
end program normalize_values_demo
program normalize_values_demo
implicit none
real :: raw(3), scaled(3)
real :: max_value
raw = [2.0, 4.0, 8.0]
max_value =
scaled = raw / max_value
print '(F0.2, 1X, F0.2, 1X, F0.2)', scaled(1), scaled(2), scaled(3)
end program normalize_values_demo
program normalize_values_demo
implicit none
real :: raw(3), scaled(3)
real :: max_value
raw = [2.0, 4.0, 8.0]
max_value =
scaled = raw / max_value
print '(F0.2, 1X, F0.2, 1X, F0.2)', scaled(1), scaled(2), scaled(3)
end program normalize_values_demo
array division
`raw / max_value` divides every element by the scalar.
normalization
Scaling by a reference value makes magnitudes easier to compare.
formatting
`F0.2` prints each ratio with two decimal places.