Message Boards Message Boards


Find the sum with equations inside

Posted 5 months ago
1 Reply
1 Total Likes

Hello, now I try to understand what I want.

m = 1;
a = 1/20;
k = 0;
n = 100;
t = {0.7, 0.6, 0, 5};
c = Count[t, {u_, _} /; 1 >= u >= 0];
Y = 1000000;

a = NSolve[
  Sum[PDF[BinomialDistribution[n, p], i], {i, k, m}] == a && 
   1 >= p >= 0, p]
b = NSolve[
  Sum[PDF[BinomialDistribution[n, p], i], {i, k, m - 1}] == a && 
   1 >= p >= 0, p]
x[m_] = a - b
d = Y*a (m == 0) + 
  Sum[0.7*(a[3] - b[2]) + 0.6 (a[2] - b[1]) + 0.5 (a[1] - b[0]), {i, 
    k, c}]

And I have some questions first 1. According to the first equation,why Nsolve cant find a soulution when a=0.05? When it is 1/20 it works Ok. 2. Why the second Nsolve equation gives empty output in spite of changing the p unkown to another unknown, for example, z?

m and t have direct conection, when m=0 there is no z at al, When m=3 t has three values specified by user. The problem with d that it has another Sum inside and it should use the solutions from a and b depending on m, The sum should be counted by m or t list. In other words, I want d to take values from t list and appropriate solutions from a and b or only a. It should be like this

d = Y*a[0] + 
  Sum[t1*(a[3] - a[2]) + t2 (a[2] - a[1]) + t3 (a[1] - a[0]), {i, k, 

But I think it should take solutions into the sum from two ndsolve equations to make it easier.

When you start the calculation, a is a number. After yur first NSolve, a becomes a list of lists of replacement rules.It is not a number any more. You have to extract the numbers inside before feeding them to another NSolve. Have a look at the syntax of NSolve and its solutions, and how you use them.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract