# Items tagged with summationsummation Tagged Items Feed

### Problem with solving system...

November 16 2015
0 1

How can I solve the following system in Maple for $S_1$ and $S_{i+1}$? I have the code written, but it is giving me nothing as output.

eq1 := Q-A*S[1]*C/X+B*D*(sum(S[j], j = 2 .. i+1))/Y-r[1]*S[1] = 0;
eq2 := A*S[i-1]*C/X-A*S[i]*C/X-B*S[i]*D/Y-r[1]*S[i] = 0;
eq3 := A*S[i]*C/X-B*S[i+1]*D/(Y+S[i+1])-r[2]*S[i+1] = 0;
solve({eq1, eq2, eq3}, {S[1], S[i+1]});

The only non-constants in the system are the $S_j$'s for $j = 1, \ldots, i+1$.

Here is the system in math mode:
$$Q-\frac{AC}{X}S_1-r_1 S_1 +\frac{BD}{Y}\sum\limits_{j=2}^{i+1}S_j = 0 \\ \frac{AC}{X}S_{i-1} - \frac{AC}{X}S_i - \frac{BD}{Y}S_i - r_1 S_i = 0\\ \frac{AC}{X}S_i - \frac{BD S_{i+1}}{Y+S_{i+1}} - r_2 S_{i+1} = 0$$

I have a head start on it by hand, but it's too cumbersome to complete.

Basically, my strategy is to solve for $S_{i+1}$ as a function of $S_1$ and some constants. Then to plug in $S_2, \ldots, S_{i+1}$ in the summation and solve for $S_1$ as a function of constants. Then I would obtain $S_{i+1}$ as a function of constants itself.

Thanks for any help.

### How can I animate this stiff function?...

September 28 2015
1 4

Hi,

I have a problem with creating a function contains n-dimensional independent variables with random function .. The function looks like:

where U is a random between 0 and 1

For 1-dimensional problem, it will be like:

The plot by MATLAB will be:

While, for 2-dimensional problem, it will be like:

and the plot with MATLAB will be:

The MATLAB code is:

x1min=-5;
x1max=5;
x2min=-5;
x2max=5;
R=1000; % steps resolution
x1=x1min:(x1max-x1min)/R:x1max;
x2=x2min:(x2max-x2min)/R:x2max;

for j=1:length(x1)

% For 1-dimensional plotting
f1(j)=rand*abs(x1(j));

% For 2-dimensional plotting
for i=1:length(x2)
fn(i)=f1(j)+rand*abs(x2(i))^2;
end

fn_tot(j,:)=fn;

end

figure(1)
plot(x1,f1);

figure(2)
meshc(x1,x2,fn_tot);

I have used Maple because of its great graphics and animation, and for the mathematical analysis capability. However, to animate the above problem for 1- and 2-dimensional problems, I always fail!

My attempt has been just successed to plot 1-dimensional problem (without animation) .. And it tooks long-time with many codes!

restart;

X := Statistics:-RandomVariable(('Uniform')(0, 1));
R := Statistics:-Sample(X, 1000);

Vect := abs(Vector[column]([seq(0 .. 10, 10/999)]));

V := ~[-](Vect, 5);

with(LinearAlgebra);
Mat := Multiply(V, R);

with(ArrayTools);
f := ArrayTools:-Diagonal(Mat);

F := abs(f);

Axis := Transpose(V);

f5 := plot(Axis, F, style = line);

And finally I got the graph:

But the problem is:

How can I animate it? Maybe I need to express it with new Maple code?

How can I plot and animate it when n=2?

Thanks

### Summation in different form...

September 11 2015
3 15

Dear Feinds,

How can I compute a double summation of the following form in Maple.

∑5m=1  ∑j+k=m-1 (2m (Dk(a_m*f)) (Dj(f)))

where Drepresents nth order derivative.

EDIT 1

EDIT 2

Function "f" in the first derivative is changed to "a_m*f" where a_m (variable coefficients) represents any function of x.

First of all thank you so much for all the nice answers.

Here, the notation a_m doesn't work as I was expecting and then I thought let's just make it a(m) for simplicity, it seemed to work fine but unfortunatelyassumes it as a constant function. How can I rectify this problem?

### Help in unsupported type of index with Summation...

May 28 2015
2 5

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.

### How to efficiently write a formula in Maple...

May 14 2015
1 5

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.

### how to make desired polynomials with sum of the po...

March 09 2015
1 2

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];
 (1)
 >

### find sigma!!!!!!!!!!!!!!!!!!!...

March 08 2015
0 1

Sum(a^(k/a^k), k= 1..n);

### double summation is incorrect BUG?...

February 20 2015
2 14

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)

### Is this double sum over a binomial in error?...

October 31 2014
3 8

Maple returns the wrong answer to the following very simple double sum:

T:=(x,m)->sum( sum(binomial(m,k+p),k=1..m-p)*x^p,p=0..m-1);

Maple gives zero for all m>0.  However, the correct answer is a non-zero polynomial in x.

For example, with Maple:

T(x, 3);
0

It would be helpful if others can check this double sum in their version of Maple and report results.

### how to count the number summation ...

August 15 2014
1 10

RandomCompositions:= module()
local
Compositions, Rand,

RandomCompositions:= module()
local
Compositions, Rand,
ModuleApply:= proc(n::posint, k::posint)
local C;
Compositions:= [seq(C-~1, C= combinat:-composition(n+k, k))];
Rand:= rand(1..nops(Compositions));
()-> Compositions[Rand()]
end proc;

end module:
R:= RandomCompositions(8,6):
seq(R(),i=1..10);

[0, 0, 2, 6, 0, 0], [1, 0, 0, 3, 4, 0], [0, 3, 3, 2, 0, 0],[1, 2, 4, 0, 1, 0], [0, 4, 0, 1, 3, 0],

[2, 0, 1, 4, 1, 0],[2, 0, 1, 1, 3, 1], [1, 0, 4, 2, 1, 0], [1, 3, 0, 2, 0, 2],[2, 0, 3, 2, 1, 0]

with(Statistics):
Tally(R());
[0 = 1, 1 = 4, 4 = 1]

I want to count the 0 to 8 respectively summation,and divide by i.

But the  seq command  R() isn't conform  with Tally command R() .

Thanks.

### how to set random summation...

August 06 2014
1 5

a:=rand(0..8):
b:=rand(0..8):
c:=rand(0..8):
d:=rand(0..8):
e:=rand(0..8):
f:=rand(0..8):
a()+b()+c()+d()+e()+f()=8;

This is my  programming code.

I want ot set six random summation is  8.

But the random summation can't reach 8.

### Euler-Maclaurin Summation...

April 06 2014
0
1

Greetings to all.

I would like to share a brief observation concerning my experiences with the Euler-Maclaurin summation routine in Maple 17 (X86 64 LINUX). The following Math StackExchange Link shows how to compute a certain Euler-MacLaurin type asymptotic expansion using highly unorthodox divergent series summation techniques. The result that was obtained matches the output from eulermac which is definitely good to know. What follows is the output from said routine.

> eulermac(1/(1+k/n),k=0..n,18);
1       929569        3202291        691                O(1)
O(- ---) - ----------- + ----------- - --------- + 1/1048576 ----
19             15            17          11              19
n      2097152 n     1048576 n     32768 n               n

n
/
174611      5461        31       |      1           17        1
- -------- + --------- + ------- +  |   ------- dk - ------- + ------
19          13         9    |   1 + k/n            7        5
6600 n     65536 n     4096 n    /                 4096 n    256 n
0

1       1
- ------ + ---- + 3/4
3   16 n
128 n


While I realize that this is good enough for most purposes I have two minor issues.

• One could certainly evaluate the integral without leaving it to the user to force evaluation with the AllSolutions option. One can and should make use of what is known about n and k. In particular one can check whether there are singularities on the integration path because we know the range of k/n.
• Why are there two order terms for the order of the remainder term? There should be at most one and a coefficient times an O(1) term makes little sense as the coefficient would be absorbed.

You might want to fix these so that the output looks a bit more professional which does enter into play when potential future users decide on what CAS to commit to. Other than that it is a very useful routine even for certain harmonic sum computations where one can use Euler-Maclaurin to verify results.

Best regards,

Marko Riedel

### How do I apply an inverse distributive law...

January 02 2014
0 2

I have the following expression (obtained from an earlier calculation):

I want to collect all the terms under one summation. So I define a rule:

collectf:=proc(f)
A::algebraic*f(a::algebraic)+B::algebraic*f(b::algebraic)\
+C::algebraic*f(c::algebraic)+D::algebraic*f(d::algebraic)=f(A*a+B*b+C*c+D*d);
end proc:

and then

applyrule(collectf(Sum),%);

I get

Error, (in +) unable to identify A::algebraic

I used similar constructs before so I think the rule is constructed correctly. I should, however, mention that I use the Physics:-Vectors package and in fact the expression I start up with here reads, in 1-d Maple inputform:

Physics[Vectors][+](Physics[Vectors][+](Physics[Vectors][+](-y*(Sum((diff(a[n](r), r))/(exp(I*Pi*n/L))^2, n))/r, (2*I)*(Sum(a[n](r)/(exp(I*Pi*n/L))^2, n))*k0), y*(Sum(a[n](r)/(exp(I*Pi*n/L))^2, n))*k0^2), -y*(Sum((diff(a[n](r), r, r))/(exp(I*Pi*n/L))^2, n)))

Is my problem related to the use of Physics:-Vectors? If so, how can I get around that?

TIA,

Mac Dude

### display of summation of numbers as the outcome...

January 02 2014
1 6

How can I show the expression of the following summation as the output, not 11?

3+7+1

### Physics updates and multi-index summation...

December 05 2013
2
0

Hi,
Relevant developments in Physics happened during the last month and a 1/2, some of them of interest beyond the use of this package. Among the most exciting things I can mention:

1. The redefinition of the derivative rule for the complex components (abs, argument, conjugate, Im, Re, signum) together with the introduction of Wirtinger calculus, as an user-option to work with complex variables. In other words: it is now possible to compute taking z and its conjugate as independent variables and in equal footing.
2. Introduction of textbook mathematical display for all the inert functions of the mathematical language, also for unknown functions f(x).
3. New options in Physics:-Setup to indicate that some mathematical objects are real (different from assume(x, real), while integrated with is and coulditbe).
4. A rather large number of micro developments advancing the integration of Physics with simplify, expand and combine.
5. Another large number of micro developments for quantum mechanics.
6. New options in Physics:-Setup to redefine sum as Physics:-Library:-Add, and with that have access to multiindex summation directly from sum, for instance as in sum(f(i, j), i + j <= n), including related typesetting copy & paste.

As usual the latest version of the package is available for download in the Maplesoft Physics: Research & Development webpage  and in the zip there is a worksheet illustrating all these developments. Below I'm copying the section related to the new redefinesum option of Physics:-Setup and multiindex summation.

Thanks to everyone who provided feedback, it has been of great value and at the root of this new round of developments.

December 4

 • New option in Setup: redefinesum, so that the sum command is redefined in such a way that     a) the sum arguments are processed in a way avoiding premature evaluation and related unexpected results or error interruptions     b) the sum command includes new functionality present in Physics:-Library:-Add to perform sum over integer values of many indices, as in

or

 >
 (1.1)

New option: redefine sum so that its arguments are processed by the more modern Physics:-Library:-Add and so that it can perform multiindice summation.

Example:

By default, the sum command is not redefined, so the value of redefinesum is

 >
 (1.2)

Consider this multiindex summation functionality of the Physics:-Library:-Add command

 >
 (1.3)

For instance, for n = 2,

 >
 (1.4)

This functionality can be plugged directly into the sum command. For that purpose, set redefinesum to true

 >
 (1.5)

You can now compute directly with sum. The left-hand side is inert while the right-hand side is computed

 >
 (1.6)
 >
 (1.7)
 >
 (1.8)

The formula for the integer power of a sum

 >
 (1.9)
 >
 (1.10)
 >
 (1.11)

Verify whether this equation is true

 >
 (1.12)

Besides this new functionality, the redefined sum does a more modern handling of its arguments, consider a typical problem posted in Maple primes

 >
 (1.13)

In the following summation, j is a dummy summation index, so the value just assigned, , is not expected to interfer with the summation. This is the case with the redefined sum

 >
 (1.14)

while without redefining sum the input above is interrupted with an error message. Likely, in this other case also reported in Mapleprimes

 >
 (1.15)

the following two summations can be performed after having redefining sum:

 >
 (1.16)

For the summation above, without redefining sum, it returns 0 instead of unevaluated, because of a premature evaluation of the function  with an unassigned index i before performing the summation. Returning unevaluated as (1.16) permits evaluate the sum at a latter moment, for instance attributing a value to f

 >
 (1.17)

And this other sum where f is given from the begining also returns 0 without redefining sum

 >
 (1.18)

Problems like this other one reported in Mapleprimes here also get resolved with this redefinition of sum.