acer

32373 Reputation

29 Badges

19 years, 334 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@Christopher2222 If the conversion of 1/7^(1/2) to 7^(1/2)/7 is done by Maple as an automatic simplification then you may have to resort to some kludgy representation in order to foil that mechanism. For example, by using ``(), or replacement by manually typeset constructions.

@Christopher2222 If the conversion of 1/7^(1/2) to 7^(1/2)/7 is done by Maple as an automatic simplification then you may have to resort to some kludgy representation in order to foil that mechanism. For example, by using ``(), or replacement by manually typeset constructions.

I misread it as Eigenvalues(evalf(A)) which it wasn't. That's preconceptions for you...

ps. Sometimes I wonder about the merit of recompiling (overloaded) LAPACK with quad precision, as a performance bridge between fast double precision and much slower (gmp based) high precision.

acer

I misread it as Eigenvalues(evalf(A)) which it wasn't. That's preconceptions for you...

ps. Sometimes I wonder about the merit of recompiling (overloaded) LAPACK with quad precision, as a performance bridge between fast double precision and much slower (gmp based) high precision.

acer

Do you need Digits that high?

There will be a significant slowdown when Digits rises above 15 (the value of trunc(evalhf(Digits)), which is the cutoff for using purely compiled double precision LAPACK).

acer

@Alejandro Jakubi Could not Beta(x,1-x) be taught to immediately return the corresponding csc result if `x` is of type `fraction`? Ie, if real `x` is noninteger and rational. (That was my tentative thinking when making my earlier comment.)

Simplification, if symbolic `x` were assumed to have the corresponding property, would also be nice of course.

@Adri van der Meer It may well be easier or more convenient to take a numerical limit than to prove using Maple that it is a contraction. But of course I was considering other, perhaps more demanding examples. One of my intended points (which I may not have conveyed adequately, of course) was indeed that using fsolve might not make best sense.

@Axel Vogt The Asker gave an example. But that might just be a simple illustration.

Some other examples might not be explicitly solvable, either by rsolve for the iterative formula or by solve for the limiting form. In such a case one might be tempted to call fsolve to attempt to compute an approximate floating-point solution. ...And if fsolve were the route taken, then it might be slightly amusing to note that fsolve's non-polynomial univariate rootfinder can attempt various inverse iteration approaches -- one of which might relate to the given iterative formula.

@Alejandro Jakubi Ah, it seems as if the "normalization" of GAMMA(x) to Pi*csc(Pi*x)/GAMMA(1-x) is only done if the csc(..) can be converted to radicals (because that makes it more subsequently useful, or in hopes of additional simplifications!?).

convert(csc(Pi*2/5),'radical');

                                    (1/2)       
               1  (1/2) /     (1/2)\       (1/2)
               - 2      \5 - 5     /      5     
               5               
                 
convert(csc(Pi*2/7),'radical');

                              /2   \
                           csc|- Pi|
                              \7   /

(It's mildly amusing how topics show up in bursts. Case in point being trig->radicals.)

But then could not `Beta` improve, when it sees an appropriate pair of arguments x and 1-x? ...because of the ensuing multiplicative cancellation of GAMMA terms. That could be regardless of any successful conversion to radicals.

I think that I generally agree with you about `int` methods. But how should it be improved?

@Joe Riel The only commands I can think of, offhand, that use _nresults are in the MTM package.

Some of those instances may seem to mimic Matlab functions (especially where the corresponding top Maple command offers an optional side-effect on a name). For example, compare Maple's MTM:-coeffs with Maple's coeffs, and with Matlab's (Symbolic Math Toolbox) coeffs.

That's partly why I mentioned _nresults, because the Question touched on Matlab vs Maple programming. I don't recall, however, whether Matlab allows user-defined functions with that kind of behaviour.

@Joe Riel The only commands I can think of, offhand, that use _nresults are in the MTM package.

Some of those instances may seem to mimic Matlab functions (especially where the corresponding top Maple command offers an optional side-effect on a name). For example, compare Maple's MTM:-coeffs with Maple's coeffs, and with Matlab's (Symbolic Math Toolbox) coeffs.

That's partly why I mentioned _nresults, because the Question touched on Matlab vs Maple programming. I don't recall, however, whether Matlab allows user-defined functions with that kind of behaviour.

@Alejandro Jakubi Good observation, Alejandro. The `contour` method also gets it in M16.

int(1/(1+x^(7/2)), x=0..infinity, method=_RETURNVERBOSE);

simplify(allvalues(%)); # to simplify the two FTOC methods

And it might be attainable in Maple,

restart:

e1:=int(1/(1+x^(7/2)), x=0..infinity);

                          2     /2  5\
                          - Beta|-, -|
                          7     \7  7/

e2:=convert(e1,Int);

                  /1                             
              2  |              1                
              -  |   ----------------------- d_k1
              7  |      (5/7)          (2/7)     
                /0   _k1      (1 - _k1)    
      
e3:=subsindets(e2, specfunc(anything,Int),
           z->IntegrationTools:-Change(z,
                IntegrationTools:-GetVariable(z)=1/x));

                    /infinity                  
                2  |                1          
                -  |          -------------- dx
                7  |                   (2/7)   
                  /1          x (x - 1)     
   
value(e3);

                         2       /2   \
                         - Pi csc|- Pi|
                         7       \7   /

And, FWIW...

H:=Int(1/(1+x^(7/2)), x=0..infinity);

                     /infinity              
                    |              1        
                    |          ---------- dx
                    |               (7/2)   
                   /0          1 + x     
   
evalf(%);

                          1.148070807

Q:=IntegrationTools:-Change(H,x=t-1):

simplify(allvalues(value(Q)));

          8     /      /1   \      /3   \        /2   \\
        - -- Pi |-2 sin|- Pi| + sin|- Pi| - 3 sin|- Pi||
          49    \      \7   /      \7   /        \7   //

evalf(%);

                          1.148070807

acer

I would agree with Joe, that you can probably get what you want by using multiple return values from the procedure, combined with multiple assignment.

At the risk of adding irrelevant detail... Note that you have a choice in handling multiple return values (ie. an expression sequence) from a procedure. You can match it with an equal number of names on the LHS of the assignment statement. Or you can assign the whole sequence to a single name.

restart:

f := proc(x)
     return x, x^2, x^3;
end proc:

r1, r2, r3 := f(3);

                           r1, r2, r3 := 3, 9, 27

r2;

                                      9

s := f(4);

                               s := 4, 16, 64

s;

                                  4, 16, 64

s[2];

                                     16

If you really want to get fancy you can use a feature of procedures to distinguish the number of names on the LHS of an assignment statement in which the procedure gets called. This is related only indirectly to your question, and I mention it mostly because it's not so easy to discover. See the help-page for nresults.

restart:

f := proc(x)
   if _nresults = 1 then
      return x;
   elif _nresults = 2 then
      return x, x^2;
   else
      return x, x^2, x^3;
   end if;
end proc:

r1, r2, r3 := f(3);

                           r1, r2, r3 := 3, 9, 27

p1, p2 := f(4);

                               p1, p2 := 4, 16

p2;

                                     16

s := f(5);

                                   s := 5
s;

                                      5

acer

I would agree with Joe, that you can probably get what you want by using multiple return values from the procedure, combined with multiple assignment.

At the risk of adding irrelevant detail... Note that you have a choice in handling multiple return values (ie. an expression sequence) from a procedure. You can match it with an equal number of names on the LHS of the assignment statement. Or you can assign the whole sequence to a single name.

restart:

f := proc(x)
     return x, x^2, x^3;
end proc:

r1, r2, r3 := f(3);

                           r1, r2, r3 := 3, 9, 27

r2;

                                      9

s := f(4);

                               s := 4, 16, 64

s;

                                  4, 16, 64

s[2];

                                     16

If you really want to get fancy you can use a feature of procedures to distinguish the number of names on the LHS of an assignment statement in which the procedure gets called. This is related only indirectly to your question, and I mention it mostly because it's not so easy to discover. See the help-page for nresults.

restart:

f := proc(x)
   if _nresults = 1 then
      return x;
   elif _nresults = 2 then
      return x, x^2;
   else
      return x, x^2, x^3;
   end if;
end proc:

r1, r2, r3 := f(3);

                           r1, r2, r3 := 3, 9, 27

p1, p2 := f(4);

                               p1, p2 := 4, 16

p2;

                                     16

s := f(5);

                                   s := 5
s;

                                      5

acer

First 376 377 378 379 380 381 382 Last Page 378 of 592