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
  • Maple strings contain extended ASCII characters (codes 1..255). 
    The international characters such as  î, ș, Å, Ø ,Ă, Æ, Ç are multi-byte encoded. They are ignored by the Maple engine but are known to the user interface which uses the UTF-8 encoding.
    The package StringTools does not support this encoding. However it is not difficult to manage these characters using Python commands (included in the Maple distribution now).
    Here are the UTF-8 versions of the Maple procedures length and substring.
    You may want to improve these procedures, or to add new ones (my knowledge of Python is very limited).

    LEN:=proc(s::string) Python:-EvalFunction("len",s) end proc:
    
    SS:=proc(s::string, mn::{integer, range(({integer,identical()}))})
      local m,n;
      if type(mn,integer) then m,n := mn$2 else m:=lhs(mn); n:=rhs(mn) fi; 
      if m=NULL then m:=1 fi; if n=NULL then n:=-1 fi;
      if n=-1 then n:=LEN(s) elif n<0 then n:=n+1 fi;
      if m=-1 then m:=LEN(s) elif m<0 then m:=m+1 fi;
      Python:-EvalString(cat("\"",  s, "\"", "[", m-1, ":", n, "]"  ));
    end proc:
    

    LEN("Canada"), length("Canada");
                                  6, 6

    s:="România":
    LEN(s), length(s);
                                  7, 8

    SS(s, 1..), SS(s, 1..-3), SS(s, 1..1), SS(s, -7..2), SS(s,1), SS(s,-1); 
                "România", "Român", "R", "Ro", "R", "a"

    Hi Mapleprimes,

    Per your request.

    A_prime_producing_quadratic_expression_2019_(2).pdf

    bye

     

    Download FeynmanIntegrals.mw

    Edgardo S. Cheb-Terrab
    Physics, Differential Equations and Mathematical Functions, Maplesoft

    diff(abs(z), z)  returns abs(1, z)  and the latter, for a numeric z, is defined only for a nonzero real z.
    However,  functions such as abs(I+sin(t)) are (real) differentiable for a real t and diff should work. It usually does, but not always.

    restart
    f:= t -> abs(GAMMA(2*t+I)):  # We want D(f)(1)
    D(f)(1): 
    evalf(%);  # Error, (in simpl/abs) abs is not differentiable at non-real arguments
    D(f)(1); simplify(%); 
    evalf(%);   # 0.3808979508 + 1.161104935*I,  wrong
    

    The same wrong results are obtained with diff instead of D

    diff(f(t),t):   # or  diff(f(t),t) assuming t::real; 
    eval(%,t=1);
    simplify(%); evalf(%);   # wrong, should be real
    

    To obtain the correct result, we could use the definition of the derivative:

    limit((f(t)-f(1))/(t-1), t=1); evalf(%); # OK 
    fdiff(f(t), t=1);    # numeric, OK
    

       

           0.8772316598
           0.8772316599

    Note that abs(1, GAMMA(2 + I)); returns 1; this is also wrong, it should produce an error because  GAMMA(2+I) is not real;
     

    Let's redefine now `diff/abs`  and redo the computations.

    restart
    `diff/abs` := proc(u, z)   # implements d/dx |f(x+i*y|) when f is analytic and f(...)<>0
    local u1:=diff(u,z);
    1/abs(u)*( Re(u)*Re(u1) + Im(u)*Im(u1) )
    end:
    f:= t -> abs(GAMMA(2*t+I));
    D(f)(1); evalf(%);   # OK now
    

                   

             0.8772316597

    Now diff works too.

    diff(f(t),t);
    eval(%,t=1);
    simplify(%); evalf(%);   # it works
    

    This is a probably a very old bug which may make diff(u,x)  fail for expressions having subespressions abs(...) depending on x.

    However it works  using assuming x::real, but only if evalc simplifies u.
    The problem is actually more serious because diff/ for Re, Im, conjugate should be revized too. Plus some other related things. 

    The Putnam 2020 Competition (the 81st) was postponed to February 20, 2021 due to the COVID-19 pandemic, and held in an unofficial mode with no prizes or official results.

    Four of the problems have surprisingly short Maple solutions.
    Here they are.

    A1.  How many positive integers N satisfy all of the following three conditions?
    (i) N is divisible by 2020.
    (ii) N has at most 2020 decimal digits.
    (iii) The decimal digits of N are a string of consecutive ones followed by a string of consecutive zeros.

    add(add(`if`( (10&^m-1)*10&^(n-m) mod 2020 = 0, 1, 0), 
    n=m+1..2020), m=1..2020);
    

           508536

     

    A2.  Let k be a nonnegative integer.  Evaluate  

    sum(2^(k-j)*binomial(k+j,j), j=0..k);
    

            4^k

     

    A3.  Let a(0) = π/2, and let a(n) = sin(a(n-1)) for n ≥ 1. 
    Determine whether the series   converges.

    asympt('rsolve'({a(n) = sin(a(n-1)),a(0)=Pi/2}, a(n)), n, 4);
    

                

    a(n) ^2 being equivalent to 3/n,  the series diverges.

     

    B1.  For a positive integer n, define d(n) to be the sum of the digits of n when written in binary
     (for example, d(13) = 1+1+0+1 = 3). 

    Let   S =  
    Determine S modulo 2020.

    d := n -> add(convert(n, base,2)):
    add( (-1)^d(k) * k^3, k=1..2020 ) mod 2020; 
    

            1990

     

    Presenters:

    Affiliated Research Professor Mohammad Khoshnevisan

    Physics Department, Northeastern University

    United States of America

    &

    Behzad Mohasel Afshari, Admitted Ph.D. student

    School of Advanced Manufacturing & Mechanical Engineering

    University of South Australia

    Australia

    Note: This webinar is free. For registration, please send an e-mail to m.khoshnevisan@ieee.org. The registration link will be sent to all the participants on April 26, 2021. Maximum number of participants =60

     

    Vibrational Mechanics - Practical Applications- Animation 1

    Vibrational Mechanics - Practical Applications- Animation 2

    Vibrational Mechanics - Practical Applications- Animation 3

    I’m very pleased to announce that the Maple Calculator app now offers step-by-step solutions. Maple Calculator is a free mobile app that makes it easy to enter, solve, and visualize mathematical problems from algebra, precalculus, calculus, linear algebra, and differential equations, right on your phone.  Solution steps have been, by far, the most requested feature from Maple Calculator users, so we are pretty excited about being able to offer this functionality to our customers. With steps, students can use the app not just to check if their own work is correct, but to find the source of the problem if they made a mistake.  They can also use the steps to learn how to approach problems they are unfamiliar with.

    Steps are available in Maple Calculator for a wide variety of problems, including solving equations and systems of equations, finding limits, derivatives, and integrals, and performing matrix operations such as finding inverses and eigenvalues.

    (*Spoiler alert* You may also want to keep a look-out for more step-by-step solution abilities in the next Maple release.)

    If you are unfamiliar with the Maple Calculator app, you can find more information and app store links on the Maple Calculator product page.  One feature in particular to note for Maple and Maple Learn users is that you can use the app to take a picture of your math and load those math expressions into Maple or Maple Learn.  It makes for a fast, accurate method for entering large expressions, so even if you aren’t interested in doing math on your phone, you still might find the app useful.

    I make a maple worksheet for generating Pythagorean Triples Ternary Tree :

    Around 10,000 records in the matrix currently !

    You can set your desire size or export the Matrix as text ...

    But yet ! I wish to understand from you better techniques If you have some suggestion ?

    the mapleprimes Don't load my worksheet for preview so i put a screenshot !

    Pythagoras_ternary.mw

    Pythagoras_ternary_data.mw

    Pythagoras_ternary_maple.mw

     

     

     

                We announce the release of a new book, of title Fourier Transforms for Chemistry, which is in the form of a Maple worksheet.  This book is freely available through Maple Application Centre, either as a Maple worksheet with no output from commands or as a .pdf file with all output and plots.

                This interactive electronic book in the form of a Maple worksheet comprises six chapters containing Maple commands, plus an overview 0 as an introduction.  The chapters have content as follows.

      -   1    continuous Fourier transformation

      -   2    electron diffraction of a gaseous sample

      -   3    xray diffraction of a crystal and a powder

      -   4    microwave spectrum of a gaseous sample

      -   5    infrared and Raman spectra of a liquid sample

      -   6    nuclear magnetic resonance of various samples

                This book will be useful in courses of physical chemistry or devoted to the determination of molecular structure by physical methods.  Some content, duly acknowledged, has been derived and adapted from other authors, with permission.

    Hi all,

    Look at my pretty plot.  It is defined by

    x=sin(m*t);
    y=sin(n*t);

    where n and m are one digit positive integers.

    You can modify my worksheet with different values of n and m.

    pillow_curve.mw

    pillow_curve.pdf

    The name of the curve may be something like Curve of Lesotho.  I saw this first in one of my father's books.

    Regards,
    Matt

     

    This doc is just an example for uploading with my post.

    DocumentsAttachmentUsingLinks_in_MaplePrimes_Post.mw

    The above doc/worksheet can be clicked and viewed.

    Youtube URL is given below. This also can be clicked and viewed. Thanks to Carl Love's suggestion, I modified using the chain link in the editor.

    https://youtu.be/0pDa4FWMSQo

     

     

     

     

     

    Hello Congratulations on the great product! Isn't time time Maple got a dark theme for us night owls ! Thanx

    The order in which expressions evaluate in Maple is something that occasionally causes even advanced users to make syntax errors.

    I recently saw a single line of Maple code that provided a good example of a command not evaluating in the order the user desired.

    The command in question (after calling with(plots):) was

    animate(display, [arrow(<cos(t), sin(t)>)], t = 0 .. 2*Pi)

    This resulted in the error:

    Error, (in plots/arrow) invalid input: plottools:-arrow expects its 3rd argument, pv, to be of type {Vector, list, vector, complexcons, realcons}, but received 0.5000000000e-1*(cos(t)^2+sin(t)^2)^(1/2)
     

    This error indicates that the issue in the animation is the arrow command

    arrow(<cos(t), sin(t)>)

    on its own, the above command would give the same error. However, the animate command takes values of t from 0 to 2*Pi and substitutes them in, so at first glance, you wouldn't expect the same error to occur.

    What is happening is that the command 

    arrow(<cos(t), sin(t)>)

    in the animate expression is evaluating fully, BEFORE the call to animate is happening. This is due to Maple's automatic simplification (since if this expression contained large expressions, or the values were calculated from other function calls, that could be simplified down, you'd want that to happen first to prevent unneeded calculation time at each step).

    So the question is how do we stop it evaluating ahead of time since that isn't what we want to happen in this case?

    In order to do this we can use uneval quotes (the single quotes on the keyboard - not to be confused with the backticks). 

    animate(display, ['arrow'(<cos(t), sin(t)>)], t = 0 .. 2*Pi)

    By surrounding the arrow function call in the uneval quotes, the evaluation is delayed by a level, allowing the animate call to happen first so that each value of t is then substituted before the arrow command is called.

    Maple_Evaluation_Order_Example.mw

    Download pendulumprojection.mw

    Most of the time in multivariable calculus the vectors we are decomposing with respect to a given direction are attached to a specific point and this "orthogonal decomposition" should be visualized as a triplet of vectors with initial point at that given point such that the two projections sum to the original vector. Keep in mind our high school physics pendulum example where we need to evaluate both the component of the downward gravitational force along the tangential direction of motion of the pendulum for the equations of motion as well as along the perpendicular direction to the motion to evaluate the tension in the string or wire holding the pendulum mass.

    We create an Explorable graphic to visualize this idea and then create an animation which requires a bit of Maple expert user knowledge to accomplish (thanks Maplesoft!). A delayed evaluation of the arrow command from the plot package is required in order to animate that arrow so that it waits for the animation command to feed it actual numerical values for the vector to be plotted.

    My worksheet URL:
    http://www34.homepage.villanova.edu/robert.jantzen/courses/mat2500/handouts/pendulumprojection.mw

    3 4 5 6 7 8 9 Last Page 5 of 281