sursumCorda

1219 Reputation

15 Badges

2 years, 141 days

MaplePrimes Activity


These are replies submitted by sursumCorda

For medium numbers of nodes, one may use the simulated annealing or the genetic algorithm to find a route whose length is at least close to the minimum as well (see Approximate a Solution to Traveling Salesman Problem). But strangely, though a number of built-in procedures use compiled subroutines from NAG Library as their underlying engine and to carry out and accelerate computations and there does exist a function h03bbc provided by the NAG that approximately solves the symmetric TSP, GraphTheory:-TravelingSalesman still does not make use of this NAG solver. (Why? I read that "the incorporation of the NAG library into Maple is an ongoing project" (cf. work on including NAG routines for other types of numeric computation is continuing); maybe the developers of GraphTheory package are not very familiar with those of the LinearAlgebra package ….) 

Edit. Here is an additional comment. MatLab's marketing literature claims that classical TSPs can also be solved by mapping them to the so-called Quadratic Unconstrained Binary Optimization (QUBO, not MILP) problems, which appear to be a terra incognita of Maple's Optimization package.

@Christopher2222 I think that @Preben Alsholm's answer is easier to solve your question, so I removed my less convenient one. 

@Carl Love & @Christopher2222 Thank you very much! I hope there will be more competitive data structures (e.g., a skip list implementation) in the core/kernel/engine in a future release.

@Carl Love Thanks for your clarification. 

Though "exprseq" is not a valid type, I'd like to know if the `,=` operation for an existing expression sequence (not a 1-dimensional rtable) is potentially inefficient. In Maple, "set" is a immutable structure, so the `union=` manipulation can be less efficient when incrementally building up the large set from its members. Will the use of `,=` add a significant amount of processing time to certain computations as well?

@Christopher2222 Unfortunately, the link is dead again, but as I see it, wasn't a (table-based array)-based vector or a one-dimensional Array enough at that time? (And was the use of a linked list recommended in this situation?) If I have understood correctly, nowadays a better choice should be the newer DEQueue object.
By the way, is there a similar performance characteristic of the built-in StringTools:-StringBuffer?

@Carl Love I have updated the code (and modified the wording). The contemporaneous `cat` still performs better.
As for the backwards compatibility, I read that "a command (or package) is deprecated when its functionality has been replaced by an improved implementation". Considering such tests, why hasn't the `StringTools:-StringBuffer` object been superseded by some newer commands on modern versions of Maple? I do not mean that it should not be supported; I am simply curious about why it is not marked as a “deprecated” command? (Besides, to my mind, this behaves more like a counsel of perfection than a controversial complaint.)

Since A219954(n)=(A160414(n)-1)/4 for n ≥ 1, it's enough to generate the sequence A160414, but there has been a Maple program in this link. 

@Christopher2222 In an old question Will Maple factorize certain HUGE polynomials (modulo 𝑝, if desired) more quickly?, I mentioned some benchmarks about the algebraic manipulation. For example, the Fermat Tests contain five tests: evaluation of rational functions, smith normal form, resultants, rational function arithmetic, and a multivariate determinant. (Besides, if one need to test the performance of the built-in fsolve, one may consider the database of polynomial systems. Other tests: Independent CAS integration testsIndependent CAS ODE testsmatrix rank test, Solving PDE's using CAS, and a set of sample problems in unconstrained optimization. See also SageMath vs. Magma (Benchmarks).)

@C_R Unexpectedly, Wolfram's marketing literature provides an extensive test suite to benchmark the performance on a significant subset of the numerical computations.
Here is the given source code: the_entire_test_suite.mpl

Note. Although over a test suite of 828 tasks, covering different operations on different types of numerical data, Mathematica was faster in 813 cases, this document is of doubtful fairness, since the numeric computation environment in Maple follows the international IEEE®-754 floating point standard (not IEEE Std 754-2019) that is thoroughly understood and documented (cf. numericrefs), while Mathematica uses a proprietary numeric model derived from something called “significance arithmetic”, which is claimed to be "an extremely powerful technique that offers many advantages" over floating-point arithmetic (see details of the implementation). However, we may ignore such marketing stuff and nonsense and only focus on those examples that can be tested on different computers as a benchmark. 

Another test suite can be found hereExact computational linear algebra tools.

@MDD This can be done likewise: 
 

restart;

aux0 := proc(d::nonnegint, bases::Or(list, set)(symbol))::set; local w; coeffs(expand(eval(convert(`+`, function, convert(bases, list))**d)), bases, 'w'); {w} end:

aux1 := (m::set, n::set) -> expand({eval}(MmaTranslator:-Mma:-Distribute(m*n, set, `*`), set = expand@``)):

F := table([F1 = {x-y}, F2 = {-x*y*z+z^3, x*y^2+y*z^2-z^3}, F3 = {-x^2*y*z+z^4, x*y^3+y*z^3-z^4}])

F[F2] union= aux1(F[F1], aux0(2, {x, y, z}));

{x*y^2-y^3, x^2*y-x*y^2, x^3-x^2*y, x*z^2-y*z^2, -x*y*z+z^3, x*y*z-y^2*z, x^2*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^3*y*z-x^2*y^2*z, x^4*z-x^3*y*z, x*y^3+y*z^3-z^4, x*y^2*z^2+y*z^4-z^5, x*y^3*z+y^2*z^3-y*z^4, x*y^4+y^3*z^2-y^2*z^3, x^2*y^2*z+x*y*z^3-x*z^4, x^2*y^3+x*y^2*z^2-x*y*z^3, x^3*y^2+x^2*y*z^2-x^2*z^3}]

(3)


 

Download 237017-How-Can-I-Do-A-Particular-Type-Of-Partitioning.mw

@Carl Love Many thanks. This version works now. I hope there is such a functionality in ListTools (It appears that this package only gives attention to `list` and `listlist` and largely neglects their generalizations.) in a future release.

@Carl Love Thanks. This procedure returns correct results with the default second parameter `max`. But I guess that there is some misunderstanding. Your procedure seems to check if the input is a exactly depth-`max` rectangle nested list (Am I right?), while my main purpose is to determine if the input can be rectangle when considering it as a nested list with a depth up to `max`. (I'm not sure if this is clear as my English is poor.) 
I try to explain this by some examples. If the second argument is not be specified, `IsRectangular` will simply determine if a nested list is completely rectangular and yield its deepest "rectangular" level. (This is correct.) And as for the two arguments form, this should be something like: 

IsRectangular([[[[l], 2], [3, 4]], [[5, 6], [7, 8]]], 2); 
# should return “true, 2”, since if we treat it as a depth-2 nested 
# list (that is, [[…, …], […, …]]), it will become rectangle again.
IsRectangular([[([l], 2), [3, 4]], [[5, 6], [7, 8]]], 2); 
# should return “false, 1”, since here, the level-2 part is ragged.

Besides, I think that to distinguish these two cases (i.e., `max` only, and 1 through `max`), one may consider using `IsRectangular(..., [max])` and `IsRectangular(..., max)`, respectively.

@dharr I don't know why the built-in degree is not purely syntactical. Sometimes it seems that applyrule (which stems from the "structure" or "pattern") is more powerful instead.

@dharr For instance, 

powers(sqrt(y)*((x^y - 1)/y - ln(x)), x, y);
 = 
    [[                
    [[                
    [[                
    [[  / y    \      
    [[  |x    1|      
    [[  |-- - -| x    
    [[  \x    x/      
    [[--------------, 
    [[ y              
    [[x  - 1          
    [[------ - ln(x)  
    [[  y             

      / y                                         \       ]]
      |x  - 1                                     |       ]]
      |------ - ln(x)          / y          y    \|       ]]
      |  y               (1/2) |x  ln(x)   x  - 1||  (1/2)]]
      |-------------- + y      |-------- - ------|| y     ]]
      |      (1/2)             |   y          2  ||       ]]
      \   2 y                  \             y   //       ]]
      ----------------------------------------------------]]
                          y                               ]]
                         x  - 1                           ]]
                         ------ - ln(x)                   ]]
                           y                              ]]


But the output should be "[[0, 1/2]]".

@acer Thanks. Actually, I don't quite understand why the creators and designers chose such a rule; in my opinion, this is somewhat unnecessary. For instance, if there is no automatic simplification process, “(a-b)/3” will only take one `-` and one `/`, but as the automatic simplification exists, it always immediately becomes “a*(1/3)+b*((-1)/3)”, which is, in effect, of less simplicity. Doesn't this simply make some (numerical) evaluations more complicated/expensive?

First 9 10 11 12 13 14 15 Last Page 11 of 23