Carl Love

Carl Love

28100 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@Axel Vogt 

What is the essential difference between

int(..., numeric, epsilon= ...)

and

evalf(Int(..., epsilon= ...))?

Your Question has two attached worksheets with the same name. Are they in fact the same worksheet? Your cover text implies otherwise. If they are different, they should have different names.

@Mac Dude Thank you for selecting my Answer.

When I use unevaluation quotes, I try to keep the "span" of the quotes as narrow as will get the job done, even if that means I need some extra pairs. So, I did ''Vector''('Element') rather than ''Vector(Element)''. This helps me---a tiny bit---to understand which parts are being evaluated and when. Still, figuring out when multiple pairs of quotes will be needed is my least-understood part of the Maple kernel (from my user-level grey-box perspective---I have no direct knowledge of the kernel code).

I am still baffled by this difference between Maple versions. See the recent comments to Acer's Answer below.

@acer I've looked through the code for TypeTools:-Exists, its needlessly opaque underling TypeTools:-known, and TypeTools:-AddType in both Maple 16 and 18. I can see no change. Do you have any conjecture about the reason for the difference? Are you aware of any kernel-level change in evaluation rules?

@acer Can you confirm whether the two pairs or quotes do make a difference in Maple 17 or Maple 16.02 (which I used)?

@Athar Kharal Using Maple 16.02, I get no square brackets.

@sazroberson 

Most of StringTools is that way, and they are also not thread safe.

@sazroberson 

Your technique of initializing the list will only work for lists with fewer than 101 elements. Maple begrudgingly allows this extremely inefficient technique for these short lists. Every time an assignment is made to the list, a new list is created, and all the other elements are copied to the new list. That's what I meant by the interpretter faking it to make it look like a list is being modified.

I see no point in learning these techniques.

 

@Kitonum 

Thank you. The ~ operator was introduced in Maple 13, I believe. To run in Maple 12, simply convert it to map:

P:= (n::posint, m::posint)->
     map(
          x-> (d-> `if`(d[1]=d[-1], x, ``))(convert(x, base, 10)),
          LinearAlgebra:-RandomMatrix(n,m, generator= rand(100..999))
     )
:

(I don't have Maple 12, so I can't test that to be absolutely sure, but I'm sure that you'll report back. I believe that the above will run in Maple 6 and later.)

(The ~ is not exactly equivalent to map; however, it is equivalent when its second argument is an rtable, table, list, or set.)

@sazroberson The one place that I've seen a long integer constant effectively used is in isprime (see showstat(isprime)) where the first steps of primality testing are computing the gcd of the test number with products of small primes. However, my aversion to unindented code (and to "magic" numbers) is strong enough that were I writing isprime, I'd write a meta-procedure that would explicitly generate the small primes and would produce the final version of isprime as automatically generated code. Such meta-procedures are trivial to create in Maple using subs.

@Markiyan Hirnyk If the problem is linear in the coefficients (as Preben says), then there is only one minimum.

@Markiyan Hirnyk 

Okay, I've modified the code so that it takes any combination of Vectors (row or column), Array slices, or even lists. If the data are stored as a 2 x n Array M, the procedure can be called via

(AA,BB):= Select(f, M[1,..], M[2,..]):

If the data are stored as an n x 2 Array M, the procedure can be called via

(AA,BB):= Select(f, M[..,1], M[..,2]):

@smith_alpha Both $ (the sequencing operator) and || (the concatenation operator) have help pages. See ?$ and ?||. If, after reading those, you have further questions, please ask.

Three caveats to my code above:

1. It assumes that f is a table, not a list or array. If your code is exactly as you presented for n = 2, then will be indeed be a table.

2. It assumes that k has no assigned value.

3. It assumes that x1, ..., xn are global variables, rather than locals as, for example, in a procedure.

If any of these caveats are violated, the code can be easily modified to accomodate that.

 

@John Starrett So it sounds like you've found a bug in Statistics:-Fit also. That is much more likely to be fixed. If I understood the math behind it, I'd write a bug report.

To upload a worksheet and attach it to your post, use the green uparrow, which is the last item in the second row of the toolbar of the MaplePrimes editor.

If there is a bug, it's almost certain that it'll never be fixed because the stats package is deprecated. Use Statistics:-Fit instead.

First 512 513 514 515 516 517 518 Last Page 514 of 709