Ronan

210 Reputation

6 Badges

7 years, 10 days
East Grinstead, United Kingdom

MaplePrimes Activity


These are questions asked by Ronan

How do I remove Array B from Array A? e.g.

A:=Array([1,2,3,4,5,6,7,8...1000]
B:=Array([3,6,9,12,15....])   assuming A contains all the elements of B.

to get [1,2,4,5,7,8,11....]

Also is it possible to do it in place?

.I am testing out the MutableSet command, There seems to be a problem with the number of emements that can be operated on. When N =100000 things are ok. When N=1000000 (or there abouts) the process doesn't terminate last line. Uorks ok for sets. Using Maple 2018.2 on Win10 64bit.


 

restart

N := 900000

900000

(1)

A := {seq(i^2, i = 1 .. N)}

B := {seq(A[i+1]-A[i], i = 1 .. nops(A)-1)}

``

``

C := MutableSet(seq(i^2, i = 1 .. N))

module MutableSet () local storage; global MutableSet; option object; end module

(2)

upperbound(C)

900000

(3)

MutableSet(seq(C[i+1]-C[i], i = 1 .. N-1))

``


 

Download Mutable_set_issue.mw

I have 2 questions here

1st I want to extend this set Ug3 := {1, 19, 23, 29} by repeatively subtracting 6 fron its elements. first pass should give

Ug3 := (Ug3-~ 6) union Ug3  Ug3 := {-5, 1, 13, 17, 19, 23, 29}

Now I dont want to add any elenments less than 6 so -5 need to go

Second pass produces

Ug3 := (Ug3-~ 6) union Ug3                Ug3 := {-11, -5, 1, 7, 11, 13, 17, 19, 23, 29}

Obiviously no elements less than 6 to be added on second pass either.

At this point there is no further elements that could be added to the set.

I am looking for an efficient method. I can use For loops and if then checks. The sets grow in length quickly. Repetition lengths are 6, 30 210, 2310,... I use sets because the numbers get ordered automaticially. Are sets efficient or should I use some form of table?
 

This should be simple but I am missing something. I want to sum the product of combinations of numbers.

I know I can assign values to a0...a[n-1]. But that isn't nice.

 

(n,k):= (5,4);
add(mul~(combinat:-choose([a(||)[](0..n-1)], k))) ; =a0*a1*a2*a3+a0*a1*a2*a4+a0*a1*a3*a4+a0*a2*a3*a4+a1*a2*a3*a4  which is correct.
add(mul~(combinat:-choose([(0..n-1)], k))) ;   #should be 24 but I get 0

 

I have asked this before but am still confused. I have a half-dozen procedures I want to save. Don't want them in a module/package. I am using windows 10.

I just can't get the syntax correct on this.

Obviously after saving restart and load to test.

libname;
       "C:\Program Files\Maple 2018\lib", 

         "C:\Users\Ronan\maple\toolbox\CodeBuilder\lib", 

         "C:\Users\Ronan\maple\toolbox\OEIS\lib", 

         "C:\Users\Ronan\maple\toolbox\personal\lib", 

         "C:\Users\Ronan\maple\toolbox\UTF8\lib"
libdir := "C:/Users/Ronan/maple/toolbox/personal/lib";
     libdir := "C:/Users/Ronan/maple/toolbox/personal/lib"
NULL;

LibraryTools:-Save(Pedal, cat(kernelopts(homedir), "/maple/toolbox/personal/lib/Pedal.mpl"));
Error, (in LibraryTools:-Save) could not open `C:\Users\Ronan/maple/toolbox/personal/lib/Pedal.mpl\Pedal.m` for writing

 

1 2 3 4 5 6 7 Last Page 1 of 14