acer

32313 Reputation

29 Badges

19 years, 314 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

Maple 2021 --  March 10
Maple 2020 --  March 12
Maple 2019 --  March 14  (Pi day)
Maple 2018 --  March 21

@AHSAN Please put your close follow-up queries and details here, instead of spawning a separate Question thread.

Please put followup details for this query here, in Comments/Replies, instead of submitting a separate Question thread.

@John2020 Is this the kind of thing you're after? (If so then please test with nontrivial examples of your own. It's easy to overlook cases when coding.)

restart;

DGP:=proc(ff,var) local ee;
  ee:=combine(frontend(expand,[ff]),':-power');
  max(map(proc(u,v)
      if u::`*` then
        op(2,combine(select(type,u,
                            identical(v)^anything),
                     ':-power'));
      else
        if type(u,identical(v)^anything) then
          op(2,u);
        else return FAIL end if;
      end if;
    end proc,
    [`if`(ee::`+`,op(ee),ee)],var));
end proc:

 

H := a*x^k+b*c*x^(2*k):

DGP(H, x);

max(k, 2*k)

DGP(H, x) assuming k>0;

2*k

DGP(H, x) assuming k<0;

k

DGP(s^w-p*s^(-w/2)-z*s^(-w), s);

max(w, -w, -(1/2)*w)

DGP(s^w-p*s^(-w/2)-z*s^(-w), s) assuming w>0;

w

DGP(s^w-p*s^(-w/2), s) assuming w<0;

-(1/2)*w

DGP(s^w-p*s^(-w/2), s);

max(w, -(1/2)*w)

P := (s^w-r*s^(-w/2))*s^w;
combine(expand(P),power);

(s^w-r*s^(-(1/2)*w))*s^w

s^(2*w)-r*s^((1/2)*w)

DGP(P, s);

max(2*w, (1/2)*w)

DGP(P, s) assuming w>0;

2*w

DGP(P, s) assuming w<0;

(1/2)*w

Download para_deg.mw

Here is a simple revision of that AltDGI procedure, which handles Matrices as well as lists (of Graphs).

graph_interactive_table_acM.mw

@nm Ok, so you only need assertion-checking for the local-variable and return-value type checks of your own procedures. That's more detail.

In that case either of the ways I showed of temporarily disabling certain kinds of assertion-checking in your calls to Library code might help with the kind of example you've shown.

@nm You've written a little more about how you set it, but I was talking about how you need to use it. Without an adequate description of your usage requirements most answers will be guesses.

Do you have an example showing how it might be done standalone with UMFPACK, without use of Maple? That would be a useful first step, showing how (and whether) it could be done. If possible and provided, then a Maple custom external-calliing wrapper might be based upon it.

@Tokoro In future please put your more general query (along with specialized cases) in a single Question thread, instead of unhelpfully splitting the details and responses amongst several distinct Question threads.

Please stop submitting your queries as Posts, instead of Questions.

@Tamour_Zubair It's not really clear what you're trying to accomplish.

Could it be something like this?

evalf[15](Int(p*cos((1/2)*p+(1/2)*q)/(p^2+q^2)^(1/2),
              [p=0..1, q=0..1]));

                       0.553945861053642

Do you know a numeric value for the unknown t?

@Carl Love The stock EscapeTime command constructs an Image (or an Array of values) with a B&W layer of values based on the number of iterations required to escape (or possibly another layer, of abs value).

It does not classify & colour the values according to the root to which it converges -- as requested by the OP.

Somewhere I have a modified and reasonably fast version that does that... but I'm quite pressed right now.

@Rouben Rostamian  Here's one way to implement such conversions (just the double-angle, not a full trig combine) in the other direction, optionally recursing.

convert_double_angle.mw

(Sorry, this site isn't letting me inline the worksheet.)

@Rouben Rostamian  You have not specified in advance what you want to happen in general. I gave a piece of code for the examples supplied so far, and suggested it might be further adjusted.

The crux of my code snippet was to selectively freeze/veil some of the trig calls present in the expression, using foldl and frontend. It need not be combine that actually applies some conversion rule -- I was just continuing on with the theme. (It may be possible to turn powers of some trig call into an unsimplified product of "distinct" terms, for which certain rules might be more readily recognized...)

The original question thread was about elementwise applyrule.

Perhaps you could put your double-angle query (characterized in full) in its own Question thread (possibly branched from here).

And perhaps you could put your half-angle query (characterized in full) in another thread (possibly branched from here). It's quite different in nature.

Providing more general examples and expectations up front helps avoid the coding version of the whack-a-mole game.

Let's consider your last example. You haven't specified precedence of intended rules for that direction, so there ambiguity in the example. Starting from your,
   4*sin(x)^2*cos(x)
it was not clear that one should produce,
    2*sin(x)*sin(2*x)
over, say,
    2*(1-cos(2*x))*cos(x)
(Sure, you've since stated which you'd prefer. But a clear characterization up front would be helpful.)

First 111 112 113 114 115 116 117 Last Page 113 of 591