882 Reputation

13 Badges

1 years, 91 days

MaplePrimes Activity

These are questions asked by sursumCorda

`lprint` is officially interpreted as “linear printing of expressions”, but in the most recent release, its output looks just like "left printing" (under the default zoom 100%), 

while in some legacy version, `lprint` printed expressions not only on the left but also on the right. 

How to render `lprint` print its arguments not only on the left half?
Although I believe that similar questions must have been asked before, I cannot find such a question. 



It seems that applyrule cannot handle variable numbers of arguments, and I cannot use something like 

applyrule(f(u::anything, v::seq(anything)) = g(v, u), [f(x, y, z), f(x, y, z, t)]);
                  [f(x, y, z), f(x, y, z, t)]

Strangely, Maple does support the identical patterns in parameter declarations: 

eval([f(x, y, z), f(x, y, z, t)], f = ((u::anything, v::seq(anything)) → g(v, u)));
                  [g(y, z, x), g(y, z, t, x)]

So the two designs do not appear coherent. Should this be regarded as a "bug" in a sense? 

Of course there is no need to use the  modifier; here it is enough to use 

use f = MakeFunction('g(args[2 .. ], args[1])') in [f(x, y, z), f(x, y, z, t)] end:
use f = unapply('g(_rest, _w)', [_w::anything]) in [f(x, y, z), f(x, y, z, t)] end:

But the problem is, why is there such inconsistency described above? 

Although I still prefer applyrule (as evalindets/subsindets is not as intuitive as applyrule),  I have heard that it is regarded as being more or less antiquated in modern Maple. I notice that a lot of (yet not all) examples given in the help pages of evalindets/subsindets can be reformulated by applyrule, but does any use of applyrule also correspond to using evalindets/subsindets? And if so, how to equivalently rewrite those transformation rules (especially complicated ones like nested function applications) in the syntax of evalindets/subsindets?

For example, I would like to draw the following figure in Maple.


(The above figure is taken from MatLab's documentation.) 
Here are these four graphics objects: 

use plottools, ColorTools in
	l0, l1 := line~([<1 | 0>, <1 | 1>], [<6 | 5>, <6 | 6>], 'color' =~ Color~(["#0072BD", "#D95319"]))[];
	r0, r1 := rectangle~([[2, 0], [4, 0]], [[3, 6], [5, 6]], 'color' =~ Color~([[.6, .7, .9], [.95, .7, .6]]))[]

However, either 

`plots/display`([r1, l1, l0, r0], 'axes' = "boxed", 'size' = ["default", "golden"], 'style' = "patchnogrid")


`plots/display`([r0, l0, l1, r1], 'axes' = "boxed", 'size' = ["default", "golden"], 'style' = "patchnogrid")

outputs the same graphical image where the lines are always rendered on top of each rectangles instead of the other way around.

plots:-display([plottools:-rectangle([2, 0], [3, 6], 'color' = ColorTools:-Color([.6, .7, .9])), plottools:-line([1, 0], [6, 5], 'color' = ColorTools:-Color( 

So how to superimpose the right rectangle over the two lines? To put it differently, how to handle the graphics hierarchy? I have read some similar questions like Order in plots:-display - MaplePrimes, yet I cannot find any workarounds. 

Note that in my opinion, the result should comprise two unbroken line segments rather than four subordinate line segments! 

For example, here are two equations containing trigonometric functions (Note that they do not form one system!): 

restart; # There are more examples, yet for the sake of briefness, they are omitted here. 
eqn__0 := cos(x)*cos(y)*cos(x + y) = 2*(sin(x)*sin(y) - 1)*2*(sin(x)*sin(x + y) - 1)*2*(sin(y)*sin(x + y) - 1):
eqn__1 := (cos(x + y) - (cos(x) + cos(y)) + 1)**2 + 2*cos(x)*cos(y)*cos(x + y) = 0:

Unfortunately, none of 

(* Tag0 *) RealDomain:-solve(eqn__0, {y, x}):
(* Tag1 *) solve(eqn__0, {y, x}) assuming y + x >= 0, (y, x) <=~ Pi:
(* Tag2 *) RealDomain:-solve(eqn__1, {y, x}):
(* Tag3 *) solve(eqn__1, {y, x}) assuming y + x >= 0, (y, x) <=~ Pi:

outputs concise solutions.
Using `plot3d`, it is easy to check that when "And(y + x >= 0, (y, x) <=~ Pi)", “{y = Pi/2, x = 0}, {y = Pi/3, x = Pi/3}, {y = 0, x = Pi/2}, {y = Pi/2, x = Pi/2}” is both the only solution to "eqn__0" and the only solution to "eqn__1". But how to get Maple to do so without manual intervention?

Edit. The main purpose is to automatically find the generic solutions to each of the two equations (Tag0 and Tag2) (separately). Now that the cosine and sine functions are both periodic with period 2π and both (lhs - rhs)(eqn__0) and (lhs - rhs)(eqn__1) are even symmetric, it is enough to focus only on the region y + x ≥ 0 ∧ (y, x) ≤~ Pi. So, in theory, a second-best workaround should be Tag1 and Tag3. However, why is Maple still unable to find the four exact solutions above?

1 2 3 4 5 6 7 Last Page 2 of 18