acer

32405 Reputation

29 Badges

19 years, 350 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

Your wrote "how to combine an expression", but what you show as your goal is a new operator (not an expression) whose body happens to contain the combined form.

x := t -> sin(a)*cos(t) + cos(a)*sin(t):

x := unapply(combine(x(t)),t);

    x := t -> sin(a+t)

You haven't shown where your original operator came from. But perhaps it would be more convenient to begin with just expressions, then do all your manipulations, and then use (using, say unapply) form operators only as needed.

Forming operators manually and then only ever using then with function calls like x(t) -- to get an intermediate expression -- seems an awkward workflow.

As N gets larger is more efficient to do,

   Matrix(N,N,fill=undefined)

than,

   Matrix(N,N,(i,j)->undefined)

The technique you apply may need to depend on what you know of the form of the input. That depends on how robust you want to make it if the form is slightly different, ie. how much defensive programming you wish to have.

Here are some alternatives, using subsindets or subsop.

Add_range_ac.mw

The matter of whether the command used involves an external call is not central. Nor is whether the command is a "library function" or a kernel builtin, or what have you.

It's also unlikely the RealDomain:-simplify is going to be a place to find such functionality in the near future, IMO.

The first place that I'd hope to find the functionality, as you've expressed it algebraically, would be under the is and coulditbe commands. For example, [have I expressed this correctly?]

restart;
F1 := a + b + c + d > 0
      and
      a*b + a*c + a*d + b*c + b*d + c*d > a^2 + b^2 + c^2 + d^2:
F2 := d*c*b*a > 0
      and
      a*b*c + a*b*d + a*c*d + b*c*d > 0:

not is( F1 and not F2 ) assuming real;
                              true

Unfortunately several equivalent forms returned FAIL (after taking a while).

After that I might hope to find it using is under assumptions. Then perhaps simplify (but not using &implies).

In Maple 2018.2 (and 2022.2, say)

eq := binomial(2*n, n)/2 = binomial(2*n-1, n-1):

is( expand(eq) ) assuming n::posint;

             true

Also for n::integer, n<>0 it seems.

Is this the kind of thing you mean by getting the SAT-solver to work on it?

sat_fun.mw

Did you also want an interative application, with in which clicking on any square caused the colors to flip, with the ability to reset with a random Matrix?

How's this?

Solution_Methods_ac.mw

It might be missing just one equation in the "worked example" Section, just before one instance of the sentence "The problem is therefore non characteristic."

A simple change of variable seems adequate to get the result.

Below I use Maple 2020.2, since your Question is marked with that major version number.

restart;
kernelopts(version);

  Maple 2020.2, X86 64 LINUX, Nov 11 2020, Build ID 1502365

H := Int(exp(I*k*x)*sech(x), x=-infinity .. infinity):

value(IntegrationTools:-Change(H, s=exp(x), s));

                    Pi*sech(1/2*Pi*k)


A similar approach works for your followup example. Also, for either example we could start with active int instead of applying value on an inert Int, Ie.,

H2 := int(exp(I*k*x)*tanh(x)*sech(x)^3,x=-infinity..infinity):

IntegrationTools:-Change(H2, s=exp(x), s);

            1/6*I*Pi*sech(1/2*Pi*k)*k*(k^2+1)

The Classic worksheet interface is bundled in the 32-bit version of Maple 2017 for MS-Windows, but not in the 64-bit version of that release.

If you'd prefer the special symbol to be rendered in upright Roman font, instead of italics, then you could use,
   b^`#mo("&bot;");`
instead of,
   b^`&bot;`
 

plots:-display(
  plots:-textplot([2,2,b^`&bot;`]),
  caption=typeset("the pole at point ",
                  [2,2], " is ", b^`&bot;`)
);

First I'll show you an easy way to get a partial method. Then I'll give you some links to related, older Questions in which the answers get it more completely but also require altering how you initially input the example.

An easy way:

You can do something quite close to that, in two context-panel steps.

First, you could apply the command  eval(..., 1)  to the input. You could do this from the context-panel, using the item "Apply a Command". The command to enter in the popup box is eval and the extra argument to it is 1 .

Second, you could choose the context-panel choice "Simplify" -> "Simplify" (ie. in the submenu choices).

Attached is an example. I did it as above.  CM_eval1.mw

Unfortunately it is quite difficult to prevent or delay the numeric coefficient such as 50/10 from reducing down to just 5, on account of automatic simplification of numeric arithmetic.

More complicated ways:

The following approaches mostly require use of the InertForm package and/or wrapping the initial input in a call to a custom procedure (which will do the fancy work). This can avoid the automatic simplification issue.

1) Take a look at this idea, which is closer to your idea I suspect, and not too much extra setup (also coming here).
or,
2) Have a look at this and this (which both show the results across several lines of output).

The minimize command is not strong at multivariate problems. Sometimes it gets confused about computing & using derivatives, and ends up deciding upon end-points (and not necessarily the correct ones).

Sometimes you can get lucky with it. For fun...

minimize(x^3 + y^3 + z^3 - 4*x*y*z, x = 0 .. infinity, y = 0 .. infinity) assuming z>0;
minimize(%, z=0..infinity, location);
minimize(x^3 + y^3 + z^3 - 4*x*y*z, x = 0 .. infinity) assuming y>0, z>0;
minimize(%, y=0..infinity) assuming z>0;
minimize(%, z=0..infinity, location);

Your code calls plottools:-arrow, and it passes 0.4 as its fourth argument. That specifies the width of the arrow head, in an absolute scale.

But the scale of your plot is 0 to 900.  On that scale 0.4 is so tiny that you cannot see the arrow head.

Compare what happens if you simply change your call to, say,

   arrow([0, 0], [725, 350], 0.1, 10.0, 0.1, arrow, color = red, legend = "Vector v")

In the (undocumented?) calling sequence you tried, it has removed all characters from the second argument that are present in the first argument.

The "(", the ")", and the "2" are characters present in the first string, and instances of those characters are removed from the second string.

This seems to make sense and -- even though the first argument is not a predicate as in the documentation -- it's acting analogously by testing each character in the second string. The documentation describes this command as acting individually on all the characters in the second string, ie. it's not just looking for one full contiguous match.

Perhaps you wanted the following, instead. The Substitute command replaces the first instance of an exactly matching substring. (SubstituteAll replaces all such full matches.) Below, I replace the matching substring with the empty string.

L1 := "Methionine = (S)-2-amino-4-(methylsulfanyl)-butanoic acid (2.13)";
acid1 := "Methionine = (S)-2-amino-4-(methylsulfanyl)-butanoic acid ";

StringTools:-SubstituteAll(L1, acid1, "");

                 "(2.13)"

# or even this,
StringTools:-Substitute(L1, acid1, "");

                 "(2.13)"

Perhaps you could first run,

    mint -S -q test.txt

and bail out if there was any output.

First 55 56 57 58 59 60 61 Last Page 57 of 336