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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Pb to allocate a result from symblic Solve to a variable

FB_10651590
4-Participant

Pb to allocate a result from symblic Solve to a variable

Hello

 

I am want to use Mathcad to build  a mathematical model from several  physical formulas and later on substitute either numerical values either lower formulas.

 

The 1st difficulty I meet  is that I would expect hereafter to get numericla result in the variable JSyst. Currently the error is "undefined variable".

 

Another strange thing is the numerical resuls from the Solve command is not combining the unit.

 

Is there a common explanation ?

 

2024-04-16_14h52_38.pngPTC Mathcad prime 9.0.0.0

1 ACCEPTED SOLUTION

Accepted Solutions

You have to know that the symbolics does not understand anything about units. It does not know that 1cm=10mm or the like. So it treats each unit as an unknown variable and therefore can't simplify them.

Checking "Units/Constants in symbolics" is a good idea and you should do it. The symbolics still don't know anything about units, but at least Prime labels these units in the symbolic result as being a unit (you can see that kg, mm, etc. is now shown in bold and blue) and therefore the native numeric engine in Prime can numerically evaluate the variable and of course it simplifies the units as well:

Werner_E_0-1713275817752.png

 

I would suggest other approaches:

1) You may turn the symbolic solve result into a function of the involved variables. That way you could easily compare evaluation with different input values side by side.

Werner_E_1-1713276151959.png

 

2) If you are only interested in a numerical result, you may consider to avoid the symbolics altogether a use one of Primes numeric methods for solving an equation. You have the choice between a solve block with "find" or using the "root" function. The root function could be used in two flavors - either by providing a guess value or by providing an appropriate lower and upper limit for the variable you want to solve for.

Here is the last mentioned method - root-function and providing a range from 0 gm cm^2 to 500 gm cm^2.

I had to get rid of the derivative of theta(t) which cancels anyway and also had to get all expressions to one side of the equation because "root" will not solve equations but rather looks for the zero of a function:

Werner_E_2-1713276600749.png

 

Prime 9 worksheet attached

View solution in original post

6 REPLIES 6

 

Easy solution here.  On the Calculation tab/Calculation options, turn on Units/Constants in Symbolics.

RantEng_0-1713273362844.png

 

Bob

 

FB_10651590
4-Participant
(To:RantEng)

Thank you for your prompt answer.

 

But this does change anything.

 

1- I wonder if the units are well recognized.

2- Still JSyst appears undefined ???

LucMeekes
23-Emerald III
(To:FB_10651590)

The "Units in constants/symbols" works sometimes, that is, not always.

 

If you want to use symbolics, then work symbolically only.

If you want to get numerical data using symbolical definitions, make them as functions. So define

J.Syst(J.Mot, J.Spdle, ....) :=

Then you  can call it with the numerical data.

 

Success!
Luc

 

Sorry about that.  I should have said to recalculate the document after making the change.  When I did that on your document, JSyst was defined.

 

Bob

You have to know that the symbolics does not understand anything about units. It does not know that 1cm=10mm or the like. So it treats each unit as an unknown variable and therefore can't simplify them.

Checking "Units/Constants in symbolics" is a good idea and you should do it. The symbolics still don't know anything about units, but at least Prime labels these units in the symbolic result as being a unit (you can see that kg, mm, etc. is now shown in bold and blue) and therefore the native numeric engine in Prime can numerically evaluate the variable and of course it simplifies the units as well:

Werner_E_0-1713275817752.png

 

I would suggest other approaches:

1) You may turn the symbolic solve result into a function of the involved variables. That way you could easily compare evaluation with different input values side by side.

Werner_E_1-1713276151959.png

 

2) If you are only interested in a numerical result, you may consider to avoid the symbolics altogether a use one of Primes numeric methods for solving an equation. You have the choice between a solve block with "find" or using the "root" function. The root function could be used in two flavors - either by providing a guess value or by providing an appropriate lower and upper limit for the variable you want to solve for.

Here is the last mentioned method - root-function and providing a range from 0 gm cm^2 to 500 gm cm^2.

I had to get rid of the derivative of theta(t) which cancels anyway and also had to get all expressions to one side of the equation because "root" will not solve equations but rather looks for the zero of a function:

Werner_E_2-1713276600749.png

 

Prime 9 worksheet attached

Top Tags