acer

32333 Reputation

29 Badges

19 years, 323 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@Carl Love There is no typographically or structurally leading `-` for this example.

restart;

Sign := (e::algebraic)->
   if e::{`+`,`*`} then thisproc(op(1,e))
   elif e::function then 1
   else try sign(e) catch "invalid argument": thisproc(op(1,e)) end try
   fi
:

expr := (-x+1)^3;

(-x+1)^3

Sign(expr);

-1

 

Download hmm.mw

@nm I understand now, thank you.

You are using `frontend` quite differently from both what I suggested earler and what I put in my answer. Why!?

One point is to freeze the denominator in the case that it is a sum (so that the term can be seen a a polynomial). But if sums are to be frozen then the first addend must be examined in the case that the whole expression is a sum (and possibly also because freezing might conceivable change the order).

 

@Christopher2222 What are you talking about?

You can upload a file here, and add a link into your Question (or a followup Reply) using the green up-arrow in the Mapleprimes editor's toolbar.

Does your example work in your Maple 14 if you enter it in 1D (plaintext) Maple Notation?

Did it perhaps produce that error only when entered in 2D Input?

(I have a hazy recollection that the elementwise syntax ( ~ ) may not have been fully recognized by the 2D Input parser when it first appeared. I could be misremembering.)

 

The setsort option that can be passed to the interface when launching Maple, but I don't think that any of its permissible values is going to allow you to get that ordering of integers in a set.

For what purpose do you need L to be a set rather than a list?

 

The form of the coefficients (of powers of k) can be simplified. How much so depends on what assumptions may be placed on the remaining parameters, or how much it matters to respect branch-cut choices for the radical subexpressions.

Can you tell us anything about A, P, and N?

 

@mmcdara In your other example, I believe that you'll need PDF = unapply(f,t) instead of PDF = (t -> f) so as to obtain PDF as a procedure that properly uses its parameter t.

My_ChiSquare_ChiSquare_Gof_Test_ac.mw

Do you now want a customized command Distribution that will detect when it gets called like, say, Distribution(GeneralizedBetaDistribution(a,b,scale,shift)) and invokes Statistics:-Distribution as in your example, but otherwise simply passes along all arguments?

@Carl Love It looks like the command-completion popup.

These command-completion templates are stored (somewhere). But I don't know offhand whether it's practical or possible to augment that with one or more templates for a custom user-defined procedure.

(If you are asking how he got it into Mapleprimes, I don't know how he got the image here -- possibly via a screenshot.)

Here are two ways it could be done.

They use slightly different ways to access the stored values/fields. You could even make it do both of these ways.

One point is that as an object you get the new type, Person, for free without having to utilize TypeTools:-Add and a proc that tests, say, a Record approach.

The definition of the object is centralized. Changing it only requires editing that defintion (and, naturally, wherever the constructor gets called, if you alter the kinds of arguments the constructor accepts.)

restart;

Person:=module()
    option object;
    local ModulePrint, R;
    export ModuleApply::static:=proc()
      Object(Person, _passed);
    end;
    export ModuleCopy::static:=proc(new::Person, proto::Person,
                                    name::string, age::nonnegint)
      if nargs=4 then
        new:-R := Record(':-name'=name,':-age'=age);
      else
        error "invalid arguments"; end if;
    end proc;
    export `?[]`::static:=proc(a, idx::list)
        if idx=[] then
          [a:-R:-name, a:-R:-age][];
        elif nops(idx)=1 then
          a:-R[idx[1]];
        else error "too many indices, %1", [idx][];
      end if;
    end proc;
    ModulePrint:=proc(a)
      # or whatever you want
      'Person'(R:-name,R:-age);
    end proc:
  end module:

P1 := Person("john doe 1", 99):

P2 := Person("john doe 2", 80):

P1;

_m139837426773472

P2;

_m139837426775168

type(P1, Person), type(P2, Person);

true, true

P1[];

"john doe 1", 99

P2[];

"john doe 2", 80

P1[name], P2[name]

"john doe 1", "john doe 2"

P1[age], P2[age];

99, 80

P1[name, age];

Error, (in ?[]) too many indices, [name, age]

foo:=proc()"joe doe 1";
   Person("john doe 1", 99);
end proc:

boo:=proc()
   Person("john doe 2", 80):
end proc:

S1:=foo();
S2:=boo();

_m139837429143520

_m139837429160672

type(S1, Person), type(S2, Person);

true, true

S1[name], S2[name]

"john doe 1", "john doe 2"

S1[age], S2[age];

99, 80

 

# Another way

restart;

Person:=module()
    option object;
    local ModulePrint, lname, lage;
    export ModuleApply::static:=proc()
      Object(Person, _passed);
    end;
    export ModuleCopy::static:=proc(new::Person, proto::Person)
      if nargs=4 then
        (new:-lname,new:-lage) := args[3], args[4];
      else
        error "invalid arguments"; end if;
    end proc;
    export name::static:=proc(a)
      a:-lname;
    end proc;
    export age::static:=proc(a)
      a:-lage;
    end proc;
    ModulePrint:=proc(a)
      # or whatever you want
      'Person'(lname,lage);
    end proc:
  end module:

P1 := Person("john doe 1", 99):

P2 := Person("john doe 2", 80):

P1;

_m139837426773408

P2;

_m139837426775040

type(P1, Person), type(P2, Person);

true, true

name(P1), name(P2);

"john doe 1", "john doe 2"

age(P1), age(P2);

99, 80

foo:=proc()"joe doe 1";
   Person("john doe 1", 99);
end proc:

boo:=proc()
   Person("john doe 2", 80):
end proc:

S1:=foo();
S2:=boo();

_m139837429174080

_m139837429191200

type(S1, Person), type(S2, Person);

true, true

name(S1), name(S2);

"john doe 1", "john doe 2"

age(S1), age(S2);

99, 80

 

Download person_object_2.mw

Here is some additional computation (Maple 2019.1, 64bit Linux), involving attempts at eigen-conditioning approximation.

problematic_evals.mw

There are a few possibilities worth investigating: 1) the software float functions sw_xxxxxx are from an older (generic, netlib) clapack, and it's possible translations to C from newer lapack might differ, 2) machine-epsilon in the software-float sw_xxxxxx functions is defind according to Digits, but it's possible that some other hard-coded values or iteration limits could be adjusted beneficially, 3) ill-conditioning might be bad enough that things are really difficult, 4) there may now be additional choices than zgeevx. 

@Carl Love I was alluding to the fact that the initially constructed multivariate polynomial F with integer coefficients might be a POLY DAG, and that sort could turn that into a SUM DAG. See Appendix 1 of the Programming Manual which has a few notes. I mentioned dismantle only because it can illustrate that effect.

The purpose of the POLY DAG is to allow efficient computation (see web searches and results indicating development work at SFU CECM by Monagan, Pearce, et al.).

I don't know precisely how interface(prettyprint) versus lprint may differ in all cases. But AFAIK behavior under printing is a consequence of these DAG structures (and not a motivation for structural changes).

@Mac Dude

The call ssystem("ls; pwd") works for me in the Command Line Interface (aka CLI, or tty interface) on Linux, but not in the Standard Java GUI.

I'll submit a bug report.

@nm By dividing by a specific algebraic expression (the lhs of vv's `*` equation) you have removed some information (related to presupposing that expression is not equal to zero), resulting in mathematically lost solutions.

You then describe that as being "ok".

First 208 209 210 211 212 213 214 Last Page 210 of 591