Carl Love

Carl Love

28035 Reputation

25 Badges

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

MaplePrimes Activity


These are answers submitted by Carl Love

As may have occurred to you already, the coefficient 14 is irrelevant to solving the 90% problem. Then the problem becomes finding the 90% quantile of a statistical gamma distribution (with parameters 3 and 2 in this case).

G:= Statistics:-RandomVariable(Gamma(3,2)):
Statistics:-PDF(G, t);

    

Statistics:-Quantile(G, .9);

     11.6691605096023

This is an ideal situation to use a key sort. The key in this case is mu. I have assumed that your Vector does contain the backquotes as you presented it, hence the use of parse.

sort(A, key= (r-> -eval(parse(rhs(r))):-mu));

The minus sign makes it the descending sort that you want.

You need to change Subgroup(lc) to :-Subgroup(lc), or else avoid loading the GroupTheory package with with and rather access its procedures using the GroupTheory:- prefix

Oh boy, that's a very subtle distinction in this case, and I foresee that this type of thing will be a huge source of confusion with the new object modules. The documentation at ?LeftCoset says

  • The data structures representing (left or right) cosets respond to the following methods.
  • ...
  • Subgroup( c ) returns the subgroup of the coset c.

 

What tipped me off to use :- was the word "methods". That implies that the cosets are represented as objects with the "method" Subgroup being coded in that object's own module. So, this does not refer to that other procedure named Subgroup, the one whose code is in the GroupTheory module. Since you used with(GroupTheory), the name Subgroup (with no prefix) refers to GroupTheory:-Subgroup.

The confusion is compounded by it being very difficult (perhaps impossible) to find the name of the module where the "method" Subgroup for cosets is encoded. All you're given is that code number _m917...many digits..., that number being a memory address generated on the fly.

I avoid these problems by not using with! I only use it when the package overloads non-name operators that I want to use. For example, GroupTheory overloads (or overrides; I'm not sure which in this case), the vector constructor <...| ...>. If I'd wanted to use that as an operator rather than in the prefix form `<|>`(...), then I'd need with(GroupTheory).

What exactly do you mean by garbled? I see that the line breaks often occur in hideous, inappropriate places (depending on your screen width), but that's just the standard practice of Maple's so-called Standard GUI. Did you mean the line breaks, or something else?

Yes, it's easy. Right click on the plot to bring up its context menu. Select Manipulator -> Point Probe. Right click again. Select Probe Info -> Nearest Point on Line. Then left click on the plot.

Try replacing simplify with evalf and sum with Sum (both occurences). This is the standard Maple approach, but I can't test that it'll work without knowing the values of your constants (including sigma). If this doesn't work, try (additionally) replacing infinity (both occurences) with a large integer. Then use a larger integer and see how much difference there is.

Assuming that they're column vectors, which is the default, do

plot([<X|Z>, <Y|Z>]);

Starting with your original L, do

convert((`[]`@parse)~(L), 'list');

There are two different types of places in Maple where information relevant to your session are stored in RAM. The most important of these are called kernels (or sometimes engines). There is usually one kernel per worksheet (*footnote1), although you can make other arrangements (many worksheets using one kernel or many kernels using one worksheet). Nearly all the commands that you literally type at a command prompt are directed at the kernel. So, this is the place where all the mathematical computations are done and which executes the Maple programming language.

The other type of place that stores information relevant to your session is the GUI or Graphical User Interface (*footnote 2). Nearly all commands executed with a mouse or arrow affect the GUI. It controls the way that things appear on your screen and things like statement labels. It controls copy-and-paste operations.

The ditto operators (%, %%, %%%) represent kernel memory. They are not equivalent to copy-and-paste. Anything on the right side of the arrow operator -> (or, equivalently, anything inside a procedure body) is not evaluated until the procedure is executed. So, x-> % is nearly meaningless. When a procedure is constructed by unapply, the arguments to unapply are first evaluated; so it'll work to use % there.

In your VectorCalculus example using labels, note Maple's response to your x-> (30). See that %id= <some long integer>? This refers to a specific vector (with that address), not a general vector that'll be constructed when the procedure is executed.

In summary, (1) don't use GUI features in procedure bodies (*footnote3), and (2) it's generally a bad practice to use ditto operators in procedure bodies, though it can work if done carefully.

*footnote1: I include command-line sessions as "worksheets".

*footnote2: I include the command-line interface as a possible GUI, though UI may be a more-appropriate initialism.

*footnote3: It is possible, even common, to control aspects of the GUI via plaintext commands in procedure bodies. I am referring to attempts to include non-plaintext GUI features in procedure bodies. That never works.

You could include the slope using the caption option within the plot command, like this

Explore(
   plot((a+2)*x+6, x= -5..5, view= -10..10, caption= typeset(`Slope `, a+2)), 
   parameters= [a= -4.0..3], initialvalues= [a= 1]
);

 

The first rule of numerical/computational linear algebra: Never invert a matrix of floats. That's a bit tongue-in-cheek, but you present a case-in-point.

1. The eigenvalue problem is still meaningful even if RS is singular, in which case only what you call the "direct method" will solve it.

2. Vv says that it's "almost singular". Hmm, I'd just outright say that it's singular with the nonzero value of the determinant being solely due to round-off error.

Suppose that the vector is V. Then do

select(type, op(2,V), posint=And(positive, Not(infinity)));

The result will be a set of equations. The left side of each equation will be an index, and the right side will be the corresponding entry.

To select all terms of poly which contain a name with literal subscript __b, use

select(hastype, poly, suffixed({unames()}, identical(__b)));

You may want to adjust that if you have cases where poly has only 1 term. Let me know.

Your inner while-loop condition is while A > B. Nothing inside that loop changes A or B. Therefore, the loop can't ever end.

By setting

printlevel:= 2:

at the start of your session, you will be able to see the results of the inner-loop computation.

When mod is presented with a polynomial, it acts on the coefficients only; the variables are considered transcendentals. This allows one to create fields of order p^k, k > 1, and even matrices over those fields. If you want to do modular arithmetic with symbolic variables that represent integers rather than transcendentals, then use irem instead of mod. For example,

irem(2*n+1, 3);

returns unevaluated.

You need the procedure at to act gracefully and return unevaluated when it is given symbolic (nonnumeric) arguments. This is similar to using the single unevaluation quotes, but more robust. The procedure will check for nonnumeric arguments and in that case return 'procname'(args). Change at to this:

at:= (x, yy)->
   `if`([args]::[realcons$2], `if`(x=0, Pi/2, arctan(yy/x) + `if`(x<0, Pi, 0)), 'procname'(args))
:

 

First 189 190 191 192 193 194 195 Last Page 191 of 395