m1rumath.java

来自「this program is very interesting for to 」· Java 代码 · 共 111 行

JAVA
111
字号
/*
 * M1ruMath.java
 *
 * Created on January 31, 2008, 7:17 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package com.m1ru_soft.kalkulator;

import java.awt.event.WindowListener;

/**
 *
 * @author m1ru
 */
public class M1ruMath {
    
    /** Creates a new instance of M1ruMath */
    public M1ruMath() {
    }
    public static double msinDeg(double x)
    {double y;
     y = x - (pangkatN(x,3)/faktorial(3))+(pangkatN(x,5)/faktorial(5))-(pangkatN(x,7)/faktorial(7));
     return y; 
    }
    public static double msin(double x)
    {if (x<=0.0005)
		 x=x+((x*x*x)/6);
		else
		 x=2*msin(x/2)*mcos(x/2);
		return x; 
    }
        /*
		if (x<=0.0005)
		 x=x+((x*x*x)/6);
		else
		 x=2*msin(x/2)*mcos(x/2);
		return x;
		}*/
    public static double mcosDeg(double x)
    {double y;
     y = 1 - (pangkatN(x,2)/faktorial(2))+(pangkatN(x,4)/faktorial(4))-(pangkatN(x,6)/faktorial(6));
     return y; 
    }
    public static double mcos(double x)
	{
		if (x<=0.0005)
		 x=1-((x*x*x)/2);
		else
		 x=(mcos(x/2)*mcos(x/2))-(msin(x/2)*msin(x/2));
		return x;
	}
    
    public static double mtanDeg(double x)
    {
        double y;
        y = msinDeg(x)/mcosDeg(x);
        return y;
    }
    public static double mctgDeg(double x)
    {
        double y;
        y = mcosDeg(x)/msinDeg(x);
        return y;
    }
    
		public static double invertt(double x)
		{
//konversi dari radian ke degree 			
			double y;
			y=(180*x)/Math.PI;
			return y;
		}

	public static double invert(double x)
	{
//konversi dari degree ke radian 
		double y;
		y=(Math.PI*x)/180;
		return y;
	}
	public static double pangkatN(double x,int y)
	{
		double s;
		s=1;
		for(int i=1;i<=y;i++)
			s=s*x;
		return s;
	}

	public static double pangkat2(double x)
	{
		double s=x*x;
		return s;
	}

	public static long faktorial(int x)
        //fungsi faktorial	
	{
		long t=1;
		for(int i=x;i>0;i--)
			t=i*t;
		return t;
	}
            
}


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?