acer

32405 Reputation

29 Badges

19 years, 346 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

@sand15 Attached is what I get when I re-execute your worksheet in Maple 2015.2 for 64bit Linux.

Tabulate_Issue_2015.2.mw

I get the legends displayed whether or not I have Tools->Options->Display->"Automatically display legends in 2-D plots" toggled. I get the legends displayed whether or not I remove the original all output from the Worksheet before re-executing. That's all as expected.

When I open your .mw file in an external editor I do see the property legendvisibility=false on the 2-D plots in the Task regions that DocumentTools:-Tabulate embeds. And when I open your .mw file in Maple 2015.2 the legends are not displayed (until I re-execute).

Your attachment is marked as Maple 2015.0. It's possible that the behavior you see is due to a bug fixed in the point-release. Do you want to try 2015.2? (The installed for that point-releasee is available for download from here.)

For a univariate problem the method=branchandbound option instructs Optimization:-Maximize to use a global optimization approach.

(Yes, this contradicts the claim given in other Answers that Optimization is only ever attempts local optimization.)

restart;
with(Optimization):
app:=x->0.14546e-1*sin(3.141592654*x)+(-1)*0.50512e-2*sin(6.283185308*x)+0.19918e-2*sin(9.424777962*x):
ex:=x->evalf(-AiryAi(2^(2/3)*x)*(5*3^(5/6)-9*AiryBi(2^(2/3))*GAMMA(2/3))/(8*AiryAi(2^(2/3))*3^(5/6)-8*AiryBi(2^(2/3))*3^(1/3))-AiryBi(2^(2/3)*x)*(9*AiryAi(2^(2/3))*GAMMA(2/3)-5*3^(1/3))/(8*AiryAi(2^(2/3))*3^(5/6)-8*AiryBi(2^(2/3))*3^(1/3))+(1/4)*x^3+3/8):

Maximize(100*(abs(app(x)-ex(x))), x = 0 .. 1);
         [0.0715496606611132, [x = 0.414027159609182]]

Maximize(100*(abs(app(x)-ex(x))), x = 0 .. 1, method=branchandbound);
          [0.183847185739178, [x = 0.923034175928753]]

As you can see, the following involves quite a bit of hand-holding.

restart;

interface(showassumed=0):

pde:=diff(u(x,y),x$2)+diff(u(x,y),y$2)=0:
f:=x-> piecewise(x>0 and x<1/2, 2*x, x>1/2 and x<1, 2-2*x):
bc:=u(0,y)=0,u(1,y)=0,u(x,0)=f(x),u(x,2)=f(x):
sol:=pdsolve([pde,bc],u(x,y)) assuming x>0,y>0;

u(x, y) = Sum(-8*sin((1/2)*n*Pi)*sin(Pi*x*n)*(exp(Pi*n*(3*y-4))-exp(Pi*n*(3*y-2))+exp(Pi*n*(y-2))-exp(Pi*y*n))*exp(-2*Pi*n*(y-2))/(Pi^2*n^2*(exp(4*n*Pi)-1)), n = 0 .. infinity)

temp1:=simplify(expand(sol));

u(x, y) = -8*(Sum(-sin((1/2)*n*Pi)*sin(Pi*x*n)*(exp(Pi*y*n)+exp(-Pi*n*(y-2)))/((exp(2*n*Pi)+1)*n^2), n = 0 .. infinity))/Pi^2

temp2:=subsindets(temp1,'specfunc(Sum)',
                  u->Sum(simplify(numer(op(1,u))/(exp(n*Pi)*2))
                         /simplify(convert(denom(op(1,u))/(exp(n*Pi)*2),trigh)),
                         op(2..,u)));

u(x, y) = -8*(Sum(-(1/2)*sin((1/2)*n*Pi)*sin(Pi*x*n)*(exp(Pi*y*n)+exp(-Pi*n*(y-2)))*exp(-n*Pi)/(n^2*cosh(n*Pi)), n = 0 .. infinity))/Pi^2

solnew:=subsindets(temp2,'specfunc(Sum)',
                   u->Sum(thaw(combine(subsindets(expand(convert(op(1,u),trigh)),
                                                  'specfunc({sin,cos})',freeze))),
                          op(2..,u)));

u(x, y) = -8*(Sum(-sin((1/2)*n*Pi)*sin(Pi*x*n)*cosh(Pi*n*y-Pi*n)/(n^2*cosh(n*Pi)), n = 0 .. infinity))/Pi^2

simplify( combine( convert( sol - solnew, expln ) ) );

0 = 0

 

Download pdesol_comp.mw

You forgot to use colon-minus when trying to assign to sys3.

It should be, with colon-equals,

sys3 := {de3a, de3b};

and not (as you had it, with just the equals symbol ),

sys3 = {de3a, de3b};

Also, be careful about your syntax for multplication. It's not clear from your post whether you're using 1D or 2D input.

If you're using 1D Maple Notation then make sure you enter those products like,

(x(t))*(1-.5*x(t)-.5*y(t))    # or  x(t)*(1-.5*x(t)-.5*y(t))

and not as,

(x(t))(1-.5*x(t)-.5*y(t))    # or x(t)(1-.5*x(t)-.5*y(t))

which would be parsed as function application rather than a product.

If you're using 2D Input mode then you could use either a space to denote the multiplication implicitly, or the star symbol ( * ) to denote the multiplication explicitly.

restart;
with(DEtools):

de3a := diff(x(t), t) = (x(t))*(1-.5*x(t)-.5*y(t));

diff(x(t), t) = x(t)*(1-.5*x(t)-.5*y(t))

de3b := diff(y(t), t) = (y(t))*(-.25+.5*x(t));

diff(y(t), t) = y(t)*(-.25+.5*x(t))

sys3 := {de3a, de3b};

{diff(x(t), t) = x(t)*(1-.5*x(t)-.5*y(t)), diff(y(t), t) = y(t)*(-.25+.5*x(t))}

window := x = -1 .. 3, y = -1 .. 3;

x = -1 .. 3, y = -1 .. 3

DEplot(sys3, [x(t), y(t)], t = 0 .. 14, window);

The problem is that the Maple 2016 2D Input parser is unable to interpret that use statement until after the module is created and assigned to m.

If you are using 1D Maple notation then there is no parsing problem.

If you are using 2D Input then the module creation and assignment to m has to be executed before the 2D parser starts dealing with the execution group containing the problematic use statement.

As you've discovered one workaround is to put the use statement in a seperate execution group, after the execution group that assigns the module to m. I would prefer the alternative of not using 2D Input altogether for such programming.

It looks like your version MapleV R4 directly returns the exact radical value of sin(Pi/12).

In Maple 2017.3 an (equivalent) exact radical form can be obtained using the convert command.

sin(Pi/12);

                              /1    \
                           sin|-- Pi|
                              \12   /
r:=convert(%,radical);

                        1  (1/2) / (1/2)    \
                   r := - 2      \3      - 1/
                        4                    

ee:=1/4*sqrt(6)*(1-1/3*sqrt(3));

                       1  (1/2) /    1  (1/2)\
                 ee := - 6      |1 - - 3     |
                       4        \    3       /

radnormal(r-ee);

                               0

kernelopts(version);

   Maple 2017.3, X86 64 LINUX, Sep 27 2017, Build ID 1265877

I get the exact radical result directly from MapleV R5 but not from Maple 6.

@PhilipKroon You probably would not have had that problem with write-privilege if you had instead chosen a better location for the .mla file.

The advice in another Answer here would create the new .mla (Maple Library Archive) in the first folder in `libname`. By default that is the `lib` subfolder of your full maple installation.

It is poor advice to start fooling around in that folder, IMNSHO. It's probably even worse to fool around with i/o commands in Maple while running with admin privileges.

Alternatives are to create the new .mla file in a "toolbox" folder in the right place under your home folder. That too would not require you to alter libname in subsequent sessions in order to use it.

Yet another way is to build the new .mla file in some altogether different folder that is owned by you. In order to use it subsequently you could append `libname` in Maple sessions or (just once) append to `libname` in a personal maple initialzation file.

Please let me know if you'd like details on these suggestions (I'm away from a working copy of Maple today...)

The last opened Dcocument-Block seemed to have a corrupted Input item. If I delete that problematic Input, close off the outstanding open Group, Document-Block, two Sections, and Worksheet items in the XML file then I get the following:

1._Opgaver_1.mw

You could force the tickmarks on the second axis, eg,

plots:-display(plots:-logplot(x^2-3, x = 0 .. 100),
                  axis[2]=[tickmarks=[seq(10^i=typeset(10^convert(i,name)),i=-2..5)]],
                  legendstyle = [font = [bold, "TimesNewRoman", 30], location = right],
                  thickness = 4, font = [bold, "TimesNewRoman", 30])
restart;

ans:=sum((a+k*d)^r,k=1..infinity,formal)
     -sum((a+(k+n)*d)^r,k=1..infinity,formal);

             r             a + d     r             d n + a + d
     ans := d  Zeta(0, -r, -----) - d  Zeta(0, -r, -----------)
                             d                          d

f:=r->sum((a+k*d)^r,k=1..n):
simplify(f(7)-eval(ans,r=7));

                               0

I'm not sure what aspect of your original you found wanting.

restart;
with(Statistics):
randomize():
N := RandomVariable(Normal(300, 10)):
S := map(round,Sample(N, 100000)):
Histogram(S, frequencyscale = absolute,
          bincount = 75, binwidth = 1, tickmarks = [default, default]);

Pass it recursively as ':-num'=num .

The colon minus makes the lhs of that be a reference to the global name. The single right quotes protect against the case where you also might have assigned a value to the global name (ie. at the top level).

Use the plotsetup command to set the target device (ie. plot export driver).

And then use plots:-display or usual methods of "printing" the plot to output (which will direct it toward the set device).

Here are a few ways of shading the contours or its filled regions, on the 2D projection.

restart;

f := proc(x, y) options operator, arrow; sin(x)*cos(y) end proc:

Psurf:=plot3d(f, -Pi..Pi, -Pi..Pi, style=surface,
              colorscheme=["zgradient", ["Orange","Blue"]]):

Pcont2D_1:=plots:-contourplot(f, -Pi..Pi, -Pi..Pi,
                              coloring=["Orange","Blue"]):

Proj:=plottools:-transform((a,b)->[a,b,-1]):

plots:-display(
  Psurf,
  Proj(Pcont2D_1)
);

Pcont2D_2:=plots:-contourplot(f, -Pi..Pi, -Pi..Pi,
                              filledregions, coloring=["Orange","Blue"]):

plots:-display(
  Psurf,
  Proj(subsindets(Pcont2D_2,
                  specfunc(CURVES),
                  u->NULL))
);

plots:-display(
  Psurf,
  Proj(Pcont2D_1),
  Proj(subsindets(Pcont2D_2,
       specfunc(CURVES),
       u->NULL))
);

plots:-display(
  Psurf,
  Proj(subsindets(Pcont2D_2,
                 specfunc(CURVES),
                 u->CURVES(op(u),COLOUR(RGB,0.,0.,0.))))
);

 

surf_proj_contours.mw

You can resize the GUI Table inserted by the plots:-display command by manually dragging its borders.

Or you can change its Properties by right-clicking within it (in the white space, not the plot).

Note that if you re-execute the plots:-display command then the changed Table will be replaced with a new one (with default size).

If you want to be able to programmatically embed a GUI Table containing a plot, with a specific size, then you can use the DocumentTools:-Tabulate command in modern Maple (eg. version 2017). That command did not exist in your Maple 18, but the attached worksheet shows how you can programmatically get a similar effect for a plot. Note that the commands in use there are not documented in Maple 18, and are a bit fragile due to some lack or argument validation.

M18_DT_plot.mw

If your actual goal was to programmatically produce a 3D plot that displays automatically with a specific size (in Maple 18) then the following attachment illustrates another way to get that effect. This approach is not documented, and "your mileage may vary".

M18_sized_3dplot.mw

First 181 182 183 184 185 186 187 Last Page 183 of 336