Carl Love

Carl Love

28055 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@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.

@Alejandro Jakubi 

In this case I'm inclined to say that the documentation is wrong. But perhaps the behavior of op is wrong. I definitely see nothing wrong with the bahavior of subs.

@Rouben Rostamian  

Preben's explanation in terms of op is not quite correct, but I didn't say anything before because I didn't think an example like yours would come up. The command op does often probe two levels deep into the expression tree, thereby skipping over accessible subunits. To see the complete tree, use ToInert:

P:= 5*a*b:  ToInert(P);

     _Inert_PROD(_Inert_PROD(_Inert_NAME("a"), _Inert_NAME("b")), _Inert_INTPOS(5))

From this, we see that a*b is a distinct subunit of 5*a*b, hence it is accessible by subs even if it's not accessible by op.

I am going to disagree with Alejandro on this point: I think that the "grey box method" ToInert tells you everything that you need to know to understand this situation, although that stuff about assumptions is quite interesting.

@Markiyan Hirnyk 

I prefer

plots:-implicitplot(
     r^2 = 5 - 4*cos(theta), r= -4..4, theta= 0..2*Pi,
     coords= polar, axiscoordinates= polar, gridrefine= 2,
     thickness= 3
);

@baustamm1 

The whole expression is an operand of itself, as can be seen by using unevaluation quotes:

 op('P');

                                      a*b

Your equations are far, far too complicated to solve symbolically. If you supplied numeric values for t and b1, you may be able to solve numerically for gam0, gam1.

By the way, it's a very bad coding practice to use t both as a free variable and a variable of integration.

 

@jonlg Yes, I realize now that I was overly hasty in asking you for the parameters, because they were in the first attached worksheet. My first reaction was just to look in the code in the main post.

I am working on a solution for you. It's a strange problem that I don't understand, but I think that I have a way to workaround it even if I don't understand it.

@acer 

Your `print/%mixed` is not working for me. Using lprint, I see that %mixed(17/6) is generating the correct function call, %mixed(2, 5/6). But the prettyprint is just giving me NULL. I'm using Maple 16.02, Standard, on Windows 7.1 Home Premium; no initialization file. My Tools->Options->Display settings are Input=Maple Notation, Output=2D Math, Tysetting Level = Maple Standard.

@Kitonum +1 for the excellent 3d cutaway plot.

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