## 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()
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?

## basic question on use of private proc inside modul...

I am learning to use module().  If one has a local private proc() inside  a module, then on calling this local proc from inside the module itself, does one need to call it using module_name:-local_proc() or is it safe  to just call it using local_proc()?

i.e. will Maple always look to resolve this name inside the module first, before looking outside? What order Maple uses to resolve names?

Here is an example

restart;
private_proc:= proc()
print("Opps, should not be calling this, global copy");
end proc;

foo :=module()
local private_proc;
export public_proc;

private_proc:=proc()
print("inside private");
end proc;

public_proc:= proc()
private_proc(); #will this always call foo:-private_proc() and not
#any other global proc with that name?
end proc;

end module;

foo:-public_proc();

gives "inside private". So it seems to work without having to use foo:-private_proc(). But I thought to ask if the above will always work like this.

## using new coderegion in Maple 2018. How to indent/...

I really like the new updated code region in Maple 2018. I am now using for everything.

One thing though I can't find out, is how to automatically indent/format code? Having to keep doing this by hand is tyring.

Matlab for example have smart indent. In the editor, one selects the code to indent, or select all, then just click on indent and it will automatically auto-format. I use it alot.

Not able to find such command in Maple. Is this something that will be added in future release? This is really very important feature.

## The Start.mw in recent documents...

I only just noticed the Start.mw file being always number 1 in my Recent document list.  I don't recall it being there, ever, and I don't think it should.  Why is it there now?  Anyone else have this?

## Maple 2018 throwing 'Invalid specification of init...

Hi All,

I recently switched from Maple 18 to Maple 2018. I was trying to execute and old worksheet created with Maple 18 in which a DAE have to be solved numerically. In Maple 18 the worksheet works flawlessly whereas Maple 2018 throws 'Error, (in dsolve/numeric/process_input) invalid specification of initial conditions...'

Initial conditions are given in the form {x1(0) = 1, x2(0) = 2, D(x1)(0) = 1, D(x2)(0) = 0 ....} and are the same in both cases ( I merely executed without any modification the same worksheet in the two Maple versions).

I feel I've missed out something in the changelog... any idea on what is happening?

PS. call to dsolve

dsolve(dsys_numeric, numeric, implicit = true, stiff = true, optimize = true, compile = true):

## Solve Non Linear System Maple ...

Hi Guys :)

I need some Help with solving a nonlinear system.

I have 3 equations.

These 3 equations have 7 unknown variables in it. But 5 of them are constants which I don't want to solve. I just want to solve three of them.

I tried it with fsolve but I always get the error :

fsolve({eq1, eq3, eq5}, {a, b, c});
%;
Error, (in fsolve) {eq1, eq3, eq5} are in the equation, and are not solved for

i tried to define the variables as Parameters but then i get this error:

Parameters(t1, t2, t3, t4, t5, t6, t7, b1, t, v1, v2, s1, s2, j, a, b, c);

fsolve({eq1, eq3, eq5}, {ca, cb, cc});
%;
Error, (in fsolve) {b1, eq3, eq5, j, t, t1, t2, t3, t4, t5, t6, t7} are in the equation, and are not solved for

Here is the script : Non-Linear_system.mw

has sb an Idea?

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