Numrical Analysis Summary

Evaluating a polynomial

Direct form:O( n 2 n^2 n2)

P ( x ) = a 0 + a 1 x + a 2 x 2 + . . . + a n x n P(x)=a_0+a_1x+a_2x^2+...+a_nx^n P(x)=a0+a1x+a2x2+...+anxn

Horner’s method:O(n)

P ( x ) = a 0 + x ( a 1 + x ( a 2 + x ∗ ( . . . ( a n − 1 + a n x ) ) ) P(x)=a_0+x(a_1+x(a_2+x*(...(a_{n-1}+a_nx))) P(x)=a0+x(a1+x(a2+x(...(an1+anx)))

Example:求二进制幂O(n)->O( l o g 2 n log_2n log2n)

a n = a p ( 2 ) a^n=a^{p(2)} an=ap(2) = a b m 2 m + . . . + b i 2 i + b 0 =a^{b_m2^m+...+b_i2^i+b_0} =abm2m+...+bi2i+b0
a 2 p + b i = a 2 p ∗ a a^{2p+b_i}=a^{2p}*a a2p+bi=a2pa or a 2 p a^{2p} a2p

Errors

Assume that r is the root of function f(x)=0.
Forward Error: ∣ r − x a ∣ |r-x_a| rxa
Backward Error: f ( x a ) f(x_a) f(xa)
lk

Solving Equations

Newton’s Method
x 0 = i n i t i a l   g u e s s x_0=initial\ guess x0=initial guess
x i + 1 = x i − f ( x i ) f ′ ( x i ) x_{i+1}=x_i-\frac{f(x_i)}{f'(x_i)} xi+1=xif(xi)f(xi)

NaN:not a number

Convex Optimization

Convex combination: ( x , y ) → { α x + β y ∣ α + β = 1 , α , β ≥ 0 } (x,y)\rightarrow\{\alpha x + \beta y|\alpha + \beta =1, \alpha,\beta \geq 0\} (x,y){αx+βyα+β=1,α,β0}

Convex set S: ( x 1 , . . . , x k ) ∈ S (x1, . . . , xk) \in S (x1,...,xk)S, then convex combination of the points x1, . . . , xk should ∈ \in S.

A function f : R n → R R^n \rightarrow R RnR is convex if ∀ x , y \forall x, y x,y and ∀ α ∈ [ 0 , 1 ] \forall \alpha \in [0, 1] α[0,1]

f ( α x + ( 1 − α ) y ) ≤ α f ( x ) + ( 1 − α ) f ( y ) f(\alpha x + (1-\alpha) y) \leq \alpha f(x) + (1-\alpha) f(y) f(αx+(1α)y)αf(x)+(1α)f(y)

20230512172643

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值