Carl Love

Carl Love

28055 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

My most-common reaction to a parametric solution is "I don't want to see that much detail, although I do appreciate that it's there, and I certainly don't want to see a piecewise expression that's many screens wide." Filtering the output is tough work though, and it'd be great to have a subpackage to SolveTools for that. 

Now, I hope no-one takes that comment the wrong way, because the mathematical computation behind this is absolutely astounding, and the Maple code appears well written, although I've just skimmed it. It's in package RegularChains, which contains thousands of procedures (when you include the locals).

@nm I'm so sorry, change name to algebraic. I've been coding directly from my mind to my phone, with no Maple in between, the past few days because I'm on a long-distance household-moving project and getting very little sleep to boot. 

If you're syntax checking initial conditions from user input, you should check that they don't contain the independent variable (which would be nonsense IMO). Thinking about that is why I had name on my mind.

If you display your worksheet inline here, there's a good chance that I could answer your question immediately from my phone. I'm traveling at the moment, and so I can't load your linked worksheet into Maple to view it.

@emendes I have no question about either the syntax or semantics of @, so there's not much point in you making any major accuracy test of it. For any f, g, and x (even if they're sequences), (f@g)(x) = f(g(x)) and (f@g)~(x) = (f~@g~)(x). (In both cases, that's identical equality, not just mathematical equality.) The only question that I have is whether either of the forms on the left sides of those two are more efficient than the corresponding right sides, and whether that may depend on whether or g are built-in. 

Regarding the rational functions: Yes, that's exactly what I meant.

@Carl Love My Reply immediately above has been significantly updated, with very important details. I only added stuff without altering its original content. So, I'm just posting this to bump this thread up in the Recent queue.

@vv I'm speaking of what may be possible mathematically, not of what can be done with a stock Maple command. If one knows only a finite number of terms of two series f and g, there are many functional operators such that one can find a finite number of terms of F(f,g). I think that something akin to that may be possible. 

@emendes Use this as a replacement for abs:

Pabs:= e-> {e, -e}[1]:

Then, regardless of whether you use Classify or my procedure, replace rhs~ with (Pabs@rhs)~.

Given two single-argument commands and g, I'd guess that (f@g)~(e) is more efficient than f~(g~(e)), and I'm even more inclined to make that guess if at least one of f or is built-in (as is rhs). The reason that I'd guess that is that I think that `@` itself is built-in, giving it an ability to optimize this in ways that are not possible for Maple-level code. I'm traveling and on my phone right now, so I can't check this, but @acer or @Joe Rlel may know off the top of their heads.

Both these or the versions with simply rhs will only detect equalities that can be detected immediately, i.e., without doing any symbolic work such as simplify. Since I'd generally expect that different solutions to a particular system of equations would be returned in the same general form by solve, I don't expect this to be a problem. (For example, it seems unlikely that 2^(1/2) and 4^(1/4) would both appear in the same solution set.) Are the initial equations always rational functions with rational coefficients? If so, then it seems even more unlikely.

@Maple_lover1 Yes, here is my version that makes those requested changes, as well as a few others. I use the same subs-into-a-procedure-template technique that acer used in his Reply "Another way". This technique is extremely powerful symbolically (much more than unapply), yet also extremely efficient; however, it takes a lot of practice to master.

By replacing the doubly nested procedures with triply nested procedures, I was able to isolate the second simplify so that it would be performed only once for each n and m, but with symbolic x. I also was able to replace the "heavy" command piecewise with a simple `if`.

functionB:= proc(
    k::nonnegint, M::nonnegint,
    epsilon::(positive &under (evalf@`+`, 1)), gamma::(positive &under (evalf@`+`, 1))
)
option remember;
local m;
    subs(
        [
            __K= 2^(k-1), __M= M, 
            __h= subs(
                m= __m,
                simplify(
                    2^(epsilon+gamma+1)*GAMMA(epsilon+m+1)*GAMMA(gamma+m+1)/
                        (2*m+1+epsilon+gamma)/m!/GAMMA(epsilon+gamma+1),
                    assume= m::nonnegint
                )
            )
        ],
        proc(n::integer[0..__K], __m::integer[0..__M-1])
        option remember;
        local x;
            subs(
                 __f= subs(
                     x= __x, 
                     simplify(2^(k/2)*__h*JacobiP(__m, epsilon, gamma, 2^k*x-2*n+1))
                 ),
                 (__x::algebraic)-> `if`(n-1 <= __x*__K and __x*__K <= n, __f, 0)
            )
        end proc
    ),  
    (x::algebraic)-> (1-x)^epsilon*(1+x)^gamma
end proc
:

I tested this identically to how acer tested his, including the initial assignments to globals nm, and x. I obtained identical results, except for the wording of the error messages (which I strongly prefer to handle through argument type checking). Because of the triple nesting, all calls such as psi(-1, 0, x) need to be changed to psi(-1,0)(x).

All variables that begin with double-underscore are what acer called "dummies". They are the variables within the procedure templates which receive the substitutions from outside the templates. Unfortunately, the subs technique requires that these be global unassigned symbols. Since you should never make an assignment to any global variable beginning with a double underscore, this is likely safe. When the subs technique is used correctly, none of these globals remain in the returned procedures.

To facilitate argument-based type checking, I used two parameterized structured types that are unfamilar to most readers. The first is &under, and the second is integer[A..B]

type(e, T &under f) is true iff type(f(e), T) is true.
type(e, T &under (f, a)) is true iff type(f(e,a), T) is true.

type(n, integer[A..B]) is true iff n::integer and A <= n and n <= B.

@Kitonum You wrote:

  • Since Maple does not explicitly solve your system of differential equations (only numerically)....

That's not quite true. Maple gives an exact series solution, which is not as sophisticated as a fully symbolic solution, but more sophisticated than a numeric solution. There's a lot of symbolic processing that can be done with series. If we suppose the existence of a function such that y(t) = F(x(t)) for all (possibly restricted to some interval), it may be possible to determine the coefficients of series(F(x), x= ...(i.e., with x as the independent variable). I don't know how to do this for this particular system of equations, but I'm not yet willing to say that it's impossible, unless you have some proof (or even evidence). 

@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.

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