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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

12-Amethyst

## Jacobian matrix

Hi community

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

thanks

21 REPLIES 21
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.

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

Would be straightforeward - here done in MC15

12-Amethyst
(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"

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.

24-Ruby V
(To:Werner_E)

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:

New Symbolic Engine  (Axiom fork)

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.

12-Amethyst
(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

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.

12-Amethyst
(To:Werner_E)

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

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.

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

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

12-Amethyst
(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?

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

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

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.

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.

Prime6 worksheet attached

12-Amethyst
(To:Werner_E)

PTC support says:

I reported the issue to R&D

Details in CS364786

wait and see

Thanks Werner

24-Ruby V
(To:XDN)

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

12-Amethyst
(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

😡

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.

12-Amethyst
(To:Werner_E)

Yes, excuse me, i use P7

is good

but for solve, it's wrong

P7 say: unknown error : index out of range

24-Ruby V
(To:XDN)
but for solve, it's wrong

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.

12-Amethyst
(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

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.

12-Amethyst
(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!

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 😞

Announcements