140 Reputation

17 years, 142 days

Thanks to all of you......

Thanks to all of you....You were of great help to me!!!

THank you all...

Thounds of thanks to all of you for your support!!!

cost...

Hello Mr Riel, Thank you so much for your help. This looks great. I am still working through my books and the web though to understand your code completely. Since your code turned out to be more complicated than I thought, I hope you could help me a last time to incorporate a cost variable in the above: For each i in the vector lambda exists a fixed cost. Thus I have a cost vector like c:=vector([200,100,700,1000]). And actually when looking at the changes of DFR, when increase one i after another by 1, I wish to divide these changes by the related cost c[i]. Thus I wish to increase the right s[i] by 1 for the i with the most EFFICIENT change, i.e. taking into account the cost as well. But now looking at your code, I don't know where to incorporate the cost variable. I would be more than grateful, if you could help me a last time to tackle this last problem. Big Thanks in advance. Fred

Simpler......

I made the code simpler to explain what I wish to do: ```> >restart; with(stats); Digits := 14; FIXED INPUT > N := 4 > L := 0.002 > beta:=0.85: > lambda:=Array([0.2,0.6,0.3,0.7]): STARTING ARRAY s > s:=Array([0,0,0,0]): OBJECTIVE FUNCTION > DFR:= add(lambda[i]*add((L*lambda[i])^k*evalf(exp(-L*lambda[i]))/factorial(k), k = 0 .. s[i]-1), i = 1 .. N)/add(lambda[i], i = 1 .. N); ``` I have the initial array s consisting of zeros and calculated DFR. Now I wish to look at the effects of increasing one element after another of the array s by 1. That is, what happens to DFR in the first loop for s[1]=(1,0,0,0), s[2]=(0,1,0,0), s[3]=(0,0,1,0) and s[4]=(0,0,0,1). Then I wish to calculate the changes, i.e. DFR(old)-DFR(s[i]). Then increase the element in the Array s by 1, which showed the largest increase in DFR. And I wish to repeat this procedure until the DFR is bigger than beta=0.85. I am sorry for this long explanation, but desperately hope, that someone knows how to do this in Maple. Thx in advance...

Target....Reasoning of do loop...

Thank you so much Mr Riel. There is the vector s, which is used in calculating DFR and DFRnew[i]. The loop always increases only one of the s[i] one after another to see what happens to DFRnew, when only one of the values in the vector s is increased. THis is supposed to be. Then I want to calculate the difference between DFRnew[i] and the old DFR(which should change from iteration to iteration since the vecotr s is supposed to be updated)and increase the value i in the vector s for the i with the largest difference relative to cost(see MI). I changed the sum to an add, but that did not make any difference.

Different Example to explain my problem....

I had N defined in the previous problem. So that wasn't the problem. But If you compare the following two codes in Maple you will see what I mean: VERSION 1: > restart: > p[1] := 1; > p[2] := 4; > EBO:='EBO': EBO:=array(0..10,1..2): > for n from 1 to 2 do > for s from 0 to 10 do > EBO[s, n] := sum((x-s)*p[n]^x*evalf(exp(-p[n]))/factorial(x), x = s+1 .. infinity) > od od: > print(EBO); VERSION 2: > restart: > p[1] := 1; > p[2] := 4; > EBO:='EBO': EBO:=array(1..10,1..2): > for n from 1 to 2 do > for s from 1 to 10 do > EBO[s, n] := sum((x-s)*p[n]^x*evalf(exp(-p[n]))/factorial(x), x = s+1 .. infinity); > od od: > print(EBO); The visual output of the table is messed up in the first version. So I would like the table in the visual output of the second version, but for s ranging from 0..10. THX in advance, Fred
 Page 1 of 1
﻿