## Items tagged with type

Hello,

I have two simple module's:

1) ------------------------------------------------------------------------

```Point := proc(xx::float,yy::float)     return module()         local x := xx,y := yy;         export ShowPoint,GetX,GetY;                  ShowPoint := proc()             printf("Point X,Y -> [%f,%f]",x,y);         end proc;```

```        GetX := proc()             return x;         end proc;                 GetY := proc()             return y;         end proc;         end module: end proc:```

2) ------------------------------------------------------------------------

```PointMath := module()     option package;       export `+`;          `+` := proc(a::Point(float,float),b::Point(float,float))         option overload;         Point(a:-GetX()+b:-GetX(),a:-GetY()+b:-GetY());     end proc; end module: ```

------------------------------------------------------------------------

Next I use first module:

`p1:=Point(1.2,1.4);`

`p2:=Point(1.0,2.0);`

Finally I want to add above two points:

`with(PointMath)`

`p2:=p1+p2`

`The results is:`

`p2:=p1+p2`

Why is not called operator '+' and two points are not added?

Best,

Rariusz

## How to use Select...

Experts.

In view of the worksheet:

VRP_permute.mw

What I need is
a) a better way to display the Tour_Distances (from 1 to M) and
b) a way to select tour elements where each component is <= to a specified distance (say <=H) and the corresponding tour(s) (from Tour2).

## Check for cyclic function ...

In maple we have type/symmfunc check for a symmetric function. I want to write cycfunc function.

Example: cycfunc(a^2*b + b^2*c + c^2a, [a,b,c]) return true.

Thanks you very much.

## Numeric problem...

Hi,

I want to subtract two functions. One of them is numeric-type and the second is exact. Something like this:

solNum := dsolve(Dsys, numeric);

sol := dsolve(Dsys);

plot(solNum-sol)

In the last step there is an error (of course). How can I fix it?

Thank you very much

## Check if an integer is part of the factorisation o...

Hello,

I am working on a Dirichlet breakdown of primes. I need a way to check if a number is part of anothers number factorization.

Example: 30 = 2*3*5.

2 is therefore part of the ifactor of 30. 4 and 7 are not.
How do I check if, for instance, 7 is part of de factorization of 390?

## How do I find everything about an expression?...

I know that whattype() is used to find the basic data type of an expression. Unfortunately that information is rarely useful. How can I dig down deeper and get Maple to tell me more about the expression?

I read somewhere that there is a properties() procedure that does that but I cannot find that procedure.

Thanks.

## Strange behavior of whattype...

with(Student[LinearAlgebra]);
example1 := Matrix([[1, 2, 3], [4, 5, 6], [6, 7, 8]]);
whattype(example1);

testproc := proc (A) print(whattype(A)) end proc;

testproc(example1);

The whattype() calls output:

Matrix
proc() ... end proc

I don't understand why what is a Matrix type outside the procedure seems to change into this unrelated type? This is really bizarre. I feel like it may be something outside my code? Thank you.

## How to split string by types?...

I want to separate strings into substrings for example
input is "6,3,A,n,k,L,+,-" then the procedure breaks this string into substrings like
if a member numeric b:="6,3",or if lowercase c:="n", if uppercase l:="A,L" else m:="+,-"
thanks

## How to get such references?...

 I would appreciate if anyone lets me know how to write circular references  (say 1 inside a circle to refer element 1. At present i do a drawing insert text and using.   Also i do not know how to remove the boundary of the overall drawing.

Ramakrishnan V

rukmini_ramki@hotmail.com

## Strange error in diff...

Hi,

This is my first post here, so I apologize for any errors or breaking of posting etiquette. I encountered a strange problem suddenly tonight when I tried running a Maple worksheet I've run succesfully (several times, without changes) in the past. The problem occured on both Maple 18 and Maple 2015, unfortunately I haven't been able to recreate a minimal working example with the same error, since my other worksheets doesn't show the error even though they contain identical caluclations. The problem also persists between copies of the worksheet.

The error I'm recieving is
"Error, (in TypeTools/ac_var_local) unable to handle expressions as (((D@@2)(phi))(theta(t)))(t)"

It occurs whenever I try to differentiate some (not all) expressions containing the above variable. I have no idea what this error even means, and I can't find anything googling. As said previously, I haven't been able to produce the error so I can't really give a concise short example but the flow is as follows:

g0 := simplify(subs(diff(y(t), t, t) = F+N*v(t), lhs(aby)-lhs(aby_y)), 'size');
->Produces an expression containing (((D@@2)(phi))(theta(t)))(t)
diff(g0,t)
-> Gives Error

U := lhs(Vector([1, 0]).subs(subsVhcError, eom));
->Produces an expression containing (((D@@2)(phi))(theta(t)))(t)
diff(U,t)
-> Does not give error

Sorry that I can't be more descriptive, does anyone know have to sort this out, or might give me some more info on what the Error message might mean and how TypeTools are involved? As stated previously, the error just occured today and only affects one worksheet.

Edit: Link to worksheet with error
transverse_linearization.mw

## Recognizing a finite constant...

My Maple is apparently getting rusty!  Question: how do I recognize a finite constant?

`type(Pi, finite)` is false (by design, apparently), while `type(infinity, constant)` is true.  So now I don't know quite what to 'ask' maple!

## A problem with `OR` in structured types creation...

Hello
I encountered with a problem in understanding of structured types. I test following structured types:

the result is

true

false
false

I cannot understand two last results as I expected to receive trues. Could you explain me the result?
Thank you.

UPD
A code appropriate for copy/pase along with short problem solution is presented below

`restart;`type/A1`:={integer, rational};`type/A2`:=integer or rational; #  it matchs the expressions that literally contain `or` (see @Carl Love'sanswer below)`type/A3`:=OR(integer, rational); # `Or` should be used rather then `OR` (see @acer'sanswer below)x:=5;type(x, A1);type(x, A2);type(x, A3);`

## How to extract terms that are a product of a commu...

Hello.
I am trying to extract the terms that are a product of a commutative part and an operator part from the input expression. That is I am trying to extract a terms like a*A.B where A and B are quantum pperators.

I am trying to do it by creating corresponding structured type:

`restart; with(Physics); Physics[Setup](op = {A, B}, quiet); `
``type/ProdComOp` := `&*`(commutative, specfunc(anything, Physics:-`*`)); z0 := u*A.B-A+k*B+B.A.B+g; z1 := z0+v*A.B.A;S1 := indets(z1, ProdComOp); `

and all it is Ok. The result is
But if

`z2 := z0-v*A.B.A; S2 := indets(z2, ProdComOp);`

then
however I expected to receive the same as S1.

How to handle the sign of the commutative part? Thank you.

## How to test if a variable is a dot-product of "any...

Hi. I need to test if a variable is a dot-product of "anything"-s (usually it is quantum operators).
I try the following

`restart; with(Physics); Physics:-Setup(mathematicalnotation = true); Physics:-Setup(anticommutativeprefix = psi); ap1 := Physics:-Creation(psi, 1, notation = explicit); am1 := Physics:-Annihilation(psi, 1, notation = explicit); ap2 := Physics:-Creation(psi, 2, notation = explicit); am2 := Physics:-Annihilation(psi, 2, notation = explicit);z1 := ap1.am1.ap2:type(z1, ('`.`')(anything));`

and get

false

whereas

`z2 := a*b*c; type(z2, (':-`*`')(anything));`

returns

true

I studied ?type,structured and other sources but didn't find any answer.

## How to construct a type for an expression A^n wher...

I am trying the following:

`restart; with(Physics); with(Library); Setup(mathematicalnotation = true); Setup(op = A);assume(n::integer);type(A^n, Physics:-`^`(PhysicsType:-ExtendedQuantumOperator, integer));type(A^n, PhysicsType:-ExtendedQuantumOperator^integer);`

the result is

false
false

However, I expected to get true in both cases. How to construct correct type for A^n?
Thank you.

 1 2 3 Page 1 of 3
﻿