Joe Riel

8243 Reputation

22 Badges

15 years, 217 days

MaplePrimes Activity


These are answers submitted by Joe Riel

To generate the probability correctly, you need to generate all permutations of the 9 digits.

with(Iterator):
F := Permute(1..9):
picks := [seq(add(add(10^(i-1)*f[i+j],i=1..3),j=0..8,3),f = F)]:
rng := (min..max)(picks);
                        rng := 774 .. 2556
# Find unique values
vals := convert(picks,set):
num := numelems(vals);
                           num := 199
# Determine entry that occurs the most
A := Array(rng):
for val in picks do A[val] := A[val]+1; end do:
imax := max[index](A);
                          imax := 1764
A[imax];
                              3888

Further While it is mostly pointless here, a better technique would be to avoid generating all the picks as a list.

T := table(sparse):
for f in F do
   val := add(add(10^(i-1)*f[i+j],i=1..3),j=0..8,3);
   T[val] := T[val] + 1;
end do:

A downside is that it is a little less convenient to find the max entry and associated value, however, because there are multiple indices with the same entry, we need to do this, regardless.

vmax := max(entries(T,'nolist'));
                                  vmax := 3888
for i in [indices(T,'nolist')] do 
    if T[i] = vmax then print(i) end if 
end do:
                              1755
                              1638
                              1656
                              1764
                              1692
                              1674
                              1566
                              1575

Those agree with the values you listed.

The Statistics package could be used here

with(Statistics):
X := RandomVariable(EmpiricalDistribution(picks)):
Mean(X);
                              1665
Mode(X);
                              1566
Median(X);
                              1665
S := Sample(X,1000):
Histogram(S,'discrete');

To remove identities I usually go with

remove(evalb,EQI__4);

I don't get that error, but rather 

cannot determine if this expression is true or false: .7444168734e-1*p < -.5300353358*p+1.578268991

That comes from using ai in the condition ai>aineg (and elsewhere), with p unassigned. I suspect that at some point you assigned NULL to p.

Is this what you want to do

proc()
local ex, exnum, xnum, ynum; 
uses DocumentTools;
    xnum := parse(GetProperty("TextArea0", "value"));
    ynum := parse(GetProperty("TextArea1", "value"));
    ex := GetProperty("MathContainer0", "expression");
    exnum := eval(ex, ['x'=xnum, 'y'=ynum]);
    SetProperty("TextArea2", "value", exnum);
end();

You can use the second equation to eliminate M__Revolute(t) from the first. Open a Worksheet template and do

A := MapleSim:-LinkModel():
A:-SetSubsystemName(""):
A:-SetSubstitutions([`Main.SpringDamper.c` = c__SpriD, `Main.SpringDamper.d` = d__SpriD, `Main.SpringDamper.phi_rel0` = PhiR0__SpriD, `Main.Revolute.M`(t) = M__Revolute(t), `Main.Revolute.theta`(t) = theta__Revolute(t)], 'nocheck'):
eqs := A:-GetEquations('output' = 'all', 'inputs' = {}, 'filter' = [], 'simplify' = true, 'params' = {`Main.SpringDamper.c`, `Main.SpringDamper.d`}):
dae := eqs[1];
subs(isolate(dae[2],M__Revolute(t)), dae[1]);

UseHardwareFloats is a Maple environment variable.  As such, it gets reset to its previous value when the procedure that assigned it (ModuleLoad) exits.. 

Use the fouriercos and fouriersin procedures in the inttrans package.  Use piecewise to create the expression you want to transform. For example

with(inttrans): # load the inttrans package
y := piecewise(t < 1, exp(t), 1);
fouriercos(y, t, s);

Replace the curly braces with regular parentheses, then use solve.

eq := alpha+(6*RK[1]*alpha+2+(96/5)*R^2*K^2*alpha^2-(1/6)*R*alpha+64*R^3*K^3*alpha^3)*beta+((24/5)*RK+44*R^2*K^2*alpha^3)*beta^2=0:
solve(eq, alpha);
solve(eq, beta);

Using print, as shown by acer, is the recommended way to do this. Here is an alternative.

t := 0:
for i to 11 do
    if 1=1 then
        j := i + i^2;
        k := j + t;
    end if;
    t := j/k;
end do;

That works because Maple uses the value of the global variable printlevel to determine what to print when evaluating substatements in a statement terminated with a semicolon. The default value of printlevel is 1, which prints the result of substatements at level 1 or lower. Note that if true is used rather than 1=1 as the condition, Maple's simplifier will fully evaluate the conditional statement so the nested assignments will appear at level 1 and so be printed.

Further Rather than adding dummy levels, you could modify printlevel directly. For example

t := 0:
for i to 11 do
    printlevel := 0;
    j := i + i^2;
    k := j + t;
    assign('printlevel',1);
    t := j/k;
end do;

Note the use of the assign function, which returns NULL (so prints nothing) when resetting printlevel to 1. If a regular assignment statement was used then that assignment would be printed.

The Maple assignment operator is two-characters:

  Dmax := 0;

Change the equations that are supposed to be assignments. Also, I don't know what D.i is supposed to represent, but that cannot be on the lhs of an assignment. Maybe you are trying to create a table of values, in which case you'd use D[i],except that D is protected (it corresponds to a differential operator), so use d[i].

@mostafaorooji One approach is to to use LargeExpressions:-Veil:

with(LargeExpressions):
subsindets(ans, specfunc(exp), Veil[Z]);
              w(x) = _C1*Z[1]+_C2*Z[2]+_C3*Z[3]+_C4*Z[4]

Check the help for LargeExpressions.

{ op(s1), op(s2), ... }

It seems like you just want to count in base 3.  This could be down with MixedRadixTuples in the Iterator package:

with(Iterator):
C := MixedRadixTuples([3,3,3]):
S := [l,m,h]:
seq([NULL
     , cat(CPC_, S[c[1]+1])
     , cat(SIZE_,S[c[2]+1])
     , cat(SH_,  S[c[3]+1])
    ], c in C);

Am thinking it is asking whether you want to upgrade your 2018.1 to 2018.2, which has been recently released.

See the help page OpenMaple,C,callBackCallBack.  Then look at the source code for the example mentioned there (callBackCallBack.c); it uses a Maple-side call to callback to call the callBackCallBack C function. Basically, the purpose of callback is to invoke the user's callBackCallBack function.  

The callback function is not something you would ever call interactively from Maple.  Rather it would be called by Maple code that is being executed by an external program using OpenMaple to interact with the Maple engine. It isn't formally documented because its arguments and effect are completely determined by the callBackCallBack function, something the user defines.

First 6 7 8 9 10 11 12 Last Page 8 of 105