acer

9 years, 119 days


These are answers submitted by acer

plot

26 minutes ago acer 10768

For this particular example each equation can be isolated for either x or y. The first is of the form y=f(x) and the second is of the form x=g(y). So the first can be plotted directly using the plot command. The second can also be handled directly using the plot command, and if the transformation (x,y)->(y,x) is applied then the second plot can be sensibly displayed with the first plot. I mention this just because it can produce a smooth pair of curves.

Of course you can adjust the ranges, colors, or the scaling and view options to taste. But I expect that you might want to make the ranges used in the plot calls match the respective ranges in the view option.

plots:-display(
  plot(x^3-4*x,x=-2..2,color=red),
  plottools:-transform((x,y)->[y,x])(plot(y^3-3*y,y=-2..2,color=blue)),
  scaling=constrained, view=[-2..2,-2..2]);

acer

eval

Yesterday at 10:44 PM acer 10768
restart:

result:=solve({x+y=1,x+2*y=4},{x,y});

                        {x = -2, y = 3}

vals:=eval([x,y],result);

                            [-2, 3]

acer

record

January 23 2015 acer 10768

I'm not sure I understand your issue.

restart:

v:=Vector([Record('l','R')]):                      

TypeTools:-AddType(Element,'record(l,R)'):         
TypeTools:-AddType(ExpandedLine,'Vector(Element)'):

type(v,ExpandedLine);                              

                                     true

type(Vector([Record('s','p')]),ExpandedLine);

                                     false

kernelopts(version);

            Maple 18.01, X86 64 LINUX, Mar 28 2014, Build ID 935137

acer

evalc

January 19 2015 acer 10768
expr:=I*b+a+x+I*y+I^2*c;   

                         expr := b I + a + x + y I - c

evalc(expr);               

                             a - c + x + (b + y) I

evalc(Re(expr)+I*Im(expr));

                             a - c + x + (b + y) I

acer

blacksquare

January 18 2015 acer 10768


:-`▪`;

`▪`

':-`▪`';

`▪`

Typesetting:-mrow(Typesetting:-mn(':-`▪`',':-mathsize'=30));

"▪"

:-`▪`;

`▪`

':-`▪`';

`▪`

Typesetting:-mrow(Typesetting:-mn(':-`▪`',':-mathsize'=30));

"▪"

kernelopts(version);

`Maple 18.02, X86 64 WINDOWS, Oct 20 2014, Build ID 991181`

 


Download blacksquare.mw

acer

another way

January 14 2015 acer 10768

Here's another approach.

It'd be a little trickier than this, to make fencing with brackets be fully optional. The display would look nicer fenced, however, when multiplying a pair of such displayed mixed rationals.

If a more complete package to deal with such things were wanted then it might instead be done with objects (ModulePrint, static exports to handle their arithmetic, etc).

I realize that you showed a textplot simply as another way to get the effect using an axes-less plot, and that you may not want plots. But for what it's worth, I show below that the approach given here seems to play ok with textplots anyway.

[edit] See corrected version in comment below, to properly get `value` from a negative example. 

restart:

`print/%mixed` := proc(a,b)
   uses Typesetting;
   #mcomplete(mfenced(mrow(mn(convert(a,string)),mn(" "),Typeset(b))));
   mcomplete(mrow(mn(convert(a,string)),mn(" "),Typeset(b)));
end proc:

%mixed := proc(x::rational)
  if nargs=1 then
    if abs(x)>1 then
      'procname'(trunc(args[1]), abs(args[1]-trunc(args[1])));
    else x; end if;
  else 'procname'(args); end if;
end proc:

mixed := `+`:

%mixed( 17/6 );

%mixed(2, 5/6)

value(%);

17/6

%mixed( -100001/9971 );

%mixed(-10, 291/9971)

value(%);

-99419/9971

%mixed( 17/6 ) + %mixed( 11/5 );

%mixed(2, 5/6)+%mixed(2, 1/5)

value(%);

151/30

plots:-textplot( [ 1, 1, %mixed( 17/6 ) ],
                 size=[200,200], gridlines=false);

 

 

Download mixedrationals.mw

acer

unevaluated name

January 08 2015 acer 10768
restart:
assign(a,c):
assign('a'=d,b=2):

a,b,c;

                                    d, 2, c

By using uneval quotes the assignment is made to that quoted name rather than whatever (other name) it might currently evaluate to.

acer

sincos

January 06 2015 acer 10768

This is not the first time that I've seen Maple do better with mixtures of sin and cos than with tan or cot.

value(convert(Int(tan(x)^(n-2)*sec(x)^2,x),sincos));

                                       (n - 1)
                               /sin(x)\       
                               |------|       
                               \cos(x)/       
                               ---------------
                                    n - 1     

int( convert(tan(x)^(n-2)*sec(x)^2, sincos), x );

                                       (n - 1)
                               /sin(x)\       
                               |------|       
                               \cos(x)/       
                               ---------------
                                    n - 1     

In this particular case, it also does a nicer job after preliminary conversion to expln.

acer

Ctrl-Del

January 06 2015 acer 10768

Try Ctrl-Del (Control and Delete keys at the same time).

See here (Windows, which has the above as an item for "Delete an Element") or here (Operating System links, because on OSX it is Command-Del).

acer

HelpZoom

January 06 2015 acer 10768

In a plaintext preferences file I see a HelpZoom=100 item.

On my Windows 7 I found one of these as,

cat(kernelopts(homedir),"/AppData/Roaming/Maple/18/Maple.ini")

But even if I manually edit that entry to have instead a value of 300 (say) then this appears to be ignored/clobbered when any new Help (browser) window is opened. And even if I use the Help window's menu to zoom to 300% (Ctrl-6) then upon exiting the whole GUI that new value is lost. It appears to be lost any time I open a wholly separate and new Help window, and the preferences file is re-saved with the 100 value when I exit the GUI.

It seems that this item in the preferences file is just not doing anything. To me, it looks like it was at least someone's intention, at some point, that it work. It would be useful and user-friendly if worked.

acer

via inert form

January 04 2015 acer 10768

It looks like this got broken between Maple 13.00 and 14.01.

If you really prefer that it not emit that error (instead of using :-combine, say) then you might consider patching it by adjusting the inert form of the procedure. For example,

restart:

unprotect(IntegrationTools:-Combine):
IntegrationTools:-Combine:=
  FromInert(
    subs(ToInert(And(DefiniteIntegral,Not(MultipleIntegral)))
         =ToInert(And(Or(IndefiniteIntegral,DefiniteIntegral),
                      Not(MultipleIntegral))),
         ToInert(eval(IntegrationTools:-Combine)))):
protect(IntegrationTools):
protect(IntegrationTools:-Combine):

IntegrationTools:-Combine( Int(sin(x),x)+Int(cos(x),x) );

                             /                   
                            |                    
                            |  sin(x) + cos(x) dx
                            |                    
                           /                

That is quite a crude use of subs, above, which apparently works out ok in my Maple 18.02 for this brief procedure. You ought to check whether you think it does what you intened. More robust and generally safe might be too get at the particular pieces for correction using op, check they are of the expected wrong form, then replace with subsop.

You would need to be extra careful about saving the modified module to archive, which can be tricky (and sometimes not practical) since doing it right can require first evaluating many other parts of the module. I don't suggest anyone who doesn't consider themselves expert try that. It's a lot simpler merely to have the fix-up be done as above, in one's initialization file.

Such changes would be better if accompanied by test examples. It's obviously risky to make changes to some command whose code is protected.

acer

Initialize

January 04 2015 acer 10768

The types in question are added when the module is read from archive. Also, these types can be used with the global names. These two facts together imply that you don't need the full set of actions (including rebinding of exports' names) caused by invoking with(IntegrationTools) in order just to get those types. The types will also be defined merely by causing the global symbol :-IntegrationTools to be looked up.

restart;
v := Int(sin(x), x):

type(v,:-IndefiniteIntegral);
Error, type `IndefiniteIntegral` does not exist

eval(IntegrationTools):
type(v,:-IndefiniteIntegral);
                              true

This module uses a local named IntegrationTools:-Initialize to make the calls to TypeTools:-AddType. I mention this in case you'd prefer merely to add the types yourself.

showstat(IntegrationTools::Initialize);

acer

set vs list

January 02 2015 acer 10768

Your Question says "list" but your code uses a set.

If your code actually used a list (square brackets) then you'd see length 9. But a set (squiggly braces) has its duplicate entries removed.

acer

subs

December 31 2014 acer 10768

These do what you seem to be asking.

subs( originvarslist =~ varslist, f );

or,

subs( Equate(originvarslist,varslist), f );

or,

subs( zip(`=`,originvarslist,varslist), f );

And you could directly assign the result to `f`, if that's your goal.

acer

op 0

December 25 2014 acer 10768

If the result of a call to `int` has been assigned to `g`, then at the top-level you could test whether,

op(0,eval(g,1)) = int

in order to check whether it has returned as an unevaluated function call to `int`.

The use of 1-level eval is to prevent the active `int` from trying the computation over, especially if all relevant remember tables might have been cleared. (A note on using procedures for a similar effect, more generally.)

You can also test against :-int instead of just int, in case packages are loaded and the name rebound. Or test against inert `Int`, if you started with that and hit it with the `value` command.

I find the idea of `int` emitting an error instead of an unevaluated return to be generally poor; the unevaluated return can be quite conveniently useful in several situations.

acer

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