Carl Love

Carl Love

28035 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

I was afraid that might happen. Unfortunately, the syntax of the output option for Graph6 is not documented in the help pages, and I was making a guess. But this should work:

L2:= Import~(
    StringTools:-Split(ssystem("D:/nauty27r3/geng -c -b 6 -g")[2], "\n"), 
    source= direct, format= "Graph6"
); 
L2 := [`Graph 2: an undirected unweighted graph with 6 vertices and 5 edge(s)`,
 `Graph 3: an undirected unweighted graph with 6 vertices and 5 edge(s)`,
 `Graph 4: an undirected unweighted graph with 6 vertices and 5 edge(s)`, 
 `Graph 5: an undirected unweighted graph with 6 vertices and 6 edge(s)`, 
 `Graph 6: an undirected unweighted graph with 6 vertices and 5 edge(s)`, 
 `Graph 7: an undirected unweighted graph with 6 vertices and 6 edge(s)`,
 `Graph 8: an undirected unweighted graph with 6 vertices and 7 edge(s)`,
 `Graph 9: an undirected unweighted graph with 6 vertices and 8 edge(s)`,
 `Graph 10: an undirected unweighted graph with 6 vertices and 5 edge(s)`,
 `Graph 11: an undirected unweighted graph with 6 vertices and 6 edge(s)`,
 `Graph 12: an undirected unweighted graph with 6 vertices and 5 edge(s)`,
 `Graph 13: an undirected unweighted graph with 6 vertices and 6 edge(s)`,
 `Graph 14: an undirected unweighted graph with 6 vertices and 7 edge(s)`,
 `Graph 15: an undirected unweighted graph with 6 vertices and 6 edge(s)`,
 `Graph 16: an undirected unweighted graph with 6 vertices and 7 edge(s)`,
 `Graph 17: an undirected unweighted graph with 6 vertices and 8 edge(s)`,
 `Graph 18: an undirected unweighted graph with 6 vertices and 9 edge(s)`]

It definitely works in this case. It'll work in all cases (of format= "Graph6") if the newline character "\n" is always the separator between graphs and never occurs within an individual graph.

The strings that you're passing are just shell commands (for a Cygwin shell I assume). The Maple command for passing commands to a shell is ssystem. It will pass to the Windows/DOS Command/CMD shell. I doubt that you should begin the string with "!".

I agree with Tom Leslie that extending his printf loop to columns beyond the first differences would be difficult, that is, difficult if we're required to both generate and print the data in the same loop. But if you generate and store all the data before printing it, then it's a trivial one-liner. Add this to the procedures that I gave above:

PrintfTab:= (T::Matrix)-> printf("%9s\n", subsindets[2](T, numeric, "%2.6f", sprintf)): 

Example usage:

X:= <[$1..7]>:
PrintfTab(DisplayTab(DiffTab(1/~X), X));
 1.000000  1.000000                                                            
                    -0.500000                                                  
 2.000000  0.500000            0.333333                                        
                    -0.166667           -0.250000                              
 3.000000  0.333333            0.083333            0.200000                    
                    -0.083333           -0.050000           -0.166667          
 4.000000  0.250000            0.033333            0.033333            0.142857
                    -0.050000           -0.016667           -0.023810          
 5.000000  0.200000            0.016667            0.009524                    
                    -0.033333           -0.007143                              
 6.000000  0.166667            0.009524                                        
                    -0.023810                                                  
 7.000000  0.142857          

@abiodunowoyemi9 I don't know (mathematically) how to handle intial conditions for the derivative(s) of fractional DEs. Do you know?

Your labels say that the function has negative values in all four quadrants. That can't be true for the given function, and it's also contradicted by the colors of the regions.

Anyway, do you know the function values for which you want labeled contours?

@Christopher2222 Yes, in the last two weeks or so, I have noticed a slow down of the speed with which typing is accepted. 

@abiodunowoyemi9 The problem that you just posted is exactly the same as the original.

@jud The help page ?GroupTheory,Subgroup that I'm looking at says that the first argument to Subgroup is a "list or set of generators for the subgroup." The basic list constructor is [...], and the basic set constructor is {...}. Sets are automatically sorted and simplified to remove repeated elements. The problem with using {RandomElement(G), RandomElement(G)} is that that expression automatically simplifies to a single element before the random elements are chosen. This phenomenon can be observed in a much simpler setting, and it should be kept in mind whenever making multiple random selections with a single command:

restart:
{rand(), rand()};

                         
{395718860534}
restart:
[rand(),rand()];

                 
[395718860534, 193139816415]
 

@jalal One way to animate is the viewpoint option. For example, you can add viewpoint= "circleleft" to any of the final display commands. There are a vast number of suboptions for finer control. See the help page ?plot3d,viewpoint for details.

I just realized that my Answer may give the impression that I am recommending that you use solve instead of fsolve. I am not. I recommend that you fix your calls to fsolve so that functions are not used as variables. Note that indexed names (such as y[1]) work fine as fsolve variables, and they're practically no different than functions.

@abiodunowoyemi9 It's a version issue. You should use the pull-down list in the Question header to state which Maple version you are using. Below, I've removed some of the newer features from my code. Please try this:
 

Direct application of Method of Undetermined Coefficients

restart
:

V:= [v__||(0..5)]:  v||(0..5):= V[]:  Vs:= ()
:

#right sides of the 6 odes:
RHS:= -[
    0, v0^3, 3*v0^2*v1, 3*v0*v1^2 + 3*v0^2*v2,
    6*v0*v1*v2 + 3*v0^2*v3 + v1^3,
    6*v0*v1*v3 + 3*v1^2*v2 + 3*v0^2*v4 + 3*v0*v2^2
]:
print~(RHS)
:

0

-v__0^3

-3*v__0^2*v__1

-3*v__0^2*v__2-3*v__0*v__1^2

-3*v__0^2*v__3-6*v__0*v__1*v__2-v__1^3

-3*v__0^2*v__4-6*v__0*v__1*v__3-3*v__0*v__2^2-3*v__1^2*v__2

ICs:= [[1,0], [0,0]$5] #initial conditions of the 6 odes
:

for k to nops(RHS) do
    S:= C1*sin(t) + C2*cos(t); #general homogenous solution of v'' + v = 0
    #Perform method of undetermined coefficients termwise:
    rs:= combine(eval(RHS[k], [Vs]));
    for f in indets(rs, specfunc({sin,cos})) do #for each term on right side
        C:= coeff(rs, f);
        d:= degree(C,t);
        o:= op(f);
        P:= add(a[i]*t^i, i= 0..d)*sin(o) + add(b[i]*t^i, i= 0..d)*cos(o);
        if o=t then P:= P*t fi; #extra power of t   
        S:= S + eval(P, solve(identity(diff(P,t$2)+P=C*f, t)))
    od;
    #Apply initial conditions to determine C1 and C2:
    Vs:= Vs, V[k] = (combine@eval)(S, solve(eval([S, diff(S,t)], t=0)=~ICs[k]))
od
:
print~([Vs])
:

v__0 = cos(t)

v__1 = -(1/32)*cos(t)-(3/8)*sin(t)*t+(1/32)*cos(3*t)

v__2 = -(9/128)*cos(t)*t^2+(3/32)*sin(t)*t-(9/256)*t*sin(3*t)+(1/1024)*cos(5*t)-(3/128)*cos(3*t)+(23/1024)*cos(t)

v__3 = (9/1024)*sin(t)*t^3-(81/4096)*t^2*cos(3*t)+(135/4096)*cos(t)*t^2-(15/8192)*t*sin(5*t)+(279/8192)*t*sin(3*t)-(207/4096)*sin(t)*t+(1/32768)*cos(7*t)-(3/2048)*cos(5*t)+(297/16384)*cos(3*t)-(547/32768)*cos(t)

v__4 = (27/32768)*cos(t)*t^4-(99/16384)*sin(t)*t^3+(243/32768)*t^3*sin(3*t)-(1359/65536)*cos(t)*t^2+(1539/65536)*t^2*cos(3*t)-(225/131072)*t^2*cos(5*t)-(21/262144)*t*sin(7*t)+(8997/262144)*sin(t)*t-(3915/131072)*t*sin(3*t)+(825/262144)*t*sin(5*t)-(9/131072)*cos(7*t)+(6713/524288)*cos(t)-(15121/1048576)*cos(3*t)+(883/524288)*cos(5*t)+(1/1048576)*cos(9*t)

v__5 = -(81/1310720)*sin(t)*t^5-(783/1048576)*cos(t)*t^4+(2187/1048576)*t^4*cos(3*t)+(1125/1048576)*t^3*sin(5*t)+(4635/1048576)*sin(t)*t^3-(10935/1048576)*t^3*sin(3*t)+(6975/2097152)*t^2*cos(5*t)+(15777/1048576)*cos(t)*t^2-(441/4194304)*t^2*cos(7*t)-(96795/4194304)*t^2*cos(3*t)-(16575/4194304)*t*sin(5*t)-(108357/4194304)*sin(t)*t+(1659/8388608)*t*sin(7*t)+(108243/4194304)*t*sin(3*t)-(27/8388608)*t*sin(9*t)-(921/524288)*cos(5*t)-(42397/4194304)*cos(t)+(1757/16777216)*cos(7*t)-(3/1048576)*cos(9*t)+(394701/33554432)*cos(3*t)+(1/33554432)*cos(11*t)

plot(
    rhs~([Vs]), t= 0..15,
    color= [red, green, blue, yellow, cyan, black],
    axes=boxed, gridlines=false, legend= V
);

#Compare with numeric solution:
sys:= [
    (diff~(V(t), t$2) +~ V(t) =~ RHS(t))[],
    (V(0)=~ICs[..,1])[], (D~(V)(0)=~ICs[..,2])[]
]:

sol:= dsolve(sys, numeric):

plots:-odeplot(
    sol, `[]`~(t, V(t)), t= 0..15,
    color= [red, green, blue, yellow, cyan, black],
    axes=boxed, gridlines=false, legend= V
);

 

Download UndeterminedCoeffs.mw

@vv Yes, I noted that and replied to him above.

@tomleslie You have exactly the same typos on the right sides of the 3rd, 4th, and 5th equations as VV has. I guess he used your encoding of the equations.

@vv You have a few typos on the right-sides of the 3rd, 4th, and 5th equations. I've corrected these below. Running the corrected code (in Maple 2019), I experience the same thing that I said above: an undetermined very long time for the 6th solution.

restart;
sys:= [ 
[diff(v__0(t),t$2)+v__0(t)=0,  v__0(0)=1, D(v__0)(0)=0],
[diff(v__1(t),t$2)+v__1(t)=-v__0(t)^3,  v__1(0)=0,  D(v__1)(0)=0],
[diff(v__2(t),t$2)+v__2(t)=-3*v__0(t)^2*v__1(t),  v__2(0)=0,  D(v__2)(0)=0],
[diff(v__3(t),t$2)+v__3(t)=-3*v__0(t)*v__1(t)^2-3*v__0(t)^2*v__2(t),  v__3(0)=0, D(v__3)(0)=0],
[diff(v__4(t),t$2)+v__4(t)=-6*v__0(t)*v__1(t)*v__2(t)-3*v__0(t)^2*v__3(t)-v__1(t)^3,  v__4(0)=0,  D(v__4)(0)=0],
[diff(v__5(t),t$2)+v__5(t)=-6*v__0(t)*v__1(t)*v__3(t)-3*v__1(t)^2*v__2(t)-3*v__0(t)^2*v__4(t)-3*v__0(t)*v__2(t)^2,  v__5(0)=0, D(v__5)(0)=0]
]:
print~(sys);
s:=NULL:
for i to 6 do  s:=s, dsolve(eval(sys[i], [s])); print([s][-1]) od:

 

@tomleslie It was not my intention to restrict n to integers. Yes, if that had been my intention, I would've included adaptive= false. My intention was to make sure that every integer was included along with whatever other points plot decided to include on its own.

Yes, I understand your point about the inner floors. They aren't needed in my Answer. I mistakenly thought that I was using the OP's original function, but I was actually using your modification of it due to a hasty copy and paste. Sorry about that. So, the code of my Answer should be changed to 

f:= n-> ceil(sqrt(4*n)) - floor(sqrt(2*n)) - 1:
plot(f, 10...100, sample= [$10..100]);

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