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
  • On some platforms, my editor of choice has become the aptly named Sublime Text. Unfortunately, it does not seem to have built in syntax highlighting for the Maple programming language and so I set out to write some.  In the end, I wrote enough highlighting to keep me sane when looking at Maple source, but it could use a lot more work.  So in case anyone is interested I've put what I have in a Github repository: SublimeTextMaple

    If you use Sublime Text, please download it and add your own enhacements and share in turn.

    I find it hard to believe when I enter the search term Maple 6 Maple 7 maple 8 etc.. old versions search prior to Maple 10 it only brings up a maximum of 4 pages.  I know there are more applications of old.  

    Are all applications still there and the search just not bringing them up?

    Let us consider 

    maximize(int(exp(-x^4), x = k .. 3*k), location);

    Error, (in maximize) invalid input: iscont expects its 1st argument, f, to be of type algebraic, but received x = k .. 3*k
    whereas the expected output is 

    [(2*((1/40)*GAMMA(1/4, (1/80)*ln(3))*5^(1/4)*ln(3)^(3/4)-(1/40)*GAMMA(1/4, (81/80)*ln(3))*5^(1/4)*ln(3)^(3/4)))*5^(3/4)*(1/ln(3))^(3/4), [k = (1/10)*10^(3/4)*ln(3)^(1/4)]]

    as Mma 11 produces. The following 

    RealDomain:-solve(diff(int(exp(-x^4), x = k .. 3*k), k));
      -(1/10)*5^(3/4)*ln(3)^(1/4), (1/10)*5^(3/4)*ln(3)^(1/4)

    is not a workaround because of 

    int(exp(-x^4), x = (1/10)*5^(3/4)*ln(3)^(1/4) .. (3/10)*5^(3/4)*ln(3)^(1/4));
      FAIL

     

    Let us consider 

    MultiSeries:-series(Psi((2*x+1)/(2*x))-Psi((x+1)/(2*x)), x = 0);
    
    x-(1/2)*x^2+(1/4)*x^4-(1/2)*x^6 +O(x^7)
    

    The above result contradicts 

    MultiSeries:-limit(diff(Psi((2*x+1)/(2*x))-Psi((x+1)/(2*x)), x), x = 0);
                               undefined
    MultiSeries:-limit((Psi((2*x+1)/(2*x))-Psi((x+1)/(2*x)))/x, x = 0, right);
                                   1
    MultiSeries:-limit((Psi((2*x+1)/(2*x))-Psi((x+1)/(2*x)))/x, x = 0, left);
                               undefined
    plot((Psi((2*x+1)/(2*x))-Psi((x+1)/(2*x)))/x, x = -0.1e-1 .. 0.1e-2, discont, y = -5 .. 5);
    

    Correct computatiton for

    for reasonable expressions f(x,y), g(x,y) would be very useful in double integrals.

    For the moment this is not possible. Too many bugs:

    int(Heaviside(1-x^2-y^2), x=-infinity..infinity, y=-infinity..infinity); #should be Pi
                               undefined
    int(Heaviside(1-x^2-y^2), x=-1..1, y=-1..1); #should be Pi
                                   0
    int(Heaviside(y-x^2), x=-1..1, y=-1..1); #should be 4/3
                                   -2

    int(Heaviside(y-x^2), y=-1..1, x=-1..1); #This one is OK!
                                  4/3

     

     

     

     

    restart; with(Statistics):
    X := RandomVariable(Normal(0, 1)): Y := RandomVariable(Uniform(-2, 2)):
    Probability(X*Y < 0);

    crashes my comp in approximately 600 s. Mma produces 1/2 on my comp in 0.078125 s.

    Let us consider

    with(Statistics):
    X1 := RandomVariable(Normal(0, 1)):
    X2 := RandomVariable(Normal(0, 1)):
    X3 := RandomVariable(Uniform(0, 1)): 
    X4 := RandomVariable(Uniform(0, 1)):
    Z := max(X1, X2, X3, X4); CDF(Z, t);
    
    int((1/2)*(_t0*Heaviside(_t0-1)-_t0*Heaviside(_t0)-Heaviside(1-_t0)*Heaviside(-_t0)+Heaviside(-_t0)+Heaviside(1-_t0)-1)*(1+erf((1/2)*_t0*2^(1/2)))*(2^(1/2)*Heaviside(_t0-1)*exp(-(1/2)*_t0^2)*_t0-2^(1/2)*Heaviside(_t0)*exp(-(1/2)*_t0^2)*_t0-2^(1/2)*Heaviside(-_t0)*Heaviside(1-_t0)*exp(-(1/2)*_t0^2)-Pi^(1/2)*undefined*erf((1/2)*_t0*2^(1/2))*Dirac(_t0)-Pi^(1/2)*undefined*erf((1/2)*_t0*2^(1/2))*Dirac(_t0-1)+2^(1/2)*Heaviside(-_t0)*exp(-(1/2)*_t0^2)+2^(1/2)*Heaviside(1-_t0)*exp(-(1/2)*_t0^2)-Pi^(1/2)*undefined*Dirac(_t0)-Pi^(1/2)*undefined*Dirac(_t0-1)+Pi^(1/2)*Heaviside(_t0-1)*erf((1/2)*_t0*2^(1/2))-Pi^(1/2)*Heaviside(_t0)*erf((1/2)*_t0*2^(1/2))-exp(-(1/2)*_t0^2)*2^(1/2)+Pi^(1/2)*Heaviside(_t0-1)-Pi^(1/2)*Heaviside(_t0))/Pi^(1/2), _t0 = -infinity .. t)

    whereas Mma 11 produces the correct piecewise expression (see that here screen15.11.16.docx).

    Edit. Mma output.

    Let us consider 

    J := int(x^n/sqrt(1+x^n), x = 0 .. 1) assuming n > 0;
    
    2*(2^(1/2)-hypergeom([1/2, 1/n], [(n+1)/n], -1))/(2+n)
    
    limit(J,n=infinity);
    FAIL
    MultiSeries:-limit(J,n=infinity);
    FAIL

    Mma 11 finds the limit is zero. Hope one feels the difference.

    Hi MaplePrimes,

    This YouTube video has a nice puzzle. 

    It is titled "Can you solve the locker riddle". 
    My first blush was to consider modular arithmatic
    https://www.youtube.com/watch?v=c18GjbnZXMw

    Here is a maple page -
    divisors_excercise.mw

    divisors_excercise.pdf

    Have a very fine rest of the day.

    Regards,
    Matt

     

    limit((x^2-1)*sin(1/(x-1)), x = infinity, complex);
    infinity-infinity*I
    MultiSeries:-limit((x^2-1)*sin(1/(x-1)), x = infinity, complex);
    infinity

    whereas the same outputs are expected. The help http://www.maplesoft.com/support/help/Maple/view.aspx?path=infinity&term=infinity does not shed light on the problem. Here are few pearls:

    • infinity is used to denote a mathematical infinity, and hence it is usually used as a symbol by itself or as -infinity.
    • The quantities infinity, -infinity, infinity*I, -infinity*I, infinity + y*I, -infinity + y*I, x + infinity*I and x - infinity*I, where x and y are finite, are all considered to be distinct in Maple. However, all 2-component complex numerics in which both components are infinity are considered to be the same (representing the single point at the "north pole" of the Riemann sphere).
    • The type cx_infinity can be used to recognize this "north pole" infinity.

    This MaplePrimes guest blog post is from Dr. James Smith, an Assistant Lecturer in the Electrical Engineering and Computer Science Department of York University’s Lassonde School of Engineering. His team has been working with Maplesim to improve the design of assistive devices.

    As we go through our everyday lives, we rarely give much thought to the complex motions and movements our bodies go through on a regular basis. Motions and movements that seem so simple on the surface require more strength and coordination to execute than we realize. And these are made far more difficult as we age or when our health is in decline. So what can be done to assist us with these functions?

    In recent years, my research team and I have been working on developing more practical and streamlined devices to assist humans with everyday movements, such as standing and sitting. Our objective was to determine if energy could be regenerated in prosthetic devices during these movements, similar to the way in which hybrid electric vehicles recover waste heat from braking and convert it into useable energy.

    People use – and potentially generate – more energy than they realize in carrying out common, everyday movements. Our research for this project focused on the leg joints, and investigated which of the three joints (ankle, knee or hip) was able to regenerate the most energy throughout a sitting or standing motion. We were confident that determining this would lead to the development of more efficient locomotive devices for people suffering from diseases or disabilities affecting the muscles around these joints.

    In order to identify the point at which regenerative power is at its peak, we determined that MapleSim was the best tool to help us gather the desired data. We took biomechanical data from actual human trials and applied them to a robotic model that mimics human movements when transitioning between sitting and standing positions. We created models to measure unique movements and energy consumption at each joint throughout the identified movements to determine where the greatest regeneration occurred.

    To successfully carry out our research, it was essential that we were able to model the complex chemical reactions that occur within the battery needed to power the assistive device. It is a challenge finding this feature in many engineering software programs and MapleSim’s battery modeling library saved our team a great deal of time and effort during the process, as we were able to use an existing MapleSim model and simply make adjustments to fit our project.

    Using MapleSim, we developed a simplified model of the human leg with a foot firmly planted on the ground, followed by a more complex model with a realistic human foot that could be raised off the ground. The first model was used to create a simplified model-based motion controller that was then applied to the second model. The human trials we conducted produced the necessary data for input into a multi-domain MapleSim model that was used to accurately simulate the necessary motions to properly analyze battery autonomy.

    The findings that resulted from our research have useful and substantial applications for prostheses and orthoses designs. If one is able to determine the most efficient battery autonomy, operation of these assistive devices can be prolonged, and smaller, lighter batteries can be used to power them. Ultimately, our simulations and the resulting data create the possibility of more efficient devices that can reduce joint loads during standing to sitting processes, and vice versa.

    Let us consider 

    MmaTranslator:-FromMma(" Table[0,{n=10},{m=2}]");
    
    [seq([seq(0,i=1..(m := 2))],j=1..(n := 10))]
    

    The above result is syntactically incorrect in Maple language. The translation should be 

    Matrix(10,2)
    #or
    [seq([seq(0,i=1.. 2)],j=1..10)]

    up to the Mmma's result

    Table[0, {n = 10}, {m = 2}]
    
    {{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0,0}, {0, 0}}

    Another bug is as follows.

    MmaTranslator:-FromMma("Sinc[x]");
    
    Sinc(x)

    whereas the expected result is piecewise(x=0,1,sin(x)/x) up to http://reference.wolfram.com/language/ref/Sinc.html

    In general, the MmaTranslator package is outdated. It often returns working Mma's commands as incorrect (Concrete examples are long and need a context. These may be exposed on demand.). The question arises about the quality of other Maple translations. 

    The command

    plots:-implicitplot(evalc(argument((1+x+I*y)/(1-x-I*y))) <= (1/4)*Pi, x = -5 .. 5, y = -5 .. 5, crossingrefine = 1, gridrefine = 2, rational = true, filled, signchange = true, resolution = 1000);
    

    produces an incorrect result

    in view of

    evalf(argument((1-4+4*I)/(1+4-4*I)));
                              2.889038378
    

    There is a workaround 

    plots:-inequal(evalc(argument((1+x+I*y)/(1-x-I*y))) <= (1/4)*Pi, x = -5 .. 5, y = -5 .. 5);

     

    The command 

    restart; st := time(): FunctionAdvisor(EllipticE); time()-st;

    produces the result on my comp in 805.484 s. Too much time.

    The command

    J := int(sin(x)/(x*(1-2*a*cos(x)+a^2)), x = 0 .. infinity)assuming a::real,a^2 <>0;

    outputs 

    (infinity*I)*signum(a^3*(Sum(a^_k1, _k1 = 0 .. infinity))-a^2*(Sum(a^_k1, _k1 = 0 .. infinity))-a*(Sum(a^(-_k1), _k1 = 0 .. infinity))+a^2+Sum(a^(-_k1), _k1 = 0 .. infinity)+a)

    which is wrong in view of 

    evalf(eval(J, a = 1/2));
                           Float(undefined) I

    The correct answer is Pi/(4*a)*(abs((1+a)/(1-a))-1) according to G&R 3.792.6. Numeric calculations confirm it.

    5 6 7 8 9 10 11 Last Page 7 of 251