Improving the desmos graph

How can this be optimized?

[Copy of] Untitled Graph | Desmos

@Daniel_Grubbs or @Guzman_Tierno might know i have no idea what youre trying to optimize

just everything, i need to submit to the contest but my graph is painfully laggy and idk why because i barely know anything about desmos, i just know math well

its more of me not knowing what to do probably

I think you are using way too many entities. Desmos doesn’t “render”… it literally loads in EVERYTHING, from what you can see and what you can’t. So you can scroll like to x = 9999999 and y = 99999999 and it would be just as laggy. So basically like make some lists or something.

I think the biggest problem here is that you have multiple 500+ element lists that are making your graph extremely laggy, especially since they’re points who need to carry 2x the information (x and y)

how can i reduce the amount of list? does it create a new list instance with each expression that contains the list?

i also need those 4 lists because random seeds dont work properly

I’m not sure I can follow the purposes of many of the calculations, but any time you’ve got lists calculated in a cascading dependent manner, it’ll slow the graph down. Conditionals with lists compound that.

It may be helpful to know that the sort() function can take a second argument to sort by. For example:

L_{sortedU} = sort(L,L.y)

which sorts list L by the list of its y-coordinates, which would alleviate your need for y_vals and m_ax.

Can you explain what you mean by “properly” here?

if i use the same seed in two different random expressions, the output would be different. also my backspace isnt working with desmos anymore

You mean two sets of values “should” be different? They are as you see here.
Or do you mean each value in the lists should be unique? Which is not the case. Choosing 5 random values from a list [1…10] can result in a list of five 3’s. It’s random with replacement. Or maybe I’m still misunderstanding.

no im saying the output should be the same because i use the same seed, but they arent, that is why i create four random lists, right now im trying to get everything in one expression just incase if it does create a new list instance at every reference, but its super long, i would need 15 monitors to see all of it, and i cannot use my arrow keys, because desmos is always broken

i also cannot copy and paste anything so this is taking forever

This is a feature not a bug. New expressions defined the same are different instances. I might want two different lists of 5 elements from the same list of values, and would have no way of having unique lists.

Now if you use a variable for a seed in a graph, updating a seed back to the same value will return expressions to the same values unless you’ve edited something else in the graph. This graph, for example, a and b have the same definition, but different values. If you change the seed, each will change, but if you return the seed back to 1, they both return to their original values. If you want the same seed to be the same value, reference another as I did with c.

can u at least optimize this o\left{\sqrt{\left(P.x-o.x\right)^{2}}<\left(\frac{k}{2}\right)\right}\left{o.y>P.y\right}\left{\left(P.y-o.y\right)^{2}<\left(k\right)^{2}\right} it is a condition, and if you can get it to work with Untitled Graph | Desmos that would be incredible, because i am reducing the references i have to lists as much as possible by sticking everything in one expression, although i am not so sure if the desmos judges will like this, but it seems as if they would prefer performance

Can you explain the purpose of the multiple complex seed calculations in list “o”?

if u see the colored quadrants in [Copy of] Untitled Graph | Desmos each one of those quadrants has its separate random expression, and if u divide the graph into cells the same size of each of the quadrants, that cell will only ever contain one quadrant color, this is to make it so that way the black squares in that graph, are infinite and persistent, if you disable the graphing of the quadrants you can visualize that

I think I see what you’re saying, but I’m referring to the second argument of the random() function in lines 5-8. I think they’re unnecessarily complex because each random(a,s_eed) is going to be different. You could just use P_2.y and still have different lists for each quadrant, though you still need the offset of the unhighlighted calculation below.

no that wont work, P_2.x only changes when at least one of the quadrants change, but when that happens, at least one wont move. It does not work, so i had to calculate a unique seed for each time the quadrant would be in its snapped position cell thing

I see what you’re saying. I don’t see a way of improving that aspect.

In other areas,you can filter out all the undefined values you’ve got in your definition of o_2 by using an index filter combined with the other restrictions, but you can also combine the latter two restrictions into one. (The Test variables are comparing to your list L).

Did you try my sorting suggestions as well? After the above, you can also sort by the y coordinates, eliminating the need for a lot of your intermediate lists: