## how to use .hdb Maple help file. Trying to find he...

http://algo.inria.fr/libraries/obsolete-releases.html

Downloaded the .mla and the .hdb files. Put them in current directory where my worksheet .mw is.

Opened the .mw and typed

restart;
libname := currentdir(), libname;
_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.]

Ok. Now how to obtain help? I can call one of its functions, like this

\frac{1}{2}

But I do not know how to find help on MADLaTeX:-latex since ?MADLaTeX does nothing and ?MADLaTeX:-latex does nothing.

How to obtain the help pages for this package? I looked online and do not see anything. I do not know what to do with the .hdb file that I downloaded. I am using Maple 2018 and it does not seem to support .hdb files anyway.

Does I need to go through all the conversion steps described in

https://www.maplesoft.com/support/help/Maple/view.aspx?path=HelpTools%2fMigrate

just to see help on one function?

I just need to find how to call is Latex function and if it has any options. Any one knows an online page that have these on it?

## how to filter out undefined result from piecewise ...

After solving something, sometimes the result comes in piecwise. I'd like to just obtain all those results which are not undefined, into a list, so I can process them more easily. I am not sure what is the correct way to do this in Maple.

Here is an example.

restart;
f := piecewise(x>-1 and x<=0, x^3,
x>0 and x<=Pi/2, sin(x),
x>Pi/2, undefined,
x=20, 5,
x=50, undefined);


I need to pick all entries that do not have "undefined". I do not need the rhs condition  which is x<=1. So for the above, I'd like to obtain

sol:=[ x^3, sin(x), 5]

If there more entries which are also not undefined, they go into the list in order.

when I do

sol:=convert(sol,pwlist,x);

This gives

sol := [0,-1,x^3,0,sin(x), (1/2)*Pi,undefined,20,undefined,20,undefined,50,undefined,50,undefined]


Now it gets confusing. How to change the above to

sol:=[ x^3, sin(x), 5]

I do not even understand the conversion result above. I do not know why it gives 50 twice. And I do not even see the "5" in there. So I do not know how to decode this now.

Update:

I found this solution. But it might not be best:

contents :=[op(f)];
[seq(if(contents[i]=undefined,NULL,contents[i]),i=2..nops(contents),2)];


gives

[x^3, sin(x), 5]

## inert form of operator...

When I have an Operator like

eq:=1/r*diff(r*diff(f(r),r),r)

typically maple evaluates/expands it by product rule.

How can I tell him to not do it?

I tried using the inert operator % but probably i didn't do it right.

## patmatch fails when called from another proc() but...

I am learning patmatch. And found strange problem.

When I make an expression inside a proc A, and pass this expression to another proc B, which then uses patmatch  on it, the pattern fails to match.

but calling proc B directly, with exactly same expression, patmatch does match.

This is confusing and not sure why it happens. It seems related to using symbol which was declared local vs. same symbol but is global. Here is an example

restart;
foo:=proc()
local x,C1;
boo(exp(C1+x));
end proc;

boo:=proc(expr)
local a,b,c,la;
patmatch(expr,a::anything*exp(b::anything*C1+c::anything),'la');
end proc;


Call to foo() returns false. But call to boo() returns true. Even though I am using same expression.

foo();
false

C1:='C1':
x:='x':
boo(exp(C1+x));
true

What Am I doing wrong, and how to make it work in both cases?

## A quick way to make an interactive plot?...

Hello everyone!

I miss a convinient way to build interactive plots with parameters assigned to sliders. E.g. of such expressions as "a*sin(b*x+c)". Before Maple 2017 I could just right-click the expression, choose "plot builder" and then select "interactive plot with three parameters". That's it. Since the introduction of the new interactive plot builder I am at a loss because that way have been lost and I don't know any other way equally quick and convinient. "Interactive plot builder" now means quite another thing!

Any suggestions?

## geometric series?...

Probably I'm doing something severely wrong, but

sum(x^n,n=0..infinity)

does not evaluate to the geometric series result 1/(1-x), why?

Similarly this happens for the sum(x^n/n,n=1..infinity)

It works with Maple17 though.

## How do I solve symbolic nonlinear equations ?...

Hi everyone !!

I have a problem to find a solution for some symbolic nonlinear equations. I used the solve command but it takes much time and finally, I stopped the process because doesn't give me a solution. I have attached the code.

Cond_Poincare.mw

## I tried to replace one of the term with a newly de...

 > I*mu*A(t[2])*omega[0]*(1/2)-A(t[2])*omega[0]*(diff(B(t[2]), t[2]))+I*(diff(A(t[2]), t[2]))*omega[0]-(1/4)*A(t[2])^5*beta[2]*omega[0]^2-(1/4)*A(t[2])^3*beta[1]*omega[0]^2-(1/2)*F[0]*exp(I*sigma*t[2]-I*B(t[2]))+5*alpha[2]*A(t[2])^5*(1/16)+3*alpha[1]*A(t[2])^3*(1/8);
 (1)
 > simplify(%);
 (2)
 > subs(C(t2)=-sigma*t2+B(t2),%);
 (3)
 >

## How to solve this equation and get time history pl...

 >
 > C_t := -A(t)*omega[0]*(sigma-(diff(C(t), t)))-(1/4)*A(t)^5*beta[2]*omega[0]^2-(1/4)*A(t)^3*beta[1]*omega[0]^2-(1/2)*F[0]*cos(C(t))+5*alpha[2]*A(t)^5*(1/16)+3*alpha[1]*A(t)^3*(1/8) = 0;
 (1)

 > A_t := (1/2)*mu*A(t)*omega[0]+(diff(A(t), t))*omega[0]-(1/2)*F[0]*sin(C(t)) = 0;
 (2)
 >
 > F[0] :=2: w0 := 1: alpha[1]:=0.3331:alpha[2]:=0.1299:beta[1]:=0.3338:beta[2]:=0.1319:mu:=0.01:sigma=0：
 (3)
 >
 > C_t;A_t;
 (4)
 > ICS:=[C(0)=0,D(C)=0,A(0)=1,D(A)=0]:
 > sol:=dsolve({C_t,A_t,ICS},[C(t2),D(C),A(t2),D(A)],type=numeric):
 > pRange:=0..20:
 > Atime:=odeplot( sol, [t, A],t=pRange, numpoints=10000 ):
 > Atime;
 (5)
 >

## how to share functions definitions among more than...

Currently, I have some definitions of modules and or functions in one worksheet, say A.

To reduce clutter in A, I'd like to open second worksheet, say B, and invoke the functions defined in A in the B worksheet. This way I keep the definitions in one worksheet, and the tests/trying them, in another worksheet.  I do this all the time in Mathematica. It useful, as I like to keep one notebook for just definitions, and second one for testing and calling the functions.

I just found out, that a function defined in worksheet is not "seen" in worksheet B.  I looked at options and settings, googled a little, but not able to find an option to allow me to do this. I tried Tools->General->Share one engine among all documents. Clicked Apply. But that still did not do it.  From worksheet B, it tells me it does know the function I am trying to call. Only in worksheet A it can see the function.

Is there an option to allow one to have the function definition be seen on all open worksheets?

I know I could save the functions as mpl files, and then load them in the second worksheet. But during development, the first method is easier.

## asking for training exercise ...

Hi
I'm a student of mechanical engineering and looking for some HPM ( homotopy perturbation method) maple codes with the related article to practice more in this field.
can I ask you for help?
unfortunately, I couldn't find any articles with maple solution about HPM.

sincerely
Aidin

## How to initialize a module using option load=setup...

As an exercise to gain familiarity with the maple programming platform, I am attempting to repackage a geometric algebra program written for Maple V as a module. I have attached file NewGlyph.mpl containing the initialization code for a module to support the GA routines in the package. The text file was created in the Maple code editor (Maple 2018) and loaded by reading it into a worksheet (configured for maple input instead of 2D math). I have two questions: one: how to get the GAinit procedure to execute completely, and two: to understand the puzzling warnings produced by the code editor.  The behaviour I observe when the module is loaded into a worksheet is: NewGlyph:= a maple id.  At this point the load=setup procedure has registered type blade, but not executed the remaining procedures in the setup routine. When I execute with(NewGlyph) the exported procedures are displayed properly.  However, I still have to execute the GAversion procedure and
the GA_addmetric procedure manually to properly initialize the metric table in the module. It would appear that the module load process permits the execution of the addtype procedure but not the output of the version procedure or the metric table constructor. Is there a way to autoexecute these procedures when the NewGlyph module is invoked by the with(NewGlyph) command? Are there any criteria for the kinds of processes that can be included using option load=setup? My second question concerns the compiler warning raised by the code editor.  It warns that "These names were used as global names but were not declared: blade, sig. Also "These local variable were assigned a value but not otherwise used: cleanup.

NewGlyph := module ()
description "Basic Geometric Algebra Functions";
local setup, cleanup;
global e;

setup := proc ()
TypeTools:-AddType(blade, proc (a) type(a, indexed) and op(0, a) = 'e' end proc);
GAversion();
GAinit();
end proc;
setup();
cleanup:=proc()
TypeTools:-RemoveType(blade);
end proc;

GAinit := proc()
global &@, &., &^, &x, &s , &/, &l, &v;
protect('&@','&.', '&^', '&x', '&s', '&/', '&l', '&v');
GAadd_metric('SA', proc () 1 end proc, 1, 3);
GAadd_metric('STA', proc (i) if(i = 0, 1, -1) end proc, 0, 3);
GAadd_metric('MSTA', proc (i) if(modp(i, 4) = 0, 1, -1) end proc, 0, infinity);
GAadd_metric('Homogeneous', proc () 1 end proc, 0, infinity);
GAadd_metric('Conformal', proc (i) if(i = -1, -1, 1) end proc, -1, infinity);
GAmetric('default');
end proc:

GAversion := proc ()
print(GA Package);
print(Version 2.0);
print(Written by: Mark Ashdown, maja1@mrao.cam.ac.uk);
print(Extended by: Alan Macdonald, macdonal@luther.edu);
print(Re-Packaged for Maple 2018 by: Ian McCreath);
end proc;

GAadd_metric := proc (fred::name, signature::procedure, minind::{integer, infinity}, maxind::{integer, infinity})
global MetricTable;
unprotect('MetricTable');
MetricTable['fred'][sig] := eval(signature);
if maxind < minind then
ERROR(The minimum index is greater than the maximum index)
end if;
MetricTable['fred'][min] := minind;
MetricTable['fred'][max] := maxind;
protect('MetricTable');
print(The GA package knows about metric  . fred . .)
end proc:

GAmetric := proc (a::name)
global Metric, Sig, MetricTable, MinIndex, MaxIndex;
if member([a], [indices(MetricTable)]) then
unprotect('Metric', 'Sig', 'MinIndex', 'MaxIndex');
Metric := a;
Sig := MetricTable[Metric][sig];
MinIndex := MetricTable[Metric][min];
MaxIndex := MetricTable[Metric][max];
protect('Metric', 'Sig', 'MinIndex', 'MaxIndex');
print(Metric is now set to:  . Metric)
else
ERROR(The metric  . a .  is unknown to the GA package)
end if
end proc:

# Creates multivector with name x of with grade or set of grades g with
# indices ind
GAmv := proc(x::name,g::{nonnegint,set(nonnegint)},ind::set(integer))
local i;
if g::set then
elif g > nops(ind) then
ERROR(grade too large for number of indices.)
elif g=0 then
x[NULL]
else
end if
end:

end module;

## Changes in Maple 2018? Getting bugs...

When running this code in Maple 13 and 16 this works just fine,

GenMs:= (k::posint)-> assign(m||(1..2*k) =~ seq([dx||i, dy||i][], i= 1..k)):
GenMs(k), m || (1 .. 2*k);
gln := evalDG(l1 &s n1+&s(l2, n2)+sum('epsilon || i'*(cat(m, 2*i-1) &s cat(m, 2*i-1)+cat(m, 2*i) &s cat(m, 2*i)), i = 1 .. k));

But running the same code in Maple 2018 I get the following error:

Error, (in DifferentialGeometry:-Tensor:-SymmetrizeIndices) expected 1st argument to be a tensor. Received: m2*i-1^2

I don't know if it's related to Maple 2018 screwing with my tensor formatting:
https://gyazo.com/88eaeceda2e36cf411df44dbc4aa3ab6

(compare https://gyazo.com/b33396131165d66bbcf16e45d20cc579)

For whatever reason I just noticed that my inline &t's have been turned into &t but that's a separate issue.

## how to select all instances of function y() in an ...

I am learning how to do parsing in Maple.

I want to check that a user supplied an expression with correct argument to y(*) from some complicated expression. So I need to find all instanced of y() to check that its agument is only y(x) and nothing else.  For example, given this

restart;
expr:=y(x)^2+x+y(x)+2*1/y(z)+sin(x)+sin(y(x))+y+f(z)/Int(sin(y(x)),x)+y(x,y,z);

I need to obtain all these y(anything), like this

No matter where they show up in the expression. The above is just some made up example. The actual input will be a differential equation, and I want to check that the dependent variable y(x) has only x as its argument.

So I did the following

candidates:=convert(select(has,expr,y),list);

The problem now, is how to scan this list and check that each entry in it, the "y" in there has form y(x) and nothing else, so I can reject or accept the input. For example, the first one above is Ok, so the second one, but the third is not, since it function of z and not x. #4 is OK, #5 is not OK, since it has y without (x), and the last one is no OK, since it has 3 arguments, and so on.

I am not good in pattern matching in Maple. do I need to check match() for this? or patmatch()? If given single expresion like y(x), then I can handle it. I do something like

expr:=y(x);
if type(expr,'function') and nops(expr)=1 and op(0,expr)=y and op(1,expr)=x then
print("OK");
else
print("not ok");
fi;

But when the expression gets more complicated, like 1/y(z), then I need to check other things, and things gets complicated quickly. I think pattern matching is needed? or is there a better approach to do this that works in general?

How does Maple do it internally? When I type

   dsolve(diff(y(x),x)+x+y(z)=0,y(x));

Error, (in dsolve) found the indeterminate function y with different arguments {y(x), y(z)}

dsolve(diff(y(x),x)+x+sin(y(z))=0,y(x));

Error, (in dsolve) found the indeterminate function y with different arguments {y(x), y(z)}

dsolve(diff(y(x),x)+x+y()=0,y(x));


So I need to do the same thing as Maple does. I looked at dsolve() code, but did not understand it how or where it does the parsing.

## question on use of TSprintf...

I am using this proc by Carl Love posted here

https://www.mapleprimes.com/questions/211401-How-Do-I-Print-Text-Followed-By-Math

TSprintf:= proc()
local e;
uses T= Typesetting;
T:-mrow(seq(if(e::string, T:-mn(e), T:-Typeset(T:-EV(e))), e= [args]))
end proc:

when I do

TSprintf("Solving ", diff(y(x),x)=x);

it works fine and it prints on the screen as expected.

The problem is that inside a proc, if I use an error() later on, the message do not show up

foo:=proc()
TSprintf("Solving ", _passed);
error "opps"
end proc;


And now when I call it like this

foo(diff(y(x),x)=x);
Error, (in foo) opps   # Where the message "solving...." gone?? it does not show on the screen

I only see the "opps" and never see the message.  If I remove error(), then it shows up. But with standard printf, both show up

foo:=proc()
printf("Solving %a", _passed);
error "opps";
end proc;


foo(diff(y(x),x)=x);
Solving diff(y(x),x) = x  # printf message shows OK
Error, (in foo) opps      # from error

Why TSprintf message do not show up if there is an error() after it?

 First 39 40 41 42 43 44 45 Page 41 of 45
﻿