简体   繁体   English

简化几何(或算术)级数中的递归公式

[英]Simplifying recursive formula in geometric (or arithmetic) series

I am trying to implement a recursive function, but that is too computationally intensive. 我正在尝试实现一个递归函数,但是这在计算上过于费力。 I think there are certain ways to simplify recursive functions into geometric (or arithmetic) series. 我认为有某些方法可以将递归函数简化为几何(或算术)级数。

If it can be simplified, than I can just code the simplified formulae. 如果可以简化的话,那么我就可以对简化的公式进行编码。

My hypothetical situation is this : 我的假设情况是这样的:

I have 4 candidates, and each candidates picks a number, from a given array, consecutively. 我有4个候选人,每个候选人都从给定数组中连续选择一个数字。 The array has 8 values inside, and the probability of picking any one value in the array is the same (ie 1/8). 该数组内部有8个值,选择数组中任何一个值的可能性相同(即1/8)。

Hence, at time = 0, candidate 1 randomly picks a number. 因此,在时间= 0时,候选1随机选择一个数字。 if that number = X (such as 6), then the loop stops. 如果该数字= X(例如6),则循环停止。 If candidate 1 doesn't pick X, then it goes to candidate 2, and candidate 2 randomly picks a number. 如果候选人1没有选择X,则转到候选人2,而候选人2随机选择一个数字。 If that number = X, then loop stops. 如果该数字= X,则循环停止。 If all 4 candidates don't pick X, then it goes back to candidate 1, and start all over again. 如果所有4个候选者均未选择X,则返回候选者1,然后重新开始。

Given 4 person (or N = 4 consecutive candidates), and a 8 possibilities for each time-slice, I am trying to compute two scenarios 给定4个人(或N = 4个连续的候选人),每个时间片有8种可能性,我正在尝试计算两种情况

  1. what is the probability the first person (eg candidate A) is the first one to get X (a certain value I specify). 第一个人(例如候选人A)是第一个获得X(我指定的特定值)的概率是多少? Similarly, what is the probability the 2nd person (eg B) is the first person to get X? 同样,第二个人(例如B)成为第一个人获得X的概率是多少?

  2. what is the probability person A (first person) hits X, and then person B hits X. 人A(第一人称)命中X,然后人B命中X的概率是多少?

As described in the comment 如评论中所述

Sum[(7/8)^(4i)(1/8),{i,0,Infinity}]
(*512/1695*)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM