Kitonum

21435 Reputation

26 Badges

17 years, 28 days

MaplePrimes Activity


These are replies submitted by Kitonum

@tomleslie   Your code (and my one also) can be improved, if we exclude the line  if .. fi  (this is true automatically):

restart;

ts:=time():  ne:= 500:  k:=0:

for a from 1 to ne do

    for b from a to ne do

        for c from b to min(a+b-1, ne) do

            k:=k+1;

        od:

    od:

od:

k;

time()-ts;

                               10510625

                                   3.235

 

 

@tomleslie   Your comparison is incorrect because in fact the number  j  in  Student[Calculus1][ApproximateInt]  command  in 3 times greater as Maple itself divides each of the subsegments into 3 parts (see help with real Simpson's 3/8 Rule formula). When the correct comparison results are identical:

seq(Student[Calculus1][ApproximateInt](f(x), 1..5, method=simpson[3/8], partition=j), j=1..12);

seq(simp38(f,1,5,j), j=[seq(3*n, n=1..12)]);

seq(OPproc(f,1,5,j), j=[seq(3*n, n=1..12)]);

     

 

@ben maths  You are probably using an older version of Maple. The next variant is to work for you:

Simp38:=proc(f,x0,xn,n)

local  h:=(xn-x0)/n,  x:=i->x0+i*h;

3*h/8*(f(x0)+f(xn)+3*add(f(x(1+3*i)), i=0..(n-2)/3)+3*add(f(x(2+3*i)), i=0..(n-3)/3)+2*add(f(x(3+3*i)), i=0..(n-4)/3));

end proc:

@Markiyan Hirnyk  Replace  x+y+z = 2  by  x+y+z = 1  as this is in  OP  task.

 

Addition: Certainly, at some  values of parameters the minimum may not be achieved (unbounded problem)

@mangaba  I have no problem in Maple 2015 (32 bit) on Windows 8.1

@Shervin  zip  command implements elementwise union of two lists into a single list according to the specified rule.  *~ binary operation  (in  tomleslie's answer) makes the same, but it works in the later versions Maple only.

Alejandro Jakubi  and  Preben Alsholm . Thank you very much for your interest and the analysis carried out.

@Axel Vogt  but still would like to know the cause of the error.

@Rouben Rostamian   Agreed that the basis for my solution is your idea. But it has been improved: now user can explicitly specify a range for the variable  

@Markiyan Hirnyk  You are absolutely right, so vote up from me.

@Carl Love  Thank you for your helpful comment.

@Carl Love  Thank you for the quick response and solution to the problem. 

@acer  I figured it out just like you, but maybe OP just confuses these interfaces.

@mapleatha  Acer's method and old reference worked for me also (only in  Standard worksheet rather than Classic worksheet).

@Carl Love   Thank you for the detection of serious gap in my decision.

First 94 95 96 97 98 99 100 Last Page 96 of 132