Mathematica的一道很简单的函数应用题,See the following statement.What does it do?Create a function that takes as input the matrix mat,and then for each element compares it with value \[Tau],and if a value is below \[Tau],it should be set t

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/03 02:18:08
Mathematica的一道很简单的函数应用题,See the following statement.What does it do?Create a function that takes as input the matrix mat,and then for each element compares it with value \[Tau],and if a value is below \[Tau],it should be set t

Mathematica的一道很简单的函数应用题,See the following statement.What does it do?Create a function that takes as input the matrix mat,and then for each element compares it with value \[Tau],and if a value is below \[Tau],it should be set t
Mathematica的一道很简单的函数应用题,
See the following statement.What does it do?Create a function that takes as input the matrix mat,and then for each element compares it with value \[Tau],and if a value is below \[Tau],it should be set to zero,else to 1.
mat = RandomInteger[100,RandomInteger[{15,25},2]]
我自己写的是
Resetlist[l_,x_] :=
For[i = 1,i

Mathematica的一道很简单的函数应用题,See the following statement.What does it do?Create a function that takes as input the matrix mat,and then for each element compares it with value \[Tau],and if a value is below \[Tau],it should be set t
行才有鬼啊,看看mat是几维的列表,还有根本没必要用啰嗦又麻烦的For:
Clear[f]
f[\[Tau]_, m_] := Map[UnitStep[# - \[Tau]] &, m, {2}]
f[5, mat]