Joe Riel

8243 Reputation

22 Badges

15 years, 223 days

MaplePrimes Activity


These are replies submitted by Joe Riel

What's the application?  That is, given a Maple worksheet, do you want determine what comboboxes are in it?

I have a command-line tool, written in Maple using the Bark package available on the Maple cloud, that I use from the linux command line to inspect and modify worksheets.  For example, here I use it to determine what comboboxes exist in a given worksheet:
 

$ ect Linearization.mw --type=ComboBox
cmbInputVarRoot
cmbOutputVarRoot
cmbInputVar
cmbInputSignal
cmbOutputVar

If interested I could push it to the cloud (might take a while to get it ready).

@jfk_dora You can also use subs[eval]( X = Y, Z).  That performs the substitution, then evaluates.

@nm Given a list, say L := [a,b,c], L[] is equivalent to op(L), both of which return the expression sequence (a,b,c).  This also works with sets. In the usage sort(...)[], the list returned by sort is converted to an expression sequence, then passed to the inert addition operator.  Inert addition is used (rather than regular addition) so that the terms don't get automatically permuted to the original order.

Alas, currently there isn't a good way to do this.  I don't recall the precise reason that the noise blocks do not yet work in MapleSim. They use external code that currently is not supported.  Will look into it.

I've done so with fmpy but not with pyfmi (haven't used it), but assume it can be done.  As Thomas Richard suggests, make L a tunable parameter (in the fmu generation).  Will look into using pyfmi when I get a chance.

@Carl Love Thanks.  So far as replacing abs(n,x) with x, I'm embarassed to say I didn't bother to consider whether it made any sense. Also, the _@@0 took me a minute to comprehend. I've frequently lamented the lack of a builtin identity; that isn't it, but it is ingenious.  Note that 0@@0 also works.

 

@Carl Love That doesn't seem right.  I don't have &inside so didn't actually test, but doesn't the replacement for a multiargument abs have to return only the last argument?  So rather than the eval, abs=_@@0, I'd use x -> op(-1,x).

 

I assume you mean a template something like the Custom Component template, which works for continuous models. It could be extended to handle discrete models.  Do you have an example of discrete equations you want to model?

@acer That's a much better example than mine. 

@Anthrazit The mint facility can help here.  While it doesn't flag such a call as an error (it isn't, syntactically), if called with infolevel 4 you can see all the function calls.  While mint is normally used with external text files, you can use my CodeBuilder package, available via the Cloud, to run mint on code edit regions.  Here's a snippet of the output when doing so with your worksheet:
 

CodeBuilder:-Build('mint','maplet','infolevel'=4);

# that pops up a maplet with the display.  I've selected the relevant lines

Procedure IndirectCall() on lines 9 to 11
  Global variables usage: 
      CatchMeNot was called as a function
  These functions were called:  CatchMeNot

Any global variable usage should be looked at with suspicion.  The output also includes
 

Procedure CatchMe_Not() on lines 5 to 7
  These names were used as global names but were not declared:  SetProperty
  Global variables usage: 
      SetProperty was used as a value

While that is legal, it isn't ideal.  To correct this either forward quote SetProperty, or, better, use the colon-dash operator:  DocumentTools:-SetProperty.  The value argument passed should either be forward-quoted, or double-quoted (a string, which is accepted by DocumentTools:-SetProperty). Because value is a protected name, using it unquoted is mostly innocuous, however, it's good practice to quote such names.

@Anthrazit Unevaluated functions are frequently used to return a result that could not be evaluated.  They are also used as data structures, sometimes in conjunction with the `print/foo` facility, where foo is the function name; an unevaluated function call to foo, when displayed, will use the result of `print/foo` if such a procedure is defined.  This functionality is old.

Note that read and save are similar, that is, they are part of the Maple language and don't need parentheses, though are frequently seen with them.

@Carl Love Am thinking it should be feasible to extend specfunc to handle this.  That is, the format could be specfunc(type*, type, f), where the second argument (type) matches the remaining arguments in f (after matching those specified by multiple types). Then the answer could be type(., 'specfunc(specfunc(posint,g), posint, f)'). 

@BenOve Alas, you need to unpack the help database that comes with it; without it will be hard to figure out. Did you try running the command after first calling trace on it, as I showed in a previous response?  It would be better to get to the root of the problem.
 

@Thomas Dean Did you try Syrup:-About()?  It should return a record.  Not a big deal if it doesn't, since it isn't used for anything.

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