Re: [Maxima-discuss] Not getting numerical evaluation From: Barton Willis - 2014-08-17 10:02:25 ```To get the numerical value from this sum, try something like (%i4) U, nouns,N : 10; (%o4) 4 As for your question about why, well that's not so easy to answer. The function that simplifies sums does not handle sums as simple as sum(i,i,1,10) -- evaluating sums like this is the responsibility of some other function. Doing ev(U, N = 10) doesn't call the function that handles finite sums (%i2) :lisp(trace simpsum) (SIMPSUM) (%i2) trace(sum)\$ (%i3) 'sum(i,i,0,10); 1> (SIMPSUM ((%SUM) \$I \$I 0 10) 1 T) <1 (SIMPSUM ((%SUM SIMP) \$I \$I 0 10)) (%o3) sum(i,i,0,10) (%i4) %,nouns; 1" Enter "sum[sum(i,i,0,10)] 1" Exit "sum55 (%o4) 55 ________________________________________ From: Alejandro Morales Sent: Sunday, August 17, 2014 02:17 To: maxima-discuss@... Subject: [Maxima-discuss] Not getting numerical evaluation Hi: for the following instructions: p:fix((N)/3); q:fix((i+N)/3); U:sum(sum(binomial(i,j)*binomial(j,i),j,0,q),i,0,p); it is impossible to obtain a numerical evaluation giving numerical value to N. None of the next instructions give a complete numerical evaluation. ev(U,N=10); ev(ev(U,N=10)); N:10;U,numer; Why? ------------------------------------------------------------------------------ _______________________________________________ Maxima-discuss mailing list Maxima-discuss@... https://lists.sourceforge.net/lists/listinfo/maxima-discuss ```
 [Maxima-discuss] sum with array From: Alejandro Morales - 2014-08-04 08:38:57 ```Hi: With sum(q[i],i,1,3); I get:q_3+q_2+q_1 With sum(sum(q[i],i,1,3),q[2],2,3); I get: sum: index must be a symbol; found q_2 but I was expecting to get: 2q_3+5+2q_1. I dont find a way to run variable q[2] inside the nested sum. Is there a way? Thanks: A. Morales. ```
 Re: [Maxima-discuss] sum with array From: Robert Dodier - 2014-08-09 16:30:52 ```On 2014-08-04, Alejandro Morales wrote: > With sum(q[i],i,1,3); > I get:q_3+q_2+q_1 > With sum(sum(q[i],i,1,3),q[2],2,3); > I get: > sum: index must be a symbol; found q_2 > but I was expecting to get: 2q_3+5+2q_1. > I dont find a way to run variable q[2] inside the nested sum. > Is there a way? Well, a simple-minded solution is to replace the index with a gensym. Here's a function to do that. (%i2) mysum (foo, bar, baz, quux) := (gensym (), sum (subst (bar = %%, foo), %%, baz, quux)) \$ (%i3) mysum (sum (q[i], i, 1, 3), q[2], 2, 3); (%o3) 2*q[3]+2*q[1]+5 Hope this helps, Robert Dodier ```
 [Maxima-discuss] Not getting numerical evaluation From: Alejandro Morales - 2014-08-17 07:16:33 ```Hi: for the following instructions: p:fix((N)/3); q:fix((i+N)/3); U:sum(sum(binomial(i,j)*binomial(j,i),j,0,q),i,0,p); it is impossible to obtain a numerical evaluation giving numerical value to N. None of the next instructions give a complete numerical evaluation. ev(U,N=10); ev(ev(U,N=10)); N:10;U,numer; Why? ```
 Re: [Maxima-discuss] Not getting numerical evaluation From: Barton Willis - 2014-08-17 10:02:25 ```To get the numerical value from this sum, try something like (%i4) U, nouns,N : 10; (%o4) 4 As for your question about why, well that's not so easy to answer. The function that simplifies sums does not handle sums as simple as sum(i,i,1,10) -- evaluating sums like this is the responsibility of some other function. Doing ev(U, N = 10) doesn't call the function that handles finite sums (%i2) :lisp(trace simpsum) (SIMPSUM) (%i2) trace(sum)\$ (%i3) 'sum(i,i,0,10); 1> (SIMPSUM ((%SUM) \$I \$I 0 10) 1 T) <1 (SIMPSUM ((%SUM SIMP) \$I \$I 0 10)) (%o3) sum(i,i,0,10) (%i4) %,nouns; 1" Enter "sum[sum(i,i,0,10)] 1" Exit "sum55 (%o4) 55 ________________________________________ From: Alejandro Morales Sent: Sunday, August 17, 2014 02:17 To: maxima-discuss@... Subject: [Maxima-discuss] Not getting numerical evaluation Hi: for the following instructions: p:fix((N)/3); q:fix((i+N)/3); U:sum(sum(binomial(i,j)*binomial(j,i),j,0,q),i,0,p); it is impossible to obtain a numerical evaluation giving numerical value to N. None of the next instructions give a complete numerical evaluation. ev(U,N=10); ev(ev(U,N=10)); N:10;U,numer; Why? ------------------------------------------------------------------------------ _______________________________________________ Maxima-discuss mailing list Maxima-discuss@... https://lists.sourceforge.net/lists/listinfo/maxima-discuss ```
 Re: [Maxima-discuss] Not getting numerical evaluation From: Alejandro Morales - 2014-08-17 21:55:00 ```Dear Barton: Thank you very much, your information gave just the solution. On Sun, 17 Aug 2014, Barton Willis wrote: > To get the numerical value from this sum, try something like > > (%i4) U, nouns,N : 10; > (%o4) 4 > > As for your question about why, well that's not so easy to answer. The function that simplifies > sums does not handle sums as simple as sum(i,i,1,10) -- evaluating sums like this is the responsibility > of some other function. Doing ev(U, N = 10) doesn't call the function that handles finite sums > > (%i2) :lisp(trace simpsum) > (SIMPSUM) > (%i2) trace(sum)\$ > (%i3) 'sum(i,i,0,10); > 1> (SIMPSUM ((%SUM) \$I \$I 0 10) 1 T) > <1 (SIMPSUM ((%SUM SIMP) \$I \$I 0 10)) > (%o3) sum(i,i,0,10) > (%i4) %,nouns; > 1" Enter "sum[sum(i,i,0,10)] > 1" Exit "sum55 > (%o4) 55 > > > > > > > ________________________________________ > From: Alejandro Morales > Sent: Sunday, August 17, 2014 02:17 > To: maxima-discuss@... > Subject: [Maxima-discuss] Not getting numerical evaluation > > Hi: > for the following instructions: > p:fix((N)/3); > q:fix((i+N)/3); > U:sum(sum(binomial(i,j)*binomial(j,i),j,0,q),i,0,p); > it is impossible to obtain a numerical evaluation giving numerical value > to N. > None of the next instructions give a complete numerical evaluation. > ev(U,N=10); > ev(ev(U,N=10)); > N:10;U,numer; > Why? > > > ------------------------------------------------------------------------------ > _______________________________________________ > Maxima-discuss mailing list > Maxima-discuss@... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss ```