Carl Love

Carl Love

26658 Reputation

25 Badges

11 years, 228 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

@RezaZanjirani Try this to get the side-by-side plots:

plots:-display(
    plots:-densityplot~(
        `<|>`(DiffrP||(1..3)), 0..1, 0..1, title=~ `<|>`("diffrP"||(1..3)),
        labels= [alpha, delta], labeldirections= ["horizontal", "vertical"],
        colorstyle= SHADING, restricttoranges
    )
);

There is some subtle and undocumented difference between 2021 and 2023 that caused the error. It's too minor to fuss about.

Regarding what you call "the traditional way": I don't see how plotting where certain functions are positive or negative can tell you which is the max.

Regarding multiple conditions: It's easy: Assign numbers, 1, 2, 3, etc., to the various combinations of conditions that you want. Then plot that number with densityplot.

@C_R I don't see any difference in the two strings you just posted.

I don't see any conjugation bar over any occurence of n or m in your worksheet. Please point out exactly where you see one.

The || opertaor allows even shorter syntax for sequencing:

`&#`||(945..969)||`;`;

@mmcdara momi, and mn are needed when the name is part of a larger MathML structure, even if no modifiers are wanted.

How do you want to handle something like sin(ln(y))?

@MaPal93 I asked because if the solutions are equivalent, then it should be possible to verify that the first two are independent of gamma. One way is to take the derivative with respect to gamma and substitute a variety numeric values for the other variables, and gamma=1. Then use evalf, and you should get values close to 0.

@nm You could just use 

inttrans:-laplace~([ode_sys], t, s)

@Ronan Continuing my last Reply: Here's my original code and an equivalent version that doesn't use subs:

#Original:
(LmR,Eq0):= subs~(
    _M=~ [(E,A)-> ((lhs-rhs)~(E)[], A[]), (E,A)-> (E[], (A =~ 0)[])],
    (S::{set,list}({`=`,thistype}(algebraic)))-> 
        `if`(S::set,`{}`,`[]`)(_M(selectremove(type, S, `=`)))
)[]:

#Equivalent without subs:
LmR:= (S::{set,list}({`=`,thistype}(algebraic)))->
    `if`(S::set,`{}`,`[]`)(
        ((E,A)-> ((lhs-rhs)~(E)[], A[]))(selectremove(type, S, `=`))
                  #####################     
):
Eq0:= (S::{set,list}({`=`,thistype}(algebraic)))->
    `if`(S::set,`{}`,`[]`)(
        ((E,A)-> (E[], (A =~ 0)[]))(selectremove(type, S, `=`))
                  ###############
     )
: 

Note the parts of the separated procedures that are highlighted in blue. Those parts are the only parts that differ in the two procedures; the identical remaining parts are redundant. My programming philosophy places high value on removing such redundancies to whatever extent possible. That is why I used subs.

@Ronan Thank you for your question, and I welcome any other questions that you have about this code.

When making a substitution with subs into a procedure, the target of the substitution must be an unassigned global variable. Using unevaluation quotes or :- won't work. By convention, variables beginning with an underscore shouldn't be assigned. Note that _M also occurs in the arrow procedure that is the final argument of the subs. That second _M is replaced by one of the two arrow procedures equated to _M in the first argument of subs.

Those globalness restrictions for subs when its last argument is a procedure are not well documented, and I don't know if they're all still true in Maple 2023.

I wasn't the one who deleted some other version of this Question, nor did I even see that version. However, the Moderator who deleted it did not consider it to be spam. There are other reasons that Questions get deleted by Moderators, the most common of which is that it was considered to be a close followup to a recent Question posted by the same author. In those cases it should be posted in the toriginal thread.

As a Moderator, I wish that we had the capability to simply move an out-of-place Question to the correct thread. Unfortunately MaplePrimes lacks that capability.

Are the different "strategies" that are used in your worksheet intended to produce solutions that are mathematically equivalent but for which that equivalence is difficult to verify due to the enormous complexity? Or, are they different ways of approximating the true complete solution and thus not 100% mathematically equivalent?

It goes without saying that it's impossible to Answer your Question if you don't post the code. As a worksheet showing a timed example would likely be best.

@mmcdara Here's an example to show the multi-argument capability of ~, which would be quite awkward  to duplicate with map:

f~([a,b], X*Y, [c,d], [1,2]);
               [f(a, X Y, c, 1), f(b, X Y, d, 2)]

Here is, I believe, the only situation where ~ and map are equivalent: Let be an object of one of the four basic container types that I mentioned in my last Reply. Let a1, a2, ..., ak be a sequence (possibly empty) of additional arguments, none of which are of any of those container types. Then map(f, La1a2, ..., ak= f~(L, a1, a2, ..., ak). (Both map and ~ can be overloaded by object methods, which can alter those rules somewhat.)

Regarding map(f, Lversus map(x-> f(x), L): They produce the same result, but the former is more efficient, and can be much more efficient some cases, such as when f is a builtin command. In most cases (whether or not map is involved), (x-> f(x)) can be replaced by simply f, and it's more efficient to do so.

@nm Are you saying that in some earlier version of Maple, solve needed the parametric option to solve that pair of linear equations? I find that hard to believe. Indeed, one can get the solutions symbolically for uninstantiated initial conditions:

sol:= <c1,c2>^+.(<3,-1> +~ exp(4*t))/4/exp(t):
ICsol:= solve(eval([y(t) = sol, D(y)(t) = diff(sol,t)], t= t0), [c1,c2]);
simplify(eval(ICsol, [t0, y(t0), D(y)(t0)]=~ [4, -3, -17]));

First 7 8 9 10 11 12 13 Last Page 9 of 691