Carl Love

Carl Love

28025 Reputation

25 Badges

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

MaplePrimes Activity


These are answers submitted by Carl Love

Use back-quotes:

`E*`||(1..3);

These quotes will not appear in the ordinary pretty-printed output.

The first argument to dsolve should be a set (or a list is also acceptable) containing both the ODEs and the IBCs. You have

dsolve({eq1, ​​​​​​...}, IBC, ...);

Change that to

dsolve({eq1, ...} union IBC, ...);

or

dsolve({eq1, ..., IBC[]}, ...);

The two forms are equivalent ways to express a union of sets.

You will still have errors to overcome after this! The purpose of this Answer is simply to address your first error.

 

Controlling the order that variables appear in Maple `+` and `*` expressions is very tricky and usually not worth the trouble. This affects all expressions; it's not specific to CompleteSquareIt may depend on the order that they were entered in some (possibly unrelated) expression earlier in the session.

I ran my test using a sample size of 10^8 on every continuous distribution mentioned on help page ?Statistics,Distributions (except those whose names began NonCentral), testing both the upper (or "right") side of the distribution and the lower (or "left"). The distributions whose samples show a severe "fat-tail" irregularity (i.e., over-sampling of the tail) are ChiSquareErrorFRatioInverseGaussianLogNormal, and Normal.

For the InverseGaussian it's the tail of the corresponding Normal that gets over-sampled, causing an excessive number of values very close the 0.
 

Testing extreme-tail sampling of continuous distributions

Author: Carl Love <carl.j.love@gmail.com> 30-Nov-2019

restart
:

Digits:= 15
:

SampleCheck:= proc(
    Distr::function(realcons), N::posint,
    {tail::identical(left, right):= 'right'}
)
option `Author: Carl Love <carl.j.love@gmail.com> 30-Nov-2019`;
uses St= Statistics;
local
    X:= St:-RandomVariable(Distr),
    #Bin probabilities (smallest bin has expected size >= 5):
    P:= 10.^~[$ilog10(5/N)+1..-1],
    E:= N*~P, #expected bin sizes
    O:= (S-> #observed bin sizes:
        rhs~(St:-TallyInto(
            S,
            `if`(
                 tail='left',
                 `..`~(min(S)-1, St:-Quantile~(X, P, 'numeric')),
                 `..`~(St:-Quantile~(X, 1-~P, 'numeric'), max(S)+1)
            )
        ))
    )(St:-Sample(X,N)),
    #Compute two-tailed p-values using Normal approx to binomial:
    Z:= (O-~E)/~sqrt~(E*~(1-~P)),
    p:= 1 -~ abs~(1 -~ 2*St:-CDF~(Normal(0,1), Z))
;
    printf("\n%a, %a side:\n", Distr, tail);
    printf("probability  expected  observed  z-score  p-value\n");
    printf~(
        "    %1.1e  %8d %9d    %5.1f  %1.1e %s\n",
        P, round~(E), O, Z, p,
        #The smaller the p, the more stars, up to 5:
        (cat@op@`[]`@`$`)~("*", max~(0, min~(5, -ilog10~(p/~.05))))
    );
    return
end proc
:

Distrs:= [  
    BetaDistribution(2,1),
    Cauchy(0,1),
    ChiSquare(1),
    Erlang(1,1),
    Error(0,1,1),
    Exponential(1),
    FRatio(5,10),
    Gamma(1,1),
    Gumbel(0,1),
    InverseGaussian(1,1),
    Laplace(0,1),
    Logistic(0,1),
    LogNormal(0,1),
    Maxwell(1),
    Moyal(0,1),
    Normal(0,1),
    Pareto(1,1),
    Power(1,1),   #= Beta(1,1)
    Rayleigh(1),
    StudentT(2),
    Triangular(1,3,2),
    Uniform(0,1),
    VonMises(1,0),
    Weibull(1,1)
]
:  

randomize(23): #fixed but arbitrary number for repeatability
for X in Distrs do
    for side in [left,right] do
        SampleCheck(X, 10^8, tail=side)
    od
od;


BetaDistribution(2,1), left side:
probability  expected  observed  z-score  p-value
    1.0e-07        10         9     -0.3  7.5e-001
    1.0e-06       100       103      0.3  7.6e-001
    1.0e-05      1000      1009      0.3  7.8e-001
    1.0e-04     10000     10248      2.5  1.3e-002 *
    1.0e-03    100000    100064      0.2  8.4e-001
    1.0e-02   1000000   1000783      0.8  4.3e-001
    1.0e-01  10000000   9999326     -0.2  8.2e-001


BetaDistribution(2,1), right side:
probability  expected  observed  z-score  p-value
    1.0e-07        10         5     -1.6  1.1e-001
    1.0e-06       100        69     -3.1  1.9e-003 **
    1.0e-05      1000       955     -1.4  1.5e-001
    1.0e-04     10000      9713     -2.9  4.1e-003 **
    1.0e-03    100000     99789     -0.7  5.0e-001
    1.0e-02   1000000    999082     -0.9  3.6e-001
    1.0e-01  10000000   9999498     -0.2  8.7e-001


Cauchy(0,1), left side:
probability  expected  observed  z-score  p-value
    1.0e-07        10        13      0.9  3.4e-001
    1.0e-06       100        88     -1.2  2.3e-001
    1.0e-05      1000      1039      1.2  2.2e-001
    1.0e-04     10000     10008      0.1  9.4e-001
    1.0e-03    100000     99907     -0.3  7.7e-001
    1.0e-02   1000000   1000822      0.8  4.1e-001
    1.0e-01  10000000   9998273     -0.6  5.6e-001


Cauchy(0,1), right side:
probability  expected  observed  z-score  p-value
    1.0e-07        10        12      0.6  5.3e-001
    1.0e-06       100        90     -1.0  3.2e-001
    1.0e-05      1000       985     -0.5  6.4e-001
    1.0e-04     10000      9974     -0.3  7.9e-001
    1.0e-03    100000    100142      0.4  6.5e-001
    1.0e-02   1000000   1001117      1.1  2.6e-001
    1.0e-01  10000000   9995772     -1.4  1.6e-001


ChiSquare(1), left side:
probability  expected  observed  z-score  p-value
    1.0e-07        10        17      2.2  2.7e-002 *
    1.0e-06       100       121      2.1  3.6e-002 *
    1.0e-05      1000      1039      1.2  2.2e-001
    1.0e-04     10000     10031      0.3  7.6e-001
    1.0e-03    100000     99809     -0.6  5.5e-001
    1.0e-02   1000000   1000195      0.2  8.4e-001
    1.0e-01  10000000   9993546     -2.2  3.1e-002 *


ChiSquare(1), right side:
probability  expected  observed  z-score  p-value
    1.0e-07        10        22      3.8  1.5e-004 ***
    1.0e-06       100       153      5.3  1.2e-007 *****
    1.0e-05      1000      1042      1.3  1.8e-001
    1.0e-04     10000      9922     -0.8  4.4e-001
    1.0e-03    100000     99723     -0.9  3.8e-001
    1.0e-02   1000000    999434     -0.6  5.7e-001
    1.0e-01  10000000   9995896     -1.4  1.7e-001


Erlang(1,1), left side:
probability  expected  observed  z-score  p-value
    1.0e-07        10         7     -0.9  3.4e-001
    1.0e-06       100       105      0.5  6.2e-001
    1.0e-05      1000      1042      1.3  1.8e-001
    1.0e-04     10000     10042      0.4  6.7e-001
    1.0e-03    100000    100109      0.3  7.3e-001
    1.0e-02   1000000   1001122      1.1  2.6e-001
    1.0e-01  10000000  10001890      0.6  5.3e-001


Erlang(1,1), right side:
probability  expected  observed  z-score  p-value
    1.0e-07        10         8     -0.6  5.3e-001
    1.0e-06       100        98     -0.2  8.4e-001
    1.0e-05      1000      1059      1.9  6.2e-002
    1.0e-04     10000     10082      0.8  4.1e-001
    1.0e-03    100000    100261      0.8  4.1e-001
    1.0e-02   1000000   1000256      0.3  8.0e-001
    1.0e-01  10000000   9996368     -1.2  2.3e-001


Error(0,1,1), left side:
probability  expected  observed  z-score  p-value
    1.0e-07        10        96     27.2  0.0e+000 *****
    1.0e-06       100       423     32.3  0.0e+000 *****
    1.0e-05      1000      2229     38.9  0.0e+000 *****
    1.0e-04     10000     11497     15.0  0.0e+000 *****
    1.0e-03    100000     99937     -0.2  8.4e-001
    1.0e-02   1000000   1000034      0.0  9.7e-001
    1.0e-01  10000000  10000697      0.2  8.2e-001


Error(0,1,1), right side:
probability  expected  observed  z-score  p-value
    1.0e-07        10        66     17.7  0.0e+000 *****
    1.0e-06       100       374     27.4  0.0e+000 *****
    1.0e-05      1000      2258     39.8  0.0e+000 *****
    1.0e-04     10000     11784     17.8  0.0e+000 *****
    1.0e-03    100000    100561      1.8  7.6e-002
    1.0e-02   1000000   1000394      0.4  6.9e-001
    1.0e-01  10000000  10004593      1.5  1.3e-001


Exponential(1), left side:
probability  expected  observed  z-score  p-value
    1.0e-07        10        11      0.3  7.5e-001
    1.0e-06       100        98     -0.2  8.4e-001
    1.0e-05      1000      1030      0.9  3.4e-001
    1.0e-04     10000      9970     -0.3  7.6e-001
    1.0e-03    100000     99482     -1.6  1.0e-001
    1.0e-02   1000000    999721     -0.3  7.8e-001
    1.0e-01  10000000  10001783      0.6  5.5e-001


Exponential(1), right side:
probability  expected  observed  z-score  p-value
    1.0e-07        10        14      1.3  2.1e-001
    1.0e-06       100       103      0.3  7.6e-001
    1.0e-05      1000      1012      0.4  7.0e-001
    1.0e-04     10000      9984     -0.2  8.7e-001
    1.0e-03    100000     99592     -1.3  2.0e-001
    1.0e-02   1000000    999918     -0.1  9.3e-001
    1.0e-01  10000000   9998324     -0.6  5.8e-001


FRatio(5,10), left side:
probability  expected  observed  z-score  p-value
    1.0e-07        10        10      0.0  1.0e+000
    1.0e-06       100        85     -1.5  1.3e-001
    1.0e-05      1000       874     -4.0  6.8e-005 ***
    1.0e-04     10000      9829     -1.7  8.7e-002
    1.0e-03    100000     99882     -0.4  7.1e-001
    1.0e-02   1000000    999072     -0.9  3.5e-001
    1.0e-01  10000000  10006024      2.0  4.5e-002 *


FRatio(5,10), right side:
probability  expected  observed  z-score  p-value
    1.0e-07        10        27      5.4  7.6e-008 *****
    1.0e-06       100       170      7.0  2.6e-012 *****
    1.0e-05      1000      1135      4.3  2.0e-005 ****
    1.0e-04     10000     10120      1.2  2.3e-001
    1.0e-03    100000     99864     -0.4  6.7e-001
    1.0e-02   1000000   1000206      0.2  8.4e-001
    1.0e-01  10000000  10000916      0.3  7.6e-001


Gamma(1,1), left side:
probability  expected  observed  z-score  p-value
    1.0e-07        10        10      0.0  1.0e+000
    1.0e-06       100       101      0.1  9.2e-001
    1.0e-05      1000      1007      0.2  8.2e-001
    1.0e-04     10000      9960     -0.4  6.9e-001
    1.0e-03    100000     99218     -2.5  1.3e-002 *
    1.0e-02   1000000    999316     -0.7  4.9e-001
    1.0e-01  10000000  10000141      0.0  9.6e-001


Gamma(1,1), right side:
probability  expected  observed  z-score  p-value
    1.0e-07        10         9     -0.3  7.5e-001
    1.0e-06       100        94     -0.6  5.5e-001
    1.0e-05      1000      1012      0.4  7.0e-001
    1.0e-04     10000     10098      1.0  3.3e-001
    1.0e-03    100000     99798     -0.6  5.2e-001
    1.0e-02   1000000    999934     -0.1  9.5e-001
    1.0e-01  10000000  10000339      0.1  9.1e-001


Gumbel(0,1), left side:
probability  expected  observed  z-score  p-value
    1.0e-07        10        13      0.9  3.4e-001
    1.0e-06       100        97     -0.3  7.6e-001
    1.0e-05      1000       953     -1.5  1.4e-001
    1.0e-04     10000      9861     -1.4  1.6e-001
    1.0e-03    100000     99945     -0.2  8.6e-001
    1.0e-02   1000000    998223     -1.8  7.4e-002
    1.0e-01  10000000   9993534     -2.2  3.1e-002 *


Gumbel(0,1), right side:
probability  expected  observed  z-score  p-value
    1.0e-07        10         9     -0.3  7.5e-001
    1.0e-06       100        99     -0.1  9.2e-001
    1.0e-05      1000       955     -1.4  1.5e-001
    1.0e-04     10000      9932     -0.7  5.0e-001
    1.0e-03    100000    100014      0.0  9.6e-001
    1.0e-02   1000000   1001173      1.2  2.4e-001
    1.0e-01  10000000   9999072     -0.3  7.6e-001


InverseGaussian(1,1), left side:
probability  expected  observed  z-score  p-value
    1.0e-07        10        28      5.7  1.3e-008 *****
    1.0e-06       100       157      5.7  1.2e-008 *****
    1.0e-05      1000      1056      1.8  7.7e-002
    1.0e-04     10000     10009      0.1  9.3e-001
    1.0e-03    100000    100231      0.7  4.6e-001
    1.0e-02   1000000    999455     -0.5  5.8e-001
    1.0e-01  10000000  10000008      0.0  1.0e+000


InverseGaussian(1,1), right side:
probability  expected  observed  z-score  p-value
    1.0e-07        10         7     -0.9  3.4e-001
    1.0e-06       100        83     -1.7  8.9e-002
    1.0e-05      1000       990     -0.3  7.5e-001
    1.0e-04     10000      9882     -1.2  2.4e-001
    1.0e-03    100000     99970     -0.1  9.2e-001
    1.0e-02   1000000    999795     -0.2  8.4e-001
    1.0e-01  10000000  10000311      0.1  9.2e-001


Laplace(0,1), left side:
probability  expected  observed  z-score  p-value
    1.0e-07        10        11      0.3  7.5e-001
    1.0e-06       100       119      1.9  5.7e-002
    1.0e-05      1000      1041      1.3  1.9e-001
    1.0e-04     10000     10070      0.7  4.8e-001
    1.0e-03    100000     99855     -0.5  6.5e-001
    1.0e-02   1000000    999859     -0.1  8.9e-001
    1.0e-01  10000000   9997321     -0.9  3.7e-001


Laplace(0,1), right side:
probability  expected  observed  z-score  p-value
    1.0e-07        10        14      1.3  2.1e-001
    1.0e-06       100       103      0.3  7.6e-001
    1.0e-05      1000      1045      1.4  1.5e-001
    1.0e-04     10000     10167      1.7  9.5e-002
    1.0e-03    100000    100236      0.7  4.6e-001
    1.0e-02   1000000    999575     -0.4  6.7e-001
    1.0e-01  10000000  10000256      0.1  9.3e-001


Logistic(0,1), left side:
probability  expected  observed  z-score  p-value
    1.0e-07        10         7     -0.9  3.4e-001
    1.0e-06       100        98     -0.2  8.4e-001
    1.0e-05      1000      1019      0.6  5.5e-001
    1.0e-04     10000      9987     -0.1  9.0e-001
    1.0e-03    100000    100713      2.3  2.4e-002 *
    1.0e-02   1000000    999886     -0.1  9.1e-001
    1.0e-01  10000000   9993590     -2.1  3.3e-002 *


Logistic(0,1), right side:
probability  expected  observed  z-score  p-value
    1.0e-07        10        10      0.0  1.0e+000
    1.0e-06       100        89     -1.1  2.7e-001
    1.0e-05      1000       999     -0.0  9.7e-001
    1.0e-04     10000      9980     -0.2  8.4e-001
    1.0e-03    100000    100350      1.1  2.7e-001
    1.0e-02   1000000   1001059      1.1  2.9e-001
    1.0e-01  10000000  10002131      0.7  4.8e-001


LogNormal(0,1), left side:
probability  expected  observed  z-score  p-value
    1.0e-07        10        91     25.6  0.0e+000 *****
    1.0e-06       100       419     31.9  0.0e+000 *****
    1.0e-05      1000      2264     40.0  0.0e+000 *****
    1.0e-04     10000     11723     17.2  0.0e+000 *****
    1.0e-03    100000     99510     -1.6  1.2e-001
    1.0e-02   1000000    999833     -0.2  8.7e-001
    1.0e-01  10000000   9997978     -0.7  5.0e-001


LogNormal(0,1), right side:
probability  expected  observed  z-score  p-value
    1.0e-07        10        68     18.3  0.0e+000 *****
    1.0e-06       100       419     31.9  0.0e+000 *****
    1.0e-05      1000      2192     37.7  0.0e+000 *****
    1.0e-04     10000     11612     16.1  0.0e+000 *****
    1.0e-03    100000     99465     -1.7  9.1e-002
    1.0e-02   1000000    998737     -1.3  2.0e-001
    1.0e-01  10000000   9997466     -0.8  4.0e-001


Maxwell(1), left side:
probability  expected  observed  z-score  p-value
    1.0e-07        10        13      0.9  3.4e-001
    1.0e-06       100       122      2.2  2.8e-002 *
    1.0e-05      1000      1048      1.5  1.3e-001
    1.0e-04     10000     10104      1.0  3.0e-001
    1.0e-03    100000    100074      0.2  8.1e-001
    1.0e-02   1000000    999237     -0.8  4.4e-001
    1.0e-01  10000000  10004565      1.5  1.3e-001


Maxwell(1), right side:
probability  expected  observed  z-score  p-value
    1.0e-07        10        16      1.9  5.8e-002
    1.0e-06       100       115      1.5  1.3e-001
    1.0e-05      1000      1060      1.9  5.8e-002
    1.0e-04     10000     10127      1.3  2.0e-001
    1.0e-03    100000     99673     -1.0  3.0e-001
    1.0e-02   1000000   1001805      1.8  7.0e-002
    1.0e-01  10000000   9998989     -0.3  7.4e-001


Moyal(0,1), left side:
probability  expected  observed  z-score  p-value
    1.0e-07        10         7     -0.9  3.4e-001
    1.0e-06       100       107      0.7  4.8e-001
    1.0e-05      1000      1010      0.3  7.5e-001
    1.0e-04     10000     10017      0.2  8.7e-001
    1.0e-03    100000     99795     -0.6  5.2e-001
    1.0e-02   1000000   1001460      1.5  1.4e-001
    1.0e-01  10000000  10001574      0.5  6.0e-001


Moyal(0,1), right side:
probability  expected  observed  z-score  p-value
    1.0e-07        10        11      0.3  7.5e-001
    1.0e-06       100       108      0.8  4.2e-001
    1.0e-05      1000       994     -0.2  8.5e-001
    1.0e-04     10000     10002      0.0  9.8e-001
    1.0e-03    100000     99476     -1.7  9.7e-002
    1.0e-02   1000000    998784     -1.2  2.2e-001
    1.0e-01  10000000   9998594     -0.5  6.4e-001


Normal(0,1), left side:
probability  expected  observed  z-score  p-value
    1.0e-07        10        84     23.4  0.0e+000 *****
    1.0e-06       100       413     31.3  0.0e+000 *****
    1.0e-05      1000      2171     37.0  0.0e+000 *****
    1.0e-04     10000     11720     17.2  0.0e+000 *****
    1.0e-03    100000    100146      0.5  6.4e-001
    1.0e-02   1000000   1001413      1.4  1.6e-001
    1.0e-01  10000000  10003427      1.1  2.5e-001


Normal(0,1), right side:
probability  expected  observed  z-score  p-value
    1.0e-07        10        86     24.0  0.0e+000 *****
    1.0e-06       100       400     30.0  0.0e+000 *****
    1.0e-05      1000      2185     37.5  0.0e+000 *****
    1.0e-04     10000     11733     17.3  0.0e+000 *****
    1.0e-03    100000    100263      0.8  4.1e-001
    1.0e-02   1000000   1001856      1.9  6.2e-002
    1.0e-01  10000000   9997435     -0.9  3.9e-001


Pareto(1,1), left side:
probability  expected  observed  z-score  p-value
    1.0e-07        10         9     -0.3  7.5e-001
    1.0e-06       100       109      0.9  3.7e-001
    1.0e-05      1000       953     -1.5  1.4e-001
    1.0e-04     10000      9784     -2.2  3.1e-002 *
    1.0e-03    100000     99777     -0.7  4.8e-001
    1.0e-02   1000000    998968     -1.0  3.0e-001
    1.0e-01  10000000  10002159      0.7  4.7e-001


Pareto(1,1), right side:
probability  expected  observed  z-score  p-value
    1.0e-07        10        17      2.2  2.7e-002 *
    1.0e-06       100       103      0.3  7.6e-001
    1.0e-05      1000       993     -0.2  8.2e-001
    1.0e-04     10000      9978     -0.2  8.3e-001
    1.0e-03    100000    100186      0.6  5.6e-001
    1.0e-02   1000000   1000419      0.4  6.7e-001
    1.0e-01  10000000  10001189      0.4  6.9e-001


Power(1,1), left side:
probability  expected  observed  z-score  p-value
    1.0e-07        10        17      2.2  2.7e-002 *
    1.0e-06       100       103      0.3  7.6e-001
    1.0e-05      1000       987     -0.4  6.8e-001
    1.0e-04     10000     10066      0.7  5.1e-001
    1.0e-03    100000    100175      0.6  5.8e-001
    1.0e-02   1000000   1001758      1.8  7.7e-002
    1.0e-01  10000000  10002752      0.9  3.6e-001


Power(1,1), right side:
probability  expected  observed  z-score  p-value
    1.0e-07        10         6     -1.3  2.1e-001
    1.0e-06       100       108      0.8  4.2e-001
    1.0e-05      1000      1034      1.1  2.8e-001
    1.0e-04     10000     10087      0.9  3.8e-001
    1.0e-03    100000    100012      0.0  9.7e-001
    1.0e-02   1000000   1000990      1.0  3.2e-001
    1.0e-01  10000000  10003861      1.3  2.0e-001


Rayleigh(1), left side:
probability  expected  observed  z-score  p-value
    1.0e-07        10        10      0.0  1.0e+000
    1.0e-06       100       112      1.2  2.3e-001
    1.0e-05      1000      1025      0.8  4.3e-001
    1.0e-04     10000     10181      1.8  7.0e-002
    1.0e-03    100000    100524      1.7  9.7e-002
    1.0e-02   1000000   1000038      0.0  9.7e-001
    1.0e-01  10000000   9995559     -1.5  1.4e-001


Rayleigh(1), right side:
probability  expected  observed  z-score  p-value
    1.0e-07        10         4     -1.9  5.8e-002
    1.0e-06       100       101      0.1  9.2e-001
    1.0e-05      1000       964     -1.1  2.5e-001
    1.0e-04     10000      9922     -0.8  4.4e-001
    1.0e-03    100000     99905     -0.3  7.6e-001
    1.0e-02   1000000    997864     -2.1  3.2e-002 *
    1.0e-01  10000000  10001313      0.4  6.6e-001


StudentT(2), left side:
probability  expected  observed  z-score  p-value
    1.0e-07        10         9     -0.3  7.5e-001
    1.0e-06       100        90     -1.0  3.2e-001
    1.0e-05      1000       970     -0.9  3.4e-001
    1.0e-04     10000      9858     -1.4  1.6e-001
    1.0e-03    100000     99312     -2.2  3.0e-002 *
    1.0e-02   1000000    998106     -1.9  5.7e-002
    1.0e-01  10000000   9998344     -0.6  5.8e-001


StudentT(2), right side:
probability  expected  observed  z-score  p-value
    1.0e-07        10         8     -0.6  5.3e-001
    1.0e-06       100       113      1.3  1.9e-001
    1.0e-05      1000      1018      0.6  5.7e-001
    1.0e-04     10000      9978     -0.2  8.3e-001
    1.0e-03    100000     99844     -0.5  6.2e-001
    1.0e-02   1000000    998820     -1.2  2.4e-001
    1.0e-01  10000000   9994524     -1.8  6.8e-002


Triangular(1,3,2), left side:
probability  expected  observed  z-score  p-value
    1.0e-07        10        11      0.3  7.5e-001
    1.0e-06       100        99     -0.1  9.2e-001
    1.0e-05      1000      1021      0.7  5.1e-001
    1.0e-04     10000      9944     -0.6  5.8e-001
    1.0e-03    100000    100142      0.4  6.5e-001
    1.0e-02   1000000   1001674      1.7  9.2e-002
    1.0e-01  10000000  10000646      0.2  8.3e-001


Triangular(1,3,2), right side:
probability  expected  observed  z-score  p-value
    1.0e-07        10         6     -1.3  2.1e-001
    1.0e-06       100        91     -0.9  3.7e-001
    1.0e-05      1000      1023      0.7  4.7e-001
    1.0e-04     10000      9920     -0.8  4.2e-001
    1.0e-03    100000     99954     -0.1  8.8e-001
    1.0e-02   1000000    997941     -2.1  3.9e-002 *
    1.0e-01  10000000   9998347     -0.6  5.8e-001


Uniform(0,1), left side:
probability  expected  observed  z-score  p-value
    1.0e-07        10        10      0.0  1.0e+000
    1.0e-06       100       107      0.7  4.8e-001
    1.0e-05      1000       981     -0.6  5.5e-001
    1.0e-04     10000      9921     -0.8  4.3e-001
    1.0e-03    100000     99988     -0.0  9.7e-001
    1.0e-02   1000000   1002699      2.7  6.7e-003 *
    1.0e-01  10000000  10008032      2.7  7.4e-003 *


Uniform(0,1), right side:
probability  expected  observed  z-score  p-value
    1.0e-07        10        13      0.9  3.4e-001
    1.0e-06       100       101      0.1  9.2e-001
    1.0e-05      1000       969     -1.0  3.3e-001
    1.0e-04     10000      9953     -0.5  6.4e-001
    1.0e-03    100000    100216      0.7  4.9e-001
    1.0e-02   1000000   1001919      1.9  5.4e-002
    1.0e-01  10000000  10005962      2.0  4.7e-002 *


VonMises(1,0), left side:
probability  expected  observed  z-score  p-value
    1.0e-07        10         5     -1.6  1.1e-001
    1.0e-06       100       106      0.6  5.5e-001
    1.0e-05      1000       972     -0.9  3.8e-001
    1.0e-04     10000     10100      1.0  3.2e-001
    1.0e-03    100000    100091      0.3  7.7e-001
    1.0e-02   1000000   1000386      0.4  7.0e-001
    1.0e-01  10000000  10002124      0.7  4.8e-001


VonMises(1,0), right side:
probability  expected  observed  z-score  p-value
    1.0e-07        10        13      0.9  3.4e-001
    1.0e-06       100        95     -0.5  6.2e-001
    1.0e-05      1000       958     -1.3  1.8e-001
    1.0e-04     10000      9979     -0.2  8.3e-001
    1.0e-03    100000    100219      0.7  4.9e-001
    1.0e-02   1000000   1001247      1.3  2.1e-001
    1.0e-01  10000000   9999734     -0.1  9.3e-001


Weibull(1,1), left side:
probability  expected  observed  z-score  p-value
    1.0e-07        10        10      0.0  1.0e+000
    1.0e-06       100       100      0.0  1.0e+000
    1.0e-05      1000       974     -0.8  4.1e-001
    1.0e-04     10000     10041      0.4  6.8e-001
    1.0e-03    100000     99307     -2.2  2.8e-002 *
    1.0e-02   1000000    998751     -1.3  2.1e-001
    1.0e-01  10000000   9997901     -0.7  4.8e-001


Weibull(1,1), right side:
probability  expected  observed  z-score  p-value
    1.0e-07        10         6     -1.3  2.1e-001
    1.0e-06       100        97     -0.3  7.6e-001
    1.0e-05      1000       998     -0.1  9.5e-001
    1.0e-04     10000      9913     -0.9  3.8e-001
    1.0e-03    100000     99672     -1.0  3.0e-001
    1.0e-02   1000000    999178     -0.8  4.1e-001
    1.0e-01  10000000  10003970      1.3  1.9e-001

 


 

Download SampleCheck.mw

Hint 1: Most combinatorics problems that contain the phrase "at least one" or "some" are most easily done by considering the opposite case, "none", which is usually easier to count, and subtracting from "all cases". Having at least one odd integer is the opposite of having 3 even integers. This is the key to VV's Answer.

Hint 2: The spirit of combinatorics is to count objects by formulas whenever that's possible rather than constructing the objects and counting them directly.

The purpose of this Answer is not to directly address the issue that you raised, which seems quite significant. Rather, its purpose is to show you a much, much faster and simpler way to do these experiments---even much faster than R. Thus you can easily do experiments with samples of size 10^8 and explore whether this "fat-tails" anomaly affects other continuous distributions.

restart
:
SampleCheck:= proc(X, N::posint)
uses St= Statistics;
local
    S:= St:-Sample(X, N),
    O:= <St:-TallyInto(S, <[$(floor@min-1..ceil@max)(S)]>)>,
    E:= St:-Probability~(X <~ (rhs@lhs)~(O), 'numeric') * N
;
    <rhs~(O)[2..] | E[2..] - E[..-2]>
end proc
:
ObsExp:= CodeTools:-Usage(
    SampleCheck(Statistics:-RandomVariable(Normal(0,1)), 10^8)
);
memory used=0.76GiB, alloc change=0.75GiB, 
cpu time=7.27s, real time=7.39s, gc time=0ns

The procedure returns a 2-column Matrix. The first column is observed counts; the second is the expected values. The bin boundaries are simply all integers necessary to capture the observations.

#Optional step: Compute ChiSquared:
ChiSq:= add((ObsExp[..,1]-ObsExp[..,2])^~2/~ObsExp[..,2]);

     ChiSq := 5026.77944094975

Obviously, this value is "off the charts".

There's two immediate problems that I see:

1. You've used both := and = as assignment operators. They should all be :=.

2. Indexing a function is different than indexing its return value. Where you have fin[j](...), you should have fin(...)[j].

Maple 2019 introduced two new ways to perform this operation: embedded do-loops and the ,= append operator.

L:= [0, 3, 0, 7]: #your original data

Embedded do-loop:

L1:= [for x in L do if x>0 then x/2 fi od];

Append operator:

L2:= Array(1..0): #empty 1-D Array
for x in L do if x>0 then L2,= x/2 fi od: 
L2:= [seq(L2)]; #Convert Array to list.

seq statement is fine and quite efficient when it can be used. The limitation (which, of course, doesn't apply for this trivial example) is that one cannot access the previously generated members of the sequence from within the seq statement. So there can't be a termination condition akin to a while clause.

You change the values of omega by using a parameters option to dsolve, like this:

IVP:= {diff(y(t),t$2)+16*y(t)=3*sin(omega*t), y(0)=0, D(y)(0)=0}:
Omega:= [1, 4, 5, 8]:
Sol:= dsolve(IVP, numeric, parameters= [omega]):
plots:-display([
    for k, om in Omega do
        Sol(parameters= [omega= om]);
        plots:-odeplot(
            Sol, 0..20, 
            legend= [omega= om], 
            color= COLOR(HUE, .85*(k-1)/(nops(Omega)-1))
        )
    od
]);

Of the commands that you mentioned, only discont is needed. I think that you're overthinking this one also.

Hint: The expression that discont returns contains an integer parameter. To get the values between 0 and 2*Pi, solve that expression for 0 and 2*Pi, and then evaluate that expression for integers between those values.

If you were to use an if-statement, what would be the condition---the expression that's true or false---that would start the statement?

You're overthinking it, there's no such condition, and your procedure only needs one statement, based on this hint: If f is a function, and a a value in its domain, and the coordinate axes are named x and y, then the tangent line is y = D(f)(a)*(x-a)+f(a).

Anywhere in Maple, if a name is enclosed by single forward quotes (aka aposthropes), then it'll be treated as a name even if it has been assigned a value. So,

TangentLine('l', point('A', 0, 1), circle('c', [point('C', 0, 1), 1]));

When quotes are used this way, they're called unevaluation quotes.

In Maple 2019, the semantics have changed thus: Certain bound variables that were implicitly not local in prior versions are now implicitly local (unless explicitly made otherwise). And the syntax change is that (as shown by VV) it's been made easier to declare things local.

While I don't believe in heeding every warning issued by Maple, I think that it's a cruddy programming practice to ignore this one. Declaring all variables will help immensely with your debugging if you ever misspell a variable's name. I realized that all the way back in my Fortran days (1979). That compiler let you leave all integer and real variables implicit (based on the first letter of the name) if you so chose.

I agree with all that Acer wrote in this thread. But there's an additional tidbit of information that he didn't mention that I think greatly simplifies determining whether an argument was passed to a parameter:

  • The default value assigned to an optional parameter (whether positional or keyword) need not be of the type declared to be  allowed for arguments to that parameter.

So, if you use such a "special" default value, and the parameter has that value, then it's guaranteed that no argument was passed to it.

For a.e. and t, there's nothing to suggest that the limit of the terms is 0. Indeed, the terms appear to be a dense subset of -1..1. If these appearances hold true, then the series fails the most basic test of convergence, the "divergence test".

First 123 124 125 126 127 128 129 Last Page 125 of 395