import java.io.*; public class Exe6_4 { public static double f ( double x) { double value=0; value=1+Math.pow(x,3)+Math.sin(Math.PI*x); return value; } public static void main ( String [] args) throws IOException { double [] FunctionValues = new double[11]; for(int i=0; i<11; i++){ FunctionValues[i] = f(0.1*i); } File file = new File("function_values.txt"); PrintWriter out = new PrintWriter(file); for(int i=0; i<11; i++){ //配列をファイルに書き込む out.println( FunctionValues[i]); } out.close(); System.out.println("Data is saved in function_values.txt"); } // main } // Exe 6_4