Carl Love

Carl Love

28100 Reputation

25 Badges

13 years, 103 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

@tomleslie Changing some operators to prefix form is an unfortunate effect of converting 2D input to 1D, which happens when you copy-and-paste. So X$n always gets converted to `$`(X, n) without it being directly the fault of the OP.

The use of square brackets in the second argument of diff allows for the degenerate case of a zeroth-order derivative to be specified. For example:

d:= Diff(exp(x^2), [x$n]);
v:= value(d);

     v := x^(-n)*2^n*MeijerG([[0, 1/2], []], [[0], [1/2+(1/2)*n, (1/2)*n]], -x^2)

simplify(value(eval(d-v, n= 0)));

     0

The above's last line would be syntactically invalid without the square brackets in the first line.

@dsh1

Well you better check yourself before you go accusing people of being wrong, because if you copy-and-paste this input

geom3d:-point~([A,B,C], [[8,3,-9], [-6,-6,-2], [6,9,-3]]):
geom3d:-line(L1, [A,B]):
geom3d:-line(L2, [C, [2,4,-1]]):
geom3d:-distance(L1,L2);

you'll get 2*sqrt(5), not (388/545)*sqrt(545).

@Niek There is no problem with your pi because of the reason described by Preben Alsholm above. If you were to try using pi without menus and the mouse, then it would be a problem.

The syntax for assuming that an object has a property uses `::` rather than `=`. For example, Assume(rho::constant). I doubt that this type of assumption would have any effect on dsolve.

@emendes The only two things that I can recommend are the Maple Programming Guide and asking Questions here. The Guide is available in the onboard help system. Just enter ?ProgrammingGuide.

If there's any specific point of syntax that you'd like to ask about, I'd be glad to answer.

@omer Using recursion, it can be done as a one-liner in modern Maple (and even in older Maple):

SumToOneDigit:= (n::posint)-> `if`(ilog10(n) < 1, n, thisproc(add(convert(n, base, 10)))):

I just post this as an example to show how recursion is done in modern Maple. Acer's and Joe's very-well-known mod trick makes this procedure obsolete.

@firmaulana Tom Leslie's code works for me. Please post a worksheet so that I can see what you're doing wrong. It is impossible to use if as you show, without quotation marks, and not get an error message.

@emendes In the vast majority of cases, a procedure should use named parameters rather than relying on args. Yes, you should use proc(f::list, vars::list, samp:= T). This makes samp optional with a default value of T.

See my Answer below for a solution to the problem of iterating a multivariate function multiple times with simplification at each step.

@emendes 

I don't understand your use of T. Is it just a symbol?

@Vic Hmm. I haven't seen a full specification of your problem, but I'm going to guess that ListProcess will return NULL for the vast majority of cases. If that's not true, then you'll need a whole room full of disk drives just to store the cases for which it doesn't return NULL, and in that case, you might as well give up now. So, change the above line of code from Threads:-Map(ListProcess, LL) to LL:= Threads:-Map(ListProcess, LL). Thus the new LL will be much shorter than the old LL (NULL in a list takes no memory at all), which will be reclaimed by the automatic garbage collector. Then you write the new LL to disk.

I need to stop for the night.

@mmcdara Hmm, yes, of course. This was the first approach that I tried. I hope that you realize that my approach does linearize the problem automatically, uses exactly the same computational engine as yours, and produces exactly the same result. The reason that I didn't publish that first approach is that it requires manually taking apart the model function and re-entering parts of it into the code. The essence of elegance in programming is to reduce such redundancy. The goal is to enter the problem into the computer in as close a form as possible to its original statement and then to avoid, as much as possible, re-entering any subparts.

I do appreciate that your code shows a shortcut that I was previously unaware of: The tilde ~ can be placed after a function symbol (in prefix form) to zip that function as well as to map it. To wit: You used TX~(x,y) as a shortcut for zip(TX, x, y). I've already used that new knowledge twice in the few hours since I read your code.

@Vic It's often quite difficult to parallelize code, but in this case it's very easy, almost trivial. Make a list of lists LL such that each member of LL is one of the lists that you want to process and such that LL is as long as can comfortably fit in the memory of your computer. I'd guess that LL has on the order of a million members. Then simply do

Threads:-Map(ListProcess, LL);

@Adam Ledger Since you seem to like commands that are as short as possible, like I do, I thought that you'd appreciate that the pairing of the data could be done by `[]`~(X,Y)

Do you mean that you'd like a procedure that'd check whether the span of a set of vectors U is in the subspace spanned by a set of vectors V? What you're calling u and v are not usually thought of as single vectors as you are suggesting. Rather your u is the span of {<0,1,0>, <0,0,1>} and your v is the span of {<1,0,0>, <0,1,0>, <0,0,1>}. 

Thank you Preben and Acer. I guess that the problem has something to do with the package that I'm testing. The instructions for loading the package are quite complex, which is why I didn't mention it before. I'll post full details on loading the package later.

I'm also getting an error from exprofile, but not a "kernel connection lost". The error is "invalid nesting of calls and levels".

First 391 392 393 394 395 396 397 Last Page 393 of 709