acer

32333 Reputation

29 Badges

19 years, 322 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@Agha You can import all the subimages using Maple's ImageTools package. You can add them into a single image using Maple's ImageTools package. You can then use that with the background option of the appropriate 2D plotting command.

Duplicate Question threads of this will be flagged as such, and may be deleted.

I respectfully suggest nobody respond to duplicate postings.

I suggest that the questioner put additional details and attempted corrections here, not in wholly separate threads.

The things you've described so far (partially) are possible.

But you (not us) should provide the full and explicit example of plot(s), text, images, etc, along with placement locations and any other relevant detail.

I have done before what you've described so far in two separate ways: once all with images, once all with "plot" structures. But I'll wait for an adequate specification by you.

Which version of Maple are you using, that does not produce 1/x^(1/2) ?

@mmcdara Your example has the function call actually return something different. That is not what was being asked.

The whole point of using the print extension mechanism was to have an unevaluated function call, say f(x,y,z), be pretty-printed as something else, eg.
    f[w](x,y)

What you did in the latter part of your worksheet is actually define a procedure such as f so that the call f(x,y,z) actually returned something else. That's not the goal here. This is about the way that output is pretty-printed, not what values are output.

Note how the `print/f` procedure below does nothing to the returned value of a call to f itself.

restart;

`print/f` := proc(a,b,c) f[c](a,b); end proc:

 

f(x,y,z);

f(x, y, z)

 

lprint(%);  # the call remains unchanged!

f(x, y, z)

 

Download print_extension_example.mw

@Kevin Dragnet For fun, you can create a pair of utilities that allow you to flexibly set/unset the behaviour according to some supplied form(s).

restart

Enable := proc (f, vars, form) options operator, arrow; assign(cat('`print/`', f), unapply(form, vars)) end proc; Disable := proc (f) options operator, arrow; unassign(cat('`print/`', f)) end proc

 

Enable(`#mover(mi("U"),mo("∼"))`, [x, y, z], `#mover(mi("U"),mo("∼"))`[z](x, y))

 

`#mover(mi("U"),mo("∼"))`(v1, v2, w)

`#mover(mi("U"),mo("∼"))`(v1, v2, w)

`#mover(mi("U"),mo("∼"))`(a, b, c)

`#mover(mi("U"),mo("∼"))`(a, b, c)

Disable(`#mover(mi("U"),mo("∼"))`)

 

`#mover(mi("U"),mo("∼"))`(v1, v2, w)

`#mover(mi("U"),mo("∼"))`(v1, v2, w)

 

Enable(`#mover(mi("U"),mo("∼"))`, [x, y, z], (('InertForm:-Display')(`#mover(mi("U"),mo("∼"))`^`%.`(x, y), 'inert' = false))(z))

`#mover(mi("U"),mo("∼"))`(v1, v2, w)

`#mover(mi("U"),mo("∼"))`(v1, v2, w)

`#mover(mi("U"),mo("∼"))`(a, b, c)

`#mover(mi("U"),mo("∼"))`(a, b, c)

Disable(`#mover(mi("U"),mo("∼"))`)

`#mover(mi("U"),mo("∼"))`(v1, v2, w)

`#mover(mi("U"),mo("∼"))`(v1, v2, w)

Download printf_ext_gen01.mw

Sometimes the unevaluated "form" may be slightly tricky to concoct. (Using 2D Input doesn't make it easier...)

@Kevin Dragnet If you know that your function call will only ever have exactly three arguments then you can make it shorter:

restart

`print/#mover(mi("U"),mo("∼"))`:=
  (a,b,c)->`#mover(mi("U"),mo("∼"));`[c](a,b):

 

`#mover(mi("U"),mo("∼"))`(v1, v2, v3)

`#mover(mi("U"),mo("∼"))`(v1, v2, v3)

`#mover(mi("U"),mo("∼"))`(x, y, z)

`#mover(mi("U"),mo("∼"))`(x, y, z)

Download printf_sub_ex3.mw

 

And the above looks complicated mostly because it's hard-coded for that typeset U-tilde.

A pair of commands to enable/disable such a rule according to the name of the function (zeroth operand), would be quite simple. But you didn't address my earlier queries about what exactly you might want along those lines.

@Kevin Dragnet I have amended my Answer to include a solution for your followup query.

I don't really understand why you wouldn't describe what you actually wanted at the outset.

Perhaps you are actually looking for a more general mechanism that can,
1) enable a particular rule for pretty-printing of unevaluated function calls to any name you supply (eg. U, f, U-tilde, etc).
2) disable such a previously enabled rule, given a name you supply.
If that is your goal then you should explicitly specify the rule you want, eg,
  i) f(a[1],...a[n]) displays like f[a[n]](a[1],...a[n-1]) for any posint n.
or, say,
  ii) f(a[1],a[2],a[3]) displays like f[a[3]](a[1],a[2]) and all other calls to f display as usual,
or,
  iii) something else as yet unexplained.
If you are looking to implement something more general like that then you really ought to explain the requirements in full.

@Oliveira The link you provided downloads as an empty file (zero bytes).

The GUI's ability to recover from a corrupted .mw file is sometimes problematic. Sometimes it is unable to recover as much as possible of the content.

So, if your recovery doesn't go well, you could also try uploading the errant file and attaching a link to it here.

Why haven't you attached your complete example, with tightly specific details about what you actually wanted, to this Question itself?

It seems that calling is or coulditbe on this example does in fact make use of SMTLIB:-Satisfiable (Maple 2022.2), but not in a manner that gets the result.

I will submit the example.

[edit] The following kludge allows is to get a result, very slowly. Alas it doesn't try any early pass-off of the whole system to SMTLIB:-Satisfiable, which we know can handle the whole system quickly.

restart;
kernelopts(version);
   Maple 2022.2, X86 64 LINUX, Oct 23 2022, Build ID 1657361

F1 := a + b + c + d > 0
      and
      a*b + a*c + a*d + b*c + b*d + c*d > a^2 + b^2 + c^2 + d^2:
F2 := d*c*b*a > 0
      and
      a*b*c + a*b*d + a*c*d + b*c*d > 0:
if convert(kernelopts(version),string)[7..12]="2022.2" then

  `is/internal/SMTLIB`:=FromInert(subsop([5,7,1,2,5,1,1,2,1,2,1,2,1]=10,
                                  ToInert(eval(`is/internal/SMTLIB`)))):

  _EnvTry := hard:

  CodeTools:-Usage(print( is( not( F1 and not F2 ) ) )) assuming real;

end if:
                              true

memory used=15.57GiB, alloc change=361.50MiB, cpu time=3.34m, real time=2.97m, gc time=32.51s

@Carl Love Thank you; it was early and while I had other equivalent forms ok I was blind to this one.
    is( not( F1 and not F2 ) )

And if I correct it then I get FAIL, as I did for a valid equivalent form with disjunction, etc. (I was suspicious because the "success" stood out.

@dharr The fact that both 1 and undefined are both of type algebraic is not a sufficient reason to expect that neither would be applied to the index pairs as arguments.

Every symbol is of type algebraic. Like the number 1 and the name undefined, the symbol `^` is also a name of type algebraic.

Matrix(2,2,`^`);

                [1  1]
                [    ]
                [2  4]

The help-page for topic Matrix states:

"expression of type algebraic
The expression is evaluated as a function (or procedure) which takes a pair of positive integers as arguments (i.e., Matrix indices) and returns the value of the corresponding entry of the Matrix.
"

Kitonum's Answer explains what has happened: the name undefined is of type algebraic, and so it gets applied to the index pairs. This is an example covered by the cited paragraph above.

Here's something relevent to your example of using the number 1 as third argument. Anything of type numeric or complex(numeric) returns itself when applied to something:

17(2,5);

             17

-37.23(11,2);

           -37.23

(3/7)(8,3);

              3
              -
              7

In a related way, consider,

   Matrix(2,2,f);
   eval(%, f=3.4);
   Matrix(2,2,3.4);

(I'm not saying that the Matrix command actually goes to all the effort of appling a numeric 3rd argument to all the index pairs. It may well know that it doesn't have to bother. The behaviour is consistent with its doing so, which is what matters here.)

@zenterix The code snippet you just posted appears to be fundamentally the same kind of thing that the Explore command does, ie. it simply embeds a Plot Component and then pushes the various pointplot3d results to it. Those lines of code are essentially what Explore does, yet less simple and straightforward.

Except Carl's use of Explorepointplot3d contains some additional kernel/Library-side memory optimizations.

There doesn't appear to be anything in the code snippet you just gave that would help in any additional way with the memory clog in the Java GUI that Carl described.

First 86 87 88 89 90 91 92 Last Page 88 of 591