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

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

Translate the entire conversation x

Variable Setting

DDHH2001
8-Gravel

Variable Setting

DDHH2001_0-1748253040334.png

I tried to output the calculation result. The ideal result would be like: "ps = k tp + b "according to the "IF processing". The "tp" here actually relates to the time, but right now I just want the result to be like the form I mentioned above. In other word, I think and hope the "tp" is just a symbol in my ideal output result.

So I tried to set it as a  "key word" or "constant" by setting the labels but found nothing helpful. Can any solution help me with this? Many thanks advanced !

Files attached.

ACCEPTED SOLUTION

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

If you expect a symbolic result (as tp is an undefined variable) you have to use symbolic evaluation and not numeric (the normal equal sign).

Werner_E_0-1748263057220.png

Is it this you are looking for?  No need the re-label tp as Keyword or anything else.

Number of decimals is per default 20, You can limit this number using the "float" keyword. But keep in mind that doing so also affect the precision of the calculation, not just the display of the result.

 

Symbolic evaluation:

Werner_E_1-1748263261630.png

 

 

View solution in original post

12 REPLIES 12

MartinHanak_0-1748255582980.png

 


Martin Hanák

Hi !

I mean, this is where the  problem occurs. I try to set the "tp" as  symbol, but it keeps telling me that the "tp" is undefined and to recheck the lable that I set.

I change the definition btw, two variables are needed in this function I defined actually.

DDHH2001_0-1748259285828.png

 

I do a little modification. Instead of outputting the ideal equation form that I need, I try to calculate the coefficients "k" and "b". But there is a new problem occurs indicated that "This value must be a function".😥

Werner_E
25-Diamond I
(To:DDHH2001)

If you expect a symbolic result (as tp is an undefined variable) you have to use symbolic evaluation and not numeric (the normal equal sign).

Werner_E_0-1748263057220.png

Is it this you are looking for?  No need the re-label tp as Keyword or anything else.

Number of decimals is per default 20, You can limit this number using the "float" keyword. But keep in mind that doing so also affect the precision of the calculation, not just the display of the result.

 

Symbolic evaluation:

Werner_E_1-1748263261630.png

 

 

THANKS! It does work! 

Oh by the way, would you help me with another problem that I post on my reply above? About the error "This value must be a function". It happens when I change the ξ from 0.5 to 0.85(on the first page of the sheet), which respectively relates to the case 4 in the function "ps(tp)". Similar things happen when the coefficient ξ is changed to 0.15, as case 2. 

I have checked the relative post about "This value must be a function" in the community but found no error similar to mine. It seems like a small error but I just find no clue. Is it because I didn't complete all the judging statement that made the "if-else if" statement not work? Or because I make a separate branch in both case 2 and case 4? Or other small mistake that I don't notice just like the symbolic evaluation problem you just help me out.

Many thanks advanced! You have help me twice on this subject!

Werner_E
25-Diamond I
(To:DDHH2001)

When xi=0.85 you fall into case=4 and here you wrote

Werner_E_0-1748269163666.png

There is no multiplication between Lm and the opening parentheses and so its interpreted as a function call. And because Lm is not a function but a simple variable, the error is thrown.

You have the same error in the calculations for case=2, too.

Add the multiplication operator and the function works as it should

Werner_E_1-1748269401251.png

Its a pity that the Error Tracing (calculation tab) is flagging the whole function body and not the position where the error actually occurs. So its rather useless in this case.

 

 

Attached is the newest version edited according to your correction.

Werner_E
25-Diamond I
(To:DDHH2001)


@DDHH2001 wrote:

Attached is the newest version edited according to your correction.


My answer above still applies 😉

Missing multiplication signs.

You are UNBELIEVABLE amazing! Throughout this project, you helped a rookie for three times!  I wouldn't imagine how terribly crazy I will be without your help of pointing out the missing of multiplication sign.

I think this may be accounted for my latest learning of another software, Mathematica, in which a multiplication can be replaced by a blank. These coefficients I write in the sheet of Mathcad are calculated in MMA. I mix them up.

Anyhow, thank you so so so much for your meticulous help! You are blessed and have a nice day!

Werner_E
25-Diamond I
(To:DDHH2001)


Mathematica, in which a multiplication can be replaced by a blank.

But in Prime you had not typed a space but rather Lm immediately followed by the parenthesis. If you would have typed a space, the name Lm would have been highlighted and typing the opening parenthesis would have just put the variable name in parenthesis -> (Lm)

 

Actually a multiplication sign can be omitted in Mathcad if the first factor is a number like in 3 x or 3 (x+5). No need to type a space.

But if the first factor is a name, you must tell Prime if you mean the multiplication  f*(x+5) or the function call f(x+5).
Prime is not clever enough to trace back to look whether f is a scalar or a function. And if you think of symbolic evaluation, Prime even could not trace back if f would be an undefined symbol.
And yes, Prime could interpret a space as a multiplication, but the developers had decided that using the space should have a different meaning and so its used rather for editing an expression. If you start a region by typing a name and follow by a space, the region is turned into a text region. This was the behaviour in real old Mathcad and its often is more convenient to use than to explicitly insert a text region by pressing Ctrl+T.

Prime knows implicit multiplications (it automatically uses it when you type 3 x) and you also can use it manually. Its called "scaling operator" by PTC and can be inserted via the operator menu or by using the keyboard shortcut Ctrl+Shift+U. It shows as a small circle as long as the cursor is within the region and is invisible (just a small space) otherwise.

That way you can make f*(x+5) look like f (x+5) but you still have to manually apply the scaling operator to tell Prime that you mean a multiplication.

Understood. I am enlightened!😀

Announcements


Top Tags