Carl Love

Carl Love

28150 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@mmcdara What you showed regarding Complex(a, b) is interesting in its own right, but it sn't the point that I was trying to make in my last paragraph. I was referring to Complex(a, b) where a and b are manifest real constants. For example:

ToInert(Complex(3,7));
             _Inert_COMPLEX(_Inert_INTPOS(3), _Inert_INTPOS(7))

So, we see that the result has nothing to do with either functions or names.

You said "running the code"; however, it's not clear to me that that's what you really mean. Are you instead referring to parsing errors such as missing semicolons and parentheses?

The techniques that you mentioned don't apply to basic syntax errors---such as missing semicolons or parentheses---that prevent the code from even being "compiled" or parsed or evaluated. I think that those are the type of errors that the OP is referring to, although I'm not sure, and I've asked for clarification.

Nonetheless, all that you wrote is valuble information to know once one has actual runtime errors.

The (*  *) style comments work fine in Maple 2020. However, they can't span multiple execution groups in a worksheet, which is what I suspect you're trying to do.

@emendes Interesting.... I suspect a bug in Threads. Could you send me (either email or post here) the file that contains the lists of sets A and B for this? I don't think that there's any hope of finishing the computation on my small computer; I just want to see if I can get a strange error. I hope that you can send me a file that contains only two lists of sets that I can read in with the read command.

@aoakindele Simply change your dsolve command to

sol1[k]:= dsolve(eval(odeSys union bcs1, pList), numeric, method= bvp[midrich]);

@emendes By "kernel panic" do you mean "kernel connection lost" (which usually means simply the death of the kernel)?

And by changing that one line of code as shown did you avoid the kernel problem (for the larger problem, on the server)? If so, that's very interesting and must be reported as a bug, and I'd like to see what happens if you keep the original code but don't make any kernelopts adjustment.

The code that you showed indicates that

L:= CodeTools:-Usage(SubsetPairsSparseThreaded(pair[1], pair[2])):

would work equivalently to your parse/sprintf formulation, regardless of whether pair comes from a file.

 

 

@nm You wrote:

  • But your second choice is not type equation. Maple says it is type expression sequence. 

I don't know why that makes any difference to you. In the body of your code, you can process like this:

if ic::`=` then  #ic is an equation.
   
...
else  #ic is NULL.
   
...
fi;

Also, as I've mentioned a few times before, I think that an initial condition should be declared type function(algebraic)=algebraic rather than simply type `=`.
 

@nm A null equation is indeed a valid equation; you can enter it as NULL=NULL or ()=(). Thus,

foo:= proc(..., {ic::`=`:= ()=()}) ....

However, I'd rather let NULL itself be both an allowed value and a default value. You'd do that like

foo:= proc(..., {ic::{`=`, identical()}:= ()}) ....


Footnote: In most cases (not all cases), the syntax allows NULL to be replaced with () or even just empty space. It's my preference to do this when it's allowed. The above line of code could be 

foo:= proc(..., {ic::{`=`, identical(NULL)}:= NULL}) ....

However, NULL is not identically the same thing as () because NULL is a name that must be dereferenced to obtain the value (). Using () in the first place avoids this step.

@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= value) is 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.

First 146 147 148 149 150 151 152 Last Page 148 of 711