Adri van der Meer

Adri vanderMeer

1400 Reputation

19 Badges

18 years, 290 days
University of Twente (retired)
Enschede, Netherlands

My "website" consists of a Maple Manual in Dutch

MaplePrimes Activity

These are answers submitted by Adri van der Meer

Use " := " for an assignment; only " = " makes an equation. You typed

k = ln((M-m)/m(k-1))

instead of

k1 := ln((M-m)/(m*(k-1)))

(and: don't use the same variable name in both sides of an assignment).

  • You typed α:=0,85 where 0.85 is intended (I suppose)
  • By
    for k do p[k] := M.p[k-1]; if Norm(p[k]-p[k-1]) < tol then break end if end do:
    you try to build a table p (I suppose), but the variable p is already in use (as a matrix).
    So use another name, and don't forget to initialize:
    q[0] := Vector(n, fill=1/n):
    for k do q[k] := M.q[k-1]; if Norm(q[k]-q[k-1]) < tol then break end if end do:

For example: ex is not




Choose: Tools → Options → Display → Input Display: Maple Notation to get full control over your input.

Perhaps you mean:

u:= Int( (-4*(16*c+3)*exp(-1/2*sqrt(-16*c-3*Zeta)) )/
   (64*exp(-sqrt(-16*c-3*Zeta)) + 256*c*exp(-sqrt(-16*c-3*Zeta)) +
   8*exp(-1/(2)*sqrt(-16*c-3*Zeta)) +1), Zeta);

Then you can try the substitution

v := IntegrationTools:-Change( u, t=sqrt(-16*c-3*Zeta), t );

To be fair,

Sum(i, i=0..N) - Sum(i, i=0..N, i!=k);

should, obviously return: if k≤N then k, else zero.

There are some possibilities to manipulate inert Sums.
In your example:

S1 := Sum(i, i=0..N):
S2 := Sum(i, i=0..k-1) + Sum(i, i=k+1..N):
combine( S1-S2, 'range' ) assuming k < N;

gives you (almost) the desired answer, but, of course as an unevaluated Sum!

Markiyan Hirnyk's procedure can be used if you only want to see the three values.
If you need the results for further calculation, the procedure must build a sequence (or list, or vector) of the values:

local result:
result := x^4+3;
result := result, x+3*y;
result := result, y+z
end proc:
a,b,c := Outp(3,4,2);
a, b, c := 84, 15, 6

Compare with:

Outp := proc (x::integer, y::integer, z::integer)
end proc:
a,b,c := Outp(3,4,2);
Error, ambiguous multiple assignment
a := Outp(3,4,2);

The result is NULL, i.e. an empty sequence.

Case 1 and Question 3:
It is always clever to declare local variables as local; the returnType is only meaningful for debugging purposes:

local g:
end proc;

Case 2: a sequence of outputs:
The output of a procedure is the last executed statement, or an explicit return value. In yor example you wish "several values" that is: a sequence of values. In your example you can do for instance:

local result:
result := x+3*y;
result := result, y+z;
end proc;

Mind that Sum (capital S) is the inert form. The function value() can be used to calculate the value:

Sum( i, i=0..N ): %=value(%);

In your example (typing errors(?) removed):

sum(1, i=0..N) - sum(1, i=k..N);

I suppose that ?proc will be a good starting point. More detailed information in the (online) programming guide

Procedures can be nested. You must declare the name of an inner procedure as a local variable in the outer procedure.

If v is a vector, so

v := Vector( [54*a+3*b-c+d, 32*a-c+d, 96*b-69*c+85*d, 6*a+9*b+3*c+9*d] ):

then you must convert v to a list or set, and solve:

solve ( convert( v, set ), {a,b,c,d} );

(only trivial solution)
If there is no right hand side in an expression, then it is automatically set to zero.

Of course you can build r as a table of lists:

for i to 80 do
  r[i] := [];  # initialization
  # fill the list r[i]
  for j to n(i) do r[i] := [ op(r[i], f(j) ] end do
end do:

or, a little trickier: as a list of lists:

r := []:
for i to 80 do
Q := NULL: # empty sequence
for j to n(i) do Q := Q, f(j) end do:
r := [ op(r), [Q] ]
end do:

Here is n(i) the number of elements in list r[i].
If all the lists r[i] have the same length, you can consider to create r as a Matrix.

u and v are polynomials in α and β. so there are several (real) zeros.
Try for example

s1 := fsolve({u,v}); 
s2 := fsolve({u,v}, {alpha,beta}, avoid={s1} ); 
s3 := fsolve({u,v}, {alpha,beta}, avoid={s1,s2} ); 

Tools → Options → Display → Input Display: Maple Notation.

Apparently you want r to be a ?list , but by the initialization

r[] := [];

you make r a ?table (with one empty index and one empty entry). Try

r := [];

to start with.

simplify(F, {epsilon^2=1});


First 22 23 24 25 26 27 Page 24 of 27