cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Recursion question

YuK
1-Newbie
1-Newbie

Recursion question

Hi All. I try to find recursion function for C(n,m,p1,p2) for number of sums n=sum(x(i)), p1<=x(i)<=p2, i=1..m. But simple test give me mistake.

YuK
7 REPLIES 7
AlvaroDíaz
9-Granite
(To:YuK)

Hi YuK. I think that the problem is in the if structure.

Regards. Alvaro.
TomGutman
1-Newbie
(To:YuK)


__________________
� � � � Tom Gutman
YuK
1-Newbie
1-Newbie
(To:TomGutman)

Many Thanks.

Recursion is falls for big number. I try to find C(70,10,1,12) - and I have timeproblem.

YuK
AlvaroDíaz
9-Granite
(To:YuK)

Do you need the exact value?

Regards. Alvaro.

Yes I wont to find exact value

1) Firht idea. We can use array (70,11)-size and we can find the exact value. C(70,10,1,70)=C(60,10,0,60)=combin(60+10-1,10-1)=56 672 074 888. Only array - without recursion. Here is't big number C(60,10,0,12)< 56 672 074 888.

2) Second idea. We can use Inclusion-ExclusionPrinciple

http://mathworld.wolfram.com/Inclusion-ExclusionPrinciple.html

YuK

On 4/23/2009 8:58:09 AM, adiaz wrote:
>Do you need the exact value?
>
>Regards. Alvaro.
_________________

I didn't attempt understanding what it supposed to produce as a custom project. But clearly it is a recursive problem that is of same nature as Fibonacci. Get inspired for one column from fib(m) below Marlett, which fib(m) is the "Mathcad Speedy Gonzalez" for that kind of recursion.

I didn't understand your "genfit", genfit for what on recursive ? Interpolate between values, OK , but you will have to use a more general interpolating function rather than a model function ... like a polynomial or better rational on a range of data points around the desired interpolated values. I'm saying that as the project will issue all sorts of data points, therefore predicting failure of models, unless a large amount of time would be spent and conditionally to a reasonable project.

Efficient programming is quite a challenge in Mathcad. It does not necessarily result from logical-immediate thinking. fib(m) is either from the Mathcad Treasury or the Advisor. It has been posted several times in this collab.

jmG

Here my solution of problem. Check please.



YuK
Top Tags