Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I solve some equations numerically with FindRoot[] returning a quadruple {1,2,3,4}. Because the solver sometimes do not find any roots depending on parameterization of these equations I select only those replacement rules "full filling" the equations:

Select[rules, ! MemberQ[eqns /. #1, False] &];

My question is the following:

How can I easily calculate the deviation of an application of a replacement rule quadruples containing a False so i can check how "badly" some of my equations are not met. My problem is that as soon as I apply an rule to an equation the result is of type boolean and not numeric - which is needed for calculating the deviation.

To note: I do back substitution of my previous solution into the solver as I'am variating some parameters. (see here)

Thank you for your suggestions!

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

Does the following do what you want?

eqns /. Equal -> Subtract /. rules
share|improve this answer
    
this returns Null if I apply my false rules. It also throws me following error message: Set::write –  Martin Scherer May 20 '12 at 19:37
    
Strange. Maybe you should post (in simplified form, but with the essential structure intact) what your equations and rules actually look like (if your equations really are equations, and your rules are of the form var -> value, there should be no way to trigger Set::write – did you happen to use = instead of == somewhere?). –  celtschk May 20 '12 at 19:42
    
i added the semicolon inside my module inside of a Print containing your statement. It works perfectly - thank you –  Martin Scherer May 20 '12 at 19:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.