Using If statment function and variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Using If statment function and variable
I'm trying to write a program in Mathcad, but stuck on this step highlighted below.
How to insert the second line in the bracket as show below for return function, thanks
Solved! Go to Solution.
- Labels:
-
Programming
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi,
Need to create a matrix in the return brackets to return a matrix of four results This works for Mathcad and Prime
Cheers
Terry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi,
Need to create a matrix in the return brackets to return a matrix of four results This works for Mathcad and Prime
Cheers
Terry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
The expression after "return" is a 2x2 matrix.
I guess that you are trying to duplicate in Prime what was originally done in real Mathcad (legacy Mathcad, version 15 or below).
In Mathcad 15 (and below) a matrix is displayed in round parenthesis rather than in square brackets as in Prime.
Terry showed how it looks in Prime - the parenthesis around the matrix aren't necessary but don't do any harm either.
EDIT: I just noticed that Terry did not use the programmed "return" statement but rather typed "return" and so his "return" is interpreted as variable or function name (you can tell that because its set in italic typeface). So that's why he needed the function parameter parentheses to be able to follow with the matrix.
But what the Mathcad 15 snippet actually shows is rather most likely a return-statement, not a function, as you had mistakenly written!
If it would be a function, we should see double parenthesis in the Mathcad code snippet, one pair as parameter parentheses and the other to indicate the matrix.
So either use the "return" statement from the menu
or press the keyboard shortcut or you simply type "return" (without the quotes) and follow immediately by pressing Ctrl-J which turns the text into the appropriate program statement.
Ctrl-J is a very valuable and convenient improvement in Prime (especially as Prime lacks the floating palettes of Mathcad).
So the code snippet should look like this in Prime
Note that "return" statement is set in upright typeface (similar to the "if" statement), not in italic like variable or function names.
Guess you know how to create a matrix (keyboard short Ctrl-M, add columns or rows via Shift-Space or Shift-Enter).
BTW, it would not be necessary to assign F the value 1 and then use it in the matrix. You could as well omit the assignment F <-- 1 and simply type "1" instead of "F" in the matrix. After all the program is terminated by the "return" statement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Completed the problem, but having issues with execution of the solution. This problem is to find the area of a cross-flow heat exchange
It's showing I've not assigned LMTD, but it's not correct.
Please review and comment where I'm going wrong.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi,
Value of Cunmix is not defined? Made a guess?
Removed brackets from around matrix in first return statement.
In equations for NTUCross Flow in both if statements corrected a c that should be C?
Changed all instances of LMTDcorrected to LMTDCorrected with a capitol C
Note case of Cmix = Cunmix is not covered?
Cheers
Terry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Terry,
Based on your advice I was able to resolve the errors. Now, stuck on the final steps can some review and provide correction to get the values, thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Is there any other method to complete this step, not able to complete the next answers in the equation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi,
Can you be more specific about what you are after?
Cheers
Terry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi All,
Thank you all was able to resolve the issues in the equation and get the correct values.
I've a follow up question; can I embed or hid the below steps in another sheet and call it when required. Please provide your comments, thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi,
In a worksheet go to menu Input/Output | PTC Mathcad Worksheets | Include Worksheet. A dialog pops up where you can select a different worksheet to include.
Cheers
Terry
