janhardo

695 Reputation

12 Badges

11 years, 40 days

MaplePrimes Activity


These are questions asked by janhardo

I did two attempts with different ideas
 

 

restart;

Task (a) A list of numbers in Maple :

L:=[1,2,3,4,5];

[1, 2, 3, 4, 5]

(1)

 

In general summing up numbers sum(a, i = k .. n) = sum(a_i, i = 1 .. 5) and sum(a_i, i = 1 .. 5) = a1+a2+a3+a4+a5

underscript? ..i like to write a with underscore n : how to that

#S:={seq(L[i],i=1..5)};

#L:= [seq(L[i],i=1..5)];

For summing up numbers in a list of L i can use a ...

Sumlist := proc (L,N):  

Sumlist:=proc(L,N)

   a:=1;

   for i from 1 to N do

      a:=seq(L[i],i=1..5);

   end do;

end proc:

 

Warning, (in Sumlist) `a` is implicitly declared local

 

Warning, (in Sumlist) `i` is implicitly declared local

 

L:=[1,2,3,4,5];

[1, 2, 3, 4, 5]

(2)

N:=3;

3

(3)

Sumlist(L,N);

1, 2, 3, 4, 5

(4)

 

And now to sum the number sequenze  from the procedure?

 

restart;

Sumlist:=proc(L,N)

   a:=1;

   for i from 1 to N do

      a:=seq(L[i],i=1..5);
      #sum(a, i=1..5); # for this probably a second do loop nested ?

   end do;

end proc:

 

Warning, (in Sumlist) `a` is implicitly declared local

 

Warning, (in Sumlist) `i` is implicitly declared local

 

L:=[1,2,3,4,5];

[1, 2, 3, 4, 5]

(5)

N:=3;

3

(6)

Sumlist(L,N);

1, 2, 3, 4, 5

(7)

 

 

 

 

========================================================================

Also possible by? : a1 = 1, a2=a1+1, a3=a2+1, etc

restart;

 

Sumlist:=proc(L,N)

   a:=1;

   for i from 1 to N do

      a:=L[i]+1;

   end do;

end proc:

 

Warning, (in Sumlist) `a` is implicitly declared local

 

Warning, (in Sumlist) `i` is implicitly declared local

 

L:=[1,2,3,4,5];

[1, 2, 3, 4, 5]

(8)

N:=2;

2

(9)

Sumlist(L,N);

3

(10)

L[1];

1

(11)

 

Try some things out, but summing up list ?


 

Download betounes_ex_set_2_task_5.mw

 

Seems to make no difference with or without RETURN() for the procedure ?

 

vraag_op_forum_gesteld_over_boek_vb_binomium.mw

 

For to know what each graph is standing for in the plot legenda

Could not yet get it  in y , y' , y '' , to 5th derative 

Better is perhaps to have vertical table with the names and function expression together , but that could be difficult betounes_ex_set_task_4def.mw  

 

f := x -> exp(-x)*sin(x); intvx:= 0..3;
f := proc (x) options operator, arrow; exp(-x)*sin(x) end proc
intvx := 0 .. 3

 

And this one below ( i prefer this one ) , but got in worksheet now the one above
Probably a option issue ?

 

 

f := x -> exp(-x)*sin(x); intvx:= 0..3;

proc (x) options operator, arrow; exp(-x)*sin(x) end proc


 

Could be helpful to see again those worksheets about programming in Maple.

It was back in 2000-2004 that have seen these workssheets on the Maple website

 I looked at Maple website, but nothing to find anymore for those programming worksheets?

First 18 19 20 21 22 Page 20 of 22