acer

32353 Reputation

29 Badges

19 years, 331 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@Joe Riel Since there is only one distinct instance of the particular SUM in the kernel's simplification table then it suffices here to sort the polynomial, which affects other references to it.

restart;

ee := sqrt(1+x+x^2);

                                             (1/2)
                                 / 2        \     
                           ee := \x  + x + 1/     

ff := tan(1+x+x^2);

                                     / 2        \
                            ff := tan\x  + x + 1/

sort( 1+x+x^2, [x], ascending ):

ee;

                                          (1/2)
                              /         2\     
                              \1 + x + x /     

ff;

                                  /         2\
                               tan\1 + x + x /
Whenever I see this trick I think of how it might be thread-unsafe.

@Christopher2222 In Maple 2016 a call to simplify(...) made from the top-level does a final step of (additonally) doing what simplify(...,size) does. But when called from within a procedure such a plain call to simplify(...) does not do that.

Either behaviour can be overridden by forcing an (undocumented) option in the call. Ie,

restart;
interface(prettyprint=0):

dint := proc (a, b, c, d)
  simplify(subs(b = d, int(a, b))-subs(b = c, int(a, b)),
           applysimplifysize = true):
end proc:

dint(exp(x^3),x,1,2);

    (1/6)*(I*3^(1/2)-1)*(GAMMA(1/3, -8)-GAMMA(1/3, -1))

restart;
interface(prettyprint=0):

dint := proc (a, b, c, d)
  simplify(subs(b = d, int(a, b))-subs(b = c, int(a, b))):
end proc:

dint(exp(x^3),x,1,2);

  -(1/6)*GAMMA(1/3, -8)+((1/6)*I)*GAMMA(1/3, -8)*3^(1/2)+
   (1/6)*GAMMA(1/3, -1)-((1/6)*I)*GAMMA(1/3, -1)*3^(1/2)

simplify(%, applysimplifysize = false);

  -(1/6)*GAMMA(1/3, -8)+((1/6)*I)*GAMMA(1/3, -8)*3^(1/2)+
   (1/6)*GAMMA(1/3, -1)-((1/6)*I)*GAMMA(1/3, -1)*3^(1/2)

This is a slightly tricky area, because it seems as if quite a few people seem to think that simplify(...,size) is designed to do everything that (non-top-level, or as in previous releases) plain simplify(...) does, yet with additional compactification. The help pages makes it clear that's not the case.

Under IntegrationTools:-Definite:-Integrators:-FTOC:-FindDisconts (after trying for an antiderivative) the call to discont fails hard because it doesn't know how to handle 2-argument GAMMA.

acer

@Kitonum Nicely done. I did this before I saw your response, but I may as well throw it in...

E_T := (2/mu-2/r)*exp(-r/mu)*Pi^2;

L1:=map(u->`if`(u::polynom,content(u),1),
        map(numer,[op(E_T)])):
new:=`*`(L1[])*`*`(zip(`/`,[op(E_T)],L1)[]);
Naturally, this is not general purpose. Don't take op of E_T if it's not of type `*`.

This is a good question. It's a shame that Maple offers a literal subscript (both via keyboard shortcuts and Layout palette) but no direct and easy way to get a literal superscript.

acer

You may not have to utilize lprint. You should be able to copy and paste the particular 2D Input for which you had done the conversion, for use later on.

Note that the fact that you converted one a particular instance of the 2D Input T[4]^0 does not mean that you can subsequently type in T[4]^0 as input (1D or 2D) any place afterwards and have it be valid as the LHS of a colon-equals assignment statement.


 

restart;

subsup:=proc(a,b,c)
  uses Typesetting;
  # Using the Typeset command below gets us nice upright
  # Roman integers, and a few other nice frills.
  nprintf(`#msubsup(%a,%a,%a)`,
          convert([Typeset(a),Typeset(b),Typeset(c)],`global`)[]);
end proc:

subsup(T,4,Int(f(x),x));

`#msubsup(mi("T"),mn("4"),mrow(mstyle(mo("∫",msemantics = "inert"),mathcolor = "#909090"),mrow(mi("f"),mo("⁡"),mfenced(mi("x"))),mspace(width = "0.3em"),mstyle(mo("ⅆ",msemantics = "inert"),mathcolor = "#909090"),mi("x")))`

subsup(T,4,0);

`#msubsup(mi("T"),mn("4"),mn("0"))`

`#msubsup(mi("T"),mn("4"),mn("0"))`

`#msubsup(mi("T"),mn("4"),mn("0"))`

`#msubsup(mi("T"),mn("4"),mn("0"))` := 99

99

`#msubsup(mi("T"),mn("4"),mn("0"))`

99

assign( subsup(T,4,0), 43.2 );

`#msubsup(mi("T"),mn("4"),mn("0"))`

43.2

K := '`#msubsup(mi("T"),mn("4"),mn("0"))`';

`#msubsup(mi("T"),mn("4"),mn("0"))`

assign(eval(K,1), 1000);

`#msubsup(mi("T"),mn("4"),mn("0"))`

1000

# Or cut and paste the 2D thing above
# (from any of the 2D Input or Output places, because
# of the way it was done). Here's what get's pasted:

`#msubsup(mi("T"),mn("4"),mn("0"))`;

1000

`#msubsup(mi("T"),mn("4"),mn("0"))` := 13;

13

`#msubsup(mi("T"),mn("4"),mn("0"))`

13

 


 

Download msubsup.mw

@KCPower If your code is only going to display plots of the results then it may be quicker to strive for less accuracy in the numeric integrations. For example you could try evalf(Int( ..., epsilon =1e-5 )) instead of  int(..., numeric).  You could also try forcing a particular  method, and I have a hazy recollection that method=_d01akc might do faster as long as the accuracy is not too strict and the max intervals is high enough for convergence at the higher frequencies. Fiddling with this is what I lack time for now, sorry.

Time and time again it has turned out that the most effective way to speed up such code is focus on improving the efficiency of the serial (unparalellized) version.

I see several serious innefficiencies, offhand. I expect at least a few orders of ten speedup are possible. Unfortunately I have almost no time for it right now.

@taro It's the layout that I mostly have problems with. I described some of the issues in an earlier comment above. Another problem is that the central panel is too narrow. The Editor window is also too narrow.

Also, the layout changes are mostly just a re-skinning of the layout -- a degradation IMO, and nothing I've ever seen anyone here request. But several bugfixes and improvements that have been asked for previously (sometime multiple times) have generally not been made.

Inappropriate or misspelled tags cannot be deleted.

The Search is weak, in multiple ways.

Here is some Math typeset by the "Maple Math" button in the Editor, which inlines a generated image with coarse rendering and other problems: (theta^2 + beta+phi+psi+surd(Phi,4))/Int(f(x),x)+exp(r)-e^r+x[Y]+sin(j)Even five years ago there were better solutions for math on web pages.

2D plots in uploaded worksheets still get gridlines added, unless the person explicitly adds the option to turn it off in the plotting command. Is that bug still present in MapleNet, or is this site still using a version that's 10 years old?

Plots in uploaded worksheets look very poor and coarse (innappropriate jpeg export?), and lose modern lighting effects that make them look good in Maple itself.

@eclark Sorry I don't know details of size restrictions on Maple Cloud uploads. I don't think that it allows uploading a sheet compressed (zip, gzip, etc).

There may be a small chance that the plot structure could be made smaller (eg. float[8] data in GRID or MESH instead of listlists) but we'd have to see it, or code that made it preferably. Are the frames from displayed Graphs?

If your target audience is small then they could try the free Maple Player. It allows manual rotation of a free-standing inlined 3D plot. (But it also allows you to even set things up so that others can execute some code behind embedded components, though the code can't be entirely secured from inspection.)

@tsunamiBTP I cleared off all cookies and things and (for that reason or some other) I can usually now upload, yes, also using Chrome.

However sometimes my Windows 7 Chrome cannot even submit a Comment/Answer, at all, even without uploaded attachment. The Submit button just does nothing. This doesn't always go wrong, though. It dosn't happen on my up-to-date Firefox on Windows 7 though, or on my Chrome on Ubuntu.

I really find it hard on my eyes to read anything here, in the new format. Perhaps I'll have to stop.

@mmcdara  I think that the responders here all understood the math, up front. You asked why it went wrong, and so I tried to explain how it does so. I submitted a bug report earlier yesterday.

@Carl Love Quite correct. 

Quite a few commands in the plots package accept strings as the (rhs) value for keyword options. But not this one.

The (lhs) keywords themselves can also benefit from using the quote-protected global name. Eg,

':-fieldstrength'=':-log'

The colon-minus is to prevent accidentally picking up a local (or rebinding), and the uneval quotes are to protect against an assigned value. (In the current example :-log is protected, so the uneval quotes are less pertinent for the rhs value. But this is still the more robust way to write "production code").

@Christopher2222 You are missing at least these (for which I have only some readily available to run and query kernelopts(version) ).

I'm not sure that I understand how you computed all your dates. For example, how did you compute [9.5, 2004.25] ? I add it below not because you are missing 9.5, but because the date you give doesn't seem to match mine. (Was there ever a release where MS-Windows and Linux/Solaris were released at much different times, for the exact same point-release?)

I used 64bit Linux to make the following queries, and corroborated all on Solaris.

MapleV 5.1  Jan 11 1998? (5.51 in your terminology, on 1998.03? )
6.01
6.02
7.01
8.01
9.01
9.02   
9.03        Oct  1 2003 Build ID 141050
9.04   
9.50        Apr  7 2004 Build ID 155251 (= 2004.37 ?)
9.51        Aug  9 2004 Build ID 163356 (= 2004.83 ?)
9.52   
16.02       Nov 18 2012 Build ID 788210
16.02a                  Build ID 788570
17.02       Sep  5 2013 Build ID 872941

@asa12 You seem to have failed to notice the following effect of your initial substitution of `a` for `a(t)`.

subs( a(t)=a, diff(a(t), t) ):

> %;

                            0
That happens because `a` alone does not depend upon `t`.
First 290 291 292 293 294 295 296 Last Page 292 of 592