## 847 Reputation

11 years, 275 days
East Grinstead, United Kingdom

## Programming manual...

@Mac Dude Ok. Have downloaded it. Will work on it over the next week. Sure I'll have a few questions.

## Some understanding but questions...

```restart;

MyTypes := {algebraic, ''[algebraic\$_], 'Vector(_, algebraic)'''\$_ = 2 .. 3};

MyProc := proc (Q1::(depends(And(MyType, satisfies(proc (Q1) options operator, arrow; andmap(proc (T) options operator, arrow; Q1::T implies Q2::T and Q3::T end proc, MyTypes) end proc)))), Q2, Q3) if Q1::algebraic then print('algebraic*inputs') elif Q1::[algebraic\$2] then print('List*inputs', 2, 'elements') elif Q1::[algebraic\$3] then print('List*inputs', 3, 'elements') elif Q1::'Vector(2, algebraic)' then print('vector', 2) else Q1::'Vector(3, algebraic)'; print('vector', 3) end if end proc;
MyProc(sqrt(1-2*x), 2*x, 3);
algebraic inputs
MyProc([1, x], [2, 3], [1, sqrt(1-2*x)]);
List inputs, 2, elements
MyProc([1, x, 1], [2, 3, 2], [1, sqrt(1-2*x), 2]);
List inputs, 3, elements
MyProc(`<,>`(1, 1), `<,>`(2, 3), `<,>`(1, 2));
vector, 2
MyProc(`<,>`(1, 2), `<,>`(2, 3), `<,>`(1, 2));
proc(n, f, t)  ...  end;, 2
MyProc(`<,>`(1, 2, 3), `<,>`(2, 3, 6), `<,>`(1, -5, 2));
proc(n, f, t)  ...  end;, 3
MyProc(`<,>`(1, x, 1), `<,>`(2, 3, 3), `<,>`(1, 2, 7));
proc(n, f, t)  ...  end;, 3
MyProc(sqrt(1-2*x), 2, [3, 1]);
Error, invalid input: MyProc expects its 1st argument, Q1, to be of type And(MyType, satisfies(proc (Q1) options operator, arrow; andmap(proc (T) options operator, arrow; Q1::T implies Q2::T and Q3::T end proc, MyTypes) end proc)), but received (1-2*x)^(1/2)
MyProc([1, `<,>`(2)], [sqrt(1-2*x), 3], [1, 2]);
Error, invalid input: MyProc expects its 1st argument, Q1, to be of type And(MyType, satisfies(proc (Q1) options operator, arrow; andmap(proc (T) options operator, arrow; Q1::T implies Q2::T and Q3::T end proc, MyTypes) end proc)), but received [1, Vector(1, {(1) = 2})]

```

@Carl Love I have made some progress with understanding this. I can see how it works. It does seem to have a problem with Vectors. Get this as an output.

proc(n, f, t)  ...  end;, 2
Sometimes it works with  vectors.

I want to put this set of "types" into Packege. Obiviously the most efficient thing is the types get defined globally at the start of the package and then can be used as needed in individual procedures in the package. I tried placing part of your 1st answer into the package.

uses TT= TypeTools;
global _T1, _T2L, _T2V, _T3L, _T3V, _MyType;
local
MyTypes:= {_T1, _T2L, _T2V, _T3L, _T3V},
AllMyTypes:= MyTypes union {_MyType},

local
g, #iterator over module globals
e
;
#op([2,6], ...) of a module is its globals.
for g in op([2,6], thismodule) do
e:= eval(g);
if g <> e and e in AllMyTypes then
error "The name %1 must be globally available.", g
end if
end do;
TT:-AddType(_T2L, [algebraic \$ 2]);
TT:-AddType(_T3L, [algebraic \$ 3]);
end proc,

That didn't work. I don't know how much of it I need. Do I need to use all of the module on procedures that check input types

You 1st answer works fine with the tested inputs on the vectors. I found if I only enter 2 parameters it crashes Maple, looses kernel connection.

This leads to another question. Can a procedure have a variable number of imputs? Outside of putting them in a list first. An axample here would be angle formed be 3 points or 2 vectors or 2 lines.

Could an input be allowed to be Null? Or C takes on a default value is not entered.

Just to note here. Only some of the procedures in the package need to test the input parameters and usually not all types would need to be tested.

## Nice Look but experiencing fustrations...

Good basic overhaul on the look for the forum. Others have suggested improvements on this so don't need to recover that ground.

Have been experiencing some problems.

Some times when I hit return I loose my reply or it jumps to the end of the discussion i.e off the reply window. I am having problems posting a worksheet, nothing happens. The insert contents button seems frozen. How do you insret code (like the way Car Love and others do)? I tried copy and paste but it looked a mess.

## Simple and Effective...

@Joe Riel That works well and is simple to impliment. One thing I dont understand, how does the test produce an error on mixed input types. It only appears to test the 1st eleme A but on mixed input types produces the error as required. Haven't tested for vectors yet.

## A Great step forward....

@Mac Dude  Thank you.  Got it to work. I manually made a folder on the C drive "libR". Then ran the work sheet. That created the help file and added the 2 document. Great. I Underatand to edit the help contents delete the .help file and after modyfing the worksheets run the "help edit to databse" again. All good so far.

One more question on this.

This first worksheet added opens in the browser when searched for. The second one opens as a worksheet in Maple.

Any Idea why?

Edit:- I fixed the problem additional help files not opening in the browser. This is what the document properties "Active"= true opens the help as the maple worksheet, false opens the help in the browser.

I have not tried moving the  .help file to where the .mla file is yet. Is that important?

 (1)

 (2)

 (3)

 (4)

 (5)

## Looks like a good approach......

help_edit_to_Database.mw    @Mac Dude Thank you that is a helpful concept. See your worksheet was created in Maple2015. I have edited your

worksheet. Cant seem to get it to work. Found what your mentioned on setting active to false. Didnt make afifference. I have uploaded 2 files your's edited and the one I used to make the database path. Wonder if there is a syntax change between 2015 and 2016?

 (1)

 (2)

 (3)

 (4)

## I got it working...

@John Fredsted  Thank you for your help. This worked.

 (1)

 (2)

 (3)

 (4)

## Error.......

Sorry to be a pain on this. Now it procudes Error cannot open C:\........\lib, for writing.

Any ideas what would cause this. Using Maple 2016.

in Mable 2016 libname gives  "C:\Program Files\Maple 2016\lib"

Interesting it works in Maple 18

in Maple 18 libname gives "C:\Program Files\Maple 18\lib"  ,  "." What is this "."

It Must be where RTest was stored because it is not showing up .....Maple 18\lib.

## Savelib???...

Ok Thank you. That helps. I don't get the savelib part. I just cant make sense of the maple documentation.

 (1)

the Library folder should be C:\Program Files\Maple 2016\lib

## Maple YouTube Chanel...

This may be of some assistence to you

And Peter Stones site

http://www.peterstone.name/Maplepgs/maple_index.html

## Maplesoft Blog Posts...

http://www.mapleprimes.com/maplesoftblog/203933-A-New-Section-Style-With-Programmatic

This is 2nd in the list on the right of your screen.

## Is this explained in help?...

@Carl Love I have the quite a few looks in help for this. Haven't found anything useful on it. It seems a very powerful tool. I could ask a list of questions on this but would rather do some basic study on it and see how I can apply it myself before asking questions.

## Assign values to cunstants,then Groebner...

You probably can't solve this without assinging values to to constants. Convert the constants to rational numbers. I just made up random values for them. Then run Groebner basis using tdeg. Convert the Basis using the FGLM command to plex form. Gives 4 equations that can be solved in sequence.

Actually you can run Basis([Q1,Q2,Q3,Q4],plex(p1,p2,q1,q2)) and it gets you straight to the 4 equations.

I just picked this method because I was using Groebnr recently.

 (1)

 (2)

 (3)

 (4)

 (5)

 (6)

 (7)

 (8)

 (9)

 (10)

 (11)

 (12)

## No prefix form?...

@Carl Love  I don't quiet understand. I took what you did, looked at "help" in Maple and after a good dose of trial and error got it to work.

## Works great...

@Carl Love Thank you, I also manged to use technique to built a diagonal matrix of 1's and insert a 3 x 3 matrix in lower right corner

M1:=<<Matrix(S*(dmax-1),shape=identity);Matrix(S,S&(dmax-1))>|<Matrix(S*(dmax-1),S);C||dmax>>

C||dmax is a 3 x 3 Matrix.

 First 15 16 17 18 19 20 21 Page 17 of 21
﻿