User Tools

Site Tools


gams:specify_a_conditional_parameter_assignment_to_avoid_a_division_by_zero_error

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

gams:specify_a_conditional_parameter_assignment_to_avoid_a_division_by_zero_error [2007/09/28 11:47]
127.0.0.1 external edit
gams:specify_a_conditional_parameter_assignment_to_avoid_a_division_by_zero_error [2014/05/22 11:00] (current)
support
Line 1: Line 1:
 ===== How do I specify a conditional parameter assignment to avoid a '​division by zero' error? ===== ===== How do I specify a conditional parameter assignment to avoid a '​division by zero' error? =====
  
-Q: // Given parameters are a(i), b(i). I want to specify:+Q: Given parameters are a(i), b(i). I want to specify:
 <​code>​ <​code>​
  ​parameter c(i) = b(i) / a(i)  if a(i) ~= 0  ​parameter c(i) = b(i) / a(i)  if a(i) ~= 0
-           c(i) = 0            if a(i)  = 0 </​code>​+           c(i) = 0            if a(i)  = 0 
 +</​code>​
  
    
Line 10: Line 11:
 <​code>​ <​code>​
 c(i) = 0; c(i) = 0;
-c(i)$a(i) ​      = b(i)/​a(i);</​code>​+c(i)$a(i) ​      = b(i)/a(i); 
 +</​code>​
  
 You can do this if you don't want to zero the entire c: You can do this if you don't want to zero the entire c:
IMPRESSUM / LEGAL NOTICEPRIVACY POLICY gams/specify_a_conditional_parameter_assignment_to_avoid_a_division_by_zero_error.txt · Last modified: 2014/05/22 11:00 by support