MaplePrimes Posts

MaplePrimes Posts are for sharing your experiences, techniques and opinions about Maple, MapleSim and related products, as well as general interests in math and computing.

Latest Post
  • Latest Posts Feed
  • I created a procedure over a year ago to collect earthquake data from the usgs and save it into a file. The procedure pulls data off the internet and saves it in a text file with a date stamp (minus the year - because I haven't been bothered to change it ) in the folder location f:/7 day earthquakes.  Feel free to modify it as you wish.  Here it is, pretty much still in it's original format when I created it.

    earthquakedatasave := proc ()
      local a, b, c, d, e, i:

    Dr. Gilbert Lai is a mentor for the FIRST Robotics team SWAT 771. He is helping an all girls team from grades 7-12 design a basketball-shooting robot for this year’s annual FIRST Robotics Competition. Dr. Lai is using MapleSim and Maple to help the team understand the principles involved and design their robot. This blog post is part of a series that chronicles the progress of the team.  Posts in the series include:

    • Part 1 - 

    Ukaine-2012. External independent evaluation. A trial version in Maple, by Maple.
    HTML, Java-Interactive:
    http://webmath.exponenta.ru/zno_11/ranok/z.html
    Maple:2012_ranok_ru_bez.mw

    I was trying to put together a series of plots that each included multiple dataseries.  I wanted to color them to help distinguish the various curves.  When I went into Maple's help page for the "colornames" that Maple recognizes, I was surprised to find that there were no color swatches to help you pick what color you wanted to use.  So I copied the color names from the help into a worksheet and told it to plot some color swatches for me. Here is the result:

    MapleColors.mw 

     

    Note that the fixed width web page is cutting off two columns of colors.  Click the image to see the whole set of colors.

     

     

     

     

    Check this:

    111.mw

    Don't forget set Plot0 component manipulator to "Click and Drag" to test "on click" event. Localizing of problem takes for me ~4 days. It's terrible!

     

    ---------for stupid tags

    global

    The directional derivative of a scalar function f(x), computed in the direction u in Cartesian coordinates, is defined by

    Suppose that you wish to animate the whole view of a plot. By whole view, I mean that it includes the axes and is not just a rotation of a plotted object such as a surface.

    One simple way to do this is to call plots:-animate (or plots:-display on a list of plots supplied in a list, with its `insequence=true` option). The option `orientation` would contain the parameter that governs the animation (or generates the sequence).

    But that entails recreating the same plot each time. The plot data might not even change. The key thing that changes is the ORIENTATION() descriptor within each 3d plot object in the reulting data structure. So this is inefficient in two key ways, in the worst case scenario.

    1) It may even compute the plot's numeric results, as many times as there are frames in the resulting animation.

    2) It stores as many instances of the grid of computed numeric data as there are frames.

    We'd like to do better, if possible, reducing down to a single computation of the data, and a single instance of storage of a grid of data.

    To keep this understandable, I'll consider the simple case of plotting a single 3d surface. More complicated cases can be handled with revisions to the techniques.

    Avoiding problem 1) can be done in more than one way. Instead of plotting an expression, a procedure could be plotted, where that procedure has `option remember` so that it automatically stores computed results an immediately returns precomputed stored result when the arguments (x and y values) have been used already.

    Another way to avoid problem 1) is to generate the unrotated plot once, and then to use plottools:-rotate to generate the other grids without necessitating recomputation of the surface. But this rotates only objects in the plot, and does alter the view of the axes.

    But both 1) and 2) can be solved together by simply re-using the grid of computed data from an initial plot3d call, and then constructing each frame's plot data structure component "manually". The only thing that has to change, in each, is the ORIENTATION(...) subobject.

    At 300 frames, the difference in the following example (Intel i7, Windows 7 Pro 64bit, Maple 15.01) is a 10-fold speedup and a seven-fold reduction is memory allocation, for the creation of the animation structure. I'm not inlining all the plots into this post, as they all look the same.

    restart:
    P:=1+x+1*x^2-1*y+1*y^2+1*x*y:
    
    st,ba:=time(),kernelopts(bytesalloc):
    
    plots:-animate(plot3d,[P,x=-5..5,y=-5..5,orientation=[A,45,45],
                           axes=normal,labels=[x,y,z]],
                   A=0..360,frames=300);
    
    time()-st,kernelopts(bytesalloc)-ba;
    
                                    1.217, 25685408
    
    restart:
    P:=1+x+1*x^2-1*y+1*y^2+1*x*y:
    
    st,ba:=time(),kernelopts(bytesalloc):
    
    g:=plot3d(P,x=-5..5,y=-5..5,orientation=[-47,666,-47],
              axes=normal,labels=[x,y,z]):
    
    plots:-display([seq(PLOT3D(GRID(op([1,1..2],g),op([1,3],g)),
                               remove(type,[op(g)],
                                      specfunc(anything,{GRID,ORIENTATION}))[],
                               ORIENTATION(A,45,45)),
                        A=0..360,360.0/300)],
                   insequence=true);
    
    time()-st,kernelopts(bytesalloc)-ba;
    
                                    0.125, 3538296
    

    By creating the entire animation data structure manually, we can get a further factor of 3 improvement in speed and a further factor of 3 reduction in memory allocation.

    restart:
    P:=1+x+1*x^2-1*y+1*y^2+1*x*y:
    
    st,ba:=time(),kernelopts(bytesalloc):
    
    g:=plot3d(P,x=-5..5,y=-5..5,orientation=[-47,666,-47],
              axes=normal,labels=[x,y,z]):
    
    PLOT3D(ANIMATE(seq([GRID(op([1,1..2],g),op([1,3],g)),
                               remove(type,[op(g)],
                                      specfunc(anything,{GRID,ORIENTATION}))[],
                               ORIENTATION(A,45,45)],
                        A=0..360,360.0/300)));
    
    time()-st,kernelopts(bytesalloc)-ba;
    
                                    0.046, 1179432                            
    

    Unfortunately, control over the orientation is missing from Plot Components, otherwise such an "animation" could be programmed into a Button. That might be a nice functionality improvement, although it wouldn't be very nice unless accompanied by a way to export all a Plot Component's views to GIF (or mpeg!).

    The above example produces animations each of 300 frames. Here's a 60-frame version:

    The cost of some mathematical sites (estimated bizinformation.org):
     8.000.000 $ - wolfram.com
       372.456 $ - webmath.exponenta.ru (Russian Maple in education)
       292.301 $ - maplesoft.com

        82.342 $ - exponenta.ru
        61.278 $ - webmath.ru
        54.895 $ - math.ege
        43.302 $ - univ.kiev.ua (Kiev National University)

    Problems concerning integration have been discussed on  maple primes  before with piecewise continuous antiderivatives explaining  difficulties. Here an example is given using Maple 15 where a continuous antiderivative is returned but definite integration fails to give the correct answer.

    Integration_anomal.mw


    Let c=MRB constant -1/2

    In case if you like notepad++  under windows, and still didn't do smth like that then this is for you .userDefineLang.zip

    Unpack to notepad++ folder. In case if you already had had other
    own language then just copy "Maple language" section.

    I have below outlined the different probabilities for different poker hands given
    5 cards from a 52 cards deck. The frequencies are from wikipedia
    http://en.wikipedia.org/wiki/Poker_probability




    These frequencies are quite interesting....I wonder if they found them by "brute fource"

    I have contributed another application to the Application Center: "Street-fighting Math".
    This interactive Maple document contains a simple street-fighting game and performs a
    mathematical analysis of it, involving probability and game theory. 

     

     

     

    ``

    restart; Digits := 64

    ``

     

    ````Define s as the following function involving a divergent series.

    s := proc (x) options operator, arrow; sum((-1)^n*n^(1/n), n = 1 .. x) end proc

    proc (x) options operator, arrow; sum((-1)^n*n^(1/n), n = 1 .. x) end proc

    (1)

    ``

    ``

     

     

    ``The upper limit point of the partial sums, of s is very slowly convergent.

    evalf(s(100))

    .211329543346941069485035868216520490712148674852018130412747187

    (2)

    evalf(s(1000))

    .191323989712141370638688981469071803275457219110707245455878532

    (3)

    evalf(s(10000))

    .188320351076950504638897789942367214051161086517598649780487746

    (4)

     

    ``

    Let mrb be tthe upper limit point of s as x goes to infinity.

    ``

    mrb := evalf(sum((-1)^n*(n^(1/n)-1), n = 1 .. infinity))

    .1878596424620671202485179340542732300559030949001387861720046841

    (5)

    ``

    ``

    ``

     

    Define f as the following function involving the divergnet series sum((-1)^n*(n^(a/n)-a), n = 1 .. infinity).NULL

    ``

    ``

    f := proc (a) options operator, arrow; sum((-1)^n*(n^(a/n)-a), n = 1 .. infinity) end proc

    proc (a) options operator, arrow; sum((-1)^n*(n^(a/n)-a), n = 1 .. infinity) end proc

    (6)

    ``

    ``

     

     

    ``Let c be the value for a in the neighborhood of 26 such that f(a)=mrb.

    c := fsolve(eval(f(x)) = mrb, x = 26)

    25.71864739101744668471488151161460875040712539231550975094037406

    (7)

    ``

    ``

     

    ``The average of the upper and lower limit points of the partil sums of f converges much faster than the  upper limit point of the partial sums of s.

    evalf((sum((-1)^n*(n^(c/n)-c), n = 1 .. 100)+sum((-1)^n*(n^(c/n)-c), n = 1 .. 101))*(1/2))

    .195238896203546569611605945649919224928195587923897718988014700

    (8)

    evalf((sum((-1)^n*(n^(c/n)-c), n = 1 .. 1000)+sum((-1)^n*(n^(c/n)-c), n = 1 .. 1001))*(1/2))

    .187904922391719396683391551158554482265830937732923110694243700

    (9)

    evalf((sum((-1)^n*(n^(c/n)-c), n = 1 .. 10000)+sum((-1)^n*(n^(c/n)-c), n = 1 .. 10001))*(1/2))

    .187860182910509428926222275077446745338505139578191116998518780

    (10)

     

    Download Jan72012.mw

    A recent Tips and Techniques article in the Maple Reporter contained the following five "gems" from my Red Book of Maple Magic. These 'gems' are tricks and techniques for Maple that I've discovered in my years here at Maplesoft. The previous 15 gems have appeared in three other issues of the Reporter, as...

    First 112 113 114 115 116 117 118 Last Page 114 of 307