Items tagged with sum sum Tagged Items Feed

sum(xj*(sum(yi, i = k .. n)), j = k .. n)

How do I solve this? Can anone help?

Here x and y both are variables.

I am working on a problem involving sums in Maple and I find Maple's facilities lacking.

Specifically; I want to convert the square of a sum into a sum of squares plus the cross terms (which is a subtask of a larger problem). So I start with

sum(E[n],n=1..N)^2;

and immediately get stuck as I do not find any command that does anything with it. The expansion of this is known and easy to derive:

sum(E[n],n=1..N)^2 = sum(E[n]^2,n=1..N) + 2*sum(sum(E[m]*E[n],m=1..n-1),n=1..N);

Maple knows nothing about this relation. I have checked out packages like SumTools but have not found anything useful for this purpose. Quite some time ago I have had difficulty distributing a sum over the elements of its expression; this was answered here and involved a custom function.

Does a package exist that has these kinds of conversions, or do I need to roll my own? It seems a general enough issue that I would expect functions for this to exist.

TIA,

Mac Dude

I have an expression like this (from an earlier computation):

2*(sum(A*cos(omega*t)^2+cos(omega*t)*B*sin(omega*t)-cos(omega*t)*ymeas(t), t));

I want to distribute the sum over the terms in the expression, i.e.

sum(A*cos(omega*t)^2,t)+sum(cos(omega*t)*B*sin(omega*t,t)+sum(cos(omega*t)*ymeas(t), t)));

I suspect defining a rule and using applyrule should be the way to go, but for the heck of it I can't figure how to do it. The best I can manage is getting the Maple kernel hung with the following construct:

distSum:=sum(A::algebraic+B::algebraic+C::algebraic,D=algebraic)=sum(A,D)+sum(B,D)+sum(C,D);

applyrule(distSum,(5)); # (5) referrs to the expression on line 2 (and it is a proper label in my Maple wrkbook).

I have asked similar questions before and gotten answers; but I am not able to find what I need in MapePrimes (or my faorites, for that matter).

Thanks for any help,

Mac Dude

 


Below is a Maple ws describing the problem. I have some fixed values pr0 and pr1, and a four variations of a function "pdf". The problem is that when I use the function in a sum (either the "sum" function or the sigma notation), the result is different than if I write out the sum explicitly. It's very puzzling as to why they woudl be different in the first place, but even more strange is that the different versions have *different* deltas. Even version 3, with a delta of 10^-100 is too much for my application (moreover the delta gets larger when I sum over more terms).

 

In the worksheet below, I compare "sum(f(x),x=3..3)" to "f(3)". I expect this should always be identically 0, but that is not true for any of the four versions of my function. (The same is true for "Sum(f(x),x=3..3)".) However, "sum(f(3),x=3..3)" *is* (blessedly) identically "f(3)". What gives?

restart

pr[0] := .499999999999999999999852096538403821434745813543502066245832554193147476551830440227306019620687012523264913799181385911651886999607086181640625:

pr[1] := .43394228095117646589504674154844928036961264935215813494922283329725383492977635163048065719014507668417797436877236805230495519936084747314453125:

pr0 := .499999999999999999999852096538403821434745813543502066245832554193147476551830440227306019620687012523264913799181385911651886999607086181640625:

pr1 := .43394228095117646589504674154844928036961264935215813494922283329725383492977635163048065719014507668417797436877236805230495519936084747314453125:

pdf1 := proc (x) local j, prob, y; prob := 1; y := x; for j from 0 to 1 do if `mod`(y, 2) = 1 then prob := prob*pr[j] else prob := prob*(1-pr[j]) end if; y := floor((1/2)*y) end do; return prob end proc:

Maple doesn't always like subscripted variables. Is that the problem?

pdf2 := proc (x) local prob, y; prob := 1; y := x; if `mod`(y, 2) = 1 then prob := prob*pr0 else prob := prob*(1-pr0) end if; y := floor((1/2)*y); if `mod`(y, 2) = 1 then prob := prob*pr1 else prob := prob*(1-pr1) end if; return prob end proc:

Maybe it's the binary expansion that's the issue

pdf3 := proc (arr) options operator, arrow; product(arr[2-j]*pr[j]+(1-arr[2-j])*(1-pr[j]), j = 0 .. 1) end proc:

No procedures, no arrays

pdf4 := proc (x) options operator, arrow; (`mod`(x, 2))*pr0+(1-(`mod`(x, 2)))*(1-pr0)+(`mod`(floor((1/2)*x), 2))*pr1+(1-(`mod`(floor((1/2)*x), 2)))*(1-pr1) end proc:

evalf[100](sum(pdf1(i), i = 3 .. 3)-pdf1(3));

0.660577190488235341051011619131468981956415371043397988049446125095986885183932081422133231891679108e-1

 

0.660577190488235341051011619131468981956415371043397988049446125095986885183932081422133231891679108e-1

 

0.

(1)

``

evalf[100](sum(pdf2(i), i = 3 .. 3)-pdf2(3));

0.660577190488235341051011619131468981956415371043397988049446125095986885183932081422133231891679108e-1

 

0.

(2)

evalf[100](sum(sum(pdf3([i1, i2]), i2 = 1 .. 1), i1 = 1 .. 1)-pdf3([1, 1]));

0.1e-99

 

0.

(3)

evalf[100](sum(pdf4(i), i = 3 .. 3)-pdf4(3));

-0.5916138463847142610167458259917350166697832274100937926782390907759215172519498e-21

 

0.

(4)

``

``

``

``

 

Download maple_bug.mw

I would like to pay attention to an article " Sums and Integrals: The Swiss analysis knife " by Bill Casselman, where the Euler-Maclaurin formula is discussed.  It should be noted all that matter is implemented in Maple through the commands bernoulli and eulermac. For example,

bernoulli(666);


eulermac(1/x, x);

,

eulermac(sin(x), x, 6);

BTW, as far as I know it, this boring stuff is substantially used in modern physics. The one is considered in

Ronald Graham, Donald E. Knuth, and Oren Patashnik, Concrete mathematics, Addison-Wesley, 1989.

The last chapter is concerned with the Euler-MacLaurin formula.


           

I have calculated coefficients in maple using a "for...end do" command. For example,


for n from 0 to 1 do A[n] = int(((2*n+1)*(1/2))*simplify(LegendreP(n, cos(theta)))*sin(theta), theta = 0 .. (1/2)*Pi) end do;


A[0] = 1/2

A[1] = 3/4

 

Here, I can calculate as many coefficients as I want. But, how do I use these coefficients in the following line? For example, I need to calculate a summation. But for each term in the summation, I want to input the coefficients above to the corresponding term in the sum. So. the following summation

 A[0]+A[1]*r*cos(theta)+...

will automaticlly attach the numerical values of the coefficients calculated above to the corresponding term in the sum.

 

I hope this makes sense.

Hi, I'm having a problem regarding this equation:
                                                           sum(v(i), i = 1 .. 28)

where, v is a Data Table created under the Components Tab with 28 Rows, and 1 Column.

I keep on getting an error of: 

                                                     Error, unsupported type of index, i

I didn't use or declare 'i' in any part of the program.

Thank you for your help! 

Let M and K be given positive integers.

I struggle with how to write efficiently this formula in Maple,mainly because it sums over *pairs* of integers K1 and K2, with the given property that "K1+2*K2=K":

0<=K1<=K,

0<=K2<=K/2

 

sum { M!/(M-K1-K2)! * K!/(K1! * K2)! * 1/M^K * 1/2^K2 : such that K1 + 2*K2 = K}

The "!" means factorial.

Why the command

 

coeff(sum(x^i,i=0..999)^500,x,2) prints

 

Error, unable to compute coeff??

 

I believe, that memory/cpu issues are not a relevant answer here.

 

Already

coeff(sum(x^i,i=0..998)^500,x,2) gives the correct result.

Even

coeff(sum(x^i,i=0..998)^500,x,200) is ok.

How do I compute coeffs of longer sums?Or why this limitation is imposed by Maple Server?

Hello.

given this expression

T:=unapply((1/6930)*exp(-(1/7938)*(X[4]-933)^2)*exp(-(1/6050)*(X[2]-805)^2)/((1+exp((1/50)*X[4]-(1/50)*X[2]))*Pi),X[2]);

U := unapply(sum(T(X[2]), X[4] = 0 .. 3600), X[2]):

I want to display U, but not all 3600 terms. is there anyway to simplify/reduce this sum?

kind of like geo series a+ar+ar^2+ar^3+...+ar^(n-1)=sum(ar^k,k=0..n-1) can be reduced to a*(1-r^n)/(1-r)

 

I have sum representation,

N:=3

 

I tried evaluating at t = 0 or t = 1, it does nothing when I entered f(0)[2]; it returns

 

 

I have a big system, so the loop is necessary for the assignment.

hi everyone.how can i write a function or procedure or summation so that i can write down the following polynomial ? i just want to create a set of polynomials which their summation of power ( power of x + power of y ) be less than three or equal to three ? the coefficients priority is not important , for example it is not important that a1 multiplies to x or y , i just want to create this polynomial with some coeeficients. tnx for help

``

restart:

a[9]*y^3+x^3*a[8]+x^2*y*a[5]+x*y^2*a[7]+x^2*a[2]+x*y*a[4]+y^2*a[6]+x*a[1]+y*a[3]+a[0];

x^3*a[8]+x^2*y*a[5]+x*y^2*a[7]+y^3*a[9]+x^2*a[2]+x*y*a[4]+y^2*a[6]+x*a[1]+y*a[3]+a[0]

(1)

 

``

 

Download problem.mw

I have the following procedure to do the above. It works but it returns [9,10],[10,9],[12,1] for n=1729(for example). How do I modify this to 

a) to count 9,10 and 10,9 as the same and hence only show one of them

b) get 1,12 to show as a solution?

cubesum:=proc(n::nonnegint)
global listcub:=table();
local k:=0, x:=iroot(iquo(n,3),3),y:=x,x3:=x^3,y3:=y^3;
if 3*x3 <> n then x=x+1; x3:=x^3;y:=x;y3:=x3 end if;
while x3<=n do
y:=iroot(n-x3,3); y3:=y^3;
if(x3+y3 = n) then k:=k+1; listcub[k]:=[x,y]end if;
x:=x+1; x3:=x^3;
end do;
convert(listcub,list);
end proc:

 

Hy all its my first post, thankyou for having me.
I'm not sure why this happens but say I got a list

X := [0, 1, 2, 3];

and perform this expression

sum(sum(a[k]*X[i]^k, k = 0 .. n), i = 1 .. nops(X))

I get output 4*a[0]+6*a[1]+14*a[2] which is correct and what I want, but if I swap the summations

to 

sum(sum(a[k]*X[i]^k, i = 1 .. nops(X)), k = 0 .. n)

I get 3*a[0]+6*a[1]+14*a[2] which is incorrect I believe, unless I'm being silly and missing something.

this happens because its a 0 in my list, if I replace a zero with a non zero number then it works fine and if I replace my set with

X := [seq(x[i], i = 0 .. 3)];
both summations give me
a[2]*x[0]^2+a[2]*x[1]^2+a[2]*x[2]^2+a[2]*x[3]^2+a[1]*x[0]+a[1]*x[1]+a[1]*x[2]+a[1]*x[3]+4*a[0]

and at the end there is 4*a[0]
nothing that is really depending on any element in the list. so why when I replace an element with 0 using the second expression (which should be equivalent to first) gives me less a[0]I really would like to understand why this is happening

any insight or assistance would be gratefully appreciated.(I'm still a noob)

I have a nice family of functions of the form:

W:=(p,n,mu,w)->sum(w[k] * (n-k)* mu(n-k),k=1..n)

which can be evaluated for different p's using the operator mu*diff(...,mu)

The recursion begins with p=0 and proceeds using mu*diff(W(p,n,mu,w),mu) = W(p+1,n,mu,w).

Can anybody implement this procedure in Maple

Thank you 

1 2 3 4 5 6 7 Last Page 1 of 10