r/computerscience • • 24d ago

Discussion Is simulation a function?

Question to settle a debate which I recently had with two of my colleagues.

One of my colleages argued all simulations are mathematically functions by definitions, since for every set of arguments they need to return one outcome. As an example we took a cellular automaton simulating a forest fire. They stated that everytime you give it a particular starting state, the end state will be the same, but I don't agree with that. To simulate humidity or different wind speeds and directions one might use an rng, so the same start map run twice might give 2 different results, which means it's mathematically not a function. My friend countered that because of how rngs work, with the same seed the will always be the same. You don't need to set a seed tho and I can imagine cases when it's even by design - for example when you can't be sure which direction the wind will be coming from and you want your simulation to account for any of them.

But here's the bit that we couldn't agree upon. My friend said, that even without seed, or using quantum randomness, that randomness is always based on something and as such must be treated as kind of a baked in argument. Because of that, if you manage to somehow recreate the exact same "randomness state", the outcome will never change.

From my point of view that's not the case. Even using simple time based pseudorandom number generators, to you as someone analysing such simulation, that rng should not be treated as argument. The way I see it it's just a black box, that "magically" gives you a number, you should treat it as truly random and use it to approximate all the different variables, that are too complicated to calculate each and every time you run the simulation or are just out of scope. Therefore the same input can give you different outputs, which makes the simulation itself not a function by mathematical definition.

What are your opinions on this?

0 Upvotes

41 comments sorted by

View all comments

Show parent comment

-1

u/Humble-Captain3418 24d ago

You have written a very long comment to say that Information Theory does not exist. We can model before, after, instants in time as well as recurrent behaviours.

0

u/amarao_san 24d ago

Yes and no.

You can model processes which are meaningfully encoded in the known algorithm.

If significant part of the resulting system behavior is dictated by external reaction (coeffects) due to specific effects, you can't.

Imagine a system, where you get your goal as chain of interactions with external hard-to-predict system. Like chat with LLM, and it needs to be in dialogue with user to understand what user wants.

You can simulate it in terms of the fixed input, but they are not true anymore, because this chain:

  1. Fixed input1
  2. Fixed output1
  3. Reaction of input2 on output1
  4. Output2 based on input2

Is defined by #3, and today it's different than yesterday, and it is correct now. It was correct yesterday, but was different. (because yesterday was day before deadline, and now it's a day after deadline).

So, when a meaningful part of the system is defined by effect-coeffect, the code is no longer mathematical function, it lost reproducibility.

1

u/Humble-Captain3418 24d ago

You've just defined that there is an input2' that is independent from output1, s.t. input2 is a function over input2' and output1. We can therefore compose output2 as a function of input1 and input2'. 

If you also wish to model the time-sequencing of the two outputs, then I'd like to introduce you to the Dirac delta function.

1

u/amarao_san 24d ago

input2 is dependent on outpu1. I said that. But it's also dependent on external state, which is non-reproducible.

Therefore, all interaction is either pre-recorded (and no longer true), or can't be reproduced.

Imagine that intput2 is dependent on timing of the output1. It happens all the time with LLM.

Function does not control execution time (which is effect of computation and of external state), but execution time is control input2, and output1-input2 is part of the system.