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

Solve for a variable in an equation but getting an error?

SFares
11-Garnet

Solve for a variable in an equation but getting an error?

Hello,

please scroll down in my attached sheet to the big red arrow where the error is . Unless i did something wrong, this method sometines works and some times i get an error . Not sure what the issue is. All variables are defined or calculated right above the equation. Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
AlanStevens
15-Moonstone
(To:SFares)

1. Third term in "solve" had different units from the others. 2. Symbolic solve doesn't understand units anyway, so use Given ... Find. See attached.

Alan

View solution in original post

6 REPLIES 6
Werner_E
24-Ruby IV
(To:SFares)

Over 1 MB necessary for the question? Guess the file can condensed to 10% by deleting the pictures. We sure don't need them to deal with the problem.

P.S.: Haven't looked, but I guess you are paying the price for extensive using symbolics now.

SFares
11-Garnet
(To:Werner_E)

Sorry Werner, i thoughted i deleted them all. but some were hidden in the collapsed areas

AlanStevens
15-Moonstone
(To:SFares)

1. Third term in "solve" had different units from the others. 2. Symbolic solve doesn't understand units anyway, so use Given ... Find. See attached.

Alan

View solution in original post

Thank you Alan!

Werner_E
24-Ruby IV
(To:SFares)

The problem is indeed the use of the symbolics in combination with units and conditionals.

When using the symbolic solve Mathcad will trace all variables used back as far as possible up to their original definition. In case of some of your variables (like P.u_t6) Mathcad will end up at an if statement (in case of the aforementioned variables its the definition of MasonryWeight_per_ft2 in the nameless area). Mathcad's symbolic can not deal with if statements (you would rather have to use the Heaviside function instead) and so the whole solve expression fails.

You seem to have made precautions to avoid this as you have assigned

1.png

which normally breaks the connection to the original definition of P.u_t6. But because of the unit (an unknown variable to Mathcad's symbolic) the result is not seen as a number but an arithmetic expression and Mathcad will still follow back to the if-statement.

One way to break effectively the connection is to first go for a pure numeric result by dividing through the unit and add it back in a second step:

2.png

This cures the problem but you have to do it for the other variables (psi_t6 and P.u_e_t6) as well.

I knew why I suggested the numeric solve block as the better solution in the last thread 😉

P.S.: You use a lot of conditions using two if statements (if xxx="yes" do this; if xxx="no" do that). Its better to replace the second if by the otherwise statement as that way ALL possible conditions are covered.

SFares
11-Garnet
(To:Werner_E)

Got it. Thanks Werner!

Announcements
Check out the latest
Mathcad Tip
"PTC Mathcad 15 / Prime 1-6 Update."