TransWikia.com

Can you make a graph without storing values in a list first?

Mathematica Asked by D'Angelo on September 13, 2020

For example if I had:

maxsize = 1000000;
lis1 = {};
For[i = 1, i <= maxsize, i++,
 lis1 = Append[lis1, i]]

ListLinePlot[lis1]

In the current process a number is stored to lis1 for each iteration and after the loop has ran 1 million times, a graph is then created. However, as more and more values are being stored, the process seems to slow down. So there are two questions I have:

  1. Is there a limit to the size of a list you can have in Mathematica? Is 1000000 entries in a list too many?

  2. Assuming list size is not an issue, is there any way to directly just plot a value obtained from the loop without having to store it first? So in this example, instead of obtaining:

    lis1={1,2,3,4….1000000}

Is it possible to just take the integer given by each iteration of the loop and plot it to a graph without storing that value in a list beforehand?

I know there may be other ways to make the graph which this specific loop shows, however I’m working on a a bit of code which happens to use a For loop in the same manner as the example above so any work arounds here in relation to that would be greatly appreciated.

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