Help Solving Multivariable Quintic Function

105 Views Asked by At

I am developing a game, and I am working out some of the equations for one of the features of it. Essentially, I am adding a way for a character's skills to be inherited when they die, and this formula is a way to calculate what the new character's skill level will be.

I have defined the formula as follows:
$x = a + a d(b + Jc)$
Where:
$a$ is the current skill level of the character that died
$d$ is the potential loss over an inherited generation, and is defined as a random number in the range $-1 + Jc → 1$
$b$ is a base multiplier
$J$ is the number of characters that you have created - 1
$c$ is the additive gain for a player

Essentially, my goal is that I can configure a few base values and have the game calculate the value of $c$ dynamically. One important note here is that the goal of this function is to have a max value for the skills and $c$ would be a value, such that over a certain number of player deaths (say 6) the skill level would reach a maximum, assuming $d$ always rolls a 1. Here we will also assume that $b$ is a configurable value, and assume it is .1 in this case.

Therefore, I must substitute this formula 5 times over. For example:
$x_1 = 12$,
$x_2 = 12 + (12 \cdot 1)(0.1 + 1 \cdot c)$
$x_3 = (12 + (12 \cdot 1)(0.1 + 1 \cdot c)) + ((12 + (12 \cdot 1)(0.1 + 1 \cdot c))(.1 + 2c))$
repeat through to gen 6

The problem that I am having is solving for $c$ in terms of the other variables. For this it is safe to assume that $d$ is always 1, and in this case, it is also safe to assume that $J$ is 5. I have managed to simplify the formula down to the following: $$x_6 = a_1(5b^5c + 50b^4c^2 + 20b^4c + b^4 + 175b^3c^3\\ + 150b^3c^2 + 35b^3c + b^3 + 250b^2c^4 + 350b^2c^3\\ + 155b^2c^2 + 50b^2c + 9b^2 + 120bc^5 + 250bc^4\\ + 185bc^3 + 130bc^2 + 34bc + 4b + 24c^4\\ + 50c^3 + 27c^2 + 12c + 6)$$

However, I am not exactly the best at math, so this is as far as I have been able to get.

How do I solve for $c$ in terms of the other variables?

1

There are 1 best solutions below

0
On

I am not sure if I am interpreting this correctly, however you seem to have a recurrence relation $$a_n=a_{n-1}+a_{n-1}d(b+Jc),\quad a_1=12$$ which has the following solution: $$a_n=12(1+bd+Jcd)^{n-1}$$ so $a_6=12(1+bd+Jcd)^5.$

Now I am not completely sure if you want to maximize $a_6$ with respect to some contstraints on $b$, $J$, $d$ and $c$, which amounts to maximizing $1+bd+Jcd$, or you want to find $c$ for a given value of $a_6$, $b$, $d$ and $J$, which in this case is $$c=\frac1{Jd}\left(-1-bd+\sqrt[5]{\frac{a_6}{12}}\right)$$

More generally, if the value of $a_1$ is $A$, then $c=\frac1{Jd}\left(-1-bd+\sqrt[5]{\frac{a_6}{A}}\right)$.