mathematics – Predict future position of a moving body in Phaser arcade physics

I am looking for an equation for predicting the future position of a moving arcade physics body in Phaser 3. The body has drag applied and isDamping set to true. Phaser applies the drag using the following run on each update (showing x axis only but same applies to y).

//  Damping based deceleration
dragX = Math.pow(dragX, delta);

velocityX *= dragX;

Given the above, how would I write a kinetic equation to predict the future position?

I am currently using the method below, where I am iterating over frames to calculate the position accumulatively. But this is inefficient and inelegant so would prefer a solution which estimates the position without any looping.

public futurePosition(timeInSeconds: number): Phaser.Math.Vector2 {
  const DELTA = 1 / 60; // Assume we are running at 60fps
  const DRAG = 0.3; // Drag value
  const position = this.position.clone(); // Current position of body
  const velocity = this.body.velocity.clone(); // Current velocity

  // Inefficiently looping through frames
  for (let i = 0; i < timeInSeconds / (DELTA * 1000); i++) {
    velocity.x *= Math.pow(DRAG, DELTA);
    velocity.y *= Math.pow(DRAG, DELTA);
    position.x += velocity.x * DELTA;
    position.y += velocity.y * DELTA;
  }

  return position;
}

Any help appreciated. Thanks.

mathematics – Predict future position of a moving body in Phaser’s arcade physics

I am looking for an equation for predicting the future position of a moving arcade physics body in Phaser 3. The body has drag applied and isDamping set to true. Phaser applies the drag using the following run on each update (showing x axis only but same applies to y).

//  Damping based deceleration
dragX = Math.pow(dragX, delta);

velocityX *= dragX;

Given the above, how would I write a kinetic equation to predict the future position?

I am currently using the method below, where I am iterating over frames to calculate the position accumulatively. But this is inefficient and inelegant so would prefer a solution which estimates the position without any looping.

public futurePosition(timeInSeconds: number): Phaser.Math.Vector2 {
  const DELTA = 1 / 60; // Assume we are running at 60fps
  const DRAG = 0.3; // Drag value
  const position = this.position.clone(); // Current position of body
  const velocity = this.body.velocity.clone(); // Current velocity

  // Inefficiently looping through frames
  for (let i = 0; i < timeInSeconds / (DELTA * 1000); i++) {
    velocity.x *= Math.pow(DRAG, DELTA);
    velocity.y *= Math.pow(DRAG, DELTA);
    position.x += velocity.x * DELTA;
    position.y += velocity.y * DELTA;
  }

  return position;
}

Any help appreciated. Thanks.

mathematics – How to project a Matcap correctly in Amplify Shader Editor

Unity’s Amplify Shader Editor comes with an example of matcap nodes setup, however, the matcap projection in this example is incorrect.
As you can see the texture becomes distorted when it’s on de edges of the screen, that shouldn’t happen with a correct matcap:

enter image description here

enter image description here

On the secoud image, this is how a matcap should look, without major distortions.

Does any expert in shaders knows the right way to project a matcap using the nodes? I’ve done my search and there is absolutelly no information about this around the internet, any response would add for this Shader documentation.
I’m extremelly in need that matcap works with this shader.

Probability Theory and Counting | Discrete Mathematics

I’ve been trying to do this question as part of a practice quiz, but can’t seem to get the right answer. Hopefully someone on here can provide some insight, in the case that I face a similar answer on a real test. Any feedback is appreciated!

We have two loaded dice, dice X and dice Y. Dice X comes up 1 with probability 0.2, 2 with probability 0.4, 3 with probability 0.1, and 4 with probability 0.3. Dice Y comes up 1 with probability 0.1, 2 with probability a, 3 with probability b, and 4 with probability 0.2. The probability b is to be determined. You are not asked to compute the probability a.

We throw both dice. Let A be the event that the number of pins on dice Y is strictly bigger than the number of pins on dice X. We want the probability that event A happens to be equal to 0.42.

Give an integer k as answer so that if we set b = k/100, then event A happens with probability 0.42.

discrete mathematics – Construct an explicit bijection from [x], the equivalence class of x, to Q.

Define a relation $ sim $ on the set of real numbers as follows: For $x, y in mathbb{R}$ : $x sim y$ if $𝑥 −𝑦∈mathbb{Q}$

I have proven that this is an equivalence class:

Reflexitivity

$x – x = 0$

$0 in mathbb{Q}$

so $xsim x$

Symmetry

$x – y = a$, where $a in mathbb{Q}$

$y – x = -a$, where $-a in mathbb{Q}$

so $x sim y, y sim x$

Transitive

$x – y = a$, $a in mathbb{Q}$,

$y – z = b$, $z in mathbb{R}$, $b in mathbb{Q}$

$x – y + y – z = a + b$

$= x – z = a + b$

$= x – z = c$, $c in mathbb{Q}$

Thus, $x sim y$ is an equivalence relation. However, I am having trouble finding the equivalence classes and most importantly, how to construct an explicit bijection from the equivalence class, $[x]$, to $mathbb{Q}$.

Understanding Laplace Transform equation – Mathematics Stack Exchange

I am currently studying mathematics in Digital Control Systems, and have now stumbled upon Laplace Transform. Could someone explain to me why this equation is written as it is?

Laplace Transform Equation

I understand this is supposed to be a “differential equation”, however, why do we have an exponential function raised to the power of “-st”, and what is that letter to the far left and why is our f(t) in square brackets as well as why it is suddenly changed to big F(s)?

discrete mathematics – The Hasse diagram below defines a partial ordering on the set {1,3,5,6}. Give the set of ordered pairs corresponding to this relation.

(Enter your answers as a comma-separated list of ordered pairs.)
My understanding is that in this diagram, every element is not connected to itself, and 3 is only connected to 5, 6, and 1.
I’m not sure why the answer isn’t (3,5),(3,6),(3,1)
Hasse diagram

discrete mathematics – Prove that any rational number is positive $frac{m}{n}$ Can be displayed in the form of a “combined fraction”

“Combined fracture” is an expression of the form

$(a_{0},a_{1},a_{2}…,a_{n})=
> a_{0}+frac{1}{a_{1}+frac{1}{a_{2}+frac{1}{a_{3}+_{frac{1}{…+}}}}}$

$a_{0},a_{1},a_{2}…,a_{n}$ are natural numbers. Example:
$frac{275}{52}=(5,3,2,7)= 5+frac{1}{3+frac{1}{2+frac{1}{7}}}$

Prove that any rational number is positive $frac{m}{n}$ Can be displayed in the form of a “combined fraction” (induction for n)

I think for proving with induction start with base (n=1), we get (1)= 1+1=2

then assuming $(a_{0},a_{1},a_{2}…,a_{n})$ is a rational number, then we need to prove that $(a_{0},a_{1},a_{2}…,a_{n},a_{n+1})$ is rational

But I don’t know how to continue from here