Carl Love

Carl Love

28155 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@Markiyan Hirnyk 

It should be mentioned, especially for a novice DirectSearch user, that the solution x = 46 must be discarded. It is a shame that DirectSearch even reports these "solutions" with high residuals.

My procedure RealizeDegreeSequence is also many times faster than GraphTheory:-SequenceGraph. The problem with the latter can be seen in its line 14 where the edge set is built by successive unions, whereas my edge set is built by a table.


N:= 2^9:

G:= GraphTheory:-RandomGraphs:-RandomGraph(N,.5);

GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512], Array(%id = 18446744074208329470), `GRAPHLN/table/22`, 0)

DS:= GraphTheory:-DegreeSequence(G):

H:= CodeTools:-Usage(RealizeDegreeSequence(DS));

memory used=78.11MiB, alloc change=-1.00MiB, cpu time=1.23s, real time=1.09s, gc time=250.00ms

GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512], Array(%id = 18446744074437974006), `GRAPHLN/table/23`, 0)

CodeTools:-Usage(GraphTheory:-SequenceGraph(DS));

memory used=466.10MiB, alloc change=0 bytes, cpu time=5.48s, real time=5.36s, gc time=312.50ms

GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512], Array(%id = 18446744074437974726), `GRAPHLN/table/24`, 0)

Verify the graph produced by my procedure:

evalb(DS = GraphTheory:-DegreeSequence(H));

true

The bottleneck line of GraphTheory:-SequenceGraph.

showstat(GraphTheory:-SequenceGraph, 14);


GraphTheory:-SequenceGraph := proc(L::list)
local ind, IND, v, Nbr, w, n, A, i, j, deg, E, comp;
       ...
  14       E := `union`(E,{seq({v, w},`in`(w,Nbr))});
       ...
end proc

 


Download degree_sequence.mw

 

@Kitonum 

This will also work in older versions of Maple:

H:= table(zip(`=`, [t], L)):

Indeed, (x,y)-> x OP y can be replaced with simply `OP` for almost all binary operators OP and in almost all contexts. 

@MDD 

It's not an error. I explicitly forbade 0 as the target because it needs to be treated as a special case. However, if you insist, here's a version that does what you want with 0:

PolyLinearCombo:= proc(
     F::list(polynom),
     f::polynom,
     V::set(name):= indets([F,f], And(name, Not(constant))),
     $
)
local C:= CoeffsOfLinComb([f, F[]], V);
     if f=0 then  return (true, [0$nops(F)])  end if;
     if C[1]=0 then  (false, [])  else  (true, -C[2..] /~ C[1])  end if
end proc:

@MDD 

The third argument to PolyLinearCombo, if present, must be a set, not a list. So change that to

PolyLinearCombo([1], a, {x});

and 

PolyLinearCombo([a], 1, {x});

If you do that, you'll get correct results.

I made a small change so that if you accidentally enter a list, you'll get an error:

CoeffsOfLinComb:= proc(
     L::list(polynom),
     V::set(name):= indets(L, And(name, Not(constant))),
     $
)
local
     c, k, C:= {c[k] $ k= 1..nops(L)},
     S:= solve({coeffs(expand(`+`((C*~L)[])), V)}, C),
     F:= indets(rhs~(S), name) intersect C=~ 1
;
     eval([C[]], eval(S,F) union F)
end proc:


PolyLinearCombo:= proc(
     F::list(polynom),
     f::And(polynom, Not(identical(0))),
     V::set(name):= indets([F,f], And(name, Not(constant))),
     $
)
local C:= CoeffsOfLinComb([f, F[]], V);
     if C[1]=0 then  (false, [])  else  (true, -C[2..] /~ C[1])  end if
end proc:

@Markiyan Hirnyk 

Okay, you're right, it's easy. Yes, I read the (very brief) help before replying. It has nothing to say on the matter. The key thing is that GraphTheory:-SequenceGraph maintains the order in its generic sequence labelling---a fact that isn't mentioned on its very brief help page---but which I can see from reading the procedure's code.

Anyway, my procedure has significant pedagogic value for teaching this fundamental graph algorithm (often the first algorithm taught in a graph theory course). It does three things simultaneously: It determines whether the sequence is graphical, it generates the required graph, and it maintains the vertex order.

@Markiyan Hirnyk 

Answer edited. Actually, I edited it while you were replying.

By the way, you mean ?fracdiff rather than ?fdiff.

@Markiyan Hirnyk Sure, here's an example.

 

N:= 17:

G:= GraphTheory:-RandomGraphs:-RandomGraph(17,.5);

GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17], Array(%id = 18446744074200383230), `GRAPHLN/table/14`, 0)

DS:= GraphTheory:-DegreeSequence(G);

[6, 10, 10, 4, 9, 8, 7, 10, 7, 11, 5, 5, 7, 8, 7, 8, 10]

V:= combinat:-randperm([a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z])[1..N];

[n, m, c, x, w, r, i, e, j, h, b, l, d, u, z, k, a]

G:= GraphTheory:-SequenceGraph(DS);

GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17], Array(%id = 18446744074200383350), `GRAPHLN/table/15`, 0)

GraphTheory:-DrawGraph(G);

 


Now your job is to relabel the vertices using the original correspondence. That is, n must have degree 6, m must have degree 10, c must have degree 10, x must have degree 4, etc. You may do it programmatically or "by hand". Of course, I'll allow you to regenerate the random selections, in which case the actual correspondences will differ.

Download degree_sequence.mw

@Markiyan Hirnyk It would be difficult to do that while maintaining the original correspondence between the degrees and the labels, especially for a large graph. To do it automatically would require a procedure about as long as the one that I just gave.

@Mac Dude 

Fourteen years ago I wrote a program to convert plots to logarithmic form (along 1, 2, or 3 axes). This was long before the option axis[n]= [mode= log] existed. IIRC, it worked on any plot structure except the ISOSURFACE (the structure used by implicitplot3d). I have no idea what it'll do with dual-axis plots (I don't know whether you're using those). It has options that give you a lot more control over the tickmarks than even with the modern tickmarks options. It's in the Maple Applications Center under the name "Improved logarithmic plotting in 2 and 3 dimensions".

If you can't figure it out, send me your program that generates the non-logarithmic plot, and I'll see if I can adapt it.

@Mac Dude 

Simply showstat(`plots/display`);

There's no need to fear overwriting your Maple installation. Just save any changed procedures to your own directory.

@tomleslie 

At first I considered suggesting DynamicSystems:-BodePlot, but I can't see how to make it work with explicit data, which I think is what the OP has.

@Axel Vogt 

Good procedure, Axel. It may go a long way towards an algorithmic solution to the problem. I replaced your floor with ceil, and it made no difference in any example that I tried. But I wonder if there is any example where it makes the difference between an answer and no answer.

Kitonum: Your example h(n) shows a limitation in Maple's product, not really in limit. Of course, all infinite products and sums are limits of sequences, but the areas of Maple that are used are very different.

@Kitonum Yes, I know that the actual sequence is increasing. I am saying that your sequence of floating-point approximations produced at Digits = 10 is not monotonic, so that you can't say that the "accuracy falls". Actually, the accuracy varies erratically. 

@lham Sorry, I counted wrong. The equation has five variables (or one variable and four parameters), not four. So your question isn't as ridiculous as I first thought. The command to solve such equations is

solve(..., parametric);

But I wouldn't call it a "parametric equation"; I'd call it an "equation with parameters". Unfortunately, the above command only works for polynomial equations. See ?solve,parametric.

First 480 481 482 483 484 485 486 Last Page 482 of 711