acer

32617 Reputation

29 Badges

20 years, 42 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

Here are two ways to create it.

You could create either row Vectors or column Vectors, depending on which you want.

Vector[row]([seq(0..20,0.5)]);

# trunc((20-0)/(0.5)+1)  is just 41

Vector[row]( trunc((20-0)/(0.5)+1) ,(i)->(i-1)*0.5);

Apart from suppressing the ellipses altogether (as Thu has shown), there is also the possibility of stretching the ellipse or reducing the font size.

Your question mentioned the possibility to "modify the ellipses", but without "ad hoc modifications". Surely that only makes sense if you provide at least some guideline of what would be an acceptable modification. For example, do you mean that you would only want the ellipse re-jigged to the longest label if it could be done fully automatically and robustly?

I'll toss these out there, in case another reader is interested but with less restrictions about ad hoc changes.

restart;
with(GraphTheory):
g := Graph({{"azertyuiopqsdfghjklmwxcvbn", 1}, {"azertyuiopqsdfghjklmwxcvbn", 2}}):
P := DrawGraph(g, style=tree, root="azertyuiopqsdfghjklmwxcvbn"):
P;
subsindets(P,specfunc(FONT),u->FONT("HELVETICA","DEFAULT",8));
plots:-display(P,size=[1000,1/2]);

Matrix indexing starts from 1.  But Array indexing can start from 0 (or whatever you want).

And you can create an rtable-Alias of a Matrix that behaves like an Array and which starts its indexing from 0.

Since it is an Alias, changes to either of them also appear in the other. They act like views onto the same data in memory.

So you can use indexing-from-zero to assign to (or access from) the Array's name, but the values will come from the Matrix. And vice-versa.

restart;

X := LinearAlgebra:-RandomMatrix(3);

Matrix(3, 3, {(1, 1) = 27, (1, 2) = 99, (1, 3) = 92, (2, 1) = 8, (2, 2) = 29, (2, 3) = -31, (3, 1) = 69, (3, 2) = 44, (3, 3) = 67})

(1)

XA := ArrayTools:-Alias(X, [0..2,0..2]):

X[1,1];

27

(2)

XA[0,0];

27

(3)

XA[0,0] := 17;

17

(4)

X[1,1];

17

(5)

X . X;  # usual Matrix-Matrix multiplication

Matrix(3, 3, {(1, 1) = 7429, (1, 2) = 8602, (1, 3) = 4659, (2, 1) = -1771, (2, 2) = 269, (2, 3) = -2240, (3, 1) = 6148, (3, 2) = 11055, (3, 3) = 9473})

(6)

XA . XA:  # elementwise multiplication
Matrix(%);

Matrix(3, 3, {(1, 1) = 289, (1, 2) = 9801, (1, 3) = 8464, (2, 1) = 64, (2, 2) = 841, (2, 3) = 961, (3, 1) = 4761, (3, 2) = 1936, (3, 3) = 4489})

(7)

 

Download MatrixArrayAlias.mw

 

Did you try,

interface(prettyprint=1):

in your cmaple session?

That is the default for the Command Line Interface (CLI).

Executing the code which defines a procedure is not the same as calling that procedure.

You have done the former, but not the latter.

More specifically, applying eval to a procedure does not call the procedure.

To actually call the procedure use round brackets. That applies it (even if there are no arguments within the brackets).

So, if

Glyph2:-GetSpace('default')

returned a procedure then the following would also immediately call that returned procedure (ie. apply it to zero arguments, or invoke it).

Glyph2:-GetSpace('default')()

In your actual module example I don't see the point of wrapping some procedure definitions in uneval quotes (single right quotes).

You can accomplish that by putting a call to plots:-setoptions in a custom initialization file.

E.g.,

plots:-setoptions( 'font'=[ "Tahoma", 24 ] ):

See the Help page for topic plot,options for more details on the choices. The single item font covers several related suboptions (ie. font alone covers axesfont, captionfont, labelfont, and titlefont) .

The setoptions command sets values that act like defaults (for the duration of the session). But these can still, in turn, be overridden by options supplied directly in subsequent calls to individual plotting commands.

In Maple 2016.2 entering   3!!   in 2D Input mode produces a popup dialogues that queries which one you intend.

In Maple 2018.1 that popup dialogue doesn't appear, and that 2D Input gets parsed as (3!)! .

The appearance of that disambiguation popup dialogue does not appear to be tied to the value of interface(typesetting) .

AFAIK there isn't a way to force it and avoid the popup in Maple 2016 by using Typesetting:-Settings().

 

Firstly, you have a history of supplying only toy examples, and then when people offer a solution you point out that it works for the toy examples but not your as-yet-undisclosed actual problem.

So please show your full problem(s) up front.

With the meagre details you've supplied it isn't clear why you can't just substitute y=u*x and proceed from there. Do you only want *some* instances of y to be treated, and if so what is the precise delineation of when you want that?

restart;
expr1  := sqrt(x*y)/x:
simplify( subs(y=u*x, expr1), symbolic );

                     1/2
                    u

restart;                                 
expr1 := sqrt(x^2+y^2)/x:
simplify( subs(y=u*x, expr1), symbolic );

                   2     1/2
                 (u  + 1)

Secondly, why are you so keen on using the symbolic option of simplify and combine when doing so can give you results that are not correct in general?

I'm guessing that you are asking about the height and width of the plot as rendered on the Worksheet/Document canvas, and not about the ranges that are shown on the horizontal and vertical axes.

There is no way in Maple 13 to programmatically and directly set the width and height of the rendered box in which a plot is displayed as output.

You can, of course, resize the plot by manually adjusting the border with the mouse pointer.

If you really want to be able to insert a rendered plot with specific height and width values (eg, 900x900 pixels) in a Worksheet/Document in the Standard GUI of Maple 13, then you might have a look at this old Post.

Another programmatic methodology consists of using a script -- which could be Maple, via its XMLTools package -- and modifying the height/width fields of the inline-plot items in a saved (XML) .mw file. I recall Preben or someone once saying they'd done that. This requires closing/saving and re-opening the sheet, and so it is not a direct modification of the appearance of plot output. This is quite advanced a technique.

In recent Maple versions up to Maple 2018, there is a size option on the 2D plot command which allows you to specify the height and width easily.

If you are asking about examining or extracting the data structure that holds the computed details of the plot and its features then the commands plottools:-getdata and op can work.

I don't generally recommend using the lprint command for such examination since for many plots that would produce a less legible output.

If instead you are asking about how to get at the original plotting command that produced a given plot, then no that is not stored as part of the plot itself.

See the help page for the command IterativeMaps:-Bifurcation .

 

(Some readers might also find some interesting bits in this old discussion. The first paragraph in my first Comment there contains links to another three earlier threads.)

 

This is quite similar in nature to your previous question.

a := 3;
                      a := 3

f := unapply(a*x, x);

                    f := x -> 3 x

g := subs(dummy=a, x->dummy*x);    

                    g := x -> 3 x

The command unapply handles your example, whether you want the name of the formal parameter to be x or X.

x^2;

                    2
                   x

f := unapply(%, x);

                           2
                f := x -> x

f(t);

                     2
                    t

x^2;
                     2
                    x

f := unapply(subs(x=X,%), X);

                            2
                 f := X -> X

f(t);

                      2
                     t

You *could* construct an operator/procedure that actually uses eval to evaluate the given expression (in x) at x=X where X is the name of the formal parameter. But it would be inefficient to have it do so upon every application of f, and for your example it would be unnecessarily inefficient.

x^2;

                      2
                     x

f := unapply('eval'(%,x=X),X);

                          2|
               f := X -> x |
                           |x = X

lprint(eval(f));
  X -> eval(x^2,x = X)

f(t);

                      2
                     t

I looked at the other responses only after getting the following last night. I am not surprised that the various approaches have elements in common.

ee := abs(z)*(z-4-I)+2*I = (5-I)*z:

ans1:=eval~(z=a+b*I,
            [solve(evalc([Re,Im](subs(z=a+I*b,ee))),explicit)]):

lprint(%);
[z = -1, z = 83/410*(-1/2*(25+2*I*26^(1/2))^(1/3)-9/2/(25+2*I*26^(1/2))^(1/3)+3-1/2*I*3^(1/2)*
((25+2*I*26^(1/2))^(1/3)-9/(25+2*I*26^(1/2))^(1/3)))^2+323/820*(25+2*I*26^(1/2))^(1/3)+2907/
820/(25+2*I*26^(1/2))^(1/3)-1063/410+323/820*I*3^(1/2)*((25+2*I*26^(1/2))^(1/3)-9/(25+2*I*26^(
1/2))^(1/3))+I*(9/410*(-1/2*(25+2*I*26^(1/2))^(1/3)-9/2/(25+2*I*26^(1/2))^(1/3)+3-1/2*I*3^(1/2
)*((25+2*I*26^(1/2))^(1/3)-9/(25+2*I*26^(1/2))^(1/3)))^2+119/820*(25+2*I*26^(1/2))^(1/3)+1071/
820/(25+2*I*26^(1/2))^(1/3)-219/410+119/820*I*3^(1/2)*((25+2*I*26^(1/2))^(1/3)-9/(25+2*I*26^(1
/2))^(1/3))), z = 83/410*((25+2*I*26^(1/2))^(1/3)+9/(25+2*I*26^(1/2))^(1/3)+3)^2-323/410*(25+2
*I*26^(1/2))^(1/3)-2907/410/(25+2*I*26^(1/2))^(1/3)-1063/410+I*(9/410*((25+2*I*26^(1/2))^(1/3)
+9/(25+2*I*26^(1/2))^(1/3)+3)^2-119/410*(25+2*I*26^(1/2))^(1/3)-1071/410/(25+2*I*26^(1/2))^(1/
3)-219/410)]

length(%);
                              1233

ans2:=simplify(evalc(ans1)):

lprint(%);
[z = -1, z = (-747/205-81/205*I)*cos(1/3*arctan(2/25*26^(1/2)))^2+1/410*(-525+195*I-(1494+162*
I)*3^(1/2)*sin(1/3*arctan(2/25*26^(1/2))))*cos(1/3*arctan(2/25*26^(1/2)))+385/82+21/82*I+(105/
82-39/82*I)*3^(1/2)*sin(1/3*arctan(2/25*26^(1/2))), z = -158/205-69/205*I+(1494/205+162/205*I)
*cos(1/3*arctan(2/25*26^(1/2)))^2+(105/41-39/41*I)*cos(1/3*arctan(2/25*26^(1/2)))]

length(%);
                               524

simplify(convert(eval~((rhs-lhs)(ee),ans1),expln));
                             [0, 0, 0]

simplify(convert(eval~((rhs-lhs)(ee),ans2),expln));
                             [0, 0, 0]

Here are a few ways to deal with this issue.

The first is to use formula for one of the domain ranges. This requires joining two surfaces, and a slight seam is visible.

The second and third involve using two variants of cylindrical coordinates. One of these has an quite visible seam. Fortunately the latter (made using an easy stock coordinate known to plot3d) is the nicest looking.

3dplot_domain.mw

Here is an image of the third plot.

Another less satisfying approach is to increase the grid size as an option to the plot3d command. This barely works since manual rotation of the plot slows down as the plot structure gets large, and the jaggedness is only reduced and smaller.

Another (advanced approach) is to write one's own MESH generator that looks for the boundary where the expression becomes non-real, and adjusts adjacent data points to match. I've been working on this (as one of many evening projects) for a while now.

[edit] I forgot that you were trying to make an Explore call. Using Carl's clever idea of sqrt(max(0,...)) then my third variant (usual cylindrical coordinates) could be explored as,

Explore( plot3d([sqrt(max(0,z^2+c))], theta=0..2*Pi, z=-2..2,
                coords=cylindrical,
                style=surface, color=green),
         c=-1.0 .. 1.0 );

The difference being that Carl has used the parametric calling-sequence of plot3d while I've used the expression calling-sequence (while we both used coords=cylindrical). Also, Carl noticed that only one of the two signed pieces is needed in this variant.

And Carl chose a nice fixed view for the plot3d call inside the Explore call. Using that nuance, the above looks even better with the extra option view=[-2..2,-2..2,-sqrt(2)..sqrt(2)] in the plot3d call.

[Wait, where did Carl's fine Answer go?! It seems to have disappeared.]

First 178 179 180 181 182 183 184 Last Page 180 of 339