PIXNET Logo登入

Edison.X. Blog

跳到主文

YouLoveMe() ? LetItBe() : LetMeFree() ;

部落格全站分類:數位生活

  • 相簿
  • 部落格
  • 留言
  • 名片
  • 11月 25 週五 201111:09
  • [C語言數值分析] 複數運算 - 完整程式碼參考


xComplex.h
 
/*******************************************************************/
/*                                                                 */
/*     filename : xComplex.h                                       */
/*     author   : edison.shih/edisonx                              */
/*     compiler : Visual C++ 2008                                  */
/*     date     : 2011.03.07                                       */
/*                                                                 */
/*         A.L.L.     R.I.G.H.T.S.     R.E.S.E.R.V.E.              */
/*                                                                 */
/*******************************************************************/
#ifndef X_COMPLEX_H_
#define X_COMPLEX_H_
typedef struct tagxcompolex{
     double real;
     double img;
}xComplex;
// ---------------------------------
//
加法運算
int comp_add(xComplex *rst,
                const xComplex z1,
                const xComplex z2);
// ---------------------------------
// rst+=z
int comp_adds(xComplex *rst,
                const xComplex z);
// ---------------------------------
//
減法運算
int comp_sub(xComplex *rst,
                const xComplex z1,
                const xComplex z2);
// ---------------------------------
// rst-=z
int comp_subs(xComplex *rst,
                const xComplex z);
// ---------------------------------
//
乘法運算
int comp_mul(xComplex *rst,
                const xComplex z1,
                const xComplex z2);
// ---------------------------------
// rst*=z
int comp_muls(xComplex *rst,
                const xComplex z);
// ---------------------------------
//
除法運算
int comp_div(xComplex *rst,
                const xComplex z1,
                const xComplex z2,
                const double eps);
// ---------------------------------
// rst/=z
int comp_divs(xComplex *rst,
                const xComplex z,
                const double eps);
// ---------------------------------
//
倒數運算
int comp_inv(xComplex *rst,
                const xComplex z,
                const double eps);
// ---------------------------------
// rst = 1/ rst
int comp_invs(xComplex *rst,
                const double eps);
// ---------------------------------
//
負數運算
int comp_neg(xComplex *rst,
                const xComplex z);
// ---------------------------------
// rst = -rst
int comp_negs(xComplex *rst);
// ---------------------------------
//
共軛運算
int comp_conj(xComplex *rst,
                const xComplex z);
// ---------------------------------
//
複數顯示
void comp_dis(const xComplex z);
// ---------------------------------
//
複數比較
int comp_cmp(const xComplex z1,
                const xComplex z2,
                const double eps);
// ---------------------------------
//
模數
double comp_norm(const xComplex z);
// ---------------------------------
//
角度
double comp_sita(const xComplex z);
// ---------------------------------
// n
次根號
int comp_nroot(xComplex* rst,
                   const xComplex z,
                   const int n,
                   const double eps);
// ---------------------------------
// exp(z)
int comp_exp(xComplex *rst,
                const xComplex z);
// ---------------------------------
//
整數次方, pow(z, n)
int comp_pown(xComplex *rst,
                const xComplex z,
                const int n);
// ---------------------------------
// log(z)
int comp_log(xComplex *rst,
                const xComplex z);
// ---------------------------------
//
複數次方, z=pow(z1, z2)
int comp_pow(xComplex *rst,
                const xComplex z1,
                const xComplex z2);
// ---------------------------------
// sin(z)
int comp_sin(xComplex *rst,
                const xComplex z);
// ---------------------------------
// cos(z)
int comp_cos(xComplex *rst,
                const xComplex z);
// ---------------------------------
// sinh(z)
int comp_sinh(xComplex *rst,
                const xComplex z);
// ---------------------------------
// cosh(z)
int comp_cosh(xComplex *rst,
                const xComplex z);
#endif
(繼續閱讀...)
文章標籤

edisonx 發表在 痞客邦 留言(0) 人氣(7,174)

  • 個人分類:複數 Complex
▲top
  • 11月 25 週五 201111:09
  • [C語言數值分析] 複數運算 - 推導與程式碼

 
0. 公用符號與基本假設
 
Complex 在 C++ 已支援非常好, #include <complex> 即可使用,
(繼續閱讀...)
文章標籤

edisonx 發表在 痞客邦 留言(1) 人氣(16,417)

  • 個人分類:複數 Complex
▲top
1

個人資訊

edisonx
暱稱:
edisonx
分類:
數位生活
好友:
累積中
地區:

熱門文章

  • (4,977)多測資處理
  • (21,951)bitset 整理
  • (444,397)[C] printf 引數說明
  • (39,454)[C] scanf 引數說明
  • (49,747)VBA Procedure 簡述
  • (58,119)[浮點數] IEEE754 , C/C++ 浮點數誤差
  • (80,133)[C] 計時器整理
  • (53,329)[Poker] 撲克牌遊戲設計介紹
  • (143,107)C/C++ 學習歷程分享
  • (89,466)[recursive] 遞廻基本題

文章分類

toggle 開發手札 (2)
  • 未實作的想法 (4)
  • 心得筆記 (2)
toggle C/C++ (8)
  • C/C++ Note (52)
  • 亂數 (10)
  • Debug (9)
  • Hidden Features in C (6)
  • OO NOTE (0)
  • 面試題庫 (12)
  • C/C++ FAQ (4)
  • STL Note (3)
toggle 應用軟體/工具 (1)
  • Office (1)
toggle 數值分析 (9)
  • 非線性方程式求解 (10)
  • 矩陣運算 (7)
  • 深入質數 (5)
  • 浮點數 (9)
  • 複數 Complex (2)
  • 積分法 (2)
  • 多項式內差法 (2)
  • 常見關於數 (5)
  • math.h/cmath application (8)
toggle 程式之美 (1)
  • 遊戲之樂 (3)
toggle VB.Net (1)
  • VB.Net Note (1)
toggle 英文 (1)
  • 專題單字 (1)
toggle AutoIt!! (2)
  • AutoIt!! Note (13)
  • Auto-Dll (9)
toggle VBA (4)
  • VBA FAQ (5)
  • VBA Note (9)
  • VBA tec. (1)
  • VBA_Note2 (3)
toggle MFC (1)
  • MFC雜記 (4)
toggle Win32 (8)
  • Process (10)
  • Win32-Console (5)
  • 檔案系統 (1)
  • 音效 (1)
  • 隱喻外掛 (3)
  • System undoc. (0)
  • GDI (2)
  • 記憶體管理 (1)
toggle 環境與Script (4)
  • visual studio (6)
  • 批次檔batch (2)
  • 程式環境架構 (3)
  • Library (3)
toggle 數學整理 (2)
  • 常用公式 (1)
  • 有趣數學 (2)
toggle 演算法 (7)
  • Bit-Hacks (1)
  • AI (13)
  • 大數 (5)
  • 資料結構 (0)
  • 影像 (2)
  • 遞迴-recursive (2)
  • 回溯.列舉.遞迴 (2)
toggle 程設亂語 (1)
  • 胡言亂語 (10)
toggle SmallTalk (1)
  • SmallTalk (27)
  • 未分類文章 (1)

最新文章

  • 轉戰 python
  • [MFC] CArray 注意事項
  • 你真的很狠...
  • [開發手札] tool 整理 <NOTE>
  • [開發手札] vs dll 相容性
  • [開發手札] vc 效率問題
  • [開發手札] 修改 exe 裡面的 constant
  • [開發手札] 受不了 IDE 常當機問題...
  • [Job] Job Journal 130501
  • [面試] some tips

動態訂閱

文章精選

文章搜尋

誰來我家

參觀人氣

  • 本日人氣:
  • 累積人氣:

留言板