Using MatAnalysis in computer games (part 3)
Keywords: DPS (DamagePerSecond); Wolfram Mathematica; discreteness and continuity; matanalysis; earning game currency in computer games; ArcheAge packs.
Everyone is familiar with the same type of questions in school math problems about a motorcyclist who has gone from point A to point B, which cause boredom, disgust, or simply indifference. The questions that raise are anything but interest in learning mathematics. Obviously, questions such as:
1) “how could he defeat me in the game, if my character and health have more and DPS (Damage Per Second) is higher ?!”
2) “how to earn gold the fastest (game currency) to make your character stronger ?! ”
In fact, these gaming questions are very similar to the classic school tasks. The only difference is that there is an interest in getting an answer to the game questions, there is a goal for which one wants to solve these problems. Unfortunately, very many teachers in schools and universities are completely unable to interest students in obtaining specific information, a new method for solving mathematical problems, and bringing them to an answer. But since games cause this same interest, it is a sin not to take interest in the game to arouse interest in mathematical analysis.
Here are two tasks that are only reformulated by the above questions.
one)Petya and Kolya decided to help grandfather fill two identical empty barrels with water from the well. Petya dragged water in a 5 liter bucket and spent 3 minutes on one run to the well and back to the barrel, and Kolya spent 5 minutes on 8 liter and one run. Each filled his barrel. Which of the boys will fill his barrel faster if a) the volume of the barrel is 60 liters? b) if the barrel volume is 56 liters? (the boys started at the same time)
2)Two merchants Semyon and Dobrynya buy from the peasants 10 pounds of honey for 5 gold and take it for sale to neighboring cities. Dobrynya is taken to the nearest city and sold there for 8 gold, all the way to the city and back it takes 2 days. Semyon, who wants to sell his honey as expensive as possible, is not lazy and takes him even further, spending 3 days all the way, and selling honey in another city for 10 gold. Which of the merchants will earn more in 360 days of continuous work? How will the situation change if both merchants force peasants to lower the price of honey to 3 gold?
A discussion of these tasks, described below, will help answer the burning questions of the ArcheAge game (and others) about packs and DPS. It will also allow thinking about such concepts as “discreteness” and “continuity”, as well as over such a seemingly obvious issue as “profit”.
In order to make it easier to deal with the barrel problem, it is very convenient to draw everything that happens on the chart. We denote Petya by red and Kolya by green. We get two ladders. The barrel of Kolya and the barrel of Petit are filled discretely, the length of the steps is equal to the trip to the well and back to the barrel, and the height is equal to the amount of water brought in in liters. For the most part of the graph, the red ladder is higher than the green, but in some areas the green ladder is higher.

To fill a barrel with a volume of 60 liters, using a 5 liter bucket, you need to run away 12 times with this bucket to the well. As a result, Petya will spend 3 minutes * 12 times = 36 minutes. Kolya, with his 8 liter bucket, needs 60/8 = 7.5 times. We get a non-integer number. For 7 trips Kolya will bring only 7 * 8 = 56 liters, which is less than necessary. And if Kolya goes again to get water, then he will bring 64 liters, which is even more than necessary. As a result, Kolya will need 8 times * 5 minutes = 40 minutes, that is, Petya will fill his barrel earlier.
The situation changes if it was necessary to bring 56 liters. To do this, Kolya needs to run 56/8 = 7 times, and it will take 35 minutes. Petya will need 56/5 = 11.2 times, but since it is an integer that is important, in fact Petya will need to go 12 times and it will take 12 * 3 = 36 minutes. In this case, Petya will fill his barrel later with Kolya.
It turns out here is such a strange situation that the answer to the question of who will fill the barrel faster depends not only on the boys, but also on the size of the barrel. Moreover, if you look at the graph, then there are a lot of places where the graphs intersect. Moreover, you can even make a Petya barrel of 55.9 liters, that is, less than Kolya’s, and he will fill it later anyway. This fact becomes even more surprising if we calculate the average filling speed of the barrels Petei and Kolya. For Petya, the average speed is 5/3 = 1.666 liters / minute, and for Kolya 8/5 = 1.600 liters / minute. Kolya may even start half a minute later, and still Petya will be second.
That is, Petya has a faster filling speed and a barrel is slower, and he started earlier, but he will fill his barrel anyway later than Kolya will fill his own.
Such a paradoxical result is obtained precisely because the process of filling the barrel is discrete.
If we consider the case when two opponents in the game strike each other with different strengths and different speeds, then this situation will be similar to barrels and buckets, which we have already considered. And as shown above, it is not always worth relying on the so-called DPS, that is, the average rate of damage, in assessing the strength of you and your opponent.
Is DPS not applicable at all? Not really. In some cases, it describes the situation quite adequately.
For each ladder, you can build two parallel lines that will pass through the upper corner points and through the lower.

That ladder with a higher DPS will always be higher than the second after a certain moment. And this moment can be found as the intersection of the lower straight staircase of the larger DPS, from the upper straight staircase of the smaller DPS. Here are the formulas for these two lines.
fDPSL1 (t) = (DPH1 / Period1) * (t-Period1);
fDPSH2 (t) = (DPH2 / Period2) * t;
DPH1 and DPH2 are the impact force (bucket volume) for the period Period1 and Period2, respectively. DPH1 / Period1 = DPS1. And the intersection of these lines occurs at the moment
T = Period1 / (1-DPS2 / DPS1)
From this formula it can be seen that the influence of the discreteness of the situation, and the possibility of the occurrence of paradoxes associated with the discreteness, depends on two factors. The first factor is the approximate equality of the DPS of both opponents. In this case, the denominator vanishes, and the time to stop the influence of the discreteness of the situation tends to infinity. The second factor is the stroke period of the one with the highest DPS. The higher the shock frequency, the shorter the period, and hence the time to stop the effect of discreteness will be less.
You can also see from the formula for the top line
fDPSH2 (t) = (DPH2 / Period2) * t
that this is just a formula for the graph of damage over time with a fixed DPS.
fDPSH2 (t) = DPS2 * t

If the opponents have the same DPS, then the one who has LESS and the strength and period of the blows will be in a better position. In the extreme case, if the period of strokes tends to zero, then the ladder will turn into a “continuous” line of the form fDPSH (t) = DPS * t. And this line is the most profitable option for fixed PDS.
Thus, if there is a choice to increase the impact force by N% or increase the impact frequency by the same N%, it is more profitable to increase the frequency, although in both of these cases the DPS will increase equally. However, as practice shows, many, due to some intuitive errors, prefer to increase the force of impact.
The problem of merchants is solved in a similar way. Semyon spends 5 gold per trip, gets 10, totaling 5 gold in 3 days. Dobrynya gets 3 gold in 2 days. In 360 days, Semyon will make 120 trips and earn 600gold. Dobrynya will earn 360/2 * 3 = 540 gold. As a result, Semyon correctly does what he carries on, he will earn more than Dobrynia. If Semyon and Dobrynya agree, and find a way to force the peasants to sell them honey for 3 gold. Then Simon will receive 7 gold in one trip, and Dobrynya 5. In 360 days, Semyon will receive 360/3 * 7 = 840, and Dobrynya 360/2 * 5 = 900. That is, Dobrynya will earn more than Semyon in 360 days, despite the fact that it will sell its goods cheaper.
In economics, there is such a thing as profitability - the ratio of profit from sales to the cost of sales.
So, if we consider the ratio of profit to cost, then Semyon’s profitability may seem higher. Having spent 5 gold for one trip, he receives 5gold profits. Dobrynya, for 5 gold, receives only 3 gold profits. But with this approach, as you can see, time is not taken into account at all, and it should be included in the cost price as a salary for Semyon and Dobryny for transportation. That is, in addition to the money that they invest, you must take into account the time that they spend. And when it comes to making a profit, about the way of earning, you must take into account not only the profit itself, obtained as a result of some actions, but also the time spent on them.
To make it clearer, how is it that selling at a lower price can be profitable, we’ll draw a graph again. The graph shows the dependence of profit per unit time on the cost of goods for 3 different cases. In each case, the goods and their cost will be considered the same, but the sale price and time for transportation will be different. Charts are plotted using the simple formula
F [Cost] = (Selling Price - Cost) / Transportation Time
Examples of time and selling prices are taken from the ArcheAge game. Time is measured in minutes, and prices are in gold.
In the first case, Selling Price = 8g, Time = 6min, in the second Selling Price = 11g, Time = 10min, and in the third case, Selling Price = 13g, Time = 16min
You can find a table of selling prices of all possible goods in the ArcheAge game, for examplehere
But, nevertheless, these tables do not indicate the distance to points of sale, which of course is a big drawback.
The real costs of raw materials, which are necessary for the manufacture of goods, in the game vary quite a lot, due to fluctuations in the gaming market. Prices, generally speaking, are set by players, including the so-called “work points”, which are necessary for the production of goods, and which can also be bought on the “market”. The cost in this example is approximately 7g, but can be significantly more expensive.

Understanding some task, process, very often helps consideration of extreme cases. If the cost of goods is zero, then all profit per unit of time is determined by the time that will be spent on transportation. In the general case, all 3 lines may not intersect, but in this particular case, at low cost, it is more profitable to transport them to the nearest place of sale. If the prime cost is high, then it can be higher than the selling price at the nearest points, which means that you will work with negative profitability, that is, spend more than you get. And then the only way to earn at least some will be selling in the most remote place, where the selling price is higher than the cost. But with too high a cost, even there it becomes unprofitable to sell. There is also an intermediate option,
It is worth noting that the effects associated with the "discreteness" of profit, here also naturally present. The principle of analysis of these effects is similar to what was considered above.
When you try to tell such a thing to the players, very often you get the answer “Lol ?! I know what to do! What are you teaching me ?! ” People stubbornly strive to sell their goods as expensive as possible, and do not pay attention to how much time they spend on it. Time can be expressed in currency and use this "price of time" in the cost price, and then everything becomes much more clear. But very often there are those who, for the sake of 1 gold, are ready to take them even further, spending time with much less efficiency. As a result, greedy, they lose more.
And the most interesting thing is that even those who know about these subtleties very often succumb to the inner momentary temptation, blind erroneous intuition, and the insidious and dangerous feeling of greed, and still a rod to where it is objectively not profitable to sell, but where they will see, that the selling price of their goods is higher. Psychophysiology - even matan sometimes does not work against it. But this feature of human perception is loved to use for their own purposes all and sundry, parasitizing on greedy people.
Wolfram Mathematica is an extremely powerful tool for solving a variety of problems of any complexity. However, do not think that since Mathematica can do so much, it is extremely difficult to use. In fact, I very often use it simply as a very convenient, but also a very advanced calculator. There is no need to write code for the algorithms. To draw graphs, or quickly make an interactive window, with input fields, sliders, and drawing functions in real time, a few simple commands are enough, which are described in great detail in a heap of examples in the built-in help.
Here is an example code for drawing profit / cost graphs.
And a code example for such a convenient window for rendering discrete processes. You can change the parameters and immediately compare the results on the chart.

You just need to copy the code into an empty Wolfram Mathematica window and press Shift + Enter. You will get the result in the same window.
The Internet is not omniscient. Guides, recipes, manuals for all occasions can not be found in it. In each case, anyway, refinement, modernization of well-known methods will achieve better results. But this requires analyzing the situation and synthesizing new methods based on known data. But such skills will not arise by themselves, they need to learn, train. And sometimes it can be boring and lazy. There are two ways out: either try the learning process at school or university, which often seems pointless and boring, make it conscious, meaningful and interesting, or, while doing something interesting and exciting, find interesting points in this, analyze them and try to solve the game tasks as complete tasks in mathematics.
If the teacher you got boring and uninitiated, then this is not a reason not to engage in Matanaliz. In the end, justifying yourself as a bad teacher, you’re more interesting in your life, but you won’t make yourself successful.
Introduction
Everyone is familiar with the same type of questions in school math problems about a motorcyclist who has gone from point A to point B, which cause boredom, disgust, or simply indifference. The questions that raise are anything but interest in learning mathematics. Obviously, questions such as:
1) “how could he defeat me in the game, if my character and health have more and DPS (Damage Per Second) is higher ?!”
2) “how to earn gold the fastest (game currency) to make your character stronger ?! ”
In fact, these gaming questions are very similar to the classic school tasks. The only difference is that there is an interest in getting an answer to the game questions, there is a goal for which one wants to solve these problems. Unfortunately, very many teachers in schools and universities are completely unable to interest students in obtaining specific information, a new method for solving mathematical problems, and bringing them to an answer. But since games cause this same interest, it is a sin not to take interest in the game to arouse interest in mathematical analysis.
Here are two tasks that are only reformulated by the above questions.
one)Petya and Kolya decided to help grandfather fill two identical empty barrels with water from the well. Petya dragged water in a 5 liter bucket and spent 3 minutes on one run to the well and back to the barrel, and Kolya spent 5 minutes on 8 liter and one run. Each filled his barrel. Which of the boys will fill his barrel faster if a) the volume of the barrel is 60 liters? b) if the barrel volume is 56 liters? (the boys started at the same time)
2)Two merchants Semyon and Dobrynya buy from the peasants 10 pounds of honey for 5 gold and take it for sale to neighboring cities. Dobrynya is taken to the nearest city and sold there for 8 gold, all the way to the city and back it takes 2 days. Semyon, who wants to sell his honey as expensive as possible, is not lazy and takes him even further, spending 3 days all the way, and selling honey in another city for 10 gold. Which of the merchants will earn more in 360 days of continuous work? How will the situation change if both merchants force peasants to lower the price of honey to 3 gold?
A discussion of these tasks, described below, will help answer the burning questions of the ArcheAge game (and others) about packs and DPS. It will also allow thinking about such concepts as “discreteness” and “continuity”, as well as over such a seemingly obvious issue as “profit”.
DPS paradox
In order to make it easier to deal with the barrel problem, it is very convenient to draw everything that happens on the chart. We denote Petya by red and Kolya by green. We get two ladders. The barrel of Kolya and the barrel of Petit are filled discretely, the length of the steps is equal to the trip to the well and back to the barrel, and the height is equal to the amount of water brought in in liters. For the most part of the graph, the red ladder is higher than the green, but in some areas the green ladder is higher.

To fill a barrel with a volume of 60 liters, using a 5 liter bucket, you need to run away 12 times with this bucket to the well. As a result, Petya will spend 3 minutes * 12 times = 36 minutes. Kolya, with his 8 liter bucket, needs 60/8 = 7.5 times. We get a non-integer number. For 7 trips Kolya will bring only 7 * 8 = 56 liters, which is less than necessary. And if Kolya goes again to get water, then he will bring 64 liters, which is even more than necessary. As a result, Kolya will need 8 times * 5 minutes = 40 minutes, that is, Petya will fill his barrel earlier.
The situation changes if it was necessary to bring 56 liters. To do this, Kolya needs to run 56/8 = 7 times, and it will take 35 minutes. Petya will need 56/5 = 11.2 times, but since it is an integer that is important, in fact Petya will need to go 12 times and it will take 12 * 3 = 36 minutes. In this case, Petya will fill his barrel later with Kolya.
It turns out here is such a strange situation that the answer to the question of who will fill the barrel faster depends not only on the boys, but also on the size of the barrel. Moreover, if you look at the graph, then there are a lot of places where the graphs intersect. Moreover, you can even make a Petya barrel of 55.9 liters, that is, less than Kolya’s, and he will fill it later anyway. This fact becomes even more surprising if we calculate the average filling speed of the barrels Petei and Kolya. For Petya, the average speed is 5/3 = 1.666 liters / minute, and for Kolya 8/5 = 1.600 liters / minute. Kolya may even start half a minute later, and still Petya will be second.
That is, Petya has a faster filling speed and a barrel is slower, and he started earlier, but he will fill his barrel anyway later than Kolya will fill his own.
Such a paradoxical result is obtained precisely because the process of filling the barrel is discrete.
If we consider the case when two opponents in the game strike each other with different strengths and different speeds, then this situation will be similar to barrels and buckets, which we have already considered. And as shown above, it is not always worth relying on the so-called DPS, that is, the average rate of damage, in assessing the strength of you and your opponent.
Is DPS not applicable at all? Not really. In some cases, it describes the situation quite adequately.
For each ladder, you can build two parallel lines that will pass through the upper corner points and through the lower.

That ladder with a higher DPS will always be higher than the second after a certain moment. And this moment can be found as the intersection of the lower straight staircase of the larger DPS, from the upper straight staircase of the smaller DPS. Here are the formulas for these two lines.
fDPSL1 (t) = (DPH1 / Period1) * (t-Period1);
fDPSH2 (t) = (DPH2 / Period2) * t;
DPH1 and DPH2 are the impact force (bucket volume) for the period Period1 and Period2, respectively. DPH1 / Period1 = DPS1. And the intersection of these lines occurs at the moment
T = Period1 / (1-DPS2 / DPS1)
From this formula it can be seen that the influence of the discreteness of the situation, and the possibility of the occurrence of paradoxes associated with the discreteness, depends on two factors. The first factor is the approximate equality of the DPS of both opponents. In this case, the denominator vanishes, and the time to stop the influence of the discreteness of the situation tends to infinity. The second factor is the stroke period of the one with the highest DPS. The higher the shock frequency, the shorter the period, and hence the time to stop the effect of discreteness will be less.
You can also see from the formula for the top line
fDPSH2 (t) = (DPH2 / Period2) * t
that this is just a formula for the graph of damage over time with a fixed DPS.
fDPSH2 (t) = DPS2 * t

If the opponents have the same DPS, then the one who has LESS and the strength and period of the blows will be in a better position. In the extreme case, if the period of strokes tends to zero, then the ladder will turn into a “continuous” line of the form fDPSH (t) = DPS * t. And this line is the most profitable option for fixed PDS.
Thus, if there is a choice to increase the impact force by N% or increase the impact frequency by the same N%, it is more profitable to increase the frequency, although in both of these cases the DPS will increase equally. However, as practice shows, many, due to some intuitive errors, prefer to increase the force of impact.
Greed trap
The problem of merchants is solved in a similar way. Semyon spends 5 gold per trip, gets 10, totaling 5 gold in 3 days. Dobrynya gets 3 gold in 2 days. In 360 days, Semyon will make 120 trips and earn 600gold. Dobrynya will earn 360/2 * 3 = 540 gold. As a result, Semyon correctly does what he carries on, he will earn more than Dobrynia. If Semyon and Dobrynya agree, and find a way to force the peasants to sell them honey for 3 gold. Then Simon will receive 7 gold in one trip, and Dobrynya 5. In 360 days, Semyon will receive 360/3 * 7 = 840, and Dobrynya 360/2 * 5 = 900. That is, Dobrynya will earn more than Semyon in 360 days, despite the fact that it will sell its goods cheaper.
In economics, there is such a thing as profitability - the ratio of profit from sales to the cost of sales.
So, if we consider the ratio of profit to cost, then Semyon’s profitability may seem higher. Having spent 5 gold for one trip, he receives 5gold profits. Dobrynya, for 5 gold, receives only 3 gold profits. But with this approach, as you can see, time is not taken into account at all, and it should be included in the cost price as a salary for Semyon and Dobryny for transportation. That is, in addition to the money that they invest, you must take into account the time that they spend. And when it comes to making a profit, about the way of earning, you must take into account not only the profit itself, obtained as a result of some actions, but also the time spent on them.
To make it clearer, how is it that selling at a lower price can be profitable, we’ll draw a graph again. The graph shows the dependence of profit per unit time on the cost of goods for 3 different cases. In each case, the goods and their cost will be considered the same, but the sale price and time for transportation will be different. Charts are plotted using the simple formula
F [Cost] = (Selling Price - Cost) / Transportation Time
Examples of time and selling prices are taken from the ArcheAge game. Time is measured in minutes, and prices are in gold.
In the first case, Selling Price = 8g, Time = 6min, in the second Selling Price = 11g, Time = 10min, and in the third case, Selling Price = 13g, Time = 16min
You can find a table of selling prices of all possible goods in the ArcheAge game, for examplehere
But, nevertheless, these tables do not indicate the distance to points of sale, which of course is a big drawback.
The real costs of raw materials, which are necessary for the manufacture of goods, in the game vary quite a lot, due to fluctuations in the gaming market. Prices, generally speaking, are set by players, including the so-called “work points”, which are necessary for the production of goods, and which can also be bought on the “market”. The cost in this example is approximately 7g, but can be significantly more expensive.

Understanding some task, process, very often helps consideration of extreme cases. If the cost of goods is zero, then all profit per unit of time is determined by the time that will be spent on transportation. In the general case, all 3 lines may not intersect, but in this particular case, at low cost, it is more profitable to transport them to the nearest place of sale. If the prime cost is high, then it can be higher than the selling price at the nearest points, which means that you will work with negative profitability, that is, spend more than you get. And then the only way to earn at least some will be selling in the most remote place, where the selling price is higher than the cost. But with too high a cost, even there it becomes unprofitable to sell. There is also an intermediate option,
It is worth noting that the effects associated with the "discreteness" of profit, here also naturally present. The principle of analysis of these effects is similar to what was considered above.
When you try to tell such a thing to the players, very often you get the answer “Lol ?! I know what to do! What are you teaching me ?! ” People stubbornly strive to sell their goods as expensive as possible, and do not pay attention to how much time they spend on it. Time can be expressed in currency and use this "price of time" in the cost price, and then everything becomes much more clear. But very often there are those who, for the sake of 1 gold, are ready to take them even further, spending time with much less efficiency. As a result, greedy, they lose more.
And the most interesting thing is that even those who know about these subtleties very often succumb to the inner momentary temptation, blind erroneous intuition, and the insidious and dangerous feeling of greed, and still a rod to where it is objectively not profitable to sell, but where they will see, that the selling price of their goods is higher. Psychophysiology - even matan sometimes does not work against it. But this feature of human perception is loved to use for their own purposes all and sundry, parasitizing on greedy people.
Wolfram mathematica
Wolfram Mathematica is an extremely powerful tool for solving a variety of problems of any complexity. However, do not think that since Mathematica can do so much, it is extremely difficult to use. In fact, I very often use it simply as a very convenient, but also a very advanced calculator. There is no need to write code for the algorithms. To draw graphs, or quickly make an interactive window, with input fields, sliders, and drawing functions in real time, a few simple commands are enough, which are described in great detail in a heap of examples in the built-in help.
Here is an example code for drawing profit / cost graphs.
Mathematica Code
a = {{6, 8}, {10, 11}, {16, 13}};
f[i_, x_] := (a[[i]][[2]] - x)/a[[i]][[1]];
Plot[{f[1, x], f[2, x], f[3, x]}, {x, 0, 13},
PlotStyle -> {Red, Orange, Green}, PlotRange -> All]
And a code example for such a convenient window for rendering discrete processes. You can change the parameters and immediately compare the results on the chart.

Mathematica Code
TotalD[DPH_, CD_, tDelay_, tDuration_] :=
Table[{n, DPH*(Quotient[n - tDelay, CD])}, {n, 0, tDuration,
tDuration/1000}];
(*Дискретный график наносимых повереждений участником боя через \
единицу времени*)(*Quotient даёт нам целое число количества ударов \
нанесеннного за некратное перезарядке время*)
DiffD[DPH1_, CD1_, tDelay1_, DPH2_, CD2_, tDelay2_, tDuration_] :=
Table[{n,
DPH2*(Quotient[n - tDelay2, CD2]) -
DPH1*(Quotient[n - tDelay1, CD1])}, {n, 0, tDuration,
tDuration/
1000}];(*Разница количества повреждений нанесенных двумя \
участинками*)
fDPSH[t_, DPH_, CD_,
tDelay_] := (DPH/CD)*(t -
tDelay);(*fDPSH и fDPSH это прямые которые "ограничевают" граффик \
наносимых повреждений. Можно сказать что это оценки сверху и снизу*)
fDPSL[t_, DPH_, CD_, tDelay_] := (DPH/CD)*(t - CD - tDelay);
Manipulate[
Column[{
Row[{
Row[{"DPS1=", Dynamic[N[DPH1/CD1]]}, Frame -> True,
FrameStyle -> {Red, Red}],
Row[{Dynamic[
If[DPH1/CD1 == DPH2/CD2, " EQUAL ",
If[DPH1/CD1 > DPH2/CD2, " MORE THAN ", "LESS THAN "]]]}],
Row[{"DPS2=", Dynamic[N[DPH2/CD2]]}, Frame -> True,
FrameStyle -> {Green, Green}]
}],
Show[{
Plot[
{fDPSL[t, DPH1, CD1, Delay1],
fDPSH[t, DPH1, CD1, Delay1],
fDPSL[t, DPH2, CD2, Delay2],
fDPSH[t, DPH2, CD2, Delay2]},
{t, 0, Duration},
PlotStyle -> {Darker[Orange], Darker[Orange], Darker[Blue],
Darker[Blue], PlotRange -> All}
],
ListLinePlot[
{TotalD[DPH1, CD1, Delay1, Duration],
TotalD[DPH2, CD2, Delay2, Duration],
DiffD[DPH1, CD1, Delay1, DPH2, CD2, Delay2, Duration]},
PlotStyle -> {Red, Green, Gray}, PlotRange -> All]
}, PlotRange -> All]
}],
{{DPH1, 10, "Value1"}, 0, 100, Appearance -> "Open"},
{{CD1, 0.8, "Period1"}, 0, 20, Appearance -> "Open"},
{{Delay1, 0}, -2, 2, Appearance -> "Open"},
{{DPH2, 8, "Value2"}, 0, 100, Appearance -> "Open"},
{{CD2, 0.7, "Period1"}, 0, 20, Appearance -> "Open"},
{{Delay2, 0}, -2, 2, Appearance -> "Open"},
{{Duration, 10}, 2, 1000, Appearance -> "Open"},
ControlPlacement -> {Right, Right, Right, Right, Right, Right, Right,
Right}
]
You just need to copy the code into an empty Wolfram Mathematica window and press Shift + Enter. You will get the result in the same window.
findings
The Internet is not omniscient. Guides, recipes, manuals for all occasions can not be found in it. In each case, anyway, refinement, modernization of well-known methods will achieve better results. But this requires analyzing the situation and synthesizing new methods based on known data. But such skills will not arise by themselves, they need to learn, train. And sometimes it can be boring and lazy. There are two ways out: either try the learning process at school or university, which often seems pointless and boring, make it conscious, meaningful and interesting, or, while doing something interesting and exciting, find interesting points in this, analyze them and try to solve the game tasks as complete tasks in mathematics.
If the teacher you got boring and uninitiated, then this is not a reason not to engage in Matanaliz. In the end, justifying yourself as a bad teacher, you’re more interesting in your life, but you won’t make yourself successful.