## 2453 Reputation

14 years, 66 days

## regression bug...

This is a regression bug, already observable in Maple 10.02. It works as expected in Maple 9.52 and earlier:

> factor(Pi*(t^2+1), {I});
(t - I) (t + I) Pi


So, I would not attribute the current behavior to any design difficuty. By the way, frontend is called internally, as tracing shows in Maple 18:

> trace(factor):
> trace(frontend):
> factor(Pi*(t^2+1), {I});
{--> enter factor, args = Pi*(t^2+1), {I}
2
x := Pi (t  + 1)
subsIndexed := {}
myfactor := proc(y) if y = x then y else factor(y) end if end proc
execute frontend, args = indets, [{I}]
execute frontend, args = indets, [I]
execute frontend, args = indets, [Pi]
...


## the reason for this behaviour...

Basically, the key steps  in the computation go as follows: the parts of the expression are stored in a table named pfrac, the indices of this table go to a variable ii, and the monomial to a variable x:

> stopat(convert/parfrac,14):
>
> convert([x, [I*x-1, 1]], parfrac, x);
-I
convert/parfrac:
14*    ii := minus(map(op,{indices(pfrac)}),{1});
DBG> into 3
{I+x}
convert/parfrac:
15     for i from 2 to nops(ratpol) do
...
end do;
{I+x}
convert/parfrac:
16       x := ratpol[i][1];
I*x-1



Then, it is checked whether indices in ii are of the form x^j:

> showstat(convert/parfrac,21):
convert/parfrac := proc(ratpol)
local x, rpol, sums, argn, pfrac, ii, ii2, i, j, k, f, t1, t2, t3, rflag, expnd, y;
...
21         if not (rflag or assigned(pfrac[x^j])) then
...
end if;
...


When not, it later becomes ii<>{} (as in this case), and an error is raised:

> showstat(convert/parfrac,36..37):
convert/parfrac := proc(ratpol)
local x, rpol, sums, argn, pfrac, ii, ii2, i, j, k, f, t1, t2, t3, rflag, expnd, y;
...
36     if ii <> {} then
37       error "denominator factors must be coprime"
end if;
...


So, it seems that a factorized form should be used.

## conspiracy theory...

A "conspiracy theory" crossed my mind. I know that on March 4 I have received an email notification from a thread to which I have posted some comments time ago, even though they have been removed recently, see:

The case of missing comments, another quirk

(you will have to go down by hand as links for comments are also broken).

Now, email notifications seem to have stopped few days later, at most. Could there be any connection between these two odd facts? The wrong status of threads with deleted comments will remain unnoticed only if nobody looks back at them. Of course, it will work provided they do not call the attention by sending email notifications. Perhaps the quickest way to implement it was stopping all the email notifications...

## sum of a series with exceptions...

So, you want conditional/case splitting output for the sum. The short answer is no (besides, Axel's workaround). There is a case splitting facility for sums, introduced in Maple 15, but restricted to parametric bounds, i.e. not for parameters in the summand, see e.g. ?updates,Maple15,computation .

For comparison, there is some case discussion capability implemented for parametric integrands, by means of the option allsolutions:

> int(sin(k*x),x=0..1,allsolutions);
{      0                k = 0
{
{   cos(k) - 1
{ - ----------        otherwise
{       k


This is actually in Maple 17.02, there is a regression in Maple 18:

> int(sin(k*x),x=0..1,allsolutions);
/{    0              k = 0  \
/{   0            k = 0  \   |{                          |
-|{                       | + |{   cos(k)                 |
\{ - 1/k        otherwise/   |{ - ------        otherwise|
\{     k                    /


## increase the vertical distance...

It depends on what you mean exactly. For instance, by increasing the font size of x and y, the vertical distance between the center of their typesetting boxes increases:

Typesetting:-mfenced(Typesetting:-mover(Typesetting:-mi("x",size=15),Typesetting:-mi("y",size=15)),open="| ",close = " &RightAngleBracket;",stretchy = "true",largeop = "true");


You may also use the three level munderover structure, with a white space in the middle, and regulate the vertical distance between x and y by setting its size, like:

Typesetting:-mfenced(Typesetting:-munderover(Typesetting:-mi("",size=5),Typesetting:-mi("x"),Typesetting:-mi("y")),open="| ",close = " &RightAngleBracket;",stretchy = "true",largeop = "true");


## How can I typeset this...

Two versions:

Typesetting:-mfenced(mover(mi("x"),mi("y")),open="| ",close = " &RightAngleBracket;");

Typesetting:-mfenced(mover(mi("x"),mi("y")),open="| ",close = " &RightAngleBracket;",stretchy = "true",largeop = "true");


There are many more variations possible.

Currently, I am not receiving email notifications either. I also wonder who could help as the administration of this site seems somewhat absent...

## use inert functions...

In current Maple, the systematic way for handling these symbolic manipulations, by-passing automatic mathematical function normalization, is using inert functions, with the prefix %, like:

> Z1:=sin(-a*x+b);
Z1 := -sin(a x - b)
> Z2:=%sin(-a*x+b);
Z2 := %sin(-a x + b)
>
> Y1:=subs(sin=cos,Z1);
Y1 := -cos(a x - b)
> Y2:=subs(%sin=%cos,Z2);
Y2 := %cos(-a x + b)
>
> evalf(subs(a=1,b=2,x=3,[Y1,Y2,cos(-a*x+b)]));
[-0.5403023059, 0.5403023059, 0.5403023059]


Using additional levels of unevaluation quotes, as Carl has shown, also works as long as you know exactly how many evaluation steps will occur later.

## use statement...

Your description of a temporary scope block looks also like a use statement, see ?use . E.g.:

> f:=proc()>      local x;>      x:=9;>      if x<10 then>         use z=20 in x:=z end use;>         else>      x:=1;>      end if;>      x;>      end proc:>      > f();                                            20


## Some comparison...

For comparison, see some examples of what is possible in Sage in the area of interface integration with LaTeX: Sage, LaTeX and Friends, LaTeX printing support, Using LaTeX (a free account is needed).

## insert latex markup in text paragraphs?...

I think that the answer is no. Maplesoft has made the choice in the Standard GUI for its own markup and typesetting system (TypeMK), a customized MathML. And for its frontend, what is available are 2-D math tools, partially through GUI interaction only. All these very bad indeed.

## Algolib LaTeX...

There is an alternative LaTeX facility in the Algolib library that makes it:

> MADLaTeX:-latex(1/y);
\frac{1}{y}


Note that this is actually in Algolib v.14 (an obsolete one):

> _algolibcontent();
Content of algolib (version 14.0), as of October 2010:
+ encyclopedia.			[Written by Stéphanie Petit, with contributions by Bruno Salvy and Michèle Soria.]
+ gdev.				[Written by Bruno Salvy.]
+ gfun (version 3.53).		[Maintained and extended by Bruno Salvy, with contributions by Ludovic Meunier, Marc Mezzarobba, Marni Mishna, and Eithne Murray, original version by Bruno Salvy and Paul Zimmermann.]
+ Holonomy (version 3.4).	[Written by Frédéric Chyzak.]
+ MAD (version 1.445).		[Written by Ludovic Meunier.]
+ Mgfun (version 4.1).		[Written by Frédéric Chyzak, with contributions by Shaoshi Chen, Cyril Germa, Lucien Pech, and Ziming Li.]
+ MultiSeries.			[Written by Bruno Salvy.]
+ regexpcount (version 1.5).	[Written by Pierre Nicodème.]


## How to do it...

As your posted input is only pictures, rather than text, your problem is unclear to me. But substitution works:

> eq1:=Diff(u[1](z),z)=a[11](z)*u[1](z)+a[12](z)*u[2](z):
> subs(u[1](z)=sin(z)*f(z),eq1);
d
-- (sin(z) f(z)) = a[11](z) sin(z) f(z) + a[12](z) u[2](z)
dz
> value(%);
/d      \
cos(z) f(z) + sin(z) |-- f(z)| = a[11](z) sin(z) f(z) + a[12](z) u[2](z)
\dz     /



## in general...

The generally correct equation can be written as follows:

> eq:=x^t/y^t = (x/y)^t*exp(2*I*Pi*t*(unwindK(ln(x)+ln(1/y))+unwindK(-ln(y)))):


Some numeric tests:

> eval(eq,[x=1, y=-1, t=1/2]);
-I = -I
> eval(eq,[x=1, y=3, t=I]);evalf(%);
1          I
---- = (1/3)
I
3
0.4548324228 - 0.8905770417 I = 0.4548324227 - 0.8905770417 I
> eval(eq,[x=I^(1/4), y=-1/2, t=1/5]);evalf(%);
/33\
|--|
\40/  (1/5)           (1/8) (1/5)
-(-1)     2      = (-2 (-1)     )
0.9794263543 - 0.6001932418 I = 0.9794263542 - 0.6001932418 I


 First 10 11 12 13 14 15 16 Last Page 12 of 29
﻿