Joe Riel

9520 Reputation

23 Badges

18 years, 224 days

MaplePrimes Activity


These are answers submitted by Joe Riel

The first has 24*kPa, the second 24.5*kPa.

Pass the option 'datasetlabels=contents' to the call to VennDiagram.  You'll see why the default is 'absolute'.

A workaround is to replace int with Int, then apply eval, say with map(eval@Int, ... ).

Later
A problem is the occurrence of varphi(t) in the call to int, when varphi is the variable of integration.

Drop the y = -1 .. 1 argument in the call to plot

I don't know of a direct way to do this.  It can be manually be done by first selecting the text, typing Control X (to delete and copy the text), then typing a pair of matched parentheses, moving back one character, then typing Control V to insert the text.

By default Iterator creates and uses compiled procedures.  Possibly Compiler:-Compile is unable to write to that directory (I have no idea why).  As a workaround, pass the option compile=false to the call to FillRucksack.

Later In Maple Standard, open Tools > Options > Security and see if you have activated any of the security settings that might prevent writing.

Have you tried using a table to position the various elements?   Split the table into an appropriate number of rows and columns, possibly joining some cells to make larger cells, and insert the embedded components into the cells.  You can make the dividers invisible.  While it's not perfect, it works reasonably well.

You stated the input is a set, but assigned a list to S.  I'm going to assume that the elements are symbols, but the same symbol can appear more than once.  Solving that is equivalent to finding all partitions of a multiset, which can be achieved with the Iterator:-MultiPartition procedure.   Presumably this could be simplfied if only distinct symbols are allowed (i.e partitions of a set).  Here's a solution

SumsOfList := proc(L :: list(symbol) )
local A, M, N, S, W, i, j, l, n, x;
    x := convert(L, 'compose', 'set', 'list');
    n := numelems(x);
    S := add(L);
    N := map2(coeff, S, x);
    M := Iterator:-MultiPartition(N);
    A := Array(1..0);
    for W in M do
        l := length(M);
        A ,= [seq(add(W[i,j]*x[i],i=1..n),j=1..l)];
    end do;
    convert(A, 'list');
end proc:

SumsOfList([a,b,c]);
                 [[a + b + c], [a + b, c], [a + c, b], [a, b + c], [a, b, c]]
SumsOfList([a,a,b,c]);
        [[2 a + b + c], [2 a + b, c], [2 a + c, b], [2 a, b + c], [2 a, b, c], [a + b + c, a], [a + b, a + c], [a + b, a, c], [a + c, a, b], [a, a, b + c], [a, a, b, c]]

 

An immediate issue is that simplify is not threadsafe, so parallelizing the routine using Threads is doomed.  You could do so using the Grid package, for example

CleanExpr := proc(expr, i, phi, coe, coefmodel)
local aaa, bbb, ccc, ind;
    try
        aaa := simplify(subs(coefmodel,expr)):
        if has(aaa,I) then
            return NULL;
        else
            bbb := simplify(subs(coefmodel,phi)):
            ccc := simplify(subs(coefmodel,coe)):
            ind := i:
            return [aaa,bbb,ccc,ind];
        end if:
    catch:
        return NULL;
    end try:
end proc:


sys := [NULL
        , (-x*rho*xi[6]*(beta - 1)*sqrt(((rho + beta - 1)*sigma - beta + 1)^2*xi[8]^2/(beta - 1)^2) - xi[8]*(-2*y*sigma*xi[7]*xi[6]^2*(beta - 1)^2 + (sigma*rho + (sigma + 1)*(beta - 1))*x*rho*xi[6] + 2*sigma*z*rho^2*xi[8]))/(2*xi[6]*xi[8]*rho*(beta - 1))
        , (-(beta - 1)*(-y*sigma*xi[7]*xi[6]^2*(beta - 1)^2 + rho^2*(sigma*z*xi[8] + x^2))*xi[6]*sqrt(((rho + beta - 1)*sigma - beta + 1)^2*xi[8]^2/(beta - 1)^2) - (2*sigma*(beta - 1)^2*(y*xi[7]*(rho + beta - 1)*sigma/2 + x^2*rho + y*(beta - 1)*xi[7]/2)*xi[6]^3 + 2*x*z*rho*sigma*xi[8]*(beta - 1)^2*xi[6]^2 + (-z*xi[8]*(rho + beta - 1)*sigma^2 + ((2*beta^2*z - 3*beta*z + z)*xi[8] + x^2*rho - (beta - 1)*(-2*beta*y*xi[7] + x^2))*sigma + x^2*(beta - 1))*rho^2*xi[6] + 2*x*z*rho^3*sigma*xi[8])*xi[8])/(2*xi[8]*sigma*(beta - 1)*(rho^2 + (beta - 1)^2*xi[6]^2)*xi[6]*xi[7])
        , (-(-x*sigma*(beta - 1)^2*xi[6]^3 + (beta - 1)^2*(sigma*y*xi[7] + x^2)*xi[6]^2 - rho^2*sigma*x*xi[6] - sigma*z*rho^2*xi[8])*(beta - 1)*rho*sqrt(((rho + beta - 1)*sigma - beta + 1)^2*xi[8]^2/(beta - 1)^2) + xi[8]*(-2*y*sigma^2*xi[7]*(beta - 1)^4*xi[6]^4 + 2*(rho*(rho + beta - 1)*sigma/2 + (beta - 1)*((-beta + 1/2)*rho + y*(beta - 1)*xi[7]))*sigma*(beta - 1)^2*x*xi[6]^3 + (beta - 1)^2*(((-y*xi[7] + 2*z*xi[8])*rho + y*(beta - 1)*xi[7])*sigma^2 + (x^2*rho + (beta - 1)*(-2*beta*y*xi[7] - 2*beta*z*xi[8] + x^2 + y*xi[7]))*sigma - x^2*(beta - 1))*rho*xi[6]^2 + 2*(rho*(rho + beta - 1)*sigma/2 + (beta - 1)*((-beta + 1/2)*rho + y*(beta - 1)*xi[7]))*sigma*x*rho^2*xi[6] + xi[8]*sigma*z*((rho - beta + 1)*sigma - beta + 1)*rho^3))/(2*xi[8]^2*sigma*(beta - 1)*rho*(rho^2 + (beta - 1)^2*xi[6]^2))
       ]:
coefmodel := {beta = 8/3, rho = 28, sigma = 10}:
phi := [[], [], []]:
coe := [[], [], []]:

result := [Grid:-Seq](CleanExpr(sys[i], i, phi[i], coe[i], coefmodel), i = 1 .. numelems(sys)):
op(ListTools:-Transpose(result));

 

You have declared xpsn, ypsn, and zpsn as local to ppp; as such they are not accessible in Qprj.  Maybe you meant to make them local to rt?

MapleSim comes with DA and AD components; look in Electrical -> Analog -> Converters.

Another approach is to replace the WARNINGS procedure with something suitable.  Here's a quick hack job that demos the idea (it needs work):

Warnings := module()
option package;

local catchall, formats, warnings;

export
    Catch := proc(fmts? :: seq(string), { all :: truefalse := false })
        if all then
            catchall := true;
        else
            formats := [fmts?];
        end if;
    end proc;

export
    ModuleLoad := proc()
    global WARNING;
        unprotect('WARNING'):
        WARNING := proc(fmt)
            if catchall or Match(fmt) then
                warnings[fmt] := StringTools:-FormatMessage(fmt, _rest);
            else
                print('INTERFACE_WARN'(1,fmt,_rest));
            end if;
        end proc;
        protect('WARNING'):
        Clear();
    end proc;


export
    Display := proc()
    local msg;
        for msg in [entries(warnings,'nolist')] do
            printf("%s\n", msg);
        end do;
    end proc;

export
    Caught := proc(fmt)
        ormap(f -> SearchText(fmt,f)=1, [indices(warnings,'nolist')]);
    end proc;

export
    Match := proc(fmt)
        ormap(f -> SearchText(f, fmt)=1, formats);
    end proc;

export
    Clear := proc()
        warnings := table();
        NULL;
    end proc:

export
    ModuleUnload := proc()
        kernelopts('unread' = ':-WARNINGS');
    end proc;

    ModuleLoad();

end module:

You could use it in the following manner

with(Optimization):
expr_optimize := fSW__Ratio_Tol[XU5]*f_ratio__SpreadSpectrum[XU5]*(R34^2*k1__RT[XU5] + R34*k2__RT[XU5] + k3__RT[XU5])/R34^2;
seqUnknownRanges := (NULL
                     , R34 = 5.640*10^4*Unit('Omega') .. 6.160*10^4*Unit('Omega')
                     , k1__RT[XU5] = 4.054*10^4*Unit(1/('s')) .. 4.054*10^4*Unit(1/('s'))
                     , k2__RT[XU5] = 1.593*10^11*Unit(1/('F')) .. 1.593*10^11*Unit(1/('F'))
                     , k3__RT[XU5] = -2.645*10^15*Unit('m'^4*'kg'^2/('s'^7*'A'^4)) .. -2.645*10^15*Unit('m'^4*'kg'^2/('s'^7*'A'^4))
                     , fSW__Ratio_Tol[XU5] = 0.950 .. 1.050
                     , f_ratio__SpreadSpectrum[XU5] = 1 .. 1.250
                    ):

proc()
uses Warnings;
    Catch('all');
    NLPSolve(expr_optimize, seqUnknownRanges, 'useunits', 'method' = 'modifiednewton', 'optimalitytolerance' = 0.101);
    if Caught("convergence is not assured") then
        error "caught it";
    end if;
end proc();

Error, (in anonymous procedure) caught it

 

I don't know of a good way to do this.  I believe it is possible to use html in the entries, say to force a fixed-width font and then insert horizontal space to fake two columns, however, the result is not pretty.  My recollection is that doing so inserts unwanted vertical space between rows.   Probably you are better off just parenthesizing the constants after the name:  "some acid (3.14)".

For this case there may be a workaround.  Because digits have a fixed width (I believe), you could put the constant first and used a fixed precision with scientific notation.  Then all the values and names would align vertically.  Not ideal but maybe feasible.  If the rows were sorted numerically by the constants (rather than alphabetically by the names) then this would appear almost natural.

Am not sure what you are intending with the use of the `:-' symbol, which is the Maple member operator. Will guess you want assignment.
The piecewise function can be used to express the conditional:

Mtop := piecewise(t < l/2, X*f+t/2, X*f-t/2+l/2);

If you actually want a procedure you could do something like

Mtop := proc(t, X,f, l)
    if t < l/2 then
        X*f + t/2
    else
        X*f - t/2 + l/2
    end if;
end proc:


 

There should be a hyperlink in the preprocessor help page to the kernelopts help page; I'll submit a bug report.  Presumably an assumption was made that the reader was aware of kernelopts; all settable kernelopts options use the format kernelopts(optionname = value).

1 2 3 4 5 6 7 Last Page 2 of 114