Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
Hi, I'm having trouble finding the value of a variable using symbolic operations. Let me explain:
I want to find the variable (theta) of a symbolic function within a range of values
I'm using Mathcad 11
Solved! Go to Solution.
Prime's symbolic engine is not as capable as you would like it to be.
It simply is not capable enough to solve your equation the way its defined and that has nothing to do with the "assume" modifier (which is ignored by the symbolics ever so often anyway).
It also can't solve the equation if you try to do it before defining the variables (which would be a justification for using the symbolics and not a numeric method) and it can't solve it after the variable definitions if the variables are defined with units (even though your equation only requires to cancel unit "m" on both sides).
It also does not help to turn on the calculation option "Units/Constants in Symbolics" (which always should be done anyway).
But Prime is at least capable to solve the equation if you remove the units yourself manually:
But I fully agree with Alan that symbolic "solve" is the wrong tool use here. It's not just because your problem simply doesn't require a symbolic solution, but also because the symbolic in Prime is not capable enough.
For example is 1.4575 the only solution the symbolics ever will find. It is unable to find, let's say, a solutions greater than 2:
let alone all solutions
Alan already had shown the way to go. For finding a numerical solution you should use a numerical method. In Prime, this is either a solve block with “find,” the ‘root’ function with a guess value, or the “root” function with an interval provided..
Alan just made a sign error when defining the function f which is the reason his function has no solution in the interval [1; 2]
When providing an interval the interval limits must be chosen carefully, as the function values at these points must have different signs.
To get the solution 4.2..., the interval [4; 5] is therefore unsuitable, but using [4; 4.5] works.
If you use the "root" function with a guess, there is no guarantee that the solution found is always near the guess value
When using a solve block with "find" you also have to provide a guess. A solve block takes up more space and looks quite ugly in Prime, but it has the advantage that you can use the equation as it is and furthermore you can add constraints like 1<=theta<2 which may (!, no guarantee) give you the desired solution even if you provide an inappropriate guess value
You can see from the graphs below that there is no solution in the range from 1 to 2.
Also, there is little point in using a symbolic solver for a purely numerical solution.
Alan
Prime's symbolic engine is not as capable as you would like it to be.
It simply is not capable enough to solve your equation the way its defined and that has nothing to do with the "assume" modifier (which is ignored by the symbolics ever so often anyway).
It also can't solve the equation if you try to do it before defining the variables (which would be a justification for using the symbolics and not a numeric method) and it can't solve it after the variable definitions if the variables are defined with units (even though your equation only requires to cancel unit "m" on both sides).
It also does not help to turn on the calculation option "Units/Constants in Symbolics" (which always should be done anyway).
But Prime is at least capable to solve the equation if you remove the units yourself manually:
But I fully agree with Alan that symbolic "solve" is the wrong tool use here. It's not just because your problem simply doesn't require a symbolic solution, but also because the symbolic in Prime is not capable enough.
For example is 1.4575 the only solution the symbolics ever will find. It is unable to find, let's say, a solutions greater than 2:
let alone all solutions
Alan already had shown the way to go. For finding a numerical solution you should use a numerical method. In Prime, this is either a solve block with “find,” the ‘root’ function with a guess value, or the “root” function with an interval provided..
Alan just made a sign error when defining the function f which is the reason his function has no solution in the interval [1; 2]
When providing an interval the interval limits must be chosen carefully, as the function values at these points must have different signs.
To get the solution 4.2..., the interval [4; 5] is therefore unsuitable, but using [4; 4.5] works.
If you use the "root" function with a guess, there is no guarantee that the solution found is always near the guess value
When using a solve block with "find" you also have to provide a guess. A solve block takes up more space and looks quite ugly in Prime, but it has the advantage that you can use the equation as it is and furthermore you can add constraints like 1<=theta<2 which may (!, no guarantee) give you the desired solution even if you provide an inappropriate guess value
1.-In example 01, I perform this symbolic operation with its units, and the Prime program solves it.
I believe this is because in this example there is only one variable, D, that needs to be found.
2.-In example 02, I perform this symbolic operation and it shows me the error.
3.0 I should add to Werner_E's answer that the units can be turned off using the SIUnitsOf(e) and SIUnitsOf(R) functions.
Spoiler?? Why?
And which "question" are you referring to? I can see no question in the picture you post.
Furthermore you should be very careful when using the "float" modifier. Its not just for display but it affects the precision of the whole calculation which is done just with rounded values!
1.-In example 01, I perform this symbolic operation with its units, and the Prime program solves it.
I believe this is because in this example there is only one variable, D, that needs to be found.
2.-In example 02, I perform this symbolic operation and it shows me the error.
3.0 I should add to Werner_E's answer that the units can be turned off using the SIUnitsOf(e) and SIUnitsOf(R) functions.
???
As far as I can see that's exactly the same you already posted more than an hour before as a "spoiler".
however, for this example, I wanted to find the value using a symbolic operation, which led me to the following question:
I still can't see any question?????
BTW, the reason that Prime could solve your first equation is not because it only contains one variable or because this variable only occurs once in the equation. The reason is that this equation is a mathematical very simple equation that does not overwhelm Primes' limited capabilities.
Prime is clearly hopelessly overstretched with the second equation and the units.
The third one with the variable still inside of trigonometric functions but with stripped units is too difficult for Prime to solve completely and exact. It switches into float mode automatically and refuses to deliver any other solution than the one specific you show.
Her a simple example:
Prime is able to provide exact symbolic solutions and offers an (arbitrary ?) selection of three solutions out from the infinite number of solutions.
We can limit the range for x using "assume"
and we also can Prime talk into returning an expression for all possible solutions
The result looks ugly, but is correct. Older Mathcad versions did a better job here:
But as soon as we apply a small change, the equation gets too complicated for Prime and its not capable any more to find a symbolic solution. It switches into float mode, seems to apply some numeric approximation algorithm, ignores the "assume" modifier and of course is not able to provide an expression for all solutions. It looks like the approximation algorithm used uses always the same initial value and so comes up with the very same solution (here: two solutions) no matter which modifiers are applied.
The exact solutions for this equation have to be found by other means and are seen here
Uncle Wolfram is able to come up with the correct solutions:
"Alan just made a sign error when defining the function f ..."
Oops! Apologies, that was careless!
Alan
