29914 Reputation

29 Badges

18 years, 207 days
Ontario, Canada

Social Networks and Content at

MaplePrimes Activity

These are replies submitted by acer

@nm I don't understand why you chose your initial example, as opposed to your followup example.

@Zeineb You haven't explained what you're trying to accomplish.

The code is somewhat murky to me; I don't understand how you're intending to use the names t and x.

You also haven't told us what exact results you're expecting.

Are you perhaps looking for something like this?



`Maple 17.02, X86 64 LINUX, Sep 5 2013, Build ID 872941`


int( (diff(psi(t), t))*(psi(x)-psi(t))^(alpha-1),
     t = 0 .. x, continuous )/GAMMA(alpha);




@sursumCorda There is no super-special syntax for pairing multiple rules and transformations, but such a thing may be accomplished in a straightforward manner, although it may involve duplicate coding of the types.

The indets family of commands use Maple types for the second argument. There is a Help-page for building up structured (compound) types. I'm sure that you already know that {...} and Or(...) can be used to specify alternate types.

But you also want multiple conversions.

The third argument to subsindets/evalindets can be any custom procedure you want. It could be an appliable module. It should be able to involve overload. Such customization can distinguish between multiple types (in whatever heirarchy you want), and dispatch accordingly, in several different ways. You might need to duplicate the alternate types from the second argument in the dispatch mechanism.

Could you give some concrete examples? Perhaps something you might not be surprised as being medium-hard to emulate?

@dharr One of the difficulties here is the expansion, which can be undesirable -- possibly only because unnecessary, but also because it can increase the leaf-count.

With a very slightly different example, the expansion due to calling numer or denom can produce a result that is not best. (This is part of why I mentioned expand in my comment to the Question.)


cancel := proc(eq::`=`);
  local lhseq, rhseq, nums, dens;
  lhseq := factor(lhs(eq));
  rhseq := factor(rhs(eq));
  if lhseq = 0 or rhseq = 0 then return lhseq = rhseq end if;
  nums := factor(numer(lhseq)/numer(rhseq));
  dens := factor(denom(lhseq)/denom(rhseq));
  simplify(numer(nums)/numer(dens),size) = denom(nums)/denom(dens);
end proc:

eq := ((y-2*x)^3+x)/((sin(y)-x)^2*(x^2+x)) = a/(x^2*(sin(y)-x)^3)

((y-2*x)^3+x)/((sin(y)-x)^2*(x^2+x)) = a/(x^2*(sin(y)-x)^3)


(-8*x^3+12*x^2*y-6*x*y^2+y^3+x)/(x+1) = a/((sin(y)-x)*x)

((y-2*x)^3+x)/(x+1) = a/(x*(sin(y)-x))

((y-2*x)^3+x)/(x+1) = a/((sin(y)-x)*x)


0 = 0


The idea of simplifying an equation in this way is not a bad idea.

But it shouldn't be done using that code snippet, which I wrote specifically for the example containing exp calls in the link you gave. I would write a more general (or targeted) version in quite a different manner, especially with regard to expand.

A reasonable place to start is to figure out what domain you want to handle, if only as a beginning. How about rational polynomials?

[edit] Regarding your code mentioned in your Question's Update, I'd mention expansion. The following expansion happens, for an example only slightly different:

eq:= ((y-2*x)^3+x)/( (y-x)^2 * x ) = a/x;
numer(lhs(eq))*denom(rhs(eq)) /  (denom(lhs(eq)) *numer(rhs(eq)))=1;

((y-2*x)^3+x)/((y-x)^2*x) = a/x

(-8*x^3+12*x^2*y-6*x*y^2+y^3+x)/((-y+x)^2*a) = 1

But IMO that numerator on the lhs would be better if it had stayed as the more compact (y-2*x)^3+x.

I fully realize that this difficulty of expansion due to numer & denom is not directly part of your cross-cancellation task. But it's an unpleasant side-effect that's too common in Maple "simplification". It keeps me awake at night. I'd suggest that a simplification enhancement focusing on numerator&denominator cancellations should try and avoid it.

[note: this is in response to a Reply that might since have been moved or deleted.]

@sursumCorda One of my issues with applyrule is that it is idiosyncratic. Another is that it has more weaknesses and bugs than I'd like to see.

The applyrule command attempts to provide an easy and convenient syntax, but ends up with some awkward holes at important corner cases.

Maple is not built up with pattern matching as a fundamental brick. But Maple is built up in important ways upon its powerful and flexible type system. And the indets/subsindets/evalindets commands are designed to be used directly with that type system.

Moreover, the convenience of having indets work with the same "specifier" as subsindets provides a very handy and direct probe.

Of course, there will always be examples (even some short examples) where one approach beats the other for simplicity and terseness. But that's like anecdotal evidence, and is not any indicator of general power, robustness, or flexibility.

In my opinion there are more severe bugs and weakness in applyrule than in the type system. Unless I have a very restricted and special case I almost always reach for the subsindets group before applyrule.

But I do not want this Answer to become any longer conversation of the relative merits, details, or equivalences of these two approaches. Anyone who wants to start that discussion elsewhere is free to do so...

@RezaZanjirani You haven't explained what you want to happen when one of the functions does not return a numeric result while one or two of the other do return such. That's not covered by any of your (i), (ii), or (iii).

How close can the results be from two of your functions, for you to accept them as equivalent (or both the greatest) at a given point?

It's not clear to me what you mean by a "labeled" region. Do you mean you want separate colors for the shared cases? And, labeled via a legend entry or by textplot?

You wrote that plots:-inequal took too long. How long is acceptable for any given individual plot here? 30sec? 1min?

How smooth do you want the edges? How much extra time are you willing to wait for that?

Have you still not considered investigating rewriting your procedures so that they might be more efficient, even after making quite a few postings on this topic?

Your FirmModelPP procedure lacks option remember, which the other two procedures have it. Is there some reason not to have it?

What do you want to happen when any of the three functions is not defined at some point [alpha,delta]? Do you want that left blank, or colored by whichever of the other functions (which might be defined there) is greatest?

What do you want the coloring to be for some point [alpha,delta] when more than one of the three functions shares the greatest value?

ps. Re-executing your attached worksheet didn't produce the same 2nd plot for me as is saved as output in the file.

You might read the Description section on the Help-page for the root command, as well as that of the surd command.

@enderw88 Yes, you could transform a subexpression by referencing its position" (which operand it is), or by its type, by its structural identity, by its mathematical nature, or possibly by a few other means (according to the example...).

Which approach would be more robust and appropriate would depend on the particular example as well as what future examples you'd like to mirror with the same approach.

For your given expression, which term did you want to transform, what aspect makes it the term to transform, and how should it be transformed?

I have deleted a duplicate Question thread, for essentially this same set of ODEs (with parameters slightly differently written).

The followup worksheet was this: Error_(1).mw

Please put your followups here, instead of spawning wholly separate new Question threads for this.

You've already split this off from your original Question thread on this topic ("C1" here).

Please don't spawn yet another wholly separate Question thread just to try and figure out a shorter syntax for this manipulation.

Duplicate Question threads get flagged as such, and may be deleted by some moderator.

@Mikey_W I'll try to write out some clear examples. But it might not be this week.

First 8 9 10 11 12 13 14 Last Page 10 of 547