source code metode biseksi

contoh source code metode biseksi matlab oleh Meilany Nonsi Tentua, S. Si, MT.

syms x;
f=input('masukkan persamaan : ');
x1=input('tebak nilai x1 : ');
x2=input('tebak nilai x2 : ');
et=input('masukkan Error Toleransi : ');
fx1=subs(f,x,x1);
    fx2=subs(f,x,x2);
    %uji
    x3=(a+b)/2;
   
    fx3= subs(f,x,x3);
i=1;
disp('   i      x1       x2        f(x1)    f(x2) x3   f(x3)    E');
disp('-------------------------------------------------------------');
 if (fx1*fx2)<0
while e > abs(f3)
    fx1=subs(f,x,x1);
    fx2=subs(f,x,x2);
    x3=(a+b)/2;
    fx3= subs(f,x,x3);
    fprintf('%5.0f %6.0f %6.0f %6.0f %7.2f %7.2f %7.2f %7.2f \n', i, x1, x2, fa, fb,c , fc, e);
    if fx1*fx3 < 0
       x2=x3; %geser kiri
        else  
       x1=x3; %geser kanan
    end  
        i=i+1;
end
end

Introduction to JAVA threads

Simple java thread example retrieved from IBM developerWorks

public class TwoThreads {
    public static class Thread1 extends Thread {
        public void run() {
            System.out.println("A");
            System.out.println("B");
        }
   }

   public static class Thread2 extends Thread {
       public void run() {
          System.out.println("1");
          System.out.println("2");
       }
   }

    public static void main(String[] args) {
        new Thread1().start();
        new Thread2().start();
    }
}

We have no idea in what order the lines will execute, except that “1″ will be printed before “2″ and “A” before “B.” The output could be any one of the following:
Continue reading Introduction to JAVA threads

div in a form or mixing form with div [HTML]

I thought I cant mix between form tag and div tag, I’m talking about HTML. In a basic HTML explanation I thought form tag cant be mixed with other tag than form tag itself. Here’s example of form tag from w3c

<form action="form_action.asp" method="get">
  First name: <input name="fname" type="text" />

  Last name: <input name="lname" type="text" />

  <input type="submit" value="Submit" />
</form>

But I come across to this theme and realize its’ form theme doesn’t include a form tag, how could it be… Continue reading div in a form or mixing form with div [HTML]

debugging php in quick and lightweight environment

Sometimes the debugger, xdebug, zend debugger, aren’t working. So instead debugging, we just spend time to debug the debugger itself.
To debug quickly in php we just need to call exit function with variable or any parameter we want. so the script stop and displaying what exactly in the exit parameter.
Example, suppose you want to know what happen with an array so you just type

<?php
include_once 'some_include.php';

exit("What's this : ".print_r($arr));
?>

that’s all for today.