MaplePrimes Commons General Technical Discussions

The primary forum for technical discussions.

I just wanted to remind everyone that this quarter's Möbius App Challenge closes on March 31st.  The next prize to be awarded is an Xbox One Prize Pack.  Video games are supposed to be good for the brain, after all, so really, you owe it to yourself to enter.

To enter the contest, all you need to do is:

1) Create an interactive App in Maple

2) While in Maple, log-in to the MapleCloud through the MapleCloud palette.

3) Click on the Send Document to the Cloud button

4) Set the group to "Mobius@admin", then hit send.

The group is moderated, so it won't appear instantly, but once approved it will appear on the Möbius Project server, where people can interact with it through a web browser, in Maple, or download it for use with the free Maple Player.

Here are the full contest details and more information on creating and submitting Apps.

Good luck!

Kim

In this post we present the solution with Maple to the logical problem of "Gardens Puzzle"

http://www.mathsisfun.com/puzzles/gardens-solution.html

The Puzzle:

Five friends have their gardens next to one another, where they grow three kinds of crops: fruits (apple, pear, nut, cherry), vegetables (carrot, parsley, gourd, onion) and flowers (aster, rose, tulip, lily).

1. They grow 12 different varieties.
2. Everybody grows exactly 4 different varieties
3. Each variety is at least in one garden.
4. Only one variety is in 4 gardens.
5. Only in one garden are all 3 kinds of crops.
6. Only in one garden are all 4 varieties of one kind of crops.
7. Pear is only in the two border gardens.
8. Paul's garden is in the middle with no lily.
9. Aster grower doesn't grow vegetables.
10. Rose growers don't grow parsley.
11. Nuts grower has also gourd and parsley.
12. In the first garden are apples and cherries.
13. Only in two gardens are cherries.
14. Sam has onions and cherries.
15. Luke grows exactly two kinds of fruit.
16. Tulip is only in two gardens.
17. Apple is in a single garden.
18. Only in one garden next to Zick's is parsley.
19. Sam's garden is not on the border.
20. Hank grows neither vegetables nor asters.
21. Paul has exactly three kinds of vegetable.

Who has which garden and what is grown where?

 

About methods of solution. At first I just wanted to generate all variations and using conditions 1 .. 21 to find all solutions. But even if we use the condition that everybody grows exactly 4 different varieties then the total number variants equals  5!^2*binomial(12,4)^5=427945522455000000

So from the very beginning using some of the conditions 1 .. 21 we maximally reduce the number of possible variants. For example from the conditions 11, 18 and 6 implies that only in one garden are all 4 varieties of flowers. Next we pass through these variants and using conditions 1 .. 21 and finally come to a unique solution:

restart;

Fruits:={apple, pear, nut, cherry}:

Vegetables:={carrot, parsley, gourd, onion}:

Flowers:={aster, rose, tulip, lily}:

 

Set1:=Flowers:

Garden1:={Set1}:

Set2:=Fruits union Vegetables union Flowers minus {nut,gourd,parsley} minus {apple,cherry,rose}:

Garden2:={seq({nut,gourd,parsley} union {Set2[i]}, i=1..nops(Set2))}:

Set3:=Vegetables union Flowers minus {parsley}:

Garden3:={seq({apple,cherry,pear} union {Set3[i]}, i=1..nops(Set3))}:

Set4:=combinat[choose](Fruits union Vegetables union Flowers minus {onion,cherry} minus {apple,parsley,pear,nut}, 2):

Garden4:={seq({onion,cherry} union Set4[i], i=1..nops(Set4))}:

Set5:=Fruits union Vegetables union Flowers minus {apple, cherry,nut,parsley}:

Garden5:=combinat[choose](Set5, 4):

 

S:=[]:

for s1 in Garden1 do

for s2 in Garden2 do

for s3 in Garden3 do

for s4 in Garden4 do

for s5 in Garden5 do

s:=[s1,s2,s3,s4,s5]: s_4:=combinat[choose](s,4): m:=0: n:=0: k:=0: p:=0: q:=0:

for i in s do

if `intersect`(i,Fruits)<>{} and `intersect`(i,Vegetables)<>{} and `intersect`(i,Flowers)<>{} then m:=m+1: fi:

if pear in i then n:=n+1: fi:

if tulip in i then k:=k+1: fi:

if aster in i and `intersect`(i,Vegetables)<>{} then p:=p+1: fi:

if i=Fruits or i=Vegetables or i=Flowers then q:=q+1: fi:

od:

if nops(`union`(op(s)))=12 and nops(`union`(seq(`intersect`(op(s_4[j])), j=1..nops(s_4))))=1 and m=1 and n=2 and k=2 and p=0 and q=1 then S:=[op(S),[s1,s2,s3,s4,s5]]: fi:

od: od: od: od: od:

 

L1:=[seq([[3,Paul],[2,Sam],seq([combinat[permute]([1,4,5])[i,j],[Luke,Zick,Hank][j]],j=1..3)],i=1..6)]:

L2:=[seq([[3,Paul],[4,Sam],seq([combinat[permute]([1,2,5])[i,j],[Luke,Zick,Hank][j]],j=1..3)],i=1..6)]:

L0:=[op(L1),op(L2)]:

L:=[seq(op(combinat[permute](L0[i])),i=1..nops(L0))]:

Sol:=[]:

for l in L do

for s in S do

sol:=[seq([op(l[i]),s[i]], i=1..5)]:

gad1:=op(select(has,sol,parsley)): gad2:=op(select(has,sol,Zick)):

if abs(gad1[1]-gad2[1])=1 and convert([seq(((pear in sol[i][3] implies (sol[i][1]=1 or sol[i][1]=5)) and (sol[i][2]=Paul implies (not lily in sol[i][3])) and (sol[i][1]=1 implies (apple in sol[i][3] and cherry in sol[i][3])) and (sol[i][2]=Sam implies (onion in sol[i][3] and cherry in sol[i][3])) and (sol[i][2]=Luke implies nops(`intersect`(sol[i][3],Fruits))=2) and (sol[i][2]=Hank implies (`intersect`(sol[i][3],Vegetables)={} and not aster in sol[i][3])) and (sol[i][2]=Paul implies nops(`intersect`(sol[i][3],Vegetables))=3)), i=1..5)], `and`) then Sol:=[op(Sol), sol]: fi:

 

od: od:

for i in Sol do

Matrix(sort(i,(x,y)->x[1]<y[1]));

od;

 

 

For some time I have been running into the problem where uploaded worksheets that are inlined into a Mapleprimes post get gridlines shown, even when they are not specified or shown in the original worksheet. This is a problem because quite often the gridlines make an inlined plot unattractive.

I believe that Mapleprimes uses some version of MapleNet as a mechanism for inlining uploaded worksheets.

It seems that the Standard GUI and/or MapleNet have special handling for gridlines in the sense that they actually distinguish between PLOT structures generated without the `gridlines` option versus those created with `gridlines=false`.  I believe that this has something to do with the persistence of various plot qualities in an output region which (perhaps for historical reasons?)  allow re-execution of a plot input command to produce a plot output rendering that remembers whether gridlines are visible.

If the second plot below does indeed get rendered here in Primes without gridlines visible then one workaround is evident: adding `gridlines=false` instead of omitting the option.


plot(sin(x),x=-Pi..Pi);

plot(sin(x),x=-Pi..Pi,gridlines=false);

 


Download test.mw

I'll submit a bug report against MapleNet.

acer

Maple 18, document mode. Please try this:

>restart;
>some_long_name:=3:
>f(som)

Now, as the cursor is right after the "m" above, hiting the ESC key to autocomplete, nothing happens. Only a beep, meaning Maple does not know about the variable name I wanted to expand to, which is "some_long_name". What I do now is manually add a space by  pushing the ")" away, like this:

  f(som )

And now put the mouse back in front of the "m" and now hit ESC. Maple now can see the name I wanted.

Really? This is very bad design. You might ask, why did I close the () first? Well, I like to start by writing () then fill it in, or it can be that I am changing things, and wanted to write a new name, and the () was allready there. I use name autocomplete alot, and it is very annoying to not be able to use it if happens that there is a ")" or "]" right next to the name.

Having to keep pushing the ")" away, so that Maple can see the name makes no sense since ")" can't part of a name.

In Mathematica it just works. I can do

someLongName = 3;

Then in a new cell,

f[som] and hit CTRL-K  when mouse at the letter "m" just typed it in, and it will autocomplete.  I did not have to push "]" away first.

Please Maple, fix your user interface so it is less awkward and annoying to use. This is version 18 of the software, and not version 1.

 

A post to conjure up some interest.  Nasa seeks coders to hunt asteroids http://www.bbc.com/news/technology-26528516

Just going out on a limb here but any of the three M's would have a good chance here.  A good opportunity to create some code.  Maple could port it to C code then compiled for speed.  On a smaller scale it would be an interesting challenge.  On the larger scale not sure if Maple would be best suited for the task.  Opinions?

This is one of my favorite events of the year. When we launch a new release of Maple, I get to see the work of so many talented individuals at Maplesoft come together in a form that I am sure will delight, and maybe even surprise you.

We are holding true to our principles with Maple 18. Hundreds of new mathematical algorithms further strengthen a computational engine that will help you tackle your toughest challenges. The user interface experience continues to become smarter, allowing you to focus on getting results without fighting with syntax. Connectivity options are again becoming richer.

A personal favorite of mine is the newly enhanced Explore functionality, which allows you to, with a couple of clicks, go from a mathematical expression to an interactive Math App. Math Apps allow you to explore the parameter space of the expression, gain insight into its behavior and even, in conjunction with Maple T.A., produce a gradeable Möbius App that allows you to assess a student’s interaction with the app and hence their understanding of the underlying concepts. The expanded Explore functionality is just part of a collection of advancements in Maple 18 that support The Möbius Project.

Overall, the new features of Maple 18 are quite numerous and I won’t try to list them all here. However, I do want to mention a few areas that have received special attention:

  • Statistics: Maple 18 includes lots of enhancements to statistics computations and visualization, such as new time series functionality that allows you to find patterns, make forecasts, and visualize time-based data. For the classroom, a new Student Statistics package, together with a range of bundled Math Apps, provide a simplified and interactive environment for instructors and students alike.

  • Physics: This package for representing and computing with concepts from general relativity to quantum mechanics continues to grow by leaps and bounds, with over 500 enhancements just in this release alone. We are convinced that this is the best computational environment available for researchers in this area.

  • Engineering: Key enhancements for control analysis, signal processing, and code generation to Python and Perl are just a few of the new features that engineers will note and appreciate. There’s even import/export for STL graphics files, which, amongst other things, means you can now print out your favorite Maple plots on a 3-D printer!

I think you will agree that Maple 18 exemplifies all the effort and attention that we have put into it.  And there’s more to come - this release is just the start of a stream of product announcements that you can expect from us in the coming months. Stay tuned!

It is a relatively recent innovation that complex-number computations can be done in the evalhf environment. When combined with plots:-densityplot, this makes escape-time fractals in the complex domain very easy to plot. This fractal is based on the Collatz problem. This Wikipedia article has a high-resolution picture of this fractal. I've switched the real and imaginary axes and reversed the direction of the real axis purely for asthetic reasons.

 

Collatz:= proc(b,a)  #Axes switched
local z:= -a+b*I, k;  #real part negated
     for k to 31 while abs(Im(z)) < 1 do
          z:= (1+4*z-(1+2*z)*cos(Pi*z))/4
     end do;
     k #escape time
end proc:

#Test evalhf'ability:

evalhf(Collatz(0,1));

32.

plotsetup(
     jpeg, plotoutput= "C:/Users/Carl/desktop/Collatz.jpg",
     plotoptions="height= 1024, width= 1024, quality= 95"
);

 

CodeTools:-Usage(
     plots:-densityplot(
          Collatz,
          -1..1, # imaginary range
          -0.5..4.5, #negative of real range
          colorstyle= HUE, grid= [1024, 1024], style= patchnogrid,
          labels= [Im,-Re], labelfont= [TIMES, BOLD, 14],
          axes= boxed,
          caption= cat("      Happy New Year ",                  

                StringTools:-FormatTime("%Y")),
          captionfont= [HELVETICA, BOLDOBLIQUE, 18]
     )
);

memory used=24.08MiB, alloc change=24.00MiB, cpu time=7.78s, real time=7.79s

 

Download Collatz_fractal.mw

It would be nice if Maple had a procedure which could turn a procedurelist into a listprocedure.
I use these words in the sense they are used in dsolve/numeric.
Thus by a procedurelist I mean a procedure returning lists (of numbers).
By a listprocedure I mean a list of procedures all having the same formal parameters and each returning one number.
Thus a `convert/listprocedure`should accept a procedurelist p as input and give as output the corresponding listprocedure [p1,p2, ... pN] where N is the number of elements in the output from p.

I tried making a `convert/listprocedure` myself and in doing so found that it was not totally trivial.
I had lots of problems but did end up with something that seems to work.

convert-listprocedur.mw

But my main point is that Maple ought to have some such facility either as described available to the user or by changing fsolve, complexplot or what have you, so that procedurelists are accepted.

Hi all,

I seem to have triggered a nasty bug in Maple 17.  Consider the following code:

  BlahObject := module()
    option object;
    export BlahMethod := proc()
    local C, d, i;
      add(C[i]*d[i] + C[i], i=1..4);
    return NULL;
    end proc;
  end module;

It triggers a Maple kernel crash for me when doing object construction:

 B := Object(BlahObject);

The offending line is the one with add( ). It is ok if I add C[i]*d[i], but when the line contains both * and + it causes kernel death every time.  This is strange as the proc is not even being executed... only constructing the object. 

I am running Maple 17.02, it's also present in 17.01.  But interestingly, it runs fine in Maple 16.  Bug in Maple 17? 

Thanks,
Ian.

I can't post any Replies or Answers. It acts like they are being posted, but they just disappear. I've tried both in IE and Firefox.

There seems to be patterns for sin(10^-k) for rational k;

Here we have the "floats."

n sin(10^(-n-1/2))

1 0.03161750640

2 0.003162272390

3 0.0003162277607

4 0.00003162277660

5 0.000003162277660

6 0.0000003162277660

7 0.00000003162277660

 

More later on using the mantissa. You're welcome to join me.

I define a partial repeating decimal as shown in the following example: if you have the decimal expansion 0.1728394877777777777777777777771939374652819101093837... 7 is called a partial repeating decimal.  

Back in 2000 I noticed a pattern in the decimal expansions of sin(10^-n) for growing n. Here is table of some integer n:

n                sin(10^-n)

1 9.98334166*10^-2

Back in 2000 I published A034948A036663, and A036664 in Sloane's Integer Sequences, now OEIS.

But today I decided to find the exact values of some such quotients.

1/9801=0.repeating(000

100010203040506070809101112131415161718192021222324252627282930313233

I have a previous post on this, but the discussion completely missed the situation I was presenting.

The big problem is: The (vertical) writing cursor often does not move on the visible worksheet when a new location is clicked with the mouse or the arrow keys are used, and moving with the arrow keys often leaves a trail of writing cursors along the line between exisiting symbols. Luckily, Maple internally seems to know the correct (intended) location of the...

When I run "sum(a[1/k],k=1..n);", I get "Error, (in IntegerSub) too many levels of recursion". But it's OK to run "product(a[1/k],k=1..n);". Furthermore "Error, (in IntegerSub) too many levels of recursion" cannot be caught.

Jeff

First 8 9 10 11 12 13 14 Last Page 10 of 79