The laws of physics are stated in the form of mathematics. Differential equations are pretty popular, for example classical mechanics can be described with differential equations.
You can program a computer to take some initial state of the universe and apply all the laws of physics to it to get a new state of the universe. This comes with a couple of caveats. First, you need to somehow discretize the time steps you compute. Differential equations operate under continuous time, but a numerical simulations does discrete steps. It's reasonably well understood how to do that without losing too much precision. This brings us to a second problem, precision. Physics is generally formulated using real (or complex) variables, but computers only deal with finite precision. Usually this is ok, because in reality we can also only distinguish things with finite precision. Lastly, our laws of physics are not yet complete. There are a number of phenomena where we don't really know what's supposed to happen, so the simulation won't represent the real universe perfectly, even if we start with a proper starting state (which we can also only guess) and use sufficient precision and sufficiently small time steps.
Note that it is completely impractical to simulate all laws of physics as we know them on real computers. Even simulating single molecules with all relevant laws is very hard even for supercomputers.
Nevertheless, physicists simulate things all the time, sometimes using bold approximations to cut down the required computation. It's really important in physics to do simulations. Wikipedia has on overview article on Computational Physics and Richard Feynman has written a classic paper called Simulating Physics with Computers.
It is of course also possible to tweak the laws of Physics a bit and do your simulation. You can change the equations, or the constants and see what happens to your simulated system. You can for example find that changing some constants just a little produces an inhospitable universe.
Now I don't think it's possible to change fundamental mathematical truths in your simulated universe, because Physics makes no prediction about mathematics. You can't change the laws of Physics such that 1+1 != 2.