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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Help with Symbolic Expresions - Prime 6

johncgh
4-Participant

Help with Symbolic Expresions - Prime 6

Hi everyone,

 

I am trying to work in an exported file from Mathcad 15 M050 to Prime 6.0

I am working with symbolic expressions where I used prime variables to define velocities of an angle. In Mathcad 15, I use CTRL+F7 to add the apostrophe to the variable, but in Prime 6.0 it doesn´t act the same way. I tried to use the one in the "Operators" menu, but it doesn´t operate the symbolic expression the same way. 

 

If anyone has a possible solution, I will appreciate it. Thanks in advance.

I´ll add some images of part of my file, in Mathcad 15 and Prime 6.0

 

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:Werner_E)

One last remark:

In my answer above I worked from the Prime4 file which Luc had posted and it was necessary to manually label the variables in the Jacobi matrix, too.

 

Now I gave it a try from scratch and I converted your Mathcad 15 sheet to Prime 6 format and I noticed two things:

1) Its not necessary to change the apostrophes to manually typed ones - the converter seems to have done a good job and did not converted the apostrophes to prime symbols.

2) As in my simplified example its only necessary to manually set the label of the theta.i' variables when the expressions for omega.i_i are defined.

 

So I converted the sheet and set the label manually in three regions (yellow underlined in the attached worksheet). That's all that is needed to make the worksheet run. Guess the same applies to the Prime worksheet you posted.

 

Prime 6 worksheet attached.

 

View solution in original post

11 REPLIES 11
LucMeekes
23-Emerald III
(To:johncgh)

Attach your worksheets if possible. A picture may paint a thousand words... A worksheet in general helps much better!

 

In Mathcad the prime symbol attached to a variable or function has no meaning, unless you're defining a (set of) differential equations in a solve block (see the help description there).

In Prime the prime symbol actually is an operator defining d/dt (or d/dx) whatever the parameter of the function is.That means that y' will always yield 0, unless y is a function of a parameter to a degree other than 0.

 

If, in Prime, you want to attach to a variable or function a prime symbol that's not an operator, type the variable name including the prime symbol as a string, so within double quotes, then delete one of the double quotes (the other disappears also, and you have you primed symbol).

Example: To get y' type "y' followed by the Del-key (that deletes the closing double quote).

LucMeekes_0-1595321376977.png

The weird numeric result of the first c'= indicates a special situation. The second c'= is clear.

 

I can't do the symbolics, I'm limited to Express. But the symbolic processor handles undefined variables, so it will allow c' -> (the symbolic evaluation of c' ), interpret it as the derivative of c which, with c=3, yields 0.

 

Success!

Luc

Werner_E
25-Diamond I
(To:johncgh)

The apostrophe you get in MC15 when pressing Ctrl-F7 has a special meaning - derivative (prime symbol). But in MC15 this only applies to solve blocks with odesolve, otherwise the prime symbol is just seen as an ordinary character in the name of a variable and thats how it is used in your MC15 sheet.

In Prime this apostrophe has the meaning "derivative" throughout the whole sheet and as the derivative of a constant is zero, you see the zeros in the results.

The converter keeps the meaning "prime symbol" and that can be the cause of some problems.

 

But the problem shown in your pics where derivatives are used is a different one, I think. The symbolic acts differently in Prime compared to real Mathcad and this applies to the new symbolic introduced in Prime 6 as well as to the old one (which you still can switch back to in Prime 6).

 

There seems to be no easy solution other than changing the variables to true functions with argument(s).

 

Mathcad 15:

Werner_E_0-1595321978756.png

Prime:

Werner_E_2-1595322224840.png

 

Remark: To create a variable or function name with an apostrophe, you don't have to use any tricks in Prime, you can simply type it from the keyboard. Its not interpreted as prime symbol even though it looks the same.

Werner_E_0-1595322784597.png

 

BTW, Luc's example (the one with c:=3) doesn't work in Prime as he (and also me) expected:

Werner_E_0-1595323485862.png

 

 

 

 

johncgh
4-Participant
(To:Werner_E)

Thanks @LucMeekes  and @Werner_E 

 

I´ll attach both versions of the situation explained (MC15 and Prime 6).

 

I´ll check the alternative provided and test it if I can make it work.

I want to add, even changing to the old symbolic, I still have the same issue in Prime 6. 

Also I wanna add, if I change the variables to not use any apostrophes, if I do the derivate to that symbolic, it should give me the result I got in the MC15 versión?

Werner_E
25-Diamond I
(To:johncgh)


@johncgh wrote:

Thanks @LucMeekes  and @Werner_E 

 

I´ll attach both versions of the situation explained (MC15 and Prime 6).

 

I´ll check the alternative provided and test it if I can make it work.

I want to add, even changing to the old symbolic, I still have the same issue in Prime 6. 


As written above, the undesired behavior is the same, no matter if you use the old or the new symbolic engine - its a Prime "feature" -(

 


Also I wanna add, if I change the variables to not use any apostrophes, if I do the derivate to that symbolic, it should give me the result I got in the MC15 versión?

No, it doesn't. As written and shown above, Prime's symbolic evaluation seems to work differently. Look at the simple example  f:=x^2   I had shown.

Werner_E_0-1595337340457.png

I tend to call it a bug that d/dx  does not yield 2*x.  The result of the prime operator seems OK as Prime possibly can't tell wrt which variable the derivative should be taken and so it assumes x to be a function of that variable.

As shown above in real Mathcad d/dx f yields  2*x as we can expect.

 

I only had a quick look at your P6 sheet and I think you will have to turn every result which depends on variables into functions of those. E.g. T.0_1 is a function of theta1 and l1, etc.

Intermediate results like you variable Q (not a function) are OK as along as you turn expressions derived on them which you later use with derivatives into functions (like you did with T()).

 

 

Werner_E
25-Diamond I
(To:johncgh)

Addendum:

I just gave it a try with older versions of Prime and the symbolic evaluation works as expected in Prime 4 and Prime 5:

Werner_E_0-1595339193355.png

So it looks like its a newly introduced bug in Prime 6 (affecting both symbolic engines):

Werner_E_1-1595339345094.png

 

If somebody is willing going through the hassle of reporting that bug, there's a small chance for a fix in one of the forthcoming versions, I guess.

 

It would be worth a try to convert your Mathcad 15 sheet into a Prime 5 or Prime 4 sheet and give it a try with an older version of Prime. Unfortunately we can have installed multiple versions of Prime in parallel, but the converter will only convert to the newest version, so I am unable to create a Prime 5 (or 4) version of your MC15 sheet.

 

EDIT: Further investigations showed, that its (again) a new problem with Primes infamous auto-labeling "feature".

In the pic above both "x" are labeled "(-)" meaning "automatically" or "auto-detect". If the "x" in the expression "x^2" is manually labeled "variable", even Prime 6 is able to give us the symbolic result "2*x":

Werner_E_0-1595340311709.png

When I tried an integral instead of the derivative I noticed that Prime dealt with two different type of "x":

Werner_E_0-1595340975328.png

 

 

This means that your sheet may work as expected if you change every apostrophe to a manually typed one and label manually every variable you intend to take a derivative with respect to it as "variable".

That way it could be possible to avoid defining so many functions explicitly.

 

 

 

 

LucMeekes
23-Emerald III
(To:Werner_E)

Werner,

 

Here is the apostophes file converted to Prime 4

Try it out.

 

Success!
Luc

 

Werner_E
25-Diamond I
(To:LucMeekes)

It was worth a try, but unfortunately no success.

I opened your sheet in Prime 5 and it shows the very same results (all zeros).
I also changed the apostrophes to manually typed ones and labeled all three theta.i' as "variable" as I noticed (see my last post) that it seems to be a problem with Primes auto-labeling which obviously was changed from P5 to P6.

LucMeekes
23-Emerald III
(To:Werner_E)

"unfortunately no success"

Could be because I converted from Prime6 to Prime4 format, outside of Prime. That is, I hardly changed anything in the worksheet part of the .mcdx file.

Awkwardly enough, the forum did not accept the Prime4 file immediately after conversion. I got this irritating message that 'the file contents does not match the type". But Prime4 accepted the file, and after saving from there I was able to attach it succesfully to the forum message.
Of course there would be no chance that the forum software believes it is almighty and knows better than Prime itself what a Prime4 file should look like.

 

Luc

Werner_E
25-Diamond I
(To:LucMeekes)

As far as I found out its not something which has to do with the conversion process but with a change in Primes auto-labeling feature from Prime 5 to Prime 6.

See in my answer below a working worksheet.

 

According the "the file contents does not match the type" error you sure remember the times when the forum software won't accept a Mathcad file at all and then only from some people, depending what Mathcad version they had or how they installed it. Crazy! And I still believe that Lithium (now: Khoros) wasn't the best choice, but ..., alas, thats what we got!

Zipping the file would sure had done the job, too.

Werner_E
25-Diamond I
(To:johncgh)

Heureka!!

 

Now it works in Prime 6, too. It mainly was the problem with Primes auto-labeling.

 

In my simple example f:=x^2 it was only necessary to change the label of x in x^2 to "variable". But in your Jacobi matrix it was also necessary to change the label of the variables in the derivatives d/d... manually to "variable" and now it works.

Werner_E_0-1595342444838.png

Changes done:

1) Change all apostrophes (prime symbols) to manually typed apostrophes to avoid interpretation as derivative

2) Manually labeled all theta1', theta2', theta3' on the left hand side of an assignment and also in the Jacobi matrix in the derivative to "variable".

Step 2 is something you obviously would have to do with every variable you intend to derive after.

 

Step 1 is necessary because the Mathcad->Prime converter does not realize, that in MC15 the apostrophe is interpreted as prime symbol (derivative) only in solve blocks with odesolve and otherwise should be treated as a normal character of the variable name

Step 2 is necessary because of Primes very faulty auto-labeling feature, which quite often is more of a PITA than helpful (sometimes it can be very helpful, though).

 

Prime 6 worksheet attached.

 

 

Werner_E
25-Diamond I
(To:Werner_E)

One last remark:

In my answer above I worked from the Prime4 file which Luc had posted and it was necessary to manually label the variables in the Jacobi matrix, too.

 

Now I gave it a try from scratch and I converted your Mathcad 15 sheet to Prime 6 format and I noticed two things:

1) Its not necessary to change the apostrophes to manually typed ones - the converter seems to have done a good job and did not converted the apostrophes to prime symbols.

2) As in my simplified example its only necessary to manually set the label of the theta.i' variables when the expressions for omega.i_i are defined.

 

So I converted the sheet and set the label manually in three regions (yellow underlined in the attached worksheet). That's all that is needed to make the worksheet run. Guess the same applies to the Prime worksheet you posted.

 

Prime 6 worksheet attached.

 

Announcements

Top Tags