Carl Love

Carl Love

28035 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@gal By "I can't reproduce your situation", I mean that if I copy your code into my Maple, then I get what we both expect: the output from the print statement. So, there must be something going on that is too subtle to be revealed by your plaintext transcription of your code. Hence, we need to see a worksheet. This is often the case with errors arising from 2D Input.

@becejac You have an older version of Maple. Please put your Maple version in your Question headers using the pull-down menu provided for that purpose, because I hate having to retrofit answers that I could've written correctly the first time.

The retrofit is

`*`(map(`+`@op, combinat:-choose([x||(1..n)], k))[]) = 0;

Your Question either has typos that I can't disambiguate[*1] or is missing crucial details. Please post the worksheet.

This is a Question, not a Post, so I moved it.

Your title is somewhat offensive because it implies that it's the writers of Maple rather than you who has done something wrong. You should change it to "I don't understand why subs does this."

[*1]Such as: Is eh a variable, or does it represent a product e*h? Is com2 the function (aka procedure) or is it simply a part of the output of a function whose name you didn't tell us? Is com2(e,e,f)=eh+he supposedly the definition of function com2? If it is, it can't work because = is not the assignment operator :=.

@Joe Riel After much thought, I decided that your way was indeed better than what I had (and I promoted your Reply to an Answer and gave it a Thumbs Up). Then, after 20 or so rewrites of it, I got my answer to Question 3 as well! It happens that this didn't require thismodule. Here it is:

KandR:= module()
local
   params:= Record(a::algebraic, b::algebraic, c::algebraic, e::algebraic),

   #procedure that lets user set parameter values:
   ModuleApply:= proc()
   local A, savAL:= kernelopts('assertlevel'= 2); 
      for A in args do 
         if A::({'symbol','string'}='anything') then params[""||(lhs(A))]:= rhs(A) fi
      od;  
      kernelopts('assertlevel'= savAL);
      return
   end proc
;
end module:

Unrelated note: Joe, I think that you'd be interested in my recent Post about Fisher's exact test because I used your recursive idea about generating contingency tables (from ?Iterator,BoundedComposition). My algorithm requires the product of the factorials of the entries, not just a count. Your Iterators are amazingly fast! I did a 3x3, n=1000, example requiring 45 million tables in 12 minutes, and a 2x3, n=75, example requiring 295 tables in 50 milliseconds. In this era of mathematical software packages, many statisticians recommend that an exact test be used whenever n < 1000.

@BaptisteK Here's some code for it:

f:= (R,L)-> Pi*R^2*L:
g:= (R,L)-> 2*Pi*R*(L+R):
A:= solve({g(R,L)=1}, {L});
plots:-spacecurve(eval([R,L,f(R,L)], A), R= 1..10);

We can't start at R=0 because has a factor of R in the denominator.

You'll need to show an example of it not producing printout.

@brian bovril With the same initial error: error (in ModuleApply) index must evaluate to a name when indexing a module? Sorry, but I have no way of testing this; I'll need your help to debug it.

I don't have an idea yet how to do it, and this wouldn't make it any easier or harder, but I noticed that your code doesn't use the d3 that you defined. So, do you need to change the plot to include d3?

@Ramakrishnan There are some differences between `if` and if:

  • `if` is a builtin procedure. It always takes exactly 3 arguments and (like any procedure) it always returns a value. It's name is in quotes because if is a reserved word. In the call `if`(BC, TV, FV)BC is a boolean condition: something that will evaluate to true or falseTV is the expression which will be evaluated and returned if BC is trueFV will be returned if BC is false. You may use ifelse in place of `if` in case you don't like quotes.
  •  if ... then ... is a statement. It may or may not return a value. It may or may not have an else clause.

Yes, you can make an assignment using `if` (or any other procedure call) before the call to SetProperty.

@brian bovril Odd. Do you have Maple 2018 initial release, or release 1? I have release 1, and the code still works for me. I thought that my use of thismodule with an abstract index was too good to be true! I'll post corrected code in a few minutes. 

And here it is: FoxesAndRabbits.mw

@vv Re "undefined": I was just giving an example, not trying to cover every case. To me more complete, I'll change "undefined function symbol" to "unevaluated function[*1] or function whose zeroth operand is undefined." Your Beta(...is an unevaluated function, and your `&+`(...is a function whose 0th operand is undefined. Your other 4 examples

['''f''', A](x), `[]`('''f''', A)(x), `+` ('''f''', A)(x), `or`('''f''', A)(x);

are not functions (because they get evaluated immediately).

Re (builtin) evalapply: No, it's the actions of evalapply on non-functions that are builtin. These are mostly trivial and documented minimally at ?evalapply. It's just that we can't see the code. I think that in all cases where a function is used as the 0th operand of another function, the expression is evaluated by a Maple-coded `evalapply/...procedure. For example, see `evalapply/D`.

Re `evalapply/[]`: It's ignored because neither [a,b] nor `[]`(a,b) (after its immediate evaluation) are functions. But if you force `[]` to return unevaluated, then it is a function, and `evalapply/[]` applies; as shown in this example:

restart:
ListDeconstruct:= L-> '`[]`'(L[]):
ListDeconstruct([a,b])(x);
                          [](a, b)(x)
`evalapply/[]`:= (`[](...)`, X)-> map(`?()`, `[](...)`, X):
ListDeconstruct([a,b])(x);
                         [](a(x), b(x))

[*1]When I type anything in inline boldface in MaplePrimes, it is either actual Maple code, or a term that is being used strictly as it is literally used in Maple code (as opposed to, for example, Maple documentation or common CompSci or mathematical English). So, when I type function, I'm strictly referring objects f such that type(f, function) is true

@mmcdara I would agree with you about that in general, but that situation does not occur in this problem. That minimum cell-size restriction of 5 applies to the expected cells, not to the observed cells. In this problem, the expected cell sizes are 

< 16, 10, 24;
      8,  5, 12 >
.

I've also implemented Yates's continuity correction to Pearson's test and Fisher's exact test. I'll be posting those shortly.

@phbmc I know that it's probably the principle of the thing, but I would guess that checking all 55 candidates could be done faster than solving even 1 equation, let alone 26.

I don't understand this statement: 

  • Solving L[4] = R[2] in the equations I gave above yields the solutions a1 = 3b/5 and a2 = (4b-5)/5

How can solving 1 equation provide solutions for 2 variables?

@Christian Wolinski What you have is an obfuscated example where you're doing some crazy type of recursion with unevalution quotes and partial evals. You could do the same type of thing in Maple V[*1]; maybe the syntax required for it was slightly different then. Unevaluation quotes were then and are now the most awkward part of the language.

What kind of practical thing do you want to do that this behavior is preventing?

Symbolics is alive and strong is Maple, and new symbolic features are added nearly every release. Great recent additions include subsindets and evalindets, inert operators and the InertForm package, objects, and overloadable operators.

[*1]My first Maple version was Maple V r4. Perhaps there existed r1, r2, and/or r3 where unevaluation quotes behaved substantially differently.

@vv I didn't say that the behavior of `or` was a natural and logical result of the overall design! I didn't say anything at all about `or`. We already know that `or` and `and` evaluate weirdly from another recent thread. It's the application of a list as a function that I was referring to as natural and logical.

Regarding `&+`: It's just an undefined function symbol; you might as well replace it with foo; the behavior is the same. In order for an undefined function to have any behavior when it itself is applied as a function, you must define a procedure `evalapply/foo` to describe the behavior.

First 297 298 299 300 301 302 303 Last Page 299 of 708