acer

32343 Reputation

29 Badges

19 years, 327 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@rlopez A Question posted by this member within the past 24 hours has an attachment that was last saved using Maple 2022.1.

I have not seen the cited problem, using Maple 2022.2 for 64bit Linux.

Perhaps the OP could try with the 2022.2 upgrade.

@Rouben Rostamian  The D operator does not necessarily need to invoke the procedure at arguments -- an act which obtains an intermediate expression, if it does not throw an error.

In contrast, your extension invokes e(params) at arguments which are mere names.

The D procedure can perform some kinds of automatic differentiation (aka algorithmic differentiation), without actually invoking the procedure.

But in the non-scalar case your extension generates an expression using symbolic names as arguments in an acutal call. That approach is restricted to the smaller class of examples for which a Vector of functionally equivalent expressions gets returned by that call. That is weaker than algorithmic differentiation, despite its later use of D following unapply.

This reduction in functionilty seems significant enough to make a stricture against using diff (followed by conversion to D, say) look misplaced.

[edit] Some aspects of general requirements are missing in the Question:
- The given example has only function calls to unknowns a and b. What functionality is wanted when the elements in the Vector call (within the procedure) involve calls to concrete, defined procedures (a and b, say)? What kinds of procedures might be used, i.e must be supported? What -- if any -- algorithmic differentiation might be needed?
- And what if the Vector elements are formed by compound expressions  (possibly involving function calls which may or may not be resolved to concrete procedure calls); here too it's unclear why diff might be discouraged.

@Rouben Rostamian  It does not seem entirely reasonable to impose a stricture against using `diff` if your solution is going to make the call z(u,v).

@Rouben Rostamian  I'm ok with your wording, for the purpose of the discussion. Sorry if it sounded like I was objecting. I mostly wanted to clarify.

I don't prefer the wording in the emitted error message, however.

What don't you upload and attach your actual worksheet, so that we can examine it and see what is going on?

You wrote, "inline plot component", but it's unclear what you mean since there is nothing that fits that description exactly.
  - There is such a thing as a PlotComponent, which are a kind of embedded component.
  - There are inline plots, which are usual output and not part of any embedded component.

If you copy & paste an embedded Plot Component then it necessarily gets renamed upon pasting (since the original was not removed). If you cut & paste then something else might happen. We cannot yet tell for sure what you might have done, or "cut".

@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.

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