Carl Love

Carl Love

28020 Reputation

25 Badges

12 years, 300 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

@AlexeyK I guess that you haven't read and "digested" my Answer yet. Everything that you mentioned in the above Reply (except the PS) is done by the little command at the end of my Answer:

map(UV@unapply, F, Z);

Regarding "How do you format window with Maple code?": Are you referring to here, on MaplePrimes, or within Maple itself? On MaplePrimes, use the tool on the toolbar "<>". It's to the right of the 2 A's. In Maple itself, go to the Insert menu and select Code Edit Region.

@mmcdara Do you have any reason to believe that the Question by @panke was deleted by anyone other than its own author?
 

@mmcdara @Christopher2222 I think that both of you are failing to recognize the distinction between Moderators and Administrators. 

Moderator is any user of sufficiently high reputation who has been given the ability to edit and/or delete any material, regardless of its author. There are currently 85 Moderators, although that includes many who haven't used MaplePrimes in years. And I would guess that the majority of those 85 have never used their Moderator powers, except perhaps to delete spam.

An Administrator is an employee of MapleSoft who is tasked with maintaining this website. Administrators can retreive deleted material (I'm not sure of the details of that). I am only aware of one Administrator, @Bryon (Bryon Thur).

Several prominent "serious information" websites, including Wikipedia and StackExchange, use ordinary users as moderators; indeed, I doubt that those two could function at all if they didn't---they'd just be filled with junk material.

@oggsait Your plot can be made smoother by increasing the number of points (option numpoints) or increasing the 2D grid (option grid). Which of these you can use and which will work best depend on the particular plotting command that you used. If you say which one, I can advise further.

@mmcdara You wrote:

  • Here is the plot, you can take it and put it into your own answer

No, I can't do that. MaplePrimes will not allow me, specifically, to post most plots or worksheets. However, you could edit my Answer to include the plot, and I'd be grateful if you did that.

@mmcdara The following derivation of the sum formula that I used is probably obvious to you, but I needed to write it out to understand it. In the following, I am simply using Maple to display my by-hand computation; Maple is not doing anything other than displaying it. Superscripted symbols in parentheses on function symbols (in the Standard prettyprinted output (not shown here)) represent the number of iterations, not the order of differentiation. 

By the chain rule
D(f@@n)(x) = D(f)((f@@(n-1))(x))*D(f@@(n-1))(x);
   D(@@(f, n))(x) = D(f)(@@(f, n - 1)(x)) D(@@(f, n - 1))(x)

So by induction
D(f@@n)(x) = Product(D(f)((f@@k)(x)), k= 0..n-1);
                             n - 1                    
                           ,--------'                 
                              |  |                    
                              |  |                    
          D(@@(f, n))(x) =    |  |   D(f)(@@(f, k)(x))
                              |  |                    
                             k = 0                    

We define x[k]= (f@@k)(x[0]) to get
D(f@@n)(x[0]) = Product(D(f)(x[k]), k= 0..n-1);
                                  n - 1             
                                ,--------'          
                                   |  |             
                                   |  |             
            D(@@(f, n))(x[0]) =    |  |   D(f)(x[k])
                                   |  |             
                                  k = 0             

Applying ln@abs to both sides, we get
ln(abs(D(f@@n)(x[0]))) = Sum(ln(abs(D(f)(x[k]))), k= 0..n-1);

                                  n - 1                 
                                  -----                 
                                   \                    
                                    )                   
        ln(|D(@@(f, n))(x[0])|) =  /    ln(|D(f)(x[k])|)
                                  -----                 
                                  k = 0                 


The number of arithmetic operations for the sum form and the product form are the same, but the sum form seems much more numerically stable.

@mmcdara The operation count of a numeric Maple procedure P can be reduced by 

P1:= codegen[optimize](P, tryhard);

The output is a revised Maple procedure. Thus, the pass through Matlab is unnecessary. In my experience, the results produced with the tryhard option (which uses a completely different algorithm) are almost always (but not 100% always) better than without the option.

For the case at hand, we want to optimize f@@iter for some very simple procedure f and some possibly large integer iter. And I'll suppose that we know a priori the value of iter, which is conceivable (e.g., for Newton's method). I don't think that there's any automatic optimization process that'll give you better results than direct iteration in a loop. In my considerable experience, there's only been one time where by meticulous by-hand optimizing I was able to reduce the operation count from that of direct iteration. (In that case, f was a Halley's method iteration for evaluating LambertW on a particular interval, and iter was 3, which I could show was sufficient to give the desired accuracy on that interval (I think 7 digits). The goal was to produce a procedure to run in Excel.)

@mmcdara The lines that you wanted explained should be something like:

FA := a-> x-> a*x*(1-x);
F:= FA(3.5): #or any specific numeric a
f := parse(sprintf("%a", eval(F)));
f1:= D(f);

The following explanation is of no mathematical interest; it's strictly for the most-hardcore programmers:

I think it's only the 3rd line of that---parse(sprintf(...))---that requires explanation. It's not a key step; it's just a trick to get around evalhf's extremely strict requirements.

The a in the anonymous inner procedure of FA is called a lexical variable because it's a parameter of a procedure at a higher level than the anonymous procedure. Procedures with lexical variables are not allowed by evalhf. Now, clearly, from a purely mathematical perspective F:= FA(3.5) is a new procedure (an instantiation of the anonymous procedure) with no dependence on a. However, evalhf balks at it simply because it was derived from a procedure that had a lexical variable at some previous time. The remants of the lexical variable can be seen with dismantle(eval(F)) or ToInert(eval(F)) or op(7, eval(F)). The parse(sprintf(...)) trick acts like money laundering to remove that lexical "stink"; essentially, it acts as if the procedure were retyped by hand with 3.5 in place of a. The same thing can be done with unapply, as noted by VV below.

Please post the plot, if MaplePrimes allows you to.

@janhardo The issue is not the language (English, etc.) in which the books are written; rather it's the mathematical level. In textbooks of mathematics below the calculus level, log usually does mean the base-10 logarithm, even in English. Elementary calculus textbooks (say, the first three courses), usually use ln for the natural logarithm, use log[b] for base-b logarithms, and don't use unsubscripted log at all. In even higher-level mathematics texts (such as any text on complex analysis), unsubscripted log simply means the natural logarithm.

@janhardo I'll go through the code line-by-line (except for things that I think you already understand):

J1:= subs((SUB:= t= alpha+beta*I), J);

I'll guess that you can figure out the meaning of the embedded assignment (SUB:= t = alpha+beta*I). The syntax requires that embedded assignments always be placed in their own parentheses, even when those parentheses seem totally redundant.

J2:= evalc([Re,Im](J1));

If is any operator (function) or sequence of operators, and x is any argument or sequence of arguments, then [S](x) is the list of all members of S applied to (and the analogous thing works for {S}). So, [Re,Im](J1) is the same as [Re(J1), Im(J1)]. The evalc automatically maps over lists, so the end result of this command is a list with the real and imaginary parts of the integral J1.

J3:= J2 =~ simplify(value(J2));

The value causes the inert integrals Int to be evaluated, as if they were int. The value is specifically for converting inert functions to their non-inert form. 

If A and B are lists of equal length, then A =~ B is the list of equations of the form a=b for a in Ab in B. For example, [x,y] =~ [1,2] is the same as [x=1, y=2].

print~(J3):

The purpose of the ~ is so that the print is applied individually to the elements of the list J3 so that the results appear on separate lines and without square brackets.

simplify(
    convert(diff(evalc(Complex(rhs~(J3)[])), x), exp),
    {rhs=lhs}(SUB)
);

rhs stands for right-hand side. It's a command that extracts the right sides of equations. By using ~, it gets applied to each each element of list J3. The [] converts the resulting list into its underlying sequence, i.e., it removes the square brackets.

Complex(a,b) is the same as a+b*I except that it remains unevaluated until it's known that a and b are real; so, evalc thus forces that evaluation by temporarily assuming that all variables are real.

convert(..., exp) converts functions such as sin and cos into exp form.

{rhs=lhs}(SUB) switches the sides of the equation SUB and puts the result in a set.

simplify(..., {...}) is a form of simplify known as simplify with side relations. The second argument is a set of equations. The first argument is simplified using the information from the equations. The purpose of this in this case is to convert alpha+beta*I back to t.

@janhardo No, absolutely not. Where your book says log, it means the natural logarithm (using base e), the same thing as ln. Maple knows this also:

log(100.);
         
4.605170186 

In calculus, logarithms are always natural logarithms unless it's explicitly stated elsewise, and angles are always measured in radians.

I would guess that deleted material is stored somewhere; however, the Moderators who delete it have no access to it nor any knowledge of where it's stored.

@nm Okay, I thought that your main issue was timelimit not working since you've written about that many times before, and it is the point most emphasized in your Question.

If you add assuming x > 0 to the dsolve command, it returns the explicit solution in half a second. For x < 0, I guess that there are a countable infinity of branched solutions, and this may be confusing dsolve.

@janhardo There is no log10 in formal abstract calculus, where log (no subscript) means the natural logarithm and can also be denoted ln.

@janhardo If I post a plaintext transcription of a Maple session, the red text is the input and the blue text is the output. You generally can't copy-and-paste the output for reuse as input, which is what you did with my last line exp(x t).

If you differentiate an indefinite integral (both operations being performed with respect to the same variable), you get back the integrand not the integral. The integrand is exp(x t).

Try this:

restart; 	
J:= Int(exp(t*x), x);
J1:= subs((SUB:= t= alpha+beta*I), J);
J2:= evalc([Re,Im](J1));
J3:= J2 =~ simplify(value(J2));
print~(J3):
 
#reversion to original integrand:
simplify(
    convert(diff(evalc(Complex(rhs~(J3)[])), x), exp),
    {rhs=lhs}(SUB)
);
                            exp(t x)

 The output of print~(J3): should be exactly the integral formulas that you're looking for.

@mmcdara The Iterator package (I think it's from Maple 2016) is for high-speed, low-memory generation of combinatorial objects; it's not for arithmetic and can't help with this. The above computation can be speeded up substantially with evalhf, which I'm thinking about now.

First 105 106 107 108 109 110 111 Last Page 107 of 708