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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

symbolic substitutions - who could help

WalterSchrabmai
7-Bedrock

symbolic substitutions - who could help

Hi 

I have a big formula where I would like to make 3 symb substitutions. But I get an error.

I would need this formula to minerr it to this 3 new Values and not to the k-values.

I would be happy if someone could find a solution. THANKS

I use PRIME 6.0

 

1 ACCEPTED SOLUTION

Accepted Solutions

Thank you very much, for your sophisicated advice. But I do not really know, how I could break this formula in much more simplier form. Anyway I did also the manuall subsitution of the analytic solution at all.

It is really bad from ptc that they will discontinue the muPAD, as it is much better, as you said.

 

Merry X-MAs!

View solution in original post

17 REPLIES 17

Here is my complete Work, Thanks for any ideas and advices.

That sure is a big formula. Did you type it in by hand? I don't see it being derived, because it's the very first occurrence of u3 in your file.

If it were the result of symbolic operations, Prime would probably have complained about the size of the result.

 

Anyway. Considering that there are "exp()" in there, instead of "e^" I think you are using the new symbolic processor, instead of MuPad. Did you already try using the alternative symbolic processor (=MuPad)?

 

Success!

Luc

 

The problem is not the "substitute" command. The symbolic engine can't handle that expression even if you just try to evaluate it symbolically without further symbolic modifications. It runs into that "unknown error"  and it doesn't make any difference which of the two symbolic engines available in Prime 6 you chose.

The reason may be due to Primes infamous autolabeling or its simply because the expression is far too large for the interface to hand it over to the symbolic engine. To find out if its the latter you may try to shorten the expression step by step by deleting parts of it up to the point where the symbolic evaluation starts to work.

I tried a numeric evaluation just to rule out that it is a mistake due to incorrect or incomplete bracketing (you have a lot of unnecessary parentheses). Numeric eval works OK. so this seems not to be the problem.

Werner_E_0-1608770492781.png

You may try to split the function into a couple of smaller auxiliary functions. Here is a simplified example

 

Werner_E_0-1608771254990.png

 

Dear Werner_E thanks a lot. I did so, as you also can see it in my complete works.

But unfortunately I do get different result-vectors by the same SSE/deg_of_Freedom.

My Idea is that the fitting with the k-values is more stable and more robust than the fitting by the V1,V2,t21 and clearance. 

I am thankful for any useful advices.

Edit: I also tried to substitute the analy. solution of the ODE with the pragmatical relationships. But without success.

Edit: I found the bug: I missed the factor a in N2

image.png

Even I could minerr and optimize the analytical solution of the ODE the substitute-problem still exists:

Here I separated the substitute problem in the other way - and also no success.

 

image.png

The final combined function still is too large for the symbolic. You would have to apply substitute to the smaller function and then combine them.

The new function sure should be defined as being dependent on the new variables introduced and you may get into troubles (not sure about that) as you already defined function with the same names (k01, k21 and k12).

 

BTW, I am absolutely not sure that there is a limit of the size of function you are allowed to define an use symbolically. Its just my best guess. There must be an interface routine written in Prime which takes an expression of the worksheet and hands it over to the symbolic engine and it may be that the programmers could not image that someone would type in an expression that large 😉

It may also be a bug on the symbolic engine, but then why does it happen with both available engines?

Of course you can open a support ticket and report the problem to PTC, but I wouldn't hold my breath waiting for a fix.

 

Thanks a lot Werner_E for making this clear. 

Merry X-Mas!

Dear Werner,

I tried this here by step-by-step - but lambdak2 is not correct substituted by t21. WHY?image.png

I really do not know why the automatic subsitute does not work. I have done it manually and here is the final working sheet. 

OK, here the fault is the infamous auto-label "feature" of Prime.

I clicked "t21" (the one the arrow points to) and changed its label from "Variable" to "Automatic (-)" and then the substitution worked OK.

Auto-labelling  quite often fails when used in conjunction with symbolic calculations.

Werner_E_0-1608845102928.png

 

BTW, in the sheet you posted earlier you used x2s and y2s with just two arguments, but the functions were defined with four (and only one is obsolete).

EDIT: In your new sheet you fixed that for y2s, but the error is still present for x2s!

 

In the attached sheet I show how you can easily create your function "model_analyX2" dependent on t, vol1, k01, k12 and k21 using the substitution you had in mind.

 

 

 

Dear Werner,

thanks a lot - I checked your sheet and works fine: Great done!

 

Moreover I saw you had Legacy Symb Processor enabled, hadn`t you?

And in GERMAN the Lableing is BESCHRIFTUNG, is that correct?

I clicked on the t21 and the Labeling was AUTOMATIC. It is still strange to me.

Thanks a lot for your great help.

Walter

 

Ich habe mit beiden Symbol-Kernen rumgespielt und da scheint eben zuletzt Mupad eingestellt gewesen zu sein. Hoffentlich funktonierts mit dem schwächeren neuen System auch.

 

Und ja, in der deutschen Version heißt das "Beschriftung".

 

Wie schon gesagt, in Verbindung mit symbolischen Auswertungen funktioniert Primes automatisches Setzen dieser "Beschriftung" nicht sonderlich gut. Die Symbolik versteht offenbar eine Variable, die auf "automatic" gestellt ist und eine, die die Beschriftung "Varaible" trägt, als zwei verschiedene Variablen. Deshalb hat die Substitution nicht geklappt. Es hätte vermutlich auch funktioniert, wenn man die "t21" im substitute Befehl auf "auto" gestellt hätte - Hauptsache überall das gleiche Label.

 

Dear Werner, 

I have beautified the sheet and now it does not work anymore. Why? Moreover it sheems that I have to use the legacy symb module. Would you be so kind and could you tell me where here the error is?

 

image.png

 

EDIT: It works when I do write the fn explicit in the substitute part.

image.png

 

Strange or buggy the Prime 6.0 !

Again you ran into a problem with the variable labels!

As the substitution seemed to work OK I guessed, that again some variable were labelled differently and so I tried to label ALL variable seen in the definition of the function "partk1X1" from "auto" to "variable" and it worked OK.

Later I noticed that originally all variables were labelled "auto" except for t21. So the easier solution is to relabel t21 from "variable" to "automatic":

Werner_E_0-1608901645260.png

The effect you experienced is similar to the simplified example below. Instead of the unknown "yy" you could write "y" but change its label from "(-)" (automatic) to "variable".

y will still remain unsubstituted and so is an undefined variable in the definition of f2(alpha, beta).

Werner_E_1-1608901841315.png

 

EDIT: And yes, it looks like it only works OK with muPad (the legacy symbolic engine). The new engine again yields the unkown error we had seen in your first sheet. You may give it a try to split the functions in even smaller parts - maybe the new engine will be happy then, too. Otherwise chances are that your sheet won't work in future versions of Prime as sooner or later PTC will remove muPad from Prime in order to save the license fees they have to pay to Mathworks. The new engine is a free one and, as we often have seen in in the forum, is also less capable in various respects.

 

 

 

Thank you very much, for your sophisicated advice. But I do not really know, how I could break this formula in much more simplier form. Anyway I did also the manuall subsitution of the analytic solution at all.

It is really bad from ptc that they will discontinue the muPAD, as it is much better, as you said.

 

Merry X-MAs!

Concerning further splitting - You may try to define the various powers with base and exponent into separate functions.

I also wonder why you don't define your various function dependent on the k-values right from the beginning wherever possible. That way you would not have to rely on symbolic substitution later.

Yes, Werner you are right. But generally spoken the functions depending on clearance, vol1 and vol2 are more systemrelevant and so this is done before. But the ODE is done with the k`s, so I just wanted to compare the results of the ODE with the analytic solution directly.

 

Many thanks for your help.

Top Tags