Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

** Community Tip** - You can Bookmark boards, posts or articles that you'd like to access again easily!
X

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Apr 16, 2024
01:39 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Apr 16, 2024
01:39 PM

"Solve" command turns for ever

In this case I want to allocate a result of substitution to Eq1,

It seems to works for the substitution but then Eq1 seems undefined. What happens?

Then it might be the reason why the 2nd substitution is endless.

However, when i try to make 2 substitution in the same execution command, it is endless too.

What happens ? Is there a relation between those 2 cases ?

Option calculation for constant unit with symobilc math is set.

PTC MathCAD prime 9.0.0.0.0

Labels:

21 REPLIES 21

Apr 16, 2024
03:07 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Apr 16, 2024
03:07 PM

You try to evaluate Eq1 numerically (the normal equal sign). Here Prime throws an error because of the derivative of the unknown and probably undefined function Theta.

Numeric evaluation will only return numeric values, not generic functions or their derivatives.

Not sure what may cause the "endless" calculation. Its hard to impossible to debug just a picture ...

Apr 17, 2024
03:20 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Apr 17, 2024
03:20 AM

Thank you for your answer.

I now try another approach:

1-define completely the symbolic formula

2- then i will define numerical values of known parameters

I expect so to see the formula with some numerical values.

In the following formula, the result seems unknown, as I would have expect on 2nd line to have the same than 1st line.

Apr 17, 2024
05:52 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Apr 17, 2024
05:52 AM

You must realize the difference between numeric evaluation (=) and symbolic evaluation (->)

Here some remarks using a simpler example

BTW, even in the last approach a derivative won't work (IMHO it should, but maybe its because Prime would have to do the numeric derivation at definition time which it can't because the function is unknown at that time?)

nor that way

Apr 17, 2024
06:09 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Apr 17, 2024
06:09 AM

Hmm, one more thing broken.

Mathcad 11 does:

(But would not allow:

)

Luc

Apr 17, 2024
06:35 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Apr 17, 2024
06:35 AM

It look like its a new Prime 10 bug!

It still works OK in Prime 9

Prime 9:

Prime 10:

Error message means "A function or variable name is needed".

I can see no meaningful reason why f2 should fail but f1 would work OK.

Apr 20, 2024
11:17 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Apr 20, 2024
11:17 AM

Can You try in prime 10 this: f2():=a+f1(), and then evaluating f2 function to see If in this way it works?

Apr 20, 2024
11:52 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Apr 20, 2024
11:52 AM

@Cornel wrote:

Yes, that's a workaround but it should not be necessary to do so.

I still consider the behaviour in Prime 10 to be a newly introduced bug which should be fixed by PTC!

Fortunately this bug seems to not affect the main question in this thread.

Latest status is that there are unit problems. See https://community.ptc.com/t5/Mathcad/quot-Solve-quot-command-turns-for-ever/m-p/944882/highlight/true#M211387

Apr 17, 2024
07:41 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Apr 17, 2024
07:41 AM

example are intersting, but it is not exactly the need.

From a complex symbolic equation, i need to fill with numerical data some fixed parameters,

but i would like to keep the symbolic formula which representation will be simplified with some numerical values.

At the end, I need to see better which are preponderant terms of the formula and understand better how it behaves.

Apr 17, 2024
08:01 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Apr 17, 2024
08:01 AM

Again - any expressions. either typed in or derived by a symbolic operation like "solve" is static in the sense, that variables defined later will not be replaced in that expression if you evaluate it.

Only way out is to define it as a function.

As already shown you may define variables and functions but make them inaccessible for the symbolic engine.

That way you can make an expression evaluate numerically using the numeric evaluation (=) and still have the symbolic result at hand if you evaluate it symbolically.

Apr 17, 2024
01:23 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Apr 17, 2024
01:23 PM

"At the end, I need to see better which are preponderant terms of the formula and understand better how it behaves."

Exactly for this purpose it is MUCH better if you define a function with parameters. Elaborating on Werner's example with:

you can have the numerical result:

or another one:

AND you can see how a specific variable is handled, such as a:

or b:

And if you do NOT clear the symbolic for f:

Success!

Luc

Apr 18, 2024
06:37 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Apr 18, 2024
06:37 AM

Thank you for your proposal.

I am currently trying it but facing a simple issue to build the final formula:

Apr 18, 2024
06:51 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Apr 18, 2024
06:51 AM

In your example the value of k would not only depend on a1, a2, b1 and b2, but also on the value given by function f. I call this value F in the screenshot below.

You could do as follows:

Apr 18, 2024
10:43 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Apr 18, 2024
10:43 AM

again thank you very much for your answer

I try to follow your example, but very quickly it says there is no solution, although I am sure there is one

Apr 18, 2024
12:10 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Apr 18, 2024
12:10 PM

Don't ask me why, but Prime fails because of the function Load.axial in the parameter list.

Maybe because the solutions does not directly depend on that function, but the logic behind that failure is not really clear to me at the moment.

But anyway, once you delete Load.axial from the parameter list of your function get_LoadPinch..., Prime is happy and returns a result:

EDIT: OK, I guess a have a logical explanation for Primes failing when you apply the function name as a parameter. Doing so would you enable to provide different functions Load.axial. But Prime tries right ahead to find a solution even though now the function Load.axial is unknown. But this function has the variable you want to solve for as an argument and because Prime does not know what the function looks like its quite clear that it can't give a symbolic solution.

We would need some kind of late evaluation which triggers the symbolics only when the function is called with a specific function Load.axial as its argument, but this is not an option in Prime.

Here a simplified example

Apr 18, 2024
03:05 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Apr 18, 2024
03:05 PM

Interesting point, thanks a lot.

Now I come almost to the end.

I have my symbolic formula.

I define some numerical values

I would like to get 'simplfied' formula where all calculation that be done and simplified appear done

and ideally with a factor or the symbol "I"

What should be used as keywords to get a kind of clean and understandable equation ?

Apr 18, 2024
03:42 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Apr 18, 2024
03:42 PM

The problem here seems that you still have undefined variables in the expression (probably only I) and so you have to use the symbolic evaluation.

On the other hand you run into the inability of the symbolics to deal with units and so it can't simplify expression with different units, which actually may cancel or can be collected.

Can you post the sheet so we can see if we could find a workaround?

You could try to (re)define some units at the top of the sheet - maybe in a collapsed region.

E.g. the symbolics does not know about "deg", but if you define deg:=pi/180 (deg should be labelled as unit), the symbolics will numerically evaluate the cos(20 deg).

Same applies to lengths units. When you define mm:=10^-3 m (mm again should be labeled as unit), the symbolics will simplify all lengths to meter. If you define m := 10^3 mm it will default to mm.

Doing so may help Prime to arrive at a simpler expression. You may also use the modifier "float, 8" to limit the precison to 8 significant digits (rather than the default 20). But you have to be aware that this not only effects the display but also the precision of the whole calculation. So the "float" modifier should be used with care.

Instead of defining mm:=10^-3 m at the top of the sheet you may also use "substitute, mm=10^-3 m" as a modifier in the symbolic evaluation. But you would have to write this in every symbolic evaluation where you'd like it to be respected, so I guess the assignment in front may be the better solution.

Apr 19, 2024
03:17 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Apr 19, 2024
03:17 AM

Here the complete sheet,

it seems "subsitute" does not help, nor the definiton of "mm:=10^-3m".

You will at the bottom the final "simplified " formula which is expected.

I hope there is a way as we are so close to the end (at least I thing so).

Apr 19, 2024
07:30 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Apr 19, 2024
07:30 AM

I had a quick look but actually I am lost as of the large expressions because of your huge long variable names.

Maybe I'll have a second look tomorrow if times allows.

EDIT:

I had a quick second look and moved the unit (re)definitions to the front of the sheet, where they belong (in front of any variable definition) and also labeled then as units (see the bold blue type face).

I also added gm := 10^-3 kg

See attached file

If you need more unit simplification you have to tell the symbolics so likewise.

The last expression yields something like sin(function) and I tried to find out where this may stem from but I got completely lost in your (for me) much too large expressions with all those lengthy variable and function names. All I could see is that this strange expression also occurs in the definition of your function get_LoadPinch but I was not able to trace any further.

I guess I can't be of help anymore here...

EDIT2: OK, I couldn't resist 😉

Found the root of the problem:

Here some thoughts which may help tiding up the worksheet, making the expression a bit shorter and maybe better readable:

You may of course combine the methods, create a function with two or three vector arguments, etc. - whatever seems appropriate.

Apr 20, 2024
11:07 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Apr 20, 2024
11:07 AM

After fixing the aforementioned problem with gamma we get a symbolic result, but there are one or two unit problems you'll have to fix!

Prime 9 sheet attached

Apr 20, 2024
01:45 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Apr 20, 2024
01:45 PM

Great! thank you so much!

I am new to Prime but finding the error seems a litttle complex,

the case of the 3 arguments of Gamma was not easy to find as not clue from Prime.

Anyway thank you for your patience.

Now I need to find this unit problem.

Apr 20, 2024
04:03 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Apr 20, 2024
04:03 PM

@FB_10651590 wrote:

Great! thank you so much!

I am new to Prime but finding the error seems a litttle complex,

the case of the 3 arguments of Gamma was not easy to find as not clue from Prime.

Anyway thank you for your patience.

Now I need to find this unit problem.

It wasn't easy for me, too because of the large expressions and variable names.

Prime's symbolics can't give any clue because it doesn't see it as an error.

If you define a function and evaluate just the function name, all information you will get is that its a function.

This is exactly what happened when you used just the function name gamma.

Only when you provide function arguments the symbolic will evaluate the function using the definition

One idea to make the expressions in your sheet a bit smaller would be to make all functions only dependent on the few arguments you need.

It looks like you just want the result be dependent on the four arguments I, Acc.Mot, Fr.Axial and K0.

So you could define the other variables at the top and then define all functions only dependent on those four variables.

According the unit mismatch I can't help. Its either in the formulas you used or in the variable definition (or both). Good luck!