acer

32333 Reputation

29 Badges

19 years, 321 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

You could try this if..then inside an init file.

restart;

kernelopts(version);

`Maple 2023.0, X86 64 LINUX, Mar 06 2023, Build ID 1689885`

if convert(kernelopts(version),string)[7..12]="2023.0" then
  __foo := ToInert(eval(IntegrationTools:-Indefinite:-Stage2)):
  unprotect(IntegrationTools:-Indefinite:-Stage2):
  IntegrationTools:-Indefinite:-Stage2:=FromInert(subsop([5,11,2,2,1,2]=_Inert_EXPSEQ(_Inert_INTPOS(5), _Inert_STRING("Stage2"), _Inert_FUNCTION(_Inert_ASSIGNEDNAME("sprintf", "PROC", _Inert_ATTRIBUTE(_Inert_EXPSEQ(_Inert_NAME("protected", _Inert_ATTRIBUTE(_Inert_NAME("protected"))), _Inert_NAME("_syslib")))), _Inert_EXPSEQ(_Inert_STRING("computed an answer with an unevaluated evalat or intat %a"), _Inert_LOCAL(3)))),__foo)):
  __foo:='__foo':
  protect(IntegrationTools:-Indefinite:-Stage2):
end if:

int((b*g*x+a*g)^2/(A+B*ln(e*(b*x+a)/(d*x+c))),x);

int((b*g*x+a*g)^2/(A+B*ln(e*(b*x+a)/(d*x+c))), x)

showstat(IntegrationTools:-Indefinite:-Stage2,25);


IntegrationTools:-Indefinite:-Stage2 := proc(f, x, $)
local fnames, a0, ans, p, num, den, other, exparg, ff, nonstdfnames, handler, func;
       ...
  25       IntegrationTools:-Utils:-Userinfo:-PrintInfo(5,"Stage2",sprintf(
             "computed an answer with an unevaluated evalat or intat %a",ans))
       ...
end proc
 

Download Stage2_subsop.mw

@nm It might not appear on subsequent calls due to remembered results.

I can try and construct at ToInert, subsop, FromInert fix that could be put in an init file.

For what it's worth, you could also use method=risch or method=elliptic in Maple 2023.0.

(Using method=_RETURNVERBOSE shows the undefined arising from method=default, although it's not obvious what programmatic flow that takes here.)

Have you submitted a bug report?

@nm Let's see if anyone gets it when internet connectivity is off.

There doesn't seem to be much interest in my Answer, so far.

But I'm going to point out that it makes use of the Typesetting:-Typeset command, which turns Maple expressions into an internal representation that Maple's GUI knows how to render as typeset math.

It's possible to programmatically adjust such a form -- including changing appearance of subexpressions of some particular types.

FWIW, wth a little further massaging that also can be changed from its nested function call form into the kind of special name which gets typeset (and which looks something like MathML). Some people might find the results instructive.

Some examples:

restart;

tom := proc(ee)
  nprintf("#%a;",
          subsindets(
            subsindets(convert(Typesetting:-Typeset(ee),`global`),
                       {identical(msemantics)=anything},
                       ()->NULL),
            specfunc(mcomplete),u->op(1,u)));
end proc:

 

tom( A*Unit(kg/m^3) );
lprint(%);

`#mrow(mi("A"),mo("⁢"),mfenced(mfrac(mi("kg"),msup(mi("m"),mn("3"))),open = "⟦",close = "⟧"));`

`#mrow(mi("A"),mo("⁢"),mfenced(mfrac(mi("kg"),msup(mi("m"),mn("3\
"))),open = "⟦",close = "⟧"));`

tom( K__i/(Q+R^2) + X[i] );
lprint(%);

`#mrow(mfrac(msub(mi("K"),mi("i","mathsize" = 10)),mrow(msup(mi("R"),mn("2")),mo("+"),mi("Q"))),mo("+"),msub(mi("X"),mi("i")));`

`#mrow(mfrac(msub(mi("K"),mi("i","mathsize" = 10)),mrow(msup(mi("R"),mn("2")),m\
o("+"),mi("Q"))),mo("+"),msub(mi("X"),mi("i")));`

tom( sum(f(i),i=1..N) );
lprint(%);

`#mrow(munderover(mo("∑"),mrow(mi("i"),mo("="),mn("1")),mi("N")),mo("⁡"),mrow(mi("f"),mo("⁡"),mfenced(mi("i"))));`

`#mrow(munderover(mo("∑"),mrow(mi("i"),mo("="),mn("1")),mi("N")),mo(\
"⁡"),mrow(mi("f"),mo("⁡"),mfenced(mi("i"))));`

tom( diff(f(x),x) );
lprint(%);

`#mrow(mfrac(mo("ⅆ"),mrow(mo("ⅆ"),mi("x"))),mspace(width = "0.4em"),mrow(mi("f"),mo("⁡"),mfenced(mi("x"))));`

`#mrow(mfrac(mo("ⅆ"),mrow(mo("ⅆ"),mi("x"))),mspace(\
width = "0.4em"),mrow(mi("f"),mo("⁡"),mfenced(mi("x"))));`

tom( Matrix([[a,b],[c,d]]) );
lprint(%);

`#mfenced(mtable(mtr(mtd(mi("a")),mtd(mi("b"))),mtr(mtd(mi("c")),mtd(mi("d")))),open = "[",close = "]")`

`#mfenced(mtable(mtr(mtd(mi("a")),mtd(mi("b"))),mtr(mtd(mi("c")),mtd(mi("d"))))\
,open = "[",close = "]");`

Download tom0.mw

I spent about 10 minutes writing all that rough version. And, so, further robustification, adjustments, and tweaks are quite possible.

I have seen that behavior using Maple 2022.2 on Linux.

@KIRAN SAJJAN Please don't spawn a duplicate Question thread for this.

@_Username_ I suggest that you upload and attach the worksheet (green up-arrow in the Mapleprimes editor), in a separate Question thread.

Please stop marking all your Maple Questions as Product "MaplePrimes".

@lcz Sorry, I made a mental switch while editing. I wrote nops(L1) when I intended length(L1). I originally just used the numeral 4, when executing.

Ie, either of these is what I intended,

   foldl( (a, b)->SubstituteAll( a, b[] ), s, seq( [L1[i], L2[i]], i=1..4 ) );

   foldl( (a, b)->SubstituteAll( a, b[] ), s, seq( [L1[i], L2[i]], i=1..length(L1) ) );

I corrected it in my Answer.

@sursumCorda Carl previously gave the following in his Answer to the earlier Question thread:

    seq['fold'= (StringTools:-SubstituteAll, L)]('L1[i], L2[i]', i= 1..length(L1));

Carl prefaced that with, "...I'm not going to use the commands foldr or foldl documented on that page but rather a new option to seq that does essentially the same thing more efficiently."

The OP for both Question threads had, of course, already seen that earlier solution using fold. But the OP started out this current Question with a paragraph containing, "as Carl Love mentioned the foldl function, today I attempted to experience its functionality (In order to understand the foldl or foldr function)."

This seems to make it quite clear that the OP has started this new Question thread because he wants to know how he can instead use foldl or foldr to accomplish the task, and he already knows that kind of (indexed call) map/seq approach using fold.

@MANUTTM I don't understand what you're talking about.

Your first claim, "From graph that you generated we can see that maximum occurs at value of i less than 0.799" is wrong and untrue. The plot clearly shows that the maximum occurs for some value of i between 0.799999998 and 0799999999. And so the plot clearly shows that the maximum occurs at a value for i greater than 0.799 or 0.7999.

Your second claim, "But the Maximize function gives the value of i as 0.7999", is misguided and misplaced. The Maximize command returned the value 0.79999 only when I specified the allowed range as i=0.0..0.79999. In other words, it returned the upper end-point of the specified range -- because the function is increasing across that boundary. That indicated that I should try again, with a higher upper end-point for the allowed range -- which is why I called Maximize again.

When I increased the upper end-point of the allowed range then Maximize returned a result with a value for i that is clearly between 0.799999998 and 0799999999.

@lcz I don't understand what you mean when you say, "it should be able to recognize it."

Your attempt passes eight additional arguments after s,
   op([L1[1],L2[1]]),op([L1[2],L2[2]]),op([L1[3],L2[3]]),op([L1[4],L2[4]])
which flattens out to,
             "(", "{", ")", "}", "[", "{", "]", "}"
before foldl receives any arguments. And so your attempt results in 8 iterations of calls to SubstituteAll.

I dislike sursumCorda's approach of using unevaluations (quotes, or command) and additional eval calls. And that has nothing to do with my understanding. It's quite unnecessarily convoluted and opaque.

ps. I also see no reason to avoid,
   CharacterMap("()[]","{}{}",s)
by using,
   Subs(convert(L1,list)=~convert(L2,list),s)
The first of those is terser, more immediately understandable, uses fewer commands, produces fewer temporary structures, and doesn't require an elementwise construct.

@Kitonum The infix syntax K%.U that you've shown will not work in 2D Input in Maple 2021, which the OP has shown to be using.

It will instead parse % as the previous result.

@Rouben Rostamian  Yes, they do solve the original equation, and no, they are not spurious solutions.

First 80 81 82 83 84 85 86 Last Page 82 of 591