acer

32303 Reputation

29 Badges

19 years, 307 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@Ronan I'm glad if things are working for you.

Consider the following example. The global name typeset is not a protected name, so you can assign it a value. But if you did so then you'd also need to uneval-quote it when utilizing it in that plotting way, so as to not accidentally get its value.

restart;
plot(x,caption=typeset("hey, ",x),size=[400,200]);
typeset:=33:
plot(x,caption=typeset("hey, ",x),size=[400,200]);
plot(x,caption=':-typeset'("hey, ",x),size=[400,200]);

So, the fix is to use it as ':-typeset', similarly to what's done in your code for several other unprotected names used for options, etc. That should appease maplemint.

The phrasing of that mint warning is slightly confusing. Most often (in practice...) it appears in cases just like here (ie. your :-typeset usage) where some name is wanted as just the name itself, not any assigned value. The other case -- that's less common -- is where one intends to utilize it as a global variable but didn't declare is a a proc global; pretty nick-picky if not being assigned, IMO. So the warning is slightly misleading. Indeed it seems to have led you to guess that the fix in this situation would be to declare it as a proc global. But that wouldn't be right, and wouldn't help in the problematic case of its being assigned a value.

In summary, if you see that warning from mint/maplemint, and didn't intend to use the name for its value, then check to see whether you ought to quote the global instance(s) in the code. Trying to break your own code -- here, by assigning some value to such names -- can be a worthwhile exercise.

Note the effect of forget here. (The `is/internal` procedure has a remember table, for example.)

restart;
Digits:=10;
is(ln(.1e11*abs(-.304805898398896+1.*RealRange(.304805898398895,.304805898398897)))/ln(10) < -6);
Digits:=30;
is(ln(.1e11*abs(-.304805898398896+1.*RealRange(.304805898398895,.304805898398897)))/ln(10) < -6)

10

true

30

true

restart;
Digits:=30;
is(ln(.1e11*abs(-.304805898398896+1.*RealRange(.304805898398895,.304805898398897)))/ln(10) < -6)

30

false

restart;
Digits:=10;
is(ln(.1e11*abs(-.304805898398896+1.*RealRange(.304805898398895,.304805898398897)))/ln(10) < -6);
forget(is);
Digits:=30;
is(ln(.1e11*abs(-.304805898398896+1.*RealRange(.304805898398895,.304805898398897)))/ln(10) < -6)

10

true

30

false

 

 

Download is_remember.mw

The is command can leverage some greater working precision, internally. That can be due to its trying to deal with numeric issues (eg. roundoff, loss-of-precision, etc) at the inbound Digits setting. It doesn't always suffice.

@segfault No, you don't have to do hand-edits. Doing it programmatically is trivial.

I made no suggestion such as "...to take the limit of the function f[4] itself". That's nonsense. Member Hullzie did not suggest that either.

Since f[4](0) is not a name in the technical Maple sense, you can temporarily replace it in your expression. I referenced three programmatic ways to accomplish that.

Hullzie suggested replacement by the name f[4], but that suggestion has quite obviously confused you (perhaps due to the re-use of the indexed name). But that suggestion would not compute a limit of f[4] itself, despite your claim. And you're also free substitute with some other name. ...Or freeze that problematic function call, or frontend the limit.

What Hullzie showed was that if you replace the unevaluated function call f[4](0) by an actual Maple name then the limit you want will attain. You don't have to rewrite the expression or hand-edit it, to effect such a replacement.

The Help-page for limit clearly shows that a name is expected for the left-hand side of the second argument.

f[4](0) is not a name in Maple.

There are many similar instances in Maple where names are expected on the lhs of procedure parameters. Eg, this won't work either:
   plot(f[4](0)^2, f[4](0)=-1..2);

One can freeze the term in question, or substitute by an actual name (symbol, or indexed symbol) of one's choice, or frontend the operation.

@Susana30 An alternative,

plots:-inequal([exp(-2*x)-1<=y, exp(-x)+1>=y, x<=0],
               x=-1..0.1, y=-1..3.5);
 


Download shb2.mw

@minhthien2016 Using that same procedure F from my last response above,

restart;

F := proc(ee, LL)
  local Hx,Hy;
  if LL[1]=1 and LL[2]=1 then
    eval(factor(ee)=ee,`=`~([a, b], LL));
  else
  Hx := ifelse(LL[1]=1, x,
               ifelse(LL[1]=-1, `#mfenced(mrow(mo("&uminus0;"),mi("x")))`,
               nprintf(`#mfenced(mrow(%a,mo("&InvisibleTimes;"),mi("x")));`,
                       Typesetting:-Typeset(Typesetting:-EV(LL[1])))));
  Hy := ifelse(LL[2]=1, y,
              ifelse(LL[2]=-1, `#mfenced(mrow(mo("&uminus0;"),mi("y")))`,
              nprintf(`#mfenced(mrow(%a,mo("&InvisibleTimes;"),mi("y")));`,
                      Typesetting:-Typeset(Typesetting:-EV(LL[2])))));
 Typesetting:-mrow(InertForm:-Typeset(InertForm:-Display(eval(eval(InertForm:-MakeInert(factor(ee)), [`%*` = `*`]) = InertForm:-MakeInert(sort(algsubs(b*y = Hy, algsubs(a*x = Hx, ee)), order = plex(Hx,Hy))), `=`~([a, b], LL)), inert = false)), Typesetting:-mo("="), InertForm:-Typeset(eval(ee, `=`~([a, b], LL))));
  end if;
end proc:

 

F(eval(expand((a*x+b*y)^2),[x=1,y=1]), [x,3]);

`%^`(`%+`(x, 3), 2) = `%+`(`%^`(x, 2), `%*`(2, x, 3), `%^`(3, 2)) and `%+`(`%^`(x, 2), `%*`(2, x, 3), `%^`(3, 2)) = x^2+6*x+9

sort(t-k,order=plex(t)):
F(eval(expand((a*x+b*y)^2),[x=t,y=-k]), [1,1]);

(t-k)^2 = k^2-2*k*t+t^2

# alternatively
F(eval(expand((a*x+b*y)^2),y=1), [1,3]);

`%^`(`%+`(x, 3), 2) = `%+`(`%^`(x, 2), `%*`(2, 3, x), `%^`(3, 2)) and `%+`(`%^`(x, 2), `%*`(2, 3, x), `%^`(3, 2)) = x^2+6*x+9; "_noterminate"


Download minhthien_ts2b.mw


ps. Since you haven't provided an explicit characterization of the goal then I'm finished here.

Here is slightly different handling for the cases of coefficients of 1 or -1.

restart;

F := proc(ee, LL)
  local Hx,Hy;
  if LL[1]=1 and LL[2]=1 then
    eval(factor(ee)=ee,`=`~([a, b], LL));
  else
  Hx := ifelse(LL[1]=1, x,
               ifelse(LL[1]=-1, `#mfenced(mrow(mo("&uminus0;"),mi("x")))`,
               nprintf(`#mfenced(mrow(%a,mo("&InvisibleTimes;"),mi("x")));`,
                       Typesetting:-Typeset(Typesetting:-EV(LL[1])))));
  Hy := ifelse(LL[2]=1, y,
              ifelse(LL[2]=-1, `#mfenced(mrow(mo("&uminus0;"),mi("y")))`,
              nprintf(`#mfenced(mrow(%a,mo("&InvisibleTimes;"),mi("y")));`,
                      Typesetting:-Typeset(Typesetting:-EV(LL[2])))));
 Typesetting:-mrow(InertForm:-Typeset(InertForm:-Display(eval(eval(InertForm:-MakeInert(factor(ee)), [`%*` = `*`]) = InertForm:-MakeInert(sort(algsubs(b*y = Hy, algsubs(a*x = Hx, ee)), order = plex(Hx,Hy))), `=`~([a, b], LL)), inert = false)), Typesetting:-mo("="), InertForm:-Typeset(eval(ee, `=`~([a, b], LL))));
  end if;
end proc:

p := a^3*x^3 + 3*a^2*b*x^2*y + 3*a*b^2*x*y^2 + b^3*y^3;

a^3*x^3+3*a^2*b*x^2*y+3*a*b^2*x*y^2+b^3*y^3

L := [[2, 3], [-3,1], [1, 2], [-1, -1], [1, 1], [1/3, -sqrt(2)]];

[[2, 3], [-3, 1], [1, 2], [-1, -1], [1, 1], [1/3, -2^(1/2)]]

ans := F~(p, L):

print~(ans):

`%^`(`%+`(2*x, 3*y), 3) = `%+`(`%^`(`#mfenced(mrow(Typesetting`:-`mn("2"),mo("&InvisibleTimes;"),mi("x")));`, 3), `%*`(3, `%^`(`#mfenced(mrow(Typesetting`:-`mn("2"),mo("&InvisibleTimes;"),mi("x")));`, 2), `#mfenced(mrow(Typesetting`:-`mn("3"),mo("&InvisibleTimes;"),mi("y")));`), `%*`(3, `#mfenced(mrow(Typesetting`:-`mn("2"),mo("&InvisibleTimes;"),mi("x")));`, `%^`(`#mfenced(mrow(Typesetting`:-`mn("3"),mo("&InvisibleTimes;"),mi("y")));`, 2)), `%^`(`#mfenced(mrow(Typesetting`:-`mn("3"),mo("&InvisibleTimes;"),mi("y")));`, 3)) and `%+`(`%^`(`#mfenced(mrow(Typesetting`:-`mn("2"),mo("&InvisibleTimes;"),mi("x")));`, 3), `%*`(3, `%^`(`#mfenced(mrow(Typesetting`:-`mn("2"),mo("&InvisibleTimes;"),mi("x")));`, 2), `#mfenced(mrow(Typesetting`:-`mn("3"),mo("&InvisibleTimes;"),mi("y")));`), `%*`(3, `#mfenced(mrow(Typesetting`:-`mn("2"),mo("&InvisibleTimes;"),mi("x")));`, `%^`(`#mfenced(mrow(Typesetting`:-`mn("3"),mo("&InvisibleTimes;"),mi("y")));`, 2)), `%^`(`#mfenced(mrow(Typesetting`:-`mn("3"),mo("&InvisibleTimes;"),mi("y")));`, 3)) = 8*x^3+36*x^2*y+54*x*y^2+27*y^3

`%^`(`%+`(-3*x, y), 3) = `%+`(`%^`(`#mfenced(mrow(Typesetting`:-`mn("&uminus0;3"),mo("&InvisibleTimes;"),mi("x")));`, 3), `%*`(3, `%^`(`#mfenced(mrow(Typesetting`:-`mn("&uminus0;3"),mo("&InvisibleTimes;"),mi("x")));`, 2), y), `%*`(3, `#mfenced(mrow(Typesetting`:-`mn("&uminus0;3"),mo("&InvisibleTimes;"),mi("x")));`, `%^`(y, 2)), `%^`(y, 3)) and `%+`(`%^`(`#mfenced(mrow(Typesetting`:-`mn("&uminus0;3"),mo("&InvisibleTimes;"),mi("x")));`, 3), `%*`(3, `%^`(`#mfenced(mrow(Typesetting`:-`mn("&uminus0;3"),mo("&InvisibleTimes;"),mi("x")));`, 2), y), `%*`(3, `#mfenced(mrow(Typesetting`:-`mn("&uminus0;3"),mo("&InvisibleTimes;"),mi("x")));`, `%^`(y, 2)), `%^`(y, 3)) = -27*x^3+27*x^2*y-9*x*y^2+y^3

`%^`(`%+`(x, 2*y), 3) = `%+`(`%^`(x, 3), `%*`(3, `%^`(x, 2), `#mfenced(mrow(Typesetting`:-`mn("2"),mo("&InvisibleTimes;"),mi("y")));`), `%*`(3, x, `%^`(`#mfenced(mrow(Typesetting`:-`mn("2"),mo("&InvisibleTimes;"),mi("y")));`, 2)), `%^`(`#mfenced(mrow(Typesetting`:-`mn("2"),mo("&InvisibleTimes;"),mi("y")));`, 3)) and `%+`(`%^`(x, 3), `%*`(3, `%^`(x, 2), `#mfenced(mrow(Typesetting`:-`mn("2"),mo("&InvisibleTimes;"),mi("y")));`), `%*`(3, x, `%^`(`#mfenced(mrow(Typesetting`:-`mn("2"),mo("&InvisibleTimes;"),mi("y")));`, 2)), `%^`(`#mfenced(mrow(Typesetting`:-`mn("2"),mo("&InvisibleTimes;"),mi("y")));`, 3)) = x^3+6*x^2*y+12*x*y^2+8*y^3

`%^`(`%+`(-x, -y), 3) = `%+`(`%^`(`#mfenced(mrow(mo("&uminus0;"),mi("x")))`, 3), `%*`(3, `%^`(`#mfenced(mrow(mo("&uminus0;"),mi("x")))`, 2), `#mfenced(mrow(mo("&uminus0;"),mi("y")))`), `%*`(3, `#mfenced(mrow(mo("&uminus0;"),mi("x")))`, `%^`(`#mfenced(mrow(mo("&uminus0;"),mi("y")))`, 2)), `%^`(`#mfenced(mrow(mo("&uminus0;"),mi("y")))`, 3)) and `%+`(`%^`(`#mfenced(mrow(mo("&uminus0;"),mi("x")))`, 3), `%*`(3, `%^`(`#mfenced(mrow(mo("&uminus0;"),mi("x")))`, 2), `#mfenced(mrow(mo("&uminus0;"),mi("y")))`), `%*`(3, `#mfenced(mrow(mo("&uminus0;"),mi("x")))`, `%^`(`#mfenced(mrow(mo("&uminus0;"),mi("y")))`, 2)), `%^`(`#mfenced(mrow(mo("&uminus0;"),mi("y")))`, 3)) = -x^3-3*x^2*y-3*x*y^2-y^3

(x+y)^3 = x^3+3*x^2*y+3*x*y^2+y^3

`%^`(`%+`((1/3)*x, -sqrt(2)*y), 3) = `%+`(`%^`(`#mfenced(mrow(Typesetting`:-`mfrac(Typesetting`:-`mn("1"),Typesetting`:-`mn("3")),mo("&InvisibleTimes;"),mi("x")));`, 3), `%*`(3, `%^`(`#mfenced(mrow(Typesetting`:-`mfrac(Typesetting`:-`mn("1"),Typesetting`:-`mn("3")),mo("&InvisibleTimes;"),mi("x")));`, 2), `#mfenced(mrow(Typesetting`:-`mrow(Typesetting`:-`mo("&uminus0;"),Typesetting`:-`msqrt(Typesetting`:-`mn("2"))),mo("&InvisibleTimes;"),mi("y")));`), `%*`(3, `#mfenced(mrow(Typesetting`:-`mfrac(Typesetting`:-`mn("1"),Typesetting`:-`mn("3")),mo("&InvisibleTimes;"),mi("x")));`, `%^`(`#mfenced(mrow(Typesetting`:-`mrow(Typesetting`:-`mo("&uminus0;"),Typesetting`:-`msqrt(Typesetting`:-`mn("2"))),mo("&InvisibleTimes;"),mi("y")));`, 2)), `%^`(`#mfenced(mrow(Typesetting`:-`mrow(Typesetting`:-`mo("&uminus0;"),Typesetting`:-`msqrt(Typesetting`:-`mn("2"))),mo("&InvisibleTimes;"),mi("y")));`, 3)) and `%+`(`%^`(`#mfenced(mrow(Typesetting`:-`mfrac(Typesetting`:-`mn("1"),Typesetting`:-`mn("3")),mo("&InvisibleTimes;"),mi("x")));`, 3), `%*`(3, `%^`(`#mfenced(mrow(Typesetting`:-`mfrac(Typesetting`:-`mn("1"),Typesetting`:-`mn("3")),mo("&InvisibleTimes;"),mi("x")));`, 2), `#mfenced(mrow(Typesetting`:-`mrow(Typesetting`:-`mo("&uminus0;"),Typesetting`:-`msqrt(Typesetting`:-`mn("2"))),mo("&InvisibleTimes;"),mi("y")));`), `%*`(3, `#mfenced(mrow(Typesetting`:-`mfrac(Typesetting`:-`mn("1"),Typesetting`:-`mn("3")),mo("&InvisibleTimes;"),mi("x")));`, `%^`(`#mfenced(mrow(Typesetting`:-`mrow(Typesetting`:-`mo("&uminus0;"),Typesetting`:-`msqrt(Typesetting`:-`mn("2"))),mo("&InvisibleTimes;"),mi("y")));`, 2)), `%^`(`#mfenced(mrow(Typesetting`:-`mrow(Typesetting`:-`mo("&uminus0;"),Typesetting`:-`msqrt(Typesetting`:-`mn("2"))),mo("&InvisibleTimes;"),mi("y")));`, 3)) = (1/27)*x^3-(1/3)*sqrt(2)*x^2*y+2*x*y^2-2*sqrt(2)*y^3; "_noterminate"


Download minhthien_ts2.mw

I don't know what other special cases you might want handled, because you haven't stated requirements explicitly (or even where this code arose).

@minhthien2016 I expect that it's not hard, using a simple conditional ifelse or other tweak when forming the special Hx and Hy names. But I won't have the time until later in the day.

@C_R He can already construct multi-equations, which is all that's in the link you gave.

What he's trying to do now is sort "polynomials" by the inert terms like 3%*x and 2%*y.

That can be done, as I showed below, by turning those inert products into atomic identifiers, ie. actual Maple names (which sort can handle)..

@Ronan In my experience the maplemint command (an actual Maple language command) provides watered-down and weak access to the standalone mint utility's functionality. 

@minhthien2016 You haven't shown us what you've been attempting. I can't identify your problem without even knowing any explicit details.

Did you use a file path? Or are you relying on currentdir(), and if so did you first set that? Are you sure that you're not accidentally trying to write to Maple's installation folder?

And so on...

Your basic mistake here is not telling us any details.

@Anthrazit 

The Maple code checker mint is available as a stand-alone file.

See the Maple installation folder for location of binaries (like the GUI launcher).

The way that the GUI's code-editing regions access mint is a somewhat recent feature. But it's always been possible from the OS command-line.

Some editors allow you to set up a macro, for a quick way to do acts on a edited file, from within the running editor.

Calling the mint program also allows for your own choice of options. I use -i2 ., but some people also toggle a few off with -tX -tY.

@minhthien2016 As I already wrote (and linked for you with a URL) you can use the fprintf command to write it to a file.

The filename can be a string, optionally with a relative or absolute filename according to your OS. That's all your choice. You can set currentdir(...), or construct the filename, as you see fit.

The methodology could be improved and made more efficient.

The following take 14sec on my machine, compared to 830sec for the original. That's over fifty times faster.

Rolling_an_Ellipse_Along_a_Curve_August_2024_ac1.mw

(please check for correctness.)

It also seems to me a bit odd that the total frame number may affect the granularity of the ellipse itself. I suspect that it could be done faster still, using a single fine construction of ellipse&foci, and then a more efficient rotation&translation (perhaps plottools:-rotate, etc). Alas, I don't have the time for a rewrite.

@Greenwaldian 

I'm not sure that I understand the comment about admin access. IIRC the file in question exists per user, and even on a network install. It might be accessible by the user himself/herself.

You might submit a bug report, here. There's even a chance that a fix might make it into a "point-release".

First 28 29 30 31 32 33 34 Last Page 30 of 591