Carl Love

Carl Love

28055 Reputation

25 Badges

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

MaplePrimes Activity


These are answers submitted by Carl Love

The green output is due to some kind of tracing or debugging being turned on. If you didn't turn it on, then it's unusual, but it's certainly possible. I suspect that some code author at Maplesoft accidentally left some debugging code in.

The green output is supplementary. It is not part of the return value of your command, which is the blue part. Nothing bad would happen if you simply ignored the green output.

For some strange reason, GetProperty returns the string "true" rather than the constant true

Although this code is ugly to me, you can workaround by 

if GetProperty(...) = "true" then ...

You can intersperse plots and text by putting it all in a column vector. This avoids the need to rely on side effects produced by print:

right:= ()-> <plot(x, x= -1..1), `This is a line of text.`, plot(x^2, x= -1..1)>:
right();

If you prefer normal-sized display, use

print~(right()):

Note that that last command ends with a colon.

 

My advice is to just use a Matrix from the start, and forget about the Vector of lists. The Matrix can be created in a single line by any of the following four commands (and there are several other variations possible):

restart:
vars:= 4:  n:= 1..2^vars:
sgn:= 2*<seq(<Bits:-Split(i-1, bits= vars)>^+, i= n)> -~ 1;
sgn:= Matrix([seq]([seq]([-1$2^j, 1$2^j][], i= 1..2^(vars-j-1)), j= 0..vars-1))^+;
sgn:= Matrix(combinat:-permute([-1$vars, 1$vars], vars))[.., [seq](vars..1, -1)];
sgn:= Matrix((2^vars, vars), (i,j)-> 2*irem(iquo(i-1, 2^(j-1)), 2)-1);


The commands vectormatrix, and evalm (all lowercase) should never be used. Replacements are VectorMatrix, and the angle bracket constructors shown in the first construction above.

A Maple session runs as two or more separate processes (independently running programs): one user interface (either plaintext as you show above or GUI) and one or more "kernels" or "mathematical engines". The message "lost connection to kernel" almost always means that there was an untrapped error due to a bug in the kernel, and the process has died. (Occasionally, it does mean a severance of the connection between the kernel and the user interface. That seems extremely unlikely in this case.)

Yes, running out of memory can precipitate this error. The messages that you show indicate that this Maple kernel (alone) was using about 32 Gigabytes of memory at the time of the crash and that that amount was rapidly increasing. (Look at the "alloc"; ignore the "memory used".) How much memory does your machine have?

The fact that you got this message says nothing whatsoever about the mathematical solvability of your system or whether you've input it correctly. Groebner calculations often take an extreme amount of memory and time.

It may be possible to achieve better results by changing the order of the variables in plex. However, I have no advice on how to select one of the 13! possible orders. A Groebner expert may be able to advise on this.

 

After the solve command, do

assign(%);

O(...is special when it occurs as part of a series structure (which includes any output from taylor), which I think is the case here. If you just want to get rid of O(...) and expand, try

expand(convert(Q(h), polynom));

The oddly named command convert(..., polynom) is for converting series structures to ordinary algebraic structures, regardless of whether they're polynomial.

Like this:

`&Delta;x`

Like this:

expr:= expand(alpha[-2]*(f(x) - 2*D(f)(x)*h + 2*(D@@2)(f)(x)*h^2 + O(h^3))/h + alpha[0]*f(x)/h + alpha[3]*(f(x) + 3*D(f)(x)*h + 9/2*(D@@2)(f)(x)*h^2 + O(h^3))/h):

InertForm:-MakeInert(expr);


This will work even if expr is entered in 2D Input using implied multiplication.

To use assuming in list form, do

`assuming`([odetest(sol,ode)], [x::real, x>0]);

I can't find any documentation on an assume option to odetest. Where did you see it? I guess that it's just being totally ignored, which is the default behavior for extra arguments that match no declared parameter.

I find this confusing also. Put your cursor on the "Section 1" header and press Ctrl-Period (or menu Insert => Section). Then a new section will open under Section 1 with the same level of indentation as Section 1.

Here are procedures for both of your sequences:

Seq1:= proc(N::posint) #N = number of terms
local 
    S:= Array(1..1, [1]), #the sequence
    SD:= 1, #its digit sum
    C:= 1, #its concatenation
    Used:= table([1= ()]), #terms used
    k, j, C1, SD1
;
    for k from 2 to N do
        for j from 2 do
            if not assigned(Used[j]) then
                C1:= Scale10(C, length(j)) + j;
                SD1:= SD + `+`(convert(j, base, 10)[]);
                if igcd(C1, SD1) = 1 then
                    C:= C1; SD:= SD1; Used[j]:= (); S(k):= j;
                    break
                fi
            fi
        od
    od;
    seq(S)
end proc
:   
CodeTools:-Usage(Seq1(99));
memory used=3.60MiB, alloc change=0 bytes, cpu time=31.00ms, real time=30.00ms, gc time=0ns

1, 3, 7, 2, 4, 5, 9, 6, 13, 8, 19, 11, 15, 21, 10, 17, 22, 23, 
  12, 24, 25, 14, 27, 16, 20, 28, 26, 31, 29, 18, 33, 37, 35, 39, 
  40, 41, 34, 42, 44, 43, 32, 45, 30, 46, 47, 36, 49, 38, 48, 51, 
  55, 53, 61, 50, 57, 60, 63, 52, 59, 64, 62, 66, 67, 54, 65, 58, 
  68, 69, 70, 71, 73, 75, 77, 79, 80, 81, 72, 82, 83, 76, 84, 86, 
  87, 78, 88, 89, 85, 93, 95, 91, 99, 101, 97, 105, 107, 103, 
  111, 56, 109

Seq2:= proc(N::posint)
local S:= Array(1..1, [1]), C:= 1, Used:= table([1= ()]), k, j, C1;
    for k from 2 to N do
        for j from 2 do
            if not assigned(Used[j]) then
                C1:= Scale10(C, length(j)) + j;
                if irem(C1, j) = 0 then
                    C:= C1; Used[j]:= (); S(k):= j;
                    break
                fi
            fi
        od
    od;
    seq(S)
end proc
:
CodeTools:-Usage(Seq2(99));
memory used=1.07MiB, alloc change=0 bytes, cpu time=16.00ms, real time=8.00ms, gc time=0ns

1, 2, 3, 5, 10, 4, 8, 6, 11, 20, 13, 7, 9, 12, 15, 18, 14, 25, 
  30, 24, 16, 32, 40, 29, 50, 100, 26, 52, 39, 21, 28, 35, 42, 
  17, 34, 51, 23, 46, 27, 36, 45, 43, 19, 38, 68, 48, 60, 75, 90, 
  54, 56, 58, 22, 44, 33, 55, 97, 125, 200, 64, 80, 69, 66, 88, 
  70, 41, 82, 37, 74, 79, 63, 84, 96, 72, 85, 136, 128, 92, 105, 
  31, 62, 93, 120, 150, 71, 142, 108, 124, 155, 179, 113, 164, 
  123, 205, 223, 140, 65, 78, 104


 

Regarding your first question with Grid:-Run and Grid:-GetLastResult: There seems to be a minor bug regarding "raw-form" assignment statements passed as strings to Grid:-Run: The assigned value is not considered to be a "result" or "return value". In this way, they act more like the assign command than the := operator. Here are 3 workarounds:

Grid:-Run(0, "a:= 2; a;");
#or # Grid:-Run(0, "(()-> (:-a:= 2))();");
#or # Grid:-Run(0, x-> (:-a:= x), [2]);
Grid:-Wait(0);
Grid:-GetLastResult(0); 
            2

Note the Grid:-Wait: Since the computation on node 0 is running at the same time as your next computation is processed in the "master" node (the one that you're typing in), you need to make sure that that computation on node 0 is finished before you can ask for its result. Hence, Grid:-Wait(0).

Regarding your second question: has been set to 2 on node 0 only. The a in the master node has no value. Your Grid:-Send(1,a) is sending that a (with no value) to node 1.

1. Regarding the question implied by the error message shown in your attached file: An equation that specifies the value of a parameter (in your case, l= 1) is not an "initial condition", and thus it's not something that should be passed directly to dsolve. It shouldn't be put in the sequence ics.

2. Regarding the message "Global variables are deprecated": It occurs when you're trying to dsolve an initial-value problem (IVP) numerically and the problem has parameters that have neither been assigned numeric values nor declared in a parameters option.

Example, incorrect:

Sol:= dsolve({diff(y(x),x) = y(x), y(0)=A}, numeric):
Warning, The use of global variables in numerical ODE problems is deprecated, and will be removed in a future release. Use the 'parameters' argument instead (see ?dsolve,numeric,parameters)

Example, corrected:

Sol:= dsolve({diff(y(x),x) = y(x), y(0)=A}, numeric, parameters= [A]):
Sol(parameters= [A=1]):
plots:-odeplot(Sol, [x,y(x)], x= 0..2);

 

We do your new 5th order BVP by setting 3 parametric initial conditions at -1 and "shooting for" the desired values of (D@@2)(F)(0)F(1), and D(F)(1).

restart;
Digits:= 5:
(t, S, R):= (-1, 1, 9):

EQ:= diff(F(x),x$4) + R*(diff(F(x),x)*diff(F(x),x$2) - F(x)*diff(F(x),x$3)) + 
    R*t*(F(x)*diff(F(x),x$5) - diff(F(x),x)*diff(F(x),x$4)) - 
    R*S^2*diff(F(x),x$2) = 0:

IC:= D(F)(-1)=0, F(-1)=-1, (D@@2)(F)(-1)=d2, (D@@3)(F)(-1)=d3, (D@@4)(F)(-1)=d4:

dsol:= dsolve({EQ,IC}, numeric, parameters= [d2, d3, d4], relerr= 1e-7):

Fsol:= proc(d2, d3, d4)
option remember;
    dsol(parameters= [d2, d3, d4]);
    [eval(diff(F(x), x$2), dsol(0)) - 0,
    (eval([F(x), diff(F(x), x)], dsol(1)) -~ [1, 0])[]
    ]
end proc:

for k to 3 do Fsol||k:= subs(_k= k, (d2,d3,d4)-> Fsol(args)[_k]) od:
fsolve([Fsol||(1..3)]);
         [3.44668196807, -5.31525372043, 3.16576851540]

dsol(parameters= %):
plots:-odeplot(
   dsol, [[x,F(x)],[x,diff(F(x),x)],[x,diff(F(x),x$2)]], 
   x= -1..1, legend= [F, `F '`, `F ''`]
);

Achieving more digits of accuracy may require more subtlety.

First 91 92 93 94 95 96 97 Last Page 93 of 395