cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Jacobian matrix

XDN
13-Aquamarine
13-Aquamarine

Jacobian matrix

Hi community

in this simple example,is shown how Mathcad help me to find a singularity value (det J = 0)

Capture d’écran 2022-03-10 114651.jpg

 thanks

21 REPLIES 21
Werner_E
24-Ruby V
(To:XDN)

Is there any question you have???

Why do add and not subtract. Furthermore it looks like you ran into Prime infamous auto-label trap and will have to manually label all variables the same.

Werner_E_0-1646917099915.png

 

Is there any reason you are not using the built-in "Jacob" function?

Would be straightforeward - here done in MC15

Werner_E_1-1646917261824.png

 

 

XDN
13-Aquamarine
13-Aquamarine
(To:Werner_E)

Hi Werner

I use Prime , because finally i connect calculation sheet with PTC Creo 3D CAD

In my example, i know the det(J)=0 with only q2=0 or q2=180 ( l1=squareroot 2 l2=1) : this corresponds to the alignment of the robot leg (l1 and l2)

but i can't find it with mathcad

in don't know "Prime infamous auto-label"

Werner_E
24-Ruby V
(To:XDN)

First of all you have to correct you error and change the plus sign to a minus to calculate the determinant the correct way.

You may also use the matrix determinant operator |J| or ||J|| to do the job.

If you still do not get the simplified result shown in my previous answer you have to look at the labels of all of your variables theta1 and theta2 and change them manually so all are the same - either all "variable" or all "-" (which means "automatic"). The symbolic engine does not like variables which are labeled differently and treats them as different variable which seems to be the reason why in your pic theta2-theta2 is not simplified to zero, etc.

As already written above using the "Jacob" function (and the determinant operator) would be the most natural way but as I have notice it seems to be broken in the new symbolic engine. So if you are using Prime 7 you have no option to switch back to the legacy symbolic engine and if the bug is not already fixed in P7 you can't use the "Jacob" function.

 

BTW, in future threads I would advice that you clearly state the problem you experience and the question you have and that you also always attach your worksheet as well.

I converted the MC16 to Prime6 and I had to realize that once again Jacobi is one of those things that are broken in Prime. This time its the new symbolic engine which fails. In Prime 6 we still have the option to use the old symbolic engine (muPad) so we can compare:

Legacy Symbolic Engine:

Werner_E_2-1646917845322.png

 

New Symbolic Engine  (Axiom fork)

Werner_E_4-1646917943535.png

Crap! Didn't wait for the last region to finish calculating.

 

Don't have P7 installed so I can't say if the bug is already fixed there.

 

XDN
13-Aquamarine
13-Aquamarine
(To:Werner_E)

Of course the solution is exactly your 1st screenshot !

But it's amazing that it doesn't work 😡

should we continue to do this by hand, it's not very serious

Werner_E
24-Ruby V
(To:XDN)

Its a bug in the new symbolic engine (at least in Prime 6, thats all I can say). If its still present in P7 and if you have confidence in the software developers and believe that it will help, feel free to report the bug to PTC. 

And the method of providing the partial derivatives manually as you did should work OK as soon as you work around the auto-label problem by changing the labels manually and as soon as you calculate the determinant the correct way or use the determinant operator instead.

XDN
13-Aquamarine
13-Aquamarine
(To:Werner_E)

Of course , i see it's clearly q2 is the only variable that causes the singularity of robot

Werner_E
24-Ruby V
(To:XDN)


@XDN wrote:

Of course , i see it's clearly q2 is the only variable that causes the singularity of robot


Yes and Mathcad sees it the same way 😉

The determinant is zero if either one of l1 or l2 is zero or theta2 is a multiple of pi.

Werner_E_0-1646919991872.png

You can also tell Mathcad that the variables are positive and solve for theta1 as well and the answer is that theta1 can be any value and theta2 again must be a multiple of pi

Werner_E_1-1646920013847.png

Prime should be able to do so as well - you simply have to avoid the faulty "Jacob" function.

XDN
13-Aquamarine
13-Aquamarine
(To:Werner_E)

Thanks for this explanation !

I'm going to open ticket at PTC

 

But do you can to explain me how can you see if it is variable or automatic?

 

Werner_E
24-Ruby V
(To:XDN)


@XDN wrote:

Thanks for this explanation !

I'm going to open ticket at PTC

 

But do you can to explain me how can you see if it is variable or automatic?

 


Click the variable, then in "Math" tab look at the "style" settings

Werner_E_0-1646922554140.png

 

For numeric evaluations it seems to be no problem if variables are labelled "-" and "variable", but the symbolics  is more choosy.

It may also help to enable "units/constants in symbolics" in the Calculation Options

Werner_E_0-1646923238719.png

 

 

Werner_E
24-Ruby V
(To:XDN)

OK, I further looked at the problems with Prime and I still consider it a bug in the new symbolics but there is an easy workaround.

The reason for the bug seems to be that the new symbolic engine is not always able to determine correctly the number of arguments in use. So the workaround is to just use the optional third argument of the "Jacob" function and tell Prime the number of independent variables in use.

Werner_E_0-1646930005027.png

There is a further problem in Prime when we try to solve for theta2. Primes new symbolic seems to not like vector indexed variables to solve for. Substituting the vector element for a "normal" variable seems to cure this problem.

Werner_E_0-1646930940689.png

 

Prime6 worksheet attached

 

 

XDN
13-Aquamarine
13-Aquamarine
(To:Werner_E)

PTC support says:

I reported the issue to R&D

Details in CS364786

wait and see

Thanks Werner

 

Werner_E
24-Ruby V
(To:XDN)

Waiting (for at earliest Prime 9, I guess) doesn't hurt that much as there is an easy workaround.

XDN
13-Aquamarine
13-Aquamarine
(To:XDN)

of course all my sheets are in Prime 7, and of course we can't go down to Prime 6! it is unacceptable

😡

Werner_E
24-Ruby V
(To:XDN)


@XDN wrote:

of course all my sheets are in Prime 7, 😡


It's not as obvious as you make it out to be that you are using P7 - after all you haven't revealed which version you're working with until now and also did never attach a worksheet. However, I had suspected P7.

 


and of course we can't go down to Prime 6! it is unacceptable

The workaround I referred to was not to do go down (or rather up) to Prime 6 and the legacy symbolic but I was talking about providing the optional third argument to the "Jacob" function as shown in the screenshot and my attached sheet. This works OK in Prime 6 with the new symbolic engine and I would expect that it also works in Prime 7 - you have to check for yourself.

XDN
13-Aquamarine
13-Aquamarine
(To:Werner_E)

Yes, excuse me, i use P7

Capture d’écran 2022-03-10 183355.jpg

 

is good

 

but for solve, it's wrong

Capture d’écran 2022-03-10 183523.jpg

 

P7 say: unknown error : index out of range

Werner_E
24-Ruby V
(To:XDN)

but for solve, it's wrong

Capture d’écran 2022-03-10 183523.jpg

 

P7 say: unknown error : index out of range


So it looks like some things got worse when they improved the symbolic from P6 to P7 😞

But I guess that the simplification of the determinant works in Prime 7, too, so you see that the zeros of sin(theta2) are the only values which can cause a singularity.

XDN
13-Aquamarine
13-Aquamarine
(To:Werner_E)

yes, in this case the singularities are easy to see. This even without calculating, looking at the geometry of the robot and the alignment of the arms. But in a poly articulated robot with a 6x6 Jacobian it's much more difficult ... and I see that I can't count on P7

Werner_E
24-Ruby V
(To:XDN)


@XDN wrote:

yes, in this case the singularities are easy to see. This even without calculating, looking at the geometry of the robot and the alignment of the arms. But in a poly articulated robot with a 6x6 Jacobian it's much more difficult ... and I see that I can't count on P7


Yes, that may be true.
Maybe you shouldn't  see it as an automatic problem solver but rather as a tool which can help but needs guidance and supervising.

XDN
13-Aquamarine
13-Aquamarine
(To:Werner_E)

yes you are definitely right

But that's a shame, because for me the interest is to give the user a clear and understandable sheet

otherwise, i use matlab or python...

 

but, you will tell me, if I do that, I lose the CAD link

so, why not use MC15

it's crazy!

 

Werner_E
24-Ruby V
(To:XDN)

Yes, unfortunately it is a very unsatisfactory situation. And while I love MC15 and use it all the time (unlike Prime), I don't think going with MC15 is a future-proof solution. Ultimately, PTC stopped selling the MC15 at the beginning of the year. I will use it as long as possible, of course, but MC15 sure isn't perfect either and the symbolics there (muPad like in Prime until version 6) is still quite limited. muPad is also the symbolic engine in MatLab, but in Mathcad a rather old and limited version is implemented, while MatLab (Mathworks are the owners of muPad) will give you the full power of it. having to pay license fee to Mathworks and the inability to make changes/improvements to the symbolic engine were the reasons why PTC switched to a different symbolic engine beginning with Prime 6. The most powerful engine in Mathcad was when they had included Maple, but thats long ago and one of the reasons many long time users consider Mathcad 11 the best version ever. People who found a way to keep this version running to this day are very happy about it , but thats sure not an option for you.

So either way you will probably have to live with compromises and find workarounds when things come to a head 😞

Top Tags