How do I simulate a large number of values without getting ... in the output?

Anonymous

This is the kind of output I get, each line should have say 100 elements but they have been cut out and replaced with ....

[[-0.0014, -0.0057, -0.0069, -0.0154, -0.0241 ... 0.0419, 0.0345, 0.0273, 0.0249, 0.0121],
[-0.0059, -0.0071, -0.0047, -0.0021, -0.0033 ... -0.0545, -0.0584, -0.0461, -0.0527, -0.0602],
[-0.0146, -0.0266, -0.0323, -0.0303, -0.0300 ... -0.0147, -0.0140, -0.0131, -0.0217, -0.0310],
[0.0010, -0.0031, -0.0071, -0.0114, -0.0087 ... -0.0753, -0.0706, -0.0545, -0.0590, -0.0691],
[0.0068, 0.0046, 0.0240, 0.0181, 0.0149 ... -0.0348, -0.0320, -0.0359, -0.0550, -0.0759]]


I'm using this code to simulate a MRW but I still get ... in the output.

sage.finance.fractal.multifractal_cascade_random_walk_simulation(T, lambda2, ell, sigma2, N, n=1)

set_random_seed(0)
a = finance.multifractal_cascade_random_walk_simulation(1000, 0.02, 0.01, 0.05, 100, 5)
str(a)

edit retag close merge delete

Sort by » oldest newest most voted

The output of multifractal_cascade_random_walk_simulation is a list of "time series" whose "repr" and "str" include ... when the time series get long enough.

To turn it into a list of lists:

aa = [list(r) for r in a]
print(aa)


To turn it into a matrix:

m = matrix(a)
print(m)


To use custom printing (e.g limit each entry to 6 characters):

print(m.str(rep_mapping=lambda x: str(x)[:6]))


For a graphical representation rendering each entry as a square whose darkness reflects the entry's value:

matrix_plot(a)

more