Carl Love

Carl Love

28070 Reputation

25 Badges

13 years, 28 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

@nm Make the keyword parameter's type and default value as shown in the title of this Reply.

@emendes 

Why did you change my code? Are you using an older version of Maple which doesn't support embedded for loops? Don't you have Maple 2020 on some machine? My experience so far is that embedded for loops work better than seq. Why are you using a machine with only 4 processors? Don't you have one with 32 processors? That's where I believe you'll experience the great benefit of the threaded code. Why do you use parse/sprintf

Answers: Both your questions have the same answer: The return value of kernelopts(option= valueis the previous value of kernelopts(option).

Does the threaded version perform up to your expectations for your larger examples when run on your larger machine?

@Carl Love I just reran the Lie solution, and now I got something completely different! (I'm sorry about the plaintext format below. MaplePrimes doesn't let me display worksheets.)

restart;
dsolve(x^3*diff(y(x),x)^2+x*diff(y(x),x)-y(x) = 0,y(x),'Lie');
        1  /      /      24           21            18
y(x) = --- \RootOf\_C1 _Z   + 8 _C1 _Z   + 16 _C1 _Z  
       4 x                                            

              15             12             9             6
   - 32 _C1 _Z   - 160 _C1 _Z   - 128 _C1 _Z  + 256 _C1 _Z 

               3        4          \   /      /      24
   + 512 _C1 _Z  - 256 x  + 256 _C1/^3 \RootOf\_C1 _Z  

             21            18            15             12
   + 8 _C1 _Z   + 16 _C1 _Z   - 32 _C1 _Z   - 160 _C1 _Z  

               9             6             3        4          \ 
   - 128 _C1 _Z  + 256 _C1 _Z  + 512 _C1 _Z  - 256 x  + 256 _C1/^

       \\  
  3 - 2//, 

                                     (1/3)                    
      (4/3) /                  (1/2)\                    (1/2)
  y(x)      \1 + (1 + 4 x y(x))     /      (1 + 4 x y(x))     
  ------------------------------------------------------------
                             (1/3)                            
   /                   (1/2)\      /              (1/2)    \  
   \-1 + (1 + 4 x y(x))     /      \(1 + 4 x y(x))      + 3/  

                                                 (1/3)        
                  (4/3) /                  (1/2)\             
            3 y(x)      \1 + (1 + 4 x y(x))     /             
   - ---------------------------------------------------------
                               (1/3)                          
     /                   (1/2)\      /              (1/2)    \
     \-1 + (1 + 4 x y(x))     /      \(1 + 4 x y(x))      + 3/

   - 

                                       (1/3)                    
        (1/3) /                  (1/2)\                    (1/2)
  2 y(x)      \1 + (1 + 4 x y(x))     /      (1 + 4 x y(x))     
  --------------------------------------------------------------
                             (1/3)                              
   /                   (1/2)\      /              (1/2)    \    
   \-1 + (1 + 4 x y(x))     /      \(1 + 4 x y(x))      + 3/ x  

                                                  (1/3)         
                   (1/3) /                  (1/2)\              
             6 y(x)      \1 + (1 + 4 x y(x))     /              
   + -----------------------------------------------------------
                               (1/3)                            
     /                   (1/2)\      /              (1/2)    \  
     \-1 + (1 + 4 x y(x))     /      \(1 + 4 x y(x))      + 3/ x

   - _C1 = 0


 

The Lie soluton is a bit uglier to me than the implicit one in that it contains the square of a degree-8 RootOf. It's not horrible though. 

 

@Preben Alsholm Vote up. This was also my immediate first guess for something worth trying. So it's probably worth trying in any case where the solve returns explicit solutions (i.e., without RootOf).

@ecterrab Thus, it follows that a likely next thing to try is dsolve(..., implicit), and indeed that works.

This is the appropriate place to discuss MaplePrimes problems. That's why there's a "MaplePrimes" entry in the Question-header "Product" check boxes. 

Additional details: I have two computers---both Windows 10, but different versions---and I have this problem on both. For both, the browser I use for posting is Google Chrome.

@nm If your guess is correct, then I've been extraordinarily unlucky. Like I said, I haven't been able to display any worksheet at all for about a year although I've tried many times.

@Ronan The approach that you show is a last resort for infinite sums for which evalf won't work. Vv's Answer shows that that isn't the case here.

Vote up. But due to the presence of LinearAlgebra in your title, I'd like to clarify something that may not be obvious to all readers: Your examples display the same (whether via Latex or GUI) regardless of whether they are created with LinearAlgebra. Indeed, many users have the false impression that LinearAlgebra is required to use Vector or Matrix. No, those are top-level commands.

I think that one of the examples that you present should be condidered a bug, just for the sake of consistency.

I dispute your contention that the returned by boo is local to boo because of this:

restart;
foo:=module()
   export n::integer:= 2;
   export boo:=proc()::integer;
     return n;
   end proc;       
end module
:
foo:-boo();
                               2

Also consider this:

restart:
foo:= module() export n; end module:
type(foo:-n, `local`);                
                              true

So, it is the presence of the ::integer that makes the difference.

@tomleslie The last algorithm that you show impressively exploits the problem's sparsity. There was an efficiency problem with your Maple implementation, for which I've given a correction in my Answer. Nonetheless, I wanted to directly congratulate you here for coming up with a great algorithm, which is the most difficult creative aspect.

@emendes 

Since the vast majority of the cputime used for this computation by all the methods shown so far is for the garbage collection, and given that Maple's garbage collection is already parallelized, it might be worthwhile to increase that parallelization. Please redo with SubsetPairsSparse the timing of one of the large computations that you've already shown with this one change: Before starting the timing, give this one command:

kernelopts(gcmaxthreads= kernelopts(numcpus));

@vv Maple has a massive and very efficient infrastructure for doing set problems such as this one. To write this efficiently in a compiled language such as C would require far more effort than "reinventing the wheel". Note that for all the large computations posted here, the majority of the time is in garbage collection, which is automatically parallelized in Maple. 

@Preben Alsholm 

Vote up.

I'd like to point out to the OP that the mathematical and computational essence of what you just said is the same as what I said. Of course, you've also given a detailed example. 

First 145 146 147 148 149 150 151 Last Page 147 of 709