title: Java to Swift - How to use math.pow and math.exp in Xcode 6
body: <p>I'm in the process of trying to apply my java code to work under swift language and am running into some issues.</p>
  
  <p>Part of my code in Java makes use of the math.pow(number,power) and math.exp() but I'm not entirely sure of how I would go about using that in swift language.</p>
  
  <p>For example, in Java:</p>
  
  <pre><code>diffAggregate = 0;
  for (kIndex = 0; kIndex &lt; NK_VALUES.length; kIndex ++) {
      diffSegment = NKVALUES[kIndex];
      diffSegment *= Math.pow(rhoR, IK_VALUES[kIndex]);
      diffSegment *= Math.pow(tempR, JK_VALUES[kIndex]);
      iFactor = 0;
      if (LK_VALUES[kIndex] &gt; 0 {
         diffSegment *= Math.exp(-1 * Math.pow(rhoR,LK_VALUES[kIndex]);
         iFactor = LK_VALUES[kIndex] * Math.pow(rhoR, LK_VALUES[kIndex]);
         }
      if (PK_VALUES[kIndex] &gt; 0 {
         diffSegment *= Math.exp(-1 * PK_VALUES[kIndex] * Math.pow(rhoR, 2) - BK_VALUES[kIndex] * Math.pow(tempR - UK_VALUES[kIndex], 2));
         iFactor  = 2 * rhoR * PK_VALUES[kIndex] * (rhoR - 1);
      }
  diffAggregate += (diffSegment * (IK_VALUES[kIndex] - iFactor));
  }
  </code></pre>
  
  <p>Any help would be greatly appreciated! Thank you so much in advance.</p>