Carl Love

Carl Love

28025 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@cbowers Try changing ^+ to ^%T. Both are operators for the matrix/vector transpose. The %T may work in your Maple version. If not, let me know, because there are other easy options.

@emendes The command abs is highly symbolic, assumption-processing, complex-expression-processing, abstract-function-processing, and definitely not threadsafe. If you were to use it, I suspect that it would be the most time consuming part of the operation. If the only reason that you want to use abs is to put e and -e in the same equivalence class for any e, then we can come up with something better. Is e always a polynomial (in all of its unknowns)? If not, is it always a rational function (quotient of polynomials}? If unknowns appear under radicals, it's an algebraic function, and it becomes much trickier.

@emendes The option nolist is a keyword argument, as are the majority of options used in Maple commands. Keywords need to be global unassigned names. The punctuation marks surrounding the keyword are to guard against the off-chance that the keyword has been replaced by a local (the :- guards against that) or assigned a value (the '...guards against that) unintentionally by some unrelated code.

Regarding tables: Yes, understanding tables is very important for writing efficient Maple code. In the code above, class is a table of tables. Building sets one element at a time can be efficiently done by collecting the elements as a table's indices with all the corresponding entries set to () (almost equivalent to NULL).

@emendes If the code had returned the result of {entries}, that would've been the entirety of each equivalence class. We just want the first member of each class as its representative. If it were op(1, ...), that would be the 1st equivalence class; op~(1,  ...makes it the 1st member of each class.

I don't know if the above explanation of op~ is what you were asking for. 

@anthonyfl I don't think that there's any possible Answer that's substantially better than Kitonum's below. What don't you like about it? Perhaps it can be improved a little by the addition of some color. As Tom said, the part of the question that asks for 2D and 3D renderings is a bit vague.

Please don't post duplicates of Questions; we'll just delete them. If you wish to draw additional attention to your Question, post a Reply to it or to one or more of its Answers. In this case, it seems to me that the Question has already been partially Answered below. So, you'll need to say why these Answers are not satisfactory. To me, Kitonum's Answer (see its 3D update) is satisfactory.

@emendes ListTools:-Classify appears to me to be well written. Nonetheless, I wrote a version of it specialized for your task. From theoretical considerations alone, I think that there's a good chance that this will be very slightly faster. The gain in speed may be too small to measure. Here it is:

RemoveSymmetricSolns:= proc(S::set(set(name= algebraic)))
#Condense equivalence classes of symmetric solutions to a single representative by
#temporarily ignoring the variable names on the left sides.
local class:= table();
    for local e in S do class[rhs~(e)][e]:= () od;
    op~(1, {entries}({indices}~(class, ':-nolist'), ':-nolist'))
end proc
:    
#Example use:
V:= {x,y}:
Sol:= {SolveTools:-PolynomialSystem}({x*(x^2 - 2), y*(y^2 - 2)}, V, explicit)
    minus {V=~ 0}
;
RemoveSymmetricSolns(Sol);

Both this procedure and the original ListTools:-Classify are threadsafe, even though Classify isn't listed in the index of threadsafe functions. That's simply an oversight.

If it's guaranteed that for each solution all of the other members of its symmetry equivalence class (i.e., all permutations) do appear, then perhaps this procedure can be vastly simplfied and made faster. Let me know.

My guess is that pdsolve does not consider the possibility of expanding any transcendental function.

@mmcdara There are a great many Questions here about fractional differential equations, but very few Answers.

@DJJerome1976 

The command heap has existed for over 20 years (as is apparent from its non-module interface). I've been aware of its existence for all that time, and I've always wanted to learn it, but I never had a good application. Indeed, I've never seen it used either in user code or in library code. Now I am happy that I finally got to use it and doubly happy that it worked so well, especially considering that it was a first-time use.

Heaps are one of the fundamental data structures of computer science. See the Wikipedia article about them: https://en.wikipedia.org/wiki/Heap_(data_structure). Reading the article, I see that the Maple implementation lacks a few of the standard features. In particular, my code above would benefit from the replace feature, which does an extract followed by an insert, but with only one rebalancing.

@mmcdara You are the one who introduced the concept of random sample to this thread. If this thread were about random samples, then your elaborately and correctly made points would be worth more consideration here. But this thread is just about choosing things at random. It can be done two ways: with replacement or without replacement. Both ways are totally valid. With replacement is the default, but without replacement is also very commonly used and it's totally valid to call it random even though you are correct that it doesn't give a random sample.

@emendes Solutions which are identical under symmetry (more precisely, under a permutation of the variables) can be removed like this:

V:= {x,y}:
Sol:= {SolveTools:-PolynomialSystem}({x*(x^2 - 2), y*(y^2 - 2)}, V, explicit)
    minus {V=~ 0}
;
op~(1, {entries}(ListTools:-Classify(rhs~, Sol), 'nolist'));

 

I should've said earlier that both of us made the same common-sense interpretation of the help page's phrase "partial solution", but our interpretation doesn't seem to be the reality! Indeed, the reality seems to be quite the opposite: The notzero option removes what we call partial solutions even though that's not desired. So, I'm just as confused as you are by the phrase. I don't know what should be considered to have a bug: the command, its help page, or our common sense.

My policy here on MaplePrimes is usually to primarily advise on how to use Maple as it is rather than as it should be. In this case, that means ignoring what the help page says about the option. Although that's not usually the right choice, I see no alternative in this case, unless someone else provides more details about the option.

@acer Yes, of course, the precedence issue makes no difference in an expression with only one infix operator. I merely pointed it out the because using the operators infix was usually at best awkward and at worst erroneous (in a hard-to-detect way) before the issue was fixed.

@emendes I forgot outer parentheses in my Answer above. It should've been:

({SolveTools:-PolynomialSystem}({x*(x^2 - 2), y*(y^2 - 2)}, {x, y}, explicit)
    minus {{x,y}=~ 0})[];

Of course, the only purpose of the (...)[] is to convert the set to its underlying sequence. If you prefer the results as a set, you might as well just not use the []. Either way, the fact that it had been a set at one point means that the duplicate removal has already happened, and that's irreversible.

I'm working out the details of a way to remove solutions that could be considered duplicates under symmetry.

 

First 152 153 154 155 156 157 158 Last Page 154 of 708