brian bovril

889 Reputation

16 Badges

18 years, 301 days

MaplePrimes Activity


These are questions asked by brian bovril

Wonder if this can be accomplished in Maple.

so I have a list of 100 items labeled {1..100} of various value {$100, $160, $220, ......  , }

the task is to distribute these items among 3 people A,B,C so they get an approximately equal share.

Adding the values and dividing by 3 gives the dollar total to aim for. 

This post has C.Love procedure for evenly sized groups

 http://www.mapleprimes.com/questions/200480-Product-Grouping

but what i want is a method for different sized groups. ie 25 items for A, 35 for B and 40 for C (user defined).

additionally there is a fixed constraint: A has been bequeathed items 1,4,8; B items 2 and 20; C item 50.

 

restart:
S:= {3, 4, 5, 6, 8, 9, 28, 30, 35}:
SL:= [A,B,C,D,E,F,G,H,I]:
assign(Labels ~ (S) =~ SL); #Create remember table.
AllP:= [seq(P, P= Iterator:-SetPartitions(S, [[3,3]], compile= false))]:
lnp:= evalf(ln((`*`(S[]))^(1/3))):

Var:= proc(P::({list,set}(set)))
local r:= evalf(`+`(map(b-> abs(ln(`*`(b[]))-lnp), P)[]));
end proc:

Min:= proc(S::{list,set}, P::procedure)
local M:= infinity, X:= (), x, v;
     for x in S do
          v:= P(x);
          if v < M then  M:= v;  X:= x  end if
     end do;
     X
end proc:

ans:= Min(AllP, Var);
              [{3, 9, 35}, {4, 8, 28}, {5, 6, 30}]
subsindets(ans, posint, Labels);
               [{I, A, F}, {B, E, G}, {C, D, H}]

 

 

So I installed copied DirectSearch.hdp and DirectSearch.mla into my Maple2015\lib directory and the program works (all the functions are there) but I cant get help menu by querying ?DirectSearch.

I'm running win7 64bit btw

so under

?hdb

i put this into maple:

HelpTools:-Database:-ConvertAll();

but i get error....

"Converting C:\\Program Files\\Maple 2015\\lib\\DirectSearch.hdb to C:\\Program Files\\Maple 2015\\lib\\DirectSearch.help"
Warning, .hdb help databases are deprecated, 'C:\Program Files\Maple 2015\lib\DirectSearch.hdb' will not be used, see ?HelpTools,Migrate help page for more information
Error, (in HelpTools:-HelpCallUI) cannot create help database: 'unable to open database file'

any clue?

ps I asked the same question for M18 but I managed to get the help to work in that instance.

http://www.mapleprimes.com/questions/204423-Help-Build-For-GlobalSearch-Package

(i also copied DirectSearch.hdp and DirectSearch.mla to Maple2015\bin.X86_64_WINDOWS directory but no joy, there is no .help file created in either bin or lib directories)

Social Golfer Problem

So we have 8 golfers : 2 golfers per group and 4 groups.Over several golfing days, how can they be arranged so no golfer plays with the same player twice.

turns out they can play for 7 days.

So my attempt in maple....golfing.mw

For 3 players per group and 4 groups this is the arrangement over 4 days:

(these was done in wolfram demonstrations project but the code appears to be obfuscated)

Not homework (from the telly): A gallery takes a concave polygon shape with a square pillar in the centre. security cameras can do a 360 degree sweep but they can't see around corners. The cameras have to be attached to the walls. What is the fewest number of cameras such that they can see everywhere in the gallery?

I got as far as drawing it in Maple.

polygon_cameras.mw

there is an algorithm -which supposedly finds the optimal solutuion- breaking the object into triangular shapes. that gets an answer:  4 cameras.

EDIT 11/10

this is based on Fisk's short proof. See Markiyan's wiki ref below.

1.first stand on on a corner and scan clockwise around the room. Any two corners passed creates one triangle.

Repeat for every corner

 

2. Pick three colours and allocate each color to each corner of each triangle.

sometimes you will end up with a triangle which has 2 corners of the same colour. This one has two blue corners

 

This triangle must be broken in two and add a green dot

3.finally the algorithm places cameras on the colour which occurs least.

But by experimenting with more complex shapes (convex polygons) you can cover the gallery with 3.

 

In Maple anyone?

 

 

 

Population at point A is 500. Point B 200. See pics.

where is the best point to meet such that the total distance is minimized. Can only go "taxi way", no diagonals allowed.

[the answer is (5,5).

Solution given: sumPop/2=~7 units. Left-right sum7 occurs at C, x=5. Bottom-top sum7 occurs at B, y=5].

there must be a better (Maple) way...

First 16 17 18 19 20 21 22 Last Page 18 of 34