Download MuPAD from SciFace

MuPAD Pro Computing Essentials - Examples 

Example 5.4 - To produce list or set of numbers

You can produce long lists of objects in a similar way to sequences. You only need to add the square brackets. However, it is important to consider its place.

  • MyList := proc(n1: Type::Integer, n2:Type::Integer)
      local mylist, n;
    begin
       mylist := [ float((1+1/n)^n) $ n=n1..n2 ];
       return(mylist)
    end:   
  • MyList(1,5);
  
   [2.0, 2.25, 2.37037037, 2.44140625, 2.48832]
  
  • MyList(10,15);
  
[2.59374246, 2.604199012, 2.61303529, 2.620600888, 
 2.627151556, 2.632878718]

Here is shown how you can produce a set of numbers

  • MySet := proc(n1: Type::Integer, n2:Type::Integer)
      local myset, n;
    begin
       myset := { float((1+1/n)^n) $ n=n1..n2 };
       return(myset)
    end:   
  • MySet(1,5);
  
  {2.0, 2.25, 2.37037037, 2.44140625, 2.48832}
TOP