Carl Love

Carl Love

28070 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@KCPower Suppose that you need to sum the first 1000 integers. The symbolic approach is to first derive a formula for the sum of the first n integers and then substitute n=1000. The formula is n*(n+1)/2. The numeric approach is the straightforward addition of the 1000 numbers. If you were doing the problem without a computer, then the symbolic approach would be better if you knew how to derive the formula.

But you do have a computer. In Maple, the symbolic approach would be

eval(sum(k, k= 1..n), n= 1000),

and the numeric approach would be

add(k, k= 1..1000).

The latter is many times faster than the former! But, obviously there is some n above which the symbolic approach is faster. Deciding when to switch between symbolics and numerics is often the key to efficient programs.

@tsunamiBTP I didn't say that either Z = tau was a special case; I said that either Z = -1/tau was a special case. Your failure to make the distinction between the two is a bad sign.

Now I suppose that you'll say that neither Z can equal -1/tau either. But then why is there a t^2*exp(-t/tau) term in your particular solution? I believe that such a term can only occur if Z[1] or Z[2] equals -1/tau.

@KCPower Wow, you learn Maple quickly!

There are only two things to improve that I see immediatey:

  • When symbolic summation isn't possible, but regular addition is, use add instead of sum. The syntax is the same, so just change sum to add.
  • Factor sqrt(2) outside the sum and make it sqrt(2.).

I don't have time right now, but it'd be worth thinking about the "big picture". Is there any part of the computation that's being redone unnecessarily? Are there parts that can be done symbolically so that the numeric part becomes simply substituting for a parameter?

@tsunamiBTP You are trying to do everything with generic coefficients. I don't know why you'd want to do this: It seems like a lot of tedious work to obtain a not very interesting result. Yet, I don't think that you've made it tedious enough: There are numerous special cases that need to be handled. Consider your partial fraction decomposition. It is only valid if Z[1] <> Z[2]. So you need to handle Z[1] = Z[2] as a special case. Then in the undetermined coefficients, there are special cases that ensue if Z[1] or Z[2] or both are equal to -1/tau.

@Matt C Anderson It's true. Let n, x, y be positive integers. If x*y = n, then there are three possibilities:

  • x < sqrt(n), y > sqrt(n)
  • x > sqrt(n), y < sqrt(n)
  • x = y = sqrt(n)

Furthermore, y is uniquely determined by x, so the divisors can be put into pairs, except for the x = y = sqrt(n) case.

Compare with:

select(n-> numtheory:-tau(n)::odd, {$1..1000});

@Christopher2222 Isn't bookmarking handled much more elegantly by your web browser?

@acer A sans-serif font is more-tiring to read for regular-sized main-body text. This is well known among font experts. (How many professionally printed books have you ever seen in a sans-serif font?) This is something that not even StackExchange always gets right: math.stackexchange.com uses a good serifed font, whereas stackoverflow.com does not. Serifs were invented for a reason; they're not just decoration.

The previous version of MaplePrimes also used a sans-serif font, but I think that it's now been changed to a worse one. You may be able to use your browser settings to override MaplePrimes font selection. I've already done this in FireFox. Here's how: Options => Content => Fonts & Colors => Advanced, then uncheck "Allow pages to choose their own fonts..."

Your code is difficult to work with. Please redo it without using the same letter A in both cases. The second case overwrites the first. Then I can't compare the two sets of coefficients at the end.

Also, you claim that these sets of coefficients are different. Yes, they appear different, but are you sure that they're truly different? I'm not saying that they're the same. I just want to know what makes you so sure that they're different. Can you provide numeric values of the parameters that prove that they're different?

@tsunamiBTP The bug that you encountered---that files with certain special characters in the name can't be uploaded---also existed in the prior version of MaplePrimes. Unfortunately, the error message only says something akin to "Error, couldn't upload file."

@awass Yes, it would've been easy enough for solve to have been coded this way. But Maple does provide a mechanism by which you can redefine procedures to accept input for which they weren't originally intended, using very few lines of code: overload.

local solve:= overload([
   proc(V::Vector) option overload; :-solve(convert(V,set), _rest) end proc,
   :-solve
]);

You can put that in an initialization file.

@Moses Tenne The command to get 70 digits of precision is as you originally wrote:

Digits:= 70;

The 70-digit number that you entered is nonsense to Maple, and I'm baffled as to why you didn't get an error message. The part at the end, `70.*^-38, violates several rules of Maple syntax. Try

9.1256223744000000041048405246803968037257471953759678468102033290122\
7075175300672646212456658597e-38;

The interface command that I gave only affects the precision at which numbers are displayed; it has no effect on how they are stored or computed. If displayprecision is set at -1 (which I think is the default), then numbers are displayed at whatever precision they are stored.

@J4James Please don't use the title line of a Reply to hold information which should be placed in the body of the Reply. As you can see, it gets cut off, and so I can't see your error message.

convert(..., piecewise, ...) needs to be told a variable with respect to which to break into intervals. So how about this?

convert(simplify(sol), piecewise, y) assuming 1 < x, x <= y;

This doesn't seem to require any expand or collect.

@Scot Gould I already figured out the problem and Answered below, so this is a moot point, but you need to run the problematic command after issuing the trace command in order to get any useful information. The output of the trace command itself is just a list of the procedures for which you've used the trace command---pretty much worthless information. What trace does is modify the procedure so that when it is run debugging information will be printed.

You may be able to simplify out the Heun functions if you supply two initial conditions for the ODE.

First 373 374 375 376 377 378 379 Last Page 375 of 709