Carl Love

Carl Love

28055 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

I have no idea how or why this Answer got turned into a separate Question. I had nothing to do with it.  Unfortunately, I have no way to put it back where it belongs: an Answer to "Expand and negative exponent".

@Rouben Rostamian  Your choice of file extension, .maple, is a bit unfortunate because it's used for the "meta-worksheets" that were introduced a few versions ago. (These are collections of worksheets, variable assignments, and associated files.) The most commonly used extension for plaintext Maple code is .mpl.

@Oliveira See the help page ?worksheet,reference,initialization

@radaar The command map doesn't do multiprocessing. Why not try gradually increasing the value of numcpus as I suggested? Start with kernelopts(numcpus= 2).

@Thomas Richard Yes, I only used expand for pedagogical reasons. For practical coding, I'd use orthopoly:-T(5,x) to get the polynomial in place of expand(cos(5*arccos(x))).

@radaar Yes, using Grid:-Map will use a lot of memory. From your example worksheet, it doesn't seem like that will be a problem. Just increase the number of processors until you either run out of processors or memory. The memory usage should be roughly a linear function of the number of processors. If it isn't, there's likely some bug that'll require expert attention.

@nm Your Answer is okay for the n=2 case, but has no relevance to the other cases. That's fine, but I want to alert the OP not to try to apply your Answer to the other cases, because doing so could cause confusion.

I don't see how this Answer deserves a vote up, although someone gave it one.

@radaar Use

kernelopts(numcpus= 8);

etc. It may be that you need to issue this command immediately after a restart. Or, maybe that bug has been fixed and you can issue it anytime.

@minhthien2016 Geez, you can't figure that out on your own? For 3-4-5, the solutions are pure rational, so there's no RootOfs, so SolA is a single solution set rather than a sequence of multiple solution sets, so SolA[1] needs to be changed to SolA.

@WmEllis That's great. But I wonder how it originally got set incorrectly.

If you measure "total time" / "number of solutions", your procedure is still much faster.

It should be possible to easily modify your procedure to return the first solution found, if that's wanted.

 

@WmEllis You should set this permanently, because it affects all output, not just matrices. You can do this from the menus: Tools => Options => Display => Output display; select either "Typeset Notation" or "2-D Math Notation"; close the menus with "Apply Globally".

If at any time you need to see output in plaintext ASCII characters (which is very useful for debugging), you can do

lprint(%);

to see just the last output in plaintext; or you can do 

interface(prettyprint= 0); 

to see it in plaintext until you reset it with

interface(prettyprint= 2); #or 3

A closely related setting is 

interface(typesetting= extended);

(My Goodness, why didn't they just make this prettyprint= 4?) In my personal opinion, this extended level is not fully implemented, and it's riddled with bugs. But it is user-adjustable for every type of expression to be output. The opposite of extended is standard.

By the way, there's another way to enter your matrix, which I usually find more convenient:

A:= <1,6; 2,7; 3,8>;

This has no effect on the way that the output is displayed, so it doesn't have anything to do with your Question.

Another entry format is to enter the transpose followed by the transpose operator ^+:

A:= <1,2,3; 6,7,8>^+;

@Nadeem_Malik 

1. I see that you're ignoring my suggestion to convert CylinderD to HermiteH

The command evalc is used for simplifying complex-number expressions under the assumption that parameters are real. So, picking up where my last message left off:

#Fourier transform oF exp(-t^2)/t^a*Heaviside(t):
F:= 2^(a-2)*sqrt(Pi)*exp(-w^2/4)*
   ((sec(a*Pi/2)-I*csc(a*Pi/2))*HermiteH(-a,-w/2) + 
    (sec(a*Pi/2)+I*csc(a*Pi/2))*HermiteH(-a,w/2)
   )
;
#Get spectrum:
S:= simplify(evalc(F*conjugate(F)));

#Do a little simplification by hand:
H:= w-> HermiteH(-a, w/2):
S:= 4^(a-1)*Pi*csc(a*Pi)*exp(-w^2/2)*
   (csc(a*Pi)*(H(-w)^2 + H(w)^2) - 2*cot(a*Pi)*H(-w)*H(w))
;

I just used some trivial trig identities. There were no HermiteH identities that seemed to apply. The above simplifications are only fully valid for a and w real due to my use of evalc.

2. Use eval to give values to parameters, for example, eval(S, a= 0.3).

3. The plot can be made by

plot(eval(S, a= 0.3), w= -15..15);

@Nadeem_Malik 

CylinderD is a special mathematical function. See ?CylinderD and FunctionAdvisor(CylinderD(a,w)). It can be (and probably should be) converted to HermiteH by convert(..., HermiteH).

The inttrans:-fourier command is very weak, IMO. It is supposed to resort to direct integration if it otherwise fails, but it never seems to. You might as well just use direct integration.

If you want to use Heaviside, the direct integration works fine:

int(exp(-t^2-I*w*t)/t^a*Heaviside(t), t= -infinity..infinity);
simplify(convert(%, HermiteH));

#Then I simplified by hand to:
2^(a-2)*sqrt(Pi)*exp(-w^2/4)*
   ((sec(a*Pi/2)-I*csc(a*Pi/2))*HermiteH(-a,-w/2) + 
    (sec(a*Pi/2)+I*csc(a*Pi/2))*HermiteH(-a,w/2)
   )
;

 

First 261 262 263 264 265 266 267 Last Page 263 of 709