Ask Your Question
0

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

asked 2021-02-25 14:06:32 +0200

anonymous user

Anonymous

updated 2021-02-25 17:55:35 +0200

slelievre gravatar image

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 flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-02-25 14:12:01 +0200

slelievre gravatar image

updated 2021-02-25 18:10:55 +0200

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)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-02-25 14:06:32 +0200

Seen: 55 times

Last updated: Feb 25