L2中的某些特殊函数类的Kolmogorov n-宽度
“carlota”通过精心收集,向本站投稿了6篇L2中的某些特殊函数类的Kolmogorov n-宽度,下面小编给大家带来L2中的某些特殊函数类的Kolmogorov n-宽度,希望能帮助到大家!
篇1:L2中的某些特殊函数类的Kolmogorov n-宽度
L2中的某些特殊函数类的Kolmogorov n-宽度
利用Steklov函数引进了一个新的.连续模.利用这个连续模我们定义了L2中的2个特殊的函数类,并且给出了它们在L2中Kolmogorov n-宽度的精确值.
作 者:耿爱成 刘永平Geng Aicheng Liu Yongping 作者单位:耿爱成,Geng Aicheng(北京师范大学数学科学学院,100875,北京;沈阳工程学院基础部,110136,沈阳)刘永平,Liu Yongping(北京师范大学数学科学学院,100875,北京)
刊 名:北京师范大学学报(自然科学版) ISTIC PKU英文刊名:JOURNAL OF BEIJING NORMAL UNIVERSITY(NATURAL SCIENCE) 年,卷(期): 43(5) 分类号:O1 关键词:Steklov函数 差分 连续模 Kolmogorov n-宽度篇2:关于类成员函数在中的使用
实际工作中模板使用还比较多,而且使用类成员函数或者变量作为模板参数的情况是很多的,在这里先小小举个例子,代码非常简单,但是在实际中确实非常常用,而且实用。
//我只是个测试类而已class TestClass{public: void testFunc(int val){} double testFunc2(double val){return 0;}public: int m_testVal;};//也会用到的写法,在不是模板的情况下还挺实用的typedef void (TestClass::*test_func)(int);//不说boost,不谈lambda,仅仅只提模板而已//成员函数的情况template
篇3:Python中针对函数处理的特殊方法
最近更 新
Python ORM框架SQLAlchemy学习笔记之安装
python ElementTree 基本读操作示例
python命令行参数sys.argv使用示例
pycharm 使用心得(八)如何调用另一文件
python实现问号表达式(?)的方法
Python splitlines使用技巧
python3.3使用tkinter开发猜数字游戏示例
复制粘贴功能的Python程序
python 简易计算器程序,代码就几行
Python 条件判断的缩写方法
热 点 排 行
Python入门教程 超详细1小时学会
python 中文乱码问题深入分析
比较详细Python正则表达式操作指
Python字符串的encode与decode研
Python open读写文件实现脚本
Python enumerate遍历数组示例应
Python 深入理解yield
Python+Django在windows下的开发
python 文件和路径操作函数小结
python 字符串split的用法分享
篇4:Lua判断字符串中包含中文字符的方法和计算字符串宽度函数
这篇文章主要介绍了Lua判断字符串中包含中文字符的方法和计算字符串宽度函数分享,需要的朋友可以参考下
一、判断字符串中包含中文字符的方法
遍历数组,对每个字节使用string.byte,发现有大于127的,就是汉字,可以参照下面的代码,
二、计算字符串宽度函数
代码如下:
-- 计算字符串宽度
local str = “Jimmy: 你好,世界!”
local fontSize = 20
local lenInByte = #str
local width = 0
for i=1,lenInByte do
local curByte = string.byte(str, i)
local byteCount = 1;
if curByte>0 and curByte<=127 then
byteCount = 1
elseif curByte>=192 and curByte<223 then
byteCount = 2
elseif curByte>=224 and curByte<239 then
byteCount = 3
elseif curByte>=240 and curByte<=247 then
byteCount = 4
end
local char = string.sub(str, i, i+byteCount-1)
i = i + byteCount -1
if byteCount == 1 then
width = width + fontSize * 0.5
else
width = width + fontSize
print(char)
end
end
print(“总宽度: ”..width)
篇5:Python中的对象,方法,类,实例,函数用法分析
Python是一个完全面向对象的语言。不仅实例是对象,类,函数,方法也都是对象。
代码如下:
class Foo(object):
static_attr = True
def method(self):
pass
foo = Foo()
这段代码实际上创造了两个对象,Foo和foo。而Foo同时又是一个类,foo是这个类的实例。
在C++里类型定义是在编译时完成的,被储存在静态内存里,不能轻易修改。在Python里类型本身是对象,和实例对象一样储存在堆中,对于解释器来说类对象和实例对象没有根本上的区别。
在Python中每一个对象都有自己的命名空间。空间内的变量被存储在对象的__dict__里。这样,Foo类有一个__dict__, foo实例也有一个__dict__,但这是两个不同的命名空间。
所谓“定义一个类”,实际上就是先生成一个类对象,然后执行一段代码,但把执行这段代码时的本地命名空间设置成类的__dict__. 所以你可以写这样的代码:
代码如下:
>>>class Foo(object):
... bar = 1 + 1
... qux = bar + 1
... print “bar: ”, bar
... print “qux: ”, qux
... print locals()
...
bar: 2
qux: 3
{‘qux‘: 3, ‘__module__‘: ‘__main__‘, ‘bar‘: 2}
>>>print Foo.bar, Foo.__dict__[‘bar‘]
2 2
>>>print Foo.qux, Foo.__dict__[‘qux‘]
3 3
所谓“定义一个函数”,实际上也就是生成一个函数对象。而“定义一个方法”就是生成一
个函数对象,并把这个对象放在一个类的__dict__中。下面两种定义方法的形式是等价的:
代码如下:
>>>class Foo(object):
... def bar(self):
... return 2
...
>>>def qux(self):
... return 3
...
>>>Foo.qux = qux
>>>print Foo.bar, Foo.__dict__[‘bar‘]
>>>print Foo.qux, Foo.__dict__[‘qux‘]
>>>foo = Foo()
>>>foo.bar()
2
>>>foo.qux()
3
而类继承就是简单地定义两个类对象,各自有不同的__dict__:
代码如下:
>>>class Cheese(object):
... smell = ‘good‘
... taste = ‘good‘
...
>>>class Stilton(Cheese):
... smell = ‘bad‘
...
>>>print Cheese.smell
good
>>>print Cheese.taste
good
>>>print Stilton.smell
bad
>>>print Stilton.taste
good
>>>print ‘taste‘ in Cheese.__dict__
True
>>>print ‘taste‘ in Stilton.__dict__
False
复杂的地方在`.`这个运算符上。对于类来说,Stilton.taste的意思是“在Stilton.__dict__中找‘taste‘. 如果没找到,到父类Cheese的__dict__里去找,然后到父类的父类,等等。如果一直到object仍没找到,那么扔一个AttributeError.”
实例同样有自己的__dict__:
代码如下:
>>>class Cheese(object):
... smell = ‘good‘
... taste = ‘good‘
... def __init__(self, weight):
... self.weight = weight
... def get_weight(self):
... return self.weight
...
>>>class Stilton(Cheese):
... smell = ‘bad‘
...
>>>stilton = Stilton(‘100g‘)
>>>print ‘weight‘ in Cheese.__dict__
False
>>>print ‘weight‘ in Stilton.__dict__
False
>>>print ‘weight‘ in stilton.__dict__
True
不管__init__()是在哪儿定义的, stilton.__dict__与类的__dict__都无关。
Cheese.weight和Stilton.weight都会出错,因为这两个都碰不到实例的命名空间。而
stilton.weight的查找顺序是stilton.__dict__ =>Stilton.__dict__ =>
Cheese.__dict__ =>object.__dict__. 这与Stilton.taste的查找顺序非常相似,仅仅是
在最前面多出了一步。
方法稍微复杂些。
代码如下:
>>>print Cheese.__dict__[‘get_weight‘]
>>>print Cheese.get_weight
>>>print stilton.get_weight
<__main__.Stilton object at 0x7ff820669190>>
我们可以看到点运算符把function变成了unbound method. 直接调用类命名空间的函数和点
运算返回的未绑定方法会得到不同的错误:
代码如下:
>>>Cheese.__dict__[‘get_weight‘]()
Traceback (most recent call last):
File “”, line 1, in
TypeError: get_weight() takes exactly 1 argument (0 given)
>>>Cheese.get_weight()
Traceback (most recent call last):
File “”, line 1, in
TypeError: unbound method get_weight() must be called with Cheese instance as
first argument (got nothing instead)
但这两个错误说的是一回事,实例方法需要一个实例,
所谓“绑定方法”就是简单地在调用方法时把一个实例对象作为第一个参数。下面这些调用方法是等价的:
代码如下:
>>>Cheese.__dict__[‘get_weight‘](stilton)
‘100g‘
>>>Cheese.get_weight(stilton)
‘100g‘
>>>Stilton.get_weight(stilton)
‘100g‘
>>>stilton.get_weight()
‘100g‘
最后一种也就是平常用的调用方式,stilton.get_weight(),是点运算符的另一种功能,将stilton.get_weight()翻译成stilton.get_weight(stilton).
这样,方法调用实际上有两个步骤。首先用属性查找的规则找到get_weight, 然后将这个属性作为函数调用,并把实例对象作为第一参数。这两个步骤间没有联系。比如说你可以这样试:
代码如下:
>>>stilton.weight()
Traceback (most recent call last):
File “”, line 1, in
TypeError: ‘str‘ object is not callable
先查找weight这个属性,然后将weight做为函数调用。但weight是字符串,所以出错。要注意在这里属性查找是从实例开始的:
代码如下:
>>>stilton.get_weight = lambda : ‘200g‘
>>>stilton.get_weight()
‘200g‘
但是
代码如下:
>>>Stilton.get_weight(stilton)
‘100g‘
Stilton.get_weight的查找跳过了实例对象stilton,所以查找到的是没有被覆盖的,在Cheese中定义的方法。
getattr(stilton, ‘weight‘)和stilton.weight是等价的。类对象和实例对象没有本质区别,getattr(Cheese, ‘smell‘)和Cheese.smell同样是等价的。getattr()与点运算符相比,好处是属性名用字符串指定,可以在运行时改变。
__getattribute__()是最底层的代码。如果你不重新定义这个方法,object.__getattribute__()和type.__getattribute__()就是getattr()的具体实现,前者用于实例,后者用以类。换句话说,stilton.weight就是object.__getattribute__(stilton, ‘weight‘). 覆盖这个方法是很容易出错的。比如说点运算符会导致无限递归:
代码如下:
def __getattribute__(self, name):
return self.__dict__[name]
__getattribute__()中还有其它的细节,比如说descriptor protocol的实现,如果重写很容易搞错。
__getattr__()是在__dict__查找没找到的情况下调用的方法。一般来说动态生成属性要用这个,因为__getattr__()不会干涉到其它地方定义的放到__dict__里的属性。
代码如下:
>>>class Cheese(object):
... smell = ‘good‘
... taste = ‘good‘
...
>>>class Stilton(Cheese):
... smell = ‘bad‘
... def __getattr__(self, name):
... return ‘Dynamically created attribute “%s”‘ % name
...
>>>stilton = Stilton()
>>>print stilton.taste
good
>>>print stilton.weight
Dynamically created attribute “weight”
>>>print ‘weight‘ in stilton.__dict__
False
由于方法只不过是可以作为函数调用的属性,__getattr__()也可以用来动态生成方法,但同样要注意无限递归:
代码如下:
>>>class Cheese(object):
... smell = ‘good‘
... taste = ‘good‘
... def __init__(self, weight):
... self.weight = weight
...
>>>class Stilton(Cheese):
... smell = ‘bad‘
... def __getattr__(self, name):
... if name.startswith(‘get_‘):
... def func():
... return getattr(self, name[4:])
... return func
... else:
... if hasattr(self, name):
... return getattr(self, name)
... else:
... raise AttributeError(name)
...
>>>stilton = Stilton(‘100g‘)
>>>print stilton.weight
100g
>>>print stilton.get_weight
>>>print stilton.get_weight()
100g
>>>print stilton.age
Traceback (most recent call last):
File “”, line 1, in
File “”, line 12, in __getattr__
AttributeError: age
希望本文所述对大家的Python程序设计有所帮助。
篇6:what在高中英语中的某些特殊用法 (人教版高三英语下册教学论文)
what在高中英语中的某些特殊用法
what在英语中是个很常用的词。我们知道它能用作疑问词,引导特殊疑问句,在句中做主语﹑表语或宾语;又能用作连接代词(或复合关系代词),引导主语从句﹑表语从句或宾语从句;还能用作疑问形容词,只作定语并可表示感叹。对于这些常规的用法本文就不一一赘述,现就what在高中英语中的某些特殊用法归纳如下:
1. what = just as,意为“恰像,犹如,好比”用作连词,引导比较状语从句。(见新编高二英语上册p.21)
⑴ 惯用句式是:A is to B what C is to D. 意为“A对B而言正如C对D一样”例如:
① Air is to us What water is to fish. 空气对于我们犹如水对于鱼。(介词to 表示两者的关系)
⑵ 也有“A is for B what C is for D.”句式。例如:
② Poultry is for the cook what canvas is for the paint. 厨师离不了家禽正如画家离不开画布一样。(介词for表示“供…使用”)
⑶ what 引导的从句也可以放在句首,其句式是: What C is to D,that A is to B.(= A is to B what C is to D.)
在这一结构中,喻体在前,主体在后,相当于“just as…,so…”结构,意思也是“A对B而言正如C对D一样”例如:
What blood vessel is to a man's body,that railway is to transportation.(=Just as blood vessel is to a man's body ,so Railway is to transportation.)
铁路对于运输,好比血管对于人体一样。
2. what 与do with连用,意为“(怎样)处理﹑安排或对付等”。what常有较灵活的翻译,常用结构是:“what …do with sth./sb.?”或“what to do with sth./sb.” 例如:
① What will you do with the letter? 你将把那封信怎样处理?
② The kids do not know what to do with themselves on rainy days.
孩子们不知道雨天干什么好。
注意:do with 与deal with同义,但搭配不同:do with只能与what搭配,而deal with可与不同的疑问词搭配。比较:
③ How will you deal with the letter?你将那封信怎样处理?
④ You may have some idea of what the astronauts have to deal with if you try to drink a glass of water while standing on your head or while just lying down.
如果你试着倒立着或仅以躺着的姿势去喝水,就能大致体会得到宇航员必须应付什么了。
3. 问价格﹑度量﹑速度、人口﹑面积﹑门牌(汽车﹑电话等)号码等时,只能用what提问,不能用how much提问。例如:
① What is the cost(price)of the gold watch?这块金表多少钱?
② What is the speed of the car?车速是多少?
③ What is the length(width﹑depth)of the lake?这湖有多长(宽、深)?
④ What is the population(area)of China?中国的人口(面积)有多少(大)?
⑤ What money(cash) have you got? 你有多少钱(现金)?
⑥ What is your telephone (car、room)number?
你的电话(汽车﹑房间)号码是多少?
4.“What is …like?”的两种含义。
⑴ 表示“情况怎样”,多指天气或气候。例如:
① What is the weather like today?今天天气怎样?
② What is the climate like there?那里的气候怎样?
⑵ 表示“像什么样,什么模样,怎样的” 指人或事物。例如:
③ What is the camel like ?骆驼是什么样子的?
④ - What is your teacher like?- She is very kind and beautiful.
“你老师是怎样一个人?”--“她既善良又美丽。”
⑤ What will life be like in the future ? 未来的生活是什么样子呢?
注意:“What is…like?”通常用于对某人、某地和某物的实际情况提问,包括对其内在的品质或外在的特征(或持久的特征)提问。而“How is … like?”是就某人、某地和某物的外观询问对方的看法,可以用来询问变化的事物,如暂时的情况,情绪等,还常用来问候别人的健康。如:
⑥ How is your work these days?近来你的工作情况如何?
⑦ How is he? 他近况如何? (他身体近来怎么样?)
比较:What does she look like?她是什么模样?(What… look like?只能指外表 )
5.“What do you think of…?”用于询问对方对……的看法或评价。例如:
① What do you think of the idea?你认为这个主意怎样?
② What did you think of that film?你对那场电影评价如何?
注意:“ What do you think of…?”是惯用搭配,不能改为“How do you think of…?”。但我们可以说:How do you feel about the idea(that film)?或者How do you like the idea(that film)?
6.what 用作复合关系代词时,既可指代人又可指代物。例如:
① China is no longer what it used to be? 中国已不是过去的中国
② She is what you call a “bluestocking”。 她就是你说的“女才子”。
③ She is not what she was five years ago. 她不再是5年前的她了。
7. what从句可用作宾语补足语或状语。例如:
① We will make the factory twice what it is today. 我们将使工厂比现在规模增加一倍。(句中的twice what it is today是动词make的宾语the factory的补足语)
② Gravity is what makes you weigh what you weigh. 地心吸引力使人称得现有的重量(句中的第一个what到句末为表语从句;句末的what you weigh 是说明前面的动词weigh,系回答how much 的问题,作状语)
8.像how和why一样,what可以用作名词。例如:
① Please explain to us how and why,since you know what. 既然你想出一个好办法,请给我们解释清楚解决这个问题的方法和理由。
② By asking why,how and what if,curious minds find new ideas and solutions.
通过刨根问底,提出假设,富有求知欲的天才人物想出了新主意,找出了解决问题的新办法。(见新版高二英语上册p.7,what if 可译为:假设)
9.与what连用的常用句型和词组
⑴ What if…?What will or would happen if…?如果(假如)…将会怎么样?例如:
① What if it is true?如果这是真的又怎么样?
② What if a storm should come up?万一发生暴风雨怎么办?
⑵ what with:because of ;as a result of;因为;由于……的结果;例如:
③ What with overwork and (what with)so little sleep,she fell ill.
一半由于工作过度的劳累,一半由于睡眠不足,她病倒了。
④ She has been depressed,what with losing her job and having to move.
她由于丢了工作还要搬家而感到沮丧。
⑶ and what not :and so on ;etc;以及各种其它东西;诸如此类;等等;例如:
⑤ I bought sugar,tea,eggs,and what not. 我买了食糖、茶叶、鸡蛋之类的东西。
⑷ come what will(may)是固定搭配必须倒装,意为“不管发生什么事”“不管怎样”
⑥ Come what will (may),I will always stand by you.
不管发生什么事,我将永远支持你。
责任编辑:李芳芳
【L2中的某些特殊函数类的Kolmogorov n-宽度】相关文章:






文档为doc格式