acer

32622 Reputation

29 Badges

20 years, 43 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@gaurav_rs I made a Reply to your duplicate of this followup discussion here. I uploaded a worksheet showing a slightly different method (using Maple 18 which you mentioned using).

@gaurav_rs Attached is a variant, in which the inset is an image, as background inside an actual plot. This allows the outer plot to be exported as .eps encapsulated postscript, using say the right-click export mechanism.

I had to scale up the size of the temporary image so that the curve in the inset didn't suffer so much from artefacts (loss of the antialiasing, I suppose).

I used Maple 18.02.

plotinplot2b.mw

The bookkeeping of the scaling details is hard-coded for this example. But you should be able to fiddle with all that for your point-plot.

 

@quo The command DocumentTools:-Tabulate accepts an optional argument typesetting=extended which allows the prettyprinting to be done the way you want, I hope.

You sent me a worksheet made in Maple 2016.2. Here's the Tabulate bit, done with your Vector in two slightly different ways, using Maple 2016.2.

One way makes  a 1x1 GUI Table with a prettyprinted Vector in it. The other way makes a 30x1 GUI Table where each Table Cell contains one of the entries of the Vector.

The first way requires interface(rtablesize) to be at least as large as the Vector.

I adjusted both to use 1750 pixels for the width of the surrounding Table, which seemed a nice fit on my 64bit Maple 2016.2 for Linux. If it doesn't look right then you might have to adjust that, say for MS-Windows or Mac OS X (where the font size might have an effect).

eqs_extended.mw

 

 

Perhaps check Maple's own security settings, under Tools->Options from the main menu bar.

Why is there a derivative of g (evaluated at point 1) in the BCs? is it a typo for say g1 or g5 or...?

@gaurav_rs I won't have access to a computer with Maple for a few days.

But it's not clear what code you've executed, surely you must see that. Upload an attached .mw file (big green arrow) with all your code. Is fn assigned an Image (in the ImageTools sense) or a string (file name)?

If it's an Image then in modern maple you could try,

plot(axes=none,background=fn)

and then export as .eps format.

If it's the filename of a .bmp format file then you could use the ImageTools commands Read and Write to read in the .bmp and Write out to .jpg format. Or read in to get an Image thing, and then plot as above.

If you upload code I can look at it a bit later, and as I mentioned I think I could do it better than before, with modern Maple.

@gaurav_rs If fn is an Image (in the ImageTools sense) then you should be able to use ImageTools:-Write to export it as a jpg file. Or in modern maple you could try,

plot(axes=none,background=fn)

and the export that plot to .eps format.

It's not clear from your very short comment above what exactly you did to compute the value assigned to `fn`.

Yet a fourth way (possible now but not when this Question was originally posed) is to make the subplot be a positioned image on the background of the whole plot. This too should allow the subplot's axes to look right with less effort, IMO. Maybe I can find time to try and automate this better (though automatic placement of the subplot can be hard in general).

@quo I'm away from any computer running Maple for the next 5-6 days, but I'll look into your question then (I might answer in your other thread...).

I'm not sure which Maple version you have, and whether you're using typesetting=standard or typesetting=extended (as an `interface` command option, or as set under Tools->Options->Display from the menubar). It might make a difference, in say the prettyprinting done by Tabulate. But perhaps useful for me to know anyway...

@Adam Ledger The series command returns a special data-structure, which is not just a polynomial (a sum of terms). That special structure *prints* nicely like a polynomial and an error-term. But it's internal structure is different. And the `op` command works on the internal structure, not on what you see printed.

If you want to pick it apart as if it were a sum of products, like a polynomial, then you first need to convert. That's what gkokovidis has mentioned.

The operands of a SERIES data structure are not precisely the same as the operands of a SUM structure. The `op` command picks off operands.

If you want to use `op` without first converting to `polynom` then you need to adjust your usage to match the structure.

Try calling `op` (with no extra options to denote which operand) on both the result S from `series` as well as on convert(S,polynom). That might gain a little insight for you.

What happens if you do it with,

sprintf("%a", result)

instead of,

convert(result, string)

 

@John Fredsted Yes, it is essentially the same as `select`, for this example with procs in the list.

It's not exactly the same, because the seq indexer takes on elements of the list (rather than posint positions into the list, say). And so Tom's code needs that extra `eval` too.

A big part of why they are essentially the same is that looped list-augmentation is O(n^2) in memory (triangular usage), while both seq and select build up the result in one run and are O(n) in memory (up to gc and other maple-isms). It could also be done with `map`. Of course the constant factors in the time complexity of such different methods are each different, so in practice timings amongst them will differ. This complexity talk relates to asymptotic behavior, naturally. (I mention that in the hope that disingenuous dissemblers will not strive to muddy the waters. I'm most definitely not referring to Tom, by that.)

We haven't been told the precise nature of the expressions that may be present, or what types of function call should be accepted, but the following cases can also be easily handled by type typefunc. The original question is about testing for various types of function call, and that is what type typefunc can do.

The OP may decide which of the following sieves might serve.

restart;
                                                                                                                
eq3:=diff(u(t),t)+sin(diff(x(t),t))=t+x(t)-1+sin(x(t))
     +cos(t)+G(t,(D(x))(t),v(t))+D(w)(t)+P(n)(t)+K[m](t)
     +Diff(r(t),t,t):

indets(eq3, {name, 'typefunc(name, Non({last_name_eval,specfunc(D)}))'});

            {t, r(t), u(t), v(t), x(t), K[m](t), P(n)(t)}

indets(eq3, 'typefunc(name, Non({last_name_eval,specfunc(D)}))');

              {r(t), u(t), v(t), x(t), K[m](t), P(n)(t)}

indets(eq3, {name, 'typefunc(name, Non({last_name_eval,function}))'});

                {t, r(t), u(t), v(t), x(t), K[m](t)}

indets(eq3, 'typefunc(name, Non({last_name_eval,function}))');

                  {r(t), u(t), v(t), x(t), K[m](t)}

indets(eq3, {name,
             'typefunc(name, Non({last_name_eval,
                                  function,indexed}))'});

                     {t, r(t), u(t), v(t), x(t)}

indets(eq3, 'typefunc(name, Non({last_name_eval,
                                 function,indexed}))');

                       {r(t), u(t), v(t), x(t)}

[edit] Markiyan's use of x'(t) in plaintext 1D Maple Notation code is a syntax error. Code with 2D-Math-specific syntax is not sensible in plaintext. It's difficult to take seriously a seasoned user who makes such a fundamental mistake.

@John Fredsted Yes, sorry, lazy cut & paste. Fixed.

@John Fredsted In Kitonum's code the name F is assigned the list of anonymous procedures, and loop index name i takes integer values. But none of the names in play are ever assigned any procedure as value, so last-name-evaluation doesn't come into play.

Last-name-evaluation (LNE) serves a few useful purposes. It allows you to pass the name of a procedure as an argument (to some other procedure), without that name being evaluated to the procedure body of its value. Under normal evaluation rules arguments are evaluated.

Similarly, LNE allows you to pass the name of a table as an argument to a procedure, without that table being copied. Hence you can do in-place operations on tables (or other mutable data structures like the now-deprecated array/matrix/vector which are table-based under-the-hood).

While LNE is a rather brilliant solution (IMO) to the technical issue of allowing these beasts to be passed -- without copying and full evaluation -- as arguments to procedures, it can sometimes require explicit eval calls, as in your example. Sometimes it gets you into a mild muddle, from which the term last-name-evaluation-disease (LNED) was coined. Older users will remember the burden of using evalm when handling array/matrix/vector.

LNE is an important piece of the puzzle of Maple evaluation rules, as worth learning as special-evaluation-rules, and the fact that assigned locals and parameters of a procedure get only 1-level evaluation within the procedure body (following normal full eval of the arguments). For the last of those, see subsection "Statement Sequence Interpretation" of section 6.6 of the Programming Guide.

First 280 281 282 283 284 285 286 Last Page 282 of 596