Jean-Michel

Dr. jean-michel collard

60 Reputation

7 Badges

0 years, 313 days
Cergy (suburb of Paris), France
Ph.D. in Mathematics (Differentiel Topology) Master Degree in Cosmology

MaplePrimes Activity


These are replies submitted by Jean-Michel

@janhardo 

Of course you are a Dutschman i can smell beers :)

Head is Part[0] so i guess in Maple it should be op(0,..) ?

anyway your module does not work for all exemples i tested.

i have no specific goal, it was for "fun", let say so.

Tschüss,

JM

@janhardo 

S := [a, [[[[[a]]]]], 2*a + 3, [2, a], 1/a];
                [                                 1]
           S := [a, [[[[[a]]]]], 2 a + 3, [2, a], -]
                [                                 a]

FindPositions(S, a);
           [[1], [2, 1, 1, 1, 1, 1], [3, 1], [4, 2]]

NULL;
NULL;
FindPositions(S, 3);
                            [[3, 2]]

NULL;
FindPositions(S, 2*a);
                            [[3, 1]]

FindPositions(S, 1/a);
                             [[5]]

FindPositions(S, 1/a);
                             [[5]]

NULL;
M := [[a], [1 + a], [a, [[a]]], a];
               M := [[a], [1 + a], [a, [[a]]], a]

FindPositions[M, a];
        FindPositions[[[a], [1 + a], [a, [[a]]], a], a]

??

take care my friend og Belgium or Nederland:)

best,

JM

@janhardo 

Look at that :

N := [a, a, 1 + a, [[1/a] + a^2, [a]]];
                   [             [[1]    2     ]]
              N := [a, a, 1 + a, [[-] + a , [a]]]
                   [             [[a]          ]]

FindPositions(N, a);
                 [[1], [2], [3, 2], [4, 2, 1]]

Position(N, a);
                 [[1], [2], [3, 2], [4, 2, 1]]

So we have 6 'a' at different positions and FindPositions and Position return

only 4 positions. this is not possible :)

Have a Kriek Cherry now you will feel better :)

Best,

JM

@janhardo 

@janhardo

re re ,

M := [[a], [[a, [a]], a]]

FindPositions(M, a);
           [[1, 1], [2, 1, 1], [2, 1, 2, 1], [2, 2]]

[[2,2]] should be [4,1] , right ? 

thanks and drink a 'Mort Subite' for me :)

JM

@janhardo 

Re janhardo,

If you could avoid to put commentaries in Flemisch/Dutch it could help me

what you actually do :)

thank you

JM

@janhardo 

Hello the "search" man :)

Great work you did !

however there are at leasr 2 fatal errors :

Error, `FindPositions` does not evaluate to a module

Error, (in fprintf) integer expected for integer format

where is the module ?

thanks and tchüss,

JM

@janhardo 

well done janhardo but at line 1:

Error, illegal use of an object as a name

I will see that tomorrow morning because tonite i'm too tired :) and it's only 9:30 pm

Tschüss,

JM

@janhardo 

Hello,

I am afraid that I can't understand English enough to comprehend

your question...

Anyway here is a link toward Position in Mathematica.

I think it's quite difficult to extend this to Maple,very difficult...

I pass my whole morning on that but didn't progress at all.

Tschüss,

JM

https://reference.wolfram.com/language/ref/Position.html

@janhardo 

I know that Position is a complicated function.

Position[expr,pattern] gives a list of the positions at which objects \
matching pattern appear in expr.  (your program)

Position[expr,pattern,levelspec] finds only objects that appear on \
levels specified by levelspec. 

Position[expr,pattern,levelspec,n] gives the positions of the first n \
objects found. 

"Position[\!\(\*StyleBox[\"pattern\", \"TI\"]\)] represents an \
operator form of Position that can be applied to an expression."

I will try later on to extend your function Position in Maple.

Tschüss,

JM

@janhardo 

I am stunned by the beauty of this program !

It exactly mimics the function Position in Mathematica.

Tchüss,

JM

@janhardo 

That's the hell of an excellent way for "position".

However i have to ponder a bit on the proc. beautifully writen.

this *is* Maple programming.

Best,

JM

@Kitonum 

At least I have learnt a lot of things today.

Many thanks.

JM

@KonstantinW 

Fantastic and out of the box.

Thank you,

JM

@Kitonum 

hello Kitonum,

This doesn't work as Position.

M := [[1, a], a, [[3 + a]], 2*a - 1];
              M := [[1, a], a, [[3 + a]], 2 a - 1]

Search(a, M);
                               2  

SearchAll(a, M);
                               2

Search(3, M);
                               0

Search(1, M);
                               0

I don't understand what I do wrong

JM

@acer 

Thanks Acer...so far ..so good.

Wonderfull example.

JM

1 2 3 Page 1 of 3