Rate Equation(レート方程式)
<html>
<body>
<form action = "<?php echo $_SERVER['PHP_SELF']?>" method="post">
<font size=4>Group:
<select name = "group">
<option value="SCHOTT" selected> SCHOTT
<option value="OHARA"> OHARA
</select><br>
Material:
<select name = "Material">
<option value="N-FK5" > N-FK5
<option value="N-BK7" selected > N-BK7
</select><br>
</font>
<font size=4>Wavelength : <input type="text" name="Wl" value="0.5"> um (0.3~2.5um)<br></font>
<input type="submit" name="submit" value="send">
</form>
<pre>
<?php
include("jpgraph/jpgraph.php");
include("jpgraph/jpgraph_line.php");
if($_POST['submit']){
if(($fp=fopen("indexdata.txt","r"))!=false){
while(($text = fgets($fp))!=false){
// echo $text."\n";
list($material,$c1,$c2,$c3,$c4,$c5,$c6) = sscanf($text,"%s %f %f %f %f %f %f");
if($material == $_POST["Material"]){
//calculating refractive index
$Refindex = sqrt(1+$c1*pow($_POST["Wl"],2)/(pow($_POST["Wl"],2)-$c2)+$c3*pow($_POST["Wl"],2)/(pow($_POST["Wl"],2)-$c4)+$c5*pow($_POST["Wl"],2)/(pow($_POST["Wl"],2)-$c6));
echo "<font size = 4>";
echo "Refractive index"."\n";
echo "n =".$Refindex."\n";
echo "</font>";
//drawing refractive index
$i=0;
for($wl=0.3;$wl<2.5;$wl=$wl+0.1){
$awl[$i]=$wl;
$ari[$i]=sqrt(1+$c1*pow($wl,2)/(pow($wl,2)-$c2)+$c3*pow($wl,2)/(pow($wl,2)-$c4)+$c5*pow($wl,2)/(pow($wl,2)-$c6));
$i++;
}
// print_r($awl);
// print_r($ari);
//graph作成
$graph = new Graph(650,250);
$graph ->SetScale("textlin");
$graph ->SetFrame(false);
$graph ->title->Set('Refractive index');
//線graphのインスタンス生成
$lineplot = new LinePlot($ari);
$lineplot->SetLegend('Line');
//線グラフの線の色を設定
$lineplot->SetColor("red");
//graphに線グラフを追加
$graph -> add($lineplot);
$graph ->Stroke();
}
}
}else{
print('fail to road your file');
}
}
?>
</pre>
</body>
</html>