zoukankan      html  css  js  c++  java
  • 3.9

    
    package main
    
    import (
    	"fmt"
    	"math/cmplx"
    )
    
    func main() {
    
    	// complex numbers are
    	// defined as real and imaginary
    	// part defined by float64
    	a := complex(2, 3)
    
    	fmt.Printf("Real part: %f 
    ", real(a))
    	fmt.Printf("Complex part: %f 
    ", imag(a))
    
    	b := complex(6, 4)
    
    	// All common
    	// operators are useful
    	c := a - b
    	fmt.Printf("Difference : %v
    ", c)
    	c = a + b
    	fmt.Printf("Sum : %v
    ", c)
    	c = a * b
    	fmt.Printf("Product : %v
    ", c)
    	c = a / b
    	fmt.Printf("Product : %v
    ", c)
    
    	conjugate := cmplx.Conj(a)
    	fmt.Println("Complex number a's conjugate : ", conjugate)
    
    	cos := cmplx.Cos(b)
    	fmt.Println("Cosine of b : ", cos)
    
    }
    
    /*
    package main
    
    import (
    	"fmt"
    	"math/cmplx"
    )
    
    func main() {
    
    	// complex numbers are
    	// defined as real and imaginary
    	// part defined by float64
    	a := complex(2, 3)
    
    	fmt.Printf("Real part: %f 
    ", real(a))
    	fmt.Printf("Complex part: %f 
    ", imag(a))
    
    	b := complex(6, 4)
    
    	// All common
    	// operators are useful
    	c := a - b
    	fmt.Printf("Difference : %v
    ", c)
    	c = a + b
    	fmt.Printf("Sum : %v
    ", c)
    	c = a * b
    	fmt.Printf("Product : %v
    ", c)
    	c = a / b
    	fmt.Printf("Product : %v
    ", c)
    
    	conjugate := cmplx.Conj(a)
    	fmt.Println("Complex number a's conjugate : ", conjugate)
    
    	cos := cmplx.Cos(b)
    	fmt.Println("Cosine of b : ", cos)
    
    }
    
    */
    
    
  • 相关阅读:
    oracle--单表查询
    oracle--本地网络配置tnsnames.ora和监听器listener.ora
    HDU1251统计难题(字典树Trie Tree好题)
    模板——字典树Trie Tree
    51nod——1277 字符串中的最大值
    KMP——hdu 3336 count the string
    KMP模板
    KMP——Game
    BFS——Weed
    DFS——Sum It Up
  • 原文地址:https://www.cnblogs.com/zrdpy/p/8620796.html
Copyright © 2011-2022 走看看