Carl Love

## 21223 Reputation

8 years, 249 days
Natick, Massachusetts, United States
My name was formerly Carl Devore.

## Those parameter ranges make it hopeless...

@MapleEnthusiast You wrote:

• The domains for the parameters are as follows: For all pi, p, and gamma, we have pi, p, gamma∈[0,1], as well as epsilon>0.

Then it's hopeless because under those parameter ranges any of the denominators in rows 3 or 4 could be 0 or arbitrarily close to 0.

## Gershgorin for stochastic matrices...

@vv You wrote:

• The Gershgorin theorem is too simple to hope for a proof. It is useless even to prove the result for standard stochastic matrices.

That's not true at all. For a standard stochastic matrix, the only possible Gershgorin circles have centers in the interval [0,1] and radii 1-c. All such circles lie within the unit circle. This proves that the spectral radius is <= 1. On the other hand, it's obvious that 1 is an eigenvalue with the eigenvector being composed of all 1s. Thus, the spectral radius is 1.

## Quantum leaps?...

My knowledge of quantum matters is rudimentary, so this Reply may be completely wacky, but aren't those discontinuities literally the "quantum leaps"?

## Post worksheet...

You'll need to post a worksheet showing the two results. Use the green uparrow on the MaplePrimes editor's toolbar.

## Why I addressed the indexed/subscripted ...

@acer You wrote:

• I see only mention of indexed names in the current version of the Question. Did the OP actually ever ask about "subscripted" names? Otherwise, I don't understand why Carl wrote at length here about so-called atomic, subscripted names versus indexed names.

The double-underscore syntax is relatively new (compared to the square-bracket syntax) and relatively unknown. I thought that there was a good chance that the OP was unaware of the distinction and unaware of the potential harm that could come from assigning to indexed names. And if they were unaware, I thought that there was a very good chance that they'd decide that using subscripted names would be better for their purpose. Note that unaware users making assignments to indexed names is a major source of problems reported here. Neither indexed nor subscripted names are explicitly mentioned (in those terms) in the Question.

## Further notes on local-object-module typ...

@Carl Love Further notes on the code in the Answer above:

1. The code originally had a line ModuleLoad() as the second-to-last line (I'm not referring to the ModuleLoad() that is the fourth-to-last line). This line did nothing, neither good nor bad, and I removed it. It was simply a leftover from a preliminary version of the code that I forgot to remove before posting.
2. The code originally had a line ModuleType::static:= ()-> true. This line could do something; however, I decided that what it did do was not a signifcant enough part of the educational purpose of this example, so I removed it.
3. The global keyword type name :-person_type and the local object-submodule name person_type are different names, just like any local/global pair whose names just happen to be spelled the same. It is simply by convention that the primary type associated with an object-module has a name spelled the same as the object class itself. The type name could be changed to any global symbol simply by replacing the two occurences of :-person_type with :-footype, or whatever.
4. Despite this thing with the global type name, the object-module itself is still 100% local and inacessible (via ordinary, non-hacking means) to the outside world. (The primary hackish means of accessing module locals from the outside is setting kernelopts(opaquemodules= false), which allows module locals to be accessed via the A:-B syntax as if they were exports.) ​​​​​​

## Eigenvalue inequalities...

@MapleEnthusiast Do you have ranges to bound all the parameters? If so, I would start by finding ranges for each matrix entry. The Maple command evalr can do this. Then try to apply the Gershgorin circle theorem.

Regarding the Collatz-Wieland formula: There are a number of generalizations of it and related spectral inequalities in this Wikipedia article: Perron-Frobebnius theorem. While these generalizations only apply to non-negative matrices, this article is extremely detailed and worth reading (although its style is a bit more colloquial than the typical Wikipedia article).

Would you please define precisely what you mean by "the largest eigenvalue (not in absolute value)"? How do you order the nonreal eigenvalues without using absolute value? (On the other hand, it's trivial to prove that 1 itself is an eigenvalue of any square matrix whose rows sum to 1, regardless of the signs, arguments, or magnitudes of the entries.)

I think that the algebraic/polynomial approach that you've begun (i.e., finding algebraic expressions for the eigenvalues) is doomed due to the infeasibility of the computations, in particular the inequality computations.

## Digits, digits, epsilon...

@mmcdara You wrote:

• Thanks acer for correcting me on the number of digits that some _d01ajc  can handle. If I have thought it there was such a limitation, that is because, while I was working on Mehdi's example, I got an error message...:

```Digits:=20:
evalf(Int(x, x=0..1, method=_d01ajc))
Error, (in evalf/int) expect Digits<=15 for method _d01ajc but received 23
```

There is a limitation; however, I think that acer meant that that limitation is not as strict as you may have believed. The overall computation is limited to Digits <= 15, but the integrand evaluations can be done at higher precision, as in

```Digits:= 15:
Sin:= proc(x::realcons)
Digits:= 20;
evalf(sin(x))
end proc
:
evalf(Int(Sin, 0..Pi, method= _d01ajc));```

If acer meant something substantially more general than this, I hope that he'll say. (Note that Digits is what is called an environment variable: a global variable whose value, when changed within a procedure, reverts to its previous value upon the procedure's exit.)

• Would the plot command automatically apply evalf?

Yes, or evalhf if that happens without error. This is not a special property of Int wrt plotplot will do it for any procedure.

• I agree with both of you that explicitely specifying the tolerance or using epsilon option would be a better way to get the desired accuracy.

I don't know what you mean by "or" in that sentence. The epsilon option is the way to explicitly specify the tolerance.

## epsilon and digits options to int...

@acer In this paragraph:

• int(eval(A1+A2,omega=20.099752),theta=0..Pi, numeric, digits=5)
is not the right way to get 5 accurate digits in general, or even to force a coarse tolerance near say 1e-5.... More approriate is to specify the accuracy tolerance explicitly, instead of having it be implied by an unholy low value for the working precision.

I believe that what acer means is that it's better to use the epsilon option to int to control the precision; the digits option only controls the precision of the sub-computations. If that's what he means, then I wholeheartedly agree. (I'm only posting this Reply because he didn't explicitly mention the epsilon option in that paragraph.)​​​​​​

## How would you do inequalities?...

@MapleEnthusiast Suppose that somehow you eventually got 4 large symbolic expressions for the eigenvalues. Since it's a 4x4 matrix, this can be done by solving a 4th-degree polynomial; so, it is doable, and the expressions would only be, I guess, a few pages long (prettyprinted). Now how would you go about comparing the magnitudes of those expressions to 1? This seems to me to be a task far more complicated than getting the eigenvalues algebraically via the quartic formula.

## Subticks...

@acer I did that to fake the unlabeled subticks. It's still not 100% what I wanted because fake subticks are the same length as regular ticks but true subticks are shorter.

Also (as I'm sure you're aware), multiplication by the degree symbol doesn't typeset properly.

## You're right...

@vv Yes, you're right. The part about moving mod to the end must be used with caution, and only when one knows that it'll be appropriate.

## Bijective correspondences between partit...

@Joe Riel There are many remarkable bijective correspondences among the partitions of an integer n. Some of these would make your mentioned changes to Iterator:-Partition unnecessary, because they'd already be covered (essentially) by Iterator:-PartitionFixedSize. The correspondences most relevant to this thread are

1. The number of partitions of into exactly k parts equals the number of partitions of whose maximum part is k.
2. The number of partitions of into distinct parts equals the number of partitions of n into odd parts.
3. The number of partitions of into exactly k distinct parts equals the number of partitions of n - k*(k-1)/2 into k not-necessarily-distinct parts.

## Conditions and plots...

@David Sycamore The techniques for generating the many sequences that you ask for vary considerably. However, the techniques required for your followup questions about conditions and plots do not vary. You've been shown these techniques umpteen times by me and by other respondents. Try to learn them! Try to do it, and if you get a error, then post it and ask.

```N:= 2^16:
ta:= CodeTools:-Usage([SeqA](N)):
memory used=350.04MiB, alloc change=31.00MiB,
cpu time=5.11s, real time=4.88s, gc time=812.50ms

Cond1:= n-> ta[n]+ta[n+1] > n:
select(Cond1, [\$1..N-1]);
[1, 2, 3, 4, 17, 26, 30, 64, 87, 266, 313, 358, 405, 484, 547,
2686, 15894, 22283, 36552, 50769, 54333, 59410, 59418, 59419,
59437, 59438, 59439]

Cond2:= n-> ta[n]>n:
select(Cond2, [\$1..N]);
[]

plots:-pointplot(`[]`~([\$1..N], ta), symbol=point);
```

## My style...

@Bendesarts My style for that would be

```MAINPACKAGE:= module()
local XM:= 1;
export
ZM:= 3,
SUBPACKAGE1:= module()
local X1:= XM;
export Z1:= ZM;
end module
;
:-YM:= 2
end module
:
```

That is, to whatever extent that it's possible, a meaningful assignment should be made to a variable at the point that it's declared local or export. If nothing meaningful can be assigned, then leave it blank.

 4 5 6 7 8 9 10 Last Page 6 of 592
﻿