8 years, 330 days

These are answers submitted by acer

block diagonal

17 hours ago acer 10076
2 0

If I understand what you want then here are two ways to form the block diagonal Matrix result, using repeats of the Matrix Q as the blocks.



                         [1    2    0    0    0    0]
                         [                          ]
                         [3    4    0    0    0    0]
                         [                          ]
                         [0    0    1    2    0    0]
                         [                          ]
                         [0    0    3    4    0    0]
                         [                          ]
                         [0    0    0    0    1    2]
                         [                          ]
                         [0    0    0    0    3    4]


                         [1    2    0    0    0    0]
                         [                          ]
                         [3    4    0    0    0    0]
                         [                          ]
                         [0    0    1    2    0    0]
                         [                          ]
                         [0    0    3    4    0    0]
                         [                          ]
                         [0    0    0    0    1    2]
                         [                          ]
                         [0    0    0    0    3    4]


format for printf/sprintf

Yesterday at 1:18 PM acer 10076
2 0

There are formatting options for sprintf (and friends) which support this directly. It is fast and lean on memory use. The code below also works in Maple 12.

> M:=Matrix(3,[[1,2,3],[4,5,6],[7,8,9]]);           

                                   [1    2    3]
                                   [           ]
                              M := [4    5    6]
                                   [           ]
                                   [7    8    9]

> parse(sprintf("%{ns}ld\n",M));                     


See the help-page on topic rtable_printf for details. Within the {} brackets the qualifier `n` suppresses new lines between rows, and the qualifier `s` suppresses any space between entries.



August 22 2014 acer 10076
2 2

You were close, with your third attempt. Another level of square bracketing specify that things are stacking vertically.

A:=< <1|2|3>,<4|5|6>,<7|8|9>>;

                                    [1  2  3]
                                    [       ]
                               A := [4  5  6]
                                    [       ]
                                    [7  8  9]

Matrix([ [A[1..2,..]], [Vector[row]([91,92,92])], [A[3,..]] ]);

                                [ 1   2   3]
                                [          ]
                                [ 4   5   6]
                                [          ]
                                [91  92  92]
                                [          ]
                                [ 7   8   9]

Note that you forgot square brackets around entries in your Vector call.



August 21 2014 acer 10076
2 2

You could use a color palette. Eg,


See also the pre-made palettes listed by the ColorTools[PaletteNames] command.

One thing I like about a color palette such as `c` is that its membership widens on demand. When you reference c[i] for higher value of `i` then a new shade is generated which matches the tonal "feel" of the previous colors while trying to stay well spaced w.r.t. the previous colors. (The color computation sometimes gets sluggish, but values are remembered.) You can also create your own palette, and install one for automatic use by `plot`, etc.



August 21 2014 acer 10076
1 7

Focusing on your package usage question, and leaving aside that this particular example might be done directly under assumptions on z, could you both load the (table-based) inttrans package and call its member laplace with the longer, qualified syntax so as to have a visual cue as to what is being called by your code source? Granted, that does not give a cue as to what the call in the output may be. So much for table-based packages...



f:=t->piecewise(t<0,0,t>=0 and t<z,t,t>z,z):

    r := laplace(t Heaviside(z - t), t, s) - z laplace(Heaviside(z - t), t, s) + -

                0.5000000000 (2. - 1. exp(-0.5000000000 s) (s + 2.))

                 0.5 (1. - 1. exp(-0.5000000000 s))     0.5
               - ------------------------------------ + ---
                                  1.                     s 

You might even try loading only a subset of members of such a table-based package. For example, replacing with(inttrans) above with with(inttrans,laplace). That might help if you also wish to keep your global namespace less altered.

Not directly related to your example but somewhat on-topic is the following. In some circumstances it is simpler to call module-based package members with the P:-m syntax, rather than the safer form of the indexed syntax such as P[':-m']. Perhaps see the final examples for the table-based student package, on the colondash help-page.



August 20 2014 acer 10076
2 2

Like your previous Question, this is about Array plots, GUI Tables and plot sizing. Please see my Answer there.

BodePlot happens to return an Array plot (a _PLOTARRAY structure). But the issues relate to all Array plots, and not just to BodePlot per se.

In this example you have forced one part of the size to 300, but then complain that the aspect ratio is not right.

You might instead try something like these. The first forces one dimenstion only. The second forces the percentage of GUI width (assuming Table properties match). And the third forces only the aspect ratio.




You haven't said what aspect ratio you're hoping for.



August 20 2014 acer 10076
2 1

That framed "window" is a GUI Table. If you right-click inside it you should see an item "Table" in the second section of the pop-up context-menu. Under "Table" look for menu item "Properties...". Select that choice. This brings up a pop-up in which you can toggle off the display of the exterior and interior borders of the Table.

You can also resize the Table by dragging the exterior or interior borders with the mouse. You might wish to experiment with that alongside, say,




The choice for "Table Size Mode" in the popup for context-menu item Table->Properties affects how the Table and its plot entries re-size (or not) to match any manual resizing of the full Maple GUI. You can experiment with that too, perhaps with the second code example above.

I would be interested if you felt that the above manual adjustments of the Table were simply too onerous -- if say you desperately needed a command that would just display exactly what you wanted, perhaps because you needed to do it many times. (The Table adjustments are clobbered if you re-execute the BodePlot call.)




July 29 2014 acer 10076
0 0

It is described in the second bullet point of the Description section of the help-page dsolve,numeric,bvp .



July 23 2014 acer 10076
0 1

Your T is an operator with only two parameters, which returns a list with only 2 entries. But the 3D plot has three components. So what do you expect the transformation to do?

Try a transformation that accepts three parameters and returns a list of three components. You'll have to figure out what you want it to actually do, of course. ("back-transform" doesn't mean anything special, to me...)

For example, this produces a transformed 3D plot. Whether it is the transformation you intend is for you to decide, naturally.

T3 := plottools[transform]((s, u, z) -> [piecewise(s <= a_1, 1000000*K*s,
                                                   1000000*a_0+1000000*g*(s-a_1)), u, z]):

plots:-display( T3(pic) );



July 23 2014 acer 10076
1 1

If you replace `solve` by `eliminate` and assign the result to `sols` then sols[1] will contain expressions for T and n in terms of del and p.

Unfortunately the results appear to be the roots of a polynomial which don't factor explicitly for unknown del and p (and not even for some explicit values of same). Note that the problem might be math, not Maple, as there are no general explicit formula for roots of polynomials higher than 5.

If you leave e,f,ep, and q all unassigned then it is actually easier for Maple to do and the result are an implicit RootOf of a 7th degree polynomial for both T and n. Similarly if you assign those float values to e,f,ep, and q but wrap the set of equations to be solved in a call to convert(...,rational). If you try to do it using the float values then the result seems to contain implicit RootOfs involving a 15th degree polynomial.

It may interest you that the 7th degree polynomial will have at least one real root pair T and n, for each purely real pair of inputs del and p. But I don't see how to get an explicit formula for that.

Perhaps this is an appropriate moment to ask what you intended on doing with an explicit pair of formulas for T and n, if you had them. Suppose that you had the explicit closed formulas in terms of dep and p, and they were each ten thousand pages long. What would you do with them that you could not do with a black-box procedure that -- given any numeric values as input for parameters del and p -- computed all real roots in terms of T and n?



July 22 2014 acer 10076
0 6

NLPSolve is having difficulty figuring out what are the variables over which to optimize.

Try is as,

NLPSolve(1/(n^3*(F0*F1-F1)), tau1 = 115 .. 201, tau2 = 237 .. 273, variables=[tau1,tau2]);

           [                       -8                            ]
           [-3.15130715961255079 10  , [tau1 = 158., tau2 = 255.]]

But that doesn't seem right, as a result, considering what the 3D plot looks like over that range.

Better seems,

NLPSolve(subs(int=Int,1/(n^3*(F0*F1-F1))), tau1 = 115 .. 201, tau2 = 237 .. 273, variables=[tau1,tau2]);

                 [                                   -8   
                 [-3.18004616322786483130789361569 10  , [

                   tau1 = 201.000000000000000000000000000, 

                   tau2 = 273.000000000000000000000000000]]


Tasks, Student:-Precalculus

July 21 2014 acer 10076
0 0

Have a look through the Tasks, such as those in the subsection for Algebra. See the Table of Contents (left side panel) of the Help system (in your installed Maple, or online here and here) and look for the section called Tasks. (If you need help on using and inserting content from those Tasks then also see here.)

Perhaps also have a look at the visualization commands in the Student:-Precalculus package.

If you're a student and new to Maple, you might also wish to look here.

There are also some Math Apps that cover a bit of what you mentioned. Perhaps see here, and here.



July 21 2014 acer 10076
1 0

So, are you just wondering about the formats for floats that printf supports?

If all your output intended for export is going to be produced in such a way that you might use fprintf rather than printf and writeto.

The printf command accepts HFloats just as it accepts "software floats", as input for its supported float formats. No need to convert it first, if I am understanding your question.

For example,


printf("x=%.3f\n", x);

printf("x=%.3e\n", x);

printf("x=%.3g\n", x);

printf("x=%Y\n", x);


hue? or custom shading?

July 20 2014 acer 10076
2 1

If you wish for hue or more easily customizable piecewise-linearly-interpolated shading schemes then you might want to consider the 2-dimensional output from plots:-surfdata that are possible with Maple 18. That is the result R in the code below.

It also gives a more smoothly interpolated default color rendering (for a hue scheme, at least).

Apart from comments in the code below, I could also mention that plots:-densityplot might be also be used to get a hue shading scheme (possibly by constructing a procedure which floored x and y arguments and returned the appropriate Matrix entry values).

And, unlike plots:-listdensityplot, the plots:-densityplot command allows more control over the end-values via its restricttoranges option. But this is also easily handled by including or omitting an offset as in the code below for calling plots:-surfdata.

And you can also quite easily make plots:-surfdata use your own customized piecewise linearly interpolated color scheme in Maple 18. So alternatively you could easily have it shade from orange through white to green, etc. (You can get plots:-densityplot to produce the same effect, but it's more effort to set up.)

NB. The 3D surfdata plot looks much better in the Maple GUI than it does inlined below. But even in the GUI the hue scheme is not a good match at one extreme. And the 2D surfdata plot also looks cleaner and smoother in the Maple 18 Std GUI than it does inlined below.


with(plots): with(plottools):


M:=Matrix(N,N,(i,j)->evalhf(sin(i*2*Pi/N)*(j-N/2)), datatype=float[8]):

# By default, listdensityplot has tickmarks aligned with the middle
# or Matrix column- or row-values

A:=listdensityplot(M, colorstyle=HUE, thickness=0, style=surface):

# 2D coordinate transformation of above plot A

f:=transform( (x,y)->[2*x+1,y-3] ):
T:=display(f(A), axes=frame, gridlines=false):

#display(Array([A, T]));

# 3-dimensionsional, with forced orientation.
# Note the 3D zhue shading goes from magenta to red, thus not a true match!
# Offsets of 0.5 are used, to get same mid-point alignment.
# Note the color interpolation during rendering, smoother than above.


CL:=plots:-surfdata(-M, a..b, c..d, shading=zhue, style=patchnogrid,
                    orientation=[-90,0,0], lightmodel=none):

# 2-dimensionsional (Maple 18), producing a densityplot structure,
# but with finer control over the color shading.
# Note that this scheme hits red at both extremes, 0 and 1, matching
# listdensityplot HUE shading.
# Same offsets of 0.5 as above are used.
# Note the smoother color interpolation during rendering.



R:=plots:-surfdata(-M, a..b, c..d, dimension=2, axes=frame, style=patchnogrid,

#display(Array([T, R, CL]));





July 11 2014 acer 10076
2 2

Below I replace sum by Sum, scale up h by a factor of 10^1560, and increase the working precision. A result near 15.7 then comes out pretty quickly.


f := (a, b, k) -> (Sum(exp(-x)*x^m/(m!), m = a .. b))^k:

h := f(0,0,82)*f(1,3,49)*f(4,6,47)*f(7,10,47)*f(11,15,57)*f(16,20,40)

     if not type(X,numeric) then
       return 'procname'(args);
     end if;
end proc:

#plot(H(x,2000), x=14..18);


               [                   5                        ]
               [6.96925226027268 10 , [x = 15.6881165583629]]


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