Gammas

To create a gamma (more like an addition data) we used np.logspace(-3, 2, num=30) The num means we need 30 values then i am confused with -3 and 2. Checked the documentation and it says the represent start and end. Which the 30 values should be between -3 and 2 like -3,-2, -1, 0, 1, 2. But when i viewed gamma i am seeing values above 2. Why is that? Or did i not understand the documentation?

Also why choose num = 30, can i use less or above 30? and what should determine whether to use less values or not.

Your confusion about the number range seems to arise from scientific notation display and the scale logspace uses. The number after e specifies the power to the 10. For example. 4.5e+01 means 4.5*10^1= 45.

logspace computes its start and end points as base**start and base**stop respectively. The base value can be specified, but is 10.0 by default.

Thus logspace(-3, 2) refers to the powers of the base specified. The numbers after e range from -3 to 2 as a result.

To turn off the scientific notation display, you can use, np.set_printoptions(suppress=True), and then print the gammas array again. You will see that the values are between 0.001 and 100, which are 10**-3 and 10**2 respectively.

image_2022-03-28_020424

2 Likes

Why choose 30 values? Can I use less or above 30? And what should determine how many values to use?

It’s a matter of choosing enough values to catch relevant nuances in our graph without making it inefficient to calculate and look too crowded; like in the story of Goldilocks and Three Bears, finding a good spot that works well for our purposes.

The graph for 5 gamma values. This one has too few points to see more details that might be relevant.
image

The graph with 30 gamma values. It shows enough details without making it look noisy.
image

The graph with 100 gamma values. There are too many points on the graph and the code takes much longer to run.
image

You can try other values yourself to see how the graph changes. It’s a matter of balancing the relevant factors. :balance_scale::slightly_smiling_face:

5 Likes

Thank You so much, This is so very clear

1 Like