acer

32405 Reputation

29 Badges

19 years, 350 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

restart;

f := x*y*z:

constr := x+y+z=6:


method 1)

R := max(extrema(f, constr, {x,y,z}, 'S'));

8

ans := select(s->eval(f, s)=R, S)[];

{x = 2, y = 2, z = 2}

 

method 2)

 

u := eval(f, solve(constr, {z}));

x*y*(6-x-y)

S2 := {solve({diff(u,x), diff(u,y)})};

{{x = 0, y = 0}, {x = 0, y = 6}, {x = 2, y = 2}, {x = 6, y = 0}}

R2 := max(map[2](eval, u, S2));

8

temp := select(s->eval(u,s)=R2, S2);

{{x = 2, y = 2}}

ans2 := temp[] union eval~(solve(constr, {z}), temp);

{x = 2, y = 2, z = 2}

Download exfunction.mw

Your intention is not clear. Are you trying to import this as if it had five columns or data, separated by semicolons?

[edit] I changed it to parse the commas like a period in the data portion.

M := ImportMatrix( "Sdat.txt", delimiter=";" ):

DataFrame( subsindets(M[2..,..],string,
                      u->parse(StringTools:-Subs(","=".",u))),
           columns=M[1,..] );

DataFrame(_rtable[36893628252267267484], rows = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], columns = ["t[s]", "scanId", "m/z", "I[A]", "pTot[mbar]"])

Download Ssimport2.mw

There are definitions of iup and idn in the maple.sty LaTeX style file that is usually located in the etc directory of the Maple installation location.

There is a note about this LaTeX style file (ie. that you ought to utilize it) on the Help page for Topic latex.

What are the relevant variables you intend for use with the inverse Laplace transform? (Are you intending ilaplace(U4, s, eta) ??)

What is the value of a[0]? How do you expect to obtain a 2-D plot without supplying that? Did you intend a[0] to be 1/s?

Are you trying to get something like this? TC1_ac.mw

You appear to have pasted in the statements shown, as 2D Input. That's not ok.

The fragment  (P-H)^+ will not get parsed properly by the 2D parser.

You have several alternatives ,including:
 1) Pasting it in as plaintext 1D Maple notation, not 2D Input.
 2) Changing  (P-H)^+ to something else, eg.
   changing it to  (P-H)^%T  allows it to be pasted in as either 2D or 1D.
 3) Pasting in as  (P-H)^+  as 2D Inout, then placing the cursor and editing out ^+ and then entering the typeset/marked up exponentiation by +, by re-entering that aspect in 2D Input mode.

 

note. It's unhelpful that you don't bother to upload and attach a .mw file, when you submit your questions that have syntax or coding problems. Several other people have previously mentioned that to you. It's not very considerate.

You can get around this problem in Maple 2022 with the following,

  VectorCalculus:-PlotVector(w, unconstrainedview = false)

 

In Maple 2022, the PlotVector command is passing the option unconstrained=true to the plots:-arrow command.

That is the problem, a consequence of which is that for your example it generates a plot structure with Float(undefined), which appears blank. Up until Maple 2020.2 it did not do this, and the example worked ok.

As dharr mentioned, this is a bug. In a simpler example of the problem, the following renders as an "empty" plot in Maple 2022 (or Maple 2021.2),

   plots:-arrow([-2,1],[1, 2],unconstrainedview = true)

That seems to go wrong (Maple 2022) with suspect methodology and a (float) division by zero at line 15 of plottools:-arrow2d,
   showstat(plottools::arrow2d,1..15);
 

Is it less noticeable if the right panel (context-menu panel) is collapsed/hidden?

The following attachment contains as much as I can recover (which is significantly more than what the Maple GUI can recover: see notes below).

Eksamenssæt_ac.mw

There were four corrupted and unrecoverable inputs.
1) Opgave 1, section (ii), after "Herefter konjugeres matrix".
2) Opgave 2, section (i), right at its start.
3) Opgave 2, section (ii), just after "Basis for søjlerummet:"
4) Opgave 2), section (ii), just after "Basis for rækkerummet:"

I shall add this example to an earlier bug report I submitted. The underlying problem is the same as the (new) kind that I've only seen since Maple 2022, of an invalid and unclosed Equation XML element.

Do you remember what was at those four missing inputs? Were they all 2D Matrix inputs from the Matrix palette, perhaps? Or anything else that they might have had in common? Such detail might help the GUI developers fix this particular cause.

A DataTable embedded component allows you to enter numeric data in a tabular input format.

In my Maple 2022.2 for Linux I can press the tab key to advance the cursor through the cells of that component.

This also obviates the need to parse the cells, as entering a changed entry in any of the cells is accompanied by an automatic update to the named Matrix (or rtable) associated with the component (one of its properties).

Also, the data and the named Matrix are stored along with the worksheet and directly available upon close/re-open.

There is not a convenient mechanism for controlling the numeric formatting of the display of the entries (if floating-point, say).

The first operand of a procedure is its parameter sequence.

So, if that procedure has been assigned to the name q,

q := (u,v) -> u^2 + v^2:

nops([op(1,eval(q))]);

                2

note: you wrote "arguments", but here we're counting the parameters of the procedure (in its definition), not the arguments (which is what get passed when it's called).

As a followup query you asked about finding extrema of rhs(eq1).

The following shows a local minimum, and a saddle point.

restart;

eq1 := x = (((72*5^(3/2) + 270)*a^2 - 1344*5^(3/2)*a)*w + (9*5^(5/2) - 1485)*a^2 - 2016*5^(3/2)*a - 12544*5^(5/2))/(((288*sqrt(5) + 216)*a^2 - 5376*sqrt(5)*a)*w + (36*5^(3/2) - 1188)*a^2 - 8064*sqrt(5)*a + 6272*5^(3/2));

x = (((360*5^(1/2)+270)*a^2-6720*5^(1/2)*a)*w+(225*5^(1/2)-1485)*a^2-10080*5^(1/2)*a-313600*5^(1/2))/(((288*5^(1/2)+216)*a^2-5376*5^(1/2)*a)*w+(180*5^(1/2)-1188)*a^2-8064*5^(1/2)*a+31360*5^(1/2))

extrema(rhs(eq1), {}, {a,w}, 'cc');

{-10, -10*(1288+389*5^(1/2))/(-10304+1929*5^(1/2))}

cc;

{{a = 0, w = -3/2}, {a = 4480/213-(224/71)*5^(1/2), w = -185/142+(147/71)*5^(1/2)}}

evalf(cc);

{{a = 0., w = -1.500000000}, {a = 13.97822685, w = 3.326788628}}

simplify(eval~(eq1, cc));
evalf(%);

{x = -10, x = (-12880-3890*5^(1/2))/(-10304+1929*5^(1/2))}

{x = -10., x = 3.602012293}

evalf([map[2](eval,[a,w,rhs(eq1)],cc)[]]);

[[0., -1.500000000, -10.], [13.97822685, 3.326788628, 3.602012292]]

plots:-display(
  plots:-pointplot3d([map[2](eval,[a,w,rhs(eq1)],cc)[]],color=red,
                     symbol=solidcircle,symbolsize=20),
  plot3d(rhs(eq1), a=-1..20, w=-3..5, grid=[201,201], view=-12..14, color=blue),
  lightmodel=Light1, orientation=[100,55,0]
);

 

Download extrema_example.mw 

Be careful about misinterpreting spikes in your 3D plot as being finite extrema. Those could indicate a curve along which the expression is discontinuous (eg. not finite), in which case the visually apparent spikes may be merely artefacts due to the granularity of the plot's sampling process.

Consider these curves along which the denominator of rhs(eq1) is zero, ie. rhs(eq1) is +-infinity.

plots:-implicitplot(denom(rhs(eq1)));

The following attachment has one Input Equation (XML) removed, that I believe occurred above and near the text line:
   PC1

PCA_ac.mw

It is concerning that this is the third instance of the very same particular kind of corruption that I've seen reported in the last eight days; see here and here. I am going to amend a bug report to note that:
1) The problem appears to new (to Maple 2022.2?) and to not be rare (which is alarming).
2) The GUI fails to recover significant portions of these corrupted Documents, when it attempts its own recovery.

I'd like to see the underlying problem fixed if possible, but I'd also really like to see the GUI do a much better job of recovery. I've submitted more than one previous bug report on that latter aspect.

I am supposing that you are a Danish student, because of your use of the Gym package.

If you can remember what was in the missing 2D Input line that might be helpful. Did it have Danish characters/accents? Any little knowledge of it might be better than nothing.

You could pass the signchange=false option to implicitplot, so that discontinuties in f2 (eg. switching from +infinity to -infinity) are not shown.

If there's a jump discontinuity across which the sign is changed then that's not the same as an actual root.

restart:

with(plots):

a:=8:
f1 := x1^4-1999/1000*x1^2*x2^2+x2^4-1;
f2 := tan(x1+x2)-x2*sin(x1);

x1^4-(1999/1000)*x1^2*x2^2+x2^4-1

tan(x1+x2)-x2*sin(x1)

raw:=[eliminate({f1,f2}, {x1})]:nops(raw);

4

sol:='sol':
for i from 1 to 4 do
  raw[i][2];
  S2[i]:=[fsolve(%[],x2=-a..a,maxsols=100)];
  sol[i]:=seq((X1->`if`(is(X1>=-a and X1<=a),[X1,s],NULL))(eval(eval(x1,raw[i][1]),x2=s)),s=S2[i]);
end do:

K:=convert(sol,set);

{[-5.398255414, -5.360783273], [-5.364764327, -5.401933762], [-3.769355031, -3.647947770], [-3.583391246, -3.707848725], [-3.255732987, -3.396566067], [-3.185334350, 3.329928430], [-3.086665168, 2.927318296], [-2.555889626, -2.740025742], [-1.397907948, -.9772820729], [-1.192190530, .6493211306], [-.9368767219, -1.370005085], [.5881601300, -1.160042909], [2.010992428, 2.243626421], [2.194495669, 1.955777198], [3.095133265, -3.244700481], [3.113309320, 3.261859649], [3.172325434, 3.018375967], [3.192255688, -3.039528488], [4.026457505, 4.130722938], [4.124511644, 4.019959371]}

nops(K);

20

seq(eval([f1,f2],Equate([x1,x2],s)),s=K);

[0.2e-6, -0.102e-6], [-0.4e-6, -0.67e-7], [0.1e-6, -0.7e-8], [-0.1e-6, -0.3e-8], [0., 0.42e-8], [0.1e-6, 0.25e-8], [-0.3e-7, 0.7e-9], [-0.1e-7, 0.], [0.1e-8, -0.8e-9], [0.1e-8, -0.4e-9], [0., -0.2e-8], [-0.4e-9, 0.24e-8], [0., -0.2e-8], [-0.1e-7, -0.3e-8], [0., -0.16e-8], [0., 0.219e-8], [-0.8e-7, -0.750e-8], [-0.2e-7, 0.9e-9], [0.1e-6, -0.29e-7], [0.2e-6, -0.12e-7]

display(
implicitplot([f1, f2], x1 = -a .. a, x2 = -a .. a, gridrefine=4, crossingrefine=3, signchange=false,
             color = [red, blue], thickness = 0),
pointplot(K, color=black, symbol=solidcircle));

 

Download oneman_impl.mw

[edit] Here is one solution to the OP's followup query of what (apparently) they actually wanted. It's not clear to me what is wanted when the function call does not have exactly three arguments.

restart

kernelopts(version)

`Maple 2022.2, X86 64 LINUX, Oct 23 2022, Build ID 1657361`

`print/#mover(mi("U"),mo("&sim;"))` := proc()
   uses Typesetting;
   if _npassed=3 then
     msub(mover(mi("U"),mo("&sim;")),Typeset(EV(args[3])))(args[1..2]);
   else mover(mi("U"),mo("&sim;"))(args);
   end if;
end proc:


Below I used the "Over" item in the Layout palette, and the "~" item in the Punctuation palette,
to get the `#mover(mi("U"),mo("&sim;"))`symbol.

`#mover(mi("U"),mo("&sim;"))`

`#mover(mi("U"),mo("&sim;"))`(v1, v2, v3)

`#mover(mi("U"),mo("&sim;"))`(v1, v2, v3)

`#mover(mi("U"),mo("&sim;"))`(v1, v2)

`#mover(mi("U"),mo("&sim;"))`(v1, v2)

Download printf_sub_ex2.mw

[end edit. Below is my original response to the original Question.]

The pretty-printing of BesselJ can be controlled by calling appropriately the command,
    Typesetting:-EnableTypesetRule

The related Typesetting commands don't seem designed to allow for customization of user-defined functions. But there's nothing to stop you from using the remember table for its QueryTypesetRule as a semaphore within a user-defined custom print-extension procedure such as `print/f`.

For example,

restart;

kerneopts(version);

kerneopts(version)

`print/f` := proc(a, b, c)
   uses Typesetting;
   if Typesetting:-QueryTypesetRule("f")=true then
     mrow(msup(mi("f"),
               mrow(Typeset(a),mo("&InvisibleTimes;"),
                    Typeset(b))),
          mfenced(Typeset(c)));
   else
     'f(args)';
   end if;
end proc:

 

f(x,y,z);

f(x, y, z)

Typesetting:-QueryTypesetRule("f") := true:

f(x,y,z);

f(x, y, z)

BesselJ(n,x);

BesselJ(n, x)

Typesetting:-EnableTypesetRule("BesselJ"):

BesselJ(n,x);

BesselJ(n, x)

Download printf_ext_ex.mw

The following link is as much as I can recover from your upload called "Cengel2.mw". It has recovered significantly more than the Maple 2022.2 GUI is able to recover.

Cengel2_ac.mw

(I suspect that is contains as much as could possibly be recovered by any means. The problem appears to be the same as in another example I saw very recently on Dec 12. A single Equation XML element in an Input was invalid. Its removal -- leaving all parent elements intact -- appears to achieve maximal recovery. I have seen many corrupt worksheets before, but up until then never that particular issue. I wonder whether the cause was new, or something common to M2022.2.)

First 54 55 56 57 58 59 60 Last Page 56 of 336