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
  • John Fredsted suggested using the following procedure (slightly modified) to determine whether an expression was deeply algebraic.

    isDeeplyAlgebraic := proc(x)
    	if not type(x,'algebraic') then false
    	elif type(x,'atomic') then true
    	else andmap(procname,x)
    	end if
    end proc:
    TypeTools:-AddType('DeeplyAlgebraic1'
                       , proc(x)
                             if not x :: 'algebraic' then false;
                             elif x :: 'atomic' then true;
                             else andmap(type,x,'DeeplyAlgebraic1');
                             end if;
                         end proc);
    

    The first is a completely flat expression, the second is deeply nested.  The following graphs plot the time required to determine whether each expression is "deeply algebraic" as n increases, with each approach. The graph on the left is the time required to evaluate expr1, the graph on right is for expr2.  The red plot corresponds to the procedure, the green plot corresponds to the type. As you can see, for both flat and nested expressions, the procedure is significantly faster than the type.

     

    I then did some testing to see whether the type matching could be improved.  A more efficient use of the type mechanism is to use a structured type rather than a procedure.  Alas, I don't believe that it is possible to create a purely structured type, with no use of 'satisfies', that is equivalent to what we want.  Here is the best I could come up

    TypeTools:-AddType('DeeplyAlgebraic3'
                       , 'And'('algebraic'
                               , 'Or'('atomic'
                                      , 'satisfies'(x->andmap(type,x,'DeeplyAlgebraic3'))
                                     )));
    

    Adding that to each graph gives the following two plots

     

    The yellow line (p3) corresponds to this new type.  For expr1, the flat expression, it is significantly faster than the previous type, and approaches the speed of the standalone procedure.  Alas, for expr2, the nested expression, it is even slower than the previous type.  However, the reason it is slower is that with a nested expression the 'satisfies' part of the type has to be evaluated, which generates a call to a user-level procedure.

    This observation suggests that if the type could be expressed as a structured type, with no use of 'satisfies', it might be significantly more efficient.  While I can see no way to do that with the desired predicate, it is possible to construct a type specific to these two examples:

    TypeTools:-AddType('nestedF', 'And(algebraic,Or(atomic,function(Or(atomic,nestedF))))');

    This isn't equivalent to the original predicate because it only works with functions, not operators (+, *, etc).

    Here are the results with that type

    Now we are making progress.  The blue plot (p4) is the time for this restricted type.  It is significantly faster than even the standalone procedure.

    Note that if there were a structured type, say allops, that returned true if all of the operands of an expression match the given type, then we would be able to construct a purely structured type that matches our original predicate, that is,

    TypeTools:-AddType('DeeplyAlgebraic4'
                       , 'And(algebraic
                              , Or(atomic
                                   , allops(DeeplyAlgebraic4)))');
    

    My humble work - CubicRubik Maplet. Interactive Game of ordering CubicRubik.

    To run it - download library from http://www.mapleprimes.com/files/8024_CubicRubik.mla/a>

    The recent thread A crossprod problem, although not directly related, inspired me to write this blog entry about bilinear cross products and their noticable property [see for instance P. Lounesto, Clifford Algebras and Spinors, 2nd ed. (Cambridge University Press, Cambridge, 2001)]:

    Theorem: A bilinear cross product obeying the orthogonality property and the Pythagorean property, see below, exists only in 3 or 7 (real or complex) dimensions.

    Maybe I'm confused, but shouldn't these two operations yield the same result:

     

    int(-1/P-(1/10)/(.9*P+900), P)

    int(-1/P-1/(10*(.9*P+900)), P)

     

    I want to plot the normal vector of the Mobius strip represented by the parametric equations:
    x=(2+u*cos(v/2))*cos(v):

    What could be done with a module whose ModuleLoad routine redefined itself?

    Could such a routine do some action, and then cover its tracks effectively by overwriting itself?

    Would there be any way to use march() to examine the .mla archive member, in which that ModuleLoad routine is stored, without accessing the name of the module? Presumably any invocation of the actual module name would result in its being accessed from the library and hence trigger its ModuleLoad routine.

    This new MaplePrimes editor is not so bad as I feared. It has some quirks, to be sure. Would it be possible to add a toggle between normal and monospace text?  That would simplify the task of writing readable Maple input code, that is, it would eliminate the need to scroll the Format box.

    Maple's foldl and foldr procedures provide a convenient means to generate an n-ary function from a binary operator. For example, from another thread, one can use foldl to create an n-ary and procedure from Maple's binary `and` function:

    In his book UNKNOWN QUANTITY, on page 257, John Derbyshire presents the 4th degree polynomial

    4*(x^2+y^2-2*x)^2+((x^2-y^2)(x-1))(2*x-3) = 0

    which plots as the beautiful "Ampersand Curve"

    When I tried to do this in Maple 11, with a 2D Implicit Plot, the plot was broken, discontinuous, and different when I tried again.

     

    Is this beyond Maple's capability, or can someone suggest what I may have done inadvertantly incorrect?

    In working out the procedure isDeeplyAlgebraic in the post Deeply algebraic, I was trying to use something like `and` and `or`, analogously to `+`, `*`, `.`, etc.

    There are some routines in Maple's library which, when called the first time, redefine themselves.

    One plausible explanation for this is that the new versions are session dependent (external calls, say) while also more efficient to call (repeatedly).

    For example, consider StringTools:-Join which seems typical of that package. First, consider it before it's been called at all.

    > restart:
    > showstat(StringTools:-Join);
     
    StringTools:-Join := proc(...

    In the thread An easy way to plot the region between two curves there are several pictures which are externally stored, i.e., they have not been uploaded to mapleprimes, but instead the sources of the images point to some outside site.

    That should work, I think, but it does not, at least not where I am sitting. I see some Chinese looking art with http://blog.163.com/ (the external site at which they are stored, I assume) at the bottom of each picture.

    In Maple we can easily plot a space curve if it is given by a parametric form:

    x=x(t), y=y(t), z=z(t) (t=a..b).

    However, Maple does not give a easy way to plot a space curve if it is given by the intersection of two surfaces:
    F(x,y,z)=0, G(x,y,z)=0.

     So, I wonder if there are easy ways to solve this plotting problem?

    For example, I'd like to know how to plot the following space curve In Maple :
    x^2+y^2+3*z^2=1, 2*x+3*y+z=0.

    BUG 1:

    Severity: Medium-High

    Reproduction #1:
    >with(Student([Calculus1]));

    IntTutor;

    Try to enter "csc(x)^3" in "function", and let variable to be "x"

    Click all steps, and watch the system freezes.
    Or yo can click "Next Step", which won't change the integrand at all, you may click 100000000 times -- the program is in an infinite loop.

    Hi! I'm a Maple Newbie trying to use the Maple Training Videos.

    They all work fine except for two, under Algebra: "Solving Equations" and "Working with Matrices". Both start OK, then die a few seconds in.

    I'm using Kubuntu Linux, but I really don't think that that is the problem, since all the other videos work fine.

    Could someone try these for me to verify if they work for you?

    Thanks in advance for any help.

     

    First 214 215 216 217 218 219 220 Last Page 216 of 312