Carl Love

Carl Love

27343 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@Andiguys I see in your wortksheet this procedure definition:

TRC:= (tau2, tau1)-> subs(DATA, `Πm`);

This is incorrect usage (although not necessarily an error) because the variables on the left side of -> do not explicitly appear on the right side, yet they appear indirectly via `Πm`. The indirect references will not be associated with the procedure parameters tau2 and tau1; instead, they will remain global variables. To create a procedure parameterized via indirect reference (this will also work for direct reference, but it's not necessary), use

TRC:= unapply(subs(DATA, `Πm`), [tau2, tau1]);

In Maple 2023+, MakeFunction is a synonym for unapply, because it makes more sense in common English.

@C_R I suspect that MapleSim doesn't have nontrivial arithmetic of matrices, polynomials, and even matrices of polynomials over finite fields, which is one of the uses of Maple's mod. By "nontrivial", I mean that the arithmetic includes determinants, inverses, and solutions of linear systems.

mod has two modes: modp and mods. The default is modp, which you're calling a "digital clock"; mods is the "analog clock". To change the mode, do `mod`:= mods before using mod in its usual form. `mod` is an environment variable, which means that if it's set in a procedure, it reverts after the procedure exits.

I don't understand why you object to using frem in the way you suggested.

@felixiao The plus sign "+" is also not allowed in a MaplePrimes file name.

@goebeld If ex is a mathematical expression, then

indets(ex, specindex(y))

willl return all indexed occurences of y as an independent variable. If you want to find indexed occurences of y as a functional variable (e.g., y[2,2](x)), then use

indets(ex, typefunc(specindex(y)))

or you could search for both of these with the single command

indets(ex, {typefunc, thistype}(specindex(y)));

To return just the set of indices used on y, use

[op]~(subsindets[2](Ys, function, 0, op))

where Ys is the set returned by any of the above indets commands.

There is never a good reason in Maple to convert a mathematical expression to a string to extract mathematical information from it. If you ever feel a need to do it, ask here for help.

@mmcdara My primary purpose was to illustrate that in this case converting it to a module-based package is so trivial that it can be done without even explicitly listing the exports

Yes, ToInert is definitely an experts' command, and FromInert is a level even beyond that.

@nm I missed StringTools:-Has in the index. I like it better than my evalb(SearchText("y", str) <> 0). Vote up.

@mmcdara Here, I directly copy the table to the module (record) without explicitly declaring its indices as exports. Nonetheless, a special feature of the Record constructor causes them to become exports anyway. Then I hack the record into a package. This works because a record is a type of module: It has all the module infrastructure except access to the keyword thismodule, which this hack gives it.

restart:
OrthoTable:= copy(orthopoly):
unprotect(orthopoly):
_:= N-> _Inert_ || N:
orthopoly:= (FromInert@subs)(
     ["record"= "package", _(PARAMSEQ)()= _(PARAMSEQ)(_(NAME)("thismodule"))], 
     (ToInert@Record@indices)(OrthoTable, 'pairs')
):
proc(m) uses orthopoly; H(m,x) end proc(2);
                               2    
                            4 x  - 2
with(orthopoly);
                       [G, H, L, P, T, U]

I call this type of hack "surgery": rebuilding with FromInert a modification of a structure exposed with ToInert.

@GFY You need to change all the initial conditions from x=0 to x=8.95. You only changed the first two.

Almost certainly you've unintentionally used gamma= 0.577..., as @mmcdara pointed out. However, my Answer still explains how to get past the singularity.

@mmcdara I believe that it would be trivial to rewrite it as a module. For example,

restart:
OrthoTable:= copy(orthopoly):
unprotect(orthopoly):
orthopoly:= module()
option package;
export 
    G:= eval(OrthoTable[:-G]), 
    H:= eval(OrthoTable[:-H]),
    L:= eval(OrthoTable[:-L]),
    P:= eval(OrthoTable[:-P]),
    T:= eval(OrthoTable[:-T]),
    U:= eval(OrthoTable[:-U])
;    
end module
:
proc(m) uses orthopoly; H(m,x) end proc(2);
                               2    
                            4 x  - 2
use orthopoly in H(2,x) end use;
                               2    
                            4 x  - 2
with(orthopoly);
                       [G, H, L, P, T, U]
H(2,x);
                               2    
                            4 x  - 2

However, for the sake of robustness, and to avoid possible backwards-compatibility issues, I think that it'd be better to name such a quick-and-dirty implementation something other than orthopoly, such as orthomodule.

Just a terminology note: Your equations are not integral equations; they're actually much simpler. Integral equations have unknown functions inside integrals. Your equations have nothing unknown inside the integrals; the only unknowns are the real-valued limits of integration. With a little bit of finesse and floating-point-error control, they should be solvable with fsolve, if they have solutions. It's my bedtime now, but I'll get back to this later today if someone else hasn't solved it yet.

@Oliver Munk Okay, then I guess that you mean that you set Windows Defender to not react to Maple, not that you turned it off completely while using Maple.

@Oliver Munk If you truly need to disable your anti-virus to stop this "freezing" problem, I don't think that that's acceptable. How about trying another anti-virus?

This isn't related to your Question. It's just a general hint for you:, You've done

pde1:= subs(case1, pde);
pde2:= subs(case1, pde1);

These would be better replaced by the single command

pde2:= eval[recurse](pde, case1);

I've found it useful to have a verifcation constructor &under just like the longstanding type constructor &under.

restart:

interface(prompt= ""):

#We model a verification constructor on this type constructor:
showstat(`type/&under`);


`type/&under` := proc(expr, theType, f)
   1   type(f(expr,_rest),theType)
end proc
 

VerifyTools:-AddVerification(
    #I'm using Maple < 2024 symbol=procedure syntax rather than Maple 2024
    #(symbol,procedure) syntax:
    `&under`= ((a,b,v::verification,f)-> verify(f(a,_rest), f(b,_rest), v))
);
#And just because I think it's ridiculous to spell out "less_than" in any
#computer code...:
VerifyTools:-AddVerification(`<`= ((a,b)-> verify(a,b,less_than)))
;

#So Austin's examples become these, reducing the need for ad hoc
#verifications such as length_not_increased:
verify(x+1/x, (x^2+1)/x, `<` &under length);

true

verify((x^2+1)/x, x+1/x, `<` &under length);

false

#Next we model the syntax e::t  =>  type(e,t) for verifications. It's not
#allowed to overload `::`, nor is `&::` allowed as an infix operator, so
#I'll settle for `&:`:
`&:`:= verify
:

#Now the examples can be written thus:
(x+1/x, (x^2+1)/x) &: (`<` &under length);

true

((x^2+1)/x, x+1/x) &: (`<` &under length);

false

 

Download VerifyUnder.mw

Could the kernel be modified so that when (a,b)::v is used in a boolean context, verify(a,b,v) would be invoked?

@Oliver Munk To check or set your Autosave status, go to Tools ==> Options from the main menu.

To load a Backup file, go to Files ==> Restore Backup.

5 6 7 8 9 10 11 Last Page 7 of 701