ahmeng

40 Reputation

4 Badges

7 years, 8 days

MaplePrimes Activity


These are questions asked by ahmeng


 

Suppose I am given the following summation:

 

sum(a*i, i = 1 .. n)

``

Can Maple write the first few terms of the summation? For example, if I want to see first three terms of the summation, I'd like Maple to output the following:

 

a + 2 a + 3 a

 

My use case is that if I am given a complicated summation, it can be useful to look at the first few terms to see if there are any patterns.

 

The things I've tried are:

 

sum(a*i, i = 1 .. 3)

6*a

(1)

'sum(a*i, i = 1 .. 3)'

sum(a*i, i = 1 .. 3)

(2)

eval(sum(a*i, i = 1 .. 3))

6*a

(3)

expand(sum(a*i, i = 1 .. 3))

6*a````

(4)

``


 

Download expandsum.mw

I don't understand why evalb(2^(n+10)-1024*2^n = 0) returns false. The expression can be simplified to 0.

Am I misusing evalb?
 

assume(n, integer, n > 0)

NULL

f := proc (n) options operator, arrow; 2^(n+10) end proc

proc (n) options operator, arrow; 2^(n+10) end proc

(1)

g := proc (n) options operator, arrow; 1024*2^n end proc

proc (n) options operator, arrow; 1024*2^n end proc

(2)

g(n)-f(n)

1024*2^n-2^(n+10)

(3)

"(=)"

0

(4)

evalb(1024*2^n-2^(n+10) = 0)

false````

(5)

``


 

Download temp.mw


In the following workbook, I defined two equivalent one variable functions and plot their difference.

I'm surprised to see that the difference is not 0 between 55 and 60. But when I computed the respective function's values at these points, the difference is 0.

assume(n, integer, n > 0)

``

f := proc (n) options operator, arrow; 2^(n+10) end proc

proc (n) options operator, arrow; 2^(n+10) end proc

(1)

g := proc (n) options operator, arrow; 1024*2^n end proc

proc (n) options operator, arrow; 1024*2^n end proc

(2)

g(n)-f(n)

1024*2^n-2^(n+10)

(3)

"->"

 

``

map(f, [seq(i, i = 55 .. 60)])

[36893488147419103232, 73786976294838206464, 147573952589676412928, 295147905179352825856, 590295810358705651712, 1180591620717411303424]

(4)

map(g, [seq(i, i = 55 .. 60)])

[36893488147419103232, 73786976294838206464, 147573952589676412928, 295147905179352825856, 590295810358705651712, 1180591620717411303424]

(5)

[36893488147419103232, 73786976294838206464, 147573952589676412928, 295147905179352825856, 590295810358705651712, 1180591620717411303424]+[-36893488147419103232, -73786976294838206464, -147573952589676412928, -295147905179352825856, -590295810358705651712, -1180591620717411303424]

[0, 0, 0, 0, 0, 0]

(6)

``


 

Download temp.mw

1 2 Page 2 of 2